Share via


TdiCopyMdlToBuffer function

The TdiCopyMdlToBuffer function copies data from a set of buffers mapped by a given MDL chain into a caller-supplied destination buffer range.

Syntax

NTSTATUS TdiCopyMdlToBuffer(
  _In_  PMDL   SourceMdlChain,
  _In_  ULONG  SourceOffset,
  _Out_ PVOID  DestinationBuffer,
  _In_  ULONG  DestinationOffset,
  _In_  ULONG  DestinationBufferSize,
  _Out_ PULONG BytesCopied
);

Parameters

  • SourceMdlChain [in]
    Pointer to the initial MDL in a chain of MDLs mapping buffers containing the data to be copied.

  • SourceOffset [in]
    Specifies the byte offset within the mapped source buffers at which to begin the copy. Effectively, this is the number of mapped source bytes to skip before beginning the copy.

  • DestinationBuffer [out]
    Pointer to the caller-supplied destination buffer.

  • DestinationOffset [in]
    Specifies the byte offset within the destination buffer at which to begin copying the data from the source buffers.

  • DestinationBufferSize [in]
    Specifies the size in bytes of the buffer at DestinationBuffer.

  • BytesCopied [out]
    Pointer to a caller-supplied variable in which TdiCopyMdlToBuffer returns the number of bytes it copied.

Return value

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.

Remarks

TdiCopyMdlToBuffer always copies as much data as possible from the given mapped source buffers 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 must 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.

Note   The TDI feature is deprecated and will be removed in future versions of Microsoft Windows. Depending on how you use TDI, use either the Winsock Kernel (WSK) or Windows Filtering Platform (WFP). For more information about WFP and WSK, see Windows Filtering Platform and Winsock Kernel. For a Windows Core Networking blog entry about WSK and TDI, see Introduction to Winsock Kernel (WSK).

 

Requirements

Target platform

Universal

Header

Tdikrnl.h (include TdiKrnl.h)

Library

Tdi.lib

IRQL

See Remarks section.

See also

TdiCopyLookaheadData

TdiCopyBufferToMdl

 

 

Send comments about this topic to Microsoft