Share via


NdisIMGetCurrentPacketStack (Windows CE 5.0)

Send Feedback

This function returns a pointer to an NDIS_PACKET_STACK structure that is a descriptor for the current stack in a packet. This function also indicates whether one or more stack locations are available in the packet.

PNDIS_PACKET_STACK NdisIMGetCurrentPacketStack(PNDIS_PACKET Packet,BOOLEAN* StacksRemaining);

Parameters

  • Packet
    [in] Points to an NDIS_PACKET structure that is the descriptor for a packet.
  • StacksRemaining
    [out] Points 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 only if the value returned is TRUE.

Return Values

A pointer to this structure, which is a descriptor for the current stack in a packet.

Remarks

By default, each NDIS packet contains two NDIS_PACKET_STACK structures. 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. Typically, an intermediate driver 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 all stack locations for intermediate drivers are in use in the packet, NdisIMGetCurrentPacketStack returns NULL and, in StacksRemaining, FALSE.

If NdisIMGetCurrentPacketStack returns FALSE in StacksRemaining, the intermediate driver must allocate a packet pool and a packet descriptor and copy the original packet into the newly allocated packet before passing the packet to another driver. NdisIMGetCurrentPacketStack returns FALSE in StacksRemaining if the number of intermediate drivers that the packet traverses through exceeds the number of configured stacks. Note that the number of stacks in a packet cannot be dynamically altered.

Requirements

OS Versions: Windows CE .NET 4.0 and later.
Header: Ndis.h.
Link Library: Ndis.lib

See Also

NdisAllocatePacket | NdisAllocatePacketPool | NdisAllocatePacketPoolEx | NdisGetPoolFromPacket | NDIS_PACKET_STACK

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.