Condividi tramite


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

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

Syntax

VOID NdisQueryBufferSafe(
  _In_      PNDIS_BUFFER     Buffer,
  _Out_opt_ PVOID            *VirtualAddress,
  _Out_     PUINT            Length,
  _In_      MM_PAGE_PRIORITY Priority
);

Parameters

  • Buffer [in]
    Pointer to the buffer descriptor.

  • VirtualAddress [out, optional]
    Pointer 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 Priority was set to LowPagePriority or NormalPagePriority.

    • System resources are exhausted and Priority was set to HighPagePriority.

  • Length [out]
    Pointer 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

None

Remarks

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

NDIS drivers call 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.

Requirements

Target platform

Universal

Version

Not supported for NDIS 6.0 drivers in Windows Vista. Use NdisQueryMdlinstead. 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

MiniportHandleInterrupt

MiniportInitialize

MiniportSend

MiniportSendPackets

MiniportTimer

MiniportTransferData

MiniportWanSend

NdisAllocateBuffer

NdisMAllocateMapRegisters

NdisGetFirstBufferFromPacket

NdisGetFirstBufferFromPacketSafe

NdisMoveFromMappedMemory

NdisMoveMemory

NdisMoveToMappedMemory

NdisQueryBuffer

NdisQueryBufferOffset

NdisQueryPacket

NdisRawReadPortBufferUchar

NdisRawReadPortBufferUlong

NdisRawReadPortBufferUshort

NdisRawWritePortBufferUchar

NdisRawWritePortBufferUlong

NdisRawWritePortBufferUshort

NdisReleaseSpinLock

NdisUnchainBufferAtBack

NdisUnchainBufferAtFront

ProtocolReceive

ProtocolReceivePacket

 

 

Send comments about this topic to Microsoft