--- paho.mqtt.c-1.3.0/src/CMakeLists.txt.orig	2019-07-08 11:09:47.589051500 +0300
+++ paho.mqtt.c-1.3.0/src/CMakeLists.txt	2019-07-08 11:10:03.139073200 +0300
@@ -55,7 +55,7 @@
     )
 
 IF (WIN32)
-    SET(LIBS_SYSTEM ws2_32)
+    SET(LIBS_SYSTEM ws2_32 rpcrt4 crypt32)
 ELSEIF (UNIX)
     IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
         SET(LIBS_SYSTEM c dl pthread)
--- paho.mqtt.c-1.3.0/src/WebSocket.c.orig	2019-07-08 11:19:09.467968000 +0300
+++ paho.mqtt.c-1.3.0/src/WebSocket.c	2019-07-08 11:19:48.539022800 +0300
@@ -47,10 +47,15 @@
 #  if BYTE_ORDER == LITTLE_ENDIAN
 #    define htobe16(x)   htons(x)
 #    define htobe32(x)   htonl(x)
+#if defined(WIN32)
+#    define htobe64(x)   ((1==htonl(1)) ? (x) : ((uint64_t)htonl((x) & 0xFFFFFFFF) << 32) | htonl((x) >> 32))
+#    define be64toh(x)   ((1==ntohl(1)) ? (x) : ((uint64_t)ntohl((x) & 0xFFFFFFFF) << 32) | ntohl((x) >> 32))
+#else
 #    define htobe64(x)   htonll(x)
+#    define be64toh(x)   ntohll(x)
+#endif
 #    define be16toh(x)   ntohs(x)
 #    define be32toh(x)   ntohl(x)
-#    define be64toh(x)   ntohll(x)
 #  elif BTYE_ORDER == BIG_ENDIAN
 #    define htobe16(x)   (x)
 #    define htobe32(x)   (x)
