LocalIrpProcessing rule set (WDM)

Use these rules to verify that your driver correctly handles I/O request packets (IRP) that are created by the driver.

In this section

Topic Description

IoAllocateComplete

The IoAllocateComplete rule specifies that a driver should not call IoCompleteRequest if the IRP was created with IoAllocateIrp.

IoAllocateFree

The IoAllocateFree rule specifies that a driver should use IoFreeIrp only on IRPs that were previously allocated with IoAllocateIrp.

IoAllocateForward

The IoAllocateForward rule specifies that if an IRP is generated by a call to IoAllocateIrp, the driver must set a completion routine before calling IoCallDriver or PoCallDriver.

IoAllocateIrpSignalEventInCompletion

The IoAllocateIrpSignalEventInCompletion rule specifies that the driver should call KeSetEvent in the completion routine when the Irp->PendingReturned flag is set and the completion routine is processing a locally created asynchronous IRP.

IoAllocateIrpSignalEventInCompletion2

The IoAllocateIrpSignalEventInCompletion2 rule specifies that KeSetEvent needs to be called in the completion routine when the Irp->PendingReturned flag is set and the completion routine is processing a locally created asynchronous IRP.

IoAllocateIrpSignalEventInCompletion3

The IoAllocateIrpSignalEventInCompletion3 rule specifies that KeSetEvent needs to be called in the completion routine when the Irp->PendingReturned flag is set and the completion routine is processing a locally created asynchronous IRP.

IoAllocateIrpSignalEventInCompletionTimeout

The IoAllocateIrpSignalEventInCompletionTimeout rule reports a defect if it detects that this driver will wait indefinitely until the lower driver returns, as the IRP’s event is required to be signaled in the completion routine.

IoBuildDeviceControlNoFree

The IoBuildDeviceControlNoFree rule specifies that a driver that calls IoBuildDeviceIoControlRequest must not call IoFreeIrp.

IoBuildDeviceControlWait

The IoBuildDeviceControlWait rule specifies that the KeWaitForSingleObject routine should be called if IoCallDriver or PoCallDriver returns STATUS_PENDING.

IoBuildDeviceControlWaitTimeout

The IoBuildDeviceControlWaitTimeout rule reports a defect if it detects that this driver will wait indefinitely until the lower driver returns, as the IRP’s event is required to be signaled in the completion routine.

IoBuildDeviceIoControlSetEvent

The IoBuildDeviceIoControlSetEvent rule specifies that a driver that calls IoBuildDeviceIoControlRequest must not call KeSetEvent if the driver supplies a pointer to a caller-allocated and initialized event object. The KeSetEvent does not need to be called by the driver for this IRP.

IoBuildFsdComplete

The IoBuildFsdComplete rule specifies that a driver should not call IoCompleteRequest if the IRP was created with IoBuildAsynchronousFsdRequest.

IoBuildFsdForward

The IoBuildFsdForward rule specifies that a completion routine must be set before a driver calls IoCallDriver or PoCallDriver if the IRP is generated by a call to IoBuildAsynchronousFsdRequest.

IoBuildFsdFree

The IoBuildFsdFree rule specifies that a driver should use IoFreeIrp only on IRPs it previously allocated with IoBuildAsynchronousFsdRequest.

IoBuildFsdIrpSignalEventInCompletion

The IoBuildFsdIrpSignalEventInCompletion rule specifies that the driver should call KeSetEvent in the completion routine when the Irp->PendingReturned flag is set and the completion routine is processing a locally created asynchronous IRP.

IoBuildFsdIrpSignalEventInCompletion2

The IoBuildFsdIrpSignalEventInCompletion2 rule specifies that KeSetEvent needs to be called in the completion routine when the Irp->PendingReturned flag is set and the completion routine is processing a locally created asynchronous IRP.

IoBuildFsdIrpSignalEventInCompletion3

The IoBuildFsdIrpSignalEventInCompletion3 rule specifies that KeSetEvent needs to be called in the completion routine when the Irp->PendingReturned flag is set and the completion routine is processing a locally created asynchronous IRP.

IoBuildFsdIrpSignalEventInCompletionTimeout

The IoBuildFsdIrpSignalEventInCompletionTimeout rule reports a defect when the driver waits indefinitely until the lower driver returns, as the IRP’s event is required to be signaled in the completion routine.

IoBuildSynchronousFsdRequestNoFree

The IoBuildSynchronousFsdRequestNoFree rule specifies that a driver that calls IoBuildSynchronousFsdRequest must not call IoFreeIrp.

IoBuildSynchronousFsdRequestWait

The IoBuildSynchronousFsdRequestWait rule specifies that KeWaitForSingleObject should be called in the case that IoCallDriver or PoCallDriver returns STATUS_PENDING.

IoBuildSynchronousFsdRequestWaitTimeout

The IoBuildSynchronousFsdRequestWaitTimeout rule reports a defect if it detects that this driver will wait indefinitely until the lower driver returns, as the IRP’s event is required to be signaled in the completion routine.

RequestedPowerIrp

The RequestedPowerIrp rule specifies that driver calls PoRequestPowerIrp with the *Irp pointer variable set to NULL.

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

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

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