Rémi Bernon : hidclass.sys: Call IoInvalidateDeviceRelations before IoSetDevicePropertyData.

Alexandre Julliard julliard at winehq.org
Wed May 5 16:09:01 CDT 2021


Module: wine
Branch: master
Commit: af2b2d0433dd1a591fe574945699f32d467cd4b0
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=af2b2d0433dd1a591fe574945699f32d467cd4b0

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Wed May  5 11:51:54 2021 +0200

hidclass.sys: Call IoInvalidateDeviceRelations before IoSetDevicePropertyData.

Otherwise setupapi may fail to find the device on which to set the
property. This triggers messages like the following the first time a
device is created (on prefix creation for mouse and keyboard devices):

  IoSetDevicePropertyData Failed to open device, error 0xe000020b.

Some IoSetDevicePropertyData implementation detail makes it always
return successfully but it's not doing anything and user32 will then
ignore the device when it enumerates rawinput devices.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/hidclass.sys/pnp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/hidclass.sys/pnp.c b/dlls/hidclass.sys/pnp.c
index 2769b78c13b..4490f1eba23 100644
--- a/dlls/hidclass.sys/pnp.c
+++ b/dlls/hidclass.sys/pnp.c
@@ -245,6 +245,8 @@ static void create_child(minidriver *minidriver, DEVICE_OBJECT *fdo)
     else
         pdo_ext->u.pdo.rawinput_handle = alloc_rawinput_handle();
 
+    IoInvalidateDeviceRelations(fdo_ext->u.fdo.hid_ext.PhysicalDeviceObject, BusRelations);
+
     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)))
@@ -254,8 +256,6 @@ static void create_child(minidriver *minidriver, DEVICE_OBJECT *fdo)
         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(




More information about the wine-cvs mailing list