Bewerken

Delen via


WdfRequestRetrieveInputWdmMdl function (wdfrequest.h)

[Applies to KMDF only]

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

Syntax

NTSTATUS WdfRequestRetrieveInputWdmMdl(
  [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

WdfRequestRetrieveInputWdmMdl 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 input buffer contains information, such as data to be written to a disk, that was supplied by the originator of the request. Your driver can call WdfRequestRetrieveInputWdmMdl for a write request or a device I/O control request, but not for a read request (because read requests do not provide input data).

The WdfRequestRetrieveInputWdmMdl method retrieves the input 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, WdfRequestRetrieveInputWdmMdl also supports I/O requests that use neither buffered nor direct I/O.

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

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

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

Examples

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

VOID 
MyDrvEvtIoWrite(
    IN WDFQUEUE  Queue,
    IN WDFREQUEST  Request,
    IN size_t  Length
    )
{
    NTSTATUS  status;
    PMDL  mdl = NULL;

...
    status = WdfRequestRetrieveInputWdmMdl(
                                           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), InputBufferAPI(kmdf), InvalidReqAccess(kmdf), InvalidReqAccessLocal(kmdf), KmdfIrql(kmdf), KmdfIrql2(kmdf), KmdfIrqlExplicit(kmdf), MdlAfterReqCompletedIntIoctl(kmdf), MdlAfterReqCompletedIntIoctlA(kmdf), MdlAfterReqCompletedIoctl(kmdf), MdlAfterReqCompletedIoctlA(kmdf), MdlAfterReqCompletedRead(kmdf), MdlAfterReqCompletedWrite(kmdf), MdlAfterReqCompletedWriteA(kmdf)

See also

WdfRequestRetrieveOutputWdmMdl