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

Rémi Bernon rbernon at codeweavers.com
Thu Jun 9 03:08:09 CDT 2022


From: Zebediah Figura <zfigura at codeweavers.com>

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---

v2: Fix some style nitpicks, move the ioctl to wine/hid.h and name it
    with a wine prefix, similarly to IOCTL_HID_GET_MS_GENRE_DESCRIPTOR.

 dlls/hidclass.sys/device.c | 12 ++++++++++++
 include/wine/hid.h         |  2 ++
 2 files changed, 14 insertions(+)

diff --git a/dlls/hidclass.sys/device.c b/dlls/hidclass.sys/device.c
index 9d917bbc674..7c0dbdcbc10 100644
--- a/dlls/hidclass.sys/device.c
+++ b/dlls/hidclass.sys/device.c
@@ -655,6 +655,18 @@ 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_WINE_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/wine/hid.h b/include/wine/hid.h
index 236888cbdc7..6a92317551f 100644
--- a/include/wine/hid.h
+++ b/include/wine/hid.h
@@ -227,4 +227,6 @@ struct hid_preparsed_data
 #define PID_USAGE_CREATE_NEW_EFFECT_REPORT         ((USAGE) 0xab)
 #define PID_USAGE_RAM_POOL_AVAILABLE               ((USAGE) 0xac)
 
+#define IOCTL_HID_GET_WINE_RAWINPUT_HANDLE         HID_BUFFER_CTL_CODE(300)
+
 #endif /* __WINE_PARSE_H */
-- 
2.36.1




More information about the wine-devel mailing list