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.

154 lines
2.8 KiB

  1. // Copyright (C) 1997-2001 Microsoft Corporation
  2. //
  3. // allow user to set forest version
  4. // NTRAID#NTBUG9-159663-2001/04/18-sburns
  5. //
  6. // 18 Apr 2001 sburns
  7. #include "headers.hxx"
  8. #include "resource.h"
  9. #include "page.hpp"
  10. #include "ForestVersionPage.hpp"
  11. #include "state.hpp"
  12. ForestVersionPage::ForestVersionPage()
  13. :
  14. DCPromoWizardPage(
  15. IDD_FOREST_VERSION,
  16. IDS_FOREST_VERSION_PAGE_TITLE,
  17. IDS_FOREST_VERSION_PAGE_SUBTITLE)
  18. {
  19. LOG_CTOR(ForestVersionPage);
  20. }
  21. ForestVersionPage::~ForestVersionPage()
  22. {
  23. LOG_DTOR(ForestVersionPage);
  24. }
  25. void
  26. ForestVersionPage::OnInit()
  27. {
  28. LOG_FUNCTION(ForestVersionPage::OnInit);
  29. State& state = State::GetInstance();
  30. if (state.UsingAnswerFile())
  31. {
  32. String option =
  33. state.GetAnswerFileOption(AnswerFile::OPTION_SET_FOREST_VERSION);
  34. if (option.icompare(AnswerFile::VALUE_YES) == 0)
  35. {
  36. Win::CheckDlgButton(hwnd, IDC_WINDOTNET, BST_CHECKED);
  37. return;
  38. }
  39. }
  40. Win::CheckDlgButton(hwnd, IDC_WIN2K, BST_CHECKED);
  41. }
  42. // bool
  43. // ForestVersionPage::OnCommand(
  44. // HWND /* windowFrom */ ,
  45. // unsigned controlIDFrom,
  46. // unsigned code)
  47. // {
  48. // // LOG_FUNCTION(ForestVersionPage::OnCommand);
  49. //
  50. // switch (controlIDFrom)
  51. // {
  52. // case IDC_WIN2K:
  53. // case IDC_WINDOTNET:
  54. // {
  55. // if (code == BN_CLICKED)
  56. // {
  57. // SetChanged(controlIDFrom);
  58. // return true;
  59. // }
  60. // }
  61. // default:
  62. // {
  63. // // do nothing
  64. //
  65. // break;
  66. // }
  67. // }
  68. //
  69. // return false;
  70. // }
  71. bool
  72. ForestVersionPage::OnSetActive()
  73. {
  74. LOG_FUNCTION(ForestVersionPage::OnSetActive);
  75. ASSERT(State::GetInstance().GetOperation() == State::FOREST);
  76. Win::PropSheet_SetWizButtons(
  77. Win::GetParent(hwnd),
  78. PSWIZB_BACK | PSWIZB_NEXT);
  79. State& state = State::GetInstance();
  80. if (state.RunHiddenUnattended())
  81. {
  82. // skip the page.
  83. LOG(L"skipping ForestVersionPage");
  84. Wizard& wiz = GetWizard();
  85. if (wiz.IsBacktracking())
  86. {
  87. // backup once again
  88. wiz.Backtrack(hwnd);
  89. return true;
  90. }
  91. int nextPage = ForestVersionPage::Validate();
  92. if (nextPage != -1)
  93. {
  94. GetWizard().SetNextPageID(hwnd, nextPage);
  95. }
  96. else
  97. {
  98. state.ClearHiddenWhileUnattended();
  99. }
  100. }
  101. return true;
  102. }
  103. int
  104. ForestVersionPage::Validate()
  105. {
  106. LOG_FUNCTION(ForestVersionPage::Validate);
  107. State& state = State::GetInstance();
  108. int nextPage = IDD_PATHS;
  109. state.SetSetForestVersionFlag(Win::IsDlgButtonChecked(hwnd, IDC_WINDOTNET));
  110. LOG(String::format(L"next = %1!d!", nextPage));
  111. return nextPage;
  112. }