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.

217 lines
6.5 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1997 - 1998 **/
  4. /**********************************************************************/
  5. /*
  6. dhcpcomp.h
  7. This file contains the derived prototypes from CComponent
  8. and CComponentData for the DHCP admin snapin.
  9. FILE HISTORY:
  10. */
  11. #ifndef _DHCPCOMP_H
  12. #define _DHCPCOMP_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. #ifndef _SERVBROW_H
  24. #include "servbrow.h"
  25. #endif
  26. #define COLORREF_PINK 0x00FF00FF
  27. extern CAuthServerList g_AuthServerList;
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. extern WATERMARKINFO g_WatermarkInfoServer;
  32. extern WATERMARKINFO g_WatermarkInfoScope;
  33. BOOL FilterOption(DHCP_OPTION_ID id);
  34. BOOL FilterUserClassOption(DHCP_OPTION_ID id);
  35. BOOL IsBasicOption(DHCP_OPTION_ID id);
  36. BOOL IsAdvancedOption(DHCP_OPTION_ID id);
  37. BOOL IsCustomOption(DHCP_OPTION_ID id);
  38. // Use FormatMessage() to get a system error message
  39. LONG GetSystemMessage ( UINT nId, TCHAR * chBuffer, int cbBuffSize ) ;
  40. BOOL LoadMessage (UINT nIdPrompt, TCHAR * chMsg, int nMsgSize);
  41. // Surrogate AfxMessageBox replacement for error message filtering.
  42. int DhcpMessageBox(DWORD dwIdPrompt,
  43. UINT nType = MB_OK,
  44. const TCHAR * pszSuffixString = NULL,
  45. UINT nHelpContext = -1);
  46. int DhcpMessageBoxEx(DWORD dwIdPrompt,
  47. LPCTSTR pszPrefixMessage,
  48. UINT nType = (UINT) MB_OK,
  49. UINT nHelpContext = -1);
  50. #ifdef __cplusplus
  51. } // extern "C"
  52. #endif
  53. #define TASKPAD_ROOT_FLAG 0x00000001
  54. #define TASKPAD_SERVER_FLAG 0x00000002
  55. #define TASKPAD_ROOT_INDEX 0x00000000
  56. #define TASKPAD_SERVER_INDEX 0x00000001
  57. enum DHCPSTRM_TAG
  58. {
  59. DHCPSTRM_TAG_VERSION = XFER_TAG(1, XFER_DWORD),
  60. DHCPSTRM_TAG_VERSIONADMIN = XFER_TAG(2, XFER_LARGEINTEGER),
  61. DHCPSTRM_TAB_SNAPIN_NAME = XFER_TAG(3, XFER_STRING),
  62. DHCPSTRM_TAG_SERVER_IP = XFER_TAG(4, XFER_STRING_ARRAY),
  63. DHCPSTRM_TAG_SERVER_NAME = XFER_TAG(5, XFER_STRING_ARRAY),
  64. DHCPSTRM_TAG_SERVER_OPTIONS = XFER_TAG(6, XFER_DWORD_ARRAY),
  65. DHCPSTRM_TAG_SERVER_REFRESH_INTERVAL = XFER_TAG(7, XFER_DWORD_ARRAY),
  66. DHCPSTRM_TAG_COLUMN_INFO = XFER_TAG(8, XFER_DWORD_ARRAY),
  67. DHCPSTRM_TAG_SNAPIN_OPTIONS = XFER_TAG(9, XFER_DWORD)
  68. };
  69. /////////////////////////////////////////////////////////////////////////////
  70. // CDhcpComponentData
  71. class CDhcpComponentData :
  72. public CComponentData,
  73. public CComObjectRoot
  74. {
  75. public:
  76. BEGIN_COM_MAP(CDhcpComponentData)
  77. COM_INTERFACE_ENTRY(IComponentData)
  78. COM_INTERFACE_ENTRY(IExtendPropertySheet2)
  79. COM_INTERFACE_ENTRY(IExtendContextMenu)
  80. COM_INTERFACE_ENTRY(IPersistStreamInit)
  81. COM_INTERFACE_ENTRY(ISnapinHelp)
  82. END_COM_MAP()
  83. // These are the interfaces that we MUST implement
  84. // We will implement our common behavior here, with the derived
  85. // classes implementing the specific behavior.
  86. DeclareIPersistStreamInitMembers(IMPL)
  87. DeclareITFSCompDataCallbackMembers(IMPL)
  88. CDhcpComponentData();
  89. HRESULT FinalConstruct();
  90. void FinalRelease();
  91. protected:
  92. SPITFSNodeMgr m_spNodeMgr;
  93. SPITFSNode m_spRootNode;
  94. // Notify handler declarations
  95. private:
  96. };
  97. /////////////////////////////////////////////////////////////////////////////
  98. // CDhcpComponent
  99. class CDhcpComponent :
  100. public TFSComponent
  101. {
  102. public:
  103. CDhcpComponent();
  104. ~CDhcpComponent();
  105. STDMETHOD(InitializeBitmaps)(MMC_COOKIE cookie);
  106. STDMETHOD(SetControlbar)(LPCONTROLBAR pControlbar);
  107. STDMETHOD(ControlbarNotify)(MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param);
  108. STDMETHOD(QueryDataObject)(MMC_COOKIE cookie,
  109. DATA_OBJECT_TYPES type,
  110. LPDATAOBJECT* ppDataObject);
  111. STDMETHOD(OnSnapinHelp)(LPDATAOBJECT pDataObject, LPARAM arg, LPARAM param);
  112. //Attributes
  113. private:
  114. CBitmap* m_pbmpToolbar; // Imagelist for toolbar
  115. };
  116. /*---------------------------------------------------------------------------
  117. This is how the DHCP snapin implements its extension functionality.
  118. It actually exposes two interfaces that are CoCreate-able. One is the
  119. primary interface, the other the extension interface.
  120. Author: EricDav
  121. ---------------------------------------------------------------------------*/
  122. class CDhcpComponentDataPrimary : public CDhcpComponentData,
  123. public CComCoClass<CDhcpComponentDataPrimary, &CLSID_DhcpSnapin>
  124. {
  125. public:
  126. DECLARE_REGISTRY(CDhcpComponentDataPrimary,
  127. _T("DhcpSnapin.DhcpSnapin.1"),
  128. _T("DhcpSnapin.DhcpSnapin"),
  129. IDS_SNAPIN_DESC, THREADFLAGS_BOTH)
  130. STDMETHODIMP_(const CLSID *)GetCoClassID() { return &CLSID_DhcpSnapin; }
  131. };
  132. class CDhcpComponentDataExtension : public CDhcpComponentData,
  133. public CComCoClass<CDhcpComponentDataExtension, &CLSID_DhcpSnapinExtension>
  134. {
  135. public:
  136. DECLARE_REGISTRY(CDhcpComponentDataExtension,
  137. _T("DhcpSnapinExtension.DhcpSnapinExtension.1"),
  138. _T("DhcpSnapinExtension.DhcpSnapinExtension"),
  139. IDS_SNAPIN_DESC, THREADFLAGS_BOTH)
  140. STDMETHODIMP_(const CLSID *)GetCoClassID() { return &CLSID_DhcpSnapinExtension; }
  141. };
  142. /*---------------------------------------------------------------------------
  143. This is the derived class for handling the IAbout interface from MMC
  144. Author: EricDav
  145. ---------------------------------------------------------------------------*/
  146. class CDhcpAbout :
  147. public CAbout,
  148. public CComCoClass<CDhcpAbout, &CLSID_DhcpSnapinAbout>
  149. {
  150. public:
  151. DECLARE_REGISTRY(CDhcpAbout, _T("DhcpSnapin.About.1"),
  152. _T("DhcpSnapin.About"),
  153. IDS_SNAPIN_DESC, THREADFLAGS_BOTH)
  154. BEGIN_COM_MAP(CDhcpAbout)
  155. COM_INTERFACE_ENTRY(ISnapinAbout) // Must have one static entry
  156. COM_INTERFACE_ENTRY_CHAIN(CAbout) // chain to the base class
  157. END_COM_MAP()
  158. DECLARE_NOT_AGGREGATABLE(CDhcpAbout)
  159. // these must be overridden to provide values to the base class
  160. protected:
  161. virtual UINT GetAboutDescriptionId() { return IDS_ABOUT_DESCRIPTION; }
  162. virtual UINT GetAboutProviderId() { return IDS_ABOUT_PROVIDER; }
  163. virtual UINT GetAboutVersionId() { return IDS_ABOUT_VERSION; }
  164. virtual UINT GetAboutIconId() { return IDI_DHCP_SNAPIN; }
  165. virtual UINT GetSmallRootId() { return IDB_ROOT_SMALL; }
  166. virtual UINT GetSmallOpenRootId() { return IDB_ROOT_SMALL; }
  167. virtual UINT GetLargeRootId() { return IDB_ROOT_LARGE; }
  168. virtual COLORREF GetLargeColorMask() { return (COLORREF) COLORREF_PINK; }
  169. };
  170. #endif _DHCPCOMP_H