Release 961023

Tue Oct 22 20:09:52 1996  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [*/Makefile.in] [tools/makedep.c]
	New program to generate dependencies; should be faster and more
	portable than 'gcc -MM'.

	* [*/*]
	Replaced WPARAM and HDC by explicitly-sized types.

	* [windows/hook.c]
	Fixed bug in HOOK_GetHook16 function.

Thu Oct 17 09:13:50 1996  John Harvey <john@division.co.uk>

	* [include/debug.h] [include/stddebug.h]
        Added debug option for win16drv (-debugmsg +win16drv)

	* [graphics/win16drv/init.c]
        Only enable CreateDC if printer=on specified in wine section of
 	wine.conf.
 	printfs changed to dprintf_win16drv.
	Some tidying up.

	* [include/gdi.h] [graphics/x11drv/clipping.c]
	  [graphics/x11drv/Makefile.in]
        Moved SetDeviceClipping into drivers.
diff --git a/ANNOUNCE b/ANNOUNCE
index 0d473b4..1d05e42 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,13 +1,13 @@
-This is release 961013 of Wine, the MS Windows emulator.  This is still a
+This is release 961023 of Wine, the MS Windows emulator.  This is still a
 developer's only release.  There are many bugs and many unimplemented API
 features.  Most applications still do not work correctly.
 
 Patches should be submitted to "julliard@lrc.epfl.ch".  Please don't
 forget to include a ChangeLog entry.
 
-WHAT'S NEW with Wine-961013: (see ChangeLog for details)
-	- Several non Win32-clean data types removed.
-	- Graphics driver for metafiles.
+WHAT'S NEW with Wine-961023: (see ChangeLog for details)
+	- Printer driver fixes.
+	- Faster make depend.
 	- Lots of bug fixes.
 
 See the README file in the distribution for installation instructions.
@@ -16,10 +16,10 @@
 the release is available at the ftp sites.  The sources will be available
 from the following locations:
 
-  ftp://sunsite.unc.edu/pub/Linux/ALPHA/wine/development/Wine-961013.tar.gz
-  ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-961013.tar.gz
-  ftp://ftp.infomagic.com/pub/mirrors/linux/wine/development/Wine-961013.tar.gz
-  ftp://aris.com/pub/linux/ALPHA/Wine/development/Wine-961013.tar.gz
+  ftp://sunsite.unc.edu/pub/Linux/ALPHA/wine/development/Wine-961023.tar.gz
+  ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-961023.tar.gz
+  ftp://ftp.infomagic.com/pub/mirrors/linux/wine/development/Wine-961023.tar.gz
+  ftp://aris.com/pub/linux/ALPHA/Wine/development/Wine-961023.tar.gz
 
 It should also be available from any site that mirrors tsx-11 or sunsite.
 
diff --git a/ChangeLog b/ChangeLog
index 03051aa..e9787ad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,32 @@
 ----------------------------------------------------------------------
+Tue Oct 22 20:09:52 1996  Alexandre Julliard  <julliard@lrc.epfl.ch>
+
+	* [*/Makefile.in] [tools/makedep.c]
+	New program to generate dependencies; should be faster and more
+	portable than 'gcc -MM'.
+
+	* [*/*]
+	Replaced WPARAM and HDC by explicitly-sized types.
+
+	* [windows/hook.c]
+	Fixed bug in HOOK_GetHook16 function.
+
+Thu Oct 17 09:13:50 1996  John Harvey <john@division.co.uk>
+
+	* [include/debug.h] [include/stddebug.h]
+        Added debug option for win16drv (-debugmsg +win16drv)
+
+	* [graphics/win16drv/init.c]
+        Only enable CreateDC if printer=on specified in wine section of
+ 	wine.conf.
+ 	printfs changed to dprintf_win16drv.
+	Some tidying up.
+
+	* [include/gdi.h] [graphics/x11drv/clipping.c]
+	  [graphics/x11drv/Makefile.in]
+        Moved SetDeviceClipping into drivers.
+
+----------------------------------------------------------------------
 Sun Oct 13 15:32:32 1996  Alexandre Julliard  <julliard@lrc.epfl.ch>
 
 	* [Make.rules.in] [*/Makefile.in]
diff --git a/Make.rules.in b/Make.rules.in
index 06455e1..4e7b95b 100644
--- a/Make.rules.in
+++ b/Make.rules.in
@@ -26,17 +26,17 @@
 YACC      = @YACC@
 LEX       = @LEX@
 LEXLIB    = @LEXLIB@
-DIVINCL   = -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include -I.
+DIVINCL   = -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include -I$(SRCDIR) -I.
 ALLCFLAGS = $(CFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL) $(X_CFLAGS)
 LDCOMBINE = ld -r
 RM        = rm -f
 BUILD     = $(TOPOBJDIR)/tools/build
+MAKEDEP   = $(TOPOBJDIR)/tools/makedep
 WINERC    = $(TOPOBJDIR)/rc/winerc
 SUBMAKE   = $(MAKE) 'CC=$(CC)' 'CFLAGS=$(CFLAGS)' 'OPTIONS=$(OPTIONS)'
 @SET_MAKE@
 
 OBJS = $(C_SRCS:.c=.o) $(GEN_C_SRCS:.c=.o) $(ASM_SRCS:.S=.o) $(EXTRA_OBJS)
-DEPEND_SRCS = $(C_SRCS:%=$(SRCDIR)/%) $(GEN_C_SRCS:%=./%)
 
 # Implicit rules
 
@@ -68,6 +68,10 @@
 $(WINERC) check_winerc:
 	cd $(TOPOBJDIR)/rc; $(SUBMAKE) winerc
 
+# Rule to rebuild the makedep program
+
+$(MAKEDEP) check_makedep:
+	cd $(TOPOBJDIR)/tools; $(SUBMAKE) makedep
 
 # Rule for main module
 
@@ -77,13 +81,11 @@
 
 # Misc. rules
 
-depend:: $(C_SRCS) $(GEN_C_SRCS)
-	sed '/\#\#\# Dependencies/q' < Makefile > tmp_make
-	$(CC) $(ALLCFLAGS) -MM $(DEPEND_SRCS) >> tmp_make
-	mv tmp_make Makefile
+depend:: $(MAKEDEP) $(C_SRCS) $(GEN_C_SRCS)
+	$(MAKEDEP) $(DIVINCL) -C. $(GEN_C_SRCS) -C$(SRCDIR) $(C_SRCS)
 
 clean::
-	$(RM) *.o \#*\# *~ *.bak *.orig *.rej *.flc tmp_make winerctmp.c $(GEN_C_SRCS)
+	$(RM) *.o \#*\# *~ *.bak *.orig *.rej *.flc winerctmp.c $(GEN_C_SRCS) $(GEN_C_SRCS:.c=.h) $(PROGRAMS)
 
 dummy:
 
diff --git a/Makefile.in b/Makefile.in
index 3bfdb34..9a676b1 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -129,19 +129,16 @@
 install_programs: dummy
 	@cd programs; $(SUBMAKE) install
 
-depend: libdepend emudepend
-
-libdepend: dummy
-	for i in $(COMMONSUBDIRS) $(LIBSUBDIRS); do (cd $$i; $(MAKE) depend); done
-
-emudepend: dummy
-	for i in $(EMUSUBDIRS); do (cd $$i; $(MAKE) depend); done
+depend: dummy
+	for i in $(COMMONSUBDIRS) $(LIBSUBDIRS) $(EMUSUBDIRS); do \
+	  (cd $$i; $(MAKE) depend) || exit 1; \
+	done
 
 etags:
 	etags `find . -name '*.[chS]' -print`
 
 clean:
