Commit b45b4048 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

iphlpapi: Add support for the EnableRouting member.

parent 13130774
...@@ -2395,64 +2395,60 @@ err: ...@@ -2395,64 +2395,60 @@ err:
* Get the network parameters for the local computer. * Get the network parameters for the local computer.
* *
* PARAMS * PARAMS
* pFixedInfo [Out] buffer for network parameters * info [Out] buffer for network parameters
* pOutBufLen [In/Out] length of output buffer * size [In/Out] length of output buffer
* *
* RETURNS * RETURNS
* Success: NO_ERROR * Success: NO_ERROR
* Failure: error code from winerror.h * Failure: error code from winerror.h
* *
* NOTES * NOTES
* If pOutBufLen is less than required, the function will return * If size is less than required, the function will return
* ERROR_INSUFFICIENT_BUFFER, and pOutBufLen will be set to the required byte * ERROR_INSUFFICIENT_BUFFER, and size will be set to the required byte
* size. * size.
*/ */
DWORD WINAPI GetNetworkParams(PFIXED_INFO pFixedInfo, PULONG pOutBufLen) DWORD WINAPI GetNetworkParams( FIXED_INFO *info, ULONG *size )
{ {
DWORD ret, size, serverListSize; DWORD needed = sizeof(*info), dns_size, err;
LONG regReturn; MIB_IPSTATS ip_stats;
HKEY hKey; HKEY key;
TRACE("pFixedInfo %p, pOutBufLen %p\n", pFixedInfo, pOutBufLen); TRACE( "info %p, size %p\n", info, size );
if (!pOutBufLen) if (!size) return ERROR_INVALID_PARAMETER;
return ERROR_INVALID_PARAMETER;
get_dns_server_list( NULL, NULL, NULL, &serverListSize ); if (get_dns_server_list( NULL, NULL, NULL, &dns_size ) == ERROR_BUFFER_OVERFLOW)
size = sizeof(FIXED_INFO) + serverListSize - sizeof(IP_ADDR_STRING); needed += dns_size - sizeof(IP_ADDR_STRING);
if (!pFixedInfo || *pOutBufLen < size) { if (!info || *size < needed)
*pOutBufLen = size; {
*size = needed;
return ERROR_BUFFER_OVERFLOW; return ERROR_BUFFER_OVERFLOW;
} }
memset(pFixedInfo, 0, size); *size = needed;
size = sizeof(pFixedInfo->HostName); memset( info, 0, needed );
GetComputerNameExA(ComputerNameDnsHostname, pFixedInfo->HostName, &size); needed = sizeof(info->HostName);
size = sizeof(pFixedInfo->DomainName); GetComputerNameExA( ComputerNameDnsHostname, info->HostName, &needed );
GetComputerNameExA(ComputerNameDnsDomain, pFixedInfo->DomainName, &size); needed = sizeof(info->DomainName);
get_dns_server_list( NULL, &pFixedInfo->DnsServerList, (IP_ADDR_STRING *)(pFixedInfo + 1), GetComputerNameExA( ComputerNameDnsDomain, info->DomainName, &needed );
&serverListSize ); get_dns_server_list( NULL, &info->DnsServerList, (IP_ADDR_STRING *)(info + 1), &dns_size );
/* Assume the first DNS server in the list is the "current" DNS server: */ info->CurrentDnsServer = &info->DnsServerList;
pFixedInfo->CurrentDnsServer = &pFixedInfo->DnsServerList; info->NodeType = HYBRID_NODETYPE;
pFixedInfo->NodeType = HYBRID_NODETYPE; err = RegOpenKeyExA( HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\VxD\\MSTCP",
regReturn = RegOpenKeyExA(HKEY_LOCAL_MACHINE, 0, KEY_READ, &key );
"SYSTEM\\CurrentControlSet\\Services\\VxD\\MSTCP", 0, KEY_READ, &hKey); if (err)
if (regReturn != ERROR_SUCCESS) err = RegOpenKeyExA( HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\NetBT\\Parameters",
regReturn = RegOpenKeyExA(HKEY_LOCAL_MACHINE, 0, KEY_READ, &key );
"SYSTEM\\CurrentControlSet\\Services\\NetBT\\Parameters", 0, KEY_READ, if (!err)
&hKey); {
if (regReturn == ERROR_SUCCESS) needed = sizeof(info->ScopeId);
{ RegQueryValueExA( key, "ScopeID", NULL, NULL, (BYTE *)info->ScopeId, &needed );
DWORD size = sizeof(pFixedInfo->ScopeId); RegCloseKey( key );
}
RegQueryValueExA(hKey, "ScopeID", NULL, NULL, (LPBYTE)pFixedInfo->ScopeId, &size);
RegCloseKey(hKey); if (!GetIpStatistics( &ip_stats ))
} info->EnableRouting = (ip_stats.u.Forwarding == MIB_IP_FORWARDING);
/* FIXME: can check whether routing's enabled in /proc/sys/net/ipv4/ip_forward return ERROR_SUCCESS;
I suppose could also check for a listener on port 53 to set EnableDns */
ret = NO_ERROR;
TRACE("returning %d\n", ret);
return ret;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment