Bewerken

Delen via


NdisCopyFromPacketToPacketSafe function (ndis.h)

Note   NDIS 5. x has been deprecated and is superseded by NDIS 6. x. For new NDIS driver development, see Network Drivers Starting with Windows Vista. For information about porting NDIS 5. x drivers to NDIS 6. x, see Porting NDIS 5.x Drivers to NDIS 6.0.

NdisCopyFromPacketToPacket copies a specified range of data from one packet to another.

Syntax

void NdisCopyFromPacketToPacketSafe(
  [in]  IN PNDIS_PACKET     Destination,
  [in]  IN UINT             DestinationOffset,
  [in]  IN UINT             BytesToCopy,
  [in]  IN PNDIS_PACKET     Source,
  [in]  IN UINT             SourceOffset,
  [out] OUT PUINT           BytesCopied,
        IN MM_PAGE_PRIORITY Priority
);

Parameters

[in] Destination

Pointer to the destination packet descriptor.

[in] DestinationOffset

Specifies the byte offset within the destination packet at which to begin writing the copied data.

[in] BytesToCopy

Specifies the number of bytes to copy.

[in] Source

Pointer to the source packet descriptor.

[in] SourceOffset

Specifies the byte offset within the source packet at which to begin copying the data.

[out] BytesCopied

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 packet runs out of data or the destination packet runs out of space.

Priority

Return value

None

Remarks

Return value: None

Drivers should call NdisCopyFromPacketToPacketSafe instead of NdisCopyFromPacketToPacket. NDIS 5.1 miniport drivers must call NdisCopyFromPacketToPacketSafe instead of NdisCopyFromPacketToPacket. Unlike NdisCopyFromPacketToPacket, NdisCopyFromPacketToPacketSafe does not cause a bug check if system resources are low or exhausted.

The caller of NdisCopyFromPacketToPacket allocates the destination packet, if not the source packet as well. The packet descriptor of the destination packet should have enough chained buffer descriptors to receive the data.

If the source packet runs out of data or the destination packet out of space before the specified number of bytes has been copied, the copy operation stops. In either case, NdisCopyFromPacketToPacket returns the number of bytes successfully copied from the source to the destination packet.

NdisCopyFromPacketToPacket does not copy any out-of-band information associated with the given Source to the Destination. To copy this information, the driver can use pointers returned by NDIS_OOB_DATA_FROM_PACKET and then call NdisMoveMemory.

The driver must release any spin lock it is holding before calling NdisCopyFromPacketToPacket.

  • Target platform: Universal
  • Version: Not supported for NDIS 6.0 drivers in Windows Vista. Use NdisCopyFromNetBufferToNetBufferinstead. Supported for NDIS 5.1 drivers in Windows Vista and Windows XP, but use NdisCopyFromPacketToPacketSafe instead.

Requirements

Requirement Value
Header ndis.h (include Ndis.h)
Library Ndis.lib
IRQL IRQL <= DISPATCH_LEVEL

See also