hidclass.sys: Pass IO_STATUS_BLOCK parameter to call_minidriver.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
a8ab0fe08f
commit
00008c9d48
|
@ -312,8 +312,8 @@ static void handle_minidriver_string( BASE_DEVICE_EXTENSION *ext, IRP *irp, SHOR
|
||||||
|
|
||||||
InputBuffer = MAKELONG(index, 0);
|
InputBuffer = MAKELONG(index, 0);
|
||||||
|
|
||||||
irp->IoStatus.Status = call_minidriver( IOCTL_HID_GET_STRING, ext->u.pdo.parent_fdo, ULongToPtr( InputBuffer ),
|
call_minidriver( IOCTL_HID_GET_STRING, ext->u.pdo.parent_fdo, ULongToPtr( InputBuffer ),
|
||||||
sizeof(InputBuffer), buffer, sizeof(buffer) );
|
sizeof(InputBuffer), buffer, sizeof(buffer), &irp->IoStatus );
|
||||||
|
|
||||||
if (irp->IoStatus.Status == STATUS_SUCCESS)
|
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);
|
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)
|
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);
|
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,
|
call_minidriver( irpsp->Parameters.DeviceIoControl.IoControlCode, ext->u.pdo.parent_fdo, NULL,
|
||||||
ext->u.pdo.parent_fdo, NULL, 0, &packet, sizeof(packet) );
|
0, &packet, sizeof(packet), &irp->IoStatus );
|
||||||
|
|
||||||
if (irp->IoStatus.Status == STATUS_SUCCESS)
|
if (irp->IoStatus.Status == STATUS_SUCCESS)
|
||||||
irp->IoStatus.Information = irpsp->Parameters.DeviceIoControl.InputBufferLength;
|
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->reportBuffer = (BYTE *)packet + sizeof(*packet);
|
||||||
packet->reportBufferLen = buffer_len - 1;
|
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)
|
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.reportBuffer = &((BYTE*)irp->AssociatedIrp.SystemBuffer)[1];
|
||||||
packet.reportBufferLen = irpsp->Parameters.Read.Length - 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)
|
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);
|
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)
|
if (irp->IoStatus.Status == STATUS_SUCCESS)
|
||||||
irp->IoStatus.Information = irpsp->Parameters.Write.Length;
|
irp->IoStatus.Information = irpsp->Parameters.Write.Length;
|
||||||
|
|
|
@ -108,7 +108,8 @@ typedef struct _minidriver
|
||||||
PDRIVER_DISPATCH PNPDispatch;
|
PDRIVER_DISPATCH PNPDispatch;
|
||||||
} minidriver;
|
} 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 */
|
/* Internal device functions */
|
||||||
void HID_StartDeviceThread(DEVICE_OBJECT *device) DECLSPEC_HIDDEN;
|
void HID_StartDeviceThread(DEVICE_OBJECT *device) DECLSPEC_HIDDEN;
|
||||||
|
|
|
@ -188,14 +188,15 @@ static void create_child(minidriver *minidriver, DEVICE_OBJECT *fdo)
|
||||||
BYTE *reportDescriptor;
|
BYTE *reportDescriptor;
|
||||||
UNICODE_STRING string;
|
UNICODE_STRING string;
|
||||||
WCHAR pdo_name[255];
|
WCHAR pdo_name[255];
|
||||||
|
IO_STATUS_BLOCK io;
|
||||||
USAGE page, usage;
|
USAGE page, usage;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
INT i;
|
INT i;
|
||||||
|
|
||||||
status = call_minidriver(IOCTL_HID_GET_DEVICE_ATTRIBUTES, fdo, NULL, 0, &attr, sizeof(attr));
|
call_minidriver( IOCTL_HID_GET_DEVICE_ATTRIBUTES, fdo, NULL, 0, &attr, sizeof(attr), &io );
|
||||||
if (status != STATUS_SUCCESS)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +205,7 @@ static void create_child(minidriver *minidriver, DEVICE_OBJECT *fdo)
|
||||||
RtlInitUnicodeString(&string, pdo_name);
|
RtlInitUnicodeString(&string, pdo_name);
|
||||||
if ((status = IoCreateDevice(fdo->DriverObject, sizeof(*pdo_ext), &string, 0, 0, FALSE, &child_pdo)))
|
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;
|
return;
|
||||||
}
|
}
|
||||||
fdo_ext->u.fdo.child_pdo = child_pdo;
|
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.VersionNumber = attr.VersionNumber;
|
||||||
pdo_ext->u.pdo.information.Polled = minidriver->minidriver.DevicesArePolled;
|
pdo_ext->u.pdo.information.Polled = minidriver->minidriver.DevicesArePolled;
|
||||||
|
|
||||||
status = call_minidriver(IOCTL_HID_GET_DEVICE_DESCRIPTOR, fdo, NULL, 0, &descriptor, sizeof(descriptor));
|
call_minidriver( IOCTL_HID_GET_DEVICE_DESCRIPTOR, fdo, NULL, 0, &descriptor, sizeof(descriptor), &io );
|
||||||
if (status != STATUS_SUCCESS)
|
if (io.Status != STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
ERR("Cannot get Device Descriptor(%x)\n",status);
|
ERR("Cannot get Device Descriptor(%x)\n",status);
|
||||||
IoDeleteDevice(child_pdo);
|
IoDeleteDevice(child_pdo);
|
||||||
|
@ -240,9 +241,9 @@ static void create_child(minidriver *minidriver, DEVICE_OBJECT *fdo)
|
||||||
}
|
}
|
||||||
|
|
||||||
reportDescriptor = malloc(descriptor.DescriptorList[i].wReportLength);
|
reportDescriptor = malloc(descriptor.DescriptorList[i].wReportLength);
|
||||||
status = call_minidriver(IOCTL_HID_GET_REPORT_DESCRIPTOR, fdo, NULL, 0,
|
call_minidriver( IOCTL_HID_GET_REPORT_DESCRIPTOR, fdo, NULL, 0, reportDescriptor,
|
||||||
reportDescriptor, descriptor.DescriptorList[i].wReportLength);
|
descriptor.DescriptorList[i].wReportLength, &io );
|
||||||
if (status != STATUS_SUCCESS)
|
if (io.Status != STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
ERR("Cannot get Report Descriptor(%x)\n",status);
|
ERR("Cannot get Report Descriptor(%x)\n",status);
|
||||||
free(reportDescriptor);
|
free(reportDescriptor);
|
||||||
|
@ -606,19 +607,16 @@ NTSTATUS WINAPI HidRegisterMinidriver(HID_MINIDRIVER_REGISTRATION *registration)
|
||||||
return STATUS_SUCCESS;
|
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;
|
IRP *irp;
|
||||||
IO_STATUS_BLOCK io;
|
|
||||||
KEVENT event;
|
KEVENT event;
|
||||||
|
|
||||||
KeInitializeEvent(&event, NotificationEvent, FALSE);
|
KeInitializeEvent(&event, NotificationEvent, FALSE);
|
||||||
|
|
||||||
irp = IoBuildDeviceIoControlRequest(code, device, in_buff, in_size,
|
irp = IoBuildDeviceIoControlRequest( code, device, in_buff, in_size, out_buff, out_size, TRUE, &event, io );
|
||||||
out_buff, out_size, TRUE, &event, &io);
|
|
||||||
|
|
||||||
if (IoCallDriver(device, irp) == STATUS_PENDING)
|
if (IoCallDriver(device, irp) == STATUS_PENDING)
|
||||||
KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL);
|
KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL);
|
||||||
|
|
||||||
return io.Status;
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue