1 /* WinRT Windows.Security.Credentials.UI Implementation
3 * Copyright (C) 2023 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
23 #include "wine/debug.h"
25 WINE_DEFAULT_DEBUG_CHANNEL(credentials
);
27 struct user_consent_verifier_statics
29 IActivationFactory IActivationFactory_iface
;
30 IUserConsentVerifierStatics IUserConsentVerifierStatics_iface
;
34 static inline struct user_consent_verifier_statics
*impl_from_IActivationFactory( IActivationFactory
*iface
)
36 return CONTAINING_RECORD( iface
, struct user_consent_verifier_statics
, IActivationFactory_iface
);
39 static HRESULT WINAPI
factory_QueryInterface( IActivationFactory
*iface
, REFIID iid
, void **out
)
41 struct user_consent_verifier_statics
*impl
= impl_from_IActivationFactory( iface
);
43 TRACE( "iface %p, iid %s, out %p.\n", iface
, debugstr_guid( iid
), out
);
45 if (IsEqualGUID( iid
, &IID_IUnknown
) ||
46 IsEqualGUID( iid
, &IID_IInspectable
) ||
47 IsEqualGUID( iid
, &IID_IActivationFactory
))
49 *out
= &impl
->IActivationFactory_iface
;
50 IInspectable_AddRef( *out
);
54 if (IsEqualGUID( iid
, &IID_IUserConsentVerifierStatics
))
56 *out
= &impl
->IUserConsentVerifierStatics_iface
;
57 IInspectable_AddRef( *out
);
61 FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid
) );
66 static ULONG WINAPI
factory_AddRef( IActivationFactory
*iface
)
68 struct user_consent_verifier_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
factory_Release( IActivationFactory
*iface
)
76 struct user_consent_verifier_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
factory_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
factory_GetRuntimeClassName( IActivationFactory
*iface
, HSTRING
*class_name
)
90 FIXME( "iface %p, class_name %p stub!\n", iface
, class_name
);
94 static HRESULT WINAPI
factory_GetTrustLevel( IActivationFactory
*iface
, TrustLevel
*trust_level
)
96 FIXME( "iface %p, trust_level %p stub!\n", iface
, trust_level
);
100 static HRESULT WINAPI
factory_ActivateInstance( IActivationFactory
*iface
, IInspectable
**instance
)
102 FIXME( "iface %p, instance %p stub!\n", iface
, instance
);
106 static const struct IActivationFactoryVtbl factory_vtbl
=
108 factory_QueryInterface
,
111 /* IInspectable methods */
113 factory_GetRuntimeClassName
,
114 factory_GetTrustLevel
,
115 /* IActivationFactory methods */
116 factory_ActivateInstance
,
119 DEFINE_IINSPECTABLE( user_consent_verifier_statics
, IUserConsentVerifierStatics
, struct user_consent_verifier_statics
, IActivationFactory_iface
)
121 static HRESULT WINAPI
check_availability_async( IUnknown
*invoker
, IUnknown
*param
, PROPVARIANT
*result
)
124 result
->ulVal
= UserConsentVerifierAvailability_DeviceNotPresent
;
128 static HRESULT WINAPI
user_consent_verifier_statics_CheckAvailabilityAsync( IUserConsentVerifierStatics
*iface
, IAsyncOperation_UserConsentVerifierAvailability
**result
)
130 TRACE( "iface %p, result %p\n", iface
, result
);
131 return async_operation_user_consent_verifier_availability_create( (IUnknown
*)iface
, NULL
, check_availability_async
, result
);
134 static HRESULT WINAPI
user_consent_verifier_statics_RequestVerificationAsync( IUserConsentVerifierStatics
*iface
, HSTRING message
,
135 IAsyncOperation_UserConsentVerificationResult
**result
)
137 FIXME( "iface %p, message %s, result %p stub!\n", iface
, debugstr_hstring( message
), result
);
141 static const struct IUserConsentVerifierStaticsVtbl user_consent_verifier_statics_vtbl
=
143 user_consent_verifier_statics_QueryInterface
,
144 user_consent_verifier_statics_AddRef
,
145 user_consent_verifier_statics_Release
,
146 /* IInspectable methods */
147 user_consent_verifier_statics_GetIids
,
148 user_consent_verifier_statics_GetRuntimeClassName
,
149 user_consent_verifier_statics_GetTrustLevel
,
150 /* IUserConsentVerifierStatics methods */
151 user_consent_verifier_statics_CheckAvailabilityAsync
,
152 user_consent_verifier_statics_RequestVerificationAsync
,
155 static struct user_consent_verifier_statics user_consent_verifier_statics
=
158 {&user_consent_verifier_statics_vtbl
},
162 static IActivationFactory
*user_consent_verifier_factory
= &user_consent_verifier_statics
.IActivationFactory_iface
;
164 HRESULT WINAPI
DllGetClassObject( REFCLSID clsid
, REFIID riid
, void **out
)
166 FIXME( "clsid %s, riid %s, out %p stub!\n", debugstr_guid( clsid
), debugstr_guid( riid
), out
);
167 return CLASS_E_CLASSNOTAVAILABLE
;
170 HRESULT WINAPI
DllGetActivationFactory( HSTRING classid
, IActivationFactory
**factory
)
172 const WCHAR
*buffer
= WindowsGetStringRawBuffer( classid
, NULL
);
174 TRACE( "class %s, factory %p.\n", debugstr_hstring( classid
), factory
);
178 if (!wcscmp( buffer
, RuntimeClass_Windows_Security_Credentials_UI_UserConsentVerifier
))
179 IActivationFactory_QueryInterface( user_consent_verifier_factory
, &IID_IActivationFactory
, (void **)factory
);
181 if (*factory
) return S_OK
;
182 return CLASS_E_CLASSNOTAVAILABLE
;