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.

275 lines
6.2 KiB

  1. //+--------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1994 - 1998.
  5. //
  6. // File: ScopeManager.hxx
  7. //
  8. // Contents: Declaration of class used to hold scope object hierarchy
  9. //
  10. // Classes: CScopeManager
  11. //
  12. // History: 02-24-2000 davidmun Created
  13. //
  14. //---------------------------------------------------------------------------
  15. #ifndef __SCOPE_MANAGER_HXX_
  16. #define __SCOPE_MANAGER_HXX_
  17. class CDomainInfo;
  18. //+--------------------------------------------------------------------------
  19. //
  20. // Class: CScopeManager (sm)
  21. //
  22. // Purpose: Maintain a tree of CScope-derived objects, and provide access
  23. // to them via methods that return the currently selected scope,
  24. // the scope with a given name, etc.
  25. //
  26. // History: 05-24-2000 DavidMun Created
  27. //
  28. // Notes: This object owns the Look In dialog.
  29. //
  30. //---------------------------------------------------------------------------
  31. class CScopeManager
  32. {
  33. public:
  34. CScopeManager(
  35. const CObjectPicker &ropContaining):
  36. m_rop(ropContaining),
  37. m_hScopeImageList(NULL),
  38. m_StartingScopeType(ST_INVALID)
  39. {
  40. TRACE_CONSTRUCTOR(CScopeManager);
  41. m_rpInvalidScope.Acquire(new CInvalidScope(ropContaining));
  42. }
  43. ~CScopeManager()
  44. {
  45. TRACE_DESTRUCTOR(CScopeManager);
  46. Clear();
  47. if (m_hScopeImageList)
  48. {
  49. ImageList_Destroy(m_hScopeImageList);
  50. m_hScopeImageList = NULL;
  51. }
  52. }
  53. HRESULT
  54. Initialize(
  55. PCDSOP_INIT_INFO pInitInfo);
  56. const CScope &
  57. AddUserEnteredScope(
  58. const ADD_SCOPE_INFO &asi) const;
  59. const CScope &
  60. CScopeManager::AddCrossForestDomainScope(
  61. const ADD_SCOPE_INFO &asi) const;
  62. void
  63. Clear();
  64. const SScopeParameters *
  65. GetScopeParams(
  66. SCOPE_TYPE Type) const;
  67. void
  68. GetRootScopeIterators(
  69. vector<RpScope>::const_iterator *pitBegin,
  70. vector<RpScope>::const_iterator *pitEnd) const
  71. {
  72. ASSERT(pitBegin && pitEnd);
  73. if (!pitBegin || !pitEnd)
  74. {
  75. return;
  76. }
  77. *pitBegin = m_vrpRootScopes.begin();
  78. *pitEnd = m_vrpRootScopes.end();
  79. }
  80. #if (DBG == 1)
  81. BOOL
  82. IsValidScope(
  83. CScope *pScope) const;
  84. #endif // (DBG == 1)
  85. void
  86. DoLookInDialog(
  87. HWND hwndParent) const;
  88. const String &
  89. GetContainerFilter(
  90. HWND hwnd) const
  91. {
  92. TRACE_METHOD(CScopeManager, GetContainerFilter);
  93. if (m_strContainerFilter.empty())
  94. {
  95. _InitContainerFilter(hwnd);
  96. }
  97. return m_strContainerFilter;
  98. }
  99. const CScope &
  100. GetCurScope() const
  101. {
  102. if (m_rpCurScope.get())
  103. {
  104. return *m_rpCurScope.get();
  105. }
  106. return *m_rpInvalidScope.get();
  107. }
  108. const CScope &
  109. GetStartingScope() const
  110. {
  111. if (m_rpStartingScope.get())
  112. {
  113. return *m_rpStartingScope.get();
  114. }
  115. return *m_rpInvalidScope.get();
  116. }
  117. const CScope &
  118. GetParent(
  119. const CScope &Child) const;
  120. const CScope &
  121. LookupScopeByDisplayName(
  122. const String &strDisplayName) const;
  123. const CScope &
  124. LookupScopeByFlatName(
  125. const String &strFlatName) const;
  126. const CScope &
  127. LookupScopeByType(
  128. SCOPE_TYPE Type) const
  129. {
  130. return _LookupScopeByType(Type,
  131. m_vrpRootScopes.begin(),
  132. m_vrpRootScopes.end());
  133. }
  134. const CScope &
  135. LookupScopeById(
  136. ULONG id) const
  137. {
  138. return _LookupScopeById(id,
  139. m_vrpRootScopes.begin(),
  140. m_vrpRootScopes.end());
  141. }
  142. VOID
  143. DeleteLastScope() const
  144. {
  145. m_vrpRootScopes.pop_back();
  146. }
  147. private:
  148. CScopeManager &
  149. operator=(const CScopeManager &);
  150. enum SCOPE_NAME_TYPE
  151. {
  152. NAME_IS_DISPLAY_NAME,
  153. NAME_IS_FLAT_NAME
  154. };
  155. HRESULT
  156. _ValidateFilterFlags(
  157. PCDSOP_SCOPE_INIT_INFO pScopeInit,
  158. ULONG flScopeTypes);
  159. void
  160. _InitDomainScopesJoinedNt5(
  161. CGcScope *pGcScope);
  162. void
  163. _AddTreeJoinedNt5(
  164. CLdapContainerScope *pParent,
  165. ULONG idxCur,
  166. CDomainInfo *adi,
  167. PDS_DOMAIN_TRUSTS Domains);
  168. void
  169. _InitScopesJoinedNt4();
  170. void
  171. _InitContainerFilter(
  172. HWND hwnd) const;
  173. const CScope &
  174. _LookupScopeByName(
  175. const String &strName,
  176. SCOPE_NAME_TYPE NameIs,
  177. vector<RpScope>::const_iterator itBegin,
  178. vector<RpScope>::const_iterator itEnd) const;
  179. const CScope &
  180. _LookupScopeByType(
  181. SCOPE_TYPE Type,
  182. vector<RpScope>::const_iterator itBegin,
  183. vector<RpScope>::const_iterator itEnd) const;
  184. const CScope &
  185. _LookupScopeById(
  186. ULONG id,
  187. vector<RpScope>::const_iterator itBegin,
  188. vector<RpScope>::const_iterator itEnd) const;
  189. void
  190. _AddRootTrustScopes
  191. (
  192. vector<ADD_SCOPE_INFO> &asiv,
  193. const SScopeParameters *pspExternalUplevel
  194. );
  195. NET_API_STATUS
  196. MyDsEnumerateDomainTrusts
  197. (
  198. LPWSTR pwzTarget,
  199. ULONG flags,
  200. PDS_DOMAIN_TRUSTS *Domains,
  201. ULONG *cDomains
  202. );
  203. #if (DBG == 1)
  204. BOOL
  205. _IsChildScope(
  206. CScope *pParent,
  207. CScope *pMaybeChild) const;
  208. #endif // (DBG == 1)
  209. // used as error return for returning reference to scope
  210. RpScope m_rpInvalidScope;
  211. const CObjectPicker &m_rop;
  212. mutable vector<RpScope> m_vrpRootScopes;
  213. vector<SScopeParameters> m_vScopeParameters;
  214. HIMAGELIST m_hScopeImageList;
  215. SCOPE_TYPE m_StartingScopeType;
  216. RpScope m_rpStartingScope;
  217. mutable RpScope m_rpCurScope;
  218. mutable String m_strContainerFilter;
  219. };
  220. #endif // __SCOPE_MANAGER_HXX_