diff --git a/dlls/shell32/iconcache.c b/dlls/shell32/iconcache.c
index ad3799d24269e61071108e0e03fa8b2dffb0168e..227df17438fc4f2858718eca2ded0a0e684128d2 100644
--- a/dlls/shell32/iconcache.c
+++ b/dlls/shell32/iconcache.c
@@ -536,7 +536,7 @@ INT SIC_GetIconIndex (LPCSTR sSourceFile, INT dwSourceIndex )
  * NOTES
  *  retrives the specified icon from the iconcache. if not found try's to load the icon
  */
-static HICON SIC_GetIcon (LPCSTR sSourceFile, INT dwSourceIndex, BOOL bSmallIcon )
+static HICON WINE_UNUSED SIC_GetIcon (LPCSTR sSourceFile, INT dwSourceIndex, BOOL bSmallIcon )
 {	INT index;
 
 	TRACE(shell,"%s %i\n", sSourceFile, dwSourceIndex);
diff --git a/files/dos_fs.c b/files/dos_fs.c
index 1e3087f51a3113f0dde217f94cd3a74316b4b3bc..df2495468d67173af1e8894e07202a8e796b2488 100644
--- a/files/dos_fs.c
+++ b/files/dos_fs.c
@@ -30,6 +30,7 @@
 #include "syslevel.h"
 #include "server.h"
 #include "process.h"
+#include "options.h"
 #include "debug.h"
 
 /* Define the VFAT ioctl to get both short and long file names */
diff --git a/graphics/ddraw.c b/graphics/ddraw.c
index 607b6c2e95f87a85b56b3822ed35fe4fea0211ad..0b710b0495a86e4d5c88712bcd1ebe23d0c6a36a 100644
--- a/graphics/ddraw.c
+++ b/graphics/ddraw.c
@@ -162,16 +162,16 @@ HRESULT WINAPI DirectDrawEnumerateExA(
   
   if (DDRAW_DGA_Available()) {
     TRACE(ddraw, "Enumerating DGA interface\n");
-    if (!lpCallback(&DGA_DirectDraw_GUID, "WINE with XFree86 DGA", "display", lpContext, NULL))
+    if (!lpCallback(&DGA_DirectDraw_GUID, "WINE with XFree86 DGA", "display", lpContext, 0))
       return DD_OK;
   }
 
   TRACE(ddraw, "Enumerating Xlib interface\n");
-  if (!lpCallback(&XLIB_DirectDraw_GUID, "WINE with Xlib", "display", lpContext, NULL))
+  if (!lpCallback(&XLIB_DirectDraw_GUID, "WINE with Xlib", "display", lpContext, 0))
     return DD_OK;
   
   TRACE(ddraw, "Enumerating Default interface\n");
-  if (!lpCallback(NULL,"WINE (default)", "display", lpContext, NULL))
+  if (!lpCallback(NULL,"WINE (default)", "display", lpContext, 0))
     return DD_OK;
   
   return DD_OK;
@@ -246,7 +246,7 @@ HRESULT WINAPI DirectDrawEnumerateA(
  *		DirectDrawEnumerateW (DDRAW.*)
  */
 
-static BOOL DirectDrawEnumerateProcW(
+static BOOL WINAPI DirectDrawEnumerateProcW(
   GUID *lpGUID, LPWSTR lpDriverDescription, LPWSTR lpDriverName, 
   LPVOID lpContext, HMONITOR hm)
 {
diff --git a/graphics/fontengine.c b/graphics/fontengine.c
index 0d8a07f57e2b983a0f2cfe673da102557bd6a804..9b672dcc7d2989b79562bf60a1f3fb5dd04508be 100644
--- a/graphics/fontengine.c
+++ b/graphics/fontengine.c
@@ -5,11 +5,12 @@
  * Copyright 1998 David Lee Lambert
  * 
  */
+#include <math.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <debug.h>     
 #include "winbase.h"
 #include "font.h"
+#include "debug.h"     
 
 
 
diff --git a/include/win.h b/include/win.h
index 2c8ab51ce7657d0d26edb39b129efd01327a336a..95133d71d14b0dcc08ad3676ec9ec149a4aae126 100644
--- a/include/win.h
+++ b/include/win.h
@@ -170,6 +170,8 @@ extern void PROPERTY_RemoveWindowProps( WND *pWnd );  		      /* windows/propert
 extern BOOL PAINT_RedrawWindow( HWND hwnd, const RECT *rectUpdate,
                                   HRGN hrgnUpdate, UINT flags,
                                   UINT control );		      /* windows/painting.c */
+extern void WIN_UpdateNCArea(WND* wnd, BOOL bUpdate);
+
 
 /* controls/widgets.c */
 extern BOOL WIDGETS_Init( void );
diff --git a/loader/main.c b/loader/main.c
index 99e0fd985644c3c5258de26d77d130727dae9a41..a84a407dc9ddd44069d7397ad4baa0062ba3e6e0 100644
--- a/loader/main.c
+++ b/loader/main.c
@@ -23,7 +23,6 @@
 #include "queue.h"
 #include "sysmetrics.h"
 #include "file.h"
-#include "gdi.h"
 #include "heap.h"
 #include "keyboard.h"
 #include "mouse.h"
diff --git a/loader/resource.c b/loader/resource.c
index fbd03b8e39f6e3891beea7514893fe0fbbbf5d2a..d314608ef2641dfbce29aedec2a962823c16f135 100644
--- a/loader/resource.c
+++ b/loader/resource.c
@@ -17,7 +17,7 @@
 #include "winuser.h"
 #include "wine/winbase16.h"
 #include "wine/winuser16.h"
-#include "gdi.h"
+#include "ldt.h"
 #include "global.h"
 #include "heap.h"
 #include "callback.h"
@@ -435,11 +435,12 @@ static BOOL RES_FreeResource( HGLOBAL handle )
         /* If this failed, call USER.DestroyIcon32; this will check
            whether it is a shared cursor/icon; if not it will call
            GlobalFree16() */
-        if ( retv )
+        if ( retv ) {
             if ( Callout.DestroyIcon32 )
                 retv = Callout.DestroyIcon32( handle, CID_RESOURCE );
             else
                 retv = GlobalFree16( handle );
+	}
     }
 
     return (BOOL)retv;
diff --git a/misc/lzexpand.c b/misc/lzexpand.c
index 86606186e4f3051c0c34e686d41f83a4d6fc50ad..0a902d8cf68a51723964d15101b35ea0dea1b0d3 100644
--- a/misc/lzexpand.c
+++ b/misc/lzexpand.c
@@ -486,7 +486,12 @@ LONG WINAPI LZCopy( HFILE src, HFILE dest )
 	HFILE	oldsrc = src;
 #define BUFLEN	1000
 	BYTE	buf[BUFLEN];
-	UINT	WINAPI (*xread)(HFILE,LPVOID,UINT);
+	/* we need that weird typedef, for i can't seem to get function pointer
+	 * casts right. (Or they probably just do not like WINAPI in general)
+	 */
+	typedef	UINT	WINAPI (*_readfun)(HFILE,LPVOID,UINT);
+
+	_readfun	xread;
 
 	TRACE(file,"(%d,%d)\n",src,dest);
 	if (!IS_LZ_HANDLE(src)) {
@@ -498,8 +503,8 @@ LONG WINAPI LZCopy( HFILE src, HFILE dest )
 	/* not compressed? just copy */
         if (!IS_LZ_HANDLE(src))
 		xread=_lread;
-	else	/* Note: Ignore warning, just mismatched INT/UINT */
-		xread=LZRead; 
+	else
+		xread=(_readfun)LZRead; 
 	len=0;
 	while (1) {
 		ret=xread(src,buf,BUFLEN);
diff --git a/misc/registry.c b/misc/registry.c
index fa0454de124a10154d34bde8cf8273679773cb30..0ba7b98b8f550518af612e77bf8f3358c9e9c830 100644
--- a/misc/registry.c
+++ b/misc/registry.c
@@ -39,6 +39,7 @@
 #include "heap.h"
 #include "debug.h"
 #include "xmalloc.h"
+#include "options.h"
 #include "winreg.h"
 #include "winversion.h"
 
diff --git a/msdos/int10.c b/msdos/int10.c
index 924d6b14052d2e8783e7fad14294a02053f48f96..feff2a8eeec3ff0e5f12cfd3e0b00a1bc1e3a49c 100644
--- a/msdos/int10.c
+++ b/msdos/int10.c
@@ -722,7 +722,7 @@ else {
           AH_reg(context) = 0;
           *(DWORD *)p = *(DWORD *)"VESA";
           *(WORD *)(p+0x04) = 0x0200; /* VESA 2.0 */
-          *(DWORD *)(p+0x06) = NULL;   /* pointer to OEM name */
+          *(DWORD *)(p+0x06) = 0x00000000; /* pointer to OEM name */
           *(DWORD *)(p+0x0a) = 0xfffffffd; /* capabilities flags :-) */
         }
         break;
diff --git a/multimedia/init.c b/multimedia/init.c
index 677000d6a88e8d427d5291d71d2b2ea0804f36d0..d40443262b73bb04cf1e24e8ebb49c1f95221661 100644
--- a/multimedia/init.c
+++ b/multimedia/init.c
@@ -13,6 +13,7 @@
 #include "winbase.h"
 #include "multimedia.h"
 #include "xmalloc.h"
+#include "options.h"
 #include "debug.h"
 
 #ifdef HAVE_OSS
diff --git a/objects/enhmetafile.c b/objects/enhmetafile.c
index 2451d5cdd127382fdb14aa57bcc1caac0bb8e0ab..d0c7b1091a96d8c42f6f8d871755543f2640575f 100644
--- a/objects/enhmetafile.c
+++ b/objects/enhmetafile.c
@@ -6,11 +6,10 @@
 #include <string.h>
 #include <assert.h>
 #include "winbase.h"
+#include "wingdi.h"
 #include "wine/winestring.h"
-#include "gdi.h"
-#include "winnt.h"
-#include "debug.h"
 #include "winerror.h"
+#include "debug.h"
 
 /*****************************************************************************
  *          GetEnhMetaFile32A (GDI32.174)
diff --git a/ole/itemmoniker.c b/ole/itemmoniker.c
index 1312e19a43ad0a36a7b220e9439b09fd7e27b0d7..b55dfd81667f6de82854fce4689eef0b7d650df5 100644
--- a/ole/itemmoniker.c
+++ b/ole/itemmoniker.c
@@ -10,8 +10,8 @@
 #include <assert.h>
 #include "winerror.h"
 #include "wine/obj_moniker.h"
-#include "debug.h"
 #include "heap.h"
+#include "debug.h"
 
 typedef struct ItemMonikerImpl{
 
diff --git a/ole/ole2.c b/ole/ole2.c
index 9f05278df06b659da39705af01ea7794761bdc58..72807bcb55ecfd214666c66bfe7397c9133117e9 100644
--- a/ole/ole2.c
+++ b/ole/ole2.c
@@ -469,7 +469,7 @@ HOLEMENU WINAPI OleCreateMenuDescriptor(
 {
   FIXME(ole,"(%x,%p),stub!\n", hmenuCombined, lpMenuWidths);
 
-  return NULL;
+  return 0;
 }
 
 /***********************************************************************
diff --git a/ole/olefont.c b/ole/olefont.c
index f8dd98fdeb1f2756bd9338f7dda175b7e4b091b4..e3a1743d173d1ee685b3bbce4604345c17fddecd 100644
--- a/ole/olefont.c
+++ b/ole/olefont.c
@@ -318,7 +318,7 @@ static OLEFontImpl* OLEFontImpl_Construct(LPFONTDESC fontDesc)
   /*
    * Initializing all the other members.
    */
-  newObject->gdiFont  = NULL;
+  newObject->gdiFont  = 0;
   newObject->fontLock = 0;
   newObject->cyHimetric = 1;
   newObject->cyLogical  = 1;
@@ -338,7 +338,7 @@ static void OLEFontImpl_Destroy(OLEFontImpl* fontDesc)
   if (fontDesc->description.lpstrName!=0)
     HeapFree(GetProcessHeap(), 0, fontDesc->description.lpstrName);
 
-  if (fontDesc->gdiFont!=NULL)
+  if (fontDesc->gdiFont!=0)
     DeleteObject(fontDesc->gdiFont);
 
   HeapFree(GetProcessHeap(), 0, fontDesc);
@@ -923,7 +923,7 @@ static HRESULT WINAPI OLEFontImpl_AddRefHfont(
 {
   _ICOM_THIS(OLEFontImpl, iface);
 
-  if ( (hfont == NULL) ||
+  if ( (hfont == 0) ||
        (hfont != this->gdiFont) )
     return E_INVALIDARG;
 
@@ -943,7 +943,7 @@ static HRESULT WINAPI OLEFontImpl_ReleaseHfont(
 {
   _ICOM_THIS(OLEFontImpl, iface);
 
-  if ( (hfont == NULL) ||
+  if ( (hfont == 0) ||
        (hfont != this->gdiFont) )
     return E_INVALIDARG;
 
@@ -955,7 +955,7 @@ static HRESULT WINAPI OLEFontImpl_ReleaseHfont(
   if (this->fontLock==0)
   {
     DeleteObject(this->gdiFont);
-    this->gdiFont = NULL; 
+    this->gdiFont = 0; 
 }
 
   return S_OK;
diff --git a/windows/dinput.c b/windows/dinput.c
index 6418bdf0d63953fad60ac688d4283a958025a79b..800e489882a0cf659c3fec94035adcc1414de642 100644
--- a/windows/dinput.c
+++ b/windows/dinput.c
@@ -27,7 +27,6 @@
 #include "winuser.h"
 #include "winerror.h"
 #include "wine/obj_base.h"
-#include "gdi.h"
 #include "dinput.h"
 #include "debug.h"
 #include "message.h"
@@ -890,9 +889,7 @@ static HRESULT WINAPI SysMouseAImpl_Acquire(LPDIRECTINPUTDEVICE2A iface)
   if (This->acquired == 0) {
     POINT       point;
 
-    /* This stores the current mouse handler.
-       FIXME : need to be fixed for native USER use */
-      WND *tempWnd = 0;
+    /* This stores the current mouse handler. */
     This->prev_handler = mouse_event;
     
     /* Store (in a global variable) the current lock */
diff --git a/windows/input.c b/windows/input.c
index 7d85979b10ed66a61a6b571e82f5dfde62cf318f..4d34e4b506591d4c169630734f74ab9fb3e89742 100644
--- a/windows/input.c
+++ b/windows/input.c
@@ -19,7 +19,6 @@
 #include "wine/winuser16.h"
 #include "wine/keyboard16.h"
 #include "win.h"
-#include "gdi.h"
 #include "heap.h"
 #include "input.h"
 #include "keyboard.h"
diff --git a/windows/keyboard.c b/windows/keyboard.c
index 9df57fa1e193cd8f247204be19db7ff5e9c2379b..2ddf79327c7eb9910dfd198b8ff395523f224e3a 100644
--- a/windows/keyboard.c
+++ b/windows/keyboard.c
@@ -17,7 +17,6 @@
 #include "winuser.h"
 #include "wine/keyboard16.h"
 #include "win.h"
-#include "gdi.h"
 #include "heap.h"
 #include "keyboard.h"
 #include "message.h"
diff --git a/windows/message.c b/windows/message.c
index 668460e29604c5d0706e36a5ec04380707015634..e0b2315e8e29aa543c3930be9b1296e64db88962 100644
--- a/windows/message.c
+++ b/windows/message.c
@@ -14,7 +14,6 @@
 #include "message.h"
 #include "winerror.h"
 #include "win.h"
-#include "gdi.h"
 #include "sysmetrics.h"
 #include "heap.h"
 #include "hook.h"
diff --git a/windows/painting.c b/windows/painting.c
index 520457b2760f78d07e4c15611d19082701be0ae6..3eb9f99e871a43697f666ed479fe6c8e6566a068 100644
--- a/windows/painting.c
+++ b/windows/painting.c
@@ -10,7 +10,6 @@
 
 #include "win.h"
 #include "queue.h"
-#include "gdi.h"
 #include "dce.h"
 #include "heap.h"
 #include "debug.h"
diff --git a/windows/queue.c b/windows/queue.c
index adf918be456fa74e38226e71c9906556113b647f..73392cbbaf7cdab88919cfb72bb624c64e7d3549 100644
--- a/windows/queue.c
+++ b/windows/queue.c
@@ -1336,7 +1336,6 @@ HTASK16 WINAPI GetWindowTask16( HWND16 hwnd )
 DWORD WINAPI GetWindowThreadProcessId( HWND hwnd, LPDWORD process )
 {
     HTASK16 htask;
-    DWORD retvalue;
     TDB	*tdb;
 
     WND *wndPtr = WIN_FindWndPtr( hwnd );
diff --git a/windows/syscolor.c b/windows/syscolor.c
index b2222ca6e08e6856b59bdb11351240dbc9e8781f..eade0c342ee99b13ac766ab7e2ba9d2ce6260289 100644
--- a/windows/syscolor.c
+++ b/windows/syscolor.c
@@ -12,7 +12,6 @@
 #include "winbase.h"
 #include "winuser.h"
 #include "debug.h"
-#include "gdi.h"
 #include "tweak.h"
 
 static const char * const DefSysColors[] =
diff --git a/windows/sysmetrics.c b/windows/sysmetrics.c
index 8803fa56ec77f72cec4d1d7128cb2544c1227b02..ca11fcdb8b3e5c4ee45fc437c2537ff7fe4647db 100644
--- a/windows/sysmetrics.c
+++ b/windows/sysmetrics.c
@@ -8,7 +8,6 @@
 #include <stdio.h>
 #include "winbase.h"
 #include "winuser.h"
-#include "gdi.h"
 #include "monitor.h"
 #include "options.h"
 #include "sysmetrics.h"
diff --git a/windows/user.c b/windows/user.c
index b54ea8c044e523a90ebd3dde0c564a2c919ff406..f573558c21f3aee683151b67a95b3c5195081cc2 100644
--- a/windows/user.c
+++ b/windows/user.c
@@ -9,8 +9,8 @@
 #include "wine/winbase16.h"
 #include "winuser.h"
 #include "heap.h"
-#include "gdi.h"
 #include "user.h"
+#include "gdi.h"
 #include "task.h"
 #include "queue.h"
 #include "win.h"
@@ -18,7 +18,6 @@
 #include "menu.h"
 #include "cursoricon.h"
 #include "hook.h"
-#include "debug.h"
 #include "toolhelp.h"
 #include "message.h"
 #include "module.h"
@@ -28,6 +27,7 @@
 #include "local.h"
 #include "class.h"
 #include "desktop.h"
+#include "debug.h"
 
 /***********************************************************************
  *           GetFreeSystemResources   (USER.284)