[FDC]
authorPierre Schweitzer <pierre@reactos.org>
Thu, 7 Jan 2016 19:23:55 +0000 (19:23 +0000)
committerPierre Schweitzer <pierre@reactos.org>
Thu, 7 Jan 2016 19:23:55 +0000 (19:23 +0000)
Fix FdcPower() stub so that it doesn't leak IRP on shutdown
Dedicated to Thomas.

CORE-10117

svn path=/trunk/; revision=70531

reactos/drivers/storage/fdc/fdc/fdc.c

index 88ba7d4..08263a5 100644 (file)
@@ -143,8 +143,34 @@ NTAPI
 FdcPower(IN PDEVICE_OBJECT DeviceObject,
          IN PIRP Irp)
 {
 FdcPower(IN PDEVICE_OBJECT DeviceObject,
          IN PIRP Irp)
 {
+    PIO_STACK_LOCATION IrpSp;
+    NTSTATUS Status = Irp->IoStatus.Status;
+    PFDO_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
+
     DPRINT("FdcPower()\n");
     DPRINT("FdcPower()\n");
-    return STATUS_UNSUCCESSFUL;
+
+    IrpSp = IoGetCurrentIrpStackLocation(Irp);
+
+    if (DeviceExtension->Common.IsFDO)
+    {
+        PoStartNextPowerIrp(Irp);
+        IoSkipCurrentIrpStackLocation(Irp);
+        return PoCallDriver(DeviceExtension->LowerDevice, Irp);
+    }
+    else
+    {
+        switch (IrpSp->MinorFunction)
+        {
+            case IRP_MN_QUERY_POWER:
+            case IRP_MN_SET_POWER:
+                Status = STATUS_SUCCESS;
+                break;
+        }
+        PoStartNextPowerIrp(Irp);
+        Irp->IoStatus.Status = Status;
+        IoCompleteRequest(Irp, IO_NO_INCREMENT);
+        return Status;
+    }
 }
 
 
 }