Removed some unnecessary #includes and dll dependencies.

diff --git a/controls/icontitle.c b/controls/icontitle.c
index e2ac64a..0e94893 100644
--- a/controls/icontitle.c
+++ b/controls/icontitle.c
@@ -12,7 +12,6 @@
 #include "winuser.h"
 #include "wine/winuser16.h"
 #include "win.h"
-#include "desktop.h"
 #include "heap.h"
 
 	BOOL	bMultiLineTitle;
diff --git a/controls/widgets.c b/controls/widgets.c
index 2eabec4..13b6052 100644
--- a/controls/widgets.c
+++ b/controls/widgets.c
@@ -15,7 +15,6 @@
 #include "heap.h"
 #include "mdi.h"
 #include "menu.h"
-#include "module.h"
 #include "scroll.h"
 #include "static.h"
 
diff --git a/dlls/comctl32/tab.c b/dlls/comctl32/tab.c
index a949976..e6553c6 100644
--- a/dlls/comctl32/tab.c
+++ b/dlls/comctl32/tab.c
@@ -17,7 +17,6 @@
 #include "commctrl.h"
 #include "debugtools.h"
 #include "cache.h"
-#include "win.h"
 
 DEFAULT_DEBUG_CHANNEL(tab);
 
@@ -1257,15 +1256,12 @@
   if ( (lStyle & TCS_OWNERDRAWFIXED) && GetParent(hwnd) )
   {
     DRAWITEMSTRUCT dis;
-    WND *pwndPtr;
     UINT id;
 
     /*
      * get the control id
      */
-    pwndPtr = WIN_FindWndPtr( hwnd );
-    id = pwndPtr->wIDmenu;
-    WIN_ReleaseWndPtr(pwndPtr);
+    id = GetWindowLongA( hwnd, GWL_ID );
 
     /* 
      * put together the DRAWITEMSTRUCT
diff --git a/dlls/crtdll/crtdll_main.c b/dlls/crtdll/crtdll_main.c
index e6d4c31..0222c74 100644
--- a/dlls/crtdll/crtdll_main.c
+++ b/dlls/crtdll/crtdll_main.c
@@ -50,7 +50,6 @@
 #include "winerror.h"
 #include "ntddk.h"
 #include "debugtools.h"
-#include "module.h"
 #include "heap.h"
 #include "crtdll.h"
 #include "drive.h"
diff --git a/dlls/ddraw/ddraw/dga.c b/dlls/ddraw/ddraw/dga.c
index 128fa04..686d101 100644
--- a/dlls/ddraw/ddraw/dga.c
+++ b/dlls/ddraw/ddraw/dga.c
@@ -33,7 +33,6 @@
 #include "ddraw.h"
 #include "d3d.h"
 #include "debugtools.h"
-#include "message.h"
 #include "options.h"
 
 #define RESTORE_SIGNALS
diff --git a/dlls/ddraw/ddraw/main.c b/dlls/ddraw/ddraw/main.c
index 5d38dce..ec5b3d1 100644
--- a/dlls/ddraw/ddraw/main.c
+++ b/dlls/ddraw/ddraw/main.c
@@ -22,7 +22,6 @@
 #include "ddraw.h"
 #include "d3d.h"
 #include "debugtools.h"
-#include "message.h"
 #include "options.h"
 
 DEFAULT_DEBUG_CHANNEL(ddraw);
diff --git a/dlls/ddraw/ddraw/x11.c b/dlls/ddraw/ddraw/x11.c
index 00a2fed..7344874 100644
--- a/dlls/ddraw/ddraw/x11.c
+++ b/dlls/ddraw/ddraw/x11.c
@@ -21,7 +21,6 @@
 #include "d3d.h"
 #include "win.h"
 #include "debugtools.h"
-#include "message.h"
 #include "options.h"
 
 DEFAULT_DEBUG_CHANNEL(ddraw);
diff --git a/dlls/ddraw/dga.c b/dlls/ddraw/dga.c
index b298b3a..d509225 100644
--- a/dlls/ddraw/dga.c
+++ b/dlls/ddraw/dga.c
@@ -26,15 +26,11 @@
 #include <string.h>
 #include <stdio.h>
 
-#include "gdi.h"
 #include "heap.h"
-#include "dc.h"
-#include "win.h"
 #include "wine/exception.h"
 #include "ddraw.h"
 #include "d3d.h"
 #include "debugtools.h"
-#include "message.h"
 #include "options.h"
 
 #include "dga_private.h"
diff --git a/dlls/ddraw/dga2.c b/dlls/ddraw/dga2.c
index 653a0c3..521ffb9 100644
--- a/dlls/ddraw/dga2.c
+++ b/dlls/ddraw/dga2.c
@@ -17,13 +17,10 @@
 
 #include "gdi.h"
 #include "heap.h"
-#include "dc.h"
-#include "win.h"
 #include "wine/exception.h"
 #include "ddraw.h"
 #include "d3d.h"
 #include "debugtools.h"
-#include "message.h"
 #include "options.h"
 
 #include "dga2_private.h"
diff --git a/dlls/ddraw/direct3d/main.c b/dlls/ddraw/direct3d/main.c
index 0d4b594..1fe95db 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 "message.h"
 #include "options.h"
 #include "debugtools.h"
 
diff --git a/dlls/ddraw/direct3d/mesa.c b/dlls/ddraw/direct3d/mesa.c
index a37071d..709fdef 100644
--- a/dlls/ddraw/direct3d/mesa.c
+++ b/dlls/ddraw/direct3d/mesa.c
@@ -9,7 +9,6 @@
 #include "winerror.h"
 #include "ddraw.h"
 #include "d3d.h"
-#include "message.h"
 #include "options.h"
 #include "debugtools.h"
 
diff --git a/dlls/ddraw/helper.c b/dlls/ddraw/helper.c
index b7091c2..632946e 100644
--- a/dlls/ddraw/helper.c
+++ b/dlls/ddraw/helper.c
@@ -15,15 +15,11 @@
 #include <stdio.h>
 
 #include "winerror.h"
-#include "gdi.h"
 #include "heap.h"
-#include "dc.h"
-#include "win.h"
 #include "wine/exception.h"
 #include "ddraw.h"
 #include "d3d.h"
 #include "debugtools.h"
-#include "message.h"
 #include "options.h"
 
 DEFAULT_DEBUG_CHANNEL(ddraw);
diff --git a/dlls/ddraw/main.c b/dlls/ddraw/main.c
index acdc101..6c368de 100644
--- a/dlls/ddraw/main.c
+++ b/dlls/ddraw/main.c
@@ -15,11 +15,8 @@
 
 #include "winerror.h"
 #include "heap.h"
-#include "dc.h"
-#include "win.h"
 #include "wine/exception.h"
 #include "debugtools.h"
-#include "message.h"
 
 #include "initguid.h"
 #include "ddraw.h"
@@ -232,12 +229,12 @@
 	    ret = DefWindowProcA( ddraw->d->mainWindow, msg, wParam, lParam );
 
 	    if( !ret ) {
-		WND *tmpWnd =WIN_FindWndPtr(ddraw->d->mainWindow);
 		/* We didn't handle the message - give it to the application */
-		if (ddraw && ddraw->d->mainWindow && tmpWnd)
-		    ret = CallWindowProcA(tmpWnd->winproc,
-		ddraw->d->mainWindow, msg, wParam, lParam );
-		WIN_ReleaseWndPtr(tmpWnd);
+		if (ddraw && ddraw->d->mainWindow)
+                {
+                    WNDPROC winproc = (WNDPROC)GetWindowLongA( ddraw->d->mainWindow, GWL_WNDPROC );
+		    ret = CallWindowProcA(winproc, ddraw->d->mainWindow, msg, wParam, lParam );
+                }
 	    }
 	    return ret;
 	} /* else FALLTHROUGH */
diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c
index b349c96..0de9dc9 100644
--- a/dlls/dinput/dinput_main.c
+++ b/dlls/dinput/dinput_main.c
@@ -42,7 +42,6 @@
 #include "debugtools.h"
 #include "input.h"
 #include "user.h"
-#include "message.h"
 #include "mouse.h"
 #include "winbase.h"
 #include "winerror.h"
@@ -381,7 +380,7 @@
   }
 }
 
-static DataFormat *create_DataFormat(DIDATAFORMAT *wine_format, DIDATAFORMAT *asked_format, int *offset) {
+static DataFormat *create_DataFormat(DIDATAFORMAT *wine_format, LPCDIDATAFORMAT asked_format, int *offset) {
   DataFormat *ret;
   DataTransform *dt;
   int i, j;
diff --git a/include/msacmdrv.h b/dlls/msacm/msacmdrv.h
similarity index 100%
rename from include/msacmdrv.h
rename to dlls/msacm/msacmdrv.h
diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c
index 1210618..b5da7bf 100644
--- a/dlls/ole32/compobj.c
+++ b/dlls/ole32/compobj.c
@@ -19,7 +19,6 @@
 #include "wine/winbase16.h"
 #include "winerror.h"
 #include "wownt32.h"
-#include "ole.h"
 #include "ole2ver.h"
 #include "debugtools.h"
 #include "file.h"
@@ -519,7 +518,7 @@
 	CLSID *id		/* [out] GUID represented by above string */
 ) {
     LPOLESTR16      xid = HEAP_strdupWtoA(GetProcessHeap(),0,idstr);
-    OLESTATUS       ret = CLSIDFromString16(xid,id);
+    HRESULT       ret = CLSIDFromString16(xid,id);
 
     HeapFree(GetProcessHeap(),0,xid);
     if(ret != S_OK) { /* It appears a ProgID is also valid */
@@ -535,7 +534,7 @@
  * NOTES
  *
  * RETURNS
- *	the string representation and OLESTATUS
+ *	the string representation and HRESULT
  */
 static HRESULT WINE_StringFromCLSID(
 	const CLSID *id,	/* [in] GUID to be converted */
@@ -567,7 +566,7 @@
 
   TRACE("%p->%s\n", id, idstr);
 
-  return OLE_OK;
+  return S_OK;
 }
 
 /******************************************************************************
@@ -575,7 +574,7 @@
  * Converts a GUID into the respective string representation.
  * The target string is allocated using the OLE IMalloc.
  * RETURNS
- *	the string representation and OLESTATUS
+ *	the string representation and HRESULT
  */
 HRESULT WINAPI StringFromCLSID16(
         REFCLSID id,            /* [in] the GUID to be converted */
@@ -583,7 +582,7 @@
 
 ) {
     LPMALLOC16	mllc;
-    OLESTATUS	ret;
+    HRESULT	ret;
     DWORD	args[2];
 
     ret = CoGetMalloc16(0,&mllc);
@@ -615,14 +614,14 @@
  * Converts a GUID into the respective string representation.
  * The target string is allocated using the OLE IMalloc.
  * RETURNS
- *	the string representation and OLESTATUS
+ *	the string representation and HRESULT
  */
 HRESULT WINAPI StringFromCLSID(
         REFCLSID id,            /* [in] the GUID to be converted */
 	LPOLESTR *idstr	/* [out] a pointer to a to-be-allocated pointer pointing to the resulting string */
 ) {
 	char            buf[80];
-	OLESTATUS       ret;
+	HRESULT       ret;
 	LPMALLOC	mllc;
 
 	if ((ret=CoGetMalloc(0,&mllc)))
@@ -752,7 +751,7 @@
 	LPCLSID riid		/* [out] associated CLSID */
 ) {
 	LPOLESTR16 pid = HEAP_strdupWtoA(GetProcessHeap(),0,progid);
-	OLESTATUS       ret = CLSIDFromProgID16(pid,riid);
+	HRESULT       ret = CLSIDFromProgID16(pid,riid);
 
 	HeapFree(GetProcessHeap(),0,pid);
 	return ret;
@@ -803,7 +802,7 @@
 /***********************************************************************
  *           LookupETask (COMPOBJ.94)
  */
-OLESTATUS WINAPI LookupETask16(HTASK16 *hTask,LPVOID p) {
+HRESULT WINAPI LookupETask16(HTASK16 *hTask,LPVOID p) {
 	FIXME("(%p,%p),stub!\n",hTask,p);
 	if ((*hTask = GetCurrentTask()) == hETask) {
 		memcpy(p, Table_ETask, sizeof(Table_ETask));
@@ -815,7 +814,7 @@
 /***********************************************************************
  *           SetETask (COMPOBJ.95)
  */
-OLESTATUS WINAPI SetETask16(HTASK16 hTask, LPVOID p) {
+HRESULT WINAPI SetETask16(HTASK16 hTask, LPVOID p) {
         FIXME("(%04x,%p),stub!\n",hTask,p);
 	hETask = hTask;
 	return 0;
@@ -825,7 +824,7 @@
 /***********************************************************************
  *           CallObjectInWOW (COMPOBJ.201)
  */
-OLESTATUS WINAPI CallObjectInWOW(LPVOID p1,LPVOID p2) {
+HRESULT WINAPI CallObjectInWOW(LPVOID p1,LPVOID p2) {
 	FIXME("(%p,%p),stub!\n",p1,p2);
 	return 0;
 }
diff --git a/dlls/ole32/storage.c b/dlls/ole32/storage.c
index fe87533..0c70611 100644
--- a/dlls/ole32/storage.c
+++ b/dlls/ole32/storage.c
@@ -19,7 +19,6 @@
 #include "wingdi.h"
 #include "wtypes.h"
 #include "file.h"
-#include "ole.h"
 #include "wine/obj_base.h"
 #include "wine/obj_storage.h"
 #include "heap.h"
@@ -1648,7 +1647,7 @@
 StgIsStorageFile(LPCOLESTR fn) 
 {
 	LPOLESTR16	xfn = HEAP_strdupWtoA(GetProcessHeap(),0,fn);
-	OLESTATUS	ret = StgIsStorageFile16(xfn);
+	HRESULT	ret = StgIsStorageFile16(xfn);
 
 	HeapFree(GetProcessHeap(),0,xfn);
 	return ret;
diff --git a/dlls/serialui/confdlg.c b/dlls/serialui/confdlg.c
index ac45267..ce9b960 100644
--- a/dlls/serialui/confdlg.c
+++ b/dlls/serialui/confdlg.c
@@ -19,15 +19,12 @@
 
 #include "winbase.h"
 #include "winreg.h"
-#include "dialog.h"
-#include "win.h"
+#include "wingdi.h"
+#include "winuser.h"
 #include "debugtools.h"
 #include "serialui.h"
 #include "winerror.h"
 
-#include "queue.h"
-#include "message.h"
-
 DEFAULT_DEBUG_CHANNEL(comm);
 
 HMODULE SERIALUI_hModule = 0;
diff --git a/dlls/shell32/brsfolder.c b/dlls/shell32/brsfolder.c
index 9cc9105..09d806e 100644
--- a/dlls/shell32/brsfolder.c
+++ b/dlls/shell32/brsfolder.c
@@ -4,7 +4,6 @@
 #include "winerror.h"
 #include "heap.h"
 #include "dlgs.h"
-#include "win.h"
 #include "debugtools.h"
 #include "winreg.h"
 #include "winnls.h"
diff --git a/dlls/user/ddeml.c b/dlls/user/ddeml.c
index b168370..f1e4ee6 100644
--- a/dlls/user/ddeml.c
+++ b/dlls/user/ddeml.c
@@ -18,10 +18,9 @@
 #include "winerror.h"
 #include "heap.h"
 #include "debugtools.h"
-#include "tchar.h"
 #include "winnt.h"
 
-DEFAULT_DEBUG_CHANNEL(ddeml)
+DEFAULT_DEBUG_CHANNEL(ddeml);
 
 /* Has defined in atom.c file.
  */
diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index 2b5ee78..3f9496c 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -14,7 +14,6 @@
 #include "debugtools.h"
 #include "winerror.h"
 #include "heap.h"
-#include "tchar.h"
 #include "winsock.h"
 
 #include <sys/types.h>
@@ -970,35 +969,35 @@
 {
     INT index = -1;
 
-    if (!_stricmp(lpszField, "Content-Length"))
+    if (!strcasecmp(lpszField, "Content-Length"))
         index = HTTP_QUERY_CONTENT_LENGTH;
-    else if (!_stricmp(lpszField,"Status"))
+    else if (!strcasecmp(lpszField,"Status"))
         index = HTTP_QUERY_STATUS_CODE;
-    else if (!_stricmp(lpszField,"Content-Type"))
+    else if (!strcasecmp(lpszField,"Content-Type"))
         index = HTTP_QUERY_CONTENT_TYPE;
-    else if (!_stricmp(lpszField,"Last-Modified"))
+    else if (!strcasecmp(lpszField,"Last-Modified"))
         index = HTTP_QUERY_LAST_MODIFIED;
-    else if (!_stricmp(lpszField,"Location"))
+    else if (!strcasecmp(lpszField,"Location"))
         index = HTTP_QUERY_LOCATION;
-    else if (!_stricmp(lpszField,"Accept"))
+    else if (!strcasecmp(lpszField,"Accept"))
         index = HTTP_QUERY_ACCEPT;
-    else if (!_stricmp(lpszField,"Referer"))
+    else if (!strcasecmp(lpszField,"Referer"))
         index = HTTP_QUERY_REFERER;
-    else if (!_stricmp(lpszField,"Content-Transfer-Encoding"))
+    else if (!strcasecmp(lpszField,"Content-Transfer-Encoding"))
         index = HTTP_QUERY_CONTENT_TRANSFER_ENCODING;
-    else if (!_stricmp(lpszField,"Date"))
+    else if (!strcasecmp(lpszField,"Date"))
         index = HTTP_QUERY_DATE;
-    else if (!_stricmp(lpszField,"Server"))
+    else if (!strcasecmp(lpszField,"Server"))
         index = HTTP_QUERY_SERVER;
-    else if (!_stricmp(lpszField,"Connection"))
+    else if (!strcasecmp(lpszField,"Connection"))
         index = HTTP_QUERY_CONNECTION;
-    else if (!_stricmp(lpszField,"ETag"))
+    else if (!strcasecmp(lpszField,"ETag"))
         index = HTTP_QUERY_ETAG;
-    else if (!_stricmp(lpszField,"Accept-Ranges"))
+    else if (!strcasecmp(lpszField,"Accept-Ranges"))
         index = HTTP_QUERY_ACCEPT_RANGES;
-    else if (!_stricmp(lpszField,"Expires"))
+    else if (!strcasecmp(lpszField,"Expires"))
         index = HTTP_QUERY_EXPIRES;
-    else if (!_stricmp(lpszField,"Mime-Version"))
+    else if (!strcasecmp(lpszField,"Mime-Version"))
         index = HTTP_QUERY_MIME_VERSION;
     else
     {
@@ -1260,7 +1259,7 @@
 
     for (index = 0; index < lpwhr->nCustHeaders; index++)
     {
-	if (!_stricmp(lpwhr->pCustHeaders[index].lpszField, lpszField))
+	if (!strcasecmp(lpwhr->pCustHeaders[index].lpszField, lpszField))
 	    break;
 
     }
diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c
index 1b4d9fe..ae5ce18 100644
--- a/dlls/wininet/internet.c
+++ b/dlls/wininet/internet.c
@@ -22,7 +22,6 @@
 #include "debugtools.h"
 #include "winerror.h"
 #include "winsock.h"
-#include "tchar.h"
 #include "heap.h"
 
 #include "internet.h"
@@ -919,19 +918,19 @@
     if(lpszScheme==NULL)
         return INTERNET_SCHEME_UNKNOWN;
 
-    if (!_strnicmp("ftp", lpszScheme, nMaxCmp))
+    if (!strncasecmp("ftp", lpszScheme, nMaxCmp))
         return INTERNET_SCHEME_FTP;
-    else if (!_strnicmp("gopher", lpszScheme, nMaxCmp))
+    else if (!strncasecmp("gopher", lpszScheme, nMaxCmp))
         return INTERNET_SCHEME_GOPHER;
-    else if (!_strnicmp("http", lpszScheme, nMaxCmp))
+    else if (!strncasecmp("http", lpszScheme, nMaxCmp))
         return INTERNET_SCHEME_HTTP;
-    else if (!_strnicmp("https", lpszScheme, nMaxCmp))
+    else if (!strncasecmp("https", lpszScheme, nMaxCmp))
         return INTERNET_SCHEME_HTTPS;
-    else if (!_strnicmp("file", lpszScheme, nMaxCmp))
+    else if (!strncasecmp("file", lpszScheme, nMaxCmp))
         return INTERNET_SCHEME_FILE;
-    else if (!_strnicmp("news", lpszScheme, nMaxCmp))
+    else if (!strncasecmp("news", lpszScheme, nMaxCmp))
         return INTERNET_SCHEME_NEWS;
-    else if (!_strnicmp("mailto", lpszScheme, nMaxCmp))
+    else if (!strncasecmp("mailto", lpszScheme, nMaxCmp))
         return INTERNET_SCHEME_MAILTO;
     else
         return INTERNET_SCHEME_UNKNOWN;
diff --git a/dlls/winsock/async.c b/dlls/winsock/async.c
index 7e90528..18f48c9 100644
--- a/dlls/winsock/async.c
+++ b/dlls/winsock/async.c
@@ -84,12 +84,11 @@
 #include "winnt.h"
 #include "heap.h"
 #include "task.h"
-#include "message.h"
-#include "miscemu.h"
+#include "ldt.h"
 #include "wine/port.h"
 #include "debugtools.h"
 
-DEFAULT_DEBUG_CHANNEL(winsock)
+DEFAULT_DEBUG_CHANNEL(winsock);
 
 /* protoptypes of some functions in socket.c
  */
diff --git a/dlls/winsock/socket.c b/dlls/winsock/socket.c
index d70bce3..41eee91 100644
--- a/dlls/winsock/socket.c
+++ b/dlls/winsock/socket.c
@@ -83,15 +83,13 @@
 #include "winnt.h"
 #include "heap.h"
 #include "task.h"
-#include "message.h"
-#include "miscemu.h"
 #include "wine/port.h"
 #include "services.h"
 #include "server.h"
 #include "debugtools.h"
 
 
-DEFAULT_DEBUG_CHANNEL(winsock)
+DEFAULT_DEBUG_CHANNEL(winsock);
 
 #define DEBUG_SOCKADDR 0
 #define dump_sockaddr(a) \
diff --git a/files/change.c b/files/change.c
index 5bce5f9..80ea17e 100644
--- a/files/change.c
+++ b/files/change.c
@@ -16,8 +16,6 @@
 #include <time.h>
 #include "winbase.h"
 #include "winerror.h"
-#include "process.h"
-#include "thread.h"
 #include "heap.h"
 #include "server.h"
 #include "debugtools.h"
diff --git a/files/dos_fs.c b/files/dos_fs.c
index bfb605d..7b25946 100644
--- a/files/dos_fs.c
+++ b/files/dos_fs.c
@@ -32,12 +32,11 @@
 #include "msdos.h"
 #include "syslevel.h"
 #include "server.h"
-#include "process.h"
 #include "options.h"
 #include "debugtools.h"
 
-DEFAULT_DEBUG_CHANNEL(dosfs)
-DECLARE_DEBUG_CHANNEL(file)
+DEFAULT_DEBUG_CHANNEL(dosfs);
+DECLARE_DEBUG_CHANNEL(file);
 
 /* Define the VFAT ioctl to get both short and long file names */
 /* FIXME: is it possible to get this to work on other systems? */
diff --git a/graphics/painting.c b/graphics/painting.c
index 00f45d8..aacb7fc 100644
--- a/graphics/painting.c
+++ b/graphics/painting.c
@@ -10,7 +10,6 @@
 #include "dc.h"
 #include "bitmap.h"
 #include "heap.h"
-#include "cache.h"
 #include "region.h"
 #include "path.h"
 #include "debugtools.h"
diff --git a/include/ntddk.h b/include/ntddk.h
index e4ae9b1..db69c7e 100644
--- a/include/ntddk.h
+++ b/include/ntddk.h
@@ -990,6 +990,7 @@
 LPVOID WINAPI RtlNormalizeProcessParams(LPVOID x);
 DWORD WINAPI RtlNtStatusToDosError(DWORD error);
 BOOLEAN WINAPI RtlGetNtProductType(LPDWORD type);
+PIMAGE_NT_HEADERS WINAPI RtlImageNtHeader(HMODULE hModule);
 
 DWORD WINAPI RtlOpenCurrentUser(
 	IN ACCESS_MASK DesiredAccess,
diff --git a/include/ole.h b/include/ole.h
index 9fbf9d1..4a695bc 100644
--- a/include/ole.h
+++ b/include/ole.h
@@ -273,12 +273,6 @@
 	LPCSTR name, LPOLECLIENT olecli, LHCLIENTDOC hclientdoc, LPCSTR xname,
 	LPOLEOBJECT *lpoleob, UINT16 render, UINT16 clipformat);
 
-/* com functions */
-void WINAPI CoFreeUnusedLibraries(void);
-HINSTANCE WINAPI CoLoadLibrary(LPOLESTR lpszLibName, BOOL bAutoFree);
-void WINAPI CoFreeUnusedLibraries(void);
-void WINAPI CoFreeAllLibraries(void);
-
 #ifdef __cplusplus
 } /*extern*/
 #endif
diff --git a/include/wine/obj_base.h b/include/wine/obj_base.h
index 16e895d..767b344 100644
--- a/include/wine/obj_base.h
+++ b/include/wine/obj_base.h
@@ -707,6 +707,8 @@
 
 HRESULT WINAPI CoCreateGuid(GUID* pguid);
 
+HINSTANCE WINAPI CoLoadLibrary(LPOLESTR lpszLibName, BOOL bAutoFree);
+
 void WINAPI CoFreeAllLibraries(void);
 
 void WINAPI CoFreeLibrary(HINSTANCE hLibrary);
diff --git a/misc/comm.c b/misc/comm.c
index 14f1125..7596a31 100644
--- a/misc/comm.c
+++ b/misc/comm.c
@@ -63,7 +63,6 @@
 #include "options.h"
 
 #include "server.h"
-#include "process.h"
 #include "winerror.h"
 #include "services.h"
 #include "callback.h"
diff --git a/misc/main.c b/misc/main.c
index 666e3c6..6ad71a4 100644
--- a/misc/main.c
+++ b/misc/main.c
@@ -9,6 +9,7 @@
 #include <locale.h>
 #include <ctype.h>
 #include <stdlib.h>
+#include <stdio.h>
 #include <string.h>
 #include <unistd.h>
 #ifdef MALLOC_DEBUGGING
@@ -18,17 +19,12 @@
 #include "winbase.h"
 #include "winsock.h"
 #include "heap.h"
-#include "message.h"
 #include "msdos.h"
-#include "color.h"
 #include "options.h"
 #include "debugtools.h"
 #include "debugdefs.h"
 #include "module.h"
-#include "version.h"
 #include "winnls.h"
-#include "console.h"
-#include "gdi.h"
 #include "user.h"
 #include "windef.h"
 #include "wingdi.h"
diff --git a/msdos/int09.c b/msdos/int09.c
index 9278d94..f232b8d 100644
--- a/msdos/int09.c
+++ b/msdos/int09.c
@@ -8,11 +8,10 @@
 #include "wingdi.h"
 #include "winuser.h"
 #include "miscemu.h"
-#include "input.h"
 #include "debugtools.h"
 #include "dosexe.h"
 
-DEFAULT_DEBUG_CHANNEL(int)
+DEFAULT_DEBUG_CHANNEL(int);
 
 #define QUEUELEN 31
 
diff --git a/objects/bitmap.c b/objects/bitmap.c
index 4b8de05..cc1aa5c 100644
--- a/objects/bitmap.c
+++ b/objects/bitmap.c
@@ -14,7 +14,6 @@
 #include "bitmap.h"
 #include "heap.h"
 #include "global.h"
-#include "cursoricon.h"
 #include "debugtools.h"
 #include "wine/winuser16.h"
 
diff --git a/programs/notepad/search.c b/programs/notepad/search.c
index e53851b..3be3fbf 100644
--- a/programs/notepad/search.c
+++ b/programs/notepad/search.c
@@ -10,7 +10,7 @@
  *
  */
 
- #include <win.h>
+#include <windows.h>
  
  #define CHARSETSIZE 255
   
diff --git a/scheduler/synchro.c b/scheduler/synchro.c
index aa98c07..26820e4 100644
--- a/scheduler/synchro.c
+++ b/scheduler/synchro.c
@@ -9,11 +9,9 @@
 #include <sys/time.h>
 #include <unistd.h>
 #include "heap.h"
-#include "process.h"
 #include "thread.h"
 #include "winerror.h"
 #include "syslevel.h"
-#include "message.h"
 #include "server.h"
 
 /***********************************************************************
diff --git a/windows/caret.c b/windows/caret.c
index 843de0a..5dc43f6 100644
--- a/windows/caret.c
+++ b/windows/caret.c
@@ -6,15 +6,15 @@
  */
 
 #include "windef.h"
+#include "winbase.h"
 #include "wingdi.h"
+#include "winuser.h"
 #include "wine/wingdi16.h"
 #include "wine/winuser16.h"
-#include "module.h"
 #include "win.h"
-#include "winuser.h"
 #include "debugtools.h"
 
-DEFAULT_DEBUG_CHANNEL(caret)
+DEFAULT_DEBUG_CHANNEL(caret);
 
 typedef struct
 {
diff --git a/windows/cursoricon.c b/windows/cursoricon.c
index bd78baa..7b37d4a 100644
--- a/windows/cursoricon.c
+++ b/windows/cursoricon.c
@@ -37,7 +37,7 @@
 #include "wine/winbase16.h"
 #include "wine/winuser16.h"
 #include "heap.h"
-#include "color.h"
+#include "palette.h"
 #include "bitmap.h"
 #include "cursoricon.h"
 #include "global.h"
diff --git a/windows/queue.c b/windows/queue.c
index a89271c..34e95ae 100644
--- a/windows/queue.c
+++ b/windows/queue.c
@@ -11,7 +11,6 @@
 #include "winerror.h"
 #include "wine/winbase16.h"
 #include "wine/winuser16.h"
-#include "miscemu.h"
 #include "syslevel.h"
 #include "module.h"
 #include "queue.h"
diff --git a/windows/x11drv/wnd.c b/windows/x11drv/wnd.c
index ae1412c..3a4c1d8 100644
--- a/windows/x11drv/wnd.c
+++ b/windows/x11drv/wnd.c
@@ -18,7 +18,6 @@
 #include <string.h>
 
 #include "bitmap.h"
-#include "color.h"
 #include "debugtools.h"
 #include "dce.h"
 #include "dc.h"