diff --git a/src/xpdev/sockwrap.h b/src/xpdev/sockwrap.h
index f3f2603a155fc5116f81ae10ff47cd11f1872182..9877c9e1d2630389d832365229688f1b231b45d0 100644
--- a/src/xpdev/sockwrap.h
+++ b/src/xpdev/sockwrap.h
@@ -48,7 +48,14 @@
 #ifndef _WINSOCKAPI_
 	#include <winsock2.h>	/* socket/bind/etc. */
 	#include <mswsock.h>	/* Microsoft WinSock2 extensions */
+#if defined(__BORLANDC__)
+// Borland C++ builder 6 comes with a broken ws2tcpip.h header for GCC.
+#define _MSC_VER 7
+#endif
     #include <ws2tcpip.h>	/* More stuff */
+#if defined(__BORLANDC__)
+#undef _MSC_VER
+#endif
 	#define SOCK_MAXADDRLEN sizeof(SOCKADDR_STORAGE)
 	/* Let's agree on a standard WinSock symbol here, people */
 	#define _WINSOCKAPI_