ExAllocateFromNPagedLookasideList function (wdm.h)

The ExAllocateFromNPagedLookasideList routine returns a pointer to a nonpaged entry from the given lookaside list, or it returns a pointer to a newly allocated nonpaged entry.

Syntax

PVOID ExAllocateFromNPagedLookasideList(
  [in, out] PNPAGED_LOOKASIDE_LIST Lookaside
);

Parameters

[in, out] Lookaside

A pointer to the NPAGED_LOOKASIDE_LIST structure for the lookaside list, which the caller already initialized with ExInitializeNPagedLookasideList.

Return value

ExAllocateFromNPagedLookasideList returns a pointer to an entry if one can be allocated. Otherwise, it returns NULL.

Remarks

Caution

Starting in Windows 11, version 22H2, this function changed from inline to exported. As a result, if you build your driver targeting the latest version of Windows, it will fail to load in older OS versions. To change the target OS version in Visual Studio, select Configuration Properties->Driver Settings->General.

If the given lookaside list is not empty, ExAllocateFromNPagedLookasideList removes the first entry from the list and returns a pointer to this entry. Otherwise, ExAllocateFromNPagedLookasideList either calls the Allocate routine specified at list initialization or ExAllocatePoolWithTag to return an entry pointer.

The caller can then set up the returned entry with any caller-determined data. For example, a driver might use each such fixed-size entry to set up command blocks, like SCSI SRBs, to peripheral devices on a particular type of I/O bus. The caller should release each entry with ExFreeToNPagedLookasideList when it is no longer in use.

For more information, see Using Lookaside Lists.

Requirements

Requirement Value
Minimum supported client Available starting with Windows 2000.
Target Platform Desktop
Header wdm.h (include Wdm.h, Ntddk.h, Ntifs.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL <= DISPATCH_LEVEL

See also

ExAllocateFromPagedLookasideList

ExFreeToNPagedLookasideList

ExInitializeNPagedLookasideList

NPAGED_LOOKASIDE_LIST