Index: reactos/dll/win32/iphlpapi/iphlpapi_main.c =================================================================== --- reactos/dll/win32/iphlpapi/iphlpapi_main.c (revision 35622) +++ reactos/dll/win32/iphlpapi/iphlpapi_main.c (working copy) @@ -88,7 +88,24 @@ return RtlNtStatusToDosError(addIPAddress(Address, Netmask, IfIndex, NteContext, NteInstance)); } +DWORD getInterfaceGatewayByIndex(DWORD index) +{ + RouteTable *table = getRouteTable(); + DWORD ndx, retVal = 0, numRoutes = getNumRoutes();; + char StringM[16]; + for (ndx = 0; ndx < numRoutes; ndx++) + { + ERR("table->routes[ndx].ifIndex %d\n",table->routes[ndx].ifIndex); + toIPAddressString(table->routes[ndx].gateway,StringM); + ERR("table->routes[%d].gateway %s\n",ndx,StringM); + if ((table->routes[ndx].ifIndex == (index - 1)) && (table->routes[ndx].dest == 0)) + retVal = table->routes[ndx].gateway; + } + free(table); + return retVal; +} + /****************************************************************** * AllocateAndGetIfTableFromStack (IPHLPAPI.@) * @@ -640,6 +657,8 @@ 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 +1179,7 @@ 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 =