Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/hidclass.sys/device.c | 20 ++++++++++++-------- dlls/hidclass.sys/hid.h | 3 ++- dlls/hidclass.sys/pnp.c | 28 +++++++++++++--------------- 3 files changed, 27 insertions(+), 24 deletions(-)
diff --git a/dlls/hidclass.sys/device.c b/dlls/hidclass.sys/device.c index 1ebe44f3f14..76d8898f00e 100644 --- a/dlls/hidclass.sys/device.c +++ b/dlls/hidclass.sys/device.c @@ -312,8 +312,8 @@ static void handle_minidriver_string( BASE_DEVICE_EXTENSION *ext, IRP *irp, SHOR
InputBuffer = MAKELONG(index, 0);
- irp->IoStatus.Status = call_minidriver( IOCTL_HID_GET_STRING, ext->u.pdo.parent_fdo, ULongToPtr( InputBuffer ), - sizeof(InputBuffer), buffer, sizeof(buffer) ); + call_minidriver( IOCTL_HID_GET_STRING, ext->u.pdo.parent_fdo, ULongToPtr( InputBuffer ), + sizeof(InputBuffer), buffer, sizeof(buffer), &irp->IoStatus );
if (irp->IoStatus.Status == STATUS_SUCCESS) { @@ -351,7 +351,8 @@ static void HID_get_feature( BASE_DEVICE_EXTENSION *ext, IRP *irp )
TRACE_(hid_report)("(id %i, len %i buffer %p)\n", packet->reportId, packet->reportBufferLen, packet->reportBuffer);
- irp->IoStatus.Status = call_minidriver( IOCTL_HID_GET_FEATURE, ext->u.pdo.parent_fdo, NULL, 0, packet, sizeof(*packet) ); + call_minidriver( IOCTL_HID_GET_FEATURE, ext->u.pdo.parent_fdo, NULL, 0, packet, sizeof(*packet), + &irp->IoStatus );
if (irp->IoStatus.Status == STATUS_SUCCESS) { @@ -400,8 +401,8 @@ static void HID_set_to_device( DEVICE_OBJECT *device, IRP *irp )
TRACE_(hid_report)("(id %i, len %i buffer %p)\n", packet.reportId, packet.reportBufferLen, packet.reportBuffer);
- irp->IoStatus.Status = call_minidriver( irpsp->Parameters.DeviceIoControl.IoControlCode, - ext->u.pdo.parent_fdo, NULL, 0, &packet, sizeof(packet) ); + call_minidriver( irpsp->Parameters.DeviceIoControl.IoControlCode, ext->u.pdo.parent_fdo, NULL, + 0, &packet, sizeof(packet), &irp->IoStatus );
if (irp->IoStatus.Status == STATUS_SUCCESS) irp->IoStatus.Information = irpsp->Parameters.DeviceIoControl.InputBufferLength; @@ -521,7 +522,8 @@ NTSTATUS WINAPI pdo_ioctl(DEVICE_OBJECT *device, IRP *irp) packet->reportBuffer = (BYTE *)packet + sizeof(*packet); packet->reportBufferLen = buffer_len - 1;
- irp->IoStatus.Status = call_minidriver( IOCTL_HID_GET_INPUT_REPORT, ext->u.pdo.parent_fdo, NULL, 0, packet, sizeof(*packet) ); + call_minidriver( IOCTL_HID_GET_INPUT_REPORT, ext->u.pdo.parent_fdo, NULL, 0, packet, + sizeof(*packet), &irp->IoStatus );
if (irp->IoStatus.Status == STATUS_SUCCESS) { @@ -658,7 +660,8 @@ NTSTATUS WINAPI pdo_read(DEVICE_OBJECT *device, IRP *irp) packet.reportBuffer = &((BYTE*)irp->AssociatedIrp.SystemBuffer)[1]; packet.reportBufferLen = irpsp->Parameters.Read.Length - 1;
- irp->IoStatus.Status = call_minidriver( IOCTL_HID_GET_INPUT_REPORT, ext->u.pdo.parent_fdo, NULL, 0, &packet, sizeof(packet) ); + call_minidriver( IOCTL_HID_GET_INPUT_REPORT, ext->u.pdo.parent_fdo, NULL, 0, &packet, + sizeof(packet), &irp->IoStatus );
if (irp->IoStatus.Status == STATUS_SUCCESS) { @@ -731,7 +734,8 @@ NTSTATUS WINAPI pdo_write(DEVICE_OBJECT *device, IRP *irp)
TRACE_(hid_report)("(id %i, len %i buffer %p)\n", packet.reportId, packet.reportBufferLen, packet.reportBuffer);
- irp->IoStatus.Status = call_minidriver( IOCTL_HID_WRITE_REPORT, ext->u.pdo.parent_fdo, NULL, 0, &packet, sizeof(packet) ); + call_minidriver( IOCTL_HID_WRITE_REPORT, ext->u.pdo.parent_fdo, NULL, 0, &packet, + sizeof(packet), &irp->IoStatus );
if (irp->IoStatus.Status == STATUS_SUCCESS) irp->IoStatus.Information = irpsp->Parameters.Write.Length; diff --git a/dlls/hidclass.sys/hid.h b/dlls/hidclass.sys/hid.h index 19ac7091065..f0982d508e3 100644 --- a/dlls/hidclass.sys/hid.h +++ b/dlls/hidclass.sys/hid.h @@ -108,7 +108,8 @@ typedef struct _minidriver PDRIVER_DISPATCH PNPDispatch; } minidriver;
-NTSTATUS call_minidriver(ULONG code, DEVICE_OBJECT *device, void *in_buff, ULONG in_size, void *out_buff, ULONG out_size) DECLSPEC_HIDDEN; +void call_minidriver( ULONG code, DEVICE_OBJECT *device, void *in_buff, ULONG in_size, + void *out_buff, ULONG out_size, IO_STATUS_BLOCK *io ) DECLSPEC_HIDDEN;
/* Internal device functions */ void HID_StartDeviceThread(DEVICE_OBJECT *device) DECLSPEC_HIDDEN; diff --git a/dlls/hidclass.sys/pnp.c b/dlls/hidclass.sys/pnp.c index 2f5fe5de4eb..e5a38dafc1c 100644 --- a/dlls/hidclass.sys/pnp.c +++ b/dlls/hidclass.sys/pnp.c @@ -188,14 +188,15 @@ static void create_child(minidriver *minidriver, DEVICE_OBJECT *fdo) BYTE *reportDescriptor; UNICODE_STRING string; WCHAR pdo_name[255]; + IO_STATUS_BLOCK io; USAGE page, usage; NTSTATUS status; INT i;
- status = call_minidriver(IOCTL_HID_GET_DEVICE_ATTRIBUTES, fdo, NULL, 0, &attr, sizeof(attr)); - if (status != STATUS_SUCCESS) + call_minidriver( IOCTL_HID_GET_DEVICE_ATTRIBUTES, fdo, NULL, 0, &attr, sizeof(attr), &io ); + if (io.Status != STATUS_SUCCESS) { - ERR("Minidriver failed to get Attributes(%x)\n",status); + ERR( "Minidriver failed to get attributes, status %#x.\n", io.Status ); return; }
@@ -204,7 +205,7 @@ static void create_child(minidriver *minidriver, DEVICE_OBJECT *fdo) RtlInitUnicodeString(&string, pdo_name); if ((status = IoCreateDevice(fdo->DriverObject, sizeof(*pdo_ext), &string, 0, 0, FALSE, &child_pdo))) { - ERR("Failed to create child PDO, status %#x.\n", status); + ERR( "Failed to create child PDO, status %#x.\n", io.Status ); return; } fdo_ext->u.fdo.child_pdo = child_pdo; @@ -221,8 +222,8 @@ static void create_child(minidriver *minidriver, DEVICE_OBJECT *fdo) pdo_ext->u.pdo.information.VersionNumber = attr.VersionNumber; pdo_ext->u.pdo.information.Polled = minidriver->minidriver.DevicesArePolled;
- status = call_minidriver(IOCTL_HID_GET_DEVICE_DESCRIPTOR, fdo, NULL, 0, &descriptor, sizeof(descriptor)); - if (status != STATUS_SUCCESS) + call_minidriver( IOCTL_HID_GET_DEVICE_DESCRIPTOR, fdo, NULL, 0, &descriptor, sizeof(descriptor), &io ); + if (io.Status != STATUS_SUCCESS) { ERR("Cannot get Device Descriptor(%x)\n",status); IoDeleteDevice(child_pdo); @@ -240,9 +241,9 @@ static void create_child(minidriver *minidriver, DEVICE_OBJECT *fdo) }
reportDescriptor = malloc(descriptor.DescriptorList[i].wReportLength); - status = call_minidriver(IOCTL_HID_GET_REPORT_DESCRIPTOR, fdo, NULL, 0, - reportDescriptor, descriptor.DescriptorList[i].wReportLength); - if (status != STATUS_SUCCESS) + call_minidriver( IOCTL_HID_GET_REPORT_DESCRIPTOR, fdo, NULL, 0, reportDescriptor, + descriptor.DescriptorList[i].wReportLength, &io ); + if (io.Status != STATUS_SUCCESS) { ERR("Cannot get Report Descriptor(%x)\n",status); free(reportDescriptor); @@ -606,19 +607,16 @@ NTSTATUS WINAPI HidRegisterMinidriver(HID_MINIDRIVER_REGISTRATION *registration) return STATUS_SUCCESS; }
-NTSTATUS call_minidriver(ULONG code, DEVICE_OBJECT *device, void *in_buff, ULONG in_size, void *out_buff, ULONG out_size) +void call_minidriver( ULONG code, DEVICE_OBJECT *device, void *in_buff, ULONG in_size, + void *out_buff, ULONG out_size, IO_STATUS_BLOCK *io ) { IRP *irp; - IO_STATUS_BLOCK io; KEVENT event;
KeInitializeEvent(&event, NotificationEvent, FALSE);
- irp = IoBuildDeviceIoControlRequest(code, device, in_buff, in_size, - out_buff, out_size, TRUE, &event, &io); + irp = IoBuildDeviceIoControlRequest( code, device, in_buff, in_size, out_buff, out_size, TRUE, &event, io );
if (IoCallDriver(device, irp) == STATUS_PENDING) KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL); - - return io.Status; }