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.

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