Partager via


NdisBufferVirtualAddressSafe (Windows Embedded CE 6.0)

1/6/2010

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.

Syntax

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 Value

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

Header ndis.h
Library ndis.lib
Windows Embedded CE Windows CE .NET 4.0 and later

See Also

Reference

NDIS Library Functions
NdisAllocateBuffer
NdisAllocateBufferPool
NdisAllocateMemory
NdisBufferVirtualAddress
NdisFreeBuffer