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@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Rémi Bernon 2021-09-03 07:57:36 +02:00 committed by Alexandre Julliard
parent 90175a745c
commit ed63e1bcf0
2 changed files with 9 additions and 1 deletions

View File

@ -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;

View File

@ -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;