Rémi Bernon : winexinput.sys: Override the product string for internal devices.

Alexandre Julliard julliard at winehq.org
Fri Sep 24 15:32:01 CDT 2021


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

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Fri Sep 24 10:10:33 2021 +0200

winexinput.sys: Override the product string for internal devices.

So DirectInput registry keys can match both the gamepad and the internal
device.

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

---

 dlls/winexinput.sys/main.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/dlls/winexinput.sys/main.c b/dlls/winexinput.sys/main.c
index 667ce867269..79c566e7cc8 100644
--- a/dlls/winexinput.sys/main.c
+++ b/dlls/winexinput.sys/main.c
@@ -323,14 +323,14 @@ struct device_strings
 
 static const struct device_strings device_strings[] =
 {
-    { .id = L"VID_045E&PID_028E&IG_00", .product = L"Controller (XBOX 360 For Windows)" },
-    { .id = L"VID_045E&PID_028F&IG_00", .product = L"Controller (XBOX 360 For Windows)" },
-    { .id = L"VID_045E&PID_02D1&IG_00", .product = L"Controller (XBOX One For Windows)" },
-    { .id = L"VID_045E&PID_02DD&IG_00", .product = L"Controller (XBOX One For Windows)" },
-    { .id = L"VID_045E&PID_02E3&IG_00", .product = L"Controller (XBOX One For Windows)" },
-    { .id = L"VID_045E&PID_02EA&IG_00", .product = L"Controller (XBOX One For Windows)" },
-    { .id = L"VID_045E&PID_02FD&IG_00", .product = L"Controller (XBOX One For Windows)" },
-    { .id = L"VID_045E&PID_0719&IG_00", .product = L"Controller (XBOX 360 For Windows)" },
+    { .id = L"VID_045E&PID_028E", .product = L"Controller (XBOX 360 For Windows)" },
+    { .id = L"VID_045E&PID_028F", .product = L"Controller (XBOX 360 For Windows)" },
+    { .id = L"VID_045E&PID_02D1", .product = L"Controller (XBOX One For Windows)" },
+    { .id = L"VID_045E&PID_02DD", .product = L"Controller (XBOX One For Windows)" },
+    { .id = L"VID_045E&PID_02E3", .product = L"Controller (XBOX One For Windows)" },
+    { .id = L"VID_045E&PID_02EA", .product = L"Controller (XBOX One For Windows)" },
+    { .id = L"VID_045E&PID_02FD", .product = L"Controller (XBOX One For Windows)" },
+    { .id = L"VID_045E&PID_0719", .product = L"Controller (XBOX 360 For Windows)" },
 };
 
 static const WCHAR *find_product_string(const WCHAR *device_id)
@@ -339,7 +339,7 @@ static const WCHAR *find_product_string(const WCHAR *device_id)
     DWORD i;
 
     for (i = 0; i < ARRAY_SIZE(device_strings); ++i)
-        if (!wcsicmp(device_strings[i].id, match_id))
+        if (!wcsnicmp(device_strings[i].id, match_id, 17))
             return device_strings[i].product;
 
     return NULL;
@@ -459,7 +459,7 @@ static NTSTATUS WINAPI internal_ioctl(DEVICE_OBJECT *device, IRP *irp)
     TRACE("device %p, irp %p, code %#x, bus_device %p.\n", device, irp, code, fdo->bus_device);
 
     if (code == IOCTL_HID_READ_REPORT) return try_complete_pending_read(device, irp);
-    if (impl->is_gamepad) return gamepad_internal_ioctl(device, irp);
+    if (impl->is_gamepad || code == IOCTL_HID_GET_STRING) return gamepad_internal_ioctl(device, irp);
 
     IoSkipCurrentIrpStackLocation(irp);
     return IoCallDriver(fdo->bus_device, irp);




More information about the wine-cvs mailing list