1 /* CryptoWinRT Credentials Implementation
3 * Copyright (C) 2022 Mohamad Al-Jaf
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "wine/debug.h"
24 WINE_DEFAULT_DEBUG_CHANNEL(crypto
);
26 struct credentials_statics
28 IActivationFactory IActivationFactory_iface
;
29 IKeyCredentialManagerStatics IKeyCredentialManagerStatics_iface
;
33 static inline struct credentials_statics
*impl_from_IActivationFactory( IActivationFactory
*iface
)
35 return CONTAINING_RECORD( iface
, struct credentials_statics
, IActivationFactory_iface
);
38 static HRESULT WINAPI
credentials_QueryInterface( IActivationFactory
*iface
, REFIID iid
, void **out
)
40 struct credentials_statics
*factory
= impl_from_IActivationFactory( iface
);
42 TRACE( "iface %p, iid %s, out %p.\n", iface
, debugstr_guid( iid
), out
);
44 if (IsEqualGUID( iid
, &IID_IUnknown
) ||
45 IsEqualGUID( iid
, &IID_IInspectable
) ||
46 IsEqualGUID( iid
, &IID_IAgileObject
) ||
47 IsEqualGUID( iid
, &IID_IActivationFactory
))
49 IUnknown_AddRef( iface
);
50 *out
= &factory
->IActivationFactory_iface
;
54 if (IsEqualGUID( iid
, &IID_IKeyCredentialManagerStatics
))
56 IUnknown_AddRef( iface
);
57 *out
= &factory
->IKeyCredentialManagerStatics_iface
;
61 FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid
) );
66 static ULONG WINAPI
credentials_AddRef( IActivationFactory
*iface
)
68 struct credentials_statics
*impl
= impl_from_IActivationFactory( iface
);
69 ULONG ref
= InterlockedIncrement( &impl
->ref
);
70 TRACE( "iface %p increasing refcount to %lu.\n", iface
, ref
);
74 static ULONG WINAPI
credentials_Release( IActivationFactory
*iface
)
76 struct credentials_statics
*impl
= impl_from_IActivationFactory( iface
);
77 ULONG ref
= InterlockedDecrement( &impl
->ref
);
78 TRACE( "iface %p decreasing refcount to %lu.\n", iface
, ref
);
82 static HRESULT WINAPI
credentials_GetIids( IActivationFactory
*iface
, ULONG
*iid_count
, IID
**iids
)
84 FIXME( "iface %p, iid_count %p, iids %p stub!\n", iface
, iid_count
, iids
);
88 static HRESULT WINAPI
credentials_GetRuntimeClassName( IActivationFactory
*iface
, HSTRING
*class_name
)
90 FIXME( "iface %p, class_name %p stub!\n", iface
, class_name
);
94 static HRESULT WINAPI
credentials_GetTrustLevel( IActivationFactory
*iface
, TrustLevel
*trust_level
)
96 FIXME( "iface %p, trust_level %p stub!\n", iface
, trust_level
);
100 static HRESULT WINAPI
credentials_ActivateInstance( IActivationFactory
*iface
, IInspectable
**instance
)
102 FIXME( "iface %p, instance %p stub!\n", iface
, instance
);
106 static const struct IActivationFactoryVtbl factory_vtbl
=
108 credentials_QueryInterface
,
111 /* IInspectable methods */
113 credentials_GetRuntimeClassName
,
114 credentials_GetTrustLevel
,
115 /* IActivationFactory methods */
116 credentials_ActivateInstance
,
119 DEFINE_IINSPECTABLE( credentials_statics
, IKeyCredentialManagerStatics
, struct credentials_statics
, IActivationFactory_iface
);
121 static HRESULT WINAPI
is_supported_async( IUnknown
*invoker
, IUnknown
*param
, PROPVARIANT
*result
)
123 result
->vt
= VT_BOOL
;
124 result
->boolVal
= FALSE
;
128 static HRESULT WINAPI
credentials_statics_IsSupportedAsync( IKeyCredentialManagerStatics
*iface
, IAsyncOperation_boolean
**value
)
130 TRACE( "iface %p, value %p.\n", iface
, value
);
131 return async_operation_boolean_create( (IUnknown
*)iface
, NULL
, is_supported_async
, value
);
134 static HRESULT WINAPI
credentials_statics_RenewAttestationAsync( IKeyCredentialManagerStatics
*iface
, IAsyncAction
**operation
)
136 FIXME( "iface %p, operation %p stub!\n", iface
, operation
);
140 static HRESULT WINAPI
credentials_statics_RequestCreateAsync( IKeyCredentialManagerStatics
*iface
,
141 HSTRING name
, KeyCredentialCreationOption option
, IAsyncOperation_KeyCredentialRetrievalResult
**value
)
143 FIXME( "iface %p, name %s, %d option, %p value stub!\n", iface
, debugstr_hstring(name
), option
, value
);
147 static HRESULT WINAPI
credentials_statics_OpenAsync(IKeyCredentialManagerStatics
*iface
,
148 HSTRING name
, IAsyncOperation_KeyCredentialRetrievalResult
**value
)
150 FIXME( "iface %p, name %s, %p value stub!\n", iface
, debugstr_hstring(name
), value
);
154 static HRESULT WINAPI
credentials_statics_DeleteAsync( IKeyCredentialManagerStatics
*iface
, HSTRING name
, IAsyncAction
**operation
)
156 FIXME( "iface %p, name %s, %p operation stub!\n", iface
, debugstr_hstring(name
), operation
);
160 static const struct IKeyCredentialManagerStaticsVtbl credentials_statics_vtbl
=
162 credentials_statics_QueryInterface
,
163 credentials_statics_AddRef
,
164 credentials_statics_Release
,
165 /* IInspectable methods */
166 credentials_statics_GetIids
,
167 credentials_statics_GetRuntimeClassName
,
168 credentials_statics_GetTrustLevel
,
169 /* IKeyCredentialManagerStatics methods */
170 credentials_statics_IsSupportedAsync
,
171 credentials_statics_RenewAttestationAsync
,
172 credentials_statics_RequestCreateAsync
,
173 credentials_statics_OpenAsync
,
174 credentials_statics_DeleteAsync
,
177 static struct credentials_statics credentials_statics
=
180 {&credentials_statics_vtbl
},
184 IActivationFactory
*credentials_activation_factory
= &credentials_statics
.IActivationFactory_iface
;