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.

124 lines
2.8 KiB

  1. // Copyright (c) 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. static PCWSTR EXPRESSDNS_PAGE_HELP = L"cys.chm::/typical_setup.htm";
  14. ExpressDNSPage::ExpressDNSPage()
  15. :
  16. CYSWizardPage(
  17. IDD_EXPRESS_DNS_PAGE,
  18. IDS_EXPRESS_DNS_TITLE,
  19. IDS_EXPRESS_DNS_SUBTITLE,
  20. EXPRESSDNS_PAGE_HELP)
  21. {
  22. LOG_CTOR(ExpressDNSPage);
  23. }
  24. ExpressDNSPage::~ExpressDNSPage()
  25. {
  26. LOG_DTOR(ExpressDNSPage);
  27. }
  28. void
  29. ExpressDNSPage::OnInit()
  30. {
  31. LOG_FUNCTION(ExpressDNSPage::OnInit);
  32. CYSWizardPage::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. }