Share via


CAtlFileMappingBase::MapSharedMem

Call this method to create a file-mapping object that permits full access to all processes.

HRESULT MapSharedMem( 
   SIZE_T nMappingSize, 
   LPCTSTR szName, 
   BOOL* pbAlreadyExisted = NULL, 
   LPSECURITY_ATTRIBUTES lpsa = NULL, 
   DWORD dwMappingProtection = PAGE_READWRITE, 
   DWORD dwViewDesiredAccess = FILE_MAP_ALL_ACCESS  
) throw( );

Parameters

  • nMappingSize
    The mapping size. If 0, the maximum size of the file-mapping object is equal to the current size of the file-mapping object identified by szName.

  • szName
    The name of the mapping object.

  • pbAlreadyExisted
    Points to a BOOL value that is set to TRUE if the mapping object already existed.

  • lpsa
    The pointer to a SECURITY_ATTRIBUTES structure that determines whether the returned handle can be inherited by child processes. See lpAttributes in CreateFileMapping in the Windows SDK.

  • dwMappingProtection
    The protection desired for the file view, when the file is mapped. See flProtect in CreateFileMapping in the Windows SDK.

  • dwViewDesiredAccess
    Specifies the type of access to the file view and, therefore, the protection of the pages mapped by the file. See dwDesiredAccess in MapViewOfFileEx in the Windows SDK.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

MapShareMem allows an existing file-mapping object, created by CreateFileMapping, to be shared between processes.

Requirements

Header: atlfile.h

See Also

Reference

CAtlFileMappingBase Class