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.

485 lines
9.5 KiB

  1. /*++
  2. Module Name:
  3. DfsWiz.h
  4. Abstract:
  5. This module contains the declaration for CCreateDfsRootWizPage1, 2, 3, 4, 5, 6.
  6. These classes implement pages in the CreateDfs Root wizard.
  7. --*/
  8. #ifndef __CREATE_DFSROOT_WIZARD_PAGES_H_
  9. #define __CREATE_DFSROOT_WIZARD_PAGES_H_
  10. #include "QWizPage.h" // The base class that implements the common functionality
  11. // of wizard pages
  12. #include "MmcAdmin.h"
  13. #include "utils.h"
  14. // This structure is used to pass information to and from the pages.
  15. // Finally this is used to create the dfs root
  16. class CREATEDFSROOTWIZINFO
  17. {
  18. public:
  19. HFONT hBigBoldFont;
  20. HFONT hBoldFont;
  21. DFS_TYPE DfsType;
  22. BSTR bstrSelectedDomain;
  23. BSTR bstrSelectedServer;
  24. bool bPostW2KVersion;
  25. BOOL bShareExists;
  26. BSTR bstrSharePath;
  27. BSTR bstrDfsRootName;
  28. BSTR bstrDfsRootComment;
  29. CMmcDfsAdmin* pMMCAdmin;
  30. bool bRootReplica;
  31. bool bDfsSetupSuccess;
  32. // bug#217602 bool bPublish;
  33. CREATEDFSROOTWIZINFO()
  34. :DfsType(DFS_TYPE_UNASSIGNED),
  35. bstrSelectedDomain(NULL),
  36. bstrSelectedServer(NULL),
  37. bPostW2KVersion(false),
  38. bShareExists(FALSE),
  39. bstrSharePath(NULL),
  40. bstrDfsRootName(NULL),
  41. bstrDfsRootComment(NULL),
  42. pMMCAdmin(NULL),
  43. bRootReplica(false),
  44. bDfsSetupSuccess(false)
  45. // bug#217602bPublish(false)
  46. {
  47. SetupFonts( _Module.GetResourceInstance(), NULL, &hBigBoldFont, &hBoldFont );
  48. return;
  49. }
  50. ~CREATEDFSROOTWIZINFO()
  51. {
  52. DestroyFonts(hBigBoldFont, hBoldFont);
  53. SAFE_SYSFREESTRING(&bstrSelectedDomain);
  54. SAFE_SYSFREESTRING(&bstrSelectedServer);
  55. SAFE_SYSFREESTRING(&bstrSharePath);
  56. SAFE_SYSFREESTRING(&bstrDfsRootName);
  57. SAFE_SYSFREESTRING(&bstrDfsRootComment);
  58. return;
  59. }
  60. };
  61. typedef CREATEDFSROOTWIZINFO *LPCREATEDFSROOTWIZINFO;
  62. // ----------------------------------------------------------------------------
  63. // CCreateDfsRootWizPage1: Welcome page
  64. // Has a watermark bitmap and no controls except the next and cancel buttons
  65. class CCreateDfsRootWizPage1:
  66. public CQWizardPageImpl<CCreateDfsRootWizPage1>
  67. {
  68. public:
  69. enum { IDD = IDD_CREATE_DFSROOT_WIZ_PAGE1 };
  70. CCreateDfsRootWizPage1(
  71. IN LPCREATEDFSROOTWIZINFO i_lpWizInfo
  72. );
  73. // On the page being activated. Shown to the user
  74. BOOL OnSetActive(
  75. );
  76. private:
  77. LPCREATEDFSROOTWIZINFO m_lpWizInfo;
  78. };
  79. // ----------------------------------------------------------------------------
  80. // CCreateDfsRootWizPage2: Dfsroot type selection
  81. // Used to decide the type of dfsroot to be created. Fault tolerant or standalone
  82. class CCreateDfsRootWizPage2:
  83. public CQWizardPageImpl<CCreateDfsRootWizPage2>
  84. {
  85. public:
  86. enum { IDD = IDD_CREATE_DFSROOT_WIZ_PAGE2 };
  87. CCreateDfsRootWizPage2(
  88. IN LPCREATEDFSROOTWIZINFO i_lpWizInfo
  89. );
  90. // On the page being activated. Shown to the user
  91. BOOL OnSetActive(
  92. );
  93. // On Next button being pressed
  94. BOOL OnWizardNext(
  95. );
  96. // On Back button being pressed
  97. BOOL OnWizardBack(
  98. );
  99. // On Back button being pressed
  100. BOOL OnReset(
  101. );
  102. private:
  103. // To set default values for the controls, etc
  104. HRESULT SetDefaultValues(
  105. );
  106. private:
  107. LPCREATEDFSROOTWIZINFO m_lpWizInfo;
  108. };
  109. // ----------------------------------------------------------------------------
  110. // CCreateDfsRootWizPage3: Domain selection
  111. // Use to select a NT 5.0 domain
  112. class CCreateDfsRootWizPage3:
  113. public CQWizardPageImpl<CCreateDfsRootWizPage3>
  114. {
  115. public:
  116. enum { IDD = IDD_CREATE_DFSROOT_WIZ_PAGE3 };
  117. BEGIN_MSG_MAP(CCreateDfsRootWizPage3)
  118. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  119. MESSAGE_HANDLER(WM_NOTIFY, OnNotify)
  120. CHAIN_MSG_MAP(CQWizardPageImpl<CCreateDfsRootWizPage3>)
  121. END_MSG_MAP()
  122. CCreateDfsRootWizPage3(
  123. IN LPCREATEDFSROOTWIZINFO i_lpWizInfo
  124. );
  125. ~CCreateDfsRootWizPage3(
  126. );
  127. // On the page being activated. Shown to the user
  128. BOOL OnSetActive(
  129. );
  130. // On Next button being pressed
  131. BOOL OnWizardNext(
  132. );
  133. // On Back button being pressed
  134. BOOL OnWizardBack(
  135. );
  136. // On Reset. Typically called on cancel and back.
  137. BOOL OnReset(
  138. );
  139. // Notify message for user actions
  140. LRESULT OnNotify(
  141. IN UINT i_uMsg,
  142. IN WPARAM i_wParam,
  143. IN LPARAM i_lParam,
  144. IN OUT BOOL& io_bHandled
  145. );
  146. // On an item change
  147. BOOL OnItemChanged(
  148. IN INT i_iItem
  149. );
  150. // On the dialog box being initialized
  151. LRESULT OnInitDialog(
  152. IN UINT i_uMsg,
  153. IN WPARAM i_wParam,
  154. IN LPARAM i_lParam,
  155. IN OUT BOOL& io_bHandled
  156. );
  157. // Internal Methods
  158. private:
  159. // Add the domains to the imagelist
  160. HRESULT AddDomainsToList(
  161. IN HWND i_hImageList
  162. );
  163. // To set default values for the controls, etc
  164. HRESULT SetDefaultValues(
  165. );
  166. // To check if the user entered proper values
  167. HRESULT CheckUserEnteredValues(
  168. IN LPCTSTR i_szDomainName,
  169. OUT BSTR* o_pbstrDnsDomainName
  170. );
  171. private:
  172. LPCREATEDFSROOTWIZINFO m_lpWizInfo;
  173. HIMAGELIST m_hImgListSmall; // imagelist handle
  174. };
  175. // ----------------------------------------------------------------------------
  176. // CCreateDfsRootWizPage4: Server selection
  177. // Displays a list of Servers and allows the user to select one.
  178. class CCreateDfsRootWizPage4:
  179. public CQWizardPageImpl<CCreateDfsRootWizPage4>
  180. {
  181. public:
  182. enum { IDD = IDD_CREATE_DFSROOT_WIZ_PAGE4 };
  183. BEGIN_MSG_MAP(CCreateDfsRootWizPage4)
  184. COMMAND_ID_HANDLER(IDCSERVERS_BROWSE, OnBrowse)
  185. CHAIN_MSG_MAP(CQWizardPageImpl<CCreateDfsRootWizPage4>)
  186. END_MSG_MAP()
  187. CCreateDfsRootWizPage4(
  188. IN LPCREATEDFSROOTWIZINFO i_lpWizInfo
  189. );
  190. ~CCreateDfsRootWizPage4(
  191. );
  192. // On the page being activated. Shown to the user
  193. BOOL OnSetActive(
  194. );
  195. // On Next button being pressed
  196. BOOL OnWizardNext(
  197. );
  198. // On Back button being pressed
  199. BOOL OnWizardBack(
  200. );
  201. // On Reset. Typically called on cancel and back.
  202. BOOL OnReset(
  203. );
  204. BOOL OnBrowse(
  205. IN WORD wNotifyCode,
  206. IN WORD wID,
  207. IN HWND hWndCtl,
  208. IN BOOL& bHandled
  209. );
  210. // Internal methods
  211. private:
  212. // To set default values for the controls, etc
  213. HRESULT SetDefaultValues(
  214. );
  215. HRESULT IsServerInDomain(IN LPCTSTR lpszServer);
  216. // To check if the user entered proper values
  217. HRESULT CheckUserEnteredValues(
  218. IN LPCTSTR i_szMachineName,
  219. OUT BSTR* o_pbstrComputerName
  220. );
  221. private:
  222. LPCREATEDFSROOTWIZINFO m_lpWizInfo;
  223. CLIPFORMAT m_cfDsObjectNames;
  224. };
  225. // ----------------------------------------------------------------------------
  226. // CCreateDfsRootWizPage5: Share selection
  227. // Displays the shares given a server. Allows choosing from this list or
  228. // creating a new one.
  229. class CCreateDfsRootWizPage5:
  230. public CQWizardPageImpl<CCreateDfsRootWizPage5>
  231. {
  232. public:
  233. enum { IDD = IDD_CREATE_DFSROOT_WIZ_PAGE5 };
  234. BEGIN_MSG_MAP(CCreateDfsRootWizPage5)
  235. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  236. CHAIN_MSG_MAP(CQWizardPageImpl<CCreateDfsRootWizPage5>)
  237. END_MSG_MAP()
  238. CCreateDfsRootWizPage5(
  239. IN LPCREATEDFSROOTWIZINFO i_lpWizInfo
  240. );
  241. // On the page being activated. Shown to the user
  242. BOOL OnSetActive(
  243. );
  244. // On Next button being pressed
  245. BOOL OnWizardNext(
  246. );
  247. // On Back button being pressed
  248. BOOL OnWizardBack(
  249. );
  250. LRESULT OnInitDialog(
  251. IN UINT i_uMsg,
  252. IN WPARAM i_wParam,
  253. IN LPARAM i_lParam,
  254. IN OUT BOOL& io_bHandled
  255. );
  256. private:
  257. LPCREATEDFSROOTWIZINFO m_lpWizInfo;
  258. };
  259. // ----------------------------------------------------------------------------
  260. // CCreateDfsRootWizPage6: DfsRoot name selection
  261. // Here the user specifies the dfsroot name.
  262. class CCreateDfsRootWizPage6:
  263. public CQWizardPageImpl<CCreateDfsRootWizPage6>
  264. {
  265. BEGIN_MSG_MAP(CCreateDfsRootWizPage6)
  266. COMMAND_HANDLER(IDC_EDIT_DFSROOT_NAME, EN_CHANGE, OnChangeDfsRoot)
  267. CHAIN_MSG_MAP(CQWizardPageImpl<CCreateDfsRootWizPage6>)
  268. END_MSG_MAP()
  269. public:
  270. enum { IDD = IDD_CREATE_DFSROOT_WIZ_PAGE6 };
  271. CCreateDfsRootWizPage6(
  272. IN LPCREATEDFSROOTWIZINFO i_lpWizInfo
  273. );
  274. // On the page being activated. Shown to the user
  275. BOOL OnSetActive(
  276. );
  277. LRESULT OnChangeDfsRoot(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  278. // On Next button being pressed
  279. BOOL OnWizardNext(
  280. );
  281. // On Back button being pressed
  282. BOOL OnWizardBack(
  283. );
  284. private:
  285. // Update the text labels
  286. HRESULT UpdateLabels(
  287. );
  288. // To set default values for the controls, etc
  289. HRESULT SetDefaultValues(
  290. );
  291. private:
  292. LPCREATEDFSROOTWIZINFO m_lpWizInfo;
  293. };
  294. // ----------------------------------------------------------------------------
  295. // CCreateDfsRootWizPage7: Completion page
  296. // The final page. Just displays a message
  297. class CCreateDfsRootWizPage7:
  298. public CQWizardPageImpl<CCreateDfsRootWizPage7>
  299. {
  300. public:
  301. enum { IDD = IDD_CREATE_DFSROOT_WIZ_PAGE7 };
  302. CCreateDfsRootWizPage7(
  303. IN LPCREATEDFSROOTWIZINFO i_lpWizInfo = NULL
  304. );
  305. // On the page being activated. Shown to the user
  306. BOOL OnSetActive(
  307. );
  308. // On Finish button being pressed
  309. BOOL OnWizardFinish(
  310. );
  311. // On Back button being pressed
  312. BOOL OnWizardBack(
  313. );
  314. BOOL OnQueryCancel();
  315. private:
  316. // Update the text labels
  317. HRESULT UpdateLabels(
  318. );
  319. private:
  320. LPCREATEDFSROOTWIZINFO m_lpWizInfo;
  321. };
  322. // Helper Function to Set Up Dfs, called from wizard and new root replica (Page5 and Page 6)
  323. HRESULT _SetUpDfs(
  324. LPCREATEDFSROOTWIZINFO i_lpWizInfo
  325. );
  326. #endif // __CREATE_DFSROOT_WIZARD_PAGES_H_