iphlpapi: Adapter names returned from GetAdaptersAddresses are GUID strings.

Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hans Leidekker 2017-05-11 10:15:26 +02:00 committed by Alexandre Julliard
parent 564170cbd0
commit 98f77c4f7c
2 changed files with 19 additions and 5 deletions

View file

@ -978,7 +978,7 @@ static ULONG adapterAddressesFromIndex(ULONG family, ULONG flags, IF_INDEX index
}
total_size = sizeof(IP_ADAPTER_ADDRESSES);
total_size += IF_NAMESIZE;
total_size += 39; /* "{00000000-0000-0000-0000-000000000000}" */
total_size += IF_NAMESIZE * sizeof(WCHAR);
if (!(flags & GAA_FLAG_SKIP_FRIENDLY_NAME))
total_size += IF_NAMESIZE * sizeof(WCHAR);
@ -1009,10 +1009,11 @@ static ULONG adapterAddressesFromIndex(ULONG family, ULONG flags, IF_INDEX index
aa->u.s.Length = sizeof(IP_ADAPTER_ADDRESSES);
aa->u.s.IfIndex = index;
getInterfaceNameByIndex(index, name);
memcpy(ptr, name, IF_NAMESIZE);
sprintf(ptr, "{%08x-0000-0000-0000-000000000000}", index);
aa->AdapterName = ptr;
ptr += IF_NAMESIZE;
ptr += 39;
getInterfaceNameByIndex(index, name);
if (!(flags & GAA_FLAG_SKIP_FRIENDLY_NAME))
{
aa->FriendlyName = (WCHAR *)ptr;

View file

@ -1414,8 +1414,10 @@ static void test_GetAdaptersAddresses(void)
for (aa = ptr; !ret && aa; aa = aa->Next)
{
char temp[128];
char temp[128], buf[39];
IP_ADAPTER_PREFIX *prefix;
DWORD status;
GUID guid;
ok(S(U(*aa)).Length == sizeof(IP_ADAPTER_ADDRESSES_LH) ||
S(U(*aa)).Length == sizeof(IP_ADAPTER_ADDRESSES_XP),
@ -1524,6 +1526,17 @@ static void test_GetAdaptersAddresses(void)
trace("Dhcpv6Iaid: %u\n", aa->Dhcpv6Iaid);
trace("FirstDnsSuffix: %p\n", aa->FirstDnsSuffix);
trace("\n");
if (pConvertInterfaceLuidToGuid)
{
status = pConvertInterfaceLuidToGuid(&aa->Luid, &guid);
ok(!status, "got %u\n", status);
sprintf(buf, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
guid.Data1, guid.Data2, guid.Data3, guid.Data4[0], guid.Data4[1],
guid.Data4[2], guid.Data4[3], guid.Data4[4], guid.Data4[5],
guid.Data4[6], guid.Data4[7]);
ok(!strcasecmp(aa->AdapterName, buf), "expected '%s' got '%s'\n", aa->AdapterName, buf);
}
}
HeapFree(GetProcessHeap(), 0, ptr);
}