WdfRequestRetrieveOutputWdmMdl function (wdfrequest.h)

[Applies to KMDF only]

The WdfRequestRetrieveOutputWdmMdl method retrieves a memory descriptor list (MDL) that represents an I/O request's output buffer.

Syntax

NTSTATUS WdfRequestRetrieveOutputWdmMdl(
  [in]  WDFREQUEST Request,
  [out] PMDL       *Mdl
);

Parameters

[in] Request

A handle to a framework request object.

[out] Mdl

A pointer to a location that receives a pointer to an MDL.

Return value

WdfRequestRetrieveOutputWdmMdl returns STATUS_SUCCESS if the operation succeeds. Otherwise, this method might return one of the following values:

Return code Description
STATUS_INVALID_PARAMETER
An input parameter is invalid.
STATUS_INVALID_DEVICE_REQUEST
The request type is not valid or the request is using neither buffered nor direct I/O. For more information about supported methods for accessing data buffers, see the following Remarks section.
STATUS_INTERNAL_ERROR
The request has already been completed.
STATUS_BUFFER_TOO_SMALL
The input buffer's length is zero.
STATUS_INSUFFICIENT_RESOURCES
There is insufficient memory.
 

This method might also return other NTSTATUS values.

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

Remarks

A request's output buffer receives information, such as data from a disk, that the driver provides to the originator of the request. Your driver can call WdfRequestRetrieveOutputWdmMdl for a read request or a device I/O control request, but not for a write request (because write requests do not provide output data).

The WdfRequestRetrieveOutputWdmMdl method retrieves the output buffer's MDL for I/O requests that use the buffered I/O method or the direct I/O method for accessing data buffers. If the request's I/O control code is IRP_MJ_INTERNAL_DEVICE_CONTROL, or if the request came from another kernel-mode driver, WdfRequestRetrieveOutputWdmMdl also supports I/O requests that use neither buffered nor direct I/O.

If WdfRequestRetrieveOutputWdmMdl returns STATUS_SUCCESS, the driver receives a pointer to an MDL that describes the output buffer.

The driver must not access a request's MDL after completing the I/O request.

For more information about WdfRequestRetrieveOutputWdmMdl, see Accessing Data Buffers in Framework-Based Drivers.

Examples

The following code example is part of an EvtIoRead callback function that obtains an MDL for an I/O request's input buffer. If the call to WdfRequestRetrieveOutputWdmMdl fails, the driver completes the request with the error status that WdfRequestRetrieveOutputWdmMdl returns.

VOID 
MyDrvEvtIoRead(
    IN WDFQUEUE  Queue,
    IN WDFREQUEST  Request,
    IN size_t  Length
    )
{
    NTSTATUS  status;
    PMDL  mdl = NULL;
...
    status = WdfRequestRetrieveOutputWdmMdl(
                                            Request,
                                            &mdl
                                            );
    if (!NT_SUCCESS(status))
    {
        WdfRequestCompleteWithInformation(
                                          Request,
                                          status,
                                          0
                                          );
    }
...
}

Requirements

Requirement Value
Target Platform Universal
Minimum KMDF version 1.0
Header wdfrequest.h (include Wdf.h)
Library Wdf01000.sys (see Framework Library Versioning.)
IRQL <=DISPATCH_LEVEL
DDI compliance rules DriverCreate(kmdf), InvalidReqAccess(kmdf), InvalidReqAccessLocal(kmdf), KmdfIrql(kmdf), KmdfIrql2(kmdf), KmdfIrqlExplicit(kmdf), MdlAfterReqCompletedIntIoctl(kmdf), MdlAfterReqCompletedIntIoctlA(kmdf), MdlAfterReqCompletedIoctl(kmdf), MdlAfterReqCompletedIoctlA(kmdf), MdlAfterReqCompletedRead(kmdf), MdlAfterReqCompletedReadA(kmdf), MdlAfterReqCompletedWrite(kmdf), OutputBufferAPI(kmdf)

See also

WdfRequestRetrieveInputWdmMdl