diff --git a/CMakeLists.txt b/CMakeLists.txt
index bb9ec3ad..12f7e1be 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -454,7 +454,9 @@ endif(LWS_WITH_SSL)
 #
 # Platform specific libs.
 #
-if (WIN32)
+if (WINCE)
+	list(APPEND LIB_LIST ws2.lib)
+elseif (WIN32)
 	list(APPEND LIB_LIST ws2_32.lib)
 endif()
 
diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c
index 8ce60741..f0a09fdc 100644
--- a/lib/libwebsockets.c
+++ b/lib/libwebsockets.c
@@ -24,6 +24,9 @@
 #if defined(WIN32) || defined(_WIN32)
 #include <tchar.h>
 #include <mstcpip.h>
+#ifdef _WIN32_WCE
+#define vsnprintf _vsnprintf
+#endif
 #else
 #ifdef LWS_BUILTIN_GETIFADDRS
 #include <getifaddrs.h>
@@ -140,6 +143,15 @@ static unsigned long long time_in_microseconds()
 #endif
 }
 
+#ifdef _WIN32_WCE
+static inline time_t time(time_t *t)
+{
+	time_t ret = time_in_microseconds() / 1000000;
+	*t = ret;
+	return ret;
+}
+#endif
+
 int
 insert_wsi_socket_into_fds(struct libwebsocket_context *context,
 						       struct libwebsocket *wsi)
@@ -1974,6 +1986,7 @@ libwebsocket_create_context(struct lws_context_creation_info *info)
 		/* default to a poll() made out of select() */
 		poll = emulated_poll;
 
+#ifndef _WIN32_WCE
 		/* if windows socket lib available, use his WSAPoll */
 		wsdll = GetModuleHandle(_T("Ws2_32.dll"));
 		if (wsdll)
@@ -1982,6 +1995,7 @@ libwebsocket_create_context(struct lws_context_creation_info *info)
 		/* Finally fall back to emulated poll if all else fails */
 		if (!poll)
 			poll = emulated_poll;
+#endif
 	}
 #endif