From 434cd6c609d72cb92578077343ffbce9b9f92d31 Mon Sep 17 00:00:00 2001 From: Juan Lang Date: Mon, 11 Oct 2010 08:50:00 -0700 Subject: [PATCH] iphlpapi: Honor GAA_FLAG_SKIP_FRIENDLY_NAME. --- dlls/iphlpapi/iphlpapi_main.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c index 190c0ca36c7..52d1c581603 100644 --- a/dlls/iphlpapi/iphlpapi_main.c +++ b/dlls/iphlpapi/iphlpapi_main.c @@ -770,7 +770,9 @@ static ULONG adapterAddressesFromIndex(ULONG family, ULONG flags, DWORD index, total_size = sizeof(IP_ADAPTER_ADDRESSES); total_size += IF_NAMESIZE; - total_size += 2 * IF_NAMESIZE * sizeof(WCHAR); + total_size += IF_NAMESIZE * sizeof(WCHAR); + if (!(flags & GAA_FLAG_SKIP_FRIENDLY_NAME)) + total_size += IF_NAMESIZE * sizeof(WCHAR); total_size += sizeof(IP_ADAPTER_UNICAST_ADDRESS) * num_v4addrs; total_size += sizeof(struct sockaddr_in) * num_v4addrs; total_size += (sizeof(IP_ADAPTER_GATEWAY_ADDRESS) + sizeof(SOCKADDR_IN)) * num_v4_gateways; @@ -793,11 +795,14 @@ static ULONG adapterAddressesFromIndex(ULONG family, ULONG flags, DWORD index, memcpy(ptr, name, IF_NAMESIZE); aa->AdapterName = ptr; ptr += IF_NAMESIZE; - aa->FriendlyName = (WCHAR *)ptr; - for (src = name, dst = (WCHAR *)ptr; *src; src++, dst++) - *dst = *src; - *dst++ = 0; - ptr = (char *)dst; + if (!(flags & GAA_FLAG_SKIP_FRIENDLY_NAME)) + { + aa->FriendlyName = (WCHAR *)ptr; + for (src = name, dst = (WCHAR *)ptr; *src; src++, dst++) + *dst = *src; + *dst++ = 0; + ptr = (char *)dst; + } aa->Description = (WCHAR *)ptr; for (src = name, dst = (WCHAR *)ptr; *src; src++, dst++) *dst = *src;