From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- dlls/windows.ui/private.h | 38 ++++++++++++++++++++++++++ dlls/windows.ui/tests/uisettings.c | 17 ++++++++++++ dlls/windows.ui/uisettings.c | 44 ++++++++++++++++++++++++++++++ 3 files changed, 99 insertions(+)
diff --git a/dlls/windows.ui/private.h b/dlls/windows.ui/private.h index 1af5faf152b..60a928ca865 100644 --- a/dlls/windows.ui/private.h +++ b/dlls/windows.ui/private.h @@ -38,4 +38,42 @@
extern IActivationFactory *uisettings_factory;
+#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.ui/tests/uisettings.c b/dlls/windows.ui/tests/uisettings.c index 18603e53d46..c4a67c8eb28 100644 --- a/dlls/windows.ui/tests/uisettings.c +++ b/dlls/windows.ui/tests/uisettings.c @@ -52,7 +52,9 @@ static void check_interface_( unsigned int line, void *obj, const IID *iid, BOOL static void test_UISettings_Statics(void) { static const WCHAR *uisettings_name = L"Windows.UI.ViewManagement.UISettings"; + IUISettings3 *uisettings_statics3; IActivationFactory *factory; + IInspectable *inspectable; HSTRING str; HRESULT hr; LONG ref; @@ -73,6 +75,21 @@ static void test_UISettings_Statics(void) check_interface( factory, &IID_IInspectable, TRUE ); check_interface( factory, &IID_IAgileObject, FALSE );
+ hr = IActivationFactory_QueryInterface( factory, &IID_IInspectable, (void **)&inspectable ); + ok( hr == S_OK, "got hr %#lx\n", hr ); + + hr = IActivationFactory_QueryInterface( factory, &IID_IUISettings3, (void **)&uisettings_statics3 ); + ok( hr == S_OK || broken( hr == E_NOINTERFACE ), "got hr %#lx\n", hr ); + if (FAILED( hr )) + { + win_skip( "IUISettings3 not supported.\n" ); + goto skip_uisettings_statics3; + } + + IUISettings3_Release( uisettings_statics3 ); + +skip_uisettings_statics3: + IInspectable_Release( inspectable ); ref = IActivationFactory_Release( factory ); ok( ref == 1, "got ref %ld.\n", ref ); } diff --git a/dlls/windows.ui/uisettings.c b/dlls/windows.ui/uisettings.c index 1ce1096d708..f2ae024de1b 100644 --- a/dlls/windows.ui/uisettings.c +++ b/dlls/windows.ui/uisettings.c @@ -26,6 +26,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(ui); struct uisettings_statics { IActivationFactory IActivationFactory_iface; + IUISettings3 IUISettings3_iface; LONG ref; };
@@ -49,6 +50,13 @@ static HRESULT WINAPI factory_QueryInterface( IActivationFactory *iface, REFIID return S_OK; }
+ if (IsEqualGUID( iid, &IID_IUISettings3 )) + { + *out = &impl->IUISettings3_iface; + IInspectable_AddRef( *out ); + return S_OK; + } + FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) ); *out = NULL; return E_NOINTERFACE; @@ -107,9 +115,45 @@ static const struct IActivationFactoryVtbl factory_vtbl = factory_ActivateInstance, };
+DEFINE_IINSPECTABLE( statics3, IUISettings3, struct uisettings_statics, IActivationFactory_iface ) + +static HRESULT WINAPI statics3_GetColorValue( IUISettings3 *iface, UIColorType type, Color *value ) +{ + FIXME( "iface %p, type %d, color %p stub!\n", iface, type, value ); + return E_NOTIMPL; +} + +static HRESULT WINAPI statics3_add_ColorValuesChanged( IUISettings3 *iface, ITypedEventHandler_UISettings_IInspectable *handler, EventRegistrationToken *cookie ) +{ + FIXME( "iface %p, handler %p, cookie %p stub!\n", iface, handler, cookie ); + return E_NOTIMPL; +} + +static HRESULT WINAPI statics3_remove_ColorValuesChanged( IUISettings3 *iface, EventRegistrationToken cookie ) +{ + FIXME( "iface %p, cookie %#I64x stub!\n", iface, cookie.value ); + return E_NOTIMPL; +} + +static const struct IUISettings3Vtbl statics3_vtbl = +{ + statics3_QueryInterface, + statics3_AddRef, + statics3_Release, + /* IInspectable methods */ + statics3_GetIids, + statics3_GetRuntimeClassName, + statics3_GetTrustLevel, + /* IUISettings3 methods */ + statics3_GetColorValue, + statics3_add_ColorValuesChanged, + statics3_remove_ColorValuesChanged, +}; + static struct uisettings_statics uisettings_statics = { {&factory_vtbl}, + {&statics3_vtbl}, 1, };