Commit 0fc5a077 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

windows.gaming.input: Always return S_OK from TryGetFactoryControllerFromGameController.

parent 6ebdf1ba
...@@ -1059,7 +1059,6 @@ static void test_windows_gaming_input(void) ...@@ -1059,7 +1059,6 @@ static void test_windows_gaming_input(void)
hr = IGameControllerFactoryManagerStatics2_TryGetFactoryControllerFromGameController( manager_statics2, hr = IGameControllerFactoryManagerStatics2_TryGetFactoryControllerFromGameController( manager_statics2,
&custom_factory.ICustomGameControllerFactory_iface, game_controller, &tmp_game_controller ); &custom_factory.ICustomGameControllerFactory_iface, game_controller, &tmp_game_controller );
todo_wine
ok( hr == S_OK, "TryGetFactoryControllerFromGameController returned %#lx\n", hr ); ok( hr == S_OK, "TryGetFactoryControllerFromGameController returned %#lx\n", hr );
ok( !tmp_game_controller, "got controller %p\n", tmp_game_controller ); ok( !tmp_game_controller, "got controller %p\n", tmp_game_controller );
...@@ -1126,10 +1125,9 @@ static void test_windows_gaming_input(void) ...@@ -1126,10 +1125,9 @@ static void test_windows_gaming_input(void)
hr = IGameControllerFactoryManagerStatics2_TryGetFactoryControllerFromGameController( manager_statics2, hr = IGameControllerFactoryManagerStatics2_TryGetFactoryControllerFromGameController( manager_statics2,
&custom_factory.ICustomGameControllerFactory_iface, game_controller, &tmp_game_controller ); &custom_factory.ICustomGameControllerFactory_iface, game_controller, &tmp_game_controller );
todo_wine
ok( hr == S_OK, "TryGetFactoryControllerFromGameController returned %#lx\n", hr ); ok( hr == S_OK, "TryGetFactoryControllerFromGameController returned %#lx\n", hr );
ok( tmp_game_controller == custom_controller.IGameController_outer, "got controller %p\n", tmp_game_controller ); 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 ); hr = IGameController_QueryInterface( tmp_game_controller, &IID_IInspectable, (void **)&tmp_inspectable );
ok( hr == S_OK, "QueryInterface returned %#lx\n", hr ); ok( hr == S_OK, "QueryInterface returned %#lx\n", hr );
ok( tmp_inspectable == (void *)tmp_game_controller, "got inspectable %p\n", tmp_inspectable ); ok( tmp_inspectable == (void *)tmp_game_controller, "got inspectable %p\n", tmp_inspectable );
...@@ -1153,11 +1151,10 @@ static void test_windows_gaming_input(void) ...@@ -1153,11 +1151,10 @@ static void test_windows_gaming_input(void)
next: next:
hr = IRawGameControllerStatics_FromGameController( statics, custom_controller.IGameController_outer, &tmp_raw_controller ); hr = IRawGameControllerStatics_FromGameController( statics, custom_controller.IGameController_outer, &tmp_raw_controller );
todo_wine
ok( hr == S_OK, "FromGameController returned %#lx\n", hr ); ok( hr == S_OK, "FromGameController returned %#lx\n", hr );
todo_wine todo_wine
ok( tmp_raw_controller == raw_controller, "got controller %p\n", tmp_raw_controller ); 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 ); IGameController_Release( game_controller );
IRawGameController_Release( raw_controller ); IRawGameController_Release( raw_controller );
......
...@@ -459,9 +459,10 @@ static HRESULT WINAPI statics_FromGameController( IRawGameControllerStatics *ifa ...@@ -459,9 +459,10 @@ static HRESULT WINAPI statics_FromGameController( IRawGameControllerStatics *ifa
TRACE( "iface %p, game_controller %p, value %p.\n", iface, game_controller, value ); TRACE( "iface %p, game_controller %p, value %p.\n", iface, game_controller, value );
*value = NULL;
hr = IGameControllerFactoryManagerStatics2_TryGetFactoryControllerFromGameController( manager_factory, &impl->ICustomGameControllerFactory_iface, hr = IGameControllerFactoryManagerStatics2_TryGetFactoryControllerFromGameController( manager_factory, &impl->ICustomGameControllerFactory_iface,
game_controller, &controller ); game_controller, &controller );
if (FAILED(hr)) return hr; if (FAILED(hr) || !controller) return hr;
hr = IGameController_QueryInterface( controller, &IID_IRawGameController, (void **)value ); hr = IGameController_QueryInterface( controller, &IID_IRawGameController, (void **)value );
IGameController_Release( controller ); IGameController_Release( controller );
......
...@@ -484,9 +484,10 @@ static HRESULT WINAPI statics2_FromGameController( IGamepadStatics2 *iface, IGam ...@@ -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 ); TRACE( "iface %p, game_controller %p, value %p.\n", iface, game_controller, value );
*value = NULL;
hr = IGameControllerFactoryManagerStatics2_TryGetFactoryControllerFromGameController( manager_factory, &impl->ICustomGameControllerFactory_iface, hr = IGameControllerFactoryManagerStatics2_TryGetFactoryControllerFromGameController( manager_factory, &impl->ICustomGameControllerFactory_iface,
game_controller, &controller ); game_controller, &controller );
if (FAILED(hr)) return hr; if (FAILED(hr) || !controller) return hr;
hr = IGameController_QueryInterface( controller, &IID_IGamepad, (void **)value ); hr = IGameController_QueryInterface( controller, &IID_IGamepad, (void **)value );
IGameController_Release( controller ); IGameController_Release( controller );
......
...@@ -392,7 +392,7 @@ statics2_TryGetFactoryControllerFromGameController( IGameControllerFactoryManage ...@@ -392,7 +392,7 @@ statics2_TryGetFactoryControllerFromGameController( IGameControllerFactoryManage
LeaveCriticalSection( &manager_cs ); LeaveCriticalSection( &manager_cs );
if (!found) return E_FAIL; if (!found) *value = NULL;
return S_OK; return S_OK;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment