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.

448 lines
11 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1998 - 1999
  6. //
  7. // File: dnssnap.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #ifndef _DNSSNAP_H
  11. #define _DNSSNAP_H
  12. //////////////////////////////////////////////////////////////////////////////
  13. // global constants and macros
  14. extern const CLSID CLSID_DNSSnapin; // In-Proc server GUID
  15. extern const CLSID CLSID_DNSSnapinEx; // In-Proc server GUID
  16. extern const CLSID CLSID_DNSSnapinAbout; // In-Proc server GUID
  17. extern const CLSID CLSID_DNSSnapinAboutEx; // In-Proc server GUID
  18. ///////////////////////////////////////////////////////////////////////////////
  19. // RESOURCES
  20. // enumeration for image strips
  21. enum
  22. {
  23. ROOT_IMAGE = 0,
  24. SEPARATOR_1,
  25. // 10 (5 regular, 5 test failed) images for server
  26. SERVER_IMAGE_NOT_LOADED,
  27. SERVER_IMAGE_LOADING,
  28. SERVER_IMAGE_LOADED,
  29. SERVER_IMAGE_UNABLE_TO_LOAD,
  30. SERVER_IMAGE_ACCESS_DENIED,
  31. SERVER_IMAGE_NOT_LOADED_TEST_FAIL,
  32. SERVER_IMAGE_LOADING_TEST_FAIL,
  33. SERVER_IMAGE_LOADED_TEST_FAIL,
  34. SERVER_IMAGE_UNABLE_TO_LOAD_TEST_FAIL,
  35. SERVER_IMAGE_ACCESS_DENIED_TEST_FAIL,
  36. SEPARATOR_2,
  37. // 12 (6 primary, 6 secondary) images for zones
  38. ZONE_IMAGE_1,
  39. ZONE_IMAGE_LOADING_1,
  40. ZONE_IMAGE_UNABLE_TO_LOAD_1,
  41. ZONE_IMAGE_PAUSED_1,
  42. ZONE_IMAGE_EXPIRED_1,
  43. ZONE_IMAGE_ACCESS_DENIED_1,
  44. SEPARATOR_3,
  45. ZONE_IMAGE_2,
  46. ZONE_IMAGE_LOADING_2,
  47. ZONE_IMAGE_UNABLE_TO_LOAD_2,
  48. ZONE_IMAGE_PAUSED_2,
  49. ZONE_IMAGE_EXPIRED_2,
  50. ZONE_IMAGE_ACCESS_DENIED_2,
  51. SEPARATOR_4,
  52. // 4 images for domains
  53. DOMAIN_IMAGE,
  54. DOMAIN_IMAGE_UNABLE_TO_LOAD,
  55. DOMAIN_IMAGE_LOADING,
  56. DOMAIN_IMAGE_ACCESS_DENIED,
  57. SEPARATOR_5,
  58. // 4 images for delegated domains
  59. DELEGATED_DOMAIN_IMAGE,
  60. DELEGATED_DOMAIN_IMAGE_UNABLE_TO_LOAD,
  61. DELEGATED_DOMAIN_IMAGE_LOADING,
  62. DELEGATED_DOMAIN_IMAGE_ACCESS_DENIED,
  63. SEPARATOR_6,
  64. // 4 generic images shared by cache, fwd and rev lookup zones
  65. FOLDER_IMAGE,
  66. FOLDER_IMAGE_UNABLE_TO_LOAD,
  67. FOLDER_IMAGE_LOADING,
  68. FOLDER_IMAGE_ACCESS_DENIED,
  69. SEPARATOR_7,
  70. // 1 record image
  71. RECORD_IMAGE_BASE,
  72. OPEN_FOLDER, // unused
  73. FOLDER_WITH_HAND
  74. };
  75. ////////////////////////////////////////////////////////////////
  76. // aliases for images indexes that share the same icon
  77. #define ZONE_IMAGE_NOT_LOADED_1 ZONE_IMAGE_1
  78. #define ZONE_IMAGE_NOT_LOADED_2 ZONE_IMAGE_2
  79. #define ZONE_IMAGE_LOADED_1 ZONE_IMAGE_1
  80. #define ZONE_IMAGE_LOADED_2 ZONE_IMAGE_2
  81. #define DOMAIN_IMAGE_NOT_LOADED DOMAIN_IMAGE
  82. #define DOMAIN_IMAGE_LOADED DOMAIN_IMAGE
  83. #define DELEGATED_DOMAIN_IMAGE_NOT_LOADED DELEGATED_DOMAIN_IMAGE
  84. #define DELEGATED_DOMAIN_IMAGE_LOADED DELEGATED_DOMAIN_IMAGE
  85. #define FOLDER_IMAGE_NOT_LOADED FOLDER_IMAGE
  86. #define FOLDER_IMAGE_LOADED FOLDER_IMAGE
  87. ///////////////////////////////////////////////////////////////
  88. // bitmaps and images constants
  89. #define BMP_COLOR_MASK RGB(255,0,255) // pink
  90. ///////////////////////////////////////////////////////////////
  91. // headers for result pane
  92. #define N_HEADER_COLS (3)
  93. #define N_DEFAULT_HEADER_COLS (3)
  94. #define N_SERVER_HEADER_COLS (1)
  95. #define N_ZONE_HEADER_COLS (3)
  96. #define N_HEADER_NAME (0)
  97. #define N_HEADER_TYPE (1)
  98. #define N_HEADER_DATA (2)
  99. //#define N_HEADER_PARTITION (3)
  100. extern RESULT_HEADERMAP _DefaultHeaderStrings[];
  101. extern RESULT_HEADERMAP _ServerHeaderStrings[];
  102. extern RESULT_HEADERMAP _ZoneHeaderStrings[];
  103. struct ZONE_TYPE_MAP
  104. {
  105. WCHAR szBuffer[MAX_RESULT_HEADER_STRLEN];
  106. UINT uResID;
  107. };
  108. extern ZONE_TYPE_MAP _ZoneTypeStrings[];
  109. BOOL LoadZoneTypeResources(ZONE_TYPE_MAP* pHeaderMap, int nCols);
  110. ///////////////////////////////////////////////////////////////
  111. // context menus
  112. // Identifiers for each of the commands in the context menu.
  113. enum
  114. {
  115. // items for the root node
  116. IDM_SNAPIN_ADVANCED_VIEW,
  117. IDM_SNAPIN_MESSAGE,
  118. IDM_SNAPIN_FILTERING,
  119. IDM_SNAPIN_CONNECT_TO_SERVER,
  120. // items for the server node
  121. IDM_SERVER_CONFIGURE,
  122. IDM_SERVER_CREATE_NDNC,
  123. IDM_SERVER_NEW_ZONE,
  124. IDM_SERVER_SET_AGING,
  125. IDM_SERVER_SCAVENGE,
  126. IDM_SERVER_UPDATE_DATA_FILES,
  127. IDM_SERVER_CLEAR_CACHE,
  128. // items for the cache folder
  129. IDM_CACHE_FOLDER_CLEAR_CACHE,
  130. // items for the zone node
  131. IDM_ZONE_UPDATE_DATA_FILE,
  132. IDM_ZONE_RELOAD,
  133. IDM_ZONE_TRANSFER,
  134. IDM_ZONE_RELOAD_FROM_MASTER,
  135. // items for the domain node
  136. IDM_DOMAIN_NEW_RECORD,
  137. IDM_DOMAIN_NEW_DOMAIN,
  138. IDM_DOMAIN_NEW_DELEGATION,
  139. IDM_DOMAIN_NEW_HOST,
  140. IDM_DOMAIN_NEW_ALIAS,
  141. IDM_DOMAIN_NEW_MX,
  142. IDM_DOMAIN_NEW_PTR,
  143. // common items
  144. };
  145. DECLARE_MENU(CDNSRootDataMenuHolder)
  146. DECLARE_MENU(CDNSServerMenuHolder)
  147. DECLARE_MENU(CDNSCathegoryFolderHolder)
  148. DECLARE_MENU(CDNSAuthoritatedZonesMenuHolder)
  149. DECLARE_MENU(CDNSCacheMenuHolder);
  150. DECLARE_MENU(CDNSZoneMenuHolder)
  151. DECLARE_MENU(CDNSDomainMenuHolder)
  152. DECLARE_MENU(CDNSRecordMenuHolder)
  153. //
  154. // Toolbar events
  155. //
  156. DECLARE_TOOLBAR_EVENT(toolbarNewServer, 1001)
  157. DECLARE_TOOLBAR_EVENT(toolbarNewRecord, 1002)
  158. DECLARE_TOOLBAR_EVENT(toolbarNewZone, 1003)
  159. ////////////////////////////////////////////////////////////////////////
  160. // CDNSComponentObject (.i.e "view")
  161. class CDNSComponentObject : public CComponentObject
  162. {
  163. BEGIN_COM_MAP(CDNSComponentObject)
  164. COM_INTERFACE_ENTRY(IComponent) // have to have at least one static entry, so pick one
  165. COM_INTERFACE_ENTRY_CHAIN(CComponentObject) // chain to the base class
  166. END_COM_MAP()
  167. DECLARE_NOT_AGGREGATABLE(CDNSComponentObject)
  168. protected:
  169. virtual HRESULT InitializeHeaders(CContainerNode* pContainerNode);
  170. virtual HRESULT InitializeBitmaps(CTreeNode* cookie);
  171. virtual HRESULT InitializeToolbar(IToolbar* pToolbar);
  172. HRESULT LoadToolbarStrings(MMCBUTTON * Buttons);
  173. };
  174. //////////////////////////////////////////////////////////////////////////
  175. // CDNSDefaultColumnSet
  176. class CDNSDefaultColumnSet : public CColumnSet
  177. {
  178. public :
  179. CDNSDefaultColumnSet(LPCWSTR lpszColumnID)
  180. : CColumnSet(lpszColumnID)
  181. {
  182. for (int iCol = 0; iCol < N_DEFAULT_HEADER_COLS; iCol++)
  183. {
  184. CColumn* pNewColumn = new CColumn(_DefaultHeaderStrings[iCol].szBuffer,
  185. _DefaultHeaderStrings[iCol].nFormat,
  186. _DefaultHeaderStrings[iCol].nWidth,
  187. iCol);
  188. AddTail(pNewColumn);
  189. }
  190. }
  191. };
  192. //////////////////////////////////////////////////////////////////////////
  193. // CDNSServerColumnSet
  194. class CDNSServerColumnSet : public CColumnSet
  195. {
  196. public :
  197. CDNSServerColumnSet(LPCWSTR lpszColumnID)
  198. : CColumnSet(lpszColumnID)
  199. {
  200. for (int iCol = 0; iCol < N_SERVER_HEADER_COLS; iCol++)
  201. {
  202. CColumn* pNewColumn = new CColumn(_ServerHeaderStrings[iCol].szBuffer,
  203. _ServerHeaderStrings[iCol].nFormat,
  204. _ServerHeaderStrings[iCol].nWidth,
  205. iCol);
  206. AddTail(pNewColumn);
  207. }
  208. }
  209. };
  210. //////////////////////////////////////////////////////////////////////////
  211. // CDNSZoneColumnSet
  212. class CDNSZoneColumnSet : public CColumnSet
  213. {
  214. public :
  215. CDNSZoneColumnSet(LPCWSTR lpszColumnID)
  216. : CColumnSet(lpszColumnID)
  217. {
  218. for (int iCol = 0; iCol < N_ZONE_HEADER_COLS; iCol++)
  219. {
  220. CColumn* pNewColumn = new CColumn(_ZoneHeaderStrings[iCol].szBuffer,
  221. _ZoneHeaderStrings[iCol].nFormat,
  222. _ZoneHeaderStrings[iCol].nWidth,
  223. iCol);
  224. AddTail(pNewColumn);
  225. }
  226. }
  227. };
  228. ////////////////////////////////////////////////////////////////////////
  229. // CDNSComponentDataObjectBase (.i.e "document")
  230. class CDNSComponentDataObjectBase : public CComponentDataObject
  231. {
  232. BEGIN_COM_MAP(CDNSComponentDataObjectBase)
  233. COM_INTERFACE_ENTRY(IComponentData) // have to have at least one static entry, so pick one
  234. COM_INTERFACE_ENTRY_CHAIN(CComponentDataObject) // chain to the base class
  235. END_COM_MAP()
  236. DECLARE_NOT_AGGREGATABLE(CDNSComponentDataObjectBase)
  237. public:
  238. CDNSComponentDataObjectBase();
  239. virtual ~CDNSComponentDataObjectBase()
  240. {
  241. }
  242. // IComponentData interface members
  243. STDMETHOD(CreateComponent)(LPCOMPONENT* ppComponent);
  244. public:
  245. static BOOL LoadResources();
  246. private:
  247. static BOOL FindDialogContextTopic(/*IN*/UINT nDialogID,
  248. /*IN*/ HELPINFO* pHelpInfo,
  249. /*OUT*/ ULONG* pnContextTopic);
  250. // virtual functions
  251. protected:
  252. virtual HRESULT OnSetImages(LPIMAGELIST lpScopeImage);
  253. virtual CRootData* OnCreateRootData();
  254. // help handling
  255. virtual LPCWSTR GetHTMLHelpFileName();
  256. virtual void OnNodeContextHelp(CNodeList* pNodeList);
  257. public:
  258. virtual void OnDialogContextHelp(UINT nDialogID, HELPINFO* pHelpInfo);
  259. // Timer and Background Thread
  260. protected:
  261. virtual void OnTimer();
  262. virtual void OnTimerThread(WPARAM wParam, LPARAM lParam);
  263. virtual CTimerThread* OnCreateTimerThread();
  264. DWORD m_dwTime; // in
  265. public:
  266. CColumnSet* GetColumnSet(LPCWSTR lpszID)
  267. {
  268. return m_columnSetList.FindColumnSet(lpszID);
  269. }
  270. private:
  271. CColumnSetList m_columnSetList;
  272. };
  273. ////////////////////////////////////////////////////////////////////////
  274. // CDNSComponentDataObject (.i.e "document")
  275. // primary snapin
  276. class CDNSComponentDataObject :
  277. public CDNSComponentDataObjectBase,
  278. public CComCoClass<CDNSComponentDataObject,&CLSID_DNSSnapin>
  279. {
  280. BEGIN_COM_MAP(CDNSComponentDataObject)
  281. COM_INTERFACE_ENTRY(IComponentData) // have to have at least one static entry, so pick one
  282. COM_INTERFACE_ENTRY_CHAIN(CDNSComponentDataObjectBase) // chain to the base class
  283. END_COM_MAP()
  284. DECLARE_NOT_AGGREGATABLE(CDNSComponentDataObject)
  285. DECLARE_REGISTRY_CLSID()
  286. public:
  287. CDNSComponentDataObject()
  288. {
  289. }
  290. // IPersistStream interface members
  291. HRESULT STDMETHODCALLTYPE GetClassID(CLSID __RPC_FAR *pClassID)
  292. {
  293. ASSERT(pClassID != NULL);
  294. memcpy(pClassID, (GUID*)&GetObjectCLSID(), sizeof(CLSID));
  295. return S_OK;
  296. }
  297. virtual BOOL IsMultiSelect() { return TRUE; }
  298. };
  299. ////////////////////////////////////////////////////////////////////////
  300. // CDNSComponentDataObjectEx (.i.e "document")
  301. // extension snapin
  302. class CDNSComponentDataObjectEx :
  303. public CDNSComponentDataObjectBase,
  304. public CComCoClass<CDNSComponentDataObjectEx,&CLSID_DNSSnapinEx>
  305. {
  306. BEGIN_COM_MAP(CDNSComponentDataObjectEx)
  307. COM_INTERFACE_ENTRY(IComponentData) // have to have at least one static entry, so pick one
  308. COM_INTERFACE_ENTRY_CHAIN(CDNSComponentDataObjectBase) // chain to the base class
  309. END_COM_MAP()
  310. DECLARE_NOT_AGGREGATABLE(CDNSComponentDataObjectEx)
  311. DECLARE_REGISTRY_CLSID()
  312. public:
  313. CDNSComponentDataObjectEx()
  314. {
  315. SetExtensionSnapin(TRUE);
  316. }
  317. // IPersistStream interface members
  318. HRESULT STDMETHODCALLTYPE GetClassID(CLSID __RPC_FAR *pClassID)
  319. {
  320. ASSERT(pClassID != NULL);
  321. memcpy(pClassID, (GUID*)&GetObjectCLSID(), sizeof(CLSID));
  322. return S_OK;
  323. }
  324. protected:
  325. virtual HRESULT OnExtensionExpand(LPDATAOBJECT lpDataObject, LPARAM param);
  326. virtual HRESULT OnRemoveChildren(LPDATAOBJECT lpDataObject, LPARAM arg);
  327. };
  328. //////////////////////////////////////////////////////////////////////////
  329. // CDNSSnapinAbout
  330. class CDNSSnapinAbout :
  331. public CSnapinAbout,
  332. public CComCoClass<CDNSSnapinAbout, &CLSID_DNSSnapinAbout>
  333. {
  334. public:
  335. DECLARE_REGISTRY_CLSID()
  336. CDNSSnapinAbout();
  337. };
  338. //////////////////////////////////////////////////////////////////////////
  339. // CDNSSnapinAboutEx
  340. class CDNSSnapinAboutEx :
  341. public CSnapinAbout,
  342. public CComCoClass<CDNSSnapinAboutEx, &CLSID_DNSSnapinAboutEx>
  343. {
  344. public:
  345. DECLARE_REGISTRY_CLSID()
  346. CDNSSnapinAboutEx();
  347. };
  348. #endif _DNSSNAP_H