NTSTATUS
TdiCopyMdlToBuffer (
IN PMDL SourceMdlChain,
IN ULONG SourceOffset,
IN PVOID DestinationBuffer,
IN ULONG DestinationOffset,
IN ULONG DestinationBufferSize,
OUT PULONG BytesCopied
);
TdiCopyMdlToBuffer copies data from a set of buffer(s) mapped by a given MDL chain into a caller-supplied destination buffer range.
TdiCopyMdlToBuffer returns STATUS_SUCCESS if it copied (DestinationBufferSize - DestinationOffset) bytes into the destination buffer. Otherwise, it returns STATUS_BUFFER_OVERFLOW if the given SourceMdlChain, starting at SourceOffset, maps more data than the range (DestinationBufferSize - DestinationOffset) can contain.
TdiCopyMdlToBuffer always copies as much data as possible from the given mapped source buffer(s) into the given destination buffer range, even if it returns STATUS_BUFFER_OVERFLOW.
At most, the return value of BytesCopied can be the given DestinationBufferSize if DestinationOffset is zero.
Both transports and their kernel-mode clients can call TdiCopyMdlToBuffer.
Callers of TdiCopyMdlToBuffer can be running at IRQL <= DISPATCH_LEVEL if the source and destination buffers are resident. If either is pageable, the caller must be running at IRQL < DISPATCH_LEVEL.