diff --git a/Net/src/NetworkInterface.cpp b/Net/src/NetworkInterface.cpp index 7972e3069..1dbee3a6e 100644 --- a/Net/src/NetworkInterface.cpp +++ b/Net/src/NetworkInterface.cpp @@ -1097,12 +1097,22 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly) ifIndex = pAddress->Ipv6IfIndex; #elif (_WIN32_WINNT >= 0x0501) && (NTDDI_VERSION >= 0x05010100) // Win XP SP1 #if defined (IP_ADAPTER_IPV6_ENABLED) // Vista - if ((pAddress->Flags & IP_ADAPTER_IPV6_ENABLED) && - (osvi.dwMajorVersion >= 5) && - (osvi.dwMinorVersion >= 1) && - (osvi.dwBuildNumber >=1)) + if(osvi.dwMajorVersion>=6)//vista { - ifIndex = pAddress->Ipv6IfIndex; + if ((pAddress->Flags & IP_ADAPTER_IPV6_ENABLED) && + (osvi.dwMajorVersion >= 5) && + (osvi.dwMinorVersion >= 1) && + (osvi.dwBuildNumber >=1)) + { + ifIndex = pAddress->Ipv6IfIndex; + } + } + else if ((osvi.dwMajorVersion >= 5) && + (osvi.dwMinorVersion >= 1) && + (osvi.dwBuildNumber >= 1)) + { + ifIndex = pAddress->Ipv6IfIndex; + } } #else // !defined(IP_ADAPTER_IPV6_ENABLED) if ((osvi.dwMajorVersion >= 5) && @@ -1116,7 +1126,14 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly) #endif // POCO_HAVE_IPv6 #if defined (IP_ADAPTER_IPV4_ENABLED) - if (pAddress->Flags & IP_ADAPTER_IPV4_ENABLED) + if(osvi.dwMajorVersion>=6) + {//vista + if (pAddress->Flags & IP_ADAPTER_IPV4_ENABLED) + { + ifIndex = pAddress->IfIndex; + } + } + else { ifIndex = pAddress->IfIndex; } @@ -1205,8 +1222,15 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly) #elif (_WIN32_WINNT >= 0x0501) && (NTDDI_VERSION >= 0x05010100) // Win XP SP1 ULONG prefixLength = 0; #if (_WIN32_WINNT >= 0x0600) // Vista and newer - prefixLength = pUniAddr->OnLinkPrefixLength; - broadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, address); + if (osvi.dwMajorVersion >= 6) + { + prefixLength = pUniAddr->OnLinkPrefixLength; + broadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, address); + } + else + { + broadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, address, &prefixLength); + } #else broadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, address, &prefixLength); #endif