MapViewOfFileFromApp function
Maps a view of a file mapping into the address space of a calling Windows Store app.
Syntax
PVOID WINAPI MapViewOfFileFromApp( _In_ HANDLE hFileMappingObject, _In_ ULONG DesiredAccess, _In_ ULONG64 FileOffset, _In_ SIZE_T NumberOfBytesToMap );
Parameters
- hFileMappingObject [in]
-
A handle to a file mapping object. The CreateFileMappingFromApp function returns this handle.
- DesiredAccess [in]
-
The type of access to a file mapping object, which determines the protection of the pages. This parameter can be one of the following values.
For more information about access to file mapping objects, see File Mapping Security and Access Rights.
- FileOffset [in]
-
The file offset where the view is to begin. The offset must specify an offset within the file mapping. They must also match the memory allocation granularity of the system. That is, the offset must be a multiple of the allocation granularity. To obtain the memory allocation granularity of the system, use the GetSystemInfo function, which fills in the members of a SYSTEM_INFO structure.
- NumberOfBytesToMap [in]
-
The number of bytes of a file mapping to map to the view. All bytes must be within the maximum size specified by CreateFileMappingFromApp. If this parameter is 0 (zero), the mapping extends from the specified offset to the end of the file mapping.
Return value
If the function succeeds, the return value is the starting address of the mapped view.
If the function fails, the return value is NULL. To get extended error information, call GetLastError.
Remarks
With one important exception, file views derived from any file mapping object that is backed by the same file are coherent or identical at a specific time. Coherency is guaranteed for views within a process and for views that are mapped by different processes.
The exception is related to remote files. Although MapViewOfFileFromApp works with remote files, it does not keep them coherent. For example, if two computers both map a file as writable, and both change the same page, each computer only sees its own writes to the page. When the data gets updated on the disk, it is not merged.
Requirements
|
Minimum supported client |
Windows 8 [desktop apps | Windows Store apps] |
|---|---|
|
Minimum supported server |
Windows Server 2012 [desktop apps | Windows Store apps] |
|
Minimum supported phone |
Windows Phone 8 |
|
Header |
|
|
Library |
|
|
DLL |
|
See also
- Memory Management Functions
- MapViewOfFile
- CreateFileMapping
- Creating a File View
- DuplicateHandle
- GetSystemInfo
- MapViewOfFileEx
- OpenFileMapping
- SYSTEM_INFO
- UnmapViewOfFile