[PATCH v3 2/4] winebus.sys: Report WINEBUS\WINE_COMP_XINPUT compatible id for gamepads.
Rémi Bernon
rbernon at codeweavers.com
Mon Aug 30 04:06:15 CDT 2021
In addition, and before WINEBUS\WINE_COMP_HID, so that winexinput.sys
will match first as soon as it is introduced.
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
dlls/winebus.sys/main.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c
index 49385576d62..e58bf873eac 100644
--- a/dlls/winebus.sys/main.c
+++ b/dlls/winebus.sys/main.c
@@ -242,16 +242,24 @@ static WCHAR *get_hardware_ids(DEVICE_OBJECT *device)
static WCHAR *get_compatible_ids(DEVICE_OBJECT *device)
{
+ static const WCHAR xinput_compat[] =
+ {
+ 'W','I','N','E','B','U','S','\\','W','I','N','E','_','C','O','M','P','_','X','I','N','P','U','T',0
+ };
static const WCHAR hid_compat[] =
{
'W','I','N','E','B','U','S','\\','W','I','N','E','_','C','O','M','P','_','H','I','D',0
};
+ struct device_extension *ext = (struct device_extension *)device->DeviceExtension;
DWORD size = sizeof(hid_compat);
WCHAR *dst;
+ if (ext->is_gamepad) size += sizeof(xinput_compat);
+
if ((dst = ExAllocatePool(PagedPool, size + sizeof(WCHAR))))
{
- memcpy(dst, hid_compat, sizeof(hid_compat));
+ if (ext->is_gamepad) memcpy(dst, xinput_compat, sizeof(xinput_compat));
+ memcpy((char *)dst + size - sizeof(hid_compat), hid_compat, sizeof(hid_compat));
dst[size / sizeof(WCHAR)] = 0;
}
--
2.33.0
More information about the wine-devel
mailing list