iphlpapi: Return gateway address 0.0.0.0/255.255.255.255 from GetAdaptersInfo if it's not set.

Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hans Leidekker 2020-07-02 10:23:27 +02:00 committed by Alexandre Julliard
parent 1e8cfc016e
commit 3e0369970d
2 changed files with 8 additions and 3 deletions

View File

@ -742,6 +742,8 @@ DWORD WINAPI GetAdaptersInfo(PIP_ADAPTER_INFO pAdapterInfo, PULONG pOutBufLen)
}
/* Find first router through this interface, which we'll assume
* is the default gateway for this adapter */
strcpy(ptr->GatewayList.IpAddress.String, "0.0.0.0");
strcpy(ptr->GatewayList.IpMask.String, "255.255.255.255");
for (i = 0; i < routeTable->dwNumEntries; i++)
if (routeTable->table[i].dwForwardIfIndex == ptr->Index
&& routeTable->table[i].u1.ForwardType ==

View File

@ -1120,10 +1120,13 @@ static void testGetAdaptersInfo(void)
apiReturn);
ptr = buf;
while (ptr) {
ok(ptr->IpAddressList.IpAddress.String[0], "A valid IP must be present\n");
ok(ptr->IpAddressList.IpAddress.String[0], "A valid IP address must be present\n");
ok(ptr->IpAddressList.IpMask.String[0], "A valid mask must be present\n");
trace("Adapter '%s', IP %s, Mask %s\n", ptr->AdapterName,
ptr->IpAddressList.IpAddress.String, ptr->IpAddressList.IpMask.String);
ok(ptr->GatewayList.IpAddress.String[0], "A valid IP address must be present\n");
ok(ptr->GatewayList.IpMask.String[0], "A valid mask must be present\n");
trace("adapter '%s', address %s/%s gateway %s/%s\n", ptr->AdapterName,
ptr->IpAddressList.IpAddress.String, ptr->IpAddressList.IpMask.String,
ptr->GatewayList.IpAddress.String, ptr->GatewayList.IpMask.String);
ptr = ptr->Next;
}
HeapFree(GetProcessHeap(), 0, buf);