Zebediah Figura : hidclass.sys: Pass a KEVENT to IoBuildDeviceIoControlRequest() in call_minidriver().

Alexandre Julliard julliard at winehq.org
Thu Feb 11 15:37:15 CST 2021


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

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Wed Feb 10 21:42:39 2021 -0600

hidclass.sys: Pass a KEVENT to IoBuildDeviceIoControlRequest() in call_minidriver().

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/hidclass.sys/main.c | 31 ++++++++-----------------------
 1 file changed, 8 insertions(+), 23 deletions(-)

diff --git a/dlls/hidclass.sys/main.c b/dlls/hidclass.sys/main.c
index 1c7a3ca82af..e169c429efb 100644
--- a/dlls/hidclass.sys/main.c
+++ b/dlls/hidclass.sys/main.c
@@ -92,34 +92,19 @@ NTSTATUS WINAPI HidRegisterMinidriver(HID_MINIDRIVER_REGISTRATION *registration)
     return STATUS_SUCCESS;
 }
 
-static NTSTATUS WINAPI internalComplete(DEVICE_OBJECT *deviceObject, IRP *irp,
-    void *context)
-{
-    HANDLE event = context;
-    SetEvent(event);
-    return STATUS_MORE_PROCESSING_REQUIRED;
-}
-
 NTSTATUS call_minidriver(ULONG code, DEVICE_OBJECT *device, void *in_buff, ULONG in_size, void *out_buff, ULONG out_size)
 {
     IRP *irp;
-    IO_STATUS_BLOCK irp_status;
-    NTSTATUS status;
-    HANDLE event = CreateEventA(NULL, FALSE, FALSE, NULL);
+    IO_STATUS_BLOCK io;
+    KEVENT event;
 
-    irp = IoBuildDeviceIoControlRequest(code, device, in_buff, in_size,
-        out_buff, out_size, TRUE, NULL, &irp_status);
+    KeInitializeEvent(&event, NotificationEvent, FALSE);
 
-    IoSetCompletionRoutine(irp, internalComplete, event, TRUE, TRUE, TRUE);
-    status = IoCallDriver(device, irp);
-
-    if (status == STATUS_PENDING)
-        WaitForSingleObject(event, INFINITE);
-
-    status = irp->IoStatus.u.Status;
+    irp = IoBuildDeviceIoControlRequest(code, device, in_buff, in_size,
+        out_buff, out_size, TRUE, &event, &io);
 
-    IoCompleteRequest(irp, IO_NO_INCREMENT );
-    CloseHandle(event);
+    if (IoCallDriver(device, irp) == STATUS_PENDING)
+        KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL);
 
-    return status;
+    return io.u.Status;
 }




More information about the wine-cvs mailing list