RequestProcessing rule set (KMDF)
Use these rules to verify that your driver correctly completes or cancels I/O request packets (IRP).
In this section
Topic | Description |
---|---|
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. |
|
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. |
|
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. |
|
The DoubleCompletionLocal rule specifies that drivers must not complete an I/O request twice. |
|
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. |
|
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. |
|
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. |
|
The FileObjectConfigured rule specifies that a call to the WdfRequestGetFileObject method is preceded by a call to WdfDeviceInitSetFileObjectConfig. |
|
The InternalIoctlReqs rule specifies that internal IOCTL requests are not passed to inappropriate KMDF request-send device driver interfaces (DDIs). |
|
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. |
|
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. |
|
The IoctlReqs rule specifies that IOCTL requests must not be passed to inappropriate KMDF request or send device driver interfaces (DDIs). |
|
The MarkCancOnCancReqLocal rule specifies that WdfRequestMarkCancelable method cannot be called two consecutive times on the same I/O request. |
|
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: |
|
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: |
|
The ReadReqs rule specifies that read requests are not passed to inappropriate KMDF methods. |
|
The ReqCompletionRoutine rule specifies that a completion routine must be set before a request is sent to an I/O target. |
|
The ReqDelete rule specifies that driver-created requests are not passed to WdfRequestCompleteXxx functions. Instead, the request should be deleted upon completion. |
|
The ReqIsCancOnCancReq rule specifies that the WdfRequestIsCanceled method can only be called on a request that is not marked as cancelable. |
|
The ReqMarkCancelableSend rule specifies that requests forwarded by the driver are not marked as cancelable by calling WdfRequestMarkCancelable. |
|
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. |
|
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. |
|
The RequestGetStatusValid rule that specifies that WdfRequestGetStatus should be called for a request in one of the following situations:
|
|
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. |
|
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. |
|
The StopAckWithinEvtIoStop rule specifies that the WdfRequestStopAcknowledge function is only called from within EvtIoStop callback function. |
|
The WdfIoQueueFindRequestFailed rule specifies that WdfIoQueueRetrieveFoundRequest or WdfObjectDereference should only be called after WdfIoQueueFindRequestFailed returns STATUS_SUCCESS. |
|
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. |
|
The WdfIoQueueRetrieveNextRequest rule specifies that WdfIoQueueRetrieveNextRequest is not called after WdfIoQueueFindRequest is called. |
|
The WriteReqs rule specifies that a write request is not passed to inappropriate KMDF methods. |
To select the RequestProcessing rule set
Select your driver project (.vcxProj) in Microsoft Visual Studio. From the Driver menu, click Launch Static Driver Verifier….
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).