19#define KSEP_DEBUG_EVENTS 0x0001
20#define KSEP_DEBUG_MESSAGES 0x0002
21#define KSEP_DEBUG_GENERAL 0x0100
22#define KSEP_DEBUG_PNP 0x0200
23#define KSEP_DEBUG_POWER 0x0400
24#define KSEP_DEBUG_IRP 0x0800
25#define KSEP_DEBUG_POOL 0x1000
26#define KSEP_DEBUG_UNLOAD 0x2000
42 DPRINT1(
"[DriverScopeGeneral] DriverObject=%p [%wZ] RegistryPath=%wZ Status=0x%08x\n",
59 DPRINT1(
"[DriverScopeGeneral] DriverObject=%p [%wZ] Fdo=%p Irp=%p\n",
74 DPRINT1(
"[DriverScopeGeneral] DriverObject=%p [%wZ]\n",
93 DPRINT1(
"[DriverScopeGeneral] DriverObject=%p [%wZ] Pdo=%p Status=0x%08x\n",
116 DPRINT1(
"[DriverScopeGeneral] DriverObject=%p [%wZ] Fdo=%p DeviceType=%d DeviceCharacteristics=0x%x Exclusive=%d Status=0x%08x\n",
139 DPRINT1(
"[DriverScopePower] DriverObject=%p Fdo=%p Irp=%p MinorCode=0x%02x PowerState=%u Status=0x%08x\n",
159 DPRINT1(
"[DriverScopePool] ExAllocatePool: Address=%p Caller=%p Type=%d Size=%u Tag=0x%08x\n",
176 DPRINT1(
"[DriverScopePool] ExFreePool: Address=%p Caller=%p Tag=0x%08x\n",
180 OriginalFunction(
p,
Tag);
196 DPRINT1(
"[DriverScopePool] ExAllocatePool: Address=%p Caller=%p Type=%d Size=%u Tag=0x%08x\n",
213 DPRINT1(
"[DriverScopePool] ExFreePool: Address=%p Caller=%p Tag=0x%08x\n",
232 DPRINT1(
"[DriverScopeIrps] DriverObject=%p [%wZ] Fdo=%p Irp=%p MajorCode=0x%02x Status=0x%08x\n",
257 DPRINT1(
"[DriverScopeIrps] DriverObject=%p [%wZ] Fdo=%p Irp=%p\n",
262 DPRINT1(
"[DriverScopeIrps] DriverObject=%p [%wZ] Fdo=%p Irp=%p MajorCode=0x%02x Status=0x%08x\n",
280 DPRINT1(
"[DriverScopePnp] DriverObject=%p [%wZ] Fdo=%p Irp=%p Status=0x%08x\n",
306 DPRINT1(
"[DriverScopePnp] DriverObject=%p [%wZ] Fdo=%p Irp=%p\n",
311 DPRINT1(
"[DriverScopePnp] DriverObject=%p [%wZ] Fdo=%p Irp=%p MinorCode=0x%02x Status=0x%08x\n",
346DEFINE_GUID(KmDsShimGuid, 0xbc04ab45, 0xea7e, 0x4a11, 0xa7, 0xbb, 0x97, 0x76, 0x15, 0xf4, 0xca, 0xae);
359 DPRINT(
"KSE: driver scope shim registered.\n");
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
PDEVICE_OBJECT PhysicalDeviceObject
#define NT_SUCCESS(StatCode)
#define KSEP_DEBUG_GENERAL
static NTSTATUS NTAPI ShimIrpComplete(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, _In_ PVOID Context)
static VOID NTAPI ShimDriverUnload(_In_ PDRIVER_OBJECT DriverObject)
static VOID NTAPI ShimDriverStartIo(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
static VOID NTAPI ShimExFreePool(_In_ PVOID p)
static NTSTATUS NTAPI ShimIrpPnpComplete(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, _In_ PVOID Context)
static PVOID NTAPI ShimExAllocatePoolWithTag(_In_ POOL_TYPE PoolType, _In_ SIZE_T NumberOfBytes, _In_ ULONG Tag)
static NTSTATUS NTAPI ShimDriverAddDevice(_In_ PDRIVER_OBJECT DriverObject, _In_ PDEVICE_OBJECT PhysicalDeviceObject)
static NTSTATUS NTAPI ShimPoRequestPowerIrp(_In_ PDEVICE_OBJECT DeviceObject, _In_ UCHAR MinorFunction, _In_ POWER_STATE PowerState, _In_ PREQUEST_POWER_COMPLETE CompletionFunction, _In_ PVOID Context, _Out_ PIRP *Irp)
static NTSTATUS NTAPI ShimDriverInit(_In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath)
static VOID NTAPI ShimExFreePoolWithTag(_In_ PVOID p, _In_ ULONG Tag)
static ULONG KsepDebugFlags
static KSE_HOOK_COLLECTION KmDsShimCollections[]
static KSE_HOOK KmDsShimHooksNT[]
NTSTATUS NTAPI KseDriverScopeInitialize(VOID)
static NTSTATUS NTAPI ShimIoCreateDevice(_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)
static PVOID NTAPI ShimExAllocatePool(_In_ POOL_TYPE PoolType, _In_ SIZE_T NumberOfBytes)
static NTSTATUS NTAPI ShimIrp(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
static KSE_HOOK KmDsShimHooksCB[]
static NTSTATUS NTAPI ShimIrpPnp(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
UNICODE_STRING * PUNICODE_STRING
struct _DEVICE_OBJECT * PDEVICE_OBJECT
__in PWDFDEVICE_INIT __in BOOLEAN Exclusive
#define KseHookCallbackDriverInit
#define KseHookCallbackAddDevice
_In_ PIRP _In_ PIO_COMPLETION_ROUTINE _In_ PVOID Context
#define KseHookCallbackDriverUnload
#define KseCollectionInvalid
#define KseHookCallbackDriverStartIo
#define KseCollectionCallback
#define KseHookCallbackMajorFunction
#define KseCollectionNtExport
struct _KSE_SHIM KSE_SHIM
NTSTATUS NTAPI KseRegisterShim(_In_ PKSE_SHIM Shim, _In_ PVOID Ignored, _In_ ULONG Flags)
#define KseHookIRPCallback
union _POWER_STATE POWER_STATE
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8)
#define IRP_MJ_DEVICE_CONTROL
PKSE_GET_IO_CALLBACKS KseGetIoCallbacksRoutine
PKSE_SET_COMPLETION_HOOK KseSetCompletionHookRoutine
PKSE_HOOK_COLLECTION HookCollectionsArray
PKSE_CALLBACK_ROUTINES KseCallbackRoutines
_Must_inspect_result_ _In_ UCXENDPOINT _In_ PVOID Tag
_In_ PDEVICE_OBJECT DeviceObject
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ WDF_DEVICE_POWER_STATE PowerState
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
_In_ UCHAR _In_ UCHAR MinorFunction
_In_ WDFDEVICE _In_ ULONG DeviceCharacteristics
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
struct _DRIVER_OBJECT * PDRIVER_OBJECT
DRIVER_STARTIO * PDRIVER_STARTIO
DRIVER_UNLOAD * PDRIVER_UNLOAD
DRIVER_ADD_DEVICE * PDRIVER_ADD_DEVICE
DRIVER_DISPATCH * PDRIVER_DISPATCH
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
DRIVER_INITIALIZE * PDRIVER_INITIALIZE
_In_ UCHAR _In_ POWER_STATE _In_opt_ PREQUEST_POWER_COMPLETE CompletionFunction
REQUEST_POWER_COMPLETE * PREQUEST_POWER_COMPLETE