Signed-off-by: Rémi Bernon rbernon@codeweavers.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 6093a0b79eb..785fcd46cb5 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -289,13 +289,26 @@ static WCHAR *get_device_id(DEVICE_OBJECT *device)
static WCHAR *get_hardware_ids(DEVICE_OBJECT *device) { + static const WCHAR input_formatW[] = {'&','M','I','_','%','0','2','u',0}; + static const WCHAR winebus_formatW[] = + { + 'W','I','N','E','B','U','S','\','V','I','D','_','%','0','4','X', + '&','P','I','D','_','%','0','4','X',0 + }; 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, (strlenW(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)))) { - strcpyW(dst, ext->desc.busid); - dst[strlenW(dst) + 1] = 0; + 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; }
return dst;