Share via


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

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.

Syntax

PVOID NdisBufferVirtualAddressSafe(
  _In_ PNDIS_BUFFER     Buffer,
  _In_ MM_PAGE_PRIORITY Priority
);

Parameters

  • Buffer [in]
    Pointer 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

NdisBufferVirtualAddressSafe returns either the base system-space virtual address that maps the physical pages described by the given buffer descriptor, or NULL if system resources are low (if Priority was set to LowPagePriority or NormalPagePriority) or exhausted (if Priority was set to HighPagePriority).

Remarks

NdisBufferVirtualAddressSafe is the safe version of NdisBufferVirtualAddress. If system resources are low or exhausted, calling NdisBufferVirtualAddress causes a bug check. Drivers should therefore call NdisBufferVirtualAddressSafe instead of NdisBufferVirtualAddress. NDIS 5.1 miniport drivers must call NdisBufferVirtualAddressSafe instead of NdisBufferVirtualAddress.

Drivers of PIO devices call NdisBufferVirtualAddressSafe 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.

Callers of NdisBufferVirtualAddressSafe can be running at IRQL <= DISPATCH_LEVEL. However, a caller running at IRQL = DISPATCH_LEVEL must supply a buffer descriptor that maps nonpaged system-space addresses. The buffer itself must have been allocated from nonpaged pool, contiguous memory, or noncached memory.

Requirements

Target platform

Desktop

Version

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

Header

Ndis.h (include Ndis.h)

IRQL

<= DISPATCH_LEVEL (See Remarks section)

See also

NdisAllocateBuffer

NdisAllocateBufferPool

NdisAllocateMemoryWithTag

NdisBufferVirtualAddress

NdisFreeBuffer

 

 

Send comments about this topic to Microsoft