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

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Rémi Bernon 2022-03-11 09:43:48 +01:00 committed by Alexandre Julliard
parent 6ebdf1bab9
commit 0fc5a07770
4 changed files with 7 additions and 8 deletions

View File

@ -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 );

View File

@ -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 );

View File

@ -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 );

View File

@ -392,7 +392,7 @@ statics2_TryGetFactoryControllerFromGameController( IGameControllerFactoryManage
LeaveCriticalSection( &manager_cs );
if (!found) return E_FAIL;
if (!found) *value = NULL;
return S_OK;
}