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.

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