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.

232 lines
4.4 KiB

  1. // Copyright (C) 1997 Microsoft Corporation
  2. //
  3. // welcome page
  4. //
  5. // 12-15-97 sburns
  6. #include "headers.hxx"
  7. #include "page.hpp"
  8. #include "WelcomePage.hpp"
  9. #include "resource.h"
  10. #include "common.hpp"
  11. #include "state.hpp"
  12. WelcomePage::WelcomePage()
  13. :
  14. DCPromoWizardPage(
  15. IDD_WELCOME,
  16. IDS_WELCOME_PAGE_TITLE,
  17. IDS_WELCOME_PAGE_SUBTITLE,
  18. false)
  19. {
  20. LOG_CTOR(WelcomePage);
  21. }
  22. WelcomePage::~WelcomePage()
  23. {
  24. LOG_DTOR(WelcomePage);
  25. }
  26. // NTRAID#NTBUG9-510384-2002/01/22-sburns
  27. bool
  28. WelcomePage::OnNotify(
  29. HWND /* windowFrom */ ,
  30. UINT_PTR controlIDFrom,
  31. UINT code,
  32. LPARAM /* lParam */ )
  33. {
  34. // LOG_FUNCTION(WelcomePage::OnNotify);
  35. bool result = false;
  36. switch (code)
  37. {
  38. case NM_CLICK:
  39. case NM_RETURN:
  40. {
  41. switch (controlIDFrom)
  42. {
  43. case IDC_PRIMER_LINK:
  44. {
  45. Win::HtmlHelp(
  46. hwnd,
  47. L"adconcepts.chm::/sag_AD_DCInstallTopNode.htm",
  48. HH_DISPLAY_TOPIC,
  49. 0);
  50. result = true;
  51. break;
  52. }
  53. default:
  54. {
  55. // do nothing
  56. break;
  57. }
  58. }
  59. }
  60. default:
  61. {
  62. // do nothing
  63. break;
  64. }
  65. }
  66. return result;
  67. }
  68. void
  69. WelcomePage::OnInit()
  70. {
  71. LOG_FUNCTION(WelcomePage::OnInit);
  72. SetLargeFont(hwnd, IDC_BIG_BOLD_TITLE);
  73. Win::PropSheet_SetTitle(
  74. Win::GetParent(hwnd),
  75. 0,
  76. String::load(IDS_WIZARD_TITLE));
  77. State& state = State::GetInstance();
  78. int intro1TextId = IDS_INTRO1_INSTALL;
  79. String intro2Text;
  80. switch (state.GetRunContext())
  81. {
  82. case State::NT5_DC:
  83. {
  84. intro1TextId = IDS_INTRO1_DEMOTE;
  85. intro2Text = String::load(IDS_INTRO2_DEMOTE);
  86. // no readme for demote.
  87. Win::ShowWindow(Win::GetDlgItem(hwnd, IDC_PRIMER_LINK), SW_HIDE);
  88. break;
  89. }
  90. case State::NT5_STANDALONE_SERVER:
  91. case State::NT5_MEMBER_SERVER:
  92. {
  93. intro2Text = String::load(IDS_INTRO2_INSTALL);
  94. break;
  95. }
  96. case State::BDC_UPGRADE:
  97. {
  98. intro1TextId = IDS_INTRO1_DC_UPGRADE;
  99. intro2Text = String::load(IDS_INTRO2_BDC_UPGRADE);
  100. break;
  101. }
  102. case State::PDC_UPGRADE:
  103. {
  104. intro1TextId = IDS_INTRO1_DC_UPGRADE;
  105. intro2Text =
  106. String::format(
  107. IDS_INTRO2_PDC_UPGRADE,
  108. state.GetComputer().GetDomainNetbiosName().c_str());
  109. break;
  110. }
  111. default:
  112. {
  113. ASSERT(false);
  114. break;
  115. }
  116. }
  117. Win::SetDlgItemText(hwnd, IDC_INTRO1, String::load(intro1TextId));
  118. Win::SetDlgItemText(hwnd, IDC_INTRO2, intro2Text);
  119. }
  120. bool
  121. WelcomePage::OnSetActive()
  122. {
  123. LOG_FUNCTION(WelcomePage::OnSetActive);
  124. Win::PropSheet_SetWizButtons(Win::GetParent(hwnd), PSWIZB_NEXT);
  125. Win::PostMessage(
  126. Win::GetParent(hwnd),
  127. WM_NEXTDLGCTL,
  128. (WPARAM) Win::GetDlgItem(Win::GetParent(hwnd), Wizard::NEXT_BTN_ID),
  129. TRUE);
  130. State& state = State::GetInstance();
  131. if (state.RunHiddenUnattended())
  132. {
  133. int nextPage = Validate();
  134. if (nextPage != -1)
  135. {
  136. GetWizard().SetNextPageID(hwnd, nextPage);
  137. }
  138. else
  139. {
  140. state.ClearHiddenWhileUnattended();
  141. }
  142. }
  143. return true;
  144. }
  145. int
  146. WelcomePage::Validate()
  147. {
  148. LOG_FUNCTION(WelcomePage::Validate);
  149. int nextPage = -1;
  150. State& state = State::GetInstance();
  151. switch (state.GetRunContext())
  152. {
  153. case State::PDC_UPGRADE:
  154. case State::NT5_STANDALONE_SERVER:
  155. case State::NT5_MEMBER_SERVER:
  156. case State::BDC_UPGRADE:
  157. {
  158. nextPage = IDD_SECWARN;
  159. break;
  160. }
  161. case State::NT5_DC:
  162. {
  163. state.SetOperation(State::DEMOTE);
  164. // NTRAID#NTBUG9-496409-2001/11/29-sburns
  165. if (state.IsForcedDemotion())
  166. {
  167. nextPage = IDD_FORCE_DEMOTE;
  168. }
  169. else
  170. {
  171. nextPage = IDD_DEMOTE;
  172. }
  173. break;
  174. }
  175. default:
  176. {
  177. ASSERT(false);
  178. break;
  179. }
  180. }
  181. return nextPage;
  182. }