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.

218 lines
6.7 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1997 - 1998 **/
  4. /**********************************************************************/
  5. /*
  6. winscomp.h
  7. This file contains the derived prototypes from CComponent
  8. and CComponentData for the WINS admin snapin.
  9. FILE HISTORY:
  10. */
  11. #ifndef _WINSCOMP_H
  12. #define _WINSCOMP_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. #define WINSSNAP_FILE_VERSION 0x00000001
  25. #define GETHANDLER(classname, node) (reinterpret_cast<classname *>(node->GetData(TFS_DATA_USER)))
  26. #define STRING_LENGTH_MAX 256
  27. enum WINSSTRM_TAG
  28. {
  29. WINSSTRM_TAG_VERSION = XFER_TAG(1, XFER_DWORD),
  30. WINSSTRM_TAG_VERSIONADMIN = XFER_TAG(2, XFER_LARGEINTEGER),
  31. WINSSTRM_TAB_SNAPIN_NAME = XFER_TAG(3, XFER_STRING),
  32. WINSSTRM_TAG_SERVER_IP = XFER_TAG(4, XFER_DWORD_ARRAY),
  33. WINSSTRM_TAG_SERVER_NAME = XFER_TAG(5, XFER_STRING_ARRAY),
  34. WINSSTRM_TAG_SERVER_CONNECTED = XFER_TAG(6, XFER_STRING_ARRAY),
  35. WINSSTRM_TAG_SERVER_FLAGS = XFER_TAG(10, XFER_DWORD_ARRAY),
  36. WINSSTRM_TAG_SERVER_REFRESHINTERVAL = XFER_TAG(11, XFER_DWORD_ARRAY),
  37. WINSSTRM_TAG_COLUMN_INFO = XFER_TAG(12, XFER_DWORD_ARRAY),
  38. WINSSTRM_TAG_SNAPIN_FLAGS = XFER_TAG(13, XFER_DWORD),
  39. WINSSTRM_TAG_UPDATE_INTERVAL = XFER_TAG(14, XFER_DWORD)
  40. };
  41. typedef enum _ICON_INDICIES
  42. {
  43. ICON_IDX_ACTREG_FOLDER_CLOSED,
  44. ICON_IDX_ACTREG_FOLDER_CLOSED_BUSY,
  45. ICON_IDX_ACTREG_FOLDER_OPEN,
  46. ICON_IDX_ACTREG_FOLDER_OPEN_BUSY,
  47. ICON_IDX_CLIENT,
  48. ICON_IDX_CLIENT_GROUP,
  49. ICON_IDX_PARTNER,
  50. ICON_IDX_REP_PARTNERS_FOLDER_CLOSED,
  51. ICON_IDX_REP_PARTNERS_FOLDER_CLOSED_BUSY,
  52. ICON_IDX_REP_PARTNERS_FOLDER_CLOSED_LOST_CONNECTION,
  53. ICON_IDX_REP_PARTNERS_FOLDER_OPEN,
  54. ICON_IDX_REP_PARTNERS_FOLDER_OPEN_BUSY,
  55. ICON_IDX_REP_PARTNERS_FOLDER_OPEN_LOST_CONNECTION,
  56. ICON_IDX_SERVER,
  57. ICON_IDX_SERVER_BUSY,
  58. ICON_IDX_SERVER_CONNECTED,
  59. ICON_IDX_SERVER_LOST_CONNECTION,
  60. ICON_IDX_SERVER_NO_ACCESS,
  61. ICON_IDX_WINS_PRODUCT,
  62. ICON_IDX_MAX
  63. } ICON_INDICIES, * LPICON_INDICIES;
  64. // icon image map
  65. extern UINT g_uIconMap[ICON_IDX_MAX + 1][2];
  66. /////////////////////////////////////////////////////////////////////////////
  67. // CWinsComponentData
  68. class CWinsComponentData :
  69. public CComponentData,
  70. public CComObjectRoot
  71. {
  72. public:
  73. BEGIN_COM_MAP(CWinsComponentData)
  74. COM_INTERFACE_ENTRY(IComponentData)
  75. COM_INTERFACE_ENTRY(IExtendPropertySheet)
  76. COM_INTERFACE_ENTRY(IExtendContextMenu)
  77. COM_INTERFACE_ENTRY(IPersistStreamInit)
  78. COM_INTERFACE_ENTRY(ISnapinHelp)
  79. END_COM_MAP()
  80. // These are the interfaces that we MUST implement
  81. // We will implement our common behavior here, with the derived
  82. // classes implementing the specific behavior.
  83. DeclareIPersistStreamInitMembers(IMPL)
  84. DeclareITFSCompDataCallbackMembers(IMPL)
  85. CWinsComponentData();
  86. HRESULT FinalConstruct();
  87. void FinalRelease();
  88. protected:
  89. SPITFSNodeMgr m_spNodeMgr;
  90. SPITFSNode m_spRootNode;
  91. // Notify handler declarations
  92. private:
  93. };
  94. /////////////////////////////////////////////////////////////////////////////
  95. // CWinsComponent
  96. class CWinsComponent :
  97. public TFSComponent
  98. {
  99. public:
  100. CWinsComponent();
  101. ~CWinsComponent();
  102. //DeclareITFSCompCallbackMembers(IMPL)
  103. STDMETHOD(InitializeBitmaps)(MMC_COOKIE cookie);
  104. STDMETHOD(QueryDataObject) (MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT *ppDataObject);
  105. STDMETHOD(CompareObjects)(LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB);
  106. // snap-in help
  107. STDMETHOD(OnSnapinHelp)(LPDATAOBJECT pDataObject, LPARAM arg, LPARAM param);
  108. //Attributes
  109. private:
  110. };
  111. /*---------------------------------------------------------------------------
  112. This is how the WINS snapin implements its extension functionality.
  113. It actually exposes two interfaces that are CoCreate-able. One is the
  114. primary interface, the other the extension interface.
  115. Author: EricDav
  116. ---------------------------------------------------------------------------*/
  117. class CWinsComponentDataPrimary : public CWinsComponentData,
  118. public CComCoClass<CWinsComponentDataPrimary, &CLSID_WinsSnapin>
  119. {
  120. public:
  121. DECLARE_REGISTRY(CWinsComponentDataPrimary,
  122. _T("WinsSnapin.WinsSnapin.1"),
  123. _T("WinsSnapin.WinsSnapin"),
  124. IDS_SNAPIN_DESC, THREADFLAGS_BOTH)
  125. STDMETHODIMP_(const CLSID *)GetCoClassID() { return &CLSID_WinsSnapin; }
  126. };
  127. class CWinsComponentDataExtension : public CWinsComponentData,
  128. public CComCoClass<CWinsComponentDataExtension, &CLSID_WinsSnapinExtension>
  129. {
  130. public:
  131. DECLARE_REGISTRY(CWinsComponentDataExtension,
  132. _T("WinsSnapinExtension.WinsSnapinExtension.1"),
  133. _T("WinsSnapinExtension.WinsSnapinExtension"),
  134. IDS_SNAPIN_DESC, THREADFLAGS_BOTH)
  135. STDMETHODIMP_(const CLSID *)GetCoClassID() { return &CLSID_WinsSnapinExtension; }
  136. };
  137. /*---------------------------------------------------------------------------
  138. This is the derived class for handling the IAbout interface from MMC
  139. Author: EricDav
  140. ---------------------------------------------------------------------------*/
  141. class CWinsAbout :
  142. public CAbout,
  143. public CComCoClass<CWinsAbout, &CLSID_WinsSnapinAbout>
  144. {
  145. public:
  146. DECLARE_REGISTRY(CWinsAbout, _T("WinsSnapin.About.1"),
  147. _T("WinsSnapin.About"),
  148. IDS_SNAPIN_DESC, THREADFLAGS_BOTH)
  149. BEGIN_COM_MAP(CWinsAbout)
  150. COM_INTERFACE_ENTRY(ISnapinAbout) // Must have one static entry
  151. COM_INTERFACE_ENTRY_CHAIN(CAbout) // chain to the base class
  152. END_COM_MAP()
  153. DECLARE_NOT_AGGREGATABLE(CWinsAbout)
  154. // these must be overridden to provide values to the base class
  155. protected:
  156. virtual UINT GetAboutDescriptionId() { return IDS_ABOUT_DESCRIPTION; }
  157. virtual UINT GetAboutProviderId() { return IDS_ABOUT_PROVIDER; }
  158. virtual UINT GetAboutVersionId() { return IDS_ABOUT_VERSION; }
  159. virtual UINT GetAboutIconId() { return IDI_WINS_SNAPIN; }
  160. virtual UINT GetSmallRootId() { return IDB_ROOT_SMALL; }
  161. virtual UINT GetSmallOpenRootId() { return IDB_ROOT_SMALL; }
  162. virtual UINT GetLargeRootId() { return IDB_ROOT_LARGE; }
  163. virtual COLORREF GetLargeColorMask() { return (COLORREF) COLORREF_PINK; }
  164. };
  165. class CThemeContextActivator
  166. {
  167. public:
  168. CThemeContextActivator() : m_ulActivationCookie(0)
  169. { SHActivateContext (&m_ulActivationCookie); }
  170. ~CThemeContextActivator()
  171. { SHDeactivateContext (m_ulActivationCookie); }
  172. private:
  173. ULONG_PTR m_ulActivationCookie;
  174. };
  175. #endif _WINSCOMP_H