ReactOS 0.4.16-dev-109-gf4cb10f
CicFileMappingStatic Class Reference

#include <cicfmap.h>

Inheritance diagram for CicFileMappingStatic:
Collaboration diagram for CicFileMappingStatic:

Public Member Functions

 CicFileMappingStatic ()
 
 ~CicFileMappingStatic ()
 
void Init (LPCTSTR pszName, CicMutex *pMutex)
 
LPVOID Create (LPSECURITY_ATTRIBUTES pSA, DWORD dwMaximumSizeLow, LPBOOL pbAlreadyExists)
 
LPVOID Open ()
 
void Close ()
 
BOOL Enter ()
 
void Leave ()
 
BOOL Flush (SIZE_T dwNumberOfBytesToFlush)
 
void Finalize ()
 

Protected Member Functions

LPVOID _Map ()
 

Protected Attributes

LPCTSTR m_pszName
 
LPVOID m_pView
 
HANDLE m_hMapping
 
BOOL m_bCreated
 
BOOL m_bHasMutex
 
CicMutexm_pMutex
 

Detailed Description

Definition at line 15 of file cicfmap.h.

Constructor & Destructor Documentation

◆ CicFileMappingStatic()

CicFileMappingStatic::CicFileMappingStatic ( )
inline

Definition at line 28 of file cicfmap.h.

28{ }

◆ ~CicFileMappingStatic()

CicFileMappingStatic::~CicFileMappingStatic ( )
inline

Definition at line 29 of file cicfmap.h.

29{ }

Member Function Documentation

◆ _Map()

LPVOID CicFileMappingStatic::_Map ( )
protected

Definition at line 84 of file cicfmap.cpp.

85{
87 if (!m_pView)
88 {
89 Close();
90 return NULL;
91 }
92 return m_pView;
93}
#define NULL
Definition: types.h:112
#define MapViewOfFile
Definition: compat.h:745
#define FILE_MAP_WRITE
Definition: winbase.h:154

Referenced by Create(), and Open().

◆ Close()

void CicFileMappingStatic::Close ( )

Definition at line 22 of file cicfmap.cpp.

23{
24 if (m_pView)
25 {
27 m_pView = NULL;
28 }
29
30 if (m_hMapping)
31 {
34 }
35
37}
#define FALSE
Definition: types.h:117
#define CloseHandle
Definition: compat.h:739
#define UnmapViewOfFile
Definition: compat.h:746

Referenced by _Map(), Finalize(), and ProcessDetach().

◆ Create()

LPVOID CicFileMappingStatic::Create ( LPSECURITY_ATTRIBUTES  pSA,
DWORD  dwMaximumSizeLow,
LPBOOL  pbAlreadyExists 
)

Definition at line 50 of file cicfmap.cpp.

54{
55 if (!m_pszName)
56 return NULL;
57
59 pSA,
61 0,
62 dwMaximumSizeLow,
63 m_pszName);
64 if (pbAlreadyExists)
65 *pbAlreadyExists = (::GetLastError() == ERROR_ALREADY_EXISTS);
66 if (!m_hMapping)
67 return NULL;
68
70 return _Map();
71}
LPCTSTR m_pszName
Definition: cicfmap.h:18
#define TRUE
Definition: types.h:120
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
#define PAGE_READWRITE
Definition: nt_native.h:1304
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define CreateFileMapping
Definition: winbase.h:3750

◆ Enter()

BOOL CicFileMappingStatic::Enter ( )

Definition at line 95 of file cicfmap.cpp.

96{
97 if (!m_bHasMutex)
98 return TRUE;
99 return m_pMutex->Enter();
100}
CicMutex * m_pMutex
Definition: cicfmap.h:23
BOOL Enter()
Definition: cicmutex.h:41

◆ Finalize()

void CicFileMappingStatic::Finalize ( )

Definition at line 116 of file cicfmap.cpp.

117{
118 if (!m_bHasMutex)
119 return;
120
121 Close();
122 Leave();
123}

Referenced by ProcessDetach(), and CicFileMapping::~CicFileMapping().

◆ Flush()

BOOL CicFileMappingStatic::Flush ( SIZE_T  dwNumberOfBytesToFlush)

Definition at line 109 of file cicfmap.cpp.

110{
111 if (!m_pView)
112 return FALSE;
113 return ::FlushViewOfFile(m_pView, dwNumberOfBytesToFlush);
114}

◆ Init()

void CicFileMappingStatic::Init ( LPCTSTR  pszName,
CicMutex pMutex 
)

Definition at line 39 of file cicfmap.cpp.

40{
41 if (pMutex)
42 m_pMutex = pMutex;
43
45 m_pszName = pszName;
46 m_bHasMutex = (pMutex != NULL);
47}

◆ Leave()

void CicFileMappingStatic::Leave ( )

Definition at line 102 of file cicfmap.cpp.

103{
104 if (!m_bHasMutex)
105 return;
106 m_pMutex->Leave();
107}
void Leave()
Definition: cicmutex.h:46

Referenced by Finalize().

◆ Open()

LPVOID CicFileMappingStatic::Open ( )

Definition at line 73 of file cicfmap.cpp.

74{
75 if (!m_pszName)
76 return NULL;
78 if (!m_hMapping)
79 return NULL;
80
81 return _Map();
82}
#define FILE_MAP_ALL_ACCESS
Definition: winbase.h:156
#define OpenFileMapping
Definition: winbase.h:3887

Member Data Documentation

◆ m_bCreated

BOOL CicFileMappingStatic::m_bCreated
protected

Definition at line 21 of file cicfmap.h.

Referenced by CicFileMapping::CicFileMapping(), Close(), Create(), and Init().

◆ m_bHasMutex

BOOL CicFileMappingStatic::m_bHasMutex
protected

Definition at line 22 of file cicfmap.h.

Referenced by CicFileMapping::CicFileMapping(), Enter(), Finalize(), Init(), and Leave().

◆ m_hMapping

HANDLE CicFileMappingStatic::m_hMapping
protected

Definition at line 20 of file cicfmap.h.

Referenced by _Map(), CicFileMapping::CicFileMapping(), Close(), Create(), and Open().

◆ m_pMutex

CicMutex* CicFileMappingStatic::m_pMutex
protected

Definition at line 23 of file cicfmap.h.

Referenced by CicFileMapping::CicFileMapping(), Enter(), Init(), and Leave().

◆ m_pszName

LPCTSTR CicFileMappingStatic::m_pszName
protected

Definition at line 18 of file cicfmap.h.

Referenced by CicFileMapping::CicFileMapping(), Create(), Init(), and Open().

◆ m_pView

LPVOID CicFileMappingStatic::m_pView
protected

Definition at line 19 of file cicfmap.h.

Referenced by _Map(), CicFileMapping::CicFileMapping(), Close(), and Flush().


The documentation for this class was generated from the following files: