[PATCH 2/5] hidclass.sys: Assign rawinput handles through device properties.

Rémi Bernon rbernon at codeweavers.com
Mon Apr 26 05:38:00 CDT 2021


Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 dlls/hidclass.sys/device.c |  4 ----
 dlls/hidclass.sys/pnp.c    | 18 ++++++++++++++++--
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/dlls/hidclass.sys/device.c b/dlls/hidclass.sys/device.c
index a7825080deb..7dc97781b6b 100644
--- a/dlls/hidclass.sys/device.c
+++ b/dlls/hidclass.sys/device.c
@@ -21,7 +21,6 @@
 #include <stdarg.h>
 #define NONAMELESSUNION
 #define NONAMELESSSTRUCT
-#include "initguid.h"
 #include "hid.h"
 #include "winreg.h"
 #include "winuser.h"
@@ -30,9 +29,6 @@
 #include "ddk/hidsdi.h"
 #include "ddk/hidtypes.h"
 #include "ddk/wdm.h"
-#include "devguid.h"
-#include "ntddmou.h"
-#include "ntddkbd.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(hid);
 WINE_DECLARE_DEBUG_CHANNEL(hid_report);
diff --git a/dlls/hidclass.sys/pnp.c b/dlls/hidclass.sys/pnp.c
index 3d81c16356e..2769b78c13b 100644
--- a/dlls/hidclass.sys/pnp.c
+++ b/dlls/hidclass.sys/pnp.c
@@ -21,7 +21,10 @@
 #define NONAMELESSUNION
 #include <unistd.h>
 #include <stdarg.h>
+#include "initguid.h"
 #include "hid.h"
+#include "devguid.h"
+#include "devpkey.h"
 #include "ntddmou.h"
 #include "ntddkbd.h"
 #include "ddk/hidtypes.h"
@@ -33,6 +36,8 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(hid);
 
+DEFINE_DEVPROPKEY(DEVPROPKEY_HID_HANDLE, 0xbc62e415, 0xf4fe, 0x405c, 0x8e, 0xda, 0x63, 0x6f, 0xb5, 0x9f, 0x08, 0x98, 2);
+
 #if defined(__i386__) && !defined(_WIN32)
 
 extern void * WINAPI wrap_fastcall_func1( void *func, const void *a );
@@ -231,8 +236,6 @@ static void create_child(minidriver *minidriver, DEVICE_OBJECT *fdo)
 
     pdo_ext->u.pdo.information.DescriptorSize = pdo_ext->u.pdo.preparsed_data->dwSize;
 
-    IoInvalidateDeviceRelations(fdo_ext->u.fdo.hid_ext.PhysicalDeviceObject, BusRelations);
-
     page = pdo_ext->u.pdo.preparsed_data->caps.UsagePage;
     usage = pdo_ext->u.pdo.preparsed_data->caps.Usage;
     if (page == HID_USAGE_PAGE_GENERIC && usage == HID_USAGE_GENERIC_MOUSE)
@@ -242,6 +245,17 @@ static void create_child(minidriver *minidriver, DEVICE_OBJECT *fdo)
     else
         pdo_ext->u.pdo.rawinput_handle = alloc_rawinput_handle();
 
+    if ((status = IoSetDevicePropertyData(child_pdo, &DEVPROPKEY_HID_HANDLE, LOCALE_NEUTRAL,
+                                          PLUGPLAY_PROPERTY_PERSISTENT, DEVPROP_TYPE_UINT32,
+                                          sizeof(pdo_ext->u.pdo.rawinput_handle), &pdo_ext->u.pdo.rawinput_handle)))
+    {
+        ERR("Failed to set device handle property, status %x\n", status);
+        IoDeleteDevice(child_pdo);
+        return;
+    }
+
+    IoInvalidateDeviceRelations(fdo_ext->u.fdo.hid_ext.PhysicalDeviceObject, BusRelations);
+
     pdo_ext->u.pdo.poll_interval = DEFAULT_POLL_INTERVAL;
 
     pdo_ext->u.pdo.ring_buffer = RingBuffer_Create(
-- 
2.31.0




More information about the wine-devel mailing list