From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- dlls/windows.ui.xaml/color_helper.c | 30 +++++++++++++++++++++++ dlls/windows.ui.xaml/private.h | 38 +++++++++++++++++++++++++++++ dlls/windows.ui.xaml/tests/xaml.c | 5 ++++ 3 files changed, 73 insertions(+)
diff --git a/dlls/windows.ui.xaml/color_helper.c b/dlls/windows.ui.xaml/color_helper.c index 44e61a829e3..8df93641e0f 100644 --- a/dlls/windows.ui.xaml/color_helper.c +++ b/dlls/windows.ui.xaml/color_helper.c @@ -24,6 +24,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(xaml); struct color_helper_statics { IActivationFactory IActivationFactory_iface; + IColorHelperStatics IColorHelperStatics_iface; LONG ref; };
@@ -48,6 +49,13 @@ static HRESULT WINAPI factory_QueryInterface( IActivationFactory *iface, REFIID return S_OK; }
+ if (IsEqualGUID( iid, &IID_IColorHelperStatics )) + { + *out = &impl->IColorHelperStatics_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,31 @@ static const struct IActivationFactoryVtbl factory_vtbl = factory_ActivateInstance, };
+DEFINE_IINSPECTABLE( color_helper_statics, IColorHelperStatics, struct color_helper_statics, IActivationFactory_iface ) + +static HRESULT WINAPI color_helper_statics_FromArgb( IColorHelperStatics *iface, BYTE a, BYTE r, BYTE g, BYTE b, Color *value ) +{ + FIXME( "iface %p, a %u, r %u, g %u, b %u, value %p stub!\n", iface, a, r, g, b, value ); + return E_NOTIMPL; +} + +static const struct IColorHelperStaticsVtbl color_helper_statics_vtbl = +{ + color_helper_statics_QueryInterface, + color_helper_statics_AddRef, + color_helper_statics_Release, + /* IInspectable methods */ + color_helper_statics_GetIids, + color_helper_statics_GetRuntimeClassName, + color_helper_statics_GetTrustLevel, + /* IColorHelperStatics methods */ + color_helper_statics_FromArgb, +}; + static struct color_helper_statics color_helper_statics = { {&factory_vtbl}, + {&color_helper_statics_vtbl}, 1, };
diff --git a/dlls/windows.ui.xaml/private.h b/dlls/windows.ui.xaml/private.h index 9a60dd7b6f5..e634d159c79 100644 --- a/dlls/windows.ui.xaml/private.h +++ b/dlls/windows.ui.xaml/private.h @@ -39,4 +39,42 @@
extern IActivationFactory *color_helper_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.xaml/tests/xaml.c b/dlls/windows.ui.xaml/tests/xaml.c index 02895e7ed38..c1b5fdfbedd 100644 --- a/dlls/windows.ui.xaml/tests/xaml.c +++ b/dlls/windows.ui.xaml/tests/xaml.c @@ -49,6 +49,7 @@ static void check_interface_( unsigned int line, void *obj, const IID *iid, BOOL static void test_ColorHelper(void) { static const WCHAR *color_helper_statics_name = L"Windows.UI.ColorHelper"; + IColorHelperStatics *color_helper_statics = (void *)0xdeadbeef; IActivationFactory *factory = (void *)0xdeadbeef; HSTRING str; HRESULT hr; @@ -68,6 +69,10 @@ static void test_ColorHelper(void) check_interface( factory, &IID_IInspectable, FALSE ); check_interface( factory, &IID_IAgileObject, TRUE /* Missing on Windows older than 1809v2 */ );
+ hr = IActivationFactory_QueryInterface( factory, &IID_IColorHelperStatics, (void **)&color_helper_statics ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + + IColorHelperStatics_Release( color_helper_statics ); IActivationFactory_Release( factory ); }