From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- dlls/windows.system.profile.systemid/main.c | 37 ++++++++++++++++++ .../windows.system.profile.systemid/private.h | 38 +++++++++++++++++++ .../tests/systemid.c | 6 +++ 3 files changed, 81 insertions(+)
diff --git a/dlls/windows.system.profile.systemid/main.c b/dlls/windows.system.profile.systemid/main.c index af55ea204d3..ceacc929622 100644 --- a/dlls/windows.system.profile.systemid/main.c +++ b/dlls/windows.system.profile.systemid/main.c @@ -25,6 +25,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(systemid); struct system_id_statics { IActivationFactory IActivationFactory_iface; + ISystemIdentificationStatics ISystemIdentificationStatics_iface; LONG ref; };
@@ -48,6 +49,13 @@ static HRESULT WINAPI factory_QueryInterface( IActivationFactory *iface, REFIID return S_OK; }
+ if (IsEqualGUID( iid, &IID_ISystemIdentificationStatics )) + { + *out = &impl->ISystemIdentificationStatics_iface; + IInspectable_AddRef( *out ); + return S_OK; + } + FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) ); *out = NULL; return E_NOINTERFACE; @@ -106,9 +114,38 @@ static const struct IActivationFactoryVtbl factory_vtbl = factory_ActivateInstance, };
+DEFINE_IINSPECTABLE( system_id_statics, ISystemIdentificationStatics, struct system_id_statics, IActivationFactory_iface ) + +static HRESULT WINAPI system_id_statics_GetSystemIdForPublisher( ISystemIdentificationStatics *iface, ISystemIdentificationInfo **result ) +{ + FIXME( "iface %p, result %p stub!\n", iface, result ); + return E_NOTIMPL; +} + +static HRESULT WINAPI system_id_statics_GetSystemIdForUser( ISystemIdentificationStatics *iface, __x_ABI_CWindows_CSystem_CIUser *user, ISystemIdentificationInfo **result ) +{ + FIXME( "iface %p, user %p, result %p stub!\n", iface, user, result ); + return E_NOTIMPL; +} + +static const struct ISystemIdentificationStaticsVtbl system_id_statics_vtbl = +{ + system_id_statics_QueryInterface, + system_id_statics_AddRef, + system_id_statics_Release, + /* IInspectable methods */ + system_id_statics_GetIids, + system_id_statics_GetRuntimeClassName, + system_id_statics_GetTrustLevel, + /* ISystemIdentificationStatics methods */ + system_id_statics_GetSystemIdForPublisher, + system_id_statics_GetSystemIdForUser, +}; + static struct system_id_statics system_id_statics = { {&factory_vtbl}, + {&system_id_statics_vtbl}, 1, };
diff --git a/dlls/windows.system.profile.systemid/private.h b/dlls/windows.system.profile.systemid/private.h index b55020a999f..e1a18a958b0 100644 --- a/dlls/windows.system.profile.systemid/private.h +++ b/dlls/windows.system.profile.systemid/private.h @@ -31,3 +31,41 @@
#define WIDL_using_Windows_System_Profile #include "windows.system.profile.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 ) diff --git a/dlls/windows.system.profile.systemid/tests/systemid.c b/dlls/windows.system.profile.systemid/tests/systemid.c index 6e857bf331a..1187b6f438f 100644 --- a/dlls/windows.system.profile.systemid/tests/systemid.c +++ b/dlls/windows.system.profile.systemid/tests/systemid.c @@ -46,6 +46,7 @@ static void check_interface_( unsigned int line, void *obj, const IID *iid, BOOL static void test_SystemIdentification_Statics(void) { static const WCHAR *system_id_statics_name = L"Windows.System.Profile.SystemIdentification"; + ISystemIdentificationStatics *system_id_statics = (void *)0xdeadbeef; IActivationFactory *factory = (void *)0xdeadbeef; HSTRING str = NULL; HRESULT hr; @@ -66,6 +67,11 @@ static void test_SystemIdentification_Statics(void) check_interface( factory, &IID_IInspectable, TRUE ); check_interface( factory, &IID_IAgileObject, FALSE );
+ hr = IActivationFactory_QueryInterface( factory, &IID_ISystemIdentificationStatics, (void **)&system_id_statics ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + + ref = ISystemIdentificationStatics_Release( system_id_statics ); + ok( ref == 2, "got ref %ld.\n", ref ); ref = IActivationFactory_Release( factory ); ok( ref == 1, "got ref %ld.\n", ref ); }