NdisGetFirstBufferFromPacketSafe 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.

NdisGetFirstBufferFromPacketSafe returns pointers to the buffer descriptor and base virtual address for the first buffer chained to a given packet descriptor, along with the size of the first buffer and the total number of bytes mapped by all buffer descriptors chained to the packet descriptor.

Syntax

VOID NdisGetFirstBufferFromPacketSafe(
  _In_  PNDIS_PACKET     Packet,
  _Out_ PNDIS_BUFFER     *FirstBuffer,
  _Out_ PVOID            *FirstBufferVA,
  _Out_ PUINT            FirstBufferLength,
  _Out_ PUINT            TotalBufferLength,
  _In_  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 or NdisQueryBufferSafe.

System support for NdisGetFirstBufferFromPacketSafe is available in Windows XP and later versions.

Requirements

Target platform

Universal

Version

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

Header

Ndis.h (include Ndis.h)

Library

Ndis.lib

IRQL

<= DISPATCH_LEVEL

See also

MiniportSend

MiniportSendPackets

NdisGetFirstBufferFromPacket

NdisGetNextBuffer

NDIS_PACKET

NdisQueryBuffer

NdisQueryBufferSafe

NdisQueryPacket

ProtocolReceivePacket

 

 

Send comments about this topic to Microsoft