ANSI C fixes.
Removed warnings.
Made the include files self-sufficient.
Some Solaris fixes.

diff --git a/controls/desktop.c b/controls/desktop.c
index 462625f..c170f2c 100644
--- a/controls/desktop.c
+++ b/controls/desktop.c
@@ -22,7 +22,7 @@
 /***********************************************************************
  *		DESKTOP_IsSingleWindow
  */
-BOOL DESKTOP_IsSingleWindow()
+BOOL DESKTOP_IsSingleWindow(void)
 {
   BOOL retvalue;
   DESKTOP *pDesktop = (DESKTOP *) WIN_GetDesktop()->wExtra;
diff --git a/controls/edit.c b/controls/edit.c
index 33fe741..f9debfa 100644
--- a/controls/edit.c
+++ b/controls/edit.c
@@ -154,11 +154,7 @@
 static inline void		EDIT_EM_EmptyUndoBuffer(WND *wnd, EDITSTATE *es);
 static inline void		EDIT_WM_Clear(WND *wnd, EDITSTATE *es);
 static inline void		EDIT_WM_Cut(WND *wnd, EDITSTATE *es);
-/*
- *	This is the only exported function
- */
-LRESULT WINAPI EditWndProc( HWND hwnd, UINT msg,
-                            WPARAM wParam, LPARAM lParam );
+
 /*
  *	Helper functions only valid for one type of control
  */
diff --git a/controls/menu.c b/controls/menu.c
index e9ac2d9..5b8d382 100644
--- a/controls/menu.c
+++ b/controls/menu.c
@@ -295,7 +295,7 @@
  *
  * Return the locked pointer pTopPopupWnd.
  */
-WND *MENU_GetTopPopupWnd()
+static WND *MENU_GetTopPopupWnd()
 {
     return WIN_LockWndPtr(pTopPopupWnd);
 }
@@ -304,7 +304,7 @@
  *
  * Realease the locked pointer pTopPopupWnd.
  */
-void MENU_ReleaseTopPopupWnd()
+static void MENU_ReleaseTopPopupWnd()
 {
     WIN_ReleaseWndPtr(pTopPopupWnd);
 }
@@ -313,7 +313,7 @@
  *
  * Destroy the locked pointer pTopPopupWnd.
  */
-void MENU_DestroyTopPopupWnd()
+static void MENU_DestroyTopPopupWnd()
 {
     WND *tmpWnd = pTopPopupWnd;
     pTopPopupWnd = NULL;
diff --git a/controls/uitools.c b/controls/uitools.c
index b7251d5..b0aa3aa 100644
--- a/controls/uitools.c
+++ b/controls/uitools.c
@@ -5,6 +5,7 @@
  * Copyright 1997 Bertho A. Stultiens
  */
 
+#include "wine/winuser16.h"
 #include "winuser.h"
 #include "debugtools.h"
 
diff --git a/controls/widgets.c b/controls/widgets.c
index e81f689..f13196e 100644
--- a/controls/widgets.c
+++ b/controls/widgets.c
@@ -4,33 +4,20 @@
  * Copyright 1993 Alexandre Julliard
  */
 
-#include <string.h>
 #include <assert.h>
+#include <string.h>
 
 #include "win.h"
 #include "button.h"
-#include "static.h"
-#include "scroll.h"
+#include "combo.h"
 #include "desktop.h"
-#include "mdi.h"
 #include "gdi.h"
-#include "module.h"
 #include "heap.h"
-
-/* Window procedures */
-
-extern LRESULT WINAPI EditWndProc( HWND hwnd, UINT msg,
-                                   WPARAM wParam, LPARAM lParam );
-extern LRESULT WINAPI ComboWndProc( HWND hwnd, UINT msg,
-                                    WPARAM wParam, LPARAM lParam );
-extern LRESULT WINAPI ComboLBWndProc( HWND hwnd, UINT msg,
-                                      WPARAM wParam, LPARAM lParam );
-extern LRESULT WINAPI ListBoxWndProc( HWND hwnd, UINT msg,
-                                      WPARAM wParam, LPARAM lParam );
-extern LRESULT WINAPI PopupMenuWndProc( HWND hwnd, UINT msg,
-                                        WPARAM wParam, LPARAM lParam );
-extern LRESULT WINAPI IconTitleWndProc( HWND hwnd, UINT msg,
-                                        WPARAM wParam, LPARAM lParam );
+#include "mdi.h"
+#include "menu.h"
+#include "module.h"
+#include "scroll.h"
+#include "static.h"
 
 /* Built-in classes */
 
diff --git a/debugger/debug.l b/debugger/debug.l
index d8f96a9..02aa298 100644
--- a/debugger/debug.l
+++ b/debugger/debug.l
@@ -23,7 +23,7 @@
 	if ( (result = dbg_read((char *) buf, max_size )) < 0 ) \
 	    YY_FATAL_ERROR( "read() in flex scanner failed" );
 
-extern char * readline(char *);
+extern char * readline(const char *);
 extern void add_history(char *);
 static int dbg_read(char * buf, int size);
 static char * make_symbol(char *);
diff --git a/debugger/editline.c b/debugger/editline.c
index 37c8e13..3063357 100644
--- a/debugger/editline.c
+++ b/debugger/editline.c
@@ -27,11 +27,13 @@
 #include <ctype.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <unistd.h>
 #include <string.h>
 #include <errno.h>
 #include <sys/ioctl.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <unistd.h>
 
 #include "windef.h"
 #include "debugger.h"
@@ -151,8 +153,7 @@
 #include <termios.h>
 
 static void
-rl_ttyset(Reset)
-    int				Reset;
+rl_ttyset(int Reset)
 {
     static struct termios	old;
     struct termios		new;
@@ -181,8 +182,7 @@
 #else  /* HAVE_TCGETATTR */
 
 static void
-rl_ttyset(Reset)
-    int				Reset;
+rl_ttyset(int Reset)
 {
     static struct sgttyb	old_sgttyb;
     static struct tchars	old_tchars;
@@ -221,7 +221,7 @@
 #endif	/* HAVE_TCGETATTR */
 
 static void
-TTYflush()
+TTYflush(void)
 {
     if (ScreenCount) {
 	(void)write(1, Screen, ScreenCount);
@@ -230,8 +230,7 @@
 }
 
 static void
-TTYput(c)
-    CHAR	c;
+TTYput(CHAR c)
 {
     Screen[ScreenCount] = c;
     if (++ScreenCount >= ScreenSize - 1) {
@@ -241,16 +240,14 @@
 }
 
 static void
-TTYputs(p)
-    CHAR	*p;
+TTYputs(CHAR *p)
 {
     while (*p)
 	TTYput(*p++);
 }
 
 static void
-TTYshow(c)
-    CHAR	c;
+TTYshow(CHAR c)
 {
     if (c == DEL) {
 	TTYput('^');
@@ -270,15 +267,14 @@
 }
 
 static void
-TTYstring(p)
-    CHAR	*p;
+TTYstring(CHAR *p)
 {
     while (*p)
 	TTYshow(*p++);
 }
 
 static unsigned int
-TTYget()
+TTYget(void)
 {
     CHAR	c;
     int retv;
@@ -306,15 +302,14 @@
 #define TTYback()	(backspace ? TTYputs((CHAR *)backspace) : TTYput('\b'))
 
 static void
-TTYbackn(n)
-    int		n;
+TTYbackn(int n)
 {
     while (--n >= 0)
 	TTYback();
 }
 
 static void
-TTYinfo()
+TTYinfo(void)
 {
     static int		init;
 #if	defined(USE_TERMCAP)
@@ -370,7 +365,7 @@
 
 
 static void
-reposition()
+reposition(void)
 {
     int		i;
     CHAR	*p;
@@ -382,8 +377,7 @@
 }
 
 static void
-left(Change)
-    STATUS	Change;
+left(STATUS Change)
 {
     TTYback();
     if (Point) {
@@ -399,8 +393,7 @@
 }
 
 static void
-right(Change)
-    STATUS	Change;
+right(STATUS Change)
 {
     TTYshow(Line[Point]);
     if (Change == CSmove)
@@ -408,7 +401,7 @@
 }
 
 static STATUS
-ring_bell()
+ring_bell(void)
 {
     TTYput('\07');
     TTYflush();
@@ -416,8 +409,7 @@
 }
 
 static STATUS
-do_macro(c)
-    unsigned int	c;
+do_macro(unsigned int c)
 {
     CHAR		name[4];
 
@@ -434,8 +426,7 @@
 }
 
 static STATUS
-do_forward(move)
-    STATUS	move;
+do_forward(STATUS move)
 {
     int		i;
     CHAR	*p;
@@ -459,8 +450,7 @@
 }
 
 static STATUS
-do_case(type)
-    CASE	type;
+do_case(CASE type)
 {
     int		i;
     int		end;
@@ -488,19 +478,19 @@
 }
 
 static STATUS
-case_down_word()
+case_down_word(void)
 {
     return do_case(TOlower);
 }
 
 static STATUS
-case_up_word()
+case_up_word(void)
 {
     return do_case(TOupper);
 }
 
 static void
-ceol()
+ceol(void)
 {
     int		extras;
     int		i;
@@ -524,7 +514,7 @@
 }
 
 static void
-clear_line()
+clear_line(void)
 {
     Point = -strlen(Prompt);
     TTYput('\r');
@@ -535,8 +525,7 @@
 }
 
 static STATUS
-insert_string(p)
-    CHAR	*p;
+insert_string(CHAR *p)
 {
     size_t	len;
     int		i;
@@ -568,7 +557,7 @@
 
 
 static CHAR *
-next_hist()
+next_hist(void)
 {
     return H.Pos >= H.Size - 1 ? NULL : H.Lines[++H.Pos];
 }
@@ -580,8 +569,7 @@
 }
 
 static STATUS
-do_insert_hist(p)
-    CHAR	*p;
+do_insert_hist(CHAR *p)
 {
     if (p == NULL)
 	return ring_bell();
@@ -593,8 +581,7 @@
 }
 
 static STATUS
-do_hist(move)
-    CHAR	*(*move)();
+do_hist(CHAR *(*move)(void))
 {
     CHAR	*p;
     int		i;
@@ -608,25 +595,25 @@
 }
 
 static STATUS
-h_next()
+h_next(void)
 {
     return do_hist(next_hist);
 }
 
 static STATUS
-h_prev()
+h_prev(void)
 {
     return do_hist(prev_hist);
 }
 
 static STATUS
-h_first()
+h_first(void)
 {
     return do_insert_hist(H.Lines[H.Pos = 0]);
 }
 
 static STATUS
-h_last()
+h_last(void)
 {
     return do_insert_hist(H.Lines[H.Pos = H.Size - 1]);
 }
@@ -635,10 +622,7 @@
 **  Return zero if pat appears as a substring in text.
 */
 static int
-substrcmp(text, pat, len)
-    char	*text;
-    char	*pat;
-    int		len;
+substrcmp(char *text, char *pat, int len)
 {
     CHAR	c;
 
@@ -651,9 +635,7 @@
 }
 
 static CHAR *
-search_hist(search, move)
-    CHAR	*search;
-    CHAR	*(*move)();
+search_hist(CHAR *search, CHAR *(*move)(void))
 {
     static CHAR	*old_search;
     int		len;
@@ -692,7 +674,7 @@
 }
 
 static STATUS
-h_search()
+h_search(void)
 {
     static int	Searching;
     const char	*old_prompt;
@@ -718,7 +700,7 @@
 }
 
 static STATUS
-fd_char()
+fd_char(void)
 {
     int		i;
 
@@ -732,9 +714,7 @@
 }
 
 static void
-save_yank(begin, i)
-    int		begin;
-    int		i;
+save_yank(int begin, int i)
 {
     if (Yanked) {
 	DISPOSE(Yanked);
@@ -751,8 +731,7 @@
 }
 
 static STATUS
-delete_string(count)
-    int		count;
+delete_string(int count)
 {
     int		i;
     CHAR	*p;
@@ -794,7 +773,7 @@
 }
 
 static STATUS
-bk_char()
+bk_char(void)
 {
     int		i;
 
@@ -809,7 +788,7 @@
 }
 
 static STATUS
-bk_del_char()
+bk_del_char(void)
 {
     int		i;
 
@@ -824,7 +803,7 @@
 }
 
 static STATUS
-redisplay()
+redisplay(void)
 {
     TTYputs((CHAR *)NEWLINE);
     TTYputs((CHAR *)Prompt);
@@ -833,7 +812,7 @@
 }
 
 static STATUS
-kill_line()
+kill_line(void)
 {
     int		i;
 
@@ -859,8 +838,7 @@
 }
 
 static STATUS
-insert_char(c)
-    int		c;
+insert_char(int c)
 {
     STATUS	s;
     CHAR	buff[2];
@@ -886,7 +864,7 @@
 }
 
 static STATUS
-meta()
+meta(void)
 {
     unsigned int	c;
     KEYMAP		*kp;
@@ -922,8 +900,7 @@
 }
 
 static STATUS
-emacs(c)
-    unsigned int	c;
+emacs(unsigned int c)
 {
     STATUS		s;
     KEYMAP		*kp;
@@ -944,8 +921,7 @@
 }
 
 static STATUS
-TTYspecial(c)
-    unsigned int	c;
+TTYspecial(unsigned int c)
 {
     if (ISMETA(c))
 	return CSdispatch;
@@ -972,7 +948,7 @@
 }
 
 static CHAR *
-editinput()
+editinput(void)
 {
     unsigned int	c;
 
@@ -1010,8 +986,7 @@
 }
 
 static void
-hist_add(p)
-    CHAR	*p;
+hist_add(CHAR *p)
 {
     int		i;
 
@@ -1029,8 +1004,7 @@
 }
 
 char *
-readline(prompt)
-    const char	*prompt;
+readline(const char *prompt)
 {
     CHAR	*line;
 
@@ -1059,8 +1033,7 @@
 }
 
 void
-add_history(p)
-    char	*p;
+add_history(char *p)
 {
     if (p == NULL || *p == '\0')
 	return;
@@ -1074,7 +1047,7 @@
 
 
 static STATUS
-beg_line()
+beg_line(void)
 {
     if (Point) {
 	Point = 0;
@@ -1084,13 +1057,13 @@
 }
 
 static STATUS
-del_char()
+del_char(void)
 {
     return delete_string(Repeat == NO_ARG ? 1 : Repeat);
 }
 
 static STATUS
-end_line()
+end_line(void)
 {
     if (Point != End) {
 	Point = End;
@@ -1100,14 +1073,14 @@
 }
 
 static STATUS
-accept_line()
+accept_line(void)
 {
     Line[End] = '\0';
     return CSdone;
 }
 
 static STATUS
-transpose()
+transpose(void)
 {
     CHAR	c;
 
@@ -1125,7 +1098,7 @@
 }
 
 static STATUS
-quote()
+quote(void)
 {
     unsigned int	c;
 
@@ -1133,7 +1106,7 @@
 }
 
 static STATUS
-wipe()
+wipe(void)
 {
     int		i;
 
@@ -1151,14 +1124,14 @@
 }
 
 static STATUS
-mk_set()
+mk_set(void)
 {
     Mark = Point;
     return CSstay;
 }
 
 static STATUS
-exchange()
+exchange(void)
 {
     unsigned int	c;
 
@@ -1174,7 +1147,7 @@
 }
 
 static STATUS
-yank()
+yank(void)
 {
     if (Yanked && *Yanked)
 	return insert_string(Yanked);
@@ -1182,7 +1155,7 @@
 }
 
 static STATUS
-copy_region()
+copy_region(void)
 {
     if (Mark > End)
 	return ring_bell();
@@ -1196,7 +1169,7 @@
 }
 
 static STATUS
-move_to_char()
+move_to_char(void)
 {
     unsigned int	c;
     int			i;
@@ -1213,13 +1186,13 @@
 }
 
 static STATUS
-fd_word()
+fd_word(void)
 {
     return do_forward(CSmove);
 }
 
 static STATUS
-fd_kill_word()
+fd_kill_word(void)
 {
     int		i;
 
@@ -1233,7 +1206,7 @@
 }
 
 static STATUS
-bk_word()
+bk_word(void)
 {
     int		i;
     CHAR	*p;
@@ -1254,7 +1227,7 @@
 }
 
 static STATUS
-bk_kill_word()
+bk_kill_word(void)
 {
     (void)bk_word();
     if (OldPoint != Point)
@@ -1263,9 +1236,7 @@
 }
 
 static int
-argify(line, avp)
-    CHAR	*line;
-    CHAR	***avp;
+argify(CHAR *line, CHAR ***avp)
 {
     CHAR	*c;
     CHAR	**p;
@@ -1309,7 +1280,7 @@
 }
 
 static STATUS
-last_argument()
+last_argument(void)
 {
     CHAR	**av;
     CHAR	*p;
diff --git a/debugger/stabs.c b/debugger/stabs.c
index 3a5b77a..2758ac7 100644
--- a/debugger/stabs.c
+++ b/debugger/stabs.c
@@ -93,7 +93,7 @@
   struct known_typedef * next;
   char		       * name;
   int			 ndefs;
-  struct datatype      * types[0];
+  struct datatype      * types[1];
 };
 
 #define NR_STAB_HASH 521
@@ -221,7 +221,7 @@
       return TRUE;
 
   ktd = (struct known_typedef *) DBG_alloc(sizeof(struct known_typedef) 
-					 + ndef * sizeof(struct datatype *));
+					 + (ndef - 1) * sizeof(struct datatype *));
   
   hash = stab_hash(name);
 
diff --git a/dlls/comctl32/animate.c b/dlls/comctl32/animate.c
index 32a3a2e..906bdc9 100644
--- a/dlls/comctl32/animate.c
+++ b/dlls/comctl32/animate.c
@@ -93,7 +93,7 @@
 
 
 static VOID
-ANIMATE_GetAviInfo (infoPtr)
+ANIMATE_GetAviInfo (ANIMATE_INFO *infoPtr)
 {
 
 
@@ -305,7 +305,7 @@
 
 
 VOID
-ANIMATE_Register (VOID)
+ANIMATE_Register (void)
 {
     WNDCLASSA wndClass;
 
@@ -325,7 +325,7 @@
 
 
 VOID
-ANIMATE_Unregister (VOID)
+ANIMATE_Unregister (void)
 {
     if (GlobalFindAtomA (ANIMATE_CLASSA))
 	UnregisterClassA (ANIMATE_CLASSA, (HINSTANCE)NULL);
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index 3303a9f..bb04095 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -2040,7 +2040,7 @@
  * RETURN:
  * Number of columns.
  */
-static INT LISTVIEW_GetColumnCount(hwnd)
+static INT LISTVIEW_GetColumnCount(HWND hwnd)
 {
   LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0);
   LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE);
@@ -6767,7 +6767,7 @@
  * RETURN:
  * None
  */
-VOID LISTVIEW_Register(VOID)
+VOID LISTVIEW_Register(void)
 {
   WNDCLASSA wndClass;
 
@@ -6795,7 +6795,7 @@
  * RETURN:
  * None
  */
-VOID LISTVIEW_Unregister(VOID)
+VOID LISTVIEW_Unregister(void)
 {
   if (GlobalFindAtomA(WC_LISTVIEWA))
   {
diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c
index af60878..ebb7ced 100644
--- a/dlls/comctl32/toolbar.c
+++ b/dlls/comctl32/toolbar.c
@@ -3227,7 +3227,7 @@
 
 
 VOID
-TOOLBAR_Register (VOID)
+TOOLBAR_Register (void)
 {
     WNDCLASSA wndClass;
 
@@ -3247,7 +3247,7 @@
 
 
 VOID
-TOOLBAR_Unregister (VOID)
+TOOLBAR_Unregister (void)
 {
     if (GlobalFindAtomA (TOOLBARCLASSNAMEA))
 	UnregisterClassA (TOOLBARCLASSNAMEA, (HINSTANCE)NULL);
diff --git a/dlls/comctl32/trackbar.c b/dlls/comctl32/trackbar.c
index cb4eb36..9e98165 100644
--- a/dlls/comctl32/trackbar.c
+++ b/dlls/comctl32/trackbar.c
@@ -85,7 +85,7 @@
 /* converts from physical (mouse) position to logical position 
    (in range of trackbar) */
 
-static __inline__ DOUBLE
+static inline DOUBLE
 TRACKBAR_ConvertPlaceToPosition (TRACKBAR_INFO *infoPtr, int place, 
                                  int vertical) 
 {
diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c
index 7068eae..daad007 100644
--- a/dlls/comctl32/treeview.c
+++ b/dlls/comctl32/treeview.c
@@ -3570,7 +3570,7 @@
 
 
 VOID
-TREEVIEW_Register (VOID)
+TREEVIEW_Register (void)
 {
     WNDCLASSA wndClass;
 
@@ -3592,7 +3592,7 @@
 
 
 VOID
-TREEVIEW_Unregister (VOID)
+TREEVIEW_Unregister (void)
 {
     if (GlobalFindAtomA (WC_TREEVIEWA))
 	UnregisterClassA (WC_TREEVIEWA, (HINSTANCE)NULL);
diff --git a/dlls/commdlg/finddlg32.c b/dlls/commdlg/finddlg32.c
index d29ee1a..1c0b783 100644
--- a/dlls/commdlg/finddlg32.c
+++ b/dlls/commdlg/finddlg32.c
@@ -49,7 +49,7 @@
  *	RETURNS
  *		Current state of check and radio buttons
  */
-DWORD COMDLG32_FR_GetFlags(HWND hDlgWnd)
+static DWORD COMDLG32_FR_GetFlags(HWND hDlgWnd)
 {
 	DWORD flags = 0;
 	if(IsDlgButtonChecked(hDlgWnd, rad2) == BST_CHECKED)
@@ -65,7 +65,7 @@
  *	COMDLG32_FR_HandleWMCommand		[internal]
  * Handle WM_COMMAND messages...
  */
-void COMDLG32_FR_HandleWMCommand(HWND hDlgWnd, COMDLG32_FR_Data *pData, int Id, int NotifyCode)
+static void COMDLG32_FR_HandleWMCommand(HWND hDlgWnd, COMDLG32_FR_Data *pData, int Id, int NotifyCode)
 {
 	DWORD flag;
 
@@ -148,7 +148,7 @@
  *	COMDLG32_FindReplaceDlgProc		[internal]
  * [Find/Replace]Text32[A/W] window procedure.
  */
-BOOL CALLBACK COMDLG32_FindReplaceDlgProc(HWND hDlgWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
+static BOOL CALLBACK COMDLG32_FindReplaceDlgProc(HWND hDlgWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
 {
 	COMDLG32_FR_Data *pdata = (COMDLG32_FR_Data *)GetPropA(hDlgWnd, (LPSTR)COMDLG32_Atom);
 	BOOL retval = TRUE;;
@@ -272,7 +272,7 @@
  *		TRUE: Succes
  *		FALSE: Failure
  */
-BOOL COMDLG32_FR_CheckPartial(
+static BOOL COMDLG32_FR_CheckPartial(
 	LPFINDREPLACEA pfr,	/* [in] Find structure */
         BOOL Replace		/* [in] True if called as replace */
 ) {
@@ -340,7 +340,7 @@
  *		Window handle to created dialog:Succes
  *		NULL:Failure
  */
-HWND COMDLG32_FR_DoFindReplace(
+static HWND COMDLG32_FR_DoFindReplace(
 	COMDLG32_FR_Data *pdata	/* [in] Internal data structure */
 ) {
 	HWND hdlgwnd = 0;
diff --git a/dlls/commdlg/fontdlg.c b/dlls/commdlg/fontdlg.c
index 75937cf..77b5184 100644
--- a/dlls/commdlg/fontdlg.c
+++ b/dlls/commdlg/fontdlg.c
@@ -286,7 +286,7 @@
 /*************************************************************************
  *              FontFamilyEnumProc32                           [internal]
  */
-INT WINAPI FontFamilyEnumProc(LPENUMLOGFONTA lpEnumLogFont, 
+static INT WINAPI FontFamilyEnumProc(LPENUMLOGFONTA lpEnumLogFont, 
 	  LPNEWTEXTMETRICA metrics, UINT nFontType, LPARAM lParam)
 {
   LPCFn_ENUMSTRUCT e;
@@ -393,7 +393,7 @@
 /***********************************************************************
  *                 AddFontStyle                          [internal]
  */
-INT AddFontStyle(LPLOGFONTA lplf, UINT nFontType, 
+static INT AddFontStyle(LPLOGFONTA lplf, UINT nFontType, 
     LPCHOOSEFONTA lpcf, HWND hcmb2, HWND hcmb3, HWND hDlg)
 {
   int i;
@@ -444,7 +444,7 @@
 /***********************************************************************
  *                 FontStyleEnumProc32                     [internal]
  */
-INT WINAPI FontStyleEnumProc( LPENUMLOGFONTA lpFont, 
+static INT WINAPI FontStyleEnumProc( LPENUMLOGFONTA lpFont, 
           LPNEWTEXTMETRICA metrics, UINT nFontType, LPARAM lParam )
 {
   LPCFn_ENUMSTRUCT s=(LPCFn_ENUMSTRUCT)lParam;
@@ -458,7 +458,7 @@
 /***********************************************************************
  *           CFn_WMInitDialog                            [internal]
  */
-LRESULT CFn_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam,
+static LRESULT CFn_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam,
                          LPCHOOSEFONTA lpcf)
 {
   HDC hdc;
@@ -579,7 +579,7 @@
 /***********************************************************************
  *           CFn_WMMeasureItem                           [internal]
  */
-LRESULT CFn_WMMeasureItem(HWND hDlg, WPARAM wParam, LPARAM lParam)
+static LRESULT CFn_WMMeasureItem(HWND hDlg, WPARAM wParam, LPARAM lParam)
 {
   BITMAP bm;
   LPMEASUREITEMSTRUCT lpmi=(LPMEASUREITEMSTRUCT)lParam;
@@ -595,7 +595,7 @@
 /***********************************************************************
  *           CFn_WMDrawItem                              [internal]
  */
-LRESULT CFn_WMDrawItem(HWND hDlg, WPARAM wParam, LPARAM lParam)
+static LRESULT CFn_WMDrawItem(HWND hDlg, WPARAM wParam, LPARAM lParam)
 {
   HBRUSH hBrush;
   char buffer[40];
@@ -697,7 +697,7 @@
 /***********************************************************************
  *           CFn_WMCtlColor                              [internal]
  */
-LRESULT CFn_WMCtlColorStatic(HWND hDlg, WPARAM wParam, LPARAM lParam,
+static LRESULT CFn_WMCtlColorStatic(HWND hDlg, WPARAM wParam, LPARAM lParam,
                              LPCHOOSEFONTA lpcf)
 {
   if (lpcf->Flags & CF_EFFECTS)
@@ -712,7 +712,7 @@
 /***********************************************************************
  *           CFn_WMCommand                               [internal]
  */
-LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam,
+static LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam,
                       LPCHOOSEFONTA lpcf)
 {
   HFONT hFont;
diff --git a/dlls/commdlg/printdlg.c b/dlls/commdlg/printdlg.c
index cabc002..bdb5cc2 100644
--- a/dlls/commdlg/printdlg.c
+++ b/dlls/commdlg/printdlg.c
@@ -242,7 +242,7 @@
 /***********************************************************************
  *               PRINTDLG_UpdatePrinterInfoTexts               [internal]
  */
-void PRINTDLG_UpdatePrinterInfoTexts(HWND hDlg, PRINT_PTRA* PrintStructures)
+static void PRINTDLG_UpdatePrinterInfoTexts(HWND hDlg, PRINT_PTRA* PrintStructures)
 {
 	char   PrinterName[256];
     char   StatusMsg[256];
@@ -272,8 +272,8 @@
 /***********************************************************************
  *           PRINTDLG_WMInitDialog                      [internal]
  */
-LRESULT PRINTDLG_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam,
-                         PRINT_PTRA* PrintStructures)
+static LRESULT PRINTDLG_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam,
+				     PRINT_PTRA* PrintStructures)
 {
  int         i;
  LPPRINTDLGA lppd = PrintStructures->lpPrintDlg;
@@ -377,8 +377,8 @@
  *   FALSE if user is not allowed to close (i.e. wrong nTo or nFrom values)
  *   TRUE  if succesful.
  */
-BOOL PRINTDLG_ValidateAndDuplicateSettings(HWND hDlg, 
-                                           PRINT_PTRA* PrintStructures)
+static BOOL PRINTDLG_ValidateAndDuplicateSettings(HWND hDlg, 
+						  PRINT_PTRA* PrintStructures)
 {
  LPPRINTDLGA lppd = PrintStructures->lpPrintDlg;
  
diff --git a/dlls/ntdll/rtl.c b/dlls/ntdll/rtl.c
index 1e18e63..8e9ec99 100644
--- a/dlls/ntdll/rtl.c
+++ b/dlls/ntdll/rtl.c
@@ -398,7 +398,7 @@
 		*rest = x1 % divisor;
 	return x1/divisor;
 #else
-	FIXME("((%d<<32)+%d,%d,%p), implement this using normal integer arithmetic!\n",dividend.HighPart,dividend.LowPart,divisor,rest);
+	FIXME("((%ld<<32)+%ld,%ld,%p), implement this using normal integer arithmetic!\n",dividend.HighPart,dividend.LowPart,divisor,rest);
 	return 0;
 #endif
 }
@@ -415,7 +415,7 @@
 #if SIZEOF_LONG_LONG==8
 	return (*(long long*)&factor1) * factor2;
 #else
-	FIXME("((%d<<32)+%d,%ld), implement this using normal integer arithmetic!\n",factor1.HighPart,factor1.LowPart,factor2);
+	FIXME("((%ld<<32)+%ld,%d), implement this using normal integer arithmetic!\n",factor1.HighPart,factor1.LowPart,factor2);
 	return 0;
 #endif
 }
diff --git a/dlls/winaspi/winaspi16.c b/dlls/winaspi/winaspi16.c
index d1983c1..09fa06b 100644
--- a/dlls/winaspi/winaspi16.c
+++ b/dlls/winaspi/winaspi16.c
@@ -28,6 +28,8 @@
 
 #ifdef linux
 
+static ASPI_DEVICE_INFO *ASPI_open_devices = NULL;
+
 static FARPROC16 ASPIChainFunc = NULL;
 static WORD HA_Count = 1; /* host adapter count; FIXME: detect it */
 
diff --git a/dlls/wnaspi32/winaspi32.c b/dlls/wnaspi32/winaspi32.c
index 30d11f0..a62c443 100644
--- a/dlls/wnaspi32/winaspi32.c
+++ b/dlls/wnaspi32/winaspi32.c
@@ -25,6 +25,9 @@
  */
 
 #ifdef linux
+
+static ASPI_DEVICE_INFO *ASPI_open_devices = NULL;
+
 static int
 ASPI_OpenDevice(SRB_ExecSCSICmd *prb)
 {
diff --git a/files/directory.c b/files/directory.c
index b1833ea..351d959 100644
--- a/files/directory.c
+++ b/files/directory.c
@@ -16,6 +16,7 @@
 #include "winbase.h"
 #include "wine/winbase16.h"
 #include "wine/winestring.h"
+#include "wine/winuser16.h"
 #include "winerror.h"
 #include "process.h"
 #include "drive.h"
diff --git a/graphics/ddraw.c b/graphics/ddraw.c
index a16b6ca..95d2d59 100644
--- a/graphics/ddraw.c
+++ b/graphics/ddraw.c
@@ -96,14 +96,23 @@
     {0x84, 0x07, 0xf7, 0x87, 0x5a, 0x7d, 0x18, 0x79}
 };
 
-static struct ICOM_VTABLE(IDirectDrawSurface4)	dga_dds4vt, xlib_dds4vt;
-static struct ICOM_VTABLE(IDirectDraw)		dga_ddvt, xlib_ddvt;
-static struct ICOM_VTABLE(IDirectDraw2)		dga_dd2vt, xlib_dd2vt;
-static struct ICOM_VTABLE(IDirectDraw4)		dga_dd4vt, xlib_dd4vt;
+#ifdef HAVE_LIBXXF86DGA
+static struct ICOM_VTABLE(IDirectDrawSurface4)	dga_dds4vt;
+static struct ICOM_VTABLE(IDirectDraw)		dga_ddvt;
+static struct ICOM_VTABLE(IDirectDraw2)		dga_dd2vt;
+static struct ICOM_VTABLE(IDirectDraw4)		dga_dd4vt;
+static struct ICOM_VTABLE(IDirectDrawPalette)	dga_ddpalvt;
+#endif /* defined(HAVE_LIBXXF86DGA) */
+
+static struct ICOM_VTABLE(IDirectDrawSurface4)	xlib_dds4vt;
+static struct ICOM_VTABLE(IDirectDraw)		xlib_ddvt;
+static struct ICOM_VTABLE(IDirectDraw2)		xlib_dd2vt;
+static struct ICOM_VTABLE(IDirectDraw4)		xlib_dd4vt;
+static struct ICOM_VTABLE(IDirectDrawPalette)	xlib_ddpalvt;
+
 static struct ICOM_VTABLE(IDirectDrawClipper)	ddclipvt;
-static struct ICOM_VTABLE(IDirectDrawPalette) dga_ddpalvt, xlib_ddpalvt;
-static struct ICOM_VTABLE(IDirect3D)			d3dvt;
-static struct ICOM_VTABLE(IDirect3D2)			d3d2vt;
+static struct ICOM_VTABLE(IDirect3D)		d3dvt;
+static struct ICOM_VTABLE(IDirect3D2)		d3d2vt;
 
 #ifdef HAVE_LIBXXF86VM
 static XF86VidModeModeInfo *orig_mode = NULL;
@@ -629,6 +638,7 @@
 	return DD_OK;
 }
 
+#ifdef HAVE_LIBXXF86DGA
 static HRESULT WINAPI DGA_IDirectDrawSurface4Impl_Unlock(
 	LPDIRECTDRAWSURFACE4 iface,LPVOID surface
 ) {
@@ -636,6 +646,7 @@
 	TRACE(ddraw,"(%p)->Unlock(%p)\n",This,surface);
 	return DD_OK;
 }
+#endif /* defined(HAVE_LIBXXF86DGA) */
 
 static void Xlib_copy_surface_on_screen(IDirectDrawSurface4Impl* This) {
   if (This->s.ddraw->d.pixel_convert != NULL)
@@ -688,12 +699,12 @@
 	return DD_OK;
 }
 
+#ifdef HAVE_LIBXXF86DGA
 static HRESULT WINAPI DGA_IDirectDrawSurface4Impl_Flip(
 	LPDIRECTDRAWSURFACE4 iface,LPDIRECTDRAWSURFACE4 flipto,DWORD dwFlags
 ) {
         ICOM_THIS(IDirectDrawSurface4Impl,iface);
         IDirectDrawSurface4Impl* iflipto=(IDirectDrawSurface4Impl*)flipto;
-#ifdef HAVE_LIBXXF86DGA
 	TRACE(ddraw,"(%p)->Flip(%p,%08lx)\n",This,iflipto,dwFlags);
 	if (!iflipto) {
 		if (This->s.backbuffer)
@@ -721,10 +732,8 @@
 		iflipto->s.surface_desc.y.lpSurface = ptmp;
 	}
 	return DD_OK;
-#else /* defined(HAVE_LIBXXF86DGA) */
-	return E_UNEXPECTED;
-#endif /* defined(HAVE_LIBXXF86DGA) */
 }
+#endif /* defined(HAVE_LIBXXF86DGA) */
 
 static HRESULT WINAPI Xlib_IDirectDrawSurface4Impl_Flip(
 	LPDIRECTDRAWSURFACE4 iface,LPDIRECTDRAWSURFACE4 flipto,DWORD dwFlags
@@ -841,13 +850,14 @@
 	return DD_OK;
 }
 
+#ifdef HAVE_LIBXXF86DGA
 static HRESULT WINAPI DGA_IDirectDrawSurface4Impl_SetPalette(
 	LPDIRECTDRAWSURFACE4 iface,LPDIRECTDRAWPALETTE pal
 ) {
         ICOM_THIS(IDirectDrawSurface4Impl,iface);
         IDirectDrawPaletteImpl* ipal=(IDirectDrawPaletteImpl*)pal;
 	TRACE(ddraw,"(%p)->(%p)\n",This,ipal);
-#ifdef HAVE_LIBXXF86DGA
+
         /* According to spec, we are only supposed to 
          * AddRef if this is not the same palette.
          */
@@ -870,12 +880,8 @@
 	  TSXF86DGAInstallColormap(display,DefaultScreen(display),This->s.palette->cm);
         }
 	return DD_OK;
-#else /* defined(HAVE_LIBXXF86DGA) */
-	return E_UNEXPECTED;
-#endif /* defined(HAVE_LIBXXF86DGA) */
-
-
 }
+#endif /* defined(HAVE_LIBXXF86DGA) */
 
 static HRESULT _Blt_ColorFill(LPBYTE buf, int width, int height, int bpp, LONG lPitch, DWORD color)
 {
@@ -1275,11 +1281,11 @@
 	return ++(This->ref);
 }
 
+#ifdef HAVE_LIBXXF86DGA
 static ULONG WINAPI DGA_IDirectDrawSurface4Impl_Release(LPDIRECTDRAWSURFACE4 iface) {
         ICOM_THIS(IDirectDrawSurface4Impl,iface);
         TRACE( ddraw, "(%p)->() decrementing from %lu.\n", This, This->ref );
 
-#ifdef HAVE_LIBXXF86DGA
 	if (!--(This->ref)) {
 		IDirectDraw2_Release((IDirectDraw2*)This->s.ddraw);
 		/* clear out of surface list */
@@ -1303,9 +1309,9 @@
 		HeapFree(GetProcessHeap(),0,This);
 		return 0;
 	}
-#endif /* defined(HAVE_LIBXXF86DGA) */
 	return This->ref;
 }
+#endif /* defined(HAVE_LIBXXF86DGA) */
 
 static ULONG WINAPI Xlib_IDirectDrawSurface4Impl_Release(LPDIRECTDRAWSURFACE4 iface) {
         ICOM_THIS(IDirectDrawSurface4Impl,iface);
@@ -1982,6 +1988,7 @@
   return DD_OK;
 }
 
+#ifdef HAVE_LIBXXF86DGA
 static ICOM_VTABLE(IDirectDrawSurface4) dga_dds4vt = 
 {
 	ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
@@ -2031,6 +2038,7 @@
 	IDirectDrawSurface4Impl_GetUniquenessValue,
 	IDirectDrawSurface4Impl_ChangeUniquenessValue
 };
+#endif /* defined(HAVE_LIBXXF86DGA) */
 
 static ICOM_VTABLE(IDirectDrawSurface4) xlib_dds4vt = 
 {
@@ -2261,10 +2269,10 @@
 	return DD_OK;
 }
 
+#ifdef HAVE_LIBXXF86DGA
 static HRESULT WINAPI DGA_IDirectDrawPaletteImpl_SetEntries(
 	LPDIRECTDRAWPALETTE iface,DWORD x,DWORD start,DWORD count,LPPALETTEENTRY palent
 ) {
-#ifdef HAVE_LIBXXF86DGA
         ICOM_THIS(IDirectDrawPaletteImpl,iface);
 	XColor		xc;
 	Colormap	cm;
@@ -2298,10 +2306,8 @@
 	}
 	TSXF86DGAInstallColormap(display,DefaultScreen(display),This->cm);
 	return DD_OK;
-#else /* defined(HAVE_LIBXXF86DGA) */
-	return E_UNEXPECTED;
-#endif /* defined(HAVE_LIBXXF86DGA) */
 }
+#endif /* defined(HAVE_LIBXXF86DGA) */
 
 static ULONG WINAPI IDirectDrawPaletteImpl_Release(LPDIRECTDRAWPALETTE iface) {
         ICOM_THIS(IDirectDrawPaletteImpl,iface);
@@ -2353,6 +2359,7 @@
   return S_OK;
 }
 
+#ifdef HAVE_LIBXXF86DGA
 static ICOM_VTABLE(IDirectDrawPalette) dga_ddpalvt = 
 {
 	ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
@@ -2364,6 +2371,7 @@
 	IDirectDrawPaletteImpl_Initialize,
 	DGA_IDirectDrawPaletteImpl_SetEntries
 };
+#endif /* defined(HAVE_LIBXXF86DGA) */
 
 static ICOM_VTABLE(IDirectDrawPalette) xlib_ddpalvt = 
 {
@@ -2743,10 +2751,10 @@
   return DD_OK;
 }
 
+#ifdef HAVE_LIBXXF86DGA
 static HRESULT WINAPI DGA_IDirectDraw2Impl_CreateSurface(
 	LPDIRECTDRAW2 iface,LPDDSURFACEDESC lpddsd,LPDIRECTDRAWSURFACE *lpdsf,IUnknown *lpunk
 ) {
-#ifdef HAVE_LIBXXF86DGA
         ICOM_THIS(IDirectDraw2Impl,iface);
         IDirectDrawSurfaceImpl** ilpdsf=(IDirectDrawSurfaceImpl**)lpdsf;
 	int	i;
@@ -2847,10 +2855,8 @@
 	}
 	
 	return DD_OK;
-#else /* defined(HAVE_LIBXXF86DGA) */
-	return E_UNEXPECTED;
-#endif /* defined(HAVE_LIBXXF86DGA) */
 }
+#endif /* defined(HAVE_LIBXXF86DGA) */
 
 #ifdef HAVE_LIBXXSHM
 /* Error handlers for Image creation */
@@ -3300,10 +3306,10 @@
   return match;
 }
 
+#ifdef HAVE_LIBXXF86DGA
 static HRESULT WINAPI DGA_IDirectDrawImpl_SetDisplayMode(
 	LPDIRECTDRAW iface,DWORD width,DWORD height,DWORD depth
 ) {
-#ifdef HAVE_LIBXXF86DGA
         ICOM_THIS(IDirectDrawImpl,iface);
         int	i,mode_count;
 
@@ -3387,10 +3393,8 @@
 	EXC_InitHandlers();
 #endif
 	return DD_OK;
-#else /* defined(HAVE_LIBXXF86DGA) */
-	return E_UNEXPECTED;
-#endif /* defined(HAVE_LIBXXF86DGA) */
 }
+#endif /* defined(HAVE_LIBXXF86DGA) */
 
 /* *************************************
       16 / 15 bpp to palettized 8 bpp
@@ -3637,10 +3641,10 @@
 	return DD_OK;
 }
 
+#ifdef HAVE_LIBXXF86DGA
 static HRESULT WINAPI DGA_IDirectDraw2Impl_GetCaps(
 	LPDIRECTDRAW2 iface,LPDDCAPS caps1,LPDDCAPS caps2
 ) {
-#ifdef HAVE_LIBXXF86DGA
         ICOM_THIS(IDirectDraw2Impl,iface);
 	TRACE(ddraw,"(%p)->GetCaps(%p,%p)\n",This,caps1,caps2);
 	if (!caps1 && !caps2)
@@ -3656,10 +3660,8 @@
 		caps2->ddsCaps.dwCaps = 0xffffffff;	/* we can do anything */
 	}
 	return DD_OK;
-#else /* defined(HAVE_LIBXXF86DGA) */
-	return E_UNEXPECTED;
-#endif /* defined(HAVE_LIBXXF86DGA) */
 }
+#endif /* defined(HAVE_LIBXXF86DGA) */
 
 static void fill_caps(LPDDCAPS caps) {
   /* This function tries to fill the capabilities of Wine's DDraw implementation.
@@ -3763,6 +3765,7 @@
 	return DD_OK;
 }
 
+#ifdef HAVE_LIBXXF86DGA
 static HRESULT WINAPI DGA_IDirectDraw2Impl_CreatePalette(
 	LPDIRECTDRAW2 iface,DWORD dwFlags,LPPALETTEENTRY palent,LPDIRECTDRAWPALETTE *lpddpal,LPUNKNOWN lpunk
 ) {
@@ -3795,6 +3798,7 @@
 	}
 	return DD_OK;
 }
+#endif /* defined(HAVE_LIBXXF86DGA) */
 
 static HRESULT WINAPI Xlib_IDirectDraw2Impl_CreatePalette(
 	LPDIRECTDRAW2 iface,DWORD dwFlags,LPPALETTEENTRY palent,LPDIRECTDRAWPALETTE *lpddpal,LPUNKNOWN lpunk
@@ -3811,8 +3815,8 @@
 	return DD_OK;
 }
 
-static HRESULT WINAPI DGA_IDirectDraw2Impl_RestoreDisplayMode(LPDIRECTDRAW2 iface) {
 #ifdef HAVE_LIBXXF86DGA
+static HRESULT WINAPI DGA_IDirectDraw2Impl_RestoreDisplayMode(LPDIRECTDRAW2 iface) {
         ICOM_THIS(IDirectDraw2Impl,iface);
 	TRACE(ddraw, "(%p)->()\n",This);
 	Sleep(1000);
@@ -3821,10 +3825,8 @@
 	EXC_InitHandlers();
 #endif
 	return DD_OK;
-#else /* defined(HAVE_LIBXXF86DGA) */
-	return E_UNEXPECTED;
-#endif
 }
+#endif /* defined(HAVE_LIBXXF86DGA) */
 
 static HRESULT WINAPI Xlib_IDirectDraw2Impl_RestoreDisplayMode(LPDIRECTDRAW2 iface) {
         ICOM_THIS(IDirectDraw2Impl,iface);
@@ -3848,11 +3850,11 @@
 	return ++(This->ref);
 }
 
+#ifdef HAVE_LIBXXF86DGA
 static ULONG WINAPI DGA_IDirectDraw2Impl_Release(LPDIRECTDRAW2 iface) {
         ICOM_THIS(IDirectDraw2Impl,iface);
         TRACE( ddraw, "(%p)->() decrementing from %lu.\n", This, This->ref );
 
-#ifdef HAVE_LIBXXF86DGA
 	if (!--(This->ref)) {
 		TSXF86DGADirectVideo(display,DefaultScreen(display),0);
 		if (This->d.window && (This->d.mainWindow != This->d.window))
@@ -3876,9 +3878,9 @@
 		HeapFree(GetProcessHeap(),0,This);
 		return 0;
 	}
-#endif /* defined(HAVE_LIBXXF86DGA) */
 	return This->ref;
 }
+#endif /* defined(HAVE_LIBXXF86DGA) */
 
 static ULONG WINAPI Xlib_IDirectDraw2Impl_Release(LPDIRECTDRAW2 iface) {
         ICOM_THIS(IDirectDraw2Impl,iface);
@@ -3894,6 +3896,7 @@
 	return This->ref;
 }
 
+#ifdef HAVE_LIBXXF86DGA
 static HRESULT WINAPI DGA_IDirectDraw2Impl_QueryInterface(
 	LPDIRECTDRAW2 iface,REFIID refiid,LPVOID *obj
 ) {
@@ -3968,6 +3971,7 @@
 	WARN(ddraw,"(%p):interface for IID %s _NOT_ found!\n",This,xrefiid);
         return OLE_E_ENUM_NOMORE;
 }
+#endif /* defined(HAVE_LIBXXF86DGA) */
 
 static HRESULT WINAPI Xlib_IDirectDraw2Impl_QueryInterface(
 	LPDIRECTDRAW2 iface,REFIID refiid,LPVOID *obj
@@ -4053,6 +4057,7 @@
 	return DD_OK;
 }
 
+#ifdef HAVE_LIBXXF86DGA
 static HRESULT WINAPI DGA_IDirectDraw2Impl_EnumDisplayModes(
 	LPDIRECTDRAW2 iface,DWORD dwFlags,LPDDSURFACEDESC lpddsfd,LPVOID context,LPDDENUMMODESCALLBACK modescb
 ) {
@@ -4137,6 +4142,7 @@
 	}
 	return DD_OK;
 }
+#endif /* defined(HAVE_LIBXXF86DGA) */
 
 static HRESULT WINAPI Xlib_IDirectDraw2Impl_EnumDisplayModes(
 	LPDIRECTDRAW2 iface,DWORD dwFlags,LPDDSURFACEDESC lpddsfd,LPVOID context,LPDDENUMMODESCALLBACK modescb
@@ -4266,10 +4272,10 @@
   return DD_OK;
 }
 
+#ifdef HAVE_LIBXXF86DGA
 static HRESULT WINAPI DGA_IDirectDraw2Impl_GetDisplayMode(
 	LPDIRECTDRAW2 iface,LPDDSURFACEDESC lpddsfd
 ) {
-#ifdef HAVE_LIBXXF86DGA
         ICOM_THIS(IDirectDraw2Impl,iface);
 	TRACE(ddraw,"(%p)->(%p)\n",This,lpddsfd);
 	lpddsfd->dwFlags = DDSD_HEIGHT|DDSD_WIDTH|DDSD_PITCH|DDSD_BACKBUFFERCOUNT|DDSD_PIXELFORMAT|DDSD_CAPS;
@@ -4281,10 +4287,8 @@
 	lpddsfd->ddsCaps.dwCaps = DDSCAPS_PALETTE;
 	lpddsfd->ddpfPixelFormat = This->d.directdraw_pixelformat;
 	return DD_OK;
-#else /* defined(HAVE_LIBXXF86DGA) */
-	return E_UNEXPECTED;
-#endif /* defined(HAVE_LIBXXF86DGA) */
 }
+#endif /* defined(HAVE_LIBXXF86DGA) */
 
 static HRESULT WINAPI Xlib_IDirectDraw2Impl_GetDisplayMode(
 	LPDIRECTDRAW2 iface,LPDDSURFACEDESC lpddsfd
@@ -4367,6 +4371,8 @@
   return DD_OK;
 }
 
+#ifdef HAVE_LIBXXF86DGA
+
 /* Note: Hack so we can reuse the old functions without compiler warnings */
 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
 # define XCAST(fun)	(typeof(dga_ddvt.fn##fun))
@@ -4402,6 +4408,17 @@
 	XCAST(WaitForVerticalBlank)IDirectDraw2Impl_WaitForVerticalBlank,
 };
 
+#undef XCAST
+
+#endif /* defined(HAVE_LIBXXF86DGA) */
+
+/* Note: Hack so we can reuse the old functions without compiler warnings */
+#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
+# define XCAST(fun)	(typeof(xlib_ddvt.fn##fun))
+#else
+# define XCAST(fun)	(void *)
+#endif
+
 static ICOM_VTABLE(IDirectDraw) xlib_ddvt = 
 {
 	ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
@@ -4438,11 +4455,13 @@
  */
 
 
+#ifdef HAVE_LIBXXF86DGA
 static HRESULT WINAPI DGA_IDirectDraw2Impl_SetDisplayMode(
 	LPDIRECTDRAW2 iface,DWORD width,DWORD height,DWORD depth,DWORD xx,DWORD yy
 ) {
 	return DGA_IDirectDrawImpl_SetDisplayMode((LPDIRECTDRAW)iface,width,height,depth);
 }
+#endif /* defined(HAVE_LIBXXF86DGA) */
 
 static HRESULT WINAPI Xlib_IDirectDraw2Impl_SetDisplayMode(
 	LPDIRECTDRAW2 iface,DWORD width,DWORD height,DWORD depth,DWORD xx,DWORD yy
@@ -4450,6 +4469,7 @@
 	return Xlib_IDirectDrawImpl_SetDisplayMode((LPDIRECTDRAW)iface,width,height,depth);
 }
 
+#ifdef HAVE_LIBXXF86DGA
 static HRESULT WINAPI DGA_IDirectDraw2Impl_GetAvailableVidMem(
 	LPDIRECTDRAW2 iface,LPDDSCAPS ddscaps,LPDWORD total,LPDWORD free
 ) {
@@ -4461,6 +4481,7 @@
 	if (free) *free = This->e.dga.fb_memsize * 1024;
 	return DD_OK;
 }
+#endif /* defined(HAVE_LIBXXF86DGA) */
 
 static HRESULT WINAPI Xlib_IDirectDraw2Impl_GetAvailableVidMem(
 	LPDIRECTDRAW2 iface,LPDDSCAPS ddscaps,LPDWORD total,LPDWORD free
@@ -4474,6 +4495,7 @@
 	return DD_OK;
 }
 
+#ifdef HAVE_LIBXXF86DGA
 static ICOM_VTABLE(IDirectDraw2) dga_dd2vt = 
 {
 	ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
@@ -4502,6 +4524,7 @@
 	IDirectDraw2Impl_WaitForVerticalBlank,
 	DGA_IDirectDraw2Impl_GetAvailableVidMem
 };
+#endif /* defined(HAVE_LIBXXF86DGA) */
 
 static ICOM_VTABLE(IDirectDraw2) xlib_dd2vt = 
 {
@@ -4569,13 +4592,14 @@
   return DD_OK;
 }
 
+#ifdef HAVE_LIBXXF86DGA
+
 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
 # define XCAST(fun)	(typeof(dga_dd4vt.fn##fun))
 #else
 # define XCAST(fun)	(void*)
 #endif
 
-
 static ICOM_VTABLE(IDirectDraw4) dga_dd4vt = 
 {
 	ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
@@ -4609,6 +4633,16 @@
 	IDirectDraw4Impl_GetDeviceIdentifier
 };
 
+#undef XCAST
+
+#endif /* defined(HAVE_LIBXXF86DGA) */
+
+#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
+# define XCAST(fun)	(typeof(xlib_dd4vt.fn##fun))
+#else
+# define XCAST(fun)	(void*)
+#endif
+
 static ICOM_VTABLE(IDirectDraw4) xlib_dd4vt = 
 {
 	ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
diff --git a/include/animate.h b/include/animate.h
index cfde3f2..04dcd36 100644
--- a/include/animate.h
+++ b/include/animate.h
@@ -7,6 +7,7 @@
 #ifndef __WINE_ANIMATE_H
 #define __WINE_ANIMATE_H
 
+#include "windef.h"
 
 typedef struct tagANIMATE_INFO
 {
diff --git a/include/aspi.h b/include/aspi.h
index cb5bca7..41541ce 100644
--- a/include/aspi.h
+++ b/include/aspi.h
@@ -115,7 +115,6 @@
 };
 
 typedef struct ASPI_DEVICE_INFO ASPI_DEVICE_INFO;
-static ASPI_DEVICE_INFO *ASPI_open_devices = NULL;
 
 #include "poppack.h"
 
diff --git a/include/combo.h b/include/combo.h
index 67d6ea8..4b7ea48 100644
--- a/include/combo.h
+++ b/include/combo.h
@@ -5,6 +5,10 @@
 #ifndef __WINE_COMBO_H
 #define __WINE_COMBO_H
 
+#include "windef.h"
+
+struct tagWND;
+
 #define ID_CB_LISTBOX           1000
 #define ID_CB_EDIT              1001
 
@@ -28,7 +32,7 @@
 
 typedef struct
 {
-   WND*    	self;
+   struct tagWND *self;
    HWND  	owner;
    UINT  	dwStyle;
    HWND  	hWndEdit;
@@ -54,8 +58,10 @@
 #define CB_HASSTRINGS( lphc ) ((lphc)->dwStyle & CBS_HASSTRINGS)
 #define CB_HWND( lphc )       ((lphc)->self->hwndSelf)
 
+LRESULT WINAPI ComboWndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
+
 BOOL 	COMBO_FlipListbox( LPHEADCOMBO, BOOL );
-HWND 	COMBO_GetLBWindow( WND* );
+HWND 	COMBO_GetLBWindow( struct tagWND * );
 LRESULT COMBO_Directory( LPHEADCOMBO, UINT, LPSTR, BOOL );
 
 #endif /* __WINE_COMBO_H */
diff --git a/include/comboex.h b/include/comboex.h
index 338b29a..4546366 100644
--- a/include/comboex.h
+++ b/include/comboex.h
@@ -7,6 +7,8 @@
 #ifndef __WINE_COMBOEX_H
 #define __WINE_COMBOEX_H
 
+#include "commctrl.h"
+#include "windef.h"
 
 typedef struct tagCOMBOEX_INFO
 {
diff --git a/include/commdlg.h b/include/commdlg.h
index e20add7..0db8141 100644
--- a/include/commdlg.h
+++ b/include/commdlg.h
@@ -591,6 +591,7 @@
 BOOL  WINAPI ChooseColorW(LPCHOOSECOLORW lpChCol);
 #define ChooseColor WINELIB_NAME_AW(ChooseColor)
 DWORD   WINAPI CommDlgExtendedError(void);
+DWORD   WINAPI CommDlgExtendedError16(void);
 HWND16  WINAPI FindText16( SEGPTR find);
 HWND  WINAPI FindTextA(LPFINDREPLACEA lpFind);
 HWND  WINAPI FindTextW(LPFINDREPLACEW lpFind);
@@ -641,8 +642,11 @@
 LRESULT WINAPI FormatCharDlgProcA(HWND,UINT,WPARAM,LPARAM);
 LRESULT WINAPI FormatCharDlgProcW(HWND,UINT,WPARAM,LPARAM);
 #define FormatCharDlgProc WINELIB_NAME_AW(FormatCharDlgProc)
+INT16 WINAPI FontFamilyEnumProc16( SEGPTR logfont, SEGPTR metrics, UINT16 nFontType, LPARAM lParam);
+INT16 WINAPI FontStyleEnumProc16( SEGPTR logfont, SEGPTR metrics, UINT16 nFontType, LPARAM lParam);
 
-void COMDLG32_SetCommDlgExtendedError(DWORD err); 
+BOOL WINAPI COMMDLG_DllEntryPoint(DWORD Reason, HINSTANCE16 hInst, WORD ds, WORD HeapSize, DWORD res1, WORD res2);
+BOOL WINAPI COMDLG32_DllEntryPoint(HINSTANCE hInstance, DWORD Reason, LPVOID Reserved);
 
 #include "poppack.h"
 
diff --git a/include/console.h b/include/console.h
index 45975fa..245fdc6 100644
--- a/include/console.h
+++ b/include/console.h
@@ -70,7 +70,7 @@
 
 /* Generic defines */
 int  CONSOLE_Init(char *drivers);
-void CONSOLE_Close();
+void CONSOLE_Close(void);
 void CONSOLE_Write(char out, int fg_color, int bg_color, int attribute);
 void CONSOLE_MoveCursor(char row, char col);
 void CONSOLE_ClearWindow(char, char, char, char, int, int);
diff --git a/include/crtdll.h b/include/crtdll.h
index a272ce5..0e9733b 100644
--- a/include/crtdll.h
+++ b/include/crtdll.h
@@ -1,6 +1,8 @@
 #ifndef __WINE_CRTDLL_H
 #define __WINE_CRTDLL_H
 
+#include "windef.h"
+
 #define CRTDLL_LC_ALL		0
 #define CRTDLL_LC_COLLATE	1
 #define CRTDLL_LC_CTYPE		2
diff --git a/include/datetime.h b/include/datetime.h
index d8ee1a3..b5e6cbf 100644
--- a/include/datetime.h
+++ b/include/datetime.h
@@ -7,6 +7,8 @@
 #ifndef __WINE_DATETIME_H
 #define __WINE_DATETIME_H
 
+#include "windef.h"
+
 typedef struct tagDATETIME_INFO
 {
     DWORD dwDummy;  /* just to keep the compiler happy ;-) */
diff --git a/include/desktop.h b/include/desktop.h
index 3d12481..9a81694 100644
--- a/include/desktop.h
+++ b/include/desktop.h
@@ -30,7 +30,7 @@
 
 extern DESKTOP_DRIVER *DESKTOP_Driver;
 
-extern BOOL DESKTOP_IsSingleWindow();
+extern BOOL DESKTOP_IsSingleWindow(void);
 extern int DESKTOP_GetScreenWidth(void);
 extern int DESKTOP_GetScreenHeight(void);
 extern int DESKTOP_GetScreenDepth(void);
diff --git a/include/device.h b/include/device.h
index 6a5216c..d0f0c7f 100644
--- a/include/device.h
+++ b/include/device.h
@@ -1,5 +1,8 @@
 #ifndef __WINE_DEVICE_H
 #define __WINE_DEVICE_H
+
+#include "winbase.h"
+
 extern HANDLE DEVICE_Open( LPCSTR filename, DWORD access,
                              LPSECURITY_ATTRIBUTES sa );
 #endif
diff --git a/include/dinput.h b/include/dinput.h
index 8297ff3..503a8d6 100644
--- a/include/dinput.h
+++ b/include/dinput.h
@@ -832,5 +832,10 @@
 #define IDirectInputA_Initialize(p,a,b)      ICOM_CALL2(Initialize,p,a,b)
 #endif
 
+/* Export functions */ 
+
+HRESULT WINAPI DirectInputCreateA(HINSTANCE,DWORD,LPDIRECTINPUTA *,LPUNKNOWN);
+HRESULT WINAPI DirectInputCreateW(HINSTANCE,DWORD,LPDIRECTINPUTA *,LPUNKNOWN);
+#define DirectInputCreate WINELIB_NAME_AW(DirectInputCreate)
 
 #endif /* __WINE_DINPUT_H */
diff --git a/include/display.h b/include/display.h
index c964537..1560e5b 100644
--- a/include/display.h
+++ b/include/display.h
@@ -22,7 +22,7 @@
 WORD WINAPI DISPLAY_Inquire(LPCURSORINFO lpCursorInfo);
 VOID WINAPI DISPLAY_SetCursor( struct tagCURSORICONINFO *lpCursor );
 VOID WINAPI DISPLAY_MoveCursor( WORD wAbsX, WORD wAbsY );
-VOID WINAPI DISPLAY_CheckCursor();
+VOID WINAPI DISPLAY_CheckCursor( void );
 VOID WINAPI UserRepaintDisable16( BOOL16 bDisable );
 
 #endif /* __WINE_DISPLAY_H */
diff --git a/include/elfdll.h b/include/elfdll.h
index 94bfef8..c546f4e 100644
--- a/include/elfdll.h
+++ b/include/elfdll.h
@@ -1,6 +1,9 @@
 #ifndef __WINE_ELFDLL_H
 #define __WINE_ELFDLL_H
 
+#include "module.h"
+#include "windef.h"
+
 WINE_MODREF *ELFDLL_LoadLibraryExA(LPCSTR libname, DWORD flags, DWORD *err);
 HINSTANCE16 ELFDLL_LoadModule16(LPCSTR libname, BOOL implicit);
 void ELFDLL_UnloadLibrary(WINE_MODREF *wm);
diff --git a/include/flatsb.h b/include/flatsb.h
index ec4eefc..4a6c610 100644
--- a/include/flatsb.h
+++ b/include/flatsb.h
@@ -8,6 +8,8 @@
 #ifndef __WINE_FLATSB_H
 #define __WINE_FLATSB_H
 
+#include "windef.h"
+
 typedef struct tagFLATSB_INFO
 {
     DWORD dwDummy;  /* just to keep the compiler happy ;-) */
diff --git a/include/flatthunk.h b/include/flatthunk.h
index 2a8059b..31ec12e 100644
--- a/include/flatthunk.h
+++ b/include/flatthunk.h
@@ -7,6 +7,10 @@
 #ifndef __WINE_FLATTHUNK_H
 #define __WINE_FLATTHUNK_H
 
+#include "windef.h"
+
+struct _PDB;
+
 struct ThunkDataCommon
 {
     char                   magic[4];         /* 00 */
@@ -96,7 +100,7 @@
 struct SLTargetDB
 {
      struct SLTargetDB *   next;
-     PDB *               process;
+     struct _PDB *         process;
      DWORD *               targetTable;
 };
 
diff --git a/include/header.h b/include/header.h
index 9d3ada9..ed2da64 100644
--- a/include/header.h
+++ b/include/header.h
@@ -8,6 +8,9 @@
 #ifndef __WINE_HEADER_H_
 #define __WINE_HEADER_H_
 
+#include "commctrl.h"
+#include "windef.h"
+
 typedef struct 
 {
     INT     cxy;
diff --git a/include/hotkey.h b/include/hotkey.h
index 46f813c..78904e1 100644
--- a/include/hotkey.h
+++ b/include/hotkey.h
@@ -7,6 +7,8 @@
 #ifndef __WINE_HOTKEY_H
 #define __WINE_HOTKEY_H
 
+#include "windef.h"
+
 typedef struct tagHOTKEY_INFO
 {
     HFONT hFont;
diff --git a/include/input.h b/include/input.h
index 63bf4b2..dcaa44e 100644
--- a/include/input.h
+++ b/include/input.h
@@ -7,6 +7,8 @@
 #ifndef __WINE_INPUT_H
 #define __WINE_INPUT_H
 
+#include "windef.h"
+
 extern BOOL MouseButtonsStates[3];
 extern BOOL AsyncMouseButtonsStates[3];
 extern BYTE InputKeyStateTable[256];
diff --git a/include/ipaddress.h b/include/ipaddress.h
index 1d50c6e..f2596a8 100644
--- a/include/ipaddress.h
+++ b/include/ipaddress.h
@@ -8,6 +8,8 @@
 #ifndef __WINE_IPADDRESS_H
 #define __WINE_IPADDRESS_H
 
+#include "windef.h"
+
 typedef struct tagIPADDRESS_INFO
 {
 	BYTE LowerLimit[4];
diff --git a/include/listview.h b/include/listview.h
index 44bbe86..96a1078 100644
--- a/include/listview.h
+++ b/include/listview.h
@@ -7,6 +7,10 @@
 #ifndef __WINE_LISTVIEW_H
 #define __WINE_LISTVIEW_H
 
+#include "commctrl.h"
+#include "windef.h"
+#include "wingdi.h"
+
 typedef struct tagLISTVIEW_SUBITEM
 {
     LPSTR pszText;
diff --git a/include/loadorder.h b/include/loadorder.h
index 9b83133..d64dcc8 100644
--- a/include/loadorder.h
+++ b/include/loadorder.h
@@ -7,6 +7,8 @@
 #ifndef __WINE_LOADORDER_H
 #define __WINE_LOADORDER_H
 
+#include "windef.h"
+
 #define MODULE_LOADORDER_INVALID	0	/* Must be 0 */
 #define MODULE_LOADORDER_DLL		1	/* Native DLLs */
 #define MODULE_LOADORDER_ELFDLL		2	/* Elf-dlls */
diff --git a/include/main.h b/include/main.h
index 6002a12..ed84ca7 100644
--- a/include/main.h
+++ b/include/main.h
@@ -5,6 +5,8 @@
 #ifndef __WINE_MAIN_H
 #define __WINE_MAIN_H
 
+#include "windef.h"
+
 extern void MAIN_Usage(char*);
 extern BOOL MAIN_MainInit(void);
 extern BOOL MAIN_WineInit( int *argc, char *argv[] );
diff --git a/include/menu.h b/include/menu.h
index 6fd9eeb..f8c25b6 100644
--- a/include/menu.h
+++ b/include/menu.h
@@ -7,6 +7,9 @@
 
 #include "win.h"
 
+LRESULT WINAPI PopupMenuWndProc( HWND hwnd, UINT message, WPARAM wParam,
+                                 LPARAM lParam );
+
 extern BOOL MENU_Init(void);
 extern HMENU MENU_GetSysMenu(HWND hWndOwner, HMENU hSysPopup);
 extern UINT MENU_GetMenuBarHeight( HWND hwnd, UINT menubarWidth,
diff --git a/include/monthcal.h b/include/monthcal.h
index fbc501a..16b9ca2 100644
--- a/include/monthcal.h
+++ b/include/monthcal.h
@@ -7,6 +7,8 @@
 #ifndef __WINE_MONTHCAL_H
 #define __WINE_MONTHCAL_H
 
+#include "windef.h"
+
 typedef struct tagMONTHCAL_INFO
 {
     DWORD dwDummy;  /* just to keep the compiler happy ;-) */
diff --git a/include/nativefont.h b/include/nativefont.h
index 13603f3..1321d59 100644
--- a/include/nativefont.h
+++ b/include/nativefont.h
@@ -7,6 +7,8 @@
 #ifndef __WINE_NATIVEFONT_H
 #define __WINE_NATIVEFONT_H
 
+#include "windef.h"
+
 typedef struct tagNATIVEFONT_INFO
 {
     DWORD  dwDummy;   /* just to keep the compiler happy ;-) */
diff --git a/include/pager.h b/include/pager.h
index 993695d..0cc9057 100644
--- a/include/pager.h
+++ b/include/pager.h
@@ -7,6 +7,8 @@
 #ifndef __WINE_PAGER_H
 #define __WINE_PAGER_H
 
+#include "windef.h"
+#include "wingdi.h"
 
 typedef struct tagPAGER_INFO
 {
diff --git a/include/progress.h b/include/progress.h
index 804541a..fb2a751 100644
--- a/include/progress.h
+++ b/include/progress.h
@@ -8,6 +8,7 @@
 #define __WINE_PROGRESS_H
 
 #include "windef.h"
+#include "wingdi.h"
 
 typedef struct
 {
diff --git a/include/psapi.h b/include/psapi.h
index 389bad8..8fedeb1 100644
--- a/include/psapi.h
+++ b/include/psapi.h
@@ -5,6 +5,8 @@
 #ifndef __WINE_PSAPI_H
 #define __WINE_PSAPI_H
 
+#include "windef.h"
+
 typedef struct _MODULEINFO {
   LPVOID lpBaseOfDll;
   DWORD SizeOfImage;
diff --git a/include/rebar.h b/include/rebar.h
index f704f31..c060141 100644
--- a/include/rebar.h
+++ b/include/rebar.h
@@ -7,6 +7,10 @@
 #ifndef __WINE_REBAR_H
 #define __WINE_REBAR_H
 
+#include "commctrl.h"
+#include "windef.h"
+#include "wingdi.h"
+
 typedef struct tagREBAR_BAND
 {
     UINT    fStyle;
diff --git a/include/resource.h b/include/resource.h
index aa52a99..6512265 100644
--- a/include/resource.h
+++ b/include/resource.h
@@ -30,7 +30,7 @@
 {
     SYSRES_MENU_SYSMENU,
     SYSRES_MENU_EDITMENU,
-    SYSRES_DIALOG_MSGBOX,
+    SYSRES_DIALOG_MSGBOX
 } SYSTEM_RESOURCE;
 
 extern void LIBRES_RegisterResources(const wrc_resource32_t * const * Res);
diff --git a/include/scroll.h b/include/scroll.h
index 9c7f88e..f8f10b1 100644
--- a/include/scroll.h
+++ b/include/scroll.h
@@ -10,6 +10,8 @@
 
 #include "windef.h"
 
+struct tagWND;
+
 typedef struct
 {
     INT   CurVal;   /* Current scroll-bar value */
@@ -21,9 +23,13 @@
 
 extern LRESULT WINAPI ScrollBarWndProc( HWND hwnd, UINT uMsg,
                                         WPARAM wParam, LPARAM lParam );
+
 extern void SCROLL_DrawScrollBar( HWND hwnd, HDC hdc, INT nBar,
                                   BOOL arrows, BOOL interior );
 extern void SCROLL_HandleScrollEvent( HWND hwnd, INT nBar,
                                       UINT msg, POINT pt );
-
+extern INT SCROLL_SetNCSbState( struct tagWND *wndPtr, int vMin, int vMax, int vPos,
+				int hMin, int hMax, int hPos );
 #endif  /* __WINE_SCROLL_H */
+
+
diff --git a/include/sig_context.h b/include/sig_context.h
index 783ea26..a851ed1 100644
--- a/include/sig_context.h
+++ b/include/sig_context.h
@@ -88,7 +88,10 @@
 #ifdef _SCO_DS
 #include <sys/regset.h>
 #endif
+/* Solaris kludge */
+#undef ERR
 #include <sys/ucontext.h>
+#undef ERR
 typedef struct ucontext SIGCONTEXT;
 #define __HAVE_SIGCONTEXT
 
diff --git a/include/status.h b/include/status.h
index 6afeec1..f3f20c0 100644
--- a/include/status.h
+++ b/include/status.h
@@ -7,6 +7,9 @@
 #ifndef __WINE_STATUS_H
 #define __WINE_STATUS_H
 
+#include "windef.h"
+#include "wingdi.h"
+
 typedef struct
 {
     INT	x;
diff --git a/include/syslevel.h b/include/syslevel.h
index faeb3ec..800a4d2 100644
--- a/include/syslevel.h
+++ b/include/syslevel.h
@@ -20,10 +20,10 @@
 extern WORD SYSLEVEL_EmergencyTeb;
 
 void SYSLEVEL_Init(void);
-VOID WINAPI SYSLEVEL_EnterWin16Lock(VOID);
-VOID WINAPI SYSLEVEL_LeaveWin16Lock(VOID);
-VOID SYSLEVEL_ReleaseWin16Lock(VOID);
-VOID SYSLEVEL_RestoreWin16Lock(VOID);
+VOID WINAPI SYSLEVEL_EnterWin16Lock(void);
+VOID WINAPI SYSLEVEL_LeaveWin16Lock(void);
+VOID SYSLEVEL_ReleaseWin16Lock(void);
+VOID SYSLEVEL_RestoreWin16Lock(void);
 VOID SYSLEVEL_CheckNotLevel( INT level );
 
 VOID WINAPI GetpWin16Lock(SYSLEVEL **lock);
diff --git a/include/tab.h b/include/tab.h
index 853f7f6..2adb506 100644
--- a/include/tab.h
+++ b/include/tab.h
@@ -7,6 +7,9 @@
 #ifndef __WINE_TAB_H  
 #define __WINE_TAB_H
 
+#include "commctrl.h"
+#include "windef.h"
+
 typedef struct tagTAB_ITEM
 {
   UINT   mask;
diff --git a/include/tlhelp32.h b/include/tlhelp32.h
index 7c488d5..05e6fcb 100644
--- a/include/tlhelp32.h
+++ b/include/tlhelp32.h
@@ -23,7 +23,7 @@
 #define TH32CS_INHERIT     0x80000000
 
 #ifdef __cplusplus
-extern "C" {
+} /* extern "C" */
 #endif
 
 #endif /* __WINE_TLHELP32_H */
diff --git a/include/toolbar.h b/include/toolbar.h
index cf8eddd..64805b8 100644
--- a/include/toolbar.h
+++ b/include/toolbar.h
@@ -7,6 +7,8 @@
 #ifndef __WINE_TOOLBAR_H
 #define __WINE_TOOLBAR_H
 
+#include "commctrl.h"
+#include "windef.h"
 
 typedef struct tagTBUTTON_INFO
 {
diff --git a/include/tooltips.h b/include/tooltips.h
index 1249a30..a067a58 100644
--- a/include/tooltips.h
+++ b/include/tooltips.h
@@ -7,6 +7,9 @@
 #ifndef __WINE_TOOLTIPS_H
 #define __WINE_TOOLTIPS_H
 
+#include "commctrl.h"
+#include "windef.h"
+#include "wingdi.h"
 
 typedef struct tagTT_SUBCLASS_INFO
 {
diff --git a/include/trackbar.h b/include/trackbar.h
index 9e15707..0777a24 100644
--- a/include/trackbar.h
+++ b/include/trackbar.h
@@ -7,6 +7,9 @@
 #ifndef __WINE_TRACKBAR_H
 #define __WINE_TRACKBAR_H
 
+#include "windef.h"
+#include "wingdi.h"
+
 typedef struct tagTRACKBAR_INFO
 {
     INT  nRangeMin;
diff --git a/include/win.h b/include/win.h
index f17959b..a3b0a00 100644
--- a/include/win.h
+++ b/include/win.h
@@ -165,9 +165,9 @@
 
   /* Window functions */
 extern void   WIN_Init( void );
-extern void   WIN_LockWnds();
-extern void   WIN_UnlockWnds();
-extern int    WIN_SuspendWndsLock();
+extern void   WIN_LockWnds( void );
+extern void   WIN_UnlockWnds( void );
+extern int    WIN_SuspendWndsLock( void );
 extern void   WIN_RestoreWndsLock(int ipreviousLock);
 extern WND*   WIN_FindWndPtr( HWND hwnd );
 extern WND*   WIN_LockWndPtr(WND *wndPtr);
@@ -207,10 +207,19 @@
 extern BOOL WIDGETS_IsControl( WND* pWnd, BUILTIN_CLASS32 cls );  
 
 /* controls/icontitle.c */
+extern LRESULT WINAPI IconTitleWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
+
 extern HWND ICONTITLE_Create( WND* );
 extern BOOL ICONTITLE_Init( void );
 
 /* windows/focus.c */
 extern void FOCUS_SwitchFocus( MESSAGEQUEUE *pMsgQ, HWND , HWND );
 
+/* windows/edit.c */
+extern LRESULT WINAPI EditWndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
+
+/* windows/listbox.c */
+extern LRESULT WINAPI ListBoxWndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
+extern LRESULT WINAPI ComboLBWndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
+
 #endif  /* __WINE_WIN_H */
diff --git a/include/winbase.h b/include/winbase.h
index 2cd5b50..a71aebe 100644
--- a/include/winbase.h
+++ b/include/winbase.h
@@ -1142,7 +1142,8 @@
 BOOL      WINAPI GetCommState(INT,LPDCB);
 BOOL      WINAPI SetCommState(INT,LPDCB);
 BOOL      WINAPI TransmitCommChar(INT,CHAR);
-
+BOOL      WINAPI SetupComm(HANDLE, DWORD, DWORD);
+BOOL      WINAPI GetCommProperties(HANDLE, LPDCB *);
   
 /*DWORD WINAPI GetVersion( void );*/
 BOOL16 WINAPI GetVersionEx16(OSVERSIONINFO16*);
@@ -1158,7 +1159,6 @@
 void      WINAPI InitializeCriticalSection(CRITICAL_SECTION *lpCrit);
 void      WINAPI LeaveCriticalSection(CRITICAL_SECTION *lpCrit);
 void      WINAPI MakeCriticalSectionGlobal(CRITICAL_SECTION *lpCrit);
-HANDLE  WINAPI OpenProcess(DWORD access, BOOL inherit, DWORD id);
 BOOL    WINAPI GetProcessWorkingSetSize(HANDLE,LPDWORD,LPDWORD);
 DWORD     WINAPI QueueUserAPC(PAPCFUNC,HANDLE,ULONG_PTR);
 void      WINAPI RaiseException(DWORD,DWORD,DWORD,const LPDWORD);
@@ -1504,6 +1504,7 @@
 BOOL      WINAPI CreateDirectoryExA(LPCSTR,LPCSTR,LPSECURITY_ATTRIBUTES);
 BOOL      WINAPI CreateDirectoryExW(LPCWSTR,LPCWSTR,LPSECURITY_ATTRIBUTES);
 #define     CreateDirectoryEx WINELIB_NAME_AW(CreateDirectoryEx)
+BOOL        WINAPI DefineDosDeviceA(DWORD,LPCSTR,LPCSTR);
 #define     DefineHandleTable(w) ((w),TRUE)
 ATOM        WINAPI DeleteAtom(ATOM);
 BOOL      WINAPI DeleteFileA(LPCSTR);
diff --git a/include/wincrypt.h b/include/wincrypt.h
index 16b47c6..34fbae5 100644
--- a/include/wincrypt.h
+++ b/include/wincrypt.h
@@ -1,6 +1,8 @@
 #ifndef __WINE_WINCRYPT_H
 #define __WINE_WINCRYPT_H
 
+#include "windef.h"
+
 /* FIXME: this whole file plus the implementation */
 
 /* some typedefs for function parameters */
diff --git a/include/windows.h b/include/windows.h
index 72e111b..956058d 100644
--- a/include/windows.h
+++ b/include/windows.h
@@ -32,8 +32,6 @@
 BOOL16      WINAPI CheckMenuRadioButton16(HMENU16,UINT16,UINT16,UINT16,BOOL16);
 BOOL      WINAPI CheckMenuRadioButton(HMENU,UINT,UINT,UINT,BOOL);
 WORD        WINAPI WOWHandle16(HANDLE,WOW_HANDLE_TYPE);
-BOOL16      WINAPI GetPrivateProfileStruct16(LPCSTR,LPCSTR,LPVOID,UINT16,LPCSTR);
-INT16       WINAPI GetPrivateProfileSection16(LPCSTR,LPSTR,UINT16,LPCSTR);
 
 #endif /* 0 */
 
diff --git a/include/wine/obj_base.h b/include/wine/obj_base.h
index d09a0d1..0f4f72c 100644
--- a/include/wine/obj_base.h
+++ b/include/wine/obj_base.h
@@ -66,15 +66,15 @@
 BOOL16 WINAPI IsEqualGUID16(GUID* g1,GUID* g2);
 BOOL WINAPI IsEqualGUID32(REFGUID rguid1,REFGUID rguid2);
 /*#define IsEqualGUID WINELIB_NAME(IsEqualGUID)*/
-#ifdef __cplusplus
+#if defined(__cplusplus) && !defined(CINTERFACE)
 #define IsEqualGUID(rguid1, rguid2) (!memcmp(&(rguid1), &(rguid2), sizeof(GUID)))
-#else
+#else /* defined(__cplusplus) && !defined(CINTERFACE) */
 #define IsEqualGUID(rguid1, rguid2) (!memcmp(rguid1, rguid2, sizeof(GUID)))
-#endif /* cplusplus */
+#endif /* defined(__cplusplus) && !defined(CINTERFACE) */
 #define IsEqualIID(riid1, riid2) IsEqualGUID(riid1, riid2)
 #define IsEqualCLSID(rclsid1, rclsid2) IsEqualGUID(rclsid1, rclsid2)
 
-#ifdef __cplusplus
+#if defined(__cplusplus) && !defined(CINTERFACE)
 inline BOOL operator==(const GUID& guidOne, const GUID& guidOther)
 {
     return !memcmp(&guidOne,&guidOther,sizeof(GUID));
diff --git a/include/wine/obj_oleaut.h b/include/wine/obj_oleaut.h
index 9b32c39..1bde283 100644
--- a/include/wine/obj_oleaut.h
+++ b/include/wine/obj_oleaut.h
@@ -61,11 +61,11 @@
 /*****************************************************************************
  * Automation data types
  */
-#ifdef __cplusplus
-#define DUMMY_UNION_NAME 
-#else
-#define DUMMY_UNION_NAME u
-#endif
+#if defined(__cplusplus) && !defined(NONAMELESSUNION)
+#define DUMMYUNIONNAME 
+#else /* defined(__cplusplus) && !defined(NONAMELESSUNION) */
+#define DUMMYUNIONNAME u
+#endif /* defined(__cplusplus) && !defined(NONAMELESSUNION) */
 
 /*****************************************************************
  *  SafeArray defines and structs 
@@ -132,7 +132,7 @@
 	WORD wReserved1;
 	WORD wReserved2;
 	WORD wReserved3;
-	union /*DUMMY_UNION_NAME*/
+	union /* DUMMYUNIONNAME */
 	{
 	/* By value. */
 		CHAR cVal;
@@ -177,7 +177,7 @@
 		IUnknown** ppunkVal;
 		IDispatch** ppdispVal;
 	        SAFEARRAY** pparray;
-	} DUMMY_UNION_NAME;
+	} DUMMYUNIONNAME;
 };
 
              
@@ -260,7 +260,7 @@
 		struct tagTYPEDESC *lptdesc;
 		struct tagARRAYDESC *lpadesc;
 		HREFTYPE hreftype;
-	} DUMMY_UNION_NAME;
+	} DUMMYUNIONNAME;
 	VARTYPE vt;
 } TYPEDESC;
  
@@ -270,7 +270,7 @@
 	union {
 		IDLDESC idldesc;
 		PARAMDESC paramdesc;
-	} DUMMY_UNION_NAME;
+	} DUMMYUNIONNAME;
 } ELEMDESC, *LPELEMDESC;
 
 typedef enum tagTYPEKIND
@@ -363,7 +363,7 @@
 	union {
 		ULONG oInst;
 		VARIANT *lpvarValue;
-	} DUMMY_UNION_NAME;
+	} DUMMYUNIONNAME;
 	ELEMDESC elemdescVar;
 	WORD wVarFlags;
 	VARKIND varkind;
diff --git a/include/wine/winbase16.h b/include/wine/winbase16.h
index 00037eb..ad37c02 100644
--- a/include/wine/winbase16.h
+++ b/include/wine/winbase16.h
@@ -102,7 +102,7 @@
 HQUEUE16    WINAPI SetTaskQueue16(HTASK16,HQUEUE16);
 VOID        WINAPI SwitchStackTo16(WORD,WORD,WORD);
 BOOL16      WINAPI WaitEvent16(HTASK16);
-VOID        WINAPI WriteOutProfiles16(VOID);
+VOID        WINAPI WriteOutProfiles16(void);
 VOID        WINAPI hmemcpy16(LPVOID,LPCVOID,LONG);
 #endif  /* __WINE__ */
 
@@ -128,10 +128,14 @@
 DWORD       WINAPI GetFreeSpace16(UINT16);
 INT16       WINAPI GetModuleFileName16(HINSTANCE16,LPSTR,INT16);
 UINT16      WINAPI GetPrivateProfileInt16(LPCSTR,LPCSTR,INT16,LPCSTR);
+INT16       WINAPI GetPrivateProfileSection16(LPCSTR,LPSTR,UINT16,LPCSTR);
 WORD        WINAPI GetPrivateProfileSectionNames16(LPSTR,UINT16,LPCSTR);
 INT16       WINAPI GetPrivateProfileString16(LPCSTR,LPCSTR,LPCSTR,LPSTR,UINT16,LPCSTR);
+BOOL16      WINAPI GetPrivateProfileStruct16(LPCSTR,LPCSTR,LPVOID,UINT16,LPCSTR);
 FARPROC16   WINAPI GetProcAddress16(HMODULE16,SEGPTR);
 UINT16      WINAPI GetProfileInt16(LPCSTR,LPCSTR,INT16);
+INT16       WINAPI GetProfileSection16(LPCSTR,LPSTR,UINT16);
+WORD        WINAPI GetProfileSectionNames16(LPSTR,WORD);
 INT16       WINAPI GetProfileString16(LPCSTR,LPCSTR,LPCSTR,LPSTR,UINT16);
 UINT16      WINAPI GetSystemDirectory16(LPSTR,UINT16);
 UINT16      WINAPI GetTempFileName16(BYTE,LPCSTR,UINT16,LPSTR);
@@ -199,6 +203,7 @@
 UINT16      WINAPI _lwrite16(HFILE16,LPCSTR,UINT16);
 BOOL16      WINAPI WritePrivateProfileSection16(LPCSTR,LPCSTR,LPCSTR);
 BOOL16      WINAPI WritePrivateProfileStruct16(LPCSTR,LPCSTR,LPVOID,UINT16,LPCSTR);
+BOOL16      WINAPI WriteProfileSection16(LPCSTR,LPCSTR);
 DWORD       WINAPI GetSelectorBase(WORD);
 WORD        WINAPI SetSelectorBase(WORD,DWORD);
 
diff --git a/include/wine/winuser16.h b/include/wine/winuser16.h
index 0eddbb2..abf25fc 100644
--- a/include/wine/winuser16.h
+++ b/include/wine/winuser16.h
@@ -750,6 +750,7 @@
 INT16       WINAPI GetKeyState16(INT16);
 HWND16      WINAPI GetLastActivePopup16(HWND16);
 HMENU16     WINAPI GetMenu16(HWND16);
+DWORD       WINAPI GetMenuContextHelpId16(HMENU16);
 INT16       WINAPI GetMenuItemCount16(HMENU16);
 UINT16      WINAPI GetMenuItemID16(HMENU16,INT16);
 BOOL16      WINAPI GetMenuItemRect16(HWND16,HMENU16,UINT16,LPRECT16);
diff --git a/include/winsock.h b/include/winsock.h
index d5cc614..ca4f9b6 100644
--- a/include/winsock.h
+++ b/include/winsock.h
@@ -7,7 +7,15 @@
 #ifndef _WINSOCKAPI_
 #define _WINSOCKAPI_
 
+/* Solaris kludge */
+#undef FSHIFT
+#undef PAGESIZE
+#undef TRANSPARENT
 #include <netinet/in.h>
+#undef FSHIFT
+#undef PAGESIZE
+#undef TRANSPARENT
+
 #include <arpa/inet.h>
 #include <sys/types.h>
 #include <sys/time.h>
diff --git a/include/winuser.h b/include/winuser.h
index 88d9f85..0af79af 100644
--- a/include/winuser.h
+++ b/include/winuser.h
@@ -2914,8 +2914,10 @@
 #define     AnsiToOemBuffA CharToOemBuffA
 #define     AnsiToOemBuffW CharToOemBuffW
 #define     AnsiToOemBuff WINELIB_NAME_AW(AnsiToOemBuff)
-WORD        WINAPI CascadeWindows (HWND, UINT, const LPRECT,
-                                   UINT, const HWND *);
+
+HKL         WINAPI ActivateKeyboardLayout(HKL,UINT);
+LONG        WINAPI BroadcastSystemMessage(DWORD,LPDWORD,UINT,WPARAM,LPARAM);
+WORD        WINAPI CascadeWindows(HWND, UINT, const LPRECT, UINT, const HWND *);
 INT       WINAPI CopyAcceleratorTableA(HACCEL,LPACCEL,INT);
 INT       WINAPI CopyAcceleratorTableW(HACCEL,LPACCEL,INT);
 #define     CopyAcceleratorTable WINELIB_NAME_AW(CopyAcceleratorTable)
@@ -2928,7 +2930,9 @@
 BOOL      WINAPI EnumThreadWindows(DWORD,WNDENUMPROC,LPARAM);
 BOOL      WINAPI ExitWindowsEx(UINT,DWORD);
 BOOL      WINAPI GetIconInfo(HICON,LPICONINFO);
-DWORD       WINAPI GetMenuContextHelpId(HMENU);
+HKL       WINAPI GetKeyboardLayout(DWORD);
+INT       WINAPI GetKeyboardLayoutList(INT,HKL *);
+DWORD     WINAPI GetMenuContextHelpId(HMENU);
 UINT      WINAPI GetMenuDefaultItem(HMENU,UINT,UINT);
 BOOL      WINAPI GetMenuInfo(HMENU,LPMENUINFO);
 BOOL      WINAPI GetMenuItemInfoA(HMENU,UINT,BOOL,MENUITEMINFOA*);
@@ -2957,7 +2961,11 @@
 BOOL      WINAPI PostThreadMessageA(DWORD, UINT, WPARAM, LPARAM);
 BOOL      WINAPI PostThreadMessageW(DWORD, UINT, WPARAM, LPARAM);
 #define     PostThreadMessage WINELIB_NAME_AW(PostThreadMessage)
+BOOL        WINAPI RegisterHotKey(HWND,INT,UINT,UINT);
 UINT      WINAPI ReuseDDElParam(UINT,UINT,UINT,UINT,UINT);
+BOOL        WINAPI SendMessageCallbackA(HWND,UINT,WPARAM,LPARAM,FARPROC,DWORD);
+BOOL        WINAPI SendMessageCallbackW(HWND,UINT,WPARAM,LPARAM,FARPROC,DWORD);
+#define      SendMessageCallback WINELIB_NAME_AW(SendMessageCallback)
 BOOL      WINAPI SendNotifyMessageA(HWND,UINT,WPARAM,LPARAM);
 BOOL      WINAPI SendNotifyMessageW(HWND,UINT,WPARAM,LPARAM);
 #define     SendNotifyMessage WINELIB_NAME_AW(SendNotifyMessage)
@@ -2971,9 +2979,11 @@
 BOOL      WINAPI SetWindowContextHelpId(HWND,DWORD);
 WORD        WINAPI TileWindows (HWND, UINT, const LPRECT,
                                 UINT, const HWND *);
+INT         WINAPI ToUnicode(UINT,UINT,PBYTE,LPWSTR,int,UINT);
 BOOL      WINAPI TrackPopupMenuEx(HMENU,UINT,INT,INT,HWND,
                                     LPTPMPARAMS);
 UINT      WINAPI UnpackDDElParam(UINT,UINT,UINT*,UINT*);
+BOOL        WINAPI UnregisterHotKey(HWND,INT);
 DWORD       WINAPI WaitForInputIdle(HANDLE,DWORD);
 VOID        WINAPI keybd_event(BYTE,BYTE,DWORD,DWORD);
 VOID        WINAPI mouse_event(DWORD,DWORD,DWORD,DWORD,DWORD);
diff --git a/include/winversion.h b/include/winversion.h
index e3fb5c8..b371dca 100644
--- a/include/winversion.h
+++ b/include/winversion.h
@@ -1,6 +1,8 @@
 #ifndef __WINE_WINVERSION_H
 #define __WINE_WINVERSION_H
 
+#include "windef.h"
+
 typedef enum
 {
     WIN31, /* Windows 3.1 */
diff --git a/include/wnet.h b/include/wnet.h
index 3729642..b7d7fed 100644
--- a/include/wnet.h
+++ b/include/wnet.h
@@ -5,6 +5,7 @@
 #ifndef __WINE_WNET_H
 #define __WINE_WNET_H
 
+#include "windef.h"
 #include "winerror.h"
 
 #define WNDN_MKDIR  1
diff --git a/loader/task.c b/loader/task.c
index eba0b72..0cfc833 100644
--- a/loader/task.c
+++ b/loader/task.c
@@ -599,8 +599,8 @@
     /* Check what we need to do */
     hOldTask = GetCurrentTask();
     pOldTask = (TDB *)GlobalLock16( hOldTask );
-    TRACE_(task)( "entered with hCurrentTask %04x by hTask %04x (pid %d)\n", 
-                  hCurrentTask, hOldTask, getpid() );
+    TRACE_(task)( "entered with hCurrentTask %04x by hTask %04x (pid %ld)\n", 
+                  hCurrentTask, hOldTask, (long) getpid() );
 
     if ( pOldTask && THREAD_IsWin16( NtCurrentTeb() ) )
     {
diff --git a/memory/atom.c b/memory/atom.c
index c317449..aab4592 100644
--- a/memory/atom.c
+++ b/memory/atom.c
@@ -19,6 +19,7 @@
 #include "wine/winbase16.h"
 #include "wine/winuser16.h"
 #include "winuser.h"
+#include "global.h"
 #include "instance.h"
 #include "ldt.h"
 #include "stackframe.h"
diff --git a/memory/ldt.c b/memory/ldt.c
index a2f4fe1..aa0ee3b 100644
--- a/memory/ldt.c
+++ b/memory/ldt.c
@@ -61,6 +61,7 @@
 
 #if defined(__svr4__) || defined(_SCO_DS)
 #include <sys/sysi86.h>
+extern int sysi86(int,void*);
 #ifndef __sun__
 #include <sys/seg.h>
 #endif
diff --git a/memory/selector.c b/memory/selector.c
index d2cf909..1a2891c 100644
--- a/memory/selector.c
+++ b/memory/selector.c
@@ -12,6 +12,7 @@
 #include "stackframe.h"
 #include "process.h"
 #include "debugtools.h"
+#include "toolhelp.h"
 
 DEFAULT_DEBUG_CHANNEL(selector)
 
diff --git a/memory/string.c b/memory/string.c
index 4e480d9..ddbb6c3 100644
--- a/memory/string.c
+++ b/memory/string.c
@@ -9,6 +9,7 @@
 #include <string.h>
 
 #include "wine/winbase16.h"
+#include "wine/winuser16.h"
 #include "winbase.h"
 #include "winuser.h"
 #include "wine/keyboard16.h"
diff --git a/misc/comm.c b/misc/comm.c
index b8cee05..73b67db 100644
--- a/misc/comm.c
+++ b/misc/comm.c
@@ -145,21 +145,7 @@
 }
 
 
-struct DosDeviceStruct *GetDeviceStruct_fd(int fd)
-{
-	int x;
-
-	for (x=0; x!=MAX_PORTS; x++) {
-	    if (COM[x].fd == fd)
-		return &COM[x];
-	    if (LPT[x].fd == fd)
-		return &LPT[x];
-	}
-
-	return NULL;
-}
-
-struct DosDeviceStruct *GetDeviceStruct(int fd)
+static struct DosDeviceStruct *GetDeviceStruct(int fd)
 {
 	if ((fd&0x7F)<=MAX_PORTS) {
             if (!(fd&FLAG_LPT)) {
@@ -174,7 +160,7 @@
 	return NULL;
 }
 
-int    GetCommPort_fd(int fd)
+static int    GetCommPort_fd(int fd)
 {
         int x;
         
@@ -186,17 +172,17 @@
        return -1;
 } 
 
-int ValidCOMPort(int x)
+static int ValidCOMPort(int x)
 {
 	return(x < MAX_PORTS ? (int) COM[x].devicename : 0); 
 }
 
-int ValidLPTPort(int x)
+static int ValidLPTPort(int x)
 {
 	return(x < MAX_PORTS ? (int) LPT[x].devicename : 0); 
 }
 
-int WinError(void)
+static int WinError(void)
 {
         TRACE(comm, "errno = %d\n", errno);
 	switch (errno) {
diff --git a/misc/cpu.c b/misc/cpu.c
index 8a07175..8ad04bb 100644
--- a/misc/cpu.c
+++ b/misc/cpu.c
@@ -46,7 +46,6 @@
 	static int cache = 0;
 	static SYSTEM_INFO cachedsi;
 	HKEY	xhkey=0,hkey;
-	char	buf[20];
 
 	if (cache) {
 		memcpy(si,&cachedsi,sizeof(*si));
@@ -82,6 +81,7 @@
 
 #ifdef linux
 	{
+	char buf[20];
 	char line[200];
 	FILE *f = fopen ("/proc/cpuinfo", "r");
 
diff --git a/misc/lstr.c b/misc/lstr.c
index 9e9a1cc..8054cca 100644
--- a/misc/lstr.c
+++ b/misc/lstr.c
@@ -21,10 +21,10 @@
 # define iswlower(c) islower(c)
 #endif  /* HAVE_WCTYPE_H */
 
-
+#include "wine/winbase16.h"
+#include "wine/winuser16.h"
 #include "winbase.h"
 #include "winuser.h"
-#include "wine/winbase16.h"
 #include "winnls.h"
 #include "task.h"
 #include "heap.h"
diff --git a/misc/port.c b/misc/port.c
index 7f99f64..9d0a0aa 100644
--- a/misc/port.c
+++ b/misc/port.c
@@ -5,8 +5,10 @@
  */
 
 #include "config.h"
+
 #include <stdio.h>
 #include <string.h>
+#include <unistd.h>
 #include <sys/types.h>
 #include <sys/time.h>
 #include <sys/stat.h>
diff --git a/misc/registry.c b/misc/registry.c
index 833c707..412b3bc 100644
--- a/misc/registry.c
+++ b/misc/registry.c
@@ -729,7 +729,7 @@
 
     if (!(home = getenv( "HOME" )))
     {
-        WARN_(reg)("Failed to get homedirectory of UID %d.\n",getuid());
+        WARN_(reg)("Failed to get homedirectory of UID %ld.\n",(long) getuid());
         return;
     }
     /* 
@@ -1964,7 +1964,7 @@
   }
   else
   {
-    WARN_(reg)("Failed to get homedirectory of UID %d.\n",getuid());
+    WARN_(reg)("Failed to get homedirectory of UID %ld.\n",(long) getuid());
   }
 
   /* 
diff --git a/misc/winsock.c b/misc/winsock.c
index 70d800e..6aff24a 100644
--- a/misc/winsock.c
+++ b/misc/winsock.c
@@ -251,7 +251,7 @@
     unsigned int optval, optlen;
 
     optlen = sizeof(optval);
-    getsockopt(s, SOL_SOCKET, SO_ERROR, &optval, &optlen);
+    getsockopt(s, SOL_SOCKET, SO_ERROR, (void *) &optval, &optlen);
     if (optval) WARN(winsock, "\t[%i] error: %d\n", s, optval);
     return optval != 0;
 }
@@ -2336,7 +2336,7 @@
 
 		pws->psop = psop;
 		pws->flags |= (0x0000FFFF & lEvent);
-		getsockopt(pws->fd, SOL_SOCKET, SO_TYPE, &sock_type, &bytes);
+		getsockopt(pws->fd, SOL_SOCKET, SO_TYPE, (void *) &sock_type, &bytes);
 		if( sock_type == SOCK_RAW ) pws->flags |= WS_FD_RAW;
 
 		if( lEvent & (WS_FD_ACCEPT | WS_FD_CONNECT | WS_FD_READ | WS_FD_CLOSE) )
diff --git a/msdos/dpmi.c b/msdos/dpmi.c
index 1ce03a8..83eea74 100644
--- a/msdos/dpmi.c
+++ b/msdos/dpmi.c
@@ -336,7 +336,7 @@
         SP_reg(context) -= (args + (iret?1:0)) * sizeof(WORD);
 #else
     if (!already) {
-        stack16 = CURRENT_STACK16;
+        stack16 = (LPWORD) CURRENT_STACK16;
 #endif
         stack16 -= args;
         if (args) memcpy(stack16, stack, args*sizeof(WORD) );
@@ -387,7 +387,7 @@
 
         CS_reg(context) = HIWORD(seg_addr);
         IP_reg(context) = LOWORD(seg_addr);
-        EBP_reg(context) = OFFSETOF( thdb->cur_stack )
+        EBP_reg(context) = OFFSETOF( NtCurrentTeb()->cur_stack )
                                    + (WORD)&((STACK16FRAME*)0)->bp;
         Callbacks->CallRegisterShortProc(context, args*sizeof(WORD));
 	SELECTOR_FreeBlock(sel, 1);
diff --git a/msdos/int2f.c b/msdos/int2f.c
index 0b63071..add9ced 100644
--- a/msdos/int2f.c
+++ b/msdos/int2f.c
@@ -120,10 +120,11 @@
 	    break;
 	case 0x10:   /* XMS v2+ get driver address */
 	{
+#ifdef MZ_SUPPORTED
             TDB *pTask = (TDB *)GlobalLock16( GetCurrentTask() );
             NE_MODULE *pModule = pTask ? NE_GetPtr( pTask->hModule ) : NULL;
             GlobalUnlock16( GetCurrentTask() );
-#ifdef MZ_SUPPORTED
+
             if (pModule && pModule->lpDosTask)
                 ES_reg(context) = pModule->lpDosTask->xms_seg;
             else
@@ -359,11 +360,14 @@
         if (ISV86(context)) break; /* so bail out for now if in v86 mode */
 #endif
         {
+	    SYSTEM_INFO si;
+#ifdef MZ_SUPPORTED
             TDB *pTask = (TDB *)GlobalLock16( GetCurrentTask() );
             NE_MODULE *pModule = pTask ? NE_GetPtr( pTask->hModule ) : NULL;
-	    SYSTEM_INFO si;
 
             GlobalUnlock16( GetCurrentTask() );
+#endif
+
 	    GetSystemInfo(&si);
 	    AX_reg(context) = 0x0000; /* DPMI Installed */
             BX_reg(context) = 0x0001; /* 32bits available */
diff --git a/ole/ole2.c b/ole/ole2.c
index 975e8b4..7ca01b6 100644
--- a/ole/ole2.c
+++ b/ole/ole2.c
@@ -8,7 +8,7 @@
 
 #include <assert.h>
 #include <stdlib.h>
-#include <strings.h>
+#include <string.h>
 
 #include "winuser.h"
 #include "winerror.h"
diff --git a/ole/parsedt.c b/ole/parsedt.c
index 963588f..3d42287 100644
--- a/ole/parsedt.c
+++ b/ole/parsedt.c
@@ -42,7 +42,6 @@
 #include <string.h>
 #include <sys/types.h>
 #include <errno.h>
-#include <float.h>
 #include <limits.h>
 #include <sys/timeb.h>
 
diff --git a/relay32/utthunk.c b/relay32/utthunk.c
index 4a94ce5..9460e2d 100644
--- a/relay32/utthunk.c
+++ b/relay32/utthunk.c
@@ -85,8 +85,8 @@
 /****************************************************************************
  *		UTGlue32
  */
-DWORD WINAPI UTGlue32( FARPROC16 target, LPVOID lpBuff, DWORD dwUserDefined, 
-                       LPVOID translationList[] )
+static DWORD WINAPI UTGlue32( FARPROC16 target, LPVOID lpBuff, DWORD dwUserDefined, 
+                              LPVOID translationList[] )
 {
     SEGPTR segBuff, *segptrList = NULL;
     INT i, nList = 0;
diff --git a/scheduler/client.c b/scheduler/client.c
index bc62f53..1d43015 100644
--- a/scheduler/client.c
+++ b/scheduler/client.c
@@ -104,7 +104,7 @@
     struct msghdr msghdr;
     struct iovec vec;
 
-    vec.iov_base = &req;
+    vec.iov_base = (void *)&req;
     vec.iov_len  = sizeof(req);
 
     msghdr.msg_name    = NULL;
@@ -194,7 +194,7 @@
     msghdr.msg_namelen = 0;
     msghdr.msg_iov     = &vec;
     msghdr.msg_iovlen  = 1;
-    vec.iov_base = &res;
+    vec.iov_base = (void *)&res;
     vec.iov_len  = sizeof(res);
 
     for (;;)
diff --git a/scheduler/syslevel.c b/scheduler/syslevel.c
index 6c69ecc..37c3325 100644
--- a/scheduler/syslevel.c
+++ b/scheduler/syslevel.c
@@ -73,8 +73,8 @@
     TEB *teb = NtCurrentTeb();
     int i;
 
-    TRACE("(%p, level %d): thread %p (fs %04x, pid %d) count before %ld\n", 
-                  lock, lock->level, teb->tid, teb->teb_sel, getpid(),
+    TRACE("(%p, level %d): thread %p (fs %04x, pid %ld) count before %ld\n", 
+                  lock, lock->level, teb->tid, teb->teb_sel, (long) getpid(),
                   teb->sys_count[lock->level] );
 
     for ( i = 3; i > lock->level; i-- )
@@ -89,8 +89,8 @@
     teb->sys_count[lock->level]++;
     teb->sys_mutex[lock->level] = lock;
 
-    TRACE("(%p, level %d): thread %p (fs %04x, pid %d) count after  %ld\n",
-                  lock, lock->level, teb->tid, teb->teb_sel, getpid(), 
+    TRACE("(%p, level %d): thread %p (fs %04x, pid %ld) count after  %ld\n",
+                  lock, lock->level, teb->tid, teb->teb_sel, (long) getpid(), 
                   teb->sys_count[lock->level] );
 
     if (lock == &Win16Mutex)
@@ -104,8 +104,8 @@
 {
     TEB *teb = NtCurrentTeb();
 
-    TRACE("(%p, level %d): thread %p (fs %04x, pid %d) count before %ld\n", 
-                  lock, lock->level, teb->tid, teb->teb_sel, getpid(),
+    TRACE("(%p, level %d): thread %p (fs %04x, pid %ld) count before %ld\n", 
+                  lock, lock->level, teb->tid, teb->teb_sel, (long) getpid(),
                   teb->sys_count[lock->level] );
 
     if ( teb->sys_count[lock->level] <= 0 || teb->sys_mutex[lock->level] != lock )
@@ -122,8 +122,8 @@
 
     LeaveCriticalSection( &lock->crst );
 
-    TRACE("(%p, level %d): thread %p (fs %04x, pid %d) count after  %ld\n",
-                  lock, lock->level, teb->tid, teb->teb_sel, getpid(), 
+    TRACE("(%p, level %d): thread %p (fs %04x, pid %ld) count after  %ld\n",
+                  lock, lock->level, teb->tid, teb->teb_sel, (long) getpid(), 
                   teb->sys_count[lock->level] );
 }
 
diff --git a/server/main.c b/server/main.c
index ac0c308..0275b6d 100644
--- a/server/main.c
+++ b/server/main.c
@@ -25,9 +25,9 @@
 
     debug_level = 1;
 
-    if (debug_level) fprintf( stderr, "Server: starting (pid=%d)\n", getpid() );
+    if (debug_level) fprintf( stderr, "Server: starting (pid=%ld)\n", (long) getpid() );
     create_initial_thread( fd );
-    if (debug_level) fprintf( stderr, "Server: exiting (pid=%d)\n", getpid() );
+    if (debug_level) fprintf( stderr, "Server: exiting (pid=%ld)\n", (long) getpid() );
 
 #ifdef DEBUG_OBJECTS
     dump_objects();  /* dump any remaining objects */
diff --git a/server/socket.c b/server/socket.c
index 5628c1e..9571f73 100644
--- a/server/socket.c
+++ b/server/socket.c
@@ -73,7 +73,7 @@
         cmsg.fd = client->pass_fd;
 #endif  /* HAVE_MSGHDR_ACCRIGHTS */
 
-        iovec.iov_base = (char *)&client->res;
+        iovec.iov_base = (void *)&client->res;
         iovec.iov_len  = sizeof(client->res);
 
         ret = sendmsg( client->select.fd, &msghdr, 0 );
@@ -113,7 +113,7 @@
 
     assert( client->pass_fd == -1 );
 
-    iovec.iov_base = &req;
+    iovec.iov_base = (void *)&req;
     iovec.iov_len  = sizeof(req);
 
     ret = recvmsg( client->select.fd, &msghdr, 0 );
diff --git a/tools/build.c b/tools/build.c
index 4f49639..9a92b88 100644
--- a/tools/build.c
+++ b/tools/build.c
@@ -2730,7 +2730,9 @@
 static int BuildCallFrom16( FILE *outfile, char * outname, int argc, char *argv[] )
 {
     int i;
+#ifdef USE_STABS
     char buffer[1024];
+#endif
 
     /* File header */
 
@@ -2884,7 +2886,9 @@
  */
 static int BuildCall32( FILE *outfile, char * outname )
 {
+#ifdef USE_STABS
     char buffer[1024];
+#endif
 
     /* File header */
 
diff --git a/windows/caret.c b/windows/caret.c
index 35b1245..90fa950 100644
--- a/windows/caret.c
+++ b/windows/caret.c
@@ -5,10 +5,12 @@
  * Copyright 1996 Frans van Dorsselaer
  */
 
-#include "winuser.h"
-#include "module.h"
-#include "debug.h"
 #include "wine/wingdi16.h"
+#include "wine/winuser16.h"
+#include "module.h"
+#include "win.h"
+#include "winuser.h"
+#include "debug.h"
 
 DEFAULT_DEBUG_CHANNEL(caret)
 
diff --git a/windows/display.c b/windows/display.c
index ce3a09f..a864032 100644
--- a/windows/display.c
+++ b/windows/display.c
@@ -44,7 +44,7 @@
 /***********************************************************************
  *           DISPLAY_CheckCursor                  (DISPLAY.104)
  */
-VOID WINAPI DISPLAY_CheckCursor()
+VOID WINAPI DISPLAY_CheckCursor( void )
 {
     TRACE( cursor, "stub\n" );
 }
diff --git a/windows/driver.c b/windows/driver.c
index 41dfba8..e9f7d06 100644
--- a/windows/driver.c
+++ b/windows/driver.c
@@ -132,7 +132,7 @@
  * -1 : ko, unknown message
  * -2 : ko, memory problem
  */
-int	DRIVER_MapMsg16To32(WORD wMsg, DWORD* lParam1, DWORD* lParam2)
+static int DRIVER_MapMsg16To32(WORD wMsg, DWORD* lParam1, DWORD* lParam2)
 {
     int	ret = -1;
     
@@ -217,7 +217,7 @@
  * -1 : ko
  * -2 : ko, memory problem
  */
-int	DRIVER_UnMapMsg16To32(WORD wMsg, DWORD lParam1, DWORD lParam2)
+static int DRIVER_UnMapMsg16To32(WORD wMsg, DWORD lParam1, DWORD lParam2)
 {
     int	ret = -1;
     
@@ -284,7 +284,7 @@
  * -1 : ko, unknown message
  * -2 : ko, memory problem
  */
-int	DRIVER_MapMsg32To16(WORD wMsg, DWORD* lParam1, DWORD* lParam2)
+static int DRIVER_MapMsg32To16(WORD wMsg, DWORD* lParam1, DWORD* lParam2)
 {
     int	ret = -1;
     
@@ -393,7 +393,7 @@
  * -1 : ko
  * -2 : ko, memory problem
  */
-int	DRIVER_UnMapMsg32To16(WORD wMsg, DWORD lParam1, DWORD lParam2)
+static int DRIVER_UnMapMsg32To16(WORD wMsg, DWORD lParam1, DWORD lParam2)
 {
     int	ret = -1;
     
diff --git a/windows/mdi.c b/windows/mdi.c
index dc603bc..d3fae2d 100644
--- a/windows/mdi.c
+++ b/windows/mdi.c
@@ -23,6 +23,7 @@
 #include "user.h"
 #include "menu.h"
 #include "resource.h"
+#include "scroll.h"
 #include "struct32.h"
 #include "tweak.h"
 #include "debug.h"
@@ -34,8 +35,6 @@
 static HBITMAP16 hBmpClose   = 0;
 static HBITMAP16 hBmpRestore = 0;
 
-INT SCROLL_SetNCSbState(WND*,int,int,int,int,int,int);
-
 /* ----------------- declarations ----------------- */
 static void MDI_UpdateFrameText(WND *, HWND, BOOL, LPCSTR);
 static BOOL MDI_AugmentFrameMenu(MDICLIENTINFO*, WND *, HWND);
diff --git a/windows/message.c b/windows/message.c
index 6ca48dd..c956043 100644
--- a/windows/message.c
+++ b/windows/message.c
@@ -49,7 +49,7 @@
 /***********************************************************************
  *           MSG_CheckFilter
  */
-BOOL MSG_CheckFilter(DWORD uMsg, DWORD first, DWORD last)
+static BOOL MSG_CheckFilter(DWORD uMsg, DWORD first, DWORD last)
 {
    if( first || last )
        return (uMsg >= first && uMsg <= last);
@@ -1553,7 +1553,7 @@
  * return values: 0 if timeout occurs
  *                1 otherwise
  */
-LRESULT MSG_SendMessage( HWND hwnd, UINT msg, WPARAM wParam,
+static LRESULT MSG_SendMessage( HWND hwnd, UINT msg, WPARAM wParam,
                          LPARAM lParam, DWORD timeout, WORD flags,
                          LRESULT *pRes)
 {
diff --git a/windows/msgbox.c b/windows/msgbox.c
index 21a9207..ec5ff2b 100644
--- a/windows/msgbox.c
+++ b/windows/msgbox.c
@@ -5,6 +5,8 @@
  */
 
 #include <string.h>
+
+#include "wine/winbase16.h"
 #include "wine/winuser16.h"
 #include "dlgs.h"
 #include "heap.h"
diff --git a/windows/multimon.c b/windows/multimon.c
index 5dc3987..e8b407a 100644
--- a/windows/multimon.c
+++ b/windows/multimon.c
@@ -21,7 +21,7 @@
 /***********************************************************************
  *              MONITOR_GetMonitor
  */
-MONITOR *MONITOR_GetMonitor(HMONITOR hMonitor)
+static MONITOR *MONITOR_GetMonitor(HMONITOR hMonitor)
 {
   if(hMonitor == xPRIMARY_MONITOR)
     {
diff --git a/windows/nonclient.c b/windows/nonclient.c
index 16015e5..f382f04 100644
--- a/windows/nonclient.c
+++ b/windows/nonclient.c
@@ -636,7 +636,7 @@
  * Handle a WM_NCHITTEST message. Called from NC_HandleNcHitTest().
  */
 
-LONG NC_DoNCHitTest (WND *wndPtr, POINT16 pt )
+static LONG NC_DoNCHitTest (WND *wndPtr, POINT16 pt )
 {
     RECT16 rect;
 
@@ -771,7 +771,7 @@
  * FIXME:  Just a modified copy of the Win 3.1 version.
  */
 
-LONG
+static LONG
 NC_DoNCHitTest95 (WND *wndPtr, POINT16 pt )
 {
     RECT16 rect;
@@ -1070,7 +1070,7 @@
  *
  *****************************************************************************/
 
-void NC_DrawCloseButton95 (HWND hwnd, HDC hdc, BOOL down)
+static void NC_DrawCloseButton95 (HWND hwnd, HDC hdc, BOOL down)
 {
     RECT rect;
     HDC hdcMem;
@@ -1556,7 +1556,7 @@
  *
  * Paint the non-client area. clip is currently unused.
  */
-void NC_DoNCPaint( WND* wndPtr, HRGN clip, BOOL suppress_menupaint )
+static void NC_DoNCPaint( WND* wndPtr, HRGN clip, BOOL suppress_menupaint )
 {
     HDC hdc;
     RECT rect;
@@ -1667,7 +1667,7 @@
  *
  *****************************************************************************/
 
-void  NC_DoNCPaint95(
+static void  NC_DoNCPaint95(
     WND  *wndPtr,
     HRGN  clip,
     BOOL  suppress_menupaint )
diff --git a/windows/painting.c b/windows/painting.c
index db20ef5..25d146f 100644
--- a/windows/painting.c
+++ b/windows/painting.c
@@ -380,10 +380,14 @@
      */
 
     BOOL bHadOne =  wndPtr->hrgnUpdate && hRgn;
-    RECT r = {0, 0, wndPtr->rectWindow.right - wndPtr->rectWindow.left,
-		    wndPtr->rectWindow.bottom - wndPtr->rectWindow.top };
     BOOL bChildren =  ( wndPtr->child && !(flags & RDW_NOCHILDREN) && !(wndPtr->dwStyle & WS_MINIMIZE) 
 			&& ((flags & RDW_ALLCHILDREN) || !(wndPtr->dwStyle & WS_CLIPCHILDREN)) );
+    RECT r;
+
+    r.left = 0;
+    r.top = 0;
+    r.right = wndPtr->rectWindow.right - wndPtr->rectWindow.left;
+    r.bottom = wndPtr->rectWindow.bottom - wndPtr->rectWindow.top;
 
     TRACE_(win)("\thwnd %04x [%04x] -> hrgn [%04x], flags [%04x]\n", wndPtr->hwndSelf, wndPtr->hrgnUpdate, hRgn, flags );
 
@@ -411,8 +415,8 @@
 			    }
 			}
 			break;
-
 		case 1:	/* already an entire window */
+		        break;
 	    }
 	}
 	else if( hRgn == 1 )
@@ -474,9 +478,11 @@
 	if( hRgn > 1 && bChildren )
 	{
             WND* wnd = wndPtr->child;
-            POINT ptClient = { wndPtr->rectClient.left - wndPtr->rectWindow.left,
-                               wndPtr->rectClient.top - wndPtr->rectWindow.top };
 	    POINT ptTotal, prevOrigin = {0,0};
+            POINT ptClient;
+
+            ptClient.x = wndPtr->rectClient.left - wndPtr->rectWindow.left;
+            ptClient.y = wndPtr->rectClient.top - wndPtr->rectWindow.top;
 
             for( ptTotal.x = ptTotal.y = 0; wnd; wnd = wnd->next )
             {
diff --git a/windows/queue.c b/windows/queue.c
index 662aa6f..7c8afc6 100644
--- a/windows/queue.c
+++ b/windows/queue.c
@@ -488,7 +488,7 @@
  * 
  * Try to reply to all pending sent messages on exit.
  */
-void QUEUE_FlushMessages( MESSAGEQUEUE *queue )
+static void QUEUE_FlushMessages( MESSAGEQUEUE *queue )
 {
     SMSG *smsg;
     MESSAGEQUEUE *senderQ = 0;
diff --git a/windows/scroll.c b/windows/scroll.c
index ef817a4..0bf8adf 100644
--- a/windows/scroll.c
+++ b/windows/scroll.c
@@ -9,6 +9,7 @@
 
 #include <stdlib.h>
 
+#include "wine/winuser16.h"
 #include "winuser.h"
 #include "dc.h"
 #include "win.h"
diff --git a/windows/syscolor.c b/windows/syscolor.c
index f3f3896..210d8bd 100644
--- a/windows/syscolor.c
+++ b/windows/syscolor.c
@@ -9,6 +9,10 @@
 #include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
+
+#include "wine/winbase16.h"
+#include "wine/winuser16.h"
+#include "sysmetrics.h"
 #include "winbase.h"
 #include "winuser.h"
 #include "debug.h"
diff --git a/windows/sysmetrics.c b/windows/sysmetrics.c
index d8d6006..fb6d9b0 100644
--- a/windows/sysmetrics.c
+++ b/windows/sysmetrics.c
@@ -12,6 +12,7 @@
 #include "winuser.h"
 #include "monitor.h"
 #include "options.h"
+#include "sysmetrics.h"
 #include "tweak.h"
 
 static short sysMetrics[SM_CMETRICS+1];
diff --git a/windows/timer.c b/windows/timer.c
index 34fa262..4250b0b 100644
--- a/windows/timer.c
+++ b/windows/timer.c
@@ -4,11 +4,13 @@
  * Copyright 1993 Alexandre Julliard
  */
 
+#include "wine/winuser16.h"
 #include "winuser.h"
 #include "queue.h"
 #include "task.h"
 #include "winproc.h"
 #include "services.h"
+#include "message.h"
 #include "debug.h"
 
 DEFAULT_DEBUG_CHANNEL(timer)
diff --git a/windows/winproc.c b/windows/winproc.c
index a6e1e79..fc3e698 100644
--- a/windows/winproc.c
+++ b/windows/winproc.c
@@ -402,7 +402,7 @@
  *
  * Return TRUE if the lparam is a string
  */
-BOOL WINPROC_TestCBForStr ( HWND hwnd )
+static BOOL WINPROC_TestCBForStr ( HWND hwnd )
 {
     BOOL retvalue;
     WND * wnd = WIN_FindWndPtr(hwnd);
@@ -416,7 +416,7 @@
  *
  * Return TRUE if the lparam is a string
  */
-BOOL WINPROC_TestLBForStr ( HWND hwnd )
+static BOOL WINPROC_TestLBForStr ( HWND hwnd )
 {
     BOOL retvalue;
     WND * wnd = WIN_FindWndPtr(hwnd); 
diff --git a/windows/x11drv/keyboard.c b/windows/x11drv/keyboard.c
index 05f5554..faa5d43 100644
--- a/windows/x11drv/keyboard.c
+++ b/windows/x11drv/keyboard.c
@@ -380,7 +380,7 @@
  * Convention : called with vkey only VK_NUMLOCK or VK_CAPITAL
  *
  */
-void KEYBOARD_GenerateMsg( WORD vkey, WORD scan, int Evtype, INT event_x, INT event_y,
+static void KEYBOARD_GenerateMsg( WORD vkey, WORD scan, int Evtype, INT event_x, INT event_y,
                            DWORD event_time )
 {
   BOOL * State = (vkey==VK_NUMLOCK? &NumState : &CapsState);
@@ -429,7 +429,7 @@
  * Updates internal state for <vkey>, depending on key <state> under X
  *
  */
-void KEYBOARD_UpdateOneState ( int vkey, int state )
+static void KEYBOARD_UpdateOneState ( int vkey, int state )
 {
     /* Do something if internal table state != X state for keycode */
     if (((pKeyStateTable[vkey] & 0x80)!=0) != state)
@@ -592,7 +592,7 @@
  *  This routine walks through the defined keyboard layouts and selects
  *  whichever matches most closely.
  */
-void
+static void
 X11DRV_KEYBOARD_DetectLayout (void)
 {
   unsigned current, match, mismatch, seq;