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.

178 lines
3.4 KiB

  1. // Copyright (C) 1997 Microsoft Corporation
  2. //
  3. // downlevel RAS server fixup page
  4. //
  5. // 11-23-98 sburns
  6. #include "headers.hxx"
  7. #include "rasfixup.hpp"
  8. #include "resource.h"
  9. #include "state.hpp"
  10. RASFixupPage::RASFixupPage()
  11. :
  12. DCPromoWizardPage(
  13. IDD_RAS_FIXUP,
  14. IDS_RAS_FIXUP_PAGE_TITLE,
  15. IDS_RAS_FIXUP_PAGE_SUBTITLE)
  16. {
  17. LOG_CTOR(RASFixupPage);
  18. }
  19. RASFixupPage::~RASFixupPage()
  20. {
  21. LOG_DTOR(RASFixupPage);
  22. }
  23. void
  24. RASFixupPage::OnInit()
  25. {
  26. LOG_FUNCTION(RASFixupPage::OnInit);
  27. State& state = State::GetInstance();
  28. // If we're upgrading an NT 4 PDC, then the expectation is that the
  29. // customer is more likely to have an app-compat problem, so we default to
  30. // the allow-access option. Otherwise, we default to the more secure (but
  31. // less compatible) option.
  32. // NTRAID#NTBUG9-539263-2002/04/16-sburns
  33. int defaultButton =
  34. state.GetRunContext() == State::PDC_UPGRADE
  35. ? IDC_ALLOW_ANON_ACCESS
  36. : IDC_DENY_ANON_ACCESS;
  37. if (state.UsingAnswerFile())
  38. {
  39. String option =
  40. state.GetAnswerFileOption(AnswerFile::OPTION_ALLOW_ANON_ACCESS);
  41. int button = defaultButton;
  42. if (option.icompare(AnswerFile::VALUE_YES) == 0)
  43. {
  44. button = IDC_ALLOW_ANON_ACCESS;
  45. }
  46. else if (option.icompare(AnswerFile::VALUE_NO) == 0)
  47. {
  48. button = IDC_DENY_ANON_ACCESS;
  49. }
  50. Win::CheckDlgButton(
  51. hwnd,
  52. button,
  53. BST_CHECKED);
  54. return;
  55. }
  56. Win::CheckDlgButton(hwnd, defaultButton, BST_CHECKED);
  57. Win::PostMessage(
  58. Win::GetParent(hwnd),
  59. WM_NEXTDLGCTL,
  60. (WPARAM) Win::GetDlgItem(hwnd, defaultButton),
  61. TRUE);
  62. }
  63. bool
  64. RASFixupPage::OnSetActive()
  65. {
  66. LOG_FUNCTION(RASFixupPage::OnSetActive);
  67. State& state = State::GetInstance();
  68. bool skip = true;
  69. switch (state.GetOperation())
  70. {
  71. case State::FOREST:
  72. case State::TREE:
  73. case State::CHILD:
  74. {
  75. skip = false;
  76. break;
  77. }
  78. case State::REPLICA:
  79. case State::ABORT_BDC_UPGRADE:
  80. case State::DEMOTE:
  81. case State::NONE:
  82. {
  83. // do nothing: i.e. skip this page
  84. break;
  85. }
  86. default:
  87. {
  88. ASSERT(false);
  89. break;
  90. }
  91. }
  92. if (state.RunHiddenUnattended() || skip) // 268231
  93. {
  94. LOG(L"planning to skip RAS fixup page");
  95. Wizard& wizard = GetWizard();
  96. if (wizard.IsBacktracking())
  97. {
  98. // backup once again
  99. wizard.Backtrack(hwnd);
  100. return true;
  101. }
  102. int nextPage = Validate();
  103. if (nextPage != -1)
  104. {
  105. LOG(L"skipping RAS Fixup Page");
  106. wizard.SetNextPageID(hwnd, nextPage);
  107. return true;
  108. }
  109. state.ClearHiddenWhileUnattended();
  110. }
  111. Win::PropSheet_SetWizButtons(
  112. Win::GetParent(hwnd),
  113. PSWIZB_BACK | PSWIZB_NEXT);
  114. return true;
  115. }
  116. int
  117. RASFixupPage::Validate()
  118. {
  119. LOG_FUNCTION(RASFixupPage::Validate);
  120. State& state = State::GetInstance();
  121. if (Win::IsDlgButtonChecked(hwnd, IDC_ALLOW_ANON_ACCESS))
  122. {
  123. state.SetShouldAllowAnonymousAccess(true);
  124. }
  125. else
  126. {
  127. ASSERT(Win::IsDlgButtonChecked(hwnd, IDC_DENY_ANON_ACCESS));
  128. state.SetShouldAllowAnonymousAccess(false);
  129. }
  130. return IDD_SAFE_MODE_PASSWORD;
  131. }