[PATCH 1/5] dinput: Don't return IDirectInput8 interface when using DirectX 7

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Sun Apr 28 05:24:07 CDT 2019


Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
 dlls/dinput/dinput_main.c  | 14 ++++++--------
 dlls/dinput/tests/dinput.c | 21 ++++-----------------
 2 files changed, 10 insertions(+), 25 deletions(-)

diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c
index 1b2020c711..720635f937 100644
--- a/dlls/dinput/dinput_main.c
+++ b/dlls/dinput/dinput_main.c
@@ -587,21 +587,19 @@ static HRESULT WINAPI IDirectInputAImpl_QueryInterface(LPDIRECTINPUT7A iface, RE
         return DI_OK;
     }
 
+#if DIRECTINPUT_VERSION == 0x0800
     if (IsEqualGUID( &IID_IDirectInput8A, riid ))
-    {
         *ppobj = &This->IDirectInput8A_iface;
-        IUnknown_AddRef( (IUnknown*)*ppobj );
 
-        return DI_OK;
-    }
+    else if (IsEqualGUID( &IID_IDirectInput8W, riid ))
+        *ppobj = &This->IDirectInput8W_iface;
 
-    if (IsEqualGUID( &IID_IDirectInput8W, riid ))
+    if(*ppobj)
     {
-        *ppobj = &This->IDirectInput8W_iface;
         IUnknown_AddRef( (IUnknown*)*ppobj );
-
         return DI_OK;
     }
+#endif
 
     if (IsEqualGUID( &IID_IDirectInputJoyConfig8, riid ))
     {
@@ -611,7 +609,7 @@ static HRESULT WINAPI IDirectInputAImpl_QueryInterface(LPDIRECTINPUT7A iface, RE
         return DI_OK;
     }
 
-    FIXME( "Unsupported interface: %s\n", debugstr_guid(riid));
+    WARN( "Unsupported interface: %s\n", debugstr_guid(riid));
     *ppobj = NULL;
     return E_NOINTERFACE;
 }
diff --git a/dlls/dinput/tests/dinput.c b/dlls/dinput/tests/dinput.c
index 23b20d2b9e..6451241d38 100644
--- a/dlls/dinput/tests/dinput.c
+++ b/dlls/dinput/tests/dinput.c
@@ -272,11 +272,10 @@ static void test_QueryInterface(void)
     static const struct
     {
         REFIID riid;
-        int test_todo;
     } no_interface_list[] =
     {
-        {&IID_IDirectInput8A, 1},
-        {&IID_IDirectInput8W, 1},
+        {&IID_IDirectInput8A},
+        {&IID_IDirectInput8W},
         {&IID_IDirectInputDeviceA},
         {&IID_IDirectInputDeviceW},
         {&IID_IDirectInputDevice2A},
@@ -324,20 +323,8 @@ static void test_QueryInterface(void)
     {
         pUnk = (void *)0xdeadbeef;
         hr = IDirectInput_QueryInterface(pDI, no_interface_list[i].riid, (void **)&pUnk);
-        if (no_interface_list[i].test_todo)
-        {
-            todo_wine
-            ok(hr == E_NOINTERFACE, "[%d] IDirectInput_QueryInterface returned 0x%08x\n", i, hr);
-            todo_wine
-            ok(pUnk == NULL, "[%d] Output interface pointer is %p\n", i, pUnk);
-
-            if (pUnk) IUnknown_Release(pUnk);
-        }
-        else
-        {
-            ok(hr == E_NOINTERFACE, "[%d] IDirectInput_QueryInterface returned 0x%08x\n", i, hr);
-            ok(pUnk == NULL, "[%d] Output interface pointer is %p\n", i, pUnk);
-        }
+        ok(hr == E_NOINTERFACE, "[%d] IDirectInput_QueryInterface returned 0x%08x\n", i, hr);
+        ok(pUnk == NULL, "[%d] Output interface pointer is %p\n", i, pUnk);
     }
 
     IDirectInput_Release(pDI);
-- 
2.20.1




More information about the wine-devel mailing list