[PATCH 2/6] winebus.sys: Report WINEBUS\WINE_COMP_XINPUT compatible id for gamepads.

Rémi Bernon rbernon at codeweavers.com
Thu Aug 26 00:59:00 CDT 2021


In addition, and before WINEBUS\WINE_COMP_HID, so that new xinput.sys
will match first as soon as it is introduced.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 dlls/winebus.sys/main.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c
index c09ea1c2828..8b9aa25feb9 100644
--- a/dlls/winebus.sys/main.c
+++ b/dlls/winebus.sys/main.c
@@ -242,19 +242,27 @@ static WCHAR *get_hardware_ids(DEVICE_OBJECT *device)
 
 static WCHAR *get_compatible_ids(DEVICE_OBJECT *device)
 {
+    static const WCHAR xinput_compat[] =
+    {
+        'W','I','N','E','B','U','S','\\','W','I','N','E','_','C','O','M','P','_','X','I','N','P','U','T',0
+    };
     static const WCHAR hid_compat[] =
     {
         'W','I','N','E','B','U','S','\\','W','I','N','E','_','C','O','M','P','_','H','I','D',0
     };
-    DWORD pos = 0, len = 0, hid_compat_len;
+    struct device_extension *ext = (struct device_extension *)device->DeviceExtension;
+    DWORD pos = 0, len = 0, hid_compat_len, xinput_compat_len;
     WCHAR *dst;
 
+    xinput_compat_len = strlenW(xinput_compat);
     hid_compat_len = strlenW(hid_compat);
 
+    if (ext->is_gamepad) len += xinput_compat_len + 1;
     len += hid_compat_len + 1;
 
     if ((dst = ExAllocatePool(PagedPool, (len + 1) * sizeof(WCHAR))))
     {
+        if (ext->is_gamepad) pos += snprintfW(dst + pos, len - pos, xinput_compat) + 1;
         pos += snprintfW(dst + pos, len - pos, hid_compat) + 1;
         dst[pos] = 0;
     }
-- 
2.33.0




More information about the wine-devel mailing list