Previous Next

IoBuildPartialMdl

The IoBuildPartialMdl routine maps a portion of a buffer described by another MDL into an MDL.

VOID 
  IoBuildPartialMdl(
    IN PMDL  SourceMdl,
    IN OUT PMDL  TargetMdl,
    IN PVOID  VirtualAddress,
    IN ULONG  Length
    );

Parameters

SourceMdl
Pointer to an MDL describing the original buffer, of which a subrange is to be mapped.
TargetMdl
Pointer to a caller-allocated MDL. The MDL must be large enough to map the subrange specified by VirtualAddress and Length.
VirtualAddress
Pointer to the base virtual address for the subrange to be mapped in the TargetMdl.
Length
Specifies the length in bytes to be mapped by the TargetMdl. This value, in combination with VirtualAddress, must specify a buffer that is a proper subrange of the buffer described by SourceMdl. If Length is zero, the subrange to be mapped starts at VirtualAddress and includes the remaining range described by the SourceMdl.

Return Value

None

Headers

Declared in wdm.h and ntddk.h. Include wdm.h or ntddk.h.

Comments

IoBuildPartialMdl maps a subrange of a buffer currently mapped by SourceMdl. The VirtualAddress and Length parameters describe the subrange to be mapped from the SourceMdl into the TargetMdl.

Drivers that must split large transfer requests can use this routine. The caller must release the partial MDL it allocated when it has transferred all the requested data or completed the IRP with an error status.

Callers of IoBuildPartialMdl can be running at IRQL <= DISPATCH_LEVEL.

See Also

IoAllocateMdl, IoCallDriver, IoFreeMdl, IoSetCompletionRoutine