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.

336 lines
11 KiB

  1. /******************************************************************************
  2. Copyright (c) 1999-2000 Microsoft Corporation
  3. Module Name:
  4. rstrshl.h
  5. Abstract:
  6. This file contains the declaration of the CRestoreShell class, which
  7. provide several methods to be used by HTML scripts. This class wrappes the
  8. new CRestoreManager class.
  9. Revision History:
  10. Seong Kook Khang (SKKhang) 10/08/99
  11. created
  12. Seong Kook Khang (SKKhang) 05/10/00
  13. new architecture for Whistler, now CRestoreShell is merely a dummy
  14. ActiveX control, wrapping the new CRestoreManager class. Most of the
  15. real functionalities were moved into CRestoreManager.
  16. ******************************************************************************/
  17. #ifndef _RSTRSHL_H__INCLUDED_
  18. #define _RSTRSHL_H__INCLUDED_
  19. #pragma once
  20. /////////////////////////////////////////////////////////////////////////////
  21. //
  22. // CRestorePointInfo
  23. //
  24. /////////////////////////////////////////////////////////////////////////////
  25. class ATL_NO_VTABLE CRestorePointInfo :
  26. public CComObjectRootEx<CComMultiThreadModel>,
  27. public IDispatchImpl<IRestorePoint, &IID_IRestorePoint, &LIBID_RestoreUILib>
  28. {
  29. public:
  30. CRestorePointInfo();
  31. DECLARE_NO_REGISTRY()
  32. DECLARE_NOT_AGGREGATABLE(CRestorePointInfo)
  33. DECLARE_PROTECT_FINAL_CONSTRUCT()
  34. BEGIN_COM_MAP(CRestorePointInfo)
  35. COM_INTERFACE_ENTRY(IDispatch)
  36. COM_INTERFACE_ENTRY(IRestorePoint)
  37. END_COM_MAP()
  38. // Attributes
  39. public:
  40. SRestorePointInfo *m_pRPI;
  41. // Methods
  42. public:
  43. STDMETHOD(HrInit)( SRestorePointInfo *pRPI );
  44. // IRestorePoint methods
  45. public:
  46. STDMETHOD(get_Name)( BSTR *pbstrName );
  47. STDMETHOD(get_Type)( INT *pnType );
  48. STDMETHOD(get_SequenceNumber)( INT *pnSeq );
  49. STDMETHOD(get_TimeStamp)( INT nOffDate, VARIANT *pvarTime );
  50. STDMETHOD(get_Year)( INT *pnYear );
  51. STDMETHOD(get_Month)( INT *pnMonth );
  52. STDMETHOD(get_Day)( INT *pnDate );
  53. STDMETHOD(get_IsAdvanced)( VARIANT_BOOL *pfIsAdvanced );
  54. STDMETHOD(CompareSequence)( IRestorePoint *pRP, INT *pnCmp );
  55. };
  56. typedef CComObject<CRestorePointInfo> CRPIObj;
  57. /////////////////////////////////////////////////////////////////////////////
  58. //
  59. // CRenamedFolders
  60. //
  61. /////////////////////////////////////////////////////////////////////////////
  62. class ATL_NO_VTABLE CRenamedFolders :
  63. public CComObjectRootEx<CComMultiThreadModel>,
  64. public IDispatchImpl<IRenamedFolders, &IID_IRenamedFolders, &LIBID_RestoreUILib>
  65. {
  66. public:
  67. CRenamedFolders();
  68. DECLARE_NO_REGISTRY()
  69. DECLARE_NOT_AGGREGATABLE(CRenamedFolders)
  70. DECLARE_PROTECT_FINAL_CONSTRUCT()
  71. BEGIN_COM_MAP(CRenamedFolders)
  72. COM_INTERFACE_ENTRY(IRenamedFolders)
  73. COM_INTERFACE_ENTRY(IDispatch)
  74. END_COM_MAP()
  75. // IRestorePoint methods
  76. public:
  77. STDMETHOD(get_Count) ( long *plCount );
  78. STDMETHOD(get_OldName) ( long lIndex, BSTR *pbstrName );
  79. STDMETHOD(get_NewName) ( long lIndex, BSTR *pbstrName );
  80. STDMETHOD(get_Location)( long lIndex, BSTR *pbstrName );
  81. };
  82. typedef CComObject<CRenamedFolders> CRFObj;
  83. /////////////////////////////////////////////////////////////////////////////
  84. //
  85. // CRestoreShell
  86. //
  87. /////////////////////////////////////////////////////////////////////////////
  88. class ATL_NO_VTABLE CRestoreShell :
  89. public CComObjectRootEx<CComSingleThreadModel>,
  90. public IDispatchImpl<IRestoreShell, &IID_IRestoreShell, &LIBID_RestoreUILib>,
  91. public CComCoClass<CRestoreShell, &CLSID_RestoreShellExternal>
  92. {
  93. public:
  94. CRestoreShell();
  95. DECLARE_NO_REGISTRY()
  96. DECLARE_NOT_AGGREGATABLE(CRestoreShell)
  97. DECLARE_CLASSFACTORY_SINGLETON(CRestoreShell)
  98. DECLARE_PROTECT_FINAL_CONSTRUCT()
  99. BEGIN_COM_MAP(CRestoreShell)
  100. COM_INTERFACE_ENTRY(IDispatch)
  101. COM_INTERFACE_ENTRY(IRestoreShell)
  102. END_COM_MAP()
  103. //HRESULT FinalConstruct();
  104. //void FinalRelease();
  105. // Attributes
  106. protected:
  107. BOOL m_fFormInitialized;
  108. // IRestoreShell Restore Points Enumerator
  109. public:
  110. STDMETHOD(Item)( INT nIndex, IRestorePoint** ppRP );
  111. STDMETHOD(get_Count)( INT *pnCount );
  112. // IRestoreShell Properties
  113. public:
  114. STDMETHOD(get_CurrentDate) ( VARIANT *pvarDate );
  115. STDMETHOD(get_FirstDayOfWeek) ( INT *pnFirstDay );
  116. STDMETHOD(get_IsSafeMode) ( VARIANT_BOOL *pfIsSafeMode );
  117. STDMETHOD(get_IsUndo) ( VARIANT_BOOL *pfIsUndo );
  118. STDMETHOD(put_IsUndo) ( VARIANT_BOOL fIsUndo );
  119. STDMETHOD(get_LastRestore) ( INT *pnLastRestore );
  120. STDMETHOD(get_MainOption) ( INT *pnMainOption );
  121. STDMETHOD(put_MainOption) ( INT nMainOption );
  122. STDMETHOD(get_ManualRPName) ( BSTR *pbstrManualRP );
  123. STDMETHOD(put_ManualRPName) ( BSTR bstrManualRP );
  124. STDMETHOD(get_MaxDate) ( VARIANT *pvarDate );
  125. STDMETHOD(get_MinDate) ( VARIANT *pvarDate );
  126. STDMETHOD(get_RealPoint) ( INT *pnPoint );
  127. STDMETHOD(get_RenamedFolders) ( IRenamedFolders **ppList );
  128. STDMETHOD(get_RestorePtSelected)( VARIANT_BOOL *pfRPSel );
  129. STDMETHOD(put_RestorePtSelected)( VARIANT_BOOL fRPSel );
  130. STDMETHOD(get_SelectedDate) ( VARIANT *pvarDate );
  131. STDMETHOD(put_SelectedDate) ( VARIANT varDate );
  132. STDMETHOD(get_SelectedName) ( BSTR *pbstrName );
  133. STDMETHOD(get_SelectedPoint) ( INT *pnPoint );
  134. STDMETHOD(put_SelectedPoint) ( INT nPoint );
  135. STDMETHOD(get_SmgrUnavailable) ( VARIANT_BOOL *pfSmgr );
  136. STDMETHOD(get_StartMode) ( INT *pnMode );
  137. STDMETHOD(get_UsedDate) ( VARIANT *pvarDate );
  138. STDMETHOD(get_UsedName) ( BSTR *pbstrName );
  139. // IRestoreShell Properties - HTML UI specific
  140. public:
  141. STDMETHOD(get_CanNavigatePage) ( VARIANT_BOOL *pfCanNavigatePage );
  142. STDMETHOD(put_CanNavigatePage) ( VARIANT_BOOL fCanNavigatePage );
  143. // IRestoreShell Methods
  144. public:
  145. STDMETHOD(BeginRestore) ( VARIANT_BOOL *pfBeginRestore );
  146. STDMETHOD(CheckRestore) ( VARIANT_BOOL *pfCheckRestore );
  147. STDMETHOD(Cancel) ( VARIANT_BOOL *pfAbort );
  148. STDMETHOD(CancelRestorePoint) ();
  149. STDMETHOD(CompareDate) (/*[in]*/ VARIANT varDate1, /*[in]*/ VARIANT varDate2,/*[out, retval]*/ INT *pnCmp);
  150. STDMETHOD(CreateRestorePoint) (/*[out,retval]*/ VARIANT_BOOL *pfSucceeded);
  151. STDMETHOD(DisableFIFO) ();
  152. STDMETHOD(EnableFIFO) ();
  153. STDMETHOD(FormatDate) (/*[in]*/ VARIANT varDate, /*[in]*/ VARIANT_BOOL fLongFmt, /*[out, retval]*/ BSTR *pbstrDate);
  154. STDMETHOD(FormatLowDiskMsg) (BSTR bstrFmt, BSTR *pbstrMsg);
  155. STDMETHOD(FormatTime) (/*[in]*/ VARIANT varTime, /*[out, retval]*/ BSTR *pbstrTime);
  156. STDMETHOD(GetLocaleDateFormat) (/*[in]*/ VARIANT varDate, BSTR bstrFormat, BSTR *pbstrDate );
  157. STDMETHOD(GetYearMonthStr) (/*[in]*/ INT nYear, /*[in]*/ INT nMonth, /*[out, retval]*/ BSTR *pbstrDate);
  158. STDMETHOD(InitializeAll) ();
  159. STDMETHOD(Restore) ( OLE_HANDLE hwndProgress);
  160. STDMETHOD(SetFormSize) (/*[in]*/ INT nWidth, /*[in]*/ INT nHeight);
  161. STDMETHOD(ShowMessage) (BSTR bstrMsg);
  162. STDMETHOD(CanRunRestore) (/*[out,retval]*/ VARIANT_BOOL *pfSucceeded);
  163. STDMETHOD(DisplayOtherUsersWarning) ();
  164. STDMETHOD(DisplayMoveFileExWarning) (/*[out,retval]*/ VARIANT_BOOL *pfSucceeded);
  165. STDMETHOD(WasLastRestoreFromSafeMode) (/*[out,retval]*/ VARIANT_BOOL *pfSucceeded);
  166. };
  167. //extern CComPtr<CRestoreShell> g_pRestoreShell;
  168. //
  169. // END OF NEW CODE
  170. //
  171. /////////////////////////////////////////////////////////////////////////////
  172. #if OLD_CODE
  173. enum
  174. {
  175. RESTORE_STATUS_NONE = 0,
  176. RESTORE_STATUS_STARTED,
  177. RESTORE_STATUS_INITIALIZING,
  178. RESTORE_STATUS_CREATING_MAP,
  179. RESTORE_STATUS_RESTORING,
  180. RESTORE_STATUS_FINISHED
  181. };
  182. /////////////////////////////////////////////////////////////////////////////
  183. //
  184. // CRestoreShell
  185. //
  186. /////////////////////////////////////////////////////////////////////////////
  187. class ATL_NO_VTABLE CRestoreShell :
  188. public CComObjectRootEx<CComSingleThreadModel>,
  189. public IDispatchImpl<IRestoreShell, &IID_IRestoreShell, &LIBID_RestoreUILib>
  190. public CComCoClass<CRestoreShell, &CLSID_RestoreShellExternal>
  191. {
  192. public:
  193. CRestoreShell();
  194. DECLARE_NO_REGISTRY()
  195. DECLARE_NOT_AGGREGATABLE(CRestoreShell)
  196. DECLARE_CLASSFACTORY_SINGLETON(CRestoreShell)
  197. DECLARE_PROTECT_FINAL_CONSTRUCT()
  198. BEGIN_COM_MAP(CRestoreShell)
  199. COM_INTERFACE_ENTRY(IDispatch)
  200. COM_INTERFACE_ENTRY(IRestoreShell)
  201. END_COM_MAP()
  202. HRESULT FinalConstruct();
  203. void FinalRelease();
  204. //
  205. // Attributes
  206. //
  207. protected:
  208. DATE m_dateToday;
  209. VARIANT m_varSelectedDate;
  210. VARIANT m_varCurrentDate;
  211. long m_lStartMode;
  212. //long m_lRestoreType; // 0 means EOD, 1 means Restore Point
  213. DWORD m_dwSelectedPoint;
  214. DWORD m_dwRealPoint;
  215. BOOL m_fRestorePtSelected ;
  216. long m_lLastRestore;
  217. BOOL m_fIsUndo;
  218. BOOL m_fCanNavigatePage ;
  219. BOOL m_fWindowCreated ;
  220. CComBSTR m_bstrEndOfDay;
  221. CComBSTR m_bstrRestorePoint;
  222. #ifndef TEST_UI_ONLY
  223. CRestoreMapManager m_cMapMgr;
  224. #endif
  225. int m_nRPI;
  226. RPI **m_aryRPI;
  227. UINT64 m_ullSeqNum;
  228. LONG m_lCurrentBarSize; // to update progress bar
  229. INT64 m_llDCurTempDiskUsage ; // Current size of files in DS-TEMP
  230. INT64 m_llDMaxTempDiskUsage ; // Max size of DS-TEMP before starting restore
  231. INT m_nRestoreStatus ; // Restore status
  232. HANDLE m_RSThread ; // Thread to carry out restore
  233. HWND m_hwndProgress;
  234. HWND m_hWndShell ;
  235. INT m_nMainOption ; // Option on main screen
  236. UINT64 m_ullManualRP;
  237. CSRStr m_strManualRP;
  238. //
  239. // Operations
  240. //
  241. public:
  242. BOOL Initialize();
  243. void MonitorDataStoreProc();
  244. DWORD RestoreThread(void);
  245. void SetProgressPos( long lPos );
  246. BOOL SetStartMode( long lMode );
  247. BOOL CreateRestoreSigFile();
  248. BOOL DeleteRestoreSigFile();
  249. void ShutdownWindow();
  250. void UpdateRestorePoint();
  251. INT CurrentRestoreStatus(void);
  252. BOOL CanNavigatePage(void);
  253. HWND GetWindowHandle( void );
  254. void SetWindowHandle( HWND hWnd );
  255. DWORD m_dwCurrentWidth ;
  256. DWORD m_dwCurrentHeight ;
  257. //
  258. // Operations -- internal methods
  259. //
  260. private:
  261. BOOL GetDSTempDiskUsage(INT64 *pllD_DiskUsage);
  262. BOOL LoadSettings();
  263. void StoreSettings();
  264. //
  265. // IRestoreShell Restore Points Enumerator
  266. //
  267. public:
  268. STDMETHOD(Item)( long lIndex, IRestorePoint** ppRP );
  269. STDMETHOD(get_Count)( long *plCount );
  270. //
  271. // IRestoreShell Methods
  272. //
  273. public:
  274. };
  275. #endif //OLD_CODE
  276. #endif //_RSTRSHL_H__INCLUDED_