Rémi Bernon : winebus.sys: Use WINEBUS\ as a common hardware ids prefix.

Alexandre Julliard julliard at winehq.org
Mon Sep 20 16:26:21 CDT 2021


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

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Mon Sep 20 09:37:05 2021 +0200

winebus.sys: Use WINEBUS\ as a common hardware ids prefix.

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

---

 dlls/winebus.sys/main.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c
index 92a41e4d8ef..0fd7a405f80 100644
--- a/dlls/winebus.sys/main.c
+++ b/dlls/winebus.sys/main.c
@@ -229,13 +229,22 @@ static WCHAR *get_device_id(DEVICE_OBJECT *device)
 
 static WCHAR *get_hardware_ids(DEVICE_OBJECT *device)
 {
+    static const WCHAR input_format[] = L"&MI_%02u";
+    static const WCHAR winebus_format[] = L"WINEBUS\\VID_%04X&PID_%04X";
     struct device_extension *ext = (struct device_extension *)device->DeviceExtension;
+    DWORD pos = 0, len = 0, input_len = 0, winebus_len = 25;
     WCHAR *dst;
 
-    if ((dst = ExAllocatePool(PagedPool, (wcslen(ext->desc.busid) + 2) * sizeof(WCHAR))))
+    if (ext->desc.input != -1) input_len = 14;
+
+    len += winebus_len + input_len + 1;
+
+    if ((dst = ExAllocatePool(PagedPool, (len + 1) * sizeof(WCHAR))))
     {
-        wcscpy(dst, ext->desc.busid);
-        dst[wcslen(dst) + 1] = 0;
+        pos += swprintf(dst + pos, len - pos, winebus_format, ext->desc.vid, ext->desc.pid);
+        if (input_len) pos += swprintf(dst + pos, len - pos, input_format, ext->desc.input);
+        pos += 1;
+        dst[pos] = 0;
     }
 
     return dst;




More information about the wine-cvs mailing list