mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 19:33:16 +00:00
Add two simple tests for IoRegisterDeviceInterface() explaining which fields IoRegisterDeviceInterface() checks for mandatory presence (WDK is not clear about this)
svn path=/trunk/; revision=22980
This commit is contained in:
parent
2948f5ecdf
commit
b77e8f5145
2 changed files with 51 additions and 9 deletions
|
@ -23,6 +23,7 @@
|
||||||
/* INCLUDES *******************************************************************/
|
/* INCLUDES *******************************************************************/
|
||||||
|
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
|
#include <ndk/iotypes.h>
|
||||||
#include "kmtest.h"
|
#include "kmtest.h"
|
||||||
|
|
||||||
//#define NDEBUG
|
//#define NDEBUG
|
||||||
|
@ -101,12 +102,53 @@ VOID FASTCALL DeviceInterfaceTest_Func()
|
||||||
ExFreePool(SymbolicLinkList);
|
ExFreePool(SymbolicLinkList);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID FASTCALL DeviceInterfaceTest()
|
VOID RegisterDI_Test()
|
||||||
{
|
{
|
||||||
DPRINT("Calling DeviceInterfaceTest_Func with native functions\n");
|
GUID Guid = {0x378de44c, 0x56ef, 0x11d1, {0xbc, 0x8c, 0x00, 0xa0, 0xc9, 0x14, 0x05, 0xdd}};
|
||||||
IoGetDeviceInterfaces_Func = IoGetDeviceInterfaces;
|
DEVICE_OBJECT DeviceObject;
|
||||||
DeviceInterfaceTest_Func();
|
EXTENDED_DEVOBJ_EXTENSION DeviceObjectExtension;
|
||||||
DPRINT("Calling DeviceInterfaceTest_Func with ReactOS functions\n");
|
DEVICE_NODE DeviceNode;
|
||||||
IoGetDeviceInterfaces_Func = ReactOS_IoGetDeviceInterfaces;
|
UNICODE_STRING SymbolicLinkName;
|
||||||
DeviceInterfaceTest_Func();
|
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");
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,8 +103,8 @@ int kmtest_ok(int condition, const char *msg, ... )
|
||||||
/*
|
/*
|
||||||
* Test Declarations
|
* Test Declarations
|
||||||
*/
|
*/
|
||||||
VOID FASTCALL DeviceInterfaceTest();
|
|
||||||
VOID FASTCALL NtoskrnlIoMdlTest();
|
VOID FASTCALL NtoskrnlIoMdlTest();
|
||||||
|
VOID FASTCALL NtoskrnlIoDeviceInterface();
|
||||||
VOID FASTCALL NtoskrnlObTest();
|
VOID FASTCALL NtoskrnlObTest();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -116,7 +116,7 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
|
||||||
PUNICODE_STRING RegistryPath)
|
PUNICODE_STRING RegistryPath)
|
||||||
{
|
{
|
||||||
DbgPrint("\n===============================================\nKernel Mode Regression Test driver starting...\n");
|
DbgPrint("\n===============================================\nKernel Mode Regression Test driver starting...\n");
|
||||||
//DeviceInterfaceTest();
|
NtoskrnlIoDeviceInterface();
|
||||||
NtoskrnlIoMdlTest();
|
NtoskrnlIoMdlTest();
|
||||||
NtoskrnlObTest();
|
NtoskrnlObTest();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue