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.

505 lines
12 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1998 - 1999
  6. //
  7. // File: servwiz.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #ifndef _SERVWIZ_H
  11. #define _SERVWIZ_H
  12. #include "zonewiz.h"
  13. #include "nspage.h"
  14. ///////////////////////////////////////////////////////////////////////////////
  15. // FORWARD DECLARATIONS
  16. class CDNSRootData;
  17. class CDNSServerNode;
  18. class CDNSServerWizardHolder;
  19. class CNewServerDialog;
  20. ///////////////////////////////////////////////////////////////////////////////
  21. // CDNSServerWiz_StartPropertyPage
  22. class CDNSServerWiz_StartPropertyPage : public CPropertyPageBase
  23. {
  24. // Construction
  25. public:
  26. CDNSServerWiz_StartPropertyPage();
  27. enum { IDD = IDD_SERVWIZ_START };
  28. void OnHelpButton();
  29. DECLARE_MESSAGE_MAP()
  30. // Overrides
  31. public:
  32. virtual BOOL OnSetActive();
  33. virtual LRESULT OnWizardNext();
  34. protected:
  35. virtual BOOL OnInitDialog();
  36. // Dialog Data
  37. };
  38. ///////////////////////////////////////////////////////////////////////////////
  39. // CDNSServerWiz_ScenarioPropertyPage
  40. class CDNSServerWiz_ScenarioPropertyPage : public CPropertyPageBase
  41. {
  42. // Construction
  43. public:
  44. CDNSServerWiz_ScenarioPropertyPage();
  45. enum { IDD = IDD_SERVWIZ_SCENARIO_PAGE };
  46. // Overrides
  47. public:
  48. virtual BOOL OnSetActive();
  49. virtual LRESULT OnWizardNext();
  50. virtual LRESULT OnWizardBack();
  51. protected:
  52. virtual BOOL OnInitDialog();
  53. // Dialog Data
  54. };
  55. ///////////////////////////////////////////////////////////////////////////////
  56. // CDNSServerWiz_ForwardersPropertyPage
  57. class CDNSServerWiz_ForwardersPropertyPage : public CPropertyPageBase
  58. {
  59. // Construction
  60. public:
  61. CDNSServerWiz_ForwardersPropertyPage();
  62. enum { IDD = IDD_SERVWIZ_SM_FORWARDERS_PAGE };
  63. // Overrides
  64. public:
  65. virtual BOOL OnSetActive();
  66. virtual LRESULT OnWizardNext();
  67. virtual LRESULT OnWizardBack();
  68. virtual BOOL OnApply();
  69. void GetForwarder(CString& strref);
  70. protected:
  71. virtual BOOL OnInitDialog();
  72. afx_msg void OnChangeRadio();
  73. // Dialog Data
  74. DECLARE_MESSAGE_MAP()
  75. };
  76. ///////////////////////////////////////////////////////////////////////////////
  77. // CDNSServerWiz_RootHintsFailedPropertyPage
  78. class CDNSServerWiz_RootHintsFailedPropertyPage : public CPropertyPageBase
  79. {
  80. // Construction
  81. public:
  82. CDNSServerWiz_RootHintsFailedPropertyPage();
  83. enum { IDD = IDD_SERVWIZ_SM_ROOTHINTS_FAILED_PAGE };
  84. // Overrides
  85. public:
  86. afx_msg void OnHelpButton();
  87. virtual BOOL OnSetActive();
  88. virtual LRESULT OnWizardNext();
  89. virtual LRESULT OnWizardBack();
  90. protected:
  91. virtual BOOL OnInitDialog();
  92. DECLARE_MESSAGE_MAP()
  93. // Dialog Data
  94. };
  95. ///////////////////////////////////////////////////////////////////////////////
  96. // CDNSServer_RootHintsWizardPage
  97. class CDNSServer_RootHintsWizardPage : public CDNSNameServersWizardPage
  98. {
  99. public:
  100. CDNSServer_RootHintsWizardPage();
  101. virtual BOOL OnApply();
  102. enum { IDD = IDD_SERVWIZ_ROOTHINTS_PAGE };
  103. protected:
  104. virtual LRESULT OnWizardNext();
  105. virtual LRESULT OnWizardBack();
  106. virtual void ReadRecordNodesList();
  107. virtual BOOL WriteNSRecordNodesList();
  108. };
  109. ///////////////////////////////////////////////////////////////////////////////
  110. // CDNSServerWiz_SmallZoneTypePropertyPage
  111. class CDNSServerWiz_SmallZoneTypePropertyPage : public CPropertyPageBase
  112. {
  113. // Construction
  114. public:
  115. CDNSServerWiz_SmallZoneTypePropertyPage();
  116. enum { IDD = IDD_SERVWIZ_SM_ZONE_TYPE_PAGE };
  117. // Overrides
  118. public:
  119. virtual BOOL OnSetActive();
  120. virtual LRESULT OnWizardNext();
  121. virtual LRESULT OnWizardBack();
  122. protected:
  123. virtual BOOL OnInitDialog();
  124. // Dialog Data
  125. };
  126. ///////////////////////////////////////////////////////////////////////////////
  127. // CDNSServerWiz_NamePropertyPage
  128. class CDNSServerWiz_NamePropertyPage : public CPropertyPageBase
  129. {
  130. // Construction
  131. public:
  132. CDNSServerWiz_NamePropertyPage();
  133. // Overrides
  134. public:
  135. virtual BOOL OnSetActive();
  136. virtual LRESULT OnWizardNext();
  137. virtual LRESULT OnWizardBack();
  138. // Dialog Data
  139. enum { IDD = IDD_SERVWIZ_NAME };
  140. protected:
  141. afx_msg void OnServerNameChange();
  142. DECLARE_MESSAGE_MAP()
  143. private:
  144. CString m_szServerName;
  145. BOOL IsValidServerName(CString& s) { return !s.IsEmpty();}
  146. CEdit* GetServerNameEdit() { return (CEdit*)GetDlgItem(IDC_EDIT_DNSSERVER);}
  147. };
  148. ///////////////////////////////////////////////////////////////////////////////
  149. // CDNSServerWiz_RootServPropertyPage
  150. class CDNSServerWiz_RootServPropertyPage : public CPropertyPageBase
  151. {
  152. // Construction
  153. public:
  154. CDNSServerWiz_RootServPropertyPage();
  155. // Overrides
  156. public:
  157. virtual BOOL OnSetActive();
  158. virtual LRESULT OnWizardNext();
  159. virtual LRESULT OnWizardBack();
  160. // Dialog Data
  161. enum { IDD = IDD_SERVWIZ_ROOT_SERV };
  162. protected:
  163. virtual BOOL OnInitDialog();
  164. protected:
  165. afx_msg void OnIPv4CtrlChange();
  166. afx_msg void OnNoDnsRadio();
  167. afx_msg void OnDnsRadio();
  168. DECLARE_MESSAGE_MAP()
  169. private:
  170. BOOL m_bDNSRunningOnNet;
  171. CDNSIPv4Control* GetIPv4Ctrl() { return (CDNSIPv4Control*)GetDlgItem(IDC_IPEDIT);}
  172. void OnRadio(BOOL bEnable);
  173. };
  174. ///////////////////////////////////////////////////////////////////////////////
  175. // CDNSServerWiz_ConfigFwdZonePropertyPage
  176. class CDNSServerWiz_ConfigFwdZonePropertyPage : public CPropertyPageBase
  177. {
  178. // Construction
  179. public:
  180. CDNSServerWiz_ConfigFwdZonePropertyPage();
  181. // Dialog Data
  182. enum { IDD = IDD_SERVWIZ_FWD_ZONE };
  183. // Overrides
  184. public:
  185. virtual BOOL OnSetActive();
  186. virtual LRESULT OnWizardNext();
  187. virtual LRESULT OnWizardBack();
  188. protected:
  189. virtual BOOL OnInitDialog();
  190. };
  191. ///////////////////////////////////////////////////////////////////////////////
  192. // CDNSServerWiz_ConfigRevZonePropertyPage
  193. class CDNSServerWiz_ConfigRevZonePropertyPage : public CPropertyPageBase
  194. {
  195. // Construction
  196. public:
  197. CDNSServerWiz_ConfigRevZonePropertyPage();
  198. // Dialog Data
  199. enum { IDD = IDD_SERVWIZ_REV_ZONE };
  200. // Overrides
  201. public:
  202. virtual BOOL OnSetActive();
  203. virtual LRESULT OnWizardNext();
  204. virtual LRESULT OnWizardBack();
  205. protected:
  206. virtual BOOL OnInitDialog();
  207. };
  208. ///////////////////////////////////////////////////////////////////////////////
  209. // CDNSServerWiz_FinishPropertyPage
  210. class CDNSServerWiz_FinishPropertyPage : public CPropertyPageBase
  211. {
  212. // Construction
  213. public:
  214. CDNSServerWiz_FinishPropertyPage();
  215. // Dialog Data
  216. enum { IDD = IDD_SERVWIZ_FINISH };
  217. // Overrides
  218. public:
  219. virtual BOOL OnSetActive();
  220. virtual LRESULT OnWizardBack();
  221. virtual BOOL OnWizardFinish();
  222. protected:
  223. virtual BOOL OnInitDialog();
  224. private:
  225. void DisplaySummaryInfo(CDNSServerWizardHolder* pHolder);
  226. };
  227. ///////////////////////////////////////////////////////////////////////////////
  228. // CDNSServerWizardHolder
  229. // page holder to contain DNS server wizard property pages
  230. class CDNSServerWizardHolder : public CPropertyPageHolderBase
  231. {
  232. public:
  233. CDNSServerWizardHolder(CDNSRootData* pRootData,
  234. CComponentDataObject* pComponentData,
  235. CDNSServerNode* pServerNode,
  236. BOOL bHideUI = FALSE);
  237. ~CDNSServerWizardHolder();
  238. // run UI less, for DC Promo
  239. HRESULT DnsSetup(LPCWSTR lpszFwdZoneName,
  240. LPCWSTR lpszFwdZoneFileName,
  241. LPCWSTR lpszRevZoneName,
  242. LPCWSTR lpszRevZoneFileName,
  243. DWORD dwFlags);
  244. void DoModalConnect();
  245. void DoModalConnectOnLocalComputer();
  246. CDNSServerNode* GetServerNode() { return m_pServerNode; }
  247. protected:
  248. virtual HRESULT OnAddPage(int nPage, CPropertyPageBase* pPage);
  249. enum
  250. {
  251. SmallBusiness = 0,
  252. MediumBusiness,
  253. Manually
  254. };
  255. void SetScenario(UINT nScenario) { m_nScenario = nScenario; }
  256. UINT GetScenario() { return m_nScenario; }
  257. private:
  258. DNS_STATUS WriteResultsToRegkeyForCYS(PCWSTR pszLastErrorMessage);
  259. CDNSRootData* GetRootData() { return (CDNSRootData*)GetContainerNode();}
  260. UINT SetZoneWizardContextEx(BOOL bForward,
  261. UINT nZoneType,
  262. BOOL bADIntegrated = FALSE,
  263. UINT nNextPage = -1,
  264. UINT nPrevPage = -1);
  265. UINT SetZoneWizardContext(BOOL bForward,
  266. UINT nNextPage = -1,
  267. UINT nPrevPage = -1);
  268. void SetRootHintsRecordList(PDNS_RECORD pRootHints)
  269. {
  270. if(m_pRootHintsRecordList != NULL)
  271. {
  272. ::DnsRecordListFree(m_pRootHintsRecordList, DnsFreeRecordListDeep);
  273. m_pRootHintsRecordList = NULL;
  274. }
  275. m_pRootHintsRecordList = pRootHints;
  276. }
  277. DWORD GetServerInfo(BOOL* pbAlreadyConfigured);
  278. BOOL QueryForRootServerRecords(IP_ADDRESS* pIpAddr);
  279. void InsertServerIntoUI();
  280. BOOL OnFinish(); // do the work
  281. DNS_STATUS InitializeRootHintsList();
  282. // flag to skip the name page when server name obtained from dialog
  283. BOOL m_bSkipNamePage;
  284. // flag to run the wizard object programmatically (DC Promo)
  285. BOOL m_bHideUI;
  286. // Wizard options and collected data
  287. BOOL m_bRootServer;
  288. BOOL m_bHasRootZone;
  289. // zone creation info
  290. BOOL m_bAddFwdZone;
  291. BOOL m_bAddRevZone;
  292. CDNSCreateZoneInfo* m_pFwdZoneInfo;
  293. CDNSCreateZoneInfo* m_pRevZoneInfo;
  294. // root hints info (NS and A records)
  295. PDNS_RECORD m_pRootHintsRecordList;
  296. // server node to add
  297. CDNSServerNode* m_pServerNode;
  298. // execution state and error codes
  299. BOOL m_bServerNodeAdded; // added server node (UI)
  300. BOOL m_bRootHintsAdded; // true if we succeded once in adding root hints to server
  301. BOOL m_bRootZoneAdded;
  302. BOOL m_bFwdZoneAdded;
  303. BOOL m_bRevZoneAdded;
  304. BOOL m_bAddRootHints;
  305. BOOL m_bAddRootHintsManually;
  306. BOOL m_bAddForwarder;
  307. UINT m_nScenario;
  308. BOOL m_bServerNodeExists;
  309. // embedded zone wizard instance
  310. CDNSZoneWizardHolder* m_pZoneWiz;
  311. // property page objects
  312. CDNSServerWiz_StartPropertyPage* m_pStartPage;
  313. CDNSServerWiz_ScenarioPropertyPage* m_pScenarioPage;
  314. CDNSServerWiz_ForwardersPropertyPage* m_pForwardersPage;
  315. CDNSServerWiz_RootHintsFailedPropertyPage* m_pRootHintsFailedPage;
  316. CDNSServerWiz_SmallZoneTypePropertyPage* m_pSmallZoneTypePage;
  317. CDNSServerWiz_NamePropertyPage* m_pNamePage;
  318. CDNSServerWiz_RootServPropertyPage* m_pRootServPage;
  319. CDNSServerWiz_ConfigFwdZonePropertyPage* m_pFwdZonePage;
  320. CDNSServerWiz_ConfigRevZonePropertyPage* m_pRevZonePage;
  321. CDNSServer_RootHintsWizardPage* m_pRootHintsPage;
  322. CDNSServerWiz_FinishPropertyPage* m_pFinishPage;
  323. friend class CNewServerDialog;
  324. friend class CDNSServerWiz_StartPropertyPage;
  325. friend class CDNSServerWiz_ScenarioPropertyPage;
  326. friend class CDNSServerWiz_ForwardersPropertyPage;
  327. friend class CDNSServerWiz_RootHintsFailedPropertyPage;
  328. friend class CDNSServerWiz_SmallZoneTypePropertyPage;
  329. friend class CDNSServerWiz_NamePropertyPage;
  330. friend class CDNSServerWiz_RootServPropertyPage;
  331. friend class CDNSServerWiz_ConfigFwdZonePropertyPage;
  332. friend class CDNSServerWiz_ConfigRevZonePropertyPage;
  333. friend class CDNSServer_RootHintsWizardPage;
  334. friend class CDNSServerWiz_FinishPropertyPage;
  335. };
  336. /////////////////////////////////////////////////////////////////////////////////
  337. // HELPER CLASSES
  338. /////////////////////////////////////////////////////////////////////////////////
  339. //////////////////////////////////////////////////////////////////////////////
  340. // CContactServerThread
  341. class CContactServerThread : public CDlgWorkerThread
  342. {
  343. public:
  344. CContactServerThread(LPCTSTR lpszServerName, BOOL bCheckConfigured);
  345. ~CContactServerThread();
  346. CDNSServerInfoEx* DetachInfo();
  347. CDNSRootHintsNode* DetachRootHintsNode();
  348. BOOL IsAlreadyConfigured() { return m_bAlreadyConfigured;}
  349. private:
  350. CString m_szServerName;
  351. CDNSServerInfoEx* m_pServerInfoEx;
  352. CDNSRootHintsNode* m_pRootHintsNode;
  353. BOOL m_bAlreadyConfigured;
  354. BOOL m_bCheckConfigured;
  355. protected:
  356. virtual void OnDoAction();
  357. };
  358. ///////////////////////////////////////////////////////////////////////////////
  359. // CRootHintsQueryThread
  360. class CRootHintsQueryThread : public CDlgWorkerThread
  361. {
  362. public:
  363. CRootHintsQueryThread();
  364. virtual ~CRootHintsQueryThread();
  365. // setup
  366. BOOL LoadServerNames(CRootData* pRootData, CDNSServerNode* pServerNode);
  367. void LoadIPAddresses(DWORD cCount, PIP_ADDRESS ipArr);
  368. // return data
  369. PDNS_RECORD GetHintsRecordList();
  370. protected:
  371. virtual void OnDoAction();
  372. private:
  373. // array of server names
  374. CString* m_pServerNamesArr;
  375. DWORD m_nServerNames;
  376. // array of IP addresses
  377. PIP_ADDRESS m_ipArray;
  378. DWORD m_nIPCount;
  379. // output data
  380. PDNS_RECORD m_pRootHintsRecordList;
  381. void QueryAllServers();
  382. void QueryServersOnServerNames();
  383. void QueryServersOnIPArray();
  384. };
  385. #endif // _SERVWIZ_H