| 1 | // EraserDoc.h |
|---|
| 2 | // |
|---|
| 3 | // Eraser. Secure data removal. For Windows. |
|---|
| 4 | // Copyright © 1997-2001 Sami Tolvanen (sami@tolvanen.com). |
|---|
| 5 | // |
|---|
| 6 | // This program is free software; you can redistribute it and/or |
|---|
| 7 | // modify it under the terms of the GNU General Public License |
|---|
| 8 | // as published by the Free Software Foundation; either version 2 |
|---|
| 9 | // of the License, or (at your option) any later version. |
|---|
| 10 | // |
|---|
| 11 | // This program is distributed in the hope that it will be useful, |
|---|
| 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | // GNU General Public License for more details. |
|---|
| 15 | // |
|---|
| 16 | // You should have received a copy of the GNU General Public License |
|---|
| 17 | // along with this program; if not, write to the Free Software |
|---|
| 18 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
|---|
| 19 | // 02111-1307, USA. |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | #if !defined(AFX_ERASERDOC_H__70E9C85A_F0D1_11D2_BBF3_00105AAF62C4__INCLUDED_) |
|---|
| 23 | #define AFX_ERASERDOC_H__70E9C85A_F0D1_11D2_BBF3_00105AAF62C4__INCLUDED_ |
|---|
| 24 | |
|---|
| 25 | #if _MSC_VER > 1000 |
|---|
| 26 | #pragma once |
|---|
| 27 | #endif // _MSC_VER > 1000 |
|---|
| 28 | |
|---|
| 29 | #include "Item.h" |
|---|
| 30 | #include "SystemTray.h" |
|---|
| 31 | |
|---|
| 32 | // constants |
|---|
| 33 | const LPCTSTR szSettingsKey = "Scheduler"; |
|---|
| 34 | const LPCTSTR szScheduleKey = "Scheduled Assignments"; |
|---|
| 35 | |
|---|
| 36 | const LPCTSTR szSchedulerEnabled = "SchedulerEnabled"; |
|---|
| 37 | const LPCTSTR szLog = "SchedulerLog"; |
|---|
| 38 | const LPCTSTR szLogOnlyErrors = "SchedulerLogOnlyErrors"; |
|---|
| 39 | const LPCTSTR szStartup = "SchedulerStartup"; |
|---|
| 40 | const LPCTSTR szQueueTasks = "SchedulerQueueTasks"; |
|---|
| 41 | const LPCTSTR szNoVisualErrors = "SchedulerNoVisualErrors"; |
|---|
| 42 | const LPCTSTR szMaxLogSize = "SchedulerMaxLogFileSize"; |
|---|
| 43 | |
|---|
| 44 | const LPCTSTR szStartView = "EraserStartView"; |
|---|
| 45 | const LPCTSTR szIconAnimation = "EraserOutbarIconAnimation"; |
|---|
| 46 | const LPCTSTR szSmallIconView = "EraserOutbarSmallIconView"; |
|---|
| 47 | const LPCTSTR szOutBarWidth = "EraserOutbarWidth"; |
|---|
| 48 | const LPCTSTR szNoTrayIcon = "EraserNoTrayIcon"; |
|---|
| 49 | const LPCTSTR szHideOnMinimize = "EraserHideOnMinimize"; |
|---|
| 50 | const LPCTSTR szWindowRect = "EraserWindowRect"; |
|---|
| 51 | |
|---|
| 52 | const LPCTSTR szViewInfoBar = "EraserViewInfoBar"; |
|---|
| 53 | const LPCTSTR szResolveLock = "EraserResolveLock"; |
|---|
| 54 | const LPCTSTR szResolveAskUser = "EraserResolveLockAskUser"; |
|---|
| 55 | |
|---|
| 56 | const LPCTSTR szStartupPath = "Software\\Microsoft\\Windows\\CurrentVersion\\Run"; |
|---|
| 57 | const LPCTSTR szLogFile = "schedlog.txt"; |
|---|
| 58 | const LPCTSTR szRunOnStartup = "Eraser"; |
|---|
| 59 | |
|---|
| 60 | const LPCTSTR szClearSwapPath = "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory Management"; |
|---|
| 61 | const LPCTSTR szClearSwapValue = "ClearPageFileAtShutdown"; |
|---|
| 62 | |
|---|
| 63 | const LPCTSTR szFileExtension = "ers"; |
|---|
| 64 | const LPCTSTR szFileWCard = "*.ers"; |
|---|
| 65 | const LPCTSTR szFileFilter = "Eraser Files (*.ers)|*.ers||"; |
|---|
| 66 | const LPCTSTR szExportTitle = "Select Export File"; |
|---|
| 67 | const LPCTSTR szImportTitle = "Select Import File"; |
|---|
| 68 | |
|---|
| 69 | const LPCTSTR szDefaultFile = "default.ers"; |
|---|
| 70 | |
|---|
| 71 | // definitions |
|---|
| 72 | #define VIEW_ERASER 1 |
|---|
| 73 | #define VIEW_SCHEDULER 2 |
|---|
| 74 | #define VIEW_EXPLORER 3 |
|---|
| 75 | |
|---|
| 76 | // messages |
|---|
| 77 | #define SCHEDULER_SET_TIMERS 1L |
|---|
| 78 | |
|---|
| 79 | // enumerations |
|---|
| 80 | enum HeaderIcon |
|---|
| 81 | { |
|---|
| 82 | IconExclamation, |
|---|
| 83 | IconEraser, |
|---|
| 84 | IconClock |
|---|
| 85 | }; |
|---|
| 86 | |
|---|
| 87 | enum OutbarFolders |
|---|
| 88 | { |
|---|
| 89 | FolderEraser, |
|---|
| 90 | FolderExplorer |
|---|
| 91 | }; |
|---|
| 92 | |
|---|
| 93 | enum OutbarEraserViews |
|---|
| 94 | { |
|---|
| 95 | ViewEraser, |
|---|
| 96 | ViewScheduler |
|---|
| 97 | }; |
|---|
| 98 | |
|---|
| 99 | |
|---|
| 100 | class CEraserDoc : public CDocument |
|---|
| 101 | { |
|---|
| 102 | private: |
|---|
| 103 | CEraserDoc(const CEraserDoc&) ; |
|---|
| 104 | CEraserDoc& operator = (const CEraserDoc&); |
|---|
| 105 | |
|---|
| 106 | protected: // create from serialization only |
|---|
| 107 | CEraserDoc(); |
|---|
| 108 | DECLARE_DYNCREATE(CEraserDoc) |
|---|
| 109 | |
|---|
| 110 | |
|---|
| 111 | // Operations |
|---|
| 112 | public: |
|---|
| 113 | virtual ~CEraserDoc(); |
|---|
| 114 | |
|---|
| 115 | BOOL LogAction(UINT); |
|---|
| 116 | BOOL LogException(CException*); |
|---|
| 117 | BOOL LogAction(CString); |
|---|
| 118 | |
|---|
| 119 | void CalcNextAssignment(); |
|---|
| 120 | void UpdateToolTip(); |
|---|
| 121 | |
|---|
| 122 | BOOL SavePreferences(); |
|---|
| 123 | BOOL ReadPreferences(); |
|---|
| 124 | |
|---|
| 125 | BOOL Import(LPCTSTR szFile, BOOL bErrors = TRUE); |
|---|
| 126 | BOOL Export(LPCTSTR szFile, BOOL bErrors = TRUE); |
|---|
| 127 | BOOL SaveTasksToDefault(); |
|---|
| 128 | |
|---|
| 129 | BOOL AddScheduledTask(CScheduleItem*); |
|---|
| 130 | BOOL AddTask(CItem*); |
|---|
| 131 | void CleanList(CPtrArray&, int); |
|---|
| 132 | void FreeTasks(); |
|---|
| 133 | |
|---|
| 134 | CSystemTray m_stIcon; |
|---|
| 135 | |
|---|
| 136 | CString m_strNextAssignment; |
|---|
| 137 | CString m_strExePath; |
|---|
| 138 | |
|---|
| 139 | //Setting. resolving file lock |
|---|
| 140 | BOOL m_bResolveLock; |
|---|
| 141 | BOOL m_bResolveAskUser; |
|---|
| 142 | // Scheduler process counting |
|---|
| 143 | WORD m_wProcessCount; |
|---|
| 144 | BOOL m_bSchedulerEnabled; |
|---|
| 145 | |
|---|
| 146 | // task arrays |
|---|
| 147 | CPtrArray m_paTasks; |
|---|
| 148 | CPtrArray m_paScheduledTasks; |
|---|
| 149 | |
|---|
| 150 | // task queue |
|---|
| 151 | CPtrArray m_paQueuedTasks; |
|---|
| 152 | |
|---|
| 153 | // settings (start view) |
|---|
| 154 | DWORD m_dwStartView; |
|---|
| 155 | |
|---|
| 156 | // settings (results) |
|---|
| 157 | BOOL m_bResultsForFiles; |
|---|
| 158 | BOOL m_bResultsForUnusedSpace; |
|---|
| 159 | BOOL m_bResultsOnlyWhenFailed; |
|---|
| 160 | BOOL m_bShellextResults; |
|---|
| 161 | |
|---|
| 162 | // settings (shell extension) |
|---|
| 163 | BOOL m_bErasextEnabled; |
|---|
| 164 | |
|---|
| 165 | // settings (PRNG) |
|---|
| 166 | BOOL m_bEnableSlowPoll; |
|---|
| 167 | |
|---|
| 168 | // settings (paging file on NT) |
|---|
| 169 | BOOL m_bClearSwap; |
|---|
| 170 | |
|---|
| 171 | // settings (Scheduler) |
|---|
| 172 | BOOL m_bLog; |
|---|
| 173 | BOOL m_bLogOnlyErrors; |
|---|
| 174 | BOOL m_bStartup; |
|---|
| 175 | BOOL m_bQueueTasks; |
|---|
| 176 | BOOL m_bNoVisualErrors; |
|---|
| 177 | DWORD m_dwMaxLogSize; |
|---|
| 178 | BOOL m_bNoTrayIcon; |
|---|
| 179 | BOOL m_bHideOnMinimize; |
|---|
| 180 | |
|---|
| 181 | // settings (Folder Bar) |
|---|
| 182 | BOOL m_bIconAnimation; |
|---|
| 183 | BOOL m_bSmallIconView; |
|---|
| 184 | DWORD m_dwOutbarWidth; |
|---|
| 185 | RECT m_rWindowRect; |
|---|
| 186 | |
|---|
| 187 | // settings (View) |
|---|
| 188 | BOOL m_bViewInfoBar; |
|---|
| 189 | |
|---|
| 190 | CImageList* m_smallImageList; |
|---|
| 191 | CImageList m_ilHeader; |
|---|
| 192 | |
|---|
| 193 | // Overrides |
|---|
| 194 | // ClassWizard generated virtual function overrides |
|---|
| 195 | //{{AFX_VIRTUAL(CEraserDoc) |
|---|
| 196 | public: |
|---|
| 197 | virtual BOOL OnNewDocument(); |
|---|
| 198 | virtual void Serialize(CArchive& ar); |
|---|
| 199 | virtual BOOL OnOpenDocument(LPCTSTR lpszPathName); |
|---|
| 200 | virtual void DeleteContents(); |
|---|
| 201 | virtual void OnCloseDocument(); |
|---|
| 202 | //}}AFX_VIRTUAL |
|---|
| 203 | |
|---|
| 204 | |
|---|
| 205 | |
|---|
| 206 | #ifdef _DEBUG |
|---|
| 207 | virtual void AssertValid() const; |
|---|
| 208 | virtual void Dump(CDumpContext& dc) const; |
|---|
| 209 | #endif |
|---|
| 210 | |
|---|
| 211 | protected: |
|---|
| 212 | |
|---|
| 213 | // Generated message map functions |
|---|
| 214 | protected: |
|---|
| 215 | //{{AFX_MSG(CEraserDoc) |
|---|
| 216 | afx_msg void OnUpdateFileExport(CCmdUI* pCmdUI); |
|---|
| 217 | afx_msg void OnFileExport(); |
|---|
| 218 | afx_msg void OnFileImport(); |
|---|
| 219 | afx_msg void OnTrayEnable(); |
|---|
| 220 | afx_msg void OnUpdateTrayShowWindow(CCmdUI* pCmdUI); |
|---|
| 221 | afx_msg void OnUpdateTrayEnable(CCmdUI* pCmdUI); |
|---|
| 222 | afx_msg void OnTrayShowWindow(); |
|---|
| 223 | afx_msg void OnEditPreferencesGeneral(); |
|---|
| 224 | afx_msg void OnEditPreferencesEraser(); |
|---|
| 225 | afx_msg void OnFileViewLog(); |
|---|
| 226 | //}}AFX_MSG |
|---|
| 227 | DECLARE_MESSAGE_MAP() |
|---|
| 228 | }; |
|---|
| 229 | |
|---|
| 230 | ///////////////////////////////////////////////////////////////////////////// |
|---|
| 231 | |
|---|
| 232 | //{{AFX_INSERT_LOCATION}} |
|---|
| 233 | // Microsoft Visual C++ will insert additional declarations immediately before the previous line. |
|---|
| 234 | |
|---|
| 235 | #endif // !defined(AFX_ERASERDOC_H__70E9C85A_F0D1_11D2_BBF3_00105AAF62C4__INCLUDED_) |
|---|