[ros-diffs] [tfaber] 53293: [KMTESTS] - Make IRP major function name table public - IoHelper: catch all IRPs and add debug messages

tfaber at svn.reactos.org tfaber at svn.reactos.org
Thu Aug 18 07:09:00 UTC 2011


Author: tfaber
Date: Thu Aug 18 07:08:59 2011
New Revision: 53293

URL: http://svn.reactos.org/svn/reactos?rev=53293&view=rev
Log:
[KMTESTS]
- Make IRP major function name table public
- IoHelper: catch all IRPs and add debug messages

Modified:
    branches/GSoC_2011/KMTestSuite/kmtests/include/kmt_platform.h
    branches/GSoC_2011/KMTestSuite/kmtests/include/kmt_test.h
    branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/kmtest_standalone.c
    branches/GSoC_2011/KMTestSuite/kmtests/ntos_io/IoHelper_drv.c

Modified: branches/GSoC_2011/KMTestSuite/kmtests/include/kmt_platform.h
URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/include/kmt_platform.h?rev=53293&r1=53292&r2=53293&view=diff
==============================================================================
--- branches/GSoC_2011/KMTestSuite/kmtests/include/kmt_platform.h [iso-8859-1] (original)
+++ branches/GSoC_2011/KMTestSuite/kmtests/include/kmt_platform.h [iso-8859-1] Thu Aug 18 07:08:59 2011
@@ -7,6 +7,10 @@
 
 #ifndef _KMTEST_PLATFORM_H_
 #define _KMTEST_PLATFORM_H_
+
+#if !defined _KMTEST_TEST_H_
+#error include kmt_test.h instead of including kmt_platform.h!
+#endif /* !defined _KMTEST_TEST_H_ */
 
 #if defined KMT_KERNEL_MODE || defined KMT_STANDALONE_DRIVER
 #include <ntddk.h>

Modified: branches/GSoC_2011/KMTestSuite/kmtests/include/kmt_test.h
URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/include/kmt_test.h?rev=53293&r1=53292&r2=53293&view=diff
==============================================================================
--- branches/GSoC_2011/KMTestSuite/kmtests/include/kmt_test.h [iso-8859-1] (original)
+++ branches/GSoC_2011/KMTestSuite/kmtests/include/kmt_test.h [iso-8859-1] Thu Aug 18 07:08:59 2011
@@ -82,6 +82,7 @@
 
 extern BOOLEAN KmtIsCheckedBuild;
 extern BOOLEAN KmtIsMultiProcessorBuild;
+extern PCSTR KmtMajorFunctionNames[];
 
 VOID KmtSetIrql(IN KIRQL NewIrql);
 BOOLEAN KmtAreInterruptsEnabled(VOID);
@@ -96,7 +97,9 @@
 DWORD KmtSendToDriver(IN DWORD ControlCode);
 DWORD KmtSendStringToDriver(IN DWORD ControlCode, IN PCSTR String);
 DWORD KmtSendBufferToDriver(IN DWORD ControlCode, IN OUT PVOID Buffer OPTIONAL, IN DWORD InLength, IN OUT PDWORD OutLength);
-#endif /* defined KMT_USER_MODE */
+#else /* if !defined KMT_KERNEL_MODE && !defined KMT_USER_MODE */
+#error either KMT_KERNEL_MODE or KMT_USER_MODE must be defined
+#endif /* !defined KMT_KERNEL_MODE && !defined KMT_USER_MODE */
 
 extern PKMT_RESULTBUFFER ResultBuffer;
 
@@ -169,6 +172,37 @@
 #if defined KMT_KERNEL_MODE
 BOOLEAN KmtIsCheckedBuild;
 BOOLEAN KmtIsMultiProcessorBuild;
