mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 17:45:41 +00:00
fix loading of current values for ip and dhcp
svn path=/trunk/; revision=23441
This commit is contained in:
parent
2175834be0
commit
6777e6905f
1 changed files with 33 additions and 23 deletions
|
@ -61,25 +61,35 @@ DWORD APIENTRY DhcpNotifyConfigChange(LPWSTR ServerName, LPWSTR AdapterName,
|
|||
|
||||
|
||||
static void
|
||||
ManualDNS(HWND Dlg, BOOL Enabled) {
|
||||
ManualDNS(HWND Dlg, BOOL Enabled, UINT uCmd) {
|
||||
PTCPIP_PROPERTIES_DATA DlgData =
|
||||
(PTCPIP_PROPERTIES_DATA) GetWindowLongPtrW(Dlg, GWL_USERDATA);
|
||||
|
||||
if (! DlgData->OldDhcpEnabled)
|
||||
{
|
||||
if (INADDR_NONE != DlgData->OldIpAddress) {
|
||||
SendDlgItemMessage(Dlg, IDC_IPADDR, IPM_SETADDRESS, 0,
|
||||
ntohl(DlgData->OldIpAddress));
|
||||
}
|
||||
if (INADDR_NONE != DlgData->OldSubnetMask) {
|
||||
SendDlgItemMessage(Dlg, IDC_SUBNETMASK, IPM_SETADDRESS, 0,
|
||||
ntohl(DlgData->OldSubnetMask));
|
||||
}
|
||||
if (INADDR_NONE != DlgData->OldGateway) {
|
||||
SendDlgItemMessage(Dlg, IDC_DEFGATEWAY, IPM_SETADDRESS, 0,
|
||||
ntohl(DlgData->OldGateway));
|
||||
}
|
||||
if (! DlgData->OldDhcpEnabled &&
|
||||
(uCmd == IDC_USEDHCP || uCmd == IDC_NODHCP)) {
|
||||
if (INADDR_NONE != DlgData->OldIpAddress) {
|
||||
SendDlgItemMessage(Dlg, IDC_IPADDR, IPM_SETADDRESS, 0,
|
||||
ntohl(DlgData->OldIpAddress));
|
||||
}
|
||||
if (INADDR_NONE != DlgData->OldSubnetMask) {
|
||||
SendDlgItemMessage(Dlg, IDC_SUBNETMASK, IPM_SETADDRESS, 0,
|
||||
ntohl(DlgData->OldSubnetMask));
|
||||
}
|
||||
if (INADDR_NONE != DlgData->OldGateway) {
|
||||
SendDlgItemMessage(Dlg, IDC_DEFGATEWAY, IPM_SETADDRESS, 0,
|
||||
ntohl(DlgData->OldGateway));
|
||||
}
|
||||
}
|
||||
|
||||
if (INADDR_NONE != DlgData->OldDns1 &&
|
||||
(uCmd == IDC_FIXEDDNS || uCmd == IDC_AUTODNS || IDC_NODHCP)) {
|
||||
SendDlgItemMessage(Dlg, IDC_DNS1, IPM_SETADDRESS, 0,
|
||||
ntohl(DlgData->OldDns1));
|
||||
if (INADDR_NONE != DlgData->OldDns2) {
|
||||
SendDlgItemMessage(Dlg, IDC_DNS2, IPM_SETADDRESS, 0,
|
||||
ntohl(DlgData->OldDns2));
|
||||
}
|
||||
}
|
||||
|
||||
CheckDlgButton(Dlg, IDC_FIXEDDNS,
|
||||
Enabled ? BST_CHECKED : BST_UNCHECKED);
|
||||
|
@ -95,7 +105,7 @@ ManualDNS(HWND Dlg, BOOL Enabled) {
|
|||
}
|
||||
|
||||
static void
|
||||
EnableDHCP(HWND Dlg, BOOL Enabled) {
|
||||
EnableDHCP(HWND Dlg, BOOL Enabled, UINT uCmd) {
|
||||
CheckDlgButton(Dlg, IDC_USEDHCP, Enabled ? BST_CHECKED : BST_UNCHECKED);
|
||||
CheckDlgButton(Dlg, IDC_NODHCP, Enabled ? BST_UNCHECKED : BST_CHECKED);
|
||||
EnableWindow(GetDlgItem(Dlg, IDC_IPADDR), ! Enabled);
|
||||
|
@ -107,7 +117,7 @@ EnableDHCP(HWND Dlg, BOOL Enabled) {
|
|||
SendDlgItemMessage(Dlg, IDC_SUBNETMASK, IPM_CLEARADDRESS, 0, 0);
|
||||
SendDlgItemMessage(Dlg, IDC_DEFGATEWAY, IPM_CLEARADDRESS, 0, 0);
|
||||
} else {
|
||||
ManualDNS(Dlg, TRUE);
|
||||
ManualDNS(Dlg, TRUE, uCmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -354,7 +364,7 @@ TCPIPPropertyPageProc(HWND Dlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
|
||||
EnableWindow(GetDlgItem(Dlg, IDC_ADVANCED), FALSE);
|
||||
|
||||
EnableDHCP(Dlg, DlgData->OldDhcpEnabled);
|
||||
EnableDHCP(Dlg, DlgData->OldDhcpEnabled, 0);
|
||||
|
||||
if (! DlgData->OldDhcpEnabled)
|
||||
{
|
||||
|
@ -380,25 +390,25 @@ TCPIPPropertyPageProc(HWND Dlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
ntohl(DlgData->OldDns2));
|
||||
}
|
||||
}
|
||||
ManualDNS(Dlg, INADDR_NONE != DlgData->OldDns1);
|
||||
ManualDNS(Dlg, INADDR_NONE != DlgData->OldDns1, 0);
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch(LOWORD(wParam)) {
|
||||
case IDC_FIXEDDNS:
|
||||
ManualDNS(Dlg, TRUE);
|
||||
ManualDNS(Dlg, TRUE, LOWORD(wParam));
|
||||
return TRUE;
|
||||
|
||||
case IDC_AUTODNS:
|
||||
ManualDNS(Dlg, FALSE);
|
||||
ManualDNS(Dlg, FALSE, LOWORD(wParam));
|
||||
return TRUE;
|
||||
|
||||
case IDC_USEDHCP:
|
||||
EnableDHCP(Dlg, TRUE);
|
||||
EnableDHCP(Dlg, TRUE, LOWORD(wParam));
|
||||
return TRUE;
|
||||
|
||||
case IDC_NODHCP:
|
||||
EnableDHCP(Dlg, FALSE);
|
||||
EnableDHCP(Dlg, FALSE, LOWORD(wParam));
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue