[KMTEST]
authorThomas Faber <thomas.faber@reactos.org>
Fri, 1 May 2015 10:52:37 +0000 (10:52 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Fri, 1 May 2015 10:52:37 +0000 (10:52 +0000)
- Add TESTENTRY_NO_READONLY_DEVICE and TESTENTRY_BUFFERED_IO_DEVICE flags for standalone drivers

svn path=/trunk/; revision=67486

rostests/kmtests/include/kmt_test.h
rostests/kmtests/kmtest_drv/kmtest_standalone.c

index ca3038d..f63fb25 100644 (file)
@@ -109,6 +109,8 @@ typedef enum
     TESTENTRY_NO_REGISTER_DISPATCH = 2,
     TESTENTRY_NO_REGISTER_UNLOAD = 4,
     TESTENTRY_NO_EXCLUSIVE_DEVICE = 8,
+    TESTENTRY_NO_READONLY_DEVICE = 16,
+    TESTENTRY_BUFFERED_IO_DEVICE = 32,
 } KMT_TESTENTRY_FLAGS;
 
 NTSTATUS TestEntry(IN PDRIVER_OBJECT DriverObject, IN PCUNICODE_STRING RegistryPath, OUT PCWSTR *DeviceName, IN OUT INT *Flags);
index cf4ced3..a2e397a 100644 (file)
@@ -121,7 +121,8 @@ DriverEntry(
         RtlAppendUnicodeToString(&DeviceName, DeviceNameSuffix);
         Status = IoCreateDevice(DriverObject, 0, &DeviceName,
                                 FILE_DEVICE_UNKNOWN,
-                                FILE_DEVICE_SECURE_OPEN | FILE_READ_ONLY_DEVICE,
+                                FILE_DEVICE_SECURE_OPEN |
+                                    (Flags & TESTENTRY_NO_READONLY_DEVICE ? 0 : FILE_READ_ONLY_DEVICE),
                                 Flags & TESTENTRY_NO_EXCLUSIVE_DEVICE ? FALSE : TRUE,
                                 &TestDeviceObject);
 
@@ -131,6 +132,9 @@ DriverEntry(
             goto cleanup;
         }
 
+        if (Flags & TESTENTRY_BUFFERED_IO_DEVICE)
+            TestDeviceObject->Flags |= DO_BUFFERED_IO;
+
         DPRINT("DriverEntry. Created DeviceObject %p\n",
                  TestDeviceObject);
     }