NTSTATUS
TdiCopyBufferToMdl (
IN PVOID SourceBuffer,
IN ULONG SourceOffset,
IN ULONG SourceBytesToCopy,
IN PMDL DestinationMdlChain,
IN ULONG DestinationOffset,
IN PULONG BytesCopied
);
TdiCopyBufferToMdl copies data from a buffer range into a set of one or more destination buffers mapped by a given MDL chain.
TdiCopyBufferToMdl returns STATUS_SUCCESS if it copied SourceBytesToCopy into the mapped destination buffer(s). Otherwise, it returns STATUS_BUFFER_OVERFLOW if SourceBytesToCopy was too large to fit into the destination buffer space available from the given DestinationOffset.
TdiCopyBufferToMdl always copies as much data as possible from the source buffer to the destination buffer(s), even if it returns STATUS_BUFFER_OVERFLOW. At most, the return value of BytesCopied is equal to the given SourceBytesToCopy.
Both transports and their kernel-mode clients can call TdiCopyBufferToMdl.
Callers of TdiCopyBufferToMdl 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.