[ros-diffs] [fireball] 22980: Add two simple tests for IoRegisterDeviceInterface() explaining which fields IoRegisterDeviceInterface() checks for mandatory presence (WDK is not clear about this)

fireball at svn.reactos.org fireball at svn.reactos.org
Sun Jul 9 23:39:49 CEST 2006


Author: fireball
Date: Mon Jul 10 01:39:49 2006
New Revision: 22980

URL: http://svn.reactos.org/svn/reactos?rev=22980&view=rev
Log:
Add two simple tests for IoRegisterDeviceInterface() explaining which fields IoRegisterDeviceInterface() checks for mandatory presence (WDK is not clear about this)

Modified:
    trunk/reactos/drivers/test/kmtest/deviface_test.c
    trunk/reactos/drivers/test/kmtest/kmtest.c

Modified: trunk/reactos/drivers/test/kmtest/deviface_test.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/test/kmtest/deviface_test.c?rev=22980&r1=22979&r2=22980&view=diff
==============================================================================
--- trunk/reactos/drivers/test/kmtest/deviface_test.c (original)
+++ trunk/reactos/drivers/test/kmtest/deviface_test.c Mon Jul 10 01:39:49 2006
@@ -23,6 +23,7 @@
 /* INCLUDES *******************************************************************/
 
 #include <ddk/ntddk.h>
+#include <ndk/iotypes.h>
 #include "kmtest.h"
 
 //#define NDEBUG
@@ -101,12 +102,53 @@
    ExFreePool(SymbolicLinkList);
 }
 
-VOID FASTCALL DeviceInterfaceTest()
+VOID RegisterDI_Test()
 {
-   DPRINT("Calling DeviceInterfaceTest_Func with native functions\n");
-   IoGetDeviceInterfaces_Func = IoGetDeviceInterfaces;
-   DeviceInterfaceTest_Func();
-   DPRINT("Calling DeviceInterfaceTest_Func with ReactOS functions\n");
-   IoGetDeviceInterfaces_Func = ReactOS_IoGetDeviceInterfaces;
-   DeviceInterfaceTest_Func();
+    GUID Guid = {0x378de44c, 0x56ef, 0x11d1, {0xbc, 0x8c, 0x00, 0xa0, 0xc9, 0x14, 0x05, 0xdd}};
+    DEVICE_OBJECT DeviceObject;
+    EXTENDED_DEVOBJ_EXTENSION DeviceObjectExtension;
+    DEVICE_NODE DeviceNode;
+    UNICODE_STRING SymbolicLinkName;
+    NTSTATUS Status;
+
+    RtlInitUnicodeString(&SymbolicLinkName, L"");
+
+    // Prepare our surrogate of a Device Object
+    DeviceObject.DeviceObjectExtension = (PDEVOBJ_EXTENSION)&DeviceObjectExtension;
+
+    // 1. DeviceNode = NULL
+    DeviceObjectExtension.DeviceNode = NULL;
+    Status = IoRegisterDeviceInterface(&DeviceObject, &Guid, NULL,
+        &SymbolicLinkName);
+
+    ok(Status == STATUS_INVALID_DEVICE_REQUEST,
+        "IoRegisterDeviceInterface returned 0x%08lX\n", Status);
+
+    // 2. DeviceNode->InstancePath is of a null length
+    DeviceObjectExtension.DeviceNode = &DeviceNode;
+    DeviceNode.InstancePath.Length = 0;
+    Status = IoRegisterDeviceInterface(&DeviceObject, &Guid, NULL,
+        &SymbolicLinkName);
+
+    ok(Status == STATUS_INVALID_DEVICE_REQUEST,
+        "IoRegisterDeviceInterface returned 0x%08lX\n", Status);
 }
+
+VOID FASTCALL NtoskrnlIoDeviceInterface()
+{
+    StartTest();
+
+    // Test IoRegisterDeviceInterface() failures now
+    RegisterDI_Test();
+
+/*
+    DPRINT("Calling DeviceInterfaceTest_Func with native functions\n");
+    IoGetDeviceInterfaces_Func = IoGetDeviceInterfaces;
+    DeviceInterfaceTest_Func();
+    DPRINT("Calling DeviceInterfaceTest_Func with ReactOS functions\n");
+    IoGetDeviceInterfaces_Func = ReactOS_IoGetDeviceInterfaces;
+    DeviceInterfaceTest_Func();
+*/
+
+    FinishTest("NTOSKRNL Io Device Interface Test");
+}

Modified: trunk/reactos/drivers/test/kmtest/kmtest.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/test/kmtest/kmtest.c?rev=22980&r1=22979&r2=22980&view=diff
==============================================================================
--- trunk/reactos/drivers/test/kmtest/kmtest.c (original)
+++ trunk/reactos/drivers/test/kmtest/kmtest.c Mon Jul 10 01:39:49 2006
@@ -103,8 +103,8 @@
 /*
  * Test Declarations
  */
-VOID FASTCALL DeviceInterfaceTest();
 VOID FASTCALL NtoskrnlIoMdlTest();
+VOID FASTCALL NtoskrnlIoDeviceInterface();
 VOID FASTCALL NtoskrnlObTest();
 
 /*
@@ -116,7 +116,7 @@
             PUNICODE_STRING RegistryPath)
 {
     DbgPrint("\n===============================================\nKernel Mode Regression Test driver starting...\n");
-    //DeviceInterfaceTest();
+    NtoskrnlIoDeviceInterface();
     NtoskrnlIoMdlTest();
     NtoskrnlObTest();
 




More information about the Ros-diffs mailing list