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.

265 lines
5.2 KiB

  1. // Copyright (C) 2002 Microsoft Corporation
  2. //
  3. // readme page
  4. // NTRAID#NTBUG9-510384-2002/01/04-sburns
  5. // To be restored in Lornhorn NTRAID#NTBUG9-524242-2002/01/22-sburns
  6. //
  7. // 04 January 2002 sburns
  8. #include "headers.hxx"
  9. #include "page.hpp"
  10. #include "ReadmePage.hpp"
  11. #include "resource.h"
  12. #include "state.hpp"
  13. #include "common.hpp"
  14. ReadmePage::ReadmePage()
  15. :
  16. DCPromoWizardPage(
  17. IDD_README,
  18. IDS_README_PAGE_TITLE,
  19. IDS_README_PAGE_SUBTITLE),
  20. bulletFont(0)
  21. {
  22. LOG_CTOR(ReadmePage);
  23. }
  24. ReadmePage::~ReadmePage()
  25. {
  26. LOG_DTOR(ReadmePage);
  27. if (bulletFont)
  28. {
  29. HRESULT hr = Win::DeleteObject(bulletFont);
  30. ASSERT(SUCCEEDED(hr));
  31. }
  32. }
  33. bool
  34. ReadmePage::OnNotify(
  35. HWND /* windowFrom */ ,
  36. UINT_PTR controlIDFrom,
  37. UINT code,
  38. LPARAM /* lParam */ )
  39. {
  40. // LOG_FUNCTION(ReadmePage::OnNotify);
  41. bool result = false;
  42. switch (code)
  43. {
  44. case NM_CLICK:
  45. case NM_RETURN:
  46. {
  47. switch (controlIDFrom)
  48. {
  49. case IDC_PRIMER_LINK:
  50. {
  51. Win::HtmlHelp(
  52. hwnd,
  53. L"adconcepts.chm::/sag_AD_DCInstallTopNode.htm",
  54. HH_DISPLAY_TOPIC,
  55. 0);
  56. result = true;
  57. break;
  58. }
  59. case IDC_DEPLOY_LINK:
  60. {
  61. HRESULT hr =
  62. Win32ToHresult(
  63. (DWORD) (UINT_PTR) ShellExecute(
  64. 0,
  65. L"open",
  66. L"http://www.microsoft.com/activedirectory",
  67. 0,
  68. 0,
  69. // this brings the new window to the foreground
  70. // with focus
  71. SW_SHOWNORMAL ));
  72. if (FAILED(hr))
  73. {
  74. LOG(
  75. String::format(
  76. L"Failed to launch webpage: hr = 0x%1!x!",
  77. hr));
  78. }
  79. result = true;
  80. break;
  81. }
  82. default:
  83. {
  84. // do nothing
  85. break;
  86. }
  87. }
  88. }
  89. default:
  90. {
  91. // do nothing
  92. break;
  93. }
  94. }
  95. return result;
  96. }
  97. void
  98. ReadmePage::OnInit()
  99. {
  100. LOG_FUNCTION(ReadmePage::OnInit);
  101. InitializeBullets();
  102. }
  103. void
  104. ReadmePage::InitializeBullets()
  105. {
  106. LOG_FUNCTION(BeforeBeginPage::InitializeBulletedList);
  107. ASSERT(!bulletFont);
  108. bulletFont =
  109. ::CreateFont(
  110. 0,
  111. 0,
  112. 0,
  113. 0,
  114. FW_NORMAL,
  115. 0,
  116. 0,
  117. 0,
  118. SYMBOL_CHARSET,
  119. OUT_CHARACTER_PRECIS,
  120. CLIP_CHARACTER_PRECIS,
  121. PROOF_QUALITY,
  122. VARIABLE_PITCH | FF_DONTCARE,
  123. L"Marlett");
  124. if (bulletFont)
  125. {
  126. Win::SetWindowFont(Win::GetDlgItem(hwnd, IDC_BULLET1), bulletFont, true);
  127. Win::SetWindowFont(Win::GetDlgItem(hwnd, IDC_BULLET2), bulletFont, true);
  128. Win::SetWindowFont(Win::GetDlgItem(hwnd, IDC_BULLET3), bulletFont, true);
  129. }
  130. else
  131. {
  132. LOG(String::format(
  133. L"Failed to create font for bullet list: hr = %1!x!",
  134. Win::GetLastErrorAsHresult()));
  135. }
  136. }
  137. bool
  138. ReadmePage::OnSetActive()
  139. {
  140. LOG_FUNCTION(ReadmePage::OnSetActive);
  141. Win::PropSheet_SetWizButtons(
  142. Win::GetParent(hwnd),
  143. PSWIZB_BACK | PSWIZB_NEXT);
  144. Win::PostMessage(
  145. Win::GetParent(hwnd),
  146. WM_NEXTDLGCTL,
  147. (WPARAM) Win::GetDlgItem(Win::GetParent(hwnd), Wizard::NEXT_BTN_ID),
  148. TRUE);
  149. State& state = State::GetInstance();
  150. if (state.RunHiddenUnattended())
  151. {
  152. int nextPage = Validate();
  153. if (nextPage != -1)
  154. {
  155. GetWizard().SetNextPageID(hwnd, nextPage);
  156. }
  157. else
  158. {
  159. state.ClearHiddenWhileUnattended();
  160. }
  161. }
  162. return true;
  163. }
  164. int
  165. ReadmePage::Validate()
  166. {
  167. LOG_FUNCTION(ReadmePage::Validate);
  168. int nextPage = -1;
  169. State& state = State::GetInstance();
  170. switch (state.GetRunContext())
  171. {
  172. case State::PDC_UPGRADE:
  173. case State::NT5_STANDALONE_SERVER:
  174. case State::NT5_MEMBER_SERVER:
  175. {
  176. nextPage = IDD_INSTALL_TCPIP;
  177. break;
  178. }
  179. case State::BDC_UPGRADE:
  180. {
  181. nextPage = IDD_REPLICA_OR_MEMBER;
  182. break;
  183. }
  184. case State::NT5_DC:
  185. {
  186. // The welcome page should not have sent the user to this page
  187. // in the demote case.
  188. ASSERT(false);
  189. state.SetOperation(State::DEMOTE);
  190. // NTRAID#NTBUG9-496409-2001/11/29-sburns
  191. if (state.IsForcedDemotion())
  192. {
  193. nextPage = IDD_FORCE_DEMOTE;
  194. }
  195. else
  196. {
  197. nextPage = IDD_DEMOTE;
  198. }
  199. break;
  200. }
  201. default:
  202. {
  203. ASSERT(false);
  204. break;
  205. }
  206. }
  207. return nextPage;
  208. }