Rémi Bernon : hidclass.sys: Use a separate class for devices matching WINEXINPUT\*&XI_*.

Alexandre Julliard julliard at winehq.org
Fri Sep 3 16:25:29 CDT 2021


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

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Fri Sep  3 07:57:36 2021 +0200

hidclass.sys: Use a separate class for devices matching WINEXINPUT\*&XI_*.

Although these devices will be HID compatible we need to not have them
listed on the HID class, as they should only be used internally by Wine
XInput implementation.

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

---

 dlls/hidclass.sys/hid.h | 1 +
 dlls/hidclass.sys/pnp.c | 9 ++++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/dlls/hidclass.sys/hid.h b/dlls/hidclass.sys/hid.h
index 1ca6a926872..e65fabb2aea 100644
--- a/dlls/hidclass.sys/hid.h
+++ b/dlls/hidclass.sys/hid.h
@@ -84,6 +84,7 @@ typedef struct _BASE_DEVICE_EXTENSION
      * for convenience. */
     WCHAR device_id[MAX_DEVICE_ID_LEN];
     WCHAR instance_id[MAX_DEVICE_ID_LEN];
+    const GUID *class_guid;
 
     BOOL is_fdo;
 } BASE_DEVICE_EXTENSION;
diff --git a/dlls/hidclass.sys/pnp.c b/dlls/hidclass.sys/pnp.c
index db45aea2fd3..8755afbce6c 100644
--- a/dlls/hidclass.sys/pnp.c
+++ b/dlls/hidclass.sys/pnp.c
@@ -38,6 +38,7 @@
 WINE_DEFAULT_DEBUG_CHANNEL(hid);
 
 DEFINE_DEVPROPKEY(DEVPROPKEY_HID_HANDLE, 0xbc62e415, 0xf4fe, 0x405c, 0x8e, 0xda, 0x63, 0x6f, 0xb5, 0x9f, 0x08, 0x98, 2);
+DEFINE_GUID(GUID_DEVINTERFACE_WINEXINPUT, 0x6c53d5fd, 0x6480, 0x440f, 0xb6, 0x18, 0x47, 0x67, 0x50, 0xc5, 0xe1, 0xa6);
 
 #if defined(__i386__) && !defined(_WIN32)
 
@@ -133,6 +134,7 @@ static NTSTATUS WINAPI driver_add_device(DRIVER_OBJECT *driver, DEVICE_OBJECT *b
 {
     WCHAR device_id[MAX_DEVICE_ID_LEN], instance_id[MAX_DEVICE_ID_LEN];
     BASE_DEVICE_EXTENSION *ext;
+    BOOL is_xinput_class;
     DEVICE_OBJECT *fdo;
     NTSTATUS status;
     minidriver *minidriver;
@@ -166,6 +168,10 @@ static NTSTATUS WINAPI driver_add_device(DRIVER_OBJECT *driver, DEVICE_OBJECT *b
     swprintf(ext->device_id, ARRAY_SIZE(ext->device_id), L"HID\\%s", wcsrchr(device_id, '\\') + 1);
     wcscpy(ext->instance_id, instance_id);
 
+    is_xinput_class = !wcsncmp(device_id, L"WINEXINPUT\\", 7) && wcsstr(device_id, L"&XI_") != NULL;
+    if (is_xinput_class) ext->class_guid = &GUID_DEVINTERFACE_WINEXINPUT;
+    else ext->class_guid = &GUID_DEVINTERFACE_HID;
+
     status = minidriver->AddDevice(minidriver->minidriver.DriverObject, fdo);
     if (status != STATUS_SUCCESS)
     {
@@ -220,6 +226,7 @@ static void create_child(minidriver *minidriver, DEVICE_OBJECT *fdo)
     KeInitializeSpinLock(&pdo_ext->u.pdo.irp_queue_lock);
     wcscpy(pdo_ext->device_id, fdo_ext->device_id);
     wcscpy(pdo_ext->instance_id, fdo_ext->instance_id);
+    pdo_ext->class_guid = fdo_ext->class_guid;
 
     pdo_ext->u.pdo.information.VendorID = attr.VendorID;
     pdo_ext->u.pdo.information.ProductID = attr.ProductID;
@@ -445,7 +452,7 @@ static NTSTATUS pdo_pnp(DEVICE_OBJECT *device, IRP *irp)
         }
 
         case IRP_MN_START_DEVICE:
-            if ((status = IoRegisterDeviceInterface(device, &GUID_DEVINTERFACE_HID, NULL, &ext->u.pdo.link_name)))
+            if ((status = IoRegisterDeviceInterface(device, ext->class_guid, NULL, &ext->u.pdo.link_name)))
             {
                 ERR("Failed to register interface, status %#x.\n", status);
                 break;




More information about the wine-cvs mailing list