[PATCH v2 2/3] winebus.sys: Make the device and instance IDs consistent.

Zebediah Figura zfigura at codeweavers.com
Tue Jun 4 12:45:21 CDT 2019


From: Zebediah Figura <z.figura12 at gmail.com>

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/winebus.sys/main.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c
index 73e3154..291ec74 100644
--- a/dlls/winebus.sys/main.c
+++ b/dlls/winebus.sys/main.c
@@ -168,13 +168,26 @@ static WCHAR *get_instance_id(DEVICE_OBJECT *device)
 
 static WCHAR *get_device_id(DEVICE_OBJECT *device)
 {
-    static const WCHAR formatW[] =  {'%','s','\\','V','i','d','_','%','0','4','x','&','P','i','d','_','%','0','4','x',0};
+    static const WCHAR formatW[] = {'%','s','\\','v','i','d','_','%','0','4','x',
+            '&','p','i','d','_','%','0','4','x',0};
+    static const WCHAR format_inputW[] = {'%','s','\\','v','i','d','_','%','0','4','x',
+            '&','p','i','d','_','%','0','4','x','&','%','s','_','%','i',0};
     struct device_extension *ext = (struct device_extension *)device->DeviceExtension;
-    DWORD len = strlenW(ext->busid) + 19;
+    DWORD len = strlenW(ext->busid) + 34;
     WCHAR *dst;
 
     if ((dst = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR))))
-        sprintfW(dst, formatW, ext->busid, ext->vid, ext->pid);
+    {
+        if (ext->input == (WORD)-1)
+        {
+            sprintfW(dst, formatW, ext->busid, ext->vid, ext->pid);
+        }
+        else
+        {
+            sprintfW(dst, format_inputW, ext->busid, ext->vid, ext->pid,
+                    ext->is_gamepad ? igW : miW, ext->input);
+        }
+    }
 
     return dst;
 }
-- 
2.7.4




More information about the wine-devel mailing list