ExFreeToPagedLookasideList function (wdm.h)

The ExFreeToPagedLookasideList routine returns a pageable entry to the given lookaside list or to paged pool.

Syntax

void ExFreeToPagedLookasideList(
  [in, out] PPAGED_LOOKASIDE_LIST Lookaside,
  [in]      PVOID                 Entry
);

Parameters

[in, out] Lookaside

A pointer to the PAGED_LOOKASIDE_LIST structure for the lookaside list, which the caller already initialized with ExInitializePagedLookasideList, which the caller already initialized with ExInitializePagedLookasideList.

[in] Entry

A pointer to the entry to be freed. The caller obtained this pointer from a preceding call to ExAllocateFromPagedLookasideList.

Return value

None

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.

ExFreeToPagedLookasideList is the reciprocal of ExAllocateFromPagedLookasideList. It releases a caller-allocated entry back to the caller's lookaside list or to paged pool when that entry is no longer in use.

The same entry can be reallocated or another entry can be allocated later with a subsequent call to ExAllocateFromPagedLookasideList. The user of a lookaside list can allocate and free such entries dynamically, as needed, until it calls ExDeletePagedLookasideList. ExDeletePagedLookasideList releases any outstanding entries in the list before it clears the system state for the given lookaside list and returns control.

If the specified lookaside list has not yet reached the system-determined maximum number of entries, ExFreeToPagedLookasideList inserts the given entry at the front of the list. Otherwise, the buffer at Entry is released back to paged pool using the caller-supplied Free routine, if any, that was set up when the lookaside list was initialized or ExFreePool.

On Windows 2000, drivers must use the -D_WIN2K_COMPAT_SLIST_USAGE switch to successfully link code that uses ExFreeToPagedLookasideList.

For more information, see Using Lookaside Lists.

Requirements

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

See also

ExAllocateFromPagedLookasideList

ExDeletePagedLookasideList

ExInitializePagedLookasideList

PAGED_LOOKASIDE_LIST