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.

161 lines
4.7 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1997 - 1999 **/
  4. /**********************************************************************/
  5. /*
  6. root.h
  7. Root node information (the root node is not displayed
  8. in the MMC framework but contains information such as
  9. all of the subnodes in this snapin).
  10. FILE HISTORY:
  11. */
  12. #ifndef _ROOT_H
  13. #define _ROOT_H
  14. #ifndef _BASEHAND_H
  15. #include "basehand.h"
  16. #endif
  17. #ifndef _HANDLERS_H
  18. #include "handlers.h"
  19. #endif
  20. #ifndef _QUERYOBJ_H
  21. #include "queryobj.h"
  22. #endif
  23. #ifndef _IPXSTRM_H
  24. #include "ipxstrm.h"
  25. #endif
  26. #ifndef _INFO_H
  27. #include "info.h"
  28. #endif
  29. // The follow two classes are used by the protocol extension root to
  30. // nodes map their connection ID to the appropriate Router Object.
  31. // A Router Object may be an IRouterInfo or an IRtrMgrInfo.
  32. // create this class so that the references get freed up correctly
  33. class RtrObjRecord
  34. {
  35. public:
  36. RtrObjRecord()
  37. {
  38. m_fAddedProtocolNode = FALSE;
  39. m_fComputerAddedAsLocal = FALSE;
  40. }
  41. RtrObjRecord(RtrObjRecord & objRtrObjRecord)
  42. {
  43. *this = objRtrObjRecord;
  44. }
  45. RtrObjRecord & operator = (const RtrObjRecord & objRtrObjRecord)
  46. {
  47. if (this != &objRtrObjRecord)
  48. {
  49. m_riid = objRtrObjRecord.m_riid;
  50. m_spUnk.Set(objRtrObjRecord.m_spUnk.p);
  51. m_fAddedProtocolNode = objRtrObjRecord.m_fAddedProtocolNode;
  52. m_fComputerAddedAsLocal = objRtrObjRecord.m_fComputerAddedAsLocal;
  53. }
  54. return *this;
  55. }
  56. public:
  57. // NOTE: the m_riid is NOT the iid of the m_spUnk. It is used
  58. // as a flag to indicate the type of action to be performed
  59. // on the m_spUnk.
  60. GUID m_riid;
  61. SPIUnknown m_spUnk;
  62. BOOL m_fAddedProtocolNode;
  63. BOOL m_fComputerAddedAsLocal;
  64. };
  65. // hash table for RtrObjRecord records
  66. typedef CMap<LONG_PTR, LONG_PTR, RtrObjRecord, RtrObjRecord&> RtrObjMap;
  67. class RootHandler
  68. : public BaseRouterHandler, public IPersistStreamInit
  69. {
  70. public:
  71. RootHandler(ITFSComponentData *pCompData);
  72. virtual ~RootHandler()
  73. { DEBUG_DECREMENT_INSTANCE_COUNTER(RootHandler); };
  74. DeclareIUnknownMembers(IMPL)
  75. DeclareIPersistStreamInitMembers(IMPL)
  76. // Basic initialization
  77. virtual HRESULT Init();
  78. virtual HRESULT ConstructNode(ITFSNode *pNode);
  79. // Notification overrides
  80. OVERRIDE_BaseHandlerNotify_OnExpand() = 0;
  81. OVERRIDE_BaseHandlerNotify_OnRemoveChildren();
  82. // Handler overrides
  83. OVERRIDE_NodeHandler_OnCreateDataObject() = 0;
  84. // Access ConfigStream
  85. virtual ConfigStream * GetConfigStream() = 0;
  86. // for RtrObj access
  87. HRESULT AddRtrObj(LONG_PTR ulConnId, REFIID riid, IUnknown * pUnk);
  88. HRESULT RemoveRtrObj(LONG_PTR ulConnId);
  89. HRESULT GetRtrObj(LONG_PTR ulConnId, IUnknown ** ppUnk);
  90. HRESULT SetProtocolAdded(LONG_PTR ulConnId, BOOL fProtocolAdded);
  91. BOOL IsProtocolAdded(LONG_PTR ulConnId);
  92. HRESULT SetComputerAddedAsLocal(LONG_PTR ulConnId, BOOL fAddedAsLocal);
  93. BOOL IsComputerAddedAsLocal(LONG_PTR ulConnId);
  94. HRESULT RemoveAllRtrObj();
  95. // For the machine-name to scopeitem map
  96. HRESULT AddScopeItem(LPCTSTR pszMachineName, HSCOPEITEM hScopeItem);
  97. HRESULT GetScopeItem(LPCTSTR pszMachineName, HSCOPEITEM *phScopeItem);
  98. HRESULT RemoveScopeItem(HSCOPEITEM hScopeItem);
  99. // For the HSCOPEITEM to cookie map
  100. HRESULT AddCookie(HSCOPEITEM hScopeItem, MMC_COOKIE cookie);
  101. HRESULT GetCookie(HSCOPEITEM hScopeItem, MMC_COOKIE *pCookie);
  102. HRESULT RemoveCookie(HSCOPEITEM hScopeItem);
  103. // Useful function to remove a node. The CompareNodeToMachineName()
  104. // function must be implemted in order for this to be used.
  105. HRESULT RemoveNode(ITFSNode *pNode, LPCTSTR pszMachineName);
  106. virtual HRESULT CompareNodeToMachineName(ITFSNode *pNode, LPCTSTR pszName);
  107. // Removes all nodes
  108. HRESULT RemoveAllNodes(ITFSNode *pNode);
  109. protected:
  110. SPITFSComponentData m_spTFSCompData;
  111. // maps a refresh connection id to an RtrObj ptr
  112. // This is needed by the refresh code (it gets a conn id).
  113. RtrObjMap m_mapRtrObj;
  114. // maps a machine name to an HSCOPEITEM
  115. // Needed to differentiate among the various nodes.
  116. CMapStringToPtr m_mapScopeItem;
  117. // maps a HSCOPEITEM to a node (or a cookie)
  118. // This is used by the OnRemoveChildren() code (so that
  119. // the correct node gets removed).
  120. CMapPtrToPtr m_mapNode;
  121. };
  122. #endif _ROOT_H