IRQL rule set (WDM)

Use these rules to verify that your driver makes DDI calls at the required IRQL.

A driver that does not follow the IRQL rules can cause serious problems during operation that can lead to deadlock conditions or computer crashes.

In this section

Topic Description

ForwardedAtBadIrql

The ForwardedAtBadIrql rule specifies that the driver should call IoCallDriver and PoCallDriver at IRQL<DISPATCH_LEVEL unless the IRP major function code being forwarded is one of the following:

ForwardedAtBadIrqlAllocate

The ForwardedAtBadIrqlAllocate rule specifies that the driver should call IoCallDriver and PoCallDriver at IRQL<DISPATCH_LEVEL, unless the IRP major function code being forwarded is one of the following:

ForwardedAtBadIrqlFsdAsync

The ForwardedAtBadIrqlFsdAsync rule specifies that the driver call IoCallDriver and PoCallDriver at IRQL<DISPATCH_LEVEL, unless the IRP major function code being forwarded is one of the following:

ForwardedAtBadIrqlFsdSync

The ForwardedAtBadIrqlFsdSync rule specifies that the driver call IoCallDriver and PoCallDriver at IRQL<DISPATCH_LEVEL, unless the IRP major function code being forwarded is one of the following:

IrqlApcLte

The IrqlApcLte rule specifies that the driver calls ObGetObjectSecurity and ObReleaseObjectSecurity only when it is executing at IRQL <= APC_LEVEL.

IrqlDispatch

The IrqlDispatch rule specifies that the driver calls the following DDIs only when it is executing at IRQL = DISPATCH_LEVEL.

IrqlExAllocatePool

The IrqlExAllocatePool rule specifies that the driver calls ExAllocatePoolWithTag and ExAllocatePoolWithTagPriority only when it is executing at IRQL<=DISPATCH_LEVEL.

IrqlExApcLte1

The IrqlExApcLte1 rule specifies that the driver calls ExAcquireFastMutex and ExTryToAcquireFastMutex only at IRQL <= APC_LEVEL.

IrqlExApcLte2

The IrqlExApcLte2 rule specifies that the driver calls the following routines only at IRQL <= APC_LEVEL.

IrqlExApcLte3

The IrqlExApcLte3 rule specifies that the driver calls the following executive support routines only at IRQL <= APC_LEVEL.

IrqlExApcLteInline

The IrqlExApcLteInline rule specifies that DDIs are only called at proper IRQL levels

IrqlExFree1

The IrqlExFree1 rule specifies that ExFreePool and ExFreePoolWithTag are called at proper IRQL.

IrqlExFree2

The IrqlExFree2 rule specifies that ExFreePool and ExFreePoolWithTag are called at proper IRQL.

IrqlExFree3

The IrqlExFree3 rule specifies that ExFreePool and ExFreePoolWithTag are called at proper IRQL.

IrqlExPassive

The IrqlExPassive rule specifies that the driver calls the following executive support routines only at IRQL = PASSIVE_LEVEL:

The IrqlExPassive rule also specifies that the driver calls ExRaiseStatus at IRQL <= APC_LEVEL

IrqlIoApcLte

The IrqlIoApcLte rule specifies that the driver calls the following I/O manager routines only when it is executing at IRQL <= APC_LEVEL:

IrqlIoDispatch

The IrqlIoDispatch rule specifies that the driver calls the following I/O Manager routines only when it is executing at IRQL <= DISPATCH_LEVEL: IoGetDeviceToVerify, IoSetDeviceToVerify.

IrqlIoPassive1

The IrqlIoPassive1 rule specifies that the driver calls the following routines only when it is executing at IRQL = PASSIVE_LEVEL:

IrqlIoPassive2

The IrqlIoPassive2 rule specifies that the driver calls the following I/O Manager routines only at IRQL = PASSIVE_LEVEL:

IrqlIoPassive3

The IrqlIoPassive3 rule specifies that the driver calls the following routines only when it is executing at IRQL = PASSIVE_LEVEL:

IrqlIoPassive4

The IrqlIoPassive4 rule specifies that the driver calls the following routines only when it is executing at IRQL = PASSIVE_LEVEL:

IrqlIoPassive5

