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=48084 Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
e2f05746f1
commit
c1bbfe17a5
|
@ -1221,7 +1221,7 @@ static DWORD adapters_addresses_alloc( ULONG family, ULONG flags, IP_ADAPTER_ADD
|
||||||
if (err) return err;
|
if (err) return err;
|
||||||
|
|
||||||
needed = count * (sizeof(*aa) + ((CHARS_IN_GUID + 1) & ~1) + sizeof(stat->descr.String));
|
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 );
|
aa = heap_alloc_zero( needed );
|
||||||
if (!aa)
|
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 );
|
if_counted_string_copy( (WCHAR *)str_ptr, ARRAY_SIZE(stat[i].descr.String), &stat[i].descr );
|
||||||
aa[i].Description = (WCHAR *)str_ptr;
|
aa[i].Description = (WCHAR *)str_ptr;
|
||||||
str_ptr += sizeof(stat[i].descr.String);
|
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;
|
||||||
if_counted_string_copy( (WCHAR *)str_ptr, ARRAY_SIZE(rw[i].alias.String), &rw[i].alias );
|
str_ptr += sizeof(rw[i].alias.String);
|
||||||
aa[i].FriendlyName = (WCHAR *)str_ptr;
|
|
||||||
str_ptr += sizeof(rw[i].alias.String);
|
|
||||||
}
|
|
||||||
aa[i].PhysicalAddressLength = rw[i].phys_addr.Length;
|
aa[i].PhysicalAddressLength = rw[i].phys_addr.Length;
|
||||||
if (aa[i].PhysicalAddressLength > sizeof(aa[i].PhysicalAddress)) aa[i].PhysicalAddressLength = 0;
|
if (aa[i].PhysicalAddressLength > sizeof(aa[i].PhysicalAddress)) aa[i].PhysicalAddressLength = 0;
|
||||||
memcpy( aa[i].PhysicalAddress, rw[i].phys_addr.Address, aa[i].PhysicalAddressLength );
|
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);
|
ok(ret == ERROR_BUFFER_OVERFLOW, "expected ERROR_BUFFER_OVERFLOW, got %u\n", ret);
|
||||||
if (ret != ERROR_BUFFER_OVERFLOW) return;
|
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);
|
ptr = HeapAlloc(GetProcessHeap(), 0, size);
|
||||||
ret = GetAdaptersAddresses(AF_UNSPEC, 0, NULL, ptr, &size);
|
ret = GetAdaptersAddresses(AF_UNSPEC, 0, NULL, ptr, &size);
|
||||||
ok(!ret, "expected ERROR_SUCCESS got %u\n", ret);
|
ok(!ret, "expected ERROR_SUCCESS got %u\n", ret);
|
||||||
|
@ -1589,7 +1595,7 @@ static void test_GetAdaptersAddresses(void)
|
||||||
size *= 2;
|
size *= 2;
|
||||||
osize = size;
|
osize = size;
|
||||||
ptr = HeapAlloc(GetProcessHeap(), 0, osize);
|
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(!ret, "expected ERROR_SUCCESS got %u\n", ret);
|
||||||
ok(osize == size, "expected %d, got %d\n", size, osize);
|
ok(osize == size, "expected %d, got %d\n", size, osize);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue