diff --git a/src/fd_control.c b/src/fd_control.c
index 29a7b7dd0925f0eb90b68f320122d91a4cb11e63..52c941856388e9d4a45cf662e9fbef8651fc678b 100644
--- a/src/fd_control.c
+++ b/src/fd_control.c
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: fd_control.c,v 1.46 2002/10/11 01:39:31 nilsson Exp $
+|| $Id: fd_control.c,v 1.47 2003/04/30 10:38:31 grubba Exp $
 */
 
 #ifndef TESTING
@@ -10,7 +10,7 @@
 #include "pike_error.h"
 #include "fdlib.h"
 
-RCSID("$Id: fd_control.c,v 1.46 2002/10/11 01:39:31 nilsson Exp $");
+RCSID("$Id: fd_control.c,v 1.47 2003/04/30 10:38:31 grubba Exp $");
 
 #else /* TESTING */
 
@@ -48,7 +48,9 @@ RCSID("$Id: fd_control.c,v 1.46 2002/10/11 01:39:31 nilsson Exp $");
 #include <sys/errno.h>
 #endif
 
-#ifdef HAVE_WINSOCK_H
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#elif defined(HAVE_WINSOCK_H)
 #include <winsock.h>
 #endif
 
diff --git a/src/fdlib.h b/src/fdlib.h
index a2dee17d8355578d9776756fe83c5d2607350fbf..9531dd544387de582118f5536b82a6674ba02645 100644
--- a/src/fdlib.h
+++ b/src/fdlib.h
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: fdlib.h,v 1.45 2003/03/28 01:25:17 mast Exp $
+|| $Id: fdlib.h,v 1.46 2003/04/30 10:37:36 grubba Exp $
 */
 
 #ifndef FDLIB_H
@@ -55,7 +55,11 @@
 #define FD_SETSIZE MAX_OPEN_FILEDESCRIPTORS
 #endif
 
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#else
 #include <winsock.h>
+#endif
 #include <winbase.h>
 
 typedef int FD;
diff --git a/src/time_stuff.h b/src/time_stuff.h
index ba8893f2fbd37da5fffa6cef4a3c7ef78b3bb275..b44387773b23fdcdb9694fd6a2c693294943c9f0 100644
--- a/src/time_stuff.h
+++ b/src/time_stuff.h
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: time_stuff.h,v 1.13 2003/02/11 19:25:59 mast Exp $
+|| $Id: time_stuff.h,v 1.14 2003/04/30 10:36:47 grubba Exp $
 */
 
 #ifndef TIME_STUFF_H
@@ -25,7 +25,9 @@
 # endif
 #endif
 
-#ifdef HAVE_WINSOCK_H
+#ifdef HAVE_WINSOCK2_H
+# include <winsock2.h>
+#elif defined(HAVE_WINSOCK_H)
 # include <winsock.h>
 #endif