[PATCH 2/3] winebus.sys: Make the device and instance IDs consistent.
Zebediah Figura
zfigura at codeweavers.com
Tue Jun 4 09:51:04 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 | 27 +++++++++++++++++++++++----
1 file changed, 23 insertions(+), 4 deletions(-)
diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c
index 73e3154..c42128c 100644
--- a/dlls/winebus.sys/main.c
+++ b/dlls/winebus.sys/main.c
@@ -168,13 +168,32 @@ 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;
WCHAR *dst;
+ DWORD len;
- if ((dst = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR))))
- sprintfW(dst, formatW, ext->busid, ext->vid, ext->pid);
+ if (ext->input == (WORD)-1)
+ {
+ len = snprintfW(NULL, 0, formatW, ext->busid, ext->vid, ext->pid);
+ if ((dst = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR))))
+ {
+ sprintfW(dst, formatW, ext->busid, ext->vid, ext->pid);
+ }
+ }
+ else
+ {
+ len = snprintfW(NULL, 0, format_inputW, ext->busid, ext->vid, ext->pid,
+ ext->is_gamepad ? igW : miW, ext->input);
+ if ((dst = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR))))
+ {
+ 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