Commit c1bbfe17 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

iphlpapi: Always populate the friendly name.

The GAA_FLAG_SKIP_FRIENDLY_NAME flag is essentially ignored. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48084Signed-off-by: 's avatarHuw Davies <huw@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent e2f05746
......@@ -1221,7 +1221,7 @@ static DWORD adapters_addresses_alloc( ULONG family, ULONG flags, IP_ADAPTER_ADD
if (err) return err;
needed = count * (sizeof(*aa) + ((CHARS_IN_GUID + 1) & ~1) + sizeof(stat->descr.String));
if (!(flags & GAA_FLAG_SKIP_FRIENDLY_NAME)) needed += count * sizeof(rw->alias.String);
needed += count * sizeof(rw->alias.String); /* GAA_FLAG_SKIP_FRIENDLY_NAME is ignored */
aa = heap_alloc_zero( needed );
if (!aa)
......@@ -1243,12 +1243,9 @@ static DWORD adapters_addresses_alloc( ULONG family, ULONG flags, IP_ADAPTER_ADD
if_counted_string_copy( (WCHAR *)str_ptr, ARRAY_SIZE(stat[i].descr.String), &stat[i].descr );
aa[i].Description = (WCHAR *)str_ptr;
str_ptr += sizeof(stat[i].descr.String);
if (!(flags & GAA_FLAG_SKIP_FRIENDLY_NAME))
{
if_counted_string_copy( (WCHAR *)str_ptr, ARRAY_SIZE(rw[i].alias.String), &rw[i].alias );
aa[i].FriendlyName = (WCHAR *)str_ptr;
str_ptr += sizeof(rw[i].alias.String);
}
if_counted_string_copy( (WCHAR *)str_ptr, ARRAY_SIZE(rw[i].alias.String), &rw[i].alias );
aa[i].FriendlyName = (WCHAR *)str_ptr;
str_ptr += sizeof(rw[i].alias.String);
aa[i].PhysicalAddressLength = rw[i].phys_addr.Length;
if (aa[i].PhysicalAddressLength > sizeof(aa[i].PhysicalAddress)) aa[i].PhysicalAddressLength = 0;
memcpy( aa[i].PhysicalAddress, rw[i].phys_addr.Address, aa[i].PhysicalAddressLength );
......
......@@ -1580,6 +1580,12 @@ static void test_GetAdaptersAddresses(void)
ok(ret == ERROR_BUFFER_OVERFLOW, "expected ERROR_BUFFER_OVERFLOW, got %u\n", ret);
if (ret != ERROR_BUFFER_OVERFLOW) return;
/* GAA_FLAG_SKIP_FRIENDLY_NAME is ignored */
osize = 0x7fffffff;
ret = GetAdaptersAddresses(AF_UNSPEC, GAA_FLAG_SKIP_FRIENDLY_NAME, NULL, NULL, &osize);
ok(ret == ERROR_BUFFER_OVERFLOW, "expected ERROR_BUFFER_OVERFLOW, got %u\n", ret);
ok(osize == size, "expected %d, got %d\n", size, osize);
ptr = HeapAlloc(GetProcessHeap(), 0, size);
ret = GetAdaptersAddresses(AF_UNSPEC, 0, NULL, ptr, &size);
ok(!ret, "expected ERROR_SUCCESS got %u\n", ret);
......@@ -1589,7 +1595,7 @@ static void test_GetAdaptersAddresses(void)
size *= 2;
osize = size;
ptr = HeapAlloc(GetProcessHeap(), 0, osize);
ret = GetAdaptersAddresses(AF_UNSPEC, GAA_FLAG_INCLUDE_PREFIX, NULL, ptr, &osize);
ret = GetAdaptersAddresses(AF_UNSPEC, GAA_FLAG_INCLUDE_PREFIX | GAA_FLAG_SKIP_FRIENDLY_NAME, NULL, ptr, &osize);
ok(!ret, "expected ERROR_SUCCESS got %u\n", ret);
ok(osize == size, "expected %d, got %d\n", size, osize);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment