| 45 | class KeyDecryptor; |
| 46 | |
| 47 | class CryptFile { |
| 48 | public: |
| 49 | |
| 50 | FileHeader m_header; |
| 51 | LONGLONG m_real_file_size; |
| 52 | bool m_is_empty; |
| 53 | |
| 54 | HANDLE m_handle; |
| 55 | |
| 56 | wstring m_path; |
| 57 | |
| 58 | CryptContext *m_con; |
| 59 | |
| 60 | KeyDecryptor *m_pkdc; |
| 61 | |
| 62 | static CryptFile *NewInstance(CryptContext *con); |
| 63 | |
| 64 | |
| 65 | void GetKeys(); |
| 66 | |
| 67 | virtual BOOL Associate(CryptContext *con, HANDLE hfile, LPCWSTR inputPath, bool bForWrite) = 0; |
| 68 | |
| 69 | |
| 70 | virtual BOOL Read(unsigned char *buf, DWORD buflen, LPDWORD pNread, LONGLONG offset) = 0; |
| 71 | |
| 72 | virtual BOOL Write(const unsigned char *buf, DWORD buflen, LPDWORD pNwritten, LONGLONG offset, BOOL bWriteToEndOfFile, BOOL bPagingIo) = 0; |
| 73 | |
| 74 | virtual BOOL SetEndOfFile(LONGLONG offset, BOOL bSet = TRUE) = 0; |
| 75 | |
| 76 | virtual BOOL LockFile(LONGLONG ByteOffset, LONGLONG Length) = 0; |
| 77 | |
| 78 | virtual BOOL UnlockFile(LONGLONG ByteOffset, LONGLONG Length) = 0; |
| 79 | |
| 80 | BOOL NotImplemented() { SetLastError(ERROR_ACCESS_DENIED); return FALSE; }; |
| 81 | |
| 82 | // disallow copying |
| 83 | CryptFile(CryptFile const&) = delete; |
| 84 | void operator=(CryptFile const&) = delete; |
| 85 | |
| 86 | CryptFile(); |
| 87 | virtual ~CryptFile(); |
| 88 | |
| 89 | }; |
| 90 | |
| 91 | class CryptFileForward: public CryptFile |
| 92 | { |
nothing calls this directly
no outgoing calls
no test coverage detected