VOID
NdisReinitializePacket(
IN OUT PNDIS_PACKET Packet
);
NdisReinitializePacket removes any chained buffers from a given packet and reinitializes it for reuse.
NdisReinitializePacket reinitialize a packet descriptor so the MiniportReserved and ProtocolReserved arrays contain all zeros and the head of the buffer chain is set to NULL.
A driver can call NdisReinitializePacket only with packet descriptors allocated by that driver. For example, a MiniportReturnPacket function is likely to call NdisReinitializePacket to prepare a driver-allocated packet for use in a subsequent receive indication.
Before calling NdisReinitializePacket, a driver must call NdisFreeBuffer or NdisUnchainBufferAtXxx as many times as necessary to release or to save all buffer descriptors chained to the packet. Otherwise, a call to NdisReinitializePacket causes a memory leak: all memory associated with the buffer descriptor chain cannot be used by NDIS nor by the driver until the system is rebooted.
A driver can call NdisQueryPacket 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 NdisGetNextBuffer to retrieve each buffer descriptor pointer to pass to NdisFreeBuffer.
A call to NdisReinitializePacket has no effect on the NDIS_PACKET_OOB_DATA block associated with the packet descriptor. To prepare this block for reuse, the allocating driver can either call NdisZeroMemory with the pointer returned by NDIS_OOB_DATA_FROM_PACKET or it can reset the relevant members with the appropriate NDIS_SET_PACKET_XXX macro(s).
Callers of NdisReinitializePacket can run at any IRQL.
MiniportReturnPacket, NdisAllocatePacket, NdisDprAllocatePacket, NdisFreeBuffer, NdisGetNextBuffer, NDIS_OOB_DATA_FROM_PACKET, NDIS_PACKET, NDIS_PACKET_OOB_DATA, NdisQueryPacket, NDIS_SET_PACKET_HEADER_SIZE, NDIS_SET_PACKET_MEDIA_SPECIFIC_INFO, NDIS_SET_PACKET_STATUS, NDIS_SET_PACKET_TIME_RECEIVED, NDIS_SET_PACKET_TIME_TO_SEND, NdisUnchainBufferAtBack, NdisUnchainBufferAtFront, NdisZeroMemory