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.

202 lines
6.8 KiB

  1. //-----------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997.
  5. //
  6. // File: D L G A D D R . H
  7. //
  8. // Contents: CTcpAddrPage declaration
  9. //
  10. // Notes: CTcpAddrPage is the IP Address page
  11. //
  12. // Author: tongl 5 Nov 1997
  13. //-----------------------------------------------------------------------
  14. #pragma once
  15. #include <ncxbase.h>
  16. #include <ncatlps.h>
  17. #include "ipctrl.h"
  18. #include "dlgbkup.h"
  19. class CTcpAddrPage : public CPropSheetPage
  20. {
  21. public:
  22. // Declare the message map
  23. BEGIN_MSG_MAP(CTcpAddrPage)
  24. // Initialize dialog
  25. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  26. MESSAGE_HANDLER(WM_CONTEXTMENU, OnContextMenu)
  27. MESSAGE_HANDLER(WM_HELP, OnHelp)
  28. // Property page notification message handlers
  29. NOTIFY_CODE_HANDLER(PSN_APPLY, OnApply)
  30. NOTIFY_CODE_HANDLER(PSN_KILLACTIVE, OnKillActive)
  31. NOTIFY_CODE_HANDLER(PSN_SETACTIVE, OnActive)
  32. NOTIFY_CODE_HANDLER(PSN_RESET, OnCancel)
  33. // Control message handlers
  34. // Mesg handler for the DHCP Radio button
  35. COMMAND_ID_HANDLER(IDC_IP_DHCP, OnDhcpButton)
  36. // Mesg handler for the "specify IP address" Radio button
  37. COMMAND_ID_HANDLER(IDC_IP_FIXED, OnFixedButton)
  38. // Mesg handler for the DHCP Radio button
  39. COMMAND_ID_HANDLER(IDC_DNS_DHCP, OnDnsDhcp)
  40. // Mesg handler for the "specify IP address" Radio button
  41. COMMAND_ID_HANDLER(IDC_DNS_FIXED, OnDnsFixed)
  42. // Mesg handler for the "Advanced" push button
  43. COMMAND_ID_HANDLER(IDC_IPADDR_ADVANCED, OnAdvancedButton)
  44. // Notification handlers for the IP address edit boxes
  45. COMMAND_ID_HANDLER(IDC_IPADDR_IP, OnIpAddrIp)
  46. COMMAND_ID_HANDLER(IDC_IPADDR_SUB, OnIpAddrSub)
  47. COMMAND_ID_HANDLER(IDC_IPADDR_GATE, OnIpAddrGateway)
  48. COMMAND_ID_HANDLER(IDC_DNS_PRIMARY, OnDnsPrimary)
  49. COMMAND_ID_HANDLER(IDC_DNS_SECONDARY, OnDnsSecondary)
  50. NOTIFY_CODE_HANDLER(IPN_FIELDCHANGED, OnIpFieldChange)
  51. END_MSG_MAP()
  52. // Constructors/Destructors
  53. CTcpAddrPage(CTcpipcfg * ptcpip, const DWORD * phelpIDs = NULL);
  54. ~CTcpAddrPage();
  55. // Interface
  56. public:
  57. // message map functions
  58. LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& fHandled);
  59. LRESULT OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& fHandled);
  60. LRESULT OnHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& fHandled);
  61. // notify handlers for the property page
  62. LRESULT OnApply(int idCtrl, LPNMHDR pnmh, BOOL& fHandled);
  63. LRESULT OnKillActive(int idCtrl, LPNMHDR pnmh, BOOL& fHandled);
  64. LRESULT OnActive(int idCtrl, LPNMHDR pnmh, BOOL& fHandled);
  65. LRESULT OnCancel(int idCtrl, LPNMHDR pnmh, BOOL& fHandled);
  66. LRESULT OnQueryCancel(int idCtrl, LPNMHDR pnmh, BOOL& fHandled);
  67. // command ID handlers
  68. LRESULT OnDhcpButton(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  69. LRESULT OnFixedButton(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  70. LRESULT OnDnsDhcp(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  71. LRESULT OnDnsFixed(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  72. LRESULT OnAdvancedButton(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  73. // notify code hanlders for the IP edit controls
  74. LRESULT OnIpAddrIp(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  75. LRESULT OnIpAddrSub(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  76. LRESULT OnIpAddrGateway(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  77. LRESULT OnDnsPrimary(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  78. LRESULT OnDnsSecondary(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& fHandled);
  79. LRESULT OnIpFieldChange(int idCtrl, LPNMHDR pnmh, BOOL& fHandled);
  80. friend class CIpSettingsPage;
  81. friend class CTcpDnsPage;
  82. friend class CTcpWinsPage;
  83. friend class CAtmArpcPage;
  84. friend class CTcpOptionsPage;
  85. friend class CTcpRasPage;
  86. // Implementation
  87. private:
  88. // initializes control state and values
  89. void SetInfo();
  90. // update values in m_pAdapterInfo with what's in the controls
  91. void UpdateInfo();
  92. void UpdateAddressList(VSTR * pvstrList,IpControl& ipPrimary,IpControl& ipSecondary);
  93. INT_PTR DoPropertySheet(ADAPTER_INFO * pAdapterDlg, GLOBAL_INFO * pGlbDlg);
  94. HRESULT HrSetupPropPages(ADAPTER_INFO * pAdapterDlg,
  95. GLOBAL_INFO * pGlbDlg,
  96. HPROPSHEETPAGE ** pahpsp, INT * pcPages);
  97. void EnableGroup(BOOL fEnableDhcp);
  98. void EnableStaticDns(BOOL fUseStaticDns);
  99. void SetSubnetMask();
  100. // Inlines
  101. BOOL IsModified() {return m_fModified;}
  102. void SetModifiedTo(BOOL bState) {m_fModified = bState;}
  103. void PageModified() {
  104. if (!m_fSetInitialValue)
  105. {
  106. m_fModified = TRUE;
  107. PropSheet_Changed(GetParent(), m_hWnd);
  108. }
  109. }
  110. BOOL FAlreadyWarned(tstring strIp)
  111. {
  112. BOOL fRet = FALSE;
  113. VSTR_ITER iterIpBegin = m_vstrWarnedDupIpList.begin();
  114. VSTR_ITER iterIpEnd = m_vstrWarnedDupIpList.end();
  115. VSTR_ITER iterIp = iterIpBegin;
  116. for( ; iterIp != iterIpEnd; iterIp++)
  117. {
  118. if (strIp == **iterIp)
  119. {
  120. fRet = TRUE;
  121. break;
  122. }
  123. }
  124. return fRet;
  125. }
  126. void ShowOrHideBackupPage();
  127. BOOL FIsCardNotPresentOrMalFunctioning(GUID * pguidCard);
  128. // data members
  129. CTcpipcfg * m_ptcpip;
  130. ConnectionType m_ConnType;
  131. ADAPTER_INFO * m_pAdapterInfo;
  132. const DWORD* m_adwHelpIDs;
  133. BOOL m_fModified;
  134. BOOL m_fWarnedDisjointGw;
  135. BOOL m_fWarnedMismatchIPandGw;
  136. BOOL m_fPropShtOk;
  137. BOOL m_fPropShtModified;
  138. BOOL m_fLmhostsFileReset;
  139. //IPSec is removed from connection UI
  140. // BOOL m_fIpsecPolicySet;
  141. BOOL m_fSetInitialValue;
  142. BOOL m_fRasNotAdmin;
  143. IpControl m_ipAddress;
  144. IpControl m_ipSubnetMask;
  145. IpControl m_ipDefGateway;
  146. IpControl m_ipDnsPrimary;
  147. IpControl m_ipDnsSecondary;
  148. VSTR m_vstrWarnedDupIpList;
  149. class CIpSettingsPage * m_pIpSettingsPage;
  150. class CTcpDnsPage * m_pTcpDnsPage;
  151. class CTcpWinsPage * m_pTcpWinsPage;
  152. class CAtmArpcPage * m_pAtmArpcPage;
  153. class CTcpOptionsPage * m_pTcpOptionsPage;
  154. class CTcpRasPage * m_pTcpRasPage;
  155. CIpBackUpDlg m_pageBackup;
  156. HPROPSHEETPAGE m_hBackupPage;
  157. };