Author: gedmurphy
Date: Fri Aug 4 02:20:44 2006
New Revision: 23441
URL:
http://svn.reactos.org/svn/reactos?rev=23441&view=rev
Log:
fix loading of current values for ip and dhcp
Modified:
trunk/reactos/dll/cpl/ncpa/tcpip_properties.c
Modified: trunk/reactos/dll/cpl/ncpa/tcpip_properties.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/ncpa/tcpip_propert…
==============================================================================
--- trunk/reactos/dll/cpl/ncpa/tcpip_properties.c (original)
+++ trunk/reactos/dll/cpl/ncpa/tcpip_properties.c Fri Aug 4 02:20:44 2006
@@ -61,25 +61,35 @@
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 @@
}
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 @@
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 @@
EnableWindow(GetDlgItem(Dlg, IDC_ADVANCED), FALSE);
- EnableDHCP(Dlg, DlgData->OldDhcpEnabled);
+ EnableDHCP(Dlg, DlgData->OldDhcpEnabled, 0);
if (! DlgData->OldDhcpEnabled)
{
@@ -380,25 +390,25 @@
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;