[PATCH 1/2] windows.gaming.input: Return correct error from DllGetActivationFactory.

Rémi Bernon rbernon at codeweavers.com
Fri Mar 11 02:43:47 CST 2022


Signed-off-by: Rémi Bernon <rbernon at 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 )
-- 
2.35.1




More information about the wine-devel mailing list