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
|
@ -244,7 +244,8 @@ static void HID_Device_processQueue(DEVICE_OBJECT *device)
|
||||||
|
|
||||||
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;
|
return STATUS_MORE_PROCESSING_REQUIRED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,7 +255,6 @@ static DWORD CALLBACK hid_device_thread(void *args)
|
||||||
|
|
||||||
IRP *irp;
|
IRP *irp;
|
||||||
IO_STATUS_BLOCK irp_status;
|
IO_STATUS_BLOCK irp_status;
|
||||||
IO_STACK_LOCATION *irpsp;
|
|
||||||
DWORD rc;
|
DWORD rc;
|
||||||
HANDLE events[2];
|
HANDLE events[2];
|
||||||
NTSTATUS ntrc;
|
NTSTATUS ntrc;
|
||||||
|
@ -276,13 +276,10 @@ static DWORD CALLBACK hid_device_thread(void *args)
|
||||||
packet->reportId = 0;
|
packet->reportId = 0;
|
||||||
|
|
||||||
irp = IoBuildDeviceIoControlRequest(IOCTL_HID_GET_INPUT_REPORT,
|
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);
|
&irp_status);
|
||||||
|
|
||||||
irpsp = IoGetNextIrpStackLocation(irp);
|
IoSetCompletionRoutine(irp, read_Completion, events[0], TRUE, TRUE, TRUE);
|
||||||
irpsp->CompletionRoutine = read_Completion;
|
|
||||||
irpsp->Control = SL_INVOKE_ON_SUCCESS | SL_INVOKE_ON_ERROR;
|
|
||||||
|
|
||||||
ntrc = IoCallDriver(device, irp);
|
ntrc = IoCallDriver(device, irp);
|
||||||
|
|
||||||
if (ntrc == STATUS_PENDING)
|
if (ntrc == STATUS_PENDING)
|
||||||
|
@ -324,13 +321,10 @@ static DWORD CALLBACK hid_device_thread(void *args)
|
||||||
|
|
||||||
irp = IoBuildDeviceIoControlRequest(IOCTL_HID_READ_REPORT,
|
irp = IoBuildDeviceIoControlRequest(IOCTL_HID_READ_REPORT,
|
||||||
device, NULL, 0, buffer,
|
device, NULL, 0, buffer,
|
||||||
ext->preparseData->caps.InputReportByteLength, TRUE, events[0],
|
ext->preparseData->caps.InputReportByteLength, TRUE, NULL,
|
||||||
&irp_status);
|
&irp_status);
|
||||||
|
|
||||||
irpsp = IoGetNextIrpStackLocation(irp);
|
IoSetCompletionRoutine(irp, read_Completion, events[0], TRUE, TRUE, TRUE);
|
||||||
irpsp->CompletionRoutine = read_Completion;
|
|
||||||
irpsp->Control = SL_INVOKE_ON_SUCCESS | SL_INVOKE_ON_ERROR;
|
|
||||||
|
|
||||||
ntrc = IoCallDriver(device, irp);
|
ntrc = IoCallDriver(device, irp);
|
||||||
|
|
||||||
if (ntrc == STATUS_PENDING)
|
if (ntrc == STATUS_PENDING)
|
||||||
|
|
|
@ -88,7 +88,8 @@ NTSTATUS WINAPI HidRegisterMinidriver(HID_MINIDRIVER_REGISTRATION *registration)
|
||||||
static NTSTATUS WINAPI internalComplete(DEVICE_OBJECT *deviceObject, IRP *irp,
|
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;
|
return STATUS_MORE_PROCESSING_REQUIRED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +97,6 @@ NTSTATUS call_minidriver(ULONG code, DEVICE_OBJECT *device, void *in_buff, ULONG
|
||||||
{
|
{
|
||||||
IRP *irp;
|
IRP *irp;
|
||||||
IO_STATUS_BLOCK irp_status;
|
IO_STATUS_BLOCK irp_status;
|
||||||
IO_STACK_LOCATION *irpsp;
|
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
void *buffer = NULL;
|
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,
|
irp = IoBuildDeviceIoControlRequest(code, device, in_buff, in_size,
|
||||||
buffer, out_size, TRUE, event, &irp_status);
|
buffer, out_size, TRUE, NULL, &irp_status);
|
||||||
|
|
||||||
irpsp = IoGetNextIrpStackLocation(irp);
|
|
||||||
irpsp->CompletionRoutine = internalComplete;
|
|
||||||
irpsp->Control = SL_INVOKE_ON_SUCCESS | SL_INVOKE_ON_ERROR;
|
|
||||||
|
|
||||||
|
IoSetCompletionRoutine(irp, internalComplete, event, TRUE, TRUE, TRUE);
|
||||||
IoCallDriver(device, irp);
|
IoCallDriver(device, irp);
|
||||||
|
|
||||||
if (irp->IoStatus.u.Status == STATUS_PENDING)
|
if (irp->IoStatus.u.Status == STATUS_PENDING)
|
||||||
|
|
|
@ -38,7 +38,8 @@ static const WCHAR device_deviceid_fmtW[] = {'%','s','\\',
|
||||||
static NTSTATUS WINAPI internalComplete(DEVICE_OBJECT *deviceObject, IRP *irp,
|
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;
|
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)
|
if (irp == NULL)
|
||||||
return STATUS_NO_MEMORY;
|
return STATUS_NO_MEMORY;
|
||||||
|
|
||||||
irp->UserEvent = event = CreateEventA(NULL, FALSE, FALSE, NULL);
|
event = CreateEventA(NULL, FALSE, FALSE, NULL);
|
||||||
irpsp = IoGetNextIrpStackLocation(irp);
|
irpsp = IoGetNextIrpStackLocation(irp);
|
||||||
irpsp->MinorFunction = IRP_MN_QUERY_ID;
|
irpsp->MinorFunction = IRP_MN_QUERY_ID;
|
||||||
irpsp->Parameters.QueryId.IdType = type;
|
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);
|
IoCallDriver(device, irp);
|
||||||
if (irp->IoStatus.u.Status == STATUS_PENDING)
|
if (irp->IoStatus.u.Status == STATUS_PENDING)
|
||||||
WaitForSingleObject(event, INFINITE);
|
WaitForSingleObject(event, INFINITE);
|
||||||
|
|
Loading…
Reference in New Issue