WdfDmaTransactionInitializeUsingRequest function

[Applies to KMDF only]

The WdfDmaTransactionInitializeUsingRequest method initializes a specified DMA transaction by using the parameters of a specified I/O request.


NTSTATUS WdfDmaTransactionInitializeUsingRequest(
  WDFREQUEST          Request,
  PFN_WDF_PROGRAM_DMA EvtProgramDmaFunction,
  WDF_DMA_DIRECTION   DmaDirection



A handle to a DMA transaction object that the driver obtained from a previous call to WdfDmaTransactionCreate.


A handle to a framework request object.


A pointer to the driver's EvtProgramDma event callback function.


A WDF_DMA_DIRECTION-typed value that specifies the direction of the DMA transfer.

Return Value

WdfDmaTransactionInitializeUsingRequest returns STATUS_SUCCESS if the operation succeeds. Otherwise, the method might return one of the values described in the Return values section of WdfDmaTransactionInitialize.

This method also might return other NTSTATUS values.

A bug check occurs if the driver supplies an invalid object handle.


The WdfDmaTransactionInitializeUsingRequest method prepares a DMA operation for execution, by performing initialization operations such as setting up a transaction's scatter/gather list. After your driver calls WdfDmaTransactionInitializeUsingRequest, the driver must call WdfDmaTransactionExecute.

The driver can call WdfRequestGetParameters to obtain a request's type. The value that the driver specifies for the DmaDirection parameter must be appropriate for the request type, as follows:

  • The DmaDirection value must be WdfDmaDirectionReadFromDevice if:
    • The request type is WdfRequestTypeRead
    • The request type is WdfRequestTypeDeviceControl or WdfRequestTypeDeviceControlInternal and the I/O control code specifies a transfer type of METHOD_OUT_DIRECT
  • The DmaDirection value must be WdfDmaDirectionWriteToDevice if:
    • The request type is WdfRequestTypeWrite
    • The request type is WdfRequestTypeDeviceControl or WdfRequestTypeDeviceControlInternal and the I/O control code specifies a transfer type of METHOD_IN_DIRECT
For more information about transfer types for I/O control codes, see Defining I/O Control Codes.

Framework-based drivers typically call WdfDmaTransactionInitializeUsingRequest from within an I/O queue event callback function.

Your driver should call WdfDmaTransactionInitializeUsingRequest if you are creating a DMA transaction that is based on information that a framework request object contains. Use WdfDmaTransactionInitialize if you are creating a DMA transaction that is not based on a request object.

If the buffer that the request object describes is larger than the maximum transfer length that your driver specified when it called WdfDmaEnablerCreate or WdfDmaTransactionSetMaximumLength, the framework breaks the transaction into multiple transfers.

For more information about DMA transactions, see Creating and Initializing a DMA Transaction.


For a code example that uses WdfDmaTransactionInitializeUsingRequest, see WdfDmaTransactionExecute.


Target Platform Universal
Minimum KMDF version 1.0
Header wdfdmatransaction.h (include Wdf.h)
Library Wdf01000.sys (see Framework Library Versioning.)
DDI compliance rules DeferredRequestCompleted, DriverCreate, KmdfIrql, KmdfIrql2, RequestCompleted, RequestCompletedLocal

See Also