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.

334 lines
8.4 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1998 - 1999
  6. //
  7. // File: adsiedit.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #ifndef _ADSIEDIT_H
  11. #define _ADSIEDIT_H
  12. #include <stdabout.h>
  13. //////////////////////////////////////////////////////////////////////////////
  14. // global constants and macros
  15. extern const CLSID CLSID_ADSIEditSnapin; // In-Proc server GUID
  16. extern const CLSID CLSID_ADSIEditAbout; // In-Proc server GUID
  17. extern const CLSID CLSID_DsAttributeEditor;
  18. extern const CLSID IID_IDsAttributeEditor;
  19. ///////////////////////////////////////////////////////////////////////////////
  20. // RESOURCES
  21. // enumeration for image strips
  22. enum
  23. {
  24. ROOT_IMAGE = 0,
  25. SEPARATOR_1,
  26. // 10 (5 regular, 5 test failed) images for server
  27. SERVER_IMAGE_NOT_LOADED,
  28. SERVER_IMAGE_LOADING,
  29. SERVER_IMAGE_LOADED,
  30. SERVER_IMAGE_UNABLE_TO_LOAD,
  31. SERVER_IMAGE_ACCESS_DENIED,
  32. SERVER_IMAGE_NOT_LOADED_TEST_FAIL,
  33. SERVER_IMAGE_LOADING_TEST_FAIL,
  34. SERVER_IMAGE_LOADED_TEST_FAIL,
  35. SERVER_IMAGE_UNABLE_TO_LOAD_TEST_FAIL,
  36. SERVER_IMAGE_ACCESS_DENIED_TEST_FAIL,
  37. SEPARATOR_2,
  38. // 12 (6 primary, 6 secondary) images for zones
  39. ZONE_IMAGE_1,
  40. ZONE_IMAGE_LOADING_1,
  41. ZONE_IMAGE_UNABLE_TO_LOAD_1,
  42. ZONE_IMAGE_PAUSED_1,
  43. ZONE_IMAGE_EXPIRED_1,
  44. ZONE_IMAGE_ACCESS_DENIED_1,
  45. SEPARATOR_3,
  46. ZONE_IMAGE_2,
  47. ZONE_IMAGE_LOADING_2,
  48. ZONE_IMAGE_UNABLE_TO_LOAD_2,
  49. ZONE_IMAGE_PAUSED_2,
  50. ZONE_IMAGE_EXPIRED_2,
  51. ZONE_IMAGE_ACCESS_DENIED_2,
  52. SEPARATOR_4,
  53. // 4 images for domains
  54. DOMAIN_IMAGE,
  55. DOMAIN_IMAGE_UNABLE_TO_LOAD,
  56. DOMAIN_IMAGE_LOADING,
  57. DOMAIN_IMAGE_ACCESS_DENIED,
  58. SEPARATOR_5,
  59. // 4 images for delegated domains
  60. DELEGATED_DOMAIN_IMAGE,
  61. DELEGATED_DOMAIN_IMAGE_UNABLE_TO_LOAD,
  62. DELEGATED_DOMAIN_IMAGE_LOADING,
  63. DELEGATED_DOMAIN_IMAGE_ACCESS_DENIED,
  64. SEPARATOR_6,
  65. // 4 generic images shared by cache, fwd and rev lookup zones
  66. FOLDER_IMAGE,
  67. FOLDER_IMAGE_UNABLE_TO_LOAD,
  68. FOLDER_IMAGE_LOADING,
  69. FOLDER_IMAGE_ACCESS_DENIED,
  70. SEPARATOR_7,
  71. // 1 record image
  72. RECORD_IMAGE_BASE,
  73. OPEN_FOLDER, // unused
  74. FOLDER_WITH_HAND
  75. };
  76. ////////////////////////////////////////////////////////////////
  77. // aliases for images indexes that share the same icon
  78. #define ZONE_IMAGE_NOT_LOADED_1 ZONE_IMAGE_1
  79. #define ZONE_IMAGE_NOT_LOADED_2 ZONE_IMAGE_2
  80. #define ZONE_IMAGE_LOADED_1 ZONE_IMAGE_1
  81. #define ZONE_IMAGE_LOADED_2 ZONE_IMAGE_2
  82. #define DOMAIN_IMAGE_NOT_LOADED DOMAIN_IMAGE
  83. #define DOMAIN_IMAGE_LOADED DOMAIN_IMAGE
  84. #define DELEGATED_DOMAIN_IMAGE_NOT_LOADED DELEGATED_DOMAIN_IMAGE
  85. #define DELEGATED_DOMAIN_IMAGE_LOADED DELEGATED_DOMAIN_IMAGE
  86. #define FOLDER_IMAGE_NOT_LOADED FOLDER_IMAGE
  87. #define FOLDER_IMAGE_LOADED FOLDER_IMAGE
  88. ///////////////////////////////////////////////////////////////
  89. // bitmaps and images constants
  90. #define BMP_COLOR_MASK RGB(255,0,255) // pink
  91. ///////////////////////////////////////////////////////////////
  92. // headers for result pane
  93. #define N_HEADER_COLS (3)
  94. #define N_PARTITIONS_HEADER_COLS (4)
  95. #define COLUMNSET_ID_DEFAULT L"--ADSI Edit Column Set--"
  96. #define COLUMNSET_ID_PARTITIONS L"--Partitions Column Set--"
  97. #define N_HEADER_NAME (0)
  98. #define N_HEADER_TYPE (1)
  99. #define N_HEADER_DN (2)
  100. #define N_PARTITIONS_HEADER_NAME (0)
  101. #define N_PARTITIONS_HEADER_NCNAME (1)
  102. #define N_PARTITIONS_HEADER_TYPE (2)
  103. #define N_PARTITIONS_HEADER_DN (3)
  104. typedef struct _ColumnDefinition
  105. {
  106. PCWSTR pszColumnID;
  107. DWORD dwColumnCount;
  108. RESULT_HEADERMAP* headers;
  109. } COLUMN_DEFINITION, *PCOLUMN_DEFINITION;
  110. extern PCOLUMN_DEFINITION ColumnDefinitions[];
  111. extern RESULT_HEADERMAP _HeaderStrings[];
  112. extern RESULT_HEADERMAP _PartitionsHeaderStrings[];
  113. ///////////////////////////////////////////////////////////////
  114. // context menus
  115. // Identifiers for each of the commands in the context menu.
  116. enum
  117. {
  118. // items for the root node
  119. IDM_SNAPIN_ADVANCED_VIEW,
  120. IDM_SNAPIN_FILTERING,
  121. IDM_SNAPIN_CONNECT_TO_SERVER,
  122. // items for the server node
  123. IDM_SERVER_NEW_ZONE,
  124. IDM_SERVER_UPDATE_DATA_FILES,
  125. // items for the zone node
  126. IDM_ZONE_UPDATE_DATA_FILE,
  127. // items for the domain node
  128. IDM_DOMAIN_NEW_RECORD,
  129. IDM_DOMAIN_NEW_DOMAIN,
  130. IDM_DOMAIN_NEW_DELEGATION,
  131. IDM_DOMAIN_NEW_HOST,
  132. IDM_DOMAIN_NEW_ALIAS,
  133. IDM_DOMAIN_NEW_MX,
  134. IDM_DOMAIN_NEW_PTR,
  135. // common items
  136. };
  137. DECLARE_MENU(CADSIEditDataMenuHolder)
  138. //////////////////////////////////////////////////////////////////////////
  139. // CADSIEditColumnSet
  140. class CADSIEditColumnSet : public CColumnSet
  141. {
  142. public :
  143. CADSIEditColumnSet(PCWSTR pszColumnID)
  144. : CColumnSet(pszColumnID)
  145. {
  146. PCOLUMN_DEFINITION pColumnDef = NULL;
  147. for (UINT nIdx = 0; ColumnDefinitions[nIdx]; nIdx++)
  148. {
  149. pColumnDef = ColumnDefinitions[nIdx];
  150. if (0 == _wcsicmp(pColumnDef->pszColumnID, pszColumnID))
  151. {
  152. break;
  153. }
  154. }
  155. if (pColumnDef)
  156. {
  157. for (int iCol = 0; iCol < pColumnDef->dwColumnCount; iCol++)
  158. {
  159. CColumn* pNewColumn = new CColumn(pColumnDef->headers[iCol].szBuffer,
  160. pColumnDef->headers[iCol].nFormat,
  161. pColumnDef->headers[iCol].nWidth,
  162. iCol);
  163. AddTail(pNewColumn);
  164. }
  165. }
  166. else
  167. {
  168. //
  169. // Fall back to adding the default column directly
  170. //
  171. for (int iCol = 0; iCol < N_HEADER_COLS; iCol++)
  172. {
  173. CColumn* pNewColumn = new CColumn(_HeaderStrings[iCol].szBuffer,
  174. _HeaderStrings[iCol].nFormat,
  175. _HeaderStrings[iCol].nWidth,
  176. iCol);
  177. AddTail(pNewColumn);
  178. }
  179. }
  180. }
  181. };
  182. ////////////////////////////////////////////////////////////////////////
  183. // CADSIEditComponentObject (.i.e "view")
  184. class CADSIEditComponentObject : public CComponentObject
  185. {
  186. BEGIN_COM_MAP(CADSIEditComponentObject)
  187. COM_INTERFACE_ENTRY(IComponent) // have to have at least one static entry, so pick one
  188. COM_INTERFACE_ENTRY_CHAIN(CComponentObject) // chain to the base class
  189. END_COM_MAP()
  190. DECLARE_NOT_AGGREGATABLE(CADSIEditComponentObject)
  191. protected:
  192. virtual HRESULT InitializeHeaders(CContainerNode* pContainerNode);
  193. virtual HRESULT InitializeBitmaps(CTreeNode* cookie);
  194. virtual HRESULT InitializeToolbar(IToolbar* pToolbar) { return E_NOTIMPL; }
  195. };
  196. ////////////////////////////////////////////////////////////////////////
  197. // CADSIEditComponentDataObject (.i.e "document")
  198. class CADSIEditComponentDataObject :
  199. public CComponentDataObject,
  200. public CComCoClass<CADSIEditComponentDataObject,&CLSID_ADSIEditSnapin>
  201. {
  202. BEGIN_COM_MAP(CADSIEditComponentDataObject)
  203. COM_INTERFACE_ENTRY(IComponentData) // have to have at least one static entry, so pick one
  204. COM_INTERFACE_ENTRY_CHAIN(CComponentDataObject) // chain to the base class
  205. END_COM_MAP()
  206. DECLARE_NOT_AGGREGATABLE(CADSIEditComponentDataObject)
  207. DECLARE_REGISTRY_CLSID()
  208. public:
  209. CADSIEditComponentDataObject();
  210. virtual ~CADSIEditComponentDataObject()
  211. {
  212. if (m_pColumnSet != NULL)
  213. delete m_pColumnSet;
  214. }
  215. // IComponentData interface members
  216. STDMETHOD(CreateComponent)(LPCOMPONENT* ppComponent);
  217. // IPersistStream interface members
  218. HRESULT STDMETHODCALLTYPE GetClassID(CLSID __RPC_FAR *pClassID)
  219. {
  220. ASSERT(pClassID != NULL);
  221. memcpy(pClassID, (GUID*)&GetObjectCLSID(), sizeof(CLSID));
  222. return S_OK;
  223. }
  224. public:
  225. static BOOL LoadResources();
  226. private:
  227. static BOOL FindDialogContextTopic(/*IN*/UINT nDialogID,
  228. /*IN*/ HELPINFO* pHelpInfo,
  229. /*OUT*/ ULONG* pnContextTopic);
  230. // virtual functions
  231. protected:
  232. virtual HRESULT OnSetImages(LPIMAGELIST lpScopeImage);
  233. virtual CRootData* OnCreateRootData();
  234. // help handling
  235. virtual LPCWSTR GetHTMLHelpFileName();
  236. virtual void OnNodeContextHelp(CTreeNode* pNode);
  237. public:
  238. virtual void OnDialogContextHelp(UINT nDialogID, HELPINFO* pHelpInfo);
  239. // ISnapinHelp interface members
  240. STDMETHOD(GetHelpTopic)(LPOLESTR* lpCompiledHelpFile);
  241. CADSIEditColumnSet* GetColumnSet() { return m_pColumnSet; }
  242. //
  243. // Allow multiple selection
  244. //
  245. virtual BOOL IsMultiSelect() { return TRUE; }
  246. private:
  247. CADSIEditColumnSet* m_pColumnSet;
  248. };
  249. //////////////////////////////////////////////////////////////////////////
  250. // CADSIEditAbout
  251. class CADSIEditAbout :
  252. public CSnapinAbout,
  253. public CComCoClass<CADSIEditAbout, &CLSID_ADSIEditAbout>
  254. {
  255. public:
  256. DECLARE_REGISTRY_CLSID()
  257. CADSIEditAbout();
  258. };
  259. #endif _ADSIEDIT_H