Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/windows.gaming.input/main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/dlls/windows.gaming.input/main.c b/dlls/windows.gaming.input/main.c index c5b7f19c987..1ddd3a8fd23 100644 --- a/dlls/windows.gaming.input/main.c +++ b/dlls/windows.gaming.input/main.c @@ -169,7 +169,6 @@ HRESULT WINAPI DllGetActivationFactory( HSTRING class_str, IActivationFactory ** { static INIT_ONCE init_once = INIT_ONCE_STATIC_INIT; const WCHAR *buffer = WindowsGetStringRawBuffer( class_str, NULL ); - HRESULT hr = REGDB_E_CLASSNOTREG;
TRACE( "class %s, factory %p.\n", debugstr_w(buffer), factory );
@@ -178,13 +177,14 @@ HRESULT WINAPI DllGetActivationFactory( HSTRING class_str, IActivationFactory ** *factory = NULL;
if (!wcscmp( buffer, RuntimeClass_Windows_Gaming_Input_RawGameController )) - hr = ICustomGameControllerFactory_QueryInterface( controller_factory, &IID_IActivationFactory, (void **)factory ); + ICustomGameControllerFactory_QueryInterface( controller_factory, &IID_IActivationFactory, (void **)factory ); if (!wcscmp( buffer, RuntimeClass_Windows_Gaming_Input_Gamepad )) - hr = ICustomGameControllerFactory_QueryInterface( gamepad_factory, &IID_IActivationFactory, (void **)factory ); + ICustomGameControllerFactory_QueryInterface( gamepad_factory, &IID_IActivationFactory, (void **)factory ); if (!wcscmp( buffer, RuntimeClass_Windows_Gaming_Input_Custom_GameControllerFactoryManager )) - hr = IGameControllerFactoryManagerStatics2_QueryInterface( manager_factory, &IID_IActivationFactory, (void **)factory ); + IGameControllerFactoryManagerStatics2_QueryInterface( manager_factory, &IID_IActivationFactory, (void **)factory );
- return hr; + if (*factory) return S_OK; + return CLASS_E_CLASSNOTAVAILABLE; }
BOOL WINAPI DllMain( HINSTANCE instance, DWORD reason, void *reserved )
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput/tests/hotplug.c | 7 ++----- dlls/windows.gaming.input/controller.c | 3 ++- dlls/windows.gaming.input/gamepad.c | 3 ++- dlls/windows.gaming.input/manager.c | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/dlls/dinput/tests/hotplug.c b/dlls/dinput/tests/hotplug.c index 24f913dc140..a2072ca16de 100644 --- a/dlls/dinput/tests/hotplug.c +++ b/dlls/dinput/tests/hotplug.c @@ -1059,7 +1059,6 @@ static void test_windows_gaming_input(void)
hr = IGameControllerFactoryManagerStatics2_TryGetFactoryControllerFromGameController( manager_statics2, &custom_factory.ICustomGameControllerFactory_iface, game_controller, &tmp_game_controller ); - todo_wine ok( hr == S_OK, "TryGetFactoryControllerFromGameController returned %#lx\n", hr ); ok( !tmp_game_controller, "got controller %p\n", tmp_game_controller );
@@ -1126,10 +1125,9 @@ static void test_windows_gaming_input(void)
hr = IGameControllerFactoryManagerStatics2_TryGetFactoryControllerFromGameController( manager_statics2, &custom_factory.ICustomGameControllerFactory_iface, game_controller, &tmp_game_controller ); - todo_wine ok( hr == S_OK, "TryGetFactoryControllerFromGameController returned %#lx\n", hr ); ok( tmp_game_controller == custom_controller.IGameController_outer, "got controller %p\n", tmp_game_controller ); - if (hr != S_OK) goto next; + if (!tmp_game_controller) goto next; hr = IGameController_QueryInterface( tmp_game_controller, &IID_IInspectable, (void **)&tmp_inspectable ); ok( hr == S_OK, "QueryInterface returned %#lx\n", hr ); ok( tmp_inspectable == (void *)tmp_game_controller, "got inspectable %p\n", tmp_inspectable ); @@ -1153,11 +1151,10 @@ static void test_windows_gaming_input(void)
next: hr = IRawGameControllerStatics_FromGameController( statics, custom_controller.IGameController_outer, &tmp_raw_controller ); - todo_wine ok( hr == S_OK, "FromGameController returned %#lx\n", hr ); todo_wine ok( tmp_raw_controller == raw_controller, "got controller %p\n", tmp_raw_controller ); - if (hr == S_OK) IRawGameController_Release( tmp_raw_controller ); + if (tmp_raw_controller) IRawGameController_Release( tmp_raw_controller );
IGameController_Release( game_controller ); IRawGameController_Release( raw_controller ); diff --git a/dlls/windows.gaming.input/controller.c b/dlls/windows.gaming.input/controller.c index 3e00da917e7..03a3ae398cf 100644 --- a/dlls/windows.gaming.input/controller.c +++ b/dlls/windows.gaming.input/controller.c @@ -459,9 +459,10 @@ static HRESULT WINAPI statics_FromGameController( IRawGameControllerStatics *ifa
TRACE( "iface %p, game_controller %p, value %p.\n", iface, game_controller, value );
+ *value = NULL; hr = IGameControllerFactoryManagerStatics2_TryGetFactoryControllerFromGameController( manager_factory, &impl->ICustomGameControllerFactory_iface, game_controller, &controller ); - if (FAILED(hr)) return hr; + if (FAILED(hr) || !controller) return hr;
hr = IGameController_QueryInterface( controller, &IID_IRawGameController, (void **)value ); IGameController_Release( controller ); diff --git a/dlls/windows.gaming.input/gamepad.c b/dlls/windows.gaming.input/gamepad.c index b815d5c0a13..7e72609a277 100644 --- a/dlls/windows.gaming.input/gamepad.c +++ b/dlls/windows.gaming.input/gamepad.c @@ -484,9 +484,10 @@ static HRESULT WINAPI statics2_FromGameController( IGamepadStatics2 *iface, IGam
TRACE( "iface %p, game_controller %p, value %p.\n", iface, game_controller, value );
+ *value = NULL; hr = IGameControllerFactoryManagerStatics2_TryGetFactoryControllerFromGameController( manager_factory, &impl->ICustomGameControllerFactory_iface, game_controller, &controller ); - if (FAILED(hr)) return hr; + if (FAILED(hr) || !controller) return hr;
hr = IGameController_QueryInterface( controller, &IID_IGamepad, (void **)value ); IGameController_Release( controller ); diff --git a/dlls/windows.gaming.input/manager.c b/dlls/windows.gaming.input/manager.c index 393b5a850c8..af15849c521 100644 --- a/dlls/windows.gaming.input/manager.c +++ b/dlls/windows.gaming.input/manager.c @@ -392,7 +392,7 @@ statics2_TryGetFactoryControllerFromGameController( IGameControllerFactoryManage
LeaveCriticalSection( &manager_cs );
- if (!found) return E_FAIL; + if (!found) *value = NULL; return S_OK; }