+PCSTR KmtMajorFunctionNames[] =
+{
+    "Create",
+    "CreateNamedPipe",
+    "Close",
+    "Read",
+    "Write",
+    "QueryInformation",
+    "SetInformation",
+    "QueryEa",
+    "SetEa",
+    "FlushBuffers",
+    "QueryVolumeInformation",
+    "SetVolumeInformation",
+    "DirectoryControl",
+    "FileSystemControl",
+    "DeviceControl",
+    "InternalDeviceControl/Scsi",
+    "Shutdown",
+    "LockControl",
+    "Cleanup",
+    "CreateMailslot",
+    "QuerySecurity",
+    "SetSecurity",
+    "Power",
+    "SystemControl",
+    "DeviceChange",
+    "QueryQuota",
+    "SetQuota",
+    "Pnp/PnpPower"
+};
 
 VOID KmtSetIrql(IN KIRQL NewIrql)
 {

Modified: branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/kmtest_standalone.c
URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/kmtest_standalone.c?rev=53293&r1=53292&r2=53293&view=diff
==============================================================================
--- branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/kmtest_standalone.c [iso-8859-1] (original)
+++ branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/kmtest_standalone.c [iso-8859-1] Thu Aug 18 07:08:59 2011
@@ -46,38 +46,6 @@
 static KMT_IRP_HANDLER_ENTRY IrpHandlers[KMT_MAX_IRP_HANDLERS] = { { 0 } };
 #define KMT_MAX_MESSAGE_HANDLERS 256
 static KMT_MESSAGE_HANDLER_ENTRY MessageHandlers[KMT_MAX_MESSAGE_HANDLERS] = { { 0 } };
-
-static const char *IrpMajorFunctionNames[] =
-{
-    "Create",
-    "CreateNamedPipe",
-    "Close",
-    "Read",
-    "Write",
-    "QueryInformation",
-    "SetInformation",
-    "QueryEa",
-    "SetEa",
-    "FlushBuffers",
-    "QueryVolumeInformation",
-    "SetVolumeInformation",
-    "DirectoryControl",
-    "FileSystemControl",
-    "DeviceControl",
-    "InternalDeviceControl/Scsi",
-    "Shutdown",
-    "LockControl",
-    "Cleanup",
-    "CreateMailslot",
-    "QuerySecurity",
-    "SetSecurity",
-    "Power",
-    "SystemControl",
-    "DeviceChange",
-    "QueryQuota",
-    "SetQuota",
-    "Pnp/PnpPower"
-};
 
 /**
  * @name DriverEntry
@@ -342,7 +310,7 @@
     IoStackLocation = IoGetCurrentIrpStackLocation(Irp);
 
     DPRINT("DriverDispatch: Function=%s, Device=%p\n",
-            IrpMajorFunctionNames[IoStackLocation->MajorFunction],
+            KmtMajorFunctionNames[IoStackLocation->MajorFunction],
             DeviceObject);
 
     for (i = 0; i < sizeof IrpHandlers / sizeof IrpHandlers[0]; ++i)

Modified: branches/GSoC_2011/KMTestSuite/kmtests/ntos_io/IoHelper_drv.c
URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/ntos_io/IoHelper_drv.c?rev=53293&r1=53292&r2=53293&view=diff
==============================================================================
--- branches/GSoC_2011/KMTestSuite/kmtests/ntos_io/IoHelper_drv.c [iso-8859-1] (original)
+++ branches/GSoC_2011/KMTestSuite/kmtests/ntos_io/IoHelper_drv.c [iso-8859-1] Thu Aug 18 07:08:59 2011
@@ -20,6 +20,7 @@
     IN OUT INT *Flags)
 {
     NTSTATUS Status = STATUS_SUCCESS;
+    INT i;
 
     PAGED_CODE();
 
@@ -27,10 +28,12 @@
     UNREFERENCED_PARAMETER(RegistryPath);
     UNREFERENCED_PARAMETER(Flags);
 
+    DPRINT("TestEntry. DriverObject=%p, RegistryPath=%wZ\n", DriverObject, RegistryPath);
+
     *DeviceName = L"IoHelper";
 
-    KmtRegisterIrpHandler(IRP_MJ_CREATE, NULL, TestIrpHandler);
-    KmtRegisterIrpHandler(IRP_MJ_CLOSE, NULL, TestIrpHandler);
+    for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; ++i)
+        KmtRegisterIrpHandler(i, NULL, TestIrpHandler);
 
     return Status;
 }
@@ -42,6 +45,8 @@
     PAGED_CODE();
 
     UNREFERENCED_PARAMETER(DriverObject);
+
+    DPRINT("TestUnload. DriverObject=%p\n", DriverObject);
 }
 
 static
@@ -53,10 +58,9 @@
 {
     NTSTATUS Status = STATUS_SUCCESS;
 
-    if (IoStackLocation->MajorFunction == IRP_MJ_CREATE)
-        DPRINT("Helper Driver: Create Device %p", DeviceObject);
-    else if (IoStackLocation->MajorFunction == IRP_MJ_CLOSE)
-        DPRINT("Helper Driver: Close Device %p", DeviceObject);
+    DPRINT("TestIrpHandler. Function=%s, DeviceObject=%p\n",
+        KmtMajorFunctionNames[IoStackLocation->MajorFunction],
+        DeviceObject);
 
     Irp->IoStatus.Status = Status;
     Irp->IoStatus.Information = 0;




More information about the Ros-diffs mailing list