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.

125 lines
2.7 KiB

  1. // Copyright (c) 1997-2001 Microsoft Corporation
  2. //
  3. // File: ExpressDNSPage.cpp
  4. //
  5. // Synopsis: Defines the express DNS page used in the
  6. // Express path for the CYS Wizard
  7. //
  8. // History: 02/08/2001 JeffJon Created
  9. #include "pch.h"
  10. #include "resource.h"
  11. #include "InstallationUnitProvider.h"
  12. #include "ExpressDNSPage.h"
  13. #include "state.h"
  14. static PCWSTR EXPRESSDNS_PAGE_HELP = L"cys.chm::/cys_configuring_first_server.htm";
  15. ExpressDNSPage::ExpressDNSPage()
  16. :
  17. CYSWizardPage(
  18. IDD_EXPRESS_DNS_PAGE,
  19. IDS_EXPRESS_DNS_TITLE,
  20. IDS_EXPRESS_DNS_SUBTITLE,
  21. EXPRESSDNS_PAGE_HELP)
  22. {
  23. LOG_CTOR(ExpressDNSPage);
  24. }
  25. ExpressDNSPage::~ExpressDNSPage()
  26. {
  27. LOG_DTOR(ExpressDNSPage);
  28. }
  29. void
  30. ExpressDNSPage::OnInit()
  31. {
  32. LOG_FUNCTION(ExpressDNSPage::OnInit);
  33. }
  34. bool
  35. ExpressDNSPage::OnSetActive()
  36. {
  37. LOG_FUNCTION(ExpressDNSPage::OnSetActive);
  38. Win::PropSheet_SetWizButtons(
  39. Win::GetParent(hwnd),
  40. PSWIZB_NEXT | PSWIZB_BACK);
  41. // Initialize the static IP address to 192.168.16.2
  42. Win::SendMessage(
  43. Win::GetDlgItem(hwnd, IDC_STATIC_IPADDRESS),
  44. IPM_SETADDRESS,
  45. 0,
  46. MAKEIPADDRESS(192, 168, 16, 2));
  47. // Initialize the subnet mask to 255.255.255.0
  48. Win::SendMessage(
  49. Win::GetDlgItem(hwnd, IDC_MASK_IPADDRESS),
  50. IPM_SETADDRESS,
  51. 0,
  52. MAKEIPADDRESS(255, 255, 255, 0));
  53. return true;
  54. }
  55. int
  56. ExpressDNSPage::Validate()
  57. {
  58. LOG_FUNCTION(ExpressDNSPage::Validate);
  59. int nextPage = -1;
  60. do
  61. {
  62. DWORD ipaddress = 0;
  63. LRESULT ipValidFields = Win::SendMessage(
  64. Win::GetDlgItem(hwnd, IDC_STATIC_IPADDRESS),
  65. IPM_GETADDRESS,
  66. 0,
  67. (LPARAM)&ipaddress);
  68. if (ipValidFields <= 0)
  69. {
  70. String message = String::load(IDS_IPADDRESS_REQUIRED);
  71. popup.Gripe(hwnd, IDC_STATIC_IPADDRESS, message);
  72. nextPage = -1;
  73. break;
  74. }
  75. DWORD mask = 0;
  76. LRESULT maskValidFields = Win::SendMessage(
  77. Win::GetDlgItem(hwnd, IDC_MASK_IPADDRESS),
  78. IPM_GETADDRESS,
  79. 0,
  80. (LPARAM)&mask);
  81. if (maskValidFields <= 0)
  82. {
  83. String message = String::load(IDS_MASK_REQUIRED);
  84. popup.Gripe(hwnd, IDC_MASK_IPADDRESS, message);
  85. nextPage = -1;
  86. break;
  87. }
  88. InstallationUnitProvider::GetInstance().GetDNSInstallationUnit().SetStaticIPAddress(ipaddress);
  89. InstallationUnitProvider::GetInstance().GetDNSInstallationUnit().SetSubnetMask(mask);
  90. nextPage = IDD_EXPRESS_DHCP_PAGE;
  91. } while (false);
  92. return nextPage;
  93. }