diff --git a/src/ip_resolver.cpp b/src/ip_resolver.cpp index d01f82f0..8f2a8640 100644 --- a/src/ip_resolver.cpp +++ b/src/ip_resolver.cpp @@ -581,7 +581,7 @@ int zmq::ip_resolver_t::get_interface_name (unsigned long index_, char *if_name_result = NULL; -#if !defined ZMQ_HAVE_WINDOWS_TARGET_XP && !defined ZMQ_HAVE_WINDOWS_UWP +#if _WIN32_WINNT > _WIN32_WINNT_WINXP && !defined ZMQ_HAVE_WINDOWS_UWP if_name_result = if_indextoname (index_, buffer); #endif @@ -724,7 +724,7 @@ void zmq::ip_resolver_t::do_freeaddrinfo (struct addrinfo *res_) unsigned int zmq::ip_resolver_t::do_if_nametoindex (const char *ifname_) { -#if !defined ZMQ_HAVE_WINDOWS_TARGET_XP && !defined ZMQ_HAVE_WINDOWS_UWP \ +#if _WIN32_WINNT > _WIN32_WINNT_WINXP && !defined ZMQ_HAVE_WINDOWS_UWP \ && !defined ZMQ_HAVE_VXWORKS return if_nametoindex (ifname_); #else diff --git a/src/thread.cpp b/src/thread.cpp index 6f07e9ce..d5c3be10 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -65,10 +65,10 @@ void zmq::thread_t::start (thread_fn *tfn_, void *arg_, const char *name_) strncpy (_name, name_, sizeof (_name) - 1); #if defined _WIN32_WCE _descriptor = - (HANDLE) CreateThread (NULL, 0, &::thread_routine, this, 0, NULL); + (HANDLE) CreateThread (NULL, 0, &::thread_routine, this, 0, &_thread_id); #else - _descriptor = - (HANDLE) _beginthreadex (NULL, 0, &::thread_routine, this, 0, NULL); + _descriptor = (HANDLE) _beginthreadex (NULL, 0, &::thread_routine, this, 0, + &_thread_id); #endif win_assert (_descriptor != NULL); _started = true; @@ -76,7 +76,7 @@ void zmq::thread_t::start (thread_fn *tfn_, void *arg_, const char *name_) bool zmq::thread_t::is_current_thread () const { - return GetCurrentThreadId () == GetThreadId (_descriptor); + return GetCurrentThreadId () == _thread_id; } void zmq::thread_t::stop () diff --git a/src/thread.hpp b/src/thread.hpp index b13fc923..2e6c5a7c 100644 --- a/src/thread.hpp +++ b/src/thread.hpp @@ -107,6 +107,11 @@ class thread_t #ifdef ZMQ_HAVE_WINDOWS HANDLE _descriptor; +#if defined _WIN32_WCE + DWORD _thread_id; +#else + unsigned int _thread_id; +#endif #elif defined ZMQ_HAVE_VXWORKS int _descriptor; enum diff --git a/src/udp_address.cpp b/src/udp_address.cpp index f0ffb162..96d66c1c 100644 --- a/src/udp_address.cpp +++ b/src/udp_address.cpp @@ -104,7 +104,7 @@ int zmq::udp_address_t::resolve (const char *name_, bool bind_, bool ipv6_) if (src_name == "*") { _bind_interface = 0; } else { -#if !defined ZMQ_HAVE_WINDOWS_TARGET_XP && !defined ZMQ_HAVE_WINDOWS_UWP \ +#if _WIN32_WINNT > _WIN32_WINNT_WINXP && !defined ZMQ_HAVE_WINDOWS_UWP \ && !defined ZMQ_HAVE_VXWORKS _bind_interface = if_nametoindex (src_name.c_str ()); if (_bind_interface == 0) { diff --git a/tests/test_radio_dish.cpp b/tests/test_radio_dish.cpp index 447b42a5..2b4c9481 100644 --- a/tests/test_radio_dish.cpp +++ b/tests/test_radio_dish.cpp @@ -299,14 +299,14 @@ static bool is_multicast_available (int ipv6_) any_ipv6->sin6_flowinfo = 0; any_ipv6->sin6_scope_id = 0; - rc = inet_pton (AF_INET6, "::", &any_ipv6->sin6_addr); + rc = test_inet_pton (AF_INET6, "::", &any_ipv6->sin6_addr); if (rc == 0) { goto out; } *mcast_ipv6 = *any_ipv6; - rc = inet_pton (AF_INET6, MCAST_IPV6, &mcast_ipv6->sin6_addr); + rc = test_inet_pton (AF_INET6, MCAST_IPV6, &mcast_ipv6->sin6_addr); if (rc == 0) { goto out; } @@ -319,14 +319,14 @@ static bool is_multicast_available (int ipv6_) any_ipv4->sin_family = AF_INET; any_ipv4->sin_port = htons (5555); - rc = inet_pton (AF_INET, "0.0.0.0", &any_ipv4->sin_addr); + rc = test_inet_pton (AF_INET, "0.0.0.0", &any_ipv4->sin_addr); if (rc == 0) { goto out; } *mcast_ipv4 = *any_ipv4; - rc = inet_pton (AF_INET, MCAST_IPV4, &mcast_ipv4->sin_addr); + rc = test_inet_pton (AF_INET, MCAST_IPV4, &mcast_ipv4->sin_addr); if (rc == 0) { goto out; } diff --git a/tests/testutil.cpp b/tests/testutil.cpp index de5dd4ba..7194bd63 100644 --- a/tests/testutil.cpp +++ b/tests/testutil.cpp @@ -38,7 +38,7 @@ #include #pragma warning(disable : 4996) // iphlpapi is needed for if_nametoindex (not on Windows XP) -#if !defined ZMQ_HAVE_WINDOWS_TARGET_XP +#if _WIN32_WINNT > _WIN32_WINNT_WINXP #pragma comment(lib, "iphlpapi") #endif #endif