mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 08:16:34 +00:00
* Store more settings in registry
svn path=/trunk/; revision=36799
This commit is contained in:
parent
b12ad06d48
commit
eed100a55c
1 changed files with 39 additions and 1 deletions
|
@ -489,7 +489,16 @@ void set_name_servers( PDHCP_ADAPTER Adapter, struct client_lease *new_lease ) {
|
|||
}
|
||||
|
||||
void setup_adapter( PDHCP_ADAPTER Adapter, struct client_lease *new_lease ) {
|
||||
CHAR Buffer[200] = "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\";
|
||||
struct iaddr netmask;
|
||||
HKEY hkey;
|
||||
int i;
|
||||
DWORD dwEnableDHCP;
|
||||
|
||||
strcat(Buffer, Adapter->DhclientInfo.name);
|
||||
if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, Buffer, 0, KEY_WRITE, &hkey) != ERROR_SUCCESS)
|
||||
hkey = NULL;
|
||||
|
||||
|
||||
if( Adapter->NteContext )
|
||||
DeleteIPAddress( Adapter->NteContext );
|
||||
|
@ -501,13 +510,27 @@ void setup_adapter( PDHCP_ADAPTER Adapter, struct client_lease *new_lease ) {
|
|||
memcpy( netmask.iabuf,
|
||||
new_lease->options[DHO_SUBNET_MASK].data,
|
||||
new_lease->options[DHO_SUBNET_MASK].len );
|
||||
|
||||
Status = AddIPAddress
|
||||
( *((ULONG*)new_lease->address.iabuf),
|
||||
*((ULONG*)netmask.iabuf),
|
||||
Adapter->IfMib.dwIndex,
|
||||
&Adapter->NteContext,
|
||||
&Adapter->NteInstance );
|
||||
if (hkey) {
|
||||
RegSetValueExA(hkey, "DhcpIPAddress", 0, REG_SZ, (LPBYTE)new_lease->address.iabuf, strlen(new_lease->address.iabuf)+1);
|
||||
Buffer[0] = '\0';
|
||||
for(i = 0; i < new_lease->options[DHO_SUBNET_MASK].len; i++)
|
||||
{
|
||||
sprintf(&Buffer[strlen(Buffer)], "%u", new_lease->options[DHO_SUBNET_MASK].data[i]);
|
||||
if (i + 1 < new_lease->options[DHO_SUBNET_MASK].len)
|
||||
strcat(Buffer, ".");
|
||||
}
|
||||
RegSetValueExA(hkey, "DhcpSubnetMask", 0, REG_SZ, (LPBYTE)Buffer, strlen(Buffer)+1);
|
||||
RegSetValueExA(hkey, "IPAddress", 0, REG_SZ, (LPBYTE)"0.0.0.0", 8);
|
||||
RegSetValueExA(hkey, "SubnetMask", 0, REG_SZ, (LPBYTE)"0.0.0.0", 8);
|
||||
dwEnableDHCP = 1;
|
||||
RegSetValueExA(hkey, "EnableDHCP", 0, REG_DWORD, (LPBYTE)&dwEnableDHCP, sizeof(DWORD));
|
||||
}
|
||||
|
||||
if( !NT_SUCCESS(Status) )
|
||||
warning("AddIPAddress: %lx\n", Status);
|
||||
|
@ -536,7 +559,22 @@ void setup_adapter( PDHCP_ADAPTER Adapter, struct client_lease *new_lease ) {
|
|||
warning("CreateIpForwardEntry: %lx\n", Status);
|
||||
else
|
||||
old_default_route = RouterMib.dwForwardNextHop;
|
||||
|
||||
if (hkey) {
|
||||
Buffer[0] = '\0';
|
||||
for(i = 0; i < new_lease->options[DHO_ROUTERS].len; i++)
|
||||
{
|
||||
sprintf(&Buffer[strlen(Buffer)], "%u", new_lease->options[DHO_ROUTERS].data[i]);
|
||||
if (i + 1 < new_lease->options[DHO_ROUTERS].len)
|
||||
strcat(Buffer, ".");
|
||||
}
|
||||
RegSetValueExA(hkey, "DhcpDefaultGateway", 0, REG_SZ, (LPBYTE)Buffer, strlen(Buffer)+1);
|
||||
RegSetValueExA(hkey, "DefaultGateway", 0, REG_SZ, (LPBYTE)"0.0.0.0", 8);
|
||||
}
|
||||
}
|
||||
|
||||
if (hkey)
|
||||
RegCloseKey(hkey);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue