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.

184 lines
3.1 KiB

  1. #pragma once
  2. #include <map>
  3. #include <vector>
  4. #include <AdsiHelpers.h>
  5. #include "VarSetBase.h"
  6. class CFixObjectsInHierarchy
  7. {
  8. public:
  9. CFixObjectsInHierarchy();
  10. ~CFixObjectsInHierarchy();
  11. _bstr_t GetObjectType() const
  12. {
  13. return m_strObjectType;
  14. }
  15. void SetObjectType(LPCTSTR pszType)
  16. {
  17. m_strObjectType = pszType;
  18. }
  19. bool GetIntraForest() const
  20. {
  21. return m_bIntraForest;
  22. }
  23. void SetIntraForest(bool bIntraForest)
  24. {
  25. m_bIntraForest = bIntraForest;
  26. }
  27. bool GetFixReplaced() const
  28. {
  29. return m_bFixReplaced;
  30. }
  31. void SetFixReplaced(bool bFix)
  32. {
  33. m_bFixReplaced = bFix;
  34. }
  35. _bstr_t GetSourceContainerPath() const
  36. {
  37. return m_strSourceContainerPath;
  38. }
  39. void SetSourceContainerPath(_bstr_t strPath)
  40. {
  41. m_strSourceContainerPath = strPath;
  42. }
  43. _bstr_t GetTargetContainerPath() const
  44. {
  45. return m_strTargetContainerPath;
  46. }
  47. void SetTargetContainerPath(_bstr_t strPath)
  48. {
  49. m_strTargetContainerPath = strPath;
  50. }
  51. void FixObjects();
  52. private:
  53. class CMigrated
  54. {
  55. public:
  56. CMigrated();
  57. ~CMigrated();
  58. void RetrieveMigratedObjects(int nActionId = -1);
  59. int GetCount();
  60. _bstr_t GetObjectType(int nIndex);
  61. int GetObjectStatus(int nIndex);
  62. _bstr_t GetObjectSourcePath(int nIndex);
  63. _bstr_t GetObjectTargetPath(int nIndex);
  64. void UpdateObjectTargetPath(int nIndex, _bstr_t strPath);
  65. public:
  66. enum EStatus
  67. {
  68. STATUS_CREATED = 0x00000001,
  69. STATUS_REPLACED = 0x00000002,
  70. STATUS_EXISTED = 0x00000004,
  71. };
  72. private:
  73. _bstr_t GetObjectKey(int nIndex);
  74. private:
  75. long m_lActionId;
  76. IIManageDBPtr m_spDB;
  77. CVarSet m_vsObjects;
  78. };
  79. class CTargetPath
  80. {
  81. public:
  82. CTargetPath();
  83. ~CTargetPath();
  84. void SetContainerPaths(_bstr_t strSourceContainerPath, _bstr_t strTargetContainerPath);
  85. bool NeedsToMove(_bstr_t strSourceObjectPath, _bstr_t strTargetObjectPath);
  86. _bstr_t GetTargetContainerPath();
  87. _bstr_t GetTargetObjectCurrentPath();
  88. private:
  89. bool IsMatch(LPCTSTR pszA, LPCTSTR pszB);
  90. private:
  91. CADsPathName m_pnSourceContainerPath;
  92. CADsPathName m_pnTargetContainerPath;
  93. CADsPathName m_pnTargetObjectOldPath;
  94. CADsPathName m_pnTargetObjectNewPath;
  95. };
  96. class CContainers;
  97. struct SObject
  98. {
  99. SObject(int nIndex, _bstr_t strPath) :
  100. m_nIndex(nIndex),
  101. m_strPath(strPath)
  102. {
  103. }
  104. SObject(const SObject& r) :
  105. m_nIndex(r.m_nIndex),
  106. m_strPath(r.m_strPath)
  107. {
  108. }
  109. SObject& operator =(const SObject& r)
  110. {
  111. m_nIndex = r.m_nIndex;
  112. m_strPath = r.m_strPath;
  113. return *this;
  114. }
  115. int m_nIndex;
  116. _bstr_t m_strPath;
  117. friend CContainers;
  118. };
  119. typedef std::vector<SObject> CObjects;
  120. class CContainers : public std::map<_bstr_t, CObjects>
  121. {
  122. public:
  123. CContainers() {}
  124. void InsertObject(_bstr_t strContainerPath, int nObjectIndex, _bstr_t strObjectPathOld);
  125. };
  126. private:
  127. _bstr_t m_strObjectType;
  128. bool m_bIntraForest;
  129. bool m_bFixReplaced;
  130. _bstr_t m_strSourceContainerPath;
  131. _bstr_t m_strTargetContainerPath;
  132. CMigrated m_Migrated;
  133. CTargetPath m_TargetPath;
  134. CContainers m_Containers;
  135. };