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.

199 lines
4.3 KiB

  1. /******************************************************************************
  2. *
  3. * Copyright (c) 2000 Microsoft Corporation
  4. *
  5. * Module Name:
  6. * respoint.h
  7. *
  8. * Abstract:
  9. * Definition of CRestorePoint, CRestorePointEnum classes.
  10. *
  11. * Revision History:
  12. * Brijesh Krishnaswami (brijeshk) 03/17/2000
  13. * created
  14. *
  15. *****************************************************************************/
  16. #ifndef _RESPOINT_H_
  17. #define _RESPOINT_H_
  18. #include "findfile.h"
  19. #include "logfmt.h"
  20. #include "srrestoreptapi.h"
  21. #include <list>
  22. #define MAX_RP_PATH 14
  23. // class which will hold a single change log entry
  24. class CChangeLogEntry {
  25. private:
  26. SR_LOG_ENTRY *_pentry;
  27. LPWSTR _pszDrive, _pszPath1, _pszPath2, _pszTemp, _pszProcess, _pszShortName;
  28. WCHAR _pszRPDir[MAX_PATH];
  29. BYTE * _pbAcl;
  30. DWORD _cbAcl;
  31. BOOL _fAclInline;
  32. public:
  33. CChangeLogEntry() {
  34. _pentry = NULL;
  35. _pszPath1 = _pszPath2 = _pszTemp = _pszDrive = _pszProcess = _pszShortName = NULL;
  36. _pbAcl = NULL;
  37. _cbAcl = 0;
  38. _fAclInline = FALSE;
  39. }
  40. void Load(SR_LOG_ENTRY *pentry, LPWSTR pszRPDir);
  41. BOOL CheckPathLengths();
  42. INT64 GetSequenceNum() {
  43. return _pentry->SequenceNum;
  44. }
  45. DWORD GetType() {
  46. return _pentry->EntryType;
  47. }
  48. DWORD GetFlags() {
  49. return _pentry->EntryFlags;
  50. }
  51. DWORD GetAttributes() {
  52. return _pentry->Attributes;
  53. }
  54. LPWSTR GetProcName() {
  55. return _pentry->ProcName;
  56. }
  57. LPWSTR GetRPDir() {
  58. return _pszRPDir;
  59. }
  60. LPWSTR GetDrive() {
  61. return _pszDrive;
  62. }
  63. LPWSTR GetPath1() {
  64. return _pszPath1;
  65. }
  66. LPWSTR GetPath2() {
  67. return _pszPath2;
  68. }
  69. LPWSTR GetTemp() {
  70. return _pszTemp;
  71. }
  72. LPWSTR GetShortName() {
  73. return _pszShortName;
  74. }
  75. BYTE * GetAcl() {
  76. return _pbAcl;
  77. }
  78. DWORD GetAclSize() {
  79. return _cbAcl;
  80. }
  81. LPWSTR GetProcess() {
  82. return _pszProcess;
  83. }
  84. DWORD GetAclInline() {
  85. return _fAclInline;
  86. }
  87. };
  88. // class which will hold a single restore point entry
  89. // this will represent a restore point across all drives
  90. // can use this to find the restore point size on a given drive
  91. // enumeration will always happen on system drive (since this contains the change log)
  92. // operations on all drives will be enumerated
  93. class CRestorePoint {
  94. private:
  95. RESTOREPOINTINFOW *m_pRPInfo;
  96. WCHAR m_szRPDir[MAX_RP_PATH]; // restore point dir, for eg. "RP1"
  97. BOOL m_fForward; // forward/reverse enumeration of change log
  98. CFindFile m_FindFile;
  99. WCHAR m_szDrive[MAX_PATH]; // drive for enumeration
  100. FILETIME m_Time; // creation time
  101. BOOL m_fDefunct;
  102. std::list<SR_LOG_ENTRY *> m_ChgLogList;
  103. std::list<SR_LOG_ENTRY *>::iterator m_itCurChgLogEntry; // iterator for above list
  104. DWORD BuildList(LPWSTR pszChgLog);
  105. DWORD InsertEntryIntoList(SR_LOG_ENTRY* pEntry);
  106. public:
  107. CRestorePoint();
  108. ~CRestorePoint();
  109. void SetDir(LPWSTR szDir) {
  110. lstrcpy(m_szRPDir, szDir);
  111. }
  112. LPWSTR GetDir() {
  113. return m_szRPDir;
  114. }
  115. LPWSTR GetName() {
  116. if (m_pRPInfo)
  117. return m_pRPInfo->szDescription;
  118. else
  119. return NULL;
  120. }
  121. DWORD GetType() {
  122. if (m_pRPInfo)
  123. return m_pRPInfo->dwRestorePtType;
  124. else return 0;
  125. }
  126. DWORD GetEventType() {
  127. if (m_pRPInfo)
  128. return m_pRPInfo->dwEventType;
  129. else return 0;
  130. }
  131. FILETIME *GetTime() {
  132. return &m_Time;
  133. }
  134. BOOL IsDefunct() {
  135. return m_fDefunct;
  136. }
  137. DWORD GetNum();
  138. BOOL Load(RESTOREPOINTINFOW *pRpinfo);
  139. DWORD ReadLog();
  140. DWORD WriteLog();
  141. BOOL DeleteLog();
  142. DWORD Cancel();
  143. // need to call SetDir before calling any of these methods
  144. DWORD FindFirstChangeLogEntry(LPWSTR pszDrive,
  145. BOOL fForward,
  146. CChangeLogEntry&);
  147. DWORD FindNextChangeLogEntry(CChangeLogEntry&);
  148. DWORD FindClose();
  149. DWORD ReadSize (const WCHAR *pwszDrive, INT64 *pllSize);
  150. DWORD WriteSize (const WCHAR *pwszDrive, INT64 llSize);
  151. };
  152. #endif