Share via


NdisBufferVirtualAddressSafe

This function is the safe version of NdisBufferVirtualAddress. Unlike NdisBufferVirtualAddress, this function will not cause a bug check if system resources are low or exhausted. Drivers should call this function instead of NdisBufferVirtualAddress. NDIS 5.1 miniport drivers must call this function instead of NdisBufferVirtualAddress.

PVOID NdisBufferVirtualAddressSafe(
  PNDIS_BUFFER Buffer,
  MM_PAGE_PRIORITY Priority
);

Parameters

  • Buffer
    [in] Points to a buffer descriptor from which the base virtual address is to be returned.
  • Priority
    [in] Indicates the priority of the request as one of the following:
    • LowPagePriority

      Specifies a low priority. It is acceptable for NdisBufferVirtualAddressSafe to fail if system resources are low.

    • NormalPagePriority

      Specifies a normal priority. It is acceptable for NdisBufferVirtualAddressSafe to fail if system resources are low.

    • HighPagePriority

      Specifies a high priority. It is not acceptable for NdisBufferVirtualAddressSafe to fail unless system resources are exhausted.

Return Values

The following table shows the values returned from NdisBufferVirtualAddressSafe.

Value Description
NDISBUFFERVIRTUALADDRESSSAFE The base system-space virtual address that maps the physical pages described by the given buffer descriptor.
NULL The value returned if system resources are low (if Priority was set to LowPagePriority or NormalPagePriority) or exhausted (if Priority was set to HighPagePriority).

Remarks

NdisBufferVirtualAddressSafe returns the base virtual address for the buffer mapped by a given buffer descriptor. It maps the physical pages described by the given buffer descriptor onto system space if these pages are not already mapped to system space.

Drivers of PIO devices call this routine to translate a virtual address range, described by the buffer, for a user buffer to a system-space address range.

The returned base address has the same offset as the virtual address in the buffer.

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

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

Requirements

OS Versions: Windows CE .NET 4.0 and later.
Header: Ndis.h.

See Also

NdisAllocateBuffer | NdisAllocateBufferPool | NdisAllocateMemory | NdisBufferVirtualAddress | NdisFreeBuffer

 Last updated on Tuesday, May 18, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.