From: Zhiyi Zhang <zzhang(a)codeweavers.com> --- dlls/windows.ui.core.textinput/main.c | 32 +++++++++++++++ dlls/windows.ui.core.textinput/private.h | 39 +++++++++++++++++++ .../tests/textinput.c | 1 + 3 files changed, 72 insertions(+) diff --git a/dlls/windows.ui.core.textinput/main.c b/dlls/windows.ui.core.textinput/main.c index b40bdf3cdff..848e6ec421f 100644 --- a/dlls/windows.ui.core.textinput/main.c +++ b/dlls/windows.ui.core.textinput/main.c @@ -25,6 +25,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(coreinputview); struct core_input_view_statics { IActivationFactory IActivationFactory_iface; + ICoreInputViewStatics ICoreInputViewStatics_iface; LONG ref; }; @@ -48,6 +49,13 @@ static HRESULT WINAPI factory_QueryInterface(IActivationFactory *iface, REFIID i return S_OK; } + if (IsEqualGUID(iid, &IID_ICoreInputViewStatics)) + { + *out = &impl->ICoreInputViewStatics_iface; + ICoreInputViewStatics_AddRef(*out); + return S_OK; + } + FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); *out = NULL; return E_NOINTERFACE; @@ -106,9 +114,33 @@ static const struct IActivationFactoryVtbl factory_vtbl = factory_ActivateInstance, }; +DEFINE_IINSPECTABLE(core_input_view_statics, ICoreInputViewStatics, struct core_input_view_statics, + IActivationFactory_iface) + +static HRESULT WINAPI core_input_view_statics_GetForCurrentView(ICoreInputViewStatics *iface, + ICoreInputView **result) +{ + FIXME("iface %p, result %p stub!\n", iface, result); + return E_NOTIMPL; +} + +static const struct ICoreInputViewStaticsVtbl core_input_view_statics_vtbl = +{ + core_input_view_statics_QueryInterface, + core_input_view_statics_AddRef, + core_input_view_statics_Release, + /* IInspectable methods */ + core_input_view_statics_GetIids, + core_input_view_statics_GetRuntimeClassName, + core_input_view_statics_GetTrustLevel, + /* ICoreInputViewStatics methods */ + core_input_view_statics_GetForCurrentView, +}; + static struct core_input_view_statics core_input_view_statics = { {&factory_vtbl}, + {&core_input_view_statics_vtbl}, 1, }; diff --git a/dlls/windows.ui.core.textinput/private.h b/dlls/windows.ui.core.textinput/private.h index dfc22192e31..64093ca9512 100644 --- a/dlls/windows.ui.core.textinput/private.h +++ b/dlls/windows.ui.core.textinput/private.h @@ -29,3 +29,42 @@ #define WIDL_using_Windows_UI_ViewManagement_Core #include "windows.ui.viewmanagement.core.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.ui.core.textinput/tests/textinput.c b/dlls/windows.ui.core.textinput/tests/textinput.c index 30c4e81fe48..6c12aee239e 100644 --- a/dlls/windows.ui.core.textinput/tests/textinput.c +++ b/dlls/windows.ui.core.textinput/tests/textinput.c @@ -63,6 +63,7 @@ static void test_CoreInputViewStatics(void) check_interface(factory, &IID_IUnknown, TRUE); check_interface(factory, &IID_IInspectable, TRUE); check_interface(factory, &IID_IActivationFactory, TRUE); + check_interface(factory, &IID_ICoreInputViewStatics, TRUE); check_interface(factory, &IID_IAgileObject, FALSE); ref = IActivationFactory_Release(factory); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9269