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.

160 lines
4.6 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1997-1999 **/
  4. /**********************************************************************/
  5. /*
  6. handler.h
  7. This file contains the prototypes for the derived classes
  8. for CComponent and CComponentData. Most of these functions
  9. are pure virtual functions that need to be overridden
  10. for snapin functionality.
  11. FILE HISTORY:
  12. */
  13. #include "resource.h" // main symbols
  14. #ifndef __mmc_h__
  15. #include <mmc.h>
  16. #endif
  17. #ifndef _COMPONT_H_
  18. #include "compont.h"
  19. #endif
  20. #ifndef _SNMPCOMPH_
  21. #define _SNMPCOMPH_
  22. /*---------------------------------------------------------------------------
  23. CSnmpComponentData
  24. This is the base implementation of ComponentData. This will be
  25. incorporated into the two derived classes.
  26. ---------------------------------------------------------------------------*/
  27. class CSnmpComponentData :
  28. public CComponentData,
  29. public CComObjectRoot
  30. {
  31. public:
  32. BEGIN_COM_MAP(CSnmpComponentData)
  33. COM_INTERFACE_ENTRY(IComponentData)
  34. COM_INTERFACE_ENTRY(IExtendPropertySheet)
  35. COM_INTERFACE_ENTRY(IExtendContextMenu)
  36. COM_INTERFACE_ENTRY(IPersistStreamInit)
  37. END_COM_MAP()
  38. // These are the interfaces that we MUST implement
  39. // We will implement our common behavior here, with the derived
  40. // classes implementing the specific behavior.
  41. STDMETHOD_(ULONG, AddRef)();
  42. STDMETHOD_(ULONG, Release)();
  43. DeclareIPersistStreamInitMembers(IMPL)
  44. DeclareITFSCompDataCallbackMembers(IMPL)
  45. CSnmpComponentData();
  46. HRESULT FinalConstruct();
  47. void FinalRelease();
  48. protected:
  49. SPITFSNodeMgr m_spNodeMgr;
  50. };
  51. /*---------------------------------------------------------------------------
  52. This is how the sample snapin implements its extension functionality.
  53. It actually exposes two interfaces that are CoCreate-able. One is the
  54. primary interface, the other the extension interface.
  55. Author: EricDav
  56. ---------------------------------------------------------------------------*/
  57. class CSnmpComponentDataPrimary :
  58. public CSnmpComponentData,
  59. public CComCoClass<CSnmpComponentDataPrimary, &CLSID_SnmpSnapin>
  60. {
  61. public:
  62. DECLARE_REGISTRY(CSnmpComponentDataPrimary,
  63. _T("SnmpSnapin.SnmpSnapin.1"),
  64. _T("SnmpSnapin.SnmpSnapin"),
  65. IDS_SNAPIN_DESC, THREADFLAGS_BOTH)
  66. STDMETHOD_(const CLSID *,GetCoClassID()){ return &CLSID_SnmpSnapin; }
  67. };
  68. class CSnmpComponentDataExtension :
  69. public CSnmpComponentData,
  70. public CComCoClass<CSnmpComponentDataExtension, &CLSID_SnmpSnapinExtension>
  71. {
  72. public:
  73. DECLARE_REGISTRY(CSnmpComponentDataExtension,
  74. _T("SnmpSnapinExtension.SnmpSnapinExtension.1"),
  75. _T("SnmpSnapinExtension.SnmpSnapinExtension"),
  76. IDS_SNAPIN_DESC, THREADFLAGS_BOTH)
  77. STDMETHOD_(const CLSID *, GetCoClassID)(){ return &CLSID_SnmpSnapinExtension; }
  78. };
  79. /////////////////////////////////////////////////////////////////////////////
  80. //
  81. // CSnmpComponent
  82. //
  83. /////////////////////////////////////////////////////////////////////////////
  84. class CSnmpComponent :
  85. public TFSComponent
  86. {
  87. public:
  88. CSnmpComponent();
  89. ~CSnmpComponent();
  90. DeclareITFSCompCallbackMembers(IMPL)
  91. //Attributes
  92. private:
  93. };
  94. /*---------------------------------------------------------------------------
  95. This is the derived class for handling the IAbout interface from MMC
  96. Author: EricDav
  97. ---------------------------------------------------------------------------*/
  98. class CSnmpAbout :
  99. public CAbout,
  100. public CComCoClass<CSnmpAbout, &CLSID_SnmpSnapinAbout>
  101. {
  102. public:
  103. DECLARE_REGISTRY(CSnmpAbout,
  104. _T("SnmpSnapin.About.1"),
  105. _T("SnmpSnapin.About"),
  106. IDS_SNAPIN_DESC,
  107. THREADFLAGS_BOTH)
  108. BEGIN_COM_MAP(CSnmpAbout)
  109. COM_INTERFACE_ENTRY(ISnapinAbout) // Must have one static entry
  110. COM_INTERFACE_ENTRY_CHAIN(CAbout) // chain to the base class
  111. END_COM_MAP()
  112. DECLARE_NOT_AGGREGATABLE(CSnmpAbout)
  113. // these must be overridden to provide values to the base class
  114. protected:
  115. virtual UINT GetAboutDescriptionId() { return IDS_ABOUT_DESCRIPTION; }
  116. virtual UINT GetAboutProviderId() { return IDS_ABOUT_PROVIDER; }
  117. virtual UINT GetAboutVersionId() { return IDS_ABOUT_VERSION; }
  118. virtual UINT GetAboutIconId() { return 0; }
  119. virtual UINT GetSmallRootId() { return 0; }
  120. virtual UINT GetSmallOpenRootId() { return 0; }
  121. virtual UINT GetLargeRootId() { return 0; }
  122. virtual COLORREF GetLargeColorMask() { return (COLORREF) 0; }
  123. };
  124. #endif