Partager via


NdisReinitializePacket (Compact 2013)

3/26/2014

This function removes any chained buffers from a given packet and reinitializes it for reuse.

Syntax

VOID NdisReinitializePacket(
  PNDIS_PACKET Packet
);

Parameters

  • Packet
    [in, out] Pointer to the packet descriptor allocated by the caller.

Return Value

None.

Remarks

This function reinitializes a packet descriptor so that the MiniportReserved and ProtocolReserved arrays contain all 0s and the head of the buffer chain is set to NULL.

A driver can call this function only with packet descriptors allocated by that driver. For example, a MiniportReturnPacket function is likely to call this function to prepare a driver-allocated packet for uses in a subsequent receive indication.

Before calling this function, a driver must call the NdisFreeBuffer or the NdisUnchainBufferAtXXX functions as many times as necessary to release or to save all buffer descriptors chained to the packet. Otherwise, a call to this function causes a memory leak: all memory associated with the buffer descriptor chain cannot be used by NDIS or by the driver until the system is rebooted.

A driver can call the NdisQueryPacket function to determine how many buffer descriptors are chained to a given packet and, therefore, how many calls to NdisFreeBuffer or NdisUnchainBufferAtXXX are required. It can call the NdisGetNextBuffer function to retrieve each buffer descriptor pointer to pass to NdisFreeBuffer.

A call to this function has no effect on the NDIS_PACKET_OOB_DATA structure associated with the packet descriptor. To prepare this block for reuse, the allocating driver can reset the relevant members with the appropriate NDIS_SET_PACKET_XXX macros.

Requirements

Header

ndis.h

See Also

Reference

NDIS 5.x Legacy Functions
MiniportReturnPacket
NDIS_PACKET_OOB_DATA
NDIS_SET_PACKET_MEDIA_SPECIFIC_INFO
NDIS_SET_PACKET_STATUS
NDIS_SET_PACKET_TIME_RECEIVED
NDIS_SET_PACKET_TIME_TO_SEND
NdisAllocatePacket
NdisFreeBuffer
NdisGetNextBuffer
NdisQueryPacket
NdisZeroMemory