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.

166 lines
2.8 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. warnIcon(0)
  17. {
  18. LOG_CTOR(RASFixupPage);
  19. }
  20. RASFixupPage::~RASFixupPage()
  21. {
  22. LOG_DTOR(RASFixupPage);
  23. if (warnIcon)
  24. {
  25. Win::DestroyIcon(warnIcon);
  26. }
  27. }
  28. void
  29. RASFixupPage::OnInit()
  30. {
  31. LOG_FUNCTION(RASFixupPage::OnInit);
  32. HRESULT hr = Win::LoadImage(IDI_WARN, warnIcon);
  33. ASSERT(SUCCEEDED(hr));
  34. Win::SendMessage(
  35. Win::GetDlgItem(hwnd, IDC_WARNING_ICON),
  36. STM_SETICON,
  37. reinterpret_cast<WPARAM>(warnIcon),
  38. 0);
  39. State& state = State::GetInstance();
  40. if (state.UsingAnswerFile())
  41. {
  42. String option =
  43. state.GetAnswerFileOption(State::OPTION_ALLOW_ANON_ACCESS);
  44. Win::CheckDlgButton(
  45. hwnd,
  46. (option.icompare(State::VALUE_NO) == 0)
  47. ? IDC_DENY_ANON_ACCESS
  48. : IDC_ALLOW_ANON_ACCESS,
  49. BST_CHECKED);
  50. return;
  51. }
  52. Win::CheckDlgButton(hwnd, IDC_ALLOW_ANON_ACCESS, BST_CHECKED);
  53. }
  54. bool
  55. RASFixupPage::OnSetActive()
  56. {
  57. LOG_FUNCTION(RASFixupPage::OnSetActive);
  58. State& state = State::GetInstance();
  59. bool skip = true;
  60. switch (state.GetOperation())
  61. {
  62. case State::FOREST:
  63. case State::TREE:
  64. case State::CHILD:
  65. {
  66. skip = false;
  67. break;
  68. }
  69. case State::REPLICA:
  70. case State::ABORT_BDC_UPGRADE:
  71. case State::DEMOTE:
  72. case State::NONE:
  73. {
  74. // do nothing: i.e. skip this page
  75. break;
  76. }
  77. default:
  78. {
  79. ASSERT(false);
  80. break;
  81. }
  82. }
  83. if (state.RunHiddenUnattended() || skip) // 268231
  84. {
  85. LOG(L"planning to skip RAS fixup page");
  86. Wizard& wizard = GetWizard();
  87. if (wizard.IsBacktracking())
  88. {
  89. // backup once again
  90. wizard.Backtrack(hwnd);
  91. return true;
  92. }
  93. int nextPage = Validate();
  94. if (nextPage != -1)
  95. {
  96. LOG(L"skipping RAS Fixup Page");
  97. wizard.SetNextPageID(hwnd, nextPage);
  98. return true;
  99. }
  100. state.ClearHiddenWhileUnattended();
  101. }
  102. Win::PropSheet_SetWizButtons(
  103. Win::GetParent(hwnd),
  104. PSWIZB_BACK | PSWIZB_NEXT);
  105. return true;
  106. }
  107. int
  108. RASFixupPage::Validate()
  109. {
  110. LOG_FUNCTION(RASFixupPage::Validate);
  111. State& state = State::GetInstance();
  112. if (Win::IsDlgButtonChecked(hwnd, IDC_ALLOW_ANON_ACCESS))
  113. {
  114. state.SetShouldAllowAnonymousAccess(true);
  115. }
  116. else
  117. {
  118. ASSERT(Win::IsDlgButtonChecked(hwnd, IDC_DENY_ANON_ACCESS));
  119. state.SetShouldAllowAnonymousAccess(false);
  120. }
  121. return IDD_SAFE_MODE_PASSWORD;
  122. }