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.

391 lines
10 KiB

  1. /*++
  2. Module Name:
  3. MmcRoot.h
  4. Abstract:
  5. This module contains the definition for CMmcDfsRoot class. This is an class
  6. for MMC display related calls for the first level node(the DfsRoot nodes)
  7. Also contains members and method to be able to manipulate IDfsRoot object
  8. and add the same to the MMC Console
  9. --*/
  10. #if !defined(AFX_MMCDFSROOT_H__D78B64F3_3E2B_11D1_AA1A_00C06C00392D__INCLUDED_)
  11. #define AFX_MMCDFSROOT_H__D78B64F3_3E2B_11D1_AA1A_00C06C00392D__INCLUDED_
  12. #if _MSC_VER >= 1000
  13. #pragma once
  14. #endif // _MSC_VER >= 1000
  15. #include "MmcDispl.h"
  16. #include "DfsCore.h"
  17. #include "JPProp.h"
  18. #include "frsProp.h"
  19. #include "pubProp.h"
  20. #include "DfsEnums.h"
  21. #include <list>
  22. using namespace std;
  23. class CMmcDfsAdmin;
  24. class CMmcDfsJunctionPoint;
  25. class CMmcDfsReplica;
  26. class JP_LIST_NODE
  27. {
  28. public:
  29. CMmcDfsJunctionPoint* pJPoint;
  30. JP_LIST_NODE (CMmcDfsJunctionPoint* i_pMmcJP); // constructor defined as inline in MmcJp.cpp
  31. ~JP_LIST_NODE (); // destructor defined as inline in MmcJp.cpp
  32. };
  33. typedef list<JP_LIST_NODE*> DFS_JUNCTION_LIST;
  34. class REP_LIST_NODE
  35. {
  36. public:
  37. CMmcDfsReplica* pReplica;
  38. REP_LIST_NODE (CMmcDfsReplica* i_pMmcReplica); // constructor defined as inline in MmcRep.cpp
  39. ~REP_LIST_NODE (); // destructor defined as inline in MmcRep.cpp
  40. };
  41. typedef list<REP_LIST_NODE*> DFS_REPLICA_LIST;
  42. enum SCHEMA_VERSION {
  43. SCHEMA_VERSION_UNKNOWN = 0,
  44. SCHEMA_VERSION_NEW,
  45. SCHEMA_VERSION_OLD
  46. };
  47. class CMmcDfsRoot : public CMmcDisplay
  48. {
  49. public:
  50. CMmcDfsRoot(
  51. IN IDfsRoot* i_pDfsRoot,
  52. IN CMmcDfsAdmin* i_pMmcDfsAdmin,
  53. IN LPCONSOLE2 i_lpConsole,
  54. IN ULONG i_ulLinkFilterMaxLimit = FILTERDFSLINKS_MAXLIMIT_DEFAULT,
  55. IN FILTERDFSLINKS_TYPE i_lLinkFilterType = FILTERDFSLINKS_TYPE_NO_FILTER,
  56. IN BSTR i_bstrLinkFilterName = NULL
  57. );
  58. virtual ~CMmcDfsRoot();
  59. // Not implemented
  60. private:
  61. CMmcDfsRoot();
  62. public:
  63. // For adding context menu items
  64. STDMETHOD(AddMenuItems)(
  65. IN LPCONTEXTMENUCALLBACK i_lpContextMenuCallback,
  66. IN LPLONG i_lpInsertionAllowed
  67. );
  68. // For taking action on a context menu selection.
  69. STDMETHOD(Command)(
  70. IN LONG i_lCommandID
  71. );
  72. // Set the headers for the listview (in the result pane) column
  73. STDMETHOD(SetColumnHeader)(
  74. IN LPHEADERCTRL2 i_piHeaderControl
  75. );
  76. // Return the requested display information for the Result Pane
  77. STDMETHOD(GetResultDisplayInfo)(
  78. IN OUT LPRESULTDATAITEM io_pResultDataItem
  79. );
  80. // Return the requested display information for the Scope Pane
  81. STDMETHOD(GetScopeDisplayInfo)(
  82. IN OUT LPSCOPEDATAITEM io_pScopeDataItem
  83. );
  84. // Add all containing items to the Scope Pane
  85. STDMETHOD(EnumerateScopePane)(
  86. IN LPCONSOLENAMESPACE i_lpConsoleNameSpace,
  87. IN HSCOPEITEM i_hParent
  88. );
  89. // Add all containing items to the Result Pane
  90. STDMETHOD(EnumerateResultPane)(
  91. IN OUT IResultData* io_pResultData
  92. );
  93. // Delete the node from m_MmcJPList
  94. STDMETHOD(DeleteMmcJPNode)(
  95. IN CMmcDfsJunctionPoint* i_pJPoint,
  96. IN BOOL i_bRefresh = TRUE
  97. );
  98. // Delete the current object
  99. STDMETHOD(OnDeleteConnectionToDfsRoot)(
  100. BOOLEAN i_bForRemoveDfs = FALSE
  101. );
  102. // Add the current item to the Scope Pane
  103. STDMETHOD(AddItemToScopePane)(
  104. IN LPCONSOLENAMESPACE i_lpConsoleNameSpace,
  105. IN HSCOPEITEM i_hParent
  106. );
  107. // Set the console verb settings. Change the state, decide the default verb, etc
  108. STDMETHOD(SetConsoleVerbs)(
  109. IN LPCONSOLEVERB i_lpConsoleVerb
  110. );
  111. // let MMC handle the default verb.
  112. STDMETHOD(DoDblClick)(
  113. ) { return S_FALSE; }
  114. // Delete the current item.
  115. STDMETHOD(DoDelete)(
  116. );
  117. // Checks whether the object has pages to display
  118. STDMETHOD(QueryPagesFor)(
  119. );
  120. // Creates and passes back the pages to be displayed
  121. STDMETHOD(CreatePropertyPages)(
  122. IN LPPROPERTYSHEETCALLBACK i_lpPropSheetCallback,
  123. IN LONG_PTR i_lNotifyHandle
  124. );
  125. STDMETHOD(CreateFrsPropertyPage)(
  126. IN LPPROPERTYSHEETCALLBACK i_lpPropSheetCallback,
  127. IN LONG_PTR i_lNotifyHandle
  128. );
  129. STDMETHOD(CreatePublishPropertyPage)(
  130. IN LPPROPERTYSHEETCALLBACK i_lpPropSheetCallback,
  131. IN LONG_PTR i_lNotifyHandle
  132. );
  133. // Used to notify the object that it's properties have changed
  134. STDMETHOD(PropertyChanged)(
  135. );
  136. // Used to set the result view description bar text
  137. STDMETHOD(SetDescriptionBarText)(
  138. IN LPRESULTDATA i_lpResultData
  139. );
  140. STDMETHOD(SetStatusText)(
  141. IN LPCONSOLE2 i_lpConsole
  142. );
  143. // Delete the Remove (Stop hosting) the Dfs Root.
  144. STDMETHOD(OnDeleteDfsRoot)(
  145. );
  146. STDMETHOD(OnDeleteDisplayedDfsLinks)(
  147. );
  148. // Handle a select event for the node. Handle only toolbar related
  149. // activities here
  150. STDMETHOD(ToolbarSelect)(
  151. IN const LONG i_lArg,
  152. IN IToolbar* i_pToolBar
  153. );
  154. // Handle a click on the toolbar
  155. STDMETHOD(ToolbarClick)(
  156. IN const LPCONTROLBAR i_pControlbar,
  157. IN const LPARAM i_lParam
  158. );
  159. // Handle the menu item (and toolbar) for root replica.
  160. STDMETHOD(OnNewRootReplica)(
  161. );
  162. // Helper member function to actually delete (Stop hosting) the Dfs Root.
  163. // This is also called to delete root level replica.
  164. HRESULT _DeleteDfsRoot(
  165. IN BSTR i_bstrServerName,
  166. IN BSTR i_bstrShareName,
  167. IN BSTR i_bstrFtDfsName
  168. );
  169. STDMETHOD(RemoveFromMMC)();
  170. STDMETHOD(CleanScopeChildren)(
  171. VOID
  172. );
  173. STDMETHOD(CleanResultChildren)(
  174. );
  175. STDMETHOD(RefreshResultChildren)(
  176. );
  177. STDMETHOD(ViewChange)(
  178. IResultData* i_pResultData,
  179. LONG_PTR i_lHint
  180. );
  181. STDMETHOD(AddResultPaneItem)(
  182. CMmcDfsReplica* i_pReplicaDispObject
  183. );
  184. STDMETHOD(RemoveJP)(CMmcDfsJunctionPoint *i_pJPoint, LPCTSTR i_pszDisplayName);
  185. STDMETHOD(RemoveReplica)(LPCTSTR i_pszDisplayName);
  186. STDMETHOD(RemoveResultPaneItem)(
  187. CMmcDfsReplica* i_pReplicaDispObject
  188. );
  189. // Check the replica status
  190. STDMETHOD(OnCheckStatus)(
  191. );
  192. STDMETHOD(GetEntryPath)(BSTR* o_pbstrEntryPath)
  193. { GET_BSTR(m_bstrRootEntryPath, o_pbstrEntryPath); }
  194. DISPLAY_OBJECT_TYPE GetDisplayObjectType() { return DISPLAY_OBJECT_TYPE_ROOT; }
  195. HRESULT CreateToolbar(
  196. IN const LPCONTROLBAR i_pControlbar,
  197. IN const LPEXTENDCONTROLBAR i_lExtendControlbar,
  198. OUT IToolbar** o_ppToolBar
  199. );
  200. HRESULT OnRefresh(
  201. );
  202. HRESULT OnRefreshFilteredLinks(
  203. );
  204. STDMETHOD(OnFilterDfsLinks)();
  205. ULONG get_LinkFilterMaxLimit() { return m_ulLinkFilterMaxLimit; }
  206. FILTERDFSLINKS_TYPE get_LinkFilterType() { return m_lLinkFilterType; }
  207. BSTR get_LinkFilterName() { return (BSTR)m_bstrLinkFilterName; }
  208. BOOL get_ShowFRS() { return m_bShowFRS; }
  209. HRESULT ClosePropertySheet(BOOL bSilent);
  210. HRESULT ClosePropertySheetsOfAllLinks(BOOL bSilent);
  211. HRESULT CloseAllPropertySheets(BOOL bSilent);
  212. private:
  213. // Create a new junction point. Displays the dialog box and call the other method
  214. STDMETHOD(OnCreateNewJunctionPoint)();
  215. // Create a new junction point.
  216. STDMETHOD(OnCreateNewJunctionPoint)(
  217. IN LPCTSTR i_szJPName,
  218. IN LPCTSTR i_szServerName,
  219. IN LPCTSTR i_szShareName,
  220. IN LPCTSTR i_szComment,
  221. IN long i_lTimeOut
  222. );
  223. HRESULT OnNewReplicaSet();
  224. HRESULT OnShowReplication();
  225. HRESULT OnStopReplication(BOOL bConfirm = FALSE, BOOL bRefresh=TRUE);
  226. HRESULT GetIReplicaSetPtr(IReplicaSet** o_ppiReplicaSet);
  227. // Confirm the delete operation with the user.
  228. HRESULT ConfirmOperationOnDfsRoot(int idString);
  229. HRESULT ConfirmDeleteDisplayedDfsLinks(
  230. );
  231. HRESULT _InitReplicaSet(); // init m_piReplicaSet
  232. BOOL IsNewSchema();
  233. // Constants, Statics, etc
  234. public:
  235. static const int m_iIMAGEINDEX;
  236. static const int m_iOPENIMAGEINDEX;
  237. // Data members
  238. private:
  239. friend class CMmcDfsJunctionPoint;
  240. friend class CMmcDfsReplica; // so that MmcJP can access m_DfsRoot;
  241. CComPtr<IDfsRoot> m_DfsRoot; // IDfsRoot object
  242. CComPtr<IReplicaSet> m_piReplicaSet;
  243. CComBSTR m_bstrDisplayName; // Display name of the current DfsRoot
  244. CComBSTR m_bstrRootEntryPath; // Root EntryPath;
  245. DFS_TYPE m_lDfsRootType; // Type of the DfsRoot, Standalone or Fault Tolerant
  246. long m_lRootJunctionState;
  247. HSCOPEITEM m_hScopeItem; // Scopeitem handle
  248. CMmcDfsAdmin* m_pParent; // Pointer to the parent
  249. DFS_JUNCTION_LIST m_MmcJPList; // The list of child Junction points
  250. DFS_REPLICA_LIST m_MmcRepList; // The list of replicas
  251. CComBSTR m_bstrFullDisplayName;
  252. ULONG m_ulLinkFilterMaxLimit;
  253. FILTERDFSLINKS_TYPE m_lLinkFilterType;
  254. CComBSTR m_bstrLinkFilterName; // string filter on junction points
  255. ULONG m_ulCountOfDfsJunctionPointsFiltered;
  256. CReplicaSetPropPage m_PropPage; // The property page
  257. CRealReplicaSetPropPage m_frsPropPage;
  258. BOOL m_bShowFRS;
  259. enum SCHEMA_VERSION m_enumNewSchema;
  260. CPublishPropPage m_publishPropPage;
  261. CComPtr<IConsole2> m_lpConsole; // The Console callback. The mother of all mmc interfaces
  262. CComPtr<IConsoleNameSpace> m_lpConsoleNameSpace; // The Callback used to do Scope Pane operations
  263. };
  264. #endif // !defined(AFX_MMCDFSROOT_H__D78B64F3_3E2B_11D1_AA1A_00C06C00392D__INCLUDED_)