MCPcopy Create free account
hub / github.com/bailey27/cppcryptfs / CryptFileForward

Class CryptFileForward

libcppcryptfs/file/cryptfile.h:91–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89};
90
91class CryptFileForward: public CryptFile
92{
93private:
94 shared_ptr<CryptOpenFile> m_openfile;
95
96 bool m_bExclusiveLock;
97
98 void Unlock()
99 {
100 if (m_openfile) {
101 if (m_bExclusiveLock)
102 m_openfile->UnlockExclusive();
103 else
104 m_openfile->UnlockShared();
105 }
106 }
107
108 void Lock()
109 {
110 if (m_openfile) {
111 if (m_bExclusiveLock)
112 m_openfile->LockExclusive();
113 else
114 m_openfile->LockShared();
115 }
116 }
117
118 void ReLock(bool exclusive)
119 {
120 Unlock();
121 m_bExclusiveLock = exclusive;
122 Lock();
123 }
124
125 void ReLock()
126 {
127 ReLock(m_bExclusiveLock);
128 }
129
130 void GoExclusive()
131 {
132 ReLock(true);
133 }
134
135 void GoShared()
136 {
137 ReLock(false);
138 }
139
140public:
141
142
143 virtual BOOL Associate(CryptContext *con, HANDLE hfile, LPCWSTR inputPath, bool /* unused */);
144
145 virtual BOOL Read(unsigned char *buf, DWORD buflen, LPDWORD pNread, LONGLONG offset);
146
147 virtual BOOL Write(const unsigned char *buf, DWORD buflen, LPDWORD pNwritten, LONGLONG offset, BOOL bWriteToEndOfFile, BOOL bPagingIo);
148

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected