WdfRequestRetrieveOutputWdmMdl method
[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
- Request [in]
- 
A handle to a framework request object. 
- Mdl [out]
- 
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 | 
|---|---|
| 
 | An input parameter is invalid. | 
| 
 | 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. | 
| 
 | The request has already been completed. | 
| 
 | The input buffer's length is zero. | 
| 
 | 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
| Minimum KMDF version | 1.0 | 
|---|---|
| Header | 
 | 
| Library | 
 | 
| IRQL | <=DISPATCH_LEVEL | 
| DDI compliance rules | DriverCreate, InvalidReqAccess, InvalidReqAccessLocal, KmdfIrql, KmdfIrql2, MdlAfterReqCompletedIntIoctl, MdlAfterReqCompletedIntIoctlA, MdlAfterReqCompletedIoctl, MdlAfterReqCompletedIoctlA, MdlAfterReqCompletedRead, MdlAfterReqCompletedReadA, MdlAfterReqCompletedWrite, OutputBufferAPI | 
See also

