[VIDEOPRT]
authorThomas Faber <thomas.faber@reactos.org>
Sun, 6 Sep 2015 10:45:37 +0000 (10:45 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Sun, 6 Sep 2015 10:45:37 +0000 (10:45 +0000)
- Correctly stub power IRP handling. Fixes IRP leaks on shutdown.
- Correctly stub IntVideoPortDispatchSystemControl to avoid IRP leak.
CORE-10117 CORE-10105

svn path=/trunk/; revision=69053

reactos/win32ss/drivers/videoprt/dispatch.c

index bf8fb56..7aa2acb 100644 (file)
@@ -834,7 +834,32 @@ IntVideoPortDispatchPower(
     IN PDEVICE_OBJECT DeviceObject,
     IN PIRP Irp)
 {
-    return STATUS_NOT_IMPLEMENTED;
+    PIO_STACK_LOCATION IrpSp;
+    NTSTATUS Status = Irp->IoStatus.Status;
+    PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
+
+    IrpSp = IoGetCurrentIrpStackLocation(Irp);
+
+    if (DeviceExtension->Common.Fdo)
+    {
+        PoStartNextPowerIrp(Irp);
+        IoSkipCurrentIrpStackLocation(Irp);
+        return PoCallDriver(DeviceExtension->NextDeviceObject, 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;
+    }
 }
 
 NTSTATUS
@@ -843,7 +868,20 @@ IntVideoPortDispatchSystemControl(
     IN PDEVICE_OBJECT DeviceObject,
     IN PIRP Irp)
 {
-    return STATUS_NOT_IMPLEMENTED;
+    NTSTATUS Status;
+    PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
+
+    if (DeviceExtension->Common.Fdo)
+    {
+        IoSkipCurrentIrpStackLocation(Irp);
+        return IoCallDriver(DeviceExtension->NextDeviceObject, Irp);
+    }
+    else
+    {
+        Status = Irp->IoStatus.Status;
+        IoCompleteRequest(Irp, IO_NO_INCREMENT);
+        return Status;
+    }
 }
 
 VOID