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.

350 lines
6.2 KiB

  1. /*++
  2. Copyright (c) 1994-1998 Microsoft Corporation
  3. Module Name :
  4. metaback.h
  5. Abstract:
  6. Metabase backup and restore dialog definitions
  7. Author:
  8. Ronald Meijer (ronaldm)
  9. Project:
  10. Internet Services Manager
  11. Revision History:
  12. --*/
  13. #ifndef __METABACK_H__
  14. #define __METABACK_H__
  15. class CBackupFile : public CObjectPlus
  16. /*++
  17. Class Description:
  18. Backup location object
  19. Public Interface:
  20. CBackupFile : Constructor
  21. QueryVersion : Get the version number
  22. QueryLocation : Get the location name
  23. GetTime : Get the time
  24. --*/
  25. {
  26. //
  27. // Constructor
  28. //
  29. public:
  30. CBackupFile(
  31. IN LPCTSTR lpszLocation,
  32. IN DWORD dwVersion,
  33. IN FILETIME * pft
  34. );
  35. public:
  36. DWORD QueryVersion() const { return m_dwVersion; }
  37. LPCTSTR QueryLocation() const { return m_strLocation; }
  38. void GetTime(OUT CTime & tim);
  39. private:
  40. DWORD m_dwVersion;
  41. CString m_strLocation;
  42. FILETIME m_ft;
  43. };
  44. class CBackupsListBox : public CHeaderListBox
  45. /*++
  46. Class Description:
  47. A listbox of CBackupFile objects
  48. Public Interface:
  49. CBackupsListBox : Constructor
  50. GetItem : Get backup object at index
  51. AddItem : Add item to listbox
  52. InsertItem : Insert item into the listbox
  53. Initialize : Initialize the listbox
  54. --*/
  55. {
  56. DECLARE_DYNAMIC(CBackupsListBox);
  57. public:
  58. static const nBitmaps; // Number of bitmaps
  59. public:
  60. CBackupsListBox();
  61. public:
  62. CBackupFile * GetItem(UINT nIndex);
  63. CBackupFile * GetNextSelectedItem(int * pnStartingIndex);
  64. int AddItem(CBackupFile * pItem);
  65. int InsertItem(int nPos, CBackupFile * pItem);
  66. virtual BOOL Initialize();
  67. protected:
  68. virtual void DrawItemEx(CRMCListBoxDrawStruct & s);
  69. };
  70. class CBkupPropDlg : public CDialog
  71. /*++
  72. Class Description:
  73. Backup file properties dialog
  74. Public Interface:
  75. CBkupPropDlg : Constructor
  76. QueryName : Return the name of the backup file
  77. --*/
  78. {
  79. //
  80. // Construction
  81. //
  82. public:
  83. //
  84. // Standard Constructor
  85. //
  86. CBkupPropDlg(
  87. IN LPCTSTR lpszServer,
  88. IN CWnd * pParent = NULL
  89. );
  90. //
  91. // Access
  92. //
  93. public:
  94. LPCTSTR QueryName() const { return m_strName; }
  95. LPCTSTR QueryPassword() const { return m_strPassword; }
  96. //
  97. // Dialog Data
  98. //
  99. protected:
  100. //{{AFX_DATA(CBkupPropDlg)
  101. enum { IDD = IDD_BACKUP };
  102. CString m_strName;
  103. CEdit m_edit_Name;
  104. CString m_strPassword;
  105. CEdit m_edit_Password;
  106. CString m_strPasswordConfirm;
  107. CEdit m_edit_PasswordConfirm;
  108. CButton m_button_Password;
  109. CButton m_button_OK;
  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. CString m_strServer;
  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 LPCTSTR lpszServer,
  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. afx_msg void OnButtonCreate();
  204. afx_msg void OnButtonDelete();
  205. afx_msg void OnButtonRestore();
  206. afx_msg void OnDblclkListBackups();
  207. afx_msg void OnSelchangeListBackups();
  208. virtual BOOL OnInitDialog();
  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. CString m_strServer;
  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(
  235. OUT CTime & tim
  236. )
  237. {
  238. tim = m_ft;
  239. }
  240. inline CBackupFile * CBackupsListBox::GetItem(UINT nIndex)
  241. {
  242. return (CBackupFile *)GetItemDataPtr(nIndex);
  243. }
  244. inline CBackupFile * CBackupsListBox::GetNextSelectedItem(
  245. IN OUT int * pnStartingIndex
  246. )
  247. {
  248. return (CBackupFile *)CHeaderListBox::GetNextSelectedItem(pnStartingIndex);
  249. }
  250. inline int CBackupsListBox::AddItem(CBackupFile * pItem)
  251. {
  252. return AddString((LPCTSTR)pItem);
  253. }
  254. inline int CBackupsListBox::InsertItem(int nPos, CBackupFile * pItem)
  255. {
  256. return InsertString(nPos, (LPCTSTR)pItem);
  257. }
  258. inline CBackupFile * CBackupDlg::GetSelectedListItem(
  259. OUT int * pnSel
  260. )
  261. {
  262. return (CBackupFile *)m_list_Backups.GetSelectedListItem(pnSel);
  263. }
  264. #endif // __METABACK_H__