Module: wine Branch: master Commit: c2d0b2fdf21f2f2b8794eea086a3d9eeb1064dea URL: https://gitlab.winehq.org/wine/wine/-/commit/c2d0b2fdf21f2f2b8794eea086a3d9e...
Author: Mohamad Al-Jaf mohamadaljaf@gmail.com Date: Sun Oct 8 00:39:05 2023 -0400
windows.security.credentials.ui.userconsentverifier: Add IUserConsentVerifierStatics stub interface.
---
.../main.c | 38 ++++++++++++++++++++++ .../private.h | 38 ++++++++++++++++++++++ .../tests/verifier.c | 6 ++++ 3 files changed, 82 insertions(+)
diff --git a/dlls/windows.security.credentials.ui.userconsentverifier/main.c b/dlls/windows.security.credentials.ui.userconsentverifier/main.c index 159d58d3a4f..d86601331fb 100644 --- a/dlls/windows.security.credentials.ui.userconsentverifier/main.c +++ b/dlls/windows.security.credentials.ui.userconsentverifier/main.c @@ -27,6 +27,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(credentials); struct user_consent_verifier_statics { IActivationFactory IActivationFactory_iface; + IUserConsentVerifierStatics IUserConsentVerifierStatics_iface; LONG ref; };
@@ -50,6 +51,13 @@ static HRESULT WINAPI factory_QueryInterface( IActivationFactory *iface, REFIID return S_OK; }
+ if (IsEqualGUID( iid, &IID_IUserConsentVerifierStatics )) + { + *out = &impl->IUserConsentVerifierStatics_iface; + IInspectable_AddRef( *out ); + return S_OK; + } + FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) ); *out = NULL; return E_NOINTERFACE; @@ -108,9 +116,39 @@ static const struct IActivationFactoryVtbl factory_vtbl = factory_ActivateInstance, };
+DEFINE_IINSPECTABLE( user_consent_verifier_statics, IUserConsentVerifierStatics, struct user_consent_verifier_statics, IActivationFactory_iface ) + +static HRESULT WINAPI user_consent_verifier_statics_CheckAvailabilityAsync( IUserConsentVerifierStatics *iface, IAsyncOperation_UserConsentVerifierAvailability **result ) +{ + FIXME( "iface %p, result %p stub!\n", iface, result ); + return E_NOTIMPL; +} + +static HRESULT WINAPI user_consent_verifier_statics_RequestVerificationAsync( IUserConsentVerifierStatics *iface, HSTRING message, + IAsyncOperation_UserConsentVerificationResult **result ) +{ + FIXME( "iface %p, message %s, result %p stub!\n", iface, debugstr_hstring( message ), result ); + return E_NOTIMPL; +} + +static const struct IUserConsentVerifierStaticsVtbl user_consent_verifier_statics_vtbl = +{ + user_consent_verifier_statics_QueryInterface, + user_consent_verifier_statics_AddRef, + user_consent_verifier_statics_Release, + /* IInspectable methods */ + user_consent_verifier_statics_GetIids, + user_consent_verifier_statics_GetRuntimeClassName, + user_consent_verifier_statics_GetTrustLevel, + /* IUserConsentVerifierStatics methods */ + user_consent_verifier_statics_CheckAvailabilityAsync, + user_consent_verifier_statics_RequestVerificationAsync, +}; + static struct user_consent_verifier_statics user_consent_verifier_statics = { {&factory_vtbl}, + {&user_consent_verifier_statics_vtbl}, 1, };
diff --git a/dlls/windows.security.credentials.ui.userconsentverifier/private.h b/dlls/windows.security.credentials.ui.userconsentverifier/private.h index e9aa9d1cd96..dc22b85ffab 100644 --- a/dlls/windows.security.credentials.ui.userconsentverifier/private.h +++ b/dlls/windows.security.credentials.ui.userconsentverifier/private.h @@ -35,4 +35,42 @@ #define WIDL_using_Windows_Security_Credentials_UI #include "windows.security.credentials.ui.h"
+#define DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from, iface_mem, expr ) \ + static inline impl_type *impl_from( iface_type *iface ) \ + { \ + return CONTAINING_RECORD( iface, impl_type, iface_mem ); \ + } \ + static HRESULT WINAPI pfx##_QueryInterface( iface_type *iface, REFIID iid, void **out ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_QueryInterface( (IInspectable *)(expr), iid, out ); \ + } \ + static ULONG WINAPI pfx##_AddRef( iface_type *iface ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_AddRef( (IInspectable *)(expr) ); \ + } \ + static ULONG WINAPI pfx##_Release( iface_type *iface ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_Release( (IInspectable *)(expr) ); \ + } \ + static HRESULT WINAPI pfx##_GetIids( iface_type *iface, ULONG *iid_count, IID **iids ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_GetIids( (IInspectable *)(expr), iid_count, iids ); \ + } \ + static HRESULT WINAPI pfx##_GetRuntimeClassName( iface_type *iface, HSTRING *class_name ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_GetRuntimeClassName( (IInspectable *)(expr), class_name ); \ + } \ + static HRESULT WINAPI pfx##_GetTrustLevel( iface_type *iface, TrustLevel *trust_level ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_GetTrustLevel( (IInspectable *)(expr), trust_level ); \ + } +#define DEFINE_IINSPECTABLE( pfx, iface_type, impl_type, base_iface ) \ + DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from_##iface_type, iface_type##_iface, &impl->base_iface ) + #endif diff --git a/dlls/windows.security.credentials.ui.userconsentverifier/tests/verifier.c b/dlls/windows.security.credentials.ui.userconsentverifier/tests/verifier.c index 096696a2a70..39245fd2b14 100644 --- a/dlls/windows.security.credentials.ui.userconsentverifier/tests/verifier.c +++ b/dlls/windows.security.credentials.ui.userconsentverifier/tests/verifier.c @@ -48,6 +48,7 @@ static void check_interface_( unsigned int line, void *obj, const IID *iid ) static void test_UserConsentVerifierStatics(void) { static const WCHAR *user_consent_verifier_statics_name = L"Windows.Security.Credentials.UI.UserConsentVerifier"; + IUserConsentVerifierStatics *user_consent_verifier_statics = NULL; IActivationFactory *factory; HSTRING str; HRESULT hr; @@ -68,6 +69,11 @@ static void test_UserConsentVerifierStatics(void) check_interface( factory, &IID_IUnknown ); check_interface( factory, &IID_IInspectable );
+ hr = IActivationFactory_QueryInterface( factory, &IID_IUserConsentVerifierStatics, (void **)&user_consent_verifier_statics ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + + ref = IUserConsentVerifierStatics_Release( user_consent_verifier_statics ); + ok( ref == 1, "got ref %ld.\n", ref ); ref = IActivationFactory_Release( factory ); ok( ref == 1, "got ref %ld.\n", ref ); }