mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 01:35:47 +00:00
[KMTESTS]
- Make IRP major function name table public - IoHelper: catch all IRPs and add debug messages svn path=/branches/GSoC_2011/KMTestSuite/; revision=53293
This commit is contained in:
parent
ee28aa087c
commit
b9b5b6762d
4 changed files with 50 additions and 40 deletions
|
@ -8,6 +8,10 @@
|
||||||
#ifndef _KMTEST_PLATFORM_H_
|
#ifndef _KMTEST_PLATFORM_H_
|
||||||
#define _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
|
#if defined KMT_KERNEL_MODE || defined KMT_STANDALONE_DRIVER
|
||||||
#include <ntddk.h>
|
#include <ntddk.h>
|
||||||
#include <ntifs.h>
|
#include <ntifs.h>
|
||||||
|
|
|
@ -82,6 +82,7 @@ typedef struct
|
||||||
|
|
||||||
extern BOOLEAN KmtIsCheckedBuild;
|
extern BOOLEAN KmtIsCheckedBuild;
|
||||||
extern BOOLEAN KmtIsMultiProcessorBuild;
|
extern BOOLEAN KmtIsMultiProcessorBuild;
|
||||||
|
extern PCSTR KmtMajorFunctionNames[];
|
||||||
|
|
||||||
VOID KmtSetIrql(IN KIRQL NewIrql);
|
VOID KmtSetIrql(IN KIRQL NewIrql);
|
||||||
BOOLEAN KmtAreInterruptsEnabled(VOID);
|
BOOLEAN KmtAreInterruptsEnabled(VOID);
|
||||||
|
@ -96,7 +97,9 @@ VOID KmtCloseDriver(VOID);
|
||||||
DWORD KmtSendToDriver(IN DWORD ControlCode);
|
DWORD KmtSendToDriver(IN DWORD ControlCode);
|
||||||
DWORD KmtSendStringToDriver(IN DWORD ControlCode, IN PCSTR String);
|
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);
|
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;
|
extern PKMT_RESULTBUFFER ResultBuffer;
|
||||||
|
|
||||||
|
@ -169,6 +172,37 @@ BOOLEAN KmtSkip(INT Condition, PCSTR FileAndLine, PCSTR Format, ...)
|
||||||
#if defined KMT_KERNEL_MODE
|
#if defined KMT_KERNEL_MODE
|
||||||
BOOLEAN KmtIsCheckedBuild;
|
BOOLEAN KmtIsCheckedBuild;
|
||||||
BOOLEAN KmtIsMultiProcessorBuild;
|
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)
|
VOID KmtSetIrql(IN KIRQL NewIrql)
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,38 +47,6 @@ static KMT_IRP_HANDLER_ENTRY IrpHandlers[KMT_MAX_IRP_HANDLERS] = { { 0 } };
|
||||||
#define KMT_MAX_MESSAGE_HANDLERS 256
|
#define KMT_MAX_MESSAGE_HANDLERS 256
|
||||||
static KMT_MESSAGE_HANDLER_ENTRY MessageHandlers[KMT_MAX_MESSAGE_HANDLERS] = { { 0 } };
|
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
|
* @name DriverEntry
|
||||||
*
|
*
|
||||||
|
@ -342,7 +310,7 @@ DriverDispatch(
|
||||||
IoStackLocation = IoGetCurrentIrpStackLocation(Irp);
|
IoStackLocation = IoGetCurrentIrpStackLocation(Irp);
|
||||||
|
|
||||||
DPRINT("DriverDispatch: Function=%s, Device=%p\n",
|
DPRINT("DriverDispatch: Function=%s, Device=%p\n",
|
||||||
IrpMajorFunctionNames[IoStackLocation->MajorFunction],
|
KmtMajorFunctionNames[IoStackLocation->MajorFunction],
|
||||||
DeviceObject);
|
DeviceObject);
|
||||||
|
|
||||||
for (i = 0; i < sizeof IrpHandlers / sizeof IrpHandlers[0]; ++i)
|
for (i = 0; i < sizeof IrpHandlers / sizeof IrpHandlers[0]; ++i)
|
||||||
|
|
|
@ -20,6 +20,7 @@ TestEntry(
|
||||||
IN OUT INT *Flags)
|
IN OUT INT *Flags)
|
||||||
{
|
{
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
INT i;
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
@ -27,10 +28,12 @@ TestEntry(
|
||||||
UNREFERENCED_PARAMETER(RegistryPath);
|
UNREFERENCED_PARAMETER(RegistryPath);
|
||||||
UNREFERENCED_PARAMETER(Flags);
|
UNREFERENCED_PARAMETER(Flags);
|
||||||
|
|
||||||
|
DPRINT("TestEntry. DriverObject=%p, RegistryPath=%wZ\n", DriverObject, RegistryPath);
|
||||||
|
|
||||||
*DeviceName = L"IoHelper";
|
*DeviceName = L"IoHelper";
|
||||||
|
|
||||||
KmtRegisterIrpHandler(IRP_MJ_CREATE, NULL, TestIrpHandler);
|
for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; ++i)
|
||||||
KmtRegisterIrpHandler(IRP_MJ_CLOSE, NULL, TestIrpHandler);
|
KmtRegisterIrpHandler(i, NULL, TestIrpHandler);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -42,6 +45,8 @@ TestUnload(
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER(DriverObject);
|
UNREFERENCED_PARAMETER(DriverObject);
|
||||||
|
|
||||||
|
DPRINT("TestUnload. DriverObject=%p\n", DriverObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
|
@ -53,10 +58,9 @@ TestIrpHandler(
|
||||||
{
|
{
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
if (IoStackLocation->MajorFunction == IRP_MJ_CREATE)
|
DPRINT("TestIrpHandler. Function=%s, DeviceObject=%p\n",
|
||||||
DPRINT("Helper Driver: Create Device %p", DeviceObject);
|
KmtMajorFunctionNames[IoStackLocation->MajorFunction],
|
||||||
else if (IoStackLocation->MajorFunction == IRP_MJ_CLOSE)
|
DeviceObject);
|
||||||
DPRINT("Helper Driver: Close Device %p", DeviceObject);
|
|
||||||
|
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
Irp->IoStatus.Information = 0;
|
Irp->IoStatus.Information = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue