Optimized include/*.h: (recursively) include all headers needed by
this .h file, but only those. Necessary fixes to a lot of .c files,
started optimizing "windows.h" away from some of them. Moved
GetCurrentTask prototype to wine/winbase16.h.

diff --git a/console/interface.c b/console/interface.c
index e1d8ed0..afe646b 100644
--- a/console/interface.c
+++ b/console/interface.c
@@ -10,7 +10,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "windows.h"
+#include "windef.h"
 #include "console.h"
 #include "config.h"
 
diff --git a/console/ncurses.c b/console/ncurses.c
index af1fafd..15191c7 100644
--- a/console/ncurses.c
+++ b/console/ncurses.c
@@ -1,6 +1,7 @@
 /* ncurses.c */
 /* Copyright 1999 - Joseph Pranevich */
 
+#include <stdio.h>
 #include "config.h"
 #include "console.h"
 
diff --git a/console/tty.c b/console/tty.c
index 2dc7fec..7898caa 100644
--- a/console/tty.c
+++ b/console/tty.c
@@ -14,7 +14,6 @@
 #include "console.h"
 #include "config.h"
 #include "wintypes.h" /* FALSE */
-#include "windows.h" /* _lread16() */
 void TTY_Start()
 {
    /* This should be the root driver so we can ignore anything
diff --git a/console/xterm.c b/console/xterm.c
index 87e60f9..6c846ab 100644
--- a/console/xterm.c
+++ b/console/xterm.c
@@ -8,6 +8,7 @@
    It does not currently support changing the title bar.
 */
 
+#include <stdio.h>
 #include <signal.h>
 #include <sys/ioctl.h>
 #include <fcntl.h>
@@ -15,7 +16,6 @@
 #include <termios.h>
 #include <errno.h>
 
-#include "windows.h"
 #include "console.h"
 #include "options.h"
 #include "debug.h"
diff --git a/controls/desktop.c b/controls/desktop.c
index 7fb5251..64b8dda 100644
--- a/controls/desktop.c
+++ b/controls/desktop.c
@@ -11,6 +11,7 @@
 #include <unistd.h>
 
 #include "desktop.h"
+#include "windef.h"
 #include "heap.h"
 #include "monitor.h"
 #include "win.h"
diff --git a/controls/edit.c b/controls/edit.c
index 2560380..f0d83f0 100644
--- a/controls/edit.c
+++ b/controls/edit.c
@@ -11,9 +11,9 @@
  *	please read EDIT.TODO (and update it when you change things)
  */
 
-#include "windows.h"
 #include "winnt.h"
 #include "win.h"
+#include "wine/winbase16.h"
 #include "combo.h"
 #include "local.h"
 #include "resource.h"
diff --git a/controls/scroll.c b/controls/scroll.c
index 099b123..5ae8a51 100644
--- a/controls/scroll.c
+++ b/controls/scroll.c
@@ -5,7 +5,6 @@
  * Copyright 1994, 1996 Alexandre Julliard
  */
 
-#include "windows.h"
 #include "wine/winuser16.h"
 #include "sysmetrics.h"
 #include "scroll.h"
diff --git a/controls/uitools.c b/controls/uitools.c
index 08a6396..28dc63e 100644
--- a/controls/uitools.c
+++ b/controls/uitools.c
@@ -5,7 +5,6 @@
  * Copyright 1997 Bertho A. Stultiens
  */
 
-#include "windows.h"
 #include "wine/winuser16.h"
 #include "debug.h"
 
diff --git a/debugger/break.c b/debugger/break.c
index e45a438..4216158 100644
--- a/debugger/break.c
+++ b/debugger/break.c
@@ -10,6 +10,7 @@
 #include <sys/types.h>
 #include <sys/mman.h>
 #include "module.h"
+#include "neexe.h"
 #include "process.h"
 #include "task.h"
 #include "miscemu.h"
diff --git a/debugger/dbg.y b/debugger/dbg.y
index 84fc654..5ec81ac 100644
--- a/debugger/dbg.y
+++ b/debugger/dbg.y
@@ -20,6 +20,7 @@
 #include "options.h"
 #include "queue.h"
 #include "win.h"
+#include "wine/winbase16.h"
 #include "winnt.h"
 #include "debugger.h"
 #include "neexe.h"
diff --git a/debugger/expr.c b/debugger/expr.c
index 9637f8a..e45e763 100644
--- a/debugger/expr.c
+++ b/debugger/expr.c
@@ -11,6 +11,7 @@
 #include <limits.h>
 #include <sys/types.h>
 #include <neexe.h>
+#include "wine/winbase16.h"
 #include "module.h"
 #include "task.h"
 #include "selectors.h"
diff --git a/debugger/memory.c b/debugger/memory.c
index 4925216..7658a37 100644
--- a/debugger/memory.c
+++ b/debugger/memory.c
@@ -9,6 +9,7 @@
 #include <stdlib.h>
 #include "windows.h"
 #include "debugger.h"
+#include "miscemu.h"
 
 
 /************************************************************
diff --git a/debugger/msc.c b/debugger/msc.c
index 9d6b138..efdd16f 100644
--- a/debugger/msc.c
+++ b/debugger/msc.c
@@ -27,10 +27,10 @@
 #ifndef PATH_MAX
 #define PATH_MAX _MAX_PATH
 #endif
+#include "debugger.h"
 #include "win.h"
 #include "pe_image.h"
-#include "peexe.h"
-#include "debugger.h"
+#include "neexe.h"
 #include "peexe.h"
 #include "xmalloc.h"
 #include "file.h"
diff --git a/debugger/registers.c b/debugger/registers.c
index 3a7edd1..2e4a0de 100644
--- a/debugger/registers.c
+++ b/debugger/registers.c
@@ -5,6 +5,7 @@
  */
 
 #include <stdio.h>
+#include "selectors.h"
 #include "debugger.h"
 
 CONTEXT DEBUG_context;
diff --git a/debugger/source.c b/debugger/source.c
index 29e2c03..04627ed 100644
--- a/debugger/source.c
+++ b/debugger/source.c
@@ -20,6 +20,7 @@
 #endif
 
 #include "win.h"
+#include "wine/winbase16.h"
 #include "pe_image.h"
 #include "peexe.h"
 #include "debugger.h"
diff --git a/dlls/advapi32/advapi.c b/dlls/advapi32/advapi.c
index 36035f9..f73c848 100644
--- a/dlls/advapi32/advapi.c
+++ b/dlls/advapi32/advapi.c
@@ -4,12 +4,15 @@
  * Copyright 1995 Sven Verdoolaege
  */
 
-#include "windows.h"
+#include <unistd.h>
+
+#include "wintypes.h"
 #include "winerror.h"
-#include "debug.h"
+#include "wine/winestring.h"
 #include "heap.h"
 
-#include <unistd.h>
+#include "debug.h"
+
 
 /******************************************************************************
  * GetUserName32A [ADVAPI32.67]
diff --git a/dlls/advapi32/crypt.c b/dlls/advapi32/crypt.c
index 97f3b13..0112ed4 100644
--- a/dlls/advapi32/crypt.c
+++ b/dlls/advapi32/crypt.c
@@ -1,10 +1,10 @@
 /*
  * dlls/advapi32/crypt.c
  */
-#include "windows.h"
+#include "wintypes.h"
 #include "winerror.h"
-#include "debug.h"
 #include "wincrypt.h"
+#include "debug.h"
 
 /******************************************************************************
  * CryptAcquireContextA
diff --git a/dlls/advapi32/eventlog.c b/dlls/advapi32/eventlog.c
index 1610178..37cb8d4 100644
--- a/dlls/advapi32/eventlog.c
+++ b/dlls/advapi32/eventlog.c
@@ -4,11 +4,13 @@
  * Copyright 1995 Sven Verdoolaege, 1998 Juergen Schmied
  */
 
-#include "windows.h"
+#include "wintypes.h"
+#include "winreg.h"
 #include "winerror.h"
-#include "debug.h"
 #include "heap.h"
 
+#include "debug.h"
+
 /******************************************************************************
  * BackupEventLog32A [ADVAPI32.15]
  */
diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c
index 3983aba..6d46d39 100644
--- a/dlls/advapi32/security.c
+++ b/dlls/advapi32/security.c
@@ -1,11 +1,12 @@
 /*
  * dlls/advapi32/security.c
  */
-#include "windows.h"
+#include "wintypes.h"
+#include "winreg.h"
 #include "winerror.h"
-#include "debug.h"
 #include "heap.h"
 #include "ntdll.h"
+#include "debug.h"
 
 /* FIXME: move it to a header */
 BOOL32 WINAPI IsValidSid (PSID pSid);
diff --git a/dlls/advapi32/service.c b/dlls/advapi32/service.c
index 11b76e4..c8ce36f 100644
--- a/dlls/advapi32/service.c
+++ b/dlls/advapi32/service.c
@@ -4,11 +4,12 @@
  * Copyright 1995 Sven Verdoolaege
  */
 
-#include "windows.h"
-#include "winerror.h"
-#include "debug.h"
-#include "heap.h"
 #include <time.h>
+#include "wintypes.h"
+#include "winreg.h"
+#include "winerror.h"
+#include "heap.h"
+#include "debug.h"
 
 /* FIXME: Where do these belong? */
 typedef DWORD	SERVICE_STATUS_HANDLE;
diff --git a/dlls/comctl32/animate.c b/dlls/comctl32/animate.c
index fc50159..bf44427 100644
--- a/dlls/comctl32/animate.c
+++ b/dlls/comctl32/animate.c
@@ -13,15 +13,12 @@
  *   - All notifications.
  */
 
-#include "windows.h"
-#include "winnt.h"
-#include "winbase.h"
+
+#include "win.h"
 #include "commctrl.h"
 #include "animate.h"
-#include "win.h"
 #include "debug.h"
 
-
 #define ANIMATE_GetInfoPtr(wndPtr) ((ANIMATE_INFO *)wndPtr->wExtra[0])
 
 
diff --git a/dlls/comctl32/comboex.c b/dlls/comctl32/comboex.c
index b04951a..a77f679 100644
--- a/dlls/comctl32/comboex.c
+++ b/dlls/comctl32/comboex.c
@@ -16,7 +16,6 @@
  *   - should include "combo.h" 
  */
 
-#include "windows.h"
 #include "commctrl.h"
 #include "comboex.h"
 #include "win.h"
diff --git a/dlls/comctl32/comctl32undoc.c b/dlls/comctl32/comctl32undoc.c
index 41cb935..c83956d 100644
--- a/dlls/comctl32/comctl32undoc.c
+++ b/dlls/comctl32/comctl32undoc.c
@@ -15,9 +15,9 @@
  */
 
 #include <string.h>
-#include <stdlib.h>
+#include <stdlib.h> /* atoi */
 #include <ctype.h>
-#include "windows.h"
+
 #include "commctrl.h"
 #include "heap.h"
 #include "debug.h"
diff --git a/dlls/comctl32/datetime.c b/dlls/comctl32/datetime.c
index 79963a8..6bec902 100644
--- a/dlls/comctl32/datetime.c
+++ b/dlls/comctl32/datetime.c
@@ -14,7 +14,6 @@
  *
  */
 
-#include "windows.h"
 #include "commctrl.h"
 #include "datetime.h"
 #include "win.h"
diff --git a/dlls/comctl32/draglist.c b/dlls/comctl32/draglist.c
index e70282f..560fa80 100644
--- a/dlls/comctl32/draglist.c
+++ b/dlls/comctl32/draglist.c
@@ -12,7 +12,6 @@
  *   - Everything.
  */
 
-#include "windows.h"
 #include "commctrl.h"
 
 #include "debug.h"
diff --git a/dlls/comctl32/flatsb.c b/dlls/comctl32/flatsb.c
index 1813ff0..982a1c4 100644
--- a/dlls/comctl32/flatsb.c
+++ b/dlls/comctl32/flatsb.c
@@ -15,7 +15,6 @@
  *
  */
 
-#include "windows.h"
 #include "commctrl.h"
 #include "flatsb.h" 
 #include "win.h"
diff --git a/dlls/comctl32/header.c b/dlls/comctl32/header.c
index b0520e5..253cc41 100644
--- a/dlls/comctl32/header.c
+++ b/dlls/comctl32/header.c
@@ -19,10 +19,9 @@
  *   - Little flaw when drawing a bitmap on the right side of the text.
  */
 
-#include "windows.h"
 #include "commctrl.h"
-#include "header.h"
 #include "win.h"
+#include "header.h"
 #include "debug.h"
 
 
diff --git a/dlls/comctl32/hotkey.c b/dlls/comctl32/hotkey.c
index be2c329..e9a3438 100644
--- a/dlls/comctl32/hotkey.c
+++ b/dlls/comctl32/hotkey.c
@@ -13,7 +13,6 @@
  *   - Display code.
  */
 
-#include "windows.h"
 #include "commctrl.h"
 #include "hotkey.h"
 #include "win.h"
diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c
index 0650a65..540ae42 100644
--- a/dlls/comctl32/imagelist.c
+++ b/dlls/comctl32/imagelist.c
@@ -30,7 +30,6 @@
 #define __WINE_IMAGELIST_C
 
  
-#include "windows.h"
 #include "wine/obj_base.h"
 #include "wine/obj_storage.h"
 #include "imagelist.h"
diff --git a/dlls/comctl32/ipaddress.c b/dlls/comctl32/ipaddress.c
index 0e83d02..59bf86a 100644
--- a/dlls/comctl32/ipaddress.c
+++ b/dlls/comctl32/ipaddress.c
@@ -22,7 +22,6 @@
 #include <ctype.h>
 #include <stdlib.h>
 
-#include "windows.h"
 #include "win.h"
 #include "commctrl.h"
 #include "ipaddress.h"
diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c
index eb29519..3ccc946 100644
--- a/dlls/comctl32/monthcal.c
+++ b/dlls/comctl32/monthcal.c
@@ -14,7 +14,6 @@
  *
  */
 
-#include "windows.h"
 #include "commctrl.h"
 #include "monthcal.h"
 #include "win.h"
diff --git a/dlls/comctl32/nativefont.c b/dlls/comctl32/nativefont.c
index c4ae462..3877b44 100644
--- a/dlls/comctl32/nativefont.c
+++ b/dlls/comctl32/nativefont.c
@@ -13,7 +13,6 @@
  *   - All notifications.
  */
 
-#include "windows.h"
 #include "commctrl.h"
 #include "nativefont.h"
 #include "win.h"
diff --git a/dlls/comctl32/pager.c b/dlls/comctl32/pager.c
index 979eca1..cae056c 100644
--- a/dlls/comctl32/pager.c
+++ b/dlls/comctl32/pager.c
@@ -13,7 +13,6 @@
  *   - All notifications.
  */
 
-#include "windows.h"
 #include "commctrl.h"
 #include "pager.h"
 #include "win.h"
diff --git a/dlls/comctl32/progress.c b/dlls/comctl32/progress.c
index 3a99d3f..7b17a70 100644
--- a/dlls/comctl32/progress.c
+++ b/dlls/comctl32/progress.c
@@ -5,7 +5,6 @@
  *
  */
 
-#include "windows.h"
 #include "commctrl.h"
 #include "progress.h"
 #include "win.h"
diff --git a/dlls/comctl32/propsheet.c b/dlls/comctl32/propsheet.c
index 548f162..ffe30f4 100644
--- a/dlls/comctl32/propsheet.c
+++ b/dlls/comctl32/propsheet.c
@@ -8,7 +8,6 @@
  *
  */
 
-#include "windows.h"
 #include "commctrl.h"
 #include "prsht.h"
 #include "propsheet.h"
diff --git a/dlls/comctl32/rebar.c b/dlls/comctl32/rebar.c
index 006f92c..32b3c1b 100644
--- a/dlls/comctl32/rebar.c
+++ b/dlls/comctl32/rebar.c
@@ -18,7 +18,6 @@
  *   - All notifications.
  */
 
-#include "windows.h"
 #include "commctrl.h"
 #include "rebar.h"
 #include "win.h"
diff --git a/dlls/comctl32/status.c b/dlls/comctl32/status.c
index e32c30a..30acd1c 100644
--- a/dlls/comctl32/status.c
+++ b/dlls/comctl32/status.c
@@ -5,7 +5,6 @@
  * Copyright 1998 Eric Kohl
  */
 
-#include "windows.h"
 #include "commctrl.h"
 #include "status.h"
 #include "win.h"
diff --git a/dlls/comctl32/tab.c b/dlls/comctl32/tab.c
index 18f2a60..06ad368 100644
--- a/dlls/comctl32/tab.c
+++ b/dlls/comctl32/tab.c
@@ -13,7 +13,6 @@
  *
  */
 
-#include "windows.h"
 #include "commctrl.h"
 #include "tab.h"
 #include "win.h"
diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c
index 816e3b0..37f0d64 100644
--- a/dlls/comctl32/toolbar.c
+++ b/dlls/comctl32/toolbar.c
@@ -25,7 +25,6 @@
  *   - Microsofts controlspy examples.
  */
 
-#include "windows.h"
 #include "commctrl.h"
 #include "sysmetrics.h"
 #include "cache.h"
diff --git a/dlls/comctl32/tooltips.c b/dlls/comctl32/tooltips.c
index f04d1c7..d5b756d 100644
--- a/dlls/comctl32/tooltips.c
+++ b/dlls/comctl32/tooltips.c
@@ -14,7 +14,6 @@
  *     hittest.exe, needtext.exe, newrect.exe, updtext.exe and winfrpt.exe.
  */
 
-#include "windows.h"
 #include "commctrl.h"
 #include "tooltips.h"
 #include "win.h"
diff --git a/dlls/comctl32/trackbar.c b/dlls/comctl32/trackbar.c
index 65863b4..575ba04 100644
--- a/dlls/comctl32/trackbar.c
+++ b/dlls/comctl32/trackbar.c
@@ -24,7 +24,6 @@
 
 
 
-#include "windows.h"
 #include "commctrl.h"
 #include "trackbar.h"
 #include "win.h"
diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c
index 08b48fb..63d2833 100644
--- a/dlls/comctl32/treeview.c
+++ b/dlls/comctl32/treeview.c
@@ -38,7 +38,7 @@
 
 
 #include <string.h>
-#include "windows.h"
+#include "winbase.h"
 #include "commctrl.h"
 #include "treeview.h"
 #include "win.h"
diff --git a/dlls/comctl32/updown.c b/dlls/comctl32/updown.c
index 1f39352..8d1ed32 100644
--- a/dlls/comctl32/updown.c
+++ b/dlls/comctl32/updown.c
@@ -30,7 +30,6 @@
  */
 
 #include <stdlib.h>
-#include "windows.h"
 #include "commctrl.h"
 #include "winnls.h"
 #include "sysmetrics.h"
diff --git a/dlls/imagehlp/access.c b/dlls/imagehlp/access.c
index d9c4064..1d63747 100644
--- a/dlls/imagehlp/access.c
+++ b/dlls/imagehlp/access.c
@@ -4,7 +4,6 @@
  *	Copyright 1998	Patrik Stridvall
  */
 
-#include "windows.h"
 #include "winbase.h"
 #include "winnt.h"
 #include "winerror.h"
diff --git a/dlls/imagehlp/debug.c b/dlls/imagehlp/debug.c
index becf247..c92b1bb 100644
--- a/dlls/imagehlp/debug.c
+++ b/dlls/imagehlp/debug.c
@@ -4,8 +4,8 @@
  *	Copyright 1998	Patrik Stridvall
  */
 
-#include "windows.h"
 #include "winerror.h"
+#include "winbase.h"
 #include "wintypes.h"
 #include "debug.h"
 #include "imagehlp.h"
diff --git a/dlls/imagehlp/imagehlp_main.c b/dlls/imagehlp/imagehlp_main.c
index 9e728ad..cc76945 100644
--- a/dlls/imagehlp/imagehlp_main.c
+++ b/dlls/imagehlp/imagehlp_main.c
@@ -4,11 +4,11 @@
  *	Copyright 1998	Patrik Stridvall
  */
 
-#include "windows.h"
+#include "imagehlp.h"
 #include "winerror.h"
+#include "winbase.h"
 #include "wintypes.h"
 #include "debug.h"
-#include "imagehlp.h"
 
 /**********************************************************************/
 
diff --git a/dlls/imagehlp/integrity.c b/dlls/imagehlp/integrity.c
index 9614da5..c15308d 100644
--- a/dlls/imagehlp/integrity.c
+++ b/dlls/imagehlp/integrity.c
@@ -4,11 +4,11 @@
  *	Copyright 1998	Patrik Stridvall
  */
 
-#include "windows.h"
-#include "winerror.h"
 #include "wintypes.h"
-#include "debug.h"
+#include "winbase.h"
+#include "winerror.h"
 #include "imagehlp.h"
+#include "debug.h"
 
 /***********************************************************************
  *           ImageAddCertificate32 (IMAGEHLP.10)
diff --git a/dlls/imagehlp/internal.c b/dlls/imagehlp/internal.c
index 3d780b2..42a8495 100644
--- a/dlls/imagehlp/internal.c
+++ b/dlls/imagehlp/internal.c
@@ -4,7 +4,7 @@
  *	Copyright 1998	Patrik Stridvall
  */
 
-#include "windows.h"
+#include "winbase.h"
 #include "winerror.h"
 #include "wintypes.h"
 #include "debug.h"
diff --git a/dlls/imagehlp/modify.c b/dlls/imagehlp/modify.c
index de67bab..ad8bbcf 100644
--- a/dlls/imagehlp/modify.c
+++ b/dlls/imagehlp/modify.c
@@ -4,7 +4,7 @@
  *	Copyright 1998	Patrik Stridvall
  */
 
-#include "windows.h"
+#include "winbase.h"
 #include "winerror.h"
 #include "wintypes.h"
 #include "debug.h"
diff --git a/dlls/imagehlp/symbol.c b/dlls/imagehlp/symbol.c
index 4ff3512..b319145 100644
--- a/dlls/imagehlp/symbol.c
+++ b/dlls/imagehlp/symbol.c
@@ -4,7 +4,7 @@
  *	Copyright 1998	Patrik Stridvall
  */
 
-#include "windows.h"
+#include "winbase.h"
 #include "winerror.h"
 #include "wintypes.h"
 #include "debug.h"
diff --git a/dlls/msacm/msacm_main.c b/dlls/msacm/msacm_main.c
index e234d43..ea65a5b 100644
--- a/dlls/msacm/msacm_main.c
+++ b/dlls/msacm/msacm_main.c
@@ -4,12 +4,11 @@
  *      Copyright 1998  Patrik Stridvall
  */
 
-#include "windows.h"
 #include "winerror.h"
+#include "winbase.h"
 #include "wintypes.h"
-#include "debug.h"
-#include "mmsystem.h"
 #include "msacm.h"
+#include "debug.h"
 
 /***********************************************************************
  *           ACMGETVERSION (MSACM.7)
diff --git a/dlls/msacm32/builtin.c b/dlls/msacm32/builtin.c
index 985c76f..3ba3339 100644
--- a/dlls/msacm32/builtin.c
+++ b/dlls/msacm32/builtin.c
@@ -4,7 +4,7 @@
  *      Copyright 1998  Patrik Stridvall
  */
 
-#include "windows.h"
+#include "winbase.h"
 #include "winerror.h"
 #include "wintypes.h"
 #include "debug.h"
diff --git a/dlls/msacm32/driver.c b/dlls/msacm32/driver.c
index bee3d11..2d7411a 100644
--- a/dlls/msacm32/driver.c
+++ b/dlls/msacm32/driver.c
@@ -4,9 +4,10 @@
  *      Copyright 1998  Patrik Stridvall
  */
 
-#include "windows.h"
+#include "winbase.h"
 #include "winerror.h"
 #include "wintypes.h"
+#include "winuser.h"
 #include "debug.h"
 #include "driver.h"
 #include "heap.h"
diff --git a/dlls/msacm32/filter.c b/dlls/msacm32/filter.c
index 45dc02c..b0fddca 100644
--- a/dlls/msacm32/filter.c
+++ b/dlls/msacm32/filter.c
@@ -4,7 +4,7 @@
  *      Copyright 1998  Patrik Stridvall
  */
 
-#include "windows.h"
+#include "winbase.h"
 #include "winerror.h"
 #include "wintypes.h"
 #include "debug.h"
diff --git a/dlls/msacm32/format.c b/dlls/msacm32/format.c
index 0cd2fc1..e780bd1 100644
--- a/dlls/msacm32/format.c
+++ b/dlls/msacm32/format.c
@@ -4,7 +4,7 @@
  *      Copyright 1998  Patrik Stridvall
  */
 
-#include "windows.h"
+#include "winbase.h"
 #include "winerror.h"
 #include "wintypes.h"
 #include "debug.h"
diff --git a/dlls/msacm32/internal.c b/dlls/msacm32/internal.c
index 62c60ae..f382a0a 100644
--- a/dlls/msacm32/internal.c
+++ b/dlls/msacm32/internal.c
@@ -4,7 +4,8 @@
  *      Copyright 1998  Patrik Stridvall
  */
 
-#include "windows.h"
+#include "winbase.h"
+#include "winuser.h"
 #include "winerror.h"
 #include "wintypes.h"
 #include "debug.h"
diff --git a/dlls/msacm32/msacm32_main.c b/dlls/msacm32/msacm32_main.c
index f1dc476..655c226 100644
--- a/dlls/msacm32/msacm32_main.c
+++ b/dlls/msacm32/msacm32_main.c
@@ -4,11 +4,10 @@
  *      Copyright 1998  Patrik Stridvall
  */
 
-#include "windows.h"
+#include "winbase.h"
 #include "winerror.h"
 #include "wintypes.h"
 #include "debug.h"
-#include "mmsystem.h"
 #include "msacm.h"
 #include "msacmdrv.h"
 #include "winversion.h"
diff --git a/dlls/msacm32/stream.c b/dlls/msacm32/stream.c
index d159478..21ca98b 100644
--- a/dlls/msacm32/stream.c
+++ b/dlls/msacm32/stream.c
@@ -4,7 +4,7 @@
  *      Copyright 1998  Patrik Stridvall
  */
 
-#include "windows.h"
+#include "winbase.h"
 #include "winerror.h"
 #include "wintypes.h"
 #include "debug.h"
diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c
index e404ad8..af15030 100644
--- a/dlls/ntdll/nt.c
+++ b/dlls/ntdll/nt.c
@@ -10,19 +10,13 @@
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
-#include "win.h"
-#include "file.h"
-#include "windows.h"
-#include "winnls.h"
-#include "heap.h"
-#include "debug.h"
-#include "module.h"
-#include "debugstr.h"
-
-#include "winnt.h"
+#include "wintypes.h"
 #include "windef.h"
+#include "ntdll.h"
 #include "ntdef.h"
 #include "ntddk.h"
+#include "debugstr.h"
+#include "debug.h"
 
 /* move to winbase.h */
 typedef VOID (CALLBACK *PTIMERAPCROUTINE)(LPVOID lpArgToCompletionRoutine,DWORD dwTimerLowValue,DWORD dwTimerHighValue);   
diff --git a/dlls/ntdll/reg.c b/dlls/ntdll/reg.c
index c644f99..7e60511 100644
--- a/dlls/ntdll/reg.c
+++ b/dlls/ntdll/reg.c
@@ -1,10 +1,11 @@
-#include "win.h"
-#include "debug.h"
-#include "windows.h"
+#include "windef.h"
+#include "wintypes.h"
 #include "winreg.h"
 #include "ntdll.h"
 #include "ntddk.h"
 
+#include "debug.h"
+
 /******************************************************************************
  * NtCreateKey [NTDLL]
  * ZwCreateKey
diff --git a/dlls/ntdll/rtl.c b/dlls/ntdll/rtl.c
index 2fedbc7..104e0e6 100644
--- a/dlls/ntdll/rtl.c
+++ b/dlls/ntdll/rtl.c
@@ -12,21 +12,20 @@
 #include <time.h>
 #include <ctype.h>
 #include <math.h>
-#include "win.h"
-#include "stackframe.h"
+#include "windef.h"
+#include "winbase.h"
+#include "wine/winestring.h"
 #include "file.h"
-#include "windows.h"
+#include "stackframe.h"
 #include "winnls.h"
 #include "ntdll.h"
-#include "heap.h"
-#include "debug.h"
-#include "module.h"
-#include "heap.h"
 #include "debugstr.h"
-
+#include "heap.h"
 #include "ntdef.h"
 #include "winreg.h"
 
+#include "debug.h"
+
 /* fixme: move to windef.h*/
 typedef BOOL32 *LPBOOL;   
 /**************************************************************************
diff --git a/dlls/psapi/psapi_main.c b/dlls/psapi/psapi_main.c
index 94bc7f6..07c2b3b 100644
--- a/dlls/psapi/psapi_main.c
+++ b/dlls/psapi/psapi_main.c
@@ -4,7 +4,6 @@
  *      Copyright 1998  Patrik Stridvall
  */
 
-#include "windows.h"
 #include "winbase.h"
 #include "wintypes.h"
 #include "winerror.h"
diff --git a/dlls/rasapi32/rasapi.c b/dlls/rasapi32/rasapi.c
index 98c8250..a798f2b 100644
--- a/dlls/rasapi32/rasapi.c
+++ b/dlls/rasapi32/rasapi.c
@@ -4,7 +4,7 @@
  * Copyright 1998 Marcus Meissner
  */
 
-#include "windows.h"
+#include "wintypes.h"
 #include "ras.h"
 #include "debug.h"
 
diff --git a/dlls/shell32/brsfolder.c b/dlls/shell32/brsfolder.c
index 63ad76f..69e6163 100644
--- a/dlls/shell32/brsfolder.c
+++ b/dlls/shell32/brsfolder.c
@@ -1,7 +1,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "windows.h"
 #include "wine/winuser16.h"
 #include "winerror.h"
 #include "heap.h"
diff --git a/dlls/shell32/classes.c b/dlls/shell32/classes.c
index b65090e..b980b23 100644
--- a/dlls/shell32/classes.c
+++ b/dlls/shell32/classes.c
@@ -8,6 +8,7 @@
 #include <string.h>
 #include "debug.h"
 #include "winerror.h"
+#include "winreg.h"
 
 #include "shlobj.h"
 #include "shell32_main.h"
diff --git a/dlls/shell32/contmenu.c b/dlls/shell32/contmenu.c
index 9189807..14f7912 100644
--- a/dlls/shell32/contmenu.c
+++ b/dlls/shell32/contmenu.c
@@ -3,7 +3,6 @@
  *
  *	Copyright 1998	Juergen Schmied <juergen.schmied@metronet.de>
  */
-#include "windows.h"
 #include "winerror.h"
 #include "debug.h"
 
@@ -11,7 +10,6 @@
 #include "objbase.h"
 #include "if_macros.h"
 #include "shlguid.h"
-#include "shlobj.h"
 #include "shell32_main.h"
 #include "shresdef.h"
 
diff --git a/dlls/shell32/enumidlist.c b/dlls/shell32/enumidlist.c
index 0707dd1..baa3a74 100644
--- a/dlls/shell32/enumidlist.c
+++ b/dlls/shell32/enumidlist.c
@@ -12,7 +12,6 @@
 
 #include "pidl.h"
 #include "shlguid.h"
-#include "shlobj.h"
 #include "shell32_main.h"
 
 /* IEnumIDList Implementation */
diff --git a/dlls/shell32/folders.c b/dlls/shell32/folders.c
index 4140c99..f556c96 100644
--- a/dlls/shell32/folders.c
+++ b/dlls/shell32/folders.c
@@ -9,11 +9,9 @@
 #include "debug.h"
 #include "objbase.h"
 #include "winerror.h"
-
 #include "pidl.h"
 #include "shell32_main.h"
 #include "shlguid.h"
-#include "shlobj.h"
 
 
 /******************************************************************************
diff --git a/dlls/shell32/iconcache.c b/dlls/shell32/iconcache.c
index 64ae065..a678631 100644
--- a/dlls/shell32/iconcache.c
+++ b/dlls/shell32/iconcache.c
@@ -5,8 +5,8 @@
  *  since dll geting never unloaded the iconcache will never be freed
  */
 #include <string.h>
-#include "windows.h"
 #include "wine/winuser16.h"
+#include "wine/winbase16.h"
 #include "neexe.h"
 #include "cursoricon.h"
 #include "module.h"
diff --git a/dlls/shell32/shell32_main.c b/dlls/shell32/shell32_main.c
index 8d6a992..05238d4 100644
--- a/dlls/shell32/shell32_main.c
+++ b/dlls/shell32/shell32_main.c
@@ -7,7 +7,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "windows.h"
 #include "wine/winuser16.h"
 #include "winerror.h"
 #include "heap.h"
@@ -20,6 +19,7 @@
 #include "authors.h"
 
 #include "shell.h"
+#include "shellapi.h"
 #include "pidl.h"
 #include "shlobj.h"
 #include "shell32_main.h"
diff --git a/dlls/shell32/shellole.c b/dlls/shell32/shellole.c
index 3887a44..3ec96a0 100644
--- a/dlls/shell32/shellole.c
+++ b/dlls/shell32/shellole.c
@@ -8,15 +8,17 @@
 
 #include <stdlib.h>
 #include <string.h>
-#include "debug.h"
-#include "objbase.h"
+#include "winreg.h"
 #include "winerror.h"
+#include "objbase.h"
 #include "winversion.h"
 
 #include "shlguid.h"
 #include "shlobj.h"
 #include "shell32_main.h"
 
+#include "debug.h"
+
 /*************************************************************************
  *
  */
diff --git a/dlls/shell32/shellord.c b/dlls/shell32/shellord.c
index 04cce48..5bff512 100644
--- a/dlls/shell32/shellord.c
+++ b/dlls/shell32/shellord.c
@@ -6,8 +6,8 @@
  *           1998 Jürgen Schmied
  */
 #include <string.h>
-#include "windows.h"
 #include "winerror.h"
+#include "winreg.h"
 #include "debug.h"
 #include "winnls.h"
 #include "winversion.h"
diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c
index 3efa3ed..8503657 100644
--- a/dlls/shell32/shellpath.c
+++ b/dlls/shell32/shellpath.c
@@ -6,7 +6,6 @@
  */
 #include <string.h>
 #include <ctype.h>
-#include "windows.h"
 #include "debug.h"
 #include "winnls.h"
 #include "winversion.h"
diff --git a/dlls/shell32/shlview.c b/dlls/shell32/shlview.c
index a02ef3f..cc98822 100644
--- a/dlls/shell32/shlview.c
+++ b/dlls/shell32/shlview.c
@@ -10,7 +10,7 @@
 
 #include <stdlib.h>
 #include <string.h>
-#include "debug.h"
+
 #include "winerror.h"
 
 #include "pidl.h"
@@ -22,6 +22,8 @@
 #include "shell32_main.h"
 #include "shresdef.h"
 
+#include "debug.h"
+
 /***********************************************************************
 *   IShellView implementation
 */
diff --git a/dlls/ver/ver16.c b/dlls/ver/ver16.c
index aa19df0..f2a05d4 100644
--- a/dlls/ver/ver16.c
+++ b/dlls/ver/ver16.c
@@ -4,10 +4,11 @@
  * Copyright 1999 Ulrich Weigand
  */
 
-#include "windows.h"
-#include "debug.h"
-#include "ver.h"
+#include "winbase.h"
+#include "winver.h"
 #include "ldt.h"
+#include "ver.h"
+#include "debug.h"
 
 
 /*************************************************************************
diff --git a/dlls/version/info.c b/dlls/version/info.c
index 3835eae..185f2f1 100644
--- a/dlls/version/info.c
+++ b/dlls/version/info.c
@@ -9,11 +9,12 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "windows.h"
+#include "winreg.h"
+#include "winver.h"
+#include "wine/winuser16.h"
 #include "winerror.h"
 #include "heap.h"
 #include "ver.h"
-#include "winreg.h"
 #include "debug.h"
 
 
diff --git a/dlls/version/install.c b/dlls/version/install.c
index e921ecf..40c8d5f 100644
--- a/dlls/version/install.c
+++ b/dlls/version/install.c
@@ -8,7 +8,9 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "windows.h"
+#include "windef.h"
+#include "winver.h"
+#include "wine/winestring.h"
 #include "winerror.h"
 #include "heap.h"
 #include "ver.h"
diff --git a/dlls/version/resource.c b/dlls/version/resource.c
index 580d329..2a48b97 100644
--- a/dlls/version/resource.c
+++ b/dlls/version/resource.c
@@ -9,12 +9,14 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "windows.h"
-#include "heap.h"
-#include "ver.h"
-#include "lzexpand.h"
-#include "module.h"
+#include "peexe.h"
 #include "neexe.h"
+#include "module.h"
+#include "winver.h"
+#include "ver.h"
+#include "heap.h"
+#include "lzexpand.h"
+#include "peexe.h"
 #include "debug.h"
 
 
diff --git a/dlls/winaspi/winaspi16.c b/dlls/winaspi/winaspi16.c
index 0dc0cbc..bbdbc00 100644
--- a/dlls/winaspi/winaspi16.c
+++ b/dlls/winaspi/winaspi16.c
@@ -8,14 +8,13 @@
 #include <unistd.h>
 #include <callback.h>
 #include <string.h>
-#include "windows.h"
+#include "winbase.h"
 #include "aspi.h"
 #include "winaspi.h"
 #include "options.h"
 #include "heap.h"
 #include "debug.h"
 #include "selectors.h"
-#include "module.h"
 #include "miscemu.h"
 
 
diff --git a/dlls/wnaspi32/winaspi32.c b/dlls/wnaspi32/winaspi32.c
index 8eec3c5..e57272e 100644
--- a/dlls/wnaspi32/winaspi32.c
+++ b/dlls/wnaspi32/winaspi32.c
@@ -7,15 +7,13 @@
 #include <memory.h>
 #include <unistd.h>
 #include <callback.h>
-#include "windows.h"
+
+#include "winbase.h"
 #include "aspi.h"
 #include "wnaspi32.h"
 #include "options.h"
 #include "heap.h"
 #include "debug.h"
-#include "selectors.h"
-#include "module.h"
-#include "miscemu.h"
 
 
 /* FIXME!
diff --git a/files/change.c b/files/change.c
index 6e81b4e..2aa1a1e 100644
--- a/files/change.c
+++ b/files/change.c
@@ -9,7 +9,6 @@
 #include <unistd.h>
 #include <string.h>
 #include <time.h>
-#include "windows.h"
 #include "winbase.h"
 #include "winerror.h"
 #include "process.h"
diff --git a/files/dos_fs.c b/files/dos_fs.c
index 22c0ed2..baf5566 100644
--- a/files/dos_fs.c
+++ b/files/dos_fs.c
@@ -19,7 +19,9 @@
 #include <time.h>
 #include <unistd.h>
 
-#include "windows.h"
+#include "windef.h"
+#include "winuser.h"
+#include "wine/winbase16.h"
 #include "winerror.h"
 #include "drive.h"
 #include "file.h"
diff --git a/files/file.c b/files/file.c
index 9768cac..c596564 100644
--- a/files/file.c
+++ b/files/file.c
@@ -24,8 +24,11 @@
 #include <unistd.h>
 #include <utime.h>
 
-#include "windows.h"
 #include "winerror.h"
+#include "windef.h"
+#include "winbase.h"
+#include "wine/winbase16.h"
+#include "wine/winestring.h"
 #include "drive.h"
 #include "device.h"
 #include "file.h"
diff --git a/files/profile.c b/files/profile.c
index 8f4943e..05c67f3 100644
--- a/files/profile.c
+++ b/files/profile.c
@@ -11,7 +11,9 @@
 
 #include <sys/stat.h>
 
-#include "windows.h"
+#include "winbase.h"
+#include "wine/winbase16.h"
+#include "winuser.h"
 #include "file.h"
 #include "heap.h"
 #include "debug.h"
diff --git a/graphics/metafiledrv/init.c b/graphics/metafiledrv/init.c
index cfb105c..149607f 100644
--- a/graphics/metafiledrv/init.c
+++ b/graphics/metafiledrv/init.c
@@ -4,11 +4,13 @@
  * Copyright 1996 Alexandre Julliard
  */
 
-#include "metafiledrv.h"
+#include "windef.h"
+#include "wine/winbase16.h"
 #include "dc.h"
 #include "heap.h"
 #include "global.h"
 #include "metafile.h"
+#include "metafiledrv.h"
 #include "debug.h"
 
 #include <string.h>
diff --git a/if1632/snoop.c b/if1632/snoop.c
index 5e0f611..d560e3c 100644
--- a/if1632/snoop.c
+++ b/if1632/snoop.c
@@ -5,6 +5,7 @@
  */
 
 #include <assert.h>
+#include <string.h>
 #include "windows.h"
 #include "winbase.h"
 #include "winnt.h"
diff --git a/if1632/thunk.c b/if1632/thunk.c
index e31379d..ff1fbe9 100644
--- a/if1632/thunk.c
+++ b/if1632/thunk.c
@@ -5,14 +5,14 @@
  * Copyright 1998       Ulrich Weigand
  */
 
-#include "windows.h"
+#include <string.h>
+#include "wine/winbase16.h"
 #include "wine/winuser16.h"
+#include "hook.h"
 #include "callback.h"
-#include "resource.h"
 #include "task.h"
 #include "user.h"
 #include "heap.h"
-#include "hook.h"
 #include "module.h"
 #include "process.h"
 #include "stackframe.h"
diff --git a/include/button.h b/include/button.h
index 64c1c08..377f1b2 100644
--- a/include/button.h
+++ b/include/button.h
@@ -7,7 +7,7 @@
 #ifndef __WINE_BUTTON_H
 #define __WINE_BUTTON_H
 
-#include "windows.h"
+#include "wingdi.h"
 
   /* Extra info for BUTTON windows */
   /* Note: under MS-Windows, state is a BYTE and this structure is */
diff --git a/include/cdrom.h b/include/cdrom.h
index caeb817..0c34054 100644
--- a/include/cdrom.h
+++ b/include/cdrom.h
@@ -6,13 +6,13 @@
  * Copyright 1999 Eric Pouech
  */
 
-#include <stdlib.h>
-#include <unistd.h>
-#include "winbase.h"
-
 #ifndef __WINE_CDROM_H__
 #define __WINE_CDROM_H__
 
+#include <stdlib.h>
+#include <unistd.h>
+#include "wintypes.h"
+
 #ifdef HAVE_LINUX_CDROM_H
 # include <linux/cdrom.h>
 #endif
diff --git a/include/class.h b/include/class.h
index 32dc589..8d4ade6 100644
--- a/include/class.h
+++ b/include/class.h
@@ -7,7 +7,7 @@
 #ifndef __WINE_CLASS_H
 #define __WINE_CLASS_H
 
-#include "windows.h"
+#include "wintypes.h"
 #include "winproc.h"
 
 #define CLASS_MAGIC   ('C' | ('L' << 8) | ('A' << 16) | ('S' << 24))
diff --git a/include/console.h b/include/console.h
index 6746a18..6b5e4a9 100644
--- a/include/console.h
+++ b/include/console.h
@@ -9,7 +9,6 @@
 #define CONSOLE_H
 
 #include <stdio.h>
-
 #include "config.h"
 
 /* Can we compile with curses/ncurses? */
diff --git a/include/cursoricon.h b/include/cursoricon.h
index 24fc398..92d5c70 100644
--- a/include/cursoricon.h
+++ b/include/cursoricon.h
@@ -7,7 +7,7 @@
 #ifndef __WINE_CURSORICON_H
 #define __WINE_CURSORICON_H
 
-#include "windows.h"
+#include "wingdi.h"
 
 #pragma pack(1)
 
diff --git a/include/dce.h b/include/dce.h
index 089ad22..506bfed 100644
--- a/include/dce.h
+++ b/include/dce.h
@@ -7,7 +7,6 @@
 #ifndef __WINE_DCE_H
 #define __WINE_DCE_H
 
-#include "windows.h"
 #include "win.h"
 
 /* additional DCX flags 
diff --git a/include/ddraw.h b/include/ddraw.h
index 63c148a..fb973c4 100644
--- a/include/ddraw.h
+++ b/include/ddraw.h
@@ -6,6 +6,8 @@
 #include <X11/extensions/XShm.h>
 #endif /* defined(HAVE_LIBXXSHM) */
 
+#include "winbase.h" /* LARGE_INTEGER ... */
+#include "wingdi.h" /* PALETTE stuff ... */
 #include "wine/obj_base.h"
 
 #ifndef	DIRECTDRAW_VERSION
diff --git a/include/debugger.h b/include/debugger.h
index c490e9d..ec12229 100644
--- a/include/debugger.h
+++ b/include/debugger.h
@@ -7,10 +7,9 @@
 #ifndef __WINE_DEBUGGER_H
 #define __WINE_DEBUGGER_H
 
-#include "winnt.h"
-#include "selectors.h"
+#include <sys/types.h> /* u_long ... */
+#include "wintypes.h"
 #include "sig_context.h"
-#include "pe_image.h"
 #include "miscemu.h"
 
 #define STEP_FLAG 0x100 /* single step flag */
diff --git a/include/desktop.h b/include/desktop.h
index 21e7e6e..fa49ffa 100644
--- a/include/desktop.h
+++ b/include/desktop.h
@@ -7,7 +7,7 @@
 #ifndef __WINE_DESKTOP_H
 #define __WINE_DESKTOP_H
 
-#include "windows.h"
+#include "wintypes.h"
 
 struct tagMONITOR;
 
diff --git a/include/dialog.h b/include/dialog.h
index ac3a14d..fae9c9b 100644
--- a/include/dialog.h
+++ b/include/dialog.h
@@ -7,7 +7,6 @@
 #ifndef __WINE_DIALOG_H
 #define __WINE_DIALOG_H
 
-#include "windows.h"
 #include "winproc.h"
 
   /* Dialog info structure.
diff --git a/include/dinput.h b/include/dinput.h
index b9c0f77..3a5a7ad 100644
--- a/include/dinput.h
+++ b/include/dinput.h
@@ -1,9 +1,10 @@
 #ifndef _WINE_DINPUT_H
 #define _WINE_DINPUT_H
 
+#include "windef.h" /* for MAX_PATH */
+#include "wintypes.h"
 #include "unknwn.h"
 #include "mouse.h"
-#include "windef.h" /* for MAX_PATH */
 
 #define STDMETHOD(xfn) HRESULT (CALLBACK *fn##xfn)
 #define STDMETHOD_(ret,xfn) ret (CALLBACK *fn##xfn)
diff --git a/include/dosexe.h b/include/dosexe.h
index 9da2437..1b18ab8 100644
--- a/include/dosexe.h
+++ b/include/dosexe.h
@@ -7,11 +7,9 @@
 #ifndef __WINE_DOSEXE_H
 #define __WINE_DOSEXE_H
 
-#include <sys/types.h>
-#include "windows.h"
-#include "winnt.h"
-#include "sig_context.h"
+#include <sys/types.h> /* pid_t */
 #include "wintypes.h"
+#include "sig_context.h"
 
 typedef struct _DOSTASK {
  LPVOID img;
diff --git a/include/dsound.h b/include/dsound.h
index eb16712..fd7ab96 100644
--- a/include/dsound.h
+++ b/include/dsound.h
@@ -1,8 +1,7 @@
 #ifndef __WINE_DSOUND_H
 #define __WINE_DSOUND_H
 
-#include "windows.h"
-#include "winbase.h"
+#include "wintypes.h"
 #include "mmsystem.h"
 #include "d3d.h"			/*FIXME: Need to break out d3dtypes.h */
 
diff --git a/include/file.h b/include/file.h
index f188291..a38ae07 100644
--- a/include/file.h
+++ b/include/file.h
@@ -7,8 +7,7 @@
 #ifndef __WINE_FILE_H
 #define __WINE_FILE_H
 
-#include <time.h>
-#include "windows.h"
+#include <time.h> /* time_t */
 #include "k32obj.h"
 
 #define MAX_PATHNAME_LEN   1024
diff --git a/include/gdi.h b/include/gdi.h
index 8b2c379..5910cd6 100644
--- a/include/gdi.h
+++ b/include/gdi.h
@@ -7,7 +7,8 @@
 #ifndef __WINE_GDI_H
 #define __WINE_GDI_H
 
-#include "windows.h"
+#include "wintypes.h"
+#include "wingdi.h"
 #include "ldt.h"
 #include "local.h"
 #include "path.h"
diff --git a/include/heap.h b/include/heap.h
index 84f6dc2..5700d1d 100644
--- a/include/heap.h
+++ b/include/heap.h
@@ -8,7 +8,6 @@
 #define __WINE_HEAP_H
 
 #include "winbase.h"
-#include "winnt.h"
 
 extern HANDLE32 SystemHeap;
 extern HANDLE32 SegptrHeap;
diff --git a/include/hook.h b/include/hook.h
index fcf3fc7..9d53a11 100644
--- a/include/hook.h
+++ b/include/hook.h
@@ -7,7 +7,7 @@
 #ifndef __WINE_HOOK_H
 #define __WINE_HOOK_H
 
-#include "windows.h"
+#include "wintypes.h"
 
 #define HOOK_WIN16	0x00
 #define HOOK_WIN32A	0x01
diff --git a/include/imagehlp.h b/include/imagehlp.h
index 34949b2..53897be 100644
--- a/include/imagehlp.h
+++ b/include/imagehlp.h
@@ -5,9 +5,9 @@
 #ifndef __WINE_IMAGEHLP_H
 #define __WINE_IMAGEHLP_H
 
-#include "toolhelp.h"
-#include "winnt.h"
 #include "wintypes.h"
+#include "windef.h"
+#include "winbase.h"
 
 /***********************************************************************
  * Types
diff --git a/include/imagelist.h b/include/imagelist.h
index e20e4ab..7db2bfa 100644
--- a/include/imagelist.h
+++ b/include/imagelist.h
@@ -8,7 +8,7 @@
 #define __WINE_IMAGELIST_H
 
 #include "wingdi.h"
- 
+
 struct _IMAGELIST
 {
     HBITMAP32 hbmImage;
diff --git a/include/ipaddress.h b/include/ipaddress.h
index 20e0e39..1c2a336 100644
--- a/include/ipaddress.h
+++ b/include/ipaddress.h
@@ -8,10 +8,6 @@
 #ifndef __WINE_IPADDRESS_H
 #define __WINE_IPADDRESS_H
 
-#include "win.h"
-
-
-
 typedef struct tagIPADDRESS_INFO
 {
 	BYTE LowerLimit[4];
diff --git a/include/k32obj.h b/include/k32obj.h
index 281b3ed..5294144 100644
--- a/include/k32obj.h
+++ b/include/k32obj.h
@@ -8,7 +8,7 @@
 #define __WINE_K32OBJ_H
 
 #include "wintypes.h"
-#include "windows.h"
+#include "winbase.h" /* SECURITY_ATTRIBUTES */
 
 /* Object types */
 typedef enum
diff --git a/include/libres.h b/include/libres.h
index d70ef87..6b1e57d 100644
--- a/include/libres.h
+++ b/include/libres.h
@@ -5,7 +5,6 @@
 #define __WINE_LIBRES_H
 
 #include "wintypes.h"
-#include "resource.h"
 
 extern HRSRC32 LIBRES_FindResource( HINSTANCE32 hModule, LPCWSTR name, LPCWSTR type );
 extern HGLOBAL32 LIBRES_LoadResource( HINSTANCE32 hModule, HRSRC32 hRsrc );
diff --git a/include/lzexpand.h b/include/lzexpand.h
index fb605ab..e3198fb 100644
--- a/include/lzexpand.h
+++ b/include/lzexpand.h
@@ -7,7 +7,7 @@
 #ifndef __WINE_LZEXPAND_H
 #define __WINE_LZEXPAND_H
 
-#include "winbase.h"
+#include "wintypes.h"
 
 #define LZERROR_BADINHANDLE	-1	/* -1 */
 #define LZERROR_BADOUTHANDLE	-2	/* -2 */
diff --git a/include/mdi.h b/include/mdi.h
index b66a516..074d458 100644
--- a/include/mdi.h
+++ b/include/mdi.h
@@ -9,7 +9,7 @@
 #ifndef __WINE_MDI_H
 #define __WINE_MDI_H
 
-#include "windows.h"
+#include "wintypes.h"
 
 #define MDI_MAXLISTLENGTH	0x40
 #define MDI_MAXTITLELENGTH	0xA1
diff --git a/include/message.h b/include/message.h
index 0a6b7ad..63b3259 100644
--- a/include/message.h
+++ b/include/message.h
@@ -9,7 +9,6 @@
 
 #include "win.h"
 #include "queue.h"
-#include "wintypes.h"
 
 extern DWORD MSG_WineStartTicks;  /* Ticks at Wine startup */
 
diff --git a/include/metafile.h b/include/metafile.h
index c674718..f334465 100644
--- a/include/metafile.h
+++ b/include/metafile.h
@@ -7,7 +7,8 @@
 #ifndef __WINE_METAFILE_H
 #define __WINE_METAFILE_H
 
-#include "windows.h"
+#include "wingdi.h"
+#include "gdi.h"
 
 #define MFHEADERSIZE (sizeof(METAHEADER))
 #define MFVERSION 0x300
diff --git a/include/metafiledrv.h b/include/metafiledrv.h
index d62f422..9686516 100644
--- a/include/metafiledrv.h
+++ b/include/metafiledrv.h
@@ -5,7 +5,7 @@
 #ifndef __WINE_METAFILEDRV_H
 #define __WINE_METAFILEDRV_H
 
-#include "windows.h"
+#include "wingdi.h"
 #include "gdi.h"
 
 /* FIXME: SDK docs says these should be 1 and 2 */
diff --git a/include/miscemu.h b/include/miscemu.h
index 49992a6..d7a1846 100644
--- a/include/miscemu.h
+++ b/include/miscemu.h
@@ -7,7 +7,6 @@
 #ifndef __WINE_MISCEMU_H
 #define __WINE_MISCEMU_H
 
-#include <stdio.h>
 #include "winnt.h"
 #include "ldt.h"
 
diff --git a/include/mmreg.h b/include/mmreg.h
index b54994b..d39bfd8 100644
--- a/include/mmreg.h
+++ b/include/mmreg.h
@@ -2,7 +2,6 @@
  *      mmreg.h   -       Declarations for ???
  */
 
-#include "wintypes.h"
 
 /***********************************************************************
  * Defines/Enums
@@ -11,6 +10,8 @@
 #ifndef _ACM_WAVEFILTER
 #define _ACM_WAVEFILTER
 
+#include "wintypes.h"
+
 #define WAVE_FILTER_UNKNOWN     0x0000
 #define WAVE_FILTER_DEVELOPMENT 0xFFFF
 
diff --git a/include/module.h b/include/module.h
index a851e71..5589422 100644
--- a/include/module.h
+++ b/include/module.h
@@ -7,9 +7,9 @@
 #ifndef __WINE_MODULE_H
 #define __WINE_MODULE_H
 
+#include "wintypes.h"
 #include "dosexe.h"
 #include "pe_image.h"
-#include "wintypes.h"
 
   /* In-memory module structure. See 'Windows Internals' p. 219 */
 typedef struct _NE_MODULE
diff --git a/include/msdos.h b/include/msdos.h
index 82549e9..052cffa 100644
--- a/include/msdos.h
+++ b/include/msdos.h
@@ -1,11 +1,8 @@
 #ifndef __WINE_MSDOS_H
 #define __WINE_MSDOS_H
 
-#include <sys/types.h>
-#include <dirent.h>
-#include "windows.h"
-#include "comm.h"
 #include "winnt.h"
+#include "comm.h"
 
 struct fcb {
         BYTE drive;
diff --git a/include/ntdll.h b/include/ntdll.h
index ccc3649..2fb7a08 100644
--- a/include/ntdll.h
+++ b/include/ntdll.h
@@ -9,8 +9,6 @@
 
 #include "winbase.h"
 
-/* assumes windows.h already included */
-
 #ifdef __cplusplus
 extern "C" {
 #endif
diff --git a/include/ole.h b/include/ole.h
index f624620..a71dfe5 100644
--- a/include/ole.h
+++ b/include/ole.h
@@ -5,7 +5,7 @@
 #ifndef __WINE_OLE_H
 #define __WINE_OLE_H
 
-#include "wingdi.h"
+#include "wingdi.h" /* LOGPALETTE */
 
 /* FIXME: we need to include wtypes.h mainly, it seems, because we need BSTR. 
  * Normally none of the APIs in ole.h depend on it. It is most likey that they should 
diff --git a/include/ole2.h b/include/ole2.h
index 3acb26e..2bf8720 100644
--- a/include/ole2.h
+++ b/include/ole2.h
@@ -5,8 +5,8 @@
 #ifndef __WINE_OLE2_H
 #define __WINE_OLE2_H
 
-#include "oleidl.h"
 #include "wintypes.h"
+#include "oleidl.h"
 
 /* OLE version */
 #define rmm             23
diff --git a/include/pe_image.h b/include/pe_image.h
index d0ea88d..88084d8 100644
--- a/include/pe_image.h
+++ b/include/pe_image.h
@@ -1,11 +1,9 @@
 #ifndef __WINE_PE_IMAGE_H
 #define __WINE_PE_IMAGE_H
 
-#include <sys/types.h>
-#include "windows.h"
-#include "winnt.h"
+#include "wintypes.h"
+#include "winbase.h"
 #include "peexe.h"
-
 /* modreference used for attached processes
  * all section are calculated here, relocations etc.
  */
diff --git a/include/peexe.h b/include/peexe.h
index 2a728ee..fce3669 100644
--- a/include/peexe.h
+++ b/include/peexe.h
@@ -5,7 +5,6 @@
 #define __WINE_PEEXE_H
 
 #include "wintypes.h"
-#include "neexe.h"
 
 typedef struct _IMAGE_FILE_HEADER {
 	WORD	Machine;			/* 00 */
diff --git a/include/process.h b/include/process.h
index f24e8d7..6f323ce 100644
--- a/include/process.h
+++ b/include/process.h
@@ -7,9 +7,7 @@
 #ifndef __WINE_PROCESS_H
 #define __WINE_PROCESS_H
 
-#include "windows.h"
-#include "winbase.h"
-#include "winnt.h"
+#include "wintypes.h"
 #include "module.h"
 #include "k32obj.h"
 
diff --git a/include/progress.h b/include/progress.h
index e269810..2d506f2 100644
--- a/include/progress.h
+++ b/include/progress.h
@@ -7,9 +7,6 @@
 #ifndef __WINE_PROGRESS_H
 #define __WINE_PROGRESS_H
 
-#include "windows.h"
-#include "commctrl.h"
-
 typedef struct
 {
   INT32       CurVal;       /* Current progress value */
diff --git a/include/prsht.h b/include/prsht.h
index 21dae92..6a8472f 100644
--- a/include/prsht.h
+++ b/include/prsht.h
@@ -1,6 +1,7 @@
 #ifndef _WINE_PRSHT_H
 #define _WINE_PRSHT_H
 
+#include "winuser.h"
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/include/psdrv.h b/include/psdrv.h
index cfc6c34..110e1db 100644
--- a/include/psdrv.h
+++ b/include/psdrv.h
@@ -6,7 +6,7 @@
  *
  *	Copyright 1998  Huw D M Davies
  */
-#include "windows.h"
+#include "wingdi.h"
 #include "font.h"
 #include "pen.h"
 #include "brush.h"
diff --git a/include/queue.h b/include/queue.h
index 5762fe0..8a9836b 100644
--- a/include/queue.h
+++ b/include/queue.h
@@ -7,8 +7,8 @@
 #ifndef __WINE_QUEUE_H
 #define __WINE_QUEUE_H
 
+#include "wintypes.h"
 #include "wine/winuser16.h"
-#include "windows.h"
 #include "thread.h"
 
 
diff --git a/include/region.h b/include/region.h
index 2d7be11..d296f48 100644
--- a/include/region.h
+++ b/include/region.h
@@ -54,7 +54,7 @@
 #ifndef __WINE_REGION_H
 #define __WINE_REGION_H
 
-#include "windows.h"
+#include "wingdi.h"
 #include "gdi.h"
 
 
diff --git a/include/resource.h b/include/resource.h
index 430763c..fdda758 100644
--- a/include/resource.h
+++ b/include/resource.h
@@ -7,8 +7,6 @@
 #ifndef __WINE_RESOURCE_H
 #define __WINE_RESOURCE_H
 
-#include "windows.h"
-
 #ifndef __WRC_RSC_H
 #include "wrc_rsc.h"
 #endif
diff --git a/include/scroll.h b/include/scroll.h
index 2b8df75..eace4bb 100644
--- a/include/scroll.h
+++ b/include/scroll.h
@@ -8,7 +8,7 @@
 #ifndef __WINE_SCROLL_H
 #define __WINE_SCROLL_H
 
-#include "windows.h"
+#include "wintypes.h"
 
 typedef struct
 {
diff --git a/include/shell.h b/include/shell.h
index 0ccd1df..b6f488f 100644
--- a/include/shell.h
+++ b/include/shell.h
@@ -4,9 +4,8 @@
 #ifndef __WINE_SHELL_H
 #define __WINE_SHELL_H
 
-#include "windows.h"
-#include "winreg.h"
-#include "imagelist.h"
+#include "wintypes.h"
+#include "windef.h"
 
 
 /****************************************************************************
diff --git a/include/shlobj.h b/include/shlobj.h
index 5d08598..90469ac 100644
--- a/include/shlobj.h
+++ b/include/shlobj.h
@@ -1,14 +1,12 @@
 #ifndef __WINE_SHLOBJ_H
 #define __WINE_SHLOBJ_H
 
+#include "wintypes.h"
 #include "wine/obj_base.h"
 #include "shell.h"
-#include "ole.h"
-#include "ole2.h"
 #include "oleobj.h"
 #include "commctrl.h"
 #include "prsht.h"
-#include "wintypes.h"
 
 #define STDMETHOD(xfn) HRESULT (CALLBACK *fn##xfn)
 #define STDMETHOD_(type,xfn) type (CALLBACK *fn##xfn)
diff --git a/include/stackframe.h b/include/stackframe.h
index 24cad98..0326abd 100644
--- a/include/stackframe.h
+++ b/include/stackframe.h
@@ -7,8 +7,6 @@
 #ifndef __WINE_STACKFRAME_H
 #define __WINE_STACKFRAME_H
 
-#include <string.h>
-#include "windows.h"
 #include "ldt.h"
 #include "thread.h"
 
diff --git a/include/static.h b/include/static.h
index f29dd7b..54484bf 100644
--- a/include/static.h
+++ b/include/static.h
@@ -7,7 +7,7 @@
 #ifndef __WINE_STATIC_H
 #define __WINE_STATIC_H
 
-#include "windows.h"
+#include "wintypes.h"
 
   /* Extra info for STATIC windows */
 typedef struct
diff --git a/include/stress.h b/include/stress.h
index f38857e..6f955b6 100644
--- a/include/stress.h
+++ b/include/stress.h
@@ -1,7 +1,7 @@
 #ifndef __WINE_STRESS_H
 #define __WINE_STRESS_H
 
-#include <windows.h>
+#include <wintypes.h>
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/include/struct32.h b/include/struct32.h
index 71dc16c..f714588 100644
--- a/include/struct32.h
+++ b/include/struct32.h
@@ -1,7 +1,8 @@
 /* Structure definitions for Win32 -- used only internally */
 #ifndef __WINE__STRUCT32_H
 #define __WINE__STRUCT32_H
-#include "windows.h"
+
+#include "winbase.h"
 #include "queue.h"
 
 extern void STRUCT32_MINMAXINFO32to16( const MINMAXINFO32*, MINMAXINFO16* );
diff --git a/include/sysmetrics.h b/include/sysmetrics.h
index bfb6cf3..24d7307 100644
--- a/include/sysmetrics.h
+++ b/include/sysmetrics.h
@@ -7,9 +7,7 @@
 #ifndef __WINE_SYSMETRICS_H
 #define __WINE_SYSMETRICS_H
 
-#include "windows.h"
-
-
+#include "wingdi.h"
   /* Constant system metrics */
 #if 0
 #ifdef WIN_95_LOOK
diff --git a/include/thread.h b/include/thread.h
index 1238664..8832361 100644
--- a/include/thread.h
+++ b/include/thread.h
@@ -9,7 +9,6 @@
 
 #include "config.h"
 #include "k32obj.h"
-#include "windows.h"
 #include "winbase.h"
 #include "winnt.h"
 #include "selectors.h"  /* for SET_FS */
diff --git a/include/tlhelp32.h b/include/tlhelp32.h
index b8b798a..b28d4cc 100644
--- a/include/tlhelp32.h
+++ b/include/tlhelp32.h
@@ -1,7 +1,7 @@
 #ifndef __WINE_TLHELP32_H
 #define __WINE_TLHELP32_H
 
-#include "windows.h"
+#include "wintypes.h"
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/include/toolhelp.h b/include/toolhelp.h
index 8b422a9..1286d3d 100644
--- a/include/toolhelp.h
+++ b/include/toolhelp.h
@@ -1,7 +1,7 @@
 #ifndef __WINE_TOOLHELP_H
 #define __WINE_TOOLHELP_H
 
-#include "windows.h"
+#include "windef.h"
 #include "tlhelp32.h"
 
 #define MAX_DATA	11
diff --git a/include/updown.h b/include/updown.h
index 6256f19..dbb597c 100644
--- a/include/updown.h
+++ b/include/updown.h
@@ -7,9 +7,6 @@
 #ifndef __WINE_UPDOWN_H
 #define __WINE_UPDOWN_H
 
-#include "windows.h"
-#include "commctrl.h"
-
 typedef struct
 {
   UINT32      AccelCount;   /* Number of elements in AccelVect */
diff --git a/include/ver.h b/include/ver.h
index 04802c5..f0bab9d 100644
--- a/include/ver.h
+++ b/include/ver.h
@@ -5,7 +5,7 @@
 #ifndef __WINE_VER_H
 #define __WINE_VER_H
 
-#include "windows.h"
+#include "wintypes.h"
 
 /* resource ids for different version infos */
 #define	VS_FILE_INFO	MAKEINTRESOURCE16(16)
diff --git a/include/vfw.h b/include/vfw.h
index 6375419..1bad215 100644
--- a/include/vfw.h
+++ b/include/vfw.h
@@ -1,9 +1,10 @@
 #ifndef __WINE_VFW_H
 #define __WINE_VFW_H
 
-#include <wintypes.h>
-#include <driver.h>
-#include <objbase.h>
+#include "wintypes.h"
+#include "wingdi.h"
+#include "driver.h"
+#include "objbase.h"
 
 #define VFWAPI	WINAPI
 #define VFWAPIV	WINAPIV
diff --git a/include/win.h b/include/win.h
index 5fe5431..fad6676 100644
--- a/include/win.h
+++ b/include/win.h
@@ -7,12 +7,8 @@
 #ifndef __WINE_WIN_H
 #define __WINE_WIN_H
 
-#include "class.h"
-#include "ldt.h"
-#include "windows.h"
-#include "winproc.h"
 #include "queue.h"
-
+#include "class.h"
 
 #define WND_MAGIC     0x444e4957  /* 'WIND' */
 
diff --git a/include/win16drv.h b/include/win16drv.h
index 8ff174b..8f943e8 100644
--- a/include/win16drv.h
+++ b/include/win16drv.h
@@ -5,7 +5,7 @@
 #ifndef __WINE_WIN16DRV_H
 #define __WINE_WIN16DRV_H
 
-#include "windows.h"
+#include "wingdi.h"
 #include "gdi.h"
 
 #define SETHIGHBIT 
diff --git a/include/wine/obj_moniker.h b/include/wine/obj_moniker.h
index e42c480..91565dd 100644
--- a/include/wine/obj_moniker.h
+++ b/include/wine/obj_moniker.h
@@ -5,11 +5,11 @@
  */
 
 
-#include "wine/obj_misc.h"
 
 #ifndef __WINE_WINE_OBJ_MONIKER_H
 #define __WINE_WINE_OBJ_MONIKER_H
 
+#include "wine/obj_misc.h"
 /*****************************************************************************
  * Predeclare the interfaces
  */
diff --git a/include/wine/w32skrnl.h b/include/wine/w32skrnl.h
index e5dd128..5bc98ba 100644
--- a/include/wine/w32skrnl.h
+++ b/include/wine/w32skrnl.h
@@ -1,7 +1,6 @@
 #ifndef _W32SKRNL_H
 #define _W32SKRNL_H
 #include "wintypes.h"
-HTASK16     WINAPI GetCurrentTask(void);
 LPSTR WINAPI GetWin32sDirectory(void);
 DWORD WINAPI RtlNtStatusToDosError(DWORD error);
 #endif /* _W32SKRNL_H */
diff --git a/include/wine/winbase16.h b/include/wine/winbase16.h
index 1c9f9d1..00c28db 100644
--- a/include/wine/winbase16.h
+++ b/include/wine/winbase16.h
@@ -56,6 +56,7 @@
 HANDLE16    WINAPI GetCodeHandle(FARPROC16);
 VOID        WINAPI GetCodeInfo(FARPROC16,SEGINFO*);
 DWORD       WINAPI GetCurrentPDB(void);
+HTASK16     WINAPI GetCurrentTask(void);
 SEGPTR      WINAPI GetDOSEnvironment(void);
 HMODULE16   WINAPI GetExePtr(HANDLE16);
 WORD        WINAPI GetExeVersion(void);
diff --git a/include/wine/winestring.h b/include/wine/winestring.h
index 298ed8f..ee01331 100644
--- a/include/wine/winestring.h
+++ b/include/wine/winestring.h
@@ -1,5 +1,8 @@
 #ifndef _INCLUDE_WINE_STRINGS_H
 #define _INCLUDE_WINE_STRINGS_H
+
+#include "wintypes.h"
+
 INT16       WINAPI WideCharToLocal16(LPSTR,LPWSTR,INT16);
 INT32       WINAPI WideCharToLocal32(LPSTR,LPWSTR,INT32);
 #define			WideCharToLocal WINELIB_NAME(WideCharToLocal)
diff --git a/include/winsock.h b/include/winsock.h
index 13c9b0e..6961d96 100644
--- a/include/winsock.h
+++ b/include/winsock.h
@@ -26,7 +26,7 @@
 # define HAVE_IPX
 #endif
 
-#include "windows.h"
+#include "wintypes.h"
 #include "task.h"
 
 #pragma pack(1)
diff --git a/include/winspool.h b/include/winspool.h
index 87ff118..99dc631 100644
--- a/include/winspool.h
+++ b/include/winspool.h
@@ -8,7 +8,9 @@
 #ifndef __WINE_WINSPOOL_H
 #define __WINE_WINSPOOL_H
 
-#include "windows.h"
+#include "wintypes.h"
+#include "winbase.h"
+#include "wingdi.h"
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/include/winver.h b/include/winver.h
index 0fae9b8..a489eb7 100644
--- a/include/winver.h
+++ b/include/winver.h
@@ -1,6 +1,8 @@
 #ifndef __WINE_WINVER_H
 #define __WINE_WINVER_H
 
+#include "wintypes.h"
+
 DWORD       WINAPI VerFindFile16(UINT16,LPCSTR,LPCSTR,LPCSTR,LPSTR,UINT16*,LPSTR,UINT16*);
 DWORD       WINAPI VerFindFile32A(UINT32,LPCSTR,LPCSTR,LPCSTR,LPSTR,UINT32*,LPSTR,UINT32*);
 DWORD       WINAPI VerFindFile32W(UINT32,LPCWSTR,LPCWSTR,LPCWSTR,LPWSTR,UINT32*,LPWSTR,UINT32*);
diff --git a/loader/dos/dosvm.c b/loader/dos/dosvm.c
index 0cf2990..59094bf 100644
--- a/loader/dos/dosvm.c
+++ b/loader/dos/dosvm.c
@@ -16,8 +16,8 @@
 #include <sys/time.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include "windows.h"
-#include "winbase.h"
+
+#include "wine/winbase16.h"
 #include "winnt.h"
 #include "sig_context.h"
 #include "msdos.h"
diff --git a/loader/dos/module.c b/loader/dos/module.c
index 6a11fdc..7de55e4 100644
--- a/loader/dos/module.c
+++ b/loader/dos/module.c
@@ -16,9 +16,11 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/time.h>
-#include "windows.h"
-#include "winbase.h"
+#include "windef.h"
+#include "wine/winbase16.h"
 #include "module.h"
+#include "peexe.h"
+#include "neexe.h"
 #include "task.h"
 #include "selectors.h"
 #include "file.h"
diff --git a/loader/elf.c b/loader/elf.c
index 395f603..9214beb 100644
--- a/loader/elf.c
+++ b/loader/elf.c
@@ -19,6 +19,7 @@
 #include "windows.h"
 #include "snoop.h"
 #include "process.h"
+#include "neexe.h"
 #include "peexe.h"
 #include "heap.h"
 #include "pe_image.h"
diff --git a/loader/libres.c b/loader/libres.c
index 3579b0a..081d095 100644
--- a/loader/libres.c
+++ b/loader/libres.c
@@ -5,8 +5,9 @@
  */
 
 #include <stdlib.h>
-#include "debug.h"
 #include "libres.h"
+#include "resource.h"
+#include "debug.h"
 #include "heap.h"
 #include "windows.h"
 #include "xmalloc.h"
diff --git a/loader/main.c b/loader/main.c
index fd32ab2..062319b 100644
--- a/loader/main.c
+++ b/loader/main.c
@@ -9,9 +9,10 @@
 #include <unistd.h>
 #include <string.h>
 #include <errno.h>
-#include "windows.h"
+#include "wine/winbase16.h"
 #include "bitmap.h"
 #include "comm.h"
+#include "neexe.h"
 #include "win.h"
 #include "main.h"
 #include "menu.h"
diff --git a/loader/module.c b/loader/module.c
index d4b67dc..802a6ac 100644
--- a/loader/module.c
+++ b/loader/module.c
@@ -11,6 +11,7 @@
 #include <sys/types.h>
 #include <unistd.h>
 #include "wine/winuser16.h"
+#include "wine/winbase16.h"
 #include "winerror.h"
 #include "class.h"
 #include "file.h"
@@ -22,7 +23,6 @@
 #include "dosexe.h"
 #include "process.h"
 #include "thread.h"
-#include "resource.h"
 #include "selectors.h"
 #include "stackframe.h"
 #include "task.h"
diff --git a/loader/ne/convert.c b/loader/ne/convert.c
index 0d201e6..a342072 100644
--- a/loader/ne/convert.c
+++ b/loader/ne/convert.c
@@ -4,10 +4,10 @@
  * Copyright 1998 Ulrich Weigand
  */
 
+#include "wine/winuser16.h"
 #include "module.h"
 #include "debug.h"
 #include "debugtools.h"
-#include "windows.h"
 
 /**********************************************************************
  *	    ConvertDialog32To16   (KERNEL.615)
diff --git a/loader/ne/module.c b/loader/ne/module.c
index 7fdc0dd..0ab4003 100644
--- a/loader/ne/module.c
+++ b/loader/ne/module.c
@@ -9,7 +9,11 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include "wine/winbase16.h"
 #include "module.h"
+#include "neexe.h"
+#include "peexe.h"
+#include "toolhelp.h"
 #include "file.h"
 #include "ldt.h"
 #include "callback.h"
diff --git a/loader/ne/resource.c b/loader/ne/resource.c
index e48cdf7..06e740d 100644
--- a/loader/ne/resource.c
+++ b/loader/ne/resource.c
@@ -13,7 +13,8 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <unistd.h>
-#include "windows.h"
+#include "windef.h"
+#include "wine/winbase16.h"
 #include "global.h"
 #include "ldt.h"
 #include "module.h"
diff --git a/loader/ne/segment.c b/loader/ne/segment.c
index b452266..0fd0605 100644
--- a/loader/ne/segment.c
+++ b/loader/ne/segment.c
@@ -15,8 +15,9 @@
 #include <ctype.h>
 #include <string.h>
 #include <errno.h>
+
+#include "wine/winbase16.h"
 #include "neexe.h"
-#include "windows.h"
 #include "global.h"
 #include "task.h"
 #include "selectors.h"
diff --git a/loader/resource.c b/loader/resource.c
index 1675cad..082bbff 100644
--- a/loader/resource.c
+++ b/loader/resource.c
@@ -22,7 +22,6 @@
 #include "process.h"
 #include "module.h"
 #include "file.h"
-#include "resource.h"
 #include "debug.h"
 #include "libres.h"
 #include "winerror.h"
diff --git a/loader/task.c b/loader/task.c
index 0f0e0d4..3bb95ad 100644
--- a/loader/task.c
+++ b/loader/task.c
@@ -9,7 +9,7 @@
 #include <assert.h>
 #include <unistd.h>
 
-#include "windows.h"
+#include "wine/winbase16.h"
 #include "user.h"
 #include "callback.h"
 #include "drive.h"
diff --git a/memory/atom.c b/memory/atom.c
index 6ef828f..28d4f4f 100644
--- a/memory/atom.c
+++ b/memory/atom.c
@@ -16,6 +16,7 @@
 #include <string.h>
 #include <ctype.h>
 
+#include "winuser.h"
 #include "instance.h"
 #include "ldt.h"
 #include "stackframe.h"
diff --git a/memory/environ.c b/memory/environ.c
index 7fa1024..ab77b12 100644
--- a/memory/environ.c
+++ b/memory/environ.c
@@ -7,6 +7,8 @@
 #include <assert.h>
 #include <stdlib.h>
 #include <string.h>
+#include "winuser.h"
+#include "wine/winestring.h"
 #include "process.h"
 #include "heap.h"
 #include "selectors.h"
diff --git a/misc/commdlg.c b/misc/commdlg.c
index 762a35f..41f589e 100644
--- a/misc/commdlg.c
+++ b/misc/commdlg.c
@@ -8,14 +8,15 @@
 #include <ctype.h>
 #include <stdlib.h>
 #include <string.h>
+#include "wine/winbase16.h"
 #include "win.h"
 #include "heap.h"
 #include "message.h"
 #include "commdlg.h"
+#include "resource.h"
 #include "dialog.h"
 #include "dlgs.h"
 #include "module.h"
-#include "resource.h"
 #include "drive.h"
 #include "debug.h"
 #include "font.h"
diff --git a/misc/printdrv.c b/misc/printdrv.c
index b201f8e..857e312 100644
--- a/misc/printdrv.c
+++ b/misc/printdrv.c
@@ -8,12 +8,11 @@
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
-#include "windows.h"
-#include "win.h"
+#include "winspool.h"
+#include "ldt.h"
 #include "winerror.h"
 #include "winreg.h"
 #include "debug.h"
-#include "winspool.h"
 
 static char PrinterModel[]	= "Printer Model";
 static char DefaultDevMode[]	= "Default DevMode";
diff --git a/misc/shell.c b/misc/shell.c
index 18090d0..0ae8fc16 100644
--- a/misc/shell.c
+++ b/misc/shell.c
@@ -9,17 +9,19 @@
 #include <unistd.h>
 #include <ctype.h>
 #include "wine/winuser16.h"
+#include "wine/winbase16.h"
+#include "wine/shell16.h"
 #include "winerror.h"
 #include "file.h"
 #include "shell.h"
 #include "heap.h"
 #include "module.h"
 #include "neexe.h"
-#include "resource.h"
 #include "dlgs.h"
 #include "win.h"
 #include "cursoricon.h"
 #include "sysmetrics.h"
+#include "shellapi.h"
 #include "shlobj.h"
 #include "debug.h"
 #include "winreg.h"
diff --git a/misc/spy.c b/misc/spy.c
index e9682bd..44ccd59 100644
--- a/misc/spy.c
+++ b/misc/spy.c
@@ -8,6 +8,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include "wine/winuser16.h"
+#include "wine/winbase16.h"
 #include "win.h"
 #include "module.h"
 #include "options.h"
diff --git a/misc/stress.c b/misc/stress.c
index 7a7f9f4..db380ea 100644
--- a/misc/stress.c
+++ b/misc/stress.c
@@ -1,5 +1,4 @@
 #include <limits.h>
-#include "windows.h"
 #include "stress.h"
 #include "debug.h"
 
diff --git a/misc/version.c b/misc/version.c
index 2039e40..0c8b2f0 100644
--- a/misc/version.c
+++ b/misc/version.c
@@ -15,6 +15,7 @@
 #include "options.h"
 #include "debug.h"
 #include "ole.h"
+#include "neexe.h"
 #include "winversion.h"
 
 typedef struct
diff --git a/miscemu/main.c b/miscemu/main.c
index 42e6f42..05cd714 100644
--- a/miscemu/main.c
+++ b/miscemu/main.c
@@ -4,19 +4,19 @@
  */
 
 #include <assert.h>
+#include "wine/winbase16.h"
 #include "callback.h"
-#include "debug.h"
 #include "debugger.h"
 #include "main.h"
 #include "miscemu.h"
+#include "win16drv.h"
 #include "module.h"
 #include "options.h"
 #include "process.h"
-#include "win16drv.h"
 #include "thread.h"
 #include "task.h"
 #include "stackframe.h"
-#include "windows.h"
+#include "debug.h"
 
 static int MAIN_argc;
 static char **MAIN_argv;
diff --git a/msdos/int2f.c b/msdos/int2f.c
index c8455f7..ffb415a 100644
--- a/msdos/int2f.c
+++ b/msdos/int2f.c
@@ -11,6 +11,7 @@
 #include <string.h>
 #include <unistd.h>
 
+#include "wine/winbase16.h"
 #include "ldt.h"
 #include "drive.h"
 #include "msdos.h"
diff --git a/msdos/int41.c b/msdos/int41.c
index 4ba588e..85c4e26 100644
--- a/msdos/int41.c
+++ b/msdos/int41.c
@@ -4,6 +4,7 @@
  * Check debugsys.inc from the DDK for docu.
  */
 
+#include <stdio.h>
 #include "miscemu.h"
 
 /***********************************************************************
diff --git a/msdos/int4b.c b/msdos/int4b.c
index 6157547..34e2085 100644
--- a/msdos/int4b.c
+++ b/msdos/int4b.c
@@ -2,6 +2,7 @@
  * DOS interrupt 4bh handler
  */
 
+#include <stdio.h>
 #include "miscemu.h"
 
 /***********************************************************************
diff --git a/msdos/vxd.c b/msdos/vxd.c
index 8022a54..10c569b 100644
--- a/msdos/vxd.c
+++ b/msdos/vxd.c
@@ -12,6 +12,7 @@
 #include "miscemu.h"
 #include "selectors.h"
 #include "module.h"
+#include "neexe.h"
 #include "task.h"
 #include "process.h"
 #include "file.h"
diff --git a/multimedia/dsound.c b/multimedia/dsound.c
index 9c5ec66..81d3fad 100644
--- a/multimedia/dsound.c
+++ b/multimedia/dsound.c
@@ -61,10 +61,9 @@
 #include <stdlib.h>
 #include <string.h>
 #include <math.h>	/* Insomnia - pow() function */
-#include "windows.h"
+#include "dsound.h"
 #include "winerror.h"
 #include "multimedia.h"
-#include "dsound.h"
 #include "objbase.h"
 #include "thread.h"
 #include "debug.h"
diff --git a/multimedia/mmsystem.c b/multimedia/mmsystem.c
index 7741236..8c505f9 100644
--- a/multimedia/mmsystem.c
+++ b/multimedia/mmsystem.c
@@ -21,6 +21,9 @@
 #include <fcntl.h>
 #include <errno.h>
 #include <sys/ioctl.h>
+
+#include "windef.h"
+#include "wine/winbase16.h"
 #include "wine/winuser16.h"
 #include "win.h"
 #include "heap.h"
diff --git a/objects/bitmap.c b/objects/bitmap.c
index bb55e28..9e09fcc 100644
--- a/objects/bitmap.c
+++ b/objects/bitmap.c
@@ -7,6 +7,8 @@
 
 #include <stdlib.h>
 #include <string.h>
+
+#include "wine/winbase16.h"
 #include "gdi.h"
 #include "dc.h"
 #include "bitmap.h"
diff --git a/objects/brush.c b/objects/brush.c
index c46ef4e..f460f2b 100644
--- a/objects/brush.c
+++ b/objects/brush.c
@@ -5,6 +5,7 @@
  */
 
 #include <stdlib.h>
+#include "winbase.h"
 #include "brush.h"
 #include "bitmap.h"
 #include "debug.h"
diff --git a/objects/font.c b/objects/font.c
index e98ac86..c4dfc53 100644
--- a/objects/font.c
+++ b/objects/font.c
@@ -7,6 +7,7 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include "wine/winestring.h"
 #include "font.h"
 #include "heap.h"
 #include "metafile.h"
diff --git a/objects/metafile.c b/objects/metafile.c
index 7cf534c..1da0384 100644
--- a/objects/metafile.c
+++ b/objects/metafile.c
@@ -8,13 +8,12 @@
 
 #include <string.h>
 #include <fcntl.h>
-#include "windows.h"
-#include "gdi.h"
+#include "wine/winbase16.h"
+#include "metafiledrv.h"
+#include "metafile.h"
 #include "bitmap.h"
 #include "file.h"
 #include "heap.h"
-#include "metafile.h"
-#include "metafiledrv.h"
 #include "toolhelp.h"
 #include "debug.h"
 
diff --git a/objects/region.c b/objects/region.c
index 732dbba..7f53e9d 100644
--- a/objects/region.c
+++ b/objects/region.c
@@ -81,6 +81,7 @@
  */
 
 #include "region.h"
+#include "winuser.h"
 #include "debug.h"
 #include "heap.h"
 #include "dc.h"
diff --git a/ole/ifs.c b/ole/ifs.c
index ed8d918..e092824 100644
--- a/ole/ifs.c
+++ b/ole/ifs.c
@@ -11,6 +11,7 @@
 #include "winerror.h"
 #include "ldt.h"
 #include "heap.h"
+#include "wine/winbase16.h"
 #include "wine/obj_base.h"
 #include "objbase.h"
 #include "local.h"
diff --git a/ole/ole2nls.c b/ole/ole2nls.c
index d18d33e..ae55e93 100644
--- a/ole/ole2nls.c
+++ b/ole/ole2nls.c
@@ -8,7 +8,7 @@
 #include <string.h>
 #include <ctype.h>
 #include <stdlib.h>
-#include "windows.h"
+#include "winuser.h"
 #include "heap.h"
 #include "ole.h"
 #include "options.h"
diff --git a/relay32/builtin32.c b/relay32/builtin32.c
index e5bea37..50442bd 100644
--- a/relay32/builtin32.c
+++ b/relay32/builtin32.c
@@ -6,9 +6,11 @@
 
 #include <assert.h>
 #include <string.h>
+#include <ctype.h>
 #include "winuser.h"
 #include "builtin32.h"
 #include "peexe.h"
+#include "neexe.h"
 #include "heap.h"
 #include "debug.h"
 #include "main.h"
diff --git a/relay32/snoop.c b/relay32/snoop.c
index 216ccd4..b09dea3 100644
--- a/relay32/snoop.c
+++ b/relay32/snoop.c
@@ -6,12 +6,14 @@
 
 
 #include <assert.h>
+#include <string.h>
 #include "windows.h"
 #include "winbase.h"
 #include "winnt.h"
 #include "heap.h"
 #include "builtin32.h"
 #include "snoop.h"
+#include "neexe.h"
 #include "peexe.h"
 #include "selectors.h"
 #include "stackframe.h"
diff --git a/scheduler/client.c b/scheduler/client.c
index 81e6b40..6c0aa23 100644
--- a/scheduler/client.c
+++ b/scheduler/client.c
@@ -13,6 +13,7 @@
 #include <sys/socket.h>
 #include <sys/uio.h>
 #include <unistd.h>
+#include <stdarg.h>
 
 #include "process.h"
 #include "thread.h"
diff --git a/scheduler/process.c b/scheduler/process.c
index 10ddce3..dadf864 100644
--- a/scheduler/process.c
+++ b/scheduler/process.c
@@ -10,6 +10,7 @@
 #include <unistd.h>
 #include "process.h"
 #include "module.h"
+#include "neexe.h"
 #include "file.h"
 #include "global.h"
 #include "heap.h"
diff --git a/scheduler/thread.c b/scheduler/thread.c
index 0cd707f..4b4d1ea 100644
--- a/scheduler/thread.c
+++ b/scheduler/thread.c
@@ -7,6 +7,7 @@
 #include <assert.h>
 #include <signal.h>
 #include <unistd.h>
+#include "wine/winbase16.h"
 #include "thread.h"
 #include "process.h"
 #include "task.h"
diff --git a/win32/init.c b/win32/init.c
index 267ec4c..c2c9b5e 100644
--- a/win32/init.c
+++ b/win32/init.c
@@ -7,9 +7,9 @@
 #include <string.h>
 #include <unistd.h>
 #include <stdlib.h>
+#include "except.h"
 #include "windows.h"
 #include "winerror.h"
-#include "except.h"
 #include "heap.h"
 #include "task.h"
 #include "debug.h"
diff --git a/win32/kernel32.c b/win32/kernel32.c
index d4d7251..0b64609 100644
--- a/win32/kernel32.c
+++ b/win32/kernel32.c
@@ -10,11 +10,11 @@
 
 #include "windows.h"
 #include "callback.h"
-#include "resource.h"
 #include "task.h"
 #include "user.h"
 #include "heap.h"
 #include "module.h"
+#include "neexe.h"
 #include "process.h"
 #include "stackframe.h"
 #include "heap.h"
diff --git a/win32/struct32.c b/win32/struct32.c
index 35cc01b..6750f58 100644
--- a/win32/struct32.c
+++ b/win32/struct32.c
@@ -4,9 +4,8 @@
  * Copyright 1996 Martin von Loewis
  */
 
-#include "windows.h"
-#include "winerror.h"
 #include "struct32.h"
+#include "winerror.h"
 #include "debug.h"
 
 void STRUCT32_MSG16to32(const MSG16 *msg16,MSG32 *msg32)
diff --git a/windows/class.c b/windows/class.c
index ddd8efe..69db221 100644
--- a/windows/class.c
+++ b/windows/class.c
@@ -14,6 +14,7 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include "wine/winbase16.h"
 #include "class.h"
 #include "heap.h"
 #include "win.h"
diff --git a/windows/message.c b/windows/message.c
index 1f799f1..1723efd 100644
--- a/windows/message.c
+++ b/windows/message.c
@@ -10,6 +10,7 @@
 #include <sys/time.h>
 #include <sys/types.h>
 
+#include "wine/winbase16.h"
 #include "message.h"
 #include "winerror.h"
 #include "win.h"
diff --git a/windows/nonclient.c b/windows/nonclient.c
index 36efbdd..bf58c52 100644
--- a/windows/nonclient.c
+++ b/windows/nonclient.c
@@ -23,6 +23,7 @@
 #include "tweak.h"
 #include "debug.h"
 #include "options.h"
+#include "shellapi.h"
 #include "cache.h"
 
 static HBITMAP16 hbitmapClose = 0;
diff --git a/windows/queue.c b/windows/queue.c
index e7b44d5..0a33aa0 100644
--- a/windows/queue.c
+++ b/windows/queue.c
@@ -5,6 +5,8 @@
 
 #include <stdlib.h>
 #include <signal.h>
+#include "wine/winbase16.h"
+#include "wine/winuser16.h"
 #include "miscemu.h"
 #include "module.h"
 #include "queue.h"
diff --git a/windows/syscolor.c b/windows/syscolor.c
index d8db19c..19a597a 100644
--- a/windows/syscolor.c
+++ b/windows/syscolor.c
@@ -9,6 +9,8 @@
 #include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include "winbase.h"
+#include "winuser.h"
 #include "debug.h"
 #include "gdi.h"
 #include "tweak.h"
diff --git a/windows/sysmetrics.c b/windows/sysmetrics.c
index 6bb2cd2..37b53e2 100644
--- a/windows/sysmetrics.c
+++ b/windows/sysmetrics.c
@@ -6,6 +6,8 @@
  */
 
 #include <stdio.h>
+#include "winbase.h"
+#include "winuser.h"
 #include "gdi.h"
 #include "monitor.h"
 #include "options.h"
diff --git a/windows/user.c b/windows/user.c
index 2dd940e..5513dca 100644
--- a/windows/user.c
+++ b/windows/user.c
@@ -7,7 +7,6 @@
 
 #include <stdlib.h>
 #include "windows.h"
-#include "resource.h"
 #include "heap.h"
 #include "gdi.h"
 #include "user.h"
diff --git a/windows/win.c b/windows/win.c
index 01b2131..202b8ff 100644
--- a/windows/win.c
+++ b/windows/win.c
@@ -8,6 +8,7 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include "wine/winbase16.h"
 #include "options.h"
 #include "class.h"
 #include "win.h"