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:
parent
90175a745c
commit
ed63e1bcf0
|
@ -84,6 +84,7 @@ typedef struct _BASE_DEVICE_EXTENSION
|
||||||
* for convenience. */
|
* for convenience. */
|
||||||
WCHAR device_id[MAX_DEVICE_ID_LEN];
|
WCHAR device_id[MAX_DEVICE_ID_LEN];
|
||||||
WCHAR instance_id[MAX_DEVICE_ID_LEN];
|
WCHAR instance_id[MAX_DEVICE_ID_LEN];
|
||||||
|
const GUID *class_guid;
|
||||||
|
|
||||||
BOOL is_fdo;
|
BOOL is_fdo;
|
||||||
} BASE_DEVICE_EXTENSION;
|
} BASE_DEVICE_EXTENSION;
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(hid);
|
WINE_DEFAULT_DEBUG_CHANNEL(hid);
|
||||||
|
|
||||||
DEFINE_DEVPROPKEY(DEVPROPKEY_HID_HANDLE, 0xbc62e415, 0xf4fe, 0x405c, 0x8e, 0xda, 0x63, 0x6f, 0xb5, 0x9f, 0x08, 0x98, 2);
|
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)
|
#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];
|
WCHAR device_id[MAX_DEVICE_ID_LEN], instance_id[MAX_DEVICE_ID_LEN];
|
||||||
BASE_DEVICE_EXTENSION *ext;
|
BASE_DEVICE_EXTENSION *ext;
|
||||||
|
BOOL is_xinput_class;
|
||||||
DEVICE_OBJECT *fdo;
|
DEVICE_OBJECT *fdo;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
minidriver *minidriver;
|
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);
|
swprintf(ext->device_id, ARRAY_SIZE(ext->device_id), L"HID\\%s", wcsrchr(device_id, '\\') + 1);
|
||||||
wcscpy(ext->instance_id, instance_id);
|
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);
|
status = minidriver->AddDevice(minidriver->minidriver.DriverObject, fdo);
|
||||||
if (status != STATUS_SUCCESS)
|
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);
|
KeInitializeSpinLock(&pdo_ext->u.pdo.irp_queue_lock);
|
||||||
wcscpy(pdo_ext->device_id, fdo_ext->device_id);
|
wcscpy(pdo_ext->device_id, fdo_ext->device_id);
|
||||||
wcscpy(pdo_ext->instance_id, fdo_ext->instance_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.VendorID = attr.VendorID;
|
||||||
pdo_ext->u.pdo.information.ProductID = attr.ProductID;
|
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:
|
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);
|
ERR("Failed to register interface, status %#x.\n", status);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue