Removed input.h, queue.h, spy.h and sysmetrics.h and moved their
contents to user.h.
Moved message.h and winproc.h to dlls/user.

diff --git a/controls/combo.c b/controls/combo.c
index d94f984..cacf44c 100644
--- a/controls/combo.c
+++ b/controls/combo.c
@@ -28,7 +28,7 @@
 #include "winuser.h"
 #include "wine/winuser16.h"
 #include "wine/unicode.h"
-#include "spy.h"
+#include "message.h"
 #include "user.h"
 #include "win.h"
 #include "controls.h"
diff --git a/controls/listbox.c b/controls/listbox.c
index 24c02dc..d2d931f 100644
--- a/controls/listbox.c
+++ b/controls/listbox.c
@@ -29,7 +29,7 @@
 #include "wine/unicode.h"
 #include "winuser.h"
 #include "winerror.h"
-#include "spy.h"
+#include "message.h"
 #include "user.h"
 #include "controls.h"
 #include "wine/debug.h"
diff --git a/controls/scroll.c b/controls/scroll.c
index efed4c2..209f762 100644
--- a/controls/scroll.c
+++ b/controls/scroll.c
@@ -26,7 +26,7 @@
 #include "win.h"
 #include "wine/debug.h"
 #include "user.h"
-#include "spy.h"
+#include "message.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(scroll);
 
diff --git a/dlls/comctl32/rebar.c b/dlls/comctl32/rebar.c
index 91d630a..e1ebfa8 100644
--- a/dlls/comctl32/rebar.c
+++ b/dlls/comctl32/rebar.c
@@ -146,7 +146,6 @@
 #include "wingdi.h"
 #include "wine/unicode.h"
 #include "commctrl.h"
-/* #include "spy.h" */
 #include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(rebar);
@@ -4261,7 +4260,7 @@
     REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
 
     TRACE("hwnd=%p msg=%x wparam=%x lparam=%lx\n",
-	  hwnd, uMsg, /* SPY_GetMsgName(uMsg), */ wParam, lParam);
+	  hwnd, uMsg, wParam, lParam);
     if (!infoPtr && (uMsg != WM_NCCREATE))
 	    return DefWindowProcA (hwnd, uMsg, wParam, lParam);
     switch (uMsg)
diff --git a/dlls/user/hook.c b/dlls/user/hook.c
index 970de85..01b35fc 100644
--- a/dlls/user/hook.c
+++ b/dlls/user/hook.c
@@ -66,7 +66,7 @@
 #include "winuser.h"
 #include "winerror.h"
 #include "heap.h"
-#include "queue.h"
+#include "message.h"
 #include "win.h"
 #include "wine/server.h"
 #include "wine/unicode.h"
diff --git a/dlls/user/hook16.c b/dlls/user/hook16.c
index 0b3a676..a63b13b 100644
--- a/dlls/user/hook16.c
+++ b/dlls/user/hook16.c
@@ -26,8 +26,9 @@
 #include "winuser.h"
 #include "wownt32.h"
 #include "wine/winuser16.h"
-#include "queue.h"
+#include "message.h"
 #include "win.h"
+#include "winproc.h"
 #include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(hook);
diff --git a/dlls/user/message.c b/dlls/user/message.c
index 4ec5e00..b55253d 100644
--- a/dlls/user/message.c
+++ b/dlls/user/message.c
@@ -29,12 +29,10 @@
 #include "dde.h"
 #include "wine/unicode.h"
 #include "wine/server.h"
-#include "queue.h"
-#include "input.h"
 #include "message.h"
-#include "spy.h"
 #include "user.h"
 #include "win.h"
+#include "winproc.h"
 #include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(msg);
diff --git a/dlls/user/message.h b/dlls/user/message.h
new file mode 100644
index 0000000..9cbe941
--- /dev/null
+++ b/dlls/user/message.h
@@ -0,0 +1,87 @@
+/*
+ * Message definitions
+ *
+ * Copyright 1993 Alexandre Julliard
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef __WINE_MESSAGE_H
+#define __WINE_MESSAGE_H
+
+#include "windef.h"
+#include "wine/windef16.h"
+
+struct received_message_info;
+struct hook16_queue_info;
+
+/* Message queue */
+typedef struct tagMESSAGEQUEUE
+{
+  HQUEUE16  self;                   /* Handle to self (was: reserved) */
+  HANDLE    server_queue;           /* Handle to server-side queue */
+  DWORD     recursion_count;        /* Counter to prevent infinite SendMessage recursion */
+  HHOOK     hook;                   /* Current hook */
+  struct received_message_info *receive_info; /* Info about message being currently received */
+  struct hook16_queue_info *hook16_info;      /* Opaque pointer for 16-bit hook support */
+
+  DWORD     GetMessageTimeVal;      /* Value for GetMessageTime */
+  DWORD     GetMessagePosVal;       /* Value for GetMessagePos */
+  DWORD     GetMessageExtraInfoVal; /* Value for GetMessageExtraInfo */
+
+  HCURSOR   cursor;                 /* current cursor */
+  INT       cursor_count;           /* cursor show count */
+} MESSAGEQUEUE;
+
+
+#define MAX_SENDMSG_RECURSION  64
+
+/* queue.c */
+extern MESSAGEQUEUE *QUEUE_Current(void);
+extern void QUEUE_DeleteMsgQueue(void);
+
+/* message.c */
+extern BOOL MSG_process_raw_hardware_message( MSG *msg, ULONG_PTR extra_info, HWND hwnd_filter,
+                                              UINT first, UINT last, BOOL remove );
+extern BOOL MSG_process_cooked_hardware_message( MSG *msg, ULONG_PTR extra_info, BOOL remove );
+extern void MSG_JournalPlayBackMsg(void);
+
+/* sendmsg.c */
+extern BOOL MSG_peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, int flags );
+
+/* spy.c */
+#define SPY_DISPATCHMESSAGE16     0x0100
+#define SPY_DISPATCHMESSAGE       0x0101
+#define SPY_SENDMESSAGE16         0x0102
+#define SPY_SENDMESSAGE           0x0103
+#define SPY_DEFWNDPROC16          0x0104
+#define SPY_DEFWNDPROC            0x0105
+
+#define SPY_RESULT_OK16           0x0000
+#define SPY_RESULT_OK             0x0001
+#define SPY_RESULT_INVALIDHWND16  0x0002
+#define SPY_RESULT_INVALIDHWND    0x0003
+#define SPY_RESULT_DEFWND16       0x0004
+#define SPY_RESULT_DEFWND         0x0005
+
+
+extern const char *SPY_GetMsgName( UINT msg, HWND hWnd );
+extern const char *SPY_GetVKeyName(WPARAM wParam);
+extern void SPY_EnterMessage( INT iFlag, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam );
+extern void SPY_ExitMessage( INT iFlag, HWND hwnd, UINT msg,
+                             LRESULT lReturn, WPARAM wParam, LPARAM lParam );
+extern int SPY_Init(void);
+
+#endif  /* __WINE_MESSAGE_H */
diff --git a/dlls/user/msg16.c b/dlls/user/msg16.c
index 3d14a75..c30fb9c 100644
--- a/dlls/user/msg16.c
+++ b/dlls/user/msg16.c
@@ -22,9 +22,9 @@
 #include "wownt32.h"
 #include "winerror.h"
 #include "message.h"
-#include "spy.h"
 #include "thread.h"
 #include "win.h"
+#include "winproc.h"
 #include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(msg);
@@ -266,7 +266,7 @@
             /* before calling window proc, verify whether timer is still valid;
                there's a slim chance that the application kills the timer
 	       between GetMessage and DispatchMessage API calls */
-            if (!TIMER_IsTimerValid(hwnd, (UINT) msg->wParam, (HWINDOWPROC) msg->lParam))
+            if (!TIMER_IsTimerValid(hwnd, (UINT) msg->wParam, (WNDPROC)msg->lParam))
                 return 0; /* invalid winproc */
 
             return CallWindowProc16( (WNDPROC16)msg->lParam, msg->hwnd,
diff --git a/dlls/user/user_main.c b/dlls/user/user_main.c
index 47df466..d965e17 100644
--- a/dlls/user/user_main.c
+++ b/dlls/user/user_main.c
@@ -30,12 +30,9 @@
 #include "controls.h"
 #include "cursoricon.h"
 #include "global.h"
-#include "input.h"
 #include "message.h"
-#include "queue.h"
-#include "spy.h"
-#include "sysmetrics.h"
 #include "user.h"
+#include "thread.h"
 #include "win.h"
 #include "wine/debug.h"
 
diff --git a/include/winproc.h b/dlls/user/winproc.h
similarity index 81%
rename from include/winproc.h
rename to dlls/user/winproc.h
index a8bc080..c5d43f9 100644
--- a/include/winproc.h
+++ b/dlls/user/winproc.h
@@ -40,8 +40,6 @@
     WIN_PROC_TIMER
 } WINDOWPROCUSER;
 
-typedef void *HWINDOWPROC;  /* Really a pointer to a WINDOWPROC */
-
 typedef struct
 {
     WPARAM16	wParam;
@@ -56,12 +54,14 @@
     LRESULT	lResult;
 } MSGPARAM;
 
+struct tagWINDOWPROC;
+
 extern BOOL WINPROC_Init(void);
-extern WNDPROC16 WINPROC_GetProc( HWINDOWPROC proc, WINDOWPROCTYPE type );
-extern BOOL WINPROC_SetProc( HWINDOWPROC *pFirst, WNDPROC16 func,
+extern WNDPROC16 WINPROC_GetProc( WNDPROC proc, WINDOWPROCTYPE type );
+extern BOOL WINPROC_SetProc( WNDPROC *pFirst, WNDPROC func,
                                WINDOWPROCTYPE type, WINDOWPROCUSER user );
-extern void WINPROC_FreeProc( HWINDOWPROC proc, WINDOWPROCUSER user );
-extern WINDOWPROCTYPE WINPROC_GetProcType( HWINDOWPROC proc );
+extern void WINPROC_FreeProc( WNDPROC proc, WINDOWPROCUSER user );
+extern WINDOWPROCTYPE WINPROC_GetProcType( WNDPROC proc );
 
 extern INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM *pwparam,
                                      LPARAM *plparam );
@@ -132,4 +132,21 @@
     if (HIWORD(str)) HeapFree( GetProcessHeap(), 0, (void *)str );
 }
 
+
+/* Class functions */
+struct tagCLASS;  /* opaque structure */
+struct builtin_class_descr;
+struct tagDCE;
+extern ATOM CLASS_RegisterBuiltinClass( const struct builtin_class_descr *descr );
+extern struct tagCLASS *CLASS_AddWindow( ATOM atom, HINSTANCE inst, WINDOWPROCTYPE type,
+                                         INT *winExtra, WNDPROC *winproc,
+                                         DWORD *style, struct tagDCE **dce );
+extern void CLASS_RemoveWindow( struct tagCLASS *cls );
+extern void CLASS_FreeModuleClasses( HMODULE16 hModule );
+
+/* Timer functions */
+extern void TIMER_RemoveWindowTimers( HWND hwnd );
+extern void TIMER_RemoveThreadTimers(void);
+extern BOOL TIMER_IsTimerValid( HWND hwnd, UINT id, WNDPROC proc );
+
 #endif  /* __WINE_WINPROC_H */
diff --git a/dlls/x11drv/event.c b/dlls/x11drv/event.c
index 955c88c..261e5ae 100644
--- a/dlls/x11drv/event.c
+++ b/dlls/x11drv/event.c
@@ -37,15 +37,13 @@
 #include "shlobj.h"  /* DROPFILES */
 
 #include "clipboard.h"
-#include "dce.h"
-#include "wine/debug.h"
-#include "input.h"
 #include "win.h"
 #include "winpos.h"
 #include "windef.h"
 #include "winreg.h"
 #include "x11drv.h"
 #include "shellapi.h"
+#include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(event);
 
diff --git a/dlls/x11drv/window.c b/dlls/x11drv/window.c
index e441512..3c62db1 100644
--- a/dlls/x11drv/window.c
+++ b/dlls/x11drv/window.c
@@ -38,7 +38,6 @@
 #include "x11drv.h"
 #include "win.h"
 #include "winpos.h"
-#include "dce.h"
 #include "mwm.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(x11drv);
diff --git a/dlls/x11drv/winpos.c b/dlls/x11drv/winpos.c
index b1fbad2..4e56530 100644
--- a/dlls/x11drv/winpos.c
+++ b/dlls/x11drv/winpos.c
@@ -39,7 +39,6 @@
 #include "dce.h"
 #include "cursoricon.h"
 #include "nonclient.h"
-#include "message.h"
 
 #include "wine/server.h"
 #include "wine/debug.h"
diff --git a/include/input.h b/include/input.h
deleted file mode 100644
index ab657ce..0000000
--- a/include/input.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * USER input header file
- * Copyright 1997 David Faure
- *
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#ifndef __WINE_INPUT_H
-#define __WINE_INPUT_H
-
-#include "windef.h"
-
-extern BYTE InputKeyStateTable[256];
-extern BYTE AsyncKeyStateTable[256];
-
-#endif  /* __WINE_INPUT_H */
-
diff --git a/include/message.h b/include/message.h
deleted file mode 100644
index c1b3111..0000000
--- a/include/message.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Message definitions
- *
- * Copyright 1993 Alexandre Julliard
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#ifndef __WINE_MESSAGE_H
-#define __WINE_MESSAGE_H
-
-#include "windef.h"
-#include "wine/windef16.h"
-#include "winproc.h"
-
-/* message.c */
-extern BOOL MSG_process_raw_hardware_message( MSG *msg, ULONG_PTR extra_info, HWND hwnd_filter,
-                                              UINT first, UINT last, BOOL remove );
-extern BOOL MSG_process_cooked_hardware_message( MSG *msg, ULONG_PTR extra_info, BOOL remove );
-extern void MSG_JournalPlayBackMsg(void);
-
-/* sendmsg.c */
-extern BOOL MSG_peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, int flags );
-
-/* timer.c */
-extern void TIMER_RemoveWindowTimers( HWND hwnd );
-extern void TIMER_RemoveThreadTimers(void);
-extern BOOL TIMER_IsTimerValid( HWND hwnd, UINT id, HWINDOWPROC hProc );
-
-#endif  /* __WINE_MESSAGE_H */
diff --git a/include/queue.h b/include/queue.h
deleted file mode 100644
index c4b74c4..0000000
--- a/include/queue.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Message queues definitions
- *
- * Copyright 1993 Alexandre Julliard
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#ifndef __WINE_QUEUE_H
-#define __WINE_QUEUE_H
-
-#include "windef.h"
-#include "winbase.h"
-#include "wingdi.h"
-#include "winuser.h"
-#include "thread.h"
-
-struct received_message_info;
-struct hook16_queue_info;
-
-/* Message queue */
-typedef struct tagMESSAGEQUEUE
-{
-  HQUEUE16  self;                   /* Handle to self (was: reserved) */
-  HANDLE    server_queue;           /* Handle to server-side queue */
-  DWORD     recursion_count;        /* Counter to prevent infinite SendMessage recursion */
-  HHOOK     hook;                   /* Current hook */
-  struct received_message_info *receive_info; /* Info about message being currently received */
-  struct hook16_queue_info *hook16_info;      /* Opaque pointer for 16-bit hook support */
-
-  DWORD     GetMessageTimeVal;      /* Value for GetMessageTime */
-  DWORD     GetMessagePosVal;       /* Value for GetMessagePos */
-  DWORD     GetMessageExtraInfoVal; /* Value for GetMessageExtraInfo */
-
-  HCURSOR   cursor;                 /* current cursor */
-  INT       cursor_count;           /* cursor show count */
-} MESSAGEQUEUE;
-
-
-#define MAX_SENDMSG_RECURSION  64
-
-/* Message queue management methods */
-extern MESSAGEQUEUE *QUEUE_Current(void);
-extern void QUEUE_DeleteMsgQueue(void);
-
-#endif  /* __WINE_QUEUE_H */
diff --git a/include/spy.h b/include/spy.h
deleted file mode 100644
index cbbb38f..0000000
--- a/include/spy.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Message Logging functions
- *
- * Copyright 1994 Bob Amstadt
- * Copyright 1995 Alex Korobka
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#ifndef __WINE_SPY_H
-#define __WINE_SPY_H
-
-#include "windef.h"
-
-#define SPY_DISPATCHMESSAGE16     0x0100
-#define SPY_DISPATCHMESSAGE     0x0101
-#define SPY_SENDMESSAGE16         0x0102
-#define SPY_SENDMESSAGE         0x0103
-#define SPY_DEFWNDPROC16          0x0104
-#define SPY_DEFWNDPROC          0x0105
-
-#define SPY_RESULT_OK16           0x0000
-#define SPY_RESULT_OK           0x0001
-#define SPY_RESULT_INVALIDHWND16  0x0002
-#define SPY_RESULT_INVALIDHWND  0x0003
-#define SPY_RESULT_DEFWND16       0x0004
-#define SPY_RESULT_DEFWND       0x0005
-
-
-extern const char *SPY_GetMsgName( UINT msg, HWND hWnd );
-extern const char *SPY_GetVKeyName(WPARAM wParam);
-extern void SPY_EnterMessage( INT iFlag, HWND hwnd, UINT msg,
-                              WPARAM wParam, LPARAM lParam );
-extern void SPY_ExitMessage( INT iFlag, HWND hwnd, UINT msg,
-                             LRESULT lReturn, WPARAM wParam, LPARAM lParam );
-extern int SPY_Init(void);
-
-#endif /* __WINE_SPY_H */
diff --git a/include/sysmetrics.h b/include/sysmetrics.h
deleted file mode 100644
index 9804785..0000000
--- a/include/sysmetrics.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * System metrics definitions
- *
- * Copyright 1994 Alexandre Julliard
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#ifndef __WINE_SYSMETRICS_H
-#define __WINE_SYSMETRICS_H
-
-extern void SYSMETRICS_Init(void);  /* sysmetrics.c */
-extern INT SYSMETRICS_Set( INT index, INT value );  /* sysmetrics.c */
-extern void SYSCOLOR_Init(void);  /* syscolor.c */
-extern void SYSPARAMS_GetDoubleClickSize( INT *width, INT *height );
-extern INT SYSPARAMS_GetMouseButtonSwap( void );
-
-/* Wine extensions */
-#define SM_WINE_BPP (SM_CMETRICS+1)  /* screen bpp */
-#define SM_WINE_CMETRICS SM_WINE_BPP
-
-#endif  /* __WINE_SYSMETRICS_H */
diff --git a/include/user.h b/include/user.h
index 7ae1da8..2e7dcf9 100644
--- a/include/user.h
+++ b/include/user.h
@@ -142,9 +142,26 @@
 extern LRESULT HOOK_CallHooks( INT id, INT code, WPARAM wparam, LPARAM lparam, BOOL unicode );
 extern BOOL HOOK_IsHooked( INT id );
 
+/* input.c */
+extern BYTE InputKeyStateTable[256];
+extern BYTE AsyncKeyStateTable[256];
+
 /* syscolor.c */
+extern void SYSCOLOR_Init(void);
 extern HPEN SYSCOLOR_GetPen( INT index );
 
+/* sysmetrics.c */
+extern void SYSMETRICS_Init(void);
+extern INT SYSMETRICS_Set( INT index, INT value );
+
+/* Wine extensions */
+#define SM_WINE_BPP (SM_CMETRICS+1)  /* screen bpp */
+#define SM_WINE_CMETRICS SM_WINE_BPP
+
+/* sysparams.c */
+extern void SYSPARAMS_GetDoubleClickSize( INT *width, INT *height );
+extern INT SYSPARAMS_GetMouseButtonSwap( void );
+
 extern HPALETTE WINAPI SelectPalette( HDC hDC, HPALETTE hPal, BOOL bForceBackground );
 
 extern DWORD USER16_AlertableWait;
diff --git a/include/win.h b/include/win.h
index 3a356c2..d73fbdc 100644
--- a/include/win.h
+++ b/include/win.h
@@ -24,7 +24,6 @@
 #include "windef.h"
 #include "winbase.h"
 #include "wingdi.h"
-#include "winproc.h"
 #include "winuser.h"
 #include "wine/windef16.h"
 
@@ -42,7 +41,7 @@
     HWND           parent;        /* Window parent */
     HWND           owner;         /* Window owner */
     struct tagCLASS *class;       /* Window class */
-    HWINDOWPROC    winproc;       /* Window procedure */
+    WNDPROC        winproc;       /* Window procedure */
     DWORD          dwMagic;       /* Magic number (must be WND_MAGIC) */
     DWORD          tid;           /* Owner thread id */
     HINSTANCE      hInstance;     /* Window hInstance (from CreateWindow) */
@@ -137,14 +136,4 @@
 
 extern BOOL FOCUS_MouseActivate( HWND hwnd );
 
-/* Classes functions */
-struct tagCLASS;  /* opaque structure */
-struct builtin_class_descr;
-extern ATOM CLASS_RegisterBuiltinClass( const struct builtin_class_descr *descr );
-extern struct tagCLASS *CLASS_AddWindow( ATOM atom, HINSTANCE inst, WINDOWPROCTYPE type,
-                                         INT *winExtra, WNDPROC *winproc,
-                                         DWORD *style, struct tagDCE **dce );
-extern void CLASS_RemoveWindow( struct tagCLASS *cls );
-extern void CLASS_FreeModuleClasses( HMODULE16 hModule );
-
 #endif  /* __WINE_WIN_H */
diff --git a/windows/class.c b/windows/class.c
index 8910924..2764027 100644
--- a/windows/class.c
+++ b/windows/class.c
@@ -54,8 +54,8 @@
     struct tagCLASS *prev;          /* Prev class */
     UINT             cWindows;      /* Count of existing windows */
     UINT             style;         /* Class style */
-    HWINDOWPROC      winprocA;      /* Window procedure (ASCII) */
-    HWINDOWPROC      winprocW;      /* Window procedure (Unicode) */
+    WNDPROC          winprocA;      /* Window procedure (ASCII) */
+    WNDPROC          winprocW;      /* Window procedure (Unicode) */
     INT              cbClsExtra;    /* Class extra bytes */
     INT              cbWndExtra;    /* Window extra bytes */
     LPWSTR           menuName;      /* Default menu name (Unicode followed by ASCII) */
@@ -114,7 +114,7 @@
  */
 static WNDPROC16 CLASS_GetProc( CLASS *classPtr, WINDOWPROCTYPE type )
 {
-    HWINDOWPROC proc = classPtr->winprocA;
+    WNDPROC proc = classPtr->winprocA;
 
     if (classPtr->winprocW)
     {
@@ -135,7 +135,7 @@
  */
 static WNDPROC16 CLASS_SetProc( CLASS *classPtr, WNDPROC newproc, WINDOWPROCTYPE type )
 {
-    HWINDOWPROC *proc = &classPtr->winprocA;
+    WNDPROC *proc = &classPtr->winprocA;
     WNDPROC16 ret;
 
     if (classPtr->winprocW)
@@ -146,7 +146,7 @@
         if (!*proc || type == WIN_PROC_32W) proc = &classPtr->winprocW;
     }
     ret = WINPROC_GetProc( *proc, type );
-    WINPROC_SetProc( proc, (HWINDOWPROC)newproc, type, WIN_PROC_CLASS );
+    WINPROC_SetProc( proc, newproc, type, WIN_PROC_CLASS );
     /* now free the one that we didn't set */
     if (classPtr->winprocA && classPtr->winprocW)
     {
@@ -476,9 +476,9 @@
     classPtr->hCursor       = LoadCursorA( 0, descr->cursor );
     classPtr->hbrBackground = descr->brush;
 
-    if (descr->procA) WINPROC_SetProc( &classPtr->winprocA, (HWINDOWPROC)descr->procA,
+    if (descr->procA) WINPROC_SetProc( &classPtr->winprocA, descr->procA,
                                        WIN_PROC_32A, WIN_PROC_CLASS );
-    if (descr->procW) WINPROC_SetProc( &classPtr->winprocW, (HWINDOWPROC)descr->procW,
+    if (descr->procW) WINPROC_SetProc( &classPtr->winprocW, descr->procW,
                                        WIN_PROC_32W, WIN_PROC_CLASS );
     return atom;
 }
@@ -559,7 +559,7 @@
     classPtr->hCursor       = HCURSOR_32(wc->hCursor);
     classPtr->hbrBackground = HBRUSH_32(wc->hbrBackground);
 
-    WINPROC_SetProc( &classPtr->winprocA, (HWINDOWPROC)wc->lpfnWndProc,
+    WINPROC_SetProc( &classPtr->winprocA, (WNDPROC)wc->lpfnWndProc,
                      WIN_PROC_16, WIN_PROC_CLASS );
     CLASS_SetMenuNameA( classPtr, MapSL(wc->lpszMenuName) );
 
@@ -604,7 +604,7 @@
     classPtr->hCursor       = wc->hCursor;
     classPtr->hbrBackground = wc->hbrBackground;
 
-    WINPROC_SetProc( &classPtr->winprocA, (HWINDOWPROC)wc->lpfnWndProc,
+    WINPROC_SetProc( &classPtr->winprocA, wc->lpfnWndProc,
                      WIN_PROC_32A, WIN_PROC_CLASS );
     CLASS_SetMenuNameA( classPtr, wc->lpszMenuName );
     return atom;
@@ -644,7 +644,7 @@
     classPtr->hCursor       = wc->hCursor;
     classPtr->hbrBackground = wc->hbrBackground;
 
-    WINPROC_SetProc( &classPtr->winprocW, (HWINDOWPROC)wc->lpfnWndProc,
+    WINPROC_SetProc( &classPtr->winprocW, wc->lpfnWndProc,
                      WIN_PROC_32W, WIN_PROC_CLASS );
     CLASS_SetMenuNameW( classPtr, wc->lpszMenuName );
     return atom;
@@ -678,7 +678,7 @@
     classPtr->hCursor       = HCURSOR_32(wc->hCursor);
     classPtr->hbrBackground = HBRUSH_32(wc->hbrBackground);
 
-    WINPROC_SetProc( &classPtr->winprocA, (HWINDOWPROC)wc->lpfnWndProc,
+    WINPROC_SetProc( &classPtr->winprocA, (WNDPROC)wc->lpfnWndProc,
                      WIN_PROC_16, WIN_PROC_CLASS );
     CLASS_SetMenuNameA( classPtr, MapSL(wc->lpszMenuName) );
     return atom;
@@ -711,8 +711,7 @@
     classPtr->hIconSm       = wc->hIconSm;
     classPtr->hCursor       = wc->hCursor;
     classPtr->hbrBackground = wc->hbrBackground;
-    WINPROC_SetProc( &classPtr->winprocA, (HWINDOWPROC)wc->lpfnWndProc,
-                     WIN_PROC_32A, WIN_PROC_CLASS );
+    WINPROC_SetProc( &classPtr->winprocA, wc->lpfnWndProc, WIN_PROC_32A, WIN_PROC_CLASS );
     CLASS_SetMenuNameA( classPtr, wc->lpszMenuName );
     return atom;
 }
@@ -744,8 +743,7 @@
     classPtr->hIconSm       = wc->hIconSm;
     classPtr->hCursor       = wc->hCursor;
     classPtr->hbrBackground = wc->hbrBackground;
-    WINPROC_SetProc( &classPtr->winprocW, (HWINDOWPROC)wc->lpfnWndProc,
-                     WIN_PROC_32W, WIN_PROC_CLASS );
+    WINPROC_SetProc( &classPtr->winprocW, wc->lpfnWndProc, WIN_PROC_32W, WIN_PROC_CLASS );
     CLASS_SetMenuNameW( classPtr, wc->lpszMenuName );
     return atom;
 }
diff --git a/windows/cursoricon.c b/windows/cursoricon.c
index e6e94c6..d6b202b 100644
--- a/windows/cursoricon.c
+++ b/windows/cursoricon.c
@@ -57,8 +57,6 @@
 #include "module.h"
 #include "wine/debug.h"
 #include "user.h"
-#include "queue.h"
-#include "input.h"
 #include "message.h"
 #include "winerror.h"
 #include "msvcrt/excpt.h"
diff --git a/windows/defdlg.c b/windows/defdlg.c
index cae79f9..d69a7ca 100644
--- a/windows/defdlg.c
+++ b/windows/defdlg.c
@@ -298,7 +298,7 @@
         /* Call dialog procedure */
         result = CallWindowProc16( dlgproc, hwnd, msg, wParam, lParam );
         /* 16 bit dlg procs only return BOOL16 */
-        if( WINPROC_GetProcType( dlgproc ) == WIN_PROC_16 )
+        if( WINPROC_GetProcType( (WNDPROC)dlgproc ) == WIN_PROC_16 )
             result = LOWORD(result);
     }
 
diff --git a/windows/defwnd.c b/windows/defwnd.c
index 95dcc23..5950978 100644
--- a/windows/defwnd.c
+++ b/windows/defwnd.c
@@ -26,15 +26,15 @@
 #include "nonclient.h"
 #include "winpos.h"
 #include "dce.h"
-#include "wine/debug.h"
-#include "spy.h"
 #include "windef.h"
 #include "wingdi.h"
 #include "winnls.h"
+#include "imm.h"
+#include "message.h"
 #include "wine/unicode.h"
 #include "wine/winuser16.h"
 #include "wine/server.h"
-#include "imm.h"
+#include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(win);
 
diff --git a/windows/input.c b/windows/input.c
index 5740f32..a7bedd3 100644
--- a/windows/input.c
+++ b/windows/input.c
@@ -37,9 +37,7 @@
 #include "wine/winuser16.h"
 #include "wine/server.h"
 #include "win.h"
-#include "input.h"
 #include "message.h"
-#include "queue.h"
 #include "winternl.h"
 #include "wine/debug.h"
 #include "winerror.h"
diff --git a/windows/message.c b/windows/message.c
index 5af799b..c3f76ec 100644
--- a/windows/message.c
+++ b/windows/message.c
@@ -34,17 +34,15 @@
 #include "message.h"
 #include "winerror.h"
 #include "wine/server.h"
-#include "win.h"
-#include "heap.h"
-#include "input.h"
-#include "spy.h"
-#include "winpos.h"
-#include "dde.h"
-#include "queue.h"
-#include "winproc.h"
-#include "user.h"
-#include "thread.h"
 #include "controls.h"
+#include "dde.h"
+#include "heap.h"
+#include "message.h"
+#include "thread.h"
+#include "user.h"
+#include "win.h"
+#include "winpos.h"
+#include "winproc.h"
 #include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(msg);
@@ -1061,7 +1059,7 @@
             /* before calling window proc, verify whether timer is still valid;
                there's a slim chance that the application kills the timer
 	       between GetMessage and DispatchMessage API calls */
-            if (!TIMER_IsTimerValid(msg->hwnd, (UINT) msg->wParam, (HWINDOWPROC) msg->lParam))
+            if (!TIMER_IsTimerValid(msg->hwnd, (UINT) msg->wParam, (WNDPROC)msg->lParam))
                 return 0; /* invalid winproc */
 
 	    return CallWindowProcA( (WNDPROC)msg->lParam, msg->hwnd,
@@ -1153,7 +1151,7 @@
             /* before calling window proc, verify whether timer is still valid;
                there's a slim chance that the application kills the timer
 	       between GetMessage and DispatchMessage API calls */
-            if (!TIMER_IsTimerValid(msg->hwnd, (UINT) msg->wParam, (HWINDOWPROC) msg->lParam))
+            if (!TIMER_IsTimerValid(msg->hwnd, (UINT) msg->wParam, (WNDPROC)msg->lParam))
                 return 0; /* invalid winproc */
 
 	    return CallWindowProcW( (WNDPROC)msg->lParam, msg->hwnd,
diff --git a/windows/painting.c b/windows/painting.c
index b1ac1c1..079c4a8 100644
--- a/windows/painting.c
+++ b/windows/painting.c
@@ -29,7 +29,7 @@
 #include "gdi.h"
 #include "user.h"
 #include "win.h"
-#include "queue.h"
+#include "message.h"
 #include "dce.h"
 #include "wine/debug.h"
 
diff --git a/windows/queue.c b/windows/queue.c
index a80423a..4ac4608 100644
--- a/windows/queue.c
+++ b/windows/queue.c
@@ -26,13 +26,12 @@
 #include "winerror.h"
 #include "wine/winbase16.h"
 #include "wine/winuser16.h"
-#include "queue.h"
+#include "message.h"
 #include "win.h"
 #include "user.h"
 #include "thread.h"
 #include "wine/debug.h"
 #include "wine/server.h"
-#include "spy.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(msg);
 
diff --git a/windows/spy.c b/windows/spy.c
index 0e12065..9ab66a4 100644
--- a/windows/spy.c
+++ b/windows/spy.c
@@ -29,7 +29,7 @@
 #include "wine/unicode.h"
 #include "win.h"
 #include "wine/debug.h"
-#include "spy.h"
+#include "message.h"
 #include "commctrl.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(message);
diff --git a/windows/syscolor.c b/windows/syscolor.c
index 1c9d28f..84fe6ca 100644
--- a/windows/syscolor.c
+++ b/windows/syscolor.c
@@ -27,7 +27,6 @@
 #include "wingdi.h"
 #include "wine/winbase16.h"
 #include "wine/winuser16.h"
-#include "sysmetrics.h"
 #include "winbase.h"
 #include "winuser.h"
 #include "wownt32.h"
diff --git a/windows/sysmetrics.c b/windows/sysmetrics.c
index 1e5c8e9..ee156f8 100644
--- a/windows/sysmetrics.c
+++ b/windows/sysmetrics.c
@@ -30,7 +30,6 @@
 #include "winuser.h"
 #include "winerror.h"
 #include "user.h"
-#include "sysmetrics.h"
 
 static int sysMetrics[SM_WINE_CMETRICS+1];
 
diff --git a/windows/sysparams.c b/windows/sysparams.c
index 25d721a..902b6df 100644
--- a/windows/sysparams.c
+++ b/windows/sysparams.c
@@ -34,7 +34,6 @@
 #include "controls.h"
 #include "user.h"
 #include "wine/debug.h"
-#include "sysmetrics.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(system);
 
diff --git a/windows/timer.c b/windows/timer.c
index 0fac6bc..234ed29 100644
--- a/windows/timer.c
+++ b/windows/timer.c
@@ -40,7 +40,7 @@
     UINT           msg;  /* WM_TIMER or WM_SYSTIMER */
     UINT           id;
     UINT           timeout;
-    HWINDOWPROC    proc;
+    WNDPROC        proc;
 } TIMER;
 
 #define NB_TIMERS            34
@@ -112,11 +112,11 @@
  *           TIMER_SetTimer
  */
 static UINT_PTR TIMER_SetTimer( HWND hwnd, UINT_PTR id, UINT timeout,
-                              WNDPROC16 proc, WINDOWPROCTYPE type, BOOL sys )
+                                WNDPROC proc, WINDOWPROCTYPE type, BOOL sys )
 {
     int i;
     TIMER * pTimer;
-    HWINDOWPROC winproc = 0;
+    WNDPROC winproc = 0;
 
     if (hwnd && !(hwnd = WIN_IsCurrentThread( hwnd )))
     {
@@ -243,7 +243,7 @@
 {
     TRACE("%04x %d %d %08lx\n",
                    hwnd, id, timeout, (LONG)proc );
-    return TIMER_SetTimer( WIN_Handle32(hwnd), id, timeout, (WNDPROC16)proc,
+    return TIMER_SetTimer( WIN_Handle32(hwnd), id, timeout, (WNDPROC)proc,
                            WIN_PROC_16, FALSE );
 }
 
@@ -255,14 +255,14 @@
                           TIMERPROC proc )
 {
     TRACE("%p %d %d %p\n", hwnd, id, timeout, proc );
-    return TIMER_SetTimer( hwnd, id, timeout, (WNDPROC16)proc, WIN_PROC_32A, FALSE );
+    return TIMER_SetTimer( hwnd, id, timeout, (WNDPROC)proc, WIN_PROC_32A, FALSE );
 }
 
 
 /***********************************************************************
  *           TIMER_IsTimerValid
  */
-BOOL TIMER_IsTimerValid( HWND hwnd, UINT_PTR id, HWINDOWPROC hProc )
+BOOL TIMER_IsTimerValid( HWND hwnd, UINT_PTR id, WNDPROC proc )
 {
     int i;
     TIMER *pTimer;
@@ -272,8 +272,7 @@
     EnterCriticalSection( &csTimer );
 
     for (i = 0, pTimer = TimersArray; i < NB_TIMERS; i++, pTimer++)
-        if ((pTimer->hwnd == hwnd) && (pTimer->id == id) &&
-            (pTimer->proc == hProc))
+        if ((pTimer->hwnd == hwnd) && (pTimer->id == id) && (pTimer->proc == proc))
         {
             ret = TRUE;
             break;
@@ -292,8 +291,7 @@
 {
     TRACE("%04x %d %d %08lx\n",
                    hwnd, id, timeout, (LONG)proc );
-    return TIMER_SetTimer( WIN_Handle32(hwnd), id, timeout, (WNDPROC16)proc,
-                           WIN_PROC_16, TRUE );
+    return TIMER_SetTimer( WIN_Handle32(hwnd), id, timeout, (WNDPROC)proc, WIN_PROC_16, TRUE );
 }
 
 
@@ -304,7 +302,7 @@
                                 TIMERPROC proc )
 {
     TRACE("%p %d %d %p\n", hwnd, id, timeout, proc );
-    return TIMER_SetTimer( hwnd, id, timeout, (WNDPROC16)proc, WIN_PROC_32A, TRUE );
+    return TIMER_SetTimer( hwnd, id, timeout, (WNDPROC)proc, WIN_PROC_32A, TRUE );
 }
 
 
diff --git a/windows/user.c b/windows/user.c
index 8ea863c..80255f8 100644
--- a/windows/user.c
+++ b/windows/user.c
@@ -31,8 +31,6 @@
 #include "controls.h"
 #include "cursoricon.h"
 #include "message.h"
-#include "miscemu.h"
-#include "sysmetrics.h"
 #include "local.h"
 #include "module.h"
 #include "winternl.h"
diff --git a/windows/win.c b/windows/win.c
index c0fe14f..befcd16 100644
--- a/windows/win.c
+++ b/windows/win.c
@@ -36,7 +36,6 @@
 #include "controls.h"
 #include "cursoricon.h"
 #include "message.h"
-#include "queue.h"
 #include "winpos.h"
 #include "winerror.h"
 #include "stackframe.h"
@@ -1944,7 +1943,7 @@
         retvalue = *(LONG *)(((char *)wndPtr->wExtra) + offset);
         /* Special case for dialog window procedure */
         if ((offset == DWL_DLGPROC) && (wndPtr->flags & WIN_ISDIALOG))
-            retvalue = (LONG)WINPROC_GetProc( (HWINDOWPROC)retvalue, type );
+            retvalue = (LONG)WINPROC_GetProc( (WNDPROC)retvalue, type );
         WIN_ReleasePtr( wndPtr );
         return retvalue;
     }
@@ -2015,9 +2014,8 @@
         /* Special case for dialog window procedure */
         if ((offset == DWL_DLGPROC) && (wndPtr->flags & WIN_ISDIALOG))
         {
-            retval = (LONG)WINPROC_GetProc( (HWINDOWPROC)*ptr, type );
-            WINPROC_SetProc( (HWINDOWPROC *)ptr, (WNDPROC16)newval,
-                             type, WIN_PROC_WINDOW );
+            retval = (LONG)WINPROC_GetProc( (WNDPROC)*ptr, type );
+            WINPROC_SetProc( (WNDPROC *)ptr, (WNDPROC)newval, type, WIN_PROC_WINDOW );
             WIN_ReleasePtr( wndPtr );
             return retval;
         }
@@ -2055,8 +2053,7 @@
             }
         case GWL_WNDPROC:
             retval = (LONG)WINPROC_GetProc( wndPtr->winproc, type );
-            WINPROC_SetProc( &wndPtr->winproc, (WNDPROC16)newval,
-                             type, WIN_PROC_WINDOW );
+            WINPROC_SetProc( &wndPtr->winproc, (WNDPROC)newval, type, WIN_PROC_WINDOW );
             WIN_ReleasePtr( wndPtr );
             return retval;
         case GWL_ID:
diff --git a/windows/winpos.c b/windows/winpos.c
index 45f7e90c..7884708 100644
--- a/windows/winpos.c
+++ b/windows/winpos.c
@@ -30,12 +30,9 @@
 #include "user.h"
 #include "win.h"
 #include "message.h"
-#include "queue.h"
 #include "winpos.h"
-#include "dce.h"
 #include "nonclient.h"
 #include "wine/debug.h"
-#include "input.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(win);
 
diff --git a/windows/winproc.c b/windows/winproc.c
index b88f451..fe0f7ef 100644
--- a/windows/winproc.c
+++ b/windows/winproc.c
@@ -38,7 +38,7 @@
 #include "win.h"
 #include "winproc.h"
 #include "wine/debug.h"
-#include "spy.h"
+#include "message.h"
 #include "thread.h"
 #include "dde.h"
 
@@ -265,7 +265,7 @@
  *
  * Return a pointer to the win proc.
  */
-static WINDOWPROC *WINPROC_GetPtr( WNDPROC16 handle )
+static WINDOWPROC *WINPROC_GetPtr( WNDPROC handle )
 {
     BYTE *ptr;
     WINDOWPROC *proc;
@@ -305,7 +305,7 @@
  *
  * Allocate a new window procedure.
  */
-static WINDOWPROC *WINPROC_AllocWinProc( WNDPROC16 func, WINDOWPROCTYPE type,
+static WINDOWPROC *WINPROC_AllocWinProc( WNDPROC func, WINDOWPROCTYPE type,
                                          WINDOWPROCUSER user )
 {
     static FARPROC16 relay_32A, relay_32W;
@@ -329,7 +329,7 @@
         case WIN_PROC_16:
             proc->thunk.t_from32.popl_eax    = 0x58;   /* popl  %eax */
             proc->thunk.t_from32.pushl_func  = 0x68;   /* pushl $proc */
-            proc->thunk.t_from32.proc        = func;
+            proc->thunk.t_from32.proc        = (WNDPROC16)func;
             proc->thunk.t_from32.pushl_eax   = 0x50;   /* pushl %eax */
             proc->thunk.t_from32.jmp         = 0xe9;   /* jmp   relay*/
             proc->thunk.t_from32.relay =  /* relative jump */
@@ -341,7 +341,7 @@
                                                           "__wine_call_wndproc_32A" );
             proc->thunk.t_from16.popl_eax     = 0x58;   /* popl  %eax */
             proc->thunk.t_from16.pushl_func   = 0x68;   /* pushl $proc */
-            proc->thunk.t_from16.proc         = (WNDPROC)func;
+            proc->thunk.t_from16.proc         = func;
             proc->thunk.t_from16.pushl_eax    = 0x50;   /* pushl %eax */
             proc->thunk.t_from16.ljmp         = 0xea;   /* ljmp   relay*/
             proc->thunk.t_from16.relay_offset = OFFSETOF(relay_32A);
@@ -355,14 +355,14 @@
                                                           "__wine_call_wndproc_32W" );
             proc->thunk.t_from16.popl_eax     = 0x58;   /* popl  %eax */
             proc->thunk.t_from16.pushl_func   = 0x68;   /* pushl $proc */
-            proc->thunk.t_from16.proc         = (WNDPROC)func;
+            proc->thunk.t_from16.proc         = func;
             proc->thunk.t_from16.pushl_eax    = 0x50;   /* pushl %eax */
             proc->thunk.t_from16.ljmp         = 0xea;   /* ljmp   relay*/
             proc->thunk.t_from16.relay_offset = OFFSETOF(relay_32W);
             proc->thunk.t_from16.relay_sel    = SELECTOROF(relay_32W);
             proc->jmp.jmp  = 0xe9;
             /* Fixup relative jump */
-            proc->jmp.proc = (WNDPROC)((DWORD)func - (DWORD)(&proc->jmp.proc + 1));
+            proc->jmp.proc = (WNDPROC)((char *)func - (char *)(&proc->jmp.proc + 1));
             break;
         default:
             /* Should not happen */
@@ -373,8 +373,7 @@
         proc->user  = user;
     }
     proc->next  = NULL;
-    TRACE_(win)("(%08x,%d): returning %08x\n",
-                 (UINT)func, type, (UINT)proc );
+    TRACE_(win)("(%p,%d): returning %p\n", func, type, proc );
     return proc;
 }
 
@@ -384,7 +383,7 @@
  *
  * Get a window procedure pointer that can be passed to the Windows program.
  */
-WNDPROC16 WINPROC_GetProc( HWINDOWPROC proc, WINDOWPROCTYPE type )
+WNDPROC16 WINPROC_GetProc( WNDPROC proc, WINDOWPROCTYPE type )
 {
     WINDOWPROC *ptr = (WINDOWPROC *)proc;
 
@@ -431,8 +430,8 @@
  * window is destroyed.
  *
  */
-BOOL WINPROC_SetProc( HWINDOWPROC *pFirst, WNDPROC16 func,
-                        WINDOWPROCTYPE type, WINDOWPROCUSER user )
+BOOL WINPROC_SetProc( WNDPROC *pFirst, WNDPROC func,
+                      WINDOWPROCTYPE type, WINDOWPROCUSER user )
 {
     BOOL bRecycle = FALSE;
     WINDOWPROC *proc, **ppPrev;
@@ -462,7 +461,7 @@
         else
         {
             if (((*ppPrev)->type == type) &&
-                (func == WINPROC_THUNKPROC(*ppPrev)))
+                (func == (WNDPROC)WINPROC_THUNKPROC(*ppPrev)))
             {
                 if((*ppPrev)->user == user)
                 {
@@ -470,7 +469,7 @@
                 }
                 else
                 {
-                    WINPROC_FreeProc( *ppPrev, user );
+                    WINPROC_FreeProc( (WNDPROC)*ppPrev, user );
                     *ppPrev = NULL;
                 }
                 break;
@@ -493,7 +492,7 @@
         if (proc)  /* Was already a win proc */
         {
             type = proc->type;
-            func = WINPROC_THUNKPROC(proc);
+            func = (WNDPROC)WINPROC_THUNKPROC(proc);
         }
         proc = WINPROC_AllocWinProc( func, type, user );
         if (!proc) return FALSE;
@@ -514,15 +513,16 @@
  *
  * Free a list of win procs.
  */
-void WINPROC_FreeProc( HWINDOWPROC proc, WINDOWPROCUSER user )
+void WINPROC_FreeProc( WNDPROC proc, WINDOWPROCUSER user )
 {
-    while (proc)
+    WINDOWPROC *ptr = (WINDOWPROC *)proc;
+    while (ptr)
     {
-        WINDOWPROC *next = ((WINDOWPROC *)proc)->next;
-        if (((WINDOWPROC *)proc)->user != user) break;
-        TRACE_(win)("freeing %08x (%d)\n", (UINT)proc, user);
-        HeapFree( WinProcHeap, 0, proc );
-        proc = next;
+        WINDOWPROC *next = ptr->next;
+        if (ptr->user != user) break;
+        TRACE_(win)("freeing %p (%d)\n", ptr, user);
+        HeapFree( WinProcHeap, 0, ptr );
+        ptr = next;
     }
 }
 
@@ -532,7 +532,7 @@
  *
  * Return the window procedure type.
  */
-WINDOWPROCTYPE WINPROC_GetProcType( HWINDOWPROC proc )
+WINDOWPROCTYPE WINPROC_GetProcType( WNDPROC proc )
 {
     if (!proc ||
         (((WINDOWPROC *)proc)->magic != WINPROC_MAGIC))
@@ -2710,11 +2710,11 @@
 
     if (!func) return 0;
 
-    if (!(proc = WINPROC_GetPtr( func )))
+    if (!(proc = WINPROC_GetPtr( (WNDPROC)func )))
         return WINPROC_CallWndProc16( func, hwnd, msg, wParam, lParam );
 
 #if testing
-    func = WINPROC_GetProc( (HWINDOWPROC)proc, WIN_PROC_16 );
+    func = WINPROC_GetProc( (WNDPROC)proc, WIN_PROC_16 );
     return WINPROC_CallWndProc16( func, hwnd, msg, wParam, lParam );
 #endif
 
@@ -2768,12 +2768,12 @@
     WPARAM wParam, /* [in] message dependent parameter */
     LPARAM lParam  /* [in] message dependent parameter */
 ) {
-    WINDOWPROC *proc = WINPROC_GetPtr( (WNDPROC16)func );
+    WINDOWPROC *proc = WINPROC_GetPtr( func );
 
     if (!proc) return WINPROC_CallWndProc( func, hwnd, msg, wParam, lParam );
 
 #if testing
-    func = WINPROC_GetProc( (HWINDOWPROC)proc, WIN_PROC_32A );
+    func = WINPROC_GetProc( (WNDPROC)proc, WIN_PROC_32A );
     return WINPROC_CallWndProc( func, hwnd, msg, wParam, lParam );
 #endif
 
@@ -2804,12 +2804,12 @@
 LRESULT WINAPI CallWindowProcW( WNDPROC func, HWND hwnd, UINT msg,
                                   WPARAM wParam, LPARAM lParam )
 {
-    WINDOWPROC *proc = WINPROC_GetPtr( (WNDPROC16)func );
+    WINDOWPROC *proc = WINPROC_GetPtr( func );
 
     if (!proc) return WINPROC_CallWndProc( func, hwnd, msg, wParam, lParam );
 
 #if testing
-    func = WINPROC_GetProc( (HWINDOWPROC)proc, WIN_PROC_32W );
+    func = WINPROC_GetProc( (WNDPROC)proc, WIN_PROC_32W );
     return WINPROC_CallWndProc( func, hwnd, msg, wParam, lParam );
 #endif