Edit

Revise Code That Issues I/O Requests

WDF defines several methods that a driver can use to create and format I/O requests. The following table summarizes these methods:

KMDF method Action

WdfIoTargetFormatRequestForIoctl

WdfIoTargetFormatRequestForInternalIoctl

WdfIoTargetFormatRequestForInternalIoctlOthers

Similar to manually formatting the next I/O stack location.

WdfIoTargetFormatRequestForRead

WdfIoTargetFormatRequestForWrite

Similar to IoBuildAsynchronousFsdRequest.

WdfIoTargetSendIoctlSynchronously

WdfIoTargetSendInternalIoctlSynchronously

WdfIoTargetSendInternalIoctlOthersSynchronously

Similar to IoBuildDeviceIoControlRequest, followed by IoCallDriver.

WdfIoTargetSendReadSynchronously

WdfIoTargetSendWriteSynchronously

Similar to IoBuildSynchronousFsdRequest, followed by IoCallDriver.

WdfRequestCancelSentRequest

Similar to IoCancelIrp for a PIRP that was sent with IoCallDriver. The framework provides locks to ensure that the PIRP is not completed or freed between the calls to IoCallDriver and IoCancelIrp.
WdfRequestCreate Similar to IoAllocateIrp. Creates a new WDFREQUEST object, sets attributes, and returns handle to caller.
WdfRequestFormatRequestUsingCurrentType Similar to IoForwardIrpSynchronously but does not call IoCallDriver; driver must call WdfRequestSend.
WdfRequestSend Similar to IoForwardIrpSynchronously but does not call IoCallDriver; driver must call WdfRequestSend.

To send a request to another device stack, a WDF driver uses a remote I/O target. For information about how to initialize a remote I/O target, see Initializing a General I/O Target.

To get the completion status for an asynchronous request or for any request that is sent by calling WdfRequestSend, the driver calls WdfRequestGetStatus. For a synchronous request, it can retrieve status immediately. For an asynchronous request, the driver’s I/O completion callback typically retrieves status. For more information about sending requests synchronously or asynchronously, see Sending I/O Requests to General I/O Targets.