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.

182 lines
3.4 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. bool
  26. ConfigureDnsClientPage::OnCommand(
  27. HWND /* windowFrom */ ,
  28. unsigned controlIDFrom,
  29. unsigned code)
  30. {
  31. // LOG_FUNCTION(ConfigureDnsClientPage::OnCommand);
  32. if (controlIDFrom == IDC_JUMP)
  33. {
  34. if (code == BN_CLICKED)
  35. {
  36. ShowTroubleshooter(hwnd, IDS_CONFIG_DNS_HELP_TOPIC);
  37. return true;
  38. }
  39. }
  40. return false;
  41. }
  42. void
  43. ConfigureDnsClientPage::OnInit()
  44. {
  45. LOG_FUNCTION(ConfigureDnsClientPage::OnInit);
  46. }
  47. bool
  48. ConfigureDnsClientPage::OnSetActive()
  49. {
  50. LOG_FUNCTION(ConfigureDnsClientPage::OnSetActive);
  51. State& state = State::GetInstance();
  52. if (state.RunHiddenUnattended() || Dns::IsClientConfigured())
  53. {
  54. LOG(L"planning to Skip Configure DNS Client page");
  55. Wizard& wiz = GetWizard();
  56. if (wiz.IsBacktracking())
  57. {
  58. // backup once again
  59. wiz.Backtrack(hwnd);
  60. return true;
  61. }
  62. int nextPage = ConfigureDnsClientPage::Validate();
  63. if (nextPage != -1)
  64. {
  65. LOG(L"skipping DNS Client Page");
  66. wiz.SetNextPageID(hwnd, nextPage);
  67. return true;
  68. }
  69. state.ClearHiddenWhileUnattended();
  70. }
  71. Win::PropSheet_SetWizButtons(
  72. Win::GetParent(hwnd),
  73. PSWIZB_BACK | PSWIZB_NEXT);
  74. return true;
  75. }
  76. int
  77. ConfigureDnsClientPage::Validate()
  78. {
  79. LOG_FUNCTION(ConfigureDnsClientPage::Validate);
  80. int nextPage = -1;
  81. if (Dns::IsClientConfigured())
  82. {
  83. State& state = State::GetInstance();
  84. if (state.GetRunContext() == State::BDC_UPGRADE)
  85. {
  86. ASSERT(state.GetOperation() == State::REPLICA);
  87. // Get the DNS name of the domain. If it is empty, then the domain is
  88. // not NT5 DS yet.
  89. // this will search for the domain if necessary.
  90. String dnsDomainName = state.GetComputer().GetDomainDnsName();
  91. if (dnsDomainName.empty())
  92. {
  93. String message = String::load(IDS_CONVERT_PDC_FIRST);
  94. LOG(message);
  95. popup.Info(hwnd, message);
  96. nextPage = IDD_REPLICA_OR_MEMBER;
  97. }
  98. else
  99. {
  100. state.SetReplicaDomainDNSName(dnsDomainName);
  101. nextPage = IDD_GET_CREDENTIALS;
  102. }
  103. }
  104. else
  105. {
  106. switch (state.GetOperation())
  107. {
  108. case State::FOREST:
  109. case State::TREE:
  110. case State::CHILD:
  111. case State::REPLICA:
  112. {
  113. nextPage = IDD_GET_CREDENTIALS;
  114. break;
  115. }
  116. case State::ABORT_BDC_UPGRADE:
  117. case State::DEMOTE:
  118. case State::NONE:
  119. default:
  120. {
  121. ASSERT(false);
  122. break;
  123. }
  124. }
  125. }
  126. }
  127. else
  128. {
  129. String message = String::load(IDS_CONFIG_DNS_FIRST);
  130. popup.Info(hwnd, message);
  131. }
  132. return nextPage;
  133. }