-	for i in $(ALLSUBDIRS); do (cd $$i; $(MAKE) clean); done
+	for i in $(ALLSUBDIRS); do (cd $$i; $(MAKE) clean) || exit 1; done
 	$(RM) *.o \#*\# *~ *.bak *.orig *.rej *.flc
 	$(RM) wine wine.sym libwine.a libwine.so.1.0 TAGS
 	(cd include; $(RM) *.o \#*\# *~ *.bak *.orig *.rej *.flc)
diff --git a/controls/button.c b/controls/button.c
index 4ccf659..fcf591b 100644
--- a/controls/button.c
+++ b/controls/button.c
@@ -114,10 +114,10 @@
     case WM_PAINT:
         if (btnPaintFunc[style])
         {
-            PAINTSTRUCT16 ps;
-            HDC hdc = BeginPaint16( hWnd, &ps );
+            PAINTSTRUCT32 ps;
+            HDC32 hdc = BeginPaint32( hWnd, &ps );
             (btnPaintFunc[style])( wndPtr, hdc, ODA_DRAWENTIRE );
-            EndPaint16( hWnd, &ps );
+            EndPaint32( hWnd, &ps );
         }
         break;
 
@@ -338,7 +338,7 @@
 {
     static int Pattern[] = {0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55};
     HBITMAP16 hbm  = CreateBitmap(8, 8, 1, 1, Pattern);
-    HDC hdcMem   = CreateCompatibleDC(hDC);
+    HDC32 hdcMem = CreateCompatibleDC(hDC);
     HBITMAP16 hbmMem;
     HBRUSH16 hBr;
     RECT32 rect,rc2;
diff --git a/controls/combo.c b/controls/combo.c
index 917ab1b..1f540f4 100644
--- a/controls/combo.c
+++ b/controls/combo.c
@@ -94,7 +94,7 @@
 /***********************************************************************
  *           CBNCCreate
  */
-static LRESULT CBNCCreate(HWND hwnd, WPARAM wParam, LPARAM lParam)
+static LRESULT CBNCCreate(HWND hwnd, WPARAM16 wParam, LPARAM lParam)
 {
   CREATESTRUCT16 *createStruct;
 
@@ -112,7 +112,7 @@
 /***********************************************************************
  *           CBCreate
  */
-static LRESULT CBCreate(HWND hwnd, WPARAM wParam, LPARAM lParam)
+static LRESULT CBCreate(HWND hwnd, WPARAM16 wParam, LPARAM lParam)
 {
   LPHEADLIST   lphl;
   LPHEADCOMBO  lphc;
@@ -206,7 +206,7 @@
 /***********************************************************************
  *           CBDestroy
  */
-static LRESULT CBDestroy(HWND hwnd, WPARAM wParam, LPARAM lParam)
+static LRESULT CBDestroy(HWND hwnd, WPARAM16 wParam, LPARAM lParam)
 {
   LPHEADCOMBO lphc = ComboGetStorageHeader(hwnd);
 
@@ -218,7 +218,7 @@
 /***********************************************************************
  *           CBPaint
  */
-static LRESULT CBPaint(HWND hwnd, WPARAM wParam, LPARAM lParam)
+static LRESULT CBPaint(HWND hwnd, WPARAM16 wParam, LPARAM lParam)
 {
   LPHEADLIST lphl = ComboGetListHeader(hwnd);
   LPHEADCOMBO lphc = ComboGetStorageHeader(hwnd);
@@ -278,7 +278,7 @@
 /***********************************************************************
  *           CBGetDlgCode
  */
-static LRESULT CBGetDlgCode(HWND hwnd, WPARAM wParam, LPARAM lParam)
+static LRESULT CBGetDlgCode(HWND hwnd, WPARAM16 wParam, LPARAM lParam)
 {
   return DLGC_WANTARROWS | DLGC_WANTCHARS;
 }
@@ -286,7 +286,7 @@
 /***********************************************************************
  *           CBLButtonDown
  */
-static LRESULT CBLButtonDown(HWND hwnd, WPARAM wParam, LPARAM lParam)
+static LRESULT CBLButtonDown(HWND hwnd, WPARAM16 wParam, LPARAM lParam)
 {
   LPHEADCOMBO lphc = ComboGetStorageHeader(hwnd);
   SendMessage16(hwnd,CB_SHOWDROPDOWN,!lphc->DropDownVisible,0);
@@ -296,7 +296,7 @@
 /***********************************************************************
  *           CBKeyDown
  */
-static LRESULT CBKeyDown(HWND hwnd, WPARAM wParam, LPARAM lParam)
+static LRESULT CBKeyDown(HWND hwnd, WPARAM16 wParam, LPARAM lParam)
 {
   LPHEADLIST lphl = ComboGetListHeader(hwnd);
   WORD       newFocused = lphl->ItemFocused;
@@ -336,7 +336,7 @@
 /***********************************************************************
  *           CBChar
  */
-static LRESULT CBChar(HWND hwnd, WPARAM wParam, LPARAM lParam)
+static LRESULT CBChar(HWND hwnd, WPARAM16 wParam, LPARAM lParam)
 {
   LPHEADLIST lphl = ComboGetListHeader(hwnd);
   WORD       newFocused;
@@ -362,7 +362,7 @@
 /***********************************************************************
  *           CBKillFocus
  */
-static LRESULT CBKillFocus(HWND hwnd, WPARAM wParam, LPARAM lParam)
+static LRESULT CBKillFocus(HWND hwnd, WPARAM16 wParam, LPARAM lParam)
 {
   return 0;
 }
@@ -370,7 +370,7 @@
 /***********************************************************************
  *           CBSetFocus
  */
-static LRESULT CBSetFocus(HWND hwnd, WPARAM wParam, LPARAM lParam)
+static LRESULT CBSetFocus(HWND hwnd, WPARAM16 wParam, LPARAM lParam)
 {
   return 0;
 }
@@ -378,7 +378,7 @@
 /***********************************************************************
  *           CBResetContent
  */
-static LRESULT CBResetContent(HWND hwnd, WPARAM wParam, LPARAM lParam)
+static LRESULT CBResetContent(HWND hwnd, WPARAM16 wParam, LPARAM lParam)
 {
   LPHEADLIST lphl = ComboGetListHeader(hwnd);
   LPHEADCOMBO lphc = ComboGetStorageHeader(hwnd);
@@ -391,7 +391,7 @@
 /***********************************************************************
  *           CBDir
  */
-static LRESULT CBDir(HWND hwnd, WPARAM wParam, LPARAM lParam)
+static LRESULT CBDir(HWND hwnd, WPARAM16 wParam, LPARAM lParam)
 {
   WORD wRet;
   LPHEADLIST lphl = ComboGetListHeader(hwnd);
@@ -405,7 +405,7 @@
 /***********************************************************************
  *           CBInsertString
  */
-static LRESULT CBInsertString(HWND hwnd, WPARAM wParam, LPARAM lParam)
+static LRESULT CBInsertString(HWND hwnd, WPARAM16 wParam, LPARAM lParam)
 {
   WORD  wRet;
   LPHEADLIST lphl = ComboGetListHeader(hwnd);
@@ -422,7 +422,7 @@
 /***********************************************************************
  *           CBAddString
  */
-static LRESULT CBAddString(HWND hwnd, WPARAM wParam, LPARAM lParam)
+static LRESULT CBAddString(HWND hwnd, WPARAM16 wParam, LPARAM lParam)
 {
   WORD  wRet;
   LPHEADLIST lphl = ComboGetListHeader(hwnd);
@@ -437,7 +437,7 @@
 /***********************************************************************
  *           CBDeleteString
  */
-static LRESULT CBDeleteString(HWND hwnd, WPARAM wParam, LPARAM lParam)
+static LRESULT CBDeleteString(HWND hwnd, WPARAM16 wParam, LPARAM lParam)
 {
   LPHEADLIST lphl = ComboGetListHeader(hwnd);
   LPHEADCOMBO lphc = ComboGetStorageHeader(hwnd);
@@ -450,7 +450,7 @@
 /***********************************************************************
  *           CBSelectString
  */
-static LRESULT CBSelectString(HWND hwnd, WPARAM wParam, LPARAM lParam)
+static LRESULT CBSelectString(HWND hwnd, WPARAM16 wParam, LPARAM lParam)
 {
   LPHEADLIST lphl = ComboGetListHeader(hwnd);
   WORD  wRet;
@@ -465,7 +465,7 @@
 /***********************************************************************
  *           CBFindString
  */
-static LRESULT CBFindString(HWND hwnd, WPARAM wParam, LPARAM lParam)
+static LRESULT CBFindString(HWND hwnd, WPARAM16 wParam, LPARAM lParam)
 {
   LPHEADLIST lphl = ComboGetListHeader(hwnd);
   return ListBoxFindString(lphl, wParam, (SEGPTR)lParam);
@@ -474,7 +474,7 @@
 /***********************************************************************
  *           CBFindStringExact
  */
-static LRESULT CBFindStringExact(HWND hwnd, WPARAM wParam, LPARAM lParam)
+static LRESULT CBFindStringExact(HWND hwnd, WPARAM16 wParam, LPARAM lParam)
 {
   LPHEADLIST lphl = ComboGetListHeader(hwnd);
   return ListBoxFindStringExact(lphl, wParam, (SEGPTR)lParam);
@@ -483,7 +483,7 @@
 /***********************************************************************
  *           CBGetCount
  */
-static LRESULT CBGetCount(HWND hwnd, WPARAM wParam, LPARAM lParam)
+static LRESULT CBGetCount(HWND hwnd, WPARAM16 wParam, LPARAM lParam)
 {
   LPHEADLIST lphl = ComboGetListHeader(hwnd);
   return lphl->ItemsCount;
@@ -492,7 +492,7 @@
 /***********************************************************************
  *           CBSetCurSel
  */
-static LRESULT CBSetCurSel(HWND hwnd, WPARAM wParam, LPARAM lParam)
+static LRESULT CBSetCurSel(HWND hwnd, WPARAM16 wParam, LPARAM lParam)
 {
   LPHEADLIST lphl = ComboGetListHeader(hwnd);
   WORD  wRet;
@@ -510,7 +510,7 @@
 /***********************************************************************
  *           CBGetCurSel
  */
-static LRESULT CBGetCurSel(HWND hwnd, WPARAM wParam, LPARAM lParam)
+static LRESULT CBGetCurSel(HWND hwnd, WPARAM16 wParam, LPARAM lParam)
 {
   LPHEADLIST lphl = ComboGetListHeader(hwnd);
   return lphl->ItemFocused;
@@ -519,7 +519,7 @@
 /***********************************************************************
  *           CBGetItemHeight
  */
-static LRESULT CBGetItemHeight(HWND hwnd, WPARAM wParam, LPARAM lParam)
+static LRESULT CBGetItemHeight(HWND hwnd, WPARAM16 wParam, LPARAM lParam)
 {
   LPHEADLIST lphl = ComboGetListHeader(hwnd);
   LPLISTSTRUCT lpls = ListBoxGetItem (lphl, wParam);
@@ -531,7 +531,7 @@
 /***********************************************************************
  *           CBSetItemHeight
  */
-static LRESULT CBSetItemHeight(HWND hwnd, WPARAM wParam, LPARAM lParam)
+static LRESULT CBSetItemHeight(HWND hwnd, WPARAM16 wParam, LPARAM lParam)
 {
   LPHEADLIST lphl = ComboGetListHeader(hwnd);
   return ListBoxSetItemHeight(lphl, wParam, lParam);
@@ -540,7 +540,7 @@
 /***********************************************************************
  *           CBSetRedraw
  */
-static LRESULT CBSetRedraw(HWND hwnd, WPARAM wParam, LPARAM lParam)
+static LRESULT CBSetRedraw(HWND hwnd, WPARAM16 wParam, LPARAM lParam)
 {
   LPHEADLIST lphl = ComboGetListHeader(hwnd);
   lphl->bRedrawFlag = wParam;
@@ -550,7 +550,7 @@
 /***********************************************************************
  *           CBSetFont
  */
-static LRESULT CBSetFont(HWND hwnd, WPARAM wParam, LPARAM lParam)
+static LRESULT CBSetFont(HWND hwnd, WPARAM16 wParam, LPARAM lParam)
 {
   LPHEADLIST  lphl = ComboGetListHeader(hwnd);
   LPHEADCOMBO lphc = ComboGetStorageHeader(hwnd);
@@ -567,7 +567,7 @@
 /***********************************************************************
  *           CBGetLBTextLen
  */
-static LRESULT CBGetLBTextLen(HWND hwnd, WPARAM wParam, LPARAM lParam)
+static LRESULT CBGetLBTextLen(HWND hwnd, WPARAM16 wParam, LPARAM lParam)
 {
   LPHEADLIST   lphl = ComboGetListHeader(hwnd);
   LPLISTSTRUCT lpls = ListBoxGetItem(lphl,wParam);
@@ -579,7 +579,7 @@
 /***********************************************************************
  *           CBGetLBText
  */
-static LRESULT CBGetLBText(HWND hwnd, WPARAM wParam, LPARAM lParam)
+static LRESULT CBGetLBText(HWND hwnd, WPARAM16 wParam, LPARAM lParam)
 {
   LPHEADLIST lphl = ComboGetListHeader(hwnd);
   return ListBoxGetText(lphl, wParam, (LPSTR)PTR_SEG_TO_LIN(lParam));
@@ -588,7 +588,7 @@
 /***********************************************************************
  *           CBGetItemData
  */
-static LRESULT CBGetItemData(HWND hwnd, WPARAM wParam, LPARAM lParam)
+static LRESULT CBGetItemData(HWND hwnd, WPARAM16 wParam, LPARAM lParam)
 {
   LPHEADLIST lphl = ComboGetListHeader(hwnd);
   return ListBoxGetItemData(lphl, wParam);
@@ -597,7 +597,7 @@
 /***********************************************************************
  *           CBSetItemData
  */
-static LRESULT CBSetItemData(HWND hwnd, WPARAM wParam, LPARAM lParam)
+static LRESULT CBSetItemData(HWND hwnd, WPARAM16 wParam, LPARAM lParam)
 {
   LPHEADLIST lphl = ComboGetListHeader(hwnd);
   return ListBoxSetItemData(lphl, wParam, lParam);
@@ -606,7 +606,7 @@
 /***********************************************************************
  *           CBShowDropDown
  */
-static LRESULT CBShowDropDown(HWND hwnd, WPARAM wParam, LPARAM lParam)
+static LRESULT CBShowDropDown(HWND hwnd, WPARAM16 wParam, LPARAM lParam)
 {
   LPHEADCOMBO lphc = ComboGetStorageHeader(hwnd);
   RECT32 rect;
@@ -691,7 +691,7 @@
 /***********************************************************************
  *           CBCommand        
  */
-static LRESULT CBCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
+static LRESULT CBCommand(HWND hwnd, WPARAM16 wParam, LPARAM lParam)
 {
   LPHEADCOMBO lphc = ComboGetStorageHeader(hwnd);
   LPHEADLIST lphl = ComboGetListHeader(hwnd);
@@ -751,7 +751,7 @@
  *           CBGetEditSel
  * Look out! Under Win32, the parameter packing is very different.
  */
-static LRESULT CBGetEditSel(HWND hwnd, WPARAM wParam, LPARAM lParam)
+static LRESULT CBGetEditSel(HWND hwnd, WPARAM16 wParam, LPARAM lParam)
 {
     LPHEADCOMBO lphc = ComboGetStorageHeader(hwnd);
 
@@ -765,7 +765,7 @@
  *           CBSetEditSel
  * Look out! Under Win32, the parameter packing is very different.
  */
-static LRESULT CBSetEditSel(HWND hwnd, WPARAM wParam, LPARAM lParam)
+static LRESULT CBSetEditSel(HWND hwnd, WPARAM16 wParam, LPARAM lParam)
 {
     LPHEADCOMBO lphc = ComboGetStorageHeader(hwnd);
 
@@ -778,7 +778,7 @@
 /***********************************************************************
  *           ComboWndProc
  */
-LRESULT ComboBoxWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+LRESULT ComboBoxWndProc(HWND hwnd, UINT message, WPARAM16 wParam, LPARAM lParam)
 {
     switch(message) {	
      case WM_NCCREATE: return CBNCCreate(hwnd, wParam, lParam);
@@ -835,7 +835,7 @@
 /***********************************************************************
  *           CBLCreate
  */
-static LRESULT CBLCreate( HWND hwnd, WPARAM wParam, LPARAM lParam )
+static LRESULT CBLCreate( HWND hwnd, WPARAM16 wParam, LPARAM lParam )
 {
   CREATESTRUCT16 *createStruct = (CREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam);
   SetWindowLong32A(hwnd,0,(LONG)createStruct->lpCreateParams);
@@ -845,7 +845,7 @@
 /***********************************************************************
  *           CBLGetDlgCode
  */
-static LRESULT CBLGetDlgCode( HWND hwnd, WPARAM wParam, LPARAM lParam )
+static LRESULT CBLGetDlgCode( HWND hwnd, WPARAM16 wParam, LPARAM lParam )
 {
   return DLGC_WANTARROWS | DLGC_WANTCHARS;
 }
@@ -853,7 +853,7 @@
 /***********************************************************************
  *           CBLKeyDown
  */
-static LRESULT CBLKeyDown( HWND hwnd, WPARAM wParam, LPARAM lParam ) 
+static LRESULT CBLKeyDown( HWND hwnd, WPARAM16 wParam, LPARAM lParam ) 
 {
   LPHEADLIST lphl = CLBoxGetListHeader(hwnd);
   WORD newFocused = lphl->ItemFocused;
@@ -901,7 +901,7 @@
 /***********************************************************************
  *           CBLChar
  */
-static LRESULT CBLChar( HWND hwnd, WPARAM wParam, LPARAM lParam )
+static LRESULT CBLChar( HWND hwnd, WPARAM16 wParam, LPARAM lParam )
 {
   return 0;
 }
@@ -909,7 +909,7 @@
 /***********************************************************************
  *           CBLPaint
  */
-static LRESULT CBLPaint( HWND hwnd, WPARAM wParam, LPARAM lParam )
+static LRESULT CBLPaint( HWND hwnd, WPARAM16 wParam, LPARAM lParam )
 {
   LPHEADLIST   lphl = CLBoxGetListHeader(hwnd);
   LPLISTSTRUCT lpls;
@@ -986,7 +986,7 @@
 /***********************************************************************
  *           CBLKillFocus
  */
-static LRESULT CBLKillFocus( HWND hwnd, WPARAM wParam, LPARAM lParam )
+static LRESULT CBLKillFocus( HWND hwnd, WPARAM16 wParam, LPARAM lParam )
 {
 /*  SendMessage16(CLBoxGetCombo(hwnd),CB_SHOWDROPDOWN,0,0);*/
   return 0;
@@ -995,7 +995,7 @@
 /***********************************************************************
  *           CBLActivate
  */
-static LRESULT CBLActivate( HWND hwnd, WPARAM wParam, LPARAM lParam )
+static LRESULT CBLActivate( HWND hwnd, WPARAM16 wParam, LPARAM lParam )
 {
   if (wParam == WA_INACTIVE)
     SendMessage16(CLBoxGetCombo(hwnd),CB_SHOWDROPDOWN,0,0);
@@ -1005,7 +1005,7 @@
 /***********************************************************************
  *           CBLLButtonDown
  */
-static LRESULT CBLLButtonDown( HWND hwnd, WPARAM wParam, LPARAM lParam )
+static LRESULT CBLLButtonDown( HWND hwnd, WPARAM16 wParam, LPARAM lParam )
 {
   LPHEADLIST lphl = CLBoxGetListHeader(hwnd);
   int        y;
@@ -1030,7 +1030,7 @@
 /***********************************************************************
  *           CBLLButtonUp
  */
-static LRESULT CBLLButtonUp( HWND hwnd, WPARAM wParam, LPARAM lParam )
+static LRESULT CBLLButtonUp( HWND hwnd, WPARAM16 wParam, LPARAM lParam )
 {
   LPHEADLIST lphl = CLBoxGetListHeader(hwnd);
 
@@ -1055,7 +1055,7 @@
 /***********************************************************************
  *           CBLMouseMove
  */
-static LRESULT CBLMouseMove( HWND hwnd, WPARAM wParam, LPARAM lParam )
+static LRESULT CBLMouseMove( HWND hwnd, WPARAM16 wParam, LPARAM lParam )
 {
   LPHEADLIST lphl = CLBoxGetListHeader(hwnd);
   short y;
@@ -1102,7 +1102,7 @@
 /***********************************************************************
  *           CBLVScroll
  */
-static LRESULT CBLVScroll( HWND hwnd, WPARAM wParam, LPARAM lParam )
+static LRESULT CBLVScroll( HWND hwnd, WPARAM16 wParam, LPARAM lParam )
 {
   LPHEADLIST lphl = CLBoxGetListHeader(hwnd);
   int  y;
@@ -1204,7 +1204,7 @@
 /***********************************************************************
  *           ComboLBoxWndProc
  */
-LRESULT ComboLBoxWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+LRESULT ComboLBoxWndProc(HWND hwnd, UINT message, WPARAM16 wParam, LPARAM lParam)
 {
     switch(message) {	
      case WM_CREATE: return CBLCreate(hwnd, wParam, lParam);
diff --git a/controls/edit.c b/controls/edit.c
index a5e811e..f37c058 100644
--- a/controls/edit.c
+++ b/controls/edit.c
@@ -86,7 +86,7 @@
 
 #define EDIT_SEND_CTLCOLOR(wndPtr,hdc) \
     (SendMessage32A((wndPtr)->parent->hwndSelf, WM_CTLCOLOREDIT, \
-                    (WPARAM)(hdc), (LPARAM)(wndPtr)->hwndSelf ))
+                    (WPARAM32)(hdc), (LPARAM)(wndPtr)->hwndSelf ))
 #define EDIT_NOTIFY_PARENT(wndPtr, wNotifyCode) \
     (SendMessage32A((wndPtr)->parent->hwndSelf, WM_COMMAND, \
                     MAKEWPARAM((wndPtr)->wIDmenu, wNotifyCode), \
@@ -104,7 +104,7 @@
  *	Files like these should really be kept in alphabetical order.
  *
  */
-LRESULT EditWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+LRESULT EditWndProc(HWND hwnd, UINT msg, WPARAM16 wParam, LPARAM lParam);
 
 static void    EDIT_BuildLineDefs(WND *wndPtr);
 static INT     EDIT_CallWordBreakProc(WND *wndPtr, char *s, INT index, INT count, INT action);
@@ -117,7 +117,7 @@
 static void    EDIT_GetLineRect(WND *wndPtr, UINT line, UINT scol, UINT ecol, LPRECT16 rc);
 static char *  EDIT_GetPointer(WND *wndPtr);
 static char *  EDIT_GetPasswordPointer(WND *wndPtr);
-static LRESULT EDIT_GetRect(WND *wndPtr, WPARAM wParam, LPARAM lParam);
+static LRESULT EDIT_GetRect(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
 static BOOL    EDIT_GetRedraw(WND *wndPtr);
 static UINT    EDIT_GetTextWidth(WND *wndPtr);
 static UINT    EDIT_GetVisibleLineCount(WND *wndPtr);
@@ -136,74 +136,74 @@
 static void    EDIT_MoveUpward(WND *wndPtr, BOOL extend);
 static void    EDIT_MoveWordBackward(WND *wndPtr, BOOL extend);
 static void    EDIT_MoveWordForward(WND *wndPtr, BOOL extend);
-static void    EDIT_PaintLine(WND *wndPtr, HDC hdc, UINT line, BOOL rev);
-static UINT    EDIT_PaintText(WND *wndPtr, HDC hdc, INT x, INT y, UINT line, UINT col, UINT count, BOOL rev);
+static void    EDIT_PaintLine(WND *wndPtr, HDC32 hdc, UINT line, BOOL rev);
+static UINT    EDIT_PaintText(WND *wndPtr, HDC32 hdc, INT x, INT y, UINT line, UINT col, UINT count, BOOL rev);
 static void    EDIT_ReleasePointer(WND *wndPtr);
-static LRESULT EDIT_ReplaceSel(WND *wndPtr, WPARAM wParam, LPARAM lParam);
+static LRESULT EDIT_ReplaceSel(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
 static void    EDIT_ScrollIntoView(WND *wndPtr);
 static INT     EDIT_WndXFromCol(WND *wndPtr, UINT line, UINT col);
 static INT     EDIT_WndYFromLine(WND *wndPtr, UINT line);
 static INT     EDIT_WordBreakProc(char *s, INT index, INT count, INT action);
 
-static LRESULT EDIT_EM_CanUndo(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_EM_EmptyUndoBuffer(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_EM_FmtLines(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_EM_GetFirstVisibleLine(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_EM_GetHandle(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_EM_GetLine(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_EM_GetLineCount(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_EM_GetModify(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_EM_GetPasswordChar(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_EM_GetRect(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_EM_GetSel(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_EM_GetThumb(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_EM_GetWordBreakProc(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_EM_LimitText(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_EM_LineFromChar(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_EM_LineIndex(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_EM_LineLength(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_EM_LineScroll(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_EM_ReplaceSel(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_EM_Scroll(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_EM_SetHandle(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_EM_SetModify(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_EM_SetPasswordChar(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_EM_SetReadOnly(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_EM_SetRect(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_EM_SetRectNP(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_EM_SetSel(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_EM_SetTabStops(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_EM_SetWordBreakProc(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_EM_Undo(WND *wndPtr, WPARAM wParam, LPARAM lParam);
+static LRESULT EDIT_EM_CanUndo(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_EM_EmptyUndoBuffer(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_EM_FmtLines(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_EM_GetFirstVisibleLine(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_EM_GetHandle(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_EM_GetLine(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_EM_GetLineCount(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_EM_GetModify(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_EM_GetPasswordChar(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_EM_GetRect(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_EM_GetSel(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_EM_GetThumb(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_EM_GetWordBreakProc(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_EM_LimitText(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_EM_LineFromChar(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_EM_LineIndex(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_EM_LineLength(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_EM_LineScroll(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_EM_ReplaceSel(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_EM_Scroll(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_EM_SetHandle(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_EM_SetModify(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_EM_SetPasswordChar(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_EM_SetReadOnly(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_EM_SetRect(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_EM_SetRectNP(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_EM_SetSel(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_EM_SetTabStops(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_EM_SetWordBreakProc(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_EM_Undo(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
 
-static LRESULT EDIT_WM_Char(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_WM_Clear(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_WM_Copy(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_WM_Cut(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_WM_Create(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_WM_Destroy(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_WM_Enable(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_WM_EraseBkGnd(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_WM_GetDlgCode(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_WM_GetFont(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_WM_GetText(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_WM_GetTextLength(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_WM_HScroll(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_WM_KeyDown(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_WM_KillFocus(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_WM_LButtonDblClk(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_WM_LButtonDown(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_WM_LButtonUp(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_WM_MouseMove(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_WM_Paint(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_WM_Paste(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_WM_SetCursor(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_WM_SetFocus(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_WM_SetFont(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_WM_SetRedraw(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_WM_SetText(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_WM_Size(WND *wndPtr, WPARAM wParam, LPARAM lParam);
-static LRESULT EDIT_WM_VScroll(WND *wndPtr, WPARAM wParam, LPARAM lParam);
+static LRESULT EDIT_WM_Char(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_WM_Clear(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_WM_Copy(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_WM_Cut(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_WM_Create(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_WM_Destroy(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_WM_Enable(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_WM_EraseBkGnd(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_WM_GetDlgCode(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_WM_GetFont(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_WM_GetText(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_WM_GetTextLength(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_WM_HScroll(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_WM_KeyDown(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_WM_KillFocus(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_WM_LButtonDblClk(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_WM_LButtonDown(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_WM_LButtonUp(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_WM_MouseMove(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_WM_Paint(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_WM_Paste(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_WM_SetCursor(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_WM_SetFocus(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_WM_SetFont(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_WM_SetRedraw(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_WM_SetText(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_WM_Size(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
+static LRESULT EDIT_WM_VScroll(WND *wndPtr, WPARAM32 wParam, LPARAM lParam);
 
 
 /*********************************************************************
@@ -235,7 +235,7 @@
  *	EditWndProc()
  *
  */
-LRESULT EditWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+LRESULT EditWndProc(HWND hwnd, UINT msg, WPARAM16 wParam, LPARAM lParam)
 {
 	LRESULT lResult = 0L;
 	WND *wndPtr = WIN_FindWndPtr(hwnd);
@@ -482,7 +482,10 @@
 		lResult = EDIT_WM_VScroll(wndPtr, wParam, lParam);
 		break;
 	default:
-		if (msg >= WM_USER)
+                /* Some programs pass messages obtained through
+                 * RegisterWindowMessage() (>= 0xc000); we just ignore them
+                 */
+		if ((msg >= WM_USER) && (msg < 0xc000))
 			fprintf(stdnimp, "edit: undocumented message %d >= WM_USER, please report.\n", msg);
 		lResult = DefWindowProc16(hwnd, msg, wParam, lParam);
 		break;
@@ -796,7 +799,7 @@
  *	It is used internally, as if there were no pointer difficulties.
  *
  */
-static LRESULT EDIT_GetRect(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_GetRect(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	GetClientRect16( wndPtr->hwndSelf, (LPRECT16)lParam );
 	return 0L;
@@ -1246,7 +1249,7 @@
  *	EDIT_PaintLine
  *
  */
-static void EDIT_PaintLine(WND *wndPtr, HDC hdc, UINT line, BOOL rev)
+static void EDIT_PaintLine(WND *wndPtr, HDC32 hdc, UINT line, BOOL rev)
 {
 	UINT fv = (UINT)EDIT_EM_GetFirstVisibleLine(wndPtr, 0, 0L);
 	UINT vlc = EDIT_GetVisibleLineCount(wndPtr);
@@ -1288,7 +1291,7 @@
  *	EDIT_PaintText
  *
  */
-static UINT EDIT_PaintText(WND *wndPtr, HDC hdc, INT x, INT y, UINT line, UINT col, UINT count, BOOL rev)
+static UINT EDIT_PaintText(WND *wndPtr, HDC32 hdc, INT x, INT y, UINT line, UINT col, UINT count, BOOL rev)
 {
 	EDITSTATE *es = EDITSTATEPTR(wndPtr);
 	COLORREF BkColor;
@@ -1349,7 +1352,7 @@
  *	It is used internally, as if there were no pointer difficulties.
  *
  */
-static LRESULT EDIT_ReplaceSel(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_ReplaceSel(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	const char *str = (char *)lParam;
 	int strl = strlen(str);
@@ -1556,7 +1559,7 @@
  *	EM_CANUNDO
  *
  */
-static LRESULT EDIT_EM_CanUndo(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_EM_CanUndo(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	return 0L;
 }
@@ -1567,7 +1570,7 @@
  *	EM_EMPTYUNDOBUFFER
  *
  */
-static LRESULT EDIT_EM_EmptyUndoBuffer(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_EM_EmptyUndoBuffer(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	return 0L;
 }
@@ -1578,7 +1581,7 @@
  *	EM_FMTLINES
  *
  */
-static LRESULT EDIT_EM_FmtLines(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_EM_FmtLines(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	fprintf(stdnimp, "edit: EM_FMTLINES: message not implemented.\n");
 	return wParam ? -1L : 0L;
@@ -1590,7 +1593,7 @@
  *	EM_GETFIRSTVISIBLELINE
  *
  */
-static LRESULT EDIT_EM_GetFirstVisibleLine(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_EM_GetFirstVisibleLine(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	EDITSTATE *es = EDITSTATEPTR(wndPtr);
 	
@@ -1603,7 +1606,7 @@
  *	EM_GETHANDLE
  *
  */
-static LRESULT EDIT_EM_GetHandle(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_EM_GetHandle(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	EDITSTATE *es = EDITSTATEPTR(wndPtr);
 
@@ -1616,7 +1619,7 @@
  *	EM_GETLINE
  *
  */
-static LRESULT EDIT_EM_GetLine(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_EM_GetLine(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	char *text;
 	char *src;
@@ -1647,7 +1650,7 @@
  *	EM_GETLINECOUNT
  *
  */
-static LRESULT EDIT_EM_GetLineCount(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_EM_GetLineCount(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	EDITSTATE *es = EDITSTATEPTR(wndPtr);
 	
@@ -1660,7 +1663,7 @@
  *	EM_GETMODIFY
  *
  */
-static LRESULT EDIT_EM_GetModify(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_EM_GetModify(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	EDITSTATE *es = EDITSTATEPTR(wndPtr);
 
@@ -1673,7 +1676,7 @@
  *	EM_GETPASSWORDCHAR
  *
  */
-static LRESULT EDIT_EM_GetPasswordChar(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_EM_GetPasswordChar(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	EDITSTATE *es = EDITSTATEPTR(wndPtr);
 
@@ -1686,7 +1689,7 @@
  *	EM_GETRECT
  *
  */
-static LRESULT EDIT_EM_GetRect(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_EM_GetRect(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	return EDIT_GetRect(wndPtr, wParam, (LPARAM)PTR_SEG_TO_LIN(lParam));
 }
@@ -1697,7 +1700,7 @@
  *	EM_GETSEL
  *
  */
-static LRESULT EDIT_EM_GetSel(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_EM_GetSel(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	EDITSTATE *es = EDITSTATEPTR(wndPtr);
 
@@ -1712,7 +1715,7 @@
  *	FIXME: undocumented: is this right ?
  *
  */
-static LRESULT EDIT_EM_GetThumb(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_EM_GetThumb(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	return MAKELONG(EDIT_WM_VScroll(wndPtr, EM_GETTHUMB, 0L),
 		EDIT_WM_HScroll(wndPtr, EM_GETTHUMB, 0L));
@@ -1724,7 +1727,7 @@
  *	EM_GETWORDBREAKPROC
  *
  */
-static LRESULT EDIT_EM_GetWordBreakProc(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_EM_GetWordBreakProc(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	EDITSTATE *es = EDITSTATEPTR(wndPtr);
 
@@ -1737,7 +1740,7 @@
  *	EM_LIMITTEXT
  *
  */
-static LRESULT EDIT_EM_LimitText(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_EM_LimitText(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	EDITSTATE *es = EDITSTATEPTR(wndPtr);
 
@@ -1761,7 +1764,7 @@
  *	EM_LINEFROMCHAR
  *
  */
-static LRESULT EDIT_EM_LineFromChar(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_EM_LineFromChar(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	UINT l;
 
@@ -1781,7 +1784,7 @@
  *	EM_LINEINDEX
  *
  */
-static LRESULT EDIT_EM_LineIndex(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_EM_LineIndex(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	EDITSTATE *es = EDITSTATEPTR(wndPtr);
 	UINT e;
@@ -1806,7 +1809,7 @@
  *	EM_LINELENGTH
  *
  */
-static LRESULT EDIT_EM_LineLength(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_EM_LineLength(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	EDITSTATE *es = EDITSTATEPTR(wndPtr);
 	UINT s;
@@ -1834,7 +1837,7 @@
  *	EM_LINESCROLL
  *
  */
-static LRESULT EDIT_EM_LineScroll(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_EM_LineScroll(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	EDITSTATE *es = EDITSTATEPTR(wndPtr);
 	UINT lc = (UINT)EDIT_EM_GetLineCount(wndPtr, 0, 0L);
@@ -1882,7 +1885,7 @@
  *	EM_REPLACESEL
  *
  */
-static LRESULT EDIT_EM_ReplaceSel(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_EM_ReplaceSel(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	return (LRESULT)EDIT_ReplaceSel(wndPtr, wParam,
 				(LPARAM)(char *)PTR_SEG_TO_LIN(lParam));
@@ -1896,7 +1899,7 @@
  *	FIXME: undocumented message.
  *
  */
-static LRESULT EDIT_EM_Scroll(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_EM_Scroll(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	fprintf(stdnimp, "edit: EM_SCROLL: message not implemented (undocumented), please report.\n");
 	return 0L;
@@ -1908,7 +1911,7 @@
  *	EM_SETHANDLE
  *
  */
-static LRESULT EDIT_EM_SetHandle(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_EM_SetHandle(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	EDITSTATE *es = EDITSTATEPTR(wndPtr);
 
@@ -1938,7 +1941,7 @@
  *	EM_SETMODIFY
  *
  */
-static LRESULT EDIT_EM_SetModify(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_EM_SetModify(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	EDITSTATE *es = EDITSTATEPTR(wndPtr);
 
@@ -1952,7 +1955,7 @@
  *	EM_SETPASSWORDCHAR
  *
  */
-static LRESULT EDIT_EM_SetPasswordChar(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_EM_SetPasswordChar(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	EDITSTATE *es = EDITSTATEPTR(wndPtr);
 
@@ -1966,7 +1969,7 @@
  *	EM_SETREADONLY
  *
  */
-static LRESULT EDIT_EM_SetReadOnly(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_EM_SetReadOnly(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	if ((BOOL)wParam)
 		wndPtr->dwStyle |= ES_READONLY;
@@ -1981,7 +1984,7 @@
  *	EM_SETRECT
  *
  */
-static LRESULT EDIT_EM_SetRect(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_EM_SetRect(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	fprintf(stdnimp,"edit: EM_SETRECT: message not implemented, please report.\n");
 	return 0L;
@@ -1993,7 +1996,7 @@
  *	EM_SETRECTNP
  *
  */
-static LRESULT EDIT_EM_SetRectNP(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_EM_SetRectNP(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	fprintf(stdnimp,"edit: EM_SETRECTNP: message not implemented, please report.\n");
 	return 0L;
@@ -2005,7 +2008,7 @@
  *	EM_SETSEL
  *
  */
-static LRESULT EDIT_EM_SetSel(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_EM_SetSel(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	EDITSTATE *es = EDITSTATEPTR(wndPtr);
 	UINT ns = LOWORD(lParam);
@@ -2056,7 +2059,7 @@
  *	EM_SETTABSTOPS
  *
  */
-static LRESULT EDIT_EM_SetTabStops(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_EM_SetTabStops(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	EDITSTATE *es = EDITSTATEPTR(wndPtr);
 
@@ -2081,7 +2084,7 @@
  *	EM_SETWORDBREAKPROC
  *
  */
-static LRESULT EDIT_EM_SetWordBreakProc(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_EM_SetWordBreakProc(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	EDITSTATE *es = EDITSTATEPTR(wndPtr);
 
@@ -2095,7 +2098,7 @@
  *	EM_UNDO
  *
  */
-static LRESULT EDIT_EM_Undo(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_EM_Undo(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	return 0L;
 }
@@ -2106,7 +2109,7 @@
  *	WM_CHAR
  *
  */
-static LRESULT EDIT_WM_Char(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_WM_Char(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	char str[2];
 	unsigned char c = (unsigned char)wParam;
@@ -2143,7 +2146,7 @@
  *	WM_CLEAR
  *
  */
-static LRESULT EDIT_WM_Clear(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_WM_Clear(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	UINT s = LOWORD(EDIT_EM_GetSel(wndPtr, 0, 0L));
 	UINT e = HIWORD(EDIT_EM_GetSel(wndPtr, 0, 0L));
@@ -2175,7 +2178,7 @@
  *	WM_COPY
  *
  */
-static LRESULT EDIT_WM_Copy(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_WM_Copy(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	UINT s = LOWORD(EDIT_EM_GetSel(wndPtr, 0, 0L));
 	UINT e = HIWORD(EDIT_EM_GetSel(wndPtr, 0, 0L));
@@ -2209,7 +2212,7 @@
  *	WM_CREATE
  *
  */
-static LRESULT EDIT_WM_Create(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_WM_Create(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	CREATESTRUCT16 *cs = (CREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam);
 	EDITSTATE *es;
@@ -2267,7 +2270,7 @@
  *	WM_CUT
  *
  */
-static LRESULT EDIT_WM_Cut(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_WM_Cut(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	EDIT_WM_Copy(wndPtr, 0, 0L);
 	EDIT_WM_Clear(wndPtr, 0, 0L);
@@ -2280,7 +2283,7 @@
  *	WM_DESTROY
  *
  */
-static LRESULT EDIT_WM_Destroy(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_WM_Destroy(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	EDITSTATE *es = EDITSTATEPTR(wndPtr);
 
@@ -2300,7 +2303,7 @@
  *	WM_ENABLE
  *
  */
-static LRESULT EDIT_WM_Enable(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_WM_Enable(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	EDIT_InvalidateText(wndPtr, 0, -1);
 	return 0L;
@@ -2312,7 +2315,7 @@
  *	WM_ERASEBKGND
  *
  */
-static LRESULT EDIT_WM_EraseBkGnd(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_WM_EraseBkGnd(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	HBRUSH16 hBrush;
 	RECT16 rc;
@@ -2322,15 +2325,15 @@
 		hBrush = (HBRUSH16)GetStockObject(WHITE_BRUSH);
 
 	GetClientRect16(wndPtr->hwndSelf, &rc);
-	IntersectClipRect((HDC)wParam, rc.left, rc.top, rc.right, rc.bottom);
-	GetClipBox16((HDC)wParam, &rc);
+	IntersectClipRect((HDC16)wParam, rc.left, rc.top, rc.right, rc.bottom);
+	GetClipBox16((HDC16)wParam, &rc);
 	/*
 	 *	FIXME:	specs say that we should UnrealizeObject() the brush,
 	 *		but the specs of UnrealizeObject() say that we shouldn't
 	 *		unrealize a stock object.  The default brush that
 	 *		DefWndProc() returns is ... a stock object.
 	 */
-	FillRect16((HDC)wParam, &rc, hBrush);
+	FillRect16((HDC16)wParam, &rc, hBrush);
 	return -1L;
 }
 
@@ -2340,7 +2343,7 @@
  *	WM_GETDLGCODE
  *
  */
-static LRESULT EDIT_WM_GetDlgCode(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_WM_GetDlgCode(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	return DLGC_HASSETSEL | DLGC_WANTCHARS | DLGC_WANTARROWS;
 }
@@ -2351,7 +2354,7 @@
  *	WM_GETFONT
  *
  */
-static LRESULT EDIT_WM_GetFont(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_WM_GetFont(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	EDITSTATE *es = EDITSTATEPTR(wndPtr);
 
@@ -2364,7 +2367,7 @@
  *	WM_GETTEXT
  *
  */
-static LRESULT EDIT_WM_GetText(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_WM_GetText(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	char *text = EDIT_GetPointer(wndPtr);
 	int len;
@@ -2384,7 +2387,7 @@
  *	WM_GETTEXTLENGTH
  *
  */
-static LRESULT EDIT_WM_GetTextLength(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_WM_GetTextLength(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	char *text = EDIT_GetPointer(wndPtr);
 
@@ -2399,7 +2402,7 @@
  *	FIXME: scrollbar code itself is broken, so this one is a hack.
  *
  */
-static LRESULT EDIT_WM_HScroll(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_WM_HScroll(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	UINT ww = EDIT_GetWndWidth(wndPtr);
 	UINT tw = EDIT_GetTextWidth(wndPtr);
@@ -2463,7 +2466,7 @@
  *	(i.e. non-printable keys) & Backspace & Delete
  *
  */
-static LRESULT EDIT_WM_KeyDown(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_WM_KeyDown(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	UINT s = LOWORD(EDIT_EM_GetSel(wndPtr, 0, 0L));
 	UINT e = HIWORD(EDIT_EM_GetSel(wndPtr, 0, 0L));
@@ -2550,7 +2553,7 @@
  *	WM_KILLFOCUS
  *
  */
-static LRESULT EDIT_WM_KillFocus(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_WM_KillFocus(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	UINT s;
 	UINT e;
@@ -2573,7 +2576,7 @@
  *	The caret position has been set on the WM_LBUTTONDOWN message
  *
  */
-static LRESULT EDIT_WM_LButtonDblClk(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_WM_LButtonDblClk(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	UINT s;
 	UINT e = HIWORD(EDIT_EM_GetSel(wndPtr, 0, 0L));
@@ -2594,7 +2597,7 @@
  *	WM_LBUTTONDOWN
  *
  */
-static LRESULT EDIT_WM_LButtonDown(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_WM_LButtonDown(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	INT x = (INT)LOWORD(lParam);
 	INT y = (INT)HIWORD(lParam);
@@ -2627,7 +2630,7 @@
  *	WM_LBUTTONUP
  *
  */
-static LRESULT EDIT_WM_LButtonUp(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_WM_LButtonUp(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	if (GetCapture32() == wndPtr->hwndSelf)
 		ReleaseCapture();
@@ -2640,7 +2643,7 @@
  *	WM_MOUSEMOVE
  *
  */
-static LRESULT EDIT_WM_MouseMove(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_WM_MouseMove(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	INT x;
 	INT y;
@@ -2673,7 +2676,7 @@
  *	WM_PAINT
  *
  */
-static LRESULT EDIT_WM_Paint(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_WM_Paint(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	PAINTSTRUCT16 ps;
 	UINT i;
@@ -2717,7 +2720,7 @@
  *	WM_PASTE
  *
  */
-static LRESULT EDIT_WM_Paste(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_WM_Paste(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	HGLOBAL16 hsrc;
 	char *src;
@@ -2738,7 +2741,7 @@
  *	WM_SETCURSOR
  *
  */
-static LRESULT EDIT_WM_SetCursor(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_WM_SetCursor(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	if (LOWORD(lParam) == HTCLIENT) {
 		SetCursor(LoadCursor16(0, IDC_IBEAM));
@@ -2753,7 +2756,7 @@
  *	WM_SETFOCUS
  *
  */
-static LRESULT EDIT_WM_SetFocus(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_WM_SetFocus(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	UINT s = LOWORD(EDIT_EM_GetSel(wndPtr, 0, 0L));
 	UINT e = HIWORD(EDIT_EM_GetSel(wndPtr, 0, 0L));
@@ -2773,7 +2776,7 @@
  *	WM_SETFONT
  *
  */
-static LRESULT EDIT_WM_SetFont(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_WM_SetFont(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	TEXTMETRIC16 tm;
 	EDITSTATE *es = EDITSTATEPTR(wndPtr);
@@ -2809,7 +2812,7 @@
  *	WM_SETREDRAW
  *
  */
-static LRESULT EDIT_WM_SetRedraw(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_WM_SetRedraw(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	EDITSTATE *es = EDITSTATEPTR(wndPtr);
 
@@ -2823,7 +2826,7 @@
  *	WM_SETTEXT
  *
  */
-static LRESULT EDIT_WM_SetText(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_WM_SetText(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	EDIT_EM_SetSel(wndPtr, 1, MAKELPARAM(0, -1));
 	EDIT_WM_Clear(wndPtr, 0, 0L);
@@ -2841,7 +2844,7 @@
  *	WM_SIZE
  *
  */
-static LRESULT EDIT_WM_Size(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_WM_Size(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	if (EDIT_GetRedraw(wndPtr) &&
 			((wParam == SIZE_MAXIMIZED) ||
@@ -2861,7 +2864,7 @@
  *	FIXME: scrollbar code itself is broken, so this one is a hack.
  *
  */
-static LRESULT EDIT_WM_VScroll(WND *wndPtr, WPARAM wParam, LPARAM lParam)
+static LRESULT EDIT_WM_VScroll(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
 {
 	UINT lc = (UINT)EDIT_EM_GetLineCount(wndPtr, 0, 0L);
 	UINT fv = (UINT)EDIT_EM_GetFirstVisibleLine(wndPtr, 0, 0L);
diff --git a/controls/listbox.c b/controls/listbox.c
index f39cfdc..d3c4a94 100644
--- a/controls/listbox.c
+++ b/controls/listbox.c
@@ -200,8 +200,8 @@
 }
 
 
-void ListBoxDrawItem (HWND hwnd, LPHEADLIST lphl, HDC hdc, LPLISTSTRUCT lpls, 
-		      RECT16 *rect, WORD itemAction, WORD itemState)
+void ListBoxDrawItem(HWND hwnd, LPHEADLIST lphl, HDC16 hdc, LPLISTSTRUCT lpls, 
+                     RECT16 *rect, WORD itemAction, WORD itemState)
 {
     if (lphl->OwnerDrawn)
     {
@@ -286,7 +286,7 @@
     delItem->hwndItem = lphl->hSelf;
     delItem->itemData = lpls->mis.itemData;
 
-    ret = SendMessage16( lphl->hParent, WM_DELETEITEM, (WPARAM)lphl->CtlID,
+    ret = SendMessage16( lphl->hParent, WM_DELETEITEM, (WPARAM16)lphl->CtlID,
                          (LPARAM)SEGPTR_GET(delItem) );
     SEGPTR_FREE(delItem);
     return ret;
@@ -397,7 +397,8 @@
            itemCmp->itemID2      = -1;
            itemCmp->itemData2    = matchData;
 
-           b = SendMessage16( lphl->hParent, WM_COMPAREITEM, (WPARAM)lphl->CtlID, 
+           b = SendMessage16( lphl->hParent, WM_COMPAREITEM,
+                              (WPARAM16)lphl->CtlID,
                               (LPARAM)SEGPTR_GET(itemCmp) );
          }
 
@@ -1400,7 +1401,7 @@
 /***********************************************************************
  *           LBSetFont
  */
-static LONG LBSetFont(HWND hwnd, WPARAM wParam, LPARAM lParam)
+static LONG LBSetFont(HWND hwnd, WPARAM16 wParam, LPARAM lParam)
 {
   LPHEADLIST  lphl = ListBoxGetStorageHeader(hwnd);
   HDC32 hdc;
@@ -1455,7 +1456,7 @@
   hOldFont = SelectObject(hdc, lphl->hFont);
 
   hBrush = (HBRUSH16)SendMessage32A( lphl->hParent, WM_CTLCOLORLISTBOX,
-                                     (WPARAM)hdc, (LPARAM)hwnd);
+                                     (WPARAM32)hdc, (LPARAM)hwnd);
   if (hBrush == 0) hBrush = GetStockObject(WHITE_BRUSH);
 
   FillRect16(hdc, &rect, hBrush);
@@ -2076,7 +2077,7 @@
 /***********************************************************************
  *	     LBPassToParent
  */
-static LRESULT LBPassToParent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+static LRESULT LBPassToParent(HWND hwnd, UINT message, WPARAM16 wParam, LPARAM lParam)
 {
   WND* ptrWnd = WIN_FindWndPtr(hwnd);  
 
@@ -2090,7 +2091,7 @@
 /***********************************************************************
  *           ListBoxWndProc 
  */
-LRESULT ListBoxWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+LRESULT ListBoxWndProc(HWND hwnd, UINT message, WPARAM16 wParam, LPARAM lParam)
 { 
     switch (message) {
      case WM_CREATE: return LBCreate(hwnd, wParam, lParam);
diff --git a/controls/menu.c b/controls/menu.c
index c01dfcb..ce9a146 100644
--- a/controls/menu.c
+++ b/controls/menu.c
@@ -87,7 +87,7 @@
 #define IS_STRING_ITEM(flags) (!((flags) & (MF_BITMAP | MF_OWNERDRAW | \
 			     MF_MENUBARBREAK | MF_MENUBREAK | MF_SEPARATOR)))
 
-extern void  NC_DrawSysButton(HWND hwnd, HDC hdc, BOOL down); /* nonclient.c */
+extern void  NC_DrawSysButton(HWND hwnd, HDC32 hdc, BOOL down); /*nonclient.c*/
 extern BOOL  NC_GetSysPopupPos(WND* wndPtr, RECT16* rect);
 extern HTASK16 TASK_GetNextTask(HTASK16);
 
@@ -345,7 +345,7 @@
  *
  * Calculate the size of the menu item and store it in lpitem->rect.
  */
-static void MENU_CalcItemSize( HDC hdc, MENUITEM *lpitem, HWND hwndOwner,
+static void MENU_CalcItemSize( HDC32 hdc, MENUITEM *lpitem, HWND hwndOwner,
 			       int orgX, int orgY, BOOL menuBar )
 {
     DWORD dwSize;
@@ -484,8 +484,8 @@
  *
  * Calculate the size of the menu bar.
  */
-static void MENU_MenuBarCalcSize( HDC hdc, LPRECT16 lprect, LPPOPUPMENU lppop,
-				  HWND hwndOwner )
+static void MENU_MenuBarCalcSize( HDC32 hdc, LPRECT16 lprect,
+                                  LPPOPUPMENU lppop, HWND hwndOwner )
 {
     MENUITEM *lpitem;
     int start, i, orgX, orgY, maxY, helpPos;
@@ -552,7 +552,7 @@
  *
  * Draw a single menu item.
  */
-static void MENU_DrawMenuItem( HWND hwnd, HDC hdc, MENUITEM *lpitem,
+static void MENU_DrawMenuItem( HWND hwnd, HDC32 hdc, MENUITEM *lpitem,
 			       UINT height, BOOL menuBar )
 {
     RECT16 rect;
@@ -704,7 +704,7 @@
  *
  * Paint a popup menu.
  */
-static void MENU_DrawPopupMenu( HWND hwnd, HDC hdc, HMENU16 hmenu )
+static void MENU_DrawPopupMenu( HWND hwnd, HDC32 hdc, HMENU16 hmenu )
 {
     POPUPMENU *menu;
     MENUITEM *item;
@@ -725,7 +725,8 @@
  *
  * Paint a menu bar. Returns the height of the menu bar.
  */
-UINT MENU_DrawMenuBar(HDC hDC, LPRECT16 lprect, HWND hwnd, BOOL suppress_draw)
+UINT MENU_DrawMenuBar( HDC32 hDC, LPRECT16 lprect, HWND hwnd,
+                       BOOL suppress_draw)
 {
     LPPOPUPMENU lppop;
     int i;
@@ -803,7 +804,7 @@
 	menu->items[menu->FocusedItem].item_flags &= ~(MF_HILITE|MF_MOUSESELECT);
 	menu->FocusedItem = NO_SELECTED_ITEM;
     }
-    SendMessage16( hwndOwner, WM_INITMENUPOPUP, (WPARAM)hmenu,
+    SendMessage16( hwndOwner, WM_INITMENUPOPUP, (WPARAM16)hmenu,
 		 MAKELONG( id, (menu->wFlags & MF_SYSMENU) ? 1 : 0 ));
     MENU_PopupMenuCalcSize( menu, hwndOwner );
 
@@ -862,7 +863,7 @@
 	if( !skip_init )
 	  {
             MENU_SwitchTPWndTo(GetCurrentTask());
-	    SendMessage16( pTopPWnd->hwndSelf, WM_USER, (WPARAM)hmenu, 0L);
+	    SendMessage16( pTopPWnd->hwndSelf, WM_USER, (WPARAM16)hmenu, 0L);
 	  }
 	menu->hWnd = pTopPWnd->hwndSelf;
     }
@@ -1470,7 +1471,7 @@
       || menu->FocusedItem == SYSMENU_SELECTED 
       || ((menu->wFlags & (MF_POPUP | MF_SYSMENU)) == (MF_POPUP | MF_SYSMENU)) )
   {
-    LRESULT l = SendMessage16( *hwndOwner, WM_NEXTMENU, (WPARAM)vk, 
+    LRESULT l = SendMessage16( *hwndOwner, WM_NEXTMENU, (WPARAM16)vk, 
 				(LPARAM)((menu->FocusedItem == SYSMENU_SELECTED)
 					? GetSystemMenu( *hwndOwner, 0) 
 					: *hmenu));
@@ -1930,7 +1931,7 @@
 /***********************************************************************
  *           PopupMenuWndProc
  */
-LRESULT PopupMenuWndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
+LRESULT PopupMenuWndProc(HWND hwnd,UINT message,WPARAM16 wParam,LPARAM lParam)
 {    
     switch(message)
     {
diff --git a/controls/static.c b/controls/static.c
index 88bf0b2..09441ac 100644
--- a/controls/static.c
+++ b/controls/static.c
@@ -6,19 +6,19 @@
  */
 
 #include <stdio.h>
-#include <windows.h>
+#include "windows.h"
 #include "win.h"
 #include "static.h"
 
-static void STATIC_PaintTextfn( WND *wndPtr, HDC hdc );
-static void STATIC_PaintRectfn( WND *wndPtr, HDC hdc );
-static void STATIC_PaintIconfn( WND *wndPtr, HDC hdc );
+static void STATIC_PaintTextfn( WND *wndPtr, HDC32 hdc );
+static void STATIC_PaintRectfn( WND *wndPtr, HDC32 hdc );
+static void STATIC_PaintIconfn( WND *wndPtr, HDC32 hdc );
 
 
 static COLORREF color_windowframe, color_background, color_window;
 
 
-typedef void (*pfPaint)( WND *, HDC);
+typedef void (*pfPaint)( WND *, HDC32 );
 
 #define LAST_STATIC_TYPE  SS_LEFTNOWORDWRAP
 
@@ -67,7 +67,7 @@
 /***********************************************************************
  *           StaticWndProc
  */
-LRESULT StaticWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+LRESULT StaticWndProc(HWND hWnd, UINT uMsg, WPARAM16 wParam, LPARAM lParam)
 {
     LRESULT lResult = 0;
     WND *wndPtr = WIN_FindWndPtr(hWnd);
@@ -180,7 +180,7 @@
 }
 
 
-static void STATIC_PaintTextfn( WND *wndPtr, HDC hdc )
+static void STATIC_PaintTextfn( WND *wndPtr, HDC32 hdc )
 {
     RECT16 rc;
     HBRUSH16 hBrush;
@@ -228,7 +228,7 @@
     if (wndPtr->text) DrawText16( hdc, wndPtr->text, -1, &rc, wFormat );
 }
 
-static void STATIC_PaintRectfn( WND *wndPtr, HDC hdc )
+static void STATIC_PaintRectfn( WND *wndPtr, HDC32 hdc )
 {
     RECT16 rc;
     HBRUSH16 hBrush;
@@ -268,7 +268,7 @@
 }
 
 
-static void STATIC_PaintIconfn( WND *wndPtr, HDC hdc )
+static void STATIC_PaintIconfn( WND *wndPtr, HDC32 hdc )
 {
     RECT16 rc;
     HBRUSH16 hbrush;
diff --git a/debugger/Makefile.in b/debugger/Makefile.in
index 337d43d..a01ca75 100644
--- a/debugger/Makefile.in
+++ b/debugger/Makefile.in
@@ -29,7 +29,4 @@
 lex.yy.c: debug.l
 	$(LEX) -8 -I $(SRCDIR)/debug.l
 
-clean::
-	$(RM) y.tab.h
-
 ### Dependencies:
diff --git a/documentation/languages b/documentation/languages
index c1391a4..71f2d6b 100644
--- a/documentation/languages
+++ b/documentation/languages
@@ -12,29 +12,26 @@
 To add a new language to the list of languages that Wine can handle
 you must...
 
-1.  Edit resources/Makefile.in variable "LANGUAGES" to include a new
-    abbreviation for the language.
-
-2.  Edit ./wine.man (search for -language) to show the new language
+1.  Edit ./wine.man (search for -language) to show the new language
     abbreviation.
 
-3.  Edit misc/main.c variable "Languages" to contain the new language
+2.  Edit misc/main.c variable "Languages" to contain the new language
     abbreviation and language ID.  Also edit macro "USAGE" to show the
     new abbreviation.
 
-4.  Edit include/options.h enum "WINE_LANGUAGE" to have a member called
+3.  Edit include/options.h enum "WINE_LANGUAGE" to have a member called
     LANG_XX where XX is the new abbreviation.
 
-5.  Edit misc/ole2nls.c function "GetUserDefaultLCID" to contain an
+4.  Edit misc/ole2nls.c function "GetUserDefaultLCID" to contain an
     extra case for your language.  The correct return values seem to
     be a mystery, but don't worry.
 
-6.  Edit resources/sysrec.c to include "sysres_XX.h" where XX is the
+5.  Edit resources/sysrec.c to include "sysres_XX.h" where XX is the
     abbreviation for your language.  (That file will be produced auto-
     matically.)  Edit variable "SYSRES_Resources" to contain an entry
     for your language.
 
-7.  Create a new file, resources/sysres_XX.rc, where XX is the
+6.  Create a new file, resources/sysres_XX.rc, where XX is the
     abbreviation that you chose.  Your best bet is to copy one of the
     other *.rc files and start translating.  [Warning: the author of
     this file does not know the details of the structure of these
@@ -46,6 +43,9 @@
     copy the positions from (say) English.  In particular, items within
     one menu should have different highlighted letters.
 
+7.  Edit resources/Makefile.in to add the name of the new file to the
+    SYSRES_SRCS variable.
+
 8.  Edit misc/ole2nls.c function "GetLocaleInfoA" to contain a case for
     your language.
 
diff --git a/graphics/metafiledrv/init.c b/graphics/metafiledrv/init.c
index af5aea1..dc11829 100644
--- a/graphics/metafiledrv/init.c
+++ b/graphics/metafiledrv/init.c
@@ -59,6 +59,7 @@
     NULL,                            /* pSelectPalette */
     NULL,                            /* pSetBkColor */
     NULL,                            /* pSetBkMode */
+    NULL,                            /* pSetDeviceClipping */
     NULL,                            /* pSetDIBitsToDevice */
     NULL,                            /* pSetMapMode */
     NULL,                            /* pSetMapperFlags */
diff --git a/graphics/win16drv/init.c b/graphics/win16drv/init.c
index 1a209e1..7b285fe 100644
--- a/graphics/win16drv/init.c
+++ b/graphics/win16drv/init.c
@@ -10,6 +10,8 @@
 #include <fcntl.h>
 #include <unistd.h>
 #include <errno.h>
+#include "windows.h"
+#include "module.h"
 #include "win16drv.h"
 #include "gdi.h"
 #include "bitmap.h"
@@ -79,6 +81,7 @@
     NULL,                            /* pSelectPalette */
     NULL,                            /* pSetBkColor */
     NULL,                            /* pSetBkMode */
+    NULL,                            /* pSetDeviceClipping */
     NULL,                            /* pSetDIBitsToDevice */
     NULL,                            /* pSetMapMode */
     NULL,                            /* pSetMapperFlags */
@@ -112,6 +115,7 @@
 BOOL32 WIN16DRV_Init(void)
 {
     return DRIVER_RegisterDriver( NULL /* generic driver */, &WIN16DRV_Funcs );
+        
 }
 
 /* Tempory functions, for initialising structures */
@@ -152,7 +156,7 @@
  * Thunking utility functions
  */
 
-static BOOL32 AddData(SEGPTR *pSegPtr, void *pData, int nSize, SEGPTR Limit)
+static BOOL32 AddData(SEGPTR *pSegPtr, const void *pData, int nSize, SEGPTR Limit)
 {
     BOOL32 bRet = FALSE;
     char *pBuffer = PTR_SEG_TO_LIN((*pSegPtr));
@@ -165,7 +169,7 @@
 	SEGPTR SegPtrOld = *pSegPtr;
 	SEGPTR SegPtrNew;
 
-	printf("AddData: Copying %d from %p to %p(0x%x)\n", nSize, pData, pBuffer, (UINT32)*pSegPtr);
+	dprintf_win16drv(stddeb, "AddData: Copying %d from %p to %p(0x%x)\n", nSize, pData, pBuffer, (UINT32)*pSegPtr);
 	memcpy(pBuffer, pData, nSize); 
 	SegPtrNew = (SegPtrOld + nSize + 1);
 	*pdw = (DWORD)SegPtrNew;
@@ -179,7 +183,7 @@
     char *pSrc =  PTR_SEG_TO_LIN(SegPtrSrc);
     char *pDest = pDataDest;
 
-    printf("GetParamData: Copying %d from %lx(%lx) to %lx\n", nSize, (DWORD)pSrc, (DWORD)SegPtrSrc, (DWORD)pDataDest);
+    dprintf_win16drv(stddeb, "GetParamData: Copying %d from %lx(%lx) to %lx\n", nSize, (DWORD)pSrc, (DWORD)SegPtrSrc, (DWORD)pDataDest);
     memcpy(pDest, pSrc, nSize);
     return TRUE;
 }
@@ -195,7 +199,7 @@
       LoadPrinterDrvFunc(FUNC_ENUMDFONTS, ORD_ENUMDFONTS);	/* 6 */
       LoadPrinterDrvFunc(FUNC_REALIZEOBJECT, ORD_REALIZEOBJECT);/* 10 */
       LoadPrinterDrvFunc(FUNC_EXTTEXTOUT, ORD_EXTTEXTOUT);	/* 14 */
-      printf ("got func CONTROL 0x%p enable 0x%p enumDfonts 0x%p realizeobject 0x%p extextout 0x%p\n",
+      dprintf_win16drv (stddeb,"got func CONTROL 0x%p enable 0x%p enumDfonts 0x%p realizeobject 0x%p extextout 0x%p\n",
               pLPD->fn[FUNC_CONTROL],
               pLPD->fn[FUNC_ENABLE],
               pLPD->fn[FUNC_ENUMDFONTS],
@@ -221,7 +225,7 @@
     return pLPD;
 }
 
-static LOADED_PRINTER_DRIVER *FindPrinterDriverFromName(char *pszDriver)
+static LOADED_PRINTER_DRIVER *FindPrinterDriverFromName(const char *pszDriver)
 {
     LOADED_PRINTER_DRIVER *pLPD = NULL;
     int		nDriverSlot = 0;
@@ -233,7 +237,7 @@
 	ptmpLPD = gapLoadedPrinterDrivers[nDriverSlot++];
 	if (ptmpLPD != NULL)
 	{
-	    printf("Comparing %s,%s\n",ptmpLPD->szDriver,pszDriver);
+	    dprintf_win16drv(stddeb, "Comparing %s,%s\n",ptmpLPD->szDriver,pszDriver);
 	    /* Found driver store info, exit loop */
 	    if (lstrcmpi32A(ptmpLPD->szDriver, pszDriver) == 0)
 	      pLPD = ptmpLPD;
@@ -282,7 +286,7 @@
         strcat(drvName, ".DRV");
         hInst = LoadLibrary(drvName);
     }
-    printf("Loaded the library\n");
+    dprintf_win16drv(stddeb, "Loaded the library\n");
 
     
     if (hInst <= 32)
@@ -304,7 +308,7 @@
 	/* Get DS for the printer module */
 	pLPD->ds_reg = hInst;
 
-	printf("DS for %s is %x\n", pszDriver, pLPD->ds_reg);
+	dprintf_win16drv(stddeb, "DS for %s is %x\n", pszDriver, pLPD->ds_reg);
 
 	/* Get address of printer driver functions */
 	GetPrinterDriverFunctions(hInst, pLPD);
@@ -336,7 +340,7 @@
     WORD wRet = 0;
     LOADED_PRINTER_DRIVER *pLPD = NULL;
 
-    printf("PRTDRV_Control: %08x 0x%x %08lx %08lx\n", (unsigned int)lpDestDev, wfunction, lpInData, lpOutData);
+    dprintf_win16drv(stddeb, "PRTDRV_Control: %08x 0x%x %08lx %08lx\n", (unsigned int)lpDestDev, wfunction, lpInData, lpOutData);
 
     if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL)
     {
@@ -345,7 +349,7 @@
 
 	if (pLPD->fn[FUNC_CONTROL] == NULL)
 	{
-	    printf("PRTDRV_Control: Not supported by driver\n");
+	    dprintf_win16drv(stddeb, "PRTDRV_Control: Not supported by driver\n");
 	    return 0;
 	}
 
@@ -357,7 +361,7 @@
 	wRet = CallTo16_word_lwll(pLPD->fn[FUNC_CONTROL], 
                                   lP1, wP2, lP3, lP4);
     }
-    printf("PRTDRV_Control: return %x\n", wRet);
+    dprintf_win16drv(stddeb, "PRTDRV_Control: return %x\n", wRet);
     return wRet;
 
     return 0;
@@ -372,7 +376,7 @@
     WORD wRet = 0;
     LOADED_PRINTER_DRIVER *pLPD = NULL;
 
-    printf("PRTDRV_Enable: %s %s\n",lpDestDevType, lpOutputFile);
+    dprintf_win16drv(stddeb, "PRTDRV_Enable: %s %s\n",lpDestDevType, lpOutputFile);
 
     /* Get the printer driver info */
     if (wStyle == INITPDEVICE)
@@ -393,7 +397,7 @@
 
 	if (pLPD->fn[FUNC_ENABLE] == NULL)
 	{
-	    printf("PRTDRV_Enable: Not supported by driver\n");
+	    dprintf_win16drv(stddeb, "PRTDRV_Enable: Not supported by driver\n");
 	    return 0;
 	}
 
@@ -433,7 +437,7 @@
 	    GetParamData(lP1, lpDevInfo, nSize);
 	}
     }
-    printf("PRTDRV_Enable: return %x\n", wRet);
+    dprintf_win16drv(stddeb, "PRTDRV_Enable: return %x\n", wRet);
     return wRet;
 }
 
@@ -461,7 +465,7 @@
     /* Make sure we have the right structure */
     if (pWEPFC != NULL )
     {
-        printf("mode is 0x%x\n",pWEPFC->nMode);
+        dprintf_win16drv(stddeb, "mode is 0x%x\n",pWEPFC->nMode);
         
 	switch (pWEPFC->nMode)
 	{
@@ -475,7 +479,7 @@
 	  {
 	      PRINTER_FONTS_INFO *pPFI;
                   
-	      printf("WineEnumDFontCallback: Found %s %x\n", 
+	      dprintf_win16drv(stddeb, "WineEnumDFontCallback: Found %s %x\n", 
 		     lpLogFont->lfFaceName, wFontType);
 	      
 	      pPFI = &pWEPFC->pLPD->paPrinterFonts[pWEPFC->nCount];
@@ -488,7 +492,7 @@
 	}
 	wRet = 1;
     }
-    printf("WineEnumDFontCallback: returnd %d\n", wRet);
+    dprintf_win16drv(stddeb, "WineEnumDFontCallback: returnd %d\n", wRet);
     return wRet;
 }
 
@@ -501,7 +505,7 @@
     WORD wRet = 0;
     LOADED_PRINTER_DRIVER *pLPD = NULL;
 
-    printf("PRTDRV_EnumDFonts:\n");
+    dprintf_win16drv(stddeb, "PRTDRV_EnumDFonts:\n");
 
     if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL)
     {
@@ -513,7 +517,7 @@
 
 	if (pLPD->fn[FUNC_ENUMDFONTS] == NULL)
 	{
-	    printf("PRTDRV_EnumDFonts: Not supported by driver\n");
+	    dprintf_win16drv(stddeb, "PRTDRV_EnumDFonts: Not supported by driver\n");
 	    return 0;
 	}
 
@@ -540,7 +544,7 @@
     else 
         printf("Failed to find device\n");
     
-    printf("PRTDRV_EnumDFonts: return %x\n", wRet);
+    dprintf_win16drv(stddeb, "PRTDRV_EnumDFonts: return %x\n", wRet);
     return wRet;
 }
 
@@ -554,7 +558,7 @@
     WORD dwRet = 0;
     LOADED_PRINTER_DRIVER *pLPD = NULL;
     
-    printf("PRTDRV_RealizeObject:\n");
+    dprintf_win16drv(stddeb, "PRTDRV_RealizeObject:\n");
     
     if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL)
     {
@@ -566,7 +570,7 @@
 
 	if (pLPD->fn[FUNC_REALIZEOBJECT] == NULL)
 	{
-	    printf("PRTDRV_RealizeObject: Not supported by driver\n");
+	    dprintf_win16drv(stddeb, "PRTDRV_RealizeObject: Not supported by driver\n");
 	    return 0;
 	}
 
@@ -601,7 +605,7 @@
                                     lP1, wP2, lP3, lP4, lP5);
 
     }
-    printf("PRTDRV_RealizeObject: return %x\n", dwRet);
+    dprintf_win16drv(stddeb, "PRTDRV_RealizeObject: return %x\n", dwRet);
     return dwRet;
 }
 
@@ -620,8 +624,16 @@
     /* Realizing fonts */
     TEXTXFORM TextXForm;
     int nSize;
+    char printerEnabled[20];
+    PROFILE_GetWineIniString( "wine", "printer", "off",
+                             printerEnabled, sizeof(printerEnabled) );
+    if (strcmp(printerEnabled,"on"))
+    {
+        printf("WIN16DRV_CreateDC disabled in wine.conf file\n");
+        return FALSE;
+    }
 
-    printf("In creatdc for (%s,%s,%s) initData 0x%p\n",driver, device, output, initData);
+    dprintf_win16drv(stddeb, "In creatdc for (%s,%s,%s) initData 0x%p\n",driver, device, output, initData);
 
     physDev = (WIN16DRV_PDEVICE *)HeapAlloc( SystemHeap, 0, sizeof(*physDev) );
     if (!physDev) return FALSE;
@@ -630,11 +642,11 @@
     pLPD = LoadPrinterDriver(driver);
     if (pLPD == NULL)
     {
-	printf("LPGDI_CreateDC: Failed to find printer driver\n");
+	dprintf_win16drv(stddeb, "LPGDI_CreateDC: Failed to find printer driver\n");
         HeapFree( SystemHeap, 0, physDev );
         return FALSE;
     }
-    printf("windevCreateDC pLPD 0x%p\n", pLPD);
+    dprintf_win16drv(stddeb, "windevCreateDC pLPD 0x%p\n", pLPD);
 
     /* Now Get the device capabilities from the printer driver */
     
@@ -646,7 +658,15 @@
 
     /* Add this to the DC */
     dc->w.devCaps = printerDevCaps;
+    dc->w.hVisRgn = CreateRectRgn(0, 0, dc->w.devCaps->horzRes, dc->w.devCaps->vertRes);
+    dc->w.bitsPerPixel = dc->w.devCaps->bitsPixel;
     
+    printf("Got devcaps width %d height %d bits %d planes %d\n",
+           dc->w.devCaps->horzRes,
+           dc->w.devCaps->vertRes, 
+           dc->w.devCaps->bitsPixel,
+           dc->w.devCaps->planes);
+
     /* Now we allocate enough memory for the PDEVICE structure */
     /* The size of this varies between printer drivers */
     /* This PDEVICE is used by the printer DRIVER not by the GDI so must */
@@ -662,7 +682,7 @@
     pPDH = (PDEVICE_HEADER *)(PTR_SEG_TO_LIN(physDev->segptrPDEVICE) - sizeof(PDEVICE_HEADER)); 
     pPDH->pLPD = pLPD;
     
-    printf("PRTDRV_Enable: PDEVICE allocated %08lx\n",(DWORD)(physDev->segptrPDEVICE));
+    dprintf_win16drv(stddeb, "PRTDRV_Enable: PDEVICE allocated %08lx\n",(DWORD)(physDev->segptrPDEVICE));
     
     /* Now get the printer driver to initialise this data */
     wRet = PRTDRV_Enable((LPVOID)physDev->segptrPDEVICE, INITPDEVICE, device, driver, output, NULL); 
@@ -690,7 +710,7 @@
 	    
 	    /* Allocate a buffer to store all of the fonts */
 	    pLPD->nPrinterFonts = wepfc.nCount;
-            printf("Got %d fonts\n",wepfc.nCount);
+            dprintf_win16drv(stddeb, "Got %d fonts\n",wepfc.nCount);
             
 	    if (wepfc.nCount > 0)
 	    {
@@ -737,7 +757,7 @@
     {  
 	FONTINFO *p = (FONTINFO *)PTR_SEG_TO_LIN(physDev->segptrFontInfo);
 
-	printf("T:%d VR:%d HR:%d, F:%d L:%d\n",
+	dprintf_win16drv(stddeb, "T:%d VR:%d HR:%d, F:%d L:%d\n",
 	       p->dfType,
 	       p->dfVertRes, p->dfHorizRes,
 	       p->dfFirstCHAR, p->dfLastCHAR
@@ -789,7 +809,7 @@
     DWORD dwRet = 0;
     LOADED_PRINTER_DRIVER *pLPD = NULL;
     
-    printf("PRTDRV_ExtTextOut:\n");
+    dprintf_win16drv(stddeb, "PRTDRV_ExtTextOut:\n");
     
     if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL)
     {
@@ -801,7 +821,7 @@
 
 	if (pLPD->fn[FUNC_EXTTEXTOUT] == NULL)
 	{
-	    printf("PRTDRV_ExtTextOut: Not supported by driver\n");
+	    dprintf_win16drv(stddeb, "PRTDRV_ExtTextOut: Not supported by driver\n");
 	    return 0;
 	}
 
@@ -813,7 +833,7 @@
 	{
 	    lP4 = SegPtr;
 	    nSize = sizeof(RECT16);
-            printf("Adding lpClipRect\n");
+            dprintf_win16drv(stddeb, "Adding lpClipRect\n");
             
 	    AddData(&SegPtr, lpClipRect, nSize, Limit);	
 	}
@@ -825,7 +845,7 @@
 	    /* TTD WARNING THIS STRING ISNT NULL TERMINATED */
 	    lP5 = SegPtr;
 	    nSize = strlen(lpString);
-            printf("Adding string size %d\n",nSize);
+            dprintf_win16drv(stddeb, "Adding string size %d\n",nSize);
             
 	    AddData(&SegPtr, lpString, nSize, Limit);	
 	}
@@ -841,7 +861,7 @@
 	{
 	    lP8 = SegPtr;
 	    nSize = sizeof(DRAWMODE);
-            printf("adding lpDrawMode\n");
+            dprintf_win16drv(stddeb, "adding lpDrawMode\n");
             
 	    AddData(&SegPtr, lpDrawMode, nSize, Limit);	
 	}
@@ -852,28 +872,28 @@
 	{
 	    lP9 = SegPtr;
 	    nSize = sizeof(TEXTXFORM);
-            printf("Adding TextXForm\n");
+            dprintf_win16drv(stddeb, "Adding TextXForm\n");
 	    AddData(&SegPtr, lpTextXForm, nSize, Limit);	
 	}
 	else
 	  lP9 = 0L;
 	
 	if (lpCharWidths != NULL) 
-	  printf("PRTDRV_ExtTextOut: Char widths not supported\n");
+	  dprintf_win16drv(stddeb, "PRTDRV_ExtTextOut: Char widths not supported\n");
 	lP10 = 0;
 	
 	if (lpOpaqueRect != NULL)
 	{
 	    lP11 = SegPtr;
 	    nSize = sizeof(RECT16);
-            printf("Adding opaqueRect\n");
+            dprintf_win16drv(stddeb, "Adding opaqueRect\n");
 	    AddData(&SegPtr, lpOpaqueRect, nSize, Limit);	
 	}
 	else
 	  lP11 = 0L;
 	
 	wP12 = wOptions;
-	printf("Calling exttextout 0x%lx 0x%x 0x%x 0x%lx\n0x%lx 0x%x 0x%lx 0x%lx\n"
+	dprintf_win16drv(stddeb, "Calling exttextout 0x%lx 0x%x 0x%x 0x%lx\n0x%lx 0x%x 0x%lx 0x%lx\n"
                "0x%lx 0x%lx 0x%lx 0x%x\n",lP1, wP2, wP3, lP4, 
 					   lP5, wP6, lP7, lP8, lP9, lP10,
 					   lP11, wP12);
@@ -882,7 +902,7 @@
 					   lP5, wP6, lP7, lP8, lP9, lP10,
 					   lP11, wP12);
     }
-    printf("PRTDRV_ExtTextOut: return %lx\n", dwRet);
+    dprintf_win16drv(stddeb, "PRTDRV_ExtTextOut: return %lx\n", dwRet);
     return dwRet;
 }
 
@@ -913,7 +933,7 @@
     if (count == 0)
       return FALSE;
 
-    printf("LPGDI_ExtTextOut: %04x %d %d %x %p %*s %p\n", dc->hSelf, x, y, 
+    dprintf_win16drv(stddeb, "LPGDI_ExtTextOut: %04x %d %d %x %p %*s %p\n", dc->hSelf, x, y, 
 	   flags,  lprect, count > 0 ? count : 8, str, lpDx);
 
     InitTextXForm(lpTextXForm);
@@ -1055,7 +1075,7 @@
     HANDLE16 hHandle = SP_ERROR;
     PPRINTJOB pPrintJob;
 
-    printf("OpenJob: \"%s\" \"%s\" %04x\n", lpOutput, lpTitle, hDC);
+    dprintf_win16drv(stddeb, "OpenJob: \"%s\" \"%s\" %04x\n", lpOutput, lpTitle, hDC);
 
     pPrintJob = gPrintJobsTable[0];
     if (pPrintJob == NULL)
@@ -1080,7 +1100,7 @@
 	    gPrintJobsTable[pPrintJob->nIndex] = pPrintJob; 
 	}
     }
-    printf("OpenJob: return %04x\n", hHandle);
+    dprintf_win16drv(stddeb, "OpenJob: return %04x\n", hHandle);
     return hHandle;
 }
 
@@ -1089,7 +1109,7 @@
     int nRet = SP_ERROR;
     PPRINTJOB pPrintJob = NULL;
 
-    printf("CloseJob: %04x\n", hJob);
+    dprintf_win16drv(stddeb, "CloseJob: %04x\n", hJob);
 
     pPrintJob = FindPrintJobFromHandle(hJob);
     if (pPrintJob != NULL)
@@ -1107,7 +1127,7 @@
     int nRet = SP_ERROR;
     PPRINTJOB pPrintJob = NULL;
 
-    printf("WriteSpool: %04x %08lx %04x\n", hJob, (DWORD)lpData, cch);
+    dprintf_win16drv(stddeb, "WriteSpool: %04x %08lx %04x\n", hJob, (DWORD)lpData, cch);
 
     pPrintJob = FindPrintJobFromHandle(hJob);
     if (pPrintJob != NULL && pPrintJob->fd >= 0 && cch)
@@ -1124,7 +1144,7 @@
 {
     int nRet = 0;
 
-    printf("WriteDialog: %04x %04x \"%s\"\n", hJob,  cchMsg, lpMsg);
+    dprintf_win16drv(stddeb, "WriteDialog: %04x %04x \"%s\"\n", hJob,  cchMsg, lpMsg);
 
     nRet = MessageBox(NULL, lpMsg, "Printing Error", MB_OKCANCEL);
     return nRet;
@@ -1134,7 +1154,7 @@
 {
     int nRet;
 
-    printf("DeleteJob: %04x\n", hJob);
+    dprintf_win16drv(stddeb, "DeleteJob: %04x\n", hJob);
 
     nRet = FreePrintJob(hJob);
     return nRet;
@@ -1147,13 +1167,13 @@
  */
 int StartSpoolPage(HANDLE16 hJob)
 {
-    printf("StartSpoolPage GDI.246 unimplemented\n");
+    dprintf_win16drv(stddeb, "StartSpoolPage GDI.246 unimplemented\n");
     return 1;
 
 }
 int EndSpoolPage(HANDLE16 hJob)
 {
-    printf("EndSpoolPage GDI.247 unimplemented\n");
+    dprintf_win16drv(stddeb, "EndSpoolPage GDI.247 unimplemented\n");
     return 1;
 }
 
@@ -1161,6 +1181,6 @@
 DWORD GetSpoolJob(int nOption, LONG param)
 {
     DWORD retval = 0;
-    printf("In GetSpoolJob param 0x%lx noption %d\n",param, nOption);
+    dprintf_win16drv(stddeb, "In GetSpoolJob param 0x%lx noption %d\n",param, nOption);
     return retval;
 }
diff --git a/graphics/x11drv/Makefile.in b/graphics/x11drv/Makefile.in
index 841f3f7..a197fd7 100644
--- a/graphics/x11drv/Makefile.in
+++ b/graphics/x11drv/Makefile.in
@@ -6,6 +6,7 @@
 MODULE    = x11drv
 
 C_SRCS = \
+	clipping.c \
 	font.c \
 	init.c
 
diff --git a/graphics/x11drv/clipping.c b/graphics/x11drv/clipping.c
new file mode 100644
index 0000000..ddc9183
--- /dev/null
+++ b/graphics/x11drv/clipping.c
@@ -0,0 +1,34 @@
+/*
+ * DC clipping functions
+ *
+ * Copyright 1993 Alexandre Julliard
+ */
+
+#include <stdio.h>
+#include "dc.h"
+#include "x11drv.h"
+#include "region.h"
+#include "stddebug.h"
+#include "debug.h"
+
+/***********************************************************************
+ *           X11DRV_SetDeviceClipping
+ */
+void X11DRV_SetDeviceClipping( DC * dc )
+{
+    RGNOBJ *obj = (RGNOBJ *) GDI_GetObjPtr(dc->w.hGCClipRgn, REGION_MAGIC);
+    if (!obj)
+    {
+        fprintf( stderr, "X11DRV_SetDeviceClipping: Rgn is 0. Please report this.\n");
+        exit(1);
+    }
+    if (obj->xrgn)
+    {
+        XSetRegion( display, dc->u.x.gc, obj->xrgn );
+        XSetClipOrigin( display, dc->u.x.gc, dc->w.DCOrgX, dc->w.DCOrgY );
+    }
+    else  /* Clip everything */
+    {
+        XSetClipRectangles( display, dc->u.x.gc, 0, 0, NULL, 0, 0 );
+    }
+}
diff --git a/graphics/x11drv/init.c b/graphics/x11drv/init.c
index 5933d73..bcfe298 100644
--- a/graphics/x11drv/init.c
+++ b/graphics/x11drv/init.c
@@ -59,6 +59,7 @@
     NULL,                            /* pSelectPalette */
     NULL,                            /* pSetBkColor */
     NULL,                            /* pSetBkMode */
+    X11DRV_SetDeviceClipping,        /* pSetDeviceClipping */
     NULL,                            /* pSetDIBitsToDevice */
     NULL,                            /* pSetMapMode */
     NULL,                            /* pSetMapperFlags */
diff --git a/if1632/thunk.c b/if1632/thunk.c
index e3c1983..19694ce 100644
--- a/if1632/thunk.c
+++ b/if1632/thunk.c
@@ -328,7 +328,7 @@
 {
     THUNK *thunk = (THUNK *)HOOK_GetProc16( hhook );
     BOOL16 ret = UnhookWindowsHookEx16( hhook );
-    THUNK_Free( thunk );
+    if (thunk) THUNK_Free( thunk );
     return ret;
 }
 
diff --git a/include/combo.h b/include/combo.h
index 9732533..7d74776 100644
--- a/include/combo.h
+++ b/include/combo.h
@@ -17,5 +17,5 @@
   BOOL    bRedrawFlag;
 } HEADCOMBO,*LPHEADCOMBO;
 
-LRESULT ComboBoxWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
-LRESULT ComboLBoxWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
+LRESULT ComboBoxWndProc(HWND hwnd, UINT message, WPARAM16 wParam, LPARAM lParam);
+LRESULT ComboLBoxWndProc(HWND hwnd, UINT message, WPARAM16 wParam, LPARAM lParam);
diff --git a/include/commdlg.h b/include/commdlg.h
index b3d3293..db57549 100644
--- a/include/commdlg.h
+++ b/include/commdlg.h
@@ -133,7 +133,7 @@
 typedef struct {
 	DWORD			lStructSize;
 	HWND			hwndOwner;          /* caller's window handle   */
-	HDC            	        hDC;                /* printer DC/IC or NULL    */
+	HDC16          	        hDC;                /* printer DC/IC or NULL    */
 	SEGPTR                  lpLogFont;          /* ptr. to a LOGFONT struct */
 	short			iPointSize;         /* 10 * size in points of selected font */
 	DWORD			Flags WINE_PACKED;  /* enum. type flags         */
@@ -208,7 +208,7 @@
 	HWND 		hwndOwner;
 	HGLOBAL16       hDevMode;
 	HGLOBAL16       hDevNames;
-	HDC	       	hDC;
+	HDC16	       	hDC;
 	DWORD 		Flags;
 	UINT		nFromPage;
 	UINT		nToPage;
@@ -285,14 +285,14 @@
 BOOL  ReplaceText( SEGPTR find);
 BOOL  ChooseFont(LPCHOOSEFONT lpChFont);
 
-LRESULT FileOpenDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam);
-LRESULT FileSaveDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam);
-LRESULT ColorDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam);
-LRESULT FindTextDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam);
-LRESULT ReplaceTextDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam);
-LRESULT PrintDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam);
-LRESULT PrintSetupDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam);
-LRESULT FormatCharDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam);
+LRESULT FileOpenDlgProc(HWND hWnd, UINT wMsg, WPARAM16 wParam, LPARAM lParam);
+LRESULT FileSaveDlgProc(HWND hWnd, UINT wMsg, WPARAM16 wParam, LPARAM lParam);
+LRESULT ColorDlgProc(HWND hWnd, UINT wMsg, WPARAM16 wParam, LPARAM lParam);
+LRESULT FindTextDlgProc(HWND hWnd, UINT wMsg, WPARAM16 wParam, LPARAM lParam);
+LRESULT ReplaceTextDlgProc(HWND hWnd, UINT wMsg, WPARAM16 wParam, LPARAM lParam);
+LRESULT PrintDlgProc(HWND hWnd, UINT wMsg, WPARAM16 wParam, LPARAM lParam);
+LRESULT PrintSetupDlgProc(HWND hWnd, UINT wMsg, WPARAM16 wParam, LPARAM lParam);
+LRESULT FormatCharDlgProc(HWND hWnd, UINT wMsg, WPARAM16 wParam, LPARAM lParam);
 
 #ifdef __cplusplus
 }
diff --git a/include/debug.h b/include/debug.h
index 7906c06..8f2c028 100644
--- a/include/debug.h
+++ b/include/debug.h
@@ -91,6 +91,7 @@
 #undef DEBUG_VER
 #undef DEBUG_VXD
 #undef DEBUG_WIN
+#undef DEBUG_WIN16DRV
 #undef DEBUG_WIN32
 #undef DEBUG_WINSOCK
 #endif
@@ -171,6 +172,7 @@
 #define DEBUG_VER
 #define DEBUG_VXD
 #define DEBUG_WIN
+#define DEBUG_WIN16DRV
 #define DEBUG_WIN32
 #define DEBUG_WINSOCK
 #endif
@@ -553,6 +555,11 @@
 #else
     0,
 #endif
+#ifdef DEBUG_WIN16DRV
+    1,
+#else
+    0,
+#endif
 #ifdef DEBUG_WIN32
     1,
 #else
@@ -1546,8 +1553,21 @@
 #endif
 
 #ifdef DEBUG_RUNTIME
-#define dprintf_win32 if(!debug_msg_enabled[75]) ; else fprintf
-#define debugging_win32 debug_msg_enabled[75]
+#define dprintf_win16drv if(!debug_msg_enabled[75]) ; else fprintf
+#define debugging_win16drv debug_msg_enabled[75]
+#else
+#ifdef DEBUG_WIN16DRV
+#define dprintf_win16drv fprintf
+#define debugging_win16drv 1
+#else
+#define dprintf_win16drv while(0) fprintf
+#define debugging_win16drv 0
+#endif
+#endif
+
+#ifdef DEBUG_RUNTIME
+#define dprintf_win32 if(!debug_msg_enabled[76]) ; else fprintf
+#define debugging_win32 debug_msg_enabled[76]
 #else
 #ifdef DEBUG_WIN32
 #define dprintf_win32 fprintf
@@ -1559,8 +1579,8 @@
 #endif
 
 #ifdef DEBUG_RUNTIME
-#define dprintf_winsock if(!debug_msg_enabled[76]) ; else fprintf
-#define debugging_winsock debug_msg_enabled[76]
+#define dprintf_winsock if(!debug_msg_enabled[77]) ; else fprintf
+#define debugging_winsock debug_msg_enabled[77]
 #else
 #ifdef DEBUG_WINSOCK
 #define dprintf_winsock fprintf
@@ -1650,6 +1670,7 @@
     "ver",
     "vxd",
     "win",
+    "win16drv",
     "win32",
     "winsock",
     ""
diff --git a/include/gdi.h b/include/gdi.h
index b58f484..f4289fd 100644
--- a/include/gdi.h
+++ b/include/gdi.h
@@ -188,6 +188,7 @@
     HPALETTE32 (*pSelectPalette)(DC*,HPALETTE32,BOOL32);
     COLORREF   (*pSetBkColor)(DC*,COLORREF);
     WORD       (*pSetBkMode)(DC*,WORD);
+    VOID       (*pSetDeviceClipping)(DC*);
     INT32      (*pSetDIBitsToDevice)(DC*,INT32,INT32,DWORD,DWORD,INT32,INT32,UINT32,UINT32,LPCVOID,const BITMAPINFO*,UINT32);
     WORD       (*pSetMapMode)(DC*,WORD);
     DWORD      (*pSetMapperFlags)(DC*,DWORD);
diff --git a/include/listbox.h b/include/listbox.h
index af816b6..3cfe426 100644
--- a/include/listbox.h
+++ b/include/listbox.h
@@ -64,10 +64,10 @@
 extern int ListBoxSetItemHeight(LPHEADLIST lphl, WORD wIndex, long height);
 extern int ListBoxFindNextMatch(LPHEADLIST lphl, WORD wChar);
 
-extern void ListBoxDrawItem (HWND hwnd, LPHEADLIST lphl, HDC hdc,
+extern void ListBoxDrawItem (HWND hwnd, LPHEADLIST lphl, HDC16 hdc,
 			     LPLISTSTRUCT lpls, RECT16 *rect, WORD itemAction,
 			     WORD itemState);
 extern int ListBoxFindMouse(LPHEADLIST lphl, int X, int Y);
 extern void ListBoxAskMeasure(LPHEADLIST lphl, LPLISTSTRUCT lpls);
 
-extern LRESULT ListBoxWndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
+extern LRESULT ListBoxWndProc(HWND hwnd,UINT message,WPARAM16 wParam,LPARAM lParam);
diff --git a/include/mdi.h b/include/mdi.h
index 97911de..564b40a 100644
--- a/include/mdi.h
+++ b/include/mdi.h
@@ -21,7 +21,7 @@
 #define WM_MDICALCCHILDSCROLL   0x10AC /* this is exactly what Windows uses */
 
 extern LRESULT MDIClientWndProc(HWND hwnd, UINT message, 
-				WPARAM wParam, LPARAM lParam); /* mdi.c */
+				WPARAM16 wParam, LPARAM lParam); /* mdi.c */
 
 typedef struct tagMDIWCL
 {
diff --git a/include/menu.h b/include/menu.h
index 68d5ca9..bdb3b12 100644
--- a/include/menu.h
+++ b/include/menu.h
@@ -12,8 +12,9 @@
 				   int orgX, int orgY );
 extern void MENU_TrackMouseMenuBar( HWND hwnd, POINT16 pt );
 extern void MENU_TrackKbdMenuBar( WND*, UINT wParam, INT vkey);
-extern UINT MENU_DrawMenuBar( HDC hDC, LPRECT16 lprect,
+extern UINT MENU_DrawMenuBar( HDC32 hDC, LPRECT16 lprect,
 			      HWND hwnd, BOOL suppress_draw );
-extern LRESULT PopupMenuWndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam );
+extern LRESULT PopupMenuWndProc( HWND hwnd, UINT message,
+                                 WPARAM16 wParam, LPARAM lParam );
 
 #endif /* __WINE_MENU_H */
diff --git a/include/mmsystem.h b/include/mmsystem.h
index 9416024..91e7ef5 100644
--- a/include/mmsystem.h
+++ b/include/mmsystem.h
@@ -1257,7 +1257,7 @@
 typedef struct {
 	DWORD   dwCallback;
 	RECT16  rc;
-	HDC     hDC;
+	HDC16   hDC;
 } MCI_ANIM_UPDATE_PARMS, *LPMCI_ANIM_UPDATE_PARMS;
 
 #define MCI_OVLY_OPEN_WS                0x00010000L
diff --git a/include/msdos.h b/include/msdos.h
index 094c680..96a8732 100644
--- a/include/msdos.h
+++ b/include/msdos.h
@@ -2,7 +2,7 @@
 #define __MSDOS_H
 
 #include <dirent.h>
-#include <windows.h>
+#include "windows.h"
 #include "comm.h"
 
 struct fcb {
diff --git a/include/nonclient.h b/include/nonclient.h
index b2ffa02..764f081 100644
--- a/include/nonclient.h
+++ b/include/nonclient.h
@@ -13,12 +13,12 @@
                               POINT16 *minTrack, POINT16 *maxTrack );
 extern void NC_DoNCPaint( HWND hwnd, HRGN32 clip, BOOL suppress_menupaint );
 extern LONG NC_HandleNCPaint( HWND hwnd , HRGN32 clip);
-extern LONG NC_HandleNCActivate( WND *pwnd, WPARAM wParam );
+extern LONG NC_HandleNCActivate( WND *pwnd, WPARAM16 wParam );
 extern LONG NC_HandleNCCalcSize( WND *pWnd, RECT16 *winRect );
 extern LONG NC_HandleNCHitTest( HWND hwnd, POINT16 pt );
-extern LONG NC_HandleNCLButtonDown( HWND hwnd, WPARAM wParam, LPARAM lParam );
-extern LONG NC_HandleNCLButtonDblClk( WND *pWnd, WPARAM wParam, LPARAM lParam);
-extern LONG NC_HandleSysCommand( HWND hwnd, WPARAM wParam, POINT16 pt );
-extern LONG NC_HandleSetCursor( HWND hwnd, WPARAM wParam, LPARAM lParam );
+extern LONG NC_HandleNCLButtonDown( HWND hwnd, WPARAM16 wParam, LPARAM lParam );
+extern LONG NC_HandleNCLButtonDblClk( WND *pWnd, WPARAM16 wParam, LPARAM lParam);
+extern LONG NC_HandleSysCommand( HWND hwnd, WPARAM16 wParam, POINT16 pt );
+extern LONG NC_HandleSetCursor( HWND hwnd, WPARAM16 wParam, LPARAM lParam );
 
 #endif /* __WINE_NONCLIENT_H */
diff --git a/include/ole.h b/include/ole.h
index 4c42776..df9ae1a 100644
--- a/include/ole.h
+++ b/include/ole.h
@@ -221,7 +221,7 @@
 	OLESTATUS	(*CopyFromLink)(LPOLEOBJECT,LPOLECLIENT,LHCLIENTDOC,OLE_LPCSTR,LPOLEOBJECT *);
 	OLESTATUS	(*Equal)(LPOLEOBJECT,LPOLEOBJECT);
 	OLESTATUS	(*CopyToClipBoard)(LPOLEOBJECT);
-	OLESTATUS	(*Draw)(LPOLEOBJECT,HDC,LPRECT16,LPRECT16,HDC);
+	OLESTATUS	(*Draw)(LPOLEOBJECT,HDC16,LPRECT16,LPRECT16,HDC16);
 	OLESTATUS	(*Activate)(LPOLEOBJECT,UINT,BOOL,BOOL,HWND,LPRECT16);
 	OLESTATUS	(*Execute)(LPOLEOBJECT,HGLOBAL16,UINT);
 	OLESTATUS	(*Close)(LPOLEOBJECT);
diff --git a/include/shell.h b/include/shell.h
index 41cfb71..801d857 100644
--- a/include/shell.h
+++ b/include/shell.h
@@ -81,6 +81,6 @@
 #define SE_ERR_DDEBUSY          30
 #define SE_ERR_NOASSOC          31
 
-LRESULT AboutDlgProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam);
+LRESULT AboutDlgProc(HWND hWnd,UINT msg,WPARAM16 wParam,LPARAM lParam);
 
 #endif  /* __WINE_SHELL_H */
diff --git a/include/static.h b/include/static.h
index b91fab9..42ebfe0 100644
--- a/include/static.h
+++ b/include/static.h
@@ -17,6 +17,6 @@
     HICON16  hIcon;   /* Icon handle for SS_ICON controls */ 
 } STATICINFO;
 
-extern LRESULT StaticWndProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam );
+extern LRESULT StaticWndProc(HWND hWnd,UINT uMsg,WPARAM16 wParam,LPARAM lParam );
 
 #endif  /* STATIC_H */
diff --git a/include/stddebug.h b/include/stddebug.h
index d54da52..8f7190b 100644
--- a/include/stddebug.h
+++ b/include/stddebug.h
@@ -151,6 +151,7 @@
 #undef DEBUG_VER
 #undef DEBUG_VXD
 #undef DEBUG_WIN
+#undef DEBUG_WIN16DRV
 #undef DEBUG_WIN32
 #undef DEBUG_WINSOCK
 #endif
@@ -231,6 +232,7 @@
 #define DEBUG_VER
 #define DEBUG_VXD
 #define DEBUG_WIN
+#define DEBUG_WIN16DRV
 #define DEBUG_WIN32
 #define DEBUG_WINSOCK
 #endif
diff --git a/include/windows.h b/include/windows.h
index 88f1cbb..3210170 100644
--- a/include/windows.h
+++ b/include/windows.h
@@ -4907,15 +4907,11 @@
 typedef INT32 INT;
 typedef UINT32 UINT;
 typedef BOOL32 BOOL;
-typedef WPARAM32 WPARAM;
-typedef HANDLE32 HDC;
 typedef HANDLE32 HWND;
 # else  /* WINELIB32 */
 typedef INT16 INT;
 typedef UINT16 UINT;
 typedef BOOL16 BOOL;
-typedef WPARAM16 WPARAM;
-typedef HANDLE16 HDC;
 typedef HANDLE16 HWND;
 # endif  /* WINELIB32 */
 #endif  /* __WINE__ */
@@ -4942,17 +4938,17 @@
 LPSTR      AnsiUpper(LPSTR);
 UINT       AnsiUpperBuff(LPSTR,UINT);
 BOOL       AnyPopup(void);
-BOOL       Arc(HDC,INT,INT,INT,INT,INT,INT,INT,INT);
+BOOL       Arc(HDC16,INT,INT,INT,INT,INT,INT,INT,INT);
 UINT       ArrangeIconicWindows(HWND);
 HDWP16     BeginDeferWindowPos(INT);
-BOOL       BitBlt(HDC,INT,INT,INT,INT,HDC,INT,INT,DWORD);
+BOOL       BitBlt(HDC16,INT,INT,INT,INT,HDC16,INT,INT,DWORD);
 BOOL       BringWindowToTop(HWND);
 void       CalcChildScroll(HWND,WORD);
 BOOL       CallMsgFilter(SEGPTR,INT);
-LRESULT    CallNextHookEx(HHOOK,INT,WPARAM,LPARAM);
+LRESULT    CallNextHookEx(HHOOK,INT,WPARAM16,LPARAM);
 BOOL       ChangeClipboardChain(HWND,HWND);
 INT        CheckMenuItem(HMENU16,UINT,UINT);
-BOOL       Chord(HDC,INT,INT,INT,INT,INT,INT,INT,INT);
+BOOL       Chord(HDC16,INT,INT,INT,INT,INT,INT,INT,INT);
 BOOL       CloseClipboard(void);
 void       CloseSound(void);
 BOOL       CloseWindow(HWND);
@@ -4961,14 +4957,14 @@
 INT        CountClipboardFormats(void);
 INT        CountVoiceNotes(INT);
 HBRUSH16   CreateBrushIndirect(const LOGBRUSH16*);
-HDC        CreateCompatibleDC(HDC);
+HDC16      CreateCompatibleDC(HDC16);
 HCURSOR16  CreateCursor(HINSTANCE16,INT,INT,INT,INT,const BYTE*,const BYTE*);
 HGLOBAL16  CreateCursorIconIndirect(HINSTANCE16,CURSORICONINFO*,const BYTE*,const BYTE*);
-HDC        CreateDC(LPCSTR,LPCSTR,LPCSTR,const DEVMODE*);
+HDC16      CreateDC(LPCSTR,LPCSTR,LPCSTR,const DEVMODE*);
 HBRUSH16   CreateDIBPatternBrush(HGLOBAL16,UINT);
-HBITMAP16  CreateDIBitmap(HDC,BITMAPINFOHEADER*,DWORD,LPVOID,BITMAPINFO*,UINT);
+HBITMAP16  CreateDIBitmap(HDC16,BITMAPINFOHEADER*,DWORD,LPVOID,BITMAPINFO*,UINT);
 HBRUSH16   CreateHatchBrush(INT,COLORREF);
-HDC        CreateIC(LPCSTR,LPCSTR,LPCSTR,const DEVMODE*);
+HDC16      CreateIC(LPCSTR,LPCSTR,LPCSTR,const DEVMODE*);
 HICON16    CreateIcon(HINSTANCE16,INT,INT,BYTE,BYTE,const BYTE*,const BYTE*);
 HMENU16    CreateMenu(void);
 HPALETTE16 CreatePalette(const LOGPALETTE*);
@@ -4980,7 +4976,7 @@
 DWORD      DefHookProc(short,WORD,DWORD,HHOOK*);
 HDWP16     DeferWindowPos(HDWP16,HWND,HWND,INT,INT,INT,INT,UINT);
 ATOM       DeleteAtom(ATOM);
-BOOL       DeleteDC(HDC);
+BOOL       DeleteDC(HDC16);
 BOOL       DeleteMenu(HMENU16,UINT,UINT);
 BOOL       DeleteObject(HGDIOBJ16);
 BOOL       DestroyCursor(HCURSOR16);
@@ -4993,57 +4989,57 @@
 BOOL       DlgDirSelectComboBox(HWND,LPSTR,INT);
 BOOL16     DragDetect(HWND16,POINT16);
 DWORD      DragObject(HWND, HWND, WORD, HANDLE16, WORD, HCURSOR16);
-BOOL       DrawIcon(HDC,INT,INT,HICON16);
+BOOL       DrawIcon(HDC16,INT,INT,HICON16);
 void       DrawMenuBar(HWND);
 DWORD      DumpIcon(SEGPTR,WORD*,SEGPTR*,SEGPTR*);
-BOOL       Ellipse(HDC,INT,INT,INT,INT);
+BOOL       Ellipse(HDC16,INT,INT,INT,INT);
 BOOL       EmptyClipboard(void);
 BOOL       EnableMenuItem(HMENU16,UINT,UINT);
 BOOL       EnableWindow(HWND,BOOL);
 BOOL       EndDeferWindowPos(HDWP16);
 UINT16     EnumClipboardFormats(UINT16);
-INT        EnumFontFamilies(HDC,LPCSTR,FONTENUMPROC16,LPARAM);
-INT        EnumFonts(HDC,LPCSTR,FONTENUMPROC16,LPARAM);
-BOOL       EnumMetaFile(HDC,HMETAFILE16,MFENUMPROC16,LPARAM);
-INT        EnumObjects(HDC,INT,GOBJENUMPROC16,LPARAM);
-INT        Escape(HDC,INT,INT,SEGPTR,SEGPTR);
-int        ExcludeClipRect(HDC,short,short,short,short);
-int        ExcludeVisRect(HDC,short,short,short,short);
+INT        EnumFontFamilies(HDC16,LPCSTR,FONTENUMPROC16,LPARAM);
+INT        EnumFonts(HDC16,LPCSTR,FONTENUMPROC16,LPARAM);
+BOOL       EnumMetaFile(HDC16,HMETAFILE16,MFENUMPROC16,LPARAM);
+INT        EnumObjects(HDC16,INT,GOBJENUMPROC16,LPARAM);
+INT        Escape(HDC16,INT,INT,SEGPTR,SEGPTR);
+int        ExcludeClipRect(HDC16,short,short,short,short);
+int        ExcludeVisRect(HDC16,short,short,short,short);
 BOOL       ExitWindows(DWORD,WORD);
 HICON16    ExtractIcon(HINSTANCE16,LPCSTR,WORD);
 void       FatalAppExit(UINT,LPCSTR);
 void       FatalExit(int);
-BOOL       FillRgn(HDC,HRGN32,HBRUSH16);
+BOOL       FillRgn(HDC16,HRGN32,HBRUSH16);
 ATOM       FindAtom(SEGPTR);
 HINSTANCE16 FindExecutable(LPCSTR,LPCSTR,LPSTR);
 BOOL       FlashWindow(HWND,BOOL);
-BOOL       FrameRgn(HDC,HRGN32,HBRUSH16,int,int);
+BOOL       FrameRgn(HDC16,HRGN32,HBRUSH16,int,int);
 void       FreeLibrary(HINSTANCE16);
-UINT       GDIRealizePalette(HDC);
-HPALETTE16 GDISelectPalette(HDC,HPALETTE16,WORD);
+UINT       GDIRealizePalette(HDC16);
+HPALETTE16 GDISelectPalette(HDC16,HPALETTE16,WORD);
 HWND       GetActiveWindow(void);
-DWORD      GetAspectRatioFilter(HDC);
+DWORD      GetAspectRatioFilter(HDC16);
 int        GetAsyncKeyState(int);
 WORD       GetAtomName(ATOM,LPSTR,short);
-COLORREF   GetBkColor(HDC);
-WORD       GetBkMode(HDC);
-DWORD      GetBrushOrg(HDC);
-BOOL       GetCharABCWidths(HDC,UINT,UINT,LPABC16);
-BOOL       GetCharWidth(HDC,WORD,WORD,LPINT16);
-HRGN32     GetClipRgn(HDC);
+COLORREF   GetBkColor(HDC16);
+WORD       GetBkMode(HDC16);
+DWORD      GetBrushOrg(HDC16);
+BOOL       GetCharABCWidths(HDC16,UINT,UINT,LPABC16);
+BOOL       GetCharWidth(HDC16,WORD,WORD,LPINT16);
+HRGN32     GetClipRgn(HDC16);
 HANDLE16   GetClipboardData(WORD);
 int        GetClipboardFormatName(WORD,LPSTR,short);
 HWND       GetClipboardOwner(void);
 HWND       GetClipboardViewer(void);
-HBRUSH16   GetControlBrush(HWND,HDC,WORD);
-DWORD      GetCurrentPosition(HDC);
+HBRUSH16   GetControlBrush(HWND,HDC16,WORD);
+DWORD      GetCurrentPosition(HDC16);
 DWORD      GetCurrentTime(void);
 HCURSOR16  GetCursor(void);
-DWORD      GetDCOrg(HDC);
-HDC        GetDCState(HDC);
-int        GetDIBits(HDC,HBITMAP16,WORD,WORD,LPSTR,LPBITMAPINFO,WORD);
+DWORD      GetDCOrg(HDC16);
+HDC16      GetDCState(HDC16);
+int        GetDIBits(HDC16,HBITMAP16,WORD,WORD,LPSTR,LPBITMAPINFO,WORD);
 SEGPTR     GetDOSEnvironment(void);
-int        GetDeviceCaps(HDC,WORD);
+int        GetDeviceCaps(HDC16,WORD);
 DWORD      GetDialogBaseUnits(void);
 HWND       GetDlgItem(HWND,WORD);
 WORD       GetDlgItemInt(HWND,WORD,BOOL*,BOOL);
@@ -5053,13 +5049,13 @@
 DWORD      GetHeapSpaces(HMODULE16);
 BOOL       GetInputState(void);
 int        GetKBCodePage(void);
-int        GetKerningPairs(HDC,int,LPKERNINGPAIR16);
+int        GetKerningPairs(HDC16,int,LPKERNINGPAIR16);
 int        GetKeyNameText(LONG,LPSTR,int);
 INT        GetKeyState(INT);
 void       GetKeyboardState(BYTE*);
 int        GetKeyboardType(int);
 HWND       GetLastActivePopup(HWND);
-WORD       GetMapMode(HDC);
+WORD       GetMapMode(HDC16);
 HMENU16    GetMenu(HWND);
 DWORD      GetMenuCheckMarkDimensions(void);
 INT        GetMenuItemCount(HMENU16);
@@ -5075,13 +5071,13 @@
 INT16      GetModuleFileName(HINSTANCE16,LPSTR,INT16);
 HMODULE16  GetModuleHandle(LPCSTR);
 INT16      GetModuleUsage(HINSTANCE16);
-DWORD      GetNearestColor(HDC,DWORD);
+DWORD      GetNearestColor(HDC16,DWORD);
 WORD       GetNearestPaletteIndex(HPALETTE16,DWORD);
 HWND       GetNextWindow(HWND,WORD);
 HWND       GetOpenClipboardWindow(void);
 WORD       GetPaletteEntries(HPALETTE16,WORD,WORD,LPPALETTEENTRY);
-DWORD      GetPixel(HDC,short,short);
-WORD       GetPolyFillMode(HDC);
+DWORD      GetPixel(HDC16,short,short);
+WORD       GetPolyFillMode(HDC16);
 int        GetPriorityClipboardFormat(WORD*,short);
 UINT       GetPrivateProfileInt(LPCSTR,LPCSTR,INT,LPCSTR);
 INT        GetPrivateProfileString(LPCSTR,LPCSTR,LPCSTR,LPSTR,INT,LPCSTR);
@@ -5089,47 +5085,47 @@
 INT        GetProfileString(LPCSTR,LPCSTR,LPCSTR,LPSTR,INT);
 DWORD      GetQueueStatus(UINT);
 BOOL       GetRasterizerCaps(LPRASTERIZER_STATUS,UINT);
-WORD       GetROP2(HDC);
-WORD       GetRelAbs(HDC);
+WORD       GetROP2(HDC16);
+WORD       GetRelAbs(HDC16);
 HGDIOBJ16  GetStockObject(INT16);
-WORD       GetStretchBltMode(HDC);
+WORD       GetStretchBltMode(HDC16);
 HMENU16    GetSubMenu(HMENU16,short);
 HMENU16    GetSystemMenu(HWND,BOOL);
 int        GetSystemMetrics(WORD);
-WORD       GetSystemPaletteEntries(HDC,WORD,WORD,LPPALETTEENTRY);
-WORD       GetSystemPaletteUse(HDC);
-DWORD      GetTabbedTextExtent(HDC,LPSTR,int,int,LPINT16);
+WORD       GetSystemPaletteEntries(HDC16,WORD,WORD,LPPALETTEENTRY);
+WORD       GetSystemPaletteUse(HDC16);
+DWORD      GetTabbedTextExtent(HDC16,LPSTR,int,int,LPINT16);
 BYTE       GetTempDrive(BYTE);
-WORD       GetTextAlign(HDC);
-short      GetTextCharacterExtra(HDC);
-COLORREF   GetTextColor(HDC);
-DWORD      GetTextExtent(HDC,LPCSTR,short);
-INT        GetTextFace(HDC,INT,LPSTR);
+WORD       GetTextAlign(HDC16);
+short      GetTextCharacterExtra(HDC16);
+COLORREF   GetTextColor(HDC16);
+DWORD      GetTextExtent(HDC16,LPCSTR,short);
+INT        GetTextFace(HDC16,INT,LPSTR);
 LPINT16    GetThresholdEvent(void);
 int        GetThresholdStatus(void);
 HWND       GetTopWindow(HWND);
-DWORD      GetViewportExt(HDC);
-DWORD      GetViewportOrg(HDC);
+DWORD      GetViewportExt(HDC16);
+DWORD      GetViewportOrg(HDC16);
 BOOL       GetWinDebugInfo(LPWINDEBUGINFO,UINT);
 LONG       GetWinFlags(void);
 HWND       GetWindow(HWND,WORD);
-DWORD      GetWindowExt(HDC);
-DWORD      GetWindowOrg(HDC);
+DWORD      GetWindowExt(HDC16);
+DWORD      GetWindowOrg(HDC16);
 int        GetWindowTextLength(HWND);
 ATOM       GlobalDeleteAtom(ATOM);
 void       GlobalFix(HGLOBAL16);
 BOOL16     GlobalUnWire(HGLOBAL16);
 void       GlobalUnfix(HGLOBAL16);
 SEGPTR     GlobalWire(HGLOBAL16);
-BOOL       GrayString(HDC,HBRUSH16,GRAYSTRINGPROC16,LPARAM,INT,INT,INT,INT,INT);
+BOOL       GrayString(HDC16,HBRUSH16,GRAYSTRINGPROC16,LPARAM,INT,INT,INT,INT,INT);
 BOOL       HiliteMenuItem(HWND,HMENU16,UINT,UINT);
 BOOL       InSendMessage(void);
 WORD       InitAtomTable(WORD);
-HRGN32     InquireVisRgn(HDC);
-int        IntersectClipRect(HDC,short,short,short,short);
-int        IntersectVisRect(HDC,short,short,short,short);
+HRGN32     InquireVisRgn(HDC16);
+int        IntersectClipRect(HDC16,short,short,short,short);
+int        IntersectVisRect(HDC16,short,short,short,short);
 void       InvalidateRgn(HWND32,HRGN32,BOOL32);
-BOOL       InvertRgn(HDC,HRGN32);
+BOOL       InvertRgn(HDC16,HRGN32);
 BOOL       IsChild(HWND,HWND);
 BOOL       IsClipboardFormatAvailable(WORD);
 BOOL       IsDialogMessage(HWND,LPMSG16);
@@ -5141,7 +5137,7 @@
 BOOL       IsWindowEnabled(HWND);
 BOOL       IsWindowVisible(HWND);
 BOOL       IsZoomed(HWND);
-BOOL       LineTo(HDC,short,short);
+BOOL       LineTo(HDC16,short,short);
 HINSTANCE16 LoadLibrary(LPCSTR);
 HINSTANCE16 LoadModule(LPCSTR,LPVOID);
 FARPROC16  LocalNotify(FARPROC16);
@@ -5149,21 +5145,21 @@
 WORD       MapVirtualKey(WORD,WORD);
 void       MessageBeep(WORD);
 int        MessageBox(HWND,LPCSTR,LPCSTR,WORD);
-DWORD      MoveTo(HDC,short,short);
+DWORD      MoveTo(HDC16,short,short);
 BOOL       MoveWindow(HWND,short,short,short,short,BOOL);
 DWORD      OemKeyScan(WORD);
 BOOL       OemToAnsi(LPCSTR,LPSTR);
 void       OemToAnsiBuff(LPCSTR,LPSTR,INT);
-int        OffsetClipRgn(HDC,short,short);
+int        OffsetClipRgn(HDC16,short,short);
 BOOL       OpenClipboard(HWND);
 BOOL       OpenIcon(HWND);
 int        OpenSound(void);
 void       OutputDebugString(LPCSTR);
-BOOL       PaintRgn(HDC,HRGN32);
-BOOL       PatBlt(HDC,short,short,short,short,DWORD);
-BOOL       Pie(HDC,INT,INT,INT,INT,INT,INT,INT,INT);
-BOOL       PlayMetaFile(HDC,HMETAFILE16);
-void       PlayMetaFileRecord(HDC,LPHANDLETABLE16,LPMETARECORD,WORD);
+BOOL       PaintRgn(HDC16,HRGN32);
+BOOL       PatBlt(HDC16,short,short,short,short,DWORD);
+BOOL       Pie(HDC16,INT,INT,INT,INT,INT,INT,INT,INT);
+BOOL       PlayMetaFile(HDC16,HMETAFILE16);
+void       PlayMetaFileRecord(HDC16,LPHANDLETABLE16,LPMETARECORD,WORD);
 BOOL       PostMessage(HWND,WORD,WORD,LONG);
 void       PostQuitMessage(INT);
 void       ProfClear(void);
@@ -5174,30 +5170,30 @@
 void       ProfSetup(int,int);
 void       ProfStart(void);
 void       ProfStop(void);
-BOOL       PtVisible(HDC,short,short);
-WORD       RealizeDefaultPalette(HDC);
-BOOL       Rectangle(HDC,INT,INT,INT,INT);
+BOOL       PtVisible(HDC16,short,short);
+WORD       RealizeDefaultPalette(HDC16);
+BOOL       Rectangle(HDC16,INT,INT,INT,INT);
 WORD       RegisterClipboardFormat(LPCSTR);
 BOOL       RemoveFontResource(LPSTR);
 BOOL       RemoveMenu(HMENU16,UINT,UINT);
 void       ReplyMessage(LRESULT);
-HDC        ResetDC(HDC,LPVOID);
+HDC16      ResetDC(HDC16,LPVOID);
 BOOL       ResizePalette(HPALETTE16,UINT);
-BOOL       RestoreDC(HDC,short);
-int        RestoreVisRgn(HDC);
-BOOL       RoundRect(HDC,INT,INT,INT,INT,INT,INT);
-int        SaveDC(HDC);
-HRGN32     SaveVisRgn(HDC);
-void       ScrollChildren(HWND,UINT,WPARAM,LPARAM);
-BOOL       ScrollDC(HDC,short,short,LPRECT16,LPRECT16,HRGN32,LPRECT16);
+BOOL       RestoreDC(HDC16,short);
+int        RestoreVisRgn(HDC16);
+BOOL       RoundRect(HDC16,INT,INT,INT,INT,INT,INT);
+int        SaveDC(HDC16);
+HRGN32     SaveVisRgn(HDC16);
+void       ScrollChildren(HWND,UINT,WPARAM16,LPARAM);
+BOOL       ScrollDC(HDC16,short,short,LPRECT16,LPRECT16,HRGN32,LPRECT16);
 void       ScrollWindow(HWND,short,short,LPRECT16,LPRECT16);
 int        ScrollWindowEx(HWND,short,short,LPRECT16,LPRECT16,HRGN32,LPRECT16,WORD);
-int        SelectClipRgn(HDC,HRGN32);
-HGDIOBJ16  SelectObject(HDC,HGDIOBJ16);
-HPALETTE16 SelectPalette(HDC,HPALETTE16,BOOL);
-int        SelectVisRgn(HDC,HRGN32);
+int        SelectClipRgn(HDC16,HRGN32);
+HGDIOBJ16  SelectObject(HDC16,HGDIOBJ16);
+HPALETTE16 SelectPalette(HDC16,HPALETTE16,BOOL);
+int        SelectVisRgn(HDC16,HRGN32);
 HWND       SetActiveWindow(HWND);
-WORD       SetBkMode(HDC,WORD);
+WORD       SetBkMode(HDC16,WORD);
 HANDLE16   SetClipboardData(WORD,HANDLE16);
 HWND       SetClipboardViewer(HWND);
 void       SetConvertHook(BOOL);
@@ -5205,33 +5201,33 @@
 BOOL32     SetCurrentDirectory(LPCSTR);
 HCURSOR16  SetCursor(HCURSOR16);
 void       SetCursorPos(short,short);
-void       SetDCState(HDC,HDC);
+void       SetDCState(HDC16,HDC16);
 void       SetDoubleClickTime(WORD);
 int        SetEnvironment(LPCSTR,LPCSTR,WORD);
 UINT       SetErrorMode(UINT);
-WORD       SetHookFlags(HDC,WORD);
+WORD       SetHookFlags(HDC16,WORD);
 void       SetKeyboardState(BYTE*);
-WORD       SetMapMode(HDC,WORD);
-DWORD      SetMapperFlags(HDC,DWORD);
+WORD       SetMapMode(HDC16,WORD);
+DWORD      SetMapperFlags(HDC16,DWORD);
 BOOL       SetMenu(HWND,HMENU16);
 BOOL       SetMenuItemBitmaps(HMENU16,UINT,UINT,HBITMAP16,HBITMAP16);
 BOOL       SetMessageQueue(int);
 HMETAFILE16 SetMetaFileBits(HGLOBAL16);
 WORD       SetPaletteEntries(HPALETTE16,WORD,WORD,LPPALETTEENTRY);
 HWND       SetParent(HWND,HWND);
-COLORREF   SetPixel(HDC,short,short,COLORREF);
-WORD       SetPolyFillMode(HDC,WORD);
-WORD       SetROP2(HDC,WORD);
-WORD       SetRelAbs(HDC,WORD);
+COLORREF   SetPixel(HDC16,short,short,COLORREF);
+WORD       SetPolyFillMode(HDC16,WORD);
+WORD       SetROP2(HDC16,WORD);
+WORD       SetRelAbs(HDC16,WORD);
 FARPROC16  SetResourceHandler(HINSTANCE16,LPSTR,FARPROC16);
 int        SetSoundNoise(int,int);
-WORD       SetStretchBltMode(HDC,WORD);
+WORD       SetStretchBltMode(HDC16,WORD);
 LONG       SetSwapAreaSize(WORD);
 void       SetSysColors(int,LPINT16,COLORREF*);
-WORD       SetSystemPaletteUse(HDC,WORD);
-WORD       SetTextAlign(HDC,WORD);
-short      SetTextCharacterExtra(HDC,short);
-short      SetTextJustification(HDC,short,short);
+WORD       SetSystemPaletteUse(HDC16,WORD);
+WORD       SetTextAlign(HDC16,WORD);
+short      SetTextCharacterExtra(HDC16,short);
+short      SetTextJustification(HDC16,short,short);
 int        SetVoiceAccent(int,int,int,int,int);
 int        SetVoiceEnvelope(int,int,int);
 int        SetVoiceNote(int,int,int,int);
@@ -5247,19 +5243,19 @@
 DWORD      SizeofResource(HMODULE16,HRSRC16);
 int        StartSound(void);
 int        StopSound(void);
-BOOL       StretchBlt(HDC,short,short,short,short,HDC,short,short,short,short,DWORD);
-int        StretchDIBits(HDC,WORD,WORD,WORD,WORD,WORD,WORD,WORD,WORD,LPSTR,LPBITMAPINFO,WORD,DWORD);
+BOOL       StretchBlt(HDC16,short,short,short,short,HDC16,short,short,short,short,DWORD);
+int        StretchDIBits(HDC16,WORD,WORD,WORD,WORD,WORD,WORD,WORD,WORD,LPSTR,LPBITMAPINFO,WORD,DWORD);
 BOOL       SwapMouseButton(BOOL);
 void       SwapRecording(WORD);
 int        SyncAllVoices(void);
 BOOL       SystemParametersInfo(UINT,UINT,LPVOID,UINT);
-LONG       TabbedTextOut(HDC,short,short,LPSTR,short,short,LPINT16,short);
+LONG       TabbedTextOut(HDC16,short,short,LPSTR,short,short,LPINT16,short);
 int        ToAscii(WORD,WORD,LPSTR,LPVOID,WORD);
 INT16      TranslateAccelerator(HWND,HACCEL16,LPMSG16);
 BOOL       TranslateMDISysAccel(HWND,LPMSG16);
 BOOL       TranslateMessage(LPMSG16);
 BOOL       UnrealizeObject(HGDIOBJ16);
-int        UpdateColors(HDC);
+int        UpdateColors(HDC16);
 void       ValidateCodeSegments(void);
 LPSTR      ValidateFreeSpaces(void);
 void       ValidateRgn(HWND32,HRGN32);
diff --git a/include/x11drv.h b/include/x11drv.h
index 9ee3943..eea87db 100644
--- a/include/x11drv.h
+++ b/include/x11drv.h
@@ -52,5 +52,6 @@
 
 extern BOOL32 X11DRV_GetTextExtentPoint( struct tagDC *dc, LPCSTR str,
                                          INT32 count, LPSIZE32 size );
+extern VOID X11DRV_SetDeviceClipping(struct tagDC *dc);
 
 #endif  /* __WINE_X11DRV_H */
diff --git a/library/miscstubs.c b/library/miscstubs.c
index 9bce0ee..45f8bd7 100644
--- a/library/miscstubs.c
+++ b/library/miscstubs.c
@@ -41,23 +41,23 @@
   }
 }
 
-extern LRESULT AboutDlgProc(HWND,UINT,WPARAM,LPARAM);
-extern LRESULT ColorDlgProc(HWND,UINT,WPARAM,LPARAM);
-extern LRESULT ComboBoxWndProc(HWND,UINT,WPARAM,LPARAM);
-extern LRESULT ComboLBoxWndProc(HWND,UINT,WPARAM,LPARAM);
-extern LRESULT EditWndProc(HWND,UINT,WPARAM,LPARAM);
-extern LRESULT FileOpenDlgProc(HWND,UINT,WPARAM,LPARAM);
-extern LRESULT FileSaveDlgProc(HWND,UINT,WPARAM,LPARAM);
-extern LRESULT FindTextDlgProc(HWND,UINT,WPARAM,LPARAM);
-extern LRESULT ListBoxWndProc(HWND,UINT,WPARAM,LPARAM);
-extern LRESULT MDIClientWndProc(HWND,UINT,WPARAM,LPARAM);
-extern LRESULT PopupMenuWndProc(HWND,UINT,WPARAM,LPARAM);
-extern LRESULT PrintDlgProc(HWND,UINT,WPARAM,LPARAM);
-extern LRESULT PrintSetupDlgProc(HWND,UINT,WPARAM,LPARAM);
-extern LRESULT ReplaceTextDlgProc(HWND,UINT,WPARAM,LPARAM);
-extern LRESULT ScrollBarWndProc(HWND,UINT,WPARAM,LPARAM);
-extern LRESULT StaticWndProc(HWND,UINT,WPARAM,LPARAM);
-extern LRESULT SystemMessageBoxProc(HWND,UINT,WPARAM,LPARAM);
+extern LRESULT AboutDlgProc(HWND,UINT,WPARAM16,LPARAM);
+extern LRESULT ColorDlgProc(HWND,UINT,WPARAM16,LPARAM);
+extern LRESULT ComboBoxWndProc(HWND,UINT,WPARAM16,LPARAM);
+extern LRESULT ComboLBoxWndProc(HWND,UINT,WPARAM16,LPARAM);
+extern LRESULT EditWndProc(HWND,UINT,WPARAM16,LPARAM);
+extern LRESULT FileOpenDlgProc(HWND,UINT,WPARAM16,LPARAM);
+extern LRESULT FileSaveDlgProc(HWND,UINT,WPARAM16,LPARAM);
+extern LRESULT FindTextDlgProc(HWND,UINT,WPARAM16,LPARAM);
+extern LRESULT ListBoxWndProc(HWND,UINT,WPARAM16,LPARAM);
+extern LRESULT MDIClientWndProc(HWND,UINT,WPARAM16,LPARAM);
+extern LRESULT PopupMenuWndProc(HWND,UINT,WPARAM16,LPARAM);
+extern LRESULT PrintDlgProc(HWND,UINT,WPARAM16,LPARAM);
+extern LRESULT PrintSetupDlgProc(HWND,UINT,WPARAM16,LPARAM);
+extern LRESULT ReplaceTextDlgProc(HWND,UINT,WPARAM16,LPARAM);
+extern LRESULT ScrollBarWndProc(HWND,UINT,WPARAM16,LPARAM);
+extern LRESULT StaticWndProc(HWND,UINT,WPARAM16,LPARAM);
+extern LRESULT SystemMessageBoxProc(HWND,UINT,WPARAM16,LPARAM);
 extern LRESULT TASK_Reschedule(void);
 
 /***********************************************************************
diff --git a/libtest/Makefile.in b/libtest/Makefile.in
index 6f050d6..32d3936 100644
--- a/libtest/Makefile.in
+++ b/libtest/Makefile.in
@@ -10,11 +10,13 @@
 	hello.c \
 	hello2.c \
 	hello3.c \
-	hello3res.c \
 	hello4.c \
 	new.c \
 	rolex.c
 
+GEN_C_SRCS = \
+	hello3res.c
+
 all: check_winerc $(PROGRAMS)
 
 @MAKE_RULES@
@@ -37,9 +39,6 @@
 rolex: rolex.o
 	$(CC) -o rolex rolex.o $(LDOPTIONS) $(ALL_LIBS)
 
-clean::
-	$(RM) $(PROGRAMS) hello3res.c hello3res.h
-
 hello3res.c hello3res.h: $(WINERC)
 
 ### Dependencies:
diff --git a/misc/clipboard.c b/misc/clipboard.c
index 5bd3544..32b89c6 100644
--- a/misc/clipboard.c
+++ b/misc/clipboard.c
@@ -359,7 +359,8 @@
 {
  if( lpFormat->wDataPresent && !lpFormat->hData )
    if( IsWindow(hWndClipOwner) )
-       SendMessage16(hWndClipOwner,WM_RENDERFORMAT,(WPARAM)lpFormat->wFormatID,0L);
+       SendMessage16(hWndClipOwner,WM_RENDERFORMAT,
+                     (WPARAM16)lpFormat->wFormatID,0L);
    else
    {
        dprintf_clipboard(stddeb,"\thWndClipOwner (%04x) is lost!\n", 
@@ -633,7 +634,8 @@
     dprintf_clipboard(stdnimp, "ChangeClipboardChain(%04x, %04x)\n", hWnd, hWndNext);
 
     if( hWndViewer )
-      bRet = !SendMessage16( hWndViewer, WM_CHANGECBCHAIN, (WPARAM)hWnd, (LPARAM)hWndNext);   
+      bRet = !SendMessage16( hWndViewer, WM_CHANGECBCHAIN,
+                             (WPARAM16)hWnd, (LPARAM)hWndNext);   
     else
       dprintf_clipboard(stddeb,"ChangeClipboardChain: hWndViewer is lost\n");
 
diff --git a/misc/commdlg.c b/misc/commdlg.c
index aacfc81..ec93f7c 100644
--- a/misc/commdlg.c
+++ b/misc/commdlg.c
@@ -214,14 +214,14 @@
 /***********************************************************************
  *                              FILEDLG_WMDrawItem              [internal]
  */
-static LONG FILEDLG_WMDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam,int savedlg)
+static LONG FILEDLG_WMDrawItem(HWND hWnd, WPARAM16 wParam, LPARAM lParam,int savedlg)
 {
     LPDRAWITEMSTRUCT16 lpdis = (LPDRAWITEMSTRUCT16)PTR_SEG_TO_LIN(lParam);
     char *str;
     HBRUSH16 hBrush;
     HBITMAP16 hBitmap, hPrevBitmap;
     BITMAP16 bm;
-    HDC hMemDC;
+    HDC16 hMemDC;
 
     if (lpdis->CtlType == ODT_LISTBOX && lpdis->CtlID == lst1)
     {
@@ -306,7 +306,7 @@
 /***********************************************************************
  *                              FILEDLG_WMMeasureItem           [internal]
  */
-static LONG FILEDLG_WMMeasureItem(HWND hWnd, WPARAM wParam, LPARAM lParam) 
+static LONG FILEDLG_WMMeasureItem(HWND hWnd, WPARAM16 wParam, LPARAM lParam) 
 {
     BITMAP16 bm;
     LPMEASUREITEMSTRUCT16 lpmeasure;
@@ -333,7 +333,7 @@
  *                              FILEDLG_WMInitDialog            [internal]
  */
 
-static LONG FILEDLG_WMInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam) 
+static LONG FILEDLG_WMInitDialog(HWND hWnd, WPARAM16 wParam, LPARAM lParam) 
 {
   int i, n;
   LPOPENFILENAME lpofn;
@@ -422,7 +422,7 @@
 /***********************************************************************
  *                              FILEDLG_WMCommand               [internal]
  */
-static LRESULT FILEDLG_WMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) 
+static LRESULT FILEDLG_WMCommand(HWND hWnd, WPARAM16 wParam, LPARAM lParam) 
 {
   LONG lRet;
   LPOPENFILENAME lpofn;
@@ -614,7 +614,7 @@
 /***********************************************************************
  *           FileOpenDlgProc   (COMMDLG.6)
  */
-LRESULT FileOpenDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam)
+LRESULT FileOpenDlgProc(HWND hWnd, UINT wMsg, WPARAM16 wParam, LPARAM lParam)
 {  
  LPOPENFILENAME lpofn = (LPOPENFILENAME)PTR_SEG_TO_LIN(GetWindowLong32A(hWnd, DWL_USER));
  
@@ -637,14 +637,14 @@
       return FILEDLG_WMCommand(hWnd, wParam, lParam);
 #if 0
     case WM_CTLCOLOR:
-      SetBkColor((HDC)wParam, 0x00C0C0C0);
+      SetBkColor((HDC16)wParam, 0x00C0C0C0);
       switch (HIWORD(lParam))
 	{
 	case CTLCOLOR_BTN:
-	  SetTextColor((HDC)wParam, 0x00000000);
+	  SetTextColor((HDC16)wParam, 0x00000000);
 	  return hGRAYBrush;
 	case CTLCOLOR_STATIC:
-	  SetTextColor((HDC)wParam, 0x00000000);
+	  SetTextColor((HDC16)wParam, 0x00000000);
 	  return hGRAYBrush;
 	}
       break;
@@ -657,7 +657,7 @@
 /***********************************************************************
  *           FileSaveDlgProc   (COMMDLG.7)
  */
-LRESULT FileSaveDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam)
+LRESULT FileSaveDlgProc(HWND hWnd, UINT wMsg, WPARAM16 wParam, LPARAM lParam)
 {
  LPOPENFILENAME lpofn = (LPOPENFILENAME)PTR_SEG_TO_LIN(GetWindowLong32A(hWnd, DWL_USER));
  
@@ -684,14 +684,14 @@
   
   /*
   case WM_CTLCOLOR:
-   SetBkColor((HDC)wParam, 0x00C0C0C0);
+   SetBkColor((HDC16)wParam, 0x00C0C0C0);
    switch (HIWORD(lParam))
    {
     case CTLCOLOR_BTN:
-     SetTextColor((HDC)wParam, 0x00000000);
+     SetTextColor((HDC16)wParam, 0x00000000);
      return hGRAYBrush;
     case CTLCOLOR_STATIC:
-     SetTextColor((HDC)wParam, 0x00000000);
+     SetTextColor((HDC16)wParam, 0x00000000);
      return hGRAYBrush;
    }
    return FALSE;
@@ -764,7 +764,7 @@
 /***********************************************************************
  *                              FINDDLG_WMInitDialog            [internal]
  */
-static LRESULT FINDDLG_WMInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
+static LRESULT FINDDLG_WMInitDialog(HWND hWnd, WPARAM16 wParam, LPARAM lParam)
 {
     LPFINDREPLACE lpfr;
 
@@ -809,7 +809,7 @@
 /***********************************************************************
  *                              FINDDLG_WMCommand               [internal]
  */
-static LRESULT FINDDLG_WMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
+static LRESULT FINDDLG_WMCommand(HWND hWnd, WPARAM16 wParam, LPARAM lParam)
 {
     LPFINDREPLACE lpfr;
     int uFindReplaceMessage = RegisterWindowMessage32A( FINDMSGSTRING );
@@ -852,7 +852,7 @@
 /***********************************************************************
  *           FindTextDlgProc   (COMMDLG.13)
  */
-LRESULT FindTextDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam)
+LRESULT FindTextDlgProc(HWND hWnd, UINT wMsg, WPARAM16 wParam, LPARAM lParam)
 {
     switch (wMsg) {
 	case WM_INITDIALOG:
@@ -867,7 +867,7 @@
 /***********************************************************************
  *                              REPLACEDLG_WMInitDialog         [internal]
  */
-static LRESULT REPLACEDLG_WMInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
+static LRESULT REPLACEDLG_WMInitDialog(HWND hWnd, WPARAM16 wParam, LPARAM lParam)
 {
     LPFINDREPLACE lpfr;
 
@@ -903,7 +903,7 @@
 /***********************************************************************
  *                              REPLACEDLG_WMCommand            [internal]
  */
-static LRESULT REPLACEDLG_WMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
+static LRESULT REPLACEDLG_WMCommand(HWND hWnd, WPARAM16 wParam, LPARAM lParam)
 {
     LPFINDREPLACE lpfr;
     int uFindReplaceMessage = RegisterWindowMessage32A( FINDMSGSTRING );
@@ -972,7 +972,7 @@
 /***********************************************************************
  *           ReplaceTextDlgProc   (COMMDLG.14)
  */
-LRESULT ReplaceTextDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam)
+LRESULT ReplaceTextDlgProc(HWND hWnd, UINT wMsg, WPARAM16 wParam, LPARAM lParam)
 {
     switch (wMsg) {
 	case WM_INITDIALOG:
@@ -1018,7 +1018,7 @@
 /***********************************************************************
  *           PrintDlgProc   (COMMDLG.21)
  */
-LRESULT PrintDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam)
+LRESULT PrintDlgProc(HWND hWnd, UINT wMsg, WPARAM16 wParam, LPARAM lParam)
 {
   switch (wMsg)
     {
@@ -1045,7 +1045,7 @@
 /***********************************************************************
  *           PrintSetupDlgProc   (COMMDLG.22)
  */
-LRESULT PrintSetupDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam)
+LRESULT PrintSetupDlgProc(HWND hWnd, UINT wMsg, WPARAM16 wParam, LPARAM lParam)
 {
   switch (wMsg)
     {
@@ -1176,7 +1176,7 @@
 {
  LPCHOOSECOLOR lpcc;  /* points to public known data structure */
  int nextuserdef;     /* next free place in user defined color array */
- HDC hdcMem;          /* color graph used for BitBlt() */
+ HDC16 hdcMem;        /* color graph used for BitBlt() */
  HBITMAP16 hbmMem;    /* color graph bitmap */    
  RECT16 fullsize;     /* original dialog window size */
  UINT msetrgb;        /* # of SETRGBSTRING message (today not used)  */
@@ -1866,7 +1866,7 @@
 /***********************************************************************
  *                            CC_WMInitDialog                 [internal]
  */
-static LONG CC_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam) 
+static LONG CC_WMInitDialog(HWND hDlg, WPARAM16 wParam, LPARAM lParam) 
 {
    int i,res;
    HWND hwnd;
@@ -1936,7 +1936,7 @@
 /***********************************************************************
  *                              CC_WMCommand                  [internal]
  */
-static LRESULT CC_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam) 
+static LRESULT CC_WMCommand(HWND hDlg, WPARAM16 wParam, LPARAM lParam) 
 {
     int r,g,b,i,xx;
     UINT cokmsg;
@@ -2063,7 +2063,7 @@
 /***********************************************************************
  *                              CC_WMPaint                    [internal]
  */
-static LRESULT CC_WMPaint(HWND hDlg, WPARAM wParam, LPARAM lParam) 
+static LRESULT CC_WMPaint(HWND hDlg, WPARAM16 wParam, LPARAM lParam) 
 {
     struct CCPRIVATE * lpp=(struct CCPRIVATE *)GetWindowLong32A(hDlg, DWL_USER); 
     /* we have to paint dialog children except text and buttons */
@@ -2090,7 +2090,7 @@
 /***********************************************************************
  *                              CC_WMLButtonDown              [internal]
  */
-static LRESULT CC_WMLButtonDown(HWND hDlg, WPARAM wParam, LPARAM lParam) 
+static LRESULT CC_WMLButtonDown(HWND hDlg, WPARAM16 wParam, LPARAM lParam) 
 {
    struct CCPRIVATE * lpp=(struct CCPRIVATE *)GetWindowLong32A(hDlg, DWL_USER); 
    int r,g,b,i;
@@ -2139,7 +2139,7 @@
  *           ColorDlgProc   (COMMDLG.8)
  */
 LRESULT ColorDlgProc(HWND hDlg, UINT message,
-			 UINT wParam, LONG lParam)
+                     WPARAM16 wParam, LONG lParam)
 {
  int res;
  struct CCPRIVATE * lpp=(struct CCPRIVATE *)GetWindowLong32A(hDlg, DWL_USER); 
@@ -2302,7 +2302,7 @@
  *
  * Fill font style information into combobox  (without using font.c directly)
  */
-static int SetFontStylesToCombo2(HWND hwnd, HDC hdc, LPLOGFONT16 lplf,
+static int SetFontStylesToCombo2(HWND hwnd, HDC16 hdc, LPLOGFONT16 lplf,
                                  LPTEXTMETRIC16 lptm)
 {
    #define FSTYLES 4
@@ -2402,7 +2402,7 @@
 
   if (!SendMessage16(hcmb2,CB_GETCOUNT,0,0))
   {
-       HDC hdc= (lpcf->Flags & CF_PRINTERFONTS && lpcf->hDC) ? lpcf->hDC : GetDC32(hDlg);
+       HDC32 hdc= (lpcf->Flags & CF_PRINTERFONTS && lpcf->hDC) ? lpcf->hDC : GetDC32(hDlg);
        i=SetFontStylesToCombo2(hcmb2,hdc,lplf,lptm);
        if (!(lpcf->Flags & CF_PRINTERFONTS && lpcf->hDC))
          ReleaseDC32(hDlg,hdc);
@@ -2416,7 +2416,7 @@
 /***********************************************************************
  *           CFn_WMInitDialog                            [internal]
  */
-LRESULT CFn_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam)
+LRESULT CFn_WMInitDialog(HWND hDlg, WPARAM16 wParam, LPARAM lParam)
 {
   HDC32 hdc;
   int i,j,res,init=0;
@@ -2532,7 +2532,7 @@
 /***********************************************************************
  *           CFn_WMMeasureItem                           [internal]
  */
-LRESULT CFn_WMMeasureItem(HWND hDlg, WPARAM wParam, LPARAM lParam)
+LRESULT CFn_WMMeasureItem(HWND hDlg, WPARAM16 wParam, LPARAM lParam)
 {
   BITMAP16 bm;
   LPMEASUREITEMSTRUCT16 lpmi=PTR_SEG_TO_LIN((LPMEASUREITEMSTRUCT16)lParam);
@@ -2548,7 +2548,7 @@
 /***********************************************************************
  *           CFn_WMDrawItem                              [internal]
  */
-LRESULT CFn_WMDrawItem(HWND hDlg, WPARAM wParam, LPARAM lParam)
+LRESULT CFn_WMDrawItem(HWND hDlg, WPARAM16 wParam, LPARAM lParam)
 {
   HBRUSH16 hBrush;
   char *buffer;
@@ -2556,7 +2556,7 @@
   COLORREF cr;
   RECT16 rect;
 #if 0  
-  HDC hMemDC;
+  HDC16 hMemDC;
   int nFontType;
   HBITMAP16 hBitmap; /* for later TT usage */
 #endif  
@@ -2640,7 +2640,7 @@
 /***********************************************************************
  *           CFn_WMCtlColor                              [internal]
  */
-LRESULT CFn_WMCtlColor(HWND hDlg, WPARAM wParam, LPARAM lParam)
+LRESULT CFn_WMCtlColor(HWND hDlg, WPARAM16 wParam, LPARAM lParam)
 {
   LPCHOOSEFONT lpcf=(LPCHOOSEFONT)GetWindowLong32A(hDlg, DWL_USER); 
 
@@ -2656,12 +2656,12 @@
 /***********************************************************************
  *           CFn_WMCommand                               [internal]
  */
-LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam)
+LRESULT CFn_WMCommand(HWND hDlg, WPARAM16 wParam, LPARAM lParam)
 {
   HFONT16 hFont;
   int i,j;
   long l;
-  HDC hdc;
+  HDC16 hdc;
   LPCHOOSEFONT lpcf=(LPCHOOSEFONT)GetWindowLong32A(hDlg, DWL_USER); 
   LPLOGFONT16 lpxx=PTR_SEG_TO_LIN(lpcf->lpLogFont);
   
@@ -2793,7 +2793,7 @@
                     2. some CF_.. flags are not supported
                     3. some TType extensions
  */
-LRESULT FormatCharDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
+LRESULT FormatCharDlgProc(HWND hDlg, UINT message, WPARAM16 wParam, LPARAM lParam)
 {
   LPCHOOSEFONT lpcf=(LPCHOOSEFONT)GetWindowLong32A(hDlg, DWL_USER);  
   if (message!=WM_INITDIALOG)
diff --git a/misc/escape.c b/misc/escape.c
index 79ef0e4..ec06156 100644
--- a/misc/escape.c
+++ b/misc/escape.c
@@ -9,7 +9,7 @@
 #include "windows.h"
 #include "gdi.h"
 
-INT Escape( HDC hdc, INT nEscape, INT cbInput,
+INT Escape( HDC16 hdc, INT nEscape, INT cbInput,
             SEGPTR lpszInData, SEGPTR lpvOutData )
 {
     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
diff --git a/misc/olecli.c b/misc/olecli.c
index 7e53656..441f7b4 100644
--- a/misc/olecli.c
+++ b/misc/olecli.c
@@ -47,7 +47,7 @@
 /***********************************************************************
  *           OleIsDcMeta
  */
-BOOL OleIsDcMeta(HDC hdc)
+BOOL OleIsDcMeta(HDC16 hdc)
 {
 	dprintf_ole(stddeb,"OleIsDCMeta(%04x)\n",hdc);
 	return GDI_GetObjPtr( hdc, METAFILE_DC_MAGIC ) != 0;
diff --git a/misc/shell.c b/misc/shell.c
index 31637ea..90f89ca 100644
--- a/misc/shell.c
+++ b/misc/shell.c
@@ -351,7 +351,7 @@
 /*************************************************************************
  *				AboutDlgProc		[SHELL.33]
  */
-LRESULT AboutDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
+LRESULT AboutDlgProc(HWND hWnd, UINT msg, WPARAM16 wParam, LPARAM lParam)
 {
   char Template[512], AppTitle[512];
  
diff --git a/misc/winsocket.c b/misc/winsocket.c
index 5b496ce..1507a5e 100644
--- a/misc/winsocket.c
+++ b/misc/winsocket.c
@@ -1183,7 +1183,7 @@
 		}
 
 		result = PostMessage(message.hWnd, message.wMsg,
-				     (WPARAM)message.handle, message.lParam);
+				     (WPARAM16)message.handle, message.lParam);
 		if (result != FALSE) {
 			message_is_valid = 1;
 			break;
diff --git a/multimedia/mcistring.c b/multimedia/mcistring.c
index 7959c8c..219c3f8 100644
--- a/multimedia/mcistring.c
+++ b/multimedia/mcistring.c
@@ -345,7 +345,7 @@
 		FLAG1("shareable",MCI_OPEN_SHAREABLE);
 		if (!strcmp(keywords[i],"alias") && (i+1<nrofkeywords)) {
 			dwFlags |= MCI_OPEN_ALIAS;
-			pU->openParams.lpstrAlias=SEGPTR_GET(SEGPTR_STRDUP(keywords[i]));
+			pU->openParams.lpstrAlias=SEGPTR_GET(SEGPTR_STRDUP(keywords[i+1]));
 			i+=2;
 			continue;
 		}
diff --git a/objects/bitblt.c b/objects/bitblt.c
index 469b329..1bf8657 100644
--- a/objects/bitblt.c
+++ b/objects/bitblt.c
@@ -1287,7 +1287,7 @@
 /***********************************************************************
  *           PatBlt    (GDI.29)
  */
-BOOL PatBlt( HDC hdc, short left, short top,
+BOOL PatBlt( HDC16 hdc, short left, short top,
 	     short width, short height, DWORD rop)
 {
     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
@@ -1312,8 +1312,8 @@
 /***********************************************************************
  *           BitBlt    (GDI.34)
  */
-BOOL BitBlt( HDC hdcDst, INT xDst, INT yDst, INT width, INT height,
-	     HDC hdcSrc, INT xSrc, INT ySrc, DWORD rop )
+BOOL BitBlt( HDC16 hdcDst, INT xDst, INT yDst, INT width, INT height,
+	     HDC16 hdcSrc, INT xSrc, INT ySrc, DWORD rop )
 {
     DC *dcDst, *dcSrc;
 
@@ -1340,9 +1340,9 @@
 /***********************************************************************
  *           StretchBlt    (GDI.35)
  */
-BOOL StretchBlt( HDC hdcDst, short xDst, short yDst,
+BOOL StretchBlt( HDC16 hdcDst, short xDst, short yDst,
                  short widthDst, short heightDst,
-                 HDC hdcSrc, short xSrc, short ySrc,
+                 HDC16 hdcSrc, short xSrc, short ySrc,
                  short widthSrc, short heightSrc, DWORD rop )
 {
     DC *dcDst, *dcSrc;
diff --git a/objects/clipping.c b/objects/clipping.c
index eae9dbc..f5a7c27 100644
--- a/objects/clipping.c
+++ b/objects/clipping.c
@@ -18,29 +18,6 @@
      (dc)->hookProc( (dc)->hSelf, DCHC_INVALIDVISRGN, (dc)->dwHookData, 0 ); \
  } while(0)
 
-/***********************************************************************
- *           CLIPPING_SetDeviceClipping
- *
- * Set the clip region of the physical device.
- */
-static void CLIPPING_SetDeviceClipping( DC * dc )
-{
-    RGNOBJ *obj = (RGNOBJ *) GDI_GetObjPtr(dc->w.hGCClipRgn, REGION_MAGIC);
-    if (!obj)
-    {
-        fprintf( stderr, "SetDeviceClipping: Rgn is 0. Please report this.\n");
-        exit(1);
-    }
-    if (obj->xrgn)
-    {
-        XSetRegion( display, dc->u.x.gc, obj->xrgn );
-        XSetClipOrigin( display, dc->u.x.gc, dc->w.DCOrgX, dc->w.DCOrgY );
-    }
-    else  /* Clip everything */
-    {
-        XSetClipRectangles( display, dc->u.x.gc, 0, 0, NULL, 0, 0 );
-    }
-}
 
 
 /***********************************************************************
@@ -68,14 +45,14 @@
         CombineRgn( dc->w.hGCClipRgn, dc->w.hVisRgn, 0, RGN_COPY );
     else
         CombineRgn( dc->w.hGCClipRgn, dc->w.hClipRgn, dc->w.hVisRgn, RGN_AND );
-    CLIPPING_SetDeviceClipping( dc );
+    if (dc->funcs->pSetDeviceClipping) dc->funcs->pSetDeviceClipping( dc );
 }
 
 
 /***********************************************************************
  *           SelectClipRgn    (GDI.44)
  */
-int SelectClipRgn( HDC hdc, HRGN32 hrgn )
+int SelectClipRgn( HDC16 hdc, HRGN32 hrgn )
 {
     int retval;
     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
@@ -103,7 +80,7 @@
 /***********************************************************************
  *           SelectVisRgn    (GDI.105)
  */
-int SelectVisRgn( HDC hdc, HRGN32 hrgn )
+int SelectVisRgn( HDC16 hdc, HRGN32 hrgn )
 {
     int retval;
     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
@@ -122,7 +99,7 @@
 /***********************************************************************
  *           OffsetClipRgn    (GDI.32)
  */
-int OffsetClipRgn( HDC hdc, short x, short y )
+int OffsetClipRgn( HDC16 hdc, short x, short y )
 {
     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
     if (!dc) 
@@ -148,7 +125,7 @@
 /***********************************************************************
  *           OffsetVisRgn    (GDI.102)
  */
-int OffsetVisRgn( HDC hdc, short x, short y )
+int OffsetVisRgn( HDC16 hdc, short x, short y )
 {
     int retval;
     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
@@ -200,7 +177,7 @@
 /***********************************************************************
  *           ExcludeClipRect    (GDI.21)
  */
-int ExcludeClipRect( HDC hdc, short left, short top,
+int ExcludeClipRect( HDC16 hdc, short left, short top,
 		     short right, short bottom )
 {
     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
@@ -226,7 +203,7 @@
 /***********************************************************************
  *           IntersectClipRect    (GDI.22)
  */
-int IntersectClipRect( HDC hdc, short left, short top,
+int IntersectClipRect( HDC16 hdc, short left, short top,
 		       short right, short bottom )
 {
     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
@@ -292,7 +269,8 @@
 /***********************************************************************
  *           ExcludeVisRect    (GDI.73)
  */
-int ExcludeVisRect( HDC hdc, short left, short top, short right, short bottom )
+int ExcludeVisRect( HDC16 hdc, short left, short top,
+                    short right, short bottom )
 {
     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
     if (!dc) return ERROR;    
@@ -306,7 +284,7 @@
 /***********************************************************************
  *           IntersectVisRect    (GDI.98)
  */
-int IntersectVisRect( HDC hdc, short left, short top,
+int IntersectVisRect( HDC16 hdc, short left, short top,
                       short right, short bottom )
 {
     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
@@ -321,7 +299,7 @@
 /***********************************************************************
  *           PtVisible    (GDI.103)
  */
-BOOL PtVisible( HDC hdc, short x, short y )
+BOOL PtVisible( HDC16 hdc, short x, short y )
 {
     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
     if (!dc) return ERROR;    
@@ -396,7 +374,7 @@
 /***********************************************************************
  *           SaveVisRgn    (GDI.129)
  */
-HRGN32 SaveVisRgn( HDC hdc )
+HRGN32 SaveVisRgn( HDC16 hdc )
 {
     HRGN32 copy;
     RGNOBJ *obj, *copyObj;
@@ -426,7 +404,7 @@
 /***********************************************************************
  *           RestoreVisRgn    (GDI.130)
  */
-int RestoreVisRgn( HDC hdc )
+int RestoreVisRgn( HDC16 hdc )
 {
     HRGN32 saved;
     RGNOBJ *obj, *savedObj;
diff --git a/objects/cursoricon.c b/objects/cursoricon.c
index 064d02b..57875c4 100644
--- a/objects/cursoricon.c
+++ b/objects/cursoricon.c
@@ -608,10 +608,10 @@
 /***********************************************************************
  *           DrawIcon    (USER.84)
  */
-BOOL DrawIcon( HDC hdc, INT x, INT y, HICON16 hIcon )
+BOOL DrawIcon( HDC16 hdc, INT x, INT y, HICON16 hIcon )
 {
     CURSORICONINFO *ptr;
-    HDC hMemDC;
+    HDC16 hMemDC;
     HBITMAP16 hXorBits, hAndBits;
     COLORREF oldFg, oldBg;
 
diff --git a/objects/dc.c b/objects/dc.c
index f777779..215bc50 100644
--- a/objects/dc.c
+++ b/objects/dc.c
@@ -366,7 +366,7 @@
 /***********************************************************************
  *           GetDCState    (GDI.179)
  */
-HDC GetDCState( HDC hdc )
+HDC16 GetDCState( HDC16 hdc )
 {
     DC * newdc, * dc;
     HGDIOBJ16 handle;
@@ -381,7 +381,7 @@
     memcpy( &newdc->w, &dc->w, sizeof(dc->w) );
     memcpy( &newdc->u.x.pen, &dc->u.x.pen, sizeof(dc->u.x.pen) );
 
-    newdc->hSelf = (HDC)handle;
+    newdc->hSelf = (HDC32)handle;
     newdc->saveLevel = 0;
     newdc->w.flags |= DC_SAVED;
 
@@ -400,7 +400,7 @@
 /***********************************************************************
  *           SetDCState    (GDI.180)
  */
-void SetDCState( HDC hdc, HDC hdcs )
+void SetDCState( HDC16 hdc, HDC16 hdcs )
 {
     DC * dc, * dcs;
     HRGN32 hVisRgn, hClipRgn, hGCClipRgn;
@@ -439,9 +439,9 @@
 /***********************************************************************
  *           SaveDC    (GDI.30)
  */
-int SaveDC( HDC hdc )
+int SaveDC( HDC16 hdc )
 {
-    HDC hdcs;
+    HDC16 hdcs;
     DC * dc, * dcs;
 
     dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
@@ -464,7 +464,7 @@
 /***********************************************************************
  *           RestoreDC    (GDI.39)
  */
-BOOL RestoreDC( HDC hdc, short level )
+BOOL RestoreDC( HDC16 hdc, short level )
 {
     DC * dc, * dcs;
 
@@ -483,7 +483,7 @@
     
     while ((short)dc->saveLevel >= level)
     {
-	HDC hdcs = dc->header.hNext;
+	HDC16 hdcs = dc->header.hNext;
 	if (!(dcs = (DC *) GDI_GetObjPtr( hdcs, DC_MAGIC ))) return FALSE;
 	dc->header.hNext = dcs->header.hNext;
 	if ((short)--dc->saveLevel < level) SetDCState( hdc, hdcs );
@@ -496,7 +496,7 @@
 /***********************************************************************
  *           CreateDC    (GDI.53)
  */
-HDC CreateDC( LPCSTR driver, LPCSTR device, LPCSTR output, const DEVMODE* initData )
+HDC16 CreateDC( LPCSTR driver, LPCSTR device, LPCSTR output, const DEVMODE* initData )
 {
     DC * dc;
     const DC_FUNCTIONS *funcs;
@@ -524,7 +524,7 @@
 /***********************************************************************
  *           CreateIC    (GDI.153)
  */
-HDC CreateIC( LPCSTR driver, LPCSTR device, LPCSTR output, const DEVMODE* initData )
+HDC16 CreateIC( LPCSTR driver, LPCSTR device, LPCSTR output, const DEVMODE* initData )
 {
       /* Nothing special yet for ICs */
     return CreateDC( driver, device, output, initData );
@@ -534,7 +534,7 @@
 /***********************************************************************
  *           CreateCompatibleDC    (GDI.52)
  */
-HDC CreateCompatibleDC( HDC hdc )
+HDC16 CreateCompatibleDC( HDC16 hdc )
 {
     DC *dc, *origDC;
     HBITMAP16 hbitmap;
@@ -577,7 +577,7 @@
 /***********************************************************************
  *           DeleteDC    (GDI.68)
  */
-BOOL DeleteDC( HDC hdc )
+BOOL DeleteDC( HDC16 hdc )
 {
     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
     if (!dc) return FALSE;
@@ -587,7 +587,7 @@
     while (dc->saveLevel)
     {
 	DC * dcs;
-	HDC hdcs = dc->header.hNext;
+	HDC16 hdcs = dc->header.hNext;
 	if (!(dcs = (DC *) GDI_GetObjPtr( hdcs, DC_MAGIC ))) break;
 	dc->header.hNext = dcs->header.hNext;
 	dc->saveLevel--;
@@ -614,7 +614,7 @@
 /***********************************************************************
  *           ResetDC    (GDI.376)
  */
-HDC ResetDC( HDC hdc, /* DEVMODE */ void *devmode )
+HDC16 ResetDC( HDC16 hdc, /* DEVMODE */ void *devmode )
 {
     fprintf( stderr, "ResetDC: empty stub!\n" );
     return hdc;
@@ -624,7 +624,7 @@
 /***********************************************************************
  *           GetDeviceCaps    (GDI.80)
  */
-int GetDeviceCaps( HDC hdc, WORD cap )
+int GetDeviceCaps( HDC16 hdc, WORD cap )
 {
     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
     if (!dc) return 0;
@@ -684,7 +684,7 @@
 /***********************************************************************
  *           SetTextAlign    (GDI.346)
  */
-WORD SetTextAlign( HDC hdc, WORD textAlign )
+WORD SetTextAlign( HDC16 hdc, WORD textAlign )
 {
     WORD prevAlign;
     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
@@ -703,7 +703,7 @@
 /***********************************************************************
  *           GetDCOrg    (GDI.79)
  */
-DWORD GetDCOrg( HDC hdc )
+DWORD GetDCOrg( HDC16 hdc )
 {
     Window root;
     int x, y, w, h, border, depth;
@@ -720,7 +720,7 @@
 /***********************************************************************
  *           SetDCOrg    (GDI.117)
  */
-DWORD SetDCOrg( HDC hdc, short x, short y )
+DWORD SetDCOrg( HDC16 hdc, short x, short y )
 {
     DWORD prevOrg;
     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
@@ -764,7 +764,7 @@
 /***********************************************************************
  *           SetHookFlags       (GDI.192)
  */
-WORD SetHookFlags(HDC hDC, WORD flags)
+WORD SetHookFlags(HDC16 hDC, WORD flags)
 {
   DC* dc = (DC*)GDI_GetObjPtr( hDC, DC_MAGIC );
 
diff --git a/objects/dcvalues.c b/objects/dcvalues.c
index 9ce69c5..e32996a 100644
--- a/objects/dcvalues.c
+++ b/objects/dcvalues.c
@@ -10,7 +10,7 @@
 
 
 #define DC_GET_VAL( func_type, func_name, dc_field ) \
-func_type func_name( HDC hdc ) \
+func_type func_name( HDC16 hdc ) \
 { \
     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); \
     if (!dc) return 0; \
@@ -18,7 +18,7 @@
 }
 
 #define DC_GET_X_Y( func_type, func_name, ret_x, ret_y ) \
-func_type func_name( HDC hdc ) \
+func_type func_name( HDC16 hdc ) \
 { \
     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); \
     if (!dc) return 0; \
@@ -45,7 +45,7 @@
 }
 
 #define DC_SET_MODE( func_name, dc_field, min_val, max_val, meta_func ) \
-WORD func_name( HDC hdc, WORD mode ) \
+WORD func_name( HDC16 hdc, WORD mode ) \
 { \
     WORD prevMode; \
     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); \
diff --git a/objects/dib.c b/objects/dib.c
index 4f8dd6c..556e89f 100644
--- a/objects/dib.c
+++ b/objects/dib.c
@@ -621,13 +621,13 @@
 /***********************************************************************
  *           StretchDIBits    	(GDI.439)
  */
-int StretchDIBits( HDC hdc, 
-	WORD xDest, WORD yDest, WORD wDestWidth, WORD wDestHeight,
-	WORD xSrc, WORD ySrc, WORD wSrcWidth, WORD wSrcHeight,
-	LPSTR bits, LPBITMAPINFO info, WORD wUsage, DWORD dwRop )
+int StretchDIBits( HDC16 hdc, 
+                   WORD xDest, WORD yDest, WORD wDestWidth, WORD wDestHeight,
+                   WORD xSrc, WORD ySrc, WORD wSrcWidth, WORD wSrcHeight,
+                   LPSTR bits, LPBITMAPINFO info, WORD wUsage, DWORD dwRop )
 {
     HBITMAP16 hBitmap, hOldBitmap;
-    HDC hdcMem;
+    HDC16 hdcMem;
 
     hBitmap = CreateDIBitmap( hdc, &info->bmiHeader, CBM_INIT,
                               bits, info, wUsage );
@@ -724,7 +724,7 @@
 /***********************************************************************
  *           GetDIBits    (GDI.441)
  */
-int GetDIBits( HDC hdc, HBITMAP16 hbitmap, WORD startscan, WORD lines,
+int GetDIBits( HDC16 hdc, HBITMAP16 hbitmap, WORD startscan, WORD lines,
 	       LPSTR bits, BITMAPINFO * info, WORD coloruse )
 {
     DC * dc;
@@ -792,7 +792,7 @@
 /***********************************************************************
  *           CreateDIBitmap    (GDI.442)
  */
-HBITMAP16 CreateDIBitmap( HDC hdc, BITMAPINFOHEADER * header, DWORD init,
+HBITMAP16 CreateDIBitmap( HDC16 hdc, BITMAPINFOHEADER * header, DWORD init,
                           LPVOID bits, BITMAPINFO * data, UINT coloruse )
 {
     HBITMAP16 handle;
diff --git a/objects/font.c b/objects/font.c
index aca3874..d41a6e1 100644
--- a/objects/font.c
+++ b/objects/font.c
@@ -330,8 +330,9 @@
 /***********************************************************************
  *           GetGlyphOutLine    (GDI.309)
  */
-DWORD GetGlyphOutLine(HDC hdc, UINT uChar, UINT fuFormat, LPGLYPHMETRICS lpgm, 
-                      DWORD cbBuffer, LPSTR lpBuffer, LPMAT2 lpmat2) 
+DWORD GetGlyphOutLine( HDC16 hdc, UINT uChar, UINT fuFormat,
+                       LPGLYPHMETRICS lpgm, DWORD cbBuffer, LPSTR lpBuffer,
+                       LPMAT2 lpmat2) 
 {
     fprintf( stdnimp,"GetGlyphOutLine(%04x, '%c', %04x, %p, %ld, %p, %p) // - empty stub!\n",
              hdc, uChar, fuFormat, lpgm, cbBuffer, lpBuffer, lpmat2 );
@@ -685,7 +686,7 @@
 /***********************************************************************
  *           GetTextCharacterExtra    (GDI.89)
  */
-short GetTextCharacterExtra( HDC hdc )
+short GetTextCharacterExtra( HDC16 hdc )
 {
     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
     if (!dc) return 0;
@@ -697,7 +698,7 @@
 /***********************************************************************
  *           SetTextCharacterExtra    (GDI.8)
  */
-short SetTextCharacterExtra( HDC hdc, short extra )
+short SetTextCharacterExtra( HDC16 hdc, short extra )
 {
     short prev;
     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
@@ -712,7 +713,7 @@
 /***********************************************************************
  *           SetTextJustification    (GDI.10)
  */
-short SetTextJustification( HDC hdc, short extra, short breaks )
+short SetTextJustification( HDC16 hdc, short extra, short breaks )
 {
     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
     if (!dc) return 0;
@@ -738,7 +739,7 @@
 /***********************************************************************
  *           GetTextFace    (GDI.92)
  */
-INT GetTextFace( HDC hdc, INT count, LPSTR name )
+INT GetTextFace( HDC16 hdc, INT count, LPSTR name )
 {
     FONTOBJ *font;
 
@@ -754,7 +755,7 @@
 /***********************************************************************
  *           GetTextExtent    (GDI.91)
  */
-DWORD GetTextExtent( HDC hdc, LPCSTR str, short count )
+DWORD GetTextExtent( HDC16 hdc, LPCSTR str, short count )
 {
     SIZE16 size;
     if (!GetTextExtentPoint16( hdc, str, count, &size )) return 0;
@@ -944,7 +945,7 @@
 /***********************************************************************
  *           SetMapperFlags    (GDI.349)
  */
-DWORD SetMapperFlags(HDC hDC, DWORD dwFlag)
+DWORD SetMapperFlags(HDC16 hDC, DWORD dwFlag)
 {
     dprintf_font(stdnimp,"SetmapperFlags(%04x, %08lX) // Empty Stub !\n", 
 		 hDC, dwFlag); 
@@ -955,7 +956,7 @@
 /***********************************************************************
  *           GetCharABCWidths   (GDI.307)
  */
-BOOL GetCharABCWidths(HDC hdc, UINT wFirstChar, UINT wLastChar, LPABC16 lpABC)
+BOOL GetCharABCWidths(HDC16 hdc, UINT wFirstChar, UINT wLastChar, LPABC16 lpABC)
 {
 
     /* No TrueType fonts in Wine so far */
@@ -970,7 +971,7 @@
 /***********************************************************************
  *           GetCharWidth    (GDI.350)
  */
-BOOL GetCharWidth(HDC hdc, WORD wFirstChar, WORD wLastChar, LPINT16 lpBuffer)
+BOOL GetCharWidth(HDC16 hdc, WORD wFirstChar, WORD wLastChar, LPINT16 lpBuffer)
 {
     int i, j;
     XFontStruct *xfont;
@@ -1153,7 +1154,7 @@
 /*************************************************************************
  *				EnumFonts			[GDI.70]
  */
-INT EnumFonts(HDC hDC, LPCSTR lpFaceName, FONTENUMPROC16 lpEnumFunc, LPARAM lpData)
+INT EnumFonts(HDC16 hDC, LPCSTR lpFaceName, FONTENUMPROC16 lpEnumFunc, LPARAM lpData)
 {
   HLOCAL16     hLog;
   HLOCAL16     hMet;
@@ -1223,7 +1224,7 @@
 /*************************************************************************
  *				EnumFontFamilies	[GDI.330]
  */
-INT EnumFontFamilies(HDC hDC, LPCSTR lpszFamily, FONTENUMPROC16 lpEnumFunc, LPARAM lpData)
+INT EnumFontFamilies(HDC16 hDC, LPCSTR lpszFamily, FONTENUMPROC16 lpEnumFunc, LPARAM lpData)
 {
   HLOCAL16     	hLog;
   HLOCAL16     	hMet;
@@ -1307,7 +1308,7 @@
 /*************************************************************************
  *             GetKerningPairs      [GDI.332]
  */
-int GetKerningPairs(HDC hDC,int cPairs,LPKERNINGPAIR16 lpKerningPairs)
+int GetKerningPairs(HDC16 hDC,int cPairs,LPKERNINGPAIR16 lpKerningPairs)
 {
     /* This has to be dealt with when proper font handling is in place 
      *
diff --git a/objects/gdiobj.c b/objects/gdiobj.c
index 3aae235..9392bd9 100644
--- a/objects/gdiobj.c
+++ b/objects/gdiobj.c
@@ -357,7 +357,7 @@
 /***********************************************************************
  *           SelectObject    (GDI.45)
  */
-HGDIOBJ16 SelectObject( HDC hdc, HGDIOBJ16 handle )
+HGDIOBJ16 SelectObject( HDC16 hdc, HGDIOBJ16 handle )
 {
     GDIOBJHDR * ptr = NULL;
     DC * dc;
@@ -423,7 +423,7 @@
 /***********************************************************************
  *           EnumObjects    (GDI.71)
  */
-INT EnumObjects( HDC hdc, INT nObjType, GOBJENUMPROC16 lpEnumFunc,
+INT EnumObjects( HDC16 hdc, INT nObjType, GOBJENUMPROC16 lpEnumFunc,
                  LPARAM lParam )
 {
     /* Solid colors to enumerate */
diff --git a/objects/metafile.c b/objects/metafile.c
index 1b1760f..6b2ccd6 100644
--- a/objects/metafile.c
+++ b/objects/metafile.c
@@ -184,7 +184,7 @@
  *         CloseMetafile         GDI.126
  */
 
-HMETAFILE16 CloseMetaFile(HDC hdc)
+HMETAFILE16 CloseMetaFile(HDC16 hdc)
 {
     DC *dc;
     METAHEADER *mh;
@@ -254,7 +254,7 @@
  *         PlayMetafile         GDI.123
  */
 
-BOOL PlayMetaFile(HDC hdc, HMETAFILE16 hmf)
+BOOL PlayMetaFile(HDC16 hdc, HMETAFILE16 hmf)
 {
     METAHEADER *mh = (METAHEADER *)GlobalLock16(hmf);
     METARECORD *mr;
@@ -298,7 +298,7 @@
  *                                    Niels de carpentier, april 1996
  */
 
-BOOL EnumMetaFile(HDC hdc, HMETAFILE16 hmf, MFENUMPROC16 lpEnumFunc,LPARAM lpData)
+BOOL EnumMetaFile(HDC16 hdc, HMETAFILE16 hmf, MFENUMPROC16 lpEnumFunc,LPARAM lpData)
 {
     METAHEADER *mh = (METAHEADER *)GlobalLock16(hmf);
     METARECORD *mr;
@@ -383,8 +383,8 @@
  *         PlayMetaFileRecord      GDI.176
  */
 
-void PlayMetaFileRecord(HDC hdc, HANDLETABLE16 *ht, METARECORD *mr,
-			                           WORD nHandles)
+void PlayMetaFileRecord(HDC16 hdc, HANDLETABLE16 *ht, METARECORD *mr,
+                        WORD nHandles)
 {
     short s1;
     HANDLE16 hndl;
@@ -698,7 +698,7 @@
 
     case META_STRETCHBLT:
       {
-       HDC hdcSrc=CreateCompatibleDC(hdc);
+       HDC16 hdcSrc=CreateCompatibleDC(hdc);
        HBITMAP16 hbitmap=CreateBitmap(mr->rdParam[10], /*Width */
                                       mr->rdParam[11], /*Height*/
                                       mr->rdParam[13], /*Planes*/
@@ -716,7 +716,7 @@
 
     case META_BITBLT:            /* <-- not yet debugged */
       {
-       HDC hdcSrc=CreateCompatibleDC(hdc);
+       HDC16 hdcSrc=CreateCompatibleDC(hdc);
        HBITMAP16 hbitmap=CreateBitmap(mr->rdParam[7]/*Width */,mr->rdParam[8]/*Height*/,
                             mr->rdParam[10]/*Planes*/,mr->rdParam[11]/*BitsPixel*/,
                             (LPSTR)&mr->rdParam[12]/*bits*/);
diff --git a/objects/oembitmap.c b/objects/oembitmap.c
index 819e82a..774d264 100644
--- a/objects/oembitmap.c
+++ b/objects/oembitmap.c
@@ -176,10 +176,8 @@
 #include "bitmaps/ocr_sizens"
 #include "bitmaps/ocr_bummer"
 #include "bitmaps/ocr_dragobject"
-#if 0
-#include "bitmaps/ocr_sizeall"
-#include "bitmaps/ocr_icocur"
-#endif
+/*#include "bitmaps/ocr_sizeall"*/
+/*#include "bitmaps/ocr_icocur"*/
 
 /* Cursor are not all contiguous (go figure...) */
 #define OCR_FIRST0 OCR_BUMMER
diff --git a/objects/palette.c b/objects/palette.c
index 1682d91..39a1ae7 100644
--- a/objects/palette.c
+++ b/objects/palette.c
@@ -141,7 +141,7 @@
 /***********************************************************************
  *           SetSystemPaletteUse    (GDI.373)
  */
-WORD SetSystemPaletteUse( HDC hdc, WORD use)
+WORD SetSystemPaletteUse( HDC16 hdc, WORD use)
 {
 	 WORD old=SystemPaletteUse;
 	 fprintf(stdnimp,"SetSystemPaletteUse(%04x,%04x) // empty stub !!!\n", hdc, use);
@@ -152,7 +152,7 @@
 /***********************************************************************
  *           GetSystemPaletteUse    (GDI.374)
  */
-WORD GetSystemPaletteUse( HDC hdc )
+WORD GetSystemPaletteUse( HDC16 hdc )
 {
 	fprintf(stdnimp,"GetSystemPaletteUse(%04x) // empty stub !!!\n", hdc);
 	return SystemPaletteUse;
@@ -162,7 +162,7 @@
 /***********************************************************************
  *           GetSystemPaletteEntries    (GDI.375)
  */
-WORD GetSystemPaletteEntries( HDC hdc, WORD start, WORD count,
+WORD GetSystemPaletteEntries( HDC16 hdc, WORD start, WORD count,
 			      LPPALETTEENTRY entries )
 {
     WORD i;
@@ -207,7 +207,7 @@
 /***********************************************************************
  *           GetNearestColor    (GDI.154)
  */
-COLORREF GetNearestColor( HDC hdc, COLORREF color )
+COLORREF GetNearestColor( HDC16 hdc, COLORREF color )
 {
     COLORREF 	 nearest = 0xFADECAFE;
     DC 		*dc;
@@ -268,7 +268,7 @@
 /***********************************************************************
  *           GDISelectPalette    (GDI.361)
  */
-HPALETTE16 GDISelectPalette( HDC hdc, HPALETTE16 hpal, WORD wBkg)
+HPALETTE16 GDISelectPalette( HDC16 hdc, HPALETTE16 hpal, WORD wBkg)
 {
     HPALETTE16 prev;
     DC *dc;
@@ -292,7 +292,7 @@
  *           GDIRealizePalette    (GDI.362)
  *
  */
-UINT GDIRealizePalette( HDC hdc )
+UINT GDIRealizePalette( HDC16 hdc )
 {
     PALETTEOBJ* palPtr;
     int		realized = 0;
@@ -326,7 +326,7 @@
 /***********************************************************************
  *           RealizeDefaultPalette    (GDI.365)
  */
-WORD RealizeDefaultPalette( HDC hdc )
+WORD RealizeDefaultPalette( HDC16 hdc )
 {
     DC          *dc;
     PALETTEOBJ*  palPtr;
@@ -364,7 +364,7 @@
 /***********************************************************************
  *           IsDCCurrentPalette   (GDI.412)
  */
-BOOL IsDCCurrentPalette(HDC hDC)
+BOOL IsDCCurrentPalette(HDC16 hDC)
 {
     DC* dc = (DC *)GDI_GetObjPtr( hDC, DC_MAGIC );
     return (dc)?(dc->w.hPalette == hPrimaryPalette):FALSE;
@@ -373,7 +373,7 @@
 /***********************************************************************
  *           SelectPalette    (USER.282)
  */
-HPALETTE16 SelectPalette( HDC hDC, HPALETTE16 hPal, BOOL bForceBackground )
+HPALETTE16 SelectPalette( HDC16 hDC, HPALETTE16 hPal, BOOL bForceBackground )
 {
     WORD	wBkgPalette = 1;
     PALETTEOBJ* lpt = (PALETTEOBJ*) GDI_GetObjPtr( hPal, PALETTE_MAGIC );
@@ -426,7 +426,7 @@
  *	    UpdateColors	(GDI.366)
  *
  */
-int UpdateColors( HDC hDC )
+int UpdateColors( HDC16 hDC )
 {
     HWND32 hWnd = WindowFromDC32( hDC );
 
diff --git a/objects/text.c b/objects/text.c
index acf51de..c714e7b 100644
--- a/objects/text.c
+++ b/objects/text.c
@@ -34,7 +34,7 @@
 extern int CLIPPING_IntersectClipRect( DC * dc, short left, short top,
                                          short right, short bottom, UINT16 flags);
 
-static const char *TEXT_NextLine( HDC hdc, const char *str, int *count,
+static const char *TEXT_NextLine( HDC16 hdc, const char *str, int *count,
                                   char *dest, int *len, int width, WORD format)
 {
     /* Return next line of text from a string.
@@ -638,7 +638,7 @@
 /***********************************************************************
  *           GrayString   (USER.185)
  */
-BOOL GrayString(HDC hdc, HBRUSH16 hbr, GRAYSTRINGPROC16 gsprc, LPARAM lParam, 
+BOOL GrayString(HDC16 hdc, HBRUSH16 hbr, GRAYSTRINGPROC16 gsprc, LPARAM lParam, 
 		INT cch, INT x, INT y, INT cx, INT cy)
 {
     BOOL ret;
@@ -661,7 +661,7 @@
  * Note: this doesn't work too well for text-alignment modes other
  *       than TA_LEFT|TA_TOP. But we want bug-for-bug compatibility :-)
  */
-LONG TEXT_TabbedTextOut( HDC hdc, int x, int y, LPSTR lpstr, int count, 
+LONG TEXT_TabbedTextOut( HDC16 hdc, int x, int y, LPSTR lpstr, int count, 
                          int cTabStops, LPINT16 lpTabPos, int nTabOrg,
                          BOOL fDisplayText)
 {
@@ -717,7 +717,7 @@
 /***********************************************************************
  *           TabbedTextOut    (USER.196)
  */
-LONG TabbedTextOut( HDC hdc, short x, short y, LPSTR lpstr, short count, 
+LONG TabbedTextOut( HDC16 hdc, short x, short y, LPSTR lpstr, short count, 
                     short cTabStops, LPINT16 lpTabPos, short nTabOrg )
 {
     dprintf_text( stddeb, "TabbedTextOut: %04x %d,%d '%*.*s' %d\n",
@@ -730,7 +730,7 @@
 /***********************************************************************
  *           GetTabbedTextExtent    (USER.197)
  */
-DWORD GetTabbedTextExtent( HDC hdc, LPSTR lpstr, int count, 
+DWORD GetTabbedTextExtent( HDC16 hdc, LPSTR lpstr, int count, 
                           int cTabStops, LPINT16 lpTabPos )
 {
     dprintf_text( stddeb, "GetTabbedTextExtent: %04x '%*.*s' %d\n",
diff --git a/programs/Makefile.in b/programs/Makefile.in
index c42928d..ad54a38 100644
--- a/programs/Makefile.in
+++ b/programs/Makefile.in
@@ -6,12 +6,12 @@
 	@cd $@; $(MAKE)
 
 depend:
-	for i in $(SUBDIRS); do (cd $$i; $(MAKE) depend); done
+	for i in $(SUBDIRS); do (cd $$i; $(MAKE) depend) || exit 1; done
 
 install:
-	for i in $(SUBDIRS); do (cd $$i; $(MAKE) install); done
+	for i in $(SUBDIRS); do (cd $$i; $(MAKE) install) || exit 1; done
 
 clean:
-	for i in $(SUBDIRS); do (cd $$i; $(MAKE) clean); done
+	for i in $(SUBDIRS); do (cd $$i; $(MAKE) clean) || exit 1; done
 
 dummy:
diff --git a/programs/progman/Makefile.in b/programs/progman/Makefile.in
index fcc846b..ddf06ce 100644
--- a/programs/progman/Makefile.in
+++ b/programs/progman/Makefile.in
@@ -55,9 +55,6 @@
 install: dummy
 	$(INSTALL_PROGRAM) progman $(bindir)/progman
 
-clean::
-	$(RM) accel.c accel.h $(LANGUAGES:%=%.c) $(LANGUAGES:%=%.h) progman
-
 accel.c accel.h: $(WINERC) Xx.rc
 
 $(LANGUAGES:%=%.c) $(LANGUAGES:%=%.h): $(WINERC) Xx.rc
diff --git a/programs/winhelp/Makefile.in b/programs/winhelp/Makefile.in
index f13bf66..cb6a691 100644
--- a/programs/winhelp/Makefile.in
+++ b/programs/winhelp/Makefile.in
@@ -55,10 +55,6 @@
 	$(INSTALL_PROGRAM) winhelp $(bindir)/winhelp
 	$(INSTALL_PROGRAM) hlp2sgml $(bindir)/hlp2sgml
 
-clean::
-	$(RM) $(PROGRAMS) lex.yy.c y.tab.c y.tab.h
-	$(RM) $(LANGUAGES:%=%.c) $(LANGUAGES:%=%.h)
-
 y.tab.c y.tab.h: macro.yacc.y
 	$(YACC) -d -t $(SRCDIR)/macro.yacc.y
 
diff --git a/rc/Makefile.in b/rc/Makefile.in
index 81dd34b..7e19f99 100644
--- a/rc/Makefile.in
+++ b/rc/Makefile.in
@@ -3,17 +3,17 @@
 TOPOBJDIR = ..
 SRCDIR    = @srcdir@
 VPATH     = @srcdir@
-PROGRAM   = winerc
+PROGRAMS  = winerc
 MODULE    = none
 
 C_SRCS     = winerc.c
 GEN_C_SRCS = y.tab.c lex.yy.c
 
-all: $(PROGRAM)
+all: $(PROGRAMS)
 
 @MAKE_RULES@
 
-$(PROGRAM): $(OBJS)
+$(PROGRAMS): $(OBJS)
 	$(CC) $(CFLAGS) -o winerc $(OBJS) $(LEXLIB)
 
 y.tab.c y.tab.h: parser.y
@@ -22,7 +22,4 @@
 lex.yy.c: parser.l
 	$(LEX) -8 -I $(SRCDIR)/parser.l
 
-clean::
-	$(RM) y.tab.h $(PROGRAM)
-
 ### Dependencies:
diff --git a/rc/winerc.c b/rc/winerc.c
index 32a4dd1..2ea2d72 100644
--- a/rc/winerc.c
+++ b/rc/winerc.c
@@ -12,8 +12,7 @@
 #include <sys/types.h>
 #include <unistd.h>
 #include <string.h>
-#include <windows.h>
-/* #include <neexe.h> */
+#include "windows.h"
 #include "parser.h"
 #include "y.tab.h"
 
diff --git a/resources/Makefile.in b/resources/Makefile.in
index 5d3afd0..e24d54f 100644
--- a/resources/Makefile.in
+++ b/resources/Makefile.in
@@ -5,9 +5,18 @@
 VPATH     = @srcdir@
 MODULE    = resources
 
-LANGUAGES = En Es De No Fr Fi Da Cz Eo It Ko
-
-SYSRES_SRCS = $(LANGUAGES:%=sysres_%.c)
+SYSRES_SRCS = \
+	sysres_Cz.c \
+	sysres_Da.c \
+	sysres_De.c \
+	sysres_En.c \
+	sysres_Eo.c \
+	sysres_Es.c \
+	sysres_Fi.c \
+	sysres_Fr.c \
+	sysres_It.c \
+	sysres_Ko.c \
+	sysres_No.c
 
 C_SRCS = sysres.c
 GEN_C_SRCS = $(SYSRES_SRCS)
@@ -18,7 +27,4 @@
 
 $(SYSRES_SRCS): $(WINERC)
 
-clean::
-	$(RM) $(SYSRES_SRCS:.c=.h)
-
 ### Dependencies:
diff --git a/tools/Makefile.in b/tools/Makefile.in
index ae76df1..fb8436a 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -4,19 +4,19 @@
 SRCDIR    = @srcdir@
 VPATH     = @srcdir@
 
-PROGRAM = build
-MODULE  = none
+PROGRAMS = build makedep
+MODULE   = none
 
-C_SRCS = build.c
+C_SRCS = build.c makedep.c
 
-all: $(PROGRAM)
+all: $(PROGRAMS)
 
 @MAKE_RULES@
 
-$(PROGRAM): $(OBJS)
-	$(CC) $(CFLAGS) -o build $(OBJS)
+build: build.o
+	$(CC) $(CFLAGS) -o build build.o
 
-clean::
-	$(RM) $(PROGRAM)
+makedep: makedep.o
+	$(CC) $(CFLAGS) -o makedep makedep.o
 
 ### Dependencies:
diff --git a/tools/make_debug b/tools/make_debug
index f7865a5..d836f3b 100755
--- a/tools/make_debug
+++ b/tools/make_debug
@@ -14,8 +14,8 @@
 mv $STDDEBUG_H $STDDEBUG_H.old
 
 # Build the list of debug identifiers
-grep -h dprintf_ */*.c | sed 's/.*dprintf_\([A-Za-z0-9_]*\).*/\1/g' | \
-	sort | uniq > temp.$$
+grep -h dprintf_ `find . -name '*.c' -print` | \
+    sed 's/.*dprintf_\([A-Za-z0-9_]*\).*/\1/g' | sort | uniq > temp.$$
 
 # Build debug.h
 
diff --git a/tools/makedep.c b/tools/makedep.c
new file mode 100644
index 0000000..1d1bf3a
--- /dev/null
+++ b/tools/makedep.c
@@ -0,0 +1,351 @@
+/*
+ * Generate include file dependencies
+ *
+ * Copyright 1996 Alexandre Julliard
+ */
+
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+/* Max first-level includes per file */
+#define MAX_INCLUDES 124
+
+typedef struct _INCL_FILE
+{
+    struct _INCL_FILE *next;
+    char              *name;
+    char              *filename;
+    struct _INCL_FILE *owner;
+    struct _INCL_FILE *files[MAX_INCLUDES];
+} INCL_FILE;
+
+static INCL_FILE *firstSrc;
+static INCL_FILE *firstInclude;
+
+typedef struct _INCL_PATH
+{
+    struct _INCL_PATH *next;
+    const char        *name;
+} INCL_PATH;
+
+static INCL_PATH *firstPath;
+
+static const char *SrcDir = NULL;
+static const char *OutputFileName = "Makefile";
+static const char *Separator = "### Dependencies";
+static const char *ProgramName;
+
+static const char Usage[] =
+    "Usage: %s [options] [files]\n"
+    "Options:\n"
+    "   -Idir   Search for include files in directory 'dir'\n"
+    "   -Cdir   Search for source files in directory 'dir'\n"
+    "   -fxxx   Store output in file 'xxx' (default: Makefile)\n"
+    "   -sxxx   Use 'xxx' as separator (default: \"### Dependencies\")\n";
+
+
+/*******************************************************************
+ *         xmalloc
+ */
+static void *xmalloc( int size )
+{
+    void *res;
+    if (!(res = malloc (size ? size : 1)))
+    {
+        fprintf( stderr, "%s: Virtual memory exhausted.\n", ProgramName );
+        exit(1);
+    }
+    return res;
+}
+
+
+/*******************************************************************
+ *         xstrdup
+ */
+static char *xstrdup( const char *str )
+{
+    char *res = strdup( str );
+    if (!res)
+    {
+        fprintf( stderr, "%s: Virtual memory exhausted.\n", ProgramName );
+        exit(1);
+    }
+    return res;
+}
+
+
+/*******************************************************************
+ *         add_include_path
+ *
+ * Add a directory to the include path.
+ */
+static void add_include_path( const char *name )
+{
+    INCL_PATH *path = xmalloc( sizeof(*path) );
+    INCL_PATH **p = &firstPath;
+    while (*p) p = &(*p)->next;
+    *p = path;
+    path->next = NULL;
+    path->name = name;
+}
+
+
+/*******************************************************************
+ *         add_src_file
+ *
+ * Add a source file to the list.
+ */
+static INCL_FILE *add_src_file( const char *name )
+{
+    INCL_FILE **p = &firstSrc;
+    INCL_FILE *file = xmalloc( sizeof(*file) );
+    memset( file, 0, sizeof(*file) );
+    file->name = xstrdup(name);
+    while (*p) p = &(*p)->next;
+    *p = file;
+    return file;
+}
+
+
+/*******************************************************************
+ *         add_include
+ *
+ * Add an include file if it doesn't already exists.
+ */
+static INCL_FILE *add_include( INCL_FILE *pFile, const char *name )
+{
+    INCL_FILE **p = &firstInclude;
+    int pos;
+
+    for (pos = 0; pos < MAX_INCLUDES; pos++) if (!pFile->files[pos]) break;
+    if (pos >= MAX_INCLUDES)
+    {
+        fprintf( stderr, "%s: %s: too many included files, please fix MAX_INCLUDES\n",
+                 ProgramName, pFile->name );
+        exit(1);
+    }
+
+    while (*p && strcmp( name, (*p)->name )) p = &(*p)->next;
+    if (!*p)
+    {
+        *p = xmalloc( sizeof(INCL_FILE) );
+        memset( *p, 0, sizeof(INCL_FILE) );
+        (*p)->name = xstrdup(name);
+    }
+    pFile->files[pos] = *p;
+    return *p;
+}
+
+
+/*******************************************************************
+ *         open_src_file
+ */
+static FILE *open_src_file( INCL_FILE *pFile )
+{
+    FILE *file;
+
+    if (SrcDir)
+    {
+        pFile->filename = xmalloc( strlen(SrcDir) + strlen(pFile->name) + 2 );
+        strcpy( pFile->filename, SrcDir );
+        strcat( pFile->filename, "/" );
+        strcat( pFile->filename, pFile->name );
+    }
+    else pFile->filename = xstrdup( pFile->name );
+
+    if (!(file = fopen( pFile->filename, "r" )))
+    {
+        perror( pFile->filename );
+        exit(1);
+    }
+    return file;
+}
+
+
+/*******************************************************************
+ *         open_include_file
+ */
+static FILE *open_include_file( INCL_FILE *pFile )
+{
+    FILE *file = NULL;
+    INCL_PATH *path;
+
+    for (path = firstPath; path; path = path->next)
+    {
+        char *filename = xmalloc(strlen(path->name) + strlen(pFile->name) + 2);
+        strcpy( filename, path->name );
+        strcat( filename, "/" );
+        strcat( filename, pFile->name );
+        if ((file = fopen( filename, "r" )))
+        {
+            pFile->filename = filename;
+            break;
+        }
+        free( filename );
+    }
+    if (!file)
+    {
+        if (firstPath) perror( pFile->name );
+        else fprintf( stderr, "%s: %s: File not found\n",
+                      ProgramName, pFile->name );
+        exit(1);
+    }
+    return file;
+}
+
+
+/*******************************************************************
+ *         parse_file
+ */
+static void parse_file( INCL_FILE *pFile, int src )
+{
+    char buffer[1024];
+    char *include;
+    int line = 0;
+
+    FILE *file = src ? open_src_file( pFile ) : open_include_file( pFile );
+    while (fgets( buffer, sizeof(buffer)-1, file ))
+    {
+        char *p = buffer;
+        line++;
+        while (*p && isspace(*p)) p++;
+        if (*p++ != '#') continue;
+        while (*p && isspace(*p)) p++;
+        if (strncmp( p, "include", 7 )) continue;
+        p += 7;
+        while (*p && isspace(*p)) p++;
+        if (*p++ != '\"') continue;
+        include = p;
+        while (*p && (*p != '\"')) p++;
+        if (!*p)
+        {
+            fprintf( stderr, "%s:%d: Malformed #include directive\n",
+                     pFile->filename, line );
+            exit(1);
+        }
+        *p = 0;
+        add_include( pFile, include );
+    }
+}
+
+
+/*******************************************************************
+ *         output_include
+ */
+static void output_include( FILE *file, INCL_FILE *pFile,
+                            INCL_FILE *owner, int *column )
+{
+    int i;
+
+    if (pFile->owner == owner) return;
+    pFile->owner = owner;
+    if (*column + strlen(pFile->filename) + 1 > 70)
+    {
+        fprintf( file, " \\\n" );
+        *column = 0;
+    }
+    fprintf( file, " %s", pFile->filename );
+    *column += strlen(pFile->filename) + 1;
+    for (i = 0; i < MAX_INCLUDES; i++)
+        if (pFile->files[i]) output_include( file, pFile->files[i],
+                                             owner, column );
+}
+
+
+/*******************************************************************
+ *         output_dependencies
+ */
+static void output_dependencies(void)
+{
+    INCL_FILE *pFile;
+    int i, column;
+    FILE *file = NULL;
+    char buffer[1024];
+
+    if (Separator && ((file = fopen( OutputFileName, "r+" ))))
+    {
+        while (fgets( buffer, sizeof(buffer), file ))
+            if (!strncmp( buffer, Separator, strlen(Separator) )) break;
+        ftruncate( fileno(file), ftell(file) );
+    }
+    if (!file)
+    {
+        if (!(file = fopen( OutputFileName, "a" )))
+        {
+            perror( OutputFileName );
+            exit(1);
+        }
+    }
+    for( pFile = firstSrc; pFile; pFile = pFile->next)
+    {
+        char *name = strrchr( pFile->name, '/' );
+        char *obj = xstrdup( name ? name + 1 : pFile->name );
+        char *ext = strrchr( obj, '.' );
+        if (ext) strcpy( ext, ".o" );
+        fprintf( file, "%s: %s", obj, pFile->filename );
+        column = strlen(obj) + strlen(pFile->filename) + 2;
+        free( obj );
+        for (i = 0; i < MAX_INCLUDES; i++)
+            if (pFile->files[i]) output_include( file, pFile->files[i],
+                                                 pFile, &column );
+        fprintf( file, "\n" );
+    }
+}
+
+
+/*******************************************************************
+ *         parse_option
+ */
+static void parse_option( const char *opt )
+{
+    switch(opt[1])
+    {
+    case 'I':
+        if (opt[2]) add_include_path( opt + 2 );
+        break;
+    case 'C':
+        if (opt[2]) SrcDir = opt + 2;
+        else SrcDir = NULL;
+        break;
+    case 'f':
+        if (opt[2]) OutputFileName = opt + 2;
+        break;
+    case 's':
+        if (opt[2]) Separator = opt + 2;
+        else Separator = NULL;
+        break;
+    default:
+        fprintf( stderr, "Unknown option '%s'\n", opt );
+        fprintf( stderr, Usage, ProgramName );
+        exit(1);
+    }
+}
+
+
+/*******************************************************************
+ *         main
+ */
+int main( int argc, char *argv[] )
+{
+    INCL_FILE *pFile;
+
+    ProgramName = argv[0];
+    while (argc > 1)
+    {
+        if (*argv[1] == '-') parse_option( argv[1] );
+        else
+        {
+            pFile = add_src_file( argv[1] );
+            parse_file( pFile, 1 );
+        }
+        argc--;
+        argv++;
+    }
+    for (pFile = firstInclude; pFile; pFile = pFile->next)
+        parse_file( pFile, 0 );
+    output_dependencies();
+    return 0;
+}
diff --git a/windows/dce.c b/windows/dce.c
index b9a0fb7..0af441d 100644
--- a/windows/dce.c
+++ b/windows/dce.c
@@ -28,7 +28,7 @@
 #define NB_DCE    5  /* Number of DCEs created at startup */
 
 static DCE *firstDCE = 0;
-static HDC defaultDCstate = 0;
+static HDC32 defaultDCstate = 0;
 
 /***********************************************************************
  *           DCE_AllocDCE
@@ -396,7 +396,7 @@
 HDC32 GetDCEx32( HWND32 hwnd, HRGN32 hrgnClip, DWORD flags )
 {
     HRGN32 	hrgnVisible;
-    HDC 	hdc = 0;
+    HDC32 	hdc = 0;
     DCE * 	dce;
     DC * 	dc;
     WND * 	wndPtr;
diff --git a/windows/defdlg.c b/windows/defdlg.c
index a0970a8..1b0e853 100644
--- a/windows/defdlg.c
+++ b/windows/defdlg.c
@@ -122,7 +122,7 @@
 	    return 0;
 
         case WM_ERASEBKGND:
-	    FillWindow( hwnd, hwnd, (HDC)wParam, (HBRUSH16)CTLCOLOR_DLG );
+	    FillWindow( hwnd, hwnd, (HDC16)wParam, (HBRUSH16)CTLCOLOR_DLG );
 	    return 1;
 
 	case WM_NCDESTROY:
diff --git a/windows/defwnd.c b/windows/defwnd.c
index 46727b3..1d3adc3 100644
--- a/windows/defwnd.c
+++ b/windows/defwnd.c
@@ -105,7 +105,7 @@
     case WM_PAINT:
 	{
 	    PAINTSTRUCT16 ps;
-	    HDC		  hdc = BeginPaint16( wndPtr->hwndSelf, &ps );
+	    HDC16 hdc = BeginPaint16( wndPtr->hwndSelf, &ps );
 	    if( hdc ) 
 	    {
 	      if( (wndPtr->dwStyle & WS_MINIMIZE) && wndPtr->class->hIcon )
@@ -162,7 +162,7 @@
 		 if( wndPtr->flags & WIN_NCACTIVATED )
 		 {
 		   FillWindow( GetParent16(wndPtr->hwndSelf), wndPtr->hwndSelf,
-                               (HDC)wParam, sysColorObjects.hbrushActiveCaption );
+                               (HDC16)wParam, sysColorObjects.hbrushActiveCaption );
 		   return 1;
 		 }
 
@@ -175,11 +175,11 @@
                 HBRUSH16 hbrush = CreateSolidBrush( 
 			 GetSysColor(((DWORD)wndPtr->class->hbrBackground)-1));
                  FillWindow( GetParent16(wndPtr->hwndSelf), wndPtr->hwndSelf,
-                             (HDC)wParam, hbrush);
+                             (HDC16)wParam, hbrush);
                  DeleteObject (hbrush);
             }
             else FillWindow( GetParent16(wndPtr->hwndSelf), wndPtr->hwndSelf,
-                                  (HDC)wParam, wndPtr->class->hbrBackground );
+                             (HDC16)wParam, wndPtr->class->hbrBackground );
 	    return 1;
 	}
 
@@ -192,13 +192,13 @@
     case WM_CTLCOLORBTN:
     case WM_CTLCOLORDLG:
     case WM_CTLCOLORSTATIC:
-        SetBkColor( (HDC)wParam, GetSysColor(COLOR_WINDOW) );
-        SetTextColor( (HDC)wParam, GetSysColor(COLOR_WINDOWTEXT) );
+        SetBkColor( (HDC32)wParam, GetSysColor(COLOR_WINDOW) );
+        SetTextColor( (HDC32)wParam, GetSysColor(COLOR_WINDOWTEXT) );
         return (LRESULT)sysColorObjects.hbrushWindow;
 
     case WM_CTLCOLORSCROLLBAR:
-        SetBkColor( (HDC)wParam, RGB(255, 255, 255) );
-        SetTextColor( (HDC)wParam, RGB(0, 0, 0) );
+        SetBkColor( (HDC32)wParam, RGB(255, 255, 255) );
+        SetTextColor( (HDC32)wParam, RGB(0, 0, 0) );
         UnrealizeObject( sysColorObjects.hbrushScrollbar );
         return (LRESULT)sysColorObjects.hbrushScrollbar;
 
@@ -206,15 +206,15 @@
 	{
 	    if (HIWORD(lParam) == CTLCOLOR_SCROLLBAR)
 	    {
-		SetBkColor( (HDC)wParam, RGB(255, 255, 255) );
-		SetTextColor( (HDC)wParam, RGB(0, 0, 0) );
+		SetBkColor( (HDC32)wParam, RGB(255, 255, 255) );
+		SetTextColor( (HDC32)wParam, RGB(0, 0, 0) );
 		UnrealizeObject( sysColorObjects.hbrushScrollbar );
 		return (LRESULT)sysColorObjects.hbrushScrollbar;
 	    }
 	    else
 	    {
-		SetBkColor( (HDC)wParam, GetSysColor(COLOR_WINDOW) );
-		SetTextColor( (HDC)wParam, GetSysColor(COLOR_WINDOWTEXT) );
+		SetBkColor( (HDC32)wParam, GetSysColor(COLOR_WINDOW) );
+		SetTextColor( (HDC32)wParam, GetSysColor(COLOR_WINDOWTEXT) );
 		return (LRESULT)sysColorObjects.hbrushWindow;
 	    }
 	}
@@ -255,7 +255,7 @@
 	     else
 	         if( wParam == VK_ESCAPE && GetKeyState(VK_SHIFT) < 0 )
 		     SendMessage16( wndPtr->hwndSelf, WM_SYSCOMMAND,
-                                    (WPARAM)SC_KEYMENU, (LPARAM)VK_SPACE);
+                                    (WPARAM16)SC_KEYMENU, (LPARAM)VK_SPACE);
 	break;
 
     case WM_KEYUP:
@@ -273,7 +273,7 @@
 	if (wParam == VK_RETURN && (wndPtr->dwStyle & WS_MINIMIZE))
         {
 	    PostMessage( wndPtr->hwndSelf, WM_SYSCOMMAND,
-                         (WPARAM)SC_RESTORE, 0L ); 
+                         (WPARAM16)SC_RESTORE, 0L ); 
 	    break;
         } 
 	if ((HIWORD(lParam) & KEYDATA_ALT) && wParam)
@@ -283,7 +283,7 @@
                 SendMessage16( wndPtr->parent->hwndSelf, msg, wParam, lParam );
 	    else
                 SendMessage16( wndPtr->hwndSelf, WM_SYSCOMMAND,
-                               (WPARAM)SC_KEYMENU, (LPARAM)(DWORD)wParam );
+                               (WPARAM16)SC_KEYMENU, (LPARAM)(DWORD)wParam );
         } 
 	else /* check for Ctrl-Esc */
             if (wParam != VK_ESCAPE) MessageBeep(0);
diff --git a/windows/dialog.c b/windows/dialog.c
index d180503..0fa7fb1 100644
--- a/windows/dialog.c
+++ b/windows/dialog.c
@@ -64,7 +64,7 @@
 BOOL32 DIALOG_Init()
 {
     TEXTMETRIC16 tm;
-    HDC hdc;
+    HDC16 hdc;
     
       /* Calculate the dialog base units */
 
@@ -281,7 +281,7 @@
 
             /* Send initialisation messages to the control */
         if (dlgInfo->hUserFont) SendMessage32A( hwndCtrl, WM_SETFONT,
-                                               (WPARAM)dlgInfo->hUserFont, 0 );
+                                             (WPARAM32)dlgInfo->hUserFont, 0 );
         if (SendMessage32A(hwndCtrl, WM_GETDLGCODE, 0, 0) & DLGC_DEFPUSHBUTTON)
         {
               /* If there's already a default push-button, set it back */
@@ -582,8 +582,9 @@
 
     dlgInfo->hwndFocus = GetNextDlgTabItem32( hwnd, 0, FALSE );
     if (dlgInfo->hUserFont)
-	SendMessage32A( hwnd, WM_SETFONT, (WPARAM)dlgInfo->hUserFont, 0 );
-    if (SendMessage32A(hwnd, WM_INITDIALOG, (WPARAM)dlgInfo->hwndFocus, param))
+	SendMessage32A( hwnd, WM_SETFONT, (WPARAM32)dlgInfo->hUserFont, 0 );
+    if (SendMessage32A( hwnd, WM_INITDIALOG,
+                        (WPARAM32)dlgInfo->hwndFocus, param ))
 	SetFocus32( dlgInfo->hwndFocus );
     if (template.style & WS_VISIBLE) ShowWindow( hwnd, SW_SHOW );
     return hwnd;
diff --git a/windows/event.c b/windows/event.c
index 46fc7c4..e45582c 100644
--- a/windows/event.c
+++ b/windows/event.c
@@ -50,8 +50,8 @@
 BYTE AsyncKeyStateTable[256];
 
 
-       WPARAM   lastEventChar = 0; /* this will have to be changed once
-				    * ToAscii starts working */
+WPARAM16 lastEventChar = 0; /* this will have to be changed once
+                             * ToAscii starts working */
 
 static HWND32 captureWnd = 0;
 static BOOL32 InputEnabled = TRUE;
diff --git a/windows/graphics.c b/windows/graphics.c
index 5de568a..06644ad 100644
--- a/windows/graphics.c
+++ b/windows/graphics.c
@@ -28,7 +28,7 @@
 /***********************************************************************
  *           LineTo    (GDI.19)
  */
-BOOL LineTo( HDC hdc, short x, short y )
+BOOL LineTo( HDC16 hdc, short x, short y )
 {
     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
     if (!dc) 
@@ -54,7 +54,7 @@
 /***********************************************************************
  *           MoveTo    (GDI.20)
  */
-DWORD MoveTo( HDC hdc, short x, short y )
+DWORD MoveTo( HDC16 hdc, short x, short y )
 {
     short oldx, oldy;
     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
@@ -110,7 +110,7 @@
  * Helper functions for Arc(), Chord() and Pie().
  * 'lines' is the number of lines to draw: 0 for Arc, 1 for Chord, 2 for Pie.
  */
-static BOOL GRAPH_DrawArc( HDC hdc, int left, int top, int right, int bottom,
+static BOOL GRAPH_DrawArc( HDC16 hdc, int left, int top, int right, int bottom,
 		    int xstart, int ystart, int xend, int yend, int lines )
 {
     int xcenter, ycenter, istart_angle, idiff_angle, tmp;
@@ -200,7 +200,7 @@
 /***********************************************************************
  *           Arc    (GDI.23)
  */
-BOOL Arc( HDC hdc, INT left, INT top, INT right, INT bottom,
+BOOL Arc( HDC16 hdc, INT left, INT top, INT right, INT bottom,
 	  INT xstart, INT ystart, INT xend, INT yend )
 {
     return GRAPH_DrawArc( hdc, left, top, right, bottom,
@@ -211,7 +211,7 @@
 /***********************************************************************
  *           Pie    (GDI.26)
  */
-BOOL Pie( HDC hdc, INT left, INT top, INT right, INT bottom,
+BOOL Pie( HDC16 hdc, INT left, INT top, INT right, INT bottom,
 	  INT xstart, INT ystart, INT xend, INT yend )
 {
     return GRAPH_DrawArc( hdc, left, top, right, bottom,
@@ -222,7 +222,7 @@
 /***********************************************************************
  *           Chord    (GDI.348)
  */
-BOOL Chord( HDC hdc, INT left, INT top, INT right, INT bottom,
+BOOL Chord( HDC16 hdc, INT left, INT top, INT right, INT bottom,
 	    INT xstart, INT ystart, INT xend, INT yend )
 {
     return GRAPH_DrawArc( hdc, left, top, right, bottom,
@@ -233,7 +233,7 @@
 /***********************************************************************
  *           Ellipse    (GDI.24)
  */
-BOOL Ellipse( HDC hdc, INT left, INT top, INT right, INT bottom )
+BOOL Ellipse( HDC16 hdc, INT left, INT top, INT right, INT bottom )
 {
     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
     if (!dc) 
@@ -278,7 +278,7 @@
 /***********************************************************************
  *           Rectangle    (GDI.27)
  */
-BOOL Rectangle( HDC hdc, INT left, INT top, INT right, INT bottom )
+BOOL Rectangle( HDC16 hdc, INT left, INT top, INT right, INT bottom )
 {
     INT32 width;
     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
@@ -336,7 +336,7 @@
 /***********************************************************************
  *           RoundRect    (GDI.28)
  */
-BOOL RoundRect( HDC hDC, INT left, INT top, INT right, INT bottom,
+BOOL RoundRect( HDC16 hDC, INT left, INT top, INT right, INT bottom,
                 INT ell_width, INT ell_height )
 {
     DC * dc = (DC *) GDI_GetObjPtr(hDC, DC_MAGIC);
@@ -554,7 +554,7 @@
 /***********************************************************************
  *           SetPixel    (GDI.31)
  */
-COLORREF SetPixel( HDC hdc, short x, short y, COLORREF color )
+COLORREF SetPixel( HDC16 hdc, short x, short y, COLORREF color )
 {
     Pixel pixel;
     
@@ -584,7 +584,7 @@
 /***********************************************************************
  *           GetPixel    (GDI.83)
  */
-COLORREF GetPixel( HDC hdc, short x, short y )
+COLORREF GetPixel( HDC16 hdc, short x, short y )
 {
     static Pixmap pixmap = 0;
     XImage * image;
@@ -626,7 +626,7 @@
 /***********************************************************************
  *           PaintRgn    (GDI.43)
  */
-BOOL PaintRgn( HDC hdc, HRGN32 hrgn )
+BOOL PaintRgn( HDC16 hdc, HRGN32 hrgn )
 {
     RECT16 box;
     HRGN32 tmpVisRgn, prevVisRgn;
@@ -663,7 +663,7 @@
 /***********************************************************************
  *           FillRgn    (GDI.40)
  */
-BOOL FillRgn( HDC hdc, HRGN32 hrgn, HBRUSH16 hbrush )
+BOOL FillRgn( HDC16 hdc, HRGN32 hrgn, HBRUSH16 hbrush )
 {
     BOOL retval;
     HBRUSH16 prevBrush = SelectObject( hdc, hbrush );
@@ -676,7 +676,7 @@
 /***********************************************************************
  *           FrameRgn     (GDI.41)
  */
-BOOL FrameRgn( HDC hdc, HRGN32 hrgn, HBRUSH16 hbrush, int nWidth, int nHeight )
+BOOL FrameRgn( HDC16 hdc, HRGN32 hrgn, HBRUSH16 hbrush, int nWidth, int nHeight )
 {
     HRGN32 tmp = CreateRectRgn( 0, 0, 0, 0 );
     if(!REGION_FrameRgn( tmp, hrgn, nWidth, nHeight )) return 0;
@@ -688,7 +688,7 @@
 /***********************************************************************
  *           InvertRgn    (GDI.42)
  */
-BOOL InvertRgn( HDC hdc, HRGN32 hrgn )
+BOOL InvertRgn( HDC16 hdc, HRGN32 hrgn )
 {
     HBRUSH16 prevBrush = SelectObject( hdc, GetStockObject(BLACK_BRUSH) );
     WORD prevROP = SetROP2( hdc, R2_NOT );
diff --git a/windows/hook.c b/windows/hook.c
index 4deddf7..bf32483 100644
--- a/windows/hook.c
+++ b/windows/hook.c
@@ -79,8 +79,10 @@
  */
 HOOKPROC16 HOOK_GetProc16( HHOOK hhook )
 {
-    HOOKDATA *data = (HOOKDATA *)USER_HEAP_LIN_ADDR( hhook );
-    return data ? data->proc : NULL;
+    HOOKDATA *data;
+    if (HIWORD(hhook) != HOOK_MAGIC) return NULL;
+    if (!(data = (HOOKDATA *)USER_HEAP_LIN_ADDR( LOWORD(hhook) ))) return NULL;
+    return data->proc;
 }
 
 
diff --git a/windows/mapping.c b/windows/mapping.c
index 3d2be8a..ed8a1bb 100644
--- a/windows/mapping.c
+++ b/windows/mapping.c
@@ -111,7 +111,7 @@
 /***********************************************************************
  *           SetMapMode    (GDI.3)
  */
-WORD SetMapMode( HDC hdc, WORD mode )
+WORD SetMapMode( HDC16 hdc, WORD mode )
 {
     WORD prevMode;
     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
diff --git a/windows/mdi.c b/windows/mdi.c
index 6631b94..2e73cf4 100644
--- a/windows/mdi.c
+++ b/windows/mdi.c
@@ -41,9 +41,6 @@
 BOOL MDI_AugmentFrameMenu(MDICLIENTINFO*, WND *, HWND);
 BOOL MDI_RestoreFrameMenu(WND *, HWND);
 
-void ScrollChildren(HWND , UINT , WPARAM , LPARAM );
-void CalcChildScroll(HWND, WORD);
-
 static LONG MDI_ChildActivate(WND* ,HWND );
 
 /* -------- Miscellaneous service functions ----------
@@ -544,7 +541,7 @@
 	SendMessage16( prevActiveWnd, WM_NCACTIVATE, FALSE, 0L );
 
 #ifdef WINELIB32
-        SendMessage32A( prevActiveWnd, WM_MDIACTIVATE, (WPARAM)prevActiveWnd, 
+        SendMessage32A( prevActiveWnd, WM_MDIACTIVATE, (WPARAM32)prevActiveWnd, 
                         (LPARAM)hWndChild);
 #else 
 
@@ -592,13 +589,13 @@
 	    SendMessage16( hWndChild, WM_NCACTIVATE, TRUE, 0L);
 	    if( GetFocus32() == clientInfo->self )
 		SendMessage16( clientInfo->self, WM_SETFOCUS, 
-			    (WPARAM)clientInfo->self, 0L );
+			    (WPARAM16)clientInfo->self, 0L );
 	    else
 		SetFocus32( clientInfo->self );
     }
 
 #ifdef WINELIB32
-    SendMessage32A( hWndChild, WM_MDIACTIVATE, (WPARAM)hWndChild,
+    SendMessage32A( hWndChild, WM_MDIACTIVATE, (WPARAM32)hWndChild,
                     (LPARAM)prevActiveWnd );
 #else
     SendMessage16( hWndChild, WM_MDIACTIVATE, TRUE,
@@ -666,8 +663,8 @@
  */
 HBITMAP16 CreateMDIMenuBitmap(void)
 {
- HDC 		hDCSrc  = CreateCompatibleDC(0);
- HDC		hDCDest	= CreateCompatibleDC(hDCSrc);
+ HDC16 		hDCSrc  = CreateCompatibleDC(0);
+ HDC16		hDCDest	= CreateCompatibleDC(hDCSrc);
  HBITMAP16	hbClose = LoadBitmap16(0, MAKEINTRESOURCE(OBM_CLOSE) );
  HBITMAP16	hbCopy,hb_src,hb_dest;
 
@@ -977,7 +974,7 @@
  *
  * This function is the handler for all MDI requests.
  */
-LRESULT MDIClientWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+LRESULT MDIClientWndProc(HWND hwnd, UINT message, WPARAM16 wParam, LPARAM lParam)
 {
     LPCREATESTRUCT16     cs;
     LPCLIENTCREATESTRUCT16 ccs;
@@ -1197,7 +1194,8 @@
 	    	childHwnd = MDI_GetChildByID( WIN_FindWndPtr(hwndMDIClient),
                                           wParam );
  	    	if( childHwnd )
-	            SendMessage16(hwndMDIClient, WM_MDIACTIVATE, (WPARAM)childHwnd , 0L);
+	            SendMessage16(hwndMDIClient, WM_MDIACTIVATE,
+                                  (WPARAM16)childHwnd , 0L);
 	      }
 	    break;
 
@@ -1341,7 +1339,7 @@
         return 0;
 
       case WM_CLOSE:
-	SendMessage16(ci->self,WM_MDIDESTROY,(WPARAM)hwnd,0L);
+	SendMessage16(ci->self,WM_MDIDESTROY,(WPARAM16)hwnd,0L);
 	return 0;
 
       case WM_SETFOCUS:
@@ -1446,7 +1444,7 @@
 
 	/* MDI children don't have menu bars */
 	PostMessage( clientWnd->parent->hwndSelf, WM_SYSCOMMAND, 
-				          (WPARAM)SC_KEYMENU, (LPARAM)wParam);
+                     (WPARAM16)SC_KEYMENU, (LPARAM)wParam);
 	return 0x00010000L;
 
       case WM_NEXTMENU:
@@ -1500,7 +1498,7 @@
 
 	/* MDI children don't have menu bars */
 	PostMessage( clientWnd->parent->hwndSelf, WM_SYSCOMMAND, 
-                     (WPARAM)SC_KEYMENU, (LPARAM)LOWORD(wParam) );
+                     (WPARAM16)SC_KEYMENU, (LPARAM)LOWORD(wParam) );
 	return 0x00010000L;
 
       case WM_CLOSE:
@@ -1564,7 +1562,7 @@
   WND* clientWnd = WIN_FindWndPtr( hwndClient);
   WND* wnd;
   MDICLIENTINFO       *ci     = NULL;
-  WPARAM	       wParam = 0;
+  WPARAM16	       wParam = 0;
 
   if( (msg->message != WM_KEYDOWN && msg->message != WM_SYSKEYDOWN) || !clientWnd )
     return 0;
@@ -1651,7 +1649,7 @@
 /***********************************************************************
  *           ScrollChildren   (USER.463)
  */
-void ScrollChildren(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+void ScrollChildren(HWND hWnd, UINT uMsg, WPARAM16 wParam, LPARAM lParam)
 {
  WND	*wndPtr = WIN_FindWndPtr(hWnd);
  short 	 newPos=-1;
diff --git a/windows/message.c b/windows/message.c
index 27eec64..3e5f253 100644
--- a/windows/message.c
+++ b/windows/message.c
@@ -36,7 +36,7 @@
 
 typedef enum { SYSQ_MSG_ABANDON, SYSQ_MSG_SKIP, SYSQ_MSG_ACCEPT } SYSQ_STATUS;
 
-extern WPARAM	lastEventChar;				 /* event.c */
+extern WPARAM16 lastEventChar;				 /* event.c */
 extern BOOL MouseButtonsStates[3];
 extern BOOL AsyncMouseButtonsStates[3];
 extern BYTE KeyStateTable[256];
@@ -146,7 +146,7 @@
 
       /* Send the WM_SETCURSOR message */
 
-    SendMessage16( msg->hwnd, WM_SETCURSOR, (WPARAM)msg->hwnd,
+    SendMessage16( msg->hwnd, WM_SETCURSOR, (WPARAM16)msg->hwnd,
                    MAKELONG( hittest, msg->message ));
     if (eatMsg) return SYSQ_MSG_SKIP;
 
@@ -295,7 +295,7 @@
 /*****************************************************************
  *              MSG_JournalPlayBackIsAscii
  */
-static BOOL MSG_JournalPlayBackIsAscii(WPARAM wParam)
+static BOOL MSG_JournalPlayBackIsAscii(WPARAM16 wParam)
 {
  return ((wParam>VK_HELP && wParam<VK_F1) || 
           wParam == VK_SPACE  ||
@@ -494,7 +494,7 @@
  * Implementation of an inter-task SendMessage.
  */
 static LRESULT MSG_SendMessage( HQUEUE16 hDestQueue, HWND hwnd, UINT msg,
-                                WPARAM wParam, LPARAM lParam )
+                                WPARAM16 wParam, LPARAM lParam )
 {
     INT32	  prevSMRL = debugSMRL;
     QSMCTRL 	  qCtrl = { 0, 1};
@@ -956,6 +956,7 @@
             msg    = pmsg->wMsg;
             wParam = pmsg->wParam;
             lParam = pmsg->lParam;
+            SEGPTR_FREE( pmsg );
         }
     }
 
diff --git a/windows/msgbox.c b/windows/msgbox.c
index 178e9bc..8795b8e 100644
--- a/windows/msgbox.c
+++ b/windows/msgbox.c
@@ -18,7 +18,7 @@
   WORD  type;
 } MSGBOX, *LPMSGBOX;
 
-LRESULT SystemMessageBoxProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
+LRESULT SystemMessageBoxProc(HWND hwnd,UINT message,WPARAM16 wParam,LPARAM lParam)
 {
   LPMSGBOX lpmb;
   RECT16 rect, textrect;
@@ -65,20 +65,20 @@
     switch(lpmb->type & MB_ICONMASK) {
      case MB_ICONEXCLAMATION:
       SendDlgItemMessage16(hwnd, stc1, STM_SETICON, 
-                           (WPARAM)LoadIcon16(0, IDI_EXCLAMATION), 0);
+                           (WPARAM16)LoadIcon16(0, IDI_EXCLAMATION), 0);
       break;
      case MB_ICONQUESTION:
       SendDlgItemMessage16(hwnd, stc1, STM_SETICON, 
-                           (WPARAM)LoadIcon16(0, IDI_QUESTION), 0);
+                           (WPARAM16)LoadIcon16(0, IDI_QUESTION), 0);
       break;
      case MB_ICONASTERISK:
       SendDlgItemMessage16(hwnd, stc1, STM_SETICON, 
-                           (WPARAM)LoadIcon16(0, IDI_ASTERISK), 0);
+                           (WPARAM16)LoadIcon16(0, IDI_ASTERISK), 0);
       break;
      case MB_ICONHAND:
      default:
       SendDlgItemMessage16(hwnd, stc1, STM_SETICON, 
-                           (WPARAM)LoadIcon16(0, IDI_HAND), 0);
+                           (WPARAM16)LoadIcon16(0, IDI_HAND), 0);
       break;
     }
     
diff --git a/windows/nonclient.c b/windows/nonclient.c
index 3a9268c..0527dd6 100644
--- a/windows/nonclient.c
+++ b/windows/nonclient.c
@@ -431,10 +431,10 @@
 /***********************************************************************
  *           NC_DrawSysButton
  */
-void NC_DrawSysButton( HWND hwnd, HDC hdc, BOOL down )
+void NC_DrawSysButton( HWND hwnd, HDC16 hdc, BOOL down )
 {
     RECT16 rect;
-    HDC hdcMem;
+    HDC16 hdcMem;
     HBITMAP16 hbitmap;
     WND *wndPtr = WIN_FindWndPtr( hwnd );
 
@@ -455,7 +455,7 @@
 /***********************************************************************
  *           NC_DrawMaxButton
  */
-static void NC_DrawMaxButton( HWND hwnd, HDC hdc, BOOL down )
+static void NC_DrawMaxButton( HWND hwnd, HDC16 hdc, BOOL down )
 {
     RECT16 rect;
     WND *wndPtr = WIN_FindWndPtr( hwnd );
@@ -475,7 +475,7 @@
 /***********************************************************************
  *           NC_DrawMinButton
  */
-static void NC_DrawMinButton( HWND hwnd, HDC hdc, BOOL down )
+static void NC_DrawMinButton( HWND hwnd, HDC16 hdc, BOOL down )
 {
     RECT16 rect;
     WND *wndPtr = WIN_FindWndPtr( hwnd );
@@ -497,7 +497,7 @@
  * Draw a window frame inside the given rectangle, and update the rectangle.
  * The correct pen for the frame must be selected in the DC.
  */
-static void NC_DrawFrame( HDC hdc, RECT16 *rect, BOOL dlgFrame, BOOL active )
+static void NC_DrawFrame( HDC16 hdc, RECT16 *rect, BOOL dlgFrame, BOOL active )
 {
     short width, height, tmp;
 
@@ -573,7 +573,7 @@
  *
  * Draw the frame used when moving or resizing window.
  */
-static void NC_DrawMovingFrame( HDC hdc, RECT16 *rect, BOOL thickframe )
+static void NC_DrawMovingFrame( HDC16 hdc, RECT16 *rect, BOOL thickframe )
 {
     if (thickframe)
     {
@@ -600,7 +600,7 @@
  * Draw the window caption.
  * The correct pen for the window frame must be selected in the DC.
  */
-static void NC_DrawCaption( HDC hdc, RECT16 *rect, HWND hwnd,
+static void NC_DrawCaption( HDC16 hdc, RECT16 *rect, HWND hwnd,
 			    DWORD style, BOOL active )
 {
     RECT16 r = *rect;
@@ -778,7 +778,7 @@
  *
  * Handle a WM_NCACTIVATE message. Called from DefWindowProc().
  */
-LONG NC_HandleNCActivate( WND *wndPtr, WPARAM wParam )
+LONG NC_HandleNCActivate( WND *wndPtr, WPARAM16 wParam )
 {
     WORD wStateChange;
 
@@ -804,7 +804,7 @@
  *
  * Handle a WM_SETCURSOR message. Called from DefWindowProc().
  */
-LONG NC_HandleSetCursor( HWND hwnd, WPARAM wParam, LPARAM lParam )
+LONG NC_HandleSetCursor( HWND hwnd, WPARAM16 wParam, LPARAM lParam )
 {
     if (hwnd != (HWND)wParam) return 0;  /* Don't set the cursor for child windows */
 
@@ -873,7 +873,7 @@
  *
  * Track a mouse button press on the system menu.
  */
-static void NC_TrackSysMenu( HWND hwnd, HDC hdc, POINT16 pt )
+static void NC_TrackSysMenu( HWND hwnd, HDC16 hdc, POINT16 pt )
 {
     RECT16 rect;
     WND *wndPtr = WIN_FindWndPtr( hwnd );
@@ -906,7 +906,7 @@
  * Initialisation of a move or resize, when initiatied from a menu choice.
  * Return hit test code for caption or sizing border.
  */
-static LONG NC_StartSizeMove( HWND hwnd, WPARAM wParam, POINT16 *capturePoint )
+static LONG NC_StartSizeMove( HWND hwnd, WPARAM16 wParam, POINT16 *capturePoint )
 {
     LONG hittest = 0;
     POINT16 pt;
@@ -979,7 +979,7 @@
     }
     *capturePoint = pt;
     SetCursorPos( capturePoint->x, capturePoint->y );
-    NC_HandleSetCursor( hwnd, (WPARAM)hwnd, MAKELONG( hittest, WM_MOUSEMOVE ));
+    NC_HandleSetCursor( hwnd, (WPARAM16)hwnd, MAKELONG( hittest, WM_MOUSEMOVE ));
     return hittest;
 }
 
@@ -1278,7 +1278,7 @@
  *
  * Handle a WM_NCLBUTTONDOWN message. Called from DefWindowProc().
  */
-LONG NC_HandleNCLButtonDown( HWND hwnd, WPARAM wParam, LPARAM lParam )
+LONG NC_HandleNCLButtonDown( HWND hwnd, WPARAM16 wParam, LPARAM lParam )
 {
     HDC32 hdc;
 
@@ -1334,7 +1334,7 @@
  *
  * Handle a WM_NCLBUTTONDBLCLK message. Called from DefWindowProc().
  */
-LONG NC_HandleNCLButtonDblClk( WND *pWnd, WPARAM wParam, LPARAM lParam )
+LONG NC_HandleNCLButtonDblClk( WND *pWnd, WPARAM16 wParam, LPARAM lParam )
 {
     /*
      * if this is an icon, send a restore since we are handling
@@ -1370,7 +1370,7 @@
  *
  * Handle a WM_SYSCOMMAND message. Called from DefWindowProc().
  */
-LONG NC_HandleSysCommand( HWND hwnd, WPARAM wParam, POINT16 pt )
+LONG NC_HandleSysCommand( HWND hwnd, WPARAM16 wParam, POINT16 pt )
 {
     WND *wndPtr = WIN_FindWndPtr( hwnd );
     POINT32 pt32;
diff --git a/windows/painting.c b/windows/painting.c
index 366c629..bce51e0 100644
--- a/windows/painting.c
+++ b/windows/painting.c
@@ -133,7 +133,7 @@
         wndPtr->flags &= ~WIN_NEEDS_ERASEBKGND;
         lps->fErase = !SendMessage16(hwnd, (bIcon) ? WM_ICONERASEBKGND
                                                    : WM_ERASEBKGND,
-                                     (WPARAM)lps->hdc, 0 );
+                                     (WPARAM16)lps->hdc, 0 );
     }
     else lps->fErase = TRUE;
 
@@ -208,7 +208,7 @@
 	if (!hwndParent) return;
 	hbrush = (HBRUSH16)SendMessage32A( hwndParent, 
                                            WM_CTLCOLORMSGBOX + (UINT32)hbrush,
-                                           (WPARAM)hdc, (LPARAM)hwnd );
+                                           (WPARAM32)hdc, (LPARAM)hwnd );
     }
     if (hbrush) FillRect16( hdc, rect, hbrush );
 }
@@ -217,10 +217,10 @@
 /***********************************************************************
  *           GetControlBrush    (USER.326)
  */
-HBRUSH16 GetControlBrush( HWND hwnd, HDC hdc, WORD control )
+HBRUSH16 GetControlBrush( HWND hwnd, HDC16 hdc, WORD control )
 {
     return (HBRUSH16)SendMessage32A( GetParent32(hwnd), WM_CTLCOLOR+control,
-                                     (WPARAM)hdc, (LPARAM)hwnd );
+                                     (WPARAM32)hdc, (LPARAM)hwnd );
 }
 
 
@@ -379,7 +379,7 @@
             {
                if (SendMessage16( hwnd, (bIcon) ? WM_ICONERASEBKGND
 						: WM_ERASEBKGND,
-                                  (WPARAM)hdc, 0 ))
+                                  (WPARAM16)hdc, 0 ))
                   wndPtr->flags &= ~WIN_NEEDS_ERASEBKGND;
                ReleaseDC32( hwnd, hdc );
             }
diff --git a/windows/scroll.c b/windows/scroll.c
index 8692792..d06015f 100644
--- a/windows/scroll.c
+++ b/windows/scroll.c
@@ -101,7 +101,7 @@
  *             ScrollDC         (USER.221)
  *
  */
-BOOL ScrollDC(HDC hdc, short dx, short dy, LPRECT16 rc, LPRECT16 cliprc,
+BOOL ScrollDC(HDC16 hdc, short dx, short dy, LPRECT16 rc, LPRECT16 cliprc,
 	      HRGN32 hrgnUpdate, LPRECT16 rcUpdate)
 {
     HRGN32 hrgnClip = 0;
diff --git a/windows/win.c b/windows/win.c
index da4b5e6..4b8e12e 100644
--- a/windows/win.c
+++ b/windows/win.c
@@ -2016,7 +2016,7 @@
         {
             HDC32 hDC = GetDC32(hWnd);
             
-            if (!SendMessage16( hWnd, WM_ERASEBKGND, (WPARAM)hDC, (LPARAM)0 ))
+            if (!SendMessage16( hWnd, WM_ERASEBKGND, (WPARAM16)hDC, 0 ))
                 wndPtr->flags |= WIN_NEEDS_ERASEBKGND;
             
             ReleaseDC32( hWnd, hDC );
@@ -2032,7 +2032,7 @@
     }
     else
     {
-        WPARAM wparam;
+        WPARAM16 wparam;
         if (bInvert) wparam = !(wndPtr->flags & WIN_NCACTIVATED);
         else wparam = (hWnd == GetActiveWindow());
 
@@ -2126,7 +2126,7 @@
  ptrDragInfo->hScope = hQueryWnd;
 
  bResult = SendMessage16( hQueryWnd ,WM_QUERYDROPOBJECT ,
-                       (WPARAM)wParam ,(LPARAM) spDragInfo );
+                          (WPARAM16)wParam ,(LPARAM) spDragInfo );
  if( !bResult ) 
       ptrDragInfo->pt = pt;
 
@@ -2257,7 +2257,7 @@
     dprintf_msg(stddeb,"drag: got %04x\n",btemp);
 
     /* send WM_DRAGLOOP */
-    SendMessage16( hWnd, WM_DRAGLOOP, (WPARAM)(hCurrentCursor != hBummer) , 
+    SendMessage16( hWnd, WM_DRAGLOOP, (WPARAM16)(hCurrentCursor != hBummer) , 
 	                            (LPARAM) spDragInfo );
     /* send WM_DRAGSELECT or WM_DRAGMOVE */
     if( hCurrentWnd != lpDragInfo->hScope )
@@ -2292,7 +2292,7 @@
 
  if( hCurrentCursor != hBummer ) 
 	dwRet = SendMessage16( lpDragInfo->hScope, WM_DROPOBJECT, 
-			     (WPARAM)hWnd, (LPARAM)spDragInfo );
+                               (WPARAM16)hWnd, (LPARAM)spDragInfo );
  GlobalFree16(hDragInfo);
 
  return dwRet;
diff --git a/windows/winpos.c b/windows/winpos.c
index a5743f8..407e824 100644
--- a/windows/winpos.c
+++ b/windows/winpos.c
@@ -962,7 +962,7 @@
         LRESULT wRet;
         cbtStruct->fMouse     = fMouse;
         cbtStruct->hWndActive = hwndActive;
-        wRet = HOOK_CallHooks( WH_CBT, HCBT_ACTIVATE, (WPARAM)hWnd,
+        wRet = HOOK_CallHooks( WH_CBT, HCBT_ACTIVATE, (WPARAM16)hWnd,
                                (LPARAM)SEGPTR_GET(cbtStruct) );
         SEGPTR_FREE(cbtStruct);
         if (wRet) return wRet;
@@ -990,7 +990,7 @@
 
     /* send palette messages */
     if (hWnd && SendMessage16( hWnd, WM_QUERYNEWPALETTE, 0, 0L))
-	SendMessage16((HWND16)-1, WM_PALETTEISCHANGING, (WPARAM)hWnd, 0L );
+	SendMessage16((HWND16)-1, WM_PALETTEISCHANGING, (WPARAM16)hWnd, 0L );
 
     /* if prev wnd is minimized redraw icon title 
   if( hwndPrevActive )
diff --git a/wine.man b/wine.man
index d4c66bf..3e71c1a 100644
--- a/wine.man
+++ b/wine.man
@@ -69,13 +69,14 @@
 Turn debugging messages on or off - for instance, 
 .I -debugmsg +dll,+heap
 will turn on DLL and heap debugging messages.  The full list is:
-all, accel, bitblt, bitmap, caret, catch, cdaudio, class, clipboard, clipping,
-combo, comm, cursor, dc, dialog, dll, dosfs, driver, edit, enum, event, exec,
-file, fixup, font, gdi, global, graphics, icon, int, key, keyboard, ldt,
-listbox, local, malloc, mci, mcianim, mciwave, mdi, menu, menucalc, message,
-metafile, midi, mmio, mmsys, mmtime, module, msg, nonclient, ole, palette, 
-profile, prop, reg, region, relay, resource, scroll, selector, selectors, 
-stress, syscolor, task, text, timer, toolhelp, utility, win, winsock.
+all, accel, atom, bitblt, bitmap, caret, cdaudio, class, clipboard, clipping,
+combo, comm, commdlg, crtdll, cursor, dc, dde, dialog, dll, dosfs, driver, edit,
+env, event, exec, file, fixup, font, gdi, global, graphics, heap, hook, icon,
+int, key, keyboard, ldt, listbox, local, mci, mcianim, mciwave, mdi, menu,
+message, metafile, midi, mmio, mmsys, mmtime, module, msg, nonclient, ole,
+palette, profile, prop, reg, region, relay, resource, scroll, selector,
+sem, sendmsg, shm, stress, syscolor, task, text, timer, toolhelp, ver, vxd, win,
+win32, winsock.
 .TP
 .I -depth n
 Change the depth to use for multiple-depth screens
@@ -91,9 +92,11 @@
 .I -dll -commdlg
 is probably a good idea.
 The full list of DLLs modifiable by this is:
-KERNEL, USER, GDI, WIN87EM, SHELL, SOUND, KEYBOARD, WINSOCK, STRESS, MMSYSTEM,
-SYSTEM, TOOLHELP, MOUSE, COMMDLG, OLE2, OLE2CONV, OLE2DISP, OLE2NLS, OLE2PROX,
-OLECLI, OLESVR, COMPOBJ, STORAGE, WINPROCS, DDEML
+WIN87EM, SHELL, SOUND, KEYBOARD, WINSOCK, STRESS, MMSYSTEM, SYSTEM, TOOLHELP,
+MOUSE, COMMDLG, OLE2, OLE2CONV, OLE2DISP, OLE2NLS, OLE2PROX, OLECLI, OLESVR,
+COMPOBJ, STORAGE, WINPROCS, DDEML, ADVAPI32, COMCTL32, COMDLG32, CRTDLL,
+GDI32, LZ32, MPR, NTDLL, OLE32, SHELL32, USER32, VER, VERSION, W32SYS, WINMM,
+WINSPOOL, WSOCK32
 .TP
 .I -fixedmap
 Use a "standard" color map.
@@ -126,6 +129,10 @@
 .TP
 .I -synchronous
 Turn on synchronous display mode
+.TP
+.I -winver version
+Specify which Windows version WINE should imitate.
+Possible arguments are: win31, win95 and nt351.
 .PD 1
 .SH PROGRAM/ARGUMENTS
 The program name may be specified in DOS format (C:\\WINDOWS\\SOL.EXE) or in