MapViewOfFile2 function (memoryapi.h)
Maps a view of a file or a pagefile-backed section into the address space of the specified process.
PVOID MapViewOfFile2( [in] HANDLE FileMappingHandle, [in] HANDLE ProcessHandle, [in] ULONG64 Offset, [in, optional] PVOID BaseAddress, [in] SIZE_T ViewSize, [in] ULONG AllocationType, [in] ULONG PageProtection );
A HANDLE to a section that is to be mapped into the address space of the specified process.
A HANDLE to a process into which the section will be mapped. The handle must have the PROCESS_VM_OPERATION access mask.
The offset from the beginning of the section. This must be 64k aligned.
[in, optional] BaseAddress
The desired base address of the view. The address is rounded down to the nearest 64k boundary. If this parameter is NULL, the system picks the base address.
The number of bytes to map. A value of zero (0) specifies that the entire section is to be mapped.
The type of allocation. This parameter can be zero (0) or one of the following constant values:
- MEM_RESERVE - Maps a reserved view.
- MEM_LARGE_PAGES - Maps a large page view. This flag specifies that the view should be mapped using large page support. The size of the view must be a multiple of the size of a large page reported by the GetLargePageMinimum function, and the file-mapping object must have been created using the SEC_LARGE_PAGES option. If you provide a non-null value for the BaseAddress parameter, then the value must be a multiple of GetLargePageMinimum.
The desired page protection.
For file-mapping objects created with the SEC_IMAGE attribute, the PageProtection parameter has no effect, and should be set to any valid value such as PAGE_READONLY.
Returns the base address of the mapped view, if successful. Otherwise, returns NULL and extended error status is available using GetLastError.
This function is implemented as an inline function in the header and can't be found in any export library or DLL. It's the same as calling MapViewOfFileNuma2 with the last parameter set to
|Minimum supported client||Windows 10, version 1703 [desktop apps only]|
|Minimum supported server||Windows Server 2016 [desktop apps only]|
|Header||memoryapi.h (include Windows.h, Memoryapi.h)|