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.

190 lines
6.4 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1997 - 1998 **/
  4. /**********************************************************************/
  5. /*
  6. ipsmcomp.h
  7. This file contains the derived prototypes from CComponent
  8. and CComponentData for the IPSECMON snapin.
  9. FILE HISTORY:
  10. */
  11. #ifndef _IPSMCOMP_H
  12. #define _IPSMCOMP_H
  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 _XSTREAM_H
  21. #include "xstream.h"
  22. #endif
  23. #define COLORREF_PINK 0x00FF00FF
  24. // Use FormatMessage() to get a system error message
  25. LONG GetSystemMessage ( UINT nId, TCHAR * chBuffer, int cbBuffSize ) ;
  26. BOOL LoadMessage (UINT nIdPrompt, TCHAR * chMsg, int nMsgSize);
  27. // Surrogate AfxMessageBox replacement for error message filtering.
  28. int IpsmMessageBox(UINT nIdPrompt,
  29. UINT nType = MB_OK,
  30. const TCHAR * pszSuffixString = NULL,
  31. UINT nHelpContext = -1);
  32. int IpsmMessageBoxEx(UINT nIdPrompt,
  33. LPCTSTR pszPrefixMessage,
  34. UINT nType = MB_OK,
  35. UINT nHelpContext = -1);
  36. enum IPSMSTRM_TAG
  37. {
  38. IPSMSTRM_TAG_VERSION = XFER_TAG(1, XFER_DWORD),
  39. IPSMSTRM_TAG_VERSIONADMIN = XFER_TAG(2, XFER_DWORD),
  40. IPSMSTRM_TAG_SERVER_NAME = XFER_TAG(3, XFER_STRING_ARRAY),
  41. IPSMSTRM_TAG_SERVER_REFRESH_INTERVAL = XFER_TAG(4, XFER_DWORD_ARRAY),
  42. IPSMSTRM_TAG_COLUMN_INFO = XFER_TAG(5, XFER_DWORD_ARRAY),
  43. IPSMSTRM_TAG_SERVER_OPTIONS = XFER_TAG(6, XFER_DWORD_ARRAY),
  44. IPSMSTRM_TAG_SERVER_LINE_SIZE = XFER_TAG(7, XFER_DWORD_ARRAY),
  45. IPSMSTRM_TAG_SERVER_PHONE_SIZE = XFER_TAG(8, XFER_DWORD_ARRAY)
  46. };
  47. /////////////////////////////////////////////////////////////////////////////
  48. // CIpsmComponentData
  49. class CIpsmComponentData :
  50. public CComponentData,
  51. public CComObjectRoot
  52. {
  53. public:
  54. BEGIN_COM_MAP(CIpsmComponentData)
  55. COM_INTERFACE_ENTRY(IComponentData)
  56. COM_INTERFACE_ENTRY(IExtendPropertySheet)
  57. COM_INTERFACE_ENTRY(IExtendContextMenu)
  58. COM_INTERFACE_ENTRY(IPersistStreamInit)
  59. COM_INTERFACE_ENTRY(ISnapinHelp)
  60. END_COM_MAP()
  61. // These are the interfaces that we MUST implement
  62. // We will implement our common behavior here, with the derived
  63. // classes implementing the specific behavior.
  64. DeclareIPersistStreamInitMembers(IMPL)
  65. DeclareITFSCompDataCallbackMembers(IMPL)
  66. CIpsmComponentData();
  67. HRESULT FinalConstruct();
  68. void FinalRelease();
  69. protected:
  70. SPITFSNodeMgr m_spNodeMgr;
  71. SPITFSNode m_spRootNode;
  72. // Notify handler declarations
  73. private:
  74. };
  75. /////////////////////////////////////////////////////////////////////////////
  76. // CIpsmComponent
  77. class CIpsmComponent :
  78. public TFSComponent
  79. {
  80. public:
  81. CIpsmComponent();
  82. ~CIpsmComponent();
  83. STDMETHOD(InitializeBitmaps)(MMC_COOKIE cookie);
  84. STDMETHOD(SetControlbar)(LPCONTROLBAR pControlbar);
  85. STDMETHOD(ControlbarNotify)(MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param);
  86. STDMETHOD(QueryDataObject)(MMC_COOKIE cookie,
  87. DATA_OBJECT_TYPES type,
  88. LPDATAOBJECT* ppDataObject);
  89. STDMETHOD(CompareObjects)(LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB);
  90. STDMETHOD(OnSnapinHelp)(LPDATAOBJECT pDataObject, LPARAM arg, LPARAM param);
  91. //Attributes
  92. private:
  93. SPIToolbar m_spToolbar; // Toolbar
  94. CBitmap* m_pbmpToolbar; // Imagelist for toolbar
  95. };
  96. /*---------------------------------------------------------------------------
  97. This is how the DHCP snapin implements its extension functionality.
  98. It actually exposes two interfaces that are CoCreate-able. One is the
  99. primary interface, the other the extension interface.
  100. Author: EricDav
  101. ---------------------------------------------------------------------------*/
  102. class CIpsmComponentDataPrimary : public CIpsmComponentData,
  103. public CComCoClass<CIpsmComponentDataPrimary, &CLSID_IpsmSnapin>
  104. {
  105. public:
  106. DECLARE_REGISTRY(CIpsmComponentDataPrimary,
  107. _T("TelephonySnapin.TelephonySnapin.1"),
  108. _T("TelephonySnapin.TelephonySnapin"),
  109. IDS_SNAPIN_DESC, THREADFLAGS_BOTH)
  110. STDMETHODIMP_(const CLSID *)GetCoClassID() { return &CLSID_IpsmSnapin; }
  111. };
  112. class CIpsmComponentDataExtension : public CIpsmComponentData,
  113. public CComCoClass<CIpsmComponentDataExtension, &CLSID_IpsmSnapinExtension>
  114. {
  115. public:
  116. DECLARE_REGISTRY(CIpsmComponentDataExtension,
  117. _T("TelephonySnapinExtension.TelephonySnapinExtension.1"),
  118. _T("TelephonySnapinExtension.TelephonySnapinExtension"),
  119. IDS_SNAPIN_DESC, THREADFLAGS_BOTH)
  120. STDMETHODIMP_(const CLSID *)GetCoClassID() { return &CLSID_IpsmSnapinExtension; }
  121. };
  122. /*---------------------------------------------------------------------------
  123. This is the derived class for handling the IAbout interface from MMC
  124. Author: EricDav
  125. ---------------------------------------------------------------------------*/
  126. class CIpsmAbout :
  127. public CAbout,
  128. public CComCoClass<CIpsmAbout, &CLSID_IpsmSnapinAbout>
  129. {
  130. public:
  131. DECLARE_REGISTRY(CIpsmAbout, _T("IpsecMonSnapin.About.1"),
  132. _T("IpsecMonSnapin.About"),
  133. IDS_SNAPIN_DESC, THREADFLAGS_BOTH)
  134. BEGIN_COM_MAP(CIpsmAbout)
  135. COM_INTERFACE_ENTRY(ISnapinAbout) // Must have one static entry
  136. COM_INTERFACE_ENTRY_CHAIN(CAbout) // chain to the base class
  137. END_COM_MAP()
  138. DECLARE_NOT_AGGREGATABLE(CIpsmAbout)
  139. // these must be overridden to provide values to the base class
  140. protected:
  141. virtual UINT GetAboutDescriptionId() { return IDS_ABOUT_DESCRIPTION; }
  142. virtual UINT GetAboutProviderId() { return IDS_ABOUT_PROVIDER; }
  143. virtual UINT GetAboutVersionId() { return IDS_ABOUT_VERSION; }
  144. virtual UINT GetAboutIconId() { return IDI_IPSECMON_SNAPIN; }
  145. virtual UINT GetSmallRootId() { return IDB_ROOT_SMALL; }
  146. virtual UINT GetSmallOpenRootId() { return IDB_ROOT_SMALL; }
  147. virtual UINT GetLargeRootId() { return IDB_ROOT_LARGE; }
  148. virtual COLORREF GetLargeColorMask() { return (COLORREF) COLORREF_PINK; }
  149. };
  150. #endif _IPSMCOMP_H