Skip to content

Commit a07df2c

Browse files
committed
make NetworkInterface compile on WEC2013 again
1 parent d3c8ec0 commit a07df2c

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

Net/src/NetworkInterface.cpp

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,7 +1065,9 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
10651065
unsigned ifIndex = 0;
10661066

10671067
#if defined(POCO_HAVE_IPv6)
1068-
#if (_WIN32_WINNT >= 0x0501) && (NTDDI_VERSION >= 0x05010100) // Win XP SP1
1068+
#if defined(_WIN32_WCE)
1069+
ifIndex = pAddress->Ipv6IfIndex;
1070+
#elif (_WIN32_WINNT >= 0x0501) && (NTDDI_VERSION >= 0x05010100) // Win XP SP1
10691071
#if defined (IP_ADAPTER_IPV6_ENABLED) // Vista
10701072
if ((pAddress->Flags & IP_ADAPTER_IPV6_ENABLED) &&
10711073
(osvi.dwMajorVersion >= 5) &&
@@ -1154,7 +1156,20 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
11541156
// On Windows, a valid broadcast address will be all 1's (== address | ~subnetMask); additionaly, on pre-Vista versions of
11551157
// OS, master address structure does not contain member for prefix length; we go an extra mile here in order to make sure
11561158
// we reflect the actual values held by system and protect against misconfiguration (e.g. bad DHCP config entry)
1157-
#if (_WIN32_WINNT >= 0x0501) && (NTDDI_VERSION >= 0x05010100) // Win XP SP1
1159+
#if defined(_WIN32_WCE)
1160+
ULONG prefixLength = 0;
1161+
broadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, address, &prefixLength);
1162+
// if previous call did not do it, make last-ditch attempt for prefix and broadcast
1163+
if (prefixLength == 0 && pAddress->FirstPrefix)
1164+
prefixLength = pAddress->FirstPrefix->PrefixLength;
1165+
poco_assert (prefixLength <= 32);
1166+
if (broadcastAddress.isWildcard())
1167+
{
1168+
IPAddress mask ((unsigned) prefixLength, IPAddress::IPv4);
1169+
IPAddress host(mask & address);
1170+
broadcastAddress = host | ~mask;
1171+
}
1172+
#elif (_WIN32_WINNT >= 0x0501) && (NTDDI_VERSION >= 0x05010100) // Win XP SP1
11581173
#if (_WIN32_WINNT >= 0x0600) // Vista and newer
11591174
UINT8 prefixLength = pUniAddr->OnLinkPrefixLength;
11601175
broadcastAddress = getBroadcastAddress(pAddress->FirstPrefix, address);

0 commit comments

Comments
 (0)