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.

134 lines
2.3 KiB

  1. // Copyright (C) 1997 Microsoft Corporation
  2. //
  3. // test DNS configured page
  4. //
  5. // 12-18-97 sburns
  6. #include "headers.hxx"
  7. #include "DnsOnNetPage.hpp"
  8. #include "resource.h"
  9. #include "state.hpp"
  10. DnsOnNetPage::DnsOnNetPage()
  11. :
  12. DCPromoWizardPage(
  13. IDD_DNS_ON_NET,
  14. IDS_DNS_ON_NET_PAGE_TITLE,
  15. IDS_DNS_ON_NET_PAGE_SUBTITLE)
  16. {
  17. LOG_CTOR(DnsOnNetPage);
  18. }
  19. DnsOnNetPage::~DnsOnNetPage()
  20. {
  21. LOG_DTOR(DnsOnNetPage);
  22. }
  23. void
  24. DnsOnNetPage::OnInit()
  25. {
  26. LOG_FUNCTION(DnsOnNetPage::OnInit);
  27. if (State::GetInstance().UsingAnswerFile())
  28. {
  29. String option =
  30. State::GetInstance().GetAnswerFileOption(
  31. State::OPTION_DNS_ON_NET);
  32. if (option.icompare(State::VALUE_NO) == 0)
  33. {
  34. Win::CheckDlgButton(hwnd, IDC_DNS_NOT_ON_NET, BST_CHECKED);
  35. return;
  36. }
  37. }
  38. // it's important that this be the default in case the page is skipped.
  39. Win::CheckDlgButton(hwnd, IDC_CONFIG_CLIENT, BST_CHECKED);
  40. }
  41. bool
  42. DnsOnNetPage::OnSetActive()
  43. {
  44. LOG_FUNCTION(DnsOnNetPage::OnSetActive);
  45. // put up a wait cursor, as DNS detection may take a teeny bit of time
  46. Win::CursorSetting cursor(IDC_WAIT);
  47. State& state = State::GetInstance();
  48. if (Dns::IsClientConfigured() || state.RunHiddenUnattended())
  49. {
  50. Wizard& wiz = GetWizard();
  51. // skip this page
  52. if (wiz.IsBacktracking())
  53. {
  54. // backtrack once more
  55. wiz.Backtrack(hwnd);
  56. return true;
  57. }
  58. int nextPage = DnsOnNetPage::Validate();
  59. if (nextPage != -1)
  60. {
  61. wiz.SetNextPageID(hwnd, nextPage);
  62. return true;
  63. }
  64. state.ClearHiddenWhileUnattended();
  65. }
  66. Win::PropSheet_SetWizButtons(
  67. Win::GetParent(hwnd),
  68. PSWIZB_NEXT | PSWIZB_BACK);
  69. return true;
  70. }
  71. int
  72. DnsOnNetPage::Validate()
  73. {
  74. LOG_FUNCTION(DnsOnNetPage::Validate);
  75. bool dnsOnNet = !Win::IsDlgButtonChecked(hwnd, IDC_DNS_NOT_ON_NET);
  76. State& state = State::GetInstance();
  77. state.SetDNSOnNetwork(dnsOnNet);
  78. return dnsOnNet ? IDD_CONFIG_DNS_CLIENT : IDD_NEW_FOREST;
  79. }
  80. bool
  81. DnsOnNetPage::OnWizBack()
  82. {
  83. LOG_FUNCTION(DnsOnNetPage::OnWizBack);
  84. // make sure we clear the dns on net flag => the only way it gets cleared
  85. // it on the 'next' button.
  86. State::GetInstance().SetDNSOnNetwork(true);
  87. return DCPromoWizardPage::OnWizBack();
  88. }