mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 17:05:46 +00:00
Commit patches from bugboy, fixing bug 2392.
svn path=/trunk/; revision=35669
This commit is contained in:
parent
6c68a50dd4
commit
7e88d259cb
2 changed files with 29 additions and 4 deletions
|
@ -238,6 +238,7 @@ InternTCPIPSettings(HWND Dlg, PTCPIP_PROPERTIES_DATA DlgData) {
|
|||
BOOL SetDnsByDhcp;
|
||||
TCHAR pszRegKey[MAX_PATH];
|
||||
const char *AddressString;
|
||||
char emptyString[]="\0";
|
||||
DWORD Address = 0;
|
||||
LONG rc;
|
||||
HKEY hKey = NULL;
|
||||
|
@ -282,7 +283,7 @@ InternTCPIPSettings(HWND Dlg, PTCPIP_PROPERTIES_DATA DlgData) {
|
|||
goto cleanup;
|
||||
if (DlgData->Dns1 == INADDR_NONE)
|
||||
{
|
||||
rc = RegDeleteValue(hKey, _T("NameServer"));
|
||||
rc = RegSetValueExA(hKey, "NameServer",0, REG_SZ, (const BYTE*)emptyString, strlen(emptyString) + 1);
|
||||
if (rc != ERROR_SUCCESS && rc != ERROR_FILE_NOT_FOUND)
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -445,6 +446,7 @@ LoadDataFromInfo(PTCPIP_PROPERTIES_DATA DlgData, IP_ADAPTER_INFO *Info)
|
|||
char Dns[MAX_PATH];
|
||||
DWORD Size;
|
||||
DWORD Type;
|
||||
DWORD dwError;
|
||||
char *NextDnsServer;
|
||||
|
||||
DlgData->AdapterName = Info->AdapterName;
|
||||
|
@ -469,7 +471,15 @@ LoadDataFromInfo(PTCPIP_PROPERTIES_DATA DlgData, IP_ADAPTER_INFO *Info)
|
|||
swprintf(RegKey,
|
||||
L"SYSTEM\\CurrentControlSet\\Services\\TCPIP\\Parameters\\Interfaces\\%S",
|
||||
Info->AdapterName);
|
||||
if (ERROR_SUCCESS == RegOpenKeyW(HKEY_LOCAL_MACHINE, RegKey, &hKey)) {
|
||||
dwError = RegOpenKeyW(HKEY_LOCAL_MACHINE, RegKey, &hKey);
|
||||
if (dwError != ERROR_SUCCESS)
|
||||
{
|
||||
/* Try and fall back on the NameServer in Parameters */
|
||||
swprintf(RegKey,
|
||||
L"SYSTEM\\CurrentControlSet\\Services\\TCPIP\\Parameters\\");
|
||||
}
|
||||
dwError = RegOpenKeyW(HKEY_LOCAL_MACHINE, RegKey, &hKey);
|
||||
if (ERROR_SUCCESS == dwError) {
|
||||
Size = sizeof(Dns);
|
||||
RegQueryValueExA(hKey, "NameServer", NULL, &Type, (BYTE *)Dns,
|
||||
&Size);
|
||||
|
|
|
@ -88,6 +88,19 @@ DWORD WINAPI AddIPAddress(IPAddr Address, IPMask Netmask, DWORD IfIndex, PULONG
|
|||
return RtlNtStatusToDosError(addIPAddress(Address, Netmask, IfIndex, NteContext, NteInstance));
|
||||
}
|
||||
|
||||
DWORD getInterfaceGatewayByIndex(DWORD index)
|
||||
{
|
||||
DWORD ndx, retVal = 0, numRoutes = getNumRoutes();
|
||||
RouteTable *table = getRouteTable();
|
||||
|
||||
for (ndx = 0; ndx < numRoutes; ndx++)
|
||||
{
|
||||
if ((table->routes[ndx].ifIndex == (index - 1)) && (table->routes[ndx].dest == 0))
|
||||
retVal = table->routes[ndx].gateway;
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, table);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
* AllocateAndGetIfTableFromStack (IPHLPAPI.@)
|
||||
|
@ -640,6 +653,8 @@ DWORD WINAPI GetAdaptersInfo(PIP_ADAPTER_INFO pAdapterInfo, PULONG pOutBufLen)
|
|||
ptr->IpAddressList.IpAddress.String);
|
||||
toIPAddressString(getInterfaceMaskByIndex(table->indexes[ndx]),
|
||||
ptr->IpAddressList.IpMask.String);
|
||||
toIPAddressString(getInterfaceGatewayByIndex(table->indexes[ndx]),
|
||||
ptr->GatewayList.IpAddress.String);
|
||||
getDhcpInfoForAdapter(table->indexes[ndx], &dhcpEnabled,
|
||||
&dhcpServer, &ptr->LeaseObtained,
|
||||
&ptr->LeaseExpires);
|
||||
|
@ -1160,7 +1175,7 @@ DWORD WINAPI GetIpForwardTable(PMIB_IPFORWARDTABLE pIpForwardTable, PULONG pdwSi
|
|||
pIpForwardTable->dwNumEntries = table->numRoutes;
|
||||
for (ndx = 0; ndx < numRoutes; ndx++) {
|
||||
pIpForwardTable->table[ndx].dwForwardIfIndex =
|
||||
table->routes[ndx].ifIndex;
|
||||
table->routes[ndx].ifIndex + 1;
|
||||
pIpForwardTable->table[ndx].dwForwardDest =
|
||||
table->routes[ndx].dest;
|
||||
pIpForwardTable->table[ndx].dwForwardMask =
|
||||
|
@ -1190,7 +1205,7 @@ DWORD WINAPI GetIpForwardTable(PMIB_IPFORWARDTABLE pIpForwardTable, PULONG pdwSi
|
|||
sizeof(MIB_IPFORWARDROW), IpForwardTableSorter);
|
||||
ret = NO_ERROR;
|
||||
}
|
||||
free(table);
|
||||
HeapFree(GetProcessHeap(), 0, table);
|
||||
}
|
||||
else
|
||||
ret = ERROR_OUTOFMEMORY;
|
||||
|
|
Loading…
Reference in a new issue