IrpTracking rule set (WDM)

Use these rules to verify that your driver correctly tracks I/O request packets (IRP) so that the device is not removed while IRPs are outstanding.

In this section

Topic Description

IoReleaseRemoveLockAndWaitOutsideRemoveDevice

The IoReleaseRemoveLockAndWaitOutsideRemoveDevice rule specifies that IoReleaseRemoveLockAndWait should not be called outside IRP_MJ_PNP with IRP_MN_REMOVE_DEVICE for a PnP driver.

NsRemoveLockMnRemove

The NsRemoveLockMnRemove rule verifies a driver does not return STATUS_NOT_SUPPORTED when processing IRP_MJ_PNP with MinorFunction IRP_MN_REMOVE_DEVICE. This rule only applies to FDO and FIDO drivers.

NsRemoveLockMnSurpriseRemove

The NsRemoveLockMnSurpriseRemove rule verifies that a driver does not return STATUS_NOT_SUPPORTED when processing an IRP_MJ_PNP request with minorFunction IRP_MN_SUPRISE_REMOVAL. This rule only applies to FDO and FIDO drivers.

NsRemoveLockQueryMnRemove

The NsRemoveLockQueryMnRemove rule verifies a driver does not return STATUS_NOT_SUPPORTED when processing IRP_MJ_PNP with MinorFunction IRP_MN_QUERY_REMOVE. This rule only applies to FDO and FIDO drivers.

RemoveLock

The RemoveLock rule specifies that calls to IoAcquireRemoveLock and IoReleaseRemoveLock are used correctly. Moreover, at the end of the IRP_MJ_PNP or IRP_MJ_POWER routine, the driver should not hold the RemoveLock.

RemoveLockCheck

The RemoveLockCheck rule verifies that calls to IoAcquireRemoveLock and IoReleaseRemoveLockAndWait are used correctly when processing IRP_MJ_PNP with MinorFunction IRP_MN_REMOVE_DEVICE.

RemoveLockForward

The RemoveLockForward rule verifies that calls to IoAcquireRemoveLock and IoReleaseRemoveLock are used correctly when forwarding an IRP to another device.

RemoveLockForward2

The RemoveLockForward2 rule verifies that calls to IoAcquireRemoveLock and IoReleaseRemoveLock are used correctly when forwarding the IRP to another device.

RemoveLockForwardDeviceControl

The RemoveLockForwardDeviceControl rule verifies that calls to IoAcquireRemoveLock and IoReleaseRemoveLock are used correctly when the driver uses IoCallDriver to forward an IRP to another device.

RemoveLockForwardDeviceControl2

The RemoveLockForwardDeviceControl2 rule verifies that calls to IoAcquireRemoveLock and IoReleaseRemoveLock are used correctly when the driver uses IoCallDriver to forward an IRP to another device.

RemoveLockForwardDeviceControlInternal

The RemoveLockForwardDeviceControlInternal rule verifies that calls to IoAcquireRemoveLock and IoReleaseRemoveLock are used in correctly when forwarding an IRP using IoCallDriver to another device.

RemoveLockForwardDeviceControlInternal2

The RemoveLockForwardDeviceControlInternal2 rule verifies that calls to IoAcquireRemoveLock and IoReleaseRemoveLock are used in correctly when forwarding an IRP using IoCallDriver to another device.

RemoveLockForwardRead

The RemoveLockForwardRead rule verifies that calls to IoAcquireRemoveLock and IoReleaseRemoveLock are used in correctly.

RemoveLockForwardRead2

The RemoveLockForwardRead2 rule verifies that calls to IoAcquireRemoveLock and IoReleaseRemoveLock are used correctly when forwarding an IRP using IoCallDriver to another device.

RemoveLockForwardWrite

The RemoveLockForwardWrite rule verifies that calls to IoAcquireRemoveLock and IoReleaseRemoveLock are used correctly when forwarding an IRP using IoCallDriver to another device.

RemoveLockForwardWrite2

The RemoveLockForwardWrite2 rule verifies that calls to IoAcquireRemoveLock and IoReleaseRemoveLock are used correctly when forwarding an IRP using IoCallDriver to another device.

RemoveLockMnRemove

The RemoveLockMnRemove rule verifies that calls to IoAcquireRemoveLock and IoReleaseRemoveLockAndWait are used correctly when processing IRP_MJ_PNP with MinorFunction IRP_MN_REMOVE_DEVICE.

