diff --git a/src/i_tcp.c b/src/i_tcp.c
index 6488e98455f4f8076b30b74052c6d724693d4f7c..9febd56f019e253a024f4e3b170852ab0e6606ac 100644
--- a/src/i_tcp.c
+++ b/src/i_tcp.c
@@ -262,6 +262,28 @@ static void wattcp_outch(char s)
 }
 #endif
 
+#ifdef USE_WINSOCK
+// stupid microsoft makes things complicated
+static inline char *get_WSAErrorStr(int e)
+{
+	char *buf = NULL;
+
+	FormatMessageA(
+		FORMAT_MESSAGE_ALLOCATE_BUFFER |
+		FORMAT_MESSAGE_FROM_SYSTEM |
+		FORMAT_MESSAGE_IGNORE_INSERTS,
+		NULL,
+		(DWORD)e,
+		MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+		(LPTSTR)&buf,
+		0, NULL);
+
+	return buf;
+}
+#undef strerror
+#define strerror get_WSAErrorStr
+#endif
+
 #ifdef USE_WINSOCK2
 #define inet_ntop inet_ntopA
 #define HAVE_NTOP