Call the NdisCopyFromNetBufferToNetBuffer function to copy data from a source NET_BUFFER structure to a destination NET_BUFFER structure.
NDIS_STATUS NdisCopyFromNetBufferToNetBuffer( PNET_BUFFER Destination, ULONG DestinationOffset, ULONG BytesToCopy, PNET_BUFFER Source, ULONG SourceOffset, PULONG BytesCopied );
A pointer to a previously allocated destination NET_BUFFER structure.
The byte offset within the destination NET_BUFFER structure at which to begin writing the copied data. For more information about DestinationOffset, see the following Remarks section.
The number of bytes to copy.
A pointer to a previously allocated source NET_BUFFER structure.
The byte offset within the source NET_BUFFER structure at which to begin copying the data. For more information about SourceOffset, see the following Remarks section.
A pointer to the caller-supplied variable in which this function returns the number of bytes actually copied. This number can be less than the value of BytesToCopy if the source runs out of data or the destination runs out of space.
NdisCopyFromNetBufferToNetBuffer returns one of the following status values:
||The copy operation completed successfully.|
||The copy operation failed because of insufficient resources.|
The caller of NdisCopyFromNetBufferToNetBuffer allocates the destination NET_BUFFER structure and possibly the source NET_BUFFER structure as well. The MDLs of the destination NET_BUFFER structure should have enough space to receive the data.
If the source NET_BUFFER structure runs out of data or the destination NET_BUFFER structure runs out of space before the specified number of bytes has been copied, the copy operation stops. In either case, NdisCopyFromNetBufferToNetBuffer returns the number of bytes successfully copied from the source to the destination NET_BUFFER structure.
The caller must ensure that CurrentMdlOffset and CurrentMdl values are correct in the source and destination NET_BUFFER structures. NDIS does not change the members in the destination NET_BUFFER. The caller must update the DataLength, DataOffset, and CurrentMdlOffset values in the destination NET_BUFFER after NdisCopyFromNetBufferToNetBuffer returns.
NDIS uses the offsets in the DestionationOffset and SourceOffset parameters of NdisCopyFromNetBufferToNetBuffer as offsets from the current data offset. For example, if the CurrentMdlOffset value in the destination NET_BUFFER is x, and DestinationOffset value is y, NDIS copies the data to the destination NET_BUFFER at an x+ y offset in the memory that the CurrentMdl value describes. Similar rules apply to the CurrentMdlOffset in the source NET_BUFFER and the SourceOffset value.
|Minimum supported client||Supported in NDIS 6.0 and later.|
|Header||ndis.h (include Ndis.h)|
|DDI compliance rules||Irql_NetBuffer_Function|