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.

313 lines
7.2 KiB

  1. /******************************************************************************
  2. Copyright (c) 1999 Microsoft Corporation
  3. Module Name:
  4. htmlui2.cpp
  5. Abstract:
  6. This file contains the implementation of the CRestorePointInfo class,
  7. which is scriptable object for restore point information.
  8. Revision History:
  9. Seong Kook Khang (SKKhang) 06/21/99
  10. created
  11. Seong Kook Khang (SKKhang) 05/19/00
  12. Renamed from rpdata.cpp to htmlui2.cpp.
  13. Brought CRenamedFolders class from logfile.cpp.
  14. ******************************************************************************/
  15. #include "stdwin.h"
  16. #include "stdatl.h"
  17. #include "resource.h"
  18. #include "rstrpriv.h"
  19. #include "srui_htm.h"
  20. #include "rstrmgr.h"
  21. #include "rstrshl.h"
  22. /////////////////////////////////////////////////////////////////////////////
  23. //
  24. // CRestorePointInfo class
  25. //
  26. /////////////////////////////////////////////////////////////////////////////
  27. /////////////////////////////////////////////////////////////////////////////
  28. // CRestorePointInfo construction
  29. //#define COUNT_RPT 13
  30. //#define SIZE_RPT_STR 256
  31. CRestorePointInfo::CRestorePointInfo()
  32. {
  33. }
  34. STDMETHODIMP
  35. CRestorePointInfo::HrInit( SRestorePointInfo *pRPI )
  36. {
  37. TraceFunctEnter("CRestorePointInfo::HrInit");
  38. m_pRPI = pRPI;
  39. {
  40. LPCWSTR cszName = pRPI->strName;
  41. DebugTrace(TRACE_ID, "RP: '%ls'", cszName);
  42. }
  43. TraceFunctLeave();
  44. return( S_OK );
  45. }
  46. /////////////////////////////////////////////////////////////////////////////
  47. // CRestorePointInfo - IRestorePoint methods
  48. STDMETHODIMP
  49. CRestorePointInfo::get_Name( BSTR *pbstrName )
  50. {
  51. TraceFunctEnter("CRestorePointInfo::get_Name");
  52. HRESULT hr = S_OK;
  53. VALIDATE_INPUT_ARGUMENT(pbstrName);
  54. ALLOCATEBSTR_AND_CHECK_ERROR( pbstrName, m_pRPI->strName );
  55. Exit:
  56. TraceFunctLeave();
  57. return( hr );
  58. }
  59. STDMETHODIMP
  60. CRestorePointInfo::get_Type( INT *pnType )
  61. {
  62. TraceFunctEnter("CRestorePointInfo::get_Type");
  63. HRESULT hr = S_OK;
  64. VALIDATE_INPUT_ARGUMENT(pnType);
  65. *pnType = (INT)m_pRPI->dwType;
  66. Exit:
  67. TraceFunctLeave();
  68. return( hr );
  69. }
  70. STDMETHODIMP
  71. CRestorePointInfo::get_SequenceNumber( INT *pnSeq )
  72. {
  73. TraceFunctEnter("CRestorePointInfo::get_SquenceNumber");
  74. HRESULT hr = S_OK;
  75. VALIDATE_INPUT_ARGUMENT(pnSeq);
  76. *pnSeq = m_pRPI->dwNum;
  77. Exit:
  78. TraceFunctLeave();
  79. return( hr );
  80. }
  81. STDMETHODIMP
  82. CRestorePointInfo::get_TimeStamp( INT nOffDate, VARIANT *pvarTime )
  83. {
  84. TraceFunctEnter("CRestorePointInfo::get_TimeStamp");
  85. HRESULT hr = S_OK;
  86. SYSTEMTIME st;
  87. VALIDATE_INPUT_ARGUMENT(pvarTime);
  88. ::VariantInit(pvarTime);
  89. V_VT(pvarTime) = VT_DATE;
  90. m_pRPI->stTimeStamp.GetTime( &st );
  91. ::SystemTimeToVariantTime( &st, &V_DATE(pvarTime) );
  92. if ( nOffDate != 0 )
  93. V_DATE(pvarTime) += nOffDate;
  94. Exit:
  95. TraceFunctLeave();
  96. return( hr );
  97. }
  98. STDMETHODIMP
  99. CRestorePointInfo::get_Year( INT *pnYear )
  100. {
  101. TraceFunctEnter("CRestorePointInfo::get_Year");
  102. HRESULT hr = S_OK;
  103. VALIDATE_INPUT_ARGUMENT(pnYear);
  104. *pnYear = m_pRPI->stTimeStamp.GetYear();
  105. Exit:
  106. TraceFunctLeave();
  107. return( hr );
  108. }
  109. STDMETHODIMP
  110. CRestorePointInfo::get_Month( INT *pnMonth )
  111. {
  112. TraceFunctEnter("CRestorePointInfo::get_Month");
  113. HRESULT hr = S_OK;
  114. VALIDATE_INPUT_ARGUMENT(pnMonth);
  115. *pnMonth = m_pRPI->stTimeStamp.GetMonth();
  116. Exit:
  117. TraceFunctLeave();
  118. return( hr );
  119. }
  120. STDMETHODIMP
  121. CRestorePointInfo::get_Day( INT *pnDay )
  122. {
  123. TraceFunctEnter("CRestorePointInfo::get_Day");
  124. HRESULT hr = S_OK;
  125. VALIDATE_INPUT_ARGUMENT(pnDay);
  126. *pnDay = m_pRPI->stTimeStamp.GetDay();
  127. Exit:
  128. TraceFunctLeave();
  129. return( hr );
  130. }
  131. #define RP_ADVANCED 1
  132. STDMETHODIMP
  133. CRestorePointInfo::get_IsAdvanced( VARIANT_BOOL *pfIsAdvanced )
  134. {
  135. TraceFunctEnter("CRestorePointInfo::get_IsAdvanced");
  136. HRESULT hr = S_OK;
  137. VALIDATE_INPUT_ARGUMENT(pfIsAdvanced);
  138. *pfIsAdvanced = ( m_pRPI->dwFlags == RP_ADVANCED );
  139. Exit:
  140. TraceFunctLeave();
  141. return( hr );
  142. }
  143. STDMETHODIMP
  144. CRestorePointInfo::CompareSequence( IRestorePoint *pRP, INT *pnCmp )
  145. {
  146. TraceFunctEnter("CRestorePointInfo::CompareSequence");
  147. HRESULT hr = S_OK;
  148. INT nSrc;
  149. INT nCmp;
  150. VALIDATE_INPUT_ARGUMENT(pRP);
  151. VALIDATE_INPUT_ARGUMENT(pnCmp);
  152. hr = pRP->get_SequenceNumber( &nSrc );
  153. if ( FAILED(hr) )
  154. goto Exit;
  155. nCmp = (int)m_pRPI->dwNum - nSrc;
  156. if ( nCmp == 0 )
  157. *pnCmp = 0;
  158. else if ( nCmp > 0 )
  159. *pnCmp = 1;
  160. else
  161. *pnCmp = -1;
  162. Exit:
  163. TraceFunctLeave();
  164. return( hr );
  165. }
  166. /////////////////////////////////////////////////////////////////////////////
  167. //
  168. // CRenamedFolders class
  169. //
  170. /////////////////////////////////////////////////////////////////////////////
  171. CRenamedFolders::CRenamedFolders()
  172. {
  173. }
  174. /////////////////////////////////////////////////////////////////////////////
  175. // CRenamedFolders - IRenamedFolders methods
  176. STDMETHODIMP
  177. CRenamedFolders::get_Count( long *plCount )
  178. {
  179. TraceFunctEnter("CRenamedFolders::get_Count");
  180. HRESULT hr = S_OK;
  181. VALIDATE_INPUT_ARGUMENT(plCount);
  182. *plCount = g_pRstrMgr->GetRFICount();
  183. Exit:
  184. TraceFunctLeave();
  185. return( hr );
  186. }
  187. /******************************************************************************/
  188. STDMETHODIMP
  189. CRenamedFolders::get_OldName( long lIndex, BSTR *pbstrName )
  190. {
  191. TraceFunctEnter("CRenamedFolders::OldName");
  192. HRESULT hr = S_OK;
  193. PSRFI pRFI;
  194. VALIDATE_INPUT_ARGUMENT(pbstrName);
  195. if ( lIndex < 0 || lIndex >= g_pRstrMgr->GetRFICount() )
  196. {
  197. ErrorTrace(TRACE_ID, "Invalid Argument, out of range");
  198. hr = E_INVALIDARG;
  199. goto Exit;
  200. }
  201. pRFI = g_pRstrMgr->GetRFI( lIndex );
  202. ALLOCATEBSTR_AND_CHECK_ERROR( pbstrName, pRFI->strOld );
  203. Exit:
  204. TraceFunctLeave();
  205. return( hr );
  206. }
  207. /******************************************************************************/
  208. STDMETHODIMP
  209. CRenamedFolders::get_NewName( long lIndex, BSTR *pbstrName )
  210. {
  211. TraceFunctEnter("CRenamedFolders::NewName");
  212. HRESULT hr = S_OK;
  213. PSRFI pRFI;
  214. VALIDATE_INPUT_ARGUMENT(pbstrName);
  215. if ( lIndex < 0 || lIndex >= g_pRstrMgr->GetRFICount() )
  216. {
  217. ErrorTrace(TRACE_ID, "Invalid Argument, out of range");
  218. hr = E_INVALIDARG;
  219. goto Exit;
  220. }
  221. pRFI = g_pRstrMgr->GetRFI( lIndex );
  222. ALLOCATEBSTR_AND_CHECK_ERROR( pbstrName, pRFI->strNew );
  223. Exit:
  224. TraceFunctLeave();
  225. return( hr );
  226. }
  227. /******************************************************************************/
  228. STDMETHODIMP
  229. CRenamedFolders::get_Location( long lIndex, BSTR *pbstrName )
  230. {
  231. TraceFunctEnter("CRenamedFolders::Location");
  232. HRESULT hr = S_OK;
  233. PSRFI pRFI;
  234. VALIDATE_INPUT_ARGUMENT(pbstrName);
  235. if ( lIndex < 0 || lIndex >= g_pRstrMgr->GetRFICount() )
  236. {
  237. ErrorTrace(TRACE_ID, "Invalid Argument, out of range");
  238. hr = E_INVALIDARG;
  239. goto Exit;
  240. }
  241. pRFI = g_pRstrMgr->GetRFI( lIndex );
  242. ALLOCATEBSTR_AND_CHECK_ERROR( pbstrName, pRFI->strLoc );
  243. Exit:
  244. TraceFunctLeave();
  245. return( hr );
  246. }
  247. // end of file