Signed-off-by: Zebediah Figura z.figura12@gmail.com --- 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; }