Rémi Bernon : hidclass.sys: Register GUID_DEVINTERFACE_KEYBOARD interface.

Alexandre Julliard julliard at winehq.org
Fri Apr 23 15:20:17 CDT 2021


Module: wine
Branch: master
Commit: 8e4d668e345928b003e7fd829a752dd2fbb39edd
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=8e4d668e345928b003e7fd829a752dd2fbb39edd

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Thu Apr 22 21:26:51 2021 +0200

hidclass.sys: Register GUID_DEVINTERFACE_KEYBOARD interface.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 <stdarg.h>
 #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)
             {




More information about the wine-cvs mailing list