[CONDRV]: Code reshuffling only.
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sun, 14 Dec 2014 17:02:39 +0000 (17:02 +0000)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sun, 14 Dec 2014 17:02:39 +0000 (17:02 +0000)
svn path=/branches/condrv_restructure/; revision=65642

drivers/base/condrv/CMakeLists.txt
drivers/base/condrv/condrv.c
drivers/base/condrv/dispatch.c [new file with mode: 0644]

index ab4de2a..45bc1af 100644 (file)
@@ -1,17 +1,15 @@
 
 include_directories(${REACTOS_SOURCE_DIR}/include/reactos/drivers)
 
-## spec2def(condrv.sys condrv.spec ADD_IMPORTLIB)
-
 list(APPEND SOURCE
     condrv.c
     control.c
+    dispatch.c
     condrv.h)
 
 add_library(condrv SHARED
     ${SOURCE}
     condrv.rc)
-    # ${CMAKE_CURRENT_BINARY_DIR}/condrv.def)
 
 set_module_type(condrv kernelmodedriver)
 target_link_libraries(condrv ${PSEH_LIB})
index 6b96b97..57125d8 100644 (file)
@@ -30,80 +30,6 @@ DRIVER_DISPATCH ConDrvCleanup;
 */
 DRIVER_DISPATCH ConDrvDispatch;
 
