Author: janderwald
Date: Fri Oct 17 14:04:00 2008
New Revision: 36797
URL:
http://svn.reactos.org/svn/reactos?rev=36797&view=rev
Log:
* Fix retrieval of automatic DNS settings 2/2
Modified:
trunk/reactos/base/services/dhcp/adapter.c
trunk/reactos/base/services/dhcp/dhclient.c
Modified: trunk/reactos/base/services/dhcp/adapter.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/dhcp/adapter…
==============================================================================
--- trunk/reactos/base/services/dhcp/adapter.c [iso-8859-1] (original)
+++ trunk/reactos/base/services/dhcp/adapter.c [iso-8859-1] Fri Oct 17 14:04:00 2008
@@ -103,8 +103,7 @@
"SYSTEM\\CurrentControlSet\\Control\\Class\\"
"{4D36E972-E325-11CE-BFC1-08002BE10318}";
PCHAR TargetKeyNameStart =
- "SYSTEM\\CurrentControlSet\\Services\\";
- PCHAR TargetKeyNameEnd = "\\Parameters\\Tcpip";
+
"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\";
PCHAR TargetKeyName = NULL;
PCHAR *EnumKeysLinkage = GetSubkeyNames( EnumKeyName, "\\Linkage" );
PCHAR *EnumKeysTop = GetSubkeyNames( EnumKeyName, "" );
@@ -126,12 +125,11 @@
!strcmp( RootDevice, Adapter->DhclientInfo.name ) ) {
TargetKeyName =
(CHAR*) malloc( strlen( TargetKeyNameStart ) +
- strlen( RootDevice ) +
- strlen( TargetKeyNameEnd ) + 1 );
+ strlen( RootDevice ) + 1);
if( !TargetKeyName ) goto cleanup;
- sprintf( TargetKeyName, "%s%s%s",
- TargetKeyNameStart, RootDevice, TargetKeyNameEnd );
- Error = RegOpenKey( HKEY_LOCAL_MACHINE, TargetKeyName, &OutKey );
+ sprintf( TargetKeyName, "%s%s",
+ TargetKeyNameStart, RootDevice );
+ Error = RegCreateKeyExA( HKEY_LOCAL_MACHINE, TargetKeyName, 0, NULL, 0,
KEY_READ, NULL, &OutKey, NULL );
break;
} else {
free( RootDevice ); RootDevice = 0;
Modified: trunk/reactos/base/services/dhcp/dhclient.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/dhcp/dhclien…
==============================================================================
--- trunk/reactos/base/services/dhcp/dhclient.c [iso-8859-1] (original)
+++ trunk/reactos/base/services/dhcp/dhclient.c [iso-8859-1] Fri Oct 17 14:04:00 2008
@@ -450,8 +450,9 @@
bind_lease(ip);
}
-void set_name_servers( struct client_lease *new_lease ) {
+void set_name_servers( PDHCP_ADAPTER Adapter, struct client_lease *new_lease ) {
if( new_lease->options[DHO_DOMAIN_NAME_SERVERS].len ) {
+ CHAR Buffer[200] =
"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\";
HKEY RegKey;
struct iaddr nameserver;
char *nsbuf;
@@ -462,10 +463,11 @@
addrs = 1;
nsbuf = malloc( addrs * sizeof(IP_ADDRESS_STRING) );
nsbuf[0] = 0;
+ strcat(Buffer, Adapter->DhclientInfo.name);
if( nsbuf && !RegOpenKeyEx
( HKEY_LOCAL_MACHINE,
- "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters",
+ Buffer,
0, KEY_WRITE, &RegKey ) ) {
for( i = 0; i < addrs; i++ ) {
nameserver.len = sizeof(ULONG);
@@ -567,7 +569,7 @@
if( Adapter ) setup_adapter( Adapter, new_lease );
else warning("Could not find adapter for info %p\n", ip);
- set_name_servers( new_lease );
+ set_name_servers( Adapter, new_lease );
reinitialize_interfaces();
}