[2/2] winehid.sys: Register as a HID minidriver. (v2)

Sebastian Lackner sebastian at fds-team.de
Wed Oct 12 10:46:17 CDT 2016


From: Aric Stewart <aric at codeweavers.com>

Signed-off-by: Aric Stewart <aric at codeweavers.com>
Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
---

Changes in v2:
* TRACE arguments of add_device.
* Declare HID_MINIDRIVER_REGISTRATION directly in DriverEntry (it does
  not seem to be used anywhere else, so why static?)
* Pass through NTSTATUS from HidRegisterMinidriver.

 dlls/winehid.sys/Makefile.in |    1 +
 dlls/winehid.sys/main.c      |   19 ++++++++++++++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/dlls/winehid.sys/Makefile.in b/dlls/winehid.sys/Makefile.in
index d4ca3dd..ad7881e 100644
--- a/dlls/winehid.sys/Makefile.in
+++ b/dlls/winehid.sys/Makefile.in
@@ -1,4 +1,5 @@
 MODULE    = winehid.sys
+IMPORTS   = hidclass
 EXTRADLLFLAGS = -Wb,--subsystem,native
 
 C_SRCS = \
diff --git a/dlls/winehid.sys/main.c b/dlls/winehid.sys/main.c
index 7ab9267..cdef3c5 100644
--- a/dlls/winehid.sys/main.c
+++ b/dlls/winehid.sys/main.c
@@ -26,13 +26,30 @@
 #include "winbase.h"
 #include "winternl.h"
 #include "ddk/wdm.h"
+#include "ddk/hidport.h"
 #include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(hid);
 
+static NTSTATUS WINAPI add_device(DRIVER_OBJECT *driver, DEVICE_OBJECT *device)
+{
+    TRACE("(%p, %p)\n", driver, device);
+    return STATUS_SUCCESS;
+}
+
 NTSTATUS WINAPI DriverEntry(DRIVER_OBJECT *driver, UNICODE_STRING *path)
 {
+    HID_MINIDRIVER_REGISTRATION registration;
+
     TRACE("(%p, %s)\n", driver, debugstr_w(path->Buffer));
 
-    return STATUS_SUCCESS;
+    driver->DriverExtension->AddDevice = add_device;
+
+    memset(&registration, 0, sizeof(registration));
+    registration.DriverObject = driver;
+    registration.RegistryPath = path;
+    registration.DeviceExtensionSize = sizeof(HID_DEVICE_EXTENSION);
+    registration.DevicesArePolled = FALSE;
+
+    return HidRegisterMinidriver(&registration);
 }
-- 
2.9.0



More information about the wine-patches mailing list