#include <ntoskrnl.h>
#include <initguid.h>
#include <debug.h>
Go to the source code of this file.
|
| static NTSTATUS NTAPI | ShimDriverInit (_In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath) |
| |
| static VOID NTAPI | ShimDriverStartIo (_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp) |
| |
| static VOID NTAPI | ShimDriverUnload (_In_ PDRIVER_OBJECT DriverObject) |
| |
| static NTSTATUS NTAPI | ShimDriverAddDevice (_In_ PDRIVER_OBJECT DriverObject, _In_ PDEVICE_OBJECT PhysicalDeviceObject) |
| |
| 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 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 PVOID NTAPI | ShimExAllocatePoolWithTag (_In_ POOL_TYPE PoolType, _In_ SIZE_T NumberOfBytes, _In_ ULONG Tag) |
| |
| static VOID NTAPI | ShimExFreePoolWithTag (_In_ PVOID p, _In_ ULONG Tag) |
| |
| static PVOID NTAPI | ShimExAllocatePool (_In_ POOL_TYPE PoolType, _In_ SIZE_T NumberOfBytes) |
| |
| static VOID NTAPI | ShimExFreePool (_In_ PVOID p) |
| |
| static NTSTATUS NTAPI | ShimIrpComplete (_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, _In_ PVOID Context) |
| |
| static NTSTATUS NTAPI | ShimIrp (_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp) |
| |
| static NTSTATUS NTAPI | ShimIrpPnpComplete (_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, _In_ PVOID Context) |
| |
| static NTSTATUS NTAPI | ShimIrpPnp (_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp) |
| |
| | DEFINE_GUID (KmDsShimGuid, 0xbc04ab45, 0xea7e, 0x4a11, 0xa7, 0xbb, 0x97, 0x76, 0x15, 0xf4, 0xca, 0xae) |
| |
| NTSTATUS NTAPI | KseDriverScopeInitialize (VOID) |
| |
◆ KSEP_DEBUG_EVENTS
| #define KSEP_DEBUG_EVENTS 0x0001 |
◆ KSEP_DEBUG_GENERAL
| #define KSEP_DEBUG_GENERAL 0x0100 |
◆ KSEP_DEBUG_IRP
◆ KSEP_DEBUG_MESSAGES
| #define KSEP_DEBUG_MESSAGES 0x0002 |
◆ KSEP_DEBUG_PNP
◆ KSEP_DEBUG_POOL
| #define KSEP_DEBUG_POOL 0x1000 |
◆ KSEP_DEBUG_POWER
| #define KSEP_DEBUG_POWER 0x0400 |
◆ KSEP_DEBUG_UNLOAD
| #define KSEP_DEBUG_UNLOAD 0x2000 |
◆ DEFINE_GUID()
| DEFINE_GUID |
( |
KmDsShimGuid |
, |
|
|
0xbc04ab45 |
, |
|
|
0xea7e |
, |
|
|
0x4a11 |
, |
|
|
0xa7 |
, |
|
|
0xbb |
, |
|
|
0x97 |
, |
|
|
0x76 |
, |
|
|
0x15 |
, |
|
|
0xf4 |
, |
|
|
0xca |
, |
|
|
0xae |
|
|
) |
| |
◆ KseDriverScopeInitialize()
Definition at line 353 of file driverscope.c.
354{
356
359 DPRINT(
"KSE: driver scope shim registered.\n");
360
362}
#define NT_SUCCESS(StatCode)
NTSTATUS NTAPI KseRegisterShim(_In_ PKSE_SHIM Shim, _In_ PVOID Ignored, _In_ ULONG Flags)
Referenced by KseInitialize().
◆ ShimDriverAddDevice()
Definition at line 81 of file driverscope.c.
84{
87
90
92 {
93 DPRINT1(
"[DriverScopeGeneral] DriverObject=%p [%wZ] Pdo=%p Status=0x%08x\n",
95 }
97}
PDEVICE_OBJECT PhysicalDeviceObject
#define KSEP_DEBUG_GENERAL
static ULONG KsepDebugFlags
PKSE_GET_IO_CALLBACKS KseGetIoCallbacksRoutine
PKSE_CALLBACK_ROUTINES KseCallbackRoutines
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
DRIVER_ADD_DEVICE * PDRIVER_ADD_DEVICE
◆ ShimDriverInit()
Definition at line 30 of file driverscope.c.
33{
36
39
41 {
42 DPRINT1(
"[DriverScopeGeneral] DriverObject=%p [%wZ] RegistryPath=%wZ Status=0x%08x\n",
44 }
46}
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
DRIVER_INITIALIZE * PDRIVER_INITIALIZE
◆ ShimDriverStartIo()
Definition at line 49 of file driverscope.c.
52{
55
58 {
59 DPRINT1(
"[DriverScopeGeneral] DriverObject=%p [%wZ] Fdo=%p Irp=%p\n",
61 }
63}
_In_ PDEVICE_OBJECT DeviceObject
DRIVER_STARTIO * PDRIVER_STARTIO
◆ ShimDriverUnload()
Definition at line 66 of file driverscope.c.
68{
70
73 {
74 DPRINT1(
"[DriverScopeGeneral] DriverObject=%p [%wZ]\n",
76 }
78}
DRIVER_UNLOAD * PDRIVER_UNLOAD
◆ ShimExAllocatePool()
Definition at line 184 of file driverscope.c.
187{
190
192
195 {
196 DPRINT1(
"[DriverScopePool] ExAllocatePool: Address=%p Caller=%p Type=%d Size=%u Tag=0x%08x\n",
198 }
199
201}
PKSE_HOOK_COLLECTION HookCollectionsArray
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
◆ ShimExAllocatePoolWithTag()
Definition at line 146 of file driverscope.c.
150{
153
155
158 {
159 DPRINT1(
"[DriverScopePool] ExAllocatePool: Address=%p Caller=%p Type=%d Size=%u Tag=0x%08x\n",
161 }
163}
_Must_inspect_result_ _In_ UCXENDPOINT _In_ PVOID Tag
◆ ShimExFreePool()
Definition at line 204 of file driverscope.c.
206{
208
210
212 {
213 DPRINT1(
"[DriverScopePool] ExFreePool: Address=%p Caller=%p Tag=0x%08x\n",
215 }
216
218}
◆ ShimExFreePoolWithTag()
Definition at line 166 of file driverscope.c.
169{
171
173
175 {
176 DPRINT1(
"[DriverScopePool] ExFreePool: Address=%p Caller=%p Tag=0x%08x\n",
178 }
179
180 OriginalFunction(
p,
Tag);
181}
◆ ShimIoCreateDevice()
Definition at line 100 of file driverscope.c.
108{
111
115 {
116 DPRINT1(
"[DriverScopeGeneral] DriverObject=%p [%wZ] Fdo=%p DeviceType=%d DeviceCharacteristics=0x%x Exclusive=%d Status=0x%08x\n",
118 }
120}
UNICODE_STRING * PUNICODE_STRING
__in PWDFDEVICE_INIT __in BOOLEAN Exclusive
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
_In_ WDFDEVICE _In_ ULONG DeviceCharacteristics
struct _DRIVER_OBJECT * PDRIVER_OBJECT
◆ ShimIrp()
Definition at line 240 of file driverscope.c.
243{
248
252
254 {
256 {
257 DPRINT1(
"[DriverScopeIrps] DriverObject=%p [%wZ] Fdo=%p Irp=%p\n",
259 }
260 else
261 {
262 DPRINT1(
"[DriverScopeIrps] DriverObject=%p [%wZ] Fdo=%p Irp=%p MajorCode=0x%02x Status=0x%08x\n",
264 }
265 }
267}
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
static NTSTATUS NTAPI ShimIrpComplete(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, _In_ PVOID Context)
PKSE_SET_COMPLETION_HOOK KseSetCompletionHookRoutine
DRIVER_DISPATCH * PDRIVER_DISPATCH
◆ ShimIrpComplete()
Definition at line 221 of file driverscope.c.
225{
229
231 {
232 DPRINT1(
"[DriverScopeIrps] DriverObject=%p [%wZ] Fdo=%p Irp=%p MajorCode=0x%02x Status=0x%08x\n",
234 }
235
237}
Referenced by ShimIrp().
◆ ShimIrpPnp()
Definition at line 288 of file driverscope.c.
291{
297
301
303 {
305 {
306 DPRINT1(
"[DriverScopePnp] DriverObject=%p [%wZ] Fdo=%p Irp=%p\n",
308 }
309 else
310 {
311 DPRINT1(
"[DriverScopePnp] DriverObject=%p [%wZ] Fdo=%p Irp=%p MinorCode=0x%02x Status=0x%08x\n",
313 }
314 }
315
317}
static NTSTATUS NTAPI ShimIrpPnpComplete(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, _In_ PVOID Context)
_In_ UCHAR _In_ UCHAR MinorFunction
◆ ShimIrpPnpComplete()
Definition at line 270 of file driverscope.c.
274{
277
279 {
280 DPRINT1(
"[DriverScopePnp] DriverObject=%p [%wZ] Fdo=%p Irp=%p Status=0x%08x\n",
282 }
283
285}
Referenced by ShimIrpPnp().
◆ ShimPoRequestPowerIrp()
Definition at line 123 of file driverscope.c.
130{
134
138 {
139 DPRINT1(
"[DriverScopePower] DriverObject=%p Fdo=%p Irp=%p MinorCode=0x%02x PowerState=%u Status=0x%08x\n",
141 }
143}
struct _DEVICE_OBJECT * PDEVICE_OBJECT
_In_ PIRP _In_ PIO_COMPLETION_ROUTINE _In_ PVOID Context
union _POWER_STATE POWER_STATE
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ WDF_DEVICE_POWER_STATE PowerState
_In_ UCHAR _In_ POWER_STATE _In_opt_ PREQUEST_POWER_COMPLETE CompletionFunction
REQUEST_POWER_COMPLETE * PREQUEST_POWER_COMPLETE
◆ KmDsShim
Definition at line 348 of file driverscope.c.
Referenced by KseDriverScopeInitialize(), ShimDriverAddDevice(), ShimDriverInit(), ShimDriverStartIo(), ShimDriverUnload(), ShimExAllocatePool(), ShimExAllocatePoolWithTag(), ShimExFreePool(), ShimExFreePoolWithTag(), ShimIoCreateDevice(), ShimIrp(), ShimIrpPnp(), and ShimPoRequestPowerIrp().
◆ KmDsShimCollections
Initial value:= {
}
static KSE_HOOK KmDsShimHooksNT[]
static KSE_HOOK KmDsShimHooksCB[]
#define KseCollectionInvalid
#define KseCollectionCallback
#define KseCollectionNtExport
Definition at line 340 of file driverscope.c.
◆ KmDsShimHooksCB
Initial value:= {
}
static VOID NTAPI ShimDriverUnload(_In_ PDRIVER_OBJECT DriverObject)
static VOID NTAPI ShimDriverStartIo(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
static NTSTATUS NTAPI ShimDriverAddDevice(_In_ PDRIVER_OBJECT DriverObject, _In_ PDEVICE_OBJECT PhysicalDeviceObject)
static NTSTATUS NTAPI ShimDriverInit(_In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath)
static NTSTATUS NTAPI ShimIrp(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
static NTSTATUS NTAPI ShimIrpPnp(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
#define KseHookCallbackDriverInit
#define KseHookCallbackAddDevice
#define KseHookCallbackDriverUnload
#define KseHookCallbackDriverStartIo
#define KseHookCallbackMajorFunction
#define KseHookIRPCallback
#define IRP_MJ_DEVICE_CONTROL
Definition at line 328 of file driverscope.c.
◆ KmDsShimHooksNT
Initial value:= {
}
static VOID NTAPI ShimExFreePool(_In_ PVOID p)
static PVOID NTAPI ShimExAllocatePoolWithTag(_In_ POOL_TYPE PoolType, _In_ SIZE_T NumberOfBytes, _In_ ULONG Tag)
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 VOID NTAPI ShimExFreePoolWithTag(_In_ PVOID p, _In_ ULONG Tag)
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)
Definition at line 319 of file driverscope.c.
◆ KsepDebugFlags
| ULONG KsepDebugFlags = ~0 |
|
static |
Definition at line 27 of file driverscope.c.
Referenced by ShimDriverAddDevice(), ShimDriverInit(), ShimDriverStartIo(), ShimDriverUnload(), ShimExAllocatePool(), ShimExAllocatePoolWithTag(), ShimExFreePool(), ShimExFreePoolWithTag(), ShimIoCreateDevice(), ShimIrp(), ShimIrpComplete(), ShimIrpPnp(), ShimIrpPnpComplete(), and ShimPoRequestPowerIrp().