20#define KMT_DEFINE_TEST_FUNCTIONS
56static ULONG RequestId = 0;
79 PKMT_DEVICE_EXTENSION DeviceExtension;
103 DPRINT(
"DriverEntry. Created DeviceObject %p. DeviceExtension %p\n",
106 DeviceExtension->ResultBuffer =
NULL;
107 DeviceExtension->Mdl =
NULL;
156 ASSERT(!DeviceExtension->Mdl);
157 ASSERT(!DeviceExtension->ResultBuffer);
190 DPRINT(
"DriverCreate. DeviceObject=%p, RequestorMode=%d, FileObject=%p, FsContext=%p, FsContext2=%p\n",
195 Irp->IoStatus.Information = 0;
223 PKMT_DEVICE_EXTENSION DeviceExtension;
229 DPRINT(
"DriverCleanup. DeviceObject=%p, RequestorMode=%d, FileObject=%p, FsContext=%p, FsContext2=%p\n",
235 if (DeviceExtension->Mdl && IoStackLocation->
FileObject->FsContext == DeviceExtension->Mdl)
239 DeviceExtension->Mdl =
NULL;
248 Irp->IoStatus.Information = 0;
278 DPRINT(
"DriverClose. DeviceObject=%p, RequestorMode=%d\n",
282 Irp->IoStatus.Information = 0;
316 DPRINT(
"DriverIoControl. Code=0x%08X, DeviceObject=%p, FileObject=%p, FsContext=%p, FsContext2=%p\n",
329 DPRINT(
"DriverIoControl. IOCTL_KMTEST_GET_TESTS, outlen=%lu\n",
354 DPRINT(
"DriverIoControl. IOCTL_KMTEST_RUN_TEST, inlen=%lu, outlen=%lu\n",
358 TestName.
Buffer =
Irp->AssociatedIrp.SystemBuffer;
359 DPRINT(
"DriverIoControl. Run test: %Z\n", &TestName);
371 DPRINT1(
"DriverIoControl. Starting test %Z\n", &EntryName);
373 DPRINT1(
"DriverIoControl. Finished test %Z\n", &EntryName);
385 PKMT_DEVICE_EXTENSION DeviceExtension =
DeviceObject->DeviceExtension;
387 DPRINT(
"DriverIoControl. IOCTL_KMTEST_SET_RESULTBUFFER, buffer=%p, inlen=%lu, outlen=%lu\n",
392 if (DeviceExtension->Mdl)
394 if (IoStackLocation->
FileObject->FsContext != DeviceExtension->Mdl)
408 if (!DeviceExtension->Mdl)
422 DeviceExtension->Mdl =
NULL;
427 IoStackLocation->
FileObject->FsContext = DeviceExtension->Mdl;
429 DPRINT(
"DriverIoControl. ResultBuffer: %ld %ld %ld %ld\n",
439 DPRINT(
"DriverIoControl. IOCTL_KMTEST_USERMODE_AWAIT_REQ, len=%lu\n",
473 DPRINT(
"DriverIoControl. IOCTL_KMTEST_USERMODE_SEND_RESPONSE, inlen=%lu, outlen=%lu\n",
522 DPRINT1(
"DriverIoControl. Invalid IoCtl code 0x%08X\n",
563 if (WorkEntry ==
NULL)
578 Timeout.QuadPart = -10 * 1000 * 1000 * 10;
583 DPRINT1(
"Unexpected callback abortion! Reason: %lx\n",
Status);
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
static PDEVICE_OBJECT MainDeviceObject
static void TestEntry(const ENTRY *pEntry)
#define FILE_DEVICE_SECURE_OPEN
#define NT_SUCCESS(StatCode)
static void cleanup(void)
#define __drv_dispatchType(x)
#define RemoveEntryList(Entry)
#define InsertTailList(ListHead, Entry)
#define ExAllocatePoolWithTag(hernya, size, tag)
#define IsListEmpty(ListHead)
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
#define KeInitializeEvent(pEvt, foo, foo2)
#define KeSetEvent(pEvt, foo, foo2)
#define InitializeListHead(ListHead)
VOID NTAPI KeClearEvent(IN PKEVENT Event)
VOID FASTCALL ExAcquireFastMutex(IN PFAST_MUTEX FastMutex)
VOID FASTCALL ExReleaseFastMutex(IN PFAST_MUTEX FastMutex)
#define EXCEPTION_EXECUTE_HANDLER
#define IOCTL_KMTEST_GET_TESTS
#define IOCTL_KMTEST_USERMODE_AWAIT_REQ
#define IOCTL_KMTEST_USERMODE_SEND_RESPONSE
#define IOCTL_KMTEST_RUN_TEST
#define KMTEST_DEVICE_DRIVER_PATH
#define IOCTL_KMTEST_SET_RESULTBUFFER
enum _KMT_CALLBACK_INFORMATION_CLASS KMT_CALLBACK_INFORMATION_CLASS
PKMT_RESULTBUFFER ResultBuffer
BOOLEAN KmtIsCheckedBuild
BOOLEAN KmtIsMultiProcessorBuild
struct _KMT_USER_WORK_LIST * PKMT_USER_WORK_LIST
struct _KMT_USER_WORK_ENTRY * PKMT_USER_WORK_ENTRY
struct _KMT_USER_WORK_LIST KMT_USER_WORK_LIST
static VOID KmtCleanUsermodeCallbacks(VOID)
static NTSTATUS NTAPI DriverCreate(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
PKMT_RESPONSE KmtUserModeCallback(IN KMT_CALLBACK_INFORMATION_CLASS Operation, IN PVOID Parameters)
static NTSTATUS NTAPI DriverClose(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
DRIVER_INITIALIZE DriverEntry
static NTSTATUS NTAPI DriverIoControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
struct _KMT_USER_WORK_ENTRY KMT_USER_WORK_ENTRY
static NTSTATUS NTAPI DriverCleanup(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
VOID KmtFreeCallbackResponse(PKMT_RESPONSE Response)
static DRIVER_UNLOAD DriverUnload
VOID NTAPI MmProbeAndLockPages(IN PMDL Mdl, IN KPROCESSOR_MODE AccessMode, IN LOCK_OPERATION Operation)
VOID NTAPI MmUnlockPages(IN PMDL Mdl)
#define ExFreePoolWithTag(_P, _T)
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
NTSYSAPI LONG NTAPI RtlCompareString(PSTRING String1, PSTRING String2, BOOLEAN CaseInSensitive)
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
#define UNREFERENCED_PARAMETER(P)
_In_ ULONG _In_ ULONG _In_ ULONG Length
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)
#define IoCompleteRequest
#define STATUS_OBJECTID_NOT_FOUND
#define STATUS_INVALID_BUFFER_SIZE
#define STATUS_KERNEL_APC
NTSTRSAFEAPI RtlStringCbCopyExA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ NTSTRSAFE_PCSTR pszSrc, _Outptr_opt_result_bytebuffer_(*pcbRemaining) STRSAFE_LPSTR *ppszDestEnd, _Out_opt_ size_t *pcbRemaining, _In_ STRSAFE_DWORD dwFlags)
#define FILE_DEVICE_UNKNOWN
#define _SEH2_GetExceptionCode()
#define _SEH2_EXCEPT(...)
#define IRP_MJ_DEVICE_CONTROL
base of all file and directory entries
volatile LONG LogBufferLength
struct _IO_STACK_LOCATION::@1575::@1576 DeviceIoControl
union _IO_STACK_LOCATION::@1575 Parameters
KMT_CALLBACK_INFORMATION_CLASS OperationClass
KMT_CALLBACK_REQUEST_PACKET Request
struct _LIST_ENTRY * Flink
EH_STD::__list__< TestClass, eh_allocator(TestClass) > TestList
#define RtlCopyMemory(Destination, Source, Length)
#define CONTAINING_RECORD(address, type, field)
#define STATUS_INVALID_DEVICE_REQUEST
#define STATUS_ACCESS_DENIED
#define STATUS_OBJECT_NAME_INVALID
#define STATUS_INSUFFICIENT_RESOURCES
_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_ WDFQUEUE _In_opt_ WDFREQUEST _In_opt_ WDFFILEOBJECT _Inout_opt_ PWDF_REQUEST_PARAMETERS Parameters
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR OutputBuffer
_Must_inspect_result_ _In_ PWDF_WORKITEM_CONFIG _In_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWORKITEM * WorkItem
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
#define MmGetSystemAddressForMdlSafe(_Mdl, _Priority)