12#define KMT_DEFINE_TEST_FUNCTIONS
45#define KMT_MAX_IRP_HANDLERS 256
47#define KMT_MAX_MESSAGE_HANDLERS 256
69 WCHAR DeviceNameBuffer[128] =
L"\\Device\\Kmtest-";
72 PKMT_DEVICE_EXTENSION KmtestDeviceExtension;
93 DPRINT1(
"Failed to get Kmtest device object pointer\n");
101 DPRINT1(
"Failed to reference Kmtest device object\n");
110 DPRINT(
"KmtestDeviceExtension: %p\n", (
PVOID)KmtestDeviceExtension);
115 DeviceName.MaximumLength =
sizeof DeviceNameBuffer;
119 if (!(
Flags & TESTENTRY_NO_CREATE_DEVICE))
135 if (
Flags & TESTENTRY_BUFFERED_IO_DEVICE)
138 DPRINT(
"DriverEntry. Created DeviceObject %p\n",
143 if (!(
Flags & TESTENTRY_NO_REGISTER_UNLOAD))
145 if (!(
Flags & TESTENTRY_NO_REGISTER_DISPATCH))
217 IN PKMT_IRP_HANDLER IrpHandler)
228 if (IrpHandler ==
NULL)
270 IN PKMT_IRP_HANDLER IrpHandler)
315 DPRINT(
"DriverDispatch: Function=%s, Device=%p\n",
340 Irp->IoStatus.Information = 0;
371 IN PKMT_MESSAGE_HANDLER MessageHandler)
382 if (MessageHandler ==
NULL)
424 IN PKMT_MESSAGE_HANDLER MessageHandler)
473 ULONG ControlCode = (IoStackLocation->Parameters.DeviceIoControl.IoControlCode & 0x00000FFC) >> 2;
474 SIZE_T OutLength = IoStackLocation->Parameters.DeviceIoControl.OutputBufferLength;
485 IoStackLocation->Parameters.DeviceIoControl.InputBufferLength,
492 Irp->IoStatus.Information = OutLength;
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
VOID TestUnload(IN PDRIVER_OBJECT DriverObject)
static void TestEntry(const ENTRY *pEntry)
static OBJECT_ATTRIBUTES KmtestFileObject
#define FILE_DEVICE_SECURE_OPEN
#define NT_SUCCESS(StatCode)
static void cleanup(void)
NTSTATUS RtlAppendUnicodeToString(IN PUNICODE_STRING Str1, IN PWSTR Str2)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define KMTEST_DEVICE_DRIVER_PATH
PKMT_RESULTBUFFER ResultBuffer
PCSTR KmtMajorFunctionNames[]
BOOLEAN KmtIsCheckedBuild
BOOLEAN KmtIsMultiProcessorBuild
NTSTATUS KmtRegisterMessageHandler(IN ULONG ControlCode OPTIONAL, IN PDEVICE_OBJECT DeviceObject OPTIONAL, IN PKMT_MESSAGE_HANDLER MessageHandler)
static PDEVICE_OBJECT TestDeviceObject
static PDEVICE_OBJECT KmtestDeviceObject
DRIVER_INITIALIZE DriverEntry
struct KMT_MESSAGE_HANDLER_ENTRY * PKMT_MESSAGE_HANDLER_ENTRY
static KMT_IRP_HANDLER_ENTRY IrpHandlers[KMT_MAX_IRP_HANDLERS]
NTSTATUS KmtUnregisterMessageHandler(IN ULONG ControlCode OPTIONAL, IN PDEVICE_OBJECT DeviceObject OPTIONAL, IN PKMT_MESSAGE_HANDLER MessageHandler)
#define KMT_MAX_IRP_HANDLERS
static KMT_MESSAGE_HANDLER_ENTRY MessageHandlers[KMT_MAX_MESSAGE_HANDLERS]
NTSTATUS KmtUnregisterIrpHandler(IN UCHAR MajorFunction, IN PDEVICE_OBJECT DeviceObject OPTIONAL, IN PKMT_IRP_HANDLER IrpHandler)
NTSTATUS KmtRegisterIrpHandler(IN UCHAR MajorFunction, IN PDEVICE_OBJECT DeviceObject OPTIONAL, IN PKMT_IRP_HANDLER IrpHandler)
#define KMT_MAX_MESSAGE_HANDLERS
struct KMT_IRP_HANDLER_ENTRY * PKMT_IRP_HANDLER_ENTRY
static DRIVER_DISPATCH DriverDispatch
static DRIVER_UNLOAD DriverUnload
static KMT_IRP_HANDLER DeviceControlHandler
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
#define PRCB_BUILD_UNIPROCESSOR
DRIVER_DISPATCH(nfs41_FsdDispatch)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define FILE_READ_ONLY_DEVICE
#define UNREFERENCED_PARAMETER(P)
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
NTSTATUS NTAPI IoGetDeviceObjectPointer(IN PUNICODE_STRING ObjectName, IN ACCESS_MASK DesiredAccess, OUT PFILE_OBJECT *FileObject, OUT PDEVICE_OBJECT *DeviceObject)
#define IoCompleteRequest
#define STATUS_INVALID_PARAMETER_2
#define STATUS_ALLOTTED_SPACE_EXCEEDED
#define STATUS_INVALID_PARAMETER_1
#define STATUS_INVALID_PARAMETER_3
NTSTATUS NTAPI ObReferenceObjectByPointer(IN PVOID Object, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode)
#define FILE_DEVICE_UNKNOWN
#define IRP_MJ_DEVICE_CONTROL
PULONG MinorVersion OPTIONAL
PDEVICE_OBJECT DeviceObject
PKMT_IRP_HANDLER IrpHandler
PKMT_MESSAGE_HANDLER MessageHandler
PDEVICE_OBJECT DeviceObject
#define STATUS_INVALID_DEVICE_REQUEST
_In_ PDEVICE_OBJECT DeviceObject
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
_IRQL_requires_same_ typedef _In_ ULONG ControlCode
_Must_inspect_result_ _In_ ULONG Flags
#define IRP_MJ_INTERNAL_DEVICE_CONTROL
#define IRP_MJ_MAXIMUM_FUNCTION
#define ObDereferenceObject