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.

120 lines
2.3 KiB

  1. #pragma once
  2. #include <set>
  3. #include "DomainAccount.h"
  4. #include "DomainContainer.h"
  5. #include "VarSetBase.h"
  6. #include <MigrationMutex.h>
  7. #ifndef StringSet
  8. typedef std::set<_bstr_t> StringSet;
  9. #endif
  10. #define MAXIMUM_PREFIX_SUFFIX_LENGTH 8
  11. //---------------------------------------------------------------------------
  12. // MigrationBase Class
  13. //---------------------------------------------------------------------------
  14. class CMigrationBase
  15. {
  16. public:
  17. void SetInternalInterface(IMigrationInternal* pInternal)
  18. {
  19. m_spInternal = pInternal;
  20. }
  21. protected:
  22. CMigrationBase();
  23. ~CMigrationBase();
  24. void InitSourceDomainAndContainer();
  25. void InitTargetDomainAndContainer();
  26. void VerifyInterIntraForest();
  27. CContainer& GetSourceContainer()
  28. {
  29. if (m_SourceContainer)
  30. {
  31. return m_SourceContainer;
  32. }
  33. else
  34. {
  35. return m_SourceDomain;
  36. }
  37. }
  38. CContainer& GetTargetContainer()
  39. {
  40. if (m_TargetContainer)
  41. {
  42. return m_TargetContainer;
  43. }
  44. else
  45. {
  46. return m_TargetDomain;
  47. }
  48. }
  49. void DoOption(long lOptions, VARIANT& vntInclude, VARIANT& vntExclude);
  50. virtual void DoNone();
  51. virtual void DoNames();
  52. virtual void DoDomain();
  53. void FillInVarSetForUsers(CDomainAccounts& rUsers, CVarSet& rVarSet);
  54. void FillInVarSetForGroups(CDomainAccounts& rGroups, CVarSet& rVarSet);
  55. void FillInVarSetForComputers(CDomainAccounts& rComputers, bool bMigrateOnly, bool bMoveToTarget, bool bReboot, long lRebootDelay, CVarSet& rVarSet);
  56. void MutexWait()
  57. {
  58. m_Mutex.ObtainOwnership();
  59. }
  60. void MutexRelease()
  61. {
  62. m_Mutex.ReleaseOwnership();
  63. }
  64. void VerifyRenameConflictPrefixSuffixValid();
  65. void VerifyCanAddSidHistory();
  66. void VerifyTargetContainerPathLength();
  67. void VerifyPasswordOption();
  68. void PerformMigration(CVarSet& rVarSet);
  69. void SaveSettings(CVarSet& rVarSet)
  70. {
  71. IIManageDBPtr spDatabase(__uuidof(IManageDB));
  72. spDatabase->SaveSettings(IUnknownPtr(rVarSet.GetInterface()));
  73. }
  74. void FixObjectsInHierarchy(LPCTSTR pszType);
  75. protected:
  76. void InitRecurseMaintainOption(long lOptions);
  77. void GetExcludeNames(VARIANT& vntExclude, StringSet& setExcludeNames);
  78. protected:
  79. IMigrationInternalPtr m_spInternal;
  80. CDomain m_SourceDomain;
  81. CContainer m_SourceContainer;
  82. CDomain m_TargetDomain;
  83. CContainer m_TargetContainer;
  84. int m_nRecurseMaintain;
  85. StringSet m_setIncludeNames;
  86. StringSet m_setExcludeNames;
  87. CMigrationMutex m_Mutex;
  88. };