14#define BASE_POOL_TYPE_MASK 1
53 *
Flags = TESTENTRY_NO_CREATE_DEVICE | TESTENTRY_NO_REGISTER_DISPATCH;
65 PWCHAR LowerDriverRegPath =
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\Kmtest-IoHelper";
69 if (!
skip(Ret,
"Failed to load helper driver\n"))
124 DPRINT(
"TestIrpHandler. Function=%s, DeviceObject=%p, AttachDeviceObject=%p\n",
139 Irp->IoStatus.Information = 0;
155 BOOLEAN CheckThisDispatchRoutine;
156 PVOID FirstMajorFunc;
169 ok(
DriverObject->DeviceObject ==
NULL,
"Expected DeviceObject pointer to be 0, got %p\n",
172 "Expected Flags to be DRVO_LEGACY_DRIVER, got %lu\n",
176 "DriverStart is %p, expected < %p\n",
194 ok(Equal,
"ServiceKeyName is '%wZ'\n", &
DriverObject->DriverExtension->ServiceKeyName);
210 ok(Equal,
"HardwareDatabase is '%wZ'\n",
DriverObject->HardwareDatabase);
214 "DriverInit is %p, expected %p\n",
219 ok(
DriverObject->DeviceObject !=
NULL,
"Expected DeviceObject pointer to non null\n");
221 "Expected Flags to be DRVO_LEGACY_DRIVER | DRVO_INITIALIZED, got %lu\n",
226 ok(
DriverObject->DeviceObject !=
NULL,
"Expected DeviceObject pointer to non null\n");
228 "Expected Flags to be DRVO_LEGACY_DRIVER | DRVO_INITIALIZED | DRVO_UNLOAD_INVOKED, got %lu\n",
236 ok(FirstMajorFunc != 0,
"Expected MajorFunction[1] to be non NULL\n");
238 if (!
skip(FirstMajorFunc !=
NULL,
"First major function not set!\n"))
242 if (DriverStatus > 0) CheckThisDispatchRoutine = (
i > 3) && (
i != 14);
243 else CheckThisDispatchRoutine =
TRUE;
245 if (CheckThisDispatchRoutine)
247 ok(
DriverObject->MajorFunction[
i] == FirstMajorFunc,
"Expected MajorFunction[%d] to match %p\n",
270 DbgPrint(
"WARNING: Loading this a second time will cause BUGCHECK!\n");
274 RtlInitUnicodeString(&RegPath,
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\deadbeef");
275 Status = ZwLoadDriver(&RegPath);
280 Status = ZwLoadDriver(&RegPath);
301 RtlInitUnicodeString(&RegPath,
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\deadbeef");
352 ok(
DeviceObject->ReferenceCount == 0,
"Expected ReferenceCount = 0, got %lu\n",
355 "Expected DriverObject member to match this DriverObject %p, got %p\n",
359 ok(
DeviceObject->Characteristics == 0,
"Expected Characteristics to be 0\n");
363 "Expected Flags DO_DEVICE_HAS_NAME | DO_DEVICE_INITIALIZING | DO_EXCLUSIVE, got %lu\n",
DeviceObject->Flags);
368 "Expected Flags DO_DEVICE_HAS_NAME | DO_DEVICE_INITIALIZING, got %lu\n",
DeviceObject->Flags);
371 "Expected DeviceType to match creation parameter FILE_DEVICE_UNKNWOWN, got %lu\n",
378 ok (extdev->
Type == 13,
"Expected Type of 13, got %d\n", extdev->
Type);
379 ok (extdev->
Size == 0,
"Expected Size of 0, got %d\n", extdev->
Size);
400 ok(
DeviceObject->ReferenceCount == 0,
"Expected ReferenceCount = 0, got %lu\n",
405 "Expected DriverObject member to match this DriverObject %p, got %p\n",
421 "Expected Flags DO_DEVICE_HAS_NAME, got %lu\n",
DeviceObject->Flags);
423 "Expected DeviceType to match creation parameter FILE_DEVICE_UNKNWOWN, got %lu\n",
431 "Expected Extended ExtensionFlags to be DOE_UNLOAD_PENDING, got 0x%lx\n", extdev->
ExtensionFlags);
432 ok (extdev->
Type == 13,
"Expected Type of 13, got %d\n", extdev->
Type);
433 ok (extdev->
Size == 0,
"Expected Size of 0, got %d\n", extdev->
Size);
486 ok(
DriverObject->DeviceObject == 0,
"Expected DriverObject->DeviceObject to be NULL, got %p\n",
506 ok(
DriverObject->DeviceObject == 0,
"Expected DriverObject->DeviceObject to be NULL, got %p\n",
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
static PDRIVER_OBJECT TestDriverObject
static PDRIVER_OBJECT ThisDriverObject
#define BASE_POOL_TYPE_MASK
static BOOLEAN TestZwUnload(IN PDRIVER_OBJECT DriverObject, IN PCUNICODE_STRING DriverRegistryPath, IN PWCHAR NewDriverRegPath)
static BOOLEAN TestZwLoad(IN PDRIVER_OBJECT DriverObject, IN PCUNICODE_STRING DriverRegistryPath, IN PWCHAR NewDriverRegPath)
static PDEVICE_OBJECT MainDeviceObject
static PDEVICE_OBJECT AttachDeviceObject
static VOID TestDeviceCreated(IN PDEVICE_OBJECT DeviceObject, IN BOOLEAN ExclusiveAccess)
static VOID TestLowerDeviceKernelAPI(IN PDEVICE_OBJECT DeviceObject)
DRIVER_INITIALIZE DriverEntry
static DRIVER_DISPATCH TestDispatch
static VOID TestDeviceCreateDelete(IN PDRIVER_OBJECT DriverObject)
static VOID TestDetachDevice(IN PDEVICE_OBJECT AttachedDevice)
VOID TestUnload(IN PDRIVER_OBJECT DriverObject)
NTSTATUS TestEntry(IN PDRIVER_OBJECT DriverObject, IN PCUNICODE_STRING RegistryPath, OUT PCWSTR *DeviceName, IN OUT INT *Flags)
static VOID TestDeviceDeletion(IN PDEVICE_OBJECT DeviceObject, IN BOOLEAN Lower, IN BOOLEAN Attached)
static VOID TestAttachDevice(IN PDEVICE_OBJECT DeviceObject, IN PWCHAR NewDriverRegPath)
#define ok_eq_pointer(value, expected)
#define ok_eq_hex(value, expected)
#define ok_eq_ulong(value, expected)
#define ok_eq_tag(value, expected)
#define ok_eq_uint(value, expected)
#define NT_SUCCESS(StatCode)
#define DO_DEVICE_INITIALIZING
#define DO_DEVICE_HAS_NAME
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
UNICODE_STRING DriverRegistryPath
PCSTR KmtMajorFunctionNames[]
USHORT KmtGetPoolType(PVOID Memory)
ULONG KmtGetPoolTag(PVOID Memory)
NTSYSAPI NTSTATUS NTAPI ZwUnloadDriver(_In_ PUNICODE_STRING DriverServiceName)
struct _EXTENDED_DEVOBJ_EXTENSION * PEXTENDED_DEVOBJ_EXTENSION
#define DOE_UNLOAD_PENDING
DRIVER_DISPATCH(nfs41_FsdDispatch)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
#define UNREFERENCED_PARAMETER(P)
#define IoSkipCurrentIrpStackLocation(Irp)
PDEVICE_OBJECT NTAPI IoGetLowerDeviceObject(IN PDEVICE_OBJECT DeviceObject)
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)
NTSTATUS NTAPI IoAttachDevice(PDEVICE_OBJECT SourceDevice, PUNICODE_STRING TargetDeviceName, PDEVICE_OBJECT *AttachedDevice)
PDEVICE_OBJECT NTAPI IoGetDeviceAttachmentBaseRef(IN PDEVICE_OBJECT DeviceObject)
VOID NTAPI IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
#define IoCompleteRequest
#define STATUS_IMAGE_ALREADY_LOADED
#define FILE_DEVICE_UNKNOWN
#define IRP_MJ_DEVICE_CONTROL
PULONG MinorVersion OPTIONAL
PDEVICE_OBJECT DeviceObject
PDEVICE_OBJECT AttachedTo
#define RTL_CONSTANT_STRING(s)
#define STATUS_INVALID_DEVICE_REQUEST
#define STATUS_OBJECT_PATH_NOT_FOUND
#define STATUS_OBJECT_NAME_NOT_FOUND
_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
_Must_inspect_result_ _In_ ULONG Flags
#define DRVO_UNLOAD_INVOKED
#define DRVO_LEGACY_DRIVER
#define IRP_MJ_MAXIMUM_FUNCTION
#define ObDereferenceObject