NdisQueryPacket function

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.

NdisQueryPacket returns information about a given packet.

Syntax

__inline VOID NdisQueryPacket(
  _In_      PNDIS_PACKET Packet,
  _Out_opt_ PUINT        PhysicalBufferCount,
  _Out_opt_ PUINT        BufferCount,
  _Out_opt_ PNDIS_BUFFER *FirstBuffer,
  _Out_opt_ PUINT        TotalPacketLength
);

Parameters

  • Packet [in]
    Pointer to a packet descriptor.

  • PhysicalBufferCount [out, optional]
    Pointer to a caller-supplied variable in which this function returns the maximum number of physical breaks mapped by the buffer descriptors chained to the given packet. This parameter can be NULL.

  • BufferCount [out, optional]
    Pointer to a caller-supplied variable in which this function returns the number of buffer descriptors chained to the given packet. This parameter can be NULL.

  • FirstBuffer [out, optional]
    Pointer to a caller-supplied variable in which this function returns a pointer to the initial buffer descriptor chained to the given packet. This parameter can be NULL.

  • TotalPacketLength [out, optional]
    Pointer to a caller-supplied variable in which this function returns the number of bytes of packet data mapped by all chained buffer descriptors. This parameter can be NULL.

Return value

None

Remarks

NdisQueryPacket returns caller-selected information about a given packet. The caller must specify at least one of the PhysicalBufferCount, BufferCount, FirstBuffer, and TotalPacketLength pointers, along with the Packet parameter. A caller can specify explicit pointers for all parameters.

Specifying an explicit PhysicalBufferCount pointer is equivalent to summing calls to NdisGetBufferPhysicalArraySize for each buffer descriptor in the packet descriptor. A driver can call NdisGetNextBuffer as many times as necessary to retrieve pointers to any subsequent buffer descriptors in the chain, unless the call returns zero indicating the packet descriptor has no data.

If the caller supplies an explicit BufferCount pointer, NdisQueryPacket returns the number of buffer descriptors in the packet chain. The returned value can be used as a loop counter to retrieve buffer descriptors in the chain with either of the NdisUnchainBufferXxx functions.

If the caller supplies an explicit FirstBuffer pointer but the packet's buffer chain is empty, NdisQueryPacket returns NULL at FirstBuffer. Otherwise, the caller can use NdisQueryBuffer or NdisQueryBufferSafe subsequently to get details about the initial buffer descriptor for the packet. As a faster alternative, drivers can call NdisGetFirstBufferFromPacket or NdisGetFirstBufferFromPacketSafe to get a pointer to the initial buffer descriptor.

If the caller supplies an explicit TotalPacketLength pointer, NdisQueryPacket returns the total number of bytes specified by every buffer descriptor chained to the given packet.

Requirements

Target platform

Desktop

Version

Not supported for NDIS 6.0 drivers in Windows Vista. Supported for NDIS 5.1 drivers in Windows Vista and Windows XP.

Header

Ndis.h (include Ndis.h)

IRQL

Any level

See also

MiniportSend

MiniportSendPackets

MiniportTransferData

MiniportWanSend

NdisGetBufferPhysicalArraySize

NdisGetFirstBufferFromPacket

NdisGetFirstBufferFromPacketSafe

NdisGetNextBuffer

NdisQueryBuffer

NdisQueryBufferSafe

NdisUnchainBufferAtBack

NdisUnchainBufferAtFront

ProtocolReceive

ProtocolReceivePacket

 

 

Send comments about this topic to Microsoft