Поделиться через


NdisQueryBufferSafe (Compact 2013)

3/26/2014

This function is the safe version of NdisQueryBuffer. Unlike NdisQueryBuffer, this function does not cause a bug check if system resources are low or exhausted. Drivers should call this function instead of NdisQueryBuffer.

Syntax

VOID NdisQueryBufferSafe(
  PNDIS_BUFFER Buffer,
  PVOID* VirtualAddress OPTIONAL,
  PUINT Length,
  MM_PAGE_PRIORITY Priority
);

Parameters

  • Buffer
    [in] Points to the buffer descriptor.
  • VirtualAddress
    [out] Points to a caller-supplied variable in which this function returns the base virtual address of the range described, or set to NULL if:

    • System resources are low or exhausted and Prioritywas set toLowPagePriority or NormalPagePriority
    • System resources are exhausted and Prioritywas set toHighPagePriority
  • Length
    [out] Points to a caller-supplied variable in which this function returns the number of bytes in the virtual range.
  • Priority
    [in] Indicates the priority of the request as one of the following:

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

Return Value

Returns the base virtual address if successful.

Remarks

NdisQueryBufferSafe retrieves the size of the range, and optionally its base virtual address, from a buffer descriptor.

NDIS drivers use NdisQueryBufferSafe to retrieve information from the buffer descriptors chained to incoming packets for subsequent transfer operations.

If Priority was set to LowPagePriority or NormalPagePriority, NdisQueryBufferSafe returns NULL if system resources are low or exhausted. If Priority was set to HighPagePriority, NdisQueryBufferSafe returns NULL if system resources are exhausted.

The driver must release any spin lock it is holding before calling NdisQueryBufferSafe.

Drivers should call NdisQueryBufferSafe instead of NdisQueryBuffer. If system resources are low or exhausted, calling NdisQueryBuffer causes a bug check. NDIS 5.1 miniports must call NdisQueryBufferSafe instead of NdisQueryBuffer.

Requirements

Header

ndis.h

See Also

Reference

NDIS 5.x Legacy Functions
NdisGetFirstBufferFromPacketSafe
NdisMoveMemory
NdisQueryBuffer
NdisQueryBufferOffset
NdisQueryPacket
NdisRawReadPortBufferUchar
NdisRawReadPortBufferUlong
NdisRawReadPortBufferUshort
NdisRawWritePortBufferUchar
NdisRawWritePortBufferUlong
NdisRawWritePortBufferUshort
NdisReleaseSpinLock