mirror of
https://github.com/reactos/reactos.git
synced 2025-05-28 05:28:14 +00:00
- Revert the change from REG_SZ to REG_MULTI_SZ because it turns out that Windows does it this same way (research fail?)
svn path=/trunk/; revision=48611
This commit is contained in:
parent
2ddee30677
commit
0ea1a11d0d
2 changed files with 42 additions and 20 deletions
|
@ -507,25 +507,24 @@ void set_name_servers( PDHCP_ADAPTER Adapter, struct client_lease *new_lease ) {
|
||||||
char *nsbuf;
|
char *nsbuf;
|
||||||
int i, addrs =
|
int i, addrs =
|
||||||
new_lease->options[DHO_DOMAIN_NAME_SERVERS].len / sizeof(ULONG);
|
new_lease->options[DHO_DOMAIN_NAME_SERVERS].len / sizeof(ULONG);
|
||||||
int len = 0;
|
|
||||||
|
|
||||||
nsbuf = malloc( addrs * sizeof(IP_ADDRESS_STRING) + 1 );
|
nsbuf = malloc( addrs * sizeof(IP_ADDRESS_STRING) );
|
||||||
|
|
||||||
if( nsbuf) {
|
if( nsbuf) {
|
||||||
memset(nsbuf, 0, addrs * sizeof(IP_ADDRESS_STRING) + 1);
|
nsbuf[0] = 0;
|
||||||
for( i = 0; i < addrs; i++ ) {
|
for( i = 0; i < addrs; i++ ) {
|
||||||
nameserver.len = sizeof(ULONG);
|
nameserver.len = sizeof(ULONG);
|
||||||
memcpy( nameserver.iabuf,
|
memcpy( nameserver.iabuf,
|
||||||
new_lease->options[DHO_DOMAIN_NAME_SERVERS].data +
|
new_lease->options[DHO_DOMAIN_NAME_SERVERS].data +
|
||||||
(i * sizeof(ULONG)), sizeof(ULONG) );
|
(i * sizeof(ULONG)), sizeof(ULONG) );
|
||||||
strcat( nsbuf, piaddr(nameserver) );
|
strcat( nsbuf, piaddr(nameserver) );
|
||||||
len += strlen(nsbuf) + 1;
|
if( i != addrs-1 ) strcat( nsbuf, "," );
|
||||||
}
|
}
|
||||||
|
|
||||||
DH_DbgPrint(MID_TRACE,("Setting DhcpNameserver: %s\n", nsbuf));
|
DH_DbgPrint(MID_TRACE,("Setting DhcpNameserver: %s\n", nsbuf));
|
||||||
|
|
||||||
RegSetValueExA( RegKey, "DhcpNameServer", 0, REG_MULTI_SZ,
|
RegSetValueExA( RegKey, "DhcpNameServer", 0, REG_SZ,
|
||||||
(LPBYTE)nsbuf, len + 1 );
|
(LPBYTE)nsbuf, strlen(nsbuf) + 1 );
|
||||||
free( nsbuf );
|
free( nsbuf );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -122,24 +122,47 @@ static void EnumInterfaces( PVOID Data, EnumInterfacesFunc cb ) {
|
||||||
|
|
||||||
void EnumNameServers( HANDLE RegHandle, PWCHAR Interface,
|
void EnumNameServers( HANDLE RegHandle, PWCHAR Interface,
|
||||||
PVOID Data, EnumNameServersFunc cb ) {
|
PVOID Data, EnumNameServersFunc cb ) {
|
||||||
PWCHAR *NameServerString =
|
PWCHAR NameServerString =
|
||||||
QueryRegistryValueStringMulti(RegHandle, L"DhcpNameServer");
|
QueryRegistryValueString(RegHandle, L"DhcpNameServer");
|
||||||
DWORD i;
|
|
||||||
|
|
||||||
if (!NameServerString)
|
if (!NameServerString)
|
||||||
NameServerString = QueryRegistryValueStringMulti(RegHandle, L"NameServer");
|
NameServerString = QueryRegistryValueString(RegHandle, L"NameServer");
|
||||||
|
|
||||||
if (!NameServerString) return;
|
if (NameServerString) {
|
||||||
|
/* Now, count the non-empty comma separated */
|
||||||
for (i = 0; NameServerString[i]; i++)
|
DWORD ch;
|
||||||
{
|
DWORD LastNameStart = 0;
|
||||||
cb(Interface, NameServerString[i], Data);
|
for (ch = 0; NameServerString[ch]; ch++) {
|
||||||
|
if (NameServerString[ch] == ',') {
|
||||||
HeapFree(GetProcessHeap(), 0, NameServerString[i]);
|
if (ch - LastNameStart > 0) { /* Skip empty entries */
|
||||||
|
PWCHAR NameServer =
|
||||||
|
malloc(((ch - LastNameStart) + 1) * sizeof(WCHAR));
|
||||||
|
if (NameServer) {
|
||||||
|
memcpy(NameServer,NameServerString + LastNameStart,
|
||||||
|
(ch - LastNameStart) * sizeof(WCHAR));
|
||||||
|
NameServer[ch - LastNameStart] = 0;
|
||||||
|
cb( Interface, NameServer, Data );
|
||||||
|
free(NameServer);
|
||||||
|
LastNameStart = ch +1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LastNameStart = ch + 1; /* The first one after the comma */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ch - LastNameStart > 0) { /* A last name? */
|
||||||
|
PWCHAR NameServer = malloc(((ch - LastNameStart) + 1) * sizeof(WCHAR));
|
||||||
|
if (NameServer) {
|
||||||
|
memcpy(NameServer,NameServerString + LastNameStart,
|
||||||
|
(ch - LastNameStart) * sizeof(WCHAR));
|
||||||
|
NameServer[ch - LastNameStart] = 0;
|
||||||
|
cb( Interface, NameServer, Data );
|
||||||
|
free(NameServer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ConsumeRegValueString(NameServerString);
|
||||||
}
|
}
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, NameServerString);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CreateNameServerListEnumNamesFuncCount( PWCHAR Interface,
|
static void CreateNameServerListEnumNamesFuncCount( PWCHAR Interface,
|
||||||
PWCHAR Server,
|
PWCHAR Server,
|
||||||
PVOID _Data ) {
|
PVOID _Data ) {
|
||||||
|
|
Loading…
Reference in a new issue