wine-staging/patches/user32-rawinput-hid/0017-hidclass.sys-Assign-rawinput-handles-through-device-.patch

57 lines
1.8 KiB
Diff
Raw Normal View History

From 5e5233a4389f6e4b89337c502c91ea003cd48c5c Mon Sep 17 00:00:00 2001
From: Arkadiusz Hiler <ahiler@codeweavers.com>
Date: Wed, 10 Feb 2021 13:23:33 +0100
Subject: [PATCH] hidclass.sys: Assign rawinput handles through device
properties.
---
dlls/hidclass.sys/device.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/dlls/hidclass.sys/device.c b/dlls/hidclass.sys/device.c
index 887d7212c89..fafb7118e99 100644
--- a/dlls/hidclass.sys/device.c
+++ b/dlls/hidclass.sys/device.c
@@ -32,11 +32,14 @@
#include "ddk/hidtypes.h"
#include "ddk/wdm.h"
#include "devguid.h"
+#include "devpkey.h"
#include "ntddmou.h"
WINE_DEFAULT_DEBUG_CHANNEL(hid);
WINE_DECLARE_DEBUG_CHANNEL(hid_report);
+DEFINE_DEVPROPKEY(DEVPROPKEY_HID_HANDLE, 0xbc62e415, 0xf4fe, 0x405c, 0x8e, 0xda, 0x63, 0x6f, 0xb5, 0x9f, 0x08, 0x98, 2);
+
/* user32 reserves 1 & 2 for winemouse and winekeyboard,
* keep this in sync with user_private.h */
#define WINE_MOUSE_HANDLE 1
@@ -55,6 +58,7 @@ NTSTATUS HID_LinkDevice(DEVICE_OBJECT *device)
HDEVINFO devinfo;
BASE_DEVICE_EXTENSION *ext;
USAGE usage, page;
+ NTSTATUS status;
ext = device->DeviceExtension;
page = ext->u.pdo.preparsed_data->caps.UsagePage;
@@ -93,6 +97,15 @@ NTSTATUS HID_LinkDevice(DEVICE_OBJECT *device)
else
ext->u.pdo.rawinput_handle = alloc_rawinput_handle();
+ status = IoSetDevicePropertyData(device, &DEVPROPKEY_HID_HANDLE, LOCALE_NEUTRAL,
+ PLUGPLAY_PROPERTY_PERSISTENT, DEVPROP_TYPE_UINT32,
+ sizeof(ext->u.pdo.rawinput_handle), &ext->u.pdo.rawinput_handle);
+ if (status != STATUS_SUCCESS)
+ {
+ FIXME("failed to set device property %x\n", status);
+ return status;
+ }
+
return STATUS_SUCCESS;
error:
--
2.30.2