RemoveLockMnRemove2

The RemoveLockMnRemove2 rule verifies that calls to IoAcquireRemoveLock and IoReleaseRemoveLockAndWait are used correctly when processing IRP_MN_REMOVE_DEVICE request before the IRP is forwarded to lower drivers.

RemoveLockMnSurpriseRemove

The RemoveLockMnSurpriseRemove rule verifies that calls to IoAcquireRemoveLock and IoReleaseRemoveLockAndWait are used correctly when processing IRP_MJ_PNP with MinorFunction IRP_MN_SUPRISE_REMOVAL. The driver should acquire the remove lock before forwarding the IRP down the stack.

RemoveLockQueryMnRemove

The RemoveLockQueryMnRemove rule verifies that calls to IoAcquireRemoveLock and IoReleaseRemoveLock are used correctly when processing IRP_MJ_PNP with MinorFunction IRP_MN_QUERY_REMOVE_DEVICE. The driver should acquire the remove lock before forwarding the IRP down the stack.

RemoveLockRelease2

The rule RemoveLockRelease2 verifies that calls to IoAcquireRemoveLock and IoReleaseRemoveLock are used in strict alternation. Moreover, at the end of the dispatch routine the driver should not hold the remove lock.

RemoveLockReleaseCleanup

The RemoveLockReleaseCleanup rule specifies that calls to IoAcquireRemoveLock and IoReleaseRemoveLock are used in strict alternation. Each call to IoAcquireRemoveLock must have a matching call to IoReleaseRemoveLock. Moreover, at the end of the dispatch routine the driver should not hold the remove lock.

RemoveLockReleaseClose

The rule RemoveLockReleaseClose verifies that calls to IoAcquireRemoveLock and IoReleaseRemoveLock are used in strict alternation. Moreover, at the end of the dispatch routine the driver should not hold the remove lock.

RemoveLockReleaseCreate

The RemoveLockReleaseCreate rule verifies that calls to IoAcquireRemoveLock and IoReleaseRemoveLock are used in strict alternation. Moreover, at the end of the dispatch routine the driver should not hold the remove lock.

RemoveLockReleaseDeviceControl

The RemoveLockReleaseDeviceControl rule verifies that calls to IoAcquireRemoveLock and IoReleaseRemoveLock are used in strict alternation. Moreover, at the end of the dispatch routine the driver should not hold the remove lock.

RemoveLockReleaseInternalDeviceControl

The RemoveLockReleaseInternalDeviceControl rule verifies that calls to IoAcquireRemoveLock and IoReleaseRemoveLock are used in strict alternation. Moreover, at the end of the dispatch routine the driver should not hold the remove lock.

RemoveLockReleasePnp

The RemoveLockReleasePnp rule verifies that calls to IoAcquireRemoveLock and IoReleaseRemoveLock are used in strict alternation. Moreover, at the end of the dispatch routine the driver should not hold the remove lock.

RemoveLockReleasePower

The RemoveLockReleasePower rule verifies that calls to IoAcquireRemoveLock and IoReleaseRemoveLock are used in strict alternation. Moreover, at the end of the dispatch routine the driver should not hold the remove lock.

RemoveLockReleaseRead

The RemoveLockReleaseRead rule verifies that calls to IoAcquireRemoveLock and IoReleaseRemoveLock are used in strict alternation. Moreover, at the end of the dispatch routine the driver should not hold the remove lock.

RemoveLockReleaseShutdown

The RemoveLockReleaseShutdown rule verifies that calls to IoAcquireRemoveLock and IoReleaseRemoveLock are used in strict alternation. Moreover, at the end of the dispatch routine the driver should not hold the remove lock.

RemoveLockReleaseSystemControl

The RemoveLockReleaseSystemControl rule verifies that calls to IoAcquireRemoveLock and IoReleaseRemoveLock are used in strict alternation. Moreover, at the end of the dispatch routine the driver should not hold the remove lock.

RemoveLockReleaseWrite

The RemoveLockReleaseWrite rule verifies that calls to IoAcquireRemoveLock and IoReleaseRemoveLock are used in strict alternation. Moreover, at the end of the dispatch routine the driver should not hold the remove lock.

To select the IrpTracking 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 IrpTracking.

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

    msbuild /t:sdv /p:Inputs="/check:IrpTracking.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).