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.

125 lines
2.2 KiB

  1. // Copyright (C) 1997 Microsoft Corporation
  2. //
  3. // auto config dns page
  4. //
  5. // 3-17-98 sburns
  6. #include "headers.hxx"
  7. #include "page.hpp"
  8. #include "AutoConfigureDnsPage.hpp"
  9. #include "resource.h"
  10. #include "state.hpp"
  11. AutoConfigureDnsPage::AutoConfigureDnsPage()
  12. :
  13. DCPromoWizardPage(
  14. IDD_AUTO_CONFIG_DNS,
  15. IDS_AUTO_CONFIG_DNS_PAGE_TITLE,
  16. IDS_AUTO_CONFIG_DNS_PAGE_SUBTITLE)
  17. {
  18. LOG_CTOR(AutoConfigureDnsPage);
  19. }
  20. AutoConfigureDnsPage::~AutoConfigureDnsPage()
  21. {
  22. LOG_CTOR(AutoConfigureDnsPage);
  23. }
  24. void
  25. AutoConfigureDnsPage::OnInit()
  26. {
  27. LOG_FUNCTION(AutoConfigureDnsPage::OnInit);
  28. State& state = State::GetInstance();
  29. int button = IDC_AUTO_CONFIG;
  30. if (state.UsingAnswerFile())
  31. {
  32. String option =
  33. state.GetAnswerFileOption(State::OPTION_AUTO_CONFIG_DNS);
  34. if (option.icompare(State::VALUE_YES) == 0)
  35. {
  36. button = IDC_AUTO_CONFIG;
  37. }
  38. else
  39. {
  40. button = IDC_DONT_AUTO_CONFIG;
  41. }
  42. }
  43. Win::CheckDlgButton(hwnd, button, BST_CHECKED);
  44. }
  45. bool
  46. AutoConfigureDnsPage::OnSetActive()
  47. {
  48. LOG_FUNCTION(AutoConfigureDnsPage::OnSetActive);
  49. Win::PropSheet_SetWizButtons(
  50. Win::GetParent(hwnd),
  51. PSWIZB_BACK | PSWIZB_NEXT);
  52. State& state = State::GetInstance();
  53. if (state.RunHiddenUnattended())
  54. {
  55. int nextPage = AutoConfigureDnsPage::Validate();
  56. if (nextPage != -1)
  57. {
  58. GetWizard().SetNextPageID(hwnd, nextPage);
  59. }
  60. else
  61. {
  62. state.ClearHiddenWhileUnattended();
  63. }
  64. }
  65. return true;
  66. }
  67. int
  68. AutoConfigureDnsPage::Validate()
  69. {
  70. LOG_FUNCTION(AutoConfigureDnsPage::Validate);
  71. bool autoConfig = Win::IsDlgButtonChecked(hwnd, IDC_AUTO_CONFIG);
  72. State& state = State::GetInstance();
  73. state.SetAutoConfigureDNS(autoConfig);
  74. return IDD_RAS_FIXUP;
  75. }
  76. bool
  77. AutoConfigureDnsPage::OnWizBack()
  78. {
  79. LOG_FUNCTION(AutoConfigureDnsPage::OnWizBack);
  80. // make sure we reset the auto-config flag => the only way it gets set
  81. // it on the 'next' button.
  82. State::GetInstance().SetAutoConfigureDNS(false);
  83. return DCPromoWizardPage::OnWizBack();
  84. }