Zebediah Figura : hidclass.sys: Pass a KEVENT to IoBuildSynchronousFsdRequest() in get_device_id().
Alexandre Julliard
julliard at winehq.org
Mon Apr 19 15:38:11 CDT 2021
Module: wine
Branch: master
Commit: aff72f225305b24b83c779271e8081632fd565d7
URL: https://source.winehq.org/git/wine.git/?a=commit;h=aff72f225305b24b83c779271e8081632fd565d7
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Sat Apr 17 19:43:25 2021 -0500
hidclass.sys: Pass a KEVENT to IoBuildSynchronousFsdRequest() in get_device_id().
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/hidclass.sys/pnp.c | 31 ++++++++-----------------------
1 file changed, 8 insertions(+), 23 deletions(-)
diff --git a/dlls/hidclass.sys/pnp.c b/dlls/hidclass.sys/pnp.c
index 6e13596a32c..5134cb3569a 100644
--- a/dlls/hidclass.sys/pnp.c
+++ b/dlls/hidclass.sys/pnp.c
@@ -62,43 +62,28 @@ static minidriver *find_minidriver(DRIVER_OBJECT *driver)
return NULL;
}
-static NTSTATUS WINAPI internalComplete(DEVICE_OBJECT *deviceObject, IRP *irp,
- void *context)
-{
- HANDLE event = context;
- SetEvent(event);
- return STATUS_MORE_PROCESSING_REQUIRED;
-}
-
static NTSTATUS get_device_id(DEVICE_OBJECT *device, BUS_QUERY_ID_TYPE type, WCHAR *id)
{
- NTSTATUS status;
IO_STACK_LOCATION *irpsp;
IO_STATUS_BLOCK irp_status;
- HANDLE event;
+ KEVENT event;
IRP *irp;
- irp = IoBuildSynchronousFsdRequest(IRP_MJ_PNP, device, NULL, 0, NULL, NULL, &irp_status);
+ KeInitializeEvent(&event, NotificationEvent, FALSE);
+ irp = IoBuildSynchronousFsdRequest(IRP_MJ_PNP, device, NULL, 0, NULL, &event, &irp_status);
if (irp == NULL)
return STATUS_NO_MEMORY;
- event = CreateEventA(NULL, FALSE, FALSE, NULL);
irpsp = IoGetNextIrpStackLocation(irp);
irpsp->MinorFunction = IRP_MN_QUERY_ID;
irpsp->Parameters.QueryId.IdType = type;
- IoSetCompletionRoutine(irp, internalComplete, event, TRUE, TRUE, TRUE);
- status = IoCallDriver(device, irp);
- if (status == STATUS_PENDING)
- WaitForSingleObject(event, INFINITE);
-
- lstrcpyW(id, (WCHAR *)irp->IoStatus.Information);
- ExFreePool( (WCHAR *)irp->IoStatus.Information );
- status = irp->IoStatus.u.Status;
- IoCompleteRequest(irp, IO_NO_INCREMENT );
- CloseHandle(event);
+ if (IoCallDriver(device, irp) == STATUS_PENDING)
+ KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL);
- return status;
+ wcscpy(id, (WCHAR *)irp_status.Information);
+ ExFreePool((WCHAR *)irp_status.Information);
+ return irp_status.u.Status;
}
static NTSTATUS WINAPI driver_add_device(DRIVER_OBJECT *driver, DEVICE_OBJECT *bus_pdo)
More information about the wine-cvs
mailing list