[VIDEOPRT]
[reactos.git] / reactos / win32ss / drivers / videoprt / dispatch.c
index 9a4d026..7aa2acb 100644 (file)
 
 #include "videoprt.h"
 
+#include <ndk/inbvfuncs.h>
+#include <ndk/psfuncs.h>
+
+#define NDEBUG
+#include <debug.h>
+
 /* GLOBAL VARIABLES ***********************************************************/
 
 PVIDEO_PORT_DEVICE_EXTENSION ResetDisplayParametersDeviceExtension = NULL;
@@ -289,7 +295,7 @@ IoctlName(ULONG Ioctl)
 
 static
 NTSTATUS
-VideoPortUseDeviceInSesion(
+VideoPortUseDeviceInSession(
     _Inout_ PDEVICE_OBJECT DeviceObject,
     _Inout_ PVIDEO_DEVICE_SESSION_STATUS SessionState,
     _In_ ULONG BufferLength,
@@ -321,7 +327,7 @@ VideoPortUseDeviceInSesion(
         }
         else
         {
-            ERR_(VIDEOPRT, "Requested to set session, but session is already set to: 0x%lx",
+            ERR_(VIDEOPRT, "Requested to set session, but session is already set to: 0x%lx\n",
                  DeviceExtension->SessionId);
             SessionState->bSuccess = FALSE;
         }
@@ -469,10 +475,10 @@ IntVideoPortDispatchDeviceControl(
 
         case IOCTL_VIDEO_USE_DEVICE_IN_SESSION:
             INFO_(VIDEOPRT, "- IOCTL_VIDEO_USE_DEVICE_IN_SESSION\n");
-            Status = VideoPortUseDeviceInSesion(DeviceObject,
-                                                Irp->AssociatedIrp.SystemBuffer,
-                                                IrpStack->Parameters.DeviceIoControl.InputBufferLength,
-                                                &Irp->IoStatus.Information);
+            Status = VideoPortUseDeviceInSession(DeviceObject,
+                                                 Irp->AssociatedIrp.SystemBuffer,
+                                                 IrpStack->Parameters.DeviceIoControl.InputBufferLength,
+                                                 &Irp->IoStatus.Information);
             break;
 
         default:
@@ -828,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
@@ -837,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