UnmapViewOfFile2 function (memoryapi.h)

Unmaps a previously mapped view of a file or a pagefile-backed section.

Syntax

BOOL UnmapViewOfFile2(
  [in] HANDLE Process,
  [in] PVOID  BaseAddress,
  [in] ULONG  UnmapFlags
);

Parameters

[in] Process

A HANDLE to the process from which the section will be unmapped.

[in] BaseAddress

The base address of a previously mapped view that is to be unmapped. This value must be identical to the value returned by a previous call to one of the functions in the MapViewOfFile family.

[in] UnmapFlags

This parameter can be zero (0) or one of the following values.

Value Meaning
MEM_UNMAP_WITH_TRANSIENT_BOOST
0x00000001
Specifies that the priority of the pages being unmapped should be temporarily boosted (with automatic short term decay) because the caller expects that these pages will be accessed again shortly from another thread. For more information about memory priorities, see the SetThreadInformation(ThreadMemoryPriority) function.
MEM_PRESERVE_PLACEHOLDER
0x00000002
Unmaps a mapped view back to a placeholder (after you've replaced a placeholder with a mapped view using MapViewOfFile3 or MapViewOfFile3FromApp).

Return value

Returns TRUE if successful. Otherwise, returns FALSE and extended error status is available using GetLastError.

Requirements

Requirement Value
Minimum supported client Windows 10, version 1703 [desktop apps only]
Minimum supported server Windows Server 2016 [desktop apps only]
Target Platform Windows
Header memoryapi.h (include Windows.h, Memoryapi.h)
Library WindowsApp.lib
DLL Kernelbase.dll

See also

MapViewOfFile2

UnmapViewOfFile

UnmapViewOfFileEx