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.

154 lines
4.8 KiB

  1. #ifndef MYNODES_H
  2. #define MYNODES_H
  3. #include "NetNode.h"
  4. #include "resource.h"
  5. #include <comdef.h>
  6. //#include "..\\Common\\Common.hpp"
  7. //#include "..\\Common\\UString.hpp"
  8. #include "Common.hpp"
  9. #include "UString.hpp"
  10. class CRootNode : public CNetNode<CRootNode>
  11. {
  12. public:
  13. static const GUID* m_NODETYPE;
  14. static const OLECHAR* m_SZNODETYPE;
  15. static const OLECHAR* m_SZDISPLAY_NAME;
  16. static const CLSID* m_SNAPIN_CLASSID;
  17. BEGIN_SNAPINCOMMAND_MAP(CRootNode, FALSE)
  18. SNAPINCOMMAND_ENTRY(ID_TOP_MIGRATEUSERSANDGROUPS, OnMigrateUsers )
  19. SNAPINCOMMAND_ENTRY(ID_TOP_MIGRATEGROUPS, OnMigrateGroups )
  20. SNAPINCOMMAND_ENTRY(ID_TOP_MIGRATECOMPUTERS, OnMigrateComputers )
  21. SNAPINCOMMAND_ENTRY(ID_TOP_TRANSLATESECURITY, OnTranslateSecurity )
  22. SNAPINCOMMAND_ENTRY(ID_TOP_UNDO, OnUndo )
  23. SNAPINCOMMAND_ENTRY(ID_TOP_MIGRATEEXCHANGESERVER, OnMigrateExchangeServer )
  24. SNAPINCOMMAND_ENTRY(ID_TOP_MIGRATEEXCHANGEDIRECTORY, OnMigrateExchangeDirectory )
  25. SNAPINCOMMAND_ENTRY(ID_TOP_MIGRATESERVICEACCOUNTS, OnMigrateServiceAccounts )
  26. SNAPINCOMMAND_ENTRY(ID_TOP_REPORTING, OnReporting )
  27. SNAPINCOMMAND_ENTRY(ID_TOP_RETRY, OnRetry )
  28. SNAPINCOMMAND_ENTRY(ID_TOP_MIGRATETRUSTS, OnMigrateTrusts )
  29. SNAPINCOMMAND_ENTRY(ID_TOP_GROUPMAPPING, OnGroupMapping )
  30. //SNAPINCOMMAND_ENTRY(ID_VIEW_VERSION, OnVersionInfo )
  31. END_SNAPINCOMMAND_MAP()
  32. SNAPINMENUID(IDR_ROOT_MENU)
  33. CRootNode();
  34. ~CRootNode();
  35. void SetMainWindow(HWND hwndMainWindow)
  36. {
  37. m_hwndMainWindow = hwndMainWindow;
  38. }
  39. void CheckForFailedActions(BOOL bPrompt = TRUE);
  40. void UpdateMenuState(UINT id, LPTSTR pBuf, UINT *flags);
  41. HRESULT OnGroupMapping(bool &bHandled, CSnapInObjectRootBase* pObj);
  42. HRESULT OnMigrateUsers(bool &bHandled, CSnapInObjectRootBase* pObj);
  43. HRESULT OnUndo(bool &bHandled, CSnapInObjectRootBase* pObj);
  44. HRESULT OnMigrateGroups(bool &bHandled, CSnapInObjectRootBase* pObj);
  45. HRESULT OnMigrateComputers(bool &bHandled, CSnapInObjectRootBase* pObj);
  46. HRESULT OnTranslateSecurity(bool &bHandled, CSnapInObjectRootBase* pObj);
  47. HRESULT OnMigrateExchangeServer(bool &bHandled, CSnapInObjectRootBase* pObj);
  48. HRESULT OnMigrateExchangeDirectory(bool &bHandled, CSnapInObjectRootBase* pObj);
  49. HRESULT OnMigrateServiceAccounts(bool &bHandled, CSnapInObjectRootBase* pObj);
  50. HRESULT OnReporting(bool &bHandled, CSnapInObjectRootBase* pObj);
  51. HRESULT OnRetry(bool &bHandled, CSnapInObjectRootBase* pObj);
  52. HRESULT OnMigrateTrusts(bool &bHandled, CSnapInObjectRootBase* pObj);
  53. private:
  54. HWND m_hwndMainWindow;
  55. bool IsUndoable;
  56. bool CanUseST;
  57. bool CanRetry;
  58. void CheckUndoable();
  59. void CheckForST();
  60. void UpdateMigratedObjectsTable();
  61. void UpdateAccountReferenceTable();
  62. };
  63. class CReportingNode : public CNetNode<CReportingNode>
  64. {
  65. UINT m_idHTML;
  66. WCHAR m_htmlPath[MAX_PATH];
  67. CReportingNode * m_Reports[5];
  68. public:
  69. BEGIN_SNAPINCOMMAND_MAP(CReportingNode, FALSE)
  70. //SNAPINCOMMAND_ENTRY(ID_VIEW_VERSION, OnVersionInfo )
  71. END_SNAPINCOMMAND_MAP()
  72. SNAPINMENUID(IDR_REPORTS)
  73. CReportingNode();
  74. static const GUID* m_NODETYPE;
  75. static const OLECHAR* m_SZNODETYPE;
  76. static const OLECHAR* m_SZDISPLAY_NAME;
  77. static const CLSID* m_SNAPIN_CLASSID;
  78. void SetHtmlPath(WCHAR const * title, WCHAR const * path) { m_bstrDisplayName = SysAllocString(title); safecopy(m_htmlPath,path); }
  79. STDMETHODIMP GetResultViewType(LPOLESTR * ppViewType, long *pViewOptions);
  80. HRESULT UpdateChildren(IConsole * pConsole);
  81. // action handlers
  82. };
  83. class CPruneGraftNode : public CNetNode<CPruneGraftNode>
  84. {
  85. BOOL m_bLoaded;
  86. _bstr_t m_Domain;
  87. _bstr_t m_LDAPPath;
  88. _bstr_t m_objectClass;
  89. CStringArray m_Data;
  90. public:
  91. BEGIN_SNAPINCOMMAND_MAP(CPruneGraftNode, FALSE)
  92. //SNAPINCOMMAND_ENTRY(ID_VIEW_VERSION, OnVersionInfo )
  93. SNAPINCOMMAND_ENTRY(ID_TOP_ADDDOMAIN,OnAddDomain)
  94. END_SNAPINCOMMAND_MAP()
  95. SNAPINMENUID(IDR_PRUNE_GRAFT_MENU)
  96. CPruneGraftNode();
  97. // initialization
  98. void Init( WCHAR const * domain, WCHAR const * path, WCHAR const * objClass, WCHAR const * displayName);
  99. BOOL ShowInScopePane();
  100. static const GUID* m_NODETYPE;
  101. static const OLECHAR* m_SZNODETYPE;
  102. static const OLECHAR* m_SZDISPLAY_NAME;
  103. static const CLSID* m_SNAPIN_CLASSID;
  104. // Action handlers
  105. HRESULT OnAddDomain(bool &bHandled, CSnapInObjectRootBase * pObj);
  106. virtual HRESULT OnExpand( IConsole *spConsole );
  107. virtual HRESULT OnShow( bool bShow, IHeaderCtrl *spHeader, IResultData *spResultData);
  108. virtual LPOLESTR GetResultPaneColInfo(int nCol);
  109. void AddColumnValue(int col,WCHAR const * value);
  110. protected:
  111. // helper functions
  112. HRESULT EnumerateChildren( IConsole * spConsole);
  113. SAFEARRAY * GetAvailableColumns(WCHAR const * objectClass);
  114. HRESULT LoadChildren(IEnumVARIANT * pValues);
  115. };
  116. #endif