Rémi Bernon : user32: Remove unnecessary MOUSE / KEYBOARD special cases.

Alexandre Julliard julliard at winehq.org
Tue May 4 16:23:36 CDT 2021


Module: wine
Branch: master
Commit: 82211cd478fdf5ab2bf97704b7fd6a32545ad65d
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=82211cd478fdf5ab2bf97704b7fd6a32545ad65d

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Tue May  4 10:24:55 2021 +0200

user32: Remove unnecessary MOUSE / KEYBOARD special cases.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/rawinput.c    | 39 ++++-----------------------------------
 dlls/user32/tests/input.c |  3 +--
 2 files changed, 5 insertions(+), 37 deletions(-)

diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c
index 9a72a9a323e..15e909ebd9c 100644
--- a/dlls/user32/rawinput.c
+++ b/dlls/user32/rawinput.c
@@ -684,10 +684,6 @@ UINT WINAPI GetRawInputDeviceInfoA(HANDLE device, UINT command, void *data, UINT
  */
 UINT WINAPI GetRawInputDeviceInfoW(HANDLE handle, UINT command, void *data, UINT *data_size)
 {
-    /* FIXME: Most of this is made up. */
-    static const RID_DEVICE_INFO_KEYBOARD keyboard_info = {0, 0, 1, 12, 3, 101};
-    static const RID_DEVICE_INFO_MOUSE mouse_info = {1, 5, 0, FALSE};
-
     RID_DEVICE_INFO info;
     struct device *device;
     const void *to_copy;
@@ -718,41 +714,15 @@ UINT WINAPI GetRawInputDeviceInfoW(HANDLE handle, UINT command, void *data, UINT
     case RIDI_DEVICENAME:
         /* for RIDI_DEVICENAME, data_size is in characters, not bytes */
         avail_bytes = *data_size * sizeof(WCHAR);
-        if (handle == WINE_MOUSE_HANDLE)
-        {
-            *data_size = ARRAY_SIZE(L"\\\\?\\WINE_MOUSE");
-            to_copy = L"\\\\?\\WINE_MOUSE";
-        }
-        else if (handle == WINE_KEYBOARD_HANDLE)
-        {
-            *data_size = ARRAY_SIZE(L"\\\\?\\WINE_KEYBOARD");
-            to_copy = L"\\\\?\\WINE_KEYBOARD";
-        }
-        else
-        {
-            *data_size = wcslen(device->detail->DevicePath) + 1;
-            to_copy = device->detail->DevicePath;
-        }
+        *data_size = wcslen(device->detail->DevicePath) + 1;
+        to_copy = device->detail->DevicePath;
         to_copy_bytes = *data_size * sizeof(WCHAR);
         break;
 
     case RIDI_DEVICEINFO:
         avail_bytes = *data_size;
         info.cbSize = sizeof(info);
-        if (handle == WINE_MOUSE_HANDLE)
-        {
-            info.dwType = RIM_TYPEMOUSE;
-            info.u.mouse = mouse_info;
-        }
-        else if (handle == WINE_KEYBOARD_HANDLE)
-        {
-            info.dwType = RIM_TYPEKEYBOARD;
-            info.u.keyboard = keyboard_info;
-        }
-        else
-        {
-            info = device->info;
-        }
+        info = device->info;
         to_copy_bytes = sizeof(info);
         *data_size = to_copy_bytes;
         to_copy = &info;
@@ -760,8 +730,7 @@ UINT WINAPI GetRawInputDeviceInfoW(HANDLE handle, UINT command, void *data, UINT
 
     case RIDI_PREPARSEDDATA:
         avail_bytes = *data_size;
-        if (handle == WINE_MOUSE_HANDLE || handle == WINE_KEYBOARD_HANDLE ||
-            device->info.dwType != RIM_TYPEHID)
+        if (device->info.dwType != RIM_TYPEHID)
         {
             to_copy_bytes = 0;
             *data_size = 0;
diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c
index 4ce2c5643cd..b45adeb3cae 100644
--- a/dlls/user32/tests/input.c
+++ b/dlls/user32/tests/input.c
@@ -1923,8 +1923,7 @@ static void test_GetRawInputDeviceList(void)
          * understand that; so use the \\?\ prefix instead */
         name[1] = '\\';
         file = CreateFileW(name, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
-        todo_wine_if(info.dwType == RIM_TYPEMOUSE || info.dwType == RIM_TYPEKEYBOARD)
-            ok(file != INVALID_HANDLE_VALUE, "Failed to open %s, error %u\n", wine_dbgstr_w(name), GetLastError());
+        ok(file != INVALID_HANDLE_VALUE, "Failed to open %s, error %u\n", wine_dbgstr_w(name), GetLastError());
 
         sz = 0;
         ret = pGetRawInputDeviceInfoW(devices[i].hDevice, RIDI_PREPARSEDDATA, NULL, &sz);




More information about the wine-cvs mailing list