diff --git a/builds/msvc/errno.cpp b/builds/msvc/errno.cpp index bf386371..ddfe59ff 100644 --- a/builds/msvc/errno.cpp +++ b/builds/msvc/errno.cpp @@ -1,4 +1,4 @@ -#if defined WINCE +#if defined _WIN32_WCE //#include "..\..\include\zmq.h" #include "..\..\src\err.hpp" diff --git a/builds/msvc/errno.hpp b/builds/msvc/errno.hpp index f40ee0fc..1530f279 100644 --- a/builds/msvc/errno.hpp +++ b/builds/msvc/errno.hpp @@ -13,7 +13,7 @@ //#define ECHILD 10 #define EAGAIN 11 //#define ENOMEM 12 -//#define EACCES 13 +#define EACCES 13 #define EFAULT 14 //#define EOSERR 15 // rk //#define EBUSY 16 diff --git a/include/zmq.h b/include/zmq.h index b9f194ea..9f7093f2 100644 --- a/include/zmq.h +++ b/include/zmq.h @@ -27,7 +27,7 @@ extern "C" { #endif -#if !defined WINCE +#if !defined _WIN32_WCE #include #endif #include diff --git a/src/clock.cpp b/src/clock.cpp index 1646397c..3ef01021 100644 --- a/src/clock.cpp +++ b/src/clock.cpp @@ -27,7 +27,7 @@ #include #if defined _MSC_VER -#if defined WINCE +#if defined _WIN32_WCE #include #else #include diff --git a/src/err.cpp b/src/err.cpp index 5aecd544..23662884 100644 --- a/src/err.cpp +++ b/src/err.cpp @@ -203,7 +203,7 @@ const char *zmq::wsa_error_no (int no_) void zmq::win_error (char *buffer_, size_t buffer_size_) { DWORD errcode = GetLastError (); -#if defined WINCE +#if defined _WIN32_WCE DWORD rc = FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, errcode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)buffer_, buffer_size_ / sizeof(wchar_t), NULL ); diff --git a/src/err.hpp b/src/err.hpp index 7e27c823..81c95410 100644 --- a/src/err.hpp +++ b/src/err.hpp @@ -26,7 +26,7 @@ #include "../include/zmq.h" #include -#if defined WINCE +#if defined _WIN32_WCE #include "..\builds\msvc\errno.hpp" #else #include diff --git a/src/signaler.cpp b/src/signaler.cpp index 8a5d38e0..13acb5d2 100644 --- a/src/signaler.cpp +++ b/src/signaler.cpp @@ -238,6 +238,8 @@ int zmq::signaler_t::make_fdpair (fd_t *r_, fd_t *w_) return 0; #elif defined ZMQ_HAVE_WINDOWS +#if !defined _WIN32_WCE + // Windows CE does not manage security attributes SECURITY_DESCRIPTOR sd; SECURITY_ATTRIBUTES sa; memset (&sd, 0, sizeof (sd)); @@ -248,6 +250,7 @@ int zmq::signaler_t::make_fdpair (fd_t *r_, fd_t *w_) sa.nLength = sizeof(SECURITY_ATTRIBUTES); sa.lpSecurityDescriptor = &sd; +#endif // This function has to be in a system-wide critical section so that // two instances of the library don't accidentally create signaler @@ -256,7 +259,11 @@ int zmq::signaler_t::make_fdpair (fd_t *r_, fd_t *w_) // Note that if the event object already exists, the CreateEvent requests // EVENT_ALL_ACCESS access right. If this fails, we try to open // the event object asking for SYNCHRONIZE access only. +#if !defined _WIN32_WCE HANDLE sync = CreateEvent (&sa, FALSE, TRUE, TEXT ("Global\\zmq-signaler-port-sync")); +#else + HANDLE sync = CreateEvent (NULL, FALSE, TRUE, TEXT ("Global\\zmq-signaler-port-sync")); +#endif if (sync == NULL && GetLastError () == ERROR_ACCESS_DENIED) sync = OpenEvent (SYNCHRONIZE | EVENT_MODIFY_STATE, FALSE, TEXT ("Global\\zmq-signaler-port-sync")); @@ -303,9 +310,13 @@ int zmq::signaler_t::make_fdpair (fd_t *r_, fd_t *w_) *w_ = WSASocket (AF_INET, SOCK_STREAM, 0, NULL, 0, 0); wsa_assert (*w_ != INVALID_SOCKET); +#if !defined _WIN32_WCE // On Windows, preventing sockets to be inherited by child processes. BOOL brc = SetHandleInformation ((HANDLE) *w_, HANDLE_FLAG_INHERIT, 0); win_assert (brc); +#else + BOOL brc; +#endif // Set TCP_NODELAY on writer socket. rc = setsockopt (*w_, IPPROTO_TCP, TCP_NODELAY, @@ -341,10 +352,11 @@ int zmq::signaler_t::make_fdpair (fd_t *r_, fd_t *w_) win_assert (brc != 0); if (*r_ != INVALID_SOCKET) { +#if !defined _WIN32_WCE // On Windows, preventing sockets to be inherited by child processes. brc = SetHandleInformation ((HANDLE) *r_, HANDLE_FLAG_INHERIT, 0); win_assert (brc); - +#endif return 0; } else { // Cleanup writer if connection failed diff --git a/src/socket_base.cpp b/src/socket_base.cpp index bfcdd383..3317ad12 100644 --- a/src/socket_base.cpp +++ b/src/socket_base.cpp @@ -29,7 +29,7 @@ #if defined ZMQ_HAVE_WINDOWS #include "windows.hpp" #if defined _MSC_VER -#if defined WINCE +#if defined _WIN32_WCE #include #else #include diff --git a/src/tcp_listener.cpp b/src/tcp_listener.cpp index 73fad94b..cf40b85d 100644 --- a/src/tcp_listener.cpp +++ b/src/tcp_listener.cpp @@ -174,9 +174,11 @@ int zmq::tcp_listener_t::set_address (const char *addr_) errno = wsa_error_to_errno (WSAGetLastError ()); return -1; } +#if !defined _WIN32_WCE // On Windows, preventing sockets to be inherited by child processes. BOOL brc = SetHandleInformation ((HANDLE) s, HANDLE_FLAG_INHERIT, 0); win_assert (brc); +#endif #else if (s == -1) return -1; @@ -258,9 +260,11 @@ zmq::fd_t zmq::tcp_listener_t::accept () WSAGetLastError () == WSAENOBUFS); return retired_fd; } +#if !defined _WIN32_WCE // On Windows, preventing sockets to be inherited by child processes. BOOL brc = SetHandleInformation ((HANDLE) sock, HANDLE_FLAG_INHERIT, 0); win_assert (brc); +#endif #else if (sock == -1) { errno_assert (errno == EAGAIN || errno == EWOULDBLOCK || diff --git a/src/thread.cpp b/src/thread.cpp index cc1964a4..8fe9016f 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -43,7 +43,7 @@ void zmq::thread_t::start (thread_fn *tfn_, void *arg_) { tfn = tfn_; arg =arg_; -#if defined WINCE +#if defined _WIN32_WCE descriptor = (HANDLE) CreateThread (NULL, 0, &::thread_routine, this, 0 , NULL); #else diff --git a/src/windows.hpp b/src/windows.hpp index 4a3124eb..d89a9a84 100644 --- a/src/windows.hpp +++ b/src/windows.hpp @@ -170,7 +170,7 @@ #include #include -#if !defined WINCE +#if !defined _WIN32_WCE #include #endif