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.

718 lines
19 KiB

  1. // This is a part of the Microsoft Management Console.
  2. // Copyright (C) Microsoft Corporation, 1995 - 1999
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Management Console and related
  7. // electronic documentation provided with the interfaces.
  8. // You will need the NT SUR Beta 2 SDK or VC 4.2 in order to build this
  9. // project. This is because you will need MIDL 3.00.15 or higher and new
  10. // headers and libs. If you have VC 4.2 installed, then everything should
  11. // already be configured correctly.
  12. #include "pch.h"
  13. #include "resource.h"
  14. #include <SnapBase.h>
  15. #include "ADSIEdit.h"
  16. #include "snapdata.h"
  17. #include "editor.h"
  18. #include "connection.h"
  19. #include "querynode.h"
  20. #include "IAttredt.h"
  21. #include "editorui.h"
  22. #include "editimpl.h"
  23. //#include "HelpArr.h" // context help ID's
  24. #ifdef DEBUG_ALLOCATOR
  25. #ifdef _DEBUG
  26. #define new DEBUG_NEW
  27. #undef THIS_FILE
  28. static char THIS_FILE[] = __FILE__;
  29. #endif
  30. #endif
  31. //////////////////////////////////////////////////////////////////////////////
  32. // regsvr debugging
  33. // define to enable MsgBox debugging for regsvr32
  34. //#define _MSGBOX_ON_REG_FAIL
  35. #ifdef _MSGBOX_ON_REG_FAIL
  36. #define _MSGBOX(x) AfxMessageBox(x)
  37. #else
  38. #define _MSGBOX(x)
  39. #endif
  40. #ifdef _MSGBOX_ON_REG_FAIL
  41. #define _REPORT_FAIL(lpszMessage, lpszClsid, lRes) \
  42. ReportFail(lpszMessage, lpszClsid, lRes)
  43. void ReportFail(LPCWSTR lpszMessage, LPCWSTR lpszClsid, LONG lRes)
  44. {
  45. if (lRes == ERROR_SUCCESS)
  46. return;
  47. CString sz;
  48. sz.Format(_T("%s %s %d"), lpszMessage,lpszClsid, lRes);
  49. AfxMessageBox(sz);
  50. }
  51. #else
  52. #define _REPORT_FAIL(lpszMessage, lpszClsid, lRes)
  53. #endif
  54. //////////////////////////////////////////////////////////////////////////////
  55. // global constants and macros
  56. // GUIDs for snapin
  57. // {1C5DACFA-16BA-11d2-81D0-0000F87A7AA3}
  58. static const GUID CLSID_ADSIEditSnapin =
  59. { 0x1c5dacfa, 0x16ba, 0x11d2, { 0x81, 0xd0, 0x0, 0x0, 0xf8, 0x7a, 0x7a, 0xa3 } };
  60. // {E6F27C2A-16BA-11d2-81D0-0000F87A7AA3}
  61. static const GUID CLSID_ADSIEditAbout =
  62. { 0xe6f27c2a, 0x16ba, 0x11d2, { 0x81, 0xd0, 0x0, 0x0, 0xf8, 0x7a, 0x7a, 0xa3 } };
  63. // GUIDs for node types
  64. ///////////////////////////////////////////////////////////////////////////////
  65. // RESOURCES
  66. // # of columns in the result pane and map for resource strings
  67. extern RESULT_HEADERMAP _HeaderStrings[] =
  68. {
  69. { L"", IDS_HEADER_NAME, LVCFMT_LEFT, 180},
  70. { L"", IDS_HEADER_TYPE, LVCFMT_LEFT, 90},
  71. { L"", IDS_HEADER_DN, LVCFMT_LEFT, 450},
  72. };
  73. COLUMN_DEFINITION DefaultColumnDefinition =
  74. {
  75. COLUMNSET_ID_DEFAULT,
  76. N_HEADER_COLS,
  77. _HeaderStrings
  78. };
  79. extern RESULT_HEADERMAP _PartitionsHeaderStrings[] =
  80. {
  81. { L"", IDS_HEADER_NAME, LVCFMT_LEFT, 180},
  82. { L"", IDS_HEADER_NCNAME, LVCFMT_LEFT, 200},
  83. { L"", IDS_HEADER_TYPE, LVCFMT_LEFT, 90},
  84. { L"", IDS_HEADER_DN, LVCFMT_LEFT, 450},
  85. };
  86. COLUMN_DEFINITION PartitionsColumnDefinition =
  87. {
  88. COLUMNSET_ID_PARTITIONS,
  89. N_PARTITIONS_HEADER_COLS,
  90. _PartitionsHeaderStrings
  91. };
  92. extern PCOLUMN_DEFINITION ColumnDefinitions[] =
  93. {
  94. &DefaultColumnDefinition,
  95. &PartitionsColumnDefinition,
  96. NULL
  97. };
  98. ///////////////////////////////////////////////////////////////////////////////
  99. // CADSIEditModule
  100. HRESULT WINAPI CADSIEditModule::UpdateRegistryCLSID(const CLSID& clsid, BOOL bRegister)
  101. {
  102. static const WCHAR szIPS32[] = _T("InprocServer32");
  103. static const WCHAR szCLSID[] = _T("CLSID");
  104. HRESULT hRes = S_OK;
  105. LPOLESTR lpOleStrCLSIDValue;
  106. ::StringFromCLSID(clsid, &lpOleStrCLSIDValue);
  107. if (lpOleStrCLSIDValue == NULL)
  108. {
  109. return E_OUTOFMEMORY;
  110. }
  111. CRegKey key;
  112. if (bRegister)
  113. {
  114. LONG lRes = key.Open(HKEY_CLASSES_ROOT, szCLSID);
  115. _REPORT_FAIL(L"key.Open(HKEY_CLASSES_ROOT", lpOleStrCLSIDValue, lRes);
  116. if (lRes == ERROR_SUCCESS)
  117. {
  118. lRes = key.Create(key, lpOleStrCLSIDValue);
  119. _REPORT_FAIL(L"key.Create(key", lpOleStrCLSIDValue, lRes);
  120. if (lRes == ERROR_SUCCESS)
  121. {
  122. WCHAR szModule[_MAX_PATH];
  123. ::GetModuleFileName(m_hInst, szModule, _MAX_PATH);
  124. lRes = key.SetKeyValue(szIPS32, szModule);
  125. _REPORT_FAIL(L"key.SetKeyValue(szIPS32", lpOleStrCLSIDValue, lRes);
  126. }
  127. }
  128. if (lRes != ERROR_SUCCESS)
  129. hRes = HRESULT_FROM_WIN32(lRes);
  130. }
  131. else
  132. {
  133. key.Attach(HKEY_CLASSES_ROOT);
  134. if (key.Open(key, szCLSID) == ERROR_SUCCESS)
  135. key.RecurseDeleteKey(lpOleStrCLSIDValue);
  136. }
  137. ::CoTaskMemFree(lpOleStrCLSIDValue);
  138. return hRes;
  139. }
  140. ///////////////////////////////////////////////////////////////////////////////
  141. // Module, Object Map and DLL entry points
  142. CADSIEditModule _Module;
  143. BEGIN_OBJECT_MAP(ObjectMap)
  144. OBJECT_ENTRY(CLSID_ADSIEditSnapin, CADSIEditComponentDataObject)
  145. OBJECT_ENTRY(CLSID_ADSIEditAbout, CADSIEditAbout)
  146. OBJECT_ENTRY(CLSID_DsAttributeEditor, CAttributeEditor)
  147. END_OBJECT_MAP()
  148. STDAPI DllCanUnloadNow(void)
  149. {
  150. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  151. return (AfxDllCanUnloadNow()==S_OK && _Module.GetLockCount()==0) ? S_OK : S_FALSE;
  152. }
  153. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  154. {
  155. return _Module.GetClassObject(rclsid, riid, ppv);
  156. }
  157. static _NODE_TYPE_INFO_ENTRY _NodeTypeInfoEntryArray[] = {
  158. { &CADSIEditRootData::NodeTypeGUID, _T("Root ADSI Edit Subtree") },
  159. { &CADSIEditConnectionNode::NodeTypeGUID, _T("ADSI Edit Connection Node") },
  160. { &CADSIEditContainerNode::NodeTypeGUID, _T("ADSI Edit Container Node") },
  161. { &CADSIEditLeafNode::NodeTypeGUID, _T("ADSI Edit Leaf Node") },
  162. { &CADSIEditQueryNode::NodeTypeGUID, _T("ADSI Edit Query Node") },
  163. { NULL, NULL }
  164. };
  165. ////////////////////////////////////////////////////////////////////
  166. STDAPI DllRegisterServer(void)
  167. {
  168. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  169. // registers all objects
  170. HRESULT hr = _Module.RegisterServer(/* bRegTypeLib */ FALSE);
  171. ASSERT(SUCCEEDED(hr));
  172. if (FAILED(hr))
  173. {
  174. _MSGBOX(_T("_Module.RegisterServer() failed"));
  175. return hr;
  176. }
  177. CString szVersion, szProvider, szSnapinName, szSnapinNameEx;
  178. szVersion.LoadString(IDS_SNAPIN_VERSION);
  179. szProvider.LoadString(IDS_SNAPIN_PROVIDER);
  180. szSnapinName.LoadString(IDS_SNAPIN_NAME);
  181. // register the standalone ADSI Edit snapin into the console snapin list
  182. hr = RegisterSnapin(&CLSID_ADSIEditSnapin,
  183. &CADSIEditRootData::NodeTypeGUID,
  184. &CLSID_ADSIEditAbout,
  185. szSnapinName, szVersion, szProvider,
  186. FALSE /*bExtension*/,
  187. _NodeTypeInfoEntryArray);
  188. ASSERT(SUCCEEDED(hr));
  189. if (FAILED(hr))
  190. {
  191. _MSGBOX(_T("RegisterSnapin(&CLSID_DNSSnapin) failed"));
  192. return hr;
  193. }
  194. // register the snapin nodes into the console node list
  195. for (_NODE_TYPE_INFO_ENTRY* pCurrEntry = _NodeTypeInfoEntryArray;
  196. pCurrEntry->m_pNodeGUID != NULL; pCurrEntry++)
  197. {
  198. hr = RegisterNodeType(pCurrEntry->m_pNodeGUID,pCurrEntry->m_lpszNodeDescription);
  199. ASSERT(SUCCEEDED(hr));
  200. if (FAILED(hr))
  201. {
  202. _MSGBOX(_T("RegisterNodeType() failed"));
  203. return hr;
  204. }
  205. }
  206. return hr;
  207. }
  208. STDAPI DllUnregisterServer(void)
  209. {
  210. HRESULT hr = _Module.UnregisterServer();
  211. ASSERT(SUCCEEDED(hr));
  212. // un register the standalone snapin
  213. hr = UnregisterSnapin(&CLSID_ADSIEditSnapin);
  214. ASSERT(SUCCEEDED(hr));
  215. // unregister the snapin nodes,
  216. // this removes also the server node, with the Services Snapin extension keys
  217. for (_NODE_TYPE_INFO_ENTRY* pCurrEntry = _NodeTypeInfoEntryArray;
  218. pCurrEntry->m_pNodeGUID != NULL; pCurrEntry++)
  219. {
  220. hr = UnregisterNodeType(pCurrEntry->m_pNodeGUID);
  221. ASSERT(SUCCEEDED(hr));
  222. }
  223. return S_OK;
  224. }
  225. ///////////////////////////////////////////////////////////////////////////////
  226. // CADSIEditSnapinApp
  227. class CADSIEditSnapinApp : public CWinApp
  228. {
  229. public:
  230. virtual BOOL InitInstance();
  231. virtual int ExitInstance();
  232. };
  233. CADSIEditSnapinApp theApp;
  234. BOOL CADSIEditSnapinApp::InitInstance()
  235. {
  236. _Module.Init(ObjectMap, m_hInstance);
  237. HRESULT hr = ::OleInitialize(NULL);
  238. if (FAILED(hr))
  239. {
  240. return FALSE;
  241. }
  242. if (!CADSIEditComponentDataObject::LoadResources())
  243. return FALSE;
  244. return CWinApp::InitInstance();
  245. }
  246. int CADSIEditSnapinApp::ExitInstance()
  247. {
  248. #ifdef _DEBUG_REFCOUNT
  249. TRACE(_T("CADSIEditSnapinApp::ExitInstance()\n"));
  250. ASSERT(CComponentDataObject::m_nOustandingObjects == 0);
  251. ASSERT(CComponentObject::m_nOustandingObjects == 0);
  252. ASSERT(CDataObject::m_nOustandingObjects == 0);
  253. #endif // _DEBUG_REFCOUNT
  254. _Module.Term();
  255. return CWinApp::ExitInstance();
  256. }
  257. ////////////////////////////////////////////////////////////////////////
  258. // CADSIEditComponentObject (.i.e "view")
  259. HRESULT CADSIEditComponentObject::InitializeHeaders(CContainerNode* pContainerNode)
  260. {
  261. HRESULT hr = S_OK;
  262. ASSERT(m_pHeader);
  263. CColumnSet* pColumnSet = pContainerNode->GetColumnSet();
  264. POSITION pos = pColumnSet->GetHeadPosition();
  265. while (pos != NULL)
  266. {
  267. CColumn* pColumn = pColumnSet->GetNext(pos);
  268. hr = m_pHeader->InsertColumn(pColumn->GetColumnNum(),
  269. pColumn->GetHeader(),
  270. pColumn->GetFormat(),
  271. AUTO_WIDTH);
  272. if (FAILED(hr))
  273. return hr;
  274. hr = m_pHeader->SetColumnWidth(pColumn->GetColumnNum(),
  275. pColumn->GetWidth());
  276. if (FAILED(hr))
  277. return hr;
  278. }
  279. return hr;
  280. }
  281. HRESULT CADSIEditComponentObject::InitializeBitmaps(CTreeNode* cookie)
  282. {
  283. HRESULT hr = S_OK;
  284. // image lists for nodes
  285. CBitmapHolder<IDB_16x16> _bmp16x16;
  286. CBitmapHolder<IDB_32x32> _bmp32x32;
  287. bool bBmpsLoaded = _bmp16x16.LoadBitmap() && _bmp32x32.LoadBitmap();
  288. if (bBmpsLoaded)
  289. {
  290. ASSERT(m_pImageResult != NULL);
  291. hr = m_pImageResult->ImageListSetStrip(reinterpret_cast<LONG_PTR*>(static_cast<HBITMAP>(_bmp16x16)),
  292. reinterpret_cast<LONG_PTR*>(static_cast<HBITMAP>(_bmp32x32)),
  293. 0,
  294. BMP_COLOR_MASK);
  295. }
  296. else
  297. {
  298. hr = S_FALSE;
  299. }
  300. return hr;
  301. }
  302. ////////////////////////////////////////////////////////////////////////
  303. // CADSIEditComponentDataObject (.i.e "document")
  304. CADSIEditComponentDataObject::CADSIEditComponentDataObject()
  305. {
  306. /*
  307. CWatermarkInfo* pWatermarkInfo = new CWatermarkInfo;
  308. pWatermarkInfo->m_nIDBanner = IDB_WIZBANNER;
  309. pWatermarkInfo->m_nIDWatermark = IDB_WIZWATERMARK;
  310. SetWatermarkInfo(pWatermarkInfo);
  311. */
  312. m_pColumnSet = new CADSIEditColumnSet(COLUMNSET_ID_DEFAULT);
  313. }
  314. HRESULT CADSIEditComponentDataObject::OnSetImages(LPIMAGELIST lpScopeImage)
  315. {
  316. HRESULT hr = S_OK;
  317. // image lists for nodes
  318. CBitmapHolder<IDB_16x16> _bmp16x16;
  319. CBitmapHolder<IDB_32x32> _bmp32x32;
  320. bool bBmpsLoaded = _bmp16x16.LoadBitmap() && _bmp32x32.LoadBitmap();
  321. if (bBmpsLoaded)
  322. {
  323. ASSERT(lpScopeImage != NULL);
  324. hr = lpScopeImage->ImageListSetStrip(reinterpret_cast<LONG_PTR*>(static_cast<HBITMAP>(_bmp16x16)),
  325. reinterpret_cast<LONG_PTR*>(static_cast<HBITMAP>(_bmp32x32)),
  326. 0,
  327. BMP_COLOR_MASK);
  328. }
  329. else
  330. {
  331. hr = S_FALSE;
  332. }
  333. return hr;
  334. }
  335. CRootData* CADSIEditComponentDataObject::OnCreateRootData()
  336. {
  337. CADSIEditRootData* pADSIEditRootNode = new CADSIEditRootData(this);
  338. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  339. CString szSnapinType;
  340. szSnapinType.LoadString(IDS_SNAPIN_NAME);
  341. pADSIEditRootNode->SetDisplayName(szSnapinType);
  342. return pADSIEditRootNode;
  343. }
  344. BOOL CADSIEditComponentDataObject::LoadResources()
  345. {
  346. BOOL bLoadColumnHeaders = TRUE;
  347. for (UINT nIdx = 0; ColumnDefinitions[nIdx]; nIdx++)
  348. {
  349. PCOLUMN_DEFINITION pColumnDef = ColumnDefinitions[nIdx];
  350. bLoadColumnHeaders = LoadResultHeaderResources(pColumnDef->headers, pColumnDef->dwColumnCount);
  351. if (!bLoadColumnHeaders)
  352. {
  353. break;
  354. }
  355. }
  356. return
  357. LoadContextMenuResources(CADSIEditConnectMenuHolder::GetMenuMap()) &&
  358. LoadContextMenuResources(CADSIEditContainerMenuHolder::GetMenuMap()) &&
  359. LoadContextMenuResources(CADSIEditRootMenuHolder::GetMenuMap()) &&
  360. LoadContextMenuResources(CADSIEditLeafMenuHolder::GetMenuMap()) &&
  361. LoadContextMenuResources(CADSIEditQueryMenuHolder::GetMenuMap()) &&
  362. bLoadColumnHeaders;
  363. }
  364. STDMETHODIMP CADSIEditComponentDataObject::CreateComponent(LPCOMPONENT* ppComponent)
  365. {
  366. ASSERT(ppComponent != NULL);
  367. CComObject<CADSIEditComponentObject>* pObject;
  368. CComObject<CADSIEditComponentObject>::CreateInstance(&pObject);
  369. ASSERT(pObject != NULL);
  370. // Store IComponentData
  371. pObject->SetIComponentData(this);
  372. return pObject->QueryInterface(IID_IComponent,
  373. reinterpret_cast<void**>(ppComponent));
  374. }
  375. void CADSIEditComponentDataObject::OnNodeContextHelp(CTreeNode* pNode)
  376. {
  377. ASSERT(pNode != NULL);
  378. CComPtr<IDisplayHelp> spHelp;
  379. HRESULT hr = GetConsole()->QueryInterface(IID_IDisplayHelp, (void **)&spHelp);
  380. if (SUCCEEDED(hr))
  381. spHelp->ShowTopic(L"w2rksupp.chm::/topics/adsiedit.htm");
  382. // spHelp->ShowTopic(L"w2rksupp.chm");
  383. /*
  384. CString szNode;
  385. if (IS_CLASS(*pNode, CDNSRootData))
  386. {
  387. szNode = _T("Root Node");
  388. }
  389. else if (IS_CLASS(*pNode, CDNSServerNode))
  390. {
  391. szNode = _T("Server Node");
  392. }
  393. else if (IS_CLASS(*pNode, CDNSForwardZonesNode))
  394. {
  395. szNode = _T("Forward Zones Node");
  396. }
  397. else if (IS_CLASS(*pNode, CDNSReverseZonesNode))
  398. {
  399. szNode = _T("Reverse Zones Node");
  400. }
  401. else if (IS_CLASS(*pNode, CDNSZoneNode))
  402. {
  403. szNode = _T("Zone Node");
  404. }
  405. else if (IS_CLASS(*pNode, CDNSDomainNode))
  406. {
  407. szNode = _T("Domain Node");
  408. }
  409. else if (IS_CLASS(*pNode, CDNSCacheNode))
  410. {
  411. szNode = _T("Domain Node");
  412. }
  413. else if (dynamic_cast<CDNSRecordNodeBase*>(pNode) != NULL)
  414. {
  415. szNode = _T("Record Node");
  416. }
  417. if (!szNode.IsEmpty())
  418. {
  419. CString szMsg = _T("Context Help on ");
  420. szMsg += szNode;
  421. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  422. AfxMessageBox(szMsg);
  423. }
  424. */
  425. }
  426. LPCWSTR g_szContextHelpFileName = L"\\help\\adsiedit.hlp";
  427. LPCWSTR g_szHTMLHelpFileName = L"w2rksupp.chm";
  428. LPCWSTR CADSIEditComponentDataObject::GetHTMLHelpFileName()
  429. {
  430. return g_szHTMLHelpFileName;
  431. }
  432. void CADSIEditComponentDataObject::OnDialogContextHelp(UINT nDialogID, HELPINFO* pHelpInfo)
  433. {
  434. ULONG nContextTopic;
  435. // TODO
  436. //if (FindDialogContextTopic(nDialogID, pHelpInfo, &nContextTopic))
  437. // WinHelp(g_szContextHelpFileName, HELP_CONTEXTPOPUP, nContextTopic);
  438. }
  439. STDMETHODIMP CADSIEditComponentDataObject::GetHelpTopic(LPOLESTR* lpCompiledHelpFile)
  440. {
  441. if (lpCompiledHelpFile == NULL)
  442. return E_INVALIDARG;
  443. LPCWSTR lpszHelpFileName = GetHTMLHelpFileName();
  444. if (lpszHelpFileName == NULL)
  445. {
  446. *lpCompiledHelpFile = NULL;
  447. return E_NOTIMPL;
  448. }
  449. CString szResourceKitDir = _T("");
  450. CString szKey = L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\Components\\5A18D5BFC37FA0A4E99D24135BABE742";
  451. CRegKey key;
  452. LONG lRes = key.Open(HKEY_LOCAL_MACHINE, szKey);
  453. _REPORT_FAIL(L"key.Open(HKEY_LOCAL_MACHINE", szKey, lRes);
  454. if (lRes == ERROR_SUCCESS)
  455. {
  456. PTSTR ptszValue = new TCHAR[2*MAX_PATH];
  457. DWORD dwCount = sizeof(TCHAR) * 2 * MAX_PATH;
  458. lRes = key.QueryValue(ptszValue, L"DC5632422F082D1189A9000CF497879A", &dwCount);
  459. _REPORT_FAIL(L"key.QueryValue(key", L"DC5632422F082D1189A9000CF497879A", lRes);
  460. if (lRes == ERROR_SUCCESS)
  461. {
  462. CString szValue = ptszValue;
  463. delete[] ptszValue;
  464. szResourceKitDir = szValue.Left(szValue.ReverseFind(L'\\') + 1);
  465. }
  466. }
  467. CString szHelpFilePath = szResourceKitDir + CString(lpszHelpFileName);
  468. UINT nBytes = (szHelpFilePath.GetLength()+1) * sizeof(WCHAR);
  469. *lpCompiledHelpFile = (LPOLESTR)::CoTaskMemAlloc(nBytes);
  470. if (*lpCompiledHelpFile != NULL)
  471. {
  472. memcpy(*lpCompiledHelpFile, (LPCWSTR)szHelpFilePath, nBytes);
  473. }
  474. return S_OK;
  475. }
  476. ////////////////////////////////////////////////////////////////////////////////
  477. // help context macros and maps
  478. #if (FALSE)
  479. #define BEGIN_HELP_MAP(map) static DWORD map[] = {
  480. #define HELP_MAP_ENTRY(x) x, (DWORD)&g_aHelpIDs_##x ,
  481. #define END_HELP_MAP 0, 0 };
  482. #define NEXT_HELP_MAP_ENTRY(p) ((p)+2)
  483. #define MAP_ENTRY_DLG_ID(p) (*p)
  484. #define MAP_ENTRY_TABLE(p) ((DWORD*)(*(p+1)))
  485. #define IS_LAST_MAP_ENTRY(p) (MAP_ENTRY_DLG_ID(p) == 0)
  486. #define NEXT_HELP_TABLE_ENTRY(p) ((p)+2)
  487. #define TABLE_ENTRY_CTRL_ID(p) (*p)
  488. #define TABLE_ENTRY_HELP_ID(p) (*(p+1))
  489. #define IS_LAST_TABLE_ENTRY(p) (TABLE_ENTRY_CTRL_ID(p) == 0)
  490. BEGIN_HELP_MAP(_DNSMgrContextHelpMap)
  491. // misc dialogs
  492. HELP_MAP_ENTRY(IDD_CHOOSER_CHOOSE_MACHINE)
  493. HELP_MAP_ENTRY(IDD_BROWSE_DIALOG)
  494. // misc. add dialogs
  495. HELP_MAP_ENTRY(IDD_DOMAIN_ADDNEWHOST) // TODO
  496. HELP_MAP_ENTRY(IDD_DOMAIN_ADDNEWDOMAIN)// TODO
  497. HELP_MAP_ENTRY(IDD_SELECT_RECORD_TYPE_DIALOG)
  498. // NOTE: this has several incarnations...
  499. HELP_MAP_ENTRY(IDD_NAME_SERVERS_PAGE)
  500. // server property pages
  501. HELP_MAP_ENTRY(IDD_SERVER_INTERFACES_PAGE)
  502. HELP_MAP_ENTRY(IDD_SERVER_FORWARDERS_PAGE)
  503. HELP_MAP_ENTRY(IDD_SERVER_ADVANCED_PAGE)
  504. HELP_MAP_ENTRY(IDD_SERVER_LOGGING_PAGE)
  505. HELP_MAP_ENTRY(IDD_SERVER_BOOTMETHOD_PAGE)
  506. HELP_MAP_ENTRY(IDD_SERVMON_STATISTICS_PAGE)
  507. HELP_MAP_ENTRY(IDD_SERVMON_TEST_PAGE)
  508. // zone property pages
  509. HELP_MAP_ENTRY(IDD_ZONE_GENERAL_PAGE)
  510. HELP_MAP_ENTRY(IDD_ZONE_WINS_PAGE)
  511. HELP_MAP_ENTRY(IDD_ZONE_NBSTAT_PAGE)
  512. HELP_MAP_ENTRY(IDD_ZONE_NOTIFY_PAGE)
  513. HELP_MAP_ENTRY(IDD_ZONE_WINS_ADVANCED) // this is a subdialog, need to hook up
  514. // record property pages
  515. HELP_MAP_ENTRY(IDD_RR_NS_EDIT)
  516. HELP_MAP_ENTRY(IDD_RR_SOA)
  517. HELP_MAP_ENTRY(IDD_RR_A)
  518. HELP_MAP_ENTRY(IDD_RR_CNAME)
  519. HELP_MAP_ENTRY(IDD_RR_MX)
  520. HELP_MAP_ENTRY(IDD_RR_UNK)
  521. HELP_MAP_ENTRY(IDD_RR_TXT)
  522. HELP_MAP_ENTRY(IDD_RR_X25)
  523. HELP_MAP_ENTRY(IDD_RR_ISDN)
  524. HELP_MAP_ENTRY(IDD_RR_HINFO)
  525. HELP_MAP_ENTRY(IDD_RR_AAAA)
  526. HELP_MAP_ENTRY(IDD_RR_MB)
  527. HELP_MAP_ENTRY(IDD_RR_MG)
  528. HELP_MAP_ENTRY(IDD_RR_MD)
  529. HELP_MAP_ENTRY(IDD_RR_MF)
  530. HELP_MAP_ENTRY(IDD_RR_MR)
  531. HELP_MAP_ENTRY(IDD_RR_MINFO)
  532. HELP_MAP_ENTRY(IDD_RR_RP)
  533. HELP_MAP_ENTRY(IDD_RR_RT)
  534. HELP_MAP_ENTRY(IDD_RR_AFSDB)
  535. HELP_MAP_ENTRY(IDD_RR_WKS)
  536. HELP_MAP_ENTRY(IDD_RR_PTR)
  537. HELP_MAP_ENTRY(IDD_RR_SRV)
  538. HELP_MAP_ENTRY(IDD_RR_KEY)
  539. HELP_MAP_ENTRY(IDD_RR_SIG)
  540. END_HELP_MAP
  541. BOOL CDNSComponentDataObjectBase::FindDialogContextTopic(/*IN*/UINT nDialogID,
  542. /*IN*/ HELPINFO* pHelpInfo,
  543. /*OUT*/ ULONG* pnContextTopic)
  544. {
  545. ASSERT(pHelpInfo != NULL);
  546. *pnContextTopic = 0;
  547. const DWORD* pMapEntry = _DNSMgrContextHelpMap;
  548. while (!IS_LAST_MAP_ENTRY(pMapEntry))
  549. {
  550. if (nDialogID == MAP_ENTRY_DLG_ID(pMapEntry))
  551. {
  552. DWORD* pTable = MAP_ENTRY_TABLE(pMapEntry);
  553. // look inside the table
  554. while (!IS_LAST_TABLE_ENTRY(pTable))
  555. {
  556. if (TABLE_ENTRY_CTRL_ID(pTable) == pHelpInfo->iCtrlId)
  557. {
  558. *pnContextTopic = TABLE_ENTRY_HELP_ID(pTable);
  559. return TRUE;
  560. }
  561. pTable = NEXT_HELP_TABLE_ENTRY(pTable);
  562. }
  563. }
  564. pMapEntry = NEXT_HELP_MAP_ENTRY(pMapEntry);
  565. }
  566. return FALSE;
  567. }
  568. #endif
  569. //////////////////////////////////////////////////////////////////////////
  570. // CADSIEditAbout
  571. CADSIEditAbout::CADSIEditAbout()
  572. {
  573. m_uIdStrProvider = IDS_SNAPIN_PROVIDER;
  574. m_uIdStrVersion = IDS_SNAPIN_VERSION;
  575. m_uIdStrDestription = IDS_SNAPINABOUT_DESCRIPTION;
  576. m_uIdIconImage = IDI_ADSIEDIT_SNAPIN;
  577. m_uIdBitmapSmallImage = IDB_ABOUT_16x16;
  578. m_uIdBitmapSmallImageOpen = IDB_ABOUT_16x16;
  579. m_uIdBitmapLargeImage = IDB_ABOUT_32x32;
  580. m_crImageMask = BMP_COLOR_MASK;
  581. }