diff --git a/netwerk/sctp/src/moz.build b/netwerk/sctp/src/moz.build
index 45503a6e9433f0410691bcc13313428125f45bd0..dc1e716c5a687cd0c1879e4021989fd4b3c1d4eb 100644
--- a/netwerk/sctp/src/moz.build
+++ b/netwerk/sctp/src/moz.build
@@ -59,3 +59,5 @@ if CONFIG['OS_TARGET'] in ('Linux', 'Android'):
     DEFINES['_GNU_SOURCE'] = 1
 elif CONFIG['OS_TARGET'] == 'Darwin':
     DEFINES['__APPLE_USE_RFC_2292'] = 1
+elif CONFIG['OS_TARGET'] == 'WINNT':
+    DEFINES['_CRT_RAND_S'] = True
diff --git a/netwerk/sctp/src/netinet/sctp_cc_functions.c b/netwerk/sctp/src/netinet/sctp_cc_functions.c
index 176338a05e718f5535a0eb3fa689d8e5d0f849be..77193d8f9de60d9b57c3a9230e3d538a0fb40a37 100644
--- a/netwerk/sctp/src/netinet/sctp_cc_functions.c
+++ b/netwerk/sctp/src/netinet/sctp_cc_functions.c
@@ -49,6 +49,10 @@
 #include <netinet/sctp_kdtrace.h>
 #endif
 
+#if defined(_WIN32) && defined(__MINGW32__)
+#include <minmax.h>
+#endif
+
 #define SHIFT_MPTCP_MULTI_N 40
 #define SHIFT_MPTCP_MULTI_Z 16
 #define SHIFT_MPTCP_MULTI 8
diff --git a/netwerk/sctp/src/netinet/sctp_indata.c b/netwerk/sctp/src/netinet/sctp_indata.c
index 91980d3a240047652aa756a31b05d9ef64ca9b16..1c94568f7566e6deb719801814748ecb3058aae7 100644
--- a/netwerk/sctp/src/netinet/sctp_indata.c
+++ b/netwerk/sctp/src/netinet/sctp_indata.c
@@ -53,6 +53,11 @@
 #if defined(__FreeBSD__) && !defined(__Userspace__)
 #include <netinet/sctp_lock_bsd.h>
 #endif
+
+#if defined(_WIN32) && !defined(_MSC_VER)
+#include <minmax.h>
+#endif
+
 /*
  * NOTES: On the outbound side of things I need to check the sack timer to
  * see if I should generate a sack into the chunk queue (if I have data to
diff --git a/netwerk/sctp/src/netinet/sctp_input.c b/netwerk/sctp/src/netinet/sctp_input.c
index 361b8b22e2e70e7d948b2d173af9a79737f498c7..7430d346ea5cd70049de0faa375d3fc9cd97d9c4 100644
--- a/netwerk/sctp/src/netinet/sctp_input.c
+++ b/netwerk/sctp/src/netinet/sctp_input.c
@@ -58,6 +58,10 @@
 #include <sys/smp.h>
 #endif
 
+#if defined(_WIN32) && !defined(_MSC_VER)
+#include <minmax.h>
+#endif
+
 static void
 sctp_stop_all_cookie_timers(struct sctp_tcb *stcb)
 {
diff --git a/netwerk/sctp/src/netinet/sctp_output.c b/netwerk/sctp/src/netinet/sctp_output.c
index 85b788640448d0d4f1348a4d913635731a46c611..8be281fc4afaddf9cd20f16394e8b1d904dd9420 100644
--- a/netwerk/sctp/src/netinet/sctp_output.c
+++ b/netwerk/sctp/src/netinet/sctp_output.c
@@ -74,6 +74,11 @@
 #if defined(__Userspace__) && defined(INET6)
 #include <netinet6/sctp6_var.h>
 #endif
+
+#if defined(_WIN32) && !defined(_MSC_VER)
+#include <minmax.h>
+#endif
+
 #if defined(__APPLE__) && !defined(__Userspace__)
 #if !(defined(APPLE_LEOPARD) || defined(APPLE_SNOWLEOPARD))
 #define SCTP_MAX_LINKHDR 16
diff --git a/netwerk/sctp/src/netinet/sctp_usrreq.c b/netwerk/sctp/src/netinet/sctp_usrreq.c
index df4424e2fbeb27a16ac248da8436543dccb6b0cd..a9f9c8d863054d73d9121a9479259becb23b61b5 100644
--- a/netwerk/sctp/src/netinet/sctp_usrreq.c
+++ b/netwerk/sctp/src/netinet/sctp_usrreq.c
@@ -63,6 +63,10 @@
 #include <netinet/sctp_peeloff.h>
 #endif				/* HAVE_SCTP_PEELOFF_SOCKOPT */
 
+#if defined(_WIN32) && !defined(_MSC_VER)
+#include <minmax.h>
+#endif
+
 extern const struct sctp_cc_functions sctp_cc_functions[];
 extern const struct sctp_ss_functions sctp_ss_functions[];
 
diff --git a/netwerk/sctp/src/netinet/sctputil.c b/netwerk/sctp/src/netinet/sctputil.c
index af062001da4f77208c81cafd7204a6dc0eac0f49..3fd8822c6266bafbdf3ea056166b76429ac3160d 100644
--- a/netwerk/sctp/src/netinet/sctputil.c
+++ b/netwerk/sctp/src/netinet/sctputil.c
@@ -77,6 +77,10 @@
 #endif
 #endif
 
+#if defined(_WIN32) && !defined(_MSC_VER)
+#include <minmax.h>
+#endif
+
 extern const struct sctp_cc_functions sctp_cc_functions[];
 extern const struct sctp_ss_functions sctp_ss_functions[];
 
diff --git a/netwerk/sctp/src/user_mbuf.c b/netwerk/sctp/src/user_mbuf.c
index 85badc0fa520fc84a8d1aad03736469cd245084b..83b6ee3d8dd75994f5b95965324b82dc380effa2 100644
--- a/netwerk/sctp/src/user_mbuf.c
+++ b/netwerk/sctp/src/user_mbuf.c
@@ -35,6 +35,10 @@
  *
  */
 
+#if defined(_WIN32) && !defined(_MSC_VER)
+#include <minmax.h>
+#endif
+
 #include <stdio.h>
 #include <string.h>
 /* #include <sys/param.h> This defines MSIZE 256 */
diff --git a/netwerk/sctp/src/user_socket.c b/netwerk/sctp/src/user_socket.c
index cde6ecc417b521194e8048469ab37646b5d90d89..9bdd51e105d05346a6bd8eb6e374cd994c6914f6 100644
--- a/netwerk/sctp/src/user_socket.c
+++ b/netwerk/sctp/src/user_socket.c
@@ -60,9 +60,12 @@
 #endif
 userland_mutex_t accept_mtx;
 userland_cond_t accept_cond;
-#ifdef _WIN32
+#if defined(_WIN32)
 #include <time.h>
 #include <sys/timeb.h>
+#if !defined(_MSC_VER)
+#include <minmax.h>
+#endif
 #endif
 
 MALLOC_DEFINE(M_PCB, "sctp_pcb", "sctp pcb");