[PATCH 5/8] winebus.sys: Always add a non &MI_XX suffixed hardware id.

Rémi Bernon rbernon at codeweavers.com
Mon Sep 6 01:40:36 CDT 2021


Depending on the internal bus, we may find the same kind of device with
different input number. For instance SDL bus has no way of figuring an
input number, and it will not have any, but UDEV will have one for every
device.

This will help matching devices with their VID_XXXX&PID_XXXX ids, by
matching both the &MI_XX suffixed (if any) and non-suffixed IDs.

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

diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c
index 785fcd46cb5..d6a16a9a0b2 100644
--- a/dlls/winebus.sys/main.c
+++ b/dlls/winebus.sys/main.c
@@ -301,12 +301,18 @@ static WCHAR *get_hardware_ids(DEVICE_OBJECT *device)
 
     if (ext->desc.input != -1) input_len = 14;
 
-    len += winebus_len + input_len + 1;
+    if (input_len) len += winebus_len + input_len + 1;
+    len += winebus_len + 1;
 
     if ((dst = ExAllocatePool(PagedPool, (len + 1) * sizeof(WCHAR))))
     {
+        if (input_len)
+        {
+            pos += snprintfW(dst + pos, len - pos, winebus_formatW, ext->desc.vid, ext->desc.pid);
+            pos += snprintfW(dst + pos, len - pos, input_formatW, ext->desc.input);
+            pos += 1;
+        }
         pos += snprintfW(dst + pos, len - pos, winebus_formatW, ext->desc.vid, ext->desc.pid);
-        if (input_len) pos += snprintfW(dst + pos, len - pos, input_formatW, ext->desc.input);
         pos += 1;
         dst[pos] = 0;
     }
-- 
2.33.0




More information about the wine-devel mailing list