From c1a8b6dfd1f105a1e9f151b0fafecc928c2d0e8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Fri, 21 Aug 2020 08:58:34 +0200 Subject: [PATCH 3/4] windows.gaming.input: Implement IGamepadStatics stubs. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: RĂ©mi Bernon --- .../windows.gaming.input_main.c | 358 ++++++++++++++++++ include/objidl.idl | 9 + loader/wine.inf.in | 1 + 3 files changed, 368 insertions(+) diff --git a/dlls/windows.gaming.input.dll/windows.gaming.input_main.c b/dlls/windows.gaming.input.dll/windows.gaming.input_main.c index f345fbffb5..44ad92980e 100644 --- a/dlls/windows.gaming.input.dll/windows.gaming.input_main.c +++ b/dlls/windows.gaming.input.dll/windows.gaming.input_main.c @@ -20,9 +20,140 @@ static const char *debugstr_hstring(HSTRING hstr) return wine_dbgstr_wn(str, len); } +DEFINE_GUID(IID_IGamepadStatics,0x8bbce529,0xd49c,0x39e9,0x95,0x60,0xe4,0x7d,0xde,0x96,0xb7,0xc8); + +typedef struct EventRegistrationToken +{ + __int64 value; +} EventRegistrationToken; + +typedef struct IVectorView IVectorView; + +typedef struct IVectorViewVtbl +{ + /*** IUnknown methods ***/ + HRESULT (STDMETHODCALLTYPE *QueryInterface)( + IVectorView *This, + REFIID riid, + void **ppvObject); + + ULONG (STDMETHODCALLTYPE *AddRef)( + IVectorView *This); + + ULONG (STDMETHODCALLTYPE *Release)( + IVectorView *This); + + /*** IInspectable methods ***/ + HRESULT (STDMETHODCALLTYPE *GetIids)( + IVectorView *This, + ULONG *iidCount, + IID **iids); + + HRESULT (STDMETHODCALLTYPE *GetRuntimeClassName)( + IVectorView *This, + HSTRING *className); + + HRESULT (STDMETHODCALLTYPE *GetTrustLevel)( + IVectorView *This, + TrustLevel *trustLevel); + + /*** IVectorView methods ***/ + HRESULT (STDMETHODCALLTYPE *GetAt)( + IVectorView *This, + ULONG index, + /* T */ void *out_value); + + HRESULT (STDMETHODCALLTYPE *get_Size)( + IVectorView *This, + ULONG *out_value); + + HRESULT (STDMETHODCALLTYPE *IndexOf)( + IVectorView *This, + /* T */ void *value, + ULONG *index, + BOOLEAN *out_value); + + HRESULT (STDMETHODCALLTYPE *GetMany)( + IVectorView *This, + ULONG start_index, + /* T[] */ void **items, + UINT *out_value); +} IVectorViewVtbl; + +struct IVectorView +{ + CONST_VTBL IVectorViewVtbl* lpVtbl; +}; + +typedef struct IGamepadStatics IGamepadStatics; + +typedef struct IGamepadStaticsVtbl +{ + BEGIN_INTERFACE + + /*** IUnknown methods ***/ + HRESULT (STDMETHODCALLTYPE *QueryInterface)( + IGamepadStatics *This, + REFIID riid, + void **ppvObject); + + ULONG (STDMETHODCALLTYPE *AddRef)( + IGamepadStatics *This); + + ULONG (STDMETHODCALLTYPE *Release)( + IGamepadStatics *This); + + /*** IInspectable methods ***/ + HRESULT (STDMETHODCALLTYPE *GetIids)( + IGamepadStatics *This, + ULONG *iidCount, + IID **iids); + + HRESULT (STDMETHODCALLTYPE *GetRuntimeClassName)( + IGamepadStatics *This, + HSTRING *className); + + HRESULT (STDMETHODCALLTYPE *GetTrustLevel)( + IGamepadStatics *This, + TrustLevel *trustLevel); + + /*** IGamepadStatics methods ***/ + HRESULT (STDMETHODCALLTYPE *eventadd_GamepadAdded)( + IGamepadStatics *This, + /* Windows.Foundation.EventHandler */ + void *value, + EventRegistrationToken* token); + HRESULT (STDMETHODCALLTYPE *eventremove_GamepadAdded)( + IGamepadStatics *This, + EventRegistrationToken token); + + HRESULT (STDMETHODCALLTYPE *eventadd_GamepadRemoved)( + IGamepadStatics *This, + /* Windows.Foundation.EventHandler */ + void *value, + EventRegistrationToken* token); + HRESULT (STDMETHODCALLTYPE *eventremove_GamepadRemoved)( + IGamepadStatics *This, + EventRegistrationToken token); + + HRESULT (STDMETHODCALLTYPE *get_Gamepads)( + IGamepadStatics *This, + /* Windows.Foundation.Collections.IVectorView* */ + void **value); + + END_INTERFACE +} IGamepadStaticsVtbl; + +struct IGamepadStatics +{ + CONST_VTBL IGamepadStaticsVtbl* lpVtbl; +}; + struct windows_gaming_input { IActivationFactory IActivationFactory_iface; + IGamepadStatics IGamepadStatics_iface; + IVectorView IVectorView_iface; LONG refcount; }; @@ -31,10 +162,235 @@ static inline struct windows_gaming_input *impl_from_IActivationFactory(IActivat return CONTAINING_RECORD(iface, struct windows_gaming_input, IActivationFactory_iface); } +static inline struct windows_gaming_input *impl_from_IGamepadStatics(IGamepadStatics *iface) +{ + return CONTAINING_RECORD(iface, struct windows_gaming_input, IGamepadStatics_iface); +} + +static inline struct windows_gaming_input *impl_from_IVectorView(IVectorView *iface) +{ + return CONTAINING_RECORD(iface, struct windows_gaming_input, IVectorView_iface); +} + +static HRESULT STDMETHODCALLTYPE vector_view_QueryInterface( + IVectorView *iface, REFIID iid, void **object) +{ + TRACE("iface %p, iid %s, object %p stub!\n", iface, debugstr_guid(iid), object); + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); + *object = NULL; + return E_NOINTERFACE; +} + +static ULONG STDMETHODCALLTYPE vector_view_AddRef( + IVectorView *iface) +{ + struct windows_gaming_input *impl = impl_from_IVectorView(iface); + ULONG rc = InterlockedIncrement(&impl->refcount); + TRACE("%p increasing refcount to %u.\n", impl, rc); + return rc; +} + +static ULONG STDMETHODCALLTYPE vector_view_Release( + IVectorView *iface) +{ + struct windows_gaming_input *impl = impl_from_IVectorView(iface); + ULONG rc = InterlockedDecrement(&impl->refcount); + TRACE("%p decreasing refcount to %u.\n", impl, rc); + return rc; +} + +static HRESULT STDMETHODCALLTYPE vector_view_GetIids( + IVectorView *iface, ULONG *iid_count, IID **iids) +{ + FIXME("iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE vector_view_GetRuntimeClassName( + IVectorView *iface, HSTRING *class_name) +{ + FIXME("iface %p, class_name %p stub!\n", iface, class_name); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE vector_view_GetTrustLevel( + IVectorView *iface, TrustLevel *trust_level) +{ + FIXME("iface %p, trust_level %p stub!\n", iface, trust_level); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE vector_view_GetAt( + IVectorView *iface, ULONG index, void *out_value) +{ + FIXME("iface %p, index %#x, out_value %p stub!\n", iface, index, out_value); + return S_OK; +} + +static HRESULT STDMETHODCALLTYPE vector_view_get_Size( + IVectorView *iface, ULONG *out_value) +{ + FIXME("iface %p, out_value %p stub!\n", iface, out_value); + *out_value = 0; + return S_OK; +} + +static HRESULT STDMETHODCALLTYPE vector_view_IndexOf( + IVectorView *iface, void *value, ULONG *index, BOOLEAN *out_value) +{ + FIXME("iface %p, value %p, index %p, out_value %p stub!\n", iface, value, index, out_value); + *out_value = FALSE; + return S_OK; +} + +static HRESULT STDMETHODCALLTYPE vector_view_GetMany( + IVectorView *iface, ULONG start_index, void **items, UINT *out_value) +{ + FIXME("iface %p, start_index %#x, items %p, out_value %p stub!\n", iface, start_index, items, out_value); + *out_value = 0; + return S_OK; +} + +static const struct IVectorViewVtbl vector_view_vtbl = +{ + vector_view_QueryInterface, + vector_view_AddRef, + vector_view_Release, + /* IInspectable methods */ + vector_view_GetIids, + vector_view_GetRuntimeClassName, + vector_view_GetTrustLevel, + /*** IVectorView methods ***/ + vector_view_GetAt, + vector_view_get_Size, + vector_view_IndexOf, + vector_view_GetMany, +}; + +static HRESULT STDMETHODCALLTYPE gamepad_statics_QueryInterface( + IGamepadStatics *iface, REFIID iid, void **object) +{ + TRACE("iface %p, iid %s, object %p stub!\n", iface, debugstr_guid(iid), object); + + if (IsEqualGUID(iid, &IID_IAgileObject)) + { + IUnknown_AddRef(iface); + *object = iface; + return S_OK; + } + + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); + *object = NULL; + return E_NOINTERFACE; +} + +static ULONG STDMETHODCALLTYPE gamepad_statics_AddRef( + IGamepadStatics *iface) +{ + struct windows_gaming_input *impl = impl_from_IGamepadStatics(iface); + ULONG rc = InterlockedIncrement(&impl->refcount); + TRACE("%p increasing refcount to %u.\n", impl, rc); + return rc; +} + +static ULONG STDMETHODCALLTYPE gamepad_statics_Release( + IGamepadStatics *iface) +{ + struct windows_gaming_input *impl = impl_from_IGamepadStatics(iface); + ULONG rc = InterlockedDecrement(&impl->refcount); + TRACE("%p decreasing refcount to %u.\n", impl, rc); + return rc; +} + +static HRESULT STDMETHODCALLTYPE gamepad_statics_GetIids( + IGamepadStatics *iface, ULONG *iid_count, IID **iids) +{ + FIXME("iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE gamepad_statics_GetRuntimeClassName( + IGamepadStatics *iface, HSTRING *class_name) +{ + FIXME("iface %p, class_name %p stub!\n", iface, class_name); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE gamepad_statics_GetTrustLevel( + IGamepadStatics *iface, TrustLevel *trust_level) +{ + FIXME("iface %p, trust_level %p stub!\n", iface, trust_level); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE gamepad_statics_eventadd_GamepadAdded( + IGamepadStatics *iface, void *value, EventRegistrationToken* token) +{ + FIXME("iface %p, value %p, token %p stub!\n", iface, value, token); + return S_OK; +} + +static HRESULT STDMETHODCALLTYPE gamepad_statics_eventremove_GamepadAdded( + IGamepadStatics *iface, EventRegistrationToken token) +{ + FIXME("iface %p, token %#I64x stub!\n", iface, token.value); + return S_OK; +} + +static HRESULT STDMETHODCALLTYPE gamepad_statics_eventadd_GamepadRemoved( + IGamepadStatics *iface, void *value, EventRegistrationToken* token) +{ + FIXME("iface %p, value %p, token %p stub!\n", iface, value, token); + return S_OK; +} + +static HRESULT STDMETHODCALLTYPE gamepad_statics_eventremove_GamepadRemoved( + IGamepadStatics *iface, EventRegistrationToken token) +{ + FIXME("iface %p, token %#I64x stub!\n", iface, token.value); + return S_OK; +} + +static HRESULT STDMETHODCALLTYPE gamepad_statics_get_Gamepads( + IGamepadStatics *iface, void **value) +{ + struct windows_gaming_input *impl = impl_from_IGamepadStatics(iface); + FIXME("iface %p, value %p stub!\n", iface, value); + *value = &impl->IVectorView_iface; + return S_OK; +} + +static const struct IGamepadStaticsVtbl gamepad_statics_vtbl = +{ + gamepad_statics_QueryInterface, + gamepad_statics_AddRef, + gamepad_statics_Release, + /* IInspectable methods */ + gamepad_statics_GetIids, + gamepad_statics_GetRuntimeClassName, + gamepad_statics_GetTrustLevel, + /* IGamepadStatics methods */ + gamepad_statics_eventadd_GamepadAdded, + gamepad_statics_eventremove_GamepadAdded, + gamepad_statics_eventadd_GamepadRemoved, + gamepad_statics_eventremove_GamepadRemoved, + gamepad_statics_get_Gamepads, +}; + static HRESULT STDMETHODCALLTYPE windows_gaming_input_QueryInterface( IActivationFactory *iface, REFIID iid, void **object) { + struct windows_gaming_input *impl = impl_from_IActivationFactory(iface); TRACE("iface %p, iid %s, object %p stub!\n", iface, debugstr_guid(iid), object); + + if (IsEqualGUID(iid, &IID_IGamepadStatics)) + { + IUnknown_AddRef(iface); + *object = &impl->IGamepadStatics_iface; + return S_OK; + } + + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); *object = NULL; return E_NOINTERFACE; } @@ -101,6 +457,8 @@ static const struct IActivationFactoryVtbl activation_factory_vtbl = static struct windows_gaming_input windows_gaming_input = { {&activation_factory_vtbl}, + {&gamepad_statics_vtbl}, + {&vector_view_vtbl}, 0 }; diff --git a/include/objidl.idl b/include/objidl.idl index a86ceb8b1d..cb814f5564 100644 --- a/include/objidl.idl +++ b/include/objidl.idl @@ -37,6 +37,15 @@ typedef struct _COSERVERINFO { /******************** Fundamentals ********************/ +[ + local, + object, + uuid(94ea2b94-e9cc-49e0-c0ff-ee64ca8f5b90) +] +interface IAgileObject : IUnknown +{ +} + [ local, object, diff --git a/loader/wine.inf.in b/loader/wine.inf.in index 8777377002..a5b9e866bd 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -705,6 +705,7 @@ HKLM,%MciExtStr%,"wmx",,"MPEGVideo" HKLM,%MciExtStr%,"wvx",,"MPEGVideo" [Misc] +HKLM,Software\Microsoft\WindowsRuntime\ActivatableClassId\Windows.Gaming.Input.Gamepad,"DllPath",2,"Windows.Gaming.Input.dll" HKLM,Software\Borland\Database Engine\Settings\SYSTEM\INIT,SHAREDMEMLOCATION,,9000 HKLM,Software\Clients\Mail,,2,"Native Mail Client" HKLM,Software\Clients\Mail\Native Mail Client,,2,"Native Mail Client" -- 2.28.0