[IPHLPAPI]

Properly return unicast addresses in GetAdaptersAddresses() by properly return a struct sockaddr_in.
This fixes a bunch of failing tests in iphlpapi_apitest, and it should fix any application relying on this API to know interfaces addresses.

svn path=/trunk/; revision=70292
This commit is contained in:
Pierre Schweitzer 2015-12-08 08:03:33 +00:00
parent b2a6aff94f
commit b8b86d432b

View file

@ -588,9 +588,10 @@ GetAdaptersAddresses(
/* Set the address */
//FIXME: ipv4 only (again...)
UnicastAddress->Address.lpSockaddr = (LPSOCKADDR)(UnicastAddress + 1);
UnicastAddress->Address.iSockaddrLength = sizeof(AddrEntries[j].iae_addr);
UnicastAddress->Address.iSockaddrLength = sizeof(SOCKADDR);
UnicastAddress->Address.lpSockaddr->sa_family = AF_INET;
memcpy(UnicastAddress->Address.lpSockaddr->sa_data, &AddrEntries[j].iae_addr, sizeof(AddrEntries[j].iae_addr));
((LPSOCKADDR_IN)UnicastAddress->Address.lpSockaddr)->sin_port = 0;
memcpy(&((LPSOCKADDR_IN)UnicastAddress->Address.lpSockaddr)->sin_addr, &AddrEntries[j].iae_addr, sizeof(AddrEntries[j].iae_addr));
CurrentAA->FirstUnicastAddress = UnicastAddress;
Ptr += Size;