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.

96 lines
2.2 KiB

  1. // Copyright (c) 2001 Microsoft Corporation
  2. //
  3. // File: ExpressDHCPPage.cpp
  4. //
  5. // Synopsis: Defines the express DHCP 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 "ExpressDHCPPage.h"
  13. static PCWSTR EXPRESSDHCP_PAGE_HELP = L"cys.chm::/typical_setup.htm";
  14. ExpressDHCPPage::ExpressDHCPPage()
  15. :
  16. CYSWizardPage(
  17. IDD_EXPRESS_DHCP_PAGE,
  18. IDS_EXPRESS_DHCP_TITLE,
  19. IDS_EXPRESS_DHCP_SUBTITLE,
  20. EXPRESSDHCP_PAGE_HELP)
  21. {
  22. LOG_CTOR(ExpressDHCPPage);
  23. }
  24. ExpressDHCPPage::~ExpressDHCPPage()
  25. {
  26. LOG_DTOR(ExpressDHCPPage);
  27. }
  28. void
  29. ExpressDHCPPage::OnInit()
  30. {
  31. LOG_FUNCTION(ExpressDHCPPage::OnInit);
  32. CYSWizardPage::OnInit();
  33. }
  34. bool
  35. ExpressDHCPPage::OnSetActive()
  36. {
  37. LOG_FUNCTION(ExpressDHCPPage::OnSetActive);
  38. Win::PropSheet_SetWizButtons(
  39. Win::GetParent(hwnd),
  40. PSWIZB_NEXT | PSWIZB_BACK);
  41. return true;
  42. }
  43. int
  44. ExpressDHCPPage::Validate()
  45. {
  46. LOG_FUNCTION(ExpressDHCPPage::Validate);
  47. int nextPage = -1;
  48. DWORD startAddress = 0;
  49. LRESULT startResult = Win::SendMessage(
  50. Win::GetDlgItem(hwnd, IDC_START_IPADDRESS),
  51. IPM_GETADDRESS,
  52. 0,
  53. (LPARAM)&startAddress);
  54. DWORD endAddress = 0;
  55. LRESULT endResult = Win::SendMessage(
  56. Win::GetDlgItem(hwnd, IDC_END_IPADDRESS),
  57. IPM_GETADDRESS,
  58. 0,
  59. (LPARAM)&endAddress);
  60. if (!startResult || !endResult)
  61. {
  62. String message = String::load(IDS_BOTH_IPADDRESS_REQUIRED);
  63. popup.Gripe(hwnd, IDC_START_IPADDRESS, message);
  64. nextPage = -1;
  65. }
  66. else
  67. {
  68. InstallationUnitProvider::GetInstance().GetDHCPInstallationUnit().SetStartIPAddress(startAddress);
  69. InstallationUnitProvider::GetInstance().GetDHCPInstallationUnit().SetEndIPAddress(endAddress);
  70. nextPage = IDD_MILESTONE_PAGE;
  71. }
  72. return nextPage;
  73. }