[2/2] dinput: Return a valid keyboard type in keyboard GetCapabilities

Lucas Zawacki lfzawacki at gmail.com
Mon Aug 20 01:52:17 CDT 2012


From: Lucas Zawacki <lfzawacki at gmail.com>

This field is read by some apps that refuse to start receiving input if
they see the UNKNOWN value. Particulary the apps from bugs #21159 and #28232.

I've done some testing on different machines and I think the value DI8DEVTYPEKEYBOARD_PCENH could be used,
seeing that it's the one returned on most windows machines I tested and it makes the apps happy.

For more reasoning on this see http://bugs.winehq.org/show_bug.cgi?id=21159#c11
---
 dlls/dinput/keyboard.c       |    4 ++--
 dlls/dinput/tests/keyboard.c |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/dinput/keyboard.c b/dlls/dinput/keyboard.c
index 3ca7d97..8e1d1a4 100644
--- a/dlls/dinput/keyboard.c
+++ b/dlls/dinput/keyboard.c
@@ -375,9 +375,9 @@ static HRESULT WINAPI SysKeyboardWImpl_GetCapabilities(LPDIRECTINPUTDEVICE8W ifa
     devcaps.dwSize = lpDIDevCaps->dwSize;
     devcaps.dwFlags = DIDC_ATTACHED | DIDC_EMULATED;
     if (This->base.dinput->dwVersion >= 0x0800)
-	devcaps.dwDevType = DI8DEVTYPE_KEYBOARD | (DI8DEVTYPEKEYBOARD_UNKNOWN << 8);
+        devcaps.dwDevType = DI8DEVTYPE_KEYBOARD | (DI8DEVTYPEKEYBOARD_PCENH << 8);
     else
-	devcaps.dwDevType = DIDEVTYPE_KEYBOARD | (DIDEVTYPEKEYBOARD_UNKNOWN << 8);
+        devcaps.dwDevType = DIDEVTYPE_KEYBOARD | (DIDEVTYPEKEYBOARD_PCENH << 8);
     devcaps.dwAxes = 0;
     devcaps.dwButtons = This->base.data_format.wine_df->dwNumObjs;
     devcaps.dwPOVs = 0;
diff --git a/dlls/dinput/tests/keyboard.c b/dlls/dinput/tests/keyboard.c
index 6aab8a7..5d32abe 100644
--- a/dlls/dinput/tests/keyboard.c
+++ b/dlls/dinput/tests/keyboard.c
@@ -187,7 +187,7 @@ static void test_capabilities(LPDIRECTINPUT pDI, HWND hwnd)
     ok (caps.dwFlags & DIDC_ATTACHED, "GetCapabilites dwFlags: 0x%08x\n", caps.dwFlags);
     ok (LOWORD(LOBYTE(caps.dwDevType)) == DIDEVTYPE_KEYBOARD,
         "GetCapabilities invalid device type for dwDevType: 0x%08x\n", caps.dwDevType);
-    todo_wine ok (LOWORD(HIBYTE(caps.dwDevType)) != DIDEVTYPEKEYBOARD_UNKNOWN,
+    ok (LOWORD(HIBYTE(caps.dwDevType)) != DIDEVTYPEKEYBOARD_UNKNOWN,
         "GetCapabilities invalid device subtype for dwDevType: 0x%08x\n", caps.dwDevType);
 
     if (pKeyboard) IUnknown_Release(pKeyboard);
-- 
1.7.9.5




More information about the wine-patches mailing list