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",
430 "Expected Extended ExtensionFlags to be DOE_UNLOAD_PENDING, got %lu\n", extdev->
ExtensionFlags);
431 ok (extdev->
Type == 13,
"Expected Type of 13, got %d\n", extdev->
Type);
432 ok (extdev->
Size == 0,
"Expected Size of 0, got %d\n", extdev->
Size);
485 ok(
DriverObject->DeviceObject == 0,
"Expected DriverObject->DeviceObject to be NULL, got %p\n",
505 ok(
DriverObject->DeviceObject == 0,
"Expected DriverObject->DeviceObject to be NULL, got %p\n",
#define DO_DEVICE_INITIALIZING
#define ok_eq_ulong(value, expected)
#define DRVO_LEGACY_DRIVER
static PDRIVER_OBJECT ThisDriverObject
PCSTR KmtMajorFunctionNames[]
NTSTATUS NTAPI IoAttachDevice(PDEVICE_OBJECT SourceDevice, PUNICODE_STRING TargetDeviceName, PDEVICE_OBJECT *AttachedDevice)
static PDEVICE_OBJECT AttachDeviceObject
#define UNREFERENCED_PARAMETER(P)
#define ok_eq_pointer(value, expected)
#define IRP_MJ_MAXIMUM_FUNCTION
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
static BOOLEAN TestZwUnload(IN PDRIVER_OBJECT DriverObject, IN PCUNICODE_STRING DriverRegistryPath, IN PWCHAR NewDriverRegPath)
PDEVICE_OBJECT DeviceObject
static DRIVER_DISPATCH TestDispatch
#define STATUS_INVALID_DEVICE_REQUEST
VOID TestUnload(IN PDRIVER_OBJECT DriverObject)
VOID NTAPI IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
struct _EXTENDED_DEVOBJ_EXTENSION * PEXTENDED_DEVOBJ_EXTENSION
PDEVICE_OBJECT NTAPI IoGetDeviceAttachmentBaseRef(IN PDEVICE_OBJECT DeviceObject)
static VOID TestAttachDevice(IN PDEVICE_OBJECT DeviceObject, IN PWCHAR NewDriverRegPath)
_In_ PDEVICE_OBJECT DeviceObject
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
static BOOLEAN TestZwLoad(IN PDRIVER_OBJECT DriverObject, IN PCUNICODE_STRING DriverRegistryPath, IN PWCHAR NewDriverRegPath)
#define ok_eq_tag(value, expected)
#define IoCompleteRequest
static VOID TestDetachDevice(IN PDEVICE_OBJECT AttachedDevice)
static VOID TestDeviceCreateDelete(IN PDRIVER_OBJECT DriverObject)
PDEVICE_OBJECT NTAPI IoGetLowerDeviceObject(IN PDEVICE_OBJECT DeviceObject)
NTSYSAPI NTSTATUS NTAPI ZwUnloadDriver(_In_ PUNICODE_STRING DriverServiceName)
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
#define DRVO_UNLOAD_INVOKED
PDEVICE_OBJECT AttachedTo
DRIVER_INITIALIZE DriverEntry
_Must_inspect_result_ _In_ ULONG Flags
#define DOE_UNLOAD_PENDING
#define DO_DEVICE_HAS_NAME
#define NT_SUCCESS(StatCode)
NTSTATUS TestEntry(IN PDRIVER_OBJECT DriverObject, IN PCUNICODE_STRING RegistryPath, OUT PCWSTR *DeviceName, IN OUT INT *Flags)
#define ObDereferenceObject
static VOID TestDeviceDeletion(IN PDEVICE_OBJECT DeviceObject, IN BOOLEAN Lower, IN BOOLEAN Attached)
#define STATUS_OBJECT_PATH_NOT_FOUND
USHORT KmtGetPoolType(PVOID Memory)
static VOID TestDriverObject(IN PDRIVER_OBJECT DriverObject, IN PCUNICODE_STRING RegistryPath OPTIONAL, IN DRIVER_STATUS DriverStatus)
DRIVER_DISPATCH(nfs41_FsdDispatch)
static VOID TestDeviceCreated(IN PDEVICE_OBJECT DeviceObject, IN BOOLEAN ExclusiveAccess)
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
UNICODE_STRING DriverRegistryPath
#define STATUS_OBJECT_NAME_NOT_FOUND
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
ULONG KmtGetPoolTag(PVOID Memory)
static PDEVICE_OBJECT MainDeviceObject
#define FILE_DEVICE_UNKNOWN
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
#define IoSkipCurrentIrpStackLocation(Irp)
#define BASE_POOL_TYPE_MASK
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)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define ok_eq_hex(value, expected)
#define ok_eq_uint(value, expected)
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
static VOID TestLowerDeviceKernelAPI(IN PDEVICE_OBJECT DeviceObject)
#define IRP_MJ_DEVICE_CONTROL
#define STATUS_IMAGE_ALREADY_LOADED
#define RTL_CONSTANT_STRING(s)
PULONG MinorVersion OPTIONAL