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.

237 lines
4.4 KiB

  1. // Copyright (C) 2002 Microsoft Corporation
  2. //
  3. // Warn about SMB signing page. dc install is a pretty messy business,
  4. // isn't it?
  5. //
  6. // 15 October 2002 sburns
  7. #include "headers.hxx"
  8. #include "page.hpp"
  9. #include "SecureCommWarningPage.hpp"
  10. #include "resource.h"
  11. #include "state.hpp"
  12. #include "common.hpp"
  13. SecureCommWarningPage::SecureCommWarningPage()
  14. :
  15. DCPromoWizardPage(
  16. IDD_SECWARN,
  17. IDS_SECWARN_PAGE_TITLE,
  18. IDS_SECWARN_PAGE_SUBTITLE),
  19. bulletFont(0)
  20. {
  21. LOG_CTOR(SecureCommWarningPage);
  22. }
  23. SecureCommWarningPage::~SecureCommWarningPage()
  24. {
  25. LOG_DTOR(SecureCommWarningPage);
  26. if (bulletFont)
  27. {
  28. HRESULT hr = Win::DeleteObject(bulletFont);
  29. ASSERT(SUCCEEDED(hr));
  30. }
  31. }
  32. bool
  33. SecureCommWarningPage::OnNotify(
  34. HWND /* windowFrom */ ,
  35. UINT_PTR controlIDFrom,
  36. UINT code,
  37. LPARAM /* lParam */ )
  38. {
  39. // LOG_FUNCTION(SecureCommWarningPage::OnNotify);
  40. bool result = false;
  41. switch (code)
  42. {
  43. case NM_CLICK:
  44. case NM_RETURN:
  45. {
  46. switch (controlIDFrom)
  47. {
  48. case IDC_LINK:
  49. {
  50. Win::HtmlHelp(
  51. hwnd,
  52. L"adconcepts.chm::/adhelp3.htm",
  53. HH_DISPLAY_TOPIC,
  54. 0);
  55. result = true;
  56. break;
  57. }
  58. default:
  59. {
  60. // do nothing
  61. break;
  62. }
  63. }
  64. }
  65. default:
  66. {
  67. // do nothing
  68. break;
  69. }
  70. }
  71. return result;
  72. }
  73. void
  74. SecureCommWarningPage::OnInit()
  75. {
  76. LOG_FUNCTION(SecureCommWarningPage::OnInit);
  77. InitializeBullets();
  78. }
  79. void
  80. SecureCommWarningPage::InitializeBullets()
  81. {
  82. LOG_FUNCTION(SecureCommWarningPage::InitializeBullets);
  83. ASSERT(!bulletFont);
  84. bulletFont =
  85. ::CreateFont(
  86. 0,
  87. 0,
  88. 0,
  89. 0,
  90. FW_NORMAL,
  91. 0,
  92. 0,
  93. 0,
  94. SYMBOL_CHARSET,
  95. OUT_CHARACTER_PRECIS,
  96. CLIP_CHARACTER_PRECIS,
  97. PROOF_QUALITY,
  98. VARIABLE_PITCH | FF_DONTCARE,
  99. L"Marlett");
  100. if (bulletFont)
  101. {
  102. Win::SetWindowFont(Win::GetDlgItem(hwnd, IDC_BULLET1), bulletFont, true);
  103. Win::SetWindowFont(Win::GetDlgItem(hwnd, IDC_BULLET2), bulletFont, true);
  104. }
  105. else
  106. {
  107. LOG(String::format(
  108. L"Failed to create font for bullet list: hr = %1!x!",
  109. Win::GetLastErrorAsHresult()));
  110. }
  111. }
  112. bool
  113. SecureCommWarningPage::OnSetActive()
  114. {
  115. LOG_FUNCTION(SecureCommWarningPage::OnSetActive);
  116. Win::PropSheet_SetWizButtons(
  117. Win::GetParent(hwnd),
  118. PSWIZB_BACK | PSWIZB_NEXT);
  119. Win::PostMessage(
  120. Win::GetParent(hwnd),
  121. WM_NEXTDLGCTL,
  122. (WPARAM) Win::GetDlgItem(Win::GetParent(hwnd), Wizard::NEXT_BTN_ID),
  123. TRUE);
  124. State& state = State::GetInstance();
  125. if (state.RunHiddenUnattended())
  126. {
  127. int nextPage = Validate();
  128. if (nextPage != -1)
  129. {
  130. GetWizard().SetNextPageID(hwnd, nextPage);
  131. }
  132. else
  133. {
  134. state.ClearHiddenWhileUnattended();
  135. }
  136. }
  137. return true;
  138. }
  139. int
  140. SecureCommWarningPage::Validate()
  141. {
  142. LOG_FUNCTION(SecureCommWarningPage::Validate);
  143. int nextPage = -1;
  144. State& state = State::GetInstance();
  145. switch (state.GetRunContext())
  146. {
  147. case State::PDC_UPGRADE:
  148. case State::NT5_STANDALONE_SERVER:
  149. case State::NT5_MEMBER_SERVER:
  150. {
  151. nextPage = IDD_INSTALL_TCPIP;
  152. break;
  153. }
  154. case State::BDC_UPGRADE:
  155. {
  156. nextPage = IDD_REPLICA_OR_MEMBER;
  157. break;
  158. }
  159. case State::NT5_DC:
  160. {
  161. // The welcome page should not have sent the user to this page
  162. // in the demote case.
  163. ASSERT(false);
  164. state.SetOperation(State::DEMOTE);
  165. // NTRAID#NTBUG9-496409-2001/11/29-sburns
  166. if (state.IsForcedDemotion())
  167. {
  168. nextPage = IDD_FORCE_DEMOTE;
  169. }
  170. else
  171. {
  172. nextPage = IDD_DEMOTE;
  173. }
  174. break;
  175. }
  176. default:
  177. {
  178. ASSERT(false);
  179. break;
  180. }
  181. }
  182. return nextPage;
  183. }