Author: janderwald Date: Sun May 19 21:33:08 2013 New Revision: 59049 URL: http://svn.reactos.org/svn/reactos?rev=59049&view=rev Log: [HIDCLASS] - Fix double irp completion bug in hidclass - Hidclass now properly initializes and works in WinServer2003 - Tested excessively by Vic (Blame him ;))
Modified: trunk/reactos/drivers/hid/hidclass/fdo.c Modified: trunk/reactos/drivers/hid/hidclass/fdo.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/hid/hidclass/fdo.c?rev=59049&r1=59048&r2=59049&view=diff ============================================================================== --- trunk/reactos/drivers/hid/hidclass/fdo.c [iso-8859-1] (original) +++ trunk/reactos/drivers/hid/hidclass/fdo.c [iso-8859-1] Sun May 19 21:33:08 2013 @@ -182,23 +182,74 @@ IoStack->DeviceObject = DeviceObject; // + // sanity check + // + ASSERT(CommonDeviceExtension->DriverExtension->MajorFunction[IoStack->MajorFunction] != NULL); + + // + // call minidriver (hidusb) + // + Status = CommonDeviceExtension->DriverExtension->MajorFunction[IoStack->MajorFunction](DeviceObject, Irp); + + // + // wait for the request to finish + // + if (Status == STATUS_PENDING) + { + KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL); + + // + // update status + // + Status = Irp->IoStatus.Status; + } + + // + // done + // + return Status; +} + +NTSTATUS +HidClassFDO_DispatchRequest( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + PHIDCLASS_COMMON_DEVICE_EXTENSION CommonDeviceExtension; + NTSTATUS Status; + PIO_STACK_LOCATION IoStack; + + // + // get device extension + // + CommonDeviceExtension = DeviceObject->DeviceExtension; + + ASSERT(Irp->CurrentLocation > 0); + + // + // create stack location + // + IoSetNextIrpStackLocation(Irp); + + // + // get next stack location + // + IoStack = IoGetCurrentIrpStackLocation(Irp); + + // + // store device object + // + IoStack->DeviceObject = DeviceObject; + + // + // sanity check + // + ASSERT(CommonDeviceExtension->DriverExtension->MajorFunction[IoStack->MajorFunction] != NULL); + + // // call driver // - DPRINT("IoStack MajorFunction %x MinorFunction %x\n", IoStack->MajorFunction, IoStack->MinorFunction); Status = CommonDeviceExtension->DriverExtension->MajorFunction[IoStack->MajorFunction](DeviceObject, Irp); - - // - // wait for the request to finish - // - if (Status == STATUS_PENDING) - { - KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL); - - // - // update status - // - Status = Irp->IoStatus.Status; - } // // done @@ -620,14 +671,8 @@ // // dispatch to mini driver // - IoSkipCurrentIrpStackLocation(Irp); - Status = HidClassFDO_DispatchRequestSynchronous(DeviceObject, Irp); - - // - // complete request - // - Irp->IoStatus.Status = Status; - IoCompleteRequest(Irp, IO_NO_INCREMENT); + IoCopyCurrentIrpStackLocationToNext(Irp); + Status = HidClassFDO_DispatchRequest(DeviceObject, Irp); return Status; } }