[PATCH 1/4] hidclass.sys: Expose an ioctl to retrieve the raw input handle.

Zebediah Figura zfigura at codeweavers.com
Mon Jun 6 13:53:29 CDT 2022


Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
 dlls/hidclass.sys/device.c | 14 ++++++++++++++
 include/ddk/hidclass.h     |  5 +++++
 2 files changed, 19 insertions(+)

diff --git a/dlls/hidclass.sys/device.c b/dlls/hidclass.sys/device.c
index 9d917bbc674..db645495987 100644
--- a/dlls/hidclass.sys/device.c
+++ b/dlls/hidclass.sys/device.c
@@ -655,6 +655,20 @@ NTSTATUS WINAPI pdo_ioctl(DEVICE_OBJECT *device, IRP *irp)
         case IOCTL_HID_SET_OUTPUT_REPORT:
             status = hid_device_xfer_report( ext, code, irp );
             break;
+
+        case IOCTL_HID_GET_RAWINPUT_HANDLE:
+            if (irpsp->Parameters.DeviceIoControl.OutputBufferLength < sizeof(ULONG))
+            {
+                status = STATUS_BUFFER_OVERFLOW;
+            }
+            else
+            {
+                *(ULONG *)irp->AssociatedIrp.SystemBuffer = ext->u.pdo.rawinput_handle;
+                irp->IoStatus.Information = sizeof(ULONG);
+                status = STATUS_SUCCESS;
+            }
+            break;
+
         default:
         {
             ULONG code = irpsp->Parameters.DeviceIoControl.IoControlCode;
diff --git a/include/ddk/hidclass.h b/include/ddk/hidclass.h
index f5439ac8e95..253f309474d 100644
--- a/include/ddk/hidclass.h
+++ b/include/ddk/hidclass.h
@@ -58,6 +58,11 @@ DEFINE_GUID (GUID_DEVINTERFACE_HID, \
 #define IOCTL_HID_SET_DRIVER_CONFIG           HID_BUFFER_CTL_CODE(101)
 #define IOCTL_HID_GET_MS_GENRE_DESCRIPTOR     HID_OUT_CTL_CODE(121)
 
+/* Wine extension */
+#ifdef __WINESRC__
+#define IOCTL_HID_GET_RAWINPUT_HANDLE         HID_BUFFER_CTL_CODE(300)
+#endif
+
 typedef struct _HID_COLLECTION_INFORMATION {
     ULONG   DescriptorSize;
     BOOLEAN Polled;
-- 
2.35.1




More information about the wine-devel mailing list