Partager via


NdisGetFirstBufferFromPacketSafe (Compact 2013)

3/26/2014

NdisGetFirstBufferFromPacketSafe returns pointers to the buffer descriptor and base virtual address for the first buffer chained to a given packet descriptor, along with the sizes of the first buffer and the total buffer.

Syntax

VOID  NdisGetFirstBufferFromPacketSafe(
  PNDIS_PACKET Packet,
  PNDIS_BUFFER* FirstBuffer,
  PVOID* FirstBufferVA,
  PUINT FirstBufferLength,
  PUINT TotalBufferLength,
  MM_PAGE_PRIORITY Priority
);

Parameters

  • Packet
    [in] Pointer to the packet descriptor from which this macro extracts information about the initial buffer.
  • FirstBuffer
    [out] Pointer to a caller-supplied variable in which this macro returns the address of the initial buffer descriptor chained to the given packet descriptor.
  • FirstBufferVA
    [out] Pointer to a caller-supplied variable in which this macro returns the base virtual address of the initial buffer associated with the packet. If NdisGetFirstBufferFromPacketSafe fails, it sets FirstBufferVA to NULL.
  • FirstBufferLength
    [out] Pointer to a caller-supplied variable in which this macro returns the number of bytes mapped by the initial buffer descriptor chained to the packet descriptor.
  • TotalBufferLength
    [out] Pointer to a caller-supplied variable in which this macro returns the total number of bytes mapped by all buffer descriptors chained to the packet descriptor.
  • Priority
    [in] Indicates the priority of the request as one of the following:

    • LowPagePriority
      Specifies a low priority. It is acceptable for NdisGetFirstBufferFromPacketSafe to fail if system resources are low.
    • NormalPagePriority
      Specifies a normal priority. It is acceptable for NdisGetFirstBufferFromPacketSafe to fail if system resources are low.
    • HighPagePriority
      Specifies a high priority. It is unacceptable for NdisGetFirstBufferFromPacketSafe to fail unless system resources are exhausted.

Return Value

None.

Remarks

NdisGetFirstBufferFromPacketSafe is the safe version of NdisGetFirstBufferFromPacket. Unlike NdisGetFirstBufferFromPacket, NdisGetFirstBufferFromPacketSafe does not cause a bug check if system resources are low or exhausted. Drivers should call NdisGetFirstBufferFromPacketSafe instead of NdisGetFirstBufferFromPacket. NDIS 5.1 drivers must call NdisGetFirstBufferFromPacketSafe instead of NdisGetFirstBufferFromPacket.

Drivers call NdisGetFirstBufferFromPacketSafe to get information about the initial buffer and amount of data associated with a given packet faster than they can by making calls to NdisQueryPacket and, then, NdisQueryBuffer(Safe).

Requirements

Header

ndis.h

Library

ndis.lib

See Also

Reference

NDIS 5.x Legacy Functions
MiniportSend
MiniportSendPackets
NdisGetFirstBufferFromPacket
NdisGetNextBuffer
NDIS_PACKET
NdisQueryBuffer
NdisQueryBufferSafe
NdisQueryPacket
ProtocolReceivePacket