From 8e4d668e345928b003e7fd829a752dd2fbb39edd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 22 Apr 2021 21:26:51 +0200 Subject: [PATCH] hidclass.sys: Register GUID_DEVINTERFACE_KEYBOARD interface. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: RĂ©mi Bernon Signed-off-by: Alexandre Julliard --- dlls/hidclass.sys/device.c | 1 + dlls/hidclass.sys/hid.h | 2 ++ dlls/hidclass.sys/pnp.c | 11 +++++++++++ 3 files changed, 14 insertions(+) diff --git a/dlls/hidclass.sys/device.c b/dlls/hidclass.sys/device.c index 35cc40c01ea..a7825080deb 100644 --- a/dlls/hidclass.sys/device.c +++ b/dlls/hidclass.sys/device.c @@ -32,6 +32,7 @@ #include "ddk/wdm.h" #include "devguid.h" #include "ntddmou.h" +#include "ntddkbd.h" WINE_DEFAULT_DEBUG_CHANNEL(hid); WINE_DECLARE_DEBUG_CHANNEL(hid_report); diff --git a/dlls/hidclass.sys/hid.h b/dlls/hidclass.sys/hid.h index 9e829332bdc..5a502840691 100644 --- a/dlls/hidclass.sys/hid.h +++ b/dlls/hidclass.sys/hid.h @@ -69,6 +69,8 @@ typedef struct _BASE_DEVICE_EXTENSION BOOL is_mouse; UNICODE_STRING mouse_link_name; + BOOL is_keyboard; + UNICODE_STRING keyboard_link_name; } pdo; } u; diff --git a/dlls/hidclass.sys/pnp.c b/dlls/hidclass.sys/pnp.c index de6f409a16b..3d81c16356e 100644 --- a/dlls/hidclass.sys/pnp.c +++ b/dlls/hidclass.sys/pnp.c @@ -23,6 +23,7 @@ #include #include "hid.h" #include "ntddmou.h" +#include "ntddkbd.h" #include "ddk/hidtypes.h" #include "ddk/wdm.h" #include "regstr.h" @@ -399,10 +400,18 @@ static NTSTATUS pdo_pnp(DEVICE_OBJECT *device, IRP *irp) if (!IoRegisterDeviceInterface(device, &GUID_DEVINTERFACE_MOUSE, NULL, &ext->u.pdo.mouse_link_name)) ext->u.pdo.is_mouse = TRUE; } + if (ext->u.pdo.preparsed_data->caps.UsagePage == HID_USAGE_PAGE_GENERIC + && ext->u.pdo.preparsed_data->caps.Usage == HID_USAGE_GENERIC_KEYBOARD) + { + if (!IoRegisterDeviceInterface(device, &GUID_DEVINTERFACE_KEYBOARD, NULL, &ext->u.pdo.keyboard_link_name)) + ext->u.pdo.is_keyboard = TRUE; + } IoSetDeviceInterfaceState(&ext->u.pdo.link_name, TRUE); if (ext->u.pdo.is_mouse) IoSetDeviceInterfaceState(&ext->u.pdo.mouse_link_name, TRUE); + if (ext->u.pdo.is_keyboard) + IoSetDeviceInterfaceState(&ext->u.pdo.keyboard_link_name, TRUE); status = STATUS_SUCCESS; break; @@ -413,6 +422,8 @@ static NTSTATUS pdo_pnp(DEVICE_OBJECT *device, IRP *irp) IoSetDeviceInterfaceState(&ext->u.pdo.link_name, FALSE); if (ext->u.pdo.is_mouse) IoSetDeviceInterfaceState(&ext->u.pdo.mouse_link_name, FALSE); + if (ext->u.pdo.is_keyboard) + IoSetDeviceInterfaceState(&ext->u.pdo.keyboard_link_name, TRUE); if (ext->u.pdo.thread) {