Commit f4d5f7e8 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

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=50506Signed-off-by: 's avatarRémi Bernon <rbernon@codeweavers.com> Signed-off-by: 's avatarArkadiusz Hiler <ahiler@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 123c17aa
......@@ -71,6 +71,17 @@ NTSTATUS HID_CreateDevice(DEVICE_OBJECT *native_device, HID_MINIDRIVER_REGISTRAT
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)
{
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))
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;
......
......@@ -51,6 +51,7 @@ typedef struct _BASE_DEVICE_EXTENSION {
struct ReportRingBuffer *ring_buffer;
HANDLE halt_event;
HANDLE thread;
UINT32 rawinput_handle;
KSPIN_LOCK irp_queue_lock;
LIST_ENTRY irp_queue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment