Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/windows.media.speech/tests/Makefile.in | 2 +- .../tests/{statics.c => speech.c} | 52 ++++++++----------- 2 files changed, 22 insertions(+), 32 deletions(-) rename dlls/windows.media.speech/tests/{statics.c => speech.c} (71%)
diff --git a/dlls/windows.media.speech/tests/Makefile.in b/dlls/windows.media.speech/tests/Makefile.in index fad32174647..f3e458f53d1 100644 --- a/dlls/windows.media.speech/tests/Makefile.in +++ b/dlls/windows.media.speech/tests/Makefile.in @@ -2,4 +2,4 @@ TESTDLL = windows.media.speech.dll IMPORTS = uuid
C_SRCS = \ - statics.c + speech.c diff --git a/dlls/windows.media.speech/tests/statics.c b/dlls/windows.media.speech/tests/speech.c similarity index 71% rename from dlls/windows.media.speech/tests/statics.c rename to dlls/windows.media.speech/tests/speech.c index 9faa49dfc5d..33ce75c0c0e 100644 --- a/dlls/windows.media.speech/tests/statics.c +++ b/dlls/windows.media.speech/tests/speech.c @@ -52,69 +52,59 @@ static void test_SpeechSynthesizer(void) IAgileObject *agile_object = NULL, *tmp_agile_object = NULL; HSTRING str; HRESULT hr; - ULONG rc, size; + ULONG size;
hr = pRoInitialize(RO_INIT_MULTITHREADED); - ok(SUCCEEDED(hr), "RoInitialize failed, hr %#x\n", hr); + ok(hr == S_OK, "RoInitialize failed, hr %#x\n", hr);
hr = pWindowsCreateString(speech_synthesizer_name, wcslen(speech_synthesizer_name), &str); - ok(SUCCEEDED(hr), "WindowsCreateString failed, hr %#x\n", hr); + ok(hr == S_OK, "WindowsCreateString failed, hr %#x\n", hr);
hr = pRoGetActivationFactory(str, &IID_IActivationFactory, (void **)&factory); - ok(SUCCEEDED(hr), "RoGetActivationFactory failed, hr %#x\n", hr); - - rc = IActivationFactory_AddRef(factory); - ok(rc == 3, "IActivationFactory_AddRef returned %d\n", rc); - rc = IActivationFactory_Release(factory); - ok(rc == 2, "IActivationFactory_Release returned %d\n", rc); + ok(hr == S_OK, "RoGetActivationFactory failed, hr %#x\n", hr);
hr = IActivationFactory_QueryInterface(factory, &IID_IInspectable, (void **)&inspectable); - ok(SUCCEEDED(hr), "IActivationFactory_QueryInterface IID_IInspectable failed, hr %#x\n", hr); + ok(hr == S_OK, "IActivationFactory_QueryInterface IID_IInspectable failed, hr %#x\n", hr);
hr = IActivationFactory_QueryInterface(factory, &IID_IAgileObject, (void **)&agile_object); - ok(SUCCEEDED(hr), "IActivationFactory_QueryInterface IID_IAgileObject failed, hr %#x\n", hr); + ok(hr == S_OK, "IActivationFactory_QueryInterface IID_IAgileObject failed, hr %#x\n", hr);
hr = IActivationFactory_QueryInterface(factory, &IID_IInstalledVoicesStatic, (void **)&voices_static); - ok(SUCCEEDED(hr), "IActivationFactory_QueryInterface IID_IInstalledVoicesStatic failed, hr %#x\n", hr); + ok(hr == S_OK, "IActivationFactory_QueryInterface IID_IInstalledVoicesStatic failed, hr %#x\n", hr);
hr = IInstalledVoicesStatic_QueryInterface(voices_static, &IID_IInspectable, (void **)&tmp_inspectable); - ok(SUCCEEDED(hr), "IInstalledVoicesStatic_QueryInterface IID_IInspectable failed, hr %#x\n", hr); + ok(hr == S_OK, "IInstalledVoicesStatic_QueryInterface IID_IInspectable failed, hr %#x\n", hr); ok(tmp_inspectable == inspectable, "IInstalledVoicesStatic_QueryInterface IID_IInspectable returned %p, expected %p\n", tmp_inspectable, inspectable); IInspectable_Release(tmp_inspectable);
hr = IInstalledVoicesStatic_QueryInterface(voices_static, &IID_IAgileObject, (void **)&tmp_agile_object); - ok(SUCCEEDED(hr), "IInstalledVoicesStatic_QueryInterface IID_IAgileObject failed, hr %#x\n", hr); + ok(hr == S_OK, "IInstalledVoicesStatic_QueryInterface IID_IAgileObject failed, hr %#x\n", hr); ok(tmp_agile_object == agile_object, "IInstalledVoicesStatic_QueryInterface IID_IAgileObject returned %p, expected %p\n", tmp_agile_object, agile_object); IAgileObject_Release(tmp_agile_object);
hr = IInstalledVoicesStatic_get_AllVoices(voices_static, &voices); - ok(SUCCEEDED(hr), "IInstalledVoicesStatic_get_AllVoices failed, hr %#x\n", hr); + ok(hr == S_OK, "IInstalledVoicesStatic_get_AllVoices failed, hr %#x\n", hr);
hr = IVectorView_VoiceInformation_QueryInterface(voices, &IID_IInspectable, (void **)&tmp_inspectable); - ok(SUCCEEDED(hr), "IVectorView_VoiceInformation_QueryInterface voices failed, hr %#x\n", hr); + ok(hr == S_OK, "IVectorView_VoiceInformation_QueryInterface voices failed, hr %#x\n", hr); ok(tmp_inspectable != inspectable, "IVectorView_VoiceInformation_QueryInterface voices returned %p, expected %p\n", tmp_inspectable, inspectable); IInspectable_Release(tmp_inspectable);
hr = IVectorView_VoiceInformation_QueryInterface(voices, &IID_IAgileObject, (void **)&tmp_agile_object); - ok(FAILED(hr), "IVectorView_VoiceInformation_QueryInterface voices failed, hr %#x\n", hr); + ok(hr == E_NOINTERFACE, "IVectorView_VoiceInformation_QueryInterface voices failed, hr %#x\n", hr);
size = 0xdeadbeef; hr = IVectorView_VoiceInformation_get_Size(voices, &size); - ok(SUCCEEDED(hr), "IVectorView_VoiceInformation_QueryInterface voices failed, hr %#x\n", hr); + ok(hr == S_OK, "IVectorView_VoiceInformation_get_Size voices failed, hr %#x\n", hr); todo_wine ok(size != 0 && size != 0xdeadbeef, "IVectorView_VoiceInformation_get_Size returned %u\n", size);
- rc = IVectorView_VoiceInformation_Release(voices); - ok(rc == 0, "IVectorView_VoiceInformation_Release returned unexpected refcount %d\n", rc); + IVectorView_VoiceInformation_Release(voices);
- rc = IInstalledVoicesStatic_Release(voices_static); - ok(rc == 4, "IInstalledVoicesStatic_Release returned unexpected refcount %d\n", rc); + IInstalledVoicesStatic_Release(voices_static);
- rc = IAgileObject_Release(agile_object); - ok(rc == 3, "IAgileObject_Release returned unexpected refcount %d\n", rc); - rc = IInspectable_Release(inspectable); - ok(rc == 2, "IInspectable_Release returned unexpected refcount %d\n", rc); - rc = IActivationFactory_Release(factory); - ok(rc == 1, "IActivationFactory_Release returned unexpected refcount %d\n", rc); + IAgileObject_Release(agile_object); + IInspectable_Release(inspectable); + IActivationFactory_Release(factory);
pWindowsDeleteString(str);
@@ -130,10 +120,10 @@ static void test_VoiceInformation(void) HRESULT hr;
hr = pRoInitialize(RO_INIT_MULTITHREADED); - ok(SUCCEEDED(hr), "RoInitialize failed, hr %#x\n", hr); + ok(hr == S_OK, "RoInitialize failed, hr %#x\n", hr);
hr = pWindowsCreateString(voice_information_name, wcslen(voice_information_name), &str); - ok(SUCCEEDED(hr), "WindowsCreateString failed, hr %#x\n", hr); + ok(hr == S_OK, "WindowsCreateString failed, hr %#x\n", hr);
hr = pRoGetActivationFactory(str, &IID_IActivationFactory, (void **)&factory); ok(hr == REGDB_E_CLASSNOTREG, "RoGetActivationFactory returned unexpected hr %#x\n", hr); @@ -143,7 +133,7 @@ static void test_VoiceInformation(void) pRoUninitialize(); }
-START_TEST(statics) +START_TEST(speech) { HMODULE combase;
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- configure.ac | 2 + dlls/windows.gaming.input/Makefile.in | 9 + dlls/windows.gaming.input/classes.idl | 23 ++ dlls/windows.gaming.input/main.c | 159 ++++++++++++ dlls/windows.gaming.input/tests/Makefile.in | 5 + dlls/windows.gaming.input/tests/input.c | 228 ++++++++++++++++++ .../windows.gaming.input.spec | 3 + 7 files changed, 429 insertions(+) create mode 100644 dlls/windows.gaming.input/Makefile.in create mode 100644 dlls/windows.gaming.input/classes.idl create mode 100644 dlls/windows.gaming.input/main.c create mode 100644 dlls/windows.gaming.input/tests/Makefile.in create mode 100644 dlls/windows.gaming.input/tests/input.c create mode 100644 dlls/windows.gaming.input/windows.gaming.input.spec
diff --git a/configure.ac b/configure.ac index 8c092fb020c..6c2e9fa57ad 100644 --- a/configure.ac +++ b/configure.ac @@ -3801,6 +3801,8 @@ WINE_CONFIG_MAKEFILE(dlls/win32s16.dll16,enable_win16) WINE_CONFIG_MAKEFILE(dlls/win87em.dll16,enable_win16) WINE_CONFIG_MAKEFILE(dlls/winaspi.dll16,enable_win16) WINE_CONFIG_MAKEFILE(dlls/windebug.dll16,enable_win16) +WINE_CONFIG_MAKEFILE(dlls/windows.gaming.input) +WINE_CONFIG_MAKEFILE(dlls/windows.gaming.input/tests) WINE_CONFIG_MAKEFILE(dlls/windows.media.speech) WINE_CONFIG_MAKEFILE(dlls/windows.media.speech/tests) WINE_CONFIG_MAKEFILE(dlls/windowscodecs) diff --git a/dlls/windows.gaming.input/Makefile.in b/dlls/windows.gaming.input/Makefile.in new file mode 100644 index 00000000000..1673eaabaa7 --- /dev/null +++ b/dlls/windows.gaming.input/Makefile.in @@ -0,0 +1,9 @@ +MODULE = windows.gaming.input.dll +IMPORTS = combase uuid + +EXTRADLLFLAGS = -mno-cygwin + +C_SRCS = \ + main.c + +IDL_SRCS = classes.idl diff --git a/dlls/windows.gaming.input/classes.idl b/dlls/windows.gaming.input/classes.idl new file mode 100644 index 00000000000..c9cb91e3182 --- /dev/null +++ b/dlls/windows.gaming.input/classes.idl @@ -0,0 +1,23 @@ +/* + * Runtime Classes for windows.gaming.input.dll + * + * Copyright 2021 Rémi Bernon for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#pragma makedep register + +#include "windows.gaming.input.idl" diff --git a/dlls/windows.gaming.input/main.c b/dlls/windows.gaming.input/main.c new file mode 100644 index 00000000000..05ef844893b --- /dev/null +++ b/dlls/windows.gaming.input/main.c @@ -0,0 +1,159 @@ +/* WinRT Windows.Gaming.Input implementation + * + * Copyright 2021 Rémi Bernon for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <stdarg.h> + +#define COBJMACROS +#include "windef.h" +#include "winbase.h" +#include "winstring.h" +#include "wine/debug.h" +#include "objbase.h" + +#include "initguid.h" +#include "activation.h" + +#include "windows.foundation.h" +#include "windows.gaming.input.h" + +WINE_DEFAULT_DEBUG_CHANNEL(input); + +static const char *debugstr_hstring(HSTRING hstr) +{ + const WCHAR *str; + UINT32 len; + if (hstr && !((ULONG_PTR)hstr >> 16)) return "(invalid)"; + str = WindowsGetStringRawBuffer(hstr, &len); + return wine_dbgstr_wn(str, len); +} + +struct windows_gaming_input +{ + IActivationFactory IActivationFactory_iface; + LONG ref; +}; + +static inline struct windows_gaming_input *impl_from_IActivationFactory(IActivationFactory *iface) +{ + return CONTAINING_RECORD(iface, struct windows_gaming_input, IActivationFactory_iface); +} + +static HRESULT STDMETHODCALLTYPE windows_gaming_input_QueryInterface( + IActivationFactory *iface, REFIID iid, void **out) +{ + TRACE("iface %p, iid %s, out %p stub!\n", iface, debugstr_guid(iid), out); + + if (IsEqualGUID(iid, &IID_IUnknown) || + IsEqualGUID(iid, &IID_IInspectable) || + IsEqualGUID(iid, &IID_IAgileObject) || + IsEqualGUID(iid, &IID_IActivationFactory)) + { + IUnknown_AddRef(iface); + *out = iface; + return S_OK; + } + + FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG STDMETHODCALLTYPE windows_gaming_input_AddRef( + IActivationFactory *iface) +{ + struct windows_gaming_input *impl = impl_from_IActivationFactory(iface); + ULONG ref = InterlockedIncrement(&impl->ref); + TRACE("iface %p, ref %u.\n", iface, ref); + return ref; +} + +static ULONG STDMETHODCALLTYPE windows_gaming_input_Release( + IActivationFactory *iface) +{ + struct windows_gaming_input *impl = impl_from_IActivationFactory(iface); + ULONG ref = InterlockedDecrement(&impl->ref); + TRACE("iface %p, ref %u.\n", iface, ref); + return ref; +} + +static HRESULT STDMETHODCALLTYPE windows_gaming_input_GetIids( + IActivationFactory *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 windows_gaming_input_GetRuntimeClassName( + IActivationFactory *iface, HSTRING *class_name) +{ + FIXME("iface %p, class_name %p stub!\n", iface, class_name); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE windows_gaming_input_GetTrustLevel( + IActivationFactory *iface, TrustLevel *trust_level) +{ + FIXME("iface %p, trust_level %p stub!\n", iface, trust_level); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE windows_gaming_input_ActivateInstance( + IActivationFactory *iface, IInspectable **instance) +{ + FIXME("iface %p, instance %p stub!\n", iface, instance); + return E_NOTIMPL; +} + +static const struct IActivationFactoryVtbl activation_factory_vtbl = +{ + windows_gaming_input_QueryInterface, + windows_gaming_input_AddRef, + windows_gaming_input_Release, + /* IInspectable methods */ + windows_gaming_input_GetIids, + windows_gaming_input_GetRuntimeClassName, + windows_gaming_input_GetTrustLevel, + /* IActivationFactory methods */ + windows_gaming_input_ActivateInstance, +}; + +static struct windows_gaming_input windows_gaming_input = +{ + {&activation_factory_vtbl}, + 1 +}; + +HRESULT WINAPI DllCanUnloadNow(void) +{ + return S_FALSE; +} + +HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID riid, void **out) +{ + FIXME("clsid %s, riid %s, out %p stub!\n", debugstr_guid(clsid), debugstr_guid(riid), out); + return CLASS_E_CLASSNOTAVAILABLE; +} + +HRESULT WINAPI DllGetActivationFactory(HSTRING classid, IActivationFactory **factory) +{ + TRACE("classid %s, factory %p.\n", debugstr_hstring(classid), factory); + *factory = &windows_gaming_input.IActivationFactory_iface; + IUnknown_AddRef(*factory); + return S_OK; +} diff --git a/dlls/windows.gaming.input/tests/Makefile.in b/dlls/windows.gaming.input/tests/Makefile.in new file mode 100644 index 00000000000..7fce9b04551 --- /dev/null +++ b/dlls/windows.gaming.input/tests/Makefile.in @@ -0,0 +1,5 @@ +TESTDLL = windows.gaming.input.dll +IMPORTS = uuid + +C_SRCS = \ + input.c diff --git a/dlls/windows.gaming.input/tests/input.c b/dlls/windows.gaming.input/tests/input.c new file mode 100644 index 00000000000..fa437dade6e --- /dev/null +++ b/dlls/windows.gaming.input/tests/input.c @@ -0,0 +1,228 @@ +/* + * Copyright 2021 Rémi Bernon for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ +#define COBJMACROS +#include <stdarg.h> + +#include "windef.h" +#include "winbase.h" +#include "winerror.h" +#include "winstring.h" + +#include "initguid.h" +#include "roapi.h" + +#define WIDL_using_Windows_Foundation +#define WIDL_using_Windows_Foundation_Collections +#include "windows.foundation.h" +#define WIDL_using_Windows_Gaming_Input +#include "windows.gaming.input.h" + +#include "wine/test.h" + +static HRESULT (WINAPI *pRoActivateInstance)(HSTRING, IInspectable **); +static HRESULT (WINAPI *pRoGetActivationFactory)(HSTRING, REFIID, void **); +static HRESULT (WINAPI *pRoInitialize)(RO_INIT_TYPE); +static void (WINAPI *pRoUninitialize)(void); +static HRESULT (WINAPI *pWindowsCreateString)(LPCWSTR, UINT32, HSTRING *); +static HRESULT (WINAPI *pWindowsDeleteString)(HSTRING); + +struct gamepad_event_handler +{ + IEventHandler_Gamepad IEventHandler_Gamepad_iface; + LONG ref; +}; + +static inline struct gamepad_event_handler *impl_from_IEventHandler_Gamepad(IEventHandler_Gamepad *iface) +{ + return CONTAINING_RECORD(iface, struct gamepad_event_handler, IEventHandler_Gamepad_iface); +} + +static HRESULT STDMETHODCALLTYPE gamepad_event_handler_QueryInterface( + IEventHandler_Gamepad *iface, REFIID iid, void **out) +{ + if (IsEqualGUID(iid, &IID_IUnknown) || + IsEqualGUID(iid, &IID_IEventHandler_Gamepad)) + { + IUnknown_AddRef(iface); + *out = iface; + return S_OK; + } + + trace("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG STDMETHODCALLTYPE gamepad_event_handler_AddRef( + IEventHandler_Gamepad *iface) +{ + struct gamepad_event_handler *impl = impl_from_IEventHandler_Gamepad(iface); + ULONG ref = InterlockedIncrement(&impl->ref); + return ref; +} + +static ULONG STDMETHODCALLTYPE gamepad_event_handler_Release( + IEventHandler_Gamepad *iface) +{ + struct gamepad_event_handler *impl = impl_from_IEventHandler_Gamepad(iface); + ULONG ref = InterlockedDecrement(&impl->ref); + return ref; +} + +static HRESULT STDMETHODCALLTYPE gamepad_event_handler_Invoke( + IEventHandler_Gamepad *iface, IInspectable *sender, IGamepad *args) +{ + trace("iface %p, sender %p, args %p\n", iface, sender, args); + return S_OK; +} + +static const IEventHandler_GamepadVtbl gamepad_event_handler_vtbl = +{ + gamepad_event_handler_QueryInterface, + gamepad_event_handler_AddRef, + gamepad_event_handler_Release, + /*** IEventHandler<ABI::Windows::Gaming::Input::Gamepad* > methods ***/ + gamepad_event_handler_Invoke, +}; + +static void test_Gamepad(void) +{ + static const WCHAR *gamepad_name = L"Windows.Gaming.Input.Gamepad"; + + struct gamepad_event_handler gamepad_event_handler; + EventRegistrationToken token; + IVectorView_Gamepad *gamepads = NULL; + IActivationFactory *factory = NULL; + IGamepadStatics *gamepad_statics = NULL; + IInspectable *inspectable = NULL, *tmp_inspectable = NULL; + IAgileObject *agile_object = NULL, *tmp_agile_object = NULL; + HSTRING str; + HRESULT hr; + ULONG size; + + gamepad_event_handler.IEventHandler_Gamepad_iface.lpVtbl = &gamepad_event_handler_vtbl; + + hr = pRoInitialize(RO_INIT_MULTITHREADED); + ok(hr == S_OK, "RoInitialize failed, hr %#x\n", hr); + + hr = pWindowsCreateString(gamepad_name, wcslen(gamepad_name), &str); + ok(hr == S_OK, "WindowsCreateString failed, hr %#x\n", hr); + + hr = pRoGetActivationFactory(str, &IID_IActivationFactory, (void **)&factory); + ok(hr == S_OK || broken(hr == REGDB_E_CLASSNOTREG), "RoGetActivationFactory failed, hr %#x\n", hr); + if (hr == REGDB_E_CLASSNOTREG) + { + win_skip("%s runtimeclass not registered, skipping tests.\n", wine_dbgstr_w(gamepad_name)); + return; + } + + hr = IActivationFactory_QueryInterface(factory, &IID_IInspectable, (void **)&inspectable); + ok(hr == S_OK, "IActivationFactory_QueryInterface IID_IInspectable failed, hr %#x\n", hr); + + hr = IActivationFactory_QueryInterface(factory, &IID_IAgileObject, (void **)&agile_object); + ok(hr == S_OK, "IActivationFactory_QueryInterface IID_IAgileObject failed, hr %#x\n", hr); + + hr = IActivationFactory_QueryInterface(factory, &IID_IGamepadStatics, (void **)&gamepad_statics); + todo_wine ok(hr == S_OK, "IActivationFactory_QueryInterface IID_IGamepadStatics failed, hr %#x\n", hr); + if (FAILED(hr)) goto done; + + hr = IGamepadStatics_QueryInterface(gamepad_statics, &IID_IInspectable, (void **)&tmp_inspectable); + ok(hr == S_OK, "IGamepadStatics_QueryInterface IID_IInspectable failed, hr %#x\n", hr); + ok(tmp_inspectable == inspectable, "IGamepadStatics_QueryInterface IID_IInspectable returned %p, expected %p\n", tmp_inspectable, inspectable); + IInspectable_Release(tmp_inspectable); + + hr = IGamepadStatics_QueryInterface(gamepad_statics, &IID_IAgileObject, (void **)&tmp_agile_object); + ok(hr == S_OK, "IGamepadStatics_QueryInterface IID_IAgileObject failed, hr %#x\n", hr); + ok(tmp_agile_object == agile_object, "IGamepadStatics_QueryInterface IID_IAgileObject returned %p, expected %p\n", tmp_agile_object, agile_object); + IAgileObject_Release(tmp_agile_object); + + hr = IGamepadStatics_get_Gamepads(gamepad_statics, &gamepads); + ok(hr == S_OK, "IGamepadStatics_get_Gamepads failed, hr %#x\n", hr); + + hr = IVectorView_Gamepad_QueryInterface(gamepads, &IID_IInspectable, (void **)&tmp_inspectable); + ok(hr == S_OK, "IVectorView_Gamepad_QueryInterface failed, hr %#x\n", hr); + ok(tmp_inspectable != inspectable, "IVectorView_Gamepad_QueryInterface returned %p, expected %p\n", tmp_inspectable, inspectable); + IInspectable_Release(tmp_inspectable); + + hr = IVectorView_Gamepad_QueryInterface(gamepads, &IID_IAgileObject, (void **)&tmp_agile_object); + ok(hr == S_OK, "IVectorView_Gamepad_QueryInterface failed, hr %#x\n", hr); + ok(tmp_agile_object != agile_object, "IVectorView_Gamepad_QueryInterface IID_IAgileObject returned agile_object\n"); + IAgileObject_Release(tmp_agile_object); + + size = 0xdeadbeef; + hr = IVectorView_Gamepad_get_Size(gamepads, &size); + ok(hr == S_OK, "IVectorView_Gamepad_get_Size failed, hr %#x\n", hr); + todo_wine ok(size != 0xdeadbeef, "IVectorView_Gamepad_get_Size returned %u\n", size); + + IVectorView_Gamepad_Release(gamepads); + + token.value = 0xdeadbeef; + hr = IGamepadStatics_add_GamepadAdded(gamepad_statics, &gamepad_event_handler.IEventHandler_Gamepad_iface, &token); + todo_wine ok(hr == S_OK, "IGamepadStatics_add_GamepadAdded failed, hr %#x\n", hr); + todo_wine ok(token.value != 0xdeadbeef, "IGamepadStatics_add_GamepadAdded returned token %#I64x\n", token.value); + + hr = IGamepadStatics_remove_GamepadAdded(gamepad_statics, token); + todo_wine ok(hr == S_OK, "IGamepadStatics_add_GamepadAdded failed, hr %#x\n", hr); + + token.value = 0xdeadbeef; + IGamepadStatics_add_GamepadRemoved(gamepad_statics, &gamepad_event_handler.IEventHandler_Gamepad_iface, &token); + todo_wine ok(hr == S_OK, "IGamepadStatics_add_GamepadRemoved failed, hr %#x\n", hr); + todo_wine ok(token.value != 0xdeadbeef, "IGamepadStatics_add_GamepadRemoved returned token %#I64x\n", token.value); + + hr = IGamepadStatics_remove_GamepadRemoved(gamepad_statics, token); + todo_wine ok(hr == S_OK, "IGamepadStatics_add_GamepadAdded failed, hr %#x\n", hr); + + IGamepadStatics_Release(gamepad_statics); + +done: + IAgileObject_Release(agile_object); + IInspectable_Release(inspectable); + IActivationFactory_Release(factory); + + pWindowsDeleteString(str); + + pRoUninitialize(); +} + +START_TEST(input) +{ + HMODULE combase; + + if (!(combase = LoadLibraryW(L"combase.dll"))) + { + win_skip("Failed to load combase.dll, skipping tests\n"); + return; + } + +#define LOAD_FUNCPTR(x) \ + if (!(p##x = (void*)GetProcAddress(combase, #x))) \ + { \ + win_skip("Failed to find %s in combase.dll, skipping tests.\n", #x); \ + return; \ + } + + LOAD_FUNCPTR(RoActivateInstance); + LOAD_FUNCPTR(RoGetActivationFactory); + LOAD_FUNCPTR(RoInitialize); + LOAD_FUNCPTR(RoUninitialize); + LOAD_FUNCPTR(WindowsCreateString); + LOAD_FUNCPTR(WindowsDeleteString); +#undef LOAD_FUNCPTR + + test_Gamepad(); +} diff --git a/dlls/windows.gaming.input/windows.gaming.input.spec b/dlls/windows.gaming.input/windows.gaming.input.spec new file mode 100644 index 00000000000..20a8bfa98ea --- /dev/null +++ b/dlls/windows.gaming.input/windows.gaming.input.spec @@ -0,0 +1,3 @@ +@ stdcall -private DllCanUnloadNow() +@ stdcall -private DllGetActivationFactory(ptr ptr) +@ stdcall -private DllGetClassObject(ptr ptr ptr)
Signed-off-by: Jacek Caban jacek@codeweavers.com
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/windows.gaming.input/main.c | 113 ++++++++++++++++++++++++ dlls/windows.gaming.input/tests/input.c | 8 +- 2 files changed, 117 insertions(+), 4 deletions(-)
diff --git a/dlls/windows.gaming.input/main.c b/dlls/windows.gaming.input/main.c index 05ef844893b..50d73a1adf4 100644 --- a/dlls/windows.gaming.input/main.c +++ b/dlls/windows.gaming.input/main.c @@ -29,7 +29,10 @@ #include "initguid.h" #include "activation.h"
+#define WIDL_using_Windows_Foundation +#define WIDL_using_Windows_Foundation_Collections #include "windows.foundation.h" +#define WIDL_using_Windows_Gaming_Input #include "windows.gaming.input.h"
WINE_DEFAULT_DEBUG_CHANNEL(input); @@ -46,6 +49,7 @@ static const char *debugstr_hstring(HSTRING hstr) struct windows_gaming_input { IActivationFactory IActivationFactory_iface; + IGamepadStatics IGamepadStatics_iface; LONG ref; };
@@ -54,9 +58,16 @@ 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 HRESULT STDMETHODCALLTYPE windows_gaming_input_QueryInterface( IActivationFactory *iface, REFIID iid, void **out) { + struct windows_gaming_input *impl = impl_from_IActivationFactory(iface); + TRACE("iface %p, iid %s, out %p stub!\n", iface, debugstr_guid(iid), out);
if (IsEqualGUID(iid, &IID_IUnknown) || @@ -69,6 +80,13 @@ static HRESULT STDMETHODCALLTYPE windows_gaming_input_QueryInterface( return S_OK; }
+ if (IsEqualGUID(iid, &IID_IGamepadStatics)) + { + IUnknown_AddRef(iface); + *out = &impl->IGamepadStatics_iface; + return S_OK; + } + FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); *out = NULL; return E_NOINTERFACE; @@ -133,9 +151,104 @@ static const struct IActivationFactoryVtbl activation_factory_vtbl = windows_gaming_input_ActivateInstance, };
+static HRESULT STDMETHODCALLTYPE gamepad_statics_QueryInterface( + IGamepadStatics *iface, REFIID iid, void **out) +{ + struct windows_gaming_input *impl = impl_from_IGamepadStatics(iface); + return windows_gaming_input_QueryInterface(&impl->IActivationFactory_iface, iid, out); +} + +static ULONG STDMETHODCALLTYPE gamepad_statics_AddRef( + IGamepadStatics *iface) +{ + struct windows_gaming_input *impl = impl_from_IGamepadStatics(iface); + return windows_gaming_input_AddRef(&impl->IActivationFactory_iface); +} + +static ULONG STDMETHODCALLTYPE gamepad_statics_Release( + IGamepadStatics *iface) +{ + struct windows_gaming_input *impl = impl_from_IGamepadStatics(iface); + return windows_gaming_input_Release(&impl->IActivationFactory_iface); +} + +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_add_GamepadAdded( + IGamepadStatics *iface, IEventHandler_Gamepad *value, EventRegistrationToken* token) +{ + FIXME("iface %p, value %p, token %p stub!\n", iface, value, token); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE gamepad_statics_remove_GamepadAdded( + IGamepadStatics *iface, EventRegistrationToken token) +{ + FIXME("iface %p, token %#I64x stub!\n", iface, token.value); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE gamepad_statics_add_GamepadRemoved( + IGamepadStatics *iface, IEventHandler_Gamepad *value, EventRegistrationToken* token) +{ + FIXME("iface %p, value %p, token %p stub!\n", iface, value, token); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE gamepad_statics_remove_GamepadRemoved( + IGamepadStatics *iface, EventRegistrationToken token) +{ + FIXME("iface %p, token %#I64x stub!\n", iface, token.value); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE gamepad_statics_get_Gamepads( + IGamepadStatics *iface, IVectorView_Gamepad **value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + return E_NOTIMPL; +} + +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_add_GamepadAdded, + gamepad_statics_remove_GamepadAdded, + gamepad_statics_add_GamepadRemoved, + gamepad_statics_remove_GamepadRemoved, + gamepad_statics_get_Gamepads, +}; + static struct windows_gaming_input windows_gaming_input = { {&activation_factory_vtbl}, + {&gamepad_statics_vtbl}, 1 };
diff --git a/dlls/windows.gaming.input/tests/input.c b/dlls/windows.gaming.input/tests/input.c index fa437dade6e..2d2b76255d0 100644 --- a/dlls/windows.gaming.input/tests/input.c +++ b/dlls/windows.gaming.input/tests/input.c @@ -138,8 +138,7 @@ static void test_Gamepad(void) ok(hr == S_OK, "IActivationFactory_QueryInterface IID_IAgileObject failed, hr %#x\n", hr);
hr = IActivationFactory_QueryInterface(factory, &IID_IGamepadStatics, (void **)&gamepad_statics); - todo_wine ok(hr == S_OK, "IActivationFactory_QueryInterface IID_IGamepadStatics failed, hr %#x\n", hr); - if (FAILED(hr)) goto done; + ok(hr == S_OK, "IActivationFactory_QueryInterface IID_IGamepadStatics failed, hr %#x\n", hr);
hr = IGamepadStatics_QueryInterface(gamepad_statics, &IID_IInspectable, (void **)&tmp_inspectable); ok(hr == S_OK, "IGamepadStatics_QueryInterface IID_IInspectable failed, hr %#x\n", hr); @@ -152,7 +151,8 @@ static void test_Gamepad(void) IAgileObject_Release(tmp_agile_object);
hr = IGamepadStatics_get_Gamepads(gamepad_statics, &gamepads); - ok(hr == S_OK, "IGamepadStatics_get_Gamepads failed, hr %#x\n", hr); + todo_wine ok(hr == S_OK, "IGamepadStatics_get_Gamepads failed, hr %#x\n", hr); + if (FAILED(hr)) goto done;
hr = IVectorView_Gamepad_QueryInterface(gamepads, &IID_IInspectable, (void **)&tmp_inspectable); ok(hr == S_OK, "IVectorView_Gamepad_QueryInterface failed, hr %#x\n", hr); @@ -171,6 +171,7 @@ static void test_Gamepad(void)
IVectorView_Gamepad_Release(gamepads);
+done: token.value = 0xdeadbeef; hr = IGamepadStatics_add_GamepadAdded(gamepad_statics, &gamepad_event_handler.IEventHandler_Gamepad_iface, &token); todo_wine ok(hr == S_OK, "IGamepadStatics_add_GamepadAdded failed, hr %#x\n", hr); @@ -189,7 +190,6 @@ static void test_Gamepad(void)
IGamepadStatics_Release(gamepad_statics);
-done: IAgileObject_Release(agile_object); IInspectable_Release(inspectable); IActivationFactory_Release(factory);
Signed-off-by: Jacek Caban jacek@codeweavers.com
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/windows.gaming.input/main.c | 126 +++++++++++++++++++++++- dlls/windows.gaming.input/tests/input.c | 6 +- 2 files changed, 126 insertions(+), 6 deletions(-)
diff --git a/dlls/windows.gaming.input/main.c b/dlls/windows.gaming.input/main.c index 50d73a1adf4..5e349d98fab 100644 --- a/dlls/windows.gaming.input/main.c +++ b/dlls/windows.gaming.input/main.c @@ -46,6 +46,126 @@ static const char *debugstr_hstring(HSTRING hstr) return wine_dbgstr_wn(str, len); }
+struct gamepad_vector +{ + IVectorView_Gamepad IVectorView_Gamepad_iface; + LONG ref; +}; + +static inline struct gamepad_vector *impl_from_IVectorView_Gamepad(IVectorView_Gamepad *iface) +{ + return CONTAINING_RECORD(iface, struct gamepad_vector, IVectorView_Gamepad_iface); +} + +static HRESULT STDMETHODCALLTYPE vector_view_gamepad_QueryInterface( + IVectorView_Gamepad *iface, REFIID iid, void **out) +{ + TRACE("iface %p, iid %s, out %p stub!\n", iface, debugstr_guid(iid), out); + + if (IsEqualGUID(iid, &IID_IUnknown) || + IsEqualGUID(iid, &IID_IInspectable) || + IsEqualGUID(iid, &IID_IAgileObject) || + IsEqualGUID(iid, &IID_IVectorView_Gamepad)) + { + IUnknown_AddRef(iface); + *out = iface; + return S_OK; + } + + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG STDMETHODCALLTYPE vector_view_gamepad_AddRef( + IVectorView_Gamepad *iface) +{ + struct gamepad_vector *impl = impl_from_IVectorView_Gamepad(iface); + ULONG ref = InterlockedIncrement(&impl->ref); + TRACE("iface %p, ref %u.\n", iface, ref); + return ref; +} + +static ULONG STDMETHODCALLTYPE vector_view_gamepad_Release( + IVectorView_Gamepad *iface) +{ + struct gamepad_vector *impl = impl_from_IVectorView_Gamepad(iface); + ULONG ref = InterlockedDecrement(&impl->ref); + TRACE("iface %p, ref %u.\n", iface, ref); + return ref; +} + +static HRESULT STDMETHODCALLTYPE vector_view_gamepad_GetIids( + IVectorView_Gamepad *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_gamepad_GetRuntimeClassName( + IVectorView_Gamepad *iface, HSTRING *class_name) +{ + FIXME("iface %p, class_name %p stub!\n", iface, class_name); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE vector_view_gamepad_GetTrustLevel( + IVectorView_Gamepad *iface, TrustLevel *trust_level) +{ + FIXME("iface %p, trust_level %p stub!\n", iface, trust_level); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE vector_view_gamepad_GetAt( + IVectorView_Gamepad *iface, ULONG index, IGamepad **value) +{ + FIXME("iface %p, index %#x, value %p stub!\n", iface, index, value); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE vector_view_gamepad_get_Size( + IVectorView_Gamepad *iface, ULONG *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE vector_view_gamepad_IndexOf( + IVectorView_Gamepad *iface, IGamepad *element, ULONG *index, BOOLEAN *value) +{ + FIXME("iface %p, element %p, index %p, value %p stub!\n", iface, element, index, value); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE vector_view_gamepad_GetMany( + IVectorView_Gamepad *iface, ULONG start_index, IGamepad **items, UINT *value) +{ + FIXME("iface %p, start_index %#x, items %p, value %p stub!\n", iface, start_index, items, value); + return E_NOTIMPL; +} + +static const struct IVectorView_GamepadVtbl vector_view_gamepad_vtbl = +{ + vector_view_gamepad_QueryInterface, + vector_view_gamepad_AddRef, + vector_view_gamepad_Release, + /* IInspectable methods */ + vector_view_gamepad_GetIids, + vector_view_gamepad_GetRuntimeClassName, + vector_view_gamepad_GetTrustLevel, + /* IVectorView<VoiceInformation> methods */ + vector_view_gamepad_GetAt, + vector_view_gamepad_get_Size, + vector_view_gamepad_IndexOf, + vector_view_gamepad_GetMany, +}; + +static struct gamepad_vector gamepads = +{ + {&vector_view_gamepad_vtbl}, + 0 +}; + struct windows_gaming_input { IActivationFactory IActivationFactory_iface; @@ -224,8 +344,10 @@ static HRESULT STDMETHODCALLTYPE gamepad_statics_remove_GamepadRemoved( static HRESULT STDMETHODCALLTYPE gamepad_statics_get_Gamepads( IGamepadStatics *iface, IVectorView_Gamepad **value) { - FIXME("iface %p, value %p stub!\n", iface, value); - return E_NOTIMPL; + TRACE("iface %p, value %p.\n", iface, value); + *value = &gamepads.IVectorView_Gamepad_iface; + IVectorView_Gamepad_AddRef(*value); + return S_OK; }
static const struct IGamepadStaticsVtbl gamepad_statics_vtbl = diff --git a/dlls/windows.gaming.input/tests/input.c b/dlls/windows.gaming.input/tests/input.c index 2d2b76255d0..cfd814d5631 100644 --- a/dlls/windows.gaming.input/tests/input.c +++ b/dlls/windows.gaming.input/tests/input.c @@ -151,8 +151,7 @@ static void test_Gamepad(void) IAgileObject_Release(tmp_agile_object);
hr = IGamepadStatics_get_Gamepads(gamepad_statics, &gamepads); - todo_wine ok(hr == S_OK, "IGamepadStatics_get_Gamepads failed, hr %#x\n", hr); - if (FAILED(hr)) goto done; + ok(hr == S_OK, "IGamepadStatics_get_Gamepads failed, hr %#x\n", hr);
hr = IVectorView_Gamepad_QueryInterface(gamepads, &IID_IInspectable, (void **)&tmp_inspectable); ok(hr == S_OK, "IVectorView_Gamepad_QueryInterface failed, hr %#x\n", hr); @@ -166,12 +165,11 @@ static void test_Gamepad(void)
size = 0xdeadbeef; hr = IVectorView_Gamepad_get_Size(gamepads, &size); - ok(hr == S_OK, "IVectorView_Gamepad_get_Size failed, hr %#x\n", hr); + todo_wine ok(hr == S_OK, "IVectorView_Gamepad_get_Size failed, hr %#x\n", hr); todo_wine ok(size != 0xdeadbeef, "IVectorView_Gamepad_get_Size returned %u\n", size);
IVectorView_Gamepad_Release(gamepads);
-done: token.value = 0xdeadbeef; hr = IGamepadStatics_add_GamepadAdded(gamepad_statics, &gamepad_event_handler.IEventHandler_Gamepad_iface, &token); todo_wine ok(hr == S_OK, "IGamepadStatics_add_GamepadAdded failed, hr %#x\n", hr);
Signed-off-by: Jacek Caban jacek@codeweavers.com
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/windows.gaming.input/main.c | 11 +++++++---- dlls/windows.gaming.input/tests/input.c | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/dlls/windows.gaming.input/main.c b/dlls/windows.gaming.input/main.c index 5e349d98fab..b1ba55f9018 100644 --- a/dlls/windows.gaming.input/main.c +++ b/dlls/windows.gaming.input/main.c @@ -120,28 +120,31 @@ static HRESULT STDMETHODCALLTYPE vector_view_gamepad_GetAt( IVectorView_Gamepad *iface, ULONG index, IGamepad **value) { FIXME("iface %p, index %#x, value %p stub!\n", iface, index, value); - return E_NOTIMPL; + return S_OK; }
static HRESULT STDMETHODCALLTYPE vector_view_gamepad_get_Size( IVectorView_Gamepad *iface, ULONG *value) { FIXME("iface %p, value %p stub!\n", iface, value); - return E_NOTIMPL; + *value = 0; + return S_OK; }
static HRESULT STDMETHODCALLTYPE vector_view_gamepad_IndexOf( IVectorView_Gamepad *iface, IGamepad *element, ULONG *index, BOOLEAN *value) { FIXME("iface %p, element %p, index %p, value %p stub!\n", iface, element, index, value); - return E_NOTIMPL; + *value = FALSE; + return S_OK; }
static HRESULT STDMETHODCALLTYPE vector_view_gamepad_GetMany( IVectorView_Gamepad *iface, ULONG start_index, IGamepad **items, UINT *value) { FIXME("iface %p, start_index %#x, items %p, value %p stub!\n", iface, start_index, items, value); - return E_NOTIMPL; + *value = 0; + return S_OK; }
static const struct IVectorView_GamepadVtbl vector_view_gamepad_vtbl = diff --git a/dlls/windows.gaming.input/tests/input.c b/dlls/windows.gaming.input/tests/input.c index cfd814d5631..4b00a2e482f 100644 --- a/dlls/windows.gaming.input/tests/input.c +++ b/dlls/windows.gaming.input/tests/input.c @@ -165,8 +165,8 @@ static void test_Gamepad(void)
size = 0xdeadbeef; hr = IVectorView_Gamepad_get_Size(gamepads, &size); - todo_wine ok(hr == S_OK, "IVectorView_Gamepad_get_Size failed, hr %#x\n", hr); - todo_wine ok(size != 0xdeadbeef, "IVectorView_Gamepad_get_Size returned %u\n", size); + ok(hr == S_OK, "IVectorView_Gamepad_get_Size failed, hr %#x\n", hr); + ok(size != 0xdeadbeef, "IVectorView_Gamepad_get_Size returned %u\n", size);
IVectorView_Gamepad_Release(gamepads);
Hi Rémi,
On 18.03.2021 09:58, Rémi Bernon wrote:
IVectorView_Gamepad *iface, ULONG index, IGamepad **value)
{ FIXME("iface %p, index %#x, value %p stub!\n", iface, index, value);
- return E_NOTIMPL;
- return S_OK;
Do you need this (and GetMany) when you report 0 size anyway? Returning success and not setting output value is problematic. As long as we fake 0 size, it looks to me that something like E_BOUNDS would be more appropriate.
Jacek
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/windows.gaming.input/main.c | 8 ++++---- dlls/windows.gaming.input/tests/input.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/dlls/windows.gaming.input/main.c b/dlls/windows.gaming.input/main.c index b1ba55f9018..87c07bc763b 100644 --- a/dlls/windows.gaming.input/main.c +++ b/dlls/windows.gaming.input/main.c @@ -320,28 +320,28 @@ static HRESULT STDMETHODCALLTYPE gamepad_statics_add_GamepadAdded( IGamepadStatics *iface, IEventHandler_Gamepad *value, EventRegistrationToken* token) { FIXME("iface %p, value %p, token %p stub!\n", iface, value, token); - return E_NOTIMPL; + return S_OK; }
static HRESULT STDMETHODCALLTYPE gamepad_statics_remove_GamepadAdded( IGamepadStatics *iface, EventRegistrationToken token) { FIXME("iface %p, token %#I64x stub!\n", iface, token.value); - return E_NOTIMPL; + return S_OK; }
static HRESULT STDMETHODCALLTYPE gamepad_statics_add_GamepadRemoved( IGamepadStatics *iface, IEventHandler_Gamepad *value, EventRegistrationToken* token) { FIXME("iface %p, value %p, token %p stub!\n", iface, value, token); - return E_NOTIMPL; + return S_OK; }
static HRESULT STDMETHODCALLTYPE gamepad_statics_remove_GamepadRemoved( IGamepadStatics *iface, EventRegistrationToken token) { FIXME("iface %p, token %#I64x stub!\n", iface, token.value); - return E_NOTIMPL; + return S_OK; }
static HRESULT STDMETHODCALLTYPE gamepad_statics_get_Gamepads( diff --git a/dlls/windows.gaming.input/tests/input.c b/dlls/windows.gaming.input/tests/input.c index 4b00a2e482f..1c27af0a429 100644 --- a/dlls/windows.gaming.input/tests/input.c +++ b/dlls/windows.gaming.input/tests/input.c @@ -172,19 +172,19 @@ static void test_Gamepad(void)
token.value = 0xdeadbeef; hr = IGamepadStatics_add_GamepadAdded(gamepad_statics, &gamepad_event_handler.IEventHandler_Gamepad_iface, &token); - todo_wine ok(hr == S_OK, "IGamepadStatics_add_GamepadAdded failed, hr %#x\n", hr); + ok(hr == S_OK, "IGamepadStatics_add_GamepadAdded failed, hr %#x\n", hr); todo_wine ok(token.value != 0xdeadbeef, "IGamepadStatics_add_GamepadAdded returned token %#I64x\n", token.value);
hr = IGamepadStatics_remove_GamepadAdded(gamepad_statics, token); - todo_wine ok(hr == S_OK, "IGamepadStatics_add_GamepadAdded failed, hr %#x\n", hr); + ok(hr == S_OK, "IGamepadStatics_add_GamepadAdded failed, hr %#x\n", hr);
token.value = 0xdeadbeef; IGamepadStatics_add_GamepadRemoved(gamepad_statics, &gamepad_event_handler.IEventHandler_Gamepad_iface, &token); - todo_wine ok(hr == S_OK, "IGamepadStatics_add_GamepadRemoved failed, hr %#x\n", hr); + ok(hr == S_OK, "IGamepadStatics_add_GamepadRemoved failed, hr %#x\n", hr); todo_wine ok(token.value != 0xdeadbeef, "IGamepadStatics_add_GamepadRemoved returned token %#I64x\n", token.value);
hr = IGamepadStatics_remove_GamepadRemoved(gamepad_statics, token); - todo_wine ok(hr == S_OK, "IGamepadStatics_add_GamepadAdded failed, hr %#x\n", hr); + ok(hr == S_OK, "IGamepadStatics_add_GamepadAdded failed, hr %#x\n", hr);
IGamepadStatics_Release(gamepad_statics);