Gets the memory region of the mapped file, and the type of mapping.
HRESULT GetFileMapping ( [out] const void **ppvData, [out] ULONGLONG *pcbData, [out] DWORD *pdwMappingType );
[out] A pointer to the start of the mapped file.
[out] The size of the mapped region. If
fmFlat, this is the size of the file.
[out] A CorFileMapping value that indicates the type of mapping. The current implementation of the common language runtime (CLR) always returns
fmFlat. Other values are reserved for future use. However, you should always verify the returned value, because other values may be enabled in future versions or service releases.
||All outputs are filled.|
||NULL was passed as an argument value.|
||The CLR implementation cannot provide information about the memory region. This can happen for the following reasons:
- The metadata scope was opened with the
- The metadata scope was opened without the
- The IMetaDataDispenser::OpenScopeOnMemory method was used to open only the metadata portion of the file.
- The file is not a portable executable (PE) file. Note: These conditions depend on the CLR implementation, and are likely to be weakened in future versions of the CLR.
The memory that
ppvData points to is valid only as long as the underlying metadata scope is open.
In order for this method to work, when you map the metadata of an on-disk file into memory by calling the IMetaDataDispenser::OpenScope method, you must specify the
ofReadOnly flag and you must not specify the
The choice of file mapping type for each scope is specific to a given implementation of the CLR. It cannot be set by the user. The current implementation of the CLR always returns
pdwMappingType, but this can change in future versions of the CLR or in future service releases of a given version. You should always check the returned value in
pdwMappingType, because different types will have different layouts and offsets.
Passing NULL for any of the three parameters is not supported. The method returns
E_INVALIDARG, and none of the outputs are filled. Ignoring the mapping type or the size of the region can result in abnormal program termination.
Platforms: See System Requirements.
Library: Used as a resource in MsCorEE.dll
.NET Framework Versions: Available since 4