hidclass.sys: Use IoSetCompletionRoutine.
Signed-off-by: Aric Stewart <aric@codeweavers.com> Signed-off-by: Sebastian Lackner <sebastian@fds-team.de> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
8e8e0b24da
commit
c5dde63b19
|
@ -242,9 +242,10 @@ static void HID_Device_processQueue(DEVICE_OBJECT *device)
|
|||
HeapFree(GetProcessHeap(), 0, packet);
|
||||
}
|
||||
|
||||
static NTSTATUS WINAPI read_Completion(DEVICE_OBJECT *deviceObject, IRP *irp, void *context )
|
||||
static NTSTATUS WINAPI read_Completion(DEVICE_OBJECT *deviceObject, IRP *irp, void *context)
|
||||
{
|
||||
SetEvent(irp->UserEvent);
|
||||
HANDLE event = context;
|
||||
SetEvent(event);
|
||||
return STATUS_MORE_PROCESSING_REQUIRED;
|
||||
}
|
||||
|
||||
|
@ -254,7 +255,6 @@ static DWORD CALLBACK hid_device_thread(void *args)
|
|||
|
||||
IRP *irp;
|
||||
IO_STATUS_BLOCK irp_status;
|
||||
IO_STACK_LOCATION *irpsp;
|
||||
DWORD rc;
|
||||
HANDLE events[2];
|
||||
NTSTATUS ntrc;
|
||||
|
@ -276,13 +276,10 @@ static DWORD CALLBACK hid_device_thread(void *args)
|
|||
packet->reportId = 0;
|
||||
|
||||
irp = IoBuildDeviceIoControlRequest(IOCTL_HID_GET_INPUT_REPORT,
|
||||
device, NULL, 0, packet, sizeof(*packet), TRUE, events[0],
|
||||
device, NULL, 0, packet, sizeof(*packet), TRUE, NULL,
|
||||
&irp_status);
|
||||
|
||||
irpsp = IoGetNextIrpStackLocation(irp);
|
||||
irpsp->CompletionRoutine = read_Completion;
|
||||
irpsp->Control = SL_INVOKE_ON_SUCCESS | SL_INVOKE_ON_ERROR;
|
||||
|
||||
IoSetCompletionRoutine(irp, read_Completion, events[0], TRUE, TRUE, TRUE);
|
||||
ntrc = IoCallDriver(device, irp);
|
||||
|
||||
if (ntrc == STATUS_PENDING)
|
||||
|
@ -324,13 +321,10 @@ static DWORD CALLBACK hid_device_thread(void *args)
|
|||
|
||||
irp = IoBuildDeviceIoControlRequest(IOCTL_HID_READ_REPORT,
|
||||
device, NULL, 0, buffer,
|
||||
ext->preparseData->caps.InputReportByteLength, TRUE, events[0],
|
||||
ext->preparseData->caps.InputReportByteLength, TRUE, NULL,
|
||||
&irp_status);
|
||||
|
||||
irpsp = IoGetNextIrpStackLocation(irp);
|
||||
irpsp->CompletionRoutine = read_Completion;
|
||||
irpsp->Control = SL_INVOKE_ON_SUCCESS | SL_INVOKE_ON_ERROR;
|
||||
|
||||
IoSetCompletionRoutine(irp, read_Completion, events[0], TRUE, TRUE, TRUE);
|
||||
ntrc = IoCallDriver(device, irp);
|
||||
|
||||
if (ntrc == STATUS_PENDING)
|
||||
|
|
|
@ -86,9 +86,10 @@ NTSTATUS WINAPI HidRegisterMinidriver(HID_MINIDRIVER_REGISTRATION *registration)
|
|||
}
|
||||
|
||||
static NTSTATUS WINAPI internalComplete(DEVICE_OBJECT *deviceObject, IRP *irp,
|
||||
void *context )
|
||||
void *context)
|
||||
{
|
||||
SetEvent(irp->UserEvent);
|
||||
HANDLE event = context;
|
||||
SetEvent(event);
|
||||
return STATUS_MORE_PROCESSING_REQUIRED;
|
||||
}
|
||||
|
||||
|
@ -96,7 +97,6 @@ NTSTATUS call_minidriver(ULONG code, DEVICE_OBJECT *device, void *in_buff, ULONG
|
|||
{
|
||||
IRP *irp;
|
||||
IO_STATUS_BLOCK irp_status;
|
||||
IO_STACK_LOCATION *irpsp;
|
||||
NTSTATUS status;
|
||||
void *buffer = NULL;
|
||||
|
||||
|
@ -109,12 +109,9 @@ NTSTATUS call_minidriver(ULONG code, DEVICE_OBJECT *device, void *in_buff, ULONG
|
|||
}
|
||||
|
||||
irp = IoBuildDeviceIoControlRequest(code, device, in_buff, in_size,
|
||||
buffer, out_size, TRUE, event, &irp_status);
|
||||
|
||||
irpsp = IoGetNextIrpStackLocation(irp);
|
||||
irpsp->CompletionRoutine = internalComplete;
|
||||
irpsp->Control = SL_INVOKE_ON_SUCCESS | SL_INVOKE_ON_ERROR;
|
||||
buffer, out_size, TRUE, NULL, &irp_status);
|
||||
|
||||
IoSetCompletionRoutine(irp, internalComplete, event, TRUE, TRUE, TRUE);
|
||||
IoCallDriver(device, irp);
|
||||
|
||||
if (irp->IoStatus.u.Status == STATUS_PENDING)
|
||||
|
|
|
@ -36,9 +36,10 @@ static const WCHAR device_deviceid_fmtW[] = {'%','s','\\',
|
|||
'v','i','d','_','%','0','4','x','&','p','i','d','_','%', '0','4','x'};
|
||||
|
||||
static NTSTATUS WINAPI internalComplete(DEVICE_OBJECT *deviceObject, IRP *irp,
|
||||
void *context )
|
||||
void *context)
|
||||
{
|
||||
SetEvent(irp->UserEvent);
|
||||
HANDLE event = context;
|
||||
SetEvent(event);
|
||||
return STATUS_MORE_PROCESSING_REQUIRED;
|
||||
}
|
||||
|
||||
|
@ -54,13 +55,12 @@ static NTSTATUS get_device_id(DEVICE_OBJECT *device, BUS_QUERY_ID_TYPE type, WCH
|
|||
if (irp == NULL)
|
||||
return STATUS_NO_MEMORY;
|
||||
|
||||
irp->UserEvent = event = CreateEventA(NULL, FALSE, FALSE, NULL);
|
||||
event = CreateEventA(NULL, FALSE, FALSE, NULL);
|
||||
irpsp = IoGetNextIrpStackLocation(irp);
|
||||
irpsp->MinorFunction = IRP_MN_QUERY_ID;
|
||||
irpsp->Parameters.QueryId.IdType = type;
|
||||
irpsp->CompletionRoutine = internalComplete;
|
||||
irpsp->Control = SL_INVOKE_ON_SUCCESS | SL_INVOKE_ON_ERROR;
|
||||
|
||||
IoSetCompletionRoutine(irp, internalComplete, event, TRUE, TRUE, TRUE);
|
||||
IoCallDriver(device, irp);
|
||||
if (irp->IoStatus.u.Status == STATUS_PENDING)
|
||||
WaitForSingleObject(event, INFINITE);
|
||||
|
|
Loading…
Reference in New Issue