-NTSTATUS NTAPI
-CompleteRequest(IN PIRP      Irp,
-                IN NTSTATUS  Status,
-                IN ULONG_PTR Information)
-{
-    Irp->IoStatus.Status      = Status;
-    Irp->IoStatus.Information = Information;
-    IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
-    return Status;
-}
-
-NTSTATUS NTAPI
-ConDrvDispatch(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
-{
-#define HANDLE_CTRL_CODE(Code)  \
-    case Code :                 \
-    {                           \
-        DPRINT1("ConDrv: " #Code ", stack->FileObject = 0x%p\n", stack->FileObject);        \
-        if (stack->FileObject)                                                              \
-        {                                                                                   \
-            DPRINT1("stack->FileObject->FileName = %wZ\n", &stack->FileObject->FileName);   \
-        }                                                                                   \
-        break;                                                                              \
-    }
-
-    PIO_STACK_LOCATION stack    = IoGetCurrentIrpStackLocation(Irp);
-    // ULONG              ctrlCode = stack->Parameters.DeviceIoControl.IoControlCode;
-    ULONG MajorFunction         = stack->MajorFunction;
-
-    /* Just display all the IRP codes for now... */
-    switch (MajorFunction)
-    {
-        HANDLE_CTRL_CODE(IRP_MJ_CREATE);
-        HANDLE_CTRL_CODE(IRP_MJ_CREATE_NAMED_PIPE);
-        HANDLE_CTRL_CODE(IRP_MJ_CLOSE);
-        HANDLE_CTRL_CODE(IRP_MJ_READ);
-        HANDLE_CTRL_CODE(IRP_MJ_WRITE);
-        HANDLE_CTRL_CODE(IRP_MJ_QUERY_INFORMATION);
-        HANDLE_CTRL_CODE(IRP_MJ_SET_INFORMATION);
-        HANDLE_CTRL_CODE(IRP_MJ_QUERY_EA);
-        HANDLE_CTRL_CODE(IRP_MJ_SET_EA);
-        HANDLE_CTRL_CODE(IRP_MJ_FLUSH_BUFFERS);
-        HANDLE_CTRL_CODE(IRP_MJ_QUERY_VOLUME_INFORMATION);
-        HANDLE_CTRL_CODE(IRP_MJ_SET_VOLUME_INFORMATION);
-        HANDLE_CTRL_CODE(IRP_MJ_DIRECTORY_CONTROL);
-        HANDLE_CTRL_CODE(IRP_MJ_FILE_SYSTEM_CONTROL);
-        HANDLE_CTRL_CODE(IRP_MJ_DEVICE_CONTROL);
-        HANDLE_CTRL_CODE(IRP_MJ_INTERNAL_DEVICE_CONTROL);
-        HANDLE_CTRL_CODE(IRP_MJ_SHUTDOWN);
-        HANDLE_CTRL_CODE(IRP_MJ_LOCK_CONTROL);
-        HANDLE_CTRL_CODE(IRP_MJ_CLEANUP);
-        HANDLE_CTRL_CODE(IRP_MJ_CREATE_MAILSLOT);
-        HANDLE_CTRL_CODE(IRP_MJ_QUERY_SECURITY);
-        HANDLE_CTRL_CODE(IRP_MJ_SET_SECURITY);
-        HANDLE_CTRL_CODE(IRP_MJ_POWER);
-        HANDLE_CTRL_CODE(IRP_MJ_SYSTEM_CONTROL);
-        HANDLE_CTRL_CODE(IRP_MJ_DEVICE_CHANGE);
-        HANDLE_CTRL_CODE(IRP_MJ_QUERY_QUOTA);
-        HANDLE_CTRL_CODE(IRP_MJ_SET_QUOTA);
-        HANDLE_CTRL_CODE(IRP_MJ_PNP);
-        // case IRP_MJ_PNP_POWER:
-        // case IRP_MJ_MAXIMUM_FUNCTION:
-
-        default:
-        {
-            DPRINT1("Unknown Major %lu\n", MajorFunction);
-            break;
-        }
-    }
-
-    return CompleteRequest(Irp, STATUS_SUCCESS, 0);
-}
-
 NTSTATUS NTAPI
 DriverEntry(IN PDRIVER_OBJECT DriverObject,
             IN PUNICODE_STRING RegistryPath)
@@ -168,5 +94,4 @@ ConDrvUnload(IN PDRIVER_OBJECT DriverObject)
     return;
 }
 
-
 /* EOF */
diff --git a/drivers/base/condrv/dispatch.c b/drivers/base/condrv/dispatch.c
new file mode 100644 (file)
index 0000000..65a3869
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS Console Driver
+ * FILE:            drivers/base/condrv/dispatch.c
+ * PURPOSE:         Console Driver - Dispatching interface
+ * PROGRAMMERS:     Hermes Belusca-Maito (hermes.belusca@sfr.fr)
+ */
+
+/* INCLUDES *******************************************************************/
+
+#include "condrv.h"
+
+#define NDEBUG
+#include <debug.h>
+
+/* FUNCTIONS ******************************************************************/
+
+NTSTATUS NTAPI
+CompleteRequest(IN PIRP      Irp,
+                IN NTSTATUS  Status,
+                IN ULONG_PTR Information)
+{
+    Irp->IoStatus.Status      = Status;
+    Irp->IoStatus.Information = Information;
+    IoCompleteRequest(Irp, IO_NO_INCREMENT);
+
+    return Status;
+}
+
+NTSTATUS NTAPI
+ConDrvDispatch(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
+{
+#define HANDLE_CTRL_CODE(Code)  \
+    case Code :                 \
+    {                           \
+        DPRINT1("ConDrv: " #Code ", stack->FileObject = 0x%p\n", stack->FileObject);        \
+        if (stack->FileObject)                                                              \
+        {                                                                                   \
+            DPRINT1("stack->FileObject->FileName = %wZ\n", &stack->FileObject->FileName);   \
+        }                                                                                   \
+        break;                                                                              \
+    }
+
+    PIO_STACK_LOCATION stack    = IoGetCurrentIrpStackLocation(Irp);
+    // ULONG              ctrlCode = stack->Parameters.DeviceIoControl.IoControlCode;
+    ULONG MajorFunction         = stack->MajorFunction;
+
+    /* Just display all the IRP codes for now... */
+    switch (MajorFunction)
+    {
+        HANDLE_CTRL_CODE(IRP_MJ_CREATE);
+        HANDLE_CTRL_CODE(IRP_MJ_CREATE_NAMED_PIPE);
+        HANDLE_CTRL_CODE(IRP_MJ_CLOSE);
+        HANDLE_CTRL_CODE(IRP_MJ_READ);
+        HANDLE_CTRL_CODE(IRP_MJ_WRITE);
+        HANDLE_CTRL_CODE(IRP_MJ_QUERY_INFORMATION);
+        HANDLE_CTRL_CODE(IRP_MJ_SET_INFORMATION);
+        HANDLE_CTRL_CODE(IRP_MJ_QUERY_EA);
+        HANDLE_CTRL_CODE(IRP_MJ_SET_EA);
+        HANDLE_CTRL_CODE(IRP_MJ_FLUSH_BUFFERS);
+        HANDLE_CTRL_CODE(IRP_MJ_QUERY_VOLUME_INFORMATION);
+        HANDLE_CTRL_CODE(IRP_MJ_SET_VOLUME_INFORMATION);
+        HANDLE_CTRL_CODE(IRP_MJ_DIRECTORY_CONTROL);
+        HANDLE_CTRL_CODE(IRP_MJ_FILE_SYSTEM_CONTROL);
+        HANDLE_CTRL_CODE(IRP_MJ_DEVICE_CONTROL);
+        HANDLE_CTRL_CODE(IRP_MJ_INTERNAL_DEVICE_CONTROL);
+        HANDLE_CTRL_CODE(IRP_MJ_SHUTDOWN);
+        HANDLE_CTRL_CODE(IRP_MJ_LOCK_CONTROL);
+        HANDLE_CTRL_CODE(IRP_MJ_CLEANUP);
+        HANDLE_CTRL_CODE(IRP_MJ_CREATE_MAILSLOT);
+        HANDLE_CTRL_CODE(IRP_MJ_QUERY_SECURITY);
+        HANDLE_CTRL_CODE(IRP_MJ_SET_SECURITY);
+        HANDLE_CTRL_CODE(IRP_MJ_POWER);
+        HANDLE_CTRL_CODE(IRP_MJ_SYSTEM_CONTROL);
+        HANDLE_CTRL_CODE(IRP_MJ_DEVICE_CHANGE);
+        HANDLE_CTRL_CODE(IRP_MJ_QUERY_QUOTA);
+        HANDLE_CTRL_CODE(IRP_MJ_SET_QUOTA);
+        HANDLE_CTRL_CODE(IRP_MJ_PNP);
+        // case IRP_MJ_PNP_POWER:
+        // case IRP_MJ_MAXIMUM_FUNCTION:
+
+        default:
+        {
+            DPRINT1("Unknown Major %lu\n", MajorFunction);
+            break;
+        }
+    }
+
+    return CompleteRequest(Irp, STATUS_SUCCESS, 0);
+}
+
+/* EOF */