Critical Regions and Guarded Regions

A thread that is inside a critical region executes with user APCs and normal kernel APCs disabled. A thread inside a guarded region runs with all APCs disabled.

Critical Regions

A driver can enter and exit a critical region as follows:

Each call to KeEnterCriticalRegion must have a matching call to KeLeaveCriticalRegion.

Guarded Regions

A driver can enter and exit a guarded region as follows:

Each call to KeEnterGuardedRegion must have a matching call to KeLeaveGuardedRegion.

Drivers that were developed for Windows Server 2003 and later versions of Windows can use guarded regions to disable special kernel APCs. Drivers that were developed for earlier operating systems can disable special kernel APCs by raising the current IRQL to APC_LEVEL by calling KeRaiseIrql. Use KeLowerIrql to lower the current IRQL to the previous value.