hidclass.sys: Assign rawinput device handle in HID_LinkDevice.
The handles are just numeric values and not real object handles, they are used in the hDevice field of the RAWINPUTHEADER struct. They will also be used as an HID rawinput device array index on the server side. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506 Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Arkadiusz Hiler <ahiler@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
123c17aa92
commit
f4d5f7e88a
|
@ -71,6 +71,17 @@ NTSTATUS HID_CreateDevice(DEVICE_OBJECT *native_device, HID_MINIDRIVER_REGISTRAT
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* user32 reserves 1 & 2 for winemouse and winekeyboard,
|
||||||
|
* keep this in sync with user_private.h */
|
||||||
|
#define WINE_MOUSE_HANDLE 1
|
||||||
|
#define WINE_KEYBOARD_HANDLE 2
|
||||||
|
|
||||||
|
static UINT32 alloc_rawinput_handle(void)
|
||||||
|
{
|
||||||
|
static LONG counter = WINE_KEYBOARD_HANDLE + 1;
|
||||||
|
return InterlockedIncrement(&counter);
|
||||||
|
}
|
||||||
|
|
||||||
NTSTATUS HID_LinkDevice(DEVICE_OBJECT *device)
|
NTSTATUS HID_LinkDevice(DEVICE_OBJECT *device)
|
||||||
{
|
{
|
||||||
WCHAR device_instance_id[MAX_DEVICE_ID_LEN];
|
WCHAR device_instance_id[MAX_DEVICE_ID_LEN];
|
||||||
|
@ -125,7 +136,13 @@ NTSTATUS HID_LinkDevice(DEVICE_OBJECT *device)
|
||||||
{
|
{
|
||||||
if (!IoRegisterDeviceInterface(device, &GUID_DEVINTERFACE_MOUSE, NULL, &ext->mouse_link_name))
|
if (!IoRegisterDeviceInterface(device, &GUID_DEVINTERFACE_MOUSE, NULL, &ext->mouse_link_name))
|
||||||
ext->is_mouse = TRUE;
|
ext->is_mouse = TRUE;
|
||||||
|
ext->rawinput_handle = WINE_MOUSE_HANDLE;
|
||||||
}
|
}
|
||||||
|
else if (ext->preparseData->caps.UsagePage == HID_USAGE_PAGE_GENERIC
|
||||||
|
&& ext->preparseData->caps.Usage == HID_USAGE_GENERIC_KEYBOARD)
|
||||||
|
ext->rawinput_handle = WINE_KEYBOARD_HANDLE;
|
||||||
|
else
|
||||||
|
ext->rawinput_handle = alloc_rawinput_handle();
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,7 @@ typedef struct _BASE_DEVICE_EXTENSION {
|
||||||
struct ReportRingBuffer *ring_buffer;
|
struct ReportRingBuffer *ring_buffer;
|
||||||
HANDLE halt_event;
|
HANDLE halt_event;
|
||||||
HANDLE thread;
|
HANDLE thread;
|
||||||
|
UINT32 rawinput_handle;
|
||||||
|
|
||||||
KSPIN_LOCK irp_queue_lock;
|
KSPIN_LOCK irp_queue_lock;
|
||||||
LIST_ENTRY irp_queue;
|
LIST_ENTRY irp_queue;
|
||||||
|
|
Loading…
Reference in New Issue