The PAGED_CODE macro ensures that the calling thread is running at an IRQL that is low enough to permit paging.
Syntax
C++
VOID PAGED_CODE(void);
Parameters
Thismacro has no parameters.
Return value
None
Remarks
If the IRQL > APC_LEVEL, the PAGED_CODE macro causes the system to ASSERT.
IRQ级别大于APC_LEVEL时,导致系统挂起,对IRQL的分析请见“IRQL APC_LEVEL and APC ”
(http://blog.163.com/hao_dsliu/blog/static/131578908201373171111173/)
A call to thismacro should be made at the beginning of every driver routine that either contains pageable code or accesses pageable code.
在函数开头使用,即在变量定义之后使用
/* Video Miniport Driver entry point */
ULONG DriverEntry(IN PVOID Context1, IN PVOID Context2)
{
PAGED_CODE();
}
The PAGED_CODE macro checks the IRQL only at the point at which the driver code executes the macro.If the code subsequently raises the IRQL, the macro will not detect this change. Driver developers should use Static Driver Verifier and Driver Verifier to detect when the IRQL is raised improperly during the execution of a driver routine.
The PAGED_CODE macro works only in checked builds.