TdiCopyBufferToMdl function

The TdiCopyBufferToMdl function copies data from a buffer range into a set of one or more destination buffers mapped by a given MDL chain.

Syntax

NTSTATUS TdiCopyBufferToMdl(
  _In_  PVOID  SourceBuffer,
  _In_  ULONG  SourceOffset,
  _In_  ULONG  SourceBytesToCopy,
  _In_  PMDL   DestinationMdlChain,
  _In_  ULONG  DestinationOffset,
  _Out_ PULONG BytesCopied
);

Parameters

  • SourceBuffer [in]
    Specifies the base virtual address of the source buffer containing the data to be copied.

  • SourceOffset [in]
    Specifies the byte offset within the source buffer at which to begin the copy.

  • SourceBytesToCopy [in]
    Specifies the number of bytes to copy from SourceBuffer to the buffer mapped by the given MDL.

  • DestinationMdlChain [in]
    Pointer to the initial MDL in a chain of linked MDLs mapping the destination buffers into which to copy the data.

  • DestinationOffset [in]
    Specifies the byte offset within the destination buffers at which to begin the copy. Effectively, this is the number of bytes mapped by the given MDLs to skip before beginning the copy operation.

  • BytesCopied [out]
    Pointer to a caller-supplied variable in which TdiCopyBufferToMdl returns the number of bytes copied from the source to the destination buffer.

Return value

TdiCopyBufferToMdl returns STATUS_SUCCESS if it copied SourceBytesToCopy into the mapped destination buffers. Otherwise, it returns STATUS_BUFFER_OVERFLOW if SourceBytesToCopy was too large to fit into the destination buffer space available from the given DestinationOffset.

Remarks

TdiCopyBufferToMdl always copies as much data as possible from the source buffer to the destination buffers, 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 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

TdiCopyMdlToBuffer

 

 

Send comments about this topic to Microsoft