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.

118 lines
4.0 KiB

  1. // compdata.h : Declaration of the CComponentData
  2. #ifndef __COMPDATA_H_
  3. #define __COMPDATA_H_
  4. /////////////////////////////////////////////////////////////////////////////
  5. // CComponentData
  6. class ATL_NO_VTABLE CComponentData :
  7. public CComObjectRootEx<CComSingleThreadModel>,
  8. public CComCoClass<CComponentData, &CLSID_BOMSnapIn>,
  9. public CDataObjectImpl,
  10. public IComponentData,
  11. public IPersistStream,
  12. public IExtendContextMenu,
  13. public IExtendPropertySheet2,
  14. public ISnapinHelp2
  15. {
  16. public:
  17. CComponentData() : m_bDirty(FALSE) {}
  18. DECLARE_NOT_AGGREGATABLE(CComponentData)
  19. BEGIN_COM_MAP(CComponentData)
  20. COM_INTERFACE_ENTRY(IDataObject)
  21. COM_INTERFACE_ENTRY(IBOMObject)
  22. COM_INTERFACE_ENTRY(IComponentData)
  23. COM_INTERFACE_ENTRY(IExtendContextMenu)
  24. COM_INTERFACE_ENTRY(IPersistStream)
  25. COM_INTERFACE_ENTRY(IExtendPropertySheet2)
  26. COM_INTERFACE_ENTRY(ISnapinHelp2)
  27. END_COM_MAP()
  28. // Class registration method
  29. static HRESULT WINAPI UpdateRegistry(BOOL bRegister);
  30. public:
  31. //
  32. // IComponentData methods
  33. //
  34. STDMETHOD(Initialize)(LPUNKNOWN pUnknown);
  35. STDMETHOD(CreateComponent)(LPCOMPONENT* ppComponent);
  36. STDMETHOD(Notify)(LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param);
  37. STDMETHOD(Destroy)();
  38. STDMETHOD(QueryDataObject)(MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT* ppDataObject);
  39. STDMETHOD(GetDisplayInfo)(SCOPEDATAITEM* pScopeDataItem);
  40. STDMETHOD(CompareObjects)(LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB);
  41. //
  42. // IDataObjectImpl methods
  43. //
  44. STDMETHOD(GetDataImpl)(UINT cf, HGLOBAL* hGlobal);
  45. //
  46. // IExtendContextMenu methods
  47. //
  48. STDMETHOD(AddMenuItems)(LPDATAOBJECT pDataObject, LPCONTEXTMENUCALLBACK pCallback, long* plAllowed);
  49. STDMETHOD(Command)(long lCommand, LPDATAOBJECT pDataObject);
  50. // IExtendPropertySheet2 methods
  51. STDMETHOD(QueryPagesFor)(LPDATAOBJECT lpDataObject);
  52. STDMETHOD(CreatePropertyPages)(LPPROPERTYSHEETCALLBACK lpProvider,LONG_PTR handle, LPDATAOBJECT lpIDataObject);
  53. STDMETHOD(GetWatermarks)(LPDATAOBJECT lpIDataObject, HBITMAP* lphWatermark,
  54. HBITMAP* lphHeader, HPALETTE* lphPalette, BOOL* bStretch);
  55. // ISnapinHelp2
  56. STDMETHOD(GetHelpTopic)(LPOLESTR* ppszHelpFile);
  57. STDMETHOD(GetLinkedTopics)(LPOLESTR* ppszHelpFiles);
  58. // IPersistStream methods
  59. //
  60. STDMETHOD(GetClassID)(CLSID *pClassID);
  61. STDMETHOD(IsDirty)();
  62. STDMETHOD(Load)(IStream *pStream);
  63. STDMETHOD(Save)(IStream *pStream, BOOL fClearDirty);
  64. STDMETHOD(GetSizeMax)(ULARGE_INTEGER *pcbSize);
  65. //
  66. // IBOMObject methods
  67. //
  68. STDMETHOD(Notify)(LPCONSOLE2 pCons, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param);
  69. STDMETHOD(AddMenuItems)(LPCONTEXTMENUCALLBACK pCallback, long* lAllowed);
  70. STDMETHOD(SetToolButtons)(LPTOOLBAR pToolbar);
  71. STDMETHOD(MenuCommand)(LPCONSOLE2 pConsole, long lCommand);
  72. STDMETHOD(SetVerbs)(LPCONSOLEVERB pConsVerb);
  73. STDMETHOD(QueryPagesFor)();
  74. STDMETHOD(CreatePropertyPages)(LPPROPERTYSHEETCALLBACK lpProvider,LONG_PTR handle);
  75. STDMETHOD(GetWatermarks)(HBITMAP* lphWatermark, HBITMAP* lphHeader, HPALETTE* lphPalette, BOOL* bStretch);
  76. CScopeNode* CookieToScopeNode(MMC_COOKIE cookie)
  77. {
  78. if (cookie == 0)
  79. {
  80. ASSERT(m_spRootNode != NULL);
  81. return m_spRootNode;
  82. }
  83. else
  84. {
  85. return reinterpret_cast<CScopeNode*>(cookie);
  86. }
  87. }
  88. IConsole2* GetConsole() { return m_spConsole; }
  89. IConsoleNameSpace* GetNameSpace() { return m_spNameSpace; }
  90. IStringTable* GetStringTable() { return m_spStringTable; }
  91. private:
  92. IConsole2Ptr m_spConsole;
  93. IConsoleNameSpacePtr m_spNameSpace;
  94. IStringTablePtr m_spStringTable;
  95. CRootNodePtr m_spRootNode;
  96. BOOL m_bDirty;
  97. static UINT m_cfDisplayName;
  98. };
  99. #endif //__COMPDATA_H_