[PATCH v2] dinput: Don't return IDirectInput8 interface when using DirectX 7
Alistair Leslie-Hughes
leslie_alistair at hotmail.com
Mon Apr 29 01:47:00 CDT 2019
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
dlls/dinput/dinput_main.c | 17 ++++++++---------
dlls/dinput/tests/dinput.c | 21 ++++-----------------
2 files changed, 12 insertions(+), 26 deletions(-)
diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c
index 1b2020c..e87b684 100644
--- a/dlls/dinput/dinput_main.c
+++ b/dlls/dinput/dinput_main.c
@@ -566,6 +566,8 @@ static HRESULT WINAPI IDirectInputAImpl_QueryInterface(LPDIRECTINPUT7A iface, RE
if (!riid || !ppobj)
return E_POINTER;
+ *ppobj = NULL;
+
if (IsEqualGUID( &IID_IUnknown, riid ) ||
IsEqualGUID( &IID_IDirectInputA, riid ) ||
IsEqualGUID( &IID_IDirectInput2A, riid ) ||
@@ -587,21 +589,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,8 +611,7 @@ static HRESULT WINAPI IDirectInputAImpl_QueryInterface(LPDIRECTINPUT7A iface, RE
return DI_OK;
}
- FIXME( "Unsupported interface: %s\n", debugstr_guid(riid));
- *ppobj = NULL;
+ WARN( "Unsupported interface: %s\n", debugstr_guid(riid));
return E_NOINTERFACE;
}
diff --git a/dlls/dinput/tests/dinput.c b/dlls/dinput/tests/dinput.c
index 23b20d2..6451241 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);
--
1.9.1
More information about the wine-devel
mailing list