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.

165 lines
4.7 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. /*++
  3. Copyright (C) Microsoft Corporation, 1997 - 1999
  4. Module Name:
  5. ComponentData.cpp
  6. Abstract:
  7. The CComponentData class implements several interfaces which MMC uses:
  8. The IComponentData interface is basically how MMC talks to the snap-in
  9. to get it to implement the left-hand-side "scope" pane.
  10. The IExtendPropertySheet interface is how the snap-in adds property sheets
  11. for any of the items a user might click on.
  12. The IExtendContextMenu interface what we do to add custom entries
  13. to the menu which appears when a user right-clicks on a node.
  14. The IExtendControlBar interface allows us to support a custom
  15. iconic toolbar.
  16. See ComponentData.cpp for implementation.
  17. Note:
  18. Much of the functionality of this class is implemented in atlsnap.h
  19. by IComponentDataImpl. We are mostly overriding here.
  20. Revision History:
  21. mmaguire 11/6/97 - created using MMC snap-in wizard
  22. --*/
  23. //////////////////////////////////////////////////////////////////////////////
  24. #if !defined(_NAP_COMPONENT_DATA_H_)
  25. #define _NAP_COMPONENT_DATA_H_
  26. //////////////////////////////////////////////////////////////////////////////
  27. // BEGIN INCLUDES
  28. //
  29. // where we can find what this class derives from:
  30. //
  31. //Moved to Precompiled.h: #include <atlsnap.h>
  32. //
  33. //
  34. // where we can find what this class has or uses:
  35. //
  36. #include "MachineNode.h"
  37. //
  38. // END INCLUDES
  39. //////////////////////////////////////////////////////////////////////////////
  40. //
  41. // hack start
  42. //
  43. // This is a big hack to work around a atlsnap.h bug: Atlsnap.h
  44. // can't support extending multiple nodes. So we basically just
  45. // copied EXTENSION_SNAPIN_NODEINFO_ENTRY() here. We need to change
  46. // this after the atlsnap.h fix -- MAM: 08-06-98 -- yeah right
  47. //
  48. //
  49. // The following statements are copied from atlsnap.h and then changed
  50. // to support multiple extending node
  51. //
  52. // IsSupportedGUID will also set the m_enumExtendedSnapin flag in side m_##dataClass object
  53. // which, in our case, is CMachineNode
  54. //
  55. #define EXTENSION_SNAPIN_NODEINFO_ENTRY_EX(dataClass) \
  56. if ( m_##dataClass.IsSupportedGUID( guid ) )\
  57. { \
  58. *ppItem = m_##dataClass.GetExtNodeObject(pDataObject, &m_##dataClass); \
  59. _ASSERTE(*ppItem != NULL); \
  60. (*ppItem)->InitDataClass(pDataObject, &m_##dataClass); \
  61. return hr; \
  62. }
  63. //
  64. // hack end
  65. //
  66. class CComponent;
  67. class CComponentData :
  68. public CComObjectRootEx<CComSingleThreadModel>
  69. , public CSnapInObjectRoot<1, CComponentData>
  70. , public IComponentDataImpl<CComponentData, CComponent>
  71. , public IExtendPropertySheetImpl<CComponentData>
  72. , public IExtendContextMenuImpl<CComponentData>
  73. , public IExtendControlbarImpl<CComponentData>
  74. , public ISnapinHelp
  75. , public CComCoClass<CComponentData, &CLSID_NAPSnapin>,
  76. private IASTraceInitializer
  77. {
  78. public:
  79. CComponentData();
  80. ~CComponentData();
  81. EXTENSION_SNAPIN_DATACLASS(CMachineNode)
  82. BEGIN_EXTENSION_SNAPIN_NODEINFO_MAP(CComponentData)
  83. EXTENSION_SNAPIN_NODEINFO_ENTRY_EX(CMachineNode)
  84. END_EXTENSION_SNAPIN_NODEINFO_MAP()
  85. BEGIN_COM_MAP(CComponentData)
  86. COM_INTERFACE_ENTRY(IComponentData)
  87. COM_INTERFACE_ENTRY(IExtendPropertySheet2)
  88. COM_INTERFACE_ENTRY(IExtendContextMenu)
  89. COM_INTERFACE_ENTRY(IExtendControlbar)
  90. COM_INTERFACE_ENTRY(ISnapinHelp)
  91. END_COM_MAP()
  92. DECLARE_REGISTRY_RESOURCEID(IDR_NAPSNAPIN)
  93. DECLARE_NOT_AGGREGATABLE(CComponentData)
  94. STDMETHOD(Initialize)(LPUNKNOWN pUnknown);
  95. STDMETHOD(CompareObjects)(
  96. LPDATAOBJECT lpDataObjectA
  97. , LPDATAOBJECT lpDataObjectB
  98. );
  99. STDMETHOD(CreateComponent)(LPCOMPONENT *ppComponent);
  100. // ISnapinHelp method(s)
  101. STDMETHOD(GetHelpTopic)(LPOLESTR * lpCompiledHelpFile)
  102. {return E_UNEXPECTED;};
  103. // We are overiding ATLsnap.h's IComponentImpl implementation of this
  104. // in order to correctly handle messages which it is incorrectly
  105. // ignoring (e.g. MMCN_COLUMN_CLICK and MMCN_SNAPINHELP)
  106. STDMETHOD(Notify)(
  107. LPDATAOBJECT lpDataObject
  108. , MMC_NOTIFY_TYPE event
  109. , LPARAM arg
  110. , LPARAM param
  111. );
  112. virtual HRESULT OnPropertyChange(
  113. LPARAM arg
  114. , LPARAM param
  115. );
  116. // IExtendPropertySheet2 -- to support wizard 97
  117. STDMETHOD(GetWatermarks)(
  118. LPDATAOBJECT lpIDataObject,
  119. HBITMAP *lphWatermark,
  120. HBITMAP *lphHeader,
  121. HPALETTE *lphPalette,
  122. BOOL *bStretch
  123. );
  124. };
  125. #endif // _NAP_COMPONENT_DATA_H_