Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

338 lines
6.1 KiB

  1. /*++
  2. Copyright (c) 1994-2000 Microsoft Corporation
  3. Module Name :
  4. metaback.h
  5. Abstract:
  6. Metabase backup and restore dialog definitions
  7. Author:
  8. Ronald Meijer (ronaldm)
  9. Sergei Antonov (sergeia)
  10. Project:
  11. Internet Services Manager
  12. Revision History:
  13. --*/
  14. #ifndef __METABACK_H__
  15. #define __METABACK_H__
  16. class CBackupFile : public CObjectPlus
  17. /*++
  18. Class Description:
  19. Backup location object
  20. Public Interface:
  21. CBackupFile : Constructor
  22. QueryVersion : Get the version number
  23. QueryLocation : Get the location name
  24. GetTime : Get the time
  25. --*/
  26. {
  27. //
  28. // Constructor
  29. //
  30. public:
  31. CBackupFile(
  32. IN LPCTSTR lpszLocation,
  33. IN DWORD dwVersion,
  34. IN FILETIME * pft
  35. );
  36. public:
  37. DWORD QueryVersion() const { return m_dwVersion; }
  38. LPCTSTR QueryLocation() const { return m_strLocation; }
  39. void GetTime(OUT CTime & tim);
  40. private:
  41. DWORD m_dwVersion;
  42. CString m_strLocation;
  43. FILETIME m_ft;
  44. };
  45. class CBackupsListBox : public CHeaderListBox
  46. /*++
  47. Class Description:
  48. A listbox of CBackupFile objects
  49. Public Interface:
  50. CBackupsListBox : Constructor
  51. GetItem : Get backup object at index
  52. AddItem : Add item to listbox
  53. InsertItem : Insert item into the listbox
  54. Initialize : Initialize the listbox
  55. --*/
  56. {
  57. DECLARE_DYNAMIC(CBackupsListBox);
  58. public:
  59. static const nBitmaps; // Number of bitmaps
  60. public:
  61. CBackupsListBox();
  62. public:
  63. CBackupFile * GetItem(UINT nIndex);
  64. CBackupFile * GetNextSelectedItem(int * pnStartingIndex);
  65. int AddItem(CBackupFile * pItem);
  66. int InsertItem(int nPos, CBackupFile * pItem);
  67. virtual BOOL Initialize();
  68. protected:
  69. virtual void DrawItemEx(CRMCListBoxDrawStruct & s);
  70. };
  71. class CBkupPropDlg : public CDialog
  72. /*++
  73. Class Description:
  74. Backup file properties dialog
  75. Public Interface:
  76. CBkupPropDlg : Constructor
  77. QueryName : Return the name of the backup file
  78. --*/
  79. {
  80. //
  81. // Construction
  82. //
  83. public:
  84. //
  85. // Standard Constructor
  86. //
  87. CBkupPropDlg(
  88. IN CIISMachine * pMachine,
  89. IN CWnd * pParent = NULL
  90. );
  91. //
  92. // Access
  93. //
  94. public:
  95. LPCTSTR QueryName() const { return m_strName; }
  96. //
  97. // Dialog Data
  98. //
  99. protected:
  100. //{{AFX_DATA(CBkupPropDlg)
  101. enum { IDD = IDD_BACKUP };
  102. CEdit m_edit_Name;
  103. CButton m_button_OK;
  104. CString m_strPassword;
  105. CEdit m_edit_Password;
  106. CString m_strPasswordConfirm;
  107. CEdit m_edit_PasswordConfirm;
  108. CButton m_button_Password;
  109. CString m_strName;
  110. //}}AFX_DATA
  111. //
  112. // Overrides
  113. //
  114. protected:
  115. //{{AFX_VIRTUAL(CBkupPropDlg)
  116. protected:
  117. virtual void DoDataExchange(CDataExchange * pDX);
  118. //}}AFX_VIRTUAL
  119. //
  120. // Implementation
  121. //
  122. protected:
  123. //{{AFX_MSG(CBkupPropDlg)
  124. afx_msg void OnChangeEditBackupName();
  125. afx_msg void OnChangeEditPassword();
  126. virtual BOOL OnInitDialog();
  127. virtual void OnOK();
  128. virtual void OnUsePassword();
  129. //}}AFX_MSG
  130. DECLARE_MESSAGE_MAP()
  131. private:
  132. CIISMachine * m_pMachine;
  133. };
  134. #define MIN_PASSWORD_LENGTH 1
  135. class CBackupPassword : public CDialog
  136. {
  137. public:
  138. CBackupPassword(CWnd * pParent);
  139. //{{AFX_DATA(CBackupPassword)
  140. enum { IDD = IDD_PASSWORD };
  141. CEdit m_edit;
  142. CButton m_button_OK;
  143. CString m_password;
  144. //}}AFX_DATA
  145. virtual void DoDataExchange(CDataExchange * pDX);
  146. protected:
  147. //{{AFX_MSG(CBackupPassword)
  148. afx_msg void OnChangedPassword();
  149. virtual BOOL OnInitDialog();
  150. //}}AFX_MSG
  151. DECLARE_MESSAGE_MAP()
  152. CString m_confirm_password;
  153. };
  154. class CBackupDlg : public CDialog
  155. /*++
  156. Class Description:
  157. Metabase backup/restore dialog
  158. Public Interface:
  159. CBackupDlg : Constructor
  160. HasChangedMetabase : TRUE if the metabase was changed
  161. --*/
  162. {
  163. //
  164. // Construction
  165. //
  166. public:
  167. //
  168. // Standard Constructor
  169. //
  170. CBackupDlg(
  171. IN CIISMachine * pMachine,
  172. IN CWnd * pParent = NULL
  173. );
  174. //
  175. // Access
  176. //
  177. public:
  178. BOOL HasChangedMetabase() const { return m_fChangedMetabase; }
  179. //
  180. // Dialog Data
  181. //
  182. protected:
  183. //{{AFX_DATA(CBackupDlg)
  184. enum { IDD = IDD_METABACKREST };
  185. CButton m_button_Restore;
  186. CButton m_button_Delete;
  187. CButton m_button_Close;
  188. //}}AFX_DATA
  189. CBackupsListBox m_list_Backups;
  190. //
  191. // Overrides
  192. //
  193. protected:
  194. //{{AFX_VIRTUAL(CBackupDlg)
  195. protected:
  196. virtual void DoDataExchange(CDataExchange * pDX);
  197. //}}AFX_VIRTUAL
  198. //
  199. // Implementation
  200. //
  201. protected:
  202. //{{AFX_MSG(CBackupDlg)
  203. virtual BOOL OnInitDialog();
  204. afx_msg void OnButtonCreate();
  205. afx_msg void OnButtonDelete();
  206. afx_msg void OnButtonRestore();
  207. afx_msg void OnDblclkListBackups();
  208. afx_msg void OnSelchangeListBackups();
  209. //}}AFX_MSG
  210. DECLARE_MESSAGE_MAP()
  211. void SetControlStates();
  212. HRESULT EnumerateBackups(IN LPCTSTR lpszSelect = NULL);
  213. CBackupFile * GetSelectedListItem(OUT int * pnSel = NULL);
  214. private:
  215. BOOL m_fChangedMetabase;
  216. CIISMachine * m_pMachine;
  217. CObListPlus m_oblBackups;
  218. CRMCListBoxResources m_ListBoxRes;
  219. };
  220. //
  221. // Inline Expansion
  222. //
  223. // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  224. inline CBackupFile::CBackupFile(
  225. IN LPCTSTR lpszLocation,
  226. IN DWORD dwVersion,
  227. IN FILETIME * pft
  228. )
  229. : m_dwVersion(dwVersion),
  230. m_strLocation(lpszLocation)
  231. {
  232. CopyMemory(&m_ft, pft, sizeof(m_ft));
  233. }
  234. inline void CBackupFile::GetTime(CTime & tim)
  235. {
  236. tim = m_ft;
  237. }
  238. inline CBackupFile * CBackupsListBox::GetItem(UINT nIndex)
  239. {
  240. return (CBackupFile *)GetItemDataPtr(nIndex);
  241. }
  242. inline CBackupFile * CBackupsListBox::GetNextSelectedItem(int * pnStartingIndex)
  243. {
  244. return (CBackupFile *)CHeaderListBox::GetNextSelectedItem(pnStartingIndex);
  245. }
  246. inline int CBackupsListBox::AddItem(CBackupFile * pItem)
  247. {
  248. return AddString((LPCTSTR)pItem);
  249. }
  250. inline int CBackupsListBox::InsertItem(int nPos, CBackupFile * pItem)
  251. {
  252. return InsertString(nPos, (LPCTSTR)pItem);
  253. }
  254. inline CBackupFile * CBackupDlg::GetSelectedListItem(int * pnSel)
  255. {
  256. return (CBackupFile *)m_list_Backups.GetSelectedListItem(pnSel);
  257. }
  258. #endif // __METABACK_H__