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.
The NdisIMGetCurrentPacketStack function returns a pointer to an NDIS_PACKET_STACK structure that is a descriptor for the current stack in a packet. NdisIMGetCurrentPacketStack also indicates if any stack locations are available in the packet.
PNDIS_PACKET_STACK NdisIMGetCurrentPacketStack( _In_ PNDIS_PACKET Packet, _Out_ BOOLEAN *StacksRemaining );
Pointer to an NDIS_PACKET structure that is the descriptor for a packet.
Pointer to a caller-supplied variable in which NDIS returns TRUE to indicate that one or more stack locations are available in the packet or FALSE to indicate that the number of stack locations is zero or that the maximum number of stack locations has been exceeded. The intermediate driver can reuse this packet in a call to NdisSendPackets or NdisCoSendPackets only if the value returned is TRUE.
NdisIMGetCurrentPacketStack returns a pointer to an NDIS_PACKET_STACK structure that is a descriptor for the current stack in a packet.
If all stack locations for intermediate drivers are in use in the packet, NdisIMGetCurrentPacketStack returns NULL and, in StacksRemaining, FALSE.
After calling NdisIMGetCurrentPacketStack to obtain a pointer to an NDIS_PACKET_STACK structure, an intermediate driver can store or retrieve driver-defined information at the locations referenced by the pointers in the IMReserved array. This capability allows the intermediate driver to "reuse" a packet —that is, pass the packet to the adjacent driver without having to allocate an additional packet into which the intermediate driver copies the original packet. An intermediate driver typically calls NdisIMGetCurrentPacketStack in the context of its send and receive functions.
NDIS modifies the stack pointer as the packet traverses through each intermediate driver.
If NdisIMGetCurrentPacketStack returns FALSE in StacksRemaining, the intermediate driver must allocate a packet descriptor from a preallocated packet pool and copy the original packet into the newly allocated packet before passing the packet to another driver.
Note that the number of stack locations in a packet cannot be dynamically altered. The number of stack locations can be increased by incrementing the value at <number of stack locations> in the following registry entry:
HKLM\SYSTEM\CCS\ Services\NDIS\Parameters\PacketStackSize DWORD:<number of stack locations>
After the changing the registry, the system must be rebooted for the change to take effect. The default value for the number of stack locations is two. This default value provides each NDIS packet with one NDIS_PACKET_STACK structure that is available for intermediate drivers.
System support for NdisIMGetCurrentPacketStack is available in Windows XP and later versions.
For more information, see Intermediate Driver Packet Management (NDIS 5.1).
Not supported for NDIS 6.0 drivers in Windows Vista. Supported for NDIS 5.1 drivers in Windows Vista and Windows XP.
|Ndis.h (include Ndis.h)|