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.

292 lines
6.8 KiB

  1. /*++
  2. Module Name:
  3. MmcAdmin.h
  4. Abstract:
  5. This module contains the definition for CMmcDfsAdmin. This is an class
  6. for MMC display related calls for the static node(the DFS Admin root node)
  7. Also contains code use to wrap a list of Dfs Roots.
  8. --*/
  9. #if !defined(AFX_MMCDFSADMIN_H__2CC64E54_3BF4_11D1_AA17_00C06C00392D__INCLUDED_)
  10. #define AFX_MMCDFSADMIN_H__2CC64E54_3BF4_11D1_AA17_00C06C00392D__INCLUDED_
  11. #if _MSC_VER >= 1000
  12. #pragma once
  13. #endif // _MSC_VER >= 1000
  14. #include "MmcDispl.h"
  15. #include "connect.h"
  16. #include "MmcRoot.h"
  17. #include "DfsCore.h"
  18. #include <list>
  19. using namespace std;
  20. class CMmcDfsAdmin;
  21. class CDfsSnapinScopeManager;
  22. // This structure defines a node of the list of Dfs Roots
  23. // added to the snapin. This is maintained internally by the CMmcDfsAdmin
  24. class DFS_ROOT_NODE
  25. {
  26. public:
  27. DFS_ROOT_NODE(CMmcDfsRoot* i_pMmcDfsRoot, BSTR i_bstrRootEntryPath)
  28. {
  29. m_pMmcDfsRoot = i_pMmcDfsRoot;
  30. // Get server name from the DfsDfsRoot Object. This is used
  31. // to persist.
  32. m_bstrRootEntryPath = i_bstrRootEntryPath;
  33. };
  34. ~DFS_ROOT_NODE()
  35. {
  36. SAFE_RELEASE(m_pMmcDfsRoot);
  37. };
  38. CComBSTR m_bstrRootEntryPath; // Root Entry path of the Dfs Volume
  39. CMmcDfsRoot* m_pMmcDfsRoot; // DfsRoot class for MMC display
  40. };
  41. typedef list<DFS_ROOT_NODE*> DFS_ROOT_LIST;
  42. class CMmcDfsAdmin : public CMmcDisplay
  43. {
  44. public:
  45. CMmcDfsAdmin( CDfsSnapinScopeManager* pScopeManager );
  46. virtual ~CMmcDfsAdmin();
  47. // For adding context menu items
  48. STDMETHOD(AddMenuItems)(
  49. IN LPCONTEXTMENUCALLBACK i_lpContextMenuCallback,
  50. IN LPLONG i_lpInsertionAllowed
  51. );
  52. // For taking action on a context menu selection.
  53. STDMETHOD(Command)(
  54. IN LONG i_lCommandID
  55. );
  56. // Set the headers for the listview (in the result pane) column
  57. STDMETHOD(SetColumnHeader)(
  58. IN LPHEADERCTRL2 i_piHeaderControl
  59. );
  60. // Return the requested display information for the Result Pane
  61. STDMETHOD(GetResultDisplayInfo)(
  62. IN OUT LPRESULTDATAITEM io_pResultDataItem
  63. ) { return S_OK; };
  64. // Return the requested display information for the Scope Pane
  65. STDMETHOD(GetScopeDisplayInfo)(
  66. IN OUT LPSCOPEDATAITEM io_pScopeDataItem
  67. ) { return S_OK; };
  68. // Add all the items to the Scope Pane
  69. STDMETHOD(EnumerateScopePane)(
  70. IN LPCONSOLENAMESPACE i_lpConsoleNameSpace,
  71. IN HSCOPEITEM i_hParent
  72. );
  73. // Add items(or folders), if any to the Result Pane
  74. STDMETHOD(EnumerateResultPane)(
  75. IN OUT IResultData* io_pResultData
  76. ) { return S_OK; };
  77. // Returns the pointer to the list of DfsRoots currently added to the Snapin.
  78. STDMETHOD(GetList)(
  79. OUT DFS_ROOT_LIST** o_pList
  80. );
  81. // This method checks if DfsRoot is already added to the list.
  82. STDMETHOD(IsAlreadyInList)(
  83. IN BSTR i_bstrDfsRootServerName,
  84. OUT CMmcDfsRoot **o_ppMmcDfsRoot = NULL
  85. );
  86. // Delete the node from m_RootList
  87. STDMETHOD(DeleteMmcRootNode)(
  88. IN CMmcDfsRoot* i_pMmcDfsRoot
  89. );
  90. // Add a Dfs root to the list and scope pane
  91. STDMETHOD(AddDfsRoot)(
  92. IN BSTR i_bstrDfsRootName
  93. );
  94. // Add a Dfs root to the list.
  95. STDMETHOD(AddDfsRootToList)(
  96. IN IDfsRoot* i_pDfsRoot, // IDfsRoot pointer of the DfsRoot.
  97. IN ULONG i_ulLinkFilterMaxLimit = FILTERDFSLINKS_MAXLIMIT_DEFAULT,
  98. IN FILTERDFSLINKS_TYPE i_lLinkFilterType = FILTERDFSLINKS_TYPE_NO_FILTER,
  99. IN BSTR i_bstrLinkFilterName = NULL
  100. );
  101. // Set the console verb settings. Change the state, decide the default verb, etc
  102. STDMETHOD(SetConsoleVerbs)(
  103. IN LPCONSOLEVERB i_lpConsoleVerb
  104. );
  105. // let MMC handle the default verb.
  106. STDMETHOD(DoDblClick)(
  107. ) { return S_FALSE; }
  108. // Delete the current item.
  109. STDMETHOD(DoDelete)(
  110. ) { return S_FALSE; };
  111. // Checks whether the object has pages to display
  112. STDMETHOD(QueryPagesFor)(
  113. ) { return S_FALSE; };
  114. // Creates and passes back the pages to be displayed
  115. STDMETHOD(CreatePropertyPages)(
  116. IN LPPROPERTYSHEETCALLBACK i_lpPropSheetCallback,
  117. IN LONG_PTR i_lNotifyHandle
  118. ) { return E_UNEXPECTED; };
  119. // Used to notify the object that it's properties have changed
  120. STDMETHOD(PropertyChanged)(
  121. ) { return E_UNEXPECTED; };
  122. // Used to set the result view description bar text
  123. STDMETHOD(SetDescriptionBarText)(
  124. IN LPRESULTDATA i_lpResultData
  125. );
  126. STDMETHOD(SetStatusText)(
  127. IN LPCONSOLE2 i_lpConsole
  128. )
  129. {
  130. RETURN_INVALIDARG_IF_NULL(i_lpConsole);
  131. return i_lpConsole->SetStatusText(NULL);
  132. }
  133. // Handle a select event for the node. Handle only toolbar related
  134. // activities here
  135. STDMETHOD(ToolbarSelect)(
  136. IN const LONG i_lArg,
  137. IN IToolbar* i_pToolBar
  138. );
  139. // Handle a click on the toolbar
  140. STDMETHOD(ToolbarClick)(
  141. IN const LPCONTROLBAR i_pControlbar,
  142. IN const LPARAM i_lParam
  143. );
  144. STDMETHOD(CleanScopeChildren)(
  145. VOID
  146. );
  147. STDMETHOD(CleanResultChildren)(
  148. ) { return S_OK; };
  149. STDMETHOD(ViewChange)(
  150. IResultData* i_pResultData,
  151. LONG_PTR i_lHint
  152. ) { return S_OK; };
  153. // Getters/Setters
  154. public:
  155. // Get the value of the dirty flag
  156. bool GetDirty() { return m_bDirty; }
  157. // Set the value of the dirty flag
  158. void SetDirty(IN bool i_bDirty) { m_bDirty = i_bDirty; }
  159. HRESULT PutConsolePtr(
  160. IN const LPCONSOLE2 i_lpConsole
  161. );
  162. STDMETHOD(OnNewDfsRoot)(
  163. );
  164. DISPLAY_OBJECT_TYPE GetDisplayObjectType(
  165. )
  166. {
  167. return DISPLAY_OBJECT_TYPE_ADMIN;
  168. };
  169. HRESULT CreateToolbar(
  170. IN const LPCONTROLBAR i_pControlbar,
  171. IN const LPEXTENDCONTROLBAR i_lExtendControlbar,
  172. OUT IToolbar** o_pToolBar
  173. );
  174. HRESULT OnRefresh();
  175. virtual HRESULT OnAddImages(IImageList *pImageList, HSCOPEITEM hsi);
  176. // Helper methods
  177. private:
  178. // Menu Command handlers
  179. STDMETHOD(OnConnectTo)(
  180. );
  181. STDMETHOD(GetEntryPath)(
  182. BSTR* o_pbstrEntryPath
  183. ) { return E_NOTIMPL;};
  184. // Data members
  185. private:
  186. DFS_ROOT_LIST m_RootList; // The list of Dfs Roots added to the snap-in
  187. HSCOPEITEM m_hItemParent; // Parent of all nodes added in the Scope Pane
  188. CComPtr<IConsoleNameSpace> m_lpConsoleNameSpace; // The Callback used to do Scope Pane operations
  189. CComPtr<IConsole2> m_lpConsole; // The Console callback. The mother of all mmc interfaces
  190. bool m_bDirty; // Dirty flag used while saving the console
  191. public:
  192. CDfsSnapinScopeManager* m_pScopeManager; // The corresponding Scope Manager object
  193. };
  194. #endif // !defined(AFX_MMCDFSADMIN_H__2CC64E54_3BF4_11D1_AA17_00C06C00392D__INCLUDED_)