The IrqlIoPassive5 rule specifies that the driver calls specific I/O Manager routines only when it is executing at IRQL = PASSIVE_LEVEL.

IrqlIoRtlZwPassive

The IrqlIoRtlZwPassive rule specifies that the driver calls specific I/O Manager routines only when it is executing at IRQL = PASSIVE_LEVEL.

IrqlKeApcLte1

The IrqlKeApcLte1 rule specifies that the driver calls the following kernel routines only when it is executing at IRQL <= APC_LEVEL:

IrqlKeApcLte2

The IrqlKeApcLte2 rule specifies that the driver calls the following kernel routines only when it is executing at IRQL <= APC_LEVEL:

IrqlKeDispatchLte

The IrqlKeDispatchLte rule specifies that the driver calls the following kernel routines only when it is executing at IRQL <= DISPATCH_LEVEL:

IrqlKeRaiseLower

The IrqlKeRaiseLower rule specifies that the driver does the following when raising and lowering the IRQL:

When the driver calls KeRaiseIrql, it is executing at an IRQL that is lower than or equal to the value of the NewIrql parameter.
The driver calls KeLowerIrql only after calling KeRaiseIrql or KeRaiseIrqlToDpcLevel.

IrqlKeRaiseLower2

The IrqlKeRaiseLower2 rule specifies that drivers use KeLowerIrql to restore the original IRQL raised by a preceding call to KeRaiseIrql or KeRaiseIrqlToDpcLevel.

IrqlKeReleaseSpinLock

The IrqlKeReleaseSpinLock rule specifies that the driver calls KeReleaseSpinLock only when it is executing at IRQL = DISPATCH_LEVEL.

IrqlKeSetEvent

The IrqlKeSetEvent rule specifies that the KeSetEvent routine is only called at IRQL <= DISPATCH_LEVEL when Wait is set to FALSE, and at IRQL <= APC_LEVEL when Wait is set to TRUE.

IrqlKeWaitForMutexObject

The IrqlKeWaitForMutexObject rule specifies the driver to call the KeWaitForMutexObject routine at the proper IRQL based on the value of the Timeout parameter:

IrqlKeWaitForMultipleObjects

The IrqlKeWaitForMultipleObjects rule specifies that callers of the KeWaitForMultipleObjects routine must be running at proper IRQL based upon the Timeout parameter.

IrqlMmApcLte

The IrqlMmApcLte rule specifies that the driver calls the following memory manager routines only when it is executing at IRQL <= APC_LEVEL:

IrqlMmDispatch

The IrqlMmDispatch rule specifies that the driver calls MmFreeContiguousMemory only when it is executing at IRQL <= DISPATCH_LEVEL.

IrqlNtifsApcPassive

The IIrqlNtifsApcPassive rule specifies that the driver calls the DDIs listed in the rule only when it is executing either at IRQL = PASSIVE_LEVEL or at IRQL <= APC_LEVEL.

IrqlObPassive

The IrqlObPassive rule specifies that the driver calls ObReferenceObjectByHandle only when it is executing at IRQL = PASSIVE_LEVEL.

IrqlPsPassive

The IrqlPsPassive rule specifies that the driver calls the following Process Structure routines only when it is executing at IRQL = PASSIVE_LEVEL:

IrqlReturn

The IrqlReturn rule specifies that the driver's dispatch routines return at the same IRQL at which they were called.

IrqlRtlPassive

The IrqlRtlPassive rule specifies that the driver calls RtlDeleteRegistryValue only when it is executing at IRQL = PASSIVE_LEVEL.

IrqlZwPassive

The IrqlZwPassive rule specifies that the driver calls ZwClose only when it is executing at IRQL = PASSIVE_LEVEL.

To select the Irql rule set

  1. Select your driver project (.vcxProj) in Microsoft Visual Studio. From the Driver menu, click Launch Static Driver Verifier….

  2. Click the Rules tab. Under Rule Sets, select Irql.

    To select the default rule set from a Visual Studio developer command prompt window, specify Irql.sdv with the /check option. For example:

    msbuild /t:sdv /p:Inputs="/check:Irql.sdv" mydriver.VcxProj /p:Configuration="Win8 Release" /p:Platform=Win32
    

    For more information, see Using Static Driver Verifier to Find Defects in Drivers and Static Driver Verifier commands (MSBuild).