RequestProcessing rule set (KMDF)

Use these rules to verify that your driver correctly completes or cancels I/O request packets (IRP).

In this section

TopicDescription

ChangeQueueState

The ChangeQueueState rule specifies that the WDF driver doesn't try to change the state of the Queue from concurrent threads or doesn’t call state changing DDIs one after another from within the same thread. Queue state changing callback functions are WdfIoQueueStop, WdfIoQueueStopSynchronously,WdfIoQueuePurge,WdfIoQueuePurgeSynchronously, WdfIoQueueDrain, WdfIoQueueDrainSynchronously, WdfIoQueueStopAndPurge and WdfIoQueueStopAndPurgeSynchronously. If these DDIs are called when a Queue state change is already in progress it will cause a computer to crash or to become unresponsive.

CompleteCanceledReq

The CompleteCanceledReq rule specifies that if the request has already been canceled, the request is no longer valid, and the driver should not complete it. While the driver unmarks a request that was previously marked cancelable, it must check that the request has not already been canceled. If the driver does not make this check, the driver might complete a request that has been freed.

DoubleCompletion

The DoubleCompletion rule specifies that drivers must not complete an I/O request twice. The following methods should not be called twice in a row for the same request: WdfRequestComplete, WdfRequestCompleteWithInformation, WdfRequestCompleteWithPriorityBoost.

DoubleCompletionLocal

The DoubleCompletionLocal rule specifies that drivers must not complete an I/O request twice.

EvtIoStopCancel

The EvtIoStopCancel rule specifies that within the EvtIoStop callback function, the driver calls one of following methods for I/O requests that are not cancelable.

EvtIoStopCompleteOrStopAck

The EvtIoStopCompleteOrStopAck rule specifies that within the EvtIoStop callback function the driver calls one of the following methods for each I/O request that is presented by the framework. If this is not done, the driver might block the system from entering another lower power state.

EvtSurpriseRemoveNoSuspendQueue

The EvtSurpriseRemoveNoSuspendQueue rule specifies that WDF Drivers shouldn’t drain, stop, or purge the queue from EvtDeviceSurpriseRemoval callback function, instead self-managed I/O callback functions should be used. The EvtDeviceSurpriseRemoval callback function isn’t synchronized with the power-down path.

FileObjectConfigured

The FileObjectConfigured rule specifies that a call to the WdfRequestGetFileObject method is preceded by a call to WdfDeviceInitSetFileObjectConfig.

InternalIoctlReqs

The InternalIoctlReqs rule specifies that internal IOCTL requests are not passed to inappropriate KMDF request-send device driver interfaces (DDIs).

InvalidReqAccess

The InvalidReqAccess rule specifies that requests are not accessed after they are completed or canceled. This rule might overlap with other rules, such as rules that check for double completion, or rules that check for requests have been marked cancelable two times.

InvalidReqAccessLocal

The InvalidReqAccessLocal rule specifies that locally created requests are not accessed after they are completed or canceled. This rule might overlap with other rules, such as rules that check for double completion, or rules that check for requests have been marked cancelable two times.

IoctlReqs

The IoctlReqs rule specifies that IOCTL requests must not be passed to inappropriate KMDF request or send device driver interfaces (DDIs).

MarkCancOnCancReqLocal

The MarkCancOnCancReqLocal rule specifies that WdfRequestMarkCancelable method cannot be called two consecutive times on the same I/O request.

NoIoQueuePurgeSynchronously

The NoIoQueuePurgeSynchronously rule verifies that WDF drivers don't call the WdfIoQueueStopSynchronously, WdfIoQueueDrainSynchronously, WdfIoQueueStopAndPurgeSynchronously, or WdfIoQueuePurgeSynchronously functions from the following EvtIO queue object event callback functions:

OutputBufferAPI

The OutputBufferAPI rule specifies that the correct DDIs for buffer retrieval are used in the EvtIoWrite callback function. Within the EvtIoWrite callback function, the following DDIs cannot be called for buffer retrieval:

ReadReqs

The ReadReqs rule specifies that read requests are not passed to inappropriate KMDF methods.

ReqCompletionRoutine

The ReqCompletionRoutine rule specifies that a completion routine must be set before a request is sent to an I/O target.

ReqDelete

The ReqDelete rule specifies that driver-created requests are not passed to WdfRequestCompleteXxx functions. Instead, the request should be deleted upon completion.

ReqIsCancOnCancReq

The ReqIsCancOnCancReq rule specifies that the WdfRequestIsCanceled method can only be called on a request that is not marked as cancelable.

ReqMarkCancelableSend

The ReqMarkCancelableSend rule specifies that requests forwarded by the driver are not marked as cancelable by calling WdfRequestMarkCancelable.

RequestCompleted

The DeferredRequestCompleted rule specifies that for a non-filter driver each request presented to the driver's default I/O queue must be completed, unless the request is deferred or forwarded, or if WdfRequestStopAcknowledge is called.

RequestFormattedValid

The RequestFormattedValid rule specifies that the driver formats all requests, except for a WDF_REQUEST_SEND_OPTION_SEND_AND_FORGET request, before it sends them to an I/O target.

RequestGetStatusValid

The RequestGetStatusValid rule that specifies that WdfRequestGetStatus should be called for a request in one of the following situations:

  • When WdfRequestSend returns failure.
  • When the request has been sent with WDF_REQUEST_SEND_OPTION_SYNCHRONOUS.

RequestSendAndForgetNoFormatting

The RequestSendAndForgetNoFormatting rule verifies that the driver doesn't format a request using the I/O target formatting functions before sending it to an I/O target with the send option WDF_REQUEST_SEND_OPTION_SEND_AND_FORGET.

RequestSendAndForgetNoFormatting2

The RequestSendAndForgetNoFormatting2 rule verifies that the driver doesn't format a request using the I/O target formatting functions before sending it to an I/O target with the send option WDF_REQUEST_SEND_OPTION_SEND_AND_FORGET.

StopAckWithinEvtIoStop

The StopAckWithinEvtIoStop rule specifies that the WdfRequestStopAcknowledge function is only called from within EvtIoStop callback function.

WdfIoQueueFindRequestFailed

The WdfIoQueueFindRequestFailed rule specifies that WdfIoQueueRetrieveFoundRequest or WdfObjectDereference should only be called after WdfIoQueueFindRequestFailed returns STATUS_SUCCESS.

WdfIoQueueRetrieveFoundRequest

The WdfIoQueueRetrieveFoundRequest rule specifies that WdfIoQueueRetrieveFoundRequest method is called only after WdfIoQueueFindRequest is called and returned STATUS_SUCCESS and no WdfObjectDereference is called on the same request.

WdfIoQueueRetrieveNextRequest

The WdfIoQueueRetrieveNextRequest rule specifies that WdfIoQueueRetrieveNextRequest is not called after WdfIoQueueFindRequest is called.

WriteReqs

The WriteReqs rule specifies that a write request is not passed to inappropriate KMDF methods.

 

JJ126218.wedge(en-us,VS.85).gifTo select the RequestProcessing 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 RequestProcessing.

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

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

 

 

Send comments about this topic to Microsoft

Show: