Removed some unnecessary includes.

diff --git a/debugger/debugger.h b/debugger/debugger.h
index a10daf5..6a30779 100644
--- a/debugger/debugger.h
+++ b/debugger/debugger.h
@@ -512,11 +512,16 @@
    malloc() arena (and other heaps) can be totally wasted and it'll still
    work, etc... if someone could make optimized routines so it wouldn't
    take so long to load, it could be made default) */
-#include "heap.h"
 #define DBG_alloc(x) HeapAlloc(dbg_heap,0,x)
 #define DBG_realloc(x,y) HeapRealloc(dbg_heap,0,x,y)
 #define DBG_free(x) HeapFree(dbg_heap,0,x)
-#define DBG_strdup(x) HEAP_strdupA(dbg_heap,0,x)
+inline static LPSTR DBG_strdup( LPCSTR str )
+{
+    INT len = strlen(str) + 1;
+    LPSTR p = DBG_alloc( len );
+    if (p) memcpy( p, str, len );
+    return p;
+}
 #define DBG_need_heap
 extern HANDLE dbg_heap;
 #endif
diff --git a/debugger/info.c b/debugger/info.c
index 9da31dd..8d29b4f 100644
--- a/debugger/info.c
+++ b/debugger/info.c
@@ -11,7 +11,6 @@
 #include "winbase.h"
 #include "wingdi.h"
 #include "winuser.h"
-#include "toolhelp.h"
 #include "tlhelp32.h"
 #include "debugger.h"
 #include "expr.h"
diff --git a/debugger/memory.c b/debugger/memory.c
index 416788d..5971382 100644
--- a/debugger/memory.c
+++ b/debugger/memory.c
@@ -11,7 +11,6 @@
 #include <string.h>
 
 #include "debugger.h"
-#include "miscemu.h"
 #include "winbase.h"
 
 #ifdef __i386__
diff --git a/debugger/module.c b/debugger/module.c
index 11220f9..cce20da 100644
--- a/debugger/module.c
+++ b/debugger/module.c
@@ -10,7 +10,6 @@
 #include <stdio.h>
 #include <string.h>
 #include "debugger.h"
-#include "toolhelp.h"
 #include "wingdi.h"
 #include "winuser.h"
 
diff --git a/debugger/msc.c b/debugger/msc.c
index c661ce0..63ea5f1 100644
--- a/debugger/msc.c
+++ b/debugger/msc.c
@@ -24,7 +24,8 @@
 #define PATH_MAX _MAX_PATH
 #endif
 #include "debugger.h"
-#include "file.h"
+
+#define MAX_PATHNAME_LEN 1024
 
 typedef struct
 {
diff --git a/debugger/winedbg.c b/debugger/winedbg.c
index dfc1572..ccd11d4 100644
--- a/debugger/winedbg.c
+++ b/debugger/winedbg.c
@@ -13,7 +13,6 @@
 
 #include "ntddk.h"
 #include "thread.h"
-#include "file.h"
 #include "wincon.h"
 #include "wingdi.h"
 #include "winuser.h"
diff --git a/dlls/ddraw/ddraw/hal.c b/dlls/ddraw/ddraw/hal.c
index 4be6f00..6780d4f 100644
--- a/dlls/ddraw/ddraw/hal.c
+++ b/dlls/ddraw/ddraw/hal.c
@@ -25,8 +25,6 @@
 #include "dsurface/user.h"
 #include "dsurface/hal.h"
 
-#include "options.h"
-
 DEFAULT_DEBUG_CHANNEL(ddraw);
 
 static ICOM_VTABLE(IDirectDraw7) HAL_DirectDraw_VTable;
diff --git a/dlls/ddraw/ddraw/main.c b/dlls/ddraw/ddraw/main.c
index c7aea11..d932370 100644
--- a/dlls/ddraw/ddraw/main.c
+++ b/dlls/ddraw/ddraw/main.c
@@ -20,7 +20,6 @@
 #include "ddraw.h"
 #include "d3d.h"
 #include "debugtools.h"
-#include "options.h"
 #include "bitmap.h"
 
 #include "ddraw_private.h"
diff --git a/dlls/ddraw/direct3d/main.c b/dlls/ddraw/direct3d/main.c
index 1fe95db..9012b8c 100644
--- a/dlls/ddraw/direct3d/main.c
+++ b/dlls/ddraw/direct3d/main.c
@@ -9,7 +9,6 @@
 #include "winerror.h"
 #include "ddraw.h"
 #include "d3d.h"
-#include "options.h"
 #include "debugtools.h"
 
 #include "d3d_private.h"
diff --git a/dlls/ddraw/direct3d/mesa.c b/dlls/ddraw/direct3d/mesa.c
index ea4d5b9..0187e9e 100644
--- a/dlls/ddraw/direct3d/mesa.c
+++ b/dlls/ddraw/direct3d/mesa.c
@@ -12,7 +12,6 @@
 
 #include "ddraw_private.h"
 #include "mesa_private.h"
-#include "options.h"
 
 #include "debugtools.h"
 
diff --git a/dlls/ddraw/helper.c b/dlls/ddraw/helper.c
index 8d29f15..5daed61 100644
--- a/dlls/ddraw/helper.c
+++ b/dlls/ddraw/helper.c
@@ -17,7 +17,6 @@
 #include "wine/exception.h"
 #include "ddraw_private.h"
 #include "heap.h"
-#include "options.h"
 
 #include "debugtools.h"
 
diff --git a/dlls/gdi/printdrv.c b/dlls/gdi/printdrv.c
index 74295d7..e16652f 100644
--- a/dlls/gdi/printdrv.c
+++ b/dlls/gdi/printdrv.c
@@ -25,7 +25,6 @@
 #include "debugtools.h"
 #include "gdi.h"
 #include "callback.h"
-#include "options.h"
 #include "heap.h"
 #include "file.h"
 
diff --git a/dlls/setupapi/virtcopy.c b/dlls/setupapi/virtcopy.c
index 8a4a52d..e2ac47a1 100644
--- a/dlls/setupapi/virtcopy.c
+++ b/dlls/setupapi/virtcopy.c
@@ -11,7 +11,6 @@
 #include "setupx16.h"
 #include "heap.h"
 #include "callback.h"
-#include "stackframe.h"
 #include "winreg.h"
 #include "setupapi_private.h"
 
diff --git a/dlls/ttydrv/ttydrv_main.c b/dlls/ttydrv/ttydrv_main.c
index 62733ec..c98f8da 100644
--- a/dlls/ttydrv/ttydrv_main.c
+++ b/dlls/ttydrv/ttydrv_main.c
@@ -9,7 +9,6 @@
 #include "winbase.h"
 #include "wine/winbase16.h"
 #include "gdi.h"
-#include "message.h"
 #include "user.h"
 #include "win.h"
 #include "debugtools.h"
diff --git a/dlls/winaspi/winaspi32.c b/dlls/winaspi/winaspi32.c
index cd1c7bb..4be2d43 100644
--- a/dlls/winaspi/winaspi32.c
+++ b/dlls/winaspi/winaspi32.c
@@ -13,7 +13,6 @@
 #include "aspi.h"
 #include "wnaspi32.h"
 #include "winescsi.h"
-#include "options.h"
 #include "heap.h"
 #include "debugtools.h"
 
diff --git a/dlls/wineps/bitmap.c b/dlls/wineps/bitmap.c
index 2a0fcd1..23c806f 100644
--- a/dlls/wineps/bitmap.c
+++ b/dlls/wineps/bitmap.c
@@ -5,7 +5,6 @@
  *
  */
 
-#include "gdi.h"
 #include "psdrv.h"
 #include "debugtools.h"
 #include "bitmap.h"
diff --git a/dlls/x11drv/x11drv_main.c b/dlls/x11drv/x11drv_main.c
index 02581eb..d57c2a8 100644
--- a/dlls/x11drv/x11drv_main.c
+++ b/dlls/x11drv/x11drv_main.c
@@ -63,6 +63,11 @@
 static char *desktop_geometry;
 static XVisualInfo *desktop_vi;
 
+#define IS_OPTION_TRUE(ch) \
+    ((ch) == 'y' || (ch) == 'Y' || (ch) == 't' || (ch) == 'T' || (ch) == '1')
+#define IS_OPTION_FALSE(ch) \
+    ((ch) == 'n' || (ch) == 'N' || (ch) == 'f' || (ch) == 'F' || (ch) == '0')
+
 #ifdef NO_REENTRANT_X11
 static int* (*old_errno_location)(void);
 static int* (*old_h_errno_location)(void);
diff --git a/graphics/win16drv/prtdrv.c b/graphics/win16drv/prtdrv.c
index 5b2c102..20e8b9a 100644
--- a/graphics/win16drv/prtdrv.c
+++ b/graphics/win16drv/prtdrv.c
@@ -13,11 +13,9 @@
 #include "wine/winbase16.h"
 #include "win16drv.h"
 #include "heap.h"
-#include "brush.h"
 #include "callback.h"
 #include "debugtools.h"
 #include "bitmap.h"
-#include "pen.h"
 
 DEFAULT_DEBUG_CHANNEL(win16drv);
 
diff --git a/graphics/x11drv/bitblt.c b/graphics/x11drv/bitblt.c
index ae09219..7d53f4c 100644
--- a/graphics/x11drv/bitblt.c
+++ b/graphics/x11drv/bitblt.c
@@ -18,10 +18,7 @@
 #include "winreg.h"
 #include "winuser.h"
 #include "bitmap.h"
-#include "color.h"
 #include "gdi.h"
-#include "metafile.h"
-#include "options.h"
 #include "x11drv.h"
 #include "debugtools.h"
 
@@ -523,12 +520,6 @@
 
 #endif  /* BITBLT_TEST */
 
-static inline BOOL get_bool(const char *buffer, BOOL def_value)
-{
-    if(IS_OPTION_TRUE(buffer[0])) return TRUE;
-    if(IS_OPTION_FALSE(buffer[0])) return FALSE;
-    return def_value;
-}
 
 /***********************************************************************
  *           perfect_graphics
@@ -548,7 +539,10 @@
 	{
 	    DWORD type, count = sizeof(buffer);
 	    if(!RegQueryValueExA(hkey, "PerfectGraphics", 0, &type, buffer, &count))
-		perfect = get_bool(buffer, 0);
+            {
+                char ch = buffer[0];
+                perfect = (ch == 'y' || ch == 'Y' || ch == 't' || ch == 'T' || ch == '1');
+            }
 	    RegCloseKey(hkey);
 	}
     }
diff --git a/graphics/x11drv/graphics.c b/graphics/x11drv/graphics.c
index 4cda963..6300413 100644
--- a/graphics/x11drv/graphics.c
+++ b/graphics/x11drv/graphics.c
@@ -30,9 +30,7 @@
 #include "x11font.h"
 #include "bitmap.h"
 #include "gdi.h"
-#include "metafile.h"
 #include "palette.h"
-#include "color.h"
 #include "region.h"
 #include "debugtools.h"
 
diff --git a/graphics/x11drv/oembitmap.c b/graphics/x11drv/oembitmap.c
index 17d7696..c9c42a7 100644
--- a/graphics/x11drv/oembitmap.c
+++ b/graphics/x11drv/oembitmap.c
@@ -25,7 +25,6 @@
 #include "wine/winuser16.h"
 
 #include "bitmap.h"
-#include "color.h"
 #include "cursoricon.h"
 #include "debugtools.h"
 #include "gdi.h"
diff --git a/graphics/x11drv/palette.c b/graphics/x11drv/palette.c
index def78b0..40fc866 100644
--- a/graphics/x11drv/palette.c
+++ b/graphics/x11drv/palette.c
@@ -15,7 +15,6 @@
 #include "color.h"
 #include "debugtools.h"
 #include "gdi.h"
-#include "options.h"
 #include "palette.h"
 #include "windef.h"
 #include "winreg.h"
@@ -89,12 +88,6 @@
 static BOOL X11DRV_PALETTE_CheckSysColor(COLORREF c);
 static int X11DRV_PALETTE_LookupSystemXPixel(COLORREF col);
 
-static inline BOOL get_bool(const char *buffer, BOOL def_value)
-{
-    if(IS_OPTION_TRUE(buffer[0])) return TRUE;
-    if(IS_OPTION_FALSE(buffer[0])) return FALSE;
-    return def_value;
-}
 
 /***********************************************************************
  *           COLOR_Init
@@ -130,7 +123,10 @@
 	    char buffer[20];
 	    DWORD type, count = sizeof(buffer);
 	    if(!RegQueryValueExA(hkey, "PrivateColorMap", 0, &type, buffer, &count))
-		private_color_map = get_bool(buffer, 0);
+            {
+                char ch = buffer[0];
+                private_color_map = (ch == 'y' || ch == 'Y' || ch == 't' || ch == 'T' || ch == '1');
+            }
 	    RegCloseKey(hkey);
 	}
 
diff --git a/include/loadorder.h b/include/loadorder.h
deleted file mode 100644
index 2b0c738..0000000
--- a/include/loadorder.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Module/Library loadorder
- *
- * Copyright 1999 Bertho Stultiens
- */
-
-#ifndef __WINE_LOADORDER_H
-#define __WINE_LOADORDER_H
-
-#include "windef.h"
-
-enum loadorder_type
-{
-    LOADORDER_INVALID = 0, /* Must be 0 */
-    LOADORDER_DLL,         /* Native DLLs */
-    LOADORDER_SO,          /* Native .so libraries */
-    LOADORDER_BI,          /* Built-in modules */
-    LOADORDER_NTYPES
-};
-
-extern void MODULE_InitLoadOrder(void);
-extern void MODULE_GetLoadOrder( enum loadorder_type plo[], const char *path, BOOL win32 );
-extern void MODULE_AddLoadOrderOption( const char *option );
-
-#endif
-
diff --git a/include/metafile.h b/include/metafile.h
index 9e3c7ff..7b4d6a6 100644
--- a/include/metafile.h
+++ b/include/metafile.h
@@ -18,19 +18,8 @@
     METAHEADER  *mh;
 } METAFILEOBJ;
 
-#include "pshpack1.h"
-typedef struct {
-    DWORD dw1, dw2, dw3;
-    WORD w4;
-    CHAR filename[0x100];
-} METAHEADERDISK;
-#include "poppack.h"
-
-#define MFHEADERSIZE (sizeof(METAHEADER))
-#define MFVERSION 0x300
 #define META_EOF 0x0000
 
-
 /* values of mtType in METAHEADER.  Note however that the disk image of a disk
    based metafile has mtType == 1 */
 #define METAFILE_MEMORY 1
diff --git a/include/module.h b/include/module.h
index 3dcf97e..006a8b3 100644
--- a/include/module.h
+++ b/include/module.h
@@ -161,6 +161,15 @@
     ((IMAGE_SECTION_HEADER*)((LPBYTE)&PE_HEADER(module)->OptionalHeader + \
                            PE_HEADER(module)->FileHeader.SizeOfOptionalHeader))
 
+enum loadorder_type
+{
+    LOADORDER_INVALID = 0, /* Must be 0 */
+    LOADORDER_DLL,         /* Native DLLs */
+    LOADORDER_SO,          /* Native .so libraries */
+    LOADORDER_BI,          /* Built-in modules */
+    LOADORDER_NTYPES
+};
+
 /* module.c */
 extern WINE_MODREF *MODULE_AllocModRef( HMODULE hModule, LPCSTR filename );
 extern FARPROC MODULE_GetProcAddress( HMODULE hModule, LPCSTR function, BOOL snoop );
@@ -224,6 +233,11 @@
 extern void PE_InitTls(void);
 extern BOOL PE_InitDLL( HMODULE module, DWORD type, LPVOID lpReserved );
 
+/* loader/loadorder.c */
+extern void MODULE_InitLoadOrder(void);
+extern void MODULE_GetLoadOrder( enum loadorder_type plo[], const char *path, BOOL win32 );
+extern void MODULE_AddLoadOrderOption( const char *option );
+
 /* loader/elf.c */
 extern WINE_MODREF *ELF_LoadLibraryExA( LPCSTR libname, DWORD flags);
 
diff --git a/include/options.h b/include/options.h
index d2a3db6..00f6a45 100644
--- a/include/options.h
+++ b/include/options.h
@@ -38,9 +38,4 @@
 extern void VERSION_ParseWinVersion( const char *arg );
 extern void VERSION_ParseDosVersion( const char *arg );
 
-#define IS_OPTION_TRUE(ch) \
-    ((ch) == 'y' || (ch) == 'Y' || (ch) == 't' || (ch) == 'T' || (ch) == '1')
-#define IS_OPTION_FALSE(ch) \
-    ((ch) == 'n' || (ch) == 'N' || (ch) == 'f' || (ch) == 'F' || (ch) == '0')
-
 #endif  /* __WINE_OPTIONS_H */
diff --git a/loader/loadorder.c b/loader/loadorder.c
index 7f071d5..c15b315 100644
--- a/loader/loadorder.c
+++ b/loader/loadorder.c
@@ -13,7 +13,6 @@
 #include "winreg.h"
 #include "winerror.h"
 #include "options.h"
-#include "loadorder.h"
 #include "heap.h"
 #include "file.h"
 #include "module.h"
diff --git a/loader/main.c b/loader/main.c
index 30f2af6..5e46c46 100644
--- a/loader/main.c
+++ b/loader/main.c
@@ -18,9 +18,9 @@
 #include "drive.h"
 #include "file.h"
 #include "options.h"
+#include "module.h"
 #include "debugtools.h"
 #include "wine/server.h"
-#include "loadorder.h"
 
 DEFAULT_DEBUG_CHANNEL(server);
 
diff --git a/loader/module.c b/loader/module.c
index cde4f4f..6b8c235 100644
--- a/loader/module.c
+++ b/loader/module.c
@@ -18,7 +18,6 @@
 #include "module.h"
 #include "debugtools.h"
 #include "callback.h"
-#include "loadorder.h"
 #include "wine/server.h"
 
 DEFAULT_DEBUG_CHANNEL(module);
diff --git a/loader/ne/module.c b/loader/ne/module.c
index e46553a..1d59663 100644
--- a/loader/ne/module.c
+++ b/loader/ne/module.c
@@ -23,7 +23,6 @@
 #include "builtin16.h"
 #include "stackframe.h"
 #include "debugtools.h"
-#include "loadorder.h"
 
 DEFAULT_DEBUG_CHANNEL(module);
 DECLARE_DEBUG_CHANNEL(loaddll);
diff --git a/misc/options.c b/misc/options.c
index 66b535a..346a718 100644
--- a/misc/options.c
+++ b/misc/options.c
@@ -13,7 +13,7 @@
 #include "ntddk.h"
 #include "wine/library.h"
 #include "options.h"
-#include "loadorder.h"
+#include "module.h"
 #include "version.h"
 #include "debugtools.h"
 
diff --git a/objects/font.c b/objects/font.c
index 203b9ea..8706b96 100644
--- a/objects/font.c
+++ b/objects/font.c
@@ -11,7 +11,6 @@
 #include "winnls.h"
 #include "font.h"
 #include "heap.h"
-#include "metafile.h"
 #include "options.h"
 #include "debugtools.h"
 #include "gdi.h"
diff --git a/objects/metafile.c b/objects/metafile.c
index ed5d0e3..df012a5 100644
--- a/objects/metafile.c
+++ b/objects/metafile.c
@@ -41,12 +41,23 @@
 #include "global.h"
 #include "heap.h"
 #include "metafile.h"
-#include "toolhelp.h"
 
 #include "debugtools.h"
 
 DEFAULT_DEBUG_CHANNEL(metafile);
 
+#include "pshpack1.h"
+typedef struct
+{
+    DWORD dw1, dw2, dw3;
+    WORD w4;
+    CHAR filename[0x100];
+} METAHEADERDISK;
+#include "poppack.h"
+
+#define MFHEADERSIZE (sizeof(METAHEADER))
+#define MFVERSION 0x300
+
 /******************************************************************
  *         MF_AddHandle
  *
diff --git a/windows/class.c b/windows/class.c
index cf335a2..5bce63d 100644
--- a/windows/class.c
+++ b/windows/class.c
@@ -25,7 +25,6 @@
 #include "win.h"
 #include "controls.h"
 #include "dce.h"
-#include "toolhelp.h"
 #include "winproc.h"
 #include "debugtools.h"
 
@@ -1277,6 +1276,8 @@
 }
 
 
+#if 0  /* toolhelp is in kernel, so this cannot work */
+
 /***********************************************************************
  *		ClassFirst (TOOLHELP.69)
  */
@@ -1311,3 +1312,4 @@
                           sizeof(pClassEntry->szClassName) );
     return TRUE;
 }
+#endif
diff --git a/windows/user.c b/windows/user.c
index 112a655..88ee059 100644
--- a/windows/user.c
+++ b/windows/user.c
@@ -17,7 +17,6 @@
 #include "controls.h"
 #include "cursoricon.h"
 #include "hook.h"
-#include "toolhelp.h"
 #include "message.h"
 #include "miscemu.h"
 #include "sysmetrics.h"
diff --git a/windows/x11drv/event.c b/windows/x11drv/event.c
index 36fa073..000a986 100644
--- a/windows/x11drv/event.c
+++ b/windows/x11drv/event.c
@@ -28,12 +28,10 @@
 #include "heap.h"
 #include "input.h"
 #include "keyboard.h"
-#include "message.h"
 #include "mouse.h"
 #include "options.h"
 #include "win.h"
 #include "winpos.h"
-#include "file.h"
 #include "windef.h"
 #include "winreg.h"
 #include "x11drv.h"
diff --git a/windows/x11drv/keyboard.c b/windows/x11drv/keyboard.c
index 78ff6aa..f0b052d 100644
--- a/windows/x11drv/keyboard.c
+++ b/windows/x11drv/keyboard.c
@@ -31,7 +31,6 @@
 #include "debugtools.h"
 #include "user.h"
 #include "keyboard.h"
-#include "message.h"
 #include "winnls.h"
 #include "win.h"
 #include "x11drv.h"