[PATCH 2/2] hidclass.sys: Create Driver reg key for HID devices.
Arkadiusz Hiler
ahiler at codeweavers.com
Tue Apr 13 10:31:13 CDT 2021
SDL doesn't use HID devices directly if they don't have SPDRP_DRIVER
registry property set. It uses another input method as a fallback instead.
Since SDL_Joystick GUIDs are dependant on the input method this can mess
with mappings and controller type detection.
The change fixes Hades wrongly displaying Xbox prompts with Sony controllers
over winebus.sys/bus_udev.c.
Signed-off-by: Arkadiusz Hiler <ahiler at codeweavers.com>
---
dlls/hidclass.sys/Makefile.in | 2 +-
dlls/hidclass.sys/device.c | 9 +++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/dlls/hidclass.sys/Makefile.in b/dlls/hidclass.sys/Makefile.in
index be4af747853..ffc49e65257 100644
--- a/dlls/hidclass.sys/Makefile.in
+++ b/dlls/hidclass.sys/Makefile.in
@@ -1,7 +1,7 @@
MODULE = hidclass.sys
IMPORTLIB = hidclass
IMPORTS = hal ntoskrnl
-DELAYIMPORTS = setupapi hid
+DELAYIMPORTS = setupapi hid kernelbase
EXTRADLLFLAGS = -mno-cygwin
diff --git a/dlls/hidclass.sys/device.c b/dlls/hidclass.sys/device.c
index fc1dfd07db1..4554181e8bd 100644
--- a/dlls/hidclass.sys/device.c
+++ b/dlls/hidclass.sys/device.c
@@ -80,6 +80,7 @@ NTSTATUS HID_LinkDevice(DEVICE_OBJECT *device)
HDEVINFO devinfo;
GUID hidGuid;
BASE_DEVICE_EXTENSION *ext;
+ HKEY hkey;
HidD_GetHidGuid(&hidGuid);
ext = device->DeviceExtension;
@@ -104,6 +105,14 @@ NTSTATUS HID_LinkDevice(DEVICE_OBJECT *device)
FIXME( "failed to register device info %x\n", GetLastError());
goto error;
}
+
+ hkey = SetupDiCreateDevRegKeyW(devinfo, &Data, DICS_FLAG_GLOBAL, 0, DIREG_DRV, NULL, NULL);
+ if (hkey == INVALID_HANDLE_VALUE)
+ {
+ FIXME( "failed to create driver reg key %x\n", GetLastError() );
+ goto error;
+ }
+ RegCloseKey(hkey);
}
else if (GetLastError() != ERROR_DEVINST_ALREADY_EXISTS)
{
--
2.31.1
More information about the wine-devel
mailing list