Leaked source code of windows server 2003
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.

270 lines
7.0 KiB

  1. /******************************************************************************
  2. Copyright (c) 1999-2000 Microsoft Corporation
  3. Module Name:
  4. rstrmgr.h
  5. Abstract:
  6. This file contains the declaration of the CRestoreManager class, which
  7. controls overall restoration process and provides methods to control &
  8. help user experience flow.
  9. Revision History:
  10. Seong Kook Khang (SKKhang) 05/10/00
  11. created
  12. ******************************************************************************/
  13. #ifndef _RSTRMGR_H__INCLUDED_
  14. #define _RSTRMGR_H__INCLUDED_
  15. #pragma once
  16. /////////////////////////////////////////////////////////////////////////////
  17. //
  18. // Constant Definitions
  19. //
  20. /////////////////////////////////////////////////////////////////////////////
  21. // SR Restore Start Mode
  22. enum
  23. {
  24. SRRSM_NORMAL = 0,
  25. SRRSM_SUCCESS,
  26. SRRSM_FAIL,
  27. SRRSM_FAILLOWDISK
  28. };
  29. // SR Restore Manager Status
  30. enum
  31. {
  32. SRRMS_NONE = 0,
  33. SRRMS_STARTED,
  34. SRRMS_INITIALIZING,
  35. SRRMS_CREATING_MAP,
  36. SRRMS_RESTORING,
  37. SRRMS_FINISHED
  38. };
  39. // Functionality Chosen in the Main Page
  40. enum
  41. {
  42. RMO_RESTORE = 0,
  43. RMO_CREATERP,
  44. RMO_UNDO,
  45. RMO_MAX
  46. };
  47. // SR Restore Manager Flags
  48. #define SRRMF_CANNAVIGATEPAGE 0x00000001
  49. #define SRRMF_ISUNDO 0x00000002
  50. #define SRRMF_ISRPSELECTED 0x00000004
  51. /////////////////////////////////////////////////////////////////////////////
  52. //
  53. // CSRTime Definitions
  54. //
  55. /////////////////////////////////////////////////////////////////////////////
  56. class CSRTime
  57. {
  58. public:
  59. CSRTime();
  60. public:
  61. const CSRTime& operator=( const CSRTime &cSrc );
  62. public:
  63. int GetYear() { return( m_st.wYear ); }
  64. int GetMonth() { return( m_st.wMonth ); }
  65. int GetDay() { return( m_st.wDay ); }
  66. operator PSYSTEMTIME() const;
  67. //operator (FILETIME*)();
  68. PSYSTEMTIME GetTime();
  69. void GetTime( PSYSTEMTIME pst );
  70. BOOL GetTime( PFILETIME pft );
  71. public:
  72. int Compare( CSRTime &time );
  73. int CompareDate( CSRTime &time );
  74. BOOL SetTime( PFILETIME ft, BOOL fLocal=TRUE );
  75. void SetTime( PSYSTEMTIME st );
  76. void SetToCurrent();
  77. protected:
  78. SYSTEMTIME m_st; // Date/Time in UTC
  79. };
  80. /////////////////////////////////////////////////////////////////////////////
  81. //
  82. // Structure Definitions
  83. //
  84. /////////////////////////////////////////////////////////////////////////////
  85. struct SRestorePointInfo
  86. {
  87. DWORD dwType;
  88. DWORD dwNum;
  89. CSRStr strDir;
  90. CSRStr strName;
  91. CSRTime stTimeStamp;
  92. DWORD dwFlags;
  93. };
  94. typedef SRestorePointInfo *PSRPI;
  95. typedef CSRDynPtrArray<PSRPI, 32> CDPA_RPI;
  96. struct SRenamedFolderInfo
  97. {
  98. CSRStr strOld;
  99. CSRStr strNew;
  100. CSRStr strLoc;
  101. };
  102. typedef SRenamedFolderInfo *PSRFI;
  103. typedef CSRDynPtrArray<PSRFI, 16> CDPA_RFI;
  104. /////////////////////////////////////////////////////////////////////////////
  105. //
  106. // CRestoreManager
  107. //
  108. /////////////////////////////////////////////////////////////////////////////
  109. class CRestoreManager
  110. {
  111. public:
  112. CRestoreManager();
  113. ~CRestoreManager();
  114. void Release();
  115. // Properties - main flow
  116. public:
  117. BOOL CanRunRestore( BOOL fThawIfFrozen );
  118. int GetFirstDayOfWeek();
  119. BOOL GetIsRPSelected();
  120. BOOL GetIsSafeMode();
  121. BOOL GetIsSmgrAvailable();
  122. BOOL GetIsUndo();
  123. int GetLastRestore();
  124. int GetMainOption();
  125. LPCWSTR GetManualRPName();
  126. void GetMaxDate( PSYSTEMTIME pstMax );
  127. void GetMinDate( PSYSTEMTIME pstMin );
  128. int GetRealPoint();
  129. PSRFI GetRFI( int nIndex );
  130. int GetRFICount();
  131. PSRPI GetRPI( int nIndex );
  132. int GetRPICount();
  133. void GetSelectedDate( PSYSTEMTIME pstSel );
  134. LPCWSTR GetSelectedName();
  135. int GetSelectedPoint();
  136. int GetStartMode();
  137. void GetToday( PSYSTEMTIME pstToday );
  138. void SetIsRPSelected( BOOL fSel );
  139. void SetIsUndo( BOOL fUndo );
  140. BOOL SetMainOption( int nOpt );
  141. void SetManualRPName( LPCWSTR cszRPName );
  142. void SetSelectedDate( PSYSTEMTIME pstSel );
  143. BOOL SetSelectedPoint( int nRP );
  144. BOOL SetStartMode( int nMode );
  145. void GetUsedDate( PSYSTEMTIME pstDate );
  146. LPCWSTR GetUsedName();
  147. DWORD GetUsedType();
  148. // Properties - HTML UI specific
  149. public:
  150. BOOL GetCanNavigatePage();
  151. void SetCanNavigatePage( BOOL fCanNav );
  152. // Properties
  153. public:
  154. PSRPI GetUsedRP();
  155. int GetNewRP();
  156. // Operations - main flow
  157. public:
  158. BOOL CheckRestore( BOOL fSilent );
  159. BOOL BeginRestore();
  160. BOOL Cancel();
  161. BOOL CancelRestorePoint();
  162. BOOL CreateRestorePoint();
  163. BOOL DisableFIFO();
  164. BOOL EnableFIFO();
  165. BOOL FormatDate( PSYSTEMTIME pst, CSRStr &str, BOOL fLongFmt );
  166. BOOL FormatLowDiskMsg( LPCWSTR cszFmt, CSRStr &str );
  167. BOOL FormatTime( PSYSTEMTIME pst, CSRStr &str );
  168. BOOL GetLocaleDateFormat( PSYSTEMTIME pst, LPCWSTR cszFmt, CSRStr &str );
  169. BOOL GetYearMonthStr( int nYear, int nMonth, CSRStr &str );
  170. BOOL InitializeAll();
  171. BOOL Restore( HWND hwndProgress );
  172. // Operations
  173. public:
  174. BOOL AddRenamedFolder( PSRFI pRFI );
  175. BOOL SetRPsUsed( int nRPUsed, int nRPNew );
  176. BOOL SilentRestore( DWORD dwRP );
  177. // Operations - internal
  178. protected:
  179. void Cleanup();
  180. BOOL GetDateStr( PSYSTEMTIME pst, CSRStr &str, DWORD dwFlags, LPCWSTR cszFmt );
  181. BOOL GetTimeStr( PSYSTEMTIME pst, CSRStr &str, DWORD dwFlags );
  182. void UpdateRestorePoint();
  183. BOOL UpdateRestorePointList();
  184. BOOL CheckForDomainChange (WCHAR *pwszFilename, WCHAR *pszMsg);
  185. // Attributes
  186. public:
  187. HWND GetFrameHwnd();
  188. //int GetStatus();
  189. BOOL DenyClose();
  190. BOOL NeedReboot();
  191. void SetFrameHwnd( HWND hWnd );
  192. void SetIdealSize( int cx, int cy );
  193. protected:
  194. int m_nStartMode;
  195. BOOL m_fNeedReboot;
  196. HWND m_hwndFrame;
  197. CSRTime m_stToday; // Current local date/time
  198. int m_nMainOption; // Option on main screen
  199. //int m_nStatus;
  200. BOOL m_fDenyClose;
  201. DWORD m_dwFlags;
  202. DWORD m_dwFlagsEx;
  203. int m_nSelectedRP;
  204. CSRTime m_stSelected;
  205. CSRStr m_strSelected;
  206. int m_nRealPoint;
  207. INT64 m_ullManualRP;
  208. CSRStr m_strManualRP;
  209. int m_nRPUsed; // RP used for the last restore
  210. int m_nRPNew; // New "Restore" RP created by the last restore
  211. // Restore Point specific informations
  212. CDPA_RPI m_aryRPI;
  213. //int m_nRPI;
  214. //PSRPI *m_aryRPI;
  215. int m_nLastRestore;
  216. CSRTime m_stRPMin;
  217. CSRTime m_stRPMax;
  218. CDPA_RFI m_aryRFI;
  219. //int m_nRFI;
  220. //PSRFI *m_aryRFI;
  221. IRestoreContext *m_pCtx;
  222. };
  223. extern CRestoreManager *g_pRstrMgr;
  224. BOOL CreateRestoreManagerInstance( CRestoreManager **ppMgr );
  225. #endif //_RSTRMGR_H__INCLUDED_