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.3 KiB

  1. // Copyright (C) 1997 Microsoft Corporation
  2. //
  3. // dns client configuration page
  4. //
  5. // 12-22-97 sburns
  6. #include "headers.hxx"
  7. #include "page.hpp"
  8. #include "ConfigureDnsClientPage.hpp"
  9. #include "resource.h"
  10. #include "state.hpp"
  11. #include "common.hpp"
  12. ConfigureDnsClientPage::ConfigureDnsClientPage()
  13. :
  14. DCPromoWizardPage(
  15. IDD_CONFIG_DNS_CLIENT,
  16. IDS_CONFIG_DNS_CLIENT_PAGE_TITLE,
  17. IDS_CONFIG_DNS_CLIENT_PAGE_SUBTITLE)
  18. {
  19. LOG_CTOR(ConfigureDnsClientPage);
  20. }
  21. ConfigureDnsClientPage::~ConfigureDnsClientPage()
  22. {
  23. LOG_DTOR(ConfigureDnsClientPage);
  24. }
  25. // NTRAID#NTBUG9-467553-2001/09/17-sburns
  26. bool
  27. ConfigureDnsClientPage::OnNotify(
  28. HWND /* windowFrom */ ,
  29. UINT_PTR controlIDFrom,
  30. UINT code,
  31. LPARAM /* lParam */ )
  32. {
  33. // LOG_FUNCTION(ConfigureDnsClientPage::OnNotify);
  34. bool result = false;
  35. if (controlIDFrom == IDC_JUMP)
  36. {
  37. switch (code)
  38. {
  39. case NM_CLICK:
  40. case NM_RETURN:
  41. {
  42. ShowTroubleshooter(hwnd, IDS_CONFIG_DNS_HELP_TOPIC);
  43. result = true;
  44. }
  45. default:
  46. {
  47. // do nothing
  48. break;
  49. }
  50. }
  51. }
  52. return result;
  53. }
  54. void
  55. ConfigureDnsClientPage::OnInit()
  56. {
  57. LOG_FUNCTION(ConfigureDnsClientPage::OnInit);
  58. }
  59. bool
  60. ConfigureDnsClientPage::OnSetActive()
  61. {
  62. LOG_FUNCTION(ConfigureDnsClientPage::OnSetActive);
  63. State& state = State::GetInstance();
  64. if (state.RunHiddenUnattended() || Dns::IsClientConfigured())
  65. {
  66. LOG(L"planning to Skip Configure DNS Client page");
  67. Wizard& wiz = GetWizard();
  68. if (wiz.IsBacktracking())
  69. {
  70. // backup once again
  71. wiz.Backtrack(hwnd);
  72. return true;
  73. }
  74. int nextPage = ConfigureDnsClientPage::Validate();
  75. if (nextPage != -1)
  76. {
  77. LOG(L"skipping DNS Client Page");
  78. wiz.SetNextPageID(hwnd, nextPage);
  79. return true;
  80. }
  81. state.ClearHiddenWhileUnattended();
  82. }
  83. Win::PropSheet_SetWizButtons(
  84. Win::GetParent(hwnd),
  85. PSWIZB_BACK | PSWIZB_NEXT);
  86. return true;
  87. }
  88. int
  89. ConfigureDnsClientPage::Validate()
  90. {
  91. LOG_FUNCTION(ConfigureDnsClientPage::Validate);
  92. int nextPage = -1;
  93. if (Dns::IsClientConfigured())
  94. {
  95. State& state = State::GetInstance();
  96. if (state.GetRunContext() == State::BDC_UPGRADE)
  97. {
  98. ASSERT(state.GetOperation() == State::REPLICA);
  99. nextPage = IDD_CHECK_DOMAIN_UPGRADED;
  100. }
  101. else
  102. {
  103. switch (state.GetOperation())
  104. {
  105. case State::FOREST:
  106. case State::TREE:
  107. case State::CHILD:
  108. case State::REPLICA:
  109. {
  110. nextPage = IDD_GET_CREDENTIALS;
  111. break;
  112. }
  113. case State::ABORT_BDC_UPGRADE:
  114. case State::DEMOTE:
  115. case State::NONE:
  116. default:
  117. {
  118. ASSERT(false);
  119. break;
  120. }
  121. }
  122. }
  123. }
  124. else
  125. {
  126. String message = String::load(IDS_CONFIG_DNS_FIRST);
  127. popup.Info(hwnd, message);
  128. }
  129. return nextPage;
  130. }