Release 980301

Sun Mar  1 10:45:23 1998  Andreas Mohr <100.30936@germany.net>

	* [loader/ne_image.c]
	Fixed problem with weird DLLs (NE_FFLAGS_SINGLEDATA && DGROUP = 0).

	* [msdos/dosmem.c]
	Export address for __0000H, too.

	* [msdos/dpmi.c]
	Changed MemAlloc functions to return less fragmented addresses.

Sat Feb 28 18:50:12 1998  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [scheduler/process.c] [scheduler/sysdeps.c]
	Don't use %fs register before threading initialization.

Sat Feb 28 14:04:56 1998  Kristian Nielsen  <kristian.nielsen@risoe.dk>

	* [configure.in] [include/acconfig.h]
	Autoconf macro to check for non-reentrant X libraries.

	* [windows/winpos.c]
	In SetWindowPos32(), do not cause WM_SIZE messages when the
	SWP_NOSIZE flag is specified. This fixes the division-by-zero in
	Borland C++ 4.0 "Open Project" menu item.

Sat Feb 28 13:11:26 1998  James Moody  <013263m@dragon.acadiau.ca>

	* [ole/ole2nls.c]
	Changed "English" values from German to English.

	* [files/dos_fs.c]
	Fixed off-by-one month bug.

Fri Feb 27 22:12:01 1998  Douglas Ridgway  <ridgway@winehq.com>

	* [windows/win.c]
	Fix winelib class menu loading bug.

	* [include/module.h] [loader/module.c]
	LoadModule32 should be implemented in terms of CreateProcess.

	* [programs/view/*]
	Metafile viewer sample program.

	* [documentation/wine.texinfo] [documentation/Makefile.in]
	Improvements and additions, HTML target.

Fri Feb 27 04:27:48 1998  Dimitrie O. Paun <dimi@cs.toronto.edu>

	* [*/*]
	Switched to the new debug messages interface. For more information
	please refer to documentation/debug-msgs. Because the new scheme
	introduces a new semantic level, I had to manually do through
	about 530 dprintf_xxx!  The rest of about 2400 where transformed
	via a script.  Because of the large number of changes that I had
	to do, some may have not come out as nicely as I wanted them.  If
	this is the case, please let me know. There is a lot of work left
	to do: -- a few hundred printf's to be converted -- about 2300
	fprintf's to be converted -- about 600 FIXME's to be transformed
	The problem is that in the above mentioned cases, a lot of manual
	intervention is required because a lot of the information is
	missing.  There are also a lot of other things to be done to the
	interface and so forth. I have now ideas for a at least a month
	worth of full time work :) I will proceed with many changes in the
	next few releases, so please do not start modifing things because
	there will be a hell of a lot of conflicts. If you have ideas that
	you want to integrate or you want to work on different things,
	please coordinate with me.

Thu Feb 26 13:04:29 1998  David Lee Lambert <lamber45@egr.msu.edu>

	* [ole/ole2nls.c] [include/windows.h]
	First try at OLE date- and time-formatting functions.

Wed Feb 25 11:20:35 1998 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>

	* [files/*.c]
	Changed dos device handling, added 'CON' devicehandling.

	* [graphics/ddraw.c]
	Bug fixes, some additions.

	* [if1632/builtin.c][loader/module.c][library/winestub.c]
	Small hack so we don't need a dummy BUILTIN_LoadModule
	in winestub.c.

	* [ole/*][relay32/ole32.spec][if1632/storage.spec]
	storage.dll started. winword loads documents (saving
	doesn't work yet, dunno why).
	Several ole additions, some cleanups and bugfixes.
	IMalloc16 implemented.

	* [loader/pe_image.c]
	Added some comments, fixed circular dll references,
	fixed modref ordering, fixed tls allocation.

	* [memory/global.c]
	Added validity checks before every GET_ARENA_PTR.
	(several functions rely on Global* return values
	 on invalid handles, like IsTask).
	Implemented GlobalUnlockFree16.

	* [memory/virtual.c]
	Replaced dprintf_virtual by fprintf, so we can
	do 'info map' again in the debugger. Increase read
	linesize for Linux2.1 cases.

	* [misc/cpu.c][misc/registry.c]
	Moved cpu registry initialization to misc/cpu.c.

	* [multimedia/dsound.c]
	Enhanced, replaced GETOSPACE bufferingcheck by SETFRAGMENT.

	* [relay32/crtdll.spec][relay32/ntdll.spec]
	Replaced some ptr by respective 'str' and 'wstr' arguments
	for libc functions.

	* [scheduler/thread.c]
	Added some sanity checks to stackallocation, tlshandling fixed.

	* [tools/build.c]
	Fixed cdecl argumenttype order (was reversed).

	* [win32/ordinals.c]
	Implemented KERNEL_449.

	* [windows/dinput.c]
	Some fixes, needs much more work. Tomb Raider2 works with keyboard ;)

Tue Feb 24 20:46:37 1998  James Juran   <jrj120@psu.edu>

	* [windows/win.c]
	Fixed USER32 ordinal numbers in documentation.

Sat Feb 21 12:30:38 1998  John Richardson <jrichard@zko.dec.com>

	* [files/file.c] [include/k32obj.h] [memory/virtual.c]
	[scheduler/critsection.c] [scheduler/event.c] [scheduler/handle.c]
	[scheduler/k32obj.c] [scheduler/mutex.c] [scheduler/process.c]
	[scheduler/semaphore.c] [scheduler/thread.c]
	Added generic k32obj read and write routines for k32objs that
	support I/O.

	* [documentation/console]
	Updated console docs.

	* [win32/console.c]
	Make console work like a k32obj that supports I/O.

	* [include/windows.h]
	Make WriteFile and ReadFile take HANDLE32 for handle.

Sun Feb 15 14:07:07 1998  Dimitrie O. Paun  <dimi@mail.cs.toronto.edu>

	* [controls/menu.c] [misc/ver.c] [multimedia/dsound.c]
	  [multimedia/joystick.c] [windows/dialog.c]
	Modified some dprintf_xxx's to prepare them for a new
	dprintf_ scheme. Basically, I changed the dprintf's that
	outputed a line with many dprintf calls to do just one
	dprintf call.
diff --git a/ANNOUNCE b/ANNOUNCE
index f2e7fac..99387fb 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,13 +1,13 @@
-This is release 980215 of Wine, the MS Windows emulator.  This is still a
+This is release 980301 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-980215: (see ChangeLog for details)
-	- Preliminary console allocation support.
-	- Hopefully no more Xlib errno problems.
+WHAT'S NEW with Wine-980301: (see ChangeLog for details)
+	- New debugging printfs scheme.
+	- Better DOS device handling.
 	- 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-980215.tar.gz
-  ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-980215.tar.gz
-  ftp://ftp.infomagic.com/pub/mirrors/linux/wine/development/Wine-980215.tar.gz
-  ftp://ftp.progsoc.uts.edu.au/pub/Wine/development/Wine-980215.tar.gz
+  ftp://sunsite.unc.edu/pub/Linux/ALPHA/wine/development/Wine-980301.tar.gz
+  ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-980301.tar.gz
+  ftp://ftp.infomagic.com/pub/mirrors/linux/wine/development/Wine-980301.tar.gz
+  ftp://ftp.progsoc.uts.edu.au/pub/Wine/development/Wine-980301.tar.gz
 
 It should also be available from any site that mirrors tsx-11 or sunsite.
 
diff --git a/AUTHORS b/AUTHORS
index 09aad3f..4580845 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -10,6 +10,7 @@
 Martin Ayotte,
 Karl Backström,
 Peter Bajusz,
+Marcel Baur,
 Georg Beyerle,
 Ross Biro,
 Martin Boehme,
diff --git a/ChangeLog b/ChangeLog
index 7ee7ad4..a77cdc3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,167 @@
 ----------------------------------------------------------------------
+Sun Feb 29 10:45:23 1997  Andreas Mohr <100.30936@germany.net>
+
+	* [loader/ne_image.c]
+	Fixed problem with weird DLLs (NE_FFLAGS_SINGLEDATA && DGROUP = 0).
+
+	* [msdos/dosmem.c]
+	Export address for __0000H, too.
+
+	* [msdos/dpmi.c]
+	Changed MemAlloc functions to return less fragmented addresses.
+
+Sat Feb 28 18:50:12 1998  Alexandre Julliard  <julliard@lrc.epfl.ch>
+
+	* [scheduler/process.c] [scheduler/sysdeps.c]
+	Don't use %fs register before threading initialization.
+
+Sat Feb 28 14:04:56 1998  Kristian Nielsen  <kristian.nielsen@risoe.dk>
+
+	* [configure.in] [include/acconfig.h]
+	Autoconf macro to check for non-reentrant X libraries.
+
+	* [windows/winpos.c]
+	In SetWindowPos32(), do not cause WM_SIZE messages when the
+	SWP_NOSIZE flag is specified. This fixes the division-by-zero in
+	Borland C++ 4.0 "Open Project" menu item.
+
+Sat Feb 28 13:11:26 1998  James Moody  <013263m@dragon.acadiau.ca>
+
+	* [ole/ole2nls.c]
+	Changed "English" values from German to English.
+
+	* [files/dos_fs.c]
+	Fixed off-by-one month bug.
+
+Fri Feb 27 22:12:01 1998  Douglas Ridgway  <ridgway@winehq.com>
+
+	* [windows/win.c]
+	Fix winelib class menu loading bug.
+
+	* [include/module.h] [loader/module.c]
+	LoadModule32 should be implemented in terms of CreateProcess.
+
+	* [programs/view/*]
+	Metafile viewer sample program.
+
+	* [documentation/wine.texinfo] [documentation/Makefile.in]
+	Improvements and additions, HTML target.
+
+Fri Feb 27 04:27:48 1998  Dimitrie O. Paun <dimi@cs.toronto.edu>
+
+	* [*/*]
+	Switched to the new debug messages interface. For more information
+	please refer to documentation/debug-msgs. Because the new scheme
+	introduces a new semantic level, I had to manually do through
+	about 530 dprintf_xxx!  The rest of about 2400 where transformed
+	via a script.  Because of the large number of changes that I had
+	to do, some may have not come out as nicely as I wanted them.  If
+	this is the case, please let me know. There is a lot of work left
+	to do: -- a few hundred printf's to be converted -- about 2300
+	fprintf's to be converted -- about 600 FIXME's to be transformed
+	The problem is that in the above mentioned cases, a lot of manual
+	intervention is required because a lot of the information is
+	missing.  There are also a lot of other things to be done to the
+	interface and so forth. I have now ideas for a at least a month
+	worth of full time work :) I will proceed with many changes in the
+	next few releases, so please do not start modifing things because
+	there will be a hell of a lot of conflicts. If you have ideas that
+	you want to integrate or you want to work on different things,
+	please coordinate with me.
+
+Thu Feb 26 13:04:29 1998  David Lee Lambert <lamber45@egr.msu.edu>
+
+	* [ole/ole2nls.c] [include/windows.h]
+	First try at OLE date- and time-formatting functions.
+
+Wed Feb 25 11:20:35 1998 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>
+
+	* [files/*.c]
+	Changed dos device handling, added 'CON' devicehandling.
+
+	* [graphics/ddraw.c]
+	Bug fixes, some additions.
+
+	* [if1632/builtin.c][loader/module.c][library/winestub.c]
+	Small hack so we don't need a dummy BUILTIN_LoadModule
+	in winestub.c.
+
+	* [ole/*][relay32/ole32.spec][if1632/storage.spec]
+	storage.dll started. winword loads documents (saving
+	doesn't work yet, dunno why).
+	Several ole additions, some cleanups and bugfixes.
+	IMalloc16 implemented.
+
+	* [loader/pe_image.c]
+	Added some comments, fixed circular dll references,
+	fixed modref ordering, fixed tls allocation.
+
+	* [memory/global.c]
+	Added validity checks before every GET_ARENA_PTR.
+	(several functions rely on Global* return values
+	 on invalid handles, like IsTask).
+	Implemented GlobalUnlockFree16.
+
+	* [memory/virtual.c]
+	Replaced dprintf_virtual by fprintf, so we can
+	do 'info map' again in the debugger. Increase read
+	linesize for Linux2.1 cases.
+
+	* [misc/cpu.c][misc/registry.c]
+	Moved cpu registry initialization to misc/cpu.c.
+
+	* [multimedia/dsound.c]
+	Enhanced, replaced GETOSPACE bufferingcheck by SETFRAGMENT.
+
+	* [relay32/crtdll.spec][relay32/ntdll.spec]
+	Replaced some ptr by respective 'str' and 'wstr' arguments
+	for libc functions.
+
+	* [scheduler/thread.c]
+	Added some sanity checks to stackallocation, tlshandling fixed.
+
+	* [tools/build.c]
+	Fixed cdecl argumenttype order (was reversed).
+
+	* [win32/ordinals.c]
+	Implemented KERNEL_449.
+
+	* [windows/dinput.c]
+	Some fixes, needs much more work. Tomb Raider2 works with keyboard ;)
+
+Tue Feb 24 20:46:37 1998  James Juran   <jrj120@psu.edu>
+
+	* [windows/win.c]
+	Fixed USER32 ordinal numbers in documentation.
+
+Sat Feb 21 12:30:38 1998  John Richardson <jrichard@zko.dec.com>
+
+	* [files/file.c] [include/k32obj.h] [memory/virtual.c]
+	[scheduler/critsection.c] [scheduler/event.c] [scheduler/handle.c]
+	[scheduler/k32obj.c] [scheduler/mutex.c] [scheduler/process.c]
+	[scheduler/semaphore.c] [scheduler/thread.c]
+	Added generic k32obj read and write routines for k32objs that
+	support I/O.
+
+	* [documentation/console]
+	Updated console docs.
+
+	* [win32/console.c]
+	Make console work like a k32obj that supports I/O.
+
+	* [include/windows.h]
+	Make WriteFile and ReadFile take HANDLE32 for handle.
+
+----------------------------------------------------------------------
+Sun Feb 15 14:07:07 1998  Dimitrie O. Paun  <dimi@mail.cs.toronto.edu>
+
+	* [controls/menu.c] [misc/ver.c] [multimedia/dsound.c]
+	  [multimedia/joystick.c] [windows/dialog.c]
+	Modified some dprintf_xxx's to prepare them for a new
+	dprintf_ scheme. Basically, I changed the dprintf's that
+	outputed a line with many dprintf calls to do just one
+	dprintf call.
+
 Sun Feb 15 12:02:59 1998  Alexandre Julliard  <julliard@lrc.epfl.ch>
 
 	* [graphics/x11drv/*.c] [objects/*.c]
diff --git a/configure b/configure
index 44efdae..0aadfa3 100755
--- a/configure
+++ b/configure
@@ -17,6 +17,8 @@
 ac_help="$ac_help
   --enable-dll            build the Wine library as a DLL"
 ac_help="$ac_help
+  --without-reentrant-x   Compile for use with non-reentrant X libraries"
+ac_help="$ac_help
   --with-x                use the X Window System"
 
 # Initialize some variables set by options.
@@ -569,13 +571,20 @@
 
 
 
+# Check whether --with-reentrant-x or --without-reentrant-x was given.
+if test "${with_reentrant_x+set}" = set; then
+  withval="$with_reentrant_x"
+  :
+fi
+
+
 
 
 
 
 
 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:579: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:588: checking whether ${MAKE-make} sets \${MAKE}" >&5
 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -604,7 +613,7 @@
 # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:608: checking for $ac_word" >&5
+echo "configure:617: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -633,7 +642,7 @@
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:637: checking for $ac_word" >&5
+echo "configure:646: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -681,7 +690,7 @@
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:685: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:694: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -691,11 +700,11 @@
 cross_compiling=$ac_cv_prog_cc_cross
 
 cat > conftest.$ac_ext <<EOF
-#line 695 "configure"
+#line 704 "configure"
 #include "confdefs.h"
 main(){return(0);}
 EOF
-if { (eval echo configure:699: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:708: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   ac_cv_prog_cc_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
@@ -715,12 +724,12 @@
   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:719: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:728: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:724: checking whether we are using GNU C" >&5
+echo "configure:733: checking whether we are using GNU C" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -729,7 +738,7 @@
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:733: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:742: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
@@ -744,7 +753,7 @@
   ac_save_CFLAGS="$CFLAGS"
   CFLAGS=
   echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:748: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:757: checking whether ${CC-cc} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -772,7 +781,7 @@
 fi
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:776: checking how to run the C preprocessor" >&5
+echo "configure:785: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -787,13 +796,13 @@
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 791 "configure"
+#line 800 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:797: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:806: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
@@ -804,13 +813,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 808 "configure"
+#line 817 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:814: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:823: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
@@ -837,7 +846,7 @@
 # Uses ac_ vars as temps to allow command line to override cache and checks.
 # --without-x overrides everything else, but does not touch the cache.
 echo $ac_n "checking for X""... $ac_c" 1>&6
-echo "configure:841: checking for X" >&5
+echo "configure:850: checking for X" >&5
 
 # Check whether --with-x or --without-x was given.
 if test "${with_x+set}" = set; then
@@ -899,12 +908,12 @@
 
   # First, try using that file with no special directory specified.
 cat > conftest.$ac_ext <<EOF
-#line 903 "configure"
+#line 912 "configure"
 #include "confdefs.h"
 #include <$x_direct_test_include>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:908: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:917: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -973,14 +982,14 @@
   ac_save_LIBS="$LIBS"
   LIBS="-l$x_direct_test_library $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 977 "configure"
+#line 986 "configure"
 #include "confdefs.h"
 
 int main() {
 ${x_direct_test_function}()
 ; return 0; }
 EOF
-if { (eval echo configure:984: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:993: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   LIBS="$ac_save_LIBS"
 # We can link X programs with no special library path.
@@ -1086,17 +1095,17 @@
     case "`(uname -sr) 2>/dev/null`" in
     "SunOS 5"*)
       echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6
-echo "configure:1090: checking whether -R must be followed by a space" >&5
+echo "configure:1099: checking whether -R must be followed by a space" >&5
       ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries"
       cat > conftest.$ac_ext <<EOF
-#line 1093 "configure"
+#line 1102 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:1100: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1109: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   ac_R_nospace=yes
 else
@@ -1112,14 +1121,14 @@
       else
 	LIBS="$ac_xsave_LIBS -R $x_libraries"
 	cat > conftest.$ac_ext <<EOF
-#line 1116 "configure"
+#line 1125 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:1123: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1132: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   ac_R_space=yes
 else
@@ -1151,7 +1160,7 @@
     # libraries were built with DECnet support.  And karl@cs.umb.edu says
     # the Alpha needs dnet_stub (dnet does not exist).
     echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6
-echo "configure:1155: checking for dnet_ntoa in -ldnet" >&5
+echo "configure:1164: checking for dnet_ntoa in -ldnet" >&5
 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1159,7 +1168,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ldnet  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1163 "configure"
+#line 1172 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1170,7 +1179,7 @@
 dnet_ntoa()
 ; return 0; }
 EOF
-if { (eval echo configure:1174: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1183: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1192,7 +1201,7 @@
 
     if test $ac_cv_lib_dnet_dnet_ntoa = no; then
       echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6
-echo "configure:1196: checking for dnet_ntoa in -ldnet_stub" >&5
+echo "configure:1205: checking for dnet_ntoa in -ldnet_stub" >&5
 ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1200,7 +1209,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ldnet_stub  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1204 "configure"
+#line 1213 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1211,7 +1220,7 @@
 dnet_ntoa()
 ; return 0; }
 EOF
-if { (eval echo configure:1215: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1224: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1240,12 +1249,12 @@
     # The nsl library prevents programs from opening the X display
     # on Irix 5.2, according to dickey@clark.net.
     echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
-echo "configure:1244: checking for gethostbyname" >&5
+echo "configure:1253: checking for gethostbyname" >&5
 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1249 "configure"
+#line 1258 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char gethostbyname(); below.  */
@@ -1268,7 +1277,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:1272: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1281: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_gethostbyname=yes"
 else
@@ -1289,7 +1298,7 @@
 
     if test $ac_cv_func_gethostbyname = no; then
       echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:1293: checking for gethostbyname in -lnsl" >&5
+echo "configure:1302: checking for gethostbyname in -lnsl" >&5
 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1297,7 +1306,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1301 "configure"
+#line 1310 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1308,7 +1317,7 @@
 gethostbyname()
 ; return 0; }
 EOF
-if { (eval echo configure:1312: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1321: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1338,12 +1347,12 @@
     # -lsocket must be given before -lnsl if both are needed.
     # We assume that if connect needs -lnsl, so does gethostbyname.
     echo $ac_n "checking for connect""... $ac_c" 1>&6
-echo "configure:1342: checking for connect" >&5
+echo "configure:1351: checking for connect" >&5
 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1347 "configure"
+#line 1356 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char connect(); below.  */
@@ -1366,7 +1375,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:1370: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1379: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_connect=yes"
 else
@@ -1387,7 +1396,7 @@
 
     if test $ac_cv_func_connect = no; then
       echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6
-echo "configure:1391: checking for connect in -lsocket" >&5
+echo "configure:1400: checking for connect in -lsocket" >&5
 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1395,7 +1404,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket $X_EXTRA_LIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1399 "configure"
+#line 1408 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1406,7 +1415,7 @@
 connect()
 ; return 0; }
 EOF
-if { (eval echo configure:1410: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1419: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1430,12 +1439,12 @@
 
     # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX.
     echo $ac_n "checking for remove""... $ac_c" 1>&6
-echo "configure:1434: checking for remove" >&5
+echo "configure:1443: checking for remove" >&5
 if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1439 "configure"
+#line 1448 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char remove(); below.  */
@@ -1458,7 +1467,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:1462: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1471: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_remove=yes"
 else
@@ -1479,7 +1488,7 @@
 
     if test $ac_cv_func_remove = no; then
       echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6
-echo "configure:1483: checking for remove in -lposix" >&5
+echo "configure:1492: checking for remove in -lposix" >&5
 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1487,7 +1496,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lposix  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1491 "configure"
+#line 1500 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1498,7 +1507,7 @@
 remove()
 ; return 0; }
 EOF
-if { (eval echo configure:1502: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1511: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1522,12 +1531,12 @@
 
     # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
     echo $ac_n "checking for shmat""... $ac_c" 1>&6
-echo "configure:1526: checking for shmat" >&5
+echo "configure:1535: checking for shmat" >&5
 if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1531 "configure"
+#line 1540 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char shmat(); below.  */
@@ -1550,7 +1559,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:1554: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1563: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_shmat=yes"
 else
@@ -1571,7 +1580,7 @@
 
     if test $ac_cv_func_shmat = no; then
       echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6
-echo "configure:1575: checking for shmat in -lipc" >&5
+echo "configure:1584: checking for shmat in -lipc" >&5
 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1579,7 +1588,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lipc  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1583 "configure"
+#line 1592 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1590,7 +1599,7 @@
 shmat()
 ; return 0; }
 EOF
-if { (eval echo configure:1594: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1603: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1623,7 +1632,7 @@
   # libraries we check for below, so use a different variable.
   #  --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
   echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6
-echo "configure:1627: checking for IceConnectionNumber in -lICE" >&5
+echo "configure:1636: checking for IceConnectionNumber in -lICE" >&5
 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1631,7 +1640,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lICE  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1635 "configure"
+#line 1644 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1642,7 +1651,7 @@
 IceConnectionNumber()
 ; return 0; }
 EOF
-if { (eval echo configure:1646: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1655: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1671,7 +1680,7 @@
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1675: checking for $ac_word" >&5
+echo "configure:1684: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1703,7 +1712,7 @@
 # Extract the first word of "flex", so it can be a program name with args.
 set dummy flex; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1707: checking for $ac_word" >&5
+echo "configure:1716: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1736,7 +1745,7 @@
   *) ac_lib=l ;;
   esac
   echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6
-echo "configure:1740: checking for yywrap in -l$ac_lib" >&5
+echo "configure:1749: checking for yywrap in -l$ac_lib" >&5
 ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1744,7 +1753,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-l$ac_lib  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1748 "configure"
+#line 1757 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1755,7 +1764,7 @@
 yywrap()
 ; return 0; }
 EOF
-if { (eval echo configure:1759: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1768: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1780,7 +1789,7 @@
 # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1784: checking for $ac_word" >&5
+echo "configure:1793: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1817,7 +1826,7 @@
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:1821: checking for a BSD compatible install" >&5
+echo "configure:1830: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1867,7 +1876,7 @@
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:1871: checking whether ln -s works" >&5
+echo "configure:1880: checking whether ln -s works" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1890,7 +1899,7 @@
 
 
 echo $ac_n "checking for i386_set_ldt in -li386""... $ac_c" 1>&6
-echo "configure:1894: checking for i386_set_ldt in -li386" >&5
+echo "configure:1903: checking for i386_set_ldt in -li386" >&5
 ac_lib_var=`echo i386'_'i386_set_ldt | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1898,7 +1907,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-li386  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1902 "configure"
+#line 1911 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1909,7 +1918,7 @@
 i386_set_ldt()
 ; return 0; }
 EOF
-if { (eval echo configure:1913: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1922: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1937,7 +1946,7 @@
 fi
 
 echo $ac_n "checking for iswalnum in -lw""... $ac_c" 1>&6
-echo "configure:1941: checking for iswalnum in -lw" >&5
+echo "configure:1950: checking for iswalnum in -lw" >&5
 ac_lib_var=`echo w'_'iswalnum | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1945,7 +1954,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lw  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1949 "configure"
+#line 1958 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1956,7 +1965,7 @@
 iswalnum()
 ; return 0; }
 EOF
-if { (eval echo configure:1960: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1969: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1984,7 +1993,7 @@
 fi
 
 echo $ac_n "checking for XF86DGAQueryExtension in -lXxf86dga""... $ac_c" 1>&6
-echo "configure:1988: checking for XF86DGAQueryExtension in -lXxf86dga" >&5
+echo "configure:1997: checking for XF86DGAQueryExtension in -lXxf86dga" >&5
 ac_lib_var=`echo Xxf86dga'_'XF86DGAQueryExtension | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1992,7 +2001,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lXxf86dga $X_LIBS -lXext -lX11 $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1996 "configure"
+#line 2005 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2003,7 +2012,7 @@
 XF86DGAQueryExtension()
 ; return 0; }
 EOF
-if { (eval echo configure:2007: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2016: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2029,12 +2038,12 @@
 
 
 echo $ac_n "checking "for Open Sound System"""... $ac_c" 1>&6
-echo "configure:2033: checking "for Open Sound System"" >&5
+echo "configure:2042: checking "for Open Sound System"" >&5
 if eval "test \"`echo '$''{'ac_cv_c_opensoundsystem'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2038 "configure"
+#line 2047 "configure"
 #include "confdefs.h"
 #include <sys/soundcard.h>
 int main() {
@@ -2046,7 +2055,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2050: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2059: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_opensoundsystem="yes"
 else
@@ -2070,12 +2079,12 @@
 
 
 echo $ac_n "checking "for union semun"""... $ac_c" 1>&6
-echo "configure:2074: checking "for union semun"" >&5
+echo "configure:2083: checking "for union semun"" >&5
 if eval "test \"`echo '$''{'ac_cv_c_union_semun'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2079 "configure"
+#line 2088 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/sem.h>
@@ -2083,7 +2092,7 @@
 union semun foo
 ; return 0; }
 EOF
-if { (eval echo configure:2087: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2096: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_union_semun="yes"
 else
@@ -2111,7 +2120,7 @@
 then
   CFLAGS="$CFLAGS -Wall"
   echo $ac_n "checking "for gcc strength-reduce bug"""... $ac_c" 1>&6
-echo "configure:2115: checking "for gcc strength-reduce bug"" >&5
+echo "configure:2124: checking "for gcc strength-reduce bug"" >&5
 if eval "test \"`echo '$''{'ac_cv_c_gcc_strength_bug'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2119,7 +2128,7 @@
   ac_cv_c_gcc_strength_bug="yes"
 else
   cat > conftest.$ac_ext <<EOF
-#line 2123 "configure"
+#line 2132 "configure"
 #include "confdefs.h"
 
 int main(void) {
@@ -2130,7 +2139,7 @@
   exit( Array[1] != -2 );
 }
 EOF
-if { (eval echo configure:2134: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2143: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   ac_cv_c_gcc_strength_bug="no"
 else
@@ -2153,7 +2162,7 @@
 
 
 echo $ac_n "checking "whether external symbols need an underscore prefix"""... $ac_c" 1>&6
-echo "configure:2157: checking "whether external symbols need an underscore prefix"" >&5
+echo "configure:2166: checking "whether external symbols need an underscore prefix"" >&5
 if eval "test \"`echo '$''{'ac_cv_c_extern_prefix'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2165,14 +2174,14 @@
 	.long 0
 EOF
 cat > conftest.$ac_ext <<EOF
-#line 2169 "configure"
+#line 2178 "configure"
 #include "confdefs.h"
 extern int ac_test;
 int main() {
 if (ac_test) return 1
 ; return 0; }
 EOF
-if { (eval echo configure:2176: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2185: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   ac_cv_c_extern_prefix="yes"
 else
@@ -2196,7 +2205,7 @@
 
 
 echo $ac_n "checking "whether assembler accepts .string"""... $ac_c" 1>&6
-echo "configure:2200: checking "whether assembler accepts .string"" >&5
+echo "configure:2209: checking "whether assembler accepts .string"" >&5
 if eval "test \"`echo '$''{'ac_cv_c_asm_string'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2206,14 +2215,14 @@
 	.string "test"
 EOF
 cat > conftest.$ac_ext <<EOF
-#line 2210 "configure"
+#line 2219 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:2217: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2226: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   ac_cv_c_asm_string="yes"
 else
@@ -2240,21 +2249,21 @@
 if test "$LIB_TARGET" = "libwine.so.1.0"
 then
   echo $ac_n "checking "whether we can build a dll"""... $ac_c" 1>&6
-echo "configure:2244: checking "whether we can build a dll"" >&5
+echo "configure:2253: checking "whether we can build a dll"" >&5
 if eval "test \"`echo '$''{'ac_cv_c_dll'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   saved_cflags=$CFLAGS
   CFLAGS="$CFLAGS -fPIC -shared -Wl,-soname,conftest.so.1.0"
   cat > conftest.$ac_ext <<EOF
-#line 2251 "configure"
+#line 2260 "configure"
 #include "confdefs.h"
 
 int main() {
 return 1
 ; return 0; }
 EOF
-if { (eval echo configure:2258: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2267: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   ac_cv_c_dll="yes"
 else
@@ -2279,15 +2288,57 @@
 
 
 
+echo $ac_n "checking "for reentrant X libraries"""... $ac_c" 1>&6
+echo "configure:2293: checking "for reentrant X libraries"" >&5
+if eval "test \"`echo '$''{'wine_cv_x_reentrant'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+   if test "x$with_reentrant_x" = "xno"
+    then
+        wine_cv_x_reentrant=no
+    else
+	libX11_ckeck=none
+	for dir in "$x_libraries" /usr/lib /usr/local/lib /lib; do
+	    if test -e $dir/libX11.so; then
+		libX11_check="-D $dir/libX11.so"
+		break 1
+	    fi
+	    if test -e $dir/libX11.a; then
+		libX11_check="$dir/libX11.a"
+		break 1
+	    fi
+	done
+	if test "$libX11_check" != "none"; then
+	    if nm $libX11_check | grep -q __errno_location; then
+		wine_cv_x_reentrant=yes
+	    else
+		wine_cv_x_reentrant=no
+	    fi
+	else
+	    wine_cv_x_reentrant=unknown
+	fi
+    fi  
+fi
+
+echo "$ac_t""$wine_cv_x_reentrant" 1>&6
+if test "$wine_cv_x_reentrant" = "no"
+then
+  cat >> confdefs.h <<\EOF
+#define NO_REENTRANT_X11 1
+EOF
+
+fi
+
+
 for ac_func in clone memmove strerror tcgetattr usleep wait4 waitpid
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2286: checking for $ac_func" >&5
+echo "configure:2337: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2291 "configure"
+#line 2342 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2310,7 +2361,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2314: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2365: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -2338,17 +2389,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2342: checking for $ac_hdr" >&5
+echo "configure:2393: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2347 "configure"
+#line 2398 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2352: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2403: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2375,12 +2426,12 @@
 done
 
 echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6
-echo "configure:2379: checking whether stat file-mode macros are broken" >&5
+echo "configure:2430: checking whether stat file-mode macros are broken" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2384 "configure"
+#line 2435 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -2431,12 +2482,12 @@
 fi
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:2435: checking for working const" >&5
+echo "configure:2486: checking for working const" >&5
 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2440 "configure"
+#line 2491 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -2485,7 +2536,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2489: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2540: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -2506,12 +2557,12 @@
 fi
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:2510: checking for ANSI C header files" >&5
+echo "configure:2561: checking for ANSI C header files" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2515 "configure"
+#line 2566 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -2519,7 +2570,7 @@
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2523: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2574: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2536,7 +2587,7 @@
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 2540 "configure"
+#line 2591 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -2554,7 +2605,7 @@
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 2558 "configure"
+#line 2609 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -2575,7 +2626,7 @@
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 2579 "configure"
+#line 2630 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -2586,7 +2637,7 @@
 exit (0); }
 
 EOF
-if { (eval echo configure:2590: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2641: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -2610,12 +2661,12 @@
 fi
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:2614: checking for size_t" >&5
+echo "configure:2665: checking for size_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2619 "configure"
+#line 2670 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -2772,8 +2823,10 @@
 objects/Makefile
 ole/Makefile
 programs/Makefile
+programs/clock/Makefile
 programs/notepad/Makefile
 programs/progman/Makefile
+programs/view/Makefile
 programs/winhelp/Makefile
 programs/winver/Makefile
 rc/Makefile
@@ -2898,8 +2951,10 @@
 objects/Makefile
 ole/Makefile
 programs/Makefile
+programs/clock/Makefile
 programs/notepad/Makefile
 programs/progman/Makefile
+programs/view/Makefile
 programs/winhelp/Makefile
 programs/winver/Makefile
 rc/Makefile
diff --git a/configure.in b/configure.in
index c70d80c..f02e30c 100644
--- a/configure.in
+++ b/configure.in
@@ -28,6 +28,9 @@
 dnl [  --enable-ipc            use inter-process communication for DDE],
 dnl [if test "$enableval" = "no"; then : ; else OPTIONS="-DCONFIG_IPC"; fi])
 
+AC_ARG_WITH(reentrant-x,
+[  --without-reentrant-x   Compile for use with non-reentrant X libraries])
+
 AC_SUBST(MAIN_TARGET)
 AC_SUBST(LIB_TARGET)
 AC_SUBST(OPTIONS)
@@ -162,6 +165,43 @@
 fi
 AC_SUBST(DLLFLAGS)
 
+dnl **** Check for reentrant X libraries ****
+dnl
+dnl This may fail to determine whether X libraries are reentrant if
+dnl AC_PATH_XTRA does not set x_libraries. In this case manual configuration
+dnl is possible with the --without-reentrant-x option.
+
+AC_CACHE_CHECK( "for reentrant X libraries", wine_cv_x_reentrant,
+  [ if test "x$with_reentrant_x" = "xno"
+    then
+        wine_cv_x_reentrant=no
+    else
+	libX11_ckeck=none
+	for dir in "$x_libraries" /usr/lib /usr/local/lib /lib; do
+	    if test -e $dir/libX11.so; then
+		libX11_check="-D $dir/libX11.so"
+		break 1
+	    fi
+	    if test -e $dir/libX11.a; then
+		libX11_check="$dir/libX11.a"
+		break 1
+	    fi
+	done
+	if test "$libX11_check" != "none"; then
+	    if nm $libX11_check | grep -q __errno_location; then
+		wine_cv_x_reentrant=yes
+	    else
+		wine_cv_x_reentrant=no
+	    fi
+	else
+	    wine_cv_x_reentrant=unknown
+	fi
+    fi ] )
+if test "$wine_cv_x_reentrant" = "no"
+then
+  AC_DEFINE(NO_REENTRANT_X11)
+fi
+
 dnl **** Check for functions and header files ****
 
 AC_CHECK_FUNCS(clone memmove strerror tcgetattr usleep wait4 waitpid)
@@ -199,8 +239,10 @@
 objects/Makefile
 ole/Makefile
 programs/Makefile
+programs/clock/Makefile
 programs/notepad/Makefile
 programs/progman/Makefile
+programs/view/Makefile
 programs/winhelp/Makefile
 programs/winver/Makefile
 rc/Makefile
diff --git a/controls/combo.c b/controls/combo.c
index af61d63..4cacec7 100644
--- a/controls/combo.c
+++ b/controls/combo.c
@@ -18,7 +18,6 @@
 #include "heap.h"
 #include "combo.h"
 #include "drive.h"
-#include "stddebug.h"
 #include "debug.h"
 
   /* bits in the dwKeyData */
@@ -63,7 +62,7 @@
       CBitHeight = bm.bmHeight;
       CBitWidth  = bm.bmWidth;
 
-      dprintf_combo(stddeb, "combo bitmap [%i,%i]\n", CBitWidth, CBitHeight );
+      dprintf_info(combo, "combo bitmap [%i,%i]\n", CBitWidth, CBitHeight );
 
       hPrevB = SelectObject16( hDC, hComboBmp);
       SetRect16( &r, 0, 0, CBitWidth, CBitHeight );
@@ -102,7 +101,7 @@
 	if( !(wnd->dwExStyle & WS_EX_NOPARENTNOTIFY) )
 	      lphc->wState |= CBF_NOTIFY;
 
-	dprintf_combo(stddeb, "COMBO_NCCreate: [0x%08x], style = %08x\n", 
+	dprintf_info(combo, "COMBO_NCCreate: [0x%08x], style = %08x\n", 
 						(UINT32)lphc, lphc->dwStyle );
 
 	return (LRESULT)(UINT32)wnd->hwndSelf; 
@@ -120,7 +119,7 @@
    {
        WND*		wnd = lphc->self;
 
-       dprintf_combo(stddeb,"Combo [%04x]: freeing storage\n", CB_HWND(lphc));
+       dprintf_info(combo,"Combo [%04x]: freeing storage\n", CB_HWND(lphc));
 
        if( (CB_GETTYPE(lphc) != CBS_SIMPLE) && lphc->hWndLBox ) 
    	   DestroyWindow32( lphc->hWndLBox );
@@ -219,7 +218,7 @@
    if( lphc->droppedWidth > (lprLB->right - lprLB->left) )
        lprLB->right = lprLB->left + (INT16)lphc->droppedWidth;
 
-dprintf_combo(stddeb,"Combo [%04x]: (%i,%i-%i,%i) placement\n\ttext\t= (%i,%i-%i,%i)\
+dprintf_info(combo,"Combo [%04x]: (%i,%i-%i,%i) placement\n\ttext\t= (%i,%i-%i,%i)\
 \n\tbutton\t= (%i,%i-%i,%i)\n\tlbox\t= (%i,%i-%i,%i)\n", CB_HWND(lphc),
 lphc->RectCombo.left, lphc->RectCombo.top, lphc->RectCombo.right, lphc->RectCombo.bottom,
 lprEdit->left, lprEdit->top, lprEdit->right, lprEdit->bottom,
@@ -338,12 +337,12 @@
 				SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE );
 		lphc->wState &= ~CBF_NORESIZE;
 	      }
-	      dprintf_combo(stddeb,"COMBO_Create: init done\n");
+	      dprintf_info(combo,"COMBO_Create: init done\n");
 	      return wnd->hwndSelf;
 	  }
-	  dprintf_combo(stderr, "COMBO_Create: edit control failure.\n");
-      } else dprintf_combo(stderr, "COMBO_Create: listbox failure.\n");
-  } else dprintf_combo(stderr, "COMBO_Create: no owner for visible combo.\n");
+	  dprintf_err(combo, "COMBO_Create: edit control failure.\n");
+      } else dprintf_err(combo, "COMBO_Create: listbox failure.\n");
+  } else dprintf_err(combo, "COMBO_Create: no owner for visible combo.\n");
 
   /* CreateWindow() will send WM_NCDESTROY to cleanup */
 
@@ -562,7 +561,7 @@
    if( length > 0 ) 
        pText = (LPSTR) HeapAlloc( GetProcessHeap(), 0, length + 1);
 
-   dprintf_combo(stddeb,"\tCBUpdateLBox: edit text length %i\n", length );
+   dprintf_info(combo,"\tCBUpdateLBox: edit text length %i\n", length );
 
    if( pText )
    {
@@ -598,7 +597,7 @@
    INT32	length;
    LPSTR	pText = NULL;
 
-   dprintf_combo(stddeb,"\tCBUpdateEdit: %i\n", index );
+   dprintf_info(combo,"\tCBUpdateEdit: %i\n", index );
 
    if( index == -1 )
    {
@@ -643,7 +642,7 @@
    RECT16	rect;
    LPRECT16	pRect = NULL;
 
-   dprintf_combo(stddeb,"Combo [%04x]: drop down\n", CB_HWND(lphc));
+   dprintf_info(combo,"Combo [%04x]: drop down\n", CB_HWND(lphc));
 
    CB_NOTIFY( lphc, CBN_DROPDOWN );
 
@@ -699,7 +698,7 @@
    if( IsWindow32( hWnd ) && CB_GETTYPE(lphc) != CBS_SIMPLE )
    {
 
-       dprintf_combo(stddeb,"Combo [%04x]: roll up [%i]\n", CB_HWND(lphc), (INT32)ok );
+       dprintf_info(combo,"Combo [%04x]: roll up [%i]\n", CB_HWND(lphc), (INT32)ok );
 
        /* always send WM_LBUTTONUP? */
        SendMessage32A( lphc->hWndLBox, WM_LBUTTONUP, 0, (LPARAM)(-1) );
@@ -840,7 +839,7 @@
        {   
 	   case (EN_SETFOCUS >> 8):
 
-		dprintf_combo(stddeb,"Combo [%04x]: edit [%04x] got focus\n", 
+		dprintf_info(combo,"Combo [%04x]: edit [%04x] got focus\n", 
 				     CB_HWND(lphc), (HWND16)lphc->hWndEdit );
 
 		if( !(lphc->wState & CBF_FOCUSED) ) COMBO_SetFocus( lphc );
@@ -848,7 +847,7 @@
 
 	   case (EN_KILLFOCUS >> 8):
 
-		dprintf_combo(stddeb,"Combo [%04x]: edit [%04x] lost focus\n",
+		dprintf_info(combo,"Combo [%04x]: edit [%04x] lost focus\n",
 				      CB_HWND(lphc), (HWND16)lphc->hWndEdit );
 
 		/* NOTE: it seems that Windows' edit control sends an
@@ -889,7 +888,7 @@
 	   case LBN_SELCHANGE:
 	   case LBN_SELCANCEL:
 
-		dprintf_combo(stddeb,"Combo [%04x]: lbox selection change [%04x]\n", 
+		dprintf_info(combo,"Combo [%04x]: lbox selection change [%04x]\n", 
 						      CB_HWND(lphc), lphc->wState );
 
 		/* do not roll up if selection is being tracked 
@@ -923,7 +922,7 @@
 {
    HWND32	hWnd = lphc->self->hwndSelf;
 
-   dprintf_combo(stddeb,"Combo [%04x]: ownerdraw op %04x\n", 
+   dprintf_info(combo,"Combo [%04x]: ownerdraw op %04x\n", 
 				       CB_HWND(lphc), (UINT16)msg );
 
 #define lpIS    ((LPDELETEITEMSTRUCT32)lParam)
@@ -1061,7 +1060,7 @@
   GetWindowRect16( lphc->self->hwndSelf, &rect );
   w = rect.right - rect.left; h = rect.bottom - rect.top;
 
-  dprintf_combo(stddeb,"COMBO_Size: w = %i, h = %i\n", w, h );
+  dprintf_info(combo,"COMBO_Size: w = %i, h = %i\n", w, h );
 
   /* CreateWindow() may send a bogus WM_SIZE, ignore it */
 
@@ -1258,7 +1257,7 @@
     {
       LPHEADCOMBO	lphc = CB_GETPTR(pWnd);
 
-      dprintf_combo( stddeb, "Combo [%04x]: msg %s wp %08x lp %08lx\n",
+      dprintf_info(combo, "Combo [%04x]: msg %s wp %08x lp %08lx\n",
                      pWnd->hwndSelf, SPY_GetMsgName(message), wParam, lParam );
 
       if( lphc || message == WM_NCCREATE )
@@ -1560,7 +1559,7 @@
 		return (lphc->wState & CBF_EUI) ? TRUE : FALSE;
 
 	case (WM_USER + 0x1B):
-	        dprintf_combo(stddeb,"Combo [%04x]: undocumented msg!\n", (HWND16)hwnd );
+	        dprintf_warn(combo, "Combo [%04x]: undocumented msg!\n", (HWND16)hwnd );
     }
     return DefWindowProc32A(hwnd, message, wParam, lParam);
   }
diff --git a/controls/edit.c b/controls/edit.c
index 303d2f1..35b774f 100644
--- a/controls/edit.c
+++ b/controls/edit.c
@@ -18,7 +18,6 @@
 #include "combo.h"
 #include "local.h"
 #include "resource.h"
-#include "stddebug.h"
 #include "debug.h"
 #include "callback.h"
 
@@ -110,7 +109,7 @@
 #define ORDER_UINT32(x,y) do { if ((UINT32)(y) < (UINT32)(x)) SWAP_UINT32((x),(y)); } while(0)
 
 #define DPRINTF_EDIT_NOTIFY(hwnd, str) \
-	({dprintf_edit(stddeb, \
+	({dprintf_info(edit, \
 			"edit: notification " str " sent to hwnd=%08x\n", \
 			(UINT32)(hwnd));})
 
@@ -123,11 +122,11 @@
 			MAKEWPARAM((wnd)->wIDmenu, wNotifyCode), \
 			(LPARAM)(wnd)->hwndSelf))
 #define DPRINTF_EDIT_MSG16(str) \
-	dprintf_edit(stddeb, \
+	dprintf_info(edit, \
 			"edit: 16 bit : " str ": hwnd=%08x, wParam=%08x, lParam=%08x\n", \
 			(UINT32)hwnd, (UINT32)wParam, (UINT32)lParam)
 #define DPRINTF_EDIT_MSG32(str) \
-	dprintf_edit(stddeb, \
+	dprintf_info(edit, \
 			"edit: 32 bit : " str ": hwnd=%08x, wParam=%08x, lParam=%08x\n", \
 			(UINT32)hwnd, (UINT32)wParam, (UINT32)lParam)
 
@@ -987,7 +986,7 @@
 	}
         else if (es->word_break_proc32A)
         {
-            dprintf_relay( stddeb, "CallTo32(wordbrk=%p,str='%s',idx=%d,cnt=%d,act=%d)\n",
+            dprintf_info(relay, "CallTo32(wordbrk=%p,str='%s',idx=%d,cnt=%d,act=%d)\n",
                            es->word_break_proc32A, es->text + start, index,
                            count, action );
             return (INT32)es->word_break_proc32A( es->text + start, index,
@@ -1319,7 +1318,7 @@
 	if (size > es->buffer_limit)
 		size = es->buffer_limit;
 
-	dprintf_edit(stddeb, "edit: EDIT_MakeFit: trying to ReAlloc to %d+1\n", size);
+	dprintf_info(edit, "edit: EDIT_MakeFit: trying to ReAlloc to %d+1\n", size);
 
 	EDIT_UnlockBuffer(wnd, es, TRUE);
 	if (es->text) {
@@ -1329,25 +1328,25 @@
 			es->buffer_size = 0;
 	} else if (es->hloc32) {
 		if ((hNew32 = LocalReAlloc32(es->hloc32, size + 1, 0))) {
-			dprintf_edit(stddeb, "edit: EDIT_MakeFit: Old 32 bit handle %08x, new handle %08x\n", es->hloc32, hNew32);
+			dprintf_info(edit, "edit: EDIT_MakeFit: Old 32 bit handle %08x, new handle %08x\n", es->hloc32, hNew32);
 			es->hloc32 = hNew32;
 			es->buffer_size = MIN(LocalSize32(es->hloc32) - 1, es->buffer_limit);
 		}
 	} else if (es->hloc16) {
 		if ((hNew16 = LOCAL_ReAlloc(wnd->hInstance, es->hloc16, size + 1, LMEM_MOVEABLE))) {
-			dprintf_edit(stddeb, "edit: EDIT_MakeFit: Old 16 bit handle %08x, new handle %08x\n", es->hloc16, hNew16);
+			dprintf_info(edit, "edit: EDIT_MakeFit: Old 16 bit handle %08x, new handle %08x\n", es->hloc16, hNew16);
 			es->hloc16 = hNew16;
 			es->buffer_size = MIN(LOCAL_Size(wnd->hInstance, es->hloc16) - 1, es->buffer_limit);
 		}
 	}
 	if (es->buffer_size < size) {
 		EDIT_LockBuffer(wnd, es);
-		dprintf_edit(stddeb, "edit: EDIT_MakeFit: FAILED !  We now have %d+1\n", es->buffer_size);
+		dprintf_warn(edit, "edit: EDIT_MakeFit: FAILED !  We now have %d+1\n", es->buffer_size);
 		EDIT_NOTIFY_PARENT(wnd, EN_ERRSPACE, "EN_ERRSPACE");
 		return FALSE;
 	} else {
 		EDIT_LockBuffer(wnd, es);
-		dprintf_edit(stddeb, "edit: EDIT_MakeFit: We now have %d+1\n", es->buffer_size);
+		dprintf_info(edit, "edit: EDIT_MakeFit: We now have %d+1\n", es->buffer_size);
 		return TRUE;
 	}
 }
@@ -1366,12 +1365,12 @@
 		return TRUE;
 	size = ((size / GROWLENGTH) + 1) * GROWLENGTH;
 
-	dprintf_edit(stddeb, "edit: EDIT_MakeUndoFit: trying to ReAlloc to %d+1\n", size);
+	dprintf_info(edit, "edit: EDIT_MakeUndoFit: trying to ReAlloc to %d+1\n", size);
 
 	if ((es->undo_text = HeapReAlloc(es->heap, 0, es->undo_text, size + 1))) {
 		es->undo_buffer_size = HeapSize(es->heap, 0, es->undo_text) - 1;
 		if (es->undo_buffer_size < size) {
-			dprintf_edit(stddeb, "edit: EDIT_MakeUndoFit: FAILED !  We now have %d+1\n", es->undo_buffer_size);
+			dprintf_warn(edit, "edit: EDIT_MakeUndoFit: FAILED !  We now have %d+1\n", es->undo_buffer_size);
 			return FALSE;
 		}
 		return TRUE;
@@ -1659,7 +1658,7 @@
 	} else if (line)
 		return;
 
-	dprintf_edit(stddeb, "edit: EDIT_PaintLine: line=%d\n", line);
+	dprintf_info(edit, "edit: EDIT_PaintLine: line=%d\n", line);
 
 	pos = EDIT_EM_PosFromChar(wnd, es, EDIT_EM_LineIndex(wnd, es, line), FALSE);
 	x = SLOWORD(pos);
@@ -1868,7 +1867,7 @@
 {
 	INT32 ret = 0;
 
-	dprintf_edit(stddeb, "edit: EDIT_WordBreakProc: s=%p, index=%u"
+	dprintf_info(edit, "edit: EDIT_WordBreakProc: s=%p, index=%u"
 			", count=%u, action=%d\n", s, index, count, action);
 
 	switch (action) {
@@ -2008,7 +2007,7 @@
 	es->buffer_size = newSize;
 	es->text = newText;
 	EDIT_LockBuffer(wnd, es);
-	dprintf_edit(stddeb, "edit: EM_GETHANDLE: switched to 32 bit local heap\n");
+	dprintf_info(edit, "edit: EM_GETHANDLE: switched to 32 bit local heap\n");
 
 	return es->hloc32;
 }
@@ -2047,7 +2046,7 @@
 			fprintf(stderr, "edit: EM_GETHANDLE: could not initialize local heap\n");
 			return 0;
 		}
-		dprintf_edit(stddeb, "edit: EM_GETHANDLE: local heap initialized\n");
+		dprintf_info(edit, "edit: EM_GETHANDLE: local heap initialized\n");
 	}
 	if (!(newBuf = LOCAL_Alloc(wnd->hInstance, LMEM_MOVEABLE, lstrlen32A(es->text) + 1))) {
 		fprintf(stderr, "edit: EM_GETHANDLE: could not allocate new 16 bit buffer\n");
@@ -2072,7 +2071,7 @@
 	es->buffer_size = newSize;
 	es->text = newText;
 	EDIT_LockBuffer(wnd, es);
-	dprintf_edit(stddeb, "edit: EM_GETHANDLE: switched to 16 bit buffer\n");
+	dprintf_info(edit, "edit: EM_GETHANDLE: switched to 16 bit buffer\n");
 
 	return es->hloc16;
 }
@@ -2624,7 +2623,7 @@
 		if (action & EC_RIGHTMARGIN)
 			es->right_margin = right;
 	}
-	dprintf_edit(stddeb, "EDIT_EM_SetMargins: left=%d, right=%d\n", es->left_margin, es->right_margin);
+	dprintf_info(edit, "EDIT_EM_SetMargins: left=%d, right=%d\n", es->left_margin, es->right_margin);
 }
 
 
@@ -2810,7 +2809,7 @@
 
 	lstrcpy32A(utext, es->undo_text);
 
-	dprintf_edit(stddeb, "edit: before UNDO:insertion length = %d, deletion buffer = %s\n",
+	dprintf_info(edit, "edit: before UNDO:insertion length = %d, deletion buffer = %s\n",
 			es->undo_insert_count, utext);
 
 	EDIT_EM_SetSel(wnd, es, es->undo_position, es->undo_position + es->undo_insert_count, FALSE);
@@ -2819,7 +2818,7 @@
 	EDIT_EM_SetSel(wnd, es, es->undo_position, es->undo_position + es->undo_insert_count, FALSE);
 	HeapFree(es->heap, 0, utext);
 
-	dprintf_edit(stddeb, "edit: after UNDO: insertion length = %d, deletion buffer = %s\n",
+	dprintf_info(edit, "edit: after UNDO: insertion length = %d, deletion buffer = %s\n",
 			es->undo_insert_count, es->undo_text);
 
 	return TRUE;
@@ -2891,7 +2890,7 @@
 			EDIT_EM_ScrollCaret(wnd, es);
 			break;
 		default:
-			dprintf_edit(stddeb, "edit: unknown menu item, please report\n");
+			dprintf_err(edit, "edit: unknown menu item, please report\n");
 			break;
 	}
 }
@@ -3193,7 +3192,7 @@
 		break;
 
 	default:
-		dprintf_edit(stddeb, "edit: undocumented (hacked) WM_HSCROLL parameter, please report\n");
+		dprintf_err(edit, "edit: undocumented (hacked) WM_HSCROLL parameter, please report\n");
 		return 0;
 	}
 	if (dx)
@@ -3286,7 +3285,7 @@
 		HWND32 hCombo = wnd->parent->hwndSelf;
 		BOOL32 bUIFlip = TRUE;
 
-		dprintf_combo(stddeb, "EDIT_CheckCombo [%04x]: handling msg %04x (%04x)\n",
+		dprintf_info(combo, "EDIT_CheckCombo [%04x]: handling msg %04x (%04x)\n",
 					wnd->hwndSelf, (UINT16)msg, (UINT16)key);
 
 		switch (msg) {
@@ -3719,7 +3718,7 @@
 {
 	EDIT_EM_SetSel(wnd, es, 0, -1, FALSE);
 	if (text) {
-		dprintf_edit(stddeb, "\t'%s'\n", text);
+		dprintf_info(edit, "\t'%s'\n", text);
 		EDIT_EM_ReplaceSel(wnd, es, FALSE, text);
 		es->x_offset = 0;
 	}
diff --git a/controls/listbox.c b/controls/listbox.c
index a830489..c1512e7 100644
--- a/controls/listbox.c
+++ b/controls/listbox.c
@@ -13,7 +13,6 @@
 #include "spy.h"
 #include "win.h"
 #include "combo.h"
-#include "stddebug.h"
 #include "debug.h"
 
 /* Unimplemented yet:
@@ -309,7 +308,7 @@
         if ((descr->height > descr->item_height) &&
             (descr->height % descr->item_height))
         {
-            dprintf_listbox(stddeb, "Listbox %04x: changing height %d -> %d\n",
+            dprintf_info(listbox, "Listbox %04x: changing height %d -> %d\n",
                             wnd->hwndSelf, descr->height,
                             descr->height - descr->height%descr->item_height );
             SetWindowPos32( wnd->hwndSelf, 0, 0, 0,
@@ -320,7 +319,7 @@
             return;
         }
     }
-    dprintf_listbox( stddeb, "Listbox %04x: new size = %d,%d\n",
+    dprintf_info(listbox, "Listbox %04x: new size = %d,%d\n",
                      wnd->hwndSelf, descr->width, descr->height );
     LISTBOX_UpdatePage( wnd, descr );
     LISTBOX_UpdateScroll( wnd, descr );
@@ -458,7 +457,7 @@
         if (wnd->dwStyle & WS_DISABLED) dis.itemState |= ODS_DISABLED;
         dis.itemData     = item ? item->data : 0;
         dis.rcItem       = *rect;
-        dprintf_listbox( stddeb, "Listbox %04x: drawitem %d (%s) action=%02x "
+        dprintf_info(listbox, "Listbox %04x: drawitem %d (%s) action=%02x "
                          "state=%02x rect=%d,%d-%d,%d\n",
                          wnd->hwndSelf, index, item ? item->str : "", action,
                          dis.itemState, rect->left, rect->top,
@@ -480,7 +479,7 @@
             oldText = SetTextColor32( hdc, GetSysColor32(COLOR_HIGHLIGHTTEXT));
         }
 
-        dprintf_listbox( stddeb, "Listbox %04x: painting %d (%s) action=%02x "
+        dprintf_info(listbox, "Listbox %04x: painting %d (%s) action=%02x "
                          "rect=%d,%d-%d,%d\n",
                          wnd->hwndSelf, index, item ? item->str : "", action,
                          rect->left, rect->top, rect->right, rect->bottom );
@@ -603,12 +602,15 @@
     {
         INT32 i;
         LPINT16 p = (LPINT16)tabs;
-        dprintf_listbox( stddeb, "Listbox %04x: settabstops ", wnd->hwndSelf);
+	dbg_decl_str(listbox, 256);
+
         for (i = 0; i < descr->nb_tabs; i++) {
-            descr->tabs[i] = *p++<<1; /* FIXME */
-            dprintf_listbox( stddeb, "%hd ", descr->tabs[i]);
+	    descr->tabs[i] = *p++<<1; /* FIXME */
+	    if(debugging_info(listbox))
+              dsprintf(listbox, "%hd ", descr->tabs[i]);
 	}
-	dprintf_listbox( stddeb, "\n");
+        dprintf_info(listbox, "Listbox %04x: settabstops %s\n", 
+			 wnd->hwndSelf, dbg_str(listbox));
     }
     else memcpy( descr->tabs, tabs, descr->nb_tabs * sizeof(INT32) );
     /* FIXME: repaint the window? */
@@ -986,7 +988,7 @@
     if (descr->style & LBS_OWNERDRAWVARIABLE)
     {
         if ((index < 0) || (index >= descr->nb_items)) return LB_ERR;
-        dprintf_listbox( stddeb, "Listbox %04x: item %d height = %d\n",
+        dprintf_info(listbox, "Listbox %04x: item %d height = %d\n",
                          wnd->hwndSelf, index, height );
         descr->items[index].height = height;
         LISTBOX_UpdateScroll( wnd, descr );
@@ -994,7 +996,7 @@
     }
     else if (height != descr->item_height)
     {
-        dprintf_listbox( stddeb, "Listbox %04x: new height = %d\n",
+        dprintf_info(listbox, "Listbox %04x: new height = %d\n",
                          wnd->hwndSelf, height );
         descr->item_height = height;
         LISTBOX_UpdatePage( wnd, descr );
@@ -1016,7 +1018,7 @@
         pos = descr->horz_extent - descr->width;
     if (pos < 0) pos = 0;
     if (!(diff = descr->horz_pos - pos)) return;
-    dprintf_listbox( stddeb, "Listbox %04x: new horz pos = %d\n",
+    dprintf_info(listbox, "Listbox %04x: new horz pos = %d\n",
                      wnd->hwndSelf, pos );
     descr->horz_pos = pos;
     LISTBOX_UpdateScroll( wnd, descr );
@@ -1038,7 +1040,7 @@
         return LB_OKAY;
     if (extent <= 0) extent = 1;
     if (extent == descr->horz_extent) return LB_OKAY;
-    dprintf_listbox( stddeb, "Listbox %04x: new horz extent = %d\n",
+    dprintf_info(listbox, "Listbox %04x: new horz extent = %d\n",
                      wnd->hwndSelf, extent );
     descr->horz_extent = extent;
     if (descr->horz_pos > extent - descr->width)
@@ -1056,7 +1058,7 @@
 {
     width += 2;  /* For left and right margin */
     if (width == descr->column_width) return LB_OKAY;
-    dprintf_listbox( stddeb, "Listbox %04x: new column width = %d\n",
+    dprintf_info(listbox, "Listbox %04x: new column width = %d\n",
                      wnd->hwndSelf, width );
     descr->column_width = width;
     LISTBOX_UpdatePage( wnd, descr );
@@ -1305,7 +1307,7 @@
         mis.itemHeight = descr->item_height;
         SendMessage32A( descr->owner, WM_MEASUREITEM, id, (LPARAM)&mis );
         item->height = mis.itemHeight ? mis.itemHeight : 1;
-        dprintf_listbox( stddeb, "Listbox %04x: measure item %d (%s) = %d\n",
+        dprintf_info(listbox, "Listbox %04x: measure item %d (%s) = %d\n",
                          wnd->hwndSelf, index, str ? str : "", item->height );
     }
 
@@ -1357,7 +1359,7 @@
         return ret;
     }
 
-    dprintf_listbox( stddeb, "Listbox %04x: added item %d '%s'\n",
+    dprintf_info(listbox, "Listbox %04x: added item %d '%s'\n",
                      wnd->hwndSelf, index, HAS_STRINGS(descr) ? new_str : "" );
     return index;
 }
@@ -1694,7 +1696,7 @@
                                           WPARAM32 wParam, INT32 x, INT32 y )
 {
     INT32 index = LISTBOX_GetItemFromPoint( wnd, descr, x, y );
-    dprintf_listbox( stddeb, "Listbox %04x: lbuttondown %d,%d item %d\n",
+    dprintf_info(listbox, "Listbox %04x: lbuttondown %d,%d item %d\n",
                      wnd->hwndSelf, x, y, index );
     if (!descr->caret_on && (GetFocus32() == wnd->hwndSelf)) return 0;
     if (index != -1)
@@ -2029,7 +2031,7 @@
 
     if( lphc )
     {
-	dprintf_combo(stddeb,"ComboLBox [%04x]: resetting owner %04x -> %04x\n",
+	dprintf_info(combo,"ComboLBox [%04x]: resetting owner %04x -> %04x\n",
 			      wnd->hwndSelf, descr->owner, lphc->self->hwndSelf );
 	descr->owner = lphc->self->hwndSelf;
     }
@@ -2098,7 +2100,7 @@
         if (msg == WM_CREATE)
         {
             if (!LISTBOX_Create( wnd, NULL )) return -1;
-            dprintf_listbox( stddeb, "Listbox: creating wnd=%04x descr=%p\n",
+            dprintf_info(listbox, "Listbox: creating wnd=%04x descr=%p\n",
                              hwnd, *(LB_DESCR **)wnd->wExtra );
             return 0;
         }
@@ -2106,7 +2108,7 @@
         return DefWindowProc32A( hwnd, msg, wParam, lParam );
     }
 
-    dprintf_listbox( stddeb, "Listbox %04x: msg %s wp %08x lp %08lx\n",
+    dprintf_info(listbox, "Listbox %04x: msg %s wp %08x lp %08lx\n",
                      wnd->hwndSelf, SPY_GetMsgName(msg), wParam, lParam );
     switch(msg)
     {
@@ -2476,7 +2478,7 @@
 
     default:
         if ((msg >= WM_USER) && (msg < 0xc000))
-            dprintf_listbox(stddeb,"Listbox %04x: unknown msg %04x wp %08x lp %08lx\n",
+            dprintf_warn(listbox, "Listbox %04x: unknown msg %04x wp %08x lp %08lx\n",
                     hwnd, msg, wParam, lParam );
         return DefWindowProc32A( hwnd, msg, wParam, lParam );
     }
@@ -2521,7 +2523,7 @@
     {
 	LB_DESCR *descr = *(LB_DESCR **)wnd->wExtra;
 
-        dprintf_combo( stddeb, "ComboLBox [%04x]: msg %s wp %08x lp %08lx\n",
+        dprintf_info(combo, "ComboLBox [%04x]: msg %s wp %08x lp %08lx\n",
                        wnd->hwndSelf, SPY_GetMsgName(msg), wParam, lParam );
 
 	if( descr || msg == WM_CREATE )
@@ -2532,7 +2534,7 @@
 	    {
 		case WM_CREATE:
 #define lpcs	((LPCREATESTRUCT32A)lParam)
-		     dprintf_combo(stddeb, "\tpassed parent handle = 0x%08x\n", 
+		     dprintf_info(combo, "\tpassed parent handle = 0x%08x\n", 
 					         (UINT32)lpcs->lpCreateParams);
 
 		     lphc = (LPHEADCOMBO)(lpcs->lpCreateParams);
@@ -2578,7 +2580,7 @@
         }
         lRet = DefWindowProc32A( hwnd, msg, wParam, lParam );
 
-        dprintf_combo(stddeb,"\tComboLBox: default on msg [%04x]\n", (UINT16)msg );
+        dprintf_info(combo,"\tComboLBox: default on msg [%04x]\n", (UINT16)msg );
     }
 
     return lRet;
diff --git a/controls/menu.c b/controls/menu.c
index ee9fadf..24aecd4 100644
--- a/controls/menu.c
+++ b/controls/menu.c
@@ -32,7 +32,6 @@
 #include "message.h"
 #include "graphics.h"
 #include "resource.h"
-#include "stddebug.h"
 #include "tweak.h"
 #include "debug.h"
 
@@ -165,10 +164,10 @@
  */
 
 #define debug_print_menuitem(pre, mp, post) \
-  if(debugging_menu) do_debug_print_menuitem(pre, mp, post)
+  if(!debugging_info(menu)) ; else do_debug_print_menuitem(pre, mp, post)
 
 #define MENUOUT(text) \
-  p+=sprintf(p, "%s%s", (count++ ? "," : ""), (text))
+  dsprintf(menu, "%s%s", (count++ ? "," : ""), (text))
 
 #define MENUFLAG(bit,text) \
   do { \
@@ -178,19 +177,17 @@
 static void do_debug_print_menuitem(const char *prefix, MENUITEM * mp, 
 				    const char *postfix)
 {
-    char buff[256];
-    char *p;
+    dbg_decl_str(menu, 256);
 
-    p = buff;
     if (mp) {
 	UINT32 flags = mp->fType;
 	int typ = MENU_ITEM_TYPE(flags);
-	p+=sprintf(p, "{ ID=0x%x", mp->wID);
+	dsprintf(menu, "{ ID=0x%x", mp->wID);
 	if (flags & MF_POPUP)
-	    p+=sprintf(p, ", Sub=0x%x", mp->hSubMenu);
+	    dsprintf(menu, ", Sub=0x%x", mp->hSubMenu);
 	if (flags) {
 	    int count = 0;
-	    p+=sprintf(p, ", Typ=");
+	    dsprintf(menu, ", Typ=");
 	    if (typ == MFT_STRING)
 		/* Nothing */ ;
 	    else if (typ == MFT_SEPARATOR)
@@ -212,12 +209,12 @@
 	    MENUFLAG(MFT_RIGHTJUSTIFY, "right");
 
 	    if (flags)
-		p+=sprintf(p, "+0x%x", flags);
+		dsprintf(menu, "+0x%x", flags);
 	}
 	flags = mp->fState;
 	if (flags) {
 	    int count = 0;
-	    p+=sprintf(p, ", State=");
+	    dsprintf(menu, ", State=");
 	    MENUFLAG(MFS_GRAYED, "grey");
 	    MENUFLAG(MFS_DISABLED, "dis");
 	    MENUFLAG(MFS_CHECKED, "check");
@@ -225,28 +222,28 @@
 	    MENUFLAG(MF_USECHECKBITMAPS, "usebit");
 	    MENUFLAG(MF_MOUSESELECT, "mouse");
 	    if (flags)
-		p+=sprintf(p, "+0x%x", flags);
+		dsprintf(menu, "+0x%x", flags);
 	}
 	if (mp->hCheckBit)
-	    p+=sprintf(p, ", Chk=0x%x", mp->hCheckBit);
+	    dsprintf(menu, ", Chk=0x%x", mp->hCheckBit);
 	if (mp->hUnCheckBit)
-	    p+=sprintf(p, ", Unc=0x%x", mp->hUnCheckBit);
+	    dsprintf(menu, ", Unc=0x%x", mp->hUnCheckBit);
 
 	if (typ == MFT_STRING) {
 	    if (mp->text)
-		p+=sprintf(p, ", Text=\"%s\"", mp->text);
+		dsprintf(menu, ", Text=\"%s\"", mp->text);
 	    else
-		p+=sprintf(p, ", Text=Null");
+		dsprintf(menu, ", Text=Null");
 	} else if (mp->text == NULL)
 	    /* Nothing */ ;
 	else
-	    p+=sprintf(p, ", Text=%p", mp->text);
-	p+=sprintf(p, " }");
+	    dsprintf(menu, ", Text=%p", mp->text);
+	dsprintf(menu, " }");
     } else {
-	p+=sprintf(p, "NULL");
+	dsprintf(menu, "NULL");
     }
 
-    dprintf_menu(stddeb, "%s %s %s\n", prefix, buff, postfix);
+    dprintf_info(menu, "%s %s %s\n", prefix, dbg_str(menu), postfix);
 }
 
 #undef MENUOUT
@@ -270,7 +267,7 @@
 	fprintf( stderr, "Unable to load default system menu\n" );
     }
 
-    dprintf_menu( stddeb, "MENU_CopySysPopup: returning %x.\n", hMenu );
+    dprintf_info(menu, "MENU_CopySysPopup: returning %x.\n", hMenu );
 
     return hMenu;
 }
@@ -308,7 +305,7 @@
 	    menu = (POPUPMENU*) USER_HEAP_LIN_ADDR(hPopupMenu);
 	    menu->wFlags |= MF_SYSMENU;
 
-	    dprintf_menu(stddeb,"GetSysMenu hMenu=%04x (%04x)\n", hMenu, hPopupMenu );
+	    dprintf_info(menu,"GetSysMenu hMenu=%04x (%04x)\n", hMenu, hPopupMenu );
 	    return hMenu;
 	}
 	DestroyMenu32( hMenu );
@@ -456,7 +453,7 @@
 	    break;
     }
 
-    dprintf_menu( stddeb, "MENU_GetStartOfPrevColumn: ret %d.\n", i );
+    dprintf_info(menu, "MENU_GetStartOfPrevColumn: ret %d.\n", i );
 
     return i;
 }
@@ -555,7 +552,7 @@
 static UINT32 MENU_FindItemByKey( HWND32 hwndOwner, HMENU32 hmenu, 
 				  UINT32 key, BOOL32 forceMenuChar )
 {
-    dprintf_menu(stddeb,"\tlooking for '%c' in [%04x]\n", (char)key, (UINT16)hmenu );
+    dprintf_info(menu,"\tlooking for '%c' in [%04x]\n", (char)key, (UINT16)hmenu );
 
     if (!IsMenu32( hmenu )) 
     {
@@ -576,7 +573,7 @@
 	     key = toupper(key);
 	     for (i = 0; i < menu->nItems; i++, item++)
 	     {
-		if (IS_STRING_ITEM(item->fType))
+		if (item->text && (IS_STRING_ITEM(item->fType)))
 		{
 		    char *p = strchr( item->text, '&' );
 		    if (p && (p[1] != '&') && (toupper(p[1]) == key)) return i;
@@ -603,7 +600,7 @@
     DWORD dwSize;
     char *p;
 
-    dprintf_menu(stddeb, "MENU_CalcItemSize: HDC 0x%x at (%d,%d)\n",
+    dprintf_info(menu, "MENU_CalcItemSize: HDC 0x%x at (%d,%d)\n",
                  hdc, orgX, orgY);
     debug_print_menuitem("MENU_CalcItemSize: menuitem:", lpitem, 
 			 (menuBar ? " (MenuBar)" : ""));
@@ -621,7 +618,7 @@
         SendMessage32A( hwndOwner, WM_MEASUREITEM, 0, (LPARAM)&mis );
         lpitem->rect.bottom += mis.itemHeight;
         lpitem->rect.right  += mis.itemWidth;
-        dprintf_menu(stddeb, "MENU_CalcItemSize: %08x %dx%d\n",
+        dprintf_info(menu, "MENU_CalcItemSize: %08x %dx%d\n",
                      lpitem->wID, mis.itemWidth, mis.itemHeight);
         return;
     } 
@@ -756,7 +753,7 @@
 
     if ((lprect == NULL) || (lppop == NULL)) return;
     if (lppop->nItems == 0) return;
-    dprintf_menu(stddeb,"MENU_MenuBarCalcSize left=%d top=%d right=%d bottom=%d\n", 
+    dprintf_info(menu,"MENU_MenuBarCalcSize left=%d top=%d right=%d bottom=%d\n", 
                  lprect->left, lprect->top, lprect->right, lprect->bottom);
     lppop->Width  = lprect->right - lprect->left;
     lppop->Height = 0;
@@ -776,7 +773,7 @@
 	    if ((i != start) &&
 		(lpitem->fType & (MF_MENUBREAK | MF_MENUBARBREAK))) break;
 
-	    dprintf_menu( stddeb,
+	    dprintf_info(menu,
 			  "MENU_MenuBarCalcSize: calling MENU_CalcItemSize"
 			  " org=(%d, %d)\n", orgX, orgY );
 	    debug_print_menuitem ("  item: ", lpitem, "");
@@ -847,7 +844,7 @@
     {
         DRAWITEMSTRUCT32 dis;
 
-        dprintf_menu( stddeb, "DrawMenuItem: Ownerdraw!\n" );
+        dprintf_info(menu, "DrawMenuItem: Ownerdraw!\n" );
         dis.CtlType   = ODT_MENU;
         dis.itemID    = lpitem->wID;
         dis.itemData  = (DWORD)lpitem->text;
@@ -1140,7 +1137,7 @@
     
     lppop = (LPPOPUPMENU) USER_HEAP_LIN_ADDR( (HMENU16)wndPtr->wIDmenu );
     if (lppop == NULL || lprect == NULL) return SYSMETRICS_CYMENU;
-    dprintf_menu(stddeb,"MENU_DrawMenuBar(%04x, %p, %p); !\n", 
+    dprintf_info(menu,"MENU_DrawMenuBar(%04x, %p, %p); !\n", 
 		 hDC, lprect, lppop);
     if (lppop->Height == 0) MENU_MenuBarCalcSize(hDC, lprect, lppop, hwnd);
     lprect->bottom = lprect->top + lppop->Height;
@@ -1175,7 +1172,7 @@
     {
 	HTASK16 hTask = 0;
 
-	dprintf_menu(stddeb,"patching resident popup: %04x %04x [%04x %04x]\n", 
+	dprintf_info(menu,"patching resident popup: %04x %04x [%04x %04x]\n", 
 		checkQueue, checkWnd ? checkWnd->hwndSelf : 0, pTopPopupWnd->hmemTaskQ, 
 		pTopPopupWnd->owner ? pTopPopupWnd->owner->hwndSelf : 0);
 
@@ -1213,7 +1210,7 @@
 		pTopPopupWnd->hmemTaskQ = task->hQueue;
 		return TRUE;
 	    } 
-	    else dprintf_menu(stddeb,"failed to patch resident popup.\n");
+	    else dprintf_warn(menu,"failed to patch resident popup.\n");
 	} 
     }
     return FALSE;
@@ -1491,7 +1488,7 @@
 
     if (!(menu = (POPUPMENU *)USER_HEAP_LIN_ADDR(hMenu))) 
     {
-        dprintf_menu( stddeb, "MENU_InsertItem: %04x not a menu handle\n",
+        dprintf_warn(menu, "MENU_InsertItem: %04x not a menu handle\n",
                       hMenu );
         return NULL;
     }
@@ -1509,13 +1506,13 @@
     {
         if (!MENU_FindItem( &hMenu, &pos, flags )) 
         {
-            dprintf_menu( stddeb, "MENU_InsertItem: item %x not found\n",
+            dprintf_warn(menu, "MENU_InsertItem: item %x not found\n",
                           pos );
             return NULL;
         }
         if (!(menu = (LPPOPUPMENU) USER_HEAP_LIN_ADDR(hMenu)))
         {
-            dprintf_menu(stddeb,"MENU_InsertItem: %04x not a menu handle\n",
+            dprintf_warn(menu,"MENU_InsertItem: %04x not a menu handle\n",
                          hMenu);
             return NULL;
         }
@@ -1526,7 +1523,7 @@
     newItems = HeapAlloc( SystemHeap, 0, sizeof(MENUITEM) * (menu->nItems+1) );
     if (!newItems)
     {
-        dprintf_menu( stddeb, "MENU_InsertItem: allocation failed\n" );
+        dprintf_warn(menu, "MENU_InsertItem: allocation failed\n" );
         return NULL;
     }
     if (menu->nItems > 0)
@@ -1623,7 +1620,7 @@
 	{
 	    LPSTR newstr = HEAP_strdupWtoA(GetProcessHeap(),
 					   0, mii.dwTypeData);
-	    dprintf_menu(stddeb, "Menu item: [%08x,%08x,%04x,%04x,%s]\n",
+	    dprintf_info(menu, "Menu item: [%08x,%08x,%04x,%04x,%s]\n",
 			 mii.fType, mii.fState, mii.wID, resinfo, newstr);
 	  HeapFree( GetProcessHeap(), 0, newstr );
 	}
@@ -1837,7 +1834,7 @@
 
     item = &menu->items[menu->FocusedItem];
 
-    dprintf_menu(stddeb, "MENU_ExecFocusedItem: %08x %08x %08x\n",
+    dprintf_info(menu, "MENU_ExecFocusedItem: %08x %08x %08x\n",
                  hMenu, item->wID, item->hSubMenu);
 
     if (!(item->fType & MF_POPUP))
@@ -1932,7 +1929,7 @@
 	    pmt->hCurrentMenu = MENU_ShowSubPopup( pmt->hOwnerWnd, hPtMenu, FALSE );
 	    return TRUE;
 	} 
-	else dprintf_menu(stddeb,"\tunable to find clicked item!\n");
+	else dprintf_warn(menu, "\tunable to find clicked item!\n");
     }
     return FALSE;
 }
@@ -2026,7 +2023,7 @@
 	LRESULT l = SendMessage16( pmt->hOwnerWnd, WM_NEXTMENU, (WPARAM16)vk, 
 		(IS_SYSTEM_MENU(menu)) ? GetSubMenu16(pmt->hTopMenu,0) : pmt->hTopMenu );
 
-	dprintf_menu(stddeb,"NextMenu: %04x [%04x] -> %04x [%04x]\n",
+	dprintf_info(menu,"NextMenu: %04x [%04x] -> %04x [%04x]\n",
 		     (UINT16)pmt->hCurrentMenu, (UINT16)pmt->hOwnerWnd, LOWORD(l), HIWORD(l) );
 
 	if( l == 0 )
@@ -2074,7 +2071,7 @@
 		    /* FIXME: Not sure what to do here, perhaps,
 		     * try to track hNewMenu as a popup? */
 
-		    dprintf_menu(stddeb,"MENU_DoNextMenu() got confused.\n");
+		    dprintf_info(menu,"MENU_DoNextMenu() got confused.\n");
 		    return FALSE;
 		}
 	    }
@@ -2205,7 +2202,7 @@
     POPUPMENU *menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( pmt->hTopMenu );
     UINT32  nextcol;
 
-    dprintf_menu( stddeb, "MENU_KeyRight called, cur %x (%s), top %x (%s).\n",
+    dprintf_info(menu, "MENU_KeyRight called, cur %x (%s), top %x (%s).\n",
 		  pmt->hCurrentMenu,
 		  ((POPUPMENU *)USER_HEAP_LIN_ADDR(pmt->hCurrentMenu))->
 		     items[0].text,
@@ -2225,7 +2222,7 @@
     /* Check to see if there's another column */
     if( (nextcol = MENU_GetStartOfNextColumn( pmt->hCurrentMenu )) != 
 	NO_SELECTED_ITEM ) {
-	dprintf_menu( stddeb, "KeyRight: Going to %d.\n", nextcol );
+	dprintf_info(menu, "KeyRight: Going to %d.\n", nextcol );
 	MENU_SelectItem( pmt->hOwnerWnd, pmt->hCurrentMenu,
 			 nextcol, TRUE );
 	return;
@@ -2614,7 +2611,7 @@
 
 	if( hwnd == pTopPopupWnd->hwndSelf )
 	{	
-	    dprintf_menu(stddeb,"resident popup destroyed!\n");
+	    dprintf_err(menu, "resident popup destroyed!\n");
 
 	    pTopPopupWnd = NULL; 
 	    uSubPWndLevel = 0; 
@@ -2663,7 +2660,7 @@
     WND *wndPtr;
     LPPOPUPMENU lppop;
 
-    dprintf_menu( stddeb, "MENU_GetMenuBarHeight: HWND 0x%x, width %d, "
+    dprintf_info(menu, "MENU_GetMenuBarHeight: HWND 0x%x, width %d, "
 		  "at (%d, %d).\n", hwnd, menubarWidth, orgX, orgY );
     
     if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0;
@@ -2683,7 +2680,7 @@
 BOOL16 WINAPI ChangeMenu16( HMENU16 hMenu, UINT16 pos, SEGPTR data,
                             UINT16 id, UINT16 flags )
 {
-    dprintf_menu( stddeb,"ChangeMenu16: menu=%04x pos=%d data=%08lx id=%04x flags=%04x\n",
+    dprintf_info(menu,"ChangeMenu16: menu=%04x pos=%d data=%08lx id=%04x flags=%04x\n",
                   hMenu, pos, (DWORD)data, id, flags );
     if (flags & MF_APPEND) return AppendMenu16( hMenu, flags & ~MF_APPEND,
                                                 id, data );
@@ -2709,7 +2706,7 @@
 BOOL32 WINAPI ChangeMenu32A( HMENU32 hMenu, UINT32 pos, LPCSTR data,
                              UINT32 id, UINT32 flags )
 {
-    dprintf_menu( stddeb,"ChangeMenu32A: menu=%08x pos=%d data=%08lx id=%08x flags=%08x\n",
+    dprintf_info(menu,"ChangeMenu32A: menu=%08x pos=%d data=%08lx id=%08x flags=%08x\n",
                   hMenu, pos, (DWORD)data, id, flags );
     if (flags & MF_APPEND) return AppendMenu32A( hMenu, flags & ~MF_APPEND,
                                                  id, data );
@@ -2730,7 +2727,7 @@
 BOOL32 WINAPI ChangeMenu32W( HMENU32 hMenu, UINT32 pos, LPCWSTR data,
                              UINT32 id, UINT32 flags )
 {
-    dprintf_menu( stddeb,"ChangeMenu32W: menu=%08x pos=%d data=%08lx id=%08x flags=%08x\n",
+    dprintf_info(menu,"ChangeMenu32W: menu=%08x pos=%d data=%08lx id=%08x flags=%08x\n",
                   hMenu, pos, (DWORD)data, id, flags );
     if (flags & MF_APPEND) return AppendMenu32W( hMenu, flags & ~MF_APPEND,
                                                  id, data );
@@ -2762,7 +2759,7 @@
     MENUITEM *item;
     DWORD ret;
 
-    dprintf_menu( stddeb,"CheckMenuItem: %04x %04x %04x\n", hMenu, id, flags );
+    dprintf_info(menu,"CheckMenuItem: %04x %04x %04x\n", hMenu, id, flags );
     if (!(item = MENU_FindItem( &hMenu, &id, flags ))) return -1;
     ret = item->fState & MF_CHECKED;
     if (flags & MF_CHECKED) item->fState |= MF_CHECKED;
@@ -2788,7 +2785,7 @@
     BOOL32    bRet = FALSE;
     MENUITEM *item, *first = NULL;
 
-    dprintf_menu(stddeb,"EnableMenuItem (%04x, %04X, %04X) !\n", 
+    dprintf_info(menu,"EnableMenuItem (%04x, %04X, %04X) !\n", 
 		                        hMenu, wItemID, wFlags);
 
     while( (item = MENU_FindItem( &hMenu, &wItemID, wFlags )) )
@@ -2836,14 +2833,14 @@
 {
     MENUITEM *item;
 
-    dprintf_menu( stddeb, "GetMenuString32A: menu=%04x item=%04x ptr=%p len=%d flags=%04x\n",
+    dprintf_info(menu, "GetMenuString32A: menu=%04x item=%04x ptr=%p len=%d flags=%04x\n",
                  hMenu, wItemID, str, nMaxSiz, wFlags );
     if (!str || !nMaxSiz) return 0;
     str[0] = '\0';
     if (!(item = MENU_FindItem( &hMenu, &wItemID, wFlags ))) return 0;
     if (!IS_STRING_ITEM(item->fType)) return 0;
     lstrcpyn32A( str, item->text, nMaxSiz );
-    dprintf_menu( stddeb, "GetMenuString32A: returning '%s'\n", str );
+    dprintf_info(menu, "GetMenuString32A: returning '%s'\n", str );
     return strlen(str);
 }
 
@@ -2856,7 +2853,7 @@
 {
     MENUITEM *item;
 
-    dprintf_menu( stddeb, "GetMenuString32W: menu=%04x item=%04x ptr=%p len=%d flags=%04x\n",
+    dprintf_info(menu, "GetMenuString32W: menu=%04x item=%04x ptr=%p len=%d flags=%04x\n",
                  hMenu, wItemID, str, nMaxSiz, wFlags );
     if (!str || !nMaxSiz) return 0;
     str[0] = '\0';
@@ -2884,7 +2881,7 @@
                                 UINT32 wHilite )
 {
     LPPOPUPMENU menu;
-    dprintf_menu(stddeb,"HiliteMenuItem(%04x, %04x, %04x, %04x);\n", 
+    dprintf_info(menu,"HiliteMenuItem(%04x, %04x, %04x, %04x);\n", 
                  hWnd, hMenu, wItemID, wHilite);
     if (!MENU_FindItem( &hMenu, &wItemID, wHilite )) return FALSE;
     if (!(menu = (LPPOPUPMENU) USER_HEAP_LIN_ADDR(hMenu))) return FALSE;
@@ -2910,7 +2907,7 @@
 UINT32 WINAPI GetMenuState32( HMENU32 hMenu, UINT32 wItemID, UINT32 wFlags )
 {
     MENUITEM *item;
-    dprintf_menu(stddeb,"GetMenuState(%04x, %04x, %04x);\n", 
+    dprintf_info(menu,"GetMenuState(%04x, %04x, %04x);\n", 
 		 hMenu, wItemID, wFlags);
     if (!(item = MENU_FindItem( &hMenu, &wItemID, wFlags ))) return -1;
     debug_print_menuitem ("  item: ", item, "");
@@ -2937,7 +2934,7 @@
 {
     LPPOPUPMENU	menu = (LPPOPUPMENU) USER_HEAP_LIN_ADDR(hMenu);
     if (!IS_A_MENU(menu)) return -1;
-    dprintf_menu( stddeb,"GetMenuItemCount16(%04x) returning %d\n", 
+    dprintf_info(menu,"GetMenuItemCount16(%04x) returning %d\n", 
                   hMenu, menu->nItems );
     return menu->nItems;
 }
@@ -2950,7 +2947,7 @@
 {
     LPPOPUPMENU	menu = (LPPOPUPMENU) USER_HEAP_LIN_ADDR(hMenu);
     if (!IS_A_MENU(menu)) return -1;
-    dprintf_menu( stddeb,"GetMenuItemCount32(%04x) returning %d\n", 
+    dprintf_info(menu,"GetMenuItemCount32(%04x) returning %d\n", 
                   hMenu, menu->nItems );
     return menu->nItems;
 }
@@ -3007,10 +3004,10 @@
     MENUITEM *item;
 
     if (IS_STRING_ITEM(flags) && str)
-        dprintf_menu( stddeb, "InsertMenu: hMenu %04x, pos %d, flags %08x, "
+        dprintf_info(menu, "InsertMenu: hMenu %04x, pos %d, flags %08x, "
 		      "id %04x, str '%s'\n",
                       hMenu, pos, flags, id, str );
-    else dprintf_menu( stddeb, "InsertMenu: hMenu %04x, pos %d, flags %08x, "
+    else dprintf_info(menu, "InsertMenu: hMenu %04x, pos %d, flags %08x, "
 		       "id %04x, str %08lx (not a string)\n",
                        hMenu, pos, flags, id, (DWORD)str );
 
@@ -3096,7 +3093,7 @@
     LPPOPUPMENU	menu;
     MENUITEM *item;
 
-    dprintf_menu(stddeb,"RemoveMenu (%04x, %04x, %04x)\n",hMenu, nPos, wFlags);
+    dprintf_info(menu,"RemoveMenu (%04x, %04x, %04x)\n",hMenu, nPos, wFlags);
     if (!(item = MENU_FindItem( &hMenu, &nPos, wFlags ))) return FALSE;
     if (!(menu = (LPPOPUPMENU) USER_HEAP_LIN_ADDR(hMenu))) return FALSE;
     
@@ -3170,13 +3167,13 @@
 
     if (IS_STRING_ITEM(flags))
     {
-	dprintf_menu( stddeb, "ModifyMenu: %04x %d %04x %04x '%s'\n",
+	dprintf_info(menu, "ModifyMenu: %04x %d %04x %04x '%s'\n",
                       hMenu, pos, flags, id, str ? str : "#NULL#" );
         if (!str) return FALSE;
     }
     else
     {
-	dprintf_menu( stddeb, "ModifyMenu: %04x %d %04x %04x %08lx\n",
+	dprintf_info(menu, "ModifyMenu: %04x %d %04x %04x %08lx\n",
                       hMenu, pos, flags, id, (DWORD)str );
     }
 
@@ -3254,7 +3251,7 @@
                                     HBITMAP32 hNewUnCheck, HBITMAP32 hNewCheck)
 {
     MENUITEM *item;
-    dprintf_menu(stddeb,"SetMenuItemBitmaps(%04x, %04x, %04x, %04x, %04x)\n",
+    dprintf_info(menu,"SetMenuItemBitmaps(%04x, %04x, %04x, %04x, %04x)\n",
                  hMenu, nPos, wFlags, hNewCheck, hNewUnCheck);
     if (!(item = MENU_FindItem( &hMenu, &nPos, wFlags ))) return FALSE;
 
@@ -3299,7 +3296,7 @@
     menu->hWnd   = 0;
     menu->items  = NULL;
     menu->FocusedItem = NO_SELECTED_ITEM;
-    dprintf_menu( stddeb, "CreateMenu: return %04x\n", hMenu );
+    dprintf_info(menu, "CreateMenu: return %04x\n", hMenu );
     return hMenu;
 }
 
@@ -3318,7 +3315,7 @@
  */
 BOOL32 WINAPI DestroyMenu32( HMENU32 hMenu )
 {
-    dprintf_menu(stddeb,"DestroyMenu(%04x)\n", hMenu);
+    dprintf_info(menu,"DestroyMenu(%04x)\n", hMenu);
 
     /* Silently ignore attempts to destroy default system popup */
 
@@ -3466,7 +3463,7 @@
 {
     WND * wndPtr = WIN_FindWndPtr(hWnd);
 
-    dprintf_menu(stddeb,"SetMenu(%04x, %04x);\n", hWnd, hMenu);
+    dprintf_info(menu,"SetMenu(%04x, %04x);\n", hWnd, hMenu);
 
     if (wndPtr && !(wndPtr->dwStyle & WS_CHILD))
     {
@@ -3578,11 +3575,11 @@
     if (HIWORD(name))
     {
         char *str = (char *)PTR_SEG_TO_LIN( name );
-        dprintf_menu( stddeb, "LoadMenu(%04x,'%s')\n", instance, str );
+        dprintf_info(menu, "LoadMenu(%04x,'%s')\n", instance, str );
         if (str[0] == '#') name = (SEGPTR)atoi( str + 1 );
     }
     else
-        dprintf_resource(stddeb,"LoadMenu(%04x,%04x)\n",instance,LOWORD(name));
+        dprintf_info(resource,"LoadMenu(%04x,%04x)\n",instance,LOWORD(name));
 
     if (!name) return 0;
     
@@ -3630,7 +3627,7 @@
     WORD version, offset;
     LPCSTR p = (LPCSTR)template;
 
-    dprintf_menu(stddeb,"LoadMenuIndirect16: %p\n", template );
+    dprintf_info(menu,"LoadMenuIndirect16: %p\n", template );
     version = GET_WORD(p);
     p += sizeof(WORD);
     if (version)
@@ -3659,7 +3656,7 @@
     WORD version, offset;
     LPCSTR p = (LPCSTR)template;
 
-    dprintf_menu(stddeb,"LoadMenuIndirect32A: %p\n", template );
+    dprintf_info(menu,"LoadMenuIndirect32A: %p\n", template );
     version = GET_WORD(p);
     p += sizeof(WORD);
     switch (version)
@@ -3934,7 +3931,7 @@
      MENUITEM *mifirst, *milast, *micheck;
      HMENU32 mfirst = hMenu, mlast = hMenu, mcheck = hMenu;
 
-     dprintf_menu (stddeb,
+     dprintf_info(menu,
 		   "CheckMenuRadioItem32: ox%x: %d-%d, check %d, bypos=%d\n",
 		   hMenu, first, last, check, bypos);
 
@@ -3988,7 +3985,7 @@
      MENUITEM *item;
      HMENU32 orghMenu = hMenu;
 
-     dprintf_menu (stddeb, "GetMenuItemRect32 (0x%x,0x%x,%d,%p)\n",
+     dprintf_info(menu, "GetMenuItemRect32 (0x%x,0x%x,%d,%p)\n",
 		   hwnd, hMenu, uItem, rect);
 
      item = MENU_FindItem (&hMenu, &uItem, MF_BYPOSITION);
diff --git a/controls/progress.c b/controls/progress.c
index 6a6e388..426c2c4 100644
--- a/controls/progress.c
+++ b/controls/progress.c
@@ -17,7 +17,6 @@
 #include "graphics.h"
 #include "heap.h"
 #include "win.h"
-#include "stddebug.h"
 #include "debug.h"
 
 /* Control configuration constants */
@@ -27,7 +26,7 @@
 
 /* Work constants */
 
-#define UNKNOWN_PARAM(msg, wParam, lParam) dprintf_progress(stddeb, \
+#define UNKNOWN_PARAM(msg, wParam, lParam) dprintf_warn(progress, \
         "Progress Ctrl: Unknown parameter(s) for message " #msg     \
 	"(%04x): wp=%04x lp=%08lx\n", msg, wParam, lParam); 
 
@@ -48,7 +47,7 @@
   RECT32 rect;
   HDC32 hdc;
 
-  dprintf_progress(stddeb, "Progress Bar: paint pos=%d min=%d, max=%d\n",
+  dprintf_info(progress, "Progress Bar: paint pos=%d min=%d, max=%d\n",
 		   infoPtr->CurVal, infoPtr->MinVal, infoPtr->MaxVal);
 
   /* get a dc */
@@ -115,11 +114,11 @@
       infoPtr->MaxVal=100;
       infoPtr->CurVal=0; 
       infoPtr->Step=10;
-      dprintf_updown(stddeb, "Progress Ctrl creation, hwnd=%04x\n", hwnd);
+      dprintf_info(updown, "Progress Ctrl creation, hwnd=%04x\n", hwnd);
       break;
     
     case WM_DESTROY:
-      dprintf_updown(stddeb, "Progress Ctrl destruction, hwnd=%04x\n", hwnd);
+      dprintf_info(updown, "Progress Ctrl destruction, hwnd=%04x\n", hwnd);
       break;
 
     case WM_ERASEBKGND:
diff --git a/controls/scroll.c b/controls/scroll.c
index f1f4512..956f359 100644
--- a/controls/scroll.c
+++ b/controls/scroll.c
@@ -15,7 +15,6 @@
 #include "graphics.h"
 #include "heap.h"
 #include "win.h"
-#include "stddebug.h"
 #include "debug.h"
 
 
@@ -616,7 +615,7 @@
           return;  /* Should never happen */
     }
 
-    dprintf_scroll( stddeb, "ScrollBar Event: hwnd=%04x bar=%d msg=%x pt=%d,%d hit=%d\n",
+    dprintf_info(scroll, "ScrollBar Event: hwnd=%04x bar=%d msg=%x pt=%d,%d hit=%d\n",
                     hwnd, nBar, msg, pt.x, pt.y, hittest );
 
     switch(trackHitTest)
@@ -795,7 +794,7 @@
             }
         }
         if (!hUpArrow) SCROLL_LoadBitmaps();
-        dprintf_scroll( stddeb, "ScrollBar creation, hwnd=%04x\n", hwnd );
+        dprintf_info(scroll, "ScrollBar creation, hwnd=%04x\n", hwnd );
         return 0;
 	
     case WM_LBUTTONDOWN:
@@ -910,19 +909,18 @@
     SCROLLBAR_INFO *infoPtr;
     UINT32 new_flags;
     BOOL32 repaint_arrows = FALSE;
+    dbg_decl_str(scroll, 256);
 
     if (!(infoPtr = SCROLL_GetScrollInfo(hwnd, nBar))) return 0;
     if (info->fMask & ~(SIF_ALL | SIF_DISABLENOSCROLL)) return 0;
     if ((info->cbSize != sizeof(*info)) &&
         (info->cbSize != sizeof(*info)-sizeof(info->nTrackPos))) return 0;
 
-    dprintf_scroll( stddeb, "SetScrollInfo: hwnd=%04x bar=%d", hwnd, nBar );
-
     /* Set the page size */
 
     if (info->fMask & SIF_PAGE)
     {
-        dprintf_scroll( stddeb, " page=%d", info->nPage );
+        dsprintf(scroll, " page=%d", info->nPage );
         infoPtr->Page = info->nPage;
     }
 
@@ -930,7 +928,7 @@
 
     if (info->fMask & SIF_POS)
     {
-        dprintf_scroll( stddeb, " pos=%d", info->nPos );
+        dsprintf(scroll, " pos=%d", info->nPos );
         infoPtr->CurVal = info->nPos;
     }
 
@@ -938,7 +936,7 @@
 
     if (info->fMask & SIF_RANGE)
     {
-        dprintf_scroll( stddeb, " min=%d max=%d", info->nMin, info->nMax );
+        dsprintf(scroll, " min=%d max=%d", info->nMin, info->nMax );
 
         /* Invalid range -> range is set to (0,0) */
         if ((info->nMin > info->nMax) ||
@@ -954,6 +952,9 @@
         }
     }
 
+    dprintf_info(scroll, "SetScrollInfo: hwnd=%04x bar=%d %s\n", 
+		    hwnd, nBar, dbg_str(scroll));
+
     /* Make sure the page size is valid */
 
     if (infoPtr->Page < 0) infoPtr->Page = 0;
@@ -967,7 +968,7 @@
     else if (infoPtr->CurVal > infoPtr->MaxVal - MAX( infoPtr->Page-1, 0 ))
         infoPtr->CurVal = infoPtr->MaxVal - MAX( infoPtr->Page-1, 0 );
 
-    dprintf_scroll( stddeb, "\n   new values: page=%d pos=%d min=%d max=%d\n",
+    dprintf_info(scroll, "\n   new values: page=%d pos=%d min=%d max=%d\n",
                     infoPtr->Page, infoPtr->CurVal,
                     infoPtr->MinVal, infoPtr->MaxVal );
 
@@ -1208,7 +1209,7 @@
     WND *wndPtr = WIN_FindWndPtr( hwnd );
 
     if (!wndPtr) return FALSE;
-    dprintf_scroll( stddeb, "ShowScrollBar: hwnd=%04x bar=%d on=%d\n",
+    dprintf_info(scroll, "ShowScrollBar: hwnd=%04x bar=%d on=%d\n",
                     hwnd, nBar, fShow );
 
     switch(nBar)
@@ -1284,7 +1285,7 @@
     SCROLLBAR_INFO *infoPtr;
 
     if (!(infoPtr = SCROLL_GetScrollInfo( hwnd, nBar ))) return FALSE;
-    dprintf_scroll( stddeb, "EnableScrollBar: %04x %d %d\n",
+    dprintf_info(scroll, "EnableScrollBar: %04x %d %d\n",
                     hwnd, nBar, flags );
     flags &= ESB_DISABLE_BOTH;
     if (infoPtr->flags == flags) return FALSE;
diff --git a/controls/uitools.c b/controls/uitools.c
index 15779a1..8872a11 100644
--- a/controls/uitools.c
+++ b/controls/uitools.c
@@ -574,7 +574,7 @@
  */
 BOOL32 WINAPI DrawEdge32( HDC32 hdc, LPRECT32 rc, UINT32 edge, UINT32 flags )
 {
-    dprintf_graphics( stddeb, "DrawEdge: %04x %d,%d-%d,%d %04x %04x\n",
+    dprintf_info(graphics, "DrawEdge: %04x %d,%d-%d,%d %04x %04x\n",
                       hdc, rc->left, rc->top, rc->right, rc->bottom,
                       edge, flags );
 
diff --git a/controls/updown.c b/controls/updown.c
index c0a2848..8a8302a 100644
--- a/controls/updown.c
+++ b/controls/updown.c
@@ -35,8 +35,6 @@
 #include "graphics.h"
 #include "heap.h"
 #include "win.h"
-#include "stddebug.h"
-/*#define  DEBUG_UPDOWN*/
 #include "debug.h"
 
 /* Control configuration constants */
@@ -62,7 +60,7 @@
 
 static int accelIndex = -1;
 
-#define UNKNOWN_PARAM(msg, wParam, lParam) dprintf_updown(stddeb, \
+#define UNKNOWN_PARAM(msg, wParam, lParam) dprintf_warn(updown, \
         "UpDown Ctrl: Unknown parameter(s) for message " #msg     \
 	"(%04x): wp=%04x lp=%08lx\n", msg, wParam, lParam);
 
@@ -209,7 +207,7 @@
     if(*src || !UPDOWN_InBounds(wndPtr, newVal)) 
       return FALSE;
 
-    dprintf_updown(stddeb, "UpDown Ctrl: new value(%d) read from buddy "
+    dprintf_info(updown, "UpDown Ctrl: new value(%d) read from buddy "
 		   "(old=%d)\n",  newVal, infoPtr->CurVal);
   }
   
@@ -234,7 +232,7 @@
   if (!IsWindow32(infoPtr->Buddy)) 
     return FALSE;
 
-  dprintf_updown(stddeb, "UpDown Ctrl: set new value(%d) to buddy.\n",
+  dprintf_info(updown, "UpDown Ctrl: set new value(%d) to buddy.\n",
 		 infoPtr->CurVal);
 
   /*if the buddy is a list window, we must set curr index */
@@ -381,7 +379,7 @@
   int old_val = infoPtr->CurVal;
   NM_UPDOWN ni;
 
-  dprintf_updown(stddeb, "UpDown Ctrl action: %s by %d\n",
+  dprintf_info(updown, "UpDown Ctrl action: %s by %d\n",
 		 incr ? "inc" : "dec", delta);
 
   /* check if we can do the modification first */
@@ -583,13 +581,13 @@
       if(wndPtr->dwStyle & UDS_AUTOBUDDY)
 	UPDOWN_SetBuddy(wndPtr, GetWindow32(wndPtr->hwndSelf, GW_HWNDPREV));
 	
-      dprintf_updown(stddeb, "UpDown Ctrl creation, hwnd=%04x\n", hwnd);
+      dprintf_info(updown, "UpDown Ctrl creation, hwnd=%04x\n", hwnd);
       break;
     
     case WM_DESTROY:
       if(infoPtr->AccelVect)
 	free(infoPtr->AccelVect);
-      dprintf_updown(stddeb, "UpDown Ctrl destruction, hwnd=%04x\n", hwnd);
+      dprintf_info(updown, "UpDown Ctrl destruction, hwnd=%04x\n", hwnd);
       break;
 	
     case WM_ENABLE:
@@ -679,7 +677,7 @@
       return temp;
 
     case UDM_SETACCEL:
-      dprintf_updown(stddeb, "UpDown Ctrl new accel info, hwnd=%04x\n", hwnd);
+      dprintf_info(updown, "UpDown Ctrl new accel info, hwnd=%04x\n", hwnd);
       if(infoPtr->AccelVect){
 	free(infoPtr->AccelVect);
 	infoPtr->AccelCount = 0;
@@ -699,7 +697,7 @@
       return infoPtr->Base;
 
     case UDM_SETBASE:
-      dprintf_updown(stddeb, "UpDown Ctrl new base(%d), hwnd=%04x\n", 
+      dprintf_info(updown, "UpDown Ctrl new base(%d), hwnd=%04x\n", 
 		     wParam, hwnd);
       if ( !(wParam==10 || wParam==16) || lParam)
 	UNKNOWN_PARAM(UDM_SETBASE, wParam, lParam);
@@ -721,7 +719,7 @@
       temp = infoPtr->Buddy;
       infoPtr->Buddy = wParam;
       UPDOWN_SetBuddy(wndPtr, wParam);
-      dprintf_updown(stddeb, "UpDown Ctrl new buddy(%04x), hwnd=%04x\n", 
+      dprintf_info(updown, "UpDown Ctrl new buddy(%04x), hwnd=%04x\n", 
 		     infoPtr->Buddy, hwnd);
       return temp;
 
@@ -735,7 +733,7 @@
       if (wParam || HIWORD(lParam))
 	UNKNOWN_PARAM(UDM_GETPOS, wParam, lParam);
       temp = SLOWORD(lParam);
-      dprintf_updown(stddeb, "UpDown Ctrl new value(%d), hwnd=%04x\n",
+      dprintf_info(updown, "UpDown Ctrl new value(%d), hwnd=%04x\n",
 		     temp, hwnd);
       if(!UPDOWN_InBounds(wndPtr, temp)){
 	if(temp < infoPtr->MinVal)  
@@ -760,7 +758,7 @@
       infoPtr->MaxVal = SLOWORD(lParam); /* UD_MINVAL <= Max <= UD_MAXVAL */
       infoPtr->MinVal = SHIWORD(lParam); /* UD_MINVAL <= Min <= UD_MAXVAL */
                                          /* |Max-Min| <= UD_MAXVAL        */
-      dprintf_updown(stddeb, "UpDown Ctrl new range(%d to %d), hwnd=%04x\n", 
+      dprintf_info(updown, "UpDown Ctrl new range(%d to %d), hwnd=%04x\n", 
 		     infoPtr->MinVal, infoPtr->MaxVal, hwnd);
       break;                             
 
diff --git a/documentation/Makefile.in b/documentation/Makefile.in
index 6026158..fdf44b1 100644
--- a/documentation/Makefile.in
+++ b/documentation/Makefile.in
@@ -18,14 +18,21 @@
 	wine.info-1 \
 	wine.info-2
 
+HTMLFILES = \
+	wine_toc.html \
+	wine.html
+
 DVIFILES = wine.dvi
 
-all: $(INFOFILES) $(DVIFILES)
+
+all: $(INFOFILES) $(DVIFILES) $(HTMLFILES)
 
 info: $(INFOFILES)
 
 dvi: $(DVIFILES)
 
+html: $(HTMLFILES)
+
 @MAKE_RULES@
 
 $(INFOFILES): $(SOURCES)
@@ -34,6 +41,10 @@
 $(DVIFILES): $(SOURCES)
 	texi2dvi $(SRCDIR)/wine.texinfo
 
+$(HTMLFILES): $(SOURCES)
+	makeinfo -E wine.texi $(SRCDIR)/wine.texinfo
+	texi2html wine.texi 
+
 $(INCLUDES):
 	$(RM) $(INCLUDES)
 	for i in $(INCLUDES); do $(LN_S) $(TOPSRCDIR)/$$i $$i || exit 1; done
@@ -48,7 +59,8 @@
 clean::
 	$(RM) $(INFOFILES) $(DVIFILES) $(INCLUDES)
 	$(RM) wine.aux wine.cp wine.cps wine.fn wine.fns wine.ky wine.log \
-		wine.pg wine.toc wine.tp wine.tps wine.vr wine.vrs
+		wine.pg wine.toc wine.tp wine.tps wine.vr wine.vrs \
+		wine.texi
 	$(RM) -r man3w
 
 ### Dependencies:
diff --git a/documentation/console b/documentation/console
index a623e35..f6c71c6 100644
--- a/documentation/console
+++ b/documentation/console
@@ -4,12 +4,17 @@
 
 Consoles are just xterms created with the -Sxxn switch.
 A pty is opened and the master goes to the xterm side
-and the slave is held by the wine side.  The slave fd
-is changed into a HANDLE32 and this HANDLE32 is set
+and the slave is held by the wine side.  The console
+itself it turned into a few HANDLE32s and is set 
 to the STD_*_HANDLES.
 
-For now writing/reading to a console just calls FileWrite/FileRead.
+It is possible to use the WriteFile and ReadFile commands
+to write to a win32 console.  To accomplish this, all K32OBJs 
+that support I/O have a read and write function pointer.
+So, WriteFile calls K32OBJ_WriteFile which calls the K32OBJ's
+write function pointer, which then finally calls write.
 
+[this paragraph is now out of date]
 If the command line console is to be inheirited or
 a process inherits it's parents console (-- can that happen???),
 the console is created at process init time via PROCESS_InheritConsole.
@@ -23,20 +28,55 @@
 it is possible to create a new console (via AllocConsole).
 
 
-Like most k32 objects, when the FreeConsole is called, the 
-ref count is decremented and the console is freed when
-it reaches zero.  The free kills the xterm and closes
-the master/slave fds.
+When FreeConsole is called, all handles that the process has
+open to the console are closed.  Like most k32objs, if the 
+console's refcount reaches zero, its k32obj destroy function
+is called.  The destroy kills the xterm if one was open.
 
 Also like most k32 objects, we assume that (K32OBJ) header is the
 first field so the casting (from K32OBJ *to CONSOLE *)
 works correctly.
 
+FreeConsole is called on process exit (in ExitProcess) if 
+pdb->console is not NULL.
+
 BUGS
 ----
+Console processes do not inherit their parent's handles.  I think
+there needs to be two cases, one where they have to inherit
+the stdin/stdout/stderr from unix, and one where they have to
+inherit from another windows app.
 
-A exit handler needs to be added.  If the process exits
-without calling FreeConsole, the xterm continues on...
-But... there should probably be a generic exit handler in
-wine for this kind of stuff (K32OBJs).
 
+================================================================
+
+experimentation with NT4 yields that:
+
+WriteFile
+---------
+	o does not truncate file on 0 length write
+	o 0 length write or error on write changes numcharswritten to 0
+	o 0 length write returns TRUE
+	o works with console handles
+
+_lwrite
+-------
+	o does truncate/expand file at current position on 0 length write
+	o returns 0 on a zero length write
+	o works with console handles (typecasted)
+
+WriteConsole
+------------
+	o expects only console handles
+
+
+SetFilePointer
+--------------
+	o returns -1 (err 6) when used with a console handle
+
+
+FreeConsole
+-----------
+	o even when all the handles to it are freed, the win32 console
+	  stays visible, the only way I could find to free it
+	  was via the FreeConsole
diff --git a/documentation/debug-msgs b/documentation/debug-msgs
new file mode 100644
index 0000000..3953a68
--- /dev/null
+++ b/documentation/debug-msgs
@@ -0,0 +1,351 @@
+Note: the debugging interface is under development. Please do not make
+      changes to it yet as I will do major changes in the next few weeks.
+      To make my life easier, PLEASE follow the guidelines described in
+      this document. If you have some ideas that you would like to
+      incorporate, please contact me first.
+      Please read the document before writing new code.
+      Also, DO NOT USE fprintf (or printf) to output things. All these
+      will have to be translated to dprintf_ calls and there are already
+      about 3000 of them! Also, instead of writing FIXMEs in the source,
+      output a dprintf_fixme message. But read on...
+25 Feb 1998, Dimitrie O. Paun <dimi@cs.toronto.edu>
+
+
+Debugging classes
+-----------------
+
+The debugging messages are divided into 4 classes:
+
+fixme -- Messages in this class relate to behavior of Wine that does
+         not correspond to standard Windows behavior and that should
+         be fixed. 
+         Examples: stubs, semi-implemented features, etc.
+
+err   -- Messages in this class relate to serious errors in Wine.
+         This sort of messages are close to asserts -- that is,
+         you should output a 'err' message when the code detects a
+         condition which should not happen.
+	 Examples: unexpected change in internal state, etc.
+
+warn  -- This are warning messages. You should report a warning when
+         something unwanted happen but the function behaves properly.
+         That is, output a warning when you encounter something
+         unexpected (ex: could not open a file) but the function deals
+         correctly with the situation (that is, according to the docs).
+         If you do not deal correctly with it, output a fixme.
+	 Examples: fail to access a resource required by the app, etc.
+
+info  -- This are detailed debugging messages that are mainly useful 
+         to debug a component. This are usually turned off.
+         Examples: everything else that does not fall in one of the
+                   above mentioned categories and the user does not
+                   need to know about it. This sort of messages simply
+                   outputs something about the state of some component 
+                   that is of interest mainly to the developer of that
+                   component.
+            
+We will refer to a generic class as yyy.
+
+The user has the capability to turn on or off messages in a particular
+class. You can expect the following patters of usage (but note that 
+any combination is possible):
+  -- when you debug a component, all classes (info,warn,err,fixme)
+     will be enabled.
+  -- during the pre-alpha (maybe alpha) stage of Wine, most likely
+     the info class will be disabled by default, but all others
+     (warn,err,fixme) will be enabled by default.
+  -- when Wine will become stable, most likely the info and warn
+     classes will be disabled by default, but all err and fixme 
+     will be enabled by default.
+  -- in some installations that want the smallest footprint
+     and where the debug information is of no interest, 
+     all classes may be disabled by default.
+
+Of course, the user will have the runtime ability to override these
+defaults. However, this ability may be turned off and certain classes
+of messages may be completely disabled at compile time to reduce the 
+size of Wine.
+
+Debugging channels
+------------------
+
+Also, we divide the debugging messages per component. Each component
+is assigned a debugging channel (or type). The identifier of the
+channel must be a valid C identifier but note that it may also be a
+reserve word like int or static.
+
+Examples of debugging channels/types:
+reg, updown, string
+
+We will refer to a generic channel as xxx.
+
+Note: for those who know the old interface, the channel/type is
+      what followed the _ in the dprintf_xxx statements.
+      For example, to output a message on the debugging channel
+      reg in the old interface you would have to write:
+
+      dprintf_reg(stddeb, "Could not access key!\n");
+
+      In the new interface, we drop the stddeb as it is implicit.
+      However, we add an orthogonal piece of information to the
+      message: its class. This is very important as it will allow
+      us to selectively turn on or off certain messages based on
+      type of information they report. For this reason it is VERY
+      important to choose the right class for the message. 
+      Anyhow, suppose we figured that this message should belong
+      in the warn class, so in the new interface, you write:
+
+      dprintf_warn(reg, "Could not access key!\n");
+
+---
+
+How to use it
+-------------
+
+So, to output a message (class yyy) on channel xxx, do:
+
+#include "debug.h"
+
+....
+
+dprintf_yyy(xxx, "<message>", ...);
+
+
+Some examples from the code:
+
+#include "debug.h"
+
+...
+
+  dprintf_info(crtdll,
+	       "CRTDLL_setbuf(file %p buf %p)\n",
+	       file, buf);
+
+  dprintf_warn(aspi, "Error opening device errno=%d\n", save_error);
+
+
+If you need to declare a new debugging channel, do:
+%tools/make_debug
+in the root directory of Wine.
+
+Note that this will result in almost complete recompilation of Wine.
+
+Notes:
+   1. Please pay attention to which class you assign the message.
+      It is very, Very, VERY important to get the class right.
+      There are only 4 classes, so it is not hard. The reason
+      it is important to get it right is that too much information
+      is no information. For example, if you put things into the 
+      warn class that should really be in the info class, the 
+      output will be too big and this will force the user to 
+      turn of warnings. But this way he will fail to see the important
+      ones. Also, if you put warnings into the info class lets say,
+      he will most likely miss those because usually the info class
+      is turned off. A similar argument can be made if you mix any
+      other two classes.
+   2. ALL LINES MUST END WITH A NEWLINE!!! If you can NOT output
+      everything that you want in the line with only one dprintf_xxx
+      statement, then you need to build the string in memory.
+      Please read the section below "In-memory messages" on the
+      preferred way to do it. PLEASE USE THAT INTERFACE TO BUILD
+      MESSAGES IN MEMORY. The reason is that we are not sure that
+      we like it and having everything in one format will facilitate
+      the (automatic) translation to a better interface.
+
+
+
+Are we debugging?
+-----------------
+
+To test whether the debugging output of class yyy on channel xxx is
+enabled, do:
+
+debugging_yyy(xxx)
+
+Examples:
+
+if(debugging_info(atom)){
+  ...blah...
+}
+
+
+
+In-memory messages
+------------------
+
+If you NEED to build the message from multiple calls, you need to 
+build it in memory. To do that, you should use the following
+interface:
+
+ - declare a string (where you are allowed to declare C variables)
+   as follows:
+   dbg_decl_str(name, len);
+   where name  is the name of the string (you should use the channel
+   name on which you are going to output it)
+
+ - print in it with:
+   dsprintf(name, "<message>", ...);
+   which is just like a sprintf function but instead of a C string as
+   first parameter it takes the name you used to declare it.
+
+ - obtain a pointer to the string with:
+   dbg_str(name)
+
+ - reset the string (if you want to reuse it with):
+   dbg_reset_str(name);
+
+Example (modified from the code):
+
+void some_func(tabs)
+{
+  INT32 i;
+  LPINT16 p = (LPINT16)tabs;
+  dbg_decl_str(listbox, 256);                   /* declare the string */
+
+  for (i = 0; i < descr->nb_tabs; i++) {
+    descr->tabs[i] = *p++<<1; 
+    if(debugging_info(listbox))                  /* write in it only if
+      dsprintf(listbox, "%hd ", descr->tabs[i]); /* we are gonna output it */
+  }
+  dprintf_info(listbox, "Listbox %04x: settabstops %s\n", 
+	       wnd->hwndSelf, dbg_str(listbox)); /* output the whole thing */
+}
+
+If you need to use it two times in the same scope do like this:
+
+void some_func(tabs)
+{
+  INT32 i;
+  LPINT16 p = (LPINT16)tabs;
+  dbg_decl_str(listbox, 256);                   /* declare the string      */
+
+  for (i = 0; i < descr->nb_tabs; i++) {
+    descr->tabs[i] = *p++<<1;  
+    if(debugging_info(listbox))                  /* write in it only if
+      dsprintf(listbox, "%hd ", descr->tabs[i]); /* we are gonna output it */
+  }
+  dprintf_info(listbox, "Listbox %04x: settabstops %s\n", 
+	       wnd->hwndSelf, dbg_str(listbox)); /* output the whole thing */
+
+  dbg_reset_str(listbox);                        /* !!!reset the string!!! */
+  for (i = 0; i < descr->extrainfo_nr; i++) {
+    descr->extrainfo = *p+1; 
+    if(debugging_info(listbox))                  /* write in it only if
+      dsprintf(listbox,"%3d ",descr->extrainfo); /* we are gonna output it */
+  }
+
+  dprintf_info(listbox, "Listbox %04x: extrainfo %s\n", 
+	       wnd->hwndSelf, dbg_str(listbox)); /* output the whole thing */
+
+}
+
+IMPORTANT NOTE:
+  As I already stated, I do not think this will be the ultimate interface
+  for building in-memory debugging messages. In fact, I do have better ideas
+  which I hope to have time to implement for the next release. For this
+  reason, please try not to use it. However, if you need to output a line
+  in more than one dprintf_xxx calls, then USE THIS INTERFACE. DO NOT use
+  other methods. This way, I will easily translate everything to the new
+  interface (when it will become available). So, if you need to use if,
+  then follow the following guidelines:
+   -- wrap calls to dsprintf with a 
+      if(debugging_yyy(xxx))
+        dsprintf(xxx,...);
+      Of course, if the call to dsprintf is made from within a function 
+      which you know is called only if debugging_yyy(xxx) is true
+      (say you call it only like this:
+        if(debugging_yyy(xxx))
+          print_some_debug_info();
+      )
+      then you need not (and should not) wrap calls to dsprintf with
+      the before mentioned if.
+   -- name the string EXACTLY like the debugging channel on which
+      is going to be output. Please see the above example. 
+
+
+Resource identifiers
+--------------------
+
+Resource identifiers can be either strings or numbers. To make life a bit
+easier for outputting this beasts (and to help you avoid the need to build
+the message in memory), I introduced a new function called:
+
+debugres
+
+The function is defined in debugstr.h
+and has the following prototype:
+
+LPSTR debugres(const void *id);
+
+It takes a pointer to the resource id and returns a nicely formatted
+string of the identifier.
+
+It the high word of the pointer is 0, then it assumes that the
+identifier is a number and thus returns a string of the form:
+
+#xxxx
+
+where xxxx are 4 hex-digits representing the low word of id.
+
+It the high word of the pointer is not 0, then it assumes that the
+identifier is a string and thus returns a string of the form:
+
+'<identifier>'
+
+Thus, to use it, do something on the following lines:
+
+#include "debugstr.h"
+
+...
+
+   dprintf_yyy(xxx, "resource is %s", debugres(myresource));
+
+
+The -debugmsg command line option
+---------------------------------
+
+So, the -debugmsg command line option has been changed as follows:
+  - the new syntax is: -debugmsg [yyy]#xxx[,[yyy1]#xxx1]*
+    where # is either + or -
+
+  - when the optional class argument (yyy) is not present, 
+    then the statement will enable(+)/disable(-) all messages for
+    the given channel (xxx) on all classes. For example:
+   
+    -debugmsg +reg,-file
+   
+    enables all messages on the reg channel and disables all
+    messages on the file channel.
+    This is very close (actually identical) to the old semantics.
+
+  - when the optional class argument (yyy) is present, 
+    then the statement will enable(+)/disable(-) messages for
+    the given channel (xxx) only on the given class. For example:
+   
+    -debugmsg info+reg,warn-file
+   
+    enables info messages on the reg channel and disables warning
+    messages on the file channel.
+
+  - also, the pseudo-channel all is also supported and it has the 
+    intuitive semantics:
+
+    -debugmsg +all      -- enables all debug messages
+    -debugmsg -all      -- disables all debug messages   
+    -debugmsg yyy+all   -- enables debug messages for class yyy on all
+                           channels.
+    -debugmsg yyy-all   -- disables debug messages for class yyy on all
+                           channels.
+
+    So, for example:
+
+    -debugmsg warn-all  -- disables all warning messages.
+
+
+Also, note that at the moment:
+   - the fixme, err, warn classes are all enabled by default
+   - the info class is disabled by default
+   - there is no way to compile out the messages. All are 
+     runtime configurable. This will come next release.
+
+
diff --git a/documentation/debugging b/documentation/debugging
index 1686ae7..7142179 100644
--- a/documentation/debugging
+++ b/documentation/debugging
@@ -51,18 +51,19 @@
     the reason is located in the last call(s).  Those lines usually look like
     this:
 
-|Call KERNEL.90: LSTRLEN(0227:0692) ret=01e7:2ce7 ds=0227
-      ^^^^^^^^^  ^       ^^^^^^^^^      ^^^^^^^^^    ^^^^
-      |          |       |              |            |Datasegment on entry
-      |          |       |              |Return address.
+|Call KERNEL.90: LSTRLEN(0227:0692 "text") ret=01e7:2ce7 ds=0227
+      ^^^^^^^^^  ^       ^^^^^^^^^ ^^^^^^      ^^^^^^^^^    ^^^^
+      |          |       |         |           |            |Datasegment
+      |          |       |         |           |Return address
+      |          |       |         |textual parameter
       |          |       |
       |          |       |Argument(s). This one is a win16 segmented pointer.
       |          |Function called.
       |The module, the function is called in. In this case it is KERNEL.
 		        
-|Ret  KERNEL.90: LSTRLEN() retval=0x0007 ret=01e7:2ce7 ds=0227
+|Ret  KERNEL.90: LSTRLEN() retval=0x0004 ret=01e7:2ce7 ds=0227
                                   ^^^^^^
-				  |Returnvalue is 16 bit and has the value 7.
+				  |Returnvalue is 16 bit and has the value 4.
 
 
  3. If you have found a misbehaving function, try to find out why it
@@ -119,18 +120,28 @@
   "continue". With "-debugmsg +all" Wine will now stop directly directly
   before setting up the Messagebox.  Proceed as explained above.
 
+  You can also run wine using "wine -debugmsg +relay program.exe 2>&1|less -i"
+  and in less search for messagebox.
 
 Disassembling programs:
 =======================
   You may also try to disassemble the offending program to check for 
   undocumented features and/or use of them.
-  The best, freely available, disassembler for win16 programs is
+
+  The best, freely available, disassembler for Win16 programs is
   Windows Codeback, archivename wcbxxx.zip, which usually can be found
   in the Cica-Mirror subdirectory on the WINE ftpsites. (See ANNOUNCE).
-  Disassembling win32 programs is currenty only possible using 
-  Windows Disassembler 32, archivename something like wdasm32x.zip on
-  ftp.winsite.com and mirrors.
+  Disassembling win32 programs is possible using the Windows Disassembler 32,
+  archivename something like w32dasm.zip on ftp.winsite.com and mirrors.
+  The shareware version does not allow saving of disassembly listings.
+
+  [It also has a bug, it disassembles the dll and immediately after that
+   crashes, leaving a very large file caled 'winsys' in the directory of the
+   disassembled file. This file contains nothing of value (just the disassembly)
+   and can be safely deleted.]
+
   Understanding disassembled code is just a question of exercise.
+
   Most code out there uses standard C function entries (for it is usually 
   written in C). Win16 function entries usually look like that:
 |  	push bp
@@ -157,7 +168,6 @@
 |	call KERNEL.LSTRLEN
   Here first the selector and then the offset to the passed string are pushed.
 
-
 Sample debugging session:
 =========================
 
@@ -171,88 +181,78 @@
 
 
 |marcus@jet $ wine winword.exe -debugmsg +relay -debug
-|CallTo32(func=08007e00,000001c4,00000081,00000000,00000000)
-|CallTo32(func=08007e00,000001c4,00000014,000006d0,00000000)
-|Win16 task 'winword': Breakpoint 1 at 0x0157:0x001a
-|CallTo16(func=0097:0130,ds=0000)
-|Call WPROCS.24: TASK_RESCHEDULE() ret=003f:0759 ds=0000
-|Ret  WPROCS.24: TASK_RESCHEDULE() retval=0x0000 ret=003f:0759 ds=08a7
-|CallTo16(func=0157:001a,ds=08a7,0x11d7,0x0000,0x0000,0x3cb4,0x1f40,0x0000,0x0000,0x08a7)
-|Loading symbols from ELF file /home/marcus/wine/wine...
-|...more Loading symbols ... 
-|Stopped on breakpoint 1 at 0x0157:0x001a (WPROCS_VXD_PAGEFILE+0xffffeeea)
+|CallTo32(wndproc=0x40065bc0,hwnd=000001ac,msg=00000081,wp=00000000,lp=00000000)
+|Win16 task 'winword': Breakpoint 1 at 0x01d7:0x001a
+|CallTo16(func=0127:0070,ds=0927)
+|Call WPROCS.24: TASK_RESCHEDULE() ret=00b7:1456 ds=0927
+|Ret  WPROCS.24: TASK_RESCHEDULE() retval=0x8672 ret=00b7:1456 ds=0927
+|CallTo16(func=01d7:001a,ds=0927)
+|     AX=0000 BX=3cb4 CX=1f40 DX=0000 SI=0000 DI=0927 BP=0000 ES=11f7
+|Loading symbols: /home/marcus/wine/wine...
+|Stopped on breakpoint 1 at 0x01d7:0x001a
 |In 16 bit mode.
 |Wine-dbg>break MessageBox32A                          <---- Set Breakpoint
-|Breakpoint 2 at 0x080e792c (MessageBox32A [msgbox.c:198])
+|Breakpoint 2 at 0x40189100 (MessageBox32A [msgbox.c:190])
 |Wine-dbg>c                                            <---- Continue
 |Call KERNEL.91: INITTASK() ret=0157:0022 ds=08a7
 |     AX=0000 BX=3cb4 CX=1f40 DX=0000 SI=0000 DI=08a7 ES=11d7 EFL=00000286
 |CallTo16(func=090f:085c,ds=0dcf,0x0000,0x0000,0x0000,0x0000,0x0800,0x0000,0x0000,0x0dcf)
 |...                                                   <----- Much debugoutput
-|Call KERNEL.97: GETTEMPFILENAME(0x00c3,08a7:8350,0x0000,08a7:8234) ret=058f:09b1 ds=08a7
-                                 ^      ^         ^      ^
-				 |      |         |      |LPSTR buffer
-				 |      |         |UINT16 unique
-				 |      |LPCSTR prefix
-				 |BYTE drive
+|Call KERNEL.136: GETDRIVETYPE(0x0000) ret=060f:097b ds=0927
+                               ^^^^^^ Drive 0 (A:)
+|Ret  KERNEL.136: GETDRIVETYPE() retval=0x0002 ret=060f:097b ds=0927
+                                        ^^^^^^  DRIVE_REMOVEABLE
+						(It is a floppy diskdrive.)
 
-|Ret  KERNEL.97: GETTEMPFILENAME() retval=0xce3f ret=058f:09b1 ds=08a7
-                                          ^
-                                          |new unique number
+|Call KERNEL.136: GETDRIVETYPE(0x0001) ret=060f:097b ds=0927
+                               ^^^^^^ Drive 1 (B:)
+|Ret  KERNEL.136: GETDRIVETYPE() retval=0x0000 ret=060f:097b ds=0927
+                                        ^^^^^^  DRIVE_CANNOTDETERMINE
+						(I don't have drive B: assigned)
 
-|Call KERNEL.74: OPENFILE(08a7:8234,08a7:82c6,0x1012) ret=058f:09d8 ds=08a7
-                          ^         ^         ^
-                          |         |         |UINT32 mode
-                          |         |OFSTRUCT *ofs
-                          |LPCSTR name
+|Call KERNEL.136: GETDRIVETYPE(0x0002) ret=060f:097b ds=0927
+                               ^^^^^^^ Drive 2 (C:)
+|Ret  KERNEL.136: GETDRIVETYPE() retval=0x0003 ret=060f:097b ds=0927
+                                        ^^^^^^ DRIVE_FIXED
+                                               (specified as a harddisk)
 
-|Ret  KERNEL.74: OPENFILE() retval=0xffff ret=058f:09d8 ds=08a7
-                                   ^
-				   | -1 aka. HFILE_ERROR
+|Call KERNEL.97: GETTEMPFILENAME(0x00c3,0x09278364"doc",0x0000,0927:8248) ret=060f:09b1 ds=0927
+                                 ^^^^^^           ^^^^^        ^^^^^^^^^
+                                 |                |            |buffer for fname
+                                 |                |temporary name ~docXXXX.tmp
+                                 |Force use of Drive C:.
 
-|Call USER.1: MESSAGEBOX(0x0000,08ef:8362,0000:0000,0x1030) ret=05d7:084f ds=08efStopped on breakpoint 2 at 0x080e792c (MessageBox32A [msgbox.c:198])
-|198     {
-|In 32 bit mode.
-|Wine-dbg> _
-
-    Now, we see that OPENFILE seem to have returned 0xFFFF (or -1). Checking
-    the implementation of OpenFile in files/file.c, this signals an error.
-    The mode flags (OF_READWRITE|OF_SHARE_EXCLUSIVE|OF_CREATE) seems to
-    indicate, that WinWord wants to open the file for writing, so we check
-    the filename. Since we don't see the filename in this debugoutput, we use
-    the dprintf_file() in OpenFile to print out more information by adding
-    "-debugmsg +relay" to the commandline.
-
-    (In fact, we see that the filename has been returned by the GetTempFileName
-     function above, but we check it anyway.)
-
-|marcus@jet $ wine winword.exe -debugmsg +relay,+file -debug
-|.....much more debugoutput .....
-|
-
-|Call KERNEL.97: GETTEMPFILENAME(0x00c3,08ef:8350,0x0000,08ef:8234) ret=05d7:09b1 ds=08ef
-|FILE_Create: 'C:\~doc8b93.tmp' 01b6 1
-|FILE_SetDosError: errno = 13
-
-|Warning: GetTempFileName returns 'C:\~doc8b93.tmp', which doesn't seem to be writeable.
+|Warning: GetTempFileName returns 'C:~doc9281.tmp', which doesn't seem to be writeable.
 |Please check your configuration file if this generates a failure.
- ^ Warning message
 
-|GetTempFileName: returning C:\~doc8b93.tmp
-|Ret  KERNEL.97: GETTEMPFILENAME() retval=0x8b93 ret=05d7:09b1 ds=08ef
-|Call KERNEL.74: OPENFILE(08ef:8234,08ef:82c6,0x1012) ret=05d7:09d8 ds=08ef
-|OpenFile: C:\~doc8b93.tmp 1012
-|FILE_Create: 'C:\~doc8b93.tmp' 01b6 0
-|FILE_SetDosError: errno = 13
-|OpenFile(C:\~doc8b93.tmp): return = HFILE_ERROR
-|Ret  KERNEL.74: OPENFILE() retval=0xffff ret=05d7:09d8 ds=08ef
+Whoops, it even detects that something is wrong!
 
+|Ret  KERNEL.97: GETTEMPFILENAME() retval=0x9281 ret=060f:09b1 ds=0927
+                                          ^^^^^^ Temporary storage ID
 
-    The filename is "C:\~docd03d.tmp". Of course, C:\ is writeable for the
-    superuser only, so the open fails for a normal user and OpenFile returns
-    -1, which in turn generates this messagebox. (As said by the warning
-    message.)
+|Call KERNEL.74: OPENFILE(0x09278248"C:~doc9281.tmp",0927:82da,0x1012) ret=060f:09d8 ds=0927
+                                    ^^^^^^^^^^^^^^^^ ^^^^^^^^^ ^^^^^^^
+                                    |filename        |OFSTRUCT |open mode:
 
+                                       OF_CREATE|OF_SHARE_EXCLUSIVE|OF_READWRITE
+
+This fails, since my C: drive is in this case mounted readonly.
+
+|Ret  KERNEL.74: OPENFILE() retval=0xffff ret=060f:09d8 ds=0927
+                                   ^^^^^^ HFILE_ERROR16, yes, it failed.
+
+|Call USER.1: MESSAGEBOX(0x0000,0x09278376"Sie müssen Windows verlassen und SHARE.EXE laden bevor Sie Word starten.",0x00000000,0x1030) ret=060f:084f ds=0927
+           
+And MessageBox'ed.
+
+|Stopped on breakpoint 2 at 0x40189100 (MessageBox32A [msgbox.c:190])
+|190     {		<- the sourceline
+In 32 bit mode.
+Wine-dbg>
+
+	The code seems to find a writeable harddisk and tries to create a file
+	there. To work around this bug, you can define C: as a networkdrive,
+	which is ignored by the code above.
 
 Written by Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>,
 additions welcome.
diff --git a/documentation/wine.texinfo b/documentation/wine.texinfo
index 02f88a6..1425f84 100644
--- a/documentation/wine.texinfo
+++ b/documentation/wine.texinfo
@@ -23,7 +23,7 @@
 This file documents Wine, the Windows Emulator.
 
 @c 
-Copyright @copyright{} 1997 The Wine authors. @*
+Copyright @copyright{} 1997,1998 The Wine authors. @*
 @xref{Authors, The Wine Authors, The Wine Authors},
 for a list of the copyright holders.
 
@@ -44,8 +44,8 @@
 the section entitled ``License, Warranty, and Authors of Wine''.
 
 @sp 4
-FIXME: UNIX and POSIX trademarks. @*
-X11 @*
+FIXME: X11 and POSIX trademarks. @*
+UNIX is a registered trademark of the Open Group.
 Microsoft, Windows, MS-Windows, Windows-NT, Windows 95, and MS-DOS are
 registered trademarks of Microsoft Corporation.
 NT is a trademark of Northern Telecom Limited.
@@ -59,17 +59,16 @@
 @setchapternewpage odd
 
 @titlepage
-@sp 10
 
-@center @titlefont{The Wine Reference Manual}
-@center Edition 0.0.3, 14 August 1997
+@title{The Wine Reference Manual}
+@subtitle{Edition 0.0.5, February 1998}
 
-
+@author{The Wine Team}
 @c The following two commands start the copyright page.
 @page
 @vskip 0pt plus 1filll
 
-Copyright @copyright{} 1997 The Wine authors. @*
+Copyright @copyright{} 1997, 1998 The Wine authors. @*
 @xref{Authors, The Wine Authors, The Wine Authors},
 for a list of the copyright holders.
 
@@ -101,12 +100,12 @@
 
 @c Edit this macro manually in the above parts of the document
 @macro winemanualversion
-0.0.3
+0.0.4
 @end macro
 
 @c Edit this macro manually in the above parts of the document
 @macro winemanualdate
-14 August 1997
+February 1998
 @end macro
 
 @c Edit this macro manually into the TeX titlepage
@@ -122,12 +121,12 @@
 @c MICROSOFT
 @c
 
-@c FIXME: automatical trademark reference
+@c FIXME: automatic trademark reference
 @macro mswindows
 MS-Windows
 @end macro
 
-@c FIXME: automatical trademark reference
+@c FIXME: automatic trademark reference
 @c spell it always the same
 @macro WIN32
 WIN32
@@ -136,17 +135,17 @@
 WIN16
 @end macro
 
-@c FIXME: automatical trademark reference
+@c FIXME: automatic trademark reference
 @macro WINNT
 Windows NT
 @end macro
 
-@c FIXME: automatical trademark reference
+@c FIXME: automatic trademark reference
 @macro WINNT40
 Windows NT 4.0
 @end macro
 
-@c FIXME: automatical trademark reference
+@c FIXME: automatic trademark reference
 @macro WIN95
 Windows 95
 @end macro
@@ -155,12 +154,12 @@
 @c
 @c THE OTHERS
 @c
-@c FIXME: automatical trademark reference
+@c FIXME: automatic trademark reference
 @macro unix
 UNIX
 @end macro
 
-@c FIXME: automatical trademark reference
+@c FIXME: automatic trademark reference
 @macro posix
 POSIX
 @end macro
@@ -1203,7 +1202,14 @@
 @section Applying patches
 @xref{Creating patches}, for instructions on creating patches.
 
-FIXME: write patch instructions
+@kbd{cd} to the top source directory for Wine, and run 
+@code{patch -p1 < @var{patchfile}}.
+What needs to be done next depends to some extent on what the
+patch touches. For small patches which only alter C source, it can be
+enough to rerun @code{make}. In general, the sequence @code{configure},
+@code{make depend}, @code{make} is sufficient, unless the patch alters
+@code{[config.in]}, in which case you must regenerate @code{configure}
+via @code{make configure} (which just runs @code{autoconf}).
 
 
 @node The Wine Project, , Installation, Top
@@ -1842,7 +1848,7 @@
 emulator, they won't.
 
 You therefore have to access all functions and data types by their full
-names, with the proper suffix explicitely appended. In Wine, the 16 bit
+names, with the proper suffix explicitly appended. In Wine, the 16 bit
 and 32 bit versions of the functions are distinct entities, which might
 (theoretically) show a completely different behaviour. They may even
 call each other (and they will quite frequently).
@@ -1858,7 +1864,20 @@
 @section Creating patches
 @xref{Applying patches}, for instructions on applying patches.
 
-FIXME: how to create patches
+Patches are created with the program @code{diff}. You need a copy
+of clean source tree to diff against. The @samp{-u} option, to create 
+unified diffs, is popular but not obligatory.
+For changes to a single file,
+@code{diff -u wine990101/windows/win.c mywine/windows/win.c > win_patch}
+is sufficient.
+To generate a complete diff between your tree and the distribution,
+use @code{diff -uR wine990101 mywine}.
+
+This assumes that the original distribution and your personal tree
+have the same parent directory, from which you make the diff.
+This ensures a consistent format for the diffs, which in turn
+is necessary so that they can be applied consistently as described in
+@xref{Applying patches}.
 
 @node Adding Documentation, File names, Creating patches, The Wine Project
 @section Adding Documentation
diff --git a/files/directory.c b/files/directory.c
index f740f3e..dafec96 100644
--- a/files/directory.c
+++ b/files/directory.c
@@ -18,7 +18,6 @@
 #include "heap.h"
 #include "msdos.h"
 #include "options.h"
-#include "stddebug.h"
 #include "debug.h"
 
 #define MAX_PATH_ELEMENTS 20
@@ -97,10 +96,10 @@
         DIR_PathElements++;
     }
 
-    if (debugging_dosfs)
+    if (debugging_info(dosfs))
         for (i = 0; i < DIR_PathElements; i++)
         {
-            dprintf_dosfs( stddeb, "Path[%d]: %s = %s\n",
+            dprintf_info(dosfs, "Path[%d]: %s = %s\n",
                            i, DIR_DosPath[i], DIR_UnixPath[i] );
         }
 }
@@ -156,9 +155,9 @@
                              path, sizeof(path) );
     DIR_ParseWindowsPath( path );
 
-    dprintf_dosfs( stddeb, "WindowsDir = %s\nSystemDir  = %s\n",
+    dprintf_info(dosfs, "WindowsDir = %s\nSystemDir  = %s\n",
                    DIR_WindowsDosDir, DIR_SystemDosDir );
-    dprintf_dosfs( stddeb, "TempDir    = %s\nCwd        = %c:\\%s\n",
+    dprintf_info(dosfs, "TempDir    = %s\nCwd        = %c:\\%s\n",
                    DIR_TempDosDir, 'A' + drive, DRIVE_GetDosCwd( drive ) );
 
     /* Put the temp and Windows and system directories into the environment */
@@ -328,7 +327,7 @@
  */
 BOOL16 WINAPI CreateDirectory16( LPCSTR path, LPVOID dummy )
 {
-    dprintf_file( stddeb,"CreateDirectory16(%s,%p)\n", path, dummy );
+    dprintf_info(file,"CreateDirectory16(%s,%p)\n", path, dummy );
     return (BOOL16)CreateDirectory32A( path, NULL );
 }
 
@@ -340,12 +339,11 @@
                                   LPSECURITY_ATTRIBUTES lpsecattribs )
 {
     DOS_FULL_NAME full_name;
-    LPCSTR unixName;
 
-    dprintf_file( stddeb, "CreateDirectory32A(%s,%p)\n", path, lpsecattribs );
-    if ((unixName = DOSFS_IsDevice( path )) != NULL)
+    dprintf_info(file, "CreateDirectory32A(%s,%p)\n", path, lpsecattribs );
+    if (DOSFS_IsDevice( path ))
     {
-        dprintf_file(stddeb, "CreateDirectory: device '%s'!\n", unixName);
+        dprintf_info(file, "CreateDirectory: cannot use device '%s'!\n",path);
         DOS_ERROR( ER_AccessDenied, EC_AccessDenied, SA_Abort, EL_Disk );
         return FALSE;
     }
@@ -407,13 +405,12 @@
 BOOL32 WINAPI RemoveDirectory32A( LPCSTR path )
 {
     DOS_FULL_NAME full_name;
-    LPCSTR unixName;
 
-    dprintf_file(stddeb, "RemoveDirectory: '%s'\n", path );
+    dprintf_info(file, "RemoveDirectory: '%s'\n", path );
 
-    if ((unixName = DOSFS_IsDevice( path )) != NULL)
+    if (DOSFS_IsDevice( path ))
     {
-        dprintf_file(stddeb, "RemoveDirectory: device '%s'!\n", unixName);
+        dprintf_info(file, "RemoveDirectory: cannot remove device '%s'!\n", path);
         DOS_ERROR( ER_FileNotFound, EC_NotFound, SA_Abort, EL_Disk );
         return FALSE;
     }
diff --git a/files/dos_fs.c b/files/dos_fs.c
index 5cd8e76..416c5c0 100644
--- a/files/dos_fs.c
+++ b/files/dos_fs.c
@@ -27,7 +27,6 @@
 #include "file.h"
 #include "heap.h"
 #include "msdos.h"
-#include "stddebug.h"
 #include "debug.h"
 
 /* Define the VFAT ioctl to get both short and long file names */
@@ -50,20 +49,8 @@
 /* Chars we don't want to see in DOS file names */
 #define INVALID_DOS_CHARS  "*?<>|\"+=,;[] \345"
 
-static const char *DOSFS_Devices[][2] =
-{
-    { "CON",  "" },
-    { "PRN",  "" },
-    { "NUL",  "/dev/null" },
-    { "AUX",  "" },
-    { "LPT1", "" },
-    { "LPT2", "" },
-    { "LPT3", "" },
-    { "LPT4", "" },
-    { "COM1", "" },
-    { "COM2", "" },
-    { "COM3", "" },
-    { "COM4", "" }
+static const char *DOSFS_Devices[] = {
+"CON","PRN","NUL","AUX","LPT1","LPT2","LPT3","LPT4","COM1","COM2","COM3","COM4",
 };
 
 
@@ -513,13 +500,13 @@
     if ((p = strchr( name, '\\' ))) len = MIN( (int)(p - name), len );
     if (long_len < len + 1) return FALSE;
 
-    dprintf_dosfs( stddeb, "DOSFS_FindUnixName: %s,%s\n", path, name );
+    dprintf_info(dosfs, "DOSFS_FindUnixName: %s,%s\n", path, name );
 
     if (!DOSFS_ToDosFCBFormat( name, dos_name )) dos_name[0] = '\0';
 
     if (!(dir = DOSFS_OpenDir( path )))
     {
-        dprintf_dosfs( stddeb, "DOSFS_FindUnixName(%s,%s): can't open dir: %s\n",
+        dprintf_warn(dosfs, "DOSFS_FindUnixName(%s,%s): can't open dir: %s\n",
                        path, name, strerror(errno) );
         return FALSE;
     }
@@ -559,12 +546,11 @@
             else
                 DOSFS_Hash( long_name, short_buf, FALSE, ignore_case );
         }
-        dprintf_dosfs( stddeb, "DOSFS_FindUnixName(%s,%s) -> %s (%s)\n",
-                       path, name, long_name, short_buf ? short_buf : "***");
+        dprintf_info(dosfs, "(%s,%s) -> %s (%s)\n",
+		     path, name, long_name, short_buf ? short_buf : "***");
     }
     else
-        dprintf_dosfs(stddeb,"DOSFS_FindUnixName(%s,%s) -> ** Not found **\n",
-                      path, name );
+        dprintf_warn(dosfs, "file: '%s' NOT FOUND in dir: '%s'\n", name, path);
     DOSFS_CloseDir( dir );
     return ret;
 }
@@ -573,10 +559,34 @@
 /***********************************************************************
  *           DOSFS_IsDevice
  *
- * Check if a DOS file name represents a DOS device. Returns the name
- * of the associated Unix device, or NULL if not found.
+ * Check if a DOS file name represents a DOS device.
  */
-const char *DOSFS_IsDevice( const char *name )
+BOOL32 DOSFS_IsDevice( const char *name )
+{
+    int	i;
+    const char *p;
+
+    if (name[0] && (name[1] == ':')) name += 2;
+    if ((p = strrchr( name, '/' ))) name = p + 1;
+    if ((p = strrchr( name, '\\' ))) name = p + 1;
+    for (i = 0; i < sizeof(DOSFS_Devices)/sizeof(DOSFS_Devices[0]); i++)
+    {
+        const char *dev = DOSFS_Devices[i];
+        if (!lstrncmpi32A( dev, name, strlen(dev) ))
+        {
+            p = name + strlen( dev );
+            if (!*p || (*p == '.')) return TRUE;
+        }
+    }
+    return FALSE;
+}
+
+/***********************************************************************
+ *           DOSFS_OpenDevice
+ *
+ * Open a DOS device. This might not map 1:1 into the UNIX device concept.
+ */
+HFILE32 DOSFS_OpenDevice( const char *name, int unixmode )
 {
     int i;
     const char *p;
@@ -586,16 +596,37 @@
     if ((p = strrchr( name, '\\' ))) name = p + 1;
     for (i = 0; i < sizeof(DOSFS_Devices)/sizeof(DOSFS_Devices[0]); i++)
     {
-        const char *dev = DOSFS_Devices[i][0];
+        const char *dev = DOSFS_Devices[i];
         if (!lstrncmpi32A( dev, name, strlen(dev) ))
         {
             p = name + strlen( dev );
-            if (!*p || (*p == '.')) return DOSFS_Devices[i][1];
+            if (!*p || (*p == '.')) {
+	    	/* got it */
+		if (!strcmp(DOSFS_Devices[i],"NUL"))
+			return FILE_OpenUnixFile("/dev/null",unixmode);
+		if (!strcmp(DOSFS_Devices[i],"CON")) {
+			switch (unixmode) {
+			case O_RDONLY:
+				return GetStdHandle( STD_INPUT_HANDLE );
+				break;
+			case O_WRONLY:
+				return GetStdHandle( STD_OUTPUT_HANDLE );
+				break;
+			default:
+				fprintf(stderr,"DOSFS_OpenDevice: CON cannot be opened read/write currently, FIXME.\n");
+				return HFILE_ERROR32;
+				break;
+			}
+		}
+		/* FIXME: the rest of the devices ... lptX, comX et.al. */
+    		return HFILE_ERROR32;
+	    }
         }
     }
-    return NULL;
+    return HFILE_ERROR32;
 }
 
+
 /***********************************************************************
  *           DOSFS_GetPathDrive
  *
@@ -648,7 +679,7 @@
     UINT32 flags;
     char *p_l, *p_s, *root;
 
-    dprintf_dosfs( stddeb, "DOSFS_GetFullName: %s (last=%d)\n",
+    dprintf_info(dosfs, "DOSFS_GetFullName: %s (last=%d)\n",
                    name, check_last );
 
     if ((full->drive = DOSFS_GetPathDrive( &name )) == -1) return FALSE;
@@ -756,7 +787,7 @@
     }
     if (!full->long_name[0]) strcpy( full->long_name, "/" );
     if (!full->short_name[2]) strcpy( full->short_name + 2, "\\" );
-    dprintf_dosfs( stddeb, "DOSFS_GetFullName: returning %s = %s\n",
+    dprintf_info(dosfs, "DOSFS_GetFullName: returning %s = %s\n",
                    full->long_name, full->short_name );
     return TRUE;
 }
@@ -846,7 +877,7 @@
     int drive;
     char *p;
 
-    dprintf_dosfs( stddeb, "GetFullPathName: converting %s\n", name );
+    dprintf_info(dosfs, "GetFullPathName: converting %s\n", name );
 
     if (!name || !result) return 0;
 
@@ -910,7 +941,7 @@
     if (unicode) lstrcpynAtoW( (LPWSTR)result, buffer, len );
     else lstrcpyn32A( result, buffer, len );
 
-    dprintf_dosfs( stddeb, "GetFullPathName: returning %s\n", buffer );
+    dprintf_info(dosfs, "GetFullPathName: returning %s\n", buffer );
     return strlen(buffer);
 }
 
@@ -995,7 +1026,7 @@
     else  /* Not in the cache, open it anew */
     {
         const char *drive_path;
-        dprintf_dosfs( stddeb, "DOSFS_FindNext: cache miss, path=%s skip=%d buf=%s cur=%d\n",
+        dprintf_info(dosfs, "DOSFS_FindNext: cache miss, path=%s skip=%d buf=%s cur=%d\n",
                        path, skip, buffer, cur_pos );
         cur_pos = skip;
         if (dir) DOSFS_CloseDir(dir);
@@ -1004,7 +1035,7 @@
         drive_path = path + strlen(DRIVE_GetRoot(drive));
         while ((*drive_path == '/') || (*drive_path == '\\')) drive_path++;
         drive_root = !*drive_path;
-        dprintf_dosfs(stddeb, "DOSFS_FindNext: drive_root = %d\n", drive_root);
+        dprintf_info(dosfs, "DOSFS_FindNext: drive_root = %d\n", drive_root);
         lstrcpyn32A( buffer, path, sizeof(buffer) - 1 );
     }
     strcat( buffer, "/" );
@@ -1070,7 +1101,7 @@
 
         lstrcpyn32A( entry->cFileName, long_name, sizeof(entry->cFileName) );
         if (!(flags & DRIVE_CASE_PRESERVING)) CharLower32A( entry->cFileName );
-        dprintf_dosfs( stddeb, "DOSFS_FindNext: returning %s (%s) %02lx %ld\n",
+        dprintf_info(dosfs, "DOSFS_FindNext: returning %s (%s) %02lx %ld\n",
                        entry->cFileName, entry->cAlternateFileName,
                        entry->dwFileAttributes, entry->nFileSizeLow );
         cur_pos += count;
@@ -1537,7 +1568,7 @@
     time_t xtime = DOSFS_FileTimeToUnixTime( ft, &remainder );
     xtm = gmtime(&xtime);
     syst->wYear         = xtm->tm_year;
-    syst->wMonth        = xtm->tm_mon;
+    syst->wMonth        = xtm->tm_mon + 1;
     syst->wDayOfWeek    = xtm->tm_wday;
     syst->wDay	        = xtm->tm_mday;
     syst->wHour	        = xtm->tm_hour;
@@ -1557,7 +1588,7 @@
     LPSTR s;
     char  buffer[200];
 
-    dprintf_dosfs(stddeb,"QueryDosDevice(%s,...)\n",devname?devname:"<null>");
+    dprintf_info(dosfs,"QueryDosDevice(%s,...)\n",devname?devname:"<null>");
     if (!devname) {
 	/* return known MSDOS devices */
 	lstrcpy32A(buffer,"CON COM1 COM2 LPT1 NUL ");
@@ -1601,7 +1632,7 @@
     struct tm xtm;
 
     xtm.tm_year	= syst->wYear;
-    xtm.tm_mon	= syst->wMonth;
+    xtm.tm_mon	= syst->wMonth - 1;
     xtm.tm_wday	= syst->wDayOfWeek;
     xtm.tm_mday	= syst->wDay;
     xtm.tm_hour	= syst->wHour;
diff --git a/files/drive.c b/files/drive.c
index cdb7d9c..35266cd 100644
--- a/files/drive.c
+++ b/files/drive.c
@@ -33,7 +33,6 @@
 #include "msdos.h"
 #include "options.h"
 #include "task.h"
-#include "stddebug.h"
 #include "debug.h"
 
 typedef struct
@@ -194,12 +193,12 @@
                 DRIVE_CurDrive = i;
 
             count++;
-            dprintf_dosfs( stddeb, "%s: path=%s type=%s label='%s' serial=%08lx flags=%08x dev=%x ino=%x\n",
+            dprintf_info(dosfs, "%s: path=%s type=%s label='%s' serial=%08lx flags=%08x dev=%x ino=%x\n",
                            name, path, DRIVE_Types[drive->type],
                            drive->label, drive->serial, drive->flags,
                            (int)drive->dev, (int)drive->ino );
         }
-        else dprintf_dosfs( stddeb, "%s: not defined\n", name );
+        else dprintf_warn(dosfs, "%s: not defined\n", name );
     }
 
     if (!count) 
@@ -266,7 +265,7 @@
         DOS_ERROR( ER_InvalidDrive, EC_MediaError, SA_Abort, EL_Disk );
         return 0;
     }
-    dprintf_dosfs( stddeb, "DRIVE_SetCurrentDrive: %c:\n", 'A' + drive );
+    dprintf_info(dosfs, "DRIVE_SetCurrentDrive: %c:\n", 'A' + drive );
     DRIVE_CurDrive = drive;
     if (pTask) pTask->curdrive = drive | 0x80;
     return 1;
@@ -326,7 +325,7 @@
     *next = 0;
 
     if (rootdrive != -1)
-        dprintf_dosfs( stddeb, "DRIVE_FindDriveRoot: %s -> drive %c:, root='%s', name='%s'\n",
+        dprintf_info(dosfs, "DRIVE_FindDriveRoot: %s -> drive %c:, root='%s', name='%s'\n",
                        buffer, 'A' + rootdrive,
                        DOSDrives[rootdrive].root, *path );
     return rootdrive;
@@ -447,7 +446,7 @@
     BY_HANDLE_FILE_INFORMATION info;
     TDB *pTask = (TDB *)GlobalLock16( GetCurrentTask() );
 
-    dprintf_dosfs( stddeb, "DRIVE_Chdir(%c:,%s)\n", 'A' + drive, path );
+    dprintf_info(dosfs, "DRIVE_Chdir(%c:,%s)\n", 'A' + drive, path );
     strcpy( buffer, "A:" );
     buffer[0] += drive;
     lstrcpyn32A( buffer + 2, path, sizeof(buffer) - 2 );
@@ -462,7 +461,7 @@
     unix_cwd = full_name.long_name + strlen( DOSDrives[drive].root );
     while (*unix_cwd == '/') unix_cwd++;
 
-    dprintf_dosfs( stddeb, "DRIVE_Chdir(%c:): unix_cwd=%s dos_cwd=%s\n",
+    dprintf_info(dosfs, "DRIVE_Chdir(%c:): unix_cwd=%s dos_cwd=%s\n",
                    'A' + drive, unix_cwd, full_name.short_name + 3 );
 
     HeapFree( SystemHeap, 0, DOSDrives[drive].dos_cwd );
@@ -535,7 +534,7 @@
 
     if ( new->root )
     {
-        dprintf_dosfs ( stddeb, "Can\'t map drive %c to drive %c - "
+        dprintf_info(dosfs, "Can\'t map drive %c to drive %c - "
 	                        "drive %c already exists\n",
 			'A' + existing_drive, 'A' + new_drive,
 			'A' + new_drive );
@@ -552,7 +551,7 @@
     new->dev = old->dev;
     new->ino = old->ino;
 
-    dprintf_dosfs ( stddeb, "Drive %c is now equal to drive %c\n",
+    dprintf_info(dosfs, "Drive %c is now equal to drive %c\n",
                     'A' + new_drive, 'A' + existing_drive );
 
     return 1;
@@ -566,7 +565,7 @@
  */
 int DRIVE_OpenDevice( int drive, int flags )
 {
-    if (!DRIVE_IsValid( drive )) return NULL;
+    if (!DRIVE_IsValid( drive )) return -1;
     return open( DOSDrives[drive].device, flags );
 }
 
@@ -735,7 +734,7 @@
  */
 UINT16 WINAPI GetDriveType16( UINT16 drive )
 {
-    dprintf_dosfs( stddeb, "GetDriveType16(%c:)\n", 'A' + drive );
+    dprintf_info(dosfs, "GetDriveType16(%c:)\n", 'A' + drive );
     switch(DRIVE_GetType(drive))
     {
     case TYPE_FLOPPY:  return DRIVE_REMOVABLE;
@@ -753,7 +752,7 @@
  */
 UINT32 WINAPI GetDriveType32A( LPCSTR root )
 {
-    dprintf_dosfs( stddeb, "GetDriveType32A(%s)\n", root );
+    dprintf_info(dosfs, "GetDriveType32A(%s)\n", root );
     if ((root[1]) && (root[1] != ':'))
     {
         fprintf( stderr, "GetDriveType32A: invalid root '%s'\n", root );
diff --git a/files/file.c b/files/file.c
index 29f9abf..e1de218 100644
--- a/files/file.c
+++ b/files/file.c
@@ -31,13 +31,16 @@
 #include "ldt.h"
 #include "process.h"
 #include "task.h"
-#include "stddebug.h"
 #include "debug.h"
 
 #if defined(MAP_ANONYMOUS) && !defined(MAP_ANON)
 #define MAP_ANON MAP_ANONYMOUS
 #endif
 
+static BOOL32 FILE_Read(K32OBJ *ptr, LPVOID lpBuffer, DWORD nNumberOfChars,
+			LPDWORD lpNumberOfChars, LPOVERLAPPED lpOverlapped);
+static BOOL32 FILE_Write(K32OBJ *ptr, LPCVOID lpBuffer, DWORD nNumberOfChars,
+			 LPDWORD lpNumberOfChars, LPOVERLAPPED lpOverlapped);
 static void FILE_Destroy( K32OBJ *obj );
 
 const K32OBJ_OPS FILE_Ops =
@@ -47,6 +50,8 @@
     NULL,              /* satisfied */
     NULL,              /* add_wait */
     NULL,              /* remove_wait */
+    FILE_Read,	        /* read */
+    FILE_Write,        /* write */
     FILE_Destroy       /* destroy */
 };
 
@@ -92,6 +97,70 @@
 }
 
 
+/* FIXME: lpOverlapped is ignored */
+static BOOL32 FILE_Read(K32OBJ *ptr, LPVOID lpBuffer, DWORD nNumberOfChars,
+			LPDWORD lpNumberOfChars, LPOVERLAPPED lpOverlapped)
+{
+	FILE_OBJECT *file = (FILE_OBJECT *)ptr;
+	int result;
+
+	dprintf_info(file, "FILE_Read: %p %p %ld\n", ptr, lpBuffer,
+                     nNumberOfChars);
+
+	if (nNumberOfChars == 0) {
+		*lpNumberOfChars = 0;  /* FIXME: does this change */
+		return TRUE;
+	}
+
+	if ((result = read(file->unix_handle, lpBuffer, nNumberOfChars)) == -1)
+        {
+            FILE_SetDosError();
+            return FALSE;
+	}
+	*lpNumberOfChars = result;
+	return TRUE;
+}
+
+/**
+ *  experimentation yields that WriteFile:
+ *	o does not truncate on write of 0
+ *	o always changes the *lpNumberOfChars to actual number of
+ *	  characters written
+ *	o write of 0 nNumberOfChars returns TRUE
+ */
+static BOOL32 FILE_Write(K32OBJ *ptr, LPCVOID lpBuffer, DWORD nNumberOfChars,
+			 LPDWORD lpNumberOfChars, LPOVERLAPPED lpOverlapped)
+{
+	FILE_OBJECT *file = (FILE_OBJECT *)ptr;
+	int result;
+
+	dprintf_info(file, "FILE_Write: %p %p %ld\n", ptr, lpBuffer,
+		      nNumberOfChars);
+
+	*lpNumberOfChars = 0; 
+
+	/* FIXME: there was a loop here before that 
+	 * retried writes after EAGAIN, why??? -- I assume
+	 * it is because win32 doesn't have interrupted
+	 * system calls 
+	 */
+
+	for (;;)
+        {
+		result = write(file->unix_handle, lpBuffer, nNumberOfChars);
+		if (result != -1) {
+			*lpNumberOfChars = result;
+                        return TRUE;
+		}
+		if (errno != EINTR) {
+			FILE_SetDosError();
+			return FALSE;
+		}
+        }
+}
+
+
+
 /***********************************************************************
  *           FILE_Destroy
  *
@@ -160,8 +229,7 @@
 {
     int save_errno = errno; /* errno gets overwritten by printf */
 
-    dprintf_file(stddeb, "FILE_SetDosError: errno = %d %s\n", errno,
-		 strerror(errno) );
+    dprintf_info(file, "FILE_SetDosError: errno = %d %s\n", errno, strerror(errno));
     switch (save_errno)
     {
     case EAGAIN:
@@ -235,7 +303,7 @@
 /***********************************************************************
  *           FILE_OpenUnixFile
  */
-static HFILE32 FILE_OpenUnixFile( const char *name, int mode )
+HFILE32 FILE_OpenUnixFile( const char *name, int mode )
 {
     HFILE32 handle;
     FILE_OBJECT *file;
@@ -277,19 +345,24 @@
     DOS_FULL_NAME full_name;
     const char *unixName;
 
-    dprintf_file(stddeb, "FILE_Open: '%s' %04x\n", path, mode );
+    dprintf_info(file, "FILE_Open: '%s' %04x\n", path, mode );
 
     if (!path) return HFILE_ERROR32;
 
-    if ((unixName = DOSFS_IsDevice( path )) != NULL)
+    if (DOSFS_IsDevice( path ))
     {
-        dprintf_file( stddeb, "FILE_Open: opening device '%s'\n", unixName );
-        if (!unixName[0])  /* Non-existing device */
-        {
-            dprintf_file(stddeb, "FILE_Open: Non-existing device\n");
-            DOS_ERROR( ER_FileNotFound, EC_NotFound, SA_Abort, EL_Disk );
-            return HFILE_ERROR32;
-        }
+    	HFILE32	ret;
+
+        dprintf_info(file, "FILE_Open: opening device '%s'\n", path );
+
+	if (HFILE_ERROR32!=(ret=DOSFS_OpenDevice( path, mode )))
+		return ret;
+
+	/* Do not silence this please. It is a critical error. -MM */
+        fprintf(stderr, "FILE_Open: Couldn't open device '%s'!\n",path);
+        DOS_ERROR( ER_FileNotFound, EC_NotFound, SA_Abort, EL_Disk );
+        return HFILE_ERROR32;
+	
     }
     else /* check for filename, don't check for last entry if creating */
     {
@@ -308,16 +381,15 @@
 {
     HFILE32 handle;
     FILE_OBJECT *file;
-    const char *unixName;
     DOS_FULL_NAME full_name;
 
-    dprintf_file(stddeb, "FILE_Create: '%s' %04x %d\n", path, mode, unique );
+    dprintf_info(file, "FILE_Create: '%s' %04x %d\n", path, mode, unique );
 
     if (!path) return INVALID_HANDLE_VALUE32;
 
-    if ((unixName = DOSFS_IsDevice( path )) != NULL)
+    if (DOSFS_IsDevice( path ))
     {
-        dprintf_file(stddeb, "FILE_Create: creating device '%s'!\n", unixName);
+        fprintf(stderr, "FILE_Create: cannot create DOS device '%s'!\n", path);
         DOS_ERROR( ER_AccessDenied, EC_NotFound, SA_Abort, EL_Disk );
         return INVALID_HANDLE_VALUE32;
     }
@@ -510,11 +582,11 @@
     FILE_OBJECT *file;
     HFILE32 handle;
 
-    dprintf_file( stddeb, "FILE_Dup for handle %d\n", hFile );
+    dprintf_info(file, "FILE_Dup for handle %d\n", hFile );
     if (!(file = FILE_GetFile( hFile ))) return HFILE_ERROR32;
     handle = HANDLE_Alloc( &file->header, FILE_ALL_ACCESS /*FIXME*/, FALSE );
     FILE_ReleaseFile( file );
-    dprintf_file( stddeb, "FILE_Dup return handle %d\n", handle );
+    dprintf_info(file, "FILE_Dup return handle %d\n", handle );
     return handle;
 }
 
@@ -528,7 +600,7 @@
 {
     FILE_OBJECT *file;
 
-    dprintf_file( stddeb, "FILE_Dup2 for handle %d\n", hFile1 );
+    dprintf_info(file, "FILE_Dup2 for handle %d\n", hFile1 );
     /* FIXME: should use DuplicateHandle */
     if (!(file = FILE_GetFile( hFile1 ))) return HFILE_ERROR32;
     if (!HANDLE_SetObjPtr( hFile2, &file->header, 0 )) hFile2 = HFILE_ERROR32;
@@ -600,7 +672,7 @@
             HFILE32 handle = FILE_Create( buffer, 0666, TRUE );
             if (handle != INVALID_HANDLE_VALUE32)
             {  /* We created it */
-                dprintf_file( stddeb, "GetTempFileName32A: created %s\n",
+                dprintf_info(file, "GetTempFileName32A: created %s\n",
 			      buffer);
                 CloseHandle( handle );
                 break;
@@ -624,7 +696,7 @@
                      "Please check your configuration file if this generates a failure.\n",
                      buffer);
     }
-    dprintf_file( stddeb, "GetTempFileName32A: returning %s\n", buffer );
+    dprintf_info(file, "GetTempFileName32A: returning %s\n", buffer );
     return unique ? unique : num;
 }
 
@@ -678,7 +750,7 @@
 	return HFILE_ERROR32;
     }
 
-    dprintf_file( stddeb, "OpenFile: %s %04x\n", name, mode );
+    dprintf_info(file, "OpenFile: %s %04x\n", name, mode );
 
     /* the watcom 10.6 IDE relies on a valid path returned in ofs->szPathName
        Are there any cases where getting the path here is wrong? 
@@ -692,7 +764,7 @@
     {
         ofs->fFixedDisk = (GetDriveType16( ofs->szPathName[0]-'A' )
                            != DRIVE_REMOVABLE);
-        dprintf_file( stddeb, "OpenFile(%s): OF_PARSE, res = '%s'\n",
+        dprintf_info(file, "OpenFile(%s): OF_PARSE, res = '%s'\n",
                       name, ofs->szPathName );
         return 0;
     }
@@ -725,7 +797,7 @@
     if (!DIR_SearchPath( NULL, name, NULL, &full_name, win32 )) goto not_found;
 
 found:
-    dprintf_file( stddeb, "OpenFile: found %s = %s\n",
+    dprintf_info(file, "OpenFile: found %s = %s\n",
                   full_name.long_name, full_name.short_name );
     lstrcpyn32A( ofs->szPathName, full_name.short_name,
                  sizeof(ofs->szPathName) );
@@ -733,7 +805,7 @@
     if (mode & OF_DELETE)
     {
         if (unlink( full_name.long_name ) == -1) goto not_found;
-        dprintf_file( stddeb, "OpenFile(%s): OF_DELETE return = OK\n", name);
+        dprintf_info(file, "OpenFile(%s): OF_DELETE return = OK\n", name);
         return 1;
     }
 
@@ -757,7 +829,7 @@
         if (memcmp( ofs->reserved, filedatetime, sizeof(ofs->reserved) ))
         {
             CloseHandle( hFileRet );
-            dprintf_file( stddeb, "OpenFile(%s): OF_VERIFY failed\n", name );
+            dprintf_warn(file, "OpenFile(%s): OF_VERIFY failed\n", name );
             /* FIXME: what error here? */
             DOS_ERROR( ER_FileNotFound, EC_NotFound, SA_Abort, EL_Disk );
             goto error;
@@ -766,19 +838,19 @@
     memcpy( ofs->reserved, filedatetime, sizeof(ofs->reserved) );
 
 success:  /* We get here if the open was successful */
-    dprintf_file( stddeb, "OpenFile(%s): OK, return = %d\n", name, hFileRet );
+    dprintf_info(file, "OpenFile(%s): OK, return = %d\n", name, hFileRet );
     if (mode & OF_EXIST) /* Return the handle, but close it first */
         CloseHandle( hFileRet );
     return hFileRet;
 
 not_found:  /* We get here if the file does not exist */
-    dprintf_file( stddeb, "OpenFile: '%s' not found\n", name );
+    dprintf_warn(file, "OpenFile: '%s' not found\n", name );
     DOS_ERROR( ER_FileNotFound, EC_NotFound, SA_Abort, EL_Disk );
     /* fall through */
 
 error:  /* We get here if there was an error opening the file */
     ofs->nErrCode = DOS_ExtendedError;
-    dprintf_file( stddeb, "OpenFile(%s): return = HFILE_ERROR error= %d\n", 
+    dprintf_warn(file, "OpenFile(%s): return = HFILE_ERROR error= %d\n", 
 		  name,ofs->nErrCode );
     return HFILE_ERROR32;
 }
@@ -807,7 +879,7 @@
  */
 HFILE16 WINAPI _lclose16( HFILE16 hFile )
 {
-    dprintf_file( stddeb, "_lclose16: handle %d\n", hFile );
+    dprintf_info(file, "_lclose16: handle %d\n", hFile );
     return CloseHandle( hFile ) ? 0 : HFILE_ERROR16;
 }
 
@@ -817,7 +889,7 @@
  */
 HFILE32 WINAPI _lclose32( HFILE32 hFile )
 {
-    dprintf_file( stddeb, "_lclose32: handle %d\n", hFile );
+    dprintf_info(file, "_lclose32: handle %d\n", hFile );
     return CloseHandle( hFile ) ? 0 : HFILE_ERROR32;
 }
 
@@ -829,7 +901,7 @@
 {
     LONG maxlen;
 
-    dprintf_file( stddeb, "WIN16_hread: %d %08lx %ld\n",
+    dprintf_info(file, "WIN16_hread: %d %08lx %ld\n",
                   hFile, (DWORD)buffer, count );
 
     /* Some programs pass a count larger than the allocated buffer */
@@ -851,18 +923,19 @@
 /***********************************************************************
  *           _lread32   (KERNEL32.596)
  */
-UINT32 WINAPI _lread32( HFILE32 hFile, LPVOID buffer, UINT32 count )
+UINT32 WINAPI _lread32( HFILE32 handle, LPVOID buffer, UINT32 count )
 {
-    FILE_OBJECT *file;
-    UINT32 result;
+    K32OBJ *ptr;
+    DWORD numWritten;
+    BOOL32 result = FALSE;
 
-    dprintf_file( stddeb, "_lread32: %d %p %d\n", hFile, buffer, count );
-    if (!(file = FILE_GetFile( hFile ))) return -1;
-    if (!count) result = 0;
-    else if ((result = read( file->unix_handle, buffer, count )) == -1)
-        FILE_SetDosError();
-    FILE_ReleaseFile( file );
-    return result;
+    dprintf_info( file, "_lread32: %d %p %d\n", handle, buffer, count);
+    if (!(ptr = HANDLE_GetObjPtr( handle, K32OBJ_UNKNOWN, 0))) return -1;
+    if (K32OBJ_OPS(ptr)->read)
+        result = K32OBJ_OPS(ptr)->read(ptr, buffer, count, &numWritten, NULL);
+    K32OBJ_DecCount( ptr );
+    if (!result) return -1;
+    return (UINT32)numWritten;
 }
 
 
@@ -881,7 +954,7 @@
 HFILE16 WINAPI _lcreat16( LPCSTR path, INT16 attr )
 {
     int mode = (attr & 1) ? 0444 : 0666;
-    dprintf_file( stddeb, "_lcreat16: %s %02x\n", path, attr );
+    dprintf_info(file, "_lcreat16: %s %02x\n", path, attr );
     return (HFILE16)FILE_Create( path, mode, FALSE );
 }
 
@@ -892,7 +965,7 @@
 HFILE32 WINAPI _lcreat32( LPCSTR path, INT32 attr )
 {
     int mode = (attr & 1) ? 0444 : 0666;
-    dprintf_file( stddeb, "_lcreat32: %s %02x\n", path, attr );
+    dprintf_info(file, "_lcreat32: %s %02x\n", path, attr );
     return FILE_Create( path, mode, FALSE );
 }
 
@@ -903,7 +976,7 @@
 HFILE32 _lcreat_uniq( LPCSTR path, INT32 attr )
 {
     int mode = (attr & 1) ? 0444 : 0666;
-    dprintf_file( stddeb, "_lcreat_uniq: %s %02x\n", path, attr );
+    dprintf_info(file, "_lcreat_uniq: %s %02x\n", path, attr );
     return FILE_Create( path, mode, TRUE );
 }
 
@@ -923,7 +996,7 @@
         SetLastError( ERROR_INVALID_PARAMETER );
         return 0xffffffff;
     }
-    dprintf_file( stddeb, "SetFilePointer: handle %d offset %ld origin %ld\n",
+    dprintf_info(file, "SetFilePointer: handle %d offset %ld origin %ld\n",
                   hFile, distance, method );
 
     if (!(file = FILE_GetFile( hFile ))) return 0xffffffff;
@@ -975,7 +1048,7 @@
 {
     INT32 unixMode;
 
-    dprintf_file(stddeb, "_lopen32('%s',%04x)\n", path, mode );
+    dprintf_info(file, "_lopen32('%s',%04x)\n", path, mode );
 
     switch(mode & 3)
     {
@@ -1040,31 +1113,43 @@
 
 /***********************************************************************
  *           _hwrite32   (KERNEL32.591)
+ *
+ *	experimenation yields that _lwrite:
+ *		o truncates the file at the current position with 
+ *		  a 0 len write
+ *		o returns 0 on a 0 length write
+ *		o works with console handles
+ *		
  */
-LONG WINAPI _hwrite32( HFILE32 hFile, LPCSTR buffer, LONG count )
+LONG WINAPI _hwrite32( HFILE32 handle, LPCSTR buffer, LONG count )
 {
-    FILE_OBJECT *file;
-    LONG result;
+	K32OBJ *ioptr;
+	DWORD result;
+	BOOL32 status = FALSE;
+	
+	dprintf_info(file, "_hwrite32: %d %p %ld\n", handle, buffer, count );
 
-    dprintf_file( stddeb, "_hwrite32: %d %p %ld\n", hFile, buffer, count );
+	if (count == 0) {       /* Expand or truncate at current position */
+		FILE_OBJECT *file = FILE_GetFile(handle);
 
-    if (!(file = FILE_GetFile( hFile ))) return HFILE_ERROR32;
-    if (count == 0)  /* Expand or truncate at current position */
-        result = ftruncate( file->unix_handle,
-                            lseek( file->unix_handle, 0, SEEK_CUR ) );
-    else for (;;)
-    {
-        result = write( file->unix_handle, buffer, count );
-        if (result != -1) break;
-        if (errno != EINTR)
-        {
-            FILE_SetDosError();
-            break;
-        }
-    }
-
-    FILE_ReleaseFile( file );
-    return result;
+		if ( ftruncate(file->unix_handle,
+			       lseek( file->unix_handle, 0, SEEK_CUR)) == 0 ) {
+			FILE_ReleaseFile(file);
+			return 0;
+		} else {
+			FILE_SetDosError();
+			FILE_ReleaseFile(file);
+			return HFILE_ERROR32;
+		}
+	}
+	
+	if (!(ioptr = HANDLE_GetObjPtr( handle, K32OBJ_UNKNOWN, 0 )))
+            return HFILE_ERROR32;
+        if (K32OBJ_OPS(ioptr)->write)
+            status = K32OBJ_OPS(ioptr)->write(ioptr, buffer, count, &result, NULL);
+	K32OBJ_DecCount( ioptr );
+	if (!status) result = HFILE_ERROR32;
+	return result;
 }
 
 
@@ -1077,7 +1162,7 @@
     PDB *pdb = (PDB *)GlobalLock16( hPDB );
     BYTE *files = PTR_SEG_TO_LIN( pdb->fileHandlesPtr );
 
-    dprintf_file( stddeb, "SetHandleCount16(%d)\n", count );
+    dprintf_info(file, "SetHandleCount16(%d)\n", count );
 
     if (count < 20) count = 20;  /* No point in going below 20 */
     else if (count > 254) count = 254;
@@ -1137,7 +1222,7 @@
     FILE_OBJECT *file;
     BOOL32 ret;
 
-    dprintf_file( stddeb, "FlushFileBuffers(%d)\n", hFile );
+    dprintf_info(file, "FlushFileBuffers(%d)\n", hFile );
     if (!(file = FILE_GetFile( hFile ))) return FALSE;
     if (fsync( file->unix_handle ) != -1) ret = TRUE;
     else
@@ -1158,7 +1243,7 @@
     FILE_OBJECT *file;
     BOOL32 ret = TRUE;
 
-    dprintf_file( stddeb, "SetEndOfFile(%d)\n", hFile );
+    dprintf_info(file, "SetEndOfFile(%d)\n", hFile );
     if (!(file = FILE_GetFile( hFile ))) return FALSE;
     if (ftruncate( file->unix_handle,
                    lseek( file->unix_handle, 0, SEEK_CUR ) ))
@@ -1186,13 +1271,12 @@
 BOOL32 WINAPI DeleteFile32A( LPCSTR path )
 {
     DOS_FULL_NAME full_name;
-    const char *unixName;
 
-    dprintf_file(stddeb, "DeleteFile: '%s'\n", path );
+    dprintf_info(file, "DeleteFile: '%s'\n", path );
 
-    if ((unixName = DOSFS_IsDevice( path )) != NULL)
+    if (DOSFS_IsDevice( path ))
     {
-        dprintf_file(stddeb, "DeleteFile: removing device '%s'!\n", unixName);
+        fprintf(stderr, "DeleteFile: cannot remove DOS device '%s'!\n", path);
         DOS_ERROR( ER_FileNotFound, EC_NotFound, SA_Abort, EL_Disk );
         return FALSE;
     }
@@ -1361,7 +1445,7 @@
     DOS_FULL_NAME full_name1, full_name2;
     int mode=0; /* mode == 1: use copy */
 
-    dprintf_file( stddeb, "MoveFileEx32A(%s,%s,%04lx)\n", fn1, fn2, flag);
+    dprintf_info(file, "MoveFileEx32A(%s,%s,%04lx)\n", fn1, fn2, flag);
 
     if (!DOSFS_GetFullName( fn1, TRUE, &full_name1 )) return FALSE;
     if (fn2) { /* !fn2 means delete fn1 */
@@ -1461,7 +1545,7 @@
     DOS_FULL_NAME full_name1, full_name2;
     struct stat fstat;
 
-    dprintf_file( stddeb, "MoveFile32A(%s,%s)\n", fn1, fn2 );
+    dprintf_info(file, "MoveFile32A(%s,%s)\n", fn1, fn2 );
 
     if (!DOSFS_GetFullName( fn1, TRUE, &full_name1 )) return FALSE;
     if (DOSFS_GetFullName( fn2, TRUE, &full_name2 )) 
@@ -1479,7 +1563,7 @@
     else /*copy */ {
       if (stat(  full_name1.long_name, &fstat ))
 	{
-	  dprintf_file( stddeb, "Invalid source file %s\n",
+	  dprintf_warn(file, "Invalid source file %s\n",
 			full_name1.long_name);
 	  FILE_SetDosError();
 	  return FALSE;
@@ -1580,7 +1664,7 @@
     struct utimbuf utimbuf;
     
     if (!file) return FILE_TYPE_UNKNOWN; /* FIXME: correct? */
-    dprintf_file(stddeb,"SetFileTime(%s,%p,%p,%p)\n",
+    dprintf_info(file,"SetFileTime(%s,%p,%p,%p)\n",
 	file->unix_name,
 	lpCreationTime,
 	lpLastAccessTime,
@@ -1697,12 +1781,12 @@
   struct flock f;
   FILE_OBJECT *file;
 
-  dprintf_file(stddeb, "LockFile32: handle %d offsetlow=%ld offsethigh=%ld nbyteslow=%ld nbyteshigh=%ld\n",
+  dprintf_info(file, "LockFile32: handle %d offsetlow=%ld offsethigh=%ld nbyteslow=%ld nbyteshigh=%ld\n",
 	       hFile, dwFileOffsetLow, dwFileOffsetHigh,
 	       nNumberOfBytesToLockLow, nNumberOfBytesToLockHigh);
 
   if (dwFileOffsetHigh || nNumberOfBytesToLockHigh) {
-    dprintf_file(stddeb, "LockFile32: Unimplemented bytes > 32bits\n");
+    dprintf_fixme(file, "LockFile32: Unimplemented bytes > 32bits\n");
     return FALSE;
   }
 
@@ -1748,12 +1832,12 @@
   FILE_OBJECT *file;
   struct flock f;
 
-  dprintf_file(stddeb, "UnlockFile32: handle %d offsetlow=%ld offsethigh=%ld nbyteslow=%ld nbyteshigh=%ld\n",
+  dprintf_info(file, "UnlockFile32: handle %d offsetlow=%ld offsethigh=%ld nbyteslow=%ld nbyteshigh=%ld\n",
 	       hFile, dwFileOffsetLow, dwFileOffsetHigh,
 	       nNumberOfBytesToUnlockLow, nNumberOfBytesToUnlockHigh);
 
   if (dwFileOffsetHigh || nNumberOfBytesToUnlockHigh) {
-    dprintf_file(stddeb, "UnlockFile32: Unimplemented bytes > 32bits\n");
+    dprintf_warn(file, "UnlockFile32: Unimplemented bytes > 32bits\n");
     return FALSE;
   }
 
diff --git a/files/profile.c b/files/profile.c
index 545049d..2b6f7eb 100644
--- a/files/profile.c
+++ b/files/profile.c
@@ -13,7 +13,6 @@
 #include "windows.h"
 #include "file.h"
 #include "heap.h"
-#include "stddebug.h"
 #include "debug.h"
 
 typedef struct tagPROFILEKEY
@@ -216,11 +215,12 @@
         *prev_key  = key;
         prev_key = &key->next;
     }
-    if (debugging_profile)
+    if (debugging_info(profile))
     {
-        fprintf( stddeb, "PROFILE_Load:\n" );
-        PROFILE_Save( stddeb, first_section );
-        fprintf( stddeb, "PROFILE_Load finished.\n" );
+        dprintf_info(profile, "PROFILE_Load:\n" );
+	/* FIXME: improper use of stddeb! */
+        PROFILE_Save(stddeb, first_section );
+        dprintf_info(profile, "PROFILE_Load finished.\n" );
     }
     return first_section;
 }
@@ -357,7 +357,7 @@
         return FALSE;
     }
 
-    dprintf_profile( stddeb, "Saving '%s' into '%s'\n",
+    dprintf_info(profile, "Saving '%s' into '%s'\n",
                      CurProfile.dos_name, unix_name );
     PROFILE_Save( file, CurProfile.section );
     fclose( file );
@@ -380,7 +380,7 @@
 
     if (CurProfile.filename && !strcmp( filename, CurProfile.filename ))
     {
-        dprintf_profile( stddeb, "PROFILE_Open(%s): already opened\n",
+        dprintf_info(profile, "PROFILE_Open(%s): already opened\n",
                          filename );
         return TRUE;
     }
@@ -400,7 +400,7 @@
     if (CurProfile.dos_name &&
         !strcmp( full_name.short_name, CurProfile.dos_name ))
     {
-        dprintf_profile( stddeb, "PROFILE_Open(%s): already opened\n",
+        dprintf_info(profile, "PROFILE_Open(%s): already opened\n",
                          filename );
         return TRUE;
     }
@@ -429,7 +429,7 @@
         CharLower32A( p );
         if ((file = fopen( buffer, "r" )))
         {
-            dprintf_profile( stddeb, "PROFILE_Open(%s): found it in %s\n",
+            dprintf_info(profile, "PROFILE_Open(%s): found it in %s\n",
                              filename, buffer );
             CurProfile.unix_name = HEAP_strdupA( SystemHeap, 0, buffer );
         }
@@ -440,7 +440,7 @@
         CurProfile.unix_name = HEAP_strdupA( SystemHeap, 0,
                                              full_name.long_name );
         if ((file = fopen( full_name.long_name, "r" )))
-            dprintf_profile( stddeb, "PROFILE_Open(%s): found it in %s\n",
+            dprintf_info(profile, "PROFILE_Open(%s): found it in %s\n",
                              filename, full_name.long_name );
     }
 
@@ -506,7 +506,7 @@
         key = PROFILE_Find( &CurProfile.section, section, key_name, FALSE );
         PROFILE_CopyEntry( buffer, (key && key->value) ? key->value : def_val,
                            len, FALSE );
-        dprintf_profile( stddeb, "PROFILE_GetString('%s','%s','%s'): returning '%s'\n",
+        dprintf_info(profile, "PROFILE_GetString('%s','%s','%s'): returning '%s'\n",
                          section, key_name, def_val, buffer );
         return strlen( buffer );
     }
@@ -524,7 +524,7 @@
 {
     if (!key_name)  /* Delete a whole section */
     {
-        dprintf_profile(stddeb, "PROFILE_DeleteSection('%s')\n", section_name);
+        dprintf_info(profile, "PROFILE_DeleteSection('%s')\n", section_name);
         CurProfile.changed |= PROFILE_DeleteSection( &CurProfile.section,
                                                      section_name );
         return TRUE;         /* Even if PROFILE_DeleteSection() has failed,
@@ -532,7 +532,7 @@
     }
     else if (!value)  /* Delete a key */
     {
-        dprintf_profile( stddeb, "PROFILE_DeleteKey('%s','%s')\n",
+        dprintf_info(profile, "PROFILE_DeleteKey('%s','%s')\n",
                          section_name, key_name );
         CurProfile.changed |= PROFILE_DeleteKey( &CurProfile.section,
                                                  section_name, key_name );
@@ -542,20 +542,20 @@
     {
         PROFILEKEY *key = PROFILE_Find( &CurProfile.section, section_name,
                                         key_name, TRUE );
-        dprintf_profile( stddeb, "PROFILE_SetString('%s','%s','%s'): ",
+        dprintf_info(profile, "PROFILE_SetString('%s','%s','%s'): \n",
                          section_name, key_name, value );
         if (!key) return FALSE;
         if (key->value)
         {
             if (!strcmp( key->value, value ))
             {
-                dprintf_profile( stddeb, "no change needed\n" );
+                dprintf_info(profile, "  no change needed\n" );
                 return TRUE;  /* No change needed */
             }
-            dprintf_profile( stddeb, "replacing '%s'\n", key->value );
+            dprintf_info(profile, "  replacing '%s'\n", key->value );
             HeapFree( SystemHeap, 0, key->value );
         }
-        else dprintf_profile( stddeb, "creating key\n" );
+        else dprintf_info(profile, "  creating key\n" );
         key->value = HEAP_strdupA( SystemHeap, 0, value );
         CurProfile.changed = TRUE;
     }
@@ -576,7 +576,7 @@
         PROFILEKEY *key = PROFILE_Find(&WineProfile, section, key_name, FALSE);
         PROFILE_CopyEntry( buffer, (key && key->value) ? key->value : def,
                            len, TRUE );
-        dprintf_profile( stddeb, "PROFILE_GetWineIniString('%s','%s','%s'): returning '%s'\n",
+        dprintf_info(profile, "PROFILE_GetWineIniString('%s','%s','%s'): returning '%s'\n",
                          section, key_name, def, buffer );
         return strlen( buffer );
     }
@@ -707,7 +707,7 @@
 	retval = def;
     }
 
-    dprintf_profile(stddeb, "PROFILE_GetWineIniBool(\"%s\", \"%s\", %s), "
+    dprintf_info(profile, "PROFILE_GetWineIniBool(\"%s\", \"%s\", %s), "
 		    "[%c], ret %s.\n", section, key_name,
 		    def ? "TRUE" : "FALSE", key_value[0],
 		    retval ? "TRUE" : "FALSE");
@@ -1031,11 +1031,11 @@
 {
     char *p =(char*)string;
 
-    fprintf( stdnimp,"WritePrivateProfileSection32A empty stup\n");
-    if (debugging_profile) {
-      fprintf(stddeb,"file(%s) => [%s]\n", filename,section);
+    dprintf_fixme(profile, "WritePrivateProfileSection32A empty stup\n");
+    if (debugging_info(profile)) {
+      dprintf_info(profile, "file(%s) => [%s]\n", filename, section);
       while (*(p+1)) {
-	fprintf(stddeb,"%s\n",p);
+	dprintf_info(profile, "%s\n", p);
         p += strlen(p);
 	p += 1;
       }
diff --git a/graphics/bitblt.c b/graphics/bitblt.c
index 2356de8..f779dfd 100644
--- a/graphics/bitblt.c
+++ b/graphics/bitblt.c
@@ -5,7 +5,6 @@
  */
 
 #include "dc.h"
-#include "stddebug.h"
 #include "debug.h"
 
 
@@ -18,7 +17,7 @@
     DC * dc = DC_GetDCPtr( hdc );
     if (!dc || !dc->funcs->pPatBlt) return FALSE;
 
-    dprintf_bitblt( stddeb, "PatBlt16: %04x %d,%d %dx%d %06lx\n",
+    dprintf_info(bitblt, "PatBlt16: %04x %d,%d %dx%d %06lx\n",
                     hdc, left, top, width, height, rop );
     return dc->funcs->pPatBlt( dc, left, top, width, height, rop );
 }
@@ -33,7 +32,7 @@
     DC * dc = DC_GetDCPtr( hdc );
     if (!dc || !dc->funcs->pPatBlt) return FALSE;
 
-    dprintf_bitblt( stddeb, "PatBlt32: %04x %d,%d %dx%d %06lx\n",
+    dprintf_info(bitblt, "PatBlt32: %04x %d,%d %dx%d %06lx\n",
                     hdc, left, top, width, height, rop );
     return dc->funcs->pPatBlt( dc, left, top, width, height, rop );
 }
@@ -52,7 +51,7 @@
     if (!dcDst->funcs->pBitBlt) return FALSE;
     dcSrc = DC_GetDCPtr( hdcSrc );
 
-    dprintf_bitblt(stddeb,
+    dprintf_info(bitblt,
                 "BitBlt16: hdcSrc=%04x %d,%d %d bpp -> hdcDest=%04x %d,%d %dx%dx%d rop=%06lx\n",
                 hdcSrc, xSrc, ySrc, dcSrc ? dcSrc->w.bitsPerPixel : 0,
                 hdcDst, xDst, yDst, width, height, dcDst->w.bitsPerPixel, rop);
@@ -74,7 +73,7 @@
     if (!dcDst->funcs->pBitBlt) return FALSE;
     dcSrc = DC_GetDCPtr( hdcSrc );
 
-    dprintf_bitblt(stddeb,
+    dprintf_info(bitblt,
                 "BitBlt32: hdcSrc=%04x %d,%d %d bpp -> hdcDest=%04x %d,%d %dx%dx%d rop=%06lx\n",
                 hdcSrc, xSrc, ySrc, dcSrc ? dcSrc->w.bitsPerPixel : 0,
                 hdcDst, xDst, yDst, width, height, dcDst->w.bitsPerPixel, rop);
@@ -97,7 +96,7 @@
     if (!dcDst->funcs->pStretchBlt) return FALSE;
     dcSrc = DC_GetDCPtr( hdcSrc );
 
-    dprintf_bitblt(stddeb,
+    dprintf_info(bitblt,
         "StretchBlt16: %04x %d,%d %dx%dx%d -> %04x %d,%d %dx%dx%d rop=%06lx\n",
                    hdcSrc, xSrc, ySrc, widthSrc, heightSrc,
                    dcSrc ? dcSrc->w.bitsPerPixel : 0, hdcDst, xDst, yDst,
@@ -122,7 +121,7 @@
     if (!dcDst->funcs->pStretchBlt) return FALSE;
     dcSrc = DC_GetDCPtr( hdcSrc );
 
-    dprintf_bitblt(stddeb,
+    dprintf_info(bitblt,
         "StretchBlt32: %04x %d,%d %dx%dx%d -> %04x %d,%d %dx%dx%d rop=%06lx\n",
                    hdcSrc, xSrc, ySrc, widthSrc, heightSrc,
                    dcSrc ? dcSrc->w.bitsPerPixel : 0, hdcDst, xDst, yDst,
diff --git a/graphics/ddraw.c b/graphics/ddraw.c
index ce417f7..3b13507 100644
--- a/graphics/ddraw.c
+++ b/graphics/ddraw.c
@@ -1,4 +1,4 @@
-/*		DirectDraw
+/*		DirectDraw using DGA
  *
  * Copyright 1997,1998 Marcus Meissner
  */
@@ -14,7 +14,8 @@
 /* Progress on following programs:
  *
  * - Diablo [640x480x8]:
- *   The movies play. The game doesn't work yet.
+ *   The movies play. The game doesn't work, it somehow tries to write
+ *   into 2 lines _BEFORE_ the start of the surface. Don't know why.
  *
  * - WingCommander 4 / Win95 Patch [640x480x8]:
  *   The intromovie plays, in 8 bit mode (to reconfigure wc4, run wine
@@ -22,22 +23,26 @@
  *   my Matrox Mystique which uses 565 (rgb) colorweight instead of the usual
  *   555. Specifying it in DDPIXELFORMAT didn't help.
  *   Requires to be run in 640x480xdepth mode (doesn't seem to heed
- *   DDSURFACEDESC.lPitch).
+ *   DDSURFACEDESC.lPitch). You can fly the first mission with Maniac, but
+ *   it crashes as soon as you arrive at Blue Point Station...
  *
  * - Monkey Island 3 [640x480x8]:
- *   Goes to the easy/hard selection screen, then hangs due to not MT safe
- *   XLibs.
+ *   Goes to the easy/hard selection screen, then hangs due to MT problems.
  * 
  * - DiscWorld 2 [640x480x8]:
- *   Plays through nearly all intro movies. Sound and animation a bit broken.
+ *   [Crashes with 'cli' in released version. Yes. Privileged instructions
+ *    in 32bit code. Will they ever learn...]
+ *   Plays through nearly all intro movies. Sound and animation skip a lot of
+ *   stuff (possible DirectSound problem).
  * 
  * - XvT [640x480x16]:
  *   Shows the splash screen, then fails with missing Joystick.
  *
  * - Tomb Raider 2 Demo (using 8 bit renderer) [640x480x8]:
- *   Shows selection screen, but keyboard input doesn't work.
+ *   Playable. Sound is weird.
  *
  * - WingCommander Prophecy Demo (using software renderer) [640x480x16]:
+ *   [Crashes with an invalid opcode (outb) in the release version.]
  *   Plays intromovie, hangs in selection screen (no keyboard input, probably
  *   DirectInput problem).
  */
@@ -58,10 +63,8 @@
 #include "dc.h"
 #include "win.h"
 #include "miscemu.h"
-#include "mmsystem.h"
 #include "ddraw.h"
 #include "d3d.h"
-#include "stddebug.h"
 #include "debug.h"
 
 #ifdef HAVE_LIBXXF86DGA
@@ -301,15 +304,16 @@
 	int			nitems;
 
 	if (!vi)
-		vi = XGetVisualInfo(display,VisualNoMask,&vt,&nitems);
+		vi = TSXGetVisualInfo(display,VisualNoMask,&vt,&nitems);
 
-	pf->dwFourCC = mmioFOURCC('R','G','B',' ');
+	pf->dwFourCC = 0;
 	if (ddraw->d.depth==8) {
 		pf->dwFlags 		= DDPF_RGB|DDPF_PALETTEINDEXED8;
 		pf->x.dwRGBBitCount	= 8;
 		pf->y.dwRBitMask  	= 0;
 		pf->z.dwGBitMask  	= 0;
 		pf->xx.dwBBitMask 	= 0;
+		pf->xy.dwRGBAlphaBitMask= 0;
 		return 0;
 	}
 	if (ddraw->d.depth==16) {
@@ -318,6 +322,7 @@
 		pf->y.dwRBitMask	= vi[0].red_mask;
 		pf->z.dwGBitMask	= vi[0].green_mask;
 		pf->xx.dwBBitMask	= vi[0].blue_mask;
+		pf->xy.dwRGBAlphaBitMask= 0;
 		return 0;
 	}
 	fprintf(stderr,"_getpixelformat:oops?\n");
@@ -331,22 +336,22 @@
 static HRESULT WINAPI IDirectDrawSurface_Lock(
     LPDIRECTDRAWSURFACE this,LPRECT32 lprect,LPDDSURFACEDESC lpddsd,DWORD flags, HANDLE32 hnd
 ) {
-	if (debugging_ddraw || (flags & ~(DDLOCK_WAIT|DDLOCK_READONLY|DDLOCK_WRITEONLY)))
-		fprintf(stderr,"IDirectDrawSurface(%p)->Lock(%p,%p,%08lx,%08lx)\n",
-			this,lprect,lpddsd,flags,(DWORD)hnd
-		);
+        dprintf_info(ddraw, "IDirectDrawSurface(%p)->Lock(%p,%p,%08lx,%08lx)\n",
+		this,lprect,lpddsd,flags,(DWORD)hnd);
+	if (flags & ~(DDLOCK_WAIT|DDLOCK_READONLY|DDLOCK_WRITEONLY))
+	    dprintf_warn(ddraw, "IDirectDrawSurface(%p)->Lock(%p,%p,%08lx,%08lx)\n",
+			 this,lprect,lpddsd,flags,(DWORD)hnd);
 
 	if (lprect) {
-		/*
-		fprintf(stderr,"	lprect: %dx%d-%dx%d\n",
+		dprintf_info(ddraw,"	lprect: %dx%d-%dx%d\n",
 			lprect->top,lprect->left,lprect->bottom,lprect->right
 		);
-		 */
 		lpddsd->y.lpSurface =	this->s.surface+
 					(lprect->top*this->s.lpitch)+
 					(lprect->left*(this->s.ddraw->d.depth/8));
 	} else
 		lpddsd->y.lpSurface = this->s.surface;
+	lpddsd->dwFlags = DDSD_WIDTH|DDSD_HEIGHT|DDSD_PIXELFORMAT|DDSD_PITCH|DDSD_LPSURFACE;
 	lpddsd->dwWidth		= this->s.width;
 	lpddsd->dwHeight	= this->s.height;
 	lpddsd->lPitch		= this->s.lpitch;
@@ -357,14 +362,14 @@
 static HRESULT WINAPI IDirectDrawSurface_Unlock(
 	LPDIRECTDRAWSURFACE this,LPVOID surface
 ) {
-	dprintf_ddraw(stderr,"IDirectDrawSurface(%p)->Unlock(%p)\n",this,surface);
+	dprintf_info(ddraw,"IDirectDrawSurface(%p)->Unlock(%p)\n",this,surface);
 	return 0;
 }
 
 static HRESULT WINAPI IDirectDrawSurface_Flip(
 	LPDIRECTDRAWSURFACE this,LPDIRECTDRAWSURFACE flipto,DWORD dwFlags
 ) {
-	dprintf_ddraw(stderr,"IDirectDrawSurface(%p)->Flip(%p,%08lx)\n",this,flipto,dwFlags);
+	dprintf_info(ddraw,"IDirectDrawSurface(%p)->Flip(%p,%08lx)\n",this,flipto,dwFlags);
 	if (!flipto) {
 		if (this->s.backbuffer)
 			flipto = this->s.backbuffer;
@@ -394,7 +399,7 @@
 static HRESULT WINAPI IDirectDrawSurface_SetPalette(
 	LPDIRECTDRAWSURFACE this,LPDIRECTDRAWPALETTE pal
 ) {
-	dprintf_ddraw(stderr,"IDirectDrawSurface(%p)->SetPalette(%p)\n",this,pal);
+	dprintf_info(ddraw,"IDirectDrawSurface(%p)->SetPalette(%p)\n",this,pal);
 	this->s.palette = pal; /* probably addref it too */
 	return 0;
 }
@@ -470,11 +475,13 @@
 	LPDIRECTDRAWSURFACE this,DWORD dstx,DWORD dsty,LPDIRECTDRAWSURFACE src,LPRECT32 rsrc,DWORD trans
 ) {
 	int	i,bpp;
-	fprintf(stderr,"IDirectDrawSurface(%p)->BltFast(%ld,%ld,%p,%p,%08lx),stub!\n",
-		this,dstx,dsty,src,rsrc,trans
-	);
-	fprintf(stderr,"	trans:");_dump_DDBLTFAST(trans);fprintf(stderr,"\n");
-	fprintf(stderr,"	srcrect: %dx%d-%dx%d\n",rsrc->left,rsrc->top,rsrc->right,rsrc->bottom);
+	if (debugging_info(ddraw)) {
+	    fprintf(stderr,"IDirectDrawSurface(%p)->BltFast(%ld,%ld,%p,%p,%08lx),stub!\n",
+		    this,dstx,dsty,src,rsrc,trans
+	    );
+	    fprintf(stderr,"	trans:");_dump_DDBLTFAST(trans);fprintf(stderr,"\n");
+	    fprintf(stderr,"	srcrect: %dx%d-%dx%d\n",rsrc->left,rsrc->top,rsrc->right,rsrc->bottom);
+	}
 	bpp = this->s.ddraw->d.depth/8;
 	for (i=0;i<rsrc->bottom-rsrc->top;i++) {
 		memcpy(	this->s.surface+((i+dsty)*this->s.width*bpp)+dstx*bpp,
@@ -497,7 +504,7 @@
 static HRESULT WINAPI IDirectDrawSurface_GetCaps(
 	LPDIRECTDRAWSURFACE this,LPDDSCAPS caps
 ) {
-	dprintf_ddraw(stderr,"IDirectDrawSurface(%p)->GetCaps(%p)\n",this,caps);
+	dprintf_info(ddraw,"IDirectDrawSurface(%p)->GetCaps(%p)\n",this,caps);
 	caps->dwCaps = DDCAPS_PALETTE; /* probably more */
 	return 0;
 }
@@ -505,8 +512,9 @@
 static HRESULT WINAPI IDirectDrawSurface_GetSurfaceDesc(
 	LPDIRECTDRAWSURFACE this,LPDDSURFACEDESC ddsd
 ) { 
-	if (debugging_ddraw) {
-		fprintf(stderr,"IDirectDrawSurface(%p)->GetSurfaceDesc(%p)\n",this,ddsd);
+	if (debugging_info(ddraw)) {
+		dprintf_info(ddraw, "IDirectDrawSurface(%p)->GetSurfaceDesc(%p)\n",
+			     this,ddsd);
 		fprintf(stderr,"	flags: ");
 		_dump_DDSD(ddsd->dwFlags);
 		fprintf(stderr,"\n");
@@ -526,16 +534,20 @@
 }
 
 static ULONG WINAPI IDirectDrawSurface_AddRef(LPDIRECTDRAWSURFACE this) {
-	dprintf_ddraw(stderr,"IDirectDrawSurface(%p)->AddRef()\n",this);
+	dprintf_info(ddraw,"IDirectDrawSurface(%p)->AddRef()\n",this);
 	return ++(this->ref);
 }
 
 static ULONG WINAPI IDirectDrawSurface_Release(LPDIRECTDRAWSURFACE this) {
-	dprintf_ddraw(stderr,"IDirectDrawSurface(%p)->Release()\n",this);
+	dprintf_info(ddraw,"IDirectDrawSurface(%p)->Release()\n",this);
 	if (!--(this->ref)) {
 		this->s.ddraw->lpvtbl->fnRelease(this->s.ddraw);
 		/* clear out of surface list */
-		this->s.ddraw->d.vpmask &= ~(1<<(this->s.fb_height/this->s.ddraw->d.fb_height));
+		if (this->s.fb_height == -1) {
+			HeapFree(GetProcessHeap(),0,this->s.surface);
+		} else {
+			this->s.ddraw->d.vpmask &= ~(1<<(this->s.fb_height/this->s.ddraw->d.fb_height));
+		}
 		HeapFree(GetProcessHeap(),0,this);
 		return 0;
 	}
@@ -545,9 +557,12 @@
 static HRESULT WINAPI IDirectDrawSurface_GetAttachedSurface(
 	LPDIRECTDRAWSURFACE this,LPDDSCAPS lpddsd,LPDIRECTDRAWSURFACE *lpdsf
 ) {
-	if (debugging_ddraw) {
-		fprintf(stderr,"IDirectDrawSurface(%p)->GetAttachedSurface(%p,%p)\n",this,lpddsd,lpdsf);
-		fprintf(stderr,"	caps ");_dump_DDSCAPS(lpddsd->dwCaps);fprintf(stderr,"\n");
+        dprintf_info(ddraw, "IDirectDrawSurface(%p)->GetAttachedSurface(%p,%p)\n",
+		     this, lpddsd, lpdsf);
+	if (debugging_info(ddraw)) {
+		fprintf(stderr,"	caps ");
+		_dump_DDSCAPS(lpddsd->dwCaps);
+		fprintf(stderr,"\n");
 	}
 	if (!(lpddsd->dwCaps & DDSCAPS_BACKBUFFER)) {
 		fprintf(stderr,"IDirectDrawSurface::GetAttachedSurface():whoops, can only handle backbuffers for now\n");
@@ -609,8 +624,8 @@
 static HRESULT WINAPI IDirectDrawSurface_QueryInterface(LPDIRECTDRAWSURFACE this,REFIID refiid,LPVOID *obj) {
         char    xrefiid[50];
 
-        StringFromCLSID((LPCLSID)refiid,xrefiid);
-        dprintf_ddraw(stderr,"IDirectDrawSurface(%p)->QueryInterface(%s,%p)\n",this,xrefiid,obj);
+        WINE_StringFromCLSID((LPCLSID)refiid,xrefiid);
+        dprintf_info(ddraw,"IDirectDrawSurface(%p)->QueryInterface(%s,%p)\n",this,xrefiid,obj);
 	
 	/* thats version 3 (DirectX 5) */
 	if (	!memcmp(&IID_IDirectDrawSurface3,refiid,sizeof(IID_IDirectDrawSurface3))) {
@@ -693,7 +708,7 @@
 static HRESULT WINAPI IDirectDrawSurface2_Unlock(
 	LPDIRECTDRAWSURFACE2 this,LPVOID surface
 ) {
-	dprintf_ddraw(stderr,"IDirectDrawSurface2(%p)->Unlock(%p)\n",this,surface);
+	dprintf_info(ddraw,"IDirectDrawSurface2(%p)->Unlock(%p)\n",this,surface);
 	return 0;
 }
 
@@ -704,19 +719,12 @@
 }
 
 static ULONG WINAPI IDirectDrawSurface2_AddRef(LPDIRECTDRAWSURFACE2 this) {
-	dprintf_ddraw(stderr,"IDirectDrawSurface2(%p)->AddRef()\n",this);
+	dprintf_info(ddraw,"IDirectDrawSurface2(%p)->AddRef()\n",this);
 	return ++(this->ref);
 }
 
 static ULONG WINAPI IDirectDrawSurface2_Release(LPDIRECTDRAWSURFACE2 this) {
-	dprintf_ddraw(stderr,"IDirectDrawSurface2(%p)->Release()\n",this);
-	if (!--(this->ref)) {
-		this->s.ddraw->lpvtbl->fnRelease(this->s.ddraw);
-		this->s.ddraw->d.vpmask &= ~(1<<(this->s.fb_height/this->s.ddraw->d.fb_height));
-		HeapFree(GetProcessHeap(),0,this);
-		return 0;
-	}
-	return this->ref;
+	return IDirectDrawSurface_Release((LPDIRECTDRAWSURFACE)this);
 }
 
 static HRESULT WINAPI IDirectDrawSurface2_GetAttachedSurface(
@@ -813,12 +821,12 @@
 }
 
 static ULONG WINAPI IDirectDrawSurface3_AddRef(LPDIRECTDRAWSURFACE3 this) {
-	dprintf_ddraw(stderr,"IDirectDrawSurface3(%p)->AddRef()\n",this);
+	dprintf_info(ddraw,"IDirectDrawSurface3(%p)->AddRef()\n",this);
 	return ++(this->ref);
 }
 
 static ULONG WINAPI IDirectDrawSurface3_Release(LPDIRECTDRAWSURFACE3 this) {
-	dprintf_ddraw(stderr,"IDirectDrawSurface3(%p)->Release()\n",this);
+	dprintf_info(ddraw,"IDirectDrawSurface3(%p)->Release()\n",this);
 	if (!--(this->ref)) {
 		this->s.ddraw->lpvtbl->fnRelease(this->s.ddraw);
 		this->s.ddraw->d.vpmask &= ~(1<<(this->s.fb_height/this->s.ddraw->d.fb_height));
@@ -962,11 +970,18 @@
  *			IDirectDrawPalette
  */
 static HRESULT WINAPI IDirectDrawPalette_GetEntries(
-	LPDIRECTDRAWPALETTE this,DWORD x,DWORD y,DWORD z,LPPALETTEENTRY palent
+	LPDIRECTDRAWPALETTE this,DWORD x,DWORD start,DWORD end,LPPALETTEENTRY palent
 ) {
-	fprintf(stderr,"IDirectDrawPalette(%p)->GetEntries(%08lx,%08lx,%08lx,%p),stub!\n",
-		this,x,y,z,palent
+	int	i;
+
+	fprintf(stderr,"IDirectDrawPalette(%p)->GetEntries(%08lx,%ld,%ld,%p),stub!\n",
+		this,x,start,end,palent
 	);
+	for (i=start;i<end;i++) {
+		palent[i-start].peRed = i;
+		palent[i-start].peGreen = i;
+		palent[i-start].peBlue = i;
+	}
 	return 0;
 }
 
@@ -976,7 +991,7 @@
 	XColor		xc;
 	int		i;
 
-	dprintf_ddraw(stderr,"IDirectDrawPalette(%p)->SetEntries(%08lx,%ld,%ld,%p)\n",
+	dprintf_info(ddraw,"IDirectDrawPalette(%p)->SetEntries(%08lx,%ld,%ld,%p)\n",
 		this,x,start,end,palent
 	);
 	if (!this->cm) /* should not happen */ {
@@ -984,13 +999,19 @@
 		return DDERR_GENERIC;
 	}
 /* FIXME: free colorcells instead of freeing whole map */
-	XFreeColormap(display,this->cm);
+	TSXFreeColormap(display,this->cm);
 	this->cm = TSXCreateColormap(display,DefaultRootWindow(display),DefaultVisualOfScreen(screen),AllocAll);
 	if (start>0) {
 		xc.red = xc.blue = xc.green = 0; xc.flags = DoRed|DoGreen|DoBlue; xc.pixel = 0; TSXStoreColor(display,this->cm,&xc);
+		this->palents[0].peRed = 0;
+		this->palents[0].peBlue = 0;
+		this->palents[0].peGreen = 0;
 	}
 	if (end<256) {
 		xc.red = xc.blue = xc.green = 0xffff; xc.flags = DoRed|DoGreen|DoBlue; xc.pixel = 255; TSXStoreColor(display,this->cm,&xc);
+		this->palents[255].peRed = 255;
+		this->palents[255].peBlue = 255;
+		this->palents[255].peGreen = 255;
 	}
 	for (i=start;i<end;i++) {
 		xc.red = palent[i-start].peRed<<8;
@@ -999,6 +1020,9 @@
 		xc.flags = DoRed|DoBlue|DoGreen;
 		xc.pixel = i;
 		TSXStoreColor(display,this->cm,&xc);
+		this->palents[i].peRed = palent[i-start].peRed;
+		this->palents[i].peBlue = palent[i-start].peBlue;
+		this->palents[i].peGreen = palent[i-start].peGreen;
 	}
 	XF86DGAInstallColormap(display,DefaultScreen(display),this->cm);
 	return 0;
@@ -1007,7 +1031,7 @@
 static ULONG WINAPI IDirectDrawPalette_Release(LPDIRECTDRAWPALETTE this) {
 	if (!--(this->ref)) {
 		if (this->cm) {
-			XFreeColormap(display,this->cm);
+			TSXFreeColormap(display,this->cm);
 			this->cm = 0;
 		}
 		HeapFree(GetProcessHeap(),0,this);
@@ -1099,9 +1123,10 @@
 ) {
 	int	i;
 
-	if (debugging_ddraw) {
-		fprintf(stderr,"IDirectDraw(%p)->CreateSurface(%p,%p,%p)\n",this,lpddsd,lpdsf,lpunk);
-		fprintf(stderr," [w=%ld,h=%ld,flags ",lpddsd->dwWidth,lpddsd->dwHeight);
+	dprintf_info(ddraw, "IDirectDraw(%p)->CreateSurface(%p,%p,%p)\n",
+		     this,lpddsd,lpdsf,lpunk);
+	if (debugging_info(ddraw)) {
+		fprintf(stderr,"[w=%ld,h=%ld,flags ",lpddsd->dwWidth,lpddsd->dwHeight);
 		_dump_DDSD(lpddsd->dwFlags);
 		fprintf(stderr,"caps ");
 		_dump_DDSCAPS(lpddsd->ddsCaps.dwCaps);
@@ -1112,19 +1137,34 @@
 	this->lpvtbl->fnAddRef(this);
 	(*lpdsf)->ref = 1;
 	(*lpdsf)->lpvtbl = &ddsvt;
-	for (i=0;i<32;i++)
-		if (!(this->d.vpmask & (1<<i)))
-			break;
-	dprintf_ddraw(stderr,"using viewport %d for a primary surface\n",i);
-	/* if i == 32 or maximum ... return error */
-	this->d.vpmask|=(1<<i);
-	(*lpdsf)->s.surface = this->d.fb_addr+((i*this->d.vp_height)*this->d.fb_width*this->d.depth/8);
-	(*lpdsf)->s.fb_height = i*this->d.fb_height;
+	if (	(lpddsd->dwFlags & DDSD_CAPS) && 
+		(lpddsd->ddsCaps.dwCaps & DDSCAPS_OFFSCREENPLAIN)
+	) {
+		if (!(lpddsd->dwFlags & DDSD_WIDTH))
+			lpddsd->dwWidth = this->d.fb_width;
+		if (!(lpddsd->dwFlags & DDSD_HEIGHT))
+			lpddsd->dwWidth = this->d.fb_height;
+		(*lpdsf)->s.surface = (LPBYTE)HeapAlloc(GetProcessHeap(),0,lpddsd->dwWidth*lpddsd->dwHeight*this->d.depth/8);
+		(*lpdsf)->s.fb_height = -1;
+		(*lpdsf)->s.lpitch = lpddsd->dwWidth*this->d.depth/8;
+		dprintf_info(ddraw,"using system memory for a primary surface\n");
+	} else {
+		for (i=0;i<32;i++)
+			if (!(this->d.vpmask & (1<<i)))
+				break;
+		dprintf_info(ddraw,"using viewport %d for a primary surface\n",i);
+		/* if i == 32 or maximum ... return error */
+		this->d.vpmask|=(1<<i);
+		(*lpdsf)->s.surface = this->d.fb_addr+((i*this->d.fb_height)*this->d.fb_width*this->d.depth/8);
+		(*lpdsf)->s.fb_height = i*this->d.fb_height;
+		(*lpdsf)->s.lpitch = this->d.fb_width*this->d.depth/8;
+	}
+
+	lpddsd->lPitch = (*lpdsf)->s.lpitch;
 
 	(*lpdsf)->s.width = this->d.width;
 	(*lpdsf)->s.height = this->d.height;
 	(*lpdsf)->s.ddraw = this;
-	(*lpdsf)->s.lpitch = this->d.fb_width*this->d.depth/8;
 	(*lpdsf)->s.backbuffer = NULL;
 	if (lpddsd->dwFlags & DDSD_BACKBUFFERCOUNT) {
 		LPDIRECTDRAWSURFACE	back;
@@ -1139,10 +1179,10 @@
 		for (i=0;i<32;i++)
 			if (!(this->d.vpmask & (1<<i)))
 				break;
-		dprintf_ddraw(stderr,"using viewport %d for backbuffer\n",i);
+		dprintf_info(ddraw,"using viewport %d for backbuffer\n",i);
 		/* if i == 32 or maximum ... return error */
 		this->d.vpmask|=(1<<i);
-		back->s.surface = this->d.fb_addr+((i*this->d.vp_height)*this->d.fb_width*this->d.depth/8);
+		back->s.surface = this->d.fb_addr+((i*this->d.fb_height)*this->d.fb_width*this->d.depth/8);
 		back->s.fb_height = i*this->d.fb_height;
 
 		back->s.width = this->d.width;
@@ -1182,14 +1222,16 @@
 		FE(DDSCL_CREATEDEVICEWINDOW)
 	};
 
-	dprintf_ddraw(stderr,"IDirectDraw(%p)->SetCooperativeLevel(%08lx,%08lx)\n",
+	dprintf_info(ddraw,"IDirectDraw(%p)->SetCooperativeLevel(%08lx,%08lx)\n",
 		this,(DWORD)hwnd,cooplevel
 	);
-	dprintf_ddraw(stderr,"	cooperative level ");
-	for (i=0;i<sizeof(flagmap)/sizeof(flagmap[0]);i++)
-		if (flagmap[i].mask & cooplevel)
-			dprintf_ddraw(stderr,"%s ",flagmap[i].name);
-	dprintf_ddraw(stderr,"\n");
+	if(debugging_info(ddraw)){
+	  dbg_decl_str(ddraw, 512);
+	  for (i=0;i<sizeof(flagmap)/sizeof(flagmap[0]);i++)
+	    if (flagmap[i].mask & cooplevel)
+	      dsprintf(ddraw, "%s ", flagmap[i].name);
+	  dprintf_info(ddraw,"	cooperative level %s\n", dbg_str(ddraw));
+	}
 	this->d.mainwindow = hwnd;
 	return 0;
 }
@@ -1201,7 +1243,8 @@
 	int	i,*depths,depcount;
 	char	buf[200];
 
-	dprintf_ddraw(stderr,"IDirectDraw(%p)->SetDisplayMode(%ld,%ld,%ld),stub!\n",this,width,height,depth);
+	dprintf_fixme(ddraw, "IDirectDraw(%p)->SetDisplayMode(%ld,%ld,%ld),stub!\n",
+		      this, width, height, depth);
 
 	depths = TSXListDepths(display,DefaultScreen(display),&depcount);
 	for (i=0;i<depcount;i++)
@@ -1230,6 +1273,7 @@
 	 * it works for the library too?
 	 */
 	XF86DGADirectVideo(display,DefaultScreen(display),XF86DGADirectGraphics);
+	XF86DGASetViewPort(display,DefaultScreen(display),0,this->d.fb_height);
 #ifdef RESTORE_SIGNALS
 	SIGNAL_InitEmulator();
 #endif
@@ -1239,7 +1283,7 @@
 static HRESULT WINAPI IDirectDraw_GetCaps(
 	LPDIRECTDRAW this,LPDDCAPS caps1,LPDDCAPS caps2
 )  {
-	dprintf_ddraw(stderr,"IDirectDraw(%p)->GetCaps(%p,%p)\n",this,caps1,caps2);
+	dprintf_info(ddraw,"IDirectDraw(%p)->GetCaps(%p,%p)\n",this,caps1,caps2);
 	caps1->dwVidMemTotal = this->d.fb_memsize;
 	caps1->dwCaps = 0xffffffff&~(DDCAPS_BANKSWITCHED);		/* we can do anything */
 	caps1->ddsCaps.dwCaps = 0xffffffff;	/* we can do anything */
@@ -1266,7 +1310,7 @@
 static HRESULT WINAPI IDirectDraw_CreatePalette(
 	LPDIRECTDRAW this,DWORD x,LPPALETTEENTRY palent,LPDIRECTDRAWPALETTE *lpddpal,LPUNKNOWN lpunk
 ) {
-	dprintf_ddraw(stderr,"IDirectDraw(%p)->CreatePalette(%08lx,%p,%p,%p)\n",
+	dprintf_info(ddraw,"IDirectDraw(%p)->CreatePalette(%08lx,%p,%p,%p)\n",
 		this,x,palent,lpddpal,lpunk
 	);
 	*lpddpal = (LPDIRECTDRAWPALETTE)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirectDrawPalette));
@@ -1282,7 +1326,8 @@
 }
 
 static HRESULT WINAPI IDirectDraw_RestoreDisplayMode(LPDIRECTDRAW this) {
-	dprintf_ddraw(stderr,"IDirectDraw(%p)->RestoreDisplayMode(),stub!\n",this);
+	dprintf_fixme(ddraw, "IDirectDraw(%p)->RestoreDisplayMode(),stub!\n", 
+		      this);
 	Sleep(1000);
 	XF86DGADirectVideo(display,DefaultScreen(display),0);
 #ifdef RESTORE_SIGNALS
@@ -1295,7 +1340,7 @@
 static HRESULT WINAPI IDirectDraw_WaitForVerticalBlank(
 	LPDIRECTDRAW this,DWORD x,HANDLE32 h
 ) {
-	fprintf(stderr,"IDirectDraw(%p)->WaitForVerticalBlank(0x%08lx,0x%08x),stub!\n",this,x,h);
+	dprintf_info(ddraw,"IDirectDraw(%p)->WaitForVerticalBlank(0x%08lx,0x%08x),stub!\n",this,x,h);
 	return 0;
 }
 
@@ -1320,8 +1365,8 @@
 ) {
         char    xrefiid[50];
 
-        StringFromCLSID((LPCLSID)refiid,xrefiid);
-        dprintf_ddraw(stderr,"IDirectDraw(%p)->QueryInterface(%s,%p)\n",this,xrefiid,obj);
+        WINE_StringFromCLSID((LPCLSID)refiid,xrefiid);
+        dprintf_info(ddraw,"IDirectDraw(%p)->QueryInterface(%s,%p)\n",this,xrefiid,obj);
         if (!memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown))) {
                 *obj = this;
 		this->lpvtbl->fnAddRef(this);
@@ -1367,7 +1412,7 @@
 static HRESULT WINAPI IDirectDraw_GetVerticalBlankStatus(
 	LPDIRECTDRAW this,BOOL32 *status
 ) {
-        fprintf(stderr,"IDirectDraw(%p)->GetVerticalBlankSatus(%p)\n",this,status);
+        dprintf_info(ddraw,"IDirectDraw(%p)->GetVerticalBlankSatus(%p)\n",this,status);
 	*status = TRUE;
 	return 0;
 }
@@ -1377,7 +1422,7 @@
 ) {
 	DDSURFACEDESC	ddsfd;
 
-	dprintf_ddraw(stderr,"IDirectDraw(%p)->EnumDisplayModes(0x%08lx,%p,%p,%p)\n",this,dwFlags,lpddsfd,context,modescb);
+	dprintf_info(ddraw,"IDirectDraw(%p)->EnumDisplayModes(0x%08lx,%p,%p,%p)\n",this,dwFlags,lpddsfd,context,modescb);
 
 
 	_getpixelformat(this,&(ddsfd.ddpfPixelFormat));
@@ -1412,10 +1457,10 @@
 static HRESULT WINAPI IDirectDraw_GetDisplayMode(
 	LPDIRECTDRAW this,LPDDSURFACEDESC lpddsfd
 ) {
-	dprintf_ddraw(stderr,"IDirectDraw(%p)->GetDisplayMode(%p)\n",this,lpddsfd);
+	dprintf_info(ddraw,"IDirectDraw(%p)->GetDisplayMode(%p)\n",this,lpddsfd);
 	lpddsfd->dwFlags = DDSD_HEIGHT|DDSD_WIDTH|DDSD_PITCH|DDSD_BACKBUFFERCOUNT|DDSD_PIXELFORMAT|DDSD_CAPS;
-	lpddsfd->dwHeight = this->d.vp_height;
-	lpddsfd->dwWidth = this->d.vp_width;
+	lpddsfd->dwHeight = screenHeight;
+	lpddsfd->dwWidth = screenWidth;
 	lpddsfd->lPitch = this->d.fb_width*this->d.depth/8;
 	lpddsfd->dwBackBufferCount = 1;
 	lpddsfd->x.dwRefreshRate = 60;
@@ -1429,6 +1474,13 @@
 	return DD_OK;
 }
 
+static HRESULT WINAPI IDirectDraw_GetMonitorFrequency(
+	LPDIRECTDRAW this,LPDWORD freq
+) {
+	fprintf(stderr,"IDirectDraw(%p)->GetMonitorFrequency(%p)\n",this,freq);
+	*freq = 60*100; /* 60 Hz */
+	return 0;
+}
 
 static IDirectDraw_VTable ddvt = {
 	IDirectDraw_QueryInterface,
@@ -1446,7 +1498,7 @@
 	IDirectDraw_GetDisplayMode,
 	(void*)14,
 	(void*)15,
-	(void*)16,
+	IDirectDraw_GetMonitorFrequency,
 	(void*)17,
 	IDirectDraw_GetVerticalBlankStatus,
 	(void*)19,
@@ -1508,7 +1560,8 @@
 static HRESULT WINAPI IDirectDraw2_SetDisplayMode(
 	LPDIRECTDRAW2 this,DWORD width,DWORD height,DWORD depth,DWORD xx,DWORD yy
 ) {
-	dprintf_ddraw(stderr,"IDirectDraw2(%p)->SetDisplayMode(%ld,%ld,%ld,%08lx,%08lx),stub!\n",this,width,height,depth,xx,yy);
+	dprintf_fixme(ddraw,"IDirectDraw2(%p)->SetDisplayMode(%ld,%ld,%ld,%08lx,%08lx),stub!\n",
+		      this, width, height, depth, xx, yy);
 
 	return IDirectDraw_SetDisplayMode((LPDIRECTDRAW)this,width,height,depth);
 }
@@ -1539,7 +1592,7 @@
 static HRESULT WINAPI IDirectDraw2_GetAvailableVidMem(
 	LPDIRECTDRAW2 this,LPDDSCAPS ddscaps,LPDWORD total,LPDWORD free
 ) {
-	fprintf(stderr,"IDirectDraw2(%p)->GetAvailableVidMem(%p,%p,%p),stub!\n",
+	fprintf(stderr,"IDirectDraw2(%p)->GetAvailableVidMem(%p,%p,%p)\n",
 		this,ddscaps,total,free
 	);
 	if (total) *total = this->d.fb_memsize * 1024;
@@ -1550,9 +1603,19 @@
 static HRESULT WINAPI IDirectDraw2_GetMonitorFrequency(
 	LPDIRECTDRAW2 this,LPDWORD freq
 ) {
-	fprintf(stderr,"IDirectDraw2(%p)->GetMonitorFrequency(%p)\n",this,freq);
-	*freq = 60;
-	return 0;
+	return IDirectDraw_GetMonitorFrequency((LPDIRECTDRAW)this,freq);
+}
+
+static HRESULT WINAPI IDirectDraw2_GetVerticalBlankStatus(
+	LPDIRECTDRAW2 this,BOOL32 *status
+) {
+	return IDirectDraw_GetVerticalBlankStatus((LPDIRECTDRAW)this,status);
+}
+
+static HRESULT WINAPI IDirectDraw2_WaitForVerticalBlank(
+	LPDIRECTDRAW2 this,DWORD x,HANDLE32 h
+) {
+	return IDirectDraw_WaitForVerticalBlank((LPDIRECTDRAW)this,x,h);
 }
 
 static IDirectDraw2_VTable dd2vt = {
@@ -1573,12 +1636,12 @@
 	(void*)15,
 	IDirectDraw2_GetMonitorFrequency,
 	(void*)17,
-	(void*)18,
+	IDirectDraw2_GetVerticalBlankStatus,
 	(void*)19,
 	IDirectDraw2_RestoreDisplayMode,
 	IDirectDraw2_SetCooperativeLevel,
 	IDirectDraw2_SetDisplayMode,
-	(void*)23/*IDirectDraw_WaitForVerticalBlank*/,
+	IDirectDraw2_WaitForVerticalBlank,
 	IDirectDraw2_GetAvailableVidMem
 	
 };
@@ -1594,11 +1657,11 @@
 	char	*addr;
 
 	if (lpGUID)
-		StringFromCLSID(lpGUID,xclsid);
+		WINE_StringFromCLSID(lpGUID,xclsid);
 	else
 		strcpy(xclsid,"<null>");
 
-	dprintf_ddraw(stderr,"DirectDrawCreate(%s,%p,%p)\n",xclsid,lplpDD,pUnkOuter);
+	dprintf_info(ddraw,"DirectDrawCreate(%s,%p,%p)\n",xclsid,lplpDD,pUnkOuter);
 	if (getuid()) {
 		MessageBox32A(0,"Using the XF86DGA extension requires the program to be run using UID 0.","WINE DirectDraw",MB_OK|MB_ICONSTOP);
 		return E_UNEXPECTED;
@@ -1611,12 +1674,12 @@
 		return 0;
 	}
 	XF86DGAQueryVersion(display,&major,&minor);
-	dprintf_ddraw(stderr,"XF86DGA is version %d.%d\n",major,minor);
+	dprintf_info(ddraw,"XF86DGA is version %d.%d\n",major,minor);
 	XF86DGAQueryDirectVideo(display,DefaultScreen(display),&flags);
 	if (!(flags & XF86DGADirectPresent))
 		fprintf(stderr,"direct video is NOT ENABLED.\n");
 	XF86DGAGetVideo(display,DefaultScreen(display),&addr,&width,&banksize,&memsize);
-	dprintf_ddraw(stderr,"video framebuffer: begin %p, width %d,banksize %d,memsize %d\n",
+	dprintf_info(ddraw,"video framebuffer: begin %p, width %d,banksize %d,memsize %d\n",
 		addr,width,banksize,memsize
 	);
 	(*lplpDD)->d.fb_width = width;
@@ -1624,12 +1687,12 @@
 	(*lplpDD)->d.fb_memsize = memsize;
 	(*lplpDD)->d.fb_banksize = banksize;
 
-	XF86DGASetViewPort(display,DefaultScreen(display),0,0);
 	XF86DGAGetViewPortSize(display,DefaultScreen(display),&width,&height);
+	XF86DGASetViewPort(display,DefaultScreen(display),0,0);
 	(*lplpDD)->d.vp_width = width;
 	(*lplpDD)->d.vp_height = height;
-	(*lplpDD)->d.fb_height = height;
-	(*lplpDD)->d.vpmask = 0;
+	(*lplpDD)->d.fb_height = screenHeight;
+	(*lplpDD)->d.vpmask = 1;
 
 	/* just assume the default depth is the DGA depth too */
 	(*lplpDD)->d.depth = DefaultDepthOfScreen(screen);
diff --git a/graphics/env.c b/graphics/env.c
index 9e284d7..13aa37f 100644
--- a/graphics/env.c
+++ b/graphics/env.c
@@ -9,7 +9,6 @@
 #include "windows.h"
 #include "gdi.h"
 #include "debug.h"
-#include "stddebug.h"
 
 /***********************************************************************
  *           GetEnvironment   (GDI.134)
diff --git a/graphics/mapping.c b/graphics/mapping.c
index b810a23..8ad198d 100644
--- a/graphics/mapping.c
+++ b/graphics/mapping.c
@@ -6,7 +6,6 @@
 
 #include <math.h>
 #include "dc.h"
-#include "stddebug.h"
 #include "debug.h"
 
 
@@ -164,7 +163,7 @@
     if (!dc) return 0;
     if (dc->funcs->pSetMapMode) return dc->funcs->pSetMapMode( dc, mode );
 
-    dprintf_gdi(stddeb, "SetMapMode: %04x %d\n", hdc, mode );
+    dprintf_info(gdi, "SetMapMode: %04x %d\n", hdc, mode );
     
     prevMode = dc->w.MapMode;
     switch(mode)
diff --git a/graphics/metafiledrv/graphics.c b/graphics/metafiledrv/graphics.c
index 1647a66..f6615ff 100644
--- a/graphics/metafiledrv/graphics.c
+++ b/graphics/metafiledrv/graphics.c
@@ -12,7 +12,6 @@
 #include "region.h"
 #include "xmalloc.h"
 #include "metafiledrv.h"
-#include "stddebug.h"
 #include "debug.h"
 
 /**********************************************************************
diff --git a/graphics/metafiledrv/init.c b/graphics/metafiledrv/init.c
index 58587f0..9d232bc 100644
--- a/graphics/metafiledrv/init.c
+++ b/graphics/metafiledrv/init.c
@@ -9,7 +9,6 @@
 #include "heap.h"
 #include "global.h"
 #include "metafile.h"
-#include "stddebug.h"
 #include "debug.h"
 
 static const DC_FUNCTIONS MFDRV_Funcs =
@@ -151,7 +150,7 @@
     METAFILEDRV_PDEVICE *physDev;
     HFILE32 hFile;
 
-    dprintf_metafile( stddeb, "CreateMetaFile16: '%s'\n", filename );
+    dprintf_info(metafile, "CreateMetaFile16: '%s'\n", filename );
 
     if (!(dc = MFDRV_AllocMetaFile())) return 0;
     physDev = (METAFILEDRV_PDEVICE *)dc->physDev;
@@ -176,7 +175,7 @@
     else  /* memory based metafile */
 	physDev->mh->mtType = METAFILE_MEMORY;
 
-    dprintf_metafile( stddeb, "CreateMetaFile16: returning %04x\n", dc->hSelf);
+    dprintf_info(metafile, "CreateMetaFile16: returning %04x\n", dc->hSelf);
     return dc->hSelf;
 }
 
@@ -199,7 +198,7 @@
     HFILE32 hFile;
     METAFILEDRV_PDEVICE *physDev;
     
-    dprintf_metafile( stddeb, "CloseMetaFile(%04x)\n", hdc );
+    dprintf_info(metafile, "CloseMetaFile(%04x)\n", hdc );
 
     if (!(dc = (DC *) GDI_GetObjPtr( hdc, METAFILE_DC_MAGIC ))) return 0;
     physDev = (METAFILEDRV_PDEVICE *)dc->physDev;
diff --git a/graphics/metafiledrv/objects.c b/graphics/metafiledrv/objects.c
index dcb096d..de8bbc6 100644
--- a/graphics/metafiledrv/objects.c
+++ b/graphics/metafiledrv/objects.c
@@ -12,7 +12,6 @@
 #include "metafile.h"
 #include "metafiledrv.h"
 #include "pen.h"
-#include "stddebug.h"
 #include "debug.h"
 
 
@@ -86,7 +85,7 @@
     HGDIOBJ32 ret = 0;
 
     if (!ptr) return 0;
-    dprintf_gdi(stddeb, "SelectObject: hdc=%04x %04x\n", dc->hSelf, handle );
+    dprintf_info(gdi, "SelectObject: hdc=%04x %04x\n", dc->hSelf, handle );
     
     switch(ptr->wMagic)
     {
diff --git a/graphics/metafiledrv/text.c b/graphics/metafiledrv/text.c
index c4caf1e..1a8617a 100644
--- a/graphics/metafiledrv/text.c
+++ b/graphics/metafiledrv/text.c
@@ -13,7 +13,6 @@
 #include "heap.h"
 #include "metafile.h"
 #include "metafiledrv.h"
-#include "stddebug.h"
 #include "debug.h"
 #include "xmalloc.h"
 
diff --git a/graphics/painting.c b/graphics/painting.c
index 6756c43..2511ec4 100644
--- a/graphics/painting.c
+++ b/graphics/painting.c
@@ -24,7 +24,6 @@
 #include "color.h"
 #include "region.h"
 #include "path.h"
-#include "stddebug.h"
 #include "debug.h"
 
 /***********************************************************************
diff --git a/graphics/win16drv/brush.c b/graphics/win16drv/brush.c
index 305cde5..7f397de 100644
--- a/graphics/win16drv/brush.c
+++ b/graphics/win16drv/brush.c
@@ -8,7 +8,6 @@
 #include "brush.h"
 #include "win16drv.h"
 #include "heap.h"
-#include "stddebug.h"
 #include "debug.h"
 
 HBRUSH32 WIN16DRV_BRUSH_SelectObject( DC * dc, HBRUSH32 hbrush,
@@ -26,7 +25,7 @@
 
     if ( physDev->BrushInfo )
     {
-        dprintf_win16drv(stddeb, "UnRealizing BrushInfo\n");
+        dprintf_info(win16drv, "UnRealizing BrushInfo\n");
         nSize = PRTDRV_RealizeObject (physDev->segptrPDEVICE, -DRVOBJ_BRUSH,
 				      physDev->BrushInfo,
 				      physDev->BrushInfo, 0);
diff --git a/graphics/win16drv/font.c b/graphics/win16drv/font.c
index a669f4c..f0c8dce 100644
--- a/graphics/win16drv/font.c
+++ b/graphics/win16drv/font.c
@@ -12,7 +12,6 @@
 #include "module.h"
 #include "font.h"
 #include "heap.h"
-#include "stddebug.h"
 #include "debug.h"
 
 
@@ -25,7 +24,7 @@
     WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
     DWORD dwRet;
     
-    dprintf_win16drv(stddeb, "WIN16DRV_GetTextExtPoint: %04x %s %d %p\n",
+    dprintf_info(win16drv, "WIN16DRV_GetTextExtPoint: %04x %s %d %p\n",
 		                dc->hSelf, str, count, size);
 
     dwRet = PRTDRV_ExtTextOut(physDev->segptrPDEVICE, 0, 0, 
@@ -35,7 +34,7 @@
 			      win16drv_SegPtr_TextXForm, NULL, NULL, 0);
     size->cx = XDSTOLS(dc,LOWORD(dwRet));
     size->cy = YDSTOLS(dc,HIWORD(dwRet));
-    dprintf_win16drv(stddeb, "WIN16DRV_GetTextExtPoint: cx=0x%x, cy=0x%x\n",
+    dprintf_info(win16drv, "WIN16DRV_GetTextExtPoint: cx=0x%x, cy=0x%x\n",
 		size->cx, size->cy );
     return TRUE;
 }
@@ -48,11 +47,11 @@
 {
     WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
 
-    dprintf_win16drv(stddeb, "WIN16DRV_GetTextMetrics: %04x \n", dc->hSelf);
+    dprintf_info(win16drv, "WIN16DRV_GetTextMetrics: %04x \n", dc->hSelf);
 
     FONT_TextMetric16to32A( &physDev->tm, metrics );
 
-    dprintf_win16drv(stddeb,
+    dprintf_info(win16drv,
 	   "H %d, A %d, D %d, Int %d, Ext %d, AW %d, MW %d, W %d\n",
            metrics->tmHeight,
            metrics->tmAscent,
@@ -74,13 +73,13 @@
 
     dc->w.hFont = hfont;
 
-    dprintf_win16drv(stddeb, "WIN16DRV_FONT_SelectObject '%s' h=%d\n",
+    dprintf_info(win16drv, "WIN16DRV_FONT_SelectObject '%s' h=%d\n",
 		     font->logfont.lfFaceName, font->logfont.lfHeight);
 
 
     if( physDev->FontInfo )
     {
-        dprintf_win16drv(stddeb, "UnRealizing FontInfo\n");
+        dprintf_info(win16drv, "UnRealizing FontInfo\n");
         nSize = PRTDRV_RealizeObject (physDev->segptrPDEVICE, -DRVOBJ_FONT,
 				      physDev->FontInfo,
 				      physDev->FontInfo, 0);
@@ -130,7 +129,7 @@
     physDev->tm.tmCharSet          = fi->dfCharSet;
 #undef fi
 
-    dprintf_win16drv(stddeb,
+    dprintf_info(win16drv,
            "H %d, A %d, D %d, Int %d, Ext %d, AW %d, MW %d, W %d\n",
            physDev->tm.tmHeight,
            physDev->tm.tmAscent,
@@ -155,17 +154,18 @@
 
     WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
     
-    dprintf_win16drv( stddeb, "WIN16DRV_GetCharWidth: %d - %d into %p\n",
+    dprintf_info(win16drv, "WIN16DRV_GetCharWidth: %d - %d into %p\n",
 		      firstChar, lastChar, buffer );
 
     wRet = PRTDRV_GetCharWidth( physDev->segptrPDEVICE, buffer, firstChar, 
 				lastChar, physDev->FontInfo, 
 				win16drv_SegPtr_DrawMode, 
 				win16drv_SegPtr_TextXForm );
-    if( debugging_win16drv )
+    if( debugging_info(win16drv) ){
         for(i = 0; i <= lastChar - firstChar; i++)
-	    dprintf_win16drv(stddeb, "Char %x: width %d\n", i + firstChar,
+	    dprintf_info(win16drv, "Char %x: width %d\n", i + firstChar,
 			                 buffer[i]);
+    }
 
     return wRet;
 }
@@ -207,7 +207,7 @@
                                   LPTEXTMETRIC16 lpTextMetrics,
                                   WORD wFontType, LONG lpClientData) 
 {
-    dprintf_win16drv(stddeb, "In WineEnumDFontCallback plf=%p\n", lpLogFont);
+    dprintf_info(win16drv, "In WineEnumDFontCallback plf=%p\n", lpLogFont);
     return (*(((WEPFC *)lpClientData)->proc))( lpLogFont, lpTextMetrics, 
 				     wFontType, ((WEPFC *)lpClientData)->lp );
 }
diff --git a/graphics/win16drv/graphics.c b/graphics/win16drv/graphics.c
index 7294acb..63f34ab 100644
--- a/graphics/win16drv/graphics.c
+++ b/graphics/win16drv/graphics.c
@@ -7,7 +7,6 @@
 #include <stdio.h>
 #include "heap.h"
 #include "win16drv.h"
-#include "stddebug.h"
 #include "debug.h"
 
 /**********************************************************************
@@ -61,9 +60,9 @@
     BOOL32 bRet = 0;
     POINT16 points[2];
 
-    dprintf_win16drv(stddeb, "In WIN16DRV_Rectangle, x %d y %d DCOrgX %d y %d\n",
+    dprintf_info(win16drv, "In WIN16DRV_Rectangle, x %d y %d DCOrgX %d y %d\n",
            left, top, dc->w.DCOrgX, dc->w.DCOrgY);
-    dprintf_win16drv(stddeb, "In WIN16DRV_Rectangle, VPortOrgX %d y %d\n",
+    dprintf_info(win16drv, "In WIN16DRV_Rectangle, VPortOrgX %d y %d\n",
            dc->vportOrgX, dc->vportOrgY);
     points[0].x = XLPTODP(dc, left);
     points[0].y = YLPTODP(dc, top);
@@ -153,9 +152,9 @@
     WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
     BOOL32 bRet = 0;
     POINT16 points[2];
-    dprintf_win16drv(stddeb, "In WIN16DRV_Ellipse, x %d y %d DCOrgX %d y %d\n",
+    dprintf_info(win16drv, "In WIN16DRV_Ellipse, x %d y %d DCOrgX %d y %d\n",
            left, top, dc->w.DCOrgX, dc->w.DCOrgY);
-    dprintf_win16drv(stddeb, "In WIN16DRV_Ellipse, VPortOrgX %d y %d\n",
+    dprintf_info(win16drv, "In WIN16DRV_Ellipse, VPortOrgX %d y %d\n",
            dc->vportOrgX, dc->vportOrgY);
     points[0].x = XLPTODP(dc, left);
     points[0].y = YLPTODP(dc, top);
diff --git a/graphics/win16drv/init.c b/graphics/win16drv/init.c
index 91d0c30..6703cf5 100644
--- a/graphics/win16drv/init.c
+++ b/graphics/win16drv/init.c
@@ -21,7 +21,6 @@
 #include "font.h"
 #include "callback.h"
 #include "options.h"
-#include "stddebug.h"
 #include "debug.h"
 
 #define SUPPORT_REALIZED_FONTS 1
@@ -178,7 +177,7 @@
         return FALSE;
     }
 
-    dprintf_win16drv(stddeb, "In creatdc for (%s,%s,%s) initData 0x%p\n",driver, device, output, initData);
+    dprintf_info(win16drv, "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;
@@ -187,11 +186,11 @@
     pLPD = LoadPrinterDriver(driver);
     if (pLPD == NULL)
     {
-	dprintf_win16drv(stddeb, "LPGDI_CreateDC: Failed to find printer driver\n");
+	dprintf_warn(win16drv, "LPGDI_CreateDC: Failed to find printer driver\n");
         HeapFree( SystemHeap, 0, physDev );
         return FALSE;
     }
-    dprintf_win16drv(stddeb, "windevCreateDC pLPD 0x%p\n", pLPD);
+    dprintf_info(win16drv, "windevCreateDC pLPD 0x%p\n", pLPD);
 
     /* Now Get the device capabilities from the printer driver */
     
@@ -227,7 +226,7 @@
     pPDH = (PDEVICE_HEADER *)((BYTE*)PTR_SEG_TO_LIN(physDev->segptrPDEVICE) - sizeof(PDEVICE_HEADER)); 
     pPDH->pLPD = pLPD;
     
-    dprintf_win16drv(stddeb, "PRTDRV_Enable: PDEVICE allocated %08lx\n",(DWORD)(physDev->segptrPDEVICE));
+    dprintf_info(win16drv, "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); 
@@ -539,7 +538,7 @@
     HANDLE16 hHandle = (HANDLE16)SP_ERROR;
     PPRINTJOB pPrintJob;
 
-    dprintf_win16drv(stddeb, "OpenJob: \"%s\" \"%s\" %04x\n", lpOutput, lpTitle, hDC);
+    dprintf_info(win16drv, "OpenJob: \"%s\" \"%s\" %04x\n", lpOutput, lpTitle, hDC);
 
     pPrintJob = gPrintJobsTable[0];
     if (pPrintJob == NULL)
@@ -564,7 +563,7 @@
 	    gPrintJobsTable[pPrintJob->nIndex] = pPrintJob; 
 	}
     }
-    dprintf_win16drv(stddeb, "OpenJob: return %04x\n", hHandle);
+    dprintf_info(win16drv, "OpenJob: return %04x\n", hHandle);
     return hHandle;
 }
 
@@ -573,7 +572,7 @@
     int nRet = SP_ERROR;
     PPRINTJOB pPrintJob = NULL;
 
-    dprintf_win16drv(stddeb, "CloseJob: %04x\n", hJob);
+    dprintf_info(win16drv, "CloseJob: %04x\n", hJob);
 
     pPrintJob = FindPrintJobFromHandle(hJob);
     if (pPrintJob != NULL)
@@ -591,7 +590,7 @@
     int nRet = SP_ERROR;
     PPRINTJOB pPrintJob = NULL;
 
-    dprintf_win16drv(stddeb, "WriteSpool: %04x %08lx %04x\n", hJob, (DWORD)lpData, cch);
+    dprintf_info(win16drv, "WriteSpool: %04x %08lx %04x\n", hJob, (DWORD)lpData, cch);
 
     pPrintJob = FindPrintJobFromHandle(hJob);
     if (pPrintJob != NULL && pPrintJob->fd >= 0 && cch)
@@ -608,7 +607,7 @@
 {
     int nRet = 0;
 
-    dprintf_win16drv(stddeb, "WriteDialog: %04x %04x \"%s\"\n", hJob,  cchMsg, lpMsg);
+    dprintf_info(win16drv, "WriteDialog: %04x %04x \"%s\"\n", hJob,  cchMsg, lpMsg);
 
     nRet = MessageBox16(0, lpMsg, "Printing Error", MB_OKCANCEL);
     return nRet;
@@ -618,7 +617,7 @@
 {
     int nRet;
 
-    dprintf_win16drv(stddeb, "DeleteJob: %04x\n", hJob);
+    dprintf_info(win16drv, "DeleteJob: %04x\n", hJob);
 
     nRet = FreePrintJob(hJob);
     return nRet;
@@ -631,13 +630,13 @@
  */
 int WINAPI StartSpoolPage(HANDLE16 hJob)
 {
-    dprintf_win16drv(stddeb, "StartSpoolPage GDI.246 unimplemented\n");
+    dprintf_fixme(win16drv, "StartSpoolPage GDI.246 unimplemented\n");
     return 1;
 
 }
 int WINAPI EndSpoolPage(HANDLE16 hJob)
 {
-    dprintf_win16drv(stddeb, "EndSpoolPage GDI.247 unimplemented\n");
+    dprintf_fixme(win16drv, "EndSpoolPage GDI.247 unimplemented\n");
     return 1;
 }
 
@@ -645,6 +644,6 @@
 DWORD WINAPI GetSpoolJob(int nOption, LONG param)
 {
     DWORD retval = 0;
-    dprintf_win16drv(stddeb, "In GetSpoolJob param 0x%lx noption %d\n",param, nOption);
+    dprintf_info(win16drv, "In GetSpoolJob param 0x%lx noption %d\n",param, nOption);
     return retval;
 }
diff --git a/graphics/win16drv/objects.c b/graphics/win16drv/objects.c
index c2e1f82..a9a9e6e 100644
--- a/graphics/win16drv/objects.c
+++ b/graphics/win16drv/objects.c
@@ -10,7 +10,6 @@
 #include "brush.h"
 #include "font.h"
 #include "pen.h"
-#include "stddebug.h"
 #include "debug.h"
 
 
@@ -32,7 +31,7 @@
     HGDIOBJ32 ret = 0;
 
     if (!ptr) return 0;
-    dprintf_gdi(stddeb, "SelectObject: hdc=%04x %04x\n", dc->hSelf, handle );
+    dprintf_info(gdi, "SelectObject: hdc=%04x %04x\n", dc->hSelf, handle );
     
     switch(ptr->wMagic)
     {
diff --git a/graphics/win16drv/pen.c b/graphics/win16drv/pen.c
index c2e5454..459dcfe 100644
--- a/graphics/win16drv/pen.c
+++ b/graphics/win16drv/pen.c
@@ -8,7 +8,6 @@
 #include "color.h"
 #include "win16drv.h"
 #include "heap.h"
-#include "stddebug.h"
 #include "debug.h"
 
 /***********************************************************************
@@ -21,7 +20,7 @@
     int		 nSize;
     LOGPEN16 	 lPen16;
     dc->w.hPen = hpen;
-    dprintf_win16drv(stddeb, "In WIN16DRV_PEN_SelectObject\n");
+    dprintf_info(win16drv, "In WIN16DRV_PEN_SelectObject\n");
     lPen16.lopnStyle   = pen->logpen.lopnStyle;
     lPen16.lopnWidth.x = pen->logpen.lopnWidth.x;
     lPen16.lopnWidth.y = pen->logpen.lopnWidth.y;
@@ -29,7 +28,7 @@
 
     if ( physDev->PenInfo )
     {
-        dprintf_win16drv(stddeb, "UnRealizing PenInfo\n");
+        dprintf_info(win16drv, "UnRealizing PenInfo\n");
         nSize = PRTDRV_RealizeObject (physDev->segptrPDEVICE, -DRVOBJ_PEN,
 				      physDev->PenInfo,
 				      physDev->PenInfo, 0);
diff --git a/graphics/win16drv/prtdrv.c b/graphics/win16drv/prtdrv.c
index fac1757..c686a0a 100644
--- a/graphics/win16drv/prtdrv.c
+++ b/graphics/win16drv/prtdrv.c
@@ -15,7 +15,6 @@
 #include "heap.h"
 #include "brush.h"
 #include "callback.h"
-#include "stddebug.h"
 #include "debug.h"
 #include "bitmap.h"
 #include "pen.h"
@@ -56,7 +55,7 @@
       LoadPrinterDrvFunc(ADVANCEDSETUPDIALOG);
       LoadPrinterDrvFunc(DIALOGFN);
       LoadPrinterDrvFunc(PSEUDOEDIT);
-      dprintf_win16drv (stddeb,"got func CONTROL 0x%p enable 0x%p enumDfonts 0x%p realizeobject 0x%p extextout 0x%p\n",
+      dprintf_info(win16drv,"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],
@@ -79,7 +78,7 @@
 	ptmpLPD = gapLoadedPrinterDrivers[nDriverSlot++];
 	if (ptmpLPD != NULL)
 	{
-	    dprintf_win16drv(stddeb, "Comparing %s,%s\n",ptmpLPD->szDriver,pszDriver);
+	    dprintf_info(win16drv, "Comparing %s,%s\n",ptmpLPD->szDriver,pszDriver);
 	    /* Found driver store info, exit loop */
 	    if (lstrcmpi32A(ptmpLPD->szDriver, pszDriver) == 0)
 	      pLPD = ptmpLPD;
@@ -151,7 +150,7 @@
 	/* Failed to load driver */
 	fprintf(stderr, "Failed to load printer driver %s\n", pszDriver);
     } else {
-        dprintf_win16drv(stddeb, "Loaded the library\n");
+        dprintf_info(win16drv, "Loaded the library\n");
 	/* Allocate some memory for printer driver info */
 	pLPD = malloc(sizeof(LOADED_PRINTER_DRIVER));
 	memset(pLPD, 0 , sizeof(LOADED_PRINTER_DRIVER));
@@ -162,7 +161,7 @@
 	/* Get DS for the printer module */
 	pLPD->ds_reg	= hInst;
 
-	dprintf_win16drv(stddeb, "DS for %s is %x\n", pszDriver, pLPD->ds_reg);
+	dprintf_info(win16drv, "DS for %s is %x\n", pszDriver, pLPD->ds_reg);
 
 	/* Get address of printer driver functions */
 	GetPrinterDriverFunctions(hInst, pLPD);
@@ -189,20 +188,20 @@
     WORD wRet = 0;
     LOADED_PRINTER_DRIVER *pLPD = NULL;
 
-    dprintf_win16drv(stddeb, "PRTDRV_Control: %08x 0x%x %08lx %08lx\n", (unsigned int)lpDestDev, wfunction, lpInData, lpOutData);
+    dprintf_info(win16drv, "PRTDRV_Control: %08x 0x%x %08lx %08lx\n", (unsigned int)lpDestDev, wfunction, lpInData, lpOutData);
 
     if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL)
     {
 	if (pLPD->fn[FUNC_CONTROL] == NULL)
 	{
-	    dprintf_win16drv(stddeb, "PRTDRV_Control: Not supported by driver\n");
+	    dprintf_warn(win16drv, "PRTDRV_Control: Not supported by driver\n");
 	    return 0;
 	}
 	wRet = Callbacks->CallDrvControlProc( pLPD->fn[FUNC_CONTROL], 
                                               (SEGPTR)lpDestDev, wfunction,
                                               lpInData, lpOutData );
     }
-    dprintf_win16drv(stddeb, "PRTDRV_Control: return %x\n", wRet);
+    dprintf_info(win16drv, "PRTDRV_Control: return %x\n", wRet);
     return wRet;
 }
 
@@ -215,7 +214,7 @@
     WORD wRet = 0;
     LOADED_PRINTER_DRIVER *pLPD = NULL;
 
-    dprintf_win16drv(stddeb, "PRTDRV_Enable: %s %s\n",lpDestDevType, lpOutputFile);
+    dprintf_info(win16drv, "PRTDRV_Enable: %s %s\n",lpDestDevType, lpOutputFile);
 
     /* Get the printer driver info */
     if (wStyle == INITPDEVICE)
@@ -229,7 +228,7 @@
 	WORD		wP2;
 
 	if (!pLPD->fn[FUNC_ENABLE]) {
-	    dprintf_win16drv(stddeb, "PRTDRV_Enable: Not supported by driver\n");
+	    dprintf_warn(win16drv, "PRTDRV_Enable: Not supported by driver\n");
 	    return 0;
 	}
 
@@ -260,7 +259,7 @@
 	    SEGPTR_FREE(lP1);
 	}
     }
-    dprintf_win16drv(stddeb, "PRTDRV_Enable: return %x\n", wRet);
+    dprintf_info(win16drv, "PRTDRV_Enable: return %x\n", wRet);
     return wRet;
 }
 
@@ -274,7 +273,7 @@
     WORD wRet = 0;
     LOADED_PRINTER_DRIVER *pLPD = NULL;
 
-    dprintf_win16drv(stddeb, "PRTDRV_EnumDFonts: %08lx %s %p %p\n",
+    dprintf_info(win16drv, "PRTDRV_EnumDFonts: %08lx %s %p %p\n",
 		     lpDestDev, lpFaceName, lpCallbackFunc, lpClientData);
 
     if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL)
@@ -283,7 +282,7 @@
 	LPBYTE lP2;
 
 	if (pLPD->fn[FUNC_ENUMDFONTS] == NULL) {
-	    dprintf_win16drv(stddeb, "PRTDRV_EnumDFonts: Not supported by driver\n");
+	    dprintf_warn(win16drv, "PRTDRV_EnumDFonts: Not supported by driver\n");
 	    return 0;
 	}
 
@@ -300,7 +299,7 @@
     } else 
         fprintf(stderr,"Failed to find device\n");
     
-    dprintf_win16drv(stddeb, "PRTDRV_EnumDFonts: return %x\n", wRet);
+    dprintf_info(win16drv, "PRTDRV_EnumDFonts: return %x\n", wRet);
     return wRet;
 }
 /*
@@ -312,7 +311,7 @@
     WORD wRet = 0;
     LOADED_PRINTER_DRIVER *pLPD = NULL;
 
-    dprintf_win16drv(stddeb, "PRTDRV_EnumObj:\n");
+    dprintf_info(win16drv, "PRTDRV_EnumObj:\n");
 
     if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL)
     {
@@ -322,7 +321,7 @@
 
 	if (pLPD->fn[FUNC_ENUMOBJ] == NULL)
 	{
-	    dprintf_win16drv(stddeb, "PRTDRV_EnumObj: Not supported by driver\n");
+	    dprintf_warn(win16drv, "PRTDRV_EnumObj: Not supported by driver\n");
 	    return 0;
 	}
 
@@ -343,7 +342,7 @@
     else 
         fprintf(stderr,"Failed to find device\n");
     
-    dprintf_win16drv(stddeb, "PRTDRV_EnumObj: return %x\n", wRet);
+    dprintf_info(win16drv, "PRTDRV_EnumObj: return %x\n", wRet);
     return wRet;
 }
 
@@ -362,7 +361,7 @@
     WORD wRet = 0;
     LOADED_PRINTER_DRIVER *pLPD = NULL;
     
-    dprintf_win16drv(stddeb, "PRTDRV_OUTPUT %d\n", wStyle );
+    dprintf_info(win16drv, "PRTDRV_OUTPUT %d\n", wStyle );
     
     if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL)
     {
@@ -373,7 +372,7 @@
 	int   nSize;
 	if (pLPD->fn[FUNC_OUTPUT] == NULL)
 	{
-	    dprintf_win16drv(stddeb, "PRTDRV_Output: Not supported by driver\n");
+	    dprintf_warn(win16drv, "PRTDRV_Output: Not supported by driver\n");
 	    return 0;
 	}
 
@@ -416,7 +415,7 @@
 	        {
 		    CONV_RECT32TO16( pRect, lP8 );
 
-		    dprintf_win16drv(stddeb, "rect = %d,%d - %d,%d\n",
+		    dprintf_info(win16drv, "rect = %d,%d - %d,%d\n",
 			    lP8->left, lP8->top, lP8->right, lP8->bottom );
 		    wRet = Callbacks->CallDrvOutputProc(pLPD->fn[FUNC_OUTPUT], 
                                             lP1, wP2, wP3, SEGPTR_GET(lP4),
@@ -434,7 +433,7 @@
 	}
         SEGPTR_FREE(lP4);
     }
-    dprintf_win16drv(stddeb, "PRTDRV_Output return %d\n", wRet);
+    dprintf_info(win16drv, "PRTDRV_Output return %d\n", wRet);
     return wRet;
 }
 
@@ -448,7 +447,7 @@
     WORD dwRet = 0;
     LOADED_PRINTER_DRIVER *pLPD = NULL;
     
-    dprintf_win16drv(stddeb,
+    dprintf_info(win16drv,
 		     "PRTDRV_RealizeObject: %08lx %04x %p %p %08lx\n",
 		     lpDestDev, wStyle, lpInObj, lpOutObj, lpTextXForm);
     
@@ -461,7 +460,7 @@
 
 	if (pLPD->fn[FUNC_REALIZEOBJECT] == NULL)
 	{
-	    dprintf_win16drv(stddeb,
+	    dprintf_warn(win16drv,
 			    "PRTDRV_RealizeObject: Not supported by driver\n");
 	    return 0;
 	}
@@ -507,7 +506,7 @@
 	lP4 = SEGPTR_GET( lpOutObj );
 
         lP5 = lpTextXForm;
-	dprintf_win16drv(stddeb,
+	dprintf_info(win16drv,
 			 "Calling Realize %08lx %04x %08lx %08lx %08lx\n",
 	                                      lP1, wP2, lP3, lP4, lP5);
 	dwRet = Callbacks->CallDrvRealizeProc(pLPD->fn[FUNC_REALIZEOBJECT], 
@@ -516,7 +515,7 @@
 	    SEGPTR_FREE(lpBuf);
 
     }
-    dprintf_win16drv(stddeb, "PRTDRV_RealizeObject: return %x\n", dwRet);
+    dprintf_info(win16drv, "PRTDRV_RealizeObject: return %x\n", dwRet);
     return dwRet;
 }
 
@@ -537,7 +536,7 @@
     WORD wRet = 0;
     LOADED_PRINTER_DRIVER *pLPD = NULL;
     
-    dprintf_win16drv(stddeb, "PRTDRV_StretchBlt:\n");
+    dprintf_info(win16drv, "PRTDRV_StretchBlt:\n");
     
     if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL)
     {
@@ -547,7 +546,7 @@
 
 	if (pLPD->fn[FUNC_STRETCHBLT] == NULL)
 	{
-	    dprintf_win16drv(stddeb, "PRTDRV_StretchBlt: Not supported by driver\n");
+	    dprintf_warn(win16drv, "PRTDRV_StretchBlt: Not supported by driver\n");
 	    return 0;
 	}
 	lP1  = lpDestDev;
@@ -591,7 +590,7 @@
     DWORD dwRet = 0;
     LOADED_PRINTER_DRIVER *pLPD = NULL;
     
-    dprintf_win16drv(stddeb, "PRTDRV_ExtTextOut:\n");
+    dprintf_info(win16drv, "PRTDRV_ExtTextOut:\n");
     
     if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL)
     {
@@ -604,7 +603,7 @@
 
 	if (pLPD->fn[FUNC_EXTTEXTOUT] == NULL)
 	{
-	    dprintf_win16drv(stddeb, "PRTDRV_ExtTextOut: Not supported by driver\n");
+	    dprintf_warn(win16drv, "PRTDRV_ExtTextOut: Not supported by driver\n");
 	    return 0;
 	}
 
@@ -614,7 +613,7 @@
 	
 	if (lpClipRect != NULL) {
 	    lP4 = SEGPTR_NEW(RECT16);
-            dprintf_win16drv(stddeb, "Adding lpClipRect\n");
+            dprintf_info(win16drv, "Adding lpClipRect\n");
 	    memcpy(lP4,lpClipRect,sizeof(RECT16));
 	} else
 	  lP4 = 0L;
@@ -624,7 +623,7 @@
 	    if (nSize>abs(wCount))
 	    	nSize = abs(wCount);
 	    lP5 = SEGPTR_ALLOC(nSize+1);
-            dprintf_win16drv(stddeb, "Adding lpString (nSize is %d)\n",nSize);
+            dprintf_info(win16drv, "Adding lpString (nSize is %d)\n",nSize);
 	    memcpy(lP5,lpString,nSize);
 	    *((char *)lP5 + nSize) = '\0';
 	} else
@@ -638,18 +637,18 @@
         lP9 = lpTextXForm;
 	
 	if (lpCharWidths != NULL) 
-	  dprintf_win16drv(stddeb, "PRTDRV_ExtTextOut: Char widths not supported\n");
+	  dprintf_fixme(win16drv, "PRTDRV_ExtTextOut: Char widths not supported\n");
 	lP10 = 0;
 	
 	if (lpOpaqueRect != NULL) {
 	    lP11 = SEGPTR_NEW(RECT16);
-            dprintf_win16drv(stddeb, "Adding lpOpaqueRect\n");
+            dprintf_info(win16drv, "Adding lpOpaqueRect\n");
 	    memcpy(lP11,lpOpaqueRect,sizeof(RECT16));	
 	} else
 	  lP11 = 0L;
 	
 	wP12 = wOptions;
-	dprintf_win16drv(stddeb, "Calling ExtTextOut 0x%lx 0x%x 0x%x %p\n%*s 0x%x 0x%lx 0x%lx\n"
+	dprintf_info(win16drv, "Calling ExtTextOut 0x%lx 0x%x 0x%x %p\n%*s 0x%x 0x%lx 0x%lx\n"
                "0x%lx 0x%lx %p 0x%x\n",lP1, wP2, wP3, lP4, 
 					   nSize,lP5, iP6, lP7, lP8, lP9, lP10,
 					   lP11, wP12);
@@ -660,7 +659,7 @@
                                                  lP8, lP9, lP10,
                                                  SEGPTR_GET(lP11), wP12);
     }
-    dprintf_win16drv(stddeb, "PRTDRV_ExtTextOut: return %lx\n", dwRet);
+    dprintf_info(win16drv, "PRTDRV_ExtTextOut: return %lx\n", dwRet);
     return dwRet;
 }
 
@@ -757,7 +756,7 @@
     WORD wRet = 0;
     LOADED_PRINTER_DRIVER *pLPD = NULL;
     
-    dprintf_win16drv(stddeb, "PRTDRV_GetCharWidth:\n");
+    dprintf_info(win16drv, "PRTDRV_GetCharWidth:\n");
     
     if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL)
     {
@@ -767,7 +766,7 @@
 	
 	if (pLPD->fn[FUNC_GETCHARWIDTH] == NULL)
 	{
-	    dprintf_win16drv(stddeb,
+	    dprintf_warn(win16drv,
 		"PRTDRV_GetCharWidth: Not supported by driver\n");
 	    return 0;
 	}
diff --git a/graphics/win16drv/text.c b/graphics/win16drv/text.c
index 58d771d..2bbd2aa 100644
--- a/graphics/win16drv/text.c
+++ b/graphics/win16drv/text.c
@@ -10,7 +10,6 @@
 #include "win16drv.h"
 #include "dc.h"
 #include "gdi.h"
-#include "stddebug.h"
 #include "debug.h"
 
 /***********************************************************************
@@ -32,7 +31,7 @@
     if (count == 0)
       return FALSE;
 
-    dprintf_win16drv(stddeb, "WIN16DRV_ExtTextOut: %04x %d %d %x %p %*s %p\n",
+    dprintf_info(win16drv, "WIN16DRV_ExtTextOut: %04x %d %d %x %p %*s %p\n",
 	   dc->hSelf, x, y, flags,  lprect, count > 0 ? count : 8, str, lpDx);
 
 
@@ -55,7 +54,7 @@
             
         }
         
-	dprintf_win16drv(stddeb, "textalign = %d\n", dc->w.textAlign);
+	dprintf_info(win16drv, "textalign = %d\n", dc->w.textAlign);
 
 	if (dc->w.textAlign & TA_UPDATECP)
 	{
diff --git a/graphics/wing.c b/graphics/wing.c
index be3c901..f167633 100644
--- a/graphics/wing.c
+++ b/graphics/wing.c
@@ -17,7 +17,6 @@
 #include "dc.h"
 #include "gdi.h"
 #include "xmalloc.h"
-#include "stddebug.h"
 #include "debug.h"
 
 extern void CLIPPING_UpdateGCRegion(DC* );
diff --git a/graphics/x11drv/bitblt.c b/graphics/x11drv/bitblt.c
index 100d63e..d71cefb 100644
--- a/graphics/x11drv/bitblt.c
+++ b/graphics/x11drv/bitblt.c
@@ -16,7 +16,6 @@
 #include "metafile.h"
 #include "options.h"
 #include "x11drv.h"
-#include "stddebug.h"
 #include "debug.h"
 #include "xmalloc.h"
 
@@ -1120,12 +1119,12 @@
     widthDst  = widthDst * dcDst->vportExtX / dcDst->wndExtX;
     heightDst = heightDst * dcDst->vportExtY / dcDst->wndExtY;
 
-    dprintf_bitblt( stddeb, "    vportdst=%d,%d-%d,%d wnddst=%d,%d-%d,%d\n",
+    dprintf_info(bitblt, "    vportdst=%d,%d-%d,%d wnddst=%d,%d-%d,%d\n",
                     dcDst->vportOrgX, dcDst->vportOrgY,
                     dcDst->vportExtX, dcDst->vportExtY,
                     dcDst->wndOrgX, dcDst->wndOrgY,
                     dcDst->wndExtX, dcDst->wndExtY );
-    dprintf_bitblt( stddeb, "    rectdst=%d,%d-%d,%d orgdst=%d,%d\n",
+    dprintf_info(bitblt, "    rectdst=%d,%d-%d,%d orgdst=%d,%d\n",
                     xDst, yDst, widthDst, heightDst,
                     dcDst->w.DCOrgX, dcDst->w.DCOrgY );
 
@@ -1136,19 +1135,19 @@
         widthSrc  = widthSrc * dcSrc->vportExtX / dcSrc->wndExtX;
         heightSrc = heightSrc * dcSrc->vportExtY / dcSrc->wndExtY;
         fStretch  = (widthSrc != widthDst) || (heightSrc != heightDst);
-        dprintf_bitblt( stddeb,"    vportsrc=%d,%d-%d,%d wndsrc=%d,%d-%d,%d\n",
+        dprintf_info(bitblt,"    vportsrc=%d,%d-%d,%d wndsrc=%d,%d-%d,%d\n",
                         dcSrc->vportOrgX, dcSrc->vportOrgY,
                         dcSrc->vportExtX, dcSrc->vportExtY,
                         dcSrc->wndOrgX, dcSrc->wndOrgY,
                         dcSrc->wndExtX, dcSrc->wndExtY );
-        dprintf_bitblt( stddeb, "    rectsrc=%d,%d-%d,%d orgsrc=%d,%d\n",
+        dprintf_info(bitblt, "    rectsrc=%d,%d-%d,%d orgsrc=%d,%d\n",
                         xSrc, ySrc, widthSrc, heightSrc,
                         dcSrc->w.DCOrgX, dcSrc->w.DCOrgY );
         if (!BITBLT_GetVisRectangles( dcDst, xDst, yDst, widthDst, heightDst,
                                       dcSrc, xSrc, ySrc, widthSrc, heightSrc,
                                       &visRectSrc, &visRectDst ))
             return TRUE;
-        dprintf_bitblt( stddeb, "    vissrc=%d,%d-%d,%d visdst=%d,%d-%d,%d\n",
+        dprintf_info(bitblt, "    vissrc=%d,%d-%d,%d visdst=%d,%d-%d,%d\n",
                         visRectSrc.left, visRectSrc.top,
                         visRectSrc.right, visRectSrc.bottom,
                         visRectDst.left, visRectDst.top,
@@ -1160,7 +1159,7 @@
         if (!BITBLT_GetVisRectangles( dcDst, xDst, yDst, widthDst, heightDst,
                                       NULL, 0, 0, 0, 0, NULL, &visRectDst ))
             return TRUE;
-        dprintf_bitblt( stddeb, "    vissrc=none visdst=%d,%d-%d,%d\n",
+        dprintf_info(bitblt, "    vissrc=none visdst=%d,%d-%d,%d\n",
                         visRectDst.left, visRectDst.top,
                         visRectDst.right, visRectDst.bottom );
     }
diff --git a/graphics/x11drv/bitmap.c b/graphics/x11drv/bitmap.c
index 1c3cb8b..960c3c7 100644
--- a/graphics/x11drv/bitmap.c
+++ b/graphics/x11drv/bitmap.c
@@ -13,7 +13,6 @@
 #include "dc.h"
 #include "bitmap.h"
 #include "heap.h"
-#include "stddebug.h"
 #include "debug.h"
 
 extern void CLIPPING_UpdateGCRegion(DC* );
diff --git a/graphics/x11drv/brush.c b/graphics/x11drv/brush.c
index 5c2fae1..90ff60a 100644
--- a/graphics/x11drv/brush.c
+++ b/graphics/x11drv/brush.c
@@ -9,7 +9,6 @@
 #include "bitmap.h"
 #include "color.h"
 #include "x11drv.h"
-#include "stddebug.h"
 #include "debug.h"
 
 static const char HatchBrushes[NB_HATCH_STYLES + 1][8] =
@@ -209,7 +208,7 @@
     BITMAPINFO * bmpInfo;
     HBRUSH16 prevHandle = dc->w.hBrush;
 
-    dprintf_gdi(stddeb, "Brush_SelectObject: hdc=%04x hbrush=%04x\n",
+    dprintf_info(gdi, "Brush_SelectObject: hdc=%04x hbrush=%04x\n",
                 dc->hSelf,hbrush);
 #ifdef NOTDEF
     if (dc->header.wMagic == METAFILE_DC_MAGIC)
@@ -244,16 +243,16 @@
     switch(brush->logbrush.lbStyle)
     {
       case BS_NULL:
-	dprintf_gdi( stddeb,"BS_NULL\n" );
+	dprintf_info(gdi,"BS_NULL\n" );
 	break;
 
       case BS_SOLID:
-        dprintf_gdi( stddeb,"BS_SOLID\n" );
+        dprintf_info(gdi,"BS_SOLID\n" );
 	BRUSH_SelectSolidBrush( dc, brush->logbrush.lbColor );
 	break;
 	
       case BS_HATCHED:
-	dprintf_gdi( stddeb, "BS_HATCHED\n" );
+	dprintf_info(gdi, "BS_HATCHED\n" );
 	dc->u.x.brush.pixel = COLOR_ToPhysical( dc, brush->logbrush.lbColor );
 	dc->u.x.brush.pixmap = TSXCreateBitmapFromData( display, rootWindow,
 				 HatchBrushes[brush->logbrush.lbHatch], 8, 8 );
@@ -261,12 +260,12 @@
 	break;
 	
       case BS_PATTERN:
-	dprintf_gdi( stddeb, "BS_PATTERN\n");
+	dprintf_info(gdi, "BS_PATTERN\n");
 	BRUSH_SelectPatternBrush( dc, (HBRUSH16)brush->logbrush.lbHatch );
 	break;
 
       case BS_DIBPATTERN:
-	dprintf_gdi( stddeb, "BS_DIBPATTERN\n");
+	dprintf_info(gdi, "BS_DIBPATTERN\n");
 	if ((bmpInfo = (BITMAPINFO *) GlobalLock16( (HGLOBAL16)brush->logbrush.lbHatch )))
 	{
 	    int size = DIB_BitmapInfoSize( bmpInfo, brush->logbrush.lbColor );
diff --git a/graphics/x11drv/clipping.c b/graphics/x11drv/clipping.c
index a778c1e..8e87ce5 100644
--- a/graphics/x11drv/clipping.c
+++ b/graphics/x11drv/clipping.c
@@ -8,7 +8,6 @@
 #include "dc.h"
 #include "x11drv.h"
 #include "region.h"
-#include "stddebug.h"
 #include "debug.h"
 #include "heap.h"
 
diff --git a/graphics/x11drv/graphics.c b/graphics/x11drv/graphics.c
index da14d48..091829e 100644
--- a/graphics/x11drv/graphics.c
+++ b/graphics/x11drv/graphics.c
@@ -25,7 +25,6 @@
 #include "bitmap.h"
 #include "callback.h"
 #include "metafile.h"
-#include "stddebug.h"
 #include "palette.h"
 #include "color.h"
 #include "region.h"
@@ -271,7 +270,7 @@
 X11DRV_RoundRect( DC *dc, INT32 left, INT32 top, INT32 right,
                   INT32 bottom, INT32 ell_width, INT32 ell_height )
 {
-    dprintf_graphics(stddeb, "X11DRV_RoundRect(%d %d %d %d  %d %d\n", 
+    dprintf_info(graphics, "X11DRV_RoundRect(%d %d %d %d  %d %d\n", 
     	left, top, right, bottom, ell_width, ell_height);
 
     left   = XLPTODP( dc, left );
@@ -695,7 +694,7 @@
     BOOL32 result;
     struct FloodFill_params params = { dc, x, y, color, fillType };
 
-    dprintf_graphics( stddeb, "X11DRV_ExtFloodFill %d,%d %06lx %d\n",
+    dprintf_info(graphics, "X11DRV_ExtFloodFill %d,%d %06lx %d\n",
                       x, y, color, fillType );
 
     if (!PtVisible32( dc->hSelf, x, y )) return FALSE;
diff --git a/graphics/x11drv/objects.c b/graphics/x11drv/objects.c
index c665b07..1a8fa7e 100644
--- a/graphics/x11drv/objects.c
+++ b/graphics/x11drv/objects.c
@@ -10,7 +10,6 @@
 #include "brush.h"
 #include "font.h"
 #include "pen.h"
-#include "stddebug.h"
 #include "debug.h"
 
 
@@ -32,7 +31,7 @@
     HGDIOBJ32 ret = 0;
 
     if (!ptr) return 0;
-    dprintf_gdi(stddeb, "SelectObject: hdc=%04x %04x\n", dc->hSelf, handle );
+    dprintf_info(gdi, "SelectObject: hdc=%04x %04x\n", dc->hSelf, handle );
     
     switch(ptr->wMagic)
     {
diff --git a/graphics/x11drv/pen.c b/graphics/x11drv/pen.c
index 3a424cf..a918c85 100644
--- a/graphics/x11drv/pen.c
+++ b/graphics/x11drv/pen.c
@@ -6,7 +6,6 @@
 
 #include "pen.h"
 #include "color.h"
-#include "stddebug.h"
 #include "debug.h"
 
 static const char PEN_dash[]       = { 5,3 };      /* -----   -----   -----  */
diff --git a/graphics/x11drv/text.c b/graphics/x11drv/text.c
index cd76974..a206860 100644
--- a/graphics/x11drv/text.c
+++ b/graphics/x11drv/text.c
@@ -13,8 +13,6 @@
 /*#include "callback.h"*/
 #include "heap.h"
 #include "x11font.h"
-#include "stddebug.h"
-/* #define DEBUG_TEXT */
 #include "debug.h"
 
 #define SWAP_INT(a,b)  { int t = a; a = b; b = t; }
@@ -45,10 +43,10 @@
     lfUnderline = (pfo->fo_flags & FO_SYNTH_UNDERLINE) ? 1 : 0;
     lfStrikeOut = (pfo->fo_flags & FO_SYNTH_STRIKEOUT) ? 1 : 0;
 
-    dprintf_text(stddeb,"ExtTextOut: hdc=%04x df=%04x %d,%d '%.*s', %d  flags=%d\n",
+    dprintf_info(text,"ExtTextOut: hdc=%04x df=%04x %d,%d '%.*s', %d  flags=%d\n",
                  dc->hSelf, (UINT16)(dc->u.x.font), x, y, (int)count, str, count, flags);
 
-    if (lprect != NULL) dprintf_text(stddeb, "\trect=(%d,%d- %d,%d)\n",
+    if (lprect != NULL) dprintf_info(text, "\trect=(%d,%d- %d,%d)\n",
                                      lprect->left, lprect->top,
                                      lprect->right, lprect->bottom );
       /* Setup coordinates */
@@ -87,7 +85,7 @@
     x = XLPTODP( dc, x );
     y = YLPTODP( dc, y );
 
-    dprintf_text(stddeb,"\treal coord: x=%i, y=%i, rect=(%d,%d-%d,%d)\n",
+    dprintf_info(text,"\treal coord: x=%i, y=%i, rect=(%d,%d-%d,%d)\n",
 			  x, y, rect.left, rect.top, rect.right, rect.bottom);
 
       /* Draw the rectangle */
diff --git a/graphics/x11drv/xfont.c b/graphics/x11drv/xfont.c
index 1a99b7d..756bfc2 100644
--- a/graphics/x11drv/xfont.c
+++ b/graphics/x11drv/xfont.c
@@ -22,7 +22,6 @@
 #include "options.h"
 #include "x11font.h"
 #include "font.h"
-#include "stddebug.h"
 #include "debug.h"
 
 #define DEBUG_FONT_INIT		1
@@ -524,7 +523,7 @@
 	    sprintf( lpch, "%i-*-*-*-*-*-%s*", fo->fi->lfd_height, lpEncoding );
    }
 
-   dprintf_font(stddeb,"\tLFD: %s\n", lpLFD );
+   dprintf_info(font,"\tLFD: %s\n", lpLFD );
    return TRUE;
 }
 
@@ -826,7 +825,7 @@
 	}
 
 #ifdef DEBUG_FONT_INIT
-	dprintf_font(stddeb,"typeface \'%s\'\n", fr->lfFaceName);
+	dprintf_info(font,"typeface \'%s\'\n", fr->lfFaceName);
 #endif
 	fr->fr_flags |= FR_NAMESET;
     }
@@ -867,7 +866,7 @@
 	if( !lstrcmpi32A( pfa->faTypeFace, lpAlias ) )
 	{
 #ifdef DEBUG_FONT_INIT
-	    dprintf_font(stddeb,"\tredundant alias '%s' -> '%s'\n", lpAlias, lpTypeFace );
+	    dprintf_info(font,"\tredundant alias '%s' -> '%s'\n", lpAlias, lpTypeFace );
 #endif
 	    return NULL;
 	} 
@@ -887,7 +886,7 @@
         lstrcpy32A( pfa->faAlias, lpAlias );
 
 #ifdef DEBUG_FONT_INIT
-        dprintf_font(stddeb, "\tadded alias '%s' for %s\n", lpAlias, lpTypeFace );
+        dprintf_info(font, "\tadded alias '%s' for %s\n", lpAlias, lpTypeFace );
 #endif
 	return pfa;
     }
@@ -989,7 +988,7 @@
 			}
 						
 #ifdef DEBUG_FONT_INIT
-                        dprintf_font(stddeb, "\tsubstituted '%s' with %s\n",
+                        dprintf_info(font, "\tsubstituted '%s' with %s\n",
 						frMatch->lfFaceName, lpAlias );
 #endif
 			lstrcpyn32A( frMatch->lfFaceName, lpAlias, LF_FACESIZE );
@@ -1063,7 +1062,7 @@
 		    fontResource* 	pfr = fontList;
 		    fontInfo* 		pfi = NULL;
 
-		    dprintf_font(stddeb,"Reading cached font metrics:\n");
+		    dprintf_info(font,"Reading cached font metrics:\n");
 
 		    read( fd, fontList, i); /* read all metrics at once */
 		    while( offset < length )
@@ -1103,7 +1102,7 @@
 			offset += sizeof(int);
 			for( pfr = fontList; pfr; pfr = pfr->next )
 			{
-			    dprintf_font(stddeb,"\t%s, %i instances\n", lpch, pfr->count );
+			    dprintf_info(font,"\t%s, %i instances\n", lpch, pfr->count );
 			    pfr->resource = lpch;
 			    while( TRUE )
 			    { 
@@ -1159,13 +1158,13 @@
         i += n_ff * sizeof(fontResource) + j * sizeof(fontInfo) + sizeof(int);
 	write( fd, &i, sizeof(int) );
 
-	dprintf_font(stddeb,"Writing font cache:\n");
+	dprintf_info(font,"Writing font cache:\n");
 
 	for( pfr = fontList; pfr; pfr = pfr->next )
 	{
 	    fontInfo fi;
 
-	    dprintf_font(stddeb,"\t%s, %i instances\n", pfr->resource, pfr->count );
+	    dprintf_info(font,"\t%s, %i instances\n", pfr->resource, pfr->count );
 
 	    i = write( fd, pfr, sizeof(fontResource) );
 	    if( i == sizeof(fontResource) ) 
@@ -1324,7 +1323,7 @@
       
   x_pattern = TSXListFonts(display, "*", MAX_FONT_FAMILIES * 16, &x_count );
 
-  dprintf_font(stddeb,"Font Mapper: initializing %i fonts [LPY=%i, XDR=%i, DR=%i]\n", 
+  dprintf_info(font,"Font Mapper: initializing %i fonts [LPY=%i, XDR=%i, DR=%i]\n", 
 				    x_count, pDevCaps->logPixelsY, DefResolution, res);
   for( i = x_checksum = 0; i < x_count; i++ )
   {
@@ -1397,7 +1396,7 @@
 	   lstrcpyn32A( fr->resource, typeface, j + 1 );
 
 #ifdef DEBUG_FONT_INIT
-	   dprintf_font(stddeb,"    family: %s\n", fr->resource );
+	   dprintf_info(font,"    family: %s\n", fr->resource );
 #endif
 
 	   if( pfr ) pfr->next = fr;
@@ -1441,7 +1440,7 @@
            TSXFreeFont( display, x_fs );
 
 #ifdef DEBUG_FONT_INIT
-	   dprintf_font(stddeb,"\t[% 2ipt] '%s'\n", fi->df.dfPoints, typeface );
+	   dprintf_info(font,"\t[% 2ipt] '%s'\n", fi->df.dfPoints, typeface );
 #endif
 	   XFONT_CheckFIList( fr, fi, REMOVE_SUBSETS );
 	   fi = NULL;	/* preventing reuse */
@@ -1486,7 +1485,7 @@
   XFONT_GrowFreeList(0, fontCacheSize - 1);
 
 #ifdef DEBUG_FONT_INIT
-        dprintf_font(stddeb,"done!\n");
+        dprintf_info(font,"done!\n");
 #endif
 
   /* update text caps parameter */
@@ -1550,7 +1549,7 @@
    BOOL32       bScale = pfi->fi_flags & FI_SCALABLE;
    INT32        d, h;
 
-   dprintf_font( stddeb,"\t[ %-2ipt h=%-3i w=%-3i %s%s]", pfi->df.dfPoints,
+   dprintf_info(font,"\t[ %-2ipt h=%-3i w=%-3i %s%s]\n", pfi->df.dfPoints,
 		 pfi->df.dfPixHeight, pfi->df.dfAvgWidth,
 		(pfi->df.dfWeight > 400) ? "Bold " : "Normal ",
 		(pfi->df.dfItalic) ? "Italic" : "" );
@@ -1640,7 +1639,7 @@
    if( penalty && pfi->lfd_resolution != DefResolution ) 
        penalty++;
 
-   dprintf_font(stddeb,"-> %i\n", penalty );
+   dprintf_info(font,"  returning %i\n", penalty );
 
    return penalty;
 }
@@ -1718,7 +1717,7 @@
   }
 
 #ifdef DEBUG_FONT_INIT
-  if( i ) dprintf_font(stddeb,"\t    purged %i subsets [%i]\n", i , fr->count);
+  if( i ) dprintf_info(font,"\t    purged %i subsets [%i]\n", i , fr->count);
 #endif
 }
 
@@ -1761,7 +1760,7 @@
 
     if( fm.pfr )        /* match family */
     {
-	dprintf_font(stddeb, "%s\n", fm.pfr->lfFaceName );
+	dprintf_info(font, "%s\n", fm.pfr->lfFaceName );
 
         XFONT_MatchFIList( &fm );
         *pfm = fm;
@@ -1775,7 +1774,7 @@
         for( start = fontList; start && score; start = start->next )
         {
             fm.pfr = start;
-	    dprintf_font(stddeb, "%s\n", fm.pfr->lfFaceName );
+	    dprintf_info(font, "%s\n", fm.pfr->lfFaceName );
 
             current_score = XFONT_MatchFIList( &fm );
             if( current_score < score )
@@ -1850,7 +1849,7 @@
     {
 	int	prev_i, prev_j, j;
 
-	dprintf_font(stddeb,"font cache is full\n");
+	dprintf_info(font,"font cache is full\n");
 
 	/* lookup the least recently used font */
 
@@ -1869,7 +1868,7 @@
 	{
 	    /* detach from the lru list */
 
-	    dprintf_font(stddeb,"\tfreeing entry %i\n", j );
+	    dprintf_info(font,"\tfreeing entry %i\n", j );
 
 	    if( prev_j >= 0 )
 		fontCache[prev_j].lru = fontCache[j].lru;
@@ -1887,7 +1886,7 @@
 
 	    prev_i = fontCacheSize + FONTCACHE;
 
-	    dprintf_font(stddeb,"\tgrowing font cache from %i to %i\n", fontCacheSize, prev_i );
+	    dprintf_info(font,"\tgrowing font cache from %i to %i\n", fontCacheSize, prev_i );
 
 	    if( (newCache = (fontObject*)HeapReAlloc(SystemHeap, 0,  
 						     fontCache, prev_i)) )
@@ -1942,7 +1941,7 @@
 	    {
 		UINT32	uRelaxLevel = 0;
 
-		dprintf_font(stddeb,"XRealizeFont: (%u) '%s' h=%i weight=%i %s\n",
+		dprintf_info(font,"XRealizeFont: (%u) '%s' h=%i weight=%i %s\n",
 				     plf->lfCharSet, plf->lfFaceName, plf->lfHeight, 
 				     plf->lfWeight, (plf->lfItalic) ? "Italic" : "" );
 
@@ -2020,7 +2019,7 @@
     pfo->lru = fontMRU;
     fontMRU = (pfo - fontCache);
 
-    dprintf_font(stddeb,"physfont %i\n", fontMRU);
+    dprintf_info(font,"physfont %i\n", fontMRU);
 
     return (X_PHYSFONT)(X_PFONT_MAGIC | fontMRU);
 }
diff --git a/if1632/builtin.c b/if1632/builtin.c
index 0167750..e56183d 100644
--- a/if1632/builtin.c
+++ b/if1632/builtin.c
@@ -18,7 +18,6 @@
 #include "stackframe.h"
 #include "user.h"
 #include "process.h"
-#include "stddebug.h"
 #include "debug.h"
 
 /* Built-in modules descriptors */
@@ -142,7 +141,7 @@
     if (!hModule) return 0;
     FarSetOwner( hModule, hModule );
 
-    dprintf_module( stddeb, "Built-in %s: hmodule=%04x\n",
+    dprintf_info(module, "Built-in %s: hmodule=%04x\n",
                     descr->name, hModule );
     pModule = (NE_MODULE *)GlobalLock16( hModule );
     pModule->self = hModule;
@@ -186,6 +185,8 @@
     WORD vector;
     HMODULE16 hModule;
 
+    fnBUILTIN_LoadModule = BUILTIN_LoadModule;
+
     for (dll = BuiltinDLLs; dll->descr; dll++)
     {
         if (dll->flags & DLL_FLAG_ALWAYS_USED)
diff --git a/if1632/compobj.spec b/if1632/compobj.spec
index 55eb7e9..f0ce3c9 100644
--- a/if1632/compobj.spec
+++ b/if1632/compobj.spec
@@ -2,10 +2,10 @@
 type	win16
 
 1 pascal CoBuildVersion() CoBuildVersion
-2 pascal CoInitialize(long) CoInitialize
+2 pascal CoInitialize(long) CoInitialize16
 3 pascal CoUninitialize() CoUnitialize
-4 pascal CoGetMalloc(long ptr) CoGetMalloc
-5 pascal CoRegisterClassObject(ptr ptr long long ptr) CoRegisterClassObject
+4 pascal CoGetMalloc(long ptr) CoGetMalloc16
+5 pascal CoRegisterClassObject(ptr ptr long long ptr) CoRegisterClassObject16
 6 stub COREVOKECLASSOBJECT
 7 stub COGETCLASSOBJECT
 8 stub COMARSHALINTERFACE
@@ -19,8 +19,8 @@
 16 stub CORELEASEMARSHALDATA
 17 pascal16 COFREEUNUSEDLIBRARIES() CoFreeUnusedLibraries
 18 pascal16 IsEqualGUID(ptr ptr) IsEqualGUID
-19 pascal StringFromCLSID(ptr ptr) StringFromCLSID
-20 pascal CLSIDFromString(str ptr) CLSIDFromString
+19 pascal StringFromCLSID(ptr ptr) StringFromCLSID16
+20 pascal CLSIDFromString(str ptr) CLSIDFromString16
 21 stub ISVALIDPTRIN
 22 stub ISVALIDPTROUT
 23 stub ISVALIDINTERFACE
@@ -61,7 +61,7 @@
 58 stub _IID_IDFRESERVED2
 59 stub _IID_IDFRESERVED3
 60 stub _IID_IMESSAGEFILTER
-61 pascal CLSIDFromProgID(str ptr) CLSIDFromProgID
+61 pascal CLSIDFromProgID(str ptr) CLSIDFromProgID16
 62 stub PROGIDFROMCLSID
 63 stub COLOCKOBJECTEXTERNAL
 64 stub _CLSID_STDMARSHAL
@@ -147,3 +147,14 @@
 201 pascal CALLOBJECTINWOW(ptr ptr) CallObjectInWOW
 204 stub COMPOBJ_204
 207 stub COMPOBJ_207
+
+# WINE internal relays (for Win16 interfaces)
+500 cdecl IMalloc16_QueryInterface(ptr ptr ptr) IMalloc16_QueryInterface
+501 cdecl IMalloc16_AddRef(ptr) IMalloc16_AddRef
+502 cdecl IMalloc16_Release(ptr) IMalloc16_Release
+503 cdecl IMalloc16_Alloc(ptr long) IMalloc16_Alloc
+504 cdecl IMalloc16_Realloc(ptr segptr long) IMalloc16_Realloc
+505 cdecl IMalloc16_Free(ptr segptr) IMalloc16_Free
+506 cdecl IMalloc16_GetSize(ptr segptr) IMalloc16_GetSize
+507 cdecl IMalloc16_DidAlloc(ptr segptr) IMalloc16_DidAlloc
+508 cdecl IMalloc16_HeapMinimize(ptr) IMalloc16_HeapMinimize
diff --git a/if1632/dummy.c b/if1632/dummy.c
index dbf23c8..65c0da8 100644
--- a/if1632/dummy.c
+++ b/if1632/dummy.c
@@ -2,7 +2,7 @@
 #include "wintypes.h"
 long WINAPI stub_GDI_379(void) { fprintf(stderr, "Warning: GDI_379:STARTPAGE unimplemented stub\n"); return 1; }
 long WINAPI stub_GDI_380(void) { fprintf(stderr, "Warning: GDI_380:ENDPAGE unimplemented stub\n"); return 1; }
-long WINAPI stub_GDI_381(void) { fprintf(stderr, "Warning: GDI_381:SETABORTPROC unimplemented stub\n"); return 1; }
+long WINAPI stub_GDI_381(HDC16 hdc, SEGPTR proc) { fprintf(stderr, "Warning: GDI_381:SETABORTPROC unimplemented stub\n"); return 1; }
 long WINAPI stub_GDI_382(void) { fprintf(stderr, "Warning: GDI_382:ABORTPROC unimplemented stub\n"); return 1; }
 long WINAPI stub_GDI_530(void) { fprintf(stderr, "Warning: GDI_530: unimplemented stub\n"); return 0; }
 long WINAPI stub_GDI_531(void) { fprintf(stderr, "Warning: GDI_531: unimplemented stub\n"); return 0; }
@@ -46,4 +46,3 @@
 long WINAPI stub_USER_922(void) { fprintf(stderr, "Warning: USER_922: unimplemented stub\n"); return 0; }
 long WINAPI stub_USER_923(void) { fprintf(stderr, "Warning: USER_923: unimplemented stub\n"); return 0; }
 long WINAPI stub_KERNEL_700(void) { fprintf(stderr, "Warning: KERNEL_700: unimplemented stub\n"); return 1; }
-long WINAPI stub_KERNEL_449(void) { fprintf(stderr, "Warning: KERNEL_449: unimplemented stub\n"); return 0; }
diff --git a/if1632/gdi.spec b/if1632/gdi.spec
index 8d2ff8c..bf7fd6f 100644
--- a/if1632/gdi.spec
+++ b/if1632/gdi.spec
@@ -260,7 +260,7 @@
 378 pascal16 EndDoc(word) EndDoc16
 379 pascal16 StartPage() stub_GDI_379
 380 pascal16 EndPage() stub_GDI_380
-381 pascal16 SetAbortProc() stub_GDI_381
+381 pascal16 SetAbortProc(word segptr) stub_GDI_381
 382 pascal16 AbortDoc() stub_GDI_382
 400 pascal16 FastWindowFrame(word ptr s_word s_word long) FastWindowFrame
 401 stub GDIMOVEBITMAP
diff --git a/if1632/kernel.spec b/if1632/kernel.spec
index 3c347c7..abb0bff 100644
--- a/if1632/kernel.spec
+++ b/if1632/kernel.spec
@@ -260,7 +260,7 @@
 337 pascal16 IsBadStringPtr(segptr word) IsBadStringPtr16
 338 stub HasGPHandler
 339 pascal16 DiagQuery() DiagQuery
-340 pascal16 DiagOutput() DiagOutput
+340 pascal16 DiagOutput(str) DiagOutput
 341 pascal ToolHelpHook(ptr) ToolHelpHook
 342 stub __GP
 343 stub RegisterWinOldApHook
@@ -308,14 +308,16 @@
 445 stub KERNEL_445
 446 stub KERNEL_446
 447 stub KERNEL_447
-449 pascal KERNEL_449() stub_KERNEL_449
+449 pascal KERNEL_449() KERNEL_449
 450 pascal16 KERNEL_450() stub_KERNEL_450
 454 stub KERNEL_454
 455 stub KERNEL_455
-471 stub KERNEL_471
+471 pascal KERNEL_471() _KERNEL_471
 472 register KERNEL_472() _KERNEL_472
 473 stub KERNEL_473
 475 stub KERNEL_475
+480 stub KERNEL_480
+481 stub KERNEL_481
 482 stub KERNEL_482
 485 stub KERNEL_485
 491 stub RegisterServiceProcess
diff --git a/if1632/relay.c b/if1632/relay.c
index 74e7fad..3cc5b0d 100644
--- a/if1632/relay.c
+++ b/if1632/relay.c
@@ -13,13 +13,11 @@
 #include "module.h"
 #include "stackframe.h"
 #include "task.h"
-#include "stddebug.h"
-/* #define DEBUG_RELAY */
 #include "debug.h"
 
 #if 0
 /* Make make_debug think these were really used */
-dprintf_relay
+dprintf_info(relay, "test - dummy");
 #endif
 
 
@@ -83,7 +81,7 @@
     char *args16;
     int i;
 
-    if (!debugging_relay) return;
+    if (!debugging_info(relay)) return;
 
     frame = CURRENT_STACK16;
     printf( "Call %s(", BUILTIN_GetEntryPoint16( frame->entry_cs,
@@ -201,7 +199,7 @@
     STACK16FRAME *frame;
     WORD ordinal;
 
-    if (!debugging_relay) return;
+    if (!debugging_info(relay)) return;
     frame = CURRENT_STACK16;
     printf( "Ret  %s() ", BUILTIN_GetEntryPoint16( frame->entry_cs,
                                                    frame->entry_ip,
@@ -259,7 +257,7 @@
 {
     THDB *thdb;
 
-    if (!debugging_relay) return;
+    if (!debugging_info(relay)) return;
     thdb = THREAD_Current();
 
     if (nb_args == -1)  /* Register function */
@@ -385,7 +383,7 @@
     if (lpbuf[8] != SS_reg(context))
         fprintf( stderr, "Switching stack segment with Throw() not supported; expect crash now\n" );
 
-    if (debugging_relay)  /* Make sure we have a valid entry point address */
+    if (debugging_info(relay))  /* Make sure we have a valid entry point address */
     {
         static FARPROC16 entryPoint = NULL;
 
@@ -410,12 +408,13 @@
 	DWORD *args, ret;
         VA_LIST16 valist;
 	int i;
+	dbg_decl_str(relay, 1024);
 
         VA_START16( valist );
         nrofargs    = VA_ARG16( valist, DWORD );
         argconvmask = VA_ARG16( valist, DWORD );
         proc32      = VA_ARG16( valist, FARPROC32 );
-	dprintf_relay(stddeb,"CallProc32W(%ld,%ld,%p, Ex%d args[",nrofargs,argconvmask,proc32,Ex);
+	dsprintf(relay, "CallProc32W(%ld,%ld,%p, Ex%d args[",nrofargs,argconvmask,proc32,Ex);
 	args = (DWORD*)HEAP_xalloc( GetProcessHeap(), 0,
                                     sizeof(DWORD)*nrofargs );
 	for (i=0;i<nrofargs;i++) {
@@ -423,15 +422,15 @@
                 {
                     SEGPTR ptr = VA_ARG16( valist, SEGPTR );
                     args[nrofargs-i-1] = (DWORD)PTR_SEG_TO_LIN(ptr);
-                    dprintf_relay(stddeb,"%08lx(%p),",ptr,PTR_SEG_TO_LIN(ptr));
+                    dsprintf(relay,"%08lx(%p),",ptr,PTR_SEG_TO_LIN(ptr));
 		}
                 else
                 {
                     args[nrofargs-i-1] = VA_ARG16( valist, DWORD );
-                    dprintf_relay(stddeb,"%ld,",args[nrofargs-i-1]);
+                    dsprintf(relay,"%ld,",args[nrofargs-i-1]);
 		}
 	}
-	dprintf_relay(stddeb,"]) - ");
+	dsprintf(relay,"])");
         VA_END16( valist );
 
 	switch (nrofargs) {
@@ -469,7 +468,7 @@
         if (!Ex) STACK16_POP( THREAD_Current(),
                               (3 + nrofargs) * sizeof(DWORD) );
 
-	dprintf_relay(stddeb,"returns %08lx\n",ret);
+	dprintf_info(relay,"%s - returns %08lx\n",dbg_str(relay),ret);
 	HeapFree( GetProcessHeap(), 0, args );
 	return ret;
 }
diff --git a/if1632/storage.spec b/if1632/storage.spec
index f09c13b..2825e7e 100644
--- a/if1632/storage.spec
+++ b/if1632/storage.spec
@@ -1,13 +1,60 @@
+# Compound Storage DLL.
+# (FIXME: some methods are commented out. Commenting them in _WILL_
+#  result in dataloss. Do it at your own risk.)
 name	storage
 type	win16
  
-1 stub StgCreateDocFile
+1 pascal StgCreateDocFileA(str long long ptr) StgCreateDocFile16
 2 stub StgCreateDocFileOnILockBytes
-3 stub StgOpenStorage
+3 pascal StgOpenStorage(str ptr long ptr long ptr) StgOpenStorage16
 4 stub StgOpenStorageOnILockBytes
-5 stub StgIsStorageFile
+5 pascal StgIsStorageFile(str) StgIsStorageFile16
 6 stub StgIsStorageILockBytes
 7 stub StgSetTimes
 #8 WEP
 #9 ___EXPORTEDSTUB
 103 stub DllGetClassObject
+
+# Storage Interface functions. Starting at 500
+# these are not exported in the real storage.dll, we use them
+# as 16->32 relays. They use the cdecl calling convention.
+
+# IStorage
+500 cdecl IStorage16_QueryInterface(ptr ptr ptr) IStorage16_QueryInterface
+501 cdecl IStorage16_AddRef(ptr) IStorage16_AddRef
+502 cdecl IStorage16_Release(ptr) IStorage16_Release
+#503 cdecl IStorage16_CreateStream(ptr str long long long ptr) IStorage16_CreateStream
+503 stub  IStorage16_CreateStream
+
+504 cdecl IStorage16_OpenStream(ptr str ptr long long ptr) IStorage16_OpenStream
+#505 cdecl IStorage16_CreateStorage(ptr str long long long ptr) IStorage16_CreateStorage
+505 stub  IStorage16_CreateStorage
+506 cdecl IStorage16_OpenStorage(ptr str ptr long ptr long ptr) IStorage16_OpenStorage
+507 cdecl IStorage16_CopyTo(ptr long ptr ptr ptr) IStorage16_CopyTo
+508 stub  IStorage16_MoveElementTo
+509 cdecl IStorage16_Commit(ptr long) IStorage16_Commit
+510 stub  IStorage16_Revert
+511 stub  IStorage16_EnumElements
+512 stub  IStorage16_DestroyElement
+513 stub  IStorage16_RenameElement
+514 stub  IStorage16_SetElementTimes
+515 stub  IStorage16_SetClass
+516 stub  IStorage16_SetStateBits
+517 cdecl IStorage16_Stat(ptr ptr long) IStorage16_Stat
+
+# IStream
+518 cdecl IStream16_QueryInterface(ptr ptr ptr) IStream16_QueryInterface
+519 cdecl IStream16_AddRef(ptr) IStream16_AddRef
+520 cdecl IStream16_Release(ptr) IStream16_Release
+521 cdecl IStream16_Read(ptr ptr long ptr) IStream16_Read
+#522 cdecl IStream16_Write(ptr ptr long ptr) IStream16_Write
+522 stub  IStream16_Write
+523 cdecl IStream16_Seek(ptr long long long ptr) IStream16_Seek
+524 stub  IStream16_SetSize
+525 stub  IStream16_CopyTo
+526 stub  IStream16_Commit
+527 stub  IStream16_Revert
+528 stub  IStream16_LockRegion
+529 stub  IStream16_UnlockRegion
+530 stub  IStream16_Stat
+531 stub  IStream16_Clone
diff --git a/if1632/thunk.c b/if1632/thunk.c
index 499ec20..05eaef7 100644
--- a/if1632/thunk.c
+++ b/if1632/thunk.c
@@ -18,7 +18,6 @@
 #include "task.h"
 #include "except.h"
 #include "win.h"
-#include "stddebug.h"
 #include "debug.h"
 
 
@@ -227,7 +226,7 @@
             return;
         }
     }
-    dprintf_thunk( stddeb, "THUNK_Free: invalid thunk addr %p\n", thunk );
+    dprintf_err(thunk, "THUNK_Free: invalid thunk addr %p\n", thunk );
 }
 
 
@@ -626,7 +625,7 @@
     LPDWORD     args = (LPDWORD)xargs;
     DWORD       ret,i;
 
-    dprintf_relay(stddeb,"WOWCallback16Ex(%p,0x%08lx,%ld,%p,%p)\n",
+    dprintf_info(relay,"WOWCallback16Ex(%p,0x%08lx,%ld,%p,%p)\n",
     	proc,dwFlags,cbArgs,xargs,pdwret
     );
     if (dwFlags == WCB16_CDECL) {
diff --git a/if1632/w32sys.spec b/if1632/w32sys.spec
index ff5a3dd..378c482 100644
--- a/if1632/w32sys.spec
+++ b/if1632/w32sys.spec
@@ -5,7 +5,7 @@
 2 stub ISPEFORMAT
 3 stub EXECPE
 4 stub GETPEEXEINFO
-5 stub GETW32SYSVERSION
+5 return GETW32SYSVERSION 0 0x100
 6 stub LOADPERESOURCE
 7 stub GETPERESOURCETABLE
 8 stub EXECPEEX
diff --git a/include/acconfig.h b/include/acconfig.h
index e7ec75b..dacc345 100644
--- a/include/acconfig.h
+++ b/include/acconfig.h
@@ -17,3 +17,6 @@
 
 /* Define if you have the Open Sound system.  */
 #undef HAVE_OSS
+
+/* Define if X libraries are not reentrant (compiled without -D_REENTRANT).  */
+#undef NO_REENTRANT_X11
diff --git a/include/compobj.h b/include/compobj.h
index 9b74eda..d5f833a 100644
--- a/include/compobj.h
+++ b/include/compobj.h
@@ -1,4 +1,4 @@
-#if !defined(COMPOBJ_H)
+#ifndef COMPOBJ_H
 #define COMPOBJ_H
 
 #include "ole.h"
@@ -15,9 +15,14 @@
 typedef struct tagGUID	CLSID,*LPCLSID,*REFCLSID;
 typedef struct tagGUID	IID,*REFIID,*LPIID;
 
-OLESTATUS WINAPI StringFromCLSID(const CLSID *id, LPSTR);
-OLESTATUS WINAPI CLSIDFromString(const LPCSTR, CLSID *);
+OLESTATUS WINAPI StringFromCLSID16(const CLSID *id, LPOLESTR16*);
+OLESTATUS WINAPI StringFromCLSID32(const CLSID *id, LPOLESTR32*);
+#define StringFromCLSID WINELIB_NAME(StringFromCLSID)
+OLESTATUS WINAPI CLSIDFromString16(LPCOLESTR16, CLSID *);
+OLESTATUS WINAPI CLSIDFromString32(LPCOLESTR32, CLSID *);
+#define CLSIDFromString WINELIB_NAME(CLSIDFromString)
 
+OLESTATUS WINAPI WINE_StringFromCLSID(const CLSID *id, LPSTR);
 
 #ifdef INITGUID
 #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
diff --git a/include/config.h.in b/include/config.h.in
index 0f335ec..5bd94d2 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -30,6 +30,9 @@
 /* Define if you have the Open Sound system.  */
 #undef HAVE_OSS
 
+/* Define if X libraries are not reentrant (compiled without -D_REENTRANT).  */
+#undef NO_REENTRANT_X11
+
 /* Define if you have the clone function.  */
 #undef HAVE_CLONE
 
diff --git a/include/ddraw.h b/include/ddraw.h
index 7078757..f22fb36 100644
--- a/include/ddraw.h
+++ b/include/ddraw.h
@@ -813,6 +813,7 @@
     DWORD			ref;
     LPDIRECTDRAW		ddraw;
     Colormap			cm;
+    PALETTEENTRY		palents[256];
 };
 #undef THIS
 
diff --git a/include/debug.h b/include/debug.h
index 2f35c73..f00ff57 100644
--- a/include/debug.h
+++ b/include/debug.h
@@ -1,1858 +1,95 @@
-#include <stdio.h>
+/* Do not modify this file -- it is automatically generated! */
 
-#define stddeb stdout
-#define stdnimp stdout
-
-/* Do not remove this line or change anything below this line */
-
-#ifdef DEBUG_NONE_EXT
-#undef DEBUG_ACCEL
-#undef DEBUG_ASPI
-#undef DEBUG_ATOM
-#undef DEBUG_BITBLT
-#undef DEBUG_BITMAP
-#undef DEBUG_CARET
-#undef DEBUG_CDAUDIO
-#undef DEBUG_CLASS
-#undef DEBUG_CLIPBOARD
-#undef DEBUG_CLIPPING
-#undef DEBUG_COMBO
-#undef DEBUG_COMM
-#undef DEBUG_COMMDLG
-#undef DEBUG_CRTDLL
-#undef DEBUG_CURSOR
-#undef DEBUG_DC
-#undef DEBUG_DDE
-#undef DEBUG_DDRAW
-#undef DEBUG_DIALOG
-#undef DEBUG_DLL
-#undef DEBUG_DOSFS
-#undef DEBUG_DRIVER
-#undef DEBUG_DSOUND
-#undef DEBUG_EDIT
-#undef DEBUG_EVENT
-#undef DEBUG_EXEC
-#undef DEBUG_FILE
-#undef DEBUG_FIXUP
-#undef DEBUG_FONT
-#undef DEBUG_GDI
-#undef DEBUG_GLOBAL
-#undef DEBUG_GRAPHICS
-#undef DEBUG_HEAP
-#undef DEBUG_HOOK
-#undef DEBUG_ICON
-#undef DEBUG_INT
-#undef DEBUG_KEY
-#undef DEBUG_KEYBOARD
-#undef DEBUG_LDT
-#undef DEBUG_LISTBOX
-#undef DEBUG_LOCAL
-#undef DEBUG_MCI
-#undef DEBUG_MCIANIM
-#undef DEBUG_MCIWAVE
-#undef DEBUG_MDI
-#undef DEBUG_MENU
-#undef DEBUG_MESSAGE
-#undef DEBUG_METAFILE
-#undef DEBUG_MIDI
-#undef DEBUG_MMAUX
-#undef DEBUG_MMIO
-#undef DEBUG_MMSYS
-#undef DEBUG_MMTIME
-#undef DEBUG_MODULE
-#undef DEBUG_MSG
-#undef DEBUG_NONCLIENT
-#undef DEBUG_OLE
-#undef DEBUG_PALETTE
-#undef DEBUG_PROFILE
-#undef DEBUG_PROGRESS
-#undef DEBUG_PROP
-#undef DEBUG_REG
-#undef DEBUG_REGION
-#undef DEBUG_RELAY
-#undef DEBUG_RESOURCE
-#undef DEBUG_SCROLL
-#undef DEBUG_SELECTOR
-#undef DEBUG_SEM
-#undef DEBUG_SENDMSG
-#undef DEBUG_SHM
-#undef DEBUG_STRESS
-#undef DEBUG_STRING
-#undef DEBUG_TASK
-#undef DEBUG_TEXT
-#undef DEBUG_THUNK
-#undef DEBUG_TIMER
-#undef DEBUG_TOOLHELP
-#undef DEBUG_TWEAK
-#undef DEBUG_UPDOWN
-#undef DEBUG_VER
-#undef DEBUG_VIRTUAL
-#undef DEBUG_VXD
-#undef DEBUG_WIN
-#undef DEBUG_WIN16DRV
-#undef DEBUG_WIN32
-#undef DEBUG_WINSOCK
-#undef DEBUG_X11
+#ifndef __DEBUGTOOLS_H
+#include "debugtools.h"
 #endif
 
-#ifdef DEBUG_ALL_EXT
-#define DEBUG_ACCEL
-#define DEBUG_ASPI
-#define DEBUG_ATOM
-#define DEBUG_BITBLT
-#define DEBUG_BITMAP
-#define DEBUG_CARET
-#define DEBUG_CDAUDIO
-#define DEBUG_CLASS
-#define DEBUG_CLIPBOARD
-#define DEBUG_CLIPPING
-#define DEBUG_COMBO
-#define DEBUG_COMM
-#define DEBUG_COMMDLG
-#define DEBUG_CRTDLL
-#define DEBUG_CURSOR
-#define DEBUG_DC
-#define DEBUG_DDE
-#define DEBUG_DDRAW
-#define DEBUG_DIALOG
-#define DEBUG_DLL
-#define DEBUG_DOSFS
-#define DEBUG_DRIVER
-#define DEBUG_DSOUND
-#define DEBUG_EDIT
-#define DEBUG_EVENT
-#define DEBUG_EXEC
-#define DEBUG_FILE
-#define DEBUG_FIXUP
-#define DEBUG_FONT
-#define DEBUG_GDI
-#define DEBUG_GLOBAL
-#define DEBUG_GRAPHICS
-#define DEBUG_HEAP
-#define DEBUG_HOOK
-#define DEBUG_ICON
-#define DEBUG_INT
-#define DEBUG_KEY
-#define DEBUG_KEYBOARD
-#define DEBUG_LDT
-#define DEBUG_LISTBOX
-#define DEBUG_LOCAL
-#define DEBUG_MCI
-#define DEBUG_MCIANIM
-#define DEBUG_MCIWAVE
-#define DEBUG_MDI
-#define DEBUG_MENU
-#define DEBUG_MESSAGE
-#define DEBUG_METAFILE
-#define DEBUG_MIDI
-#define DEBUG_MMAUX
-#define DEBUG_MMIO
-#define DEBUG_MMSYS
-#define DEBUG_MMTIME
-#define DEBUG_MODULE
-#define DEBUG_MSG
-#define DEBUG_NONCLIENT
-#define DEBUG_OLE
-#define DEBUG_PALETTE
-#define DEBUG_PROFILE
-#define DEBUG_PROGRESS
-#define DEBUG_PROP
-#define DEBUG_REG
-#define DEBUG_REGION
-#define DEBUG_RELAY
-#define DEBUG_RESOURCE
-#define DEBUG_SCROLL
-#define DEBUG_SELECTOR
-#define DEBUG_SEM
-#define DEBUG_SENDMSG
-#define DEBUG_SHM
-#define DEBUG_STRESS
-#define DEBUG_STRING
-#define DEBUG_TASK
-#define DEBUG_TEXT
-#define DEBUG_THUNK
-#define DEBUG_TIMER
-#define DEBUG_TOOLHELP
-#define DEBUG_TWEAK
-#define DEBUG_UPDOWN
-#define DEBUG_VER
-#define DEBUG_VIRTUAL
-#define DEBUG_VXD
-#define DEBUG_WIN
-#define DEBUG_WIN16DRV
-#define DEBUG_WIN32
-#define DEBUG_WINSOCK
-#define DEBUG_X11
-#endif
-
-#ifdef DEBUG_RUNTIME
-#ifdef DEBUG_DEFINE_VARIABLES
-short debug_msg_enabled[]={
-#ifdef DEBUG_ACCEL
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_ASPI
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_ATOM
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_BITBLT
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_BITMAP
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_CARET
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_CDAUDIO
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_CLASS
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_CLIPBOARD
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_CLIPPING
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_COMBO
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_COMM
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_COMMDLG
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_CRTDLL
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_CURSOR
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_DC
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_DDE
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_DDRAW
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_DIALOG
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_DLL
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_DOSFS
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_DRIVER
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_DSOUND
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_EDIT
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_EVENT
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_EXEC
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_FILE
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_FIXUP
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_FONT
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_GDI
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_GLOBAL
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_GRAPHICS
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_HEAP
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_HOOK
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_ICON
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_INT
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_KEY
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_KEYBOARD
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_LDT
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_LISTBOX
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_LOCAL
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_MCI
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_MCIANIM
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_MCIWAVE
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_MDI
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_MENU
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_MESSAGE
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_METAFILE
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_MIDI
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_MMAUX
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_MMIO
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_MMSYS
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_MMTIME
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_MODULE
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_MSG
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_NONCLIENT
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_OLE
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_PALETTE
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_PROFILE
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_PROGRESS
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_PROP
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_REG
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_REGION
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_RELAY
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_RESOURCE
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_SCROLL
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_SELECTOR
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_SEM
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_SENDMSG
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_SHM
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_STRESS
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_STRING
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_TASK
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_TEXT
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_THUNK
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_TIMER
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_TOOLHELP
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_TWEAK
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_UPDOWN
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_VER
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_VIRTUAL
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_VXD
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_WIN
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_WIN16DRV
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_WIN32
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_WINSOCK
-    1,
-#else
-    0,
-#endif
-#ifdef DEBUG_X11
-    1,
-#else
-    0,
-#endif
-    0
-};
-#else
-extern short debug_msg_enabled[];
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_accel if(!debug_msg_enabled[0]) ; else fprintf
-#define debugging_accel debug_msg_enabled[0]
-#else
-#ifdef DEBUG_ACCEL
-#define dprintf_accel fprintf
-#define debugging_accel 1
-#else
-#define dprintf_accel while(0) fprintf
-#define debugging_accel 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_aspi if(!debug_msg_enabled[1]) ; else fprintf
-#define debugging_aspi debug_msg_enabled[1]
-#else
-#ifdef DEBUG_ASPI
-#define dprintf_aspi fprintf
-#define debugging_aspi 1
-#else
-#define dprintf_aspi while(0) fprintf
-#define debugging_aspi 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_atom if(!debug_msg_enabled[2]) ; else fprintf
-#define debugging_atom debug_msg_enabled[2]
-#else
-#ifdef DEBUG_ATOM
-#define dprintf_atom fprintf
-#define debugging_atom 1
-#else
-#define dprintf_atom while(0) fprintf
-#define debugging_atom 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_bitblt if(!debug_msg_enabled[3]) ; else fprintf
-#define debugging_bitblt debug_msg_enabled[3]
-#else
-#ifdef DEBUG_BITBLT
-#define dprintf_bitblt fprintf
-#define debugging_bitblt 1
-#else
-#define dprintf_bitblt while(0) fprintf
-#define debugging_bitblt 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_bitmap if(!debug_msg_enabled[4]) ; else fprintf
-#define debugging_bitmap debug_msg_enabled[4]
-#else
-#ifdef DEBUG_BITMAP
-#define dprintf_bitmap fprintf
-#define debugging_bitmap 1
-#else
-#define dprintf_bitmap while(0) fprintf
-#define debugging_bitmap 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_caret if(!debug_msg_enabled[5]) ; else fprintf
-#define debugging_caret debug_msg_enabled[5]
-#else
-#ifdef DEBUG_CARET
-#define dprintf_caret fprintf
-#define debugging_caret 1
-#else
-#define dprintf_caret while(0) fprintf
-#define debugging_caret 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_cdaudio if(!debug_msg_enabled[6]) ; else fprintf
-#define debugging_cdaudio debug_msg_enabled[6]
-#else
-#ifdef DEBUG_CDAUDIO
-#define dprintf_cdaudio fprintf
-#define debugging_cdaudio 1
-#else
-#define dprintf_cdaudio while(0) fprintf
-#define debugging_cdaudio 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_class if(!debug_msg_enabled[7]) ; else fprintf
-#define debugging_class debug_msg_enabled[7]
-#else
-#ifdef DEBUG_CLASS
-#define dprintf_class fprintf
-#define debugging_class 1
-#else
-#define dprintf_class while(0) fprintf
-#define debugging_class 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_clipboard if(!debug_msg_enabled[8]) ; else fprintf
-#define debugging_clipboard debug_msg_enabled[8]
-#else
-#ifdef DEBUG_CLIPBOARD
-#define dprintf_clipboard fprintf
-#define debugging_clipboard 1
-#else
-#define dprintf_clipboard while(0) fprintf
-#define debugging_clipboard 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_clipping if(!debug_msg_enabled[9]) ; else fprintf
-#define debugging_clipping debug_msg_enabled[9]
-#else
-#ifdef DEBUG_CLIPPING
-#define dprintf_clipping fprintf
-#define debugging_clipping 1
-#else
-#define dprintf_clipping while(0) fprintf
-#define debugging_clipping 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_combo if(!debug_msg_enabled[10]) ; else fprintf
-#define debugging_combo debug_msg_enabled[10]
-#else
-#ifdef DEBUG_COMBO
-#define dprintf_combo fprintf
-#define debugging_combo 1
-#else
-#define dprintf_combo while(0) fprintf
-#define debugging_combo 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_comm if(!debug_msg_enabled[11]) ; else fprintf
-#define debugging_comm debug_msg_enabled[11]
-#else
-#ifdef DEBUG_COMM
-#define dprintf_comm fprintf
-#define debugging_comm 1
-#else
-#define dprintf_comm while(0) fprintf
-#define debugging_comm 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_commdlg if(!debug_msg_enabled[12]) ; else fprintf
-#define debugging_commdlg debug_msg_enabled[12]
-#else
-#ifdef DEBUG_COMMDLG
-#define dprintf_commdlg fprintf
-#define debugging_commdlg 1
-#else
-#define dprintf_commdlg while(0) fprintf
-#define debugging_commdlg 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_crtdll if(!debug_msg_enabled[13]) ; else fprintf
-#define debugging_crtdll debug_msg_enabled[13]
-#else
-#ifdef DEBUG_CRTDLL
-#define dprintf_crtdll fprintf
-#define debugging_crtdll 1
-#else
-#define dprintf_crtdll while(0) fprintf
-#define debugging_crtdll 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_cursor if(!debug_msg_enabled[14]) ; else fprintf
-#define debugging_cursor debug_msg_enabled[14]
-#else
-#ifdef DEBUG_CURSOR
-#define dprintf_cursor fprintf
-#define debugging_cursor 1
-#else
-#define dprintf_cursor while(0) fprintf
-#define debugging_cursor 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_dc if(!debug_msg_enabled[15]) ; else fprintf
-#define debugging_dc debug_msg_enabled[15]
-#else
-#ifdef DEBUG_DC
-#define dprintf_dc fprintf
-#define debugging_dc 1
-#else
-#define dprintf_dc while(0) fprintf
-#define debugging_dc 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_dde if(!debug_msg_enabled[16]) ; else fprintf
-#define debugging_dde debug_msg_enabled[16]
-#else
-#ifdef DEBUG_DDE
-#define dprintf_dde fprintf
-#define debugging_dde 1
-#else
-#define dprintf_dde while(0) fprintf
-#define debugging_dde 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_ddraw if(!debug_msg_enabled[17]) ; else fprintf
-#define debugging_ddraw debug_msg_enabled[17]
-#else
-#ifdef DEBUG_DDRAW
-#define dprintf_ddraw fprintf
-#define debugging_ddraw 1
-#else
-#define dprintf_ddraw while(0) fprintf
-#define debugging_ddraw 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_dialog if(!debug_msg_enabled[18]) ; else fprintf
-#define debugging_dialog debug_msg_enabled[18]
-#else
-#ifdef DEBUG_DIALOG
-#define dprintf_dialog fprintf
-#define debugging_dialog 1
-#else
-#define dprintf_dialog while(0) fprintf
-#define debugging_dialog 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_dll if(!debug_msg_enabled[19]) ; else fprintf
-#define debugging_dll debug_msg_enabled[19]
-#else
-#ifdef DEBUG_DLL
-#define dprintf_dll fprintf
-#define debugging_dll 1
-#else
-#define dprintf_dll while(0) fprintf
-#define debugging_dll 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_dosfs if(!debug_msg_enabled[20]) ; else fprintf
-#define debugging_dosfs debug_msg_enabled[20]
-#else
-#ifdef DEBUG_DOSFS
-#define dprintf_dosfs fprintf
-#define debugging_dosfs 1
-#else
-#define dprintf_dosfs while(0) fprintf
-#define debugging_dosfs 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_driver if(!debug_msg_enabled[21]) ; else fprintf
-#define debugging_driver debug_msg_enabled[21]
-#else
-#ifdef DEBUG_DRIVER
-#define dprintf_driver fprintf
-#define debugging_driver 1
-#else
-#define dprintf_driver while(0) fprintf
-#define debugging_driver 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_dsound if(!debug_msg_enabled[22]) ; else fprintf
-#define debugging_dsound debug_msg_enabled[22]
-#else
-#ifdef DEBUG_DSOUND
-#define dprintf_dsound fprintf
-#define debugging_dsound 1
-#else
-#define dprintf_dsound while(0) fprintf
-#define debugging_dsound 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_edit if(!debug_msg_enabled[23]) ; else fprintf
-#define debugging_edit debug_msg_enabled[23]
-#else
-#ifdef DEBUG_EDIT
-#define dprintf_edit fprintf
-#define debugging_edit 1
-#else
-#define dprintf_edit while(0) fprintf
-#define debugging_edit 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_event if(!debug_msg_enabled[24]) ; else fprintf
-#define debugging_event debug_msg_enabled[24]
-#else
-#ifdef DEBUG_EVENT
-#define dprintf_event fprintf
-#define debugging_event 1
-#else
-#define dprintf_event while(0) fprintf
-#define debugging_event 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_exec if(!debug_msg_enabled[25]) ; else fprintf
-#define debugging_exec debug_msg_enabled[25]
-#else
-#ifdef DEBUG_EXEC
-#define dprintf_exec fprintf
-#define debugging_exec 1
-#else
-#define dprintf_exec while(0) fprintf
-#define debugging_exec 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_file if(!debug_msg_enabled[26]) ; else fprintf
-#define debugging_file debug_msg_enabled[26]
-#else
-#ifdef DEBUG_FILE
-#define dprintf_file fprintf
-#define debugging_file 1
-#else
-#define dprintf_file while(0) fprintf
-#define debugging_file 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_fixup if(!debug_msg_enabled[27]) ; else fprintf
-#define debugging_fixup debug_msg_enabled[27]
-#else
-#ifdef DEBUG_FIXUP
-#define dprintf_fixup fprintf
-#define debugging_fixup 1
-#else
-#define dprintf_fixup while(0) fprintf
-#define debugging_fixup 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_font if(!debug_msg_enabled[28]) ; else fprintf
-#define debugging_font debug_msg_enabled[28]
-#else
-#ifdef DEBUG_FONT
-#define dprintf_font fprintf
-#define debugging_font 1
-#else
-#define dprintf_font while(0) fprintf
-#define debugging_font 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_gdi if(!debug_msg_enabled[29]) ; else fprintf
-#define debugging_gdi debug_msg_enabled[29]
-#else
-#ifdef DEBUG_GDI
-#define dprintf_gdi fprintf
-#define debugging_gdi 1
-#else
-#define dprintf_gdi while(0) fprintf
-#define debugging_gdi 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_global if(!debug_msg_enabled[30]) ; else fprintf
-#define debugging_global debug_msg_enabled[30]
-#else
-#ifdef DEBUG_GLOBAL
-#define dprintf_global fprintf
-#define debugging_global 1
-#else
-#define dprintf_global while(0) fprintf
-#define debugging_global 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_graphics if(!debug_msg_enabled[31]) ; else fprintf
-#define debugging_graphics debug_msg_enabled[31]
-#else
-#ifdef DEBUG_GRAPHICS
-#define dprintf_graphics fprintf
-#define debugging_graphics 1
-#else
-#define dprintf_graphics while(0) fprintf
-#define debugging_graphics 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_heap if(!debug_msg_enabled[32]) ; else fprintf
-#define debugging_heap debug_msg_enabled[32]
-#else
-#ifdef DEBUG_HEAP
-#define dprintf_heap fprintf
-#define debugging_heap 1
-#else
-#define dprintf_heap while(0) fprintf
-#define debugging_heap 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_hook if(!debug_msg_enabled[33]) ; else fprintf
-#define debugging_hook debug_msg_enabled[33]
-#else
-#ifdef DEBUG_HOOK
-#define dprintf_hook fprintf
-#define debugging_hook 1
-#else
-#define dprintf_hook while(0) fprintf
-#define debugging_hook 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_icon if(!debug_msg_enabled[34]) ; else fprintf
-#define debugging_icon debug_msg_enabled[34]
-#else
-#ifdef DEBUG_ICON
-#define dprintf_icon fprintf
-#define debugging_icon 1
-#else
-#define dprintf_icon while(0) fprintf
-#define debugging_icon 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_int if(!debug_msg_enabled[35]) ; else fprintf
-#define debugging_int debug_msg_enabled[35]
-#else
-#ifdef DEBUG_INT
-#define dprintf_int fprintf
-#define debugging_int 1
-#else
-#define dprintf_int while(0) fprintf
-#define debugging_int 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_key if(!debug_msg_enabled[36]) ; else fprintf
-#define debugging_key debug_msg_enabled[36]
-#else
-#ifdef DEBUG_KEY
-#define dprintf_key fprintf
-#define debugging_key 1
-#else
-#define dprintf_key while(0) fprintf
-#define debugging_key 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_keyboard if(!debug_msg_enabled[37]) ; else fprintf
-#define debugging_keyboard debug_msg_enabled[37]
-#else
-#ifdef DEBUG_KEYBOARD
-#define dprintf_keyboard fprintf
-#define debugging_keyboard 1
-#else
-#define dprintf_keyboard while(0) fprintf
-#define debugging_keyboard 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_ldt if(!debug_msg_enabled[38]) ; else fprintf
-#define debugging_ldt debug_msg_enabled[38]
-#else
-#ifdef DEBUG_LDT
-#define dprintf_ldt fprintf
-#define debugging_ldt 1
-#else
-#define dprintf_ldt while(0) fprintf
-#define debugging_ldt 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_listbox if(!debug_msg_enabled[39]) ; else fprintf
-#define debugging_listbox debug_msg_enabled[39]
-#else
-#ifdef DEBUG_LISTBOX
-#define dprintf_listbox fprintf
-#define debugging_listbox 1
-#else
-#define dprintf_listbox while(0) fprintf
-#define debugging_listbox 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_local if(!debug_msg_enabled[40]) ; else fprintf
-#define debugging_local debug_msg_enabled[40]
-#else
-#ifdef DEBUG_LOCAL
-#define dprintf_local fprintf
-#define debugging_local 1
-#else
-#define dprintf_local while(0) fprintf
-#define debugging_local 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_mci if(!debug_msg_enabled[41]) ; else fprintf
-#define debugging_mci debug_msg_enabled[41]
-#else
-#ifdef DEBUG_MCI
-#define dprintf_mci fprintf
-#define debugging_mci 1
-#else
-#define dprintf_mci while(0) fprintf
-#define debugging_mci 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_mcianim if(!debug_msg_enabled[42]) ; else fprintf
-#define debugging_mcianim debug_msg_enabled[42]
-#else
-#ifdef DEBUG_MCIANIM
-#define dprintf_mcianim fprintf
-#define debugging_mcianim 1
-#else
-#define dprintf_mcianim while(0) fprintf
-#define debugging_mcianim 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_mciwave if(!debug_msg_enabled[43]) ; else fprintf
-#define debugging_mciwave debug_msg_enabled[43]
-#else
-#ifdef DEBUG_MCIWAVE
-#define dprintf_mciwave fprintf
-#define debugging_mciwave 1
-#else
-#define dprintf_mciwave while(0) fprintf
-#define debugging_mciwave 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_mdi if(!debug_msg_enabled[44]) ; else fprintf
-#define debugging_mdi debug_msg_enabled[44]
-#else
-#ifdef DEBUG_MDI
-#define dprintf_mdi fprintf
-#define debugging_mdi 1
-#else
-#define dprintf_mdi while(0) fprintf
-#define debugging_mdi 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_menu if(!debug_msg_enabled[45]) ; else fprintf
-#define debugging_menu debug_msg_enabled[45]
-#else
-#ifdef DEBUG_MENU
-#define dprintf_menu fprintf
-#define debugging_menu 1
-#else
-#define dprintf_menu while(0) fprintf
-#define debugging_menu 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_message if(!debug_msg_enabled[46]) ; else fprintf
-#define debugging_message debug_msg_enabled[46]
-#else
-#ifdef DEBUG_MESSAGE
-#define dprintf_message fprintf
-#define debugging_message 1
-#else
-#define dprintf_message while(0) fprintf
-#define debugging_message 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_metafile if(!debug_msg_enabled[47]) ; else fprintf
-#define debugging_metafile debug_msg_enabled[47]
-#else
-#ifdef DEBUG_METAFILE
-#define dprintf_metafile fprintf
-#define debugging_metafile 1
-#else
-#define dprintf_metafile while(0) fprintf
-#define debugging_metafile 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_midi if(!debug_msg_enabled[48]) ; else fprintf
-#define debugging_midi debug_msg_enabled[48]
-#else
-#ifdef DEBUG_MIDI
-#define dprintf_midi fprintf
-#define debugging_midi 1
-#else
-#define dprintf_midi while(0) fprintf
-#define debugging_midi 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_mmaux if(!debug_msg_enabled[49]) ; else fprintf
-#define debugging_mmaux debug_msg_enabled[49]
-#else
-#ifdef DEBUG_MMAUX
-#define dprintf_mmaux fprintf
-#define debugging_mmaux 1
-#else
-#define dprintf_mmaux while(0) fprintf
-#define debugging_mmaux 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_mmio if(!debug_msg_enabled[50]) ; else fprintf
-#define debugging_mmio debug_msg_enabled[50]
-#else
-#ifdef DEBUG_MMIO
-#define dprintf_mmio fprintf
-#define debugging_mmio 1
-#else
-#define dprintf_mmio while(0) fprintf
-#define debugging_mmio 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_mmsys if(!debug_msg_enabled[51]) ; else fprintf
-#define debugging_mmsys debug_msg_enabled[51]
-#else
-#ifdef DEBUG_MMSYS
-#define dprintf_mmsys fprintf
-#define debugging_mmsys 1
-#else
-#define dprintf_mmsys while(0) fprintf
-#define debugging_mmsys 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_mmtime if(!debug_msg_enabled[52]) ; else fprintf
-#define debugging_mmtime debug_msg_enabled[52]
-#else
-#ifdef DEBUG_MMTIME
-#define dprintf_mmtime fprintf
-#define debugging_mmtime 1
-#else
-#define dprintf_mmtime while(0) fprintf
-#define debugging_mmtime 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_module if(!debug_msg_enabled[53]) ; else fprintf
-#define debugging_module debug_msg_enabled[53]
-#else
-#ifdef DEBUG_MODULE
-#define dprintf_module fprintf
-#define debugging_module 1
-#else
-#define dprintf_module while(0) fprintf
-#define debugging_module 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_msg if(!debug_msg_enabled[54]) ; else fprintf
-#define debugging_msg debug_msg_enabled[54]
-#else
-#ifdef DEBUG_MSG
-#define dprintf_msg fprintf
-#define debugging_msg 1
-#else
-#define dprintf_msg while(0) fprintf
-#define debugging_msg 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_nonclient if(!debug_msg_enabled[55]) ; else fprintf
-#define debugging_nonclient debug_msg_enabled[55]
-#else
-#ifdef DEBUG_NONCLIENT
-#define dprintf_nonclient fprintf
-#define debugging_nonclient 1
-#else
-#define dprintf_nonclient while(0) fprintf
-#define debugging_nonclient 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_ole if(!debug_msg_enabled[56]) ; else fprintf
-#define debugging_ole debug_msg_enabled[56]
-#else
-#ifdef DEBUG_OLE
-#define dprintf_ole fprintf
-#define debugging_ole 1
-#else
-#define dprintf_ole while(0) fprintf
-#define debugging_ole 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_palette if(!debug_msg_enabled[57]) ; else fprintf
-#define debugging_palette debug_msg_enabled[57]
-#else
-#ifdef DEBUG_PALETTE
-#define dprintf_palette fprintf
-#define debugging_palette 1
-#else
-#define dprintf_palette while(0) fprintf
-#define debugging_palette 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_profile if(!debug_msg_enabled[58]) ; else fprintf
-#define debugging_profile debug_msg_enabled[58]
-#else
-#ifdef DEBUG_PROFILE
-#define dprintf_profile fprintf
-#define debugging_profile 1
-#else
-#define dprintf_profile while(0) fprintf
-#define debugging_profile 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_progress if(!debug_msg_enabled[59]) ; else fprintf
-#define debugging_progress debug_msg_enabled[59]
-#else
-#ifdef DEBUG_PROGRESS
-#define dprintf_progress fprintf
-#define debugging_progress 1
-#else
-#define dprintf_progress while(0) fprintf
-#define debugging_progress 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_prop if(!debug_msg_enabled[60]) ; else fprintf
-#define debugging_prop debug_msg_enabled[60]
-#else
-#ifdef DEBUG_PROP
-#define dprintf_prop fprintf
-#define debugging_prop 1
-#else
-#define dprintf_prop while(0) fprintf
-#define debugging_prop 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_reg if(!debug_msg_enabled[61]) ; else fprintf
-#define debugging_reg debug_msg_enabled[61]
-#else
-#ifdef DEBUG_REG
-#define dprintf_reg fprintf
-#define debugging_reg 1
-#else
-#define dprintf_reg while(0) fprintf
-#define debugging_reg 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_region if(!debug_msg_enabled[62]) ; else fprintf
-#define debugging_region debug_msg_enabled[62]
-#else
-#ifdef DEBUG_REGION
-#define dprintf_region fprintf
-#define debugging_region 1
-#else
-#define dprintf_region while(0) fprintf
-#define debugging_region 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_relay if(!debug_msg_enabled[63]) ; else fprintf
-#define debugging_relay debug_msg_enabled[63]
-#else
-#ifdef DEBUG_RELAY
-#define dprintf_relay fprintf
-#define debugging_relay 1
-#else
-#define dprintf_relay while(0) fprintf
-#define debugging_relay 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_resource if(!debug_msg_enabled[64]) ; else fprintf
-#define debugging_resource debug_msg_enabled[64]
-#else
-#ifdef DEBUG_RESOURCE
-#define dprintf_resource fprintf
-#define debugging_resource 1
-#else
-#define dprintf_resource while(0) fprintf
-#define debugging_resource 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_scroll if(!debug_msg_enabled[65]) ; else fprintf
-#define debugging_scroll debug_msg_enabled[65]
-#else
-#ifdef DEBUG_SCROLL
-#define dprintf_scroll fprintf
-#define debugging_scroll 1
-#else
-#define dprintf_scroll while(0) fprintf
-#define debugging_scroll 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_selector if(!debug_msg_enabled[66]) ; else fprintf
-#define debugging_selector debug_msg_enabled[66]
-#else
-#ifdef DEBUG_SELECTOR
-#define dprintf_selector fprintf
-#define debugging_selector 1
-#else
-#define dprintf_selector while(0) fprintf
-#define debugging_selector 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_sem if(!debug_msg_enabled[67]) ; else fprintf
-#define debugging_sem debug_msg_enabled[67]
-#else
-#ifdef DEBUG_SEM
-#define dprintf_sem fprintf
-#define debugging_sem 1
-#else
-#define dprintf_sem while(0) fprintf
-#define debugging_sem 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_sendmsg if(!debug_msg_enabled[68]) ; else fprintf
-#define debugging_sendmsg debug_msg_enabled[68]
-#else
-#ifdef DEBUG_SENDMSG
-#define dprintf_sendmsg fprintf
-#define debugging_sendmsg 1
-#else
-#define dprintf_sendmsg while(0) fprintf
-#define debugging_sendmsg 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_shm if(!debug_msg_enabled[69]) ; else fprintf
-#define debugging_shm debug_msg_enabled[69]
-#else
-#ifdef DEBUG_SHM
-#define dprintf_shm fprintf
-#define debugging_shm 1
-#else
-#define dprintf_shm while(0) fprintf
-#define debugging_shm 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_stress if(!debug_msg_enabled[70]) ; else fprintf
-#define debugging_stress debug_msg_enabled[70]
-#else
-#ifdef DEBUG_STRESS
-#define dprintf_stress fprintf
-#define debugging_stress 1
-#else
-#define dprintf_stress while(0) fprintf
-#define debugging_stress 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_string if(!debug_msg_enabled[71]) ; else fprintf
-#define debugging_string debug_msg_enabled[71]
-#else
-#ifdef DEBUG_STRING
-#define dprintf_string fprintf
-#define debugging_string 1
-#else
-#define dprintf_string while(0) fprintf
-#define debugging_string 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_task if(!debug_msg_enabled[72]) ; else fprintf
-#define debugging_task debug_msg_enabled[72]
-#else
-#ifdef DEBUG_TASK
-#define dprintf_task fprintf
-#define debugging_task 1
-#else
-#define dprintf_task while(0) fprintf
-#define debugging_task 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_text if(!debug_msg_enabled[73]) ; else fprintf
-#define debugging_text debug_msg_enabled[73]
-#else
-#ifdef DEBUG_TEXT
-#define dprintf_text fprintf
-#define debugging_text 1
-#else
-#define dprintf_text while(0) fprintf
-#define debugging_text 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_thunk if(!debug_msg_enabled[74]) ; else fprintf
-#define debugging_thunk debug_msg_enabled[74]
-#else
-#ifdef DEBUG_THUNK
-#define dprintf_thunk fprintf
-#define debugging_thunk 1
-#else
-#define dprintf_thunk while(0) fprintf
-#define debugging_thunk 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_timer if(!debug_msg_enabled[75]) ; else fprintf
-#define debugging_timer debug_msg_enabled[75]
-#else
-#ifdef DEBUG_TIMER
-#define dprintf_timer fprintf
-#define debugging_timer 1
-#else
-#define dprintf_timer while(0) fprintf
-#define debugging_timer 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_toolhelp if(!debug_msg_enabled[76]) ; else fprintf
-#define debugging_toolhelp debug_msg_enabled[76]
-#else
-#ifdef DEBUG_TOOLHELP
-#define dprintf_toolhelp fprintf
-#define debugging_toolhelp 1
-#else
-#define dprintf_toolhelp while(0) fprintf
-#define debugging_toolhelp 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_tweak if(!debug_msg_enabled[77]) ; else fprintf
-#define debugging_tweak debug_msg_enabled[77]
-#else
-#ifdef DEBUG_TWEAK
-#define dprintf_tweak fprintf
-#define debugging_tweak 1
-#else
-#define dprintf_tweak while(0) fprintf
-#define debugging_tweak 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_updown if(!debug_msg_enabled[78]) ; else fprintf
-#define debugging_updown debug_msg_enabled[78]
-#else
-#ifdef DEBUG_UPDOWN
-#define dprintf_updown fprintf
-#define debugging_updown 1
-#else
-#define dprintf_updown while(0) fprintf
-#define debugging_updown 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_ver if(!debug_msg_enabled[79]) ; else fprintf
-#define debugging_ver debug_msg_enabled[79]
-#else
-#ifdef DEBUG_VER
-#define dprintf_ver fprintf
-#define debugging_ver 1
-#else
-#define dprintf_ver while(0) fprintf
-#define debugging_ver 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_virtual if(!debug_msg_enabled[80]) ; else fprintf
-#define debugging_virtual debug_msg_enabled[80]
-#else
-#ifdef DEBUG_VIRTUAL
-#define dprintf_virtual fprintf
-#define debugging_virtual 1
-#else
-#define dprintf_virtual while(0) fprintf
-#define debugging_virtual 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_vxd if(!debug_msg_enabled[81]) ; else fprintf
-#define debugging_vxd debug_msg_enabled[81]
-#else
-#ifdef DEBUG_VXD
-#define dprintf_vxd fprintf
-#define debugging_vxd 1
-#else
-#define dprintf_vxd while(0) fprintf
-#define debugging_vxd 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_win if(!debug_msg_enabled[82]) ; else fprintf
-#define debugging_win debug_msg_enabled[82]
-#else
-#ifdef DEBUG_WIN
-#define dprintf_win fprintf
-#define debugging_win 1
-#else
-#define dprintf_win while(0) fprintf
-#define debugging_win 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_win16drv if(!debug_msg_enabled[83]) ; else fprintf
-#define debugging_win16drv debug_msg_enabled[83]
-#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[84]) ; else fprintf
-#define debugging_win32 debug_msg_enabled[84]
-#else
-#ifdef DEBUG_WIN32
-#define dprintf_win32 fprintf
-#define debugging_win32 1
-#else
-#define dprintf_win32 while(0) fprintf
-#define debugging_win32 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_winsock if(!debug_msg_enabled[85]) ; else fprintf
-#define debugging_winsock debug_msg_enabled[85]
-#else
-#ifdef DEBUG_WINSOCK
-#define dprintf_winsock fprintf
-#define debugging_winsock 1
-#else
-#define dprintf_winsock while(0) fprintf
-#define debugging_winsock 0
-#endif
-#endif
-
-#ifdef DEBUG_RUNTIME
-#define dprintf_x11 if(!debug_msg_enabled[86]) ; else fprintf
-#define debugging_x11 debug_msg_enabled[86]
-#else
-#ifdef DEBUG_X11
-#define dprintf_x11 fprintf
-#define debugging_x11 1
-#else
-#define dprintf_x11 while(0) fprintf
-#define debugging_x11 0
-#endif
-#endif
-
-
-#ifdef DEBUG_RUNTIME
-#ifdef DEBUG_DEFINE_VARIABLES
-static char *debug_msg_name[] = {
-    "accel",
-    "aspi",
-    "atom",
-    "bitblt",
-    "bitmap",
-    "caret",
-    "cdaudio",
-    "class",
-    "clipboard",
-    "clipping",
-    "combo",
-    "comm",
-    "commdlg",
-    "crtdll",
-    "cursor",
-    "dc",
-    "dde",
-    "ddraw",
-    "dialog",
-    "dll",
-    "dosfs",
-    "driver",
-    "dsound",
-    "edit",
-    "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",
-    "mmaux",
-    "mmio",
-    "mmsys",
-    "mmtime",
-    "module",
-    "msg",
-    "nonclient",
-    "ole",
-    "palette",
-    "profile",
-    "progress",
-    "prop",
-    "reg",
-    "region",
-    "relay",
-    "resource",
-    "scroll",
-    "selector",
-    "sem",
-    "sendmsg",
-    "shm",
-    "stress",
-    "string",
-    "task",
-    "text",
-    "thunk",
-    "timer",
-    "toolhelp",
-    "tweak",
-    "updown",
-    "ver",
-    "virtual",
-    "vxd",
-    "win",
-    "win16drv",
-    "win32",
-    "winsock",
-    "x11",
-    ""
-};
-#endif
-#endif
+#define dbch_accel 0
+#define dbch_aspi 1
+#define dbch_atom 2
+#define dbch_bitblt 3
+#define dbch_bitmap 4
+#define dbch_caret 5
+#define dbch_cdaudio 6
+#define dbch_class 7
+#define dbch_clipboard 8
+#define dbch_clipping 9
+#define dbch_combo 10
+#define dbch_comm 11
+#define dbch_commdlg 12
+#define dbch_console 13
+#define dbch_crtdll 14
+#define dbch_cursor 15
+#define dbch_dc 16
+#define dbch_dde 17
+#define dbch_ddraw 18
+#define dbch_dialog 19
+#define dbch_dll 20
+#define dbch_dosfs 21
+#define dbch_driver 22
+#define dbch_dsound 23
+#define dbch_edit 24
+#define dbch_event 25
+#define dbch_exec 26
+#define dbch_file 27
+#define dbch_fixup 28
+#define dbch_font 29
+#define dbch_gdi 30
+#define dbch_global 31
+#define dbch_graphics 32
+#define dbch_heap 33
+#define dbch_hook 34
+#define dbch_icon 35
+#define dbch_int 36
+#define dbch_key 37
+#define dbch_keyboard 38
+#define dbch_ldt 39
+#define dbch_listbox 40
+#define dbch_local 41
+#define dbch_mci 42
+#define dbch_mcianim 43
+#define dbch_mciwave 44
+#define dbch_mdi 45
+#define dbch_menu 46
+#define dbch_message 47
+#define dbch_metafile 48
+#define dbch_midi 49
+#define dbch_mmaux 50
+#define dbch_mmio 51
+#define dbch_mmsys 52
+#define dbch_mmtime 53
+#define dbch_module 54
+#define dbch_msg 55
+#define dbch_nonclient 56
+#define dbch_ole 57
+#define dbch_palette 58
+#define dbch_profile 59
+#define dbch_progress 60
+#define dbch_prop 61
+#define dbch_reg 62
+#define dbch_region 63
+#define dbch_relay 64
+#define dbch_resource 65
+#define dbch_scroll 66
+#define dbch_selector 67
+#define dbch_sem 68
+#define dbch_sendmsg 69
+#define dbch_shm 70
+#define dbch_stddeb 71
+#define dbch_stress 72
+#define dbch_string 73
+#define dbch_task 74
+#define dbch_text 75
+#define dbch_thunk 76
+#define dbch_timer 77
+#define dbch_toolhelp 78
+#define dbch_tweak 79
+#define dbch_updown 80
+#define dbch_ver 81
+#define dbch_virtual 82
+#define dbch_vxd 83
+#define dbch_win 84
+#define dbch_win16drv 85
+#define dbch_win32 86
+#define dbch_winsock 87
+#define dbch_x11 88
diff --git a/include/debugdefs.h b/include/debugdefs.h
new file mode 100644
index 0000000..efa6371
--- /dev/null
+++ b/include/debugdefs.h
@@ -0,0 +1,197 @@
+/* Do not modify this file -- it is automatically generated! */
+
+#ifndef __DEBUGTOOLS_H
+#include "debugtools.h"
+#endif
+
+#define DEBUG_CHANNEL_COUNT 89
+#ifdef DEBUG_RUNTIME
+short debug_msg_enabled[][DEBUG_CLASS_COUNT] = {
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+{1, 1, 0, 0},
+};
+const char* debug_ch_name[] = {
+"accel",
+"aspi",
+"atom",
+"bitblt",
+"bitmap",
+"caret",
+"cdaudio",
+"class",
+"clipboard",
+"clipping",
+"combo",
+"comm",
+"commdlg",
+"console",
+"crtdll",
+"cursor",
+"dc",
+"dde",
+"ddraw",
+"dialog",
+"dll",
+"dosfs",
+"driver",
+"dsound",
+"edit",
+"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",
+"mmaux",
+"mmio",
+"mmsys",
+"mmtime",
+"module",
+"msg",
+"nonclient",
+"ole",
+"palette",
+"profile",
+"progress",
+"prop",
+"reg",
+"region",
+"relay",
+"resource",
+"scroll",
+"selector",
+"sem",
+"sendmsg",
+"shm",
+"stddeb",
+"stress",
+"string",
+"task",
+"text",
+"thunk",
+"timer",
+"toolhelp",
+"tweak",
+"updown",
+"ver",
+"virtual",
+"vxd",
+"win",
+"win16drv",
+"win32",
+"winsock",
+"x11",
+};
+
+const char* debug_cl_name[] =
+{ "fixme", "err", "warn", "info" };
+
+#endif /*DEBUG_RUNTIME*/
+
+/* end of automatically generated debug.h */
diff --git a/include/debugstr.h b/include/debugstr.h
index 20ac865..7bb3996 100644
--- a/include/debugstr.h
+++ b/include/debugstr.h
@@ -11,5 +11,8 @@
 LPSTR debugstr_a (LPCSTR s);
 LPSTR debugstr_wn (LPCWSTR s, int n);
 LPSTR debugstr_w (LPCWSTR s);
+LPSTR debugres (const void *res);
 
 #endif /* __WINE_DEBUGSTR_H */
+
+
diff --git a/include/debugtools.h b/include/debugtools.h
new file mode 100644
index 0000000..393dd25
--- /dev/null
+++ b/include/debugtools.h
@@ -0,0 +1,66 @@
+
+#ifndef __DEBUGTOOLS_H
+#define __DEBUGTOOLS_H
+
+#include <stdio.h>
+
+#define DEBUG_RUNTIME
+#define stddeb  stdout
+#define stdnimp stdout
+
+#define DEBUG_CLASS_COUNT 4
+
+extern short debug_msg_enabled[][DEBUG_CLASS_COUNT];
+extern const char* debug_ch_name[];
+extern const char* debug_cl_name[];
+
+#define dbg_str(name) debug_str_##name
+#define dbg_buf(name) debug_buf_##name
+
+#define dbg_decl_str(name, size) \
+  char dbg_str(name)[size], *dbg_buf(name)=dbg_str(name)
+
+#define dbg_reset_str(name) \
+  dbg_buf(name)=dbg_str(name)
+
+#define dsprintf(name, format, args...) \
+  dbg_buf(name)+=sprintf(dbg_buf(name), format, ## args)
+
+#define dbg_ch_index(ch) (dbch_##ch)
+#define dbg_cl_index(cl) (dbcl_##cl)
+
+#define debugging_(cl, ch) \
+  (dbg_ch_index(ch) >=0 && dbg_cl_index(cl) >= 0 && \
+   debug_msg_enabled[dbg_ch_index(ch)][dbg_cl_index(cl)])
+
+#define dprintf(format, args...) \
+  fprintf(stddeb, format, ## args)
+
+#define dprintf_(cl, ch, format, args...) \
+            if(!debugging_(cl, ch)) ; \
+            else dprintf("%s:%s:%s:%d:%s: "format, \
+                         debug_cl_name[dbg_cl_index(cl)], \
+                         debug_ch_name[dbg_ch_index(ch)], \
+	                 __FILE__, __LINE__, __FUNCTION__ , ## args)
+
+
+
+#define debugging_fixme(ch) debugging_(fixme, ch)
+#define debugging_err(ch) debugging_(err, ch)
+#define debugging_warn(ch) debugging_(warn, ch)
+#define debugging_info(ch) debugging_(info, ch)
+
+#define dprintf_fixme(ch, format, args...) dprintf_(fixme, ch, format, ## args)
+#define dprintf_err(ch, format, args...) dprintf_(err, ch, format, ## args)
+#define dprintf_warn(ch, format, args...) dprintf_(warn, ch, format, ## args)
+#define dprintf_info(ch, format, args...) dprintf_(info, ch, format, ## args)
+
+#define dbcl_fixme 0
+#define dbcl_err   1
+#define dbcl_warn  2
+#define dbcl_info  3
+
+#endif
+
+
+
diff --git a/include/dinput.h b/include/dinput.h
index 563c7e1..d103e7b 100644
--- a/include/dinput.h
+++ b/include/dinput.h
@@ -58,6 +58,63 @@
 
 typedef struct IDirectInput32A IDirectInput32A,*LPDIRECTINPUT32A;
 typedef struct IDirectInputDevice32A IDirectInputDevice32A,*LPDIRECTINPUTDEVICE32A;
+typedef struct SysKeyboard32A SysKeyboard32A,*LPSYSKEYBOARD32A;
+
+#define DI_OK                           S_OK
+#define DI_NOTATTACHED                  S_FALSE
+#define DI_BUFFEROVERFLOW               S_FALSE
+#define DI_PROPNOEFFECT                 S_FALSE
+#define DI_NOEFFECT                     S_FALSE
+#define DI_POLLEDDEVICE                 ((HRESULT)0x00000002L)
+#define DI_DOWNLOADSKIPPED              ((HRESULT)0x00000003L)
+#define DI_EFFECTRESTARTED              ((HRESULT)0x00000004L)
+#define DI_TRUNCATED                    ((HRESULT)0x00000008L)
+#define DI_TRUNCATEDANDRESTARTED        ((HRESULT)0x0000000CL)
+
+#define DIERR_OLDDIRECTINPUTVERSION     \
+    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_OLD_WIN_VERSION)
+#define DIERR_BETADIRECTINPUTVERSION    \
+    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_RMODE_APP)
+#define DIERR_BADDRIVERVER              \
+    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_BAD_DRIVER_LEVEL)
+#define DIERR_DEVICENOTREG              REGDB_E_CLASSNOTREG
+#define DIERR_NOTFOUND                  \
+    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_FILE_NOT_FOUND)
+#define DIERR_OBJECTNOTFOUND            \
+    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_FILE_NOT_FOUND)
+#define DIERR_INVALIDPARAM              E_INVALIDARG
+#define DIERR_NOINTERFACE               E_NOINTERFACE
+#define DIERR_GENERIC                   E_FAIL
+#define DIERR_OUTOFMEMORY               E_OUTOFMEMORY
+#define DIERR_UNSUPPORTED               E_NOTIMPL
+#define DIERR_NOTINITIALIZED            \
+    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_READY)
+#define DIERR_ALREADYINITIALIZED        \
+    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_ALREADY_INITIALIZED)
+#define DIERR_NOAGGREGATION             CLASS_E_NOAGGREGATION
+#define DIERR_OTHERAPPHASPRIO           E_ACCESSDENIED
+#define DIERR_INPUTLOST                 \
+    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_READ_FAULT)
+#define DIERR_ACQUIRED                  \
+    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_BUSY)
+#define DIERR_NOTACQUIRED               \
+    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_INVALID_ACCESS)
+#define DIERR_READONLY                  E_ACCESSDENIED
+#define DIERR_HANDLEEXISTS              E_ACCESSDENIED
+#ifndef E_PENDING
+#define E_PENDING                       0x8000000AL
+#endif
+#define DIERR_INSUFFICIENTPRIVS         0x80040200L
+#define DIERR_DEVICEFULL                0x80040201L
+#define DIERR_MOREDATA                  0x80040202L
+#define DIERR_NOTDOWNLOADED             0x80040203L
+#define DIERR_HASEFFECTS                0x80040204L
+#define DIERR_NOTEXCLUSIVEACQUIRED      0x80040205L
+#define DIERR_INCOMPLETEEFFECT          0x80040206L
+#define DIERR_NOTBUFFERED               0x80040207L
+#define DIERR_EFFECTPLAYING             0x80040208L
+#define DIERR_UNPLUGGED                 0x80040209L
+#define DIERR_REPORTFULL                0x8004020AL
 
 typedef struct {
     DWORD	dwSize;
@@ -303,6 +360,8 @@
 #define DIDF_ABSAXIS		0x00000001
 #define DIDF_RELAXIS		0x00000002
 
+#define DIGDD_PEEK		0x00000001
+
 typedef struct {
     DWORD	dwOfs;
     DWORD	dwData;
@@ -338,6 +397,66 @@
 #define DIPH_BYID	2
 #define DIPH_BYUSAGE	3
 
+#define DIMAKEUSAGEDWORD(UsagePage, Usage) (DWORD)MAKELONG(Usage, UsagePage)
+
+typedef struct DIPROPDWORD {
+	DIPROPHEADER	diph;
+	DWORD		dwData;
+} DIPROPDWORD, *LPDIPROPDWORD;
+typedef const DIPROPDWORD *LPCDIPROPDWORD;
+
+typedef struct DIPROPRANGE {
+	DIPROPHEADER	diph;
+	LONG		lMin;
+	LONG		lMax;
+} DIPROPRANGE, *LPDIPROPRANGE;
+typedef const DIPROPRANGE *LPCDIPROPRANGE;
+
+#define DIPROPRANGE_NOMIN	((LONG)0x80000000)
+#define DIPROPRANGE_NOMAX	((LONG)0x7FFFFFFF)
+
+typedef struct DIPROPCAL {
+	DIPROPHEADER diph;
+	LONG    lMin;
+	LONG    lCenter;
+	LONG    lMax;
+} DIPROPCAL, *LPDIPROPCAL;
+typedef const DIPROPCAL *LPCDIPROPCAL;
+
+typedef struct DIPROPGUIDANDPATH {
+	DIPROPHEADER diph;
+	GUID    guidClass;
+	WCHAR   wszPath[MAX_PATH];
+} DIPROPGUIDANDPATH, *LPDIPROPGUIDANDPATH,*LPCDIPROPGUIDANDPATH;
+
+/* special property GUIDs */
+#define MAKEDIPROP(prop)	((REFGUID)(prop))
+#define DIPROP_BUFFERSIZE	MAKEDIPROP(1)
+#define DIPROP_AXISMODE		MAKEDIPROP(2)
+
+#define DIPROPAXISMODE_ABS	0
+#define DIPROPAXISMODE_REL	1
+
+#define DIPROP_GRANULARITY	MAKEDIPROP(3)
+#define DIPROP_RANGE		MAKEDIPROP(4)
+#define DIPROP_DEADZONE		MAKEDIPROP(5)
+#define DIPROP_SATURATION	MAKEDIPROP(6)
+#define DIPROP_FFGAIN		MAKEDIPROP(7)
+#define DIPROP_FFLOAD		MAKEDIPROP(8)
+#define DIPROP_AUTOCENTER	MAKEDIPROP(9)
+
+#define DIPROPAUTOCENTER_OFF	0
+#define DIPROPAUTOCENTER_ON	1
+
+#define DIPROP_CALIBRATIONMODE	MAKEDIPROP(10)
+
+#define DIPROPCALIBRATIONMODE_COOKED	0
+#define DIPROPCALIBRATIONMODE_RAW	1
+
+#define DIPROP_CALIBRATION	MAKEDIPROP(11)
+#define DIPROP_GUIDANDPATH	MAKEDIPROP(12)
+
+
 typedef struct DIDEVCAPS {
     DWORD	dwSize;
     DWORD	dwFlags;
@@ -402,6 +521,13 @@
 	DWORD				ref;
 	GUID				guid;
 };
+
+struct SysKeyboard32A {
+	LPDIRECTINPUTDEVICEA_VTABLE	lpvtbl;
+	DWORD				ref;
+	GUID				guid;
+	BYTE				keystate[256];
+};
 #undef THIS
 
 #define THIS LPDIRECTINPUT32A this
diff --git a/include/dsound.h b/include/dsound.h
index 013f035..081696b 100644
--- a/include/dsound.h
+++ b/include/dsound.h
@@ -225,6 +225,7 @@
 	DSBUFFERDESC			dsbd;
 	LPDSBPOSITIONNOTIFY		notifies;
 	int				nrofnotifies;
+	double				volfac;
 };
 #undef THIS
 
diff --git a/include/file.h b/include/file.h
index de43e1b..7b9c6e4 100644
--- a/include/file.h
+++ b/include/file.h
@@ -41,6 +41,7 @@
 extern HFILE32 FILE_Dup( HFILE32 hFile );
 extern HFILE32 FILE_Dup2( HFILE32 hFile1, HFILE32 hFile2 );
 extern HFILE32 FILE_Open( LPCSTR path, INT32 mode );
+extern HFILE32 FILE_OpenUnixFile( LPCSTR path, INT32 mode );
 extern BOOL32 FILE_SetFileType( HFILE32 hFile, DWORD type );
 extern LPVOID FILE_mmap( HFILE32 hFile, LPVOID start,
                          DWORD size_high, DWORD size_low,
@@ -68,7 +69,8 @@
                                       DWORD remainder );
 extern time_t DOSFS_FileTimeToUnixTime( const FILETIME *ft, DWORD *remainder );
 extern BOOL32 DOSFS_ToDosFCBFormat( LPCSTR name, LPSTR buffer );
-extern const char *DOSFS_IsDevice( const char *name );
+extern BOOL32 DOSFS_IsDevice( const char *name );
+extern HFILE32 DOSFS_OpenDevice( const char *name, INT32 mode );
 extern BOOL32 DOSFS_FindUnixName( LPCSTR path, LPCSTR name, LPSTR long_buf,
                                   INT32 long_len, LPSTR short_buf,
                                   BOOL32 ignore_case );
diff --git a/include/interfaces.h b/include/interfaces.h
index ef70a22..e8f2993 100644
--- a/include/interfaces.h
+++ b/include/interfaces.h
@@ -54,8 +54,8 @@
 };
 #undef THIS
 
-#define THIS LPMALLOC this
-typedef struct IMalloc *LPMALLOC,IMalloc;
+#define THIS LPMALLOC32 this
+typedef struct IMalloc32 *LPMALLOC32,IMalloc32;
 typedef struct {
 	STDMETHOD(QueryInterface) (THIS_ REFIID riid,LPVOID FAR* ppvObj) PURE;
 	STDMETHOD_(ULONG,AddRef) (THIS) PURE;
@@ -65,20 +65,46 @@
 	STDMETHOD_(LPVOID,Realloc) ( THIS_ LPVOID pv,DWORD cb);
 	STDMETHOD_(VOID,Free) ( THIS_ LPVOID pv);
 	STDMETHOD_(DWORD,GetSize) ( THIS_ LPVOID pv);
-	STDMETHOD_(LPINT32,DidAlloc) ( THIS_ LPVOID pv);
+	STDMETHOD_(INT32,DidAlloc) ( THIS_ LPVOID pv);
 	STDMETHOD_(LPVOID,HeapMinimize) ( THIS );
-} *LPMALLOC_VTABLE,IMalloc_VTable;
+} *LPMALLOC32_VTABLE,IMalloc32_VTable;
 
-struct IMalloc {
-	LPMALLOC_VTABLE lpvtbl;
-	DWORD		ref;
+struct IMalloc32 {
+	LPMALLOC32_VTABLE	lpvtbl;
+	DWORD			ref;
+};
+#undef THIS
+
+#define THIS LPMALLOC16 this
+typedef struct IMalloc16 *LPMALLOC16,IMalloc16;
+typedef struct {
+	STDMETHOD(QueryInterface) (THIS_ REFIID riid,LPVOID FAR* ppvObj) PURE;
+	STDMETHOD_(ULONG,AddRef) (THIS) PURE;
+	STDMETHOD_(ULONG,Release) (THIS) PURE;
+
+	STDMETHOD_(LPVOID,Alloc) ( THIS_ DWORD cb);
+	STDMETHOD_(LPVOID,Realloc) ( THIS_ LPVOID pv,DWORD cb);
+	STDMETHOD_(VOID,Free) ( THIS_ LPVOID pv);
+	STDMETHOD_(DWORD,GetSize) ( THIS_ LPVOID pv);
+	STDMETHOD_(INT16,DidAlloc) ( THIS_ LPVOID pv);
+	STDMETHOD_(LPVOID,HeapMinimize) ( THIS );
+} *LPMALLOC16_VTABLE,IMalloc16_VTable;
+
+struct IMalloc16 {
+	LPMALLOC16_VTABLE	lpvtbl;
+	DWORD			ref;
+	/* Gmm, I think one is not enough, we should probably manage a list of
+	 * heaps
+	 */
+	HGLOBAL16		heap;
 };
 #undef THIS
 
 /* private prototypes for the constructors */
 #ifdef __WINE__
 LPUNKNOWN	IUnknown_Constructor();
-LPMALLOC	IMalloc_Constructor();
+LPMALLOC16	IMalloc16_Constructor();
+LPMALLOC32	IMalloc32_Constructor();
 #endif
 
 #undef STDMETHOD
diff --git a/include/k32obj.h b/include/k32obj.h
index f117ce8..3e4dc28 100644
--- a/include/k32obj.h
+++ b/include/k32obj.h
@@ -8,6 +8,7 @@
 #define __WINE_K32OBJ_H
 
 #include "wintypes.h"
+#include "windows.h"
 
 /* Object types */
 typedef enum
@@ -47,6 +48,8 @@
     BOOL32 (*satisfied)(K32OBJ*,DWORD);   /* Wait on object is satisfied */
     void   (*add_wait)(K32OBJ*,DWORD);    /* Add thread to wait queue */
     void   (*remove_wait)(K32OBJ*,DWORD); /* Remove thread from wait queue */
+    BOOL32 (*read)(K32OBJ*,LPVOID,DWORD,LPDWORD,LPOVERLAPPED);
+    BOOL32 (*write)(K32OBJ*,LPCVOID,DWORD,LPDWORD,LPOVERLAPPED);
     void   (*destroy)(K32OBJ *);          /* Destroy object on refcount==0 */
 } K32OBJ_OPS;
 
diff --git a/include/mmsystem.h b/include/mmsystem.h
index 493b7ac..be29f5f 100644
--- a/include/mmsystem.h
+++ b/include/mmsystem.h
@@ -782,6 +782,7 @@
 #define JOYERR_NOCANDO        (JOYERR_BASE+6)      /* request not completed */
 #define JOYERR_UNPLUGGED      (JOYERR_BASE+7)      /* joystick is unplugged */
 
+/* JOYINFO, JOYINFOEX, MM_JOY* */
 #define JOY_BUTTON1         0x0001
 #define JOY_BUTTON2         0x0002
 #define JOY_BUTTON3         0x0004
@@ -794,6 +795,50 @@
 #define JOYSTICKID1         0
 #define JOYSTICKID2         1
 
+/* JOYCAPS.wCaps */
+#define JOYCAPS_HASZ		0x0001
+#define JOYCAPS_HASR		0x0002
+#define JOYCAPS_HASU		0x0004
+#define JOYCAPS_HASV		0x0008
+#define JOYCAPS_HASPOV		0x0010
+#define JOYCAPS_POV4DIR		0x0020
+#define JOYCAPS_POVCTS		0x0040
+
+/* JOYINFOEX stuff */
+#define JOY_POVCENTERED		(WORD) -1
+#define JOY_POVFORWARD		0
+#define JOY_POVRIGHT		9000
+#define JOY_POVBACKWARD		18000
+#define JOY_POVLEFT		27000
+
+#define JOY_RETURNX		0x00000001
+#define JOY_RETURNY		0x00000002
+#define JOY_RETURNZ		0x00000004
+#define JOY_RETURNR		0x00000008
+#define JOY_RETURNU		0x00000010
+#define JOY_RETURNV		0x00000020
+#define JOY_RETURNPOV		0x00000040
+#define JOY_RETURNBUTTONS	0x00000080
+#define JOY_RETURNRAWDATA	0x00000100
+#define JOY_RETURNPOVCTS	0x00000200
+#define JOY_RETURNCENTERED	0x00000400
+#define JOY_USEDEADZONE		0x00000800
+#define JOY_RETURNALL		(JOY_RETURNX | JOY_RETURNY | JOY_RETURNZ | \
+				 JOY_RETURNR | JOY_RETURNU | JOY_RETURNV | \
+				 JOY_RETURNPOV | JOY_RETURNBUTTONS)
+#define JOY_CAL_READALWAYS	0x00010000
+#define JOY_CAL_READXYONLY	0x00020000
+#define JOY_CAL_READ3		0x00040000
+#define JOY_CAL_READ4		0x00080000
+#define JOY_CAL_READXONLY	0x00100000
+#define JOY_CAL_READYONLY	0x00200000
+#define JOY_CAL_READ5		0x00400000
+#define JOY_CAL_READ6		0x00800000
+#define JOY_CAL_READZONLY	0x01000000
+#define JOY_CAL_READRONLY	0x02000000
+#define JOY_CAL_READUONLY	0x04000000
+#define JOY_CAL_READVONLY	0x08000000
+
 typedef struct {
     WORD wMid;                  /* manufacturer ID */
     WORD wPid;                  /* product ID */
@@ -892,6 +937,22 @@
     UINT32 wButtons;
 } JOYINFO32, *LPJOYINFO32;
 
+typedef struct {
+    DWORD	dwSize;		/* size of structure */
+    DWORD	dwFlags;	/* flags to indicate what to return */
+    DWORD	dwXpos;		/* x position */
+    DWORD	dwYpos;		/* y position */
+    DWORD	dwZpos;		/* z position */
+    DWORD	dwRpos;		/* rudder/4th axis position */
+    DWORD	dwUpos;		/* 5th axis position */
+    DWORD	dwVpos;		/* 6th axis position */
+    DWORD	dwButtons;	/* button states */
+    DWORD	dwButtonNumber;	/* current button number pressed */
+    DWORD	dwPOV;		/* point of view state */
+    DWORD	dwReserved1;	/* reserved for communication between winmm & driver */
+    DWORD	dwReserved2;	/* reserved for future expansion */
+} JOYINFOEX,*LPJOYINFOEX;
+
 DECL_WINELIB_TYPE(JOYINFO);
 DECL_WINELIB_TYPE(LPJOYINFO);
 
@@ -905,6 +966,7 @@
 MMRESULT16 WINAPI joyGetPos16(UINT16,LPJOYINFO16);
 MMRESULT32 WINAPI joyGetPos32(UINT32,LPJOYINFO32);
 #define joyGetPos WINELIB_NAME(joyGetPos)
+MMRESULT32 WINAPI joyGetPosEx(UINT32,LPJOYINFOEX);
 MMRESULT16 WINAPI joyGetThreshold16(UINT16,UINT16*);
 MMRESULT32 WINAPI joyGetThreshold32(UINT32,UINT32*);
 #define joyGetThreshold WINELIB_NAME(joyGetThreshold)
diff --git a/include/module.h b/include/module.h
index ea988db..e79aa47 100644
--- a/include/module.h
+++ b/include/module.h
@@ -91,6 +91,14 @@
     SEGPTR    reserved WINE_PACKED;
 } LOADPARAMS;
 
+typedef struct 
+{
+    LPSTR lpEnvAddress;
+    LPSTR lpCmdLine;
+    LPSTR lpCmdShow;
+    DWORD dwReserved;
+} LOADPARAMS32;
+
 #pragma pack(4)
 
 /* Resource types */
@@ -151,4 +159,7 @@
 extern HMODULE32 BUILTIN32_LoadModule( LPCSTR name, BOOL32 force,
                                        struct _PDB32 *process );
 
+/* if1632/builtin.c */
+extern HMODULE32 (*fnBUILTIN_LoadModule)(LPCSTR name, BOOL32 force);
+
 #endif  /* __WINE_MODULE_H */
diff --git a/include/ole.h b/include/ole.h
index 71c1659..cf05190 100644
--- a/include/ole.h
+++ b/include/ole.h
@@ -7,10 +7,19 @@
 
 #include "windows.h"
 
-typedef CHAR	OLE_CHAR,OLECHAR;
-typedef LPCSTR	OLE_LPCSTR;
-typedef LPSTR	LPOLESTR;
-typedef LPCSTR	LPCOLESTR;
+typedef CHAR	OLECHAR16;
+typedef LPSTR	LPOLESTR16;
+typedef LPCSTR	LPCOLESTR16;
+typedef WCHAR	OLECHAR32;
+typedef LPWSTR	LPOLESTR32;
+typedef LPCWSTR	LPCOLESTR32;
+DECL_WINELIB_TYPE(OLECHAR);
+DECL_WINELIB_TYPE(LPOLESTR);
+DECL_WINELIB_TYPE(LPCOLESTR);
+
+#define OLESTR16(x) x
+#define OLESTR32(x) L##x
+#define OLESTR WINELIB_NAME(OLESTR)
 
 typedef unsigned short VARTYPE;
 typedef LONG DISPID;
@@ -170,10 +179,10 @@
 typedef struct _OLESERVERDOCVTBL {
 	OLESTATUS	(CALLBACK *Save)(LPOLESERVERDOC);
 	OLESTATUS	(CALLBACK *Close)(LPOLESERVERDOC);
-	OLESTATUS	(CALLBACK *SetHostNames)(LPOLESERVERDOC,OLE_LPCSTR,OLE_LPCSTR);
+	OLESTATUS	(CALLBACK *SetHostNames)(LPOLESERVERDOC,LPCOLESTR16,LPCOLESTR16);
 	OLESTATUS	(CALLBACK *SetDocDimensions)(LPOLESERVERDOC,LPRECT16);
 #undef GetObject  /* FIXME */
-	OLESTATUS	(CALLBACK *GetObject)(LPOLESERVERDOC,OLE_LPCSTR,LPOLEOBJECT*,LPOLECLIENT);
+	OLESTATUS	(CALLBACK *GetObject)(LPOLESERVERDOC,LPCOLESTR16,LPOLEOBJECT*,LPOLECLIENT);
 	OLESTATUS	(CALLBACK *Release)(LPOLESERVERDOC);
 	OLESTATUS	(CALLBACK *SetColorScheme)(LPOLESERVERDOC,LPLOGPALETTE);
 	OLESTATUS	(CALLBACK *Execute)(LPOLESERVERDOC,HGLOBAL16);
@@ -186,10 +195,10 @@
 
 typedef struct _OLESERVER*	LPOLESERVER;
 typedef struct _OLESERVERVTBL {
-	OLESTATUS	(CALLBACK *Open)(LPOLESERVER,LHSERVERDOC,OLE_LPCSTR,LPOLESERVERDOC *);
-	OLESTATUS	(CALLBACK *Create)(LPOLESERVER,LHSERVERDOC,OLE_LPCSTR,OLE_LPCSTR,LPOLESERVERDOC*);
-	OLESTATUS	(CALLBACK *CreateFromTemplate)(LPOLESERVER,LHSERVERDOC,OLE_LPCSTR,OLE_LPCSTR,OLE_LPCSTR,LPOLESERVERDOC *);
-	OLESTATUS	(CALLBACK *Edit)(LPOLESERVER,LHSERVERDOC,OLE_LPCSTR,OLE_LPCSTR,LPOLESERVERDOC *);
+	OLESTATUS	(CALLBACK *Open)(LPOLESERVER,LHSERVERDOC,LPCOLESTR16,LPOLESERVERDOC *);
+	OLESTATUS	(CALLBACK *Create)(LPOLESERVER,LHSERVERDOC,LPCOLESTR16,LPCOLESTR16,LPOLESERVERDOC*);
+	OLESTATUS	(CALLBACK *CreateFromTemplate)(LPOLESERVER,LHSERVERDOC,LPCOLESTR16,LPCOLESTR16,LPCOLESTR16,LPOLESERVERDOC *);
+	OLESTATUS	(CALLBACK *Edit)(LPOLESERVER,LHSERVERDOC,LPCOLESTR16,LPCOLESTR16,LPOLESERVERDOC *);
 	OLESTATUS	(CALLBACK *Exit)(LPOLESERVER);
 	OLESTATUS	(CALLBACK *Release)(LPOLESERVER); 
 	OLESTATUS	(CALLBACK *Execute)(LPOLESERVER); 
@@ -210,7 +219,7 @@
 } OLECLIENT;
 
 typedef struct _OLEOBJECTVTBL {
-        void *  	(CALLBACK *QueryProtocol)(LPOLEOBJECT,OLE_LPCSTR);
+        void *  	(CALLBACK *QueryProtocol)(LPOLEOBJECT,LPCOLESTR16);
 	OLESTATUS	(CALLBACK *Release)(LPOLEOBJECT);
 	OLESTATUS	(CALLBACK *Show)(LPOLEOBJECT,BOOL16);
 	OLESTATUS	(CALLBACK *DoVerb)(LPOLEOBJECT,UINT16,BOOL16,BOOL16);
@@ -221,10 +230,10 @@
 	OLESTATUS	(CALLBACK *EnumFormats)(LPOLEOBJECT,OLECLIPFORMAT);
 	OLESTATUS	(CALLBACK *SetColorScheme)(LPOLEOBJECT,LPLOGPALETTE);
 	OLESTATUS	(CALLBACK *Delete)(LPOLEOBJECT);
-	OLESTATUS	(CALLBACK *SetHostNames)(LPOLEOBJECT,OLE_LPCSTR,OLE_LPCSTR);
+	OLESTATUS	(CALLBACK *SetHostNames)(LPOLEOBJECT,LPCOLESTR16,LPCOLESTR16);
 	OLESTATUS	(CALLBACK *SaveToStream)(LPOLEOBJECT,LPOLESTREAM);
-	OLESTATUS	(CALLBACK *Clone)(LPOLEOBJECT,LPOLECLIENT,LHCLIENTDOC,OLE_LPCSTR,LPOLEOBJECT *);
-	OLESTATUS	(CALLBACK *CopyFromLink)(LPOLEOBJECT,LPOLECLIENT,LHCLIENTDOC,OLE_LPCSTR,LPOLEOBJECT *);
+	OLESTATUS	(CALLBACK *Clone)(LPOLEOBJECT,LPOLECLIENT,LHCLIENTDOC,LPCOLESTR16,LPOLEOBJECT *);
+	OLESTATUS	(CALLBACK *CopyFromLink)(LPOLEOBJECT,LPOLECLIENT,LHCLIENTDOC,LPCOLESTR16,LPOLEOBJECT *);
 	OLESTATUS	(CALLBACK *Equal)(LPOLEOBJECT,LPOLEOBJECT);
 	OLESTATUS	(CALLBACK *CopyToClipBoard)(LPOLEOBJECT);
 	OLESTATUS	(CALLBACK *Draw)(LPOLEOBJECT,HDC16,LPRECT16,LPRECT16,HDC16);
@@ -233,10 +242,10 @@
 	OLESTATUS	(CALLBACK *Close)(LPOLEOBJECT);
 	OLESTATUS	(CALLBACK *Update)(LPOLEOBJECT);
 	OLESTATUS	(CALLBACK *Reconnect)(LPOLEOBJECT);
-	OLESTATUS	(CALLBACK *ObjectConvert)(LPOLEOBJECT,OLE_LPCSTR,LPOLECLIENT,LHCLIENTDOC,OLE_LPCSTR,LPOLEOBJECT*);
+	OLESTATUS	(CALLBACK *ObjectConvert)(LPOLEOBJECT,LPCOLESTR16,LPOLECLIENT,LHCLIENTDOC,LPCOLESTR16,LPOLEOBJECT*);
 	OLESTATUS	(CALLBACK *GetLinkUpdateOptions)(LPOLEOBJECT,LPOLEOPT_UPDATE);
 	OLESTATUS	(CALLBACK *SetLinkUpdateOptions)(LPOLEOBJECT,OLEOPT_UPDATE);
-	OLESTATUS	(CALLBACK *Rename)(LPOLEOBJECT,OLE_LPCSTR);
+	OLESTATUS	(CALLBACK *Rename)(LPOLEOBJECT,LPCOLESTR16);
 	OLESTATUS	(CALLBACK *QueryName)(LPOLEOBJECT,LPSTR,LPUINT16);
 	OLESTATUS	(CALLBACK *QueryType)(LPOLEOBJECT,LPLONG);
 	OLESTATUS	(CALLBACK *QueryBounds)(LPOLEOBJECT,LPRECT16);
@@ -279,12 +288,12 @@
 } CALLCONV;
 
 typedef struct tagPARAMDATA {
-    OLECHAR * szName;    /* parameter name */
+    OLECHAR16 * szName;    /* parameter name */
     VARTYPE vt;         /* parameter type */
 } PARAMDATA, * LPPARAMDATA;
 
 typedef struct tagMETHODDATA {
-    OLECHAR * szName;    /* method name */
+    OLECHAR16 * szName;    /* method name */
     PARAMDATA * ppdata;  /* pointer to an array of PARAMDATAs */
     DISPID dispid;      /* method ID */
     UINT16 iMeth;         /* method index */
diff --git a/include/process.h b/include/process.h
index dbce014..0323a98 100644
--- a/include/process.h
+++ b/include/process.h
@@ -115,5 +115,5 @@
 extern PDB32 *PROCESS_GetPtr( HANDLE32 handle, DWORD access );
 extern PDB32 *PROCESS_IdToPDB( DWORD id );
 extern PDB32 *PROCESS_Create( TDB *pTask, LPCSTR cmd_line );
-
+extern void PROCESS_CloseObjHandles(PDB32 *pdb, K32OBJ *ptr);
 #endif  /* __WINE_PROCESS_H */
diff --git a/include/shlobj.h b/include/shlobj.h
index 35b23cc..f3cff0a 100644
--- a/include/shlobj.h
+++ b/include/shlobj.h
@@ -146,7 +146,7 @@
 
     /* *** IShellFolder methods *** */
     STDMETHOD(ParseDisplayName) (THIS_ HWND32 hwndOwner,
-        LPBC pbcReserved, LPOLESTR lpszDisplayName,
+        LPBC pbcReserved, LPOLESTR32 lpszDisplayName,
         ULONG * pchEaten, LPITEMIDLIST * ppidl, ULONG *pdwAttributes) PURE;
     STDMETHOD(EnumObjects) ( THIS_ HWND32 hwndOwner, DWORD grfFlags, LPENUMIDLIST
 * ppenumIDList) PURE;
@@ -163,7 +163,7 @@
                                  REFIID riid, UINT32 * prgfInOut, LPVOID * ppvOut) PURE;
     STDMETHOD(GetDisplayNameOf) (THIS_ LPCITEMIDLIST pidl, DWORD uFlags, LPSTRRET lpName) PURE;
     STDMETHOD(SetNameOf)        (THIS_ HWND32 hwndOwner, LPCITEMIDLIST pidl,
-                                 LPCOLESTR lpszName, DWORD uFlags,
+                                 LPCOLESTR32 lpszName, DWORD uFlags,
                                  LPITEMIDLIST * ppidlOut) PURE;
 } *LPSHELLFOLDER_VTABLE,IShellFolder_VTable;
 
diff --git a/include/stddebug.h b/include/stddebug.h
deleted file mode 100644
index 71c6092..0000000
--- a/include/stddebug.h
+++ /dev/null
@@ -1,256 +0,0 @@
-/* If you define this you can enable or disable specific debugging- */
-/* messages at run-time by supplying the "-debugmsg" option to Wine */
-#define DEBUG_RUNTIME /* */
-
-
-/* Define this if you want to enable all debugging-messages, except  */
-/* the ones explicitly disabled in a specific *.c-file.              */
-/* #define DEBUG_ALL */
-
-/* Define this if you want to enable all debugging-messages, even    */
-/* the ones explicitly disabled in specific *.c-files.               */
-/* #define DEBUG_ALL_EXT */
-
-/* Define this if you want to disable all debugging-messages, except */
-/* the ones explicitly enabled in a specifiy *.c-file.               */
-/* #define DEBUG_NONE */
-
-/* Define this if you want to disable all debugging-messages, even   */
-/* the ones explicitly enabled in specific *.c-files.                */
-/* #define DEBUG_NONE_EXT */
-
-
-/* You can enable or disable specific debugging-messages here.       */ 
-/* However, this can be overridden in the individual *.c-files       */
-/* between #include <stddebug.h> and #include <debug.h>              */
-
-
-/* #define DEBUG_EDIT      */
-/* #define DEBUG_MENU      */
-/* #define DEBUG_MENUCALC  */
-/* #define DEBUG_SCROLL    */
-/* #define DEBUG_COMBO     */
-/* #define DEBUG_LISTBOX   */
-/* #define DEBUG_TASK      */
-/* #define DEBUG_SELECTORS */
-/* #define DEBUG_RESOURCE  */
-/* #define DEBUG_ACCEL     */
-/* #define DEBUG_FIXUP     */
-/* #define DEBUG_MODULE    */
-/* #define DEBUG_LDT       */
-/* #define DEBUG_HEAP      */
-/* #define DEBUG_MCIANIM   */
-/* #define DEBUG_MCIWAVE   */
-/* #define DEBUG_MIDI      */
-/* #define DEBUG_INT       */
-/* #define DEBUG_METAFILE  */
-/* #define DEBUG_GDI       */
-/* #define DEBUG_BITMAP    */
-/* #define DEBUG_FONT      */
-/* #define DEBUG_PALETTE   */
-/* #define DEBUG_ICON      */
-/* #define DEBUG_REGION    */
-/* #define DEBUG_TEXT      */
-/* #define DEBUG_CLIPPING  */
-/* #define DEBUG_CARET     */
-/* #define DEBUG_CLASS     */
-/* #define DEBUG_DC        */
-/* #define DEBUG_DIALOG    */
-/* #define DEBUG_MESSAGE   */
-/* #define DEBUG_EVENT     */
-/* #define DEBUG_KEY       */
-/* #define DEBUG_GRAPHICS  */
-/* #define DEBUG_MDI       */
-/* #define DEBUG_MSG       */
-/* #define DEBUG_NONCLIENT */
-/* #define DEBUG_SYSCOLOR  */
-/* #define DEBUG_TIMER     */
-/* #define DEBUG_UTILITY   */
-/* #define DEBUG_WIN       */
-/* #define DEBUG_ENUM      */
-/* #define DEBUG_DLL       */
-/* #define DEBUG_MSGBOX    */
-/* #define DEBUG_CATCH     */
- 
-
-/* Do not remove this line or change anything below this line */
-
-#ifdef DEBUG_NONE
-#undef DEBUG_ACCEL
-#undef DEBUG_ASPI
-#undef DEBUG_ATOM
-#undef DEBUG_BITBLT
-#undef DEBUG_BITMAP
-#undef DEBUG_CARET
-#undef DEBUG_CDAUDIO
-#undef DEBUG_CLASS
-#undef DEBUG_CLIPBOARD
-#undef DEBUG_CLIPPING
-#undef DEBUG_COMBO
-#undef DEBUG_COMM
-#undef DEBUG_COMMDLG
-#undef DEBUG_CRTDLL
-#undef DEBUG_CURSOR
-#undef DEBUG_DC
-#undef DEBUG_DDE
-#undef DEBUG_DDRAW
-#undef DEBUG_DIALOG
-#undef DEBUG_DLL
-#undef DEBUG_DOSFS
-#undef DEBUG_DRIVER
-#undef DEBUG_DSOUND
-#undef DEBUG_EDIT
-#undef DEBUG_EVENT
-#undef DEBUG_EXEC
-#undef DEBUG_FILE
-#undef DEBUG_FIXUP
-#undef DEBUG_FONT
-#undef DEBUG_GDI
-#undef DEBUG_GLOBAL
-#undef DEBUG_GRAPHICS
-#undef DEBUG_HEAP
-#undef DEBUG_HOOK
-#undef DEBUG_ICON
-#undef DEBUG_INT
-#undef DEBUG_KEY
-#undef DEBUG_KEYBOARD
-#undef DEBUG_LDT
-#undef DEBUG_LISTBOX
-#undef DEBUG_LOCAL
-#undef DEBUG_MCI
-#undef DEBUG_MCIANIM
-#undef DEBUG_MCIWAVE
-#undef DEBUG_MDI
-#undef DEBUG_MENU
-#undef DEBUG_MESSAGE
-#undef DEBUG_METAFILE
-#undef DEBUG_MIDI
-#undef DEBUG_MMAUX
-#undef DEBUG_MMIO
-#undef DEBUG_MMSYS
-#undef DEBUG_MMTIME
-#undef DEBUG_MODULE
-#undef DEBUG_MSG
-#undef DEBUG_NONCLIENT
-#undef DEBUG_OLE
-#undef DEBUG_PALETTE
-#undef DEBUG_PROFILE
-#undef DEBUG_PROGRESS
-#undef DEBUG_PROP
-#undef DEBUG_REG
-#undef DEBUG_REGION
-#undef DEBUG_RELAY
-#undef DEBUG_RESOURCE
-#undef DEBUG_SCROLL
-#undef DEBUG_SELECTOR
-#undef DEBUG_SEM
-#undef DEBUG_SENDMSG
-#undef DEBUG_SHM
-#undef DEBUG_STRESS
-#undef DEBUG_STRING
-#undef DEBUG_TASK
-#undef DEBUG_TEXT
-#undef DEBUG_THUNK
-#undef DEBUG_TIMER
-#undef DEBUG_TOOLHELP
-#undef DEBUG_TWEAK
-#undef DEBUG_UPDOWN
-#undef DEBUG_VER
-#undef DEBUG_VIRTUAL
-#undef DEBUG_VXD
-#undef DEBUG_WIN
-#undef DEBUG_WIN16DRV
-#undef DEBUG_WIN32
-#undef DEBUG_WINSOCK
-#undef DEBUG_X11
-#endif
-
-#ifdef DEBUG_ALL
-#define DEBUG_ACCEL
-#define DEBUG_ASPI
-#define DEBUG_ATOM
-#define DEBUG_BITBLT
-#define DEBUG_BITMAP
-#define DEBUG_CARET
-#define DEBUG_CDAUDIO
-#define DEBUG_CLASS
-#define DEBUG_CLIPBOARD
-#define DEBUG_CLIPPING
-#define DEBUG_COMBO
-#define DEBUG_COMM
-#define DEBUG_COMMDLG
-#define DEBUG_CRTDLL
-#define DEBUG_CURSOR
-#define DEBUG_DC
-#define DEBUG_DDE
-#define DEBUG_DDRAW
-#define DEBUG_DIALOG
-#define DEBUG_DLL
-#define DEBUG_DOSFS
-#define DEBUG_DRIVER
-#define DEBUG_DSOUND
-#define DEBUG_EDIT
-#define DEBUG_EVENT
-#define DEBUG_EXEC
-#define DEBUG_FILE
-#define DEBUG_FIXUP
-#define DEBUG_FONT
-#define DEBUG_GDI
-#define DEBUG_GLOBAL
-#define DEBUG_GRAPHICS
-#define DEBUG_HEAP
-#define DEBUG_HOOK
-#define DEBUG_ICON
-#define DEBUG_INT
-#define DEBUG_KEY
-#define DEBUG_KEYBOARD
-#define DEBUG_LDT
-#define DEBUG_LISTBOX
-#define DEBUG_LOCAL
-#define DEBUG_MCI
-#define DEBUG_MCIANIM
-#define DEBUG_MCIWAVE
-#define DEBUG_MDI
-#define DEBUG_MENU
-#define DEBUG_MESSAGE
-#define DEBUG_METAFILE
-#define DEBUG_MIDI
-#define DEBUG_MMAUX
-#define DEBUG_MMIO
-#define DEBUG_MMSYS
-#define DEBUG_MMTIME
-#define DEBUG_MODULE
-#define DEBUG_MSG
-#define DEBUG_NONCLIENT
-#define DEBUG_OLE
-#define DEBUG_PALETTE
-#define DEBUG_PROFILE
-#define DEBUG_PROGRESS
-#define DEBUG_PROP
-#define DEBUG_REG
-#define DEBUG_REGION
-#define DEBUG_RELAY
-#define DEBUG_RESOURCE
-#define DEBUG_SCROLL
-#define DEBUG_SELECTOR
-#define DEBUG_SEM
-#define DEBUG_SENDMSG
-#define DEBUG_SHM
-#define DEBUG_STRESS
-#define DEBUG_STRING
-#define DEBUG_TASK
-#define DEBUG_TEXT
-#define DEBUG_THUNK
-#define DEBUG_TIMER
-#define DEBUG_TOOLHELP
-#define DEBUG_TWEAK
-#define DEBUG_UPDOWN
-#define DEBUG_VER
-#define DEBUG_VIRTUAL
-#define DEBUG_VXD
-#define DEBUG_WIN
-#define DEBUG_WIN16DRV
-#define DEBUG_WIN32
-#define DEBUG_WINSOCK
-#define DEBUG_X11
-#endif
diff --git a/include/storage.h b/include/storage.h
new file mode 100644
index 0000000..dce219b
--- /dev/null
+++ b/include/storage.h
@@ -0,0 +1,212 @@
+#ifndef _WINE_STORAGE_H
+#define _WINE_STORAGE_H
+
+/* Does this look like a cellar to you? */
+
+#define STDMETHOD(xfn) HRESULT (CALLBACK *fn##xfn)
+#define STDMETHOD_(ret,xfn) ret (CALLBACK *fn##xfn)
+#define PURE
+#define FAR
+#define THIS_ THIS,
+
+struct storage_header {
+	BYTE	magic[8];	/* 00: magic */
+	BYTE	unknown1[36];	/* 08: unknown */
+	DWORD	num_of_bbd_blocks;/* 2C: length of big datablocks */
+	DWORD	root_startblock;/* 30: root storage first big block */
+	DWORD	unknown2[2];	/* 34: unknown */
+	DWORD	sbd_startblock;	/* 3C: small block depot first big block */
+	DWORD	unknown3[3];	/* 40: unknown */
+	DWORD	bbd_list[109];	/* 4C: big data block list (up to end of sector)*/
+};
+struct storage_pps_entry {
+	WCHAR	pps_rawname[32];/* 00: \0 terminated widechar name */
+	WORD	pps_sizeofname;	/* 40: namelength in bytes */
+	BYTE	pps_type;	/* 42: flags, 1 storage/dir, 2 stream, 5 root */
+	BYTE	pps_unknown0;	/* 43: unknown */
+	DWORD	pps_prev;	/* 44: previous pps */
+	DWORD	pps_next;	/* 48: next pps */
+	DWORD	pps_dir;	/* 4C: directory pps */
+	GUID	pps_guid;	/* 50: class ID */
+	DWORD	pps_unknown1;	/* 60: unknown */
+	FILETIME pps_ft1;	/* 64: filetime1 */
+	FILETIME pps_ft2;	/* 70: filetime2 */
+	DWORD	pps_sb;		/* 74: data startblock */
+	DWORD	pps_size;	/* 78: datalength. (<0x1000)?small:big blocks*/
+	DWORD	pps_unknown2;	/* 7C: unknown */
+};
+
+#define STORAGE_CHAINENTRY_FAT		0xfffffffd
+#define STORAGE_CHAINENTRY_ENDOFCHAIN	0xfffffffe
+#define STORAGE_CHAINENTRY_FREE		0xffffffff
+
+typedef LPOLESTR16 *SNB16;
+typedef LPOLESTR32 *SNB32;
+DECL_WINELIB_TYPE(SNB);
+
+typedef struct IStorage16 IStorage16,*LPSTORAGE16;
+typedef struct IStorage32 IStorage32,*LPSTORAGE32;
+typedef struct IStream16 IStream16,*LPSTREAM16;
+typedef struct IStream32 IStream32,*LPSTREAM32;
+
+typedef struct IEnumSTATSTG IEnumSTATSTG,*LPENUMSTATSTG;
+
+typedef struct {
+    LPOLESTR16	pwcsName;
+    DWORD	type;
+    ULARGE_INTEGER cbSize;
+    FILETIME	mtime;
+    FILETIME	ctime;
+    FILETIME	atime;
+    DWORD	grfMode;
+    DWORD	grfLocksSupported;
+    CLSID	clsid;
+    DWORD	grfStateBits;
+    DWORD	reserved;
+} STATSTG;
+
+#define STGM_DIRECT		0x00000000
+#define STGM_TRANSACTED		0x00010000
+#define STGM_SIMPLE		0x08000000
+#define STGM_READ		0x00000000
+#define STGM_WRITE		0x00000001
+#define STGM_READWRITE		0x00000002
+#define STGM_SHARE_DENY_NONE	0x00000040
+#define STGM_SHARE_DENY_READ	0x00000030
+#define STGM_SHARE_DENY_WRITE	0x00000020
+#define STGM_SHARE_EXCLUSIVE	0x00000010
+#define STGM_PRIORITY		0x00040000
+#define STGM_DELETEONRELEASE	0x04000000
+#define STGM_NOSCRATCH		0x00100000
+#define STGM_CREATE		0x00001000
+#define STGM_CONVERT		0x00020000
+#define STGM_FAILIFTHERE	0x00000000
+
+#define THIS LPSTORAGE16 this
+typedef struct IStorage16_VTable {
+	/* IUnknown methods */
+	STDMETHOD(QueryInterface) (THIS_ REFIID riid,LPVOID FAR* ppvObj);
+	STDMETHOD_(ULONG,AddRef) (THIS);
+	STDMETHOD_(ULONG,Release) (THIS);
+	/* IStorage methods */
+	STDMETHOD(CreateStream)(THIS_ LPCOLESTR16 pwcsName, DWORD grfMode, DWORD reserved1, DWORD reserved2, IStream16 **ppstm);
+        STDMETHOD(OpenStream)(THIS_ LPCOLESTR16 pwcsName, void *reserved1, DWORD grfMode, DWORD reserved2, IStream16 **ppstm);
+        STDMETHOD(CreateStorage)(THIS_ LPCOLESTR16 pwcsName, DWORD grfMode, DWORD dwStgFmt, DWORD reserved2, IStorage16 **ppstg);
+        STDMETHOD(OpenStorage)(THIS_ LPCOLESTR16 pwcsName,IStorage16 *pstgPriority, DWORD grfMode, SNB16 SNB16Exclude, DWORD reserved, IStorage16 **ppstg);
+	STDMETHOD(CopyTo)(THIS_ DWORD ciidExclude, const IID *rgiidExclude, SNB16 SNB16Exclude, IStorage16 *pstgDest);
+	STDMETHOD(MoveElementTo)(THIS_ LPCOLESTR16 pwcsName, IStorage16 *pstgDest, LPCOLESTR16 pwcsNewName, DWORD grfFlags);
+	STDMETHOD(Commit)(THIS_ DWORD grfCommitFlags);
+	STDMETHOD(Revert)(THIS);
+	STDMETHOD(EnumElements)(THIS_ DWORD reserved1,void *reserved2, DWORD reserved3, IEnumSTATSTG **ppenum);
+        STDMETHOD(DestroyElement)(THIS_ LPCOLESTR16 pwcsName);
+	STDMETHOD(RenameElement)(THIS_ LPCOLESTR16 pwcsOldName, LPCOLESTR16 pwcsNewName);
+	STDMETHOD(SetElementTimes)(THIS_ LPCOLESTR16 pwcsName, const FILETIME *pctime,  const FILETIME *patime, const FILETIME *pmtime);
+	STDMETHOD(SetClass)(THIS_ REFCLSID clsid);
+	STDMETHOD(SetStateBits)(THIS_ DWORD grfStateBits, DWORD grfMask);
+	STDMETHOD(Stat)(THIS_ STATSTG *pstatstg, DWORD grfStatFlag);
+} IStorage16_VTable,*LPSTORAGE16_VTABLE;
+
+struct IStorage16 {
+	LPSTORAGE16_VTABLE		lpvtbl;
+	DWORD				ref;
+	SEGPTR				thisptr; /* pointer to this struct as segmented */
+	struct storage_pps_entry	stde;
+	int				ppsent;
+	HFILE32				hf;
+};
+#undef THIS
+#define THIS LPSTORAGE32 this
+typedef struct IStorage32_VTable {
+	/* IUnknown methods */
+	STDMETHOD(QueryInterface) (THIS_ REFIID riid,LPVOID FAR* ppvObj);
+	STDMETHOD_(ULONG,AddRef) (THIS);
+	STDMETHOD_(ULONG,Release) (THIS);
+	/* IStorage methods */
+	STDMETHOD(CreateStream)(THIS_ LPCOLESTR32 pwcsName, DWORD grfMode, DWORD reserved1, DWORD reserved2, IStream32 **ppstm);
+        STDMETHOD(OpenStream)(THIS_ LPCOLESTR32 pwcsName, void *reserved1, DWORD grfMode, DWORD reserved2, IStream32 **ppstm);
+        STDMETHOD(CreateStorage)(THIS_ LPCOLESTR32 pwcsName, DWORD grfMode, DWORD dwStgFmt, DWORD reserved2, IStorage32 **ppstg);
+        STDMETHOD(OpenStorage)(THIS_ LPCOLESTR32 pwcsName,IStorage32 *pstgPriority, DWORD grfMode, SNB32 SNB16Exclude, DWORD reserved, IStorage32 **ppstg);
+	STDMETHOD(CopyTo)(THIS_ DWORD ciidExclude, const IID *rgiidExclude, SNB32 SNB16Exclude, IStorage32 *pstgDest);
+	STDMETHOD(MoveElementTo)(THIS_ LPCOLESTR32 pwcsName, IStorage32 *pstgDest, LPCOLESTR32 pwcsNewName, DWORD grfFlags);
+	STDMETHOD(Commit)(THIS_ DWORD grfCommitFlags);
+	STDMETHOD(Revert)(THIS);
+	STDMETHOD(EnumElements)(THIS_ DWORD reserved1,void *reserved2, DWORD reserved3, IEnumSTATSTG **ppenum);
+        STDMETHOD(DestroyElement)(THIS_ LPCOLESTR32 pwcsName);
+	STDMETHOD(RenameElement)(THIS_ LPCOLESTR32 pwcsOldName, LPCOLESTR32 pwcsNewName);
+	STDMETHOD(SetElementTimes)(THIS_ LPCOLESTR32 pwcsName, const FILETIME *pctime,  const FILETIME *patime, const FILETIME *pmtime);
+	STDMETHOD(SetClass)(THIS_ REFCLSID clsid);
+	STDMETHOD(SetStateBits)(THIS_ DWORD grfStateBits, DWORD grfMask);
+	STDMETHOD(Stat)(THIS_ STATSTG *pstatstg, DWORD grfStatFlag);
+} IStorage32_VTable,*LPSTORAGE32_VTABLE;
+
+struct IStorage32 {
+	LPSTORAGE32_VTABLE		lpvtbl;
+	DWORD				ref;
+	struct storage_pps_entry	stde;
+	int				ppsent;
+	HFILE32				hf;
+};
+#undef THIS
+
+#define THIS LPSTREAM16 this
+typedef struct IStream16_VTable {
+        STDMETHOD(QueryInterface)(THIS_ REFIID riid, void  * *ppvObject);
+        STDMETHOD_(ULONG,AddRef)(THIS);
+        STDMETHOD_(ULONG,Release)(THIS);
+	STDMETHOD(Read)(THIS_ void  *pv, ULONG cb, ULONG  *pcbRead);
+	STDMETHOD(Write)(THIS_ const void  *pv,ULONG cb,ULONG  *pcbWritten);
+	STDMETHOD(Seek)(THIS_ LARGE_INTEGER dlibMove,DWORD dwOrigin,ULARGE_INTEGER  *plibNewPosition); 
+	STDMETHOD(SetSize)(THIS_ ULARGE_INTEGER libNewSize);
+	STDMETHOD(CopyTo)(THIS_ IStream16  *pstm,ULARGE_INTEGER cb,ULARGE_INTEGER  *pcbRead,ULARGE_INTEGER  *pcbWritten);
+	STDMETHOD(Commit)(THIS_ DWORD grfCommitFlags);
+	STDMETHOD(Revert)(THIS);
+        STDMETHOD(LockRegion)(THIS_ ULARGE_INTEGER libOffset, ULARGE_INTEGER cb,DWORD dwLockType);
+	STDMETHOD(UnlockRegion)(THIS_ ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType);
+	STDMETHOD(Stat)(THIS_ STATSTG  *pstatstg, DWORD grfStatFlag);
+	STDMETHOD(Clone)(THIS_ IStream16 **ppstm);
+} IStream16_VTable,*LPSTREAM16_VTABLE;
+
+struct IStream16 {
+	LPSTREAM16_VTABLE		lpvtbl;
+	DWORD				ref;
+	SEGPTR				thisptr; /* pointer to this struct as segmented */
+	struct storage_pps_entry	stde;
+	int				ppsent;
+	HFILE32				hf;
+	ULARGE_INTEGER			offset;
+};
+#undef THIS
+#define THIS LPSTREAM32 this
+typedef struct IStream32_VTable {
+        STDMETHOD(QueryInterface)(THIS_ REFIID riid, void  * *ppvObject);
+        STDMETHOD_(ULONG,AddRef)(THIS);
+        STDMETHOD_(ULONG,Release)(THIS);
+	STDMETHOD(Read)(THIS_ void  *pv, ULONG cb, ULONG  *pcbRead);
+	STDMETHOD(Write)(THIS_ const void  *pv,ULONG cb,ULONG  *pcbWritten);
+	STDMETHOD(Seek)(THIS_ LARGE_INTEGER dlibMove,DWORD dwOrigin,ULARGE_INTEGER  *plibNewPosition); 
+	STDMETHOD(SetSize)(THIS_ ULARGE_INTEGER libNewSize);
+	STDMETHOD(CopyTo)(THIS_ IStream32  *pstm,ULARGE_INTEGER cb,ULARGE_INTEGER  *pcbRead,ULARGE_INTEGER  *pcbWritten);
+	STDMETHOD(Commit)(THIS_ DWORD grfCommitFlags);
+	STDMETHOD(Revert)(THIS);
+        STDMETHOD(LockRegion)(THIS_ ULARGE_INTEGER libOffset, ULARGE_INTEGER cb,DWORD dwLockType);
+	STDMETHOD(UnlockRegion)(THIS_ ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType);
+	STDMETHOD(Stat)(THIS_ STATSTG  *pstatstg, DWORD grfStatFlag);
+	STDMETHOD(Clone)(THIS_ IStream32  **ppstm);
+} IStream32_VTable,*LPSTREAM32_VTABLE;
+
+struct IStream32 {
+	LPSTREAM32_VTABLE		lpvtbl;
+	DWORD				ref;
+	struct storage_pps_entry	stde;
+	int				ppsent;
+	HFILE32				hf;
+	ULARGE_INTEGER			offset;
+};
+#undef THIS
+
+#undef STDMETHOD
+#undef STDMETHOD_
+#undef PURE
+#undef FAR
+#undef THIS_
+#endif
diff --git a/include/thread.h b/include/thread.h
index 8ffe980..84d5dae 100644
--- a/include/thread.h
+++ b/include/thread.h
@@ -12,6 +12,8 @@
 #include "winnt.h"
 #include "selectors.h"  /* for SET_FS */
 
+struct _PDB32;
+
 /* Thread exception block */
 typedef struct _TEB
 {
@@ -30,6 +32,7 @@
     HQUEUE16     queue;          /* 28 Message queue */
     WORD         pad1;           /* 2a */
     LPVOID      *tls_ptr;        /* 2c Pointer to TLS array */
+    struct _PDB32 *process;      /* 30 owning process (used by NT3.51 applets)*/
 } TEB;
 
 /* Event waiting structure */
@@ -41,8 +44,6 @@
     K32OBJ       *objs[MAXIMUM_WAIT_OBJECTS];  /* Object pointers */
 } WAIT_STRUCT;
 
-struct _PDB32;
-
 /* Thread database */
 typedef struct _THDB
 {
@@ -50,7 +51,6 @@
     struct _PDB32 *process;        /*  08 Process owning this thread */
     K32OBJ        *event;          /*  0c Thread event */
     TEB            teb;            /*  10 Thread exception block */
-    DWORD          cur_stack;      /*  40 Current stack (was: process2) */
     DWORD          flags;          /*  44 Flags */
     DWORD          exit_code;      /*  48 Termination status */
     WORD           teb_sel;        /*  4c Selector to TEB */
@@ -67,7 +67,8 @@
     void          *debugger_CB;    /*  74 Debugger context block */
     DWORD          debug_thread;   /*  78 Thread debugging this one (?) */
     void          *pcontext;       /*  7c Thread register context */
-    DWORD          unknown3[3];    /*  80 Unknown */
+    DWORD          cur_stack;      /*  80 Current stack (was: unknown) */
+    DWORD          unknown3[2];    /*  84 Unknown */
     WORD           current_ss;     /*  8c Another 16-bit stack selector */
     WORD           pad2;           /*  8e */
     void          *ss_table;       /*  90 Pointer to info about 16-bit stack */
@@ -125,6 +126,7 @@
 extern THDB *THREAD_GetPtr( HANDLE32 handle, DWORD access );
 extern void THREAD_AddQueue( THREAD_QUEUE *queue, THDB *thread );
 extern void THREAD_RemoveQueue( THREAD_QUEUE *queue, THDB *thread );
+extern DWORD THREAD_TlsAlloc( THDB *thread );
 
 /* scheduler/event.c */
 extern void EVENT_Set( K32OBJ *obj );
diff --git a/include/version.h b/include/version.h
index 7c96165..c224a7a 100644
--- a/include/version.h
+++ b/include/version.h
@@ -1 +1 @@
-#define WINE_RELEASE_INFO "Wine release 980215"
+#define WINE_RELEASE_INFO "Wine release 980301"
diff --git a/include/windows.h b/include/windows.h
index a983aa5..b4393de 100644
--- a/include/windows.h
+++ b/include/windows.h
@@ -5767,6 +5767,9 @@
 DWORD       WINAPI GetCurrentProcessId(void);
 HANDLE32    WINAPI GetCurrentThread(void);
 DWORD       WINAPI GetCurrentThreadId(void);
+INT32       WINAPI GetDateFormat32A(LCID,DWORD,LPSYSTEMTIME,LPCSTR,LPSTR,INT32);
+INT32       WINAPI GetDateFormat32W(LCID,DWORD,LPSYSTEMTIME,LPCWSTR,LPWSTR,INT32);
+#define     GetDateFormat WINELIB_NAME_AW(GetDateFormat)
 BOOL32      WINAPI GetDCOrgEx(HDC32,LPPOINT32);
 LPSTR       WINAPI GetEnvironmentStrings32A(void);
 LPWSTR      WINAPI GetEnvironmentStrings32W(void);
@@ -5856,6 +5859,8 @@
 BOOL32      WINAPI MoveFileEx32W(LPCWSTR,LPCWSTR,DWORD);
 #define     MoveFileEx WINELIB_NAME_AW(MoveFileEx)
 DWORD       WINAPI MsgWaitForMultipleObjects(DWORD,HANDLE32*,BOOL32,DWORD,DWORD);
+INT32       WINAPI MultiByteToWideChar(UINT32,DWORD,LPCSTR,INT32,LPWSTR,INT32);
+INT32       WINAPI WideCharToMultiByte(UINT32,DWORD,LPCWSTR,INT32,LPSTR,INT32,LPCSTR,BOOL32*);
 HANDLE32    WINAPI OpenEvent32A(DWORD,BOOL32,LPCSTR);
 HANDLE32    WINAPI OpenEvent32W(DWORD,BOOL32,LPCWSTR);
 #define     OpenEvent WINELIB_NAME_AW(OpenEvent)
@@ -5877,7 +5882,7 @@
 BOOL32      WINAPI ReadConsole32A(HANDLE32,LPVOID,DWORD,LPDWORD,LPVOID);
 BOOL32      WINAPI ReadConsole32W(HANDLE32,LPVOID,DWORD,LPDWORD,LPVOID);
 #define     ReadConsole WINELIB_NAME_AW(ReadConsole)
-BOOL32      WINAPI ReadFile(HFILE32,LPVOID,DWORD,LPDWORD,LPOVERLAPPED);
+BOOL32      WINAPI ReadFile(HANDLE32,LPVOID,DWORD,LPDWORD,LPOVERLAPPED);
 DWORD       WINAPI RegCreateKeyEx32A(HKEY,LPCSTR,DWORD,LPSTR,DWORD,REGSAM,
                                      LPSECURITY_ATTRIBUTES,LPHKEY,LPDWORD);
 DWORD       WINAPI RegCreateKeyEx32W(HKEY,LPCWSTR,DWORD,LPWSTR,DWORD,REGSAM,
@@ -5967,7 +5972,7 @@
 BOOL32      WINAPI WriteConsole32A(HANDLE32,LPCVOID,DWORD,LPDWORD,LPVOID);
 BOOL32      WINAPI WriteConsole32W(HANDLE32,LPCVOID,DWORD,LPDWORD,LPVOID);
 #define     WriteConsole WINELIB_NAME_AW(WriteConsole)
-BOOL32      WINAPI WriteFile(HFILE32,LPVOID,DWORD,LPDWORD,LPOVERLAPPED);
+BOOL32      WINAPI WriteFile(HANDLE32,LPCVOID,DWORD,LPDWORD,LPOVERLAPPED);
 
 /* Declarations for functions that are the same in Win16 and Win32 */
 
diff --git a/include/winerror.h b/include/winerror.h
index e0c9dda..763a124 100644
--- a/include/winerror.h
+++ b/include/winerror.h
@@ -4,6 +4,11 @@
 
 extern int WIN32_LastError;
 
+#define FACILITY_WIN32		7
+
+#define SEVERITY_ERROR		1
+
+
 #define MAKE_HRESULT(sev,fac,code) \
     ((HRESULT) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code))) )
 #define MAKE_SCODE(sev,fac,code) \
@@ -52,6 +57,7 @@
 #define ERROR_POSSIBLE_DEADLOCK     1131
 #define ERROR_BAD_DEVICE            1200
 #define ERROR_NO_NETWORK            1222
+#define ERROR_ALREADY_INITIALIZED   1247
 #define ERROR_COMMITMENT_LIMIT      1455
 
 /* HRESULT values for OLE, SHELL and other Interface stuff */
@@ -66,4 +72,38 @@
 #define	E_OUTOFMEMORY			0x8007000E
 #define	E_INVALIDARG			0x80070057
 
+#define STG_E_INVALIDFUNCTION		0x80030001
+#define STG_E_FILENOTFOUND		0x80030002
+#define STG_E_PATHNOTFOUND		0x80030003
+#define STG_E_TOOMANYOPENFILES		0x80030004
+#define STG_E_ACCESSDENIED		0x80030005
+#define STG_E_INVALIDHANDLE		0x80030006
+#define STG_E_INSUFFICIENTMEMORY	0x80030008
+#define STG_E_INVALIDPOINTER		0x80030009
+#define STG_E_NOMOREFILES		0x80030012
+#define STG_E_DISKISWRITEPROTECTED	0x80030013
+#define STG_E_SEEKERROR			0x80030019
+#define STG_E_WRITEFAULT		0x8003001D
+#define STG_E_READFAULT			0x8003001E
+#define STG_E_SHAREVIOLATION		0x80030020
+#define STG_E_LOCKVIOLATION		0x80030021
+#define STG_E_FILEALREADYEXISTS		0x80030050
+#define STG_E_INVALIDPARAMETER		0x80030057
+#define STG_E_MEDIUMFULL		0x80030070
+#define STG_E_ABNORMALAPIEXIT		0x800300FA
+#define STG_E_INVALIDHEADER		0x800300FB
+#define STG_E_INVALIDNAME		0x800300FC
+#define STG_E_UNKNOWN			0x800300FD
+#define STG_E_UNIMPLEMENTEDFUNCTION	0x800300FE
+#define STG_E_INVALIDFLAG		0x800300FF
+#define STG_E_INUSE			0x80030100
+#define STG_E_NOTCURRENT		0x80030101
+#define STG_E_REVERTED			0x80030102
+#define STG_E_CANTSAVE			0x80030103
+#define STG_E_OLDFORMAT			0x80030104
+#define STG_E_OLDDLL			0x80030105
+#define STG_E_SHAREREQUIRED		0x80030106
+#define STG_E_NOTFILEBASEDSTORAGE	0x80030107
+#define STG_E_EXTANTMARSHALLINGS	0x80030108
+
 #endif  /* __WINE_WINERROR_H */
diff --git a/ipc/dde_atom.c b/ipc/dde_atom.c
index 1aef654..458565a 100644
--- a/ipc/dde_atom.c
+++ b/ipc/dde_atom.c
@@ -16,7 +16,6 @@
 #include "shm_main_blk.h"
 #include "shm_fragment.h"
 #include "ldt.h"
-#include "stddebug.h"
 #include "debug.h"
 
 typedef struct
@@ -130,7 +129,7 @@
      return (atom<MIN_STR_ATOM) ? atom : 0;
   }
 
-  dprintf_atom(stddeb,"GlobalAddAtom(\"%s\")\n",str);
+  dprintf_info(atom,"GlobalAddAtom(\"%s\")\n",str);
 
   DDE_IPC_init();		/* will initialize only if needed */
   
@@ -175,7 +174,7 @@
   AtomData_ptr atom_ptr;
   ATOM retval=(ATOM) 0;
   
-  dprintf_atom(stddeb,"GlobalDeleteAtom(\"%d\")\n",(int)atom);
+  dprintf_info(atom,"GlobalDeleteAtom(\"%d\")\n",(int)atom);
   atom_idx=(int)atom - MIN_STR_ATOM;
   
   if (atom_idx < 0 )
@@ -212,7 +211,7 @@
   int atom_ofs;
   char *str;
 
-  dprintf_atom(stddeb,"GlobalFindAtom(%08lx)\n", name );
+  dprintf_info(atom,"GlobalFindAtom(%08lx)\n", name );
 
   /* First check for integer atom */
 
@@ -224,7 +223,7 @@
      ATOM atom= (ATOM) atoi(&str[1]);
      return (atom<MIN_STR_ATOM) ? atom : 0;
   }
-  dprintf_atom(stddeb,"GlobalFindAtom(\"%s\")\n",str);
+  dprintf_info(atom,"GlobalFindAtom(\"%s\")\n",str);
 
   DDE_IPC_init();		/* will initialize only if needed */
 
diff --git a/ipc/dde_atom_test.c b/ipc/dde_atom_test.c
index dd587c4..b0d0341 100644
--- a/ipc/dde_atom_test.c
+++ b/ipc/dde_atom_test.c
@@ -12,7 +12,6 @@
 #include <win.h>
 #include "dde_atom.h"
 #include "shm_main_blk.h"
-#include <stddebug.h>
 #include <debug.h>
 #define TOGETHER (DDE_ATOMS/5)
 
@@ -25,9 +24,9 @@
   int i,j,atom_n;
   int atom_len[TOGETHER];
   
-  debugging_shm=1;
-  debugging_atom=0;
-  debugging_sem=0;
+  debugging_info(shm)=1;
+  debugging_info(atom)=0;
+  debugging_info(sem)=0;
   
   for (i=0 ; i<=10000/TOGETHER ; i++) {
      for (atom_n=0 ; atom_n<TOGETHER ; atom_n++) {
diff --git a/ipc/dde_mem.c b/ipc/dde_mem.c
index 5f10ede..ac29c70 100644
--- a/ipc/dde_mem.c
+++ b/ipc/dde_mem.c
@@ -10,9 +10,8 @@
 #ifdef CONFIG_IPC
 
 #include <stdio.h>
-#include <stddebug.h>
-#include <debug.h>
 #include <assert.h>
+#include "debug.h"
 #include "ldt.h"
 #include "shm_main_blk.h"
 #include "shm_fragment.h"
@@ -59,18 +58,18 @@
 {
   struct shm_block *block;
   
-  dprintf_global(stddeb,"shm:locate_handle(0x%04x)\n", h);
+  dprintf_info(global,"shm:locate_handle(0x%04x)\n", h);
 
 
   if (SampleBit( &free_handles, DDE_MEM_IDX(h)) == 0) {
-     dprintf_global(stddeb, "shm:locate_handle: return NULL\n");
+     dprintf_info(global, "shm:locate_handle: return NULL\n");
      return NULL;		   /* free!!! */
   }
   
   block= shm_locate_block(DDE_MEM_INFO(h).shmid, map);
   if (block == NULL) {
       /* nothing found */
-      dprintf_global(stddeb, "shm:locate_handle: return NULL\n");
+      dprintf_info(global, "shm:locate_handle: return NULL\n");
       return NULL;
   }
 
@@ -88,7 +87,7 @@
   if (bit_nr != -1)
      return DDE_MEM_HANDLE(bit_nr);
 
-  dprintf_global(stddeb,"dde_alloc_handle: no free DDE handle found\n");
+  dprintf_info(global,"dde_alloc_handle: no free DDE handle found\n");
   return 0;
 }
 /**********************************************************************
@@ -103,7 +102,7 @@
     struct local_shm_map *curr;
     HGLOBAL16 handle;
     
-    dprintf_global(stddeb,"DDE_malloc flags %4X, size %ld\n", flags, size);
+    dprintf_info(global,"DDE_malloc flags %4X, size %ld\n", flags, size);
     DDE_IPC_init();		/* make sure main shm block allocated */ 
 
     shm_write_wait(main_block->proc[curr_proc_idx].sem);
@@ -152,14 +151,14 @@
     handle= dde_alloc_handle();
     
     if (handle) {
-       dprintf_global(stddeb,
+       dprintf_info(global,
 		      "DDE_malloc returning handle=0x%4x, ptr=0x%08lx\n",
 		      (int)handle, (long) HINFO2DATAPTR(h_info));
        DDE_MEM_INFO(handle).rel=  PTR2REL(block, h_info);
        DDE_MEM_INFO(handle).shmid= shmid;
     }
     else
-       dprintf_global(stddeb,"DDE_malloc failed\n");
+       dprintf_warn(global, "DDE_malloc failed\n");
 
     shm_write_signal(main_block->proc[curr_proc_idx].sem);
     
@@ -173,7 +172,7 @@
   int handle_index= h & 0x7fff;
   struct local_shm_map map;
 
-  dprintf_global(stddeb,"DDE_GlobalFree(0x%04x)\n",h);
+  dprintf_info(global,"DDE_GlobalFree(0x%04x)\n",h);
 
   if (h==0)
      return 0;
@@ -239,7 +238,7 @@
   if (segptr != NULL)
       *segptr=0;
 
-  dprintf_global(stddeb,"DDE_AttachHandle(%04x)\n",handle);
+  dprintf_info(global,"DDE_AttachHandle(%04x)\n",handle);
   h_info=locate_handle(handle, NULL);
 
   if (h_info == NULL) 
@@ -250,7 +249,7 @@
       return NULL;
   }
   
-  dprintf_global(stddeb,"DDE_AttachHandle: h_info=%06lx\n",(long)h_info);
+  dprintf_info(global,"DDE_AttachHandle: h_info=%06lx\n",(long)h_info);
 
   shmdata.handle= handle;
   shmdata.shmid= DDE_MEM_INFO(handle).shmid;
@@ -264,10 +263,10 @@
   if (segptr != NULL) 
       *segptr= (SEGPTR)MAKELONG( 0, shmdata.sel);
 
-  if (debugging_dde)
+  if (debugging_info(dde))
       debug_last_handle_size= h_info->size;
 
-  dprintf_global(stddeb,"DDE_AttachHandle returns ptr=0x%08lx\n", (long)ptr);
+  dprintf_info(global,"DDE_AttachHandle returns ptr=0x%08lx\n", (long)ptr);
 
   return (LPSTR)ptr;
 
diff --git a/ipc/dde_proc.c b/ipc/dde_proc.c
index 57142b1..a08b069 100644
--- a/ipc/dde_proc.c
+++ b/ipc/dde_proc.c
@@ -26,7 +26,6 @@
 #include "dde_proc.h"
 #include "dde_mem.h"
 #include "dde.h"
-#include "stddebug.h"
 #include "debug.h"
 #include "xmalloc.h"
 
@@ -48,9 +47,7 @@
 #define DDE_MSG_SIZE   sizeof(MSG16)
 #define FREE_WND (WORD)(-2)
 #define DELETED_WND (WORD)(-3)
-#if defined(DEBUG_MSG) || defined(DEBUG_RUNTIME)
 static char *msg_type[4]={"********", "DDE_SEND", "DDE_POST", "DDE_ACK"};
-#endif
 
 struct msg_dat {
 	struct msgbuf dat;
@@ -126,7 +123,7 @@
 {
   dde_proc proc;
   int proc_idx;
-  dprintf_dde(stddeb,"dde_proc_add(..)\n");
+  dprintf_info(dde,"dde_proc_add(..)\n");
   shm_write_wait(main_block->sem);
 
   /* find free proc_idx and allocate it */
@@ -167,7 +164,7 @@
        size= msgrcv( main_block->proc[curr_proc_idx].msg , &ack_buff.dat,
 		     1, DDE_ACK, IPC_NOWAIT);
        if (size>=0) {
-	  dprintf_msg(stddeb,"get_ack: received DDE_ACK message\n");
+	  dprintf_info(msg,"get_ack: received DDE_ACK message\n");
 	  return TRUE;
        }
        if (DDE_GetRemoteMessage()) {
@@ -200,7 +197,7 @@
      return FALSE;
   }
 
-  if (debugging_dde) {
+  if (debugging_info(dde) || debugging_warn_dde) {
      MSG16 *msg=(MSG16*) &msgbuf->mtext;
      char *title;
      if (msgbuf->mtype==DDE_SEND)
@@ -212,13 +209,13 @@
      if (title)
 	 print_dde_message(title, msg);
      else
-       fprintf(stddeb,"Unknown message type=0x%lx\n",msgbuf->mtype);
+       dprintf_warn(dde, "Unknown message type=0x%lx\n", msgbuf->mtype);
   }
-  dprintf_msg(stddeb,
+  dprintf_info(msg,
 	      "DDE_DoOneMessage: to proc_idx=%d (pid=%d), queue=%u\n",
 	      proc_idx, proc->pid, (unsigned)proc->msg);
   if ( proc->msg != -1) {
-     dprintf_msg(stddeb, "DDE_DoOneMessage: doing...(type=%s)\n",
+     dprintf_info(msg, "DDE_DoOneMessage: doing...(type=%s)\n",
 		 msg_type[msgbuf->mtype]);
      size=msgsnd (proc->msg, msgbuf, size, 0);
 
@@ -228,7 +225,7 @@
      }
      kill(proc->pid,SIGUSR2);	   /* tell the process there is a message */
 
-     dprintf_msg(stddeb,"DDE_DoOneMessage: "
+     dprintf_info(msg,"DDE_DoOneMessage: "
 		 "Trying to get acknowledgment from msg queue=%d\n",
 		 proc->msg);
      Yield16();			/* force task switch, and */
@@ -242,7 +239,7 @@
      }
   }
   else {
-     dprintf_msg(stddeb,"DDE_DoOneMessage: message not sent, "
+     dprintf_warn(msg, "DDE_DoOneMessage: message not sent, "
 		 "target has no message queue\n");
      return FALSE;
   }
@@ -315,11 +312,11 @@
   if ( ! DDE_IsRemoteWindow(msg->hwnd) && msg->hwnd!= (HWND16)-1)
      return FALSE;
 
-  dprintf_msg(stddeb, "%s: DDE_DoMessage(hwnd=0x%x,msg=0x%x,..)\n",
+  dprintf_info(msg, "%s: DDE_DoMessage(hwnd=0x%x,msg=0x%x,..)\n",
 	      msg_type[type], (int)msg->hwnd,(int)msg->message);
 
 
-  dprintf_msg(stddeb,
+  dprintf_info(msg,
 	      "DDE_DoMessage(hwnd=0x%x,msg=0x%x,..) // HWND_BROADCAST !\n",
 	      (int)msg->hwnd,(int)msg->message);
   remote_message=(void*)&msg_dat.dat.mtext;
@@ -364,7 +361,7 @@
 
    proc=DDE_WIN2PROC(wnd);
    msg=main_block->proc[proc].msg;
-   dprintf_msg(stddeb,"DDE_GetRemoteMessage: sending ACK "
+   dprintf_info(msg,"DDE_GetRemoteMessage: sending ACK "
 	       "to wnd=%4x, proc=%d,msg=%d, pid=%d\n",wnd,proc,msg,
 	       main_block->proc[proc].pid
      );
@@ -405,7 +402,7 @@
 
   if (size==DDE_MSG_SIZE) {	   /* is this a correct message (if any) ?*/
      was_sent=TRUE;
-     dprintf_msg(stddeb,
+     dprintf_info(msg,
 		 "DDE:receive sent message. msg=%04x wPar=%04x"
 		 " lPar=%08lx\n",
 		 remote_message->message, remote_message->wParam,
@@ -416,7 +413,7 @@
 
      if (size==DDE_MSG_SIZE) {	   /* is this a correct message (if any) ?*/
 	was_sent=FALSE;
-	dprintf_msg(stddeb,
+	dprintf_info(msg,
 		    "DDE:receive posted message. "
 		    "msg=%04x wPar=%04x lPar=%08lx\n",
 		    remote_message->message, remote_message->wParam,
@@ -432,7 +429,7 @@
 
   nesting++;
 
-  if (debugging_dde) {
+  if (debugging_info(dde)) {
      char *title;
      if (was_sent)
 	title="receive sent dde:";
@@ -445,7 +442,7 @@
     HWND16 dde_window= DDE_WIN_INFO(remote_message->hwnd).wnd;
      /* we should know exactly where to send the message (locally)*/
      if (was_sent) {
-	dprintf_dde(stddeb,
+	dprintf_info(dde,
 		    "SendMessage(wnd=0x%04x, msg=0x%04x, wPar=0x%04x,"
 		    "lPar=0x%08x\n",
 		    dde_window, remote_message->message,
@@ -527,7 +524,7 @@
      in_test--;
      return;
   }
-  dprintf_msg(stddeb,"DDE_TestDDE(0x%04x)\n", hwnd);
+  dprintf_info(msg,"DDE_TestDDE(0x%04x)\n", hwnd);
   if (hwnd==0)
       hwnd=-1;
   /* just send a message to see how things are going */
@@ -565,6 +562,7 @@
     DDEADVISE *ddeadvise;
     DDEDATA *ddedata;
     DDEPOKE *ddepoke;
+    dbg_decl_str(dde, 2048);
 
     if (is_dde_handle(msg->lParam & 0xffff) )
 	ptr=DDE_AttachHandle(msg->lParam&0xffff, NULL);
@@ -573,8 +571,8 @@
     wStatus=LOWORD(msg->lParam);
     hWord=HIWORD(msg->lParam);
 
-    fprintf(stddeb,"%s", desc);
-    fprintf(stddeb,"%04x %04x==%s %04x %08lx ",
+    dsprintf(dde,"%s", desc);
+    dsprintf(dde,"%04x %04x==%s %04x %08lx ",
 	    msg->hwnd, msg->message,"",/*MessageTypeNames[msg->message],*/
 	    msg->wParam, msg->lParam);
     switch(msg->message) {
@@ -588,52 +586,52 @@
 	/* DDEADVISE: hOptions in WM_DDE_ADVISE message */
 	if (ptr) {
 	   ddeadvise=ptr;
-	   fprintf(stddeb,"fDeferUpd=%d,fAckReq=%d,cfFormat=0x%x",
+	   dsprintf(dde,"fDeferUpd=%d,fAckReq=%d,cfFormat=0x%x",
 		   ddeadvise->fDeferUpd, ddeadvise->fAckReq,
 		   ddeadvise->cfFormat);
 	} else
-	   fprintf(stddeb,"NO-DATA");
-	fprintf(stddeb," atom=0x%x",hWord);
+	   dsprintf(dde,"NO-DATA");
+	dsprintf(dde," atom=0x%x",hWord);
 	break;
 
       case WM_DDE_UNADVISE:
-	fprintf(stddeb,"format=0x%x, atom=0x%x",wStatus,hWord);
+	dsprintf(dde,"format=0x%x, atom=0x%x",wStatus,hWord);
 	break;
       case WM_DDE_ACK:
 	ddeack=(DDEACK*)&wStatus;
-	fprintf(stddeb,"bAppReturnCode=%d,fBusy=%d,fAck=%d",
+	dsprintf(dde,"bAppReturnCode=%d,fBusy=%d,fAck=%d",
 		ddeack->bAppReturnCode, ddeack->fBusy, ddeack->fAck);
 	if (ddeack->fAck)
-	   fprintf(stddeb,"(True)");
+	   dsprintf(dde,"(True)");
 	else
-	   fprintf(stddeb,"(False)");
+	   dsprintf(dde,"(False)");
 	break;
 
       case WM_DDE_DATA:
 	if (ptr) {
 	   ddedata=ptr;
-	   fprintf(stddeb,"fResponse=%d,fRelease=%d,"
+	   dsprintf(dde,"fResponse=%d,fRelease=%d,"
 		   "fAckReq=%d,cfFormat=0x%x,value=\"%.*s\"",
 		   ddedata->fResponse, ddedata->fRelease,
 		   ddedata->fAckReq, ddedata->cfFormat,
 		   debug_last_handle_size- (int)sizeof(*ddedata)+1,
 		   ddedata->Value);
 	} else
-	   fprintf(stddeb,"NO-DATA");
-	fprintf(stddeb," atom=0x%04x",hWord);
+	   dsprintf(dde,"NO-DATA");
+	dsprintf(dde," atom=0x%04x",hWord);
 	break;
 
       case WM_DDE_POKE:
 	if (ptr) {
 	   ddepoke=ptr;
-	   fprintf(stddeb,"fRelease=%d,cfFormat=0x%x,value[0]='%c'",
+	   dsprintf(dde,"fRelease=%d,cfFormat=0x%x,value[0]='%c'",
 		   ddepoke->fRelease, ddepoke->cfFormat, ddepoke->Value[0]);
 	} else
-	   fprintf(stddeb,"NO-DATA");
-	fprintf(stddeb," atom=0x%04x",hWord);
+	   dsprintf(dde,"NO-DATA");
+	dsprintf(dde," atom=0x%04x",hWord);
 	break;
     }
-    fprintf(stddeb,"\n");
+    dprintf_info(dde,"%s\n", dbg_str(dde));
 }
 
 void dde_proc_done(dde_proc proc)
diff --git a/ipc/shm_block.c b/ipc/shm_block.c
index 6a5106b..5f5570f 100644
--- a/ipc/shm_block.c
+++ b/ipc/shm_block.c
@@ -16,9 +16,8 @@
 #include <assert.h>
 #include <unistd.h>
 #include <stdlib.h>
-#include <stddebug.h>
-#include <debug.h>
-#include <global.h>
+#include "debug.h"
+#include "global.h"
 #include "selectors.h"
 #include "shm_fragment.h"
 #include "shm_block.h"
@@ -38,7 +37,7 @@
  */
 void shm_setup_block(struct shm_block *block, int first, int size)
 {
-  dprintf_shm(stddeb,"Setting up shm block at 0x%08x\n",(int )block);
+  dprintf_info(shm,"Setting up shm block at 0x%08x\n",(int )block);
   /* setup block internal data structure */
   if (first <= 0) {
      first=sizeof(*block);
@@ -54,7 +53,7 @@
   /* block->size is initialized in shm_FragmentInit */
   shm_FragmentInit(block, first, size);  /* first item in the free list */
   
-  dprintf_shm(stddeb,
+  dprintf_info(shm,
 	      "block was set up at 0x%08x, size=0x%04xKB, 1st usable=%02x\n",
 	      (int )block,size/1024,first);
 }
diff --git a/ipc/shm_fragment.c b/ipc/shm_fragment.c
index 15c51fe..f5ec7bf 100644
--- a/ipc/shm_fragment.c
+++ b/ipc/shm_fragment.c
@@ -10,7 +10,6 @@
 #ifdef CONFIG_IPC
 
 #include <stdio.h>		   /* for debugging only */
-#include <stddebug.h>
 #include <debug.h>		   /* for "stddeb" */
 
 #include "shm_fragment.h"
diff --git a/ipc/shm_fragment_test.c b/ipc/shm_fragment_test.c
index c27061b..054ab63 100644
--- a/ipc/shm_fragment_test.c
+++ b/ipc/shm_fragment_test.c
@@ -9,7 +9,6 @@
  */
 #include <assert.h>
 #include <stdio.h>		   
-#include <stddebug.h>
 #define DEBUG_DEFINE_VARIABLES	   /* just avoid dumb errors */
 #include <debug.h>		   /* for "stddeb" */
 #include <stdlib.h>
diff --git a/ipc/shm_main_blk.c b/ipc/shm_main_blk.c
index 09a91b2..7402475 100644
--- a/ipc/shm_main_blk.c
+++ b/ipc/shm_main_blk.c
@@ -18,8 +18,7 @@
 #include <unistd.h>
 #include <errno.h>
 #include <signal.h>
-#include <stddebug.h>
-#include <debug.h>
+#include "debug.h"
 #include "shm_fragment.h"
 #include "shm_block.h"
 #include "shm_main_blk.h"
@@ -80,7 +79,7 @@
 /* setup a new main shm block (only construct a shm block object). */
 static void shm_setup_main_block()
 {
-  dprintf_shm(stddeb,"creating data structure\n");
+  dprintf_info(shm,"creating data structure\n");
   main_block->build_lock=1;
   strcpy(main_block->magic, shm_header);
 
@@ -134,29 +133,29 @@
 
   /* Make sure we don't work on somebody else's block */
   if (shm_info.shm_perm.cuid != getuid()) { /* creator is not me */
-     dprintf_shm(stddeb,"Creator is not me!\n");
+     dprintf_warn(shm, "Creator is not me!\n");
      return 0;
   }
 
-  dprintf_shm(stddeb,"shared memory exist, attaching anywhere\n");
+  dprintf_info(shm,"shared memory exist, attaching anywhere\n");
   main_block=(struct shm_main_block *)shmat(shm_id, 0, 0);
   if ( (int)main_block==-1) {
-     dprintf_shm(stddeb,"Attach failed\n");
+     dprintf_warn(shm, "Attach failed\n");
      return 0;
   }
 
   if (strcmp(main_block->magic, shm_header) != 0) {
-     dprintf_shm(stddeb,"Detaching, wrong magic\n");
+     dprintf_info(shm,"Detaching, wrong magic\n");
      shmdt((void *)main_block);
      return 0;
   }
 
-  if (debugging_shm)
+  if (debugging_info(shm))
      print_shm_info(shm_id);
 
   /* Is it an old unused block ? */
   if (shm_info.shm_nattch == 0) {
-     dprintf_shm(stddeb,"No attaches, deleting old data\n");
+     dprintf_info(shm,"No attaches, deleting old data\n");
      shm_delete_all(shm_id);
      return 0;
   }
@@ -181,10 +180,10 @@
     int shm_id;			/* Descriptor to this shared memory */
     int i;
 
-    dprintf_shm(stddeb,"shm_locate_MainBlock: trying to attach, key=0x%x\n",
+    dprintf_info(shm,"shm_locate_MainBlock: trying to attach, key=0x%x\n",
 		shm_key);
     for (i=0 ; i < SHM_KEY_RANGE ; i++) {
-       dprintf_shm(stddeb,"iteration=%d\n", i);
+       dprintf_info(shm,"iteration=%d\n", i);
 
        shm_id= shmget ( shm_key+i, SHM_MINBLOCK ,0700);
 
@@ -203,8 +202,8 @@
 	    case ENOMEM:	   /* no free memory */
 	    case ENOENT:	   /* this key does not exist */
 	    default :
-	      dprintf_shm(stddeb,"shmget failed, errno=%d, %s\n",
-			  errno, strerror(errno) );
+	      dprintf_warn(shm,"shmget failed, errno=%d, %s\n",
+		     errno, strerror(errno) );
 	      return 0;		   /* Failed */
 	  }
        } /* if .. else */
@@ -223,7 +222,7 @@
   int flags= 0700 | IPC_CREAT | IPC_EXCL;
   int i;
 
-  dprintf_shm(stddeb,"creating shared memory\n");
+  dprintf_info(shm,"creating shared memory\n");
 
   /* try to allocate shared memory with key="Wine", size=SHM_MINBLOCK, */
   /* complete user permission */
@@ -233,12 +232,12 @@
 	break;
   }
   if (shm_id == -1) {
-     dprintf_shm(stddeb,"failed to create shared memory\n");
+     dprintf_warn(shm, "failed to create shared memory\n");
      return 0;
   }
-  dprintf_shm(stddeb,"shared memory created, attaching\n");
+  dprintf_info(shm,"shared memory created, attaching\n");
   main_block=(struct shm_main_block*) shmat(shm_id, 0,0);
-  if (debugging_shm)
+  if (debugging_info(shm))
      print_shm_info(shm_id);
   main_shm_id= shm_id;
   shm_setup_main_block();
diff --git a/ipc/shm_semaph.c b/ipc/shm_semaph.c
index f730154..6d021bb 100644
--- a/ipc/shm_semaph.c
+++ b/ipc/shm_semaph.c
@@ -15,8 +15,7 @@
 #include <sys/sem.h>
 #include <stdio.h>
 #include <errno.h>
-#include <stddebug.h>
-#include <debug.h>
+#include "debug.h"
 #include "shm_semaph.h"
 #define SEM_READ  0
 #define SEM_WRITE 1
@@ -29,7 +28,7 @@
   struct sembuf sop[2];
   int ret;
   
-  dprintf_sem(stddeb,"shm_read_wait(%d)\n",semid);
+  dprintf_info(sem,"shm_read_wait(%d)\n",semid);
   sop[0].sem_num=SEM_READ;
   sop[0].sem_op=1;		   /* add this read instance */
   sop[0].sem_flg=SEM_UNDO;	   /* undo in case process dies */
@@ -51,7 +50,7 @@
   struct sembuf sop[3];
   int ret;
   
-  dprintf_sem(stddeb,"shm_write_wait(%d)\n",semid);
+  dprintf_info(sem,"shm_write_wait(%d)\n",semid);
   sop[0].sem_num=SEM_READ;
   sop[0].sem_op=0;		   /* wait until no reading instance exist */
   sop[0].sem_flg=SEM_UNDO;		   
@@ -77,7 +76,7 @@
   struct sembuf sop[2];
   int ret;
 
-  dprintf_sem(stddeb,"shm_write_signal(%d)\n",semid);
+  dprintf_info(sem,"shm_write_signal(%d)\n",semid);
   sop[0].sem_num=SEM_READ;
   sop[0].sem_op=-1;	
   sop[0].sem_flg=IPC_NOWAIT | SEM_UNDO;	/* no reason to wait */
@@ -100,7 +99,7 @@
   struct sembuf sop[2];
   int ret;
 
-  dprintf_sem(stddeb,"shm_read_signal(%d)\n",semid);
+  dprintf_info(sem,"shm_read_signal(%d)\n",semid);
   sop[0].sem_num=SEM_READ;
   sop[0].sem_op=-1;	
   sop[0].sem_flg=IPC_NOWAIT | SEM_UNDO;	/* no reason to wait */
diff --git a/ipc/shm_semaph_test.c b/ipc/shm_semaph_test.c
index fdceeb5..6132861 100644
--- a/ipc/shm_semaph_test.c
+++ b/ipc/shm_semaph_test.c
@@ -16,7 +16,6 @@
 #include "shm_semaph.h"
 #include <sys/shm.h>
 #define DEBUG_DEFINE_VARIABLES
-#include <stddebug.h>
 #include <debug.h>
 
 static volatile int * volatile data;
diff --git a/ipc/wine_test_stub.c b/ipc/wine_test_stub.c
index 0fdb599..2229351 100644
--- a/ipc/wine_test_stub.c
+++ b/ipc/wine_test_stub.c
@@ -5,7 +5,6 @@
 #include <win.h>
 #define DEBUG_DEFINE_VARIABLES
 #define DEBUG_ALL
-#include <stddebug.h>
 #include <debug.h>
 
 #define DDE_PROC2WIN(proc_idx)   (  (HWND) ~( (proc_idx)+1)  )
diff --git a/library/winestub.c b/library/winestub.c
index c23e075..f81eda6 100644
--- a/library/winestub.c
+++ b/library/winestub.c
@@ -1,17 +1,9 @@
 /* Sample winestub.c file for compiling programs with libwine.so. */
 
 #include <string.h>
-#include <stdio.h>
 #include "windows.h"
 #include "xmalloc.h"
 
-/* Stub needed for linking with Winelib */
-/* FIXME: this should not be necessary */
-HMODULE32 BUILTIN_LoadModule( LPCSTR name, BOOL32 force ) { 
-	fprintf(stderr,"BUILTIN_LoadModule(%s,%d) called in a library!\n",name,force);
-	return 0;
-}
-
 extern int PASCAL WinMain(HINSTANCE32,HINSTANCE32,LPSTR,int);
 extern BOOL32 MAIN_WinelibInit( int *argc, char *argv[] );
 extern void TASK_Reschedule(void);
@@ -23,7 +15,7 @@
 
 int main( int argc, char *argv [] )
 {
-  HINSTANCE16 hInstance;
+  HINSTANCE32 hInstance;
   LPSTR lpszCmdParam;
   int i, len = 0;
   _ARGC = argc;
diff --git a/loader/main.c b/loader/main.c
index e255cc7..d2a6423 100644
--- a/loader/main.c
+++ b/loader/main.c
@@ -11,8 +11,6 @@
 #include <string.h>
 #include <errno.h>
 #include "windows.h"
-#include "module.h"
-#include "selectors.h"
 #include "bitmap.h"
 #include "comm.h"
 #include "win.h"
@@ -27,7 +25,6 @@
 #include "heap.h"
 #include "keyboard.h"
 #include "miscemu.h"
-#include "neexe.h"
 #include "options.h"
 #include "spy.h"
 #include "task.h"
@@ -36,7 +33,6 @@
 #include "dce.h"
 #include "shell.h"
 #include "winproc.h"
-#include "stddebug.h"
 #include "debug.h"
 
 
diff --git a/loader/module.c b/loader/module.c
index c7216e6..8bc0783 100644
--- a/loader/module.c
+++ b/loader/module.c
@@ -16,7 +16,6 @@
 #include "file.h"
 #include "global.h"
 #include "heap.h"
-#include "hook.h"
 #include "module.h"
 #include "neexe.h"
 #include "process.h"
@@ -25,7 +24,6 @@
 #include "stackframe.h"
 #include "task.h"
 #include "toolhelp.h"
-#include "stddebug.h"
 #include "debug.h"
 #include "callback.h"
 
@@ -34,6 +32,9 @@
 static HMODULE16 hFirstModule = 0;
 static HMODULE16 hCachedModule = 0;  /* Module cached by MODULE_OpenFile */
 
+static HMODULE32 MODULE_LoadModule(LPCSTR name,BOOL32 force) { return 0; }
+HMODULE32 (*fnBUILTIN_LoadModule)(LPCSTR name,BOOL32 force) = MODULE_LoadModule;
+
 
 /***********************************************************************
  *           MODULE_GetPtr
@@ -268,7 +269,7 @@
     static int cachedfd = -1;
 
     hModule = MODULE_HANDLEtoHMODULE16(hModule);
-    dprintf_module( stddeb, "MODULE_OpenFile(%04x) cache: mod=%04x fd=%d\n",
+    dprintf_info(module, "MODULE_OpenFile(%04x) cache: mod=%04x fd=%d\n",
                     hModule, hCachedModule, cachedfd );
     if (!(pModule = MODULE_GetPtr( hModule ))) return -1;
     if (hCachedModule == hModule) return cachedfd;
@@ -279,7 +280,7 @@
         (cachedfd = open( full_name.long_name, O_RDONLY )) == -1)
         fprintf( stderr, "MODULE_OpenFile: can't open file '%s' for module %04x\n",
                  name, hModule );
-    dprintf_module( stddeb, "MODULE_OpenFile: opened '%s' -> %d\n",
+    dprintf_info(module, "MODULE_OpenFile: opened '%s' -> %d\n",
                     name, cachedfd );
     return cachedfd;
 }
@@ -568,7 +569,7 @@
     {
         fastload_offset=ne_header.fastload_offset<<ne_header.align_shift_count;
         fastload_length=ne_header.fastload_length<<ne_header.align_shift_count;
-        dprintf_module( stddeb, "Using fast-load area offset=%x len=%d\n",
+        dprintf_info(module, "Using fast-load area offset=%x len=%d\n",
                         fastload_offset, fastload_length );
         if ((fastload = HeapAlloc( SystemHeap, 0, fastload_length )) != NULL)
         {
@@ -755,7 +756,7 @@
 
     if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
 
-    dprintf_module( stddeb, "MODULE_GetOrdinal(%04x,'%s')\n",
+    dprintf_info(module, "MODULE_GetOrdinal(%04x,'%s')\n",
                     hModule, name );
 
       /* First handle names of the form '#xxxx' */
@@ -778,7 +779,7 @@
     {
         if (((BYTE)*cpnt == len) && !memcmp( cpnt+1, buffer, len ))
         {
-            dprintf_module( stddeb, "  Found: ordinal=%d\n",
+            dprintf_info(module, "  Found: ordinal=%d\n",
                             *(WORD *)(cpnt + *cpnt + 1) );
             return *(WORD *)(cpnt + *cpnt + 1);
         }
@@ -796,7 +797,7 @@
     {
         if (((BYTE)*cpnt == len) && !memcmp( cpnt+1, buffer, len ))
         {
-            dprintf_module( stddeb, "  Found: ordinal=%d\n",
+            dprintf_info(module, "  Found: ordinal=%d\n",
                             *(WORD *)(cpnt + *cpnt + 1) );
             return *(WORD *)(cpnt + *cpnt + 1);
         }
@@ -1043,7 +1044,7 @@
     if (ordinal) WEP = MODULE_GetEntryPoint( hModule, ordinal );
     if (!WEP)
     {
-	dprintf_module( stddeb, "module %04x doesn't have a WEP\n", hModule );
+	dprintf_warn(module, "module %04x doesn't have a WEP\n", hModule );
 	return FALSE;
     }
     return Callbacks->CallWindowsExitProc( WEP, WEP_FREE_DLL );
@@ -1157,13 +1158,13 @@
         if (!hModule)  /* We have to load the module */
         {
             /* Try to load the built-in first if not disabled */
-            if ((hModule = BUILTIN_LoadModule( name, FALSE )))
+            if ((hModule = fnBUILTIN_LoadModule( name, FALSE )))
                 return MODULE_HANDLEtoHMODULE16( hModule );
             
             if ((hFile = OpenFile32( name, &ofs, OF_READ )) == HFILE_ERROR32)
             {
                 /* Now try the built-in even if disabled */
-                if ((hModule = BUILTIN_LoadModule( name, TRUE )))
+                if ((hModule = fnBUILTIN_LoadModule( name, TRUE )))
                 {
                     fprintf( stderr, "Warning: could not load Windows DLL '%s', using built-in module.\n", name );
                     return MODULE_HANDLEtoHMODULE16( hModule );
@@ -1267,12 +1268,34 @@
 }
 
 /**********************************************************************
- *	    LoadModule32    (KERNEL32)
- * FIXME: check this function
+ *	    LoadModule32    (KERNEL32.499)
+ *
+ * FIXME
+ *
+ *  This should get implemented via CreateProcess -- MODULE_Load
+ *  is resolutely 16-bit.
  */
 DWORD LoadModule32( LPCSTR name, LPVOID paramBlock ) 
 {
+#ifdef 0
+  LOADPARAMS32 *p = paramBlock;
+  STARTUPINFO st;
+  PROCESSINFORMATION pi;
+  st.cb = sizeof(STARTUPINFO);
+  st.wShowWindow = p->lpCmdShow[2] ; WRONG
+
+  BOOL32 ret = CreateProcess32A( name, p->lpCmdLine, 
+				 NULL, NULL, FALSE, 0, p->lpEnvAddress,
+				 NULL, &st, &pi);
+  if (!ret) {
+    /*    handle errors appropriately */
+  }
+  CloseHandle32(pi.hProcess);
+  CloseHandle32(pi.hThread); 
+
+#else
     return MODULE_Load( name, paramBlock, 0 );
+#endif
 }
 
 
@@ -1284,7 +1307,7 @@
     NE_MODULE *pModule;
 
     if (!(pModule = MODULE_GetPtr( hModule ))) return FALSE;
-    dprintf_module( stddeb, "FreeModule16: %s count %d\n", 
+    dprintf_info(module, "FreeModule16: %s count %d\n", 
 		    MODULE_GetModuleName(hModule), pModule->count );
 
     return MODULE_FreeModule( hModule, GlobalLock16(GetCurrentTask()) );
@@ -1312,7 +1335,7 @@
 {
     HMODULE32	hModule;
 
-    dprintf_win32(stddeb, "GetModuleHandleA: %s\n", module ? module : "NULL");
+    dprintf_info(win32, "GetModuleHandleA: %s\n", module ? module : "NULL");
 /* Freecell uses the result of GetModuleHandleA(0) as the hInstance in
 all calls to e.g. CreateWindowEx. */
     if (module == NULL) {
@@ -1341,7 +1364,7 @@
     NE_MODULE *pModule;
 
     if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
-    dprintf_module( stddeb, "GetModuleUsage(%04x): returning %d\n",
+    dprintf_info(module, "GetModuleUsage(%04x): returning %d\n",
                     hModule, pModule->count );
     return pModule->count;
 }
@@ -1358,7 +1381,7 @@
     if (!hModule) hModule = GetCurrentTask();
     if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
     lstrcpyn32A( lpFileName, NE_MODULE_NAME(pModule), nSize );
-    dprintf_module( stddeb, "GetModuleFileName16: %s\n", lpFileName );
+    dprintf_info(module, "GetModuleFileName16: %s\n", lpFileName );
     return strlen(lpFileName);
 }
 
@@ -1378,7 +1401,7 @@
     }
     if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
     lstrcpyn32A( lpFileName, NE_MODULE_NAME(pModule), size );
-    dprintf_module( stddeb, "GetModuleFileName32A: %s\n", lpFileName );
+    dprintf_info(module, "GetModuleFileName32A: %s\n", lpFileName );
     return strlen(lpFileName);
 }                   
  
@@ -1473,7 +1496,7 @@
  */
 BOOL32 WINAPI FreeLibrary32(HINSTANCE32 hLibModule)
 {
-	dprintf_module(stddeb,"FreeLibrary: hLibModule: %08x\n", hLibModule);
+	dprintf_info(module,"FreeLibrary: hLibModule: %08x\n", hLibModule);
 	return MODULE_FreeModule(hLibModule, 
 	                         GlobalLock16(GetCurrentTask()) );
 }
@@ -1491,7 +1514,7 @@
         fprintf( stderr, "LoadLibrary not supported in Winelib\n" );
         return 0;
     }
-    dprintf_module( stddeb, "LoadLibrary: (%08x) %s\n", (int)libname, libname);
+    dprintf_info(module, "LoadLibrary: (%08x) %s\n", (int)libname, libname);
 
     handle = MODULE_Load( libname, (LPVOID)-1, 0 );
     if (handle == (HINSTANCE16)2)  /* file not found */
@@ -1521,7 +1544,7 @@
  */
 void WINAPI FreeLibrary16( HINSTANCE16 handle )
 {
-    dprintf_module( stddeb,"FreeLibrary: %04x\n", handle );
+    dprintf_info(module,"FreeLibrary: %04x\n", handle );
     FreeModule16( handle );
 }
 
@@ -1553,7 +1576,7 @@
 {
     LOADPARAMS params;
     HGLOBAL16 cmdShowHandle, cmdLineHandle;
-    HINSTANCE16 handle = 2;
+    HINSTANCE32 handle = 2;
     WORD *cmdShowPtr;
     char *p, *cmdline, filename[256];
     static int use_load_module = 1;
@@ -1630,7 +1653,7 @@
 	    params.cmdLine  = (SEGPTR)WIN16_GlobalLock16( cmdLineHandle );
 	    params.showCmd  = (SEGPTR)WIN16_GlobalLock16( cmdShowHandle );
 	    params.reserved = 0;
-	    handle = LoadModule16( filename, &params );
+	    handle = LoadModule32( filename, &params );
 	    if (handle == 2)  /* file not found */
 	    {
 		/* Check that the original file name did not have a suffix */
@@ -1735,16 +1758,16 @@
     hModule = MODULE_HANDLEtoHMODULE16(hModule);
     if (HIWORD(name)) {
         ordinal = MODULE_GetOrdinal( hModule, name );
-        dprintf_module( stddeb, "WIN32_GetProcAddress16: %04x '%s'\n",
+        dprintf_info(module, "WIN32_GetProcAddress16: %04x '%s'\n",
                         hModule, name );
     } else {
         ordinal = LOWORD(name);
-        dprintf_module( stddeb, "GetProcAddress: %04x %04x\n",
+        dprintf_info(module, "GetProcAddress: %04x %04x\n",
                         hModule, ordinal );
     }
     if (!ordinal) return (FARPROC16)0;
     ret = MODULE_GetEntryPoint( hModule, ordinal );
-    dprintf_module(stddeb,"WIN32_GetProcAddress16: returning %08x\n",(UINT32)ret);
+    dprintf_info(module,"WIN32_GetProcAddress16: returning %08x\n",(UINT32)ret);
     return ret;
 }
 
@@ -1762,20 +1785,20 @@
     if (HIWORD(name) != 0)
     {
         ordinal = MODULE_GetOrdinal( hModule, (LPSTR)PTR_SEG_TO_LIN(name) );
-        dprintf_module( stddeb, "GetProcAddress: %04x '%s'\n",
+        dprintf_info(module, "GetProcAddress: %04x '%s'\n",
                         hModule, (LPSTR)PTR_SEG_TO_LIN(name) );
     }
     else
     {
         ordinal = LOWORD(name);
-        dprintf_module( stddeb, "GetProcAddress: %04x %04x\n",
+        dprintf_info(module, "GetProcAddress: %04x %04x\n",
                         hModule, ordinal );
     }
     if (!ordinal) return (FARPROC16)0;
 
     ret = MODULE_GetEntryPoint( hModule, ordinal );
 
-    dprintf_module( stddeb, "GetProcAddress: returning %08x\n", (UINT32)ret );
+    dprintf_info(module, "GetProcAddress: returning %08x\n", (UINT32)ret );
     return ret;
 }
 
@@ -1788,9 +1811,9 @@
     NE_MODULE *pModule;
 
     if (HIWORD(function))
-	dprintf_win32(stddeb,"GetProcAddress32(%08lx,%s)\n",(DWORD)hModule,function);
+	dprintf_info(win32,"GetProcAddress32(%08lx,%s)\n",(DWORD)hModule,function);
     else
-	dprintf_win32(stddeb,"GetProcAddress32(%08lx,%p)\n",(DWORD)hModule,function);
+	dprintf_info(win32,"GetProcAddress32(%08lx,%p)\n",(DWORD)hModule,function);
     if (!(pModule = MODULE_GetPtr( hModule )))
         return (FARPROC32)0;
     if (!pModule->module32)
diff --git a/loader/ne_image.c b/loader/ne_image.c
index d092b3d..7b13bab 100644
--- a/loader/ne_image.c
+++ b/loader/ne_image.c
@@ -23,7 +23,6 @@
 #include "file.h"
 #include "module.h"
 #include "stackframe.h"
-#include "stddebug.h"
 #include "debug.h"
 #include "xmalloc.h"
 
@@ -55,7 +54,7 @@
     if (!pSeg->filepos) return TRUE;  /* No file image, just return */
 	
     fd = MODULE_OpenFile( pModule->self );
-    dprintf_module( stddeb, "Loading segment %d, selector=%04x, flags=%04x\n",
+    dprintf_info(module, "Loading segment %d, selector=%04x, flags=%04x\n",
                     segnum, pSeg->selector, pSeg->flags );
     lseek( fd, pSeg->filepos << pModule->alignment, SEEK_SET );
     if (pSeg->size) size = pSeg->size;
@@ -143,7 +142,7 @@
     read( fd, &count, sizeof(count) );
     if (!count) return TRUE;
 
-    dprintf_fixup( stddeb, "Fixups for %*.*s, segment %d, selector %04x\n",
+    dprintf_info(fixup, "Fixups for %*.*s, segment %d, selector %04x\n",
                    *((BYTE *)pModule + pModule->name_table),
                    *((BYTE *)pModule + pModule->name_table),
                    (char *)pModule + pModule->name_table + 1,
@@ -153,7 +152,7 @@
     if (read( fd, reloc_entries, count * sizeof(struct relocation_entry_s)) !=
             count * sizeof(struct relocation_entry_s))
     {
-        dprintf_fixup( stddeb, "Unable to read relocation information\n" );
+        dprintf_warn(fixup, "Unable to read relocation information\n" );
         return FALSE;
     }
 
@@ -194,14 +193,14 @@
                             (char *)pTarget + pTarget->name_table + 1,
                             ordinal );
             }
-            if (debugging_fixup)
+            if (debugging_info(fixup))
             {
                 NE_MODULE *pTarget = MODULE_GetPtr( module );
-                fprintf( stddeb,"%d: %*.*s.%d=%04x:%04x\n", i + 1, 
-                         *((BYTE *)pTarget + pTarget->name_table),
-                         *((BYTE *)pTarget + pTarget->name_table),
-                         (char *)pTarget + pTarget->name_table + 1,
-                         ordinal, HIWORD(address), LOWORD(address) );
+                dprintf_info(fixup, "%d: %*.*s.%d=%04x:%04x\n", i + 1, 
+			     *((BYTE *)pTarget + pTarget->name_table),
+			     *((BYTE *)pTarget + pTarget->name_table),
+			     (char *)pTarget + pTarget->name_table + 1,
+			     ordinal, HIWORD(address), LOWORD(address) );
             }
 	    break;
 	    
@@ -215,20 +214,20 @@
 
             address = MODULE_GetEntryPoint( module, ordinal );
 
-            if (!address)
+            if (debugging_err(fixup) && !address)
             {
                 NE_MODULE *pTarget = MODULE_GetPtr( module );
-                fprintf( stderr, "Warning: no handler for %.*s.%s, setting to 0:0\n",
-                        *((BYTE *)pTarget + pTarget->name_table),
-                        (char *)pTarget + pTarget->name_table + 1, func_name );
+                dprintf_err(fixup, "Warning: no handler for %.*s.%s, setting to 0:0\n",
+			    *((BYTE *)pTarget + pTarget->name_table),
+			    (char *)pTarget + pTarget->name_table + 1, func_name );
             }
-            if (debugging_fixup)
+            if (debugging_info(fixup))
             {
-                NE_MODULE *pTarget = MODULE_GetPtr( module );
-                fprintf( stddeb,"%d: %.*s.%s=%04x:%04x\n", i + 1, 
-                         *((BYTE *)pTarget + pTarget->name_table),
-                         (char *)pTarget + pTarget->name_table + 1,
-                         func_name, HIWORD(address), LOWORD(address) );
+	        NE_MODULE *pTarget = MODULE_GetPtr( module );
+                dprintf_info(fixup, "%d: %.*s.%s=%04x:%04x\n", i + 1, 
+			     *((BYTE *)pTarget + pTarget->name_table),
+			     (char *)pTarget + pTarget->name_table + 1,
+			     func_name, HIWORD(address), LOWORD(address) );
             }
 	    break;
 	    
@@ -242,7 +241,7 @@
                 address = (FARPROC16)PTR_SEG_OFF_TO_SEGPTR( pSegTable[rep->target1-1].selector, rep->target2 );
 	    }
 	    
-	    dprintf_fixup(stddeb,"%d: %04x:%04x\n", 
+	    dprintf_info(fixup,"%d: %04x:%04x\n", 
 			  i + 1, HIWORD(address), LOWORD(address) );
 	    break;
 
@@ -255,21 +254,17 @@
 	     * successfully emulate the coprocessor if it doesn't
 	     * exist.
 	     */
-	    dprintf_fixup(stddeb,
-                   "%d: ADDR TYPE %d,  TYPE %d,  OFFSET %04x,  ",
+	    dprintf_info(fixup,
+                   "%d: ADDR TYPE %d,  TYPE %d,  OFFSET %04x,  TARGET %04x %04x\n",
 		   i + 1, rep->address_type, rep->relocation_type, 
-		   rep->offset);
-	    dprintf_fixup(stddeb,"TARGET %04x %04x\n", 
-		   rep->target1, rep->target2);
+		   rep->offset, rep->target1, rep->target2);
 	    continue;
 	    
 	  default:
-	    dprintf_fixup(stddeb,
-		   "WARNING: %d: ADDR TYPE %d,  unknown TYPE %d,  OFFSET %04x,  ",
-		   i + 1, rep->address_type, rep->relocation_type, 
-		   rep->offset);
-	    dprintf_fixup(stddeb,"TARGET %04x %04x\n", 
-		    rep->target1, rep->target2);
+	    dprintf_warn(fixup, "WARNING: %d: ADDR TYPE %d,  "
+			  "unknown TYPE %d, OFFSET %04x, TARGET %04x %04x\n",
+			  i + 1, rep->address_type, rep->relocation_type, 
+			  rep->offset, rep->target1, rep->target2);
 	    free(reloc_entries);
 	    return FALSE;
 	}
@@ -287,7 +282,7 @@
 	  case NE_RADDR_LOWBYTE:
             do {
                 sp = PTR_SEG_OFF_TO_LIN( pSeg->selector, offset );
-                dprintf_fixup(stddeb,"    %04x:%04x:%04x BYTE%s\n",
+                dprintf_info(fixup,"    %04x:%04x:%04x BYTE%s\n",
                               pSeg->selector, offset, *sp, additive ? " additive":"");
                 offset = *sp;
 		if(additive)
@@ -301,7 +296,7 @@
 	  case NE_RADDR_OFFSET16:
 	    do {
                 sp = PTR_SEG_OFF_TO_LIN( pSeg->selector, offset );
-		dprintf_fixup(stddeb,"    %04x:%04x:%04x OFFSET16%s\n",
+		dprintf_info(fixup,"    %04x:%04x:%04x OFFSET16%s\n",
                               pSeg->selector, offset, *sp, additive ? " additive" : "" );
 		offset = *sp;
 		*sp = LOWORD(address);
@@ -313,7 +308,7 @@
 	  case NE_RADDR_POINTER32:
 	    do {
                 sp = PTR_SEG_OFF_TO_LIN( pSeg->selector, offset );
-		dprintf_fixup(stddeb,"    %04x:%04x:%04x POINTER32%s\n",
+		dprintf_info(fixup,"    %04x:%04x:%04x POINTER32%s\n",
                               pSeg->selector, offset, *sp, additive ? " additive" : "" );
 		offset = *sp;
 		*sp    = LOWORD(address);
@@ -326,7 +321,7 @@
 	  case NE_RADDR_SELECTOR:
 	    do {
                 sp = PTR_SEG_OFF_TO_LIN( pSeg->selector, offset );
-		dprintf_fixup(stddeb,"    %04x:%04x:%04x SELECTOR%s\n",
+		dprintf_info(fixup,"    %04x:%04x:%04x SELECTOR%s\n",
                               pSeg->selector, offset, *sp, additive ? " additive" : "" );
 		offset = *sp;
 		*sp    = HIWORD(address);
@@ -339,12 +334,10 @@
 	    break;
 	    
 	  default:
-	    dprintf_fixup(stddeb,
-		   "WARNING: %d: unknown ADDR TYPE %d,  TYPE %d,  OFFSET %04x,  ",
+	    dprintf_warn(fixup, "WARNING: %d: unknown ADDR TYPE %d,  "
+			  "TYPE %d,  OFFSET %04x,  TARGET %04x %04x\n",
 		   i + 1, rep->address_type, rep->relocation_type, 
-		   rep->offset);
-	    dprintf_fixup(stddeb,
-		   "TARGET %04x %04x\n", rep->target1, rep->target2);
+		   rep->offset, rep->target1, rep->target2);
 	    free(reloc_entries);
 	    return FALSE;
 	}
@@ -374,7 +367,7 @@
         DWORD oldstack;
         WORD saved_dgroup = pSegTable[pModule->dgroup - 1].selector;
 
-        dprintf_module(stddeb, "MODULE_Load: %.*s is a self-loading module!\n",
+        dprintf_info(module, "NE_LoadAllSegments: %.*s is a self-loading module!\n",
                        *((BYTE*)pModule + pModule->name_table),
                        (char *)pModule + pModule->name_table + 1);
         if (!NE_LoadSegment( pModule, 1 )) return FALSE;
@@ -431,7 +424,7 @@
         BYTE *pstr = (BYTE *)pModule + pModule->import_table + *pModRef;
         memcpy( buffer, pstr + 1, *pstr );
         strcpy( buffer + *pstr, ".dll" );
-        dprintf_module( stddeb, "Loading '%s'\n", buffer );
+        dprintf_info(module, "Loading '%s'\n", buffer );
         if (!(*pModRef = MODULE_FindModule( buffer )))
         {
             /* If the DLL is not loaded yet, load it and store */
@@ -483,12 +476,13 @@
     WORD dgroup = 0;
     WORD sel;
     BYTE *p, *fixup_ptr, count;
+    dbg_decl_str(module, 512);
 
     pSegTable = NE_SEG_TABLE(pModule);
     if (pModule->flags & NE_FFLAGS_SINGLEDATA)
         dgroup = pSegTable[pModule->dgroup-1].selector;
 
-    dprintf_module( stddeb, "MODULE_FixupPrologs(%04x)\n", pModule->self );
+    dprintf_info(module, "MODULE_FixupPrologs(%04x)\n", pModule->self );
     p = (BYTE *)pModule + pModule->entry_table;
     while (*p)
     {
@@ -509,21 +503,23 @@
         p += 2;
         while (count-- > 0)
         {
-            dprintf_module( stddeb,"Flags: %04x, sel %02x ", *p, sel);
+	    dbg_reset_str(module);
+            dsprintf(module,"Flags: %04x, sel %02x ", *p, sel);
             /* According to the output generated by TDUMP, the flags mean:
              * 0x0001 function is exported
 	     * 0x0002 Single data (seems to occur only in DLLs)
 	     */
 	    if (sel == 0xff) { /* moveable */
-		dprintf_module( stddeb, "(%02x) o %04x ", p[3], *(WORD *)(p+4) );
+		dsprintf(module, "(%02x) o %04x", p[3], *(WORD *)(p+4) );
 		fixup_ptr = (char *)GET_SEL_BASE(pSegTable[p[3]-1].selector) + *(WORD *)(p + 4);
 	    } else { /* fixed */
-		dprintf_module( stddeb, "offset %04x ", *(WORD *)(p+1) );
-		fixup_ptr = (char *)GET_SEL_BASE(pSegTable[sel-1].selector) + *(WORD *)(p + 1);
+		dsprintf(module, "offset %04x", *(WORD *)(p+1) );
+		fixup_ptr = (char *)GET_SEL_BASE(pSegTable[sel-1].selector) + 
+		  *(WORD *)(p + 1);
 	    }
-	    dprintf_module( stddeb, "Signature: %02x %02x %02x,ff %x\n",
-			   fixup_ptr[0], fixup_ptr[1], fixup_ptr[2],
-			   pModule->flags );
+	    dprintf_info(module, "%s Signature: %02x %02x %02x,ff %x\n",
+			    dbg_str(module), fixup_ptr[0], fixup_ptr[1], 
+			    fixup_ptr[2], pModule->flags );
             if (*p & 0x0001)
             {
                 /* Verify the signature */
@@ -553,11 +549,11 @@
 			}
                     }
                 } else {
-		    dprintf_fixup( stddeb, "Unknown signature\n" );
+		    dprintf_warn(fixup, "Unknown signature\n" );
 		}
             }
 	    else
-	      dprintf_module( stddeb,"\n");
+	      dprintf_info(module,"\n");
             p += (sel == 0xff) ? 6 : 3;  
         }
     }
@@ -618,8 +614,17 @@
     }
     else  /* DATA SINGLE DLL */
     {
-        DS_reg(&context)  = pSegTable[pModule->dgroup-1].selector;
-        ECX_reg(&context) = pModule->heap_size;
+	if (pModule->dgroup) {
+            DS_reg(&context)  = pSegTable[pModule->dgroup-1].selector;
+            ECX_reg(&context) = pModule->heap_size;
+	}
+	else /* hmm, DLL has no dgroup,
+		but why has it NE_FFLAGS_SINGLEDATA set ?
+		Buggy DLL compiler ? */
+	{
+            DS_reg(&context)  = 0;
+            ECX_reg(&context) = 0;
+	}
     }
 
     CS_reg(&context)  = pSegTable[pModule->cs-1].selector;
@@ -630,7 +635,7 @@
 
 
     pModule->cs = 0;  /* Don't initialize it twice */
-    dprintf_dll( stddeb, "Calling LibMain, cs:ip=%04lx:%04x ds=%04lx di=%04x cx=%04x\n", 
+    dprintf_info(dll, "Calling LibMain, cs:ip=%04lx:%04x ds=%04lx di=%04x cx=%04x\n", 
                  CS_reg(&context), IP_reg(&context), DS_reg(&context),
                  DI_reg(&context), CX_reg(&context) );
     Callbacks->CallRegisterShortProc( &context, 0 );
diff --git a/loader/ne_resource.c b/loader/ne_resource.c
index 0e340bd..b091411 100644
--- a/loader/ne_resource.c
+++ b/loader/ne_resource.c
@@ -18,7 +18,6 @@
 #include "module.h"
 #include "neexe.h"
 #include "resource.h"
-#include "stddebug.h"
 #include "debug.h"
 
 #define  NEXT_TYPEINFO(pTypeInfo) ((NE_TYPEINFO *)((char*)((pTypeInfo) + 1) + \
@@ -47,13 +46,13 @@
 	pNameInfo = (NE_NAMEINFO *)(pTypeInfo + 1);
 	for (count = pTypeInfo->count; count > 0; count--, pNameInfo++)
 	{
-            dprintf_resource( stddeb, "NameTable entry: type=%04x id=%04x\n",
+            dprintf_info(resource, "NameTable entry: type=%04x id=%04x\n",
                               pTypeInfo->type_id, pNameInfo->id );
             handle = LoadResource16( pModule->self, 
 				   (HRSRC16)((int)pNameInfo - (int)pModule) );
             for(p = (WORD*)LockResource16(handle); p && *p; p = (WORD *)((char*)p+*p))
             {
-                dprintf_resource( stddeb,"  type=%04x '%s' id=%04x '%s'\n",
+                dprintf_info(resource,"  type=%04x '%s' id=%04x '%s'\n",
                                   p[1], (char *)(p+3), p[2],
                                   (char *)(p+3)+strlen((char *)(p+3))+1 );
                 /* Check for correct type */
@@ -81,7 +80,7 @@
 
                 /* If we get here, we've found the entry */
 
-                dprintf_resource( stddeb, "  Found!\n" );
+                dprintf_info(resource, "  Found!\n" );
                 ret = MAKELONG( p[1], p[2] );
                 break;
             }
@@ -113,11 +112,11 @@
 		BYTE *p = (BYTE*)pModule + pModule->res_table + pTypeInfo->type_id;
 		if ((*p == len) && !lstrncmpi32A( p+1, str, len ))
 		{
-		    dprintf_resource( stddeb, "  Found type '%s'\n", str );
+		    dprintf_info(resource, "  Found type '%s'\n", str );
 		    return pTypeInfo;
 		}
 	    }
-	    dprintf_resource( stddeb, "  Skipping type %04x\n", pTypeInfo->type_id );
+	    dprintf_info(resource, "  Skipping type %04x\n", pTypeInfo->type_id );
 	    pTypeInfo = NEXT_TYPEINFO(pTypeInfo);
 	}
     }
@@ -128,10 +127,10 @@
 	{
             if (pTypeInfo->type_id == id)
 	    {
-		dprintf_resource( stddeb, "  Found type %04x\n", id );
+		dprintf_info(resource, "  Found type %04x\n", id );
 		return pTypeInfo;
 	    }
-	    dprintf_resource( stddeb, "  Skipping type %04x\n", pTypeInfo->type_id );
+	    dprintf_info(resource, "  Skipping type %04x\n", pTypeInfo->type_id );
 	    pTypeInfo = NEXT_TYPEINFO(pTypeInfo);
 	}
     }
@@ -189,7 +188,7 @@
 	WORD sizeShift = *(WORD *)((char *)pModule + pModule->res_table);
 	NE_NAMEINFO* pNameInfo = (NE_NAMEINFO*)((char*)pModule + hRsrc);
 
-        dprintf_resource( stddeb, "NEResourceHandler: loading, pos=%d, len=%d\n",
+        dprintf_info(resource, "NEResourceHandler: loading, pos=%d, len=%d\n",
                          (int)pNameInfo->offset << sizeShift,
                          (int)pNameInfo->length << sizeShift );
 	if( hMemObj )
@@ -217,7 +216,7 @@
     NE_MODULE *pModule = MODULE_GetPtr( hModule );
     NE_TYPEINFO *pTypeInfo = (NE_TYPEINFO *)((char *)pModule + pModule->res_table + 2);
 
-    dprintf_resource(stddeb,"InitResourceHandler[%04x]\n", hModule );
+    dprintf_info(resource,"InitResourceHandler[%04x]\n", hModule );
 
     while(pTypeInfo->type_id)
     {
@@ -280,15 +279,15 @@
 	    hRsrc = NE_FindResourceFromType(pModule, pTypeInfo, resId);
 	    if( hRsrc )
 	    {
-		dprintf_resource( stddeb, "    Found id %08lx\n", resId );
+		dprintf_info(resource, "    Found id %08lx\n", resId );
 		return hRsrc;
 	    }
-	    dprintf_resource( stddeb, "    Not found, going on\n" );
+	    dprintf_info(resource, "    Not found, going on\n" );
 	    pTypeInfo = NEXT_TYPEINFO(pTypeInfo);
 	}
     } while( pTypeInfo );
 
-    dprintf_resource( stddeb, "failed!\n");
+    dprintf_warn(resource, "failed!\n");
     return 0;
 }
 
@@ -389,7 +388,7 @@
 	    && !(GlobalFlags16(pNameInfo->handle) & GMEM_DISCARDED))
 	{
 	    pNameInfo->usage++;
-	    dprintf_resource( stddeb, "  Already loaded, new count=%d\n",
+	    dprintf_info(resource, "  Already loaded, new count=%d\n",
 			      pNameInfo->usage );
 	}
 	else
@@ -460,7 +459,7 @@
         pTypeInfo = (NE_TYPEINFO *)pNameInfo;
     }
 
-    dprintf_resource(stddeb, "NE_FreeResource[%04x]: no intrinsic resource for %04x\n", 
+    dprintf_info(resource, "NE_FreeResource[%04x]: no intrinsic resource for %04x\n", 
 			      hModule, handle );
     GlobalFree16( handle ); /* it could have been DirectResAlloc()'ed */
     return handle;
diff --git a/loader/pe_image.c b/loader/pe_image.c
index 96a9b15..842c7f7 100644
--- a/loader/pe_image.c
+++ b/loader/pe_image.c
@@ -1,7 +1,7 @@
 /* 
  *  Copyright	1994	Eric Youndale & Erik Bos
  *  Copyright	1995	Martin von Löwis
- *  Copyright   1996    Marcus Meissner
+ *  Copyright   1996-98 Marcus Meissner
  *
  *	based on Eric Youndale's pe-test and:
  *
@@ -9,8 +9,26 @@
  * make that:
  *	ftp.microsoft.com:/developr/MSDN/OctCD/PEFILE.ZIP
  */
+/* Notes:
+ * Before you start changing something in this file be aware of the following:
+ *
+ * - There are several functions called recursively. In a very subtle and 
+ *   obscure way. DLLs can reference each other recursively etc.
+ * - If you want to enhance, speed up or clean up something in here, think
+ *   twice WHY it is implemented in that strange way. There is usually a reason.
+ *   Though sometimes it might just be lazyness ;)
+ * - In PE_MapImage, right before fixup_imports() all external and internal 
+ *   state MUST be correct since this function can be called with the SAME image
+ *   AGAIN. (Thats recursion for you.) That means MODREF.module and
+ *   NE_MODULE.module32.
+ * - No, you cannot use Linux mmap() to mmap() the images directly. Linux aligns
+ *   them at pagesize (4096), Win32 requires 512 byte alignment.
+ * - All those function map things into a new addresspace. From the wrong
+ *   process and the wrong thread. So calling other API functions will mess 
+ *   things up badly sometimes.
+ */
 
-#include <ctype.h>
+/*#include <ctype.h>*/
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -32,7 +50,6 @@
 #include "global.h"
 #include "task.h"
 #include "ldt.h"
-#include "stddebug.h"
 #include "debug.h"
 #include "xmalloc.h"
 
@@ -57,7 +74,7 @@
   IMAGE_EXPORT_DIRECTORY *pe_exports = (IMAGE_EXPORT_DIRECTORY*)RVA(rva_start);
 
   Module = (char*)RVA(pe_exports->Name);
-  dprintf_win32(stddeb,"\n*******EXPORT DATA*******\nModule name is %s, %ld functions, %ld names\n", 
+  dprintf_info(win32,"\n*******EXPORT DATA*******\nModule name is %s, %ld functions, %ld names\n", 
 	 Module,
 	 pe_exports->NumberOfFunctions,
 	 pe_exports->NumberOfNames);
@@ -66,19 +83,23 @@
   functions=function=(u_long*) RVA(pe_exports->AddressOfFunctions);
   name=(u_char**) RVA(pe_exports->AddressOfNames);
 
-  dprintf_win32(stddeb," Ord    RVA     Addr   Name\n" );
+  dprintf_info(win32," Ord    RVA     Addr   Name\n" );
   for (i=0;i<pe_exports->NumberOfFunctions;i++, function++)
   {
       if (!*function) continue;  /* No such function */
-      dprintf_win32( stddeb,"%4ld %08lx %08x",
-                     i + pe_exports->Base, *function, RVA(*function) );
-      /* Check if we have a name for it */
-      for (j = 0; j < pe_exports->NumberOfNames; j++)
+      if (debugging_info(win32)){
+	dbg_decl_str(win32, 1024);
+
+	dsprintf(win32,"%4ld %08lx %08x",
+		 i + pe_exports->Base, *function, RVA(*function) );
+	/* Check if we have a name for it */
+	for (j = 0; j < pe_exports->NumberOfNames; j++)
           if (ordinal[j] == i)
-              dprintf_win32( stddeb, "  %s", (char*)RVA(name[j]) );
-      if ((*function >= rva_start) && (*function <= rva_end))
-	  dprintf_win32(stddeb, " (forwarded -> %s)", (char *)RVA(*function));
-      dprintf_win32( stddeb,"\n" );
+	    dsprintf(win32, "  %s", (char*)RVA(name[j]) );
+	if ((*function >= rva_start) && (*function <= rva_end))
+	  dsprintf(win32, " (forwarded -> %s)", (char *)RVA(*function));
+	dprintf_info(win32,"%s\n", dbg_str(win32));
+      }
   }
 }
 
@@ -114,9 +135,9 @@
 	exports   = pem->pe_export;
 
 	if (HIWORD(funcName))
-		dprintf_win32(stddeb,"PE_FindExportedFunction(%s)\n",funcName);
+		dprintf_info(win32,"PE_FindExportedFunction(%s)\n",funcName);
 	else
-		dprintf_win32(stddeb,"PE_FindExportedFunction(%d)\n",(int)funcName);
+		dprintf_info(win32,"PE_FindExportedFunction(%d)\n",(int)funcName);
 	if (!exports) {
 		fprintf(stderr,"Module %08x/MODREF %p doesn't have a exports table.\n",hModule,pem);
 		return NULL;
@@ -136,6 +157,7 @@
 			if(!strcmp(ename,funcName))
                         {
                             addr = function[*ordinal];
+                            if (!addr) return NULL;
                             if ((addr < rva_start) || (addr >= rva_end))
                                 return (FARPROC32)RVA(addr);
                             forward = (char *)RVA(addr);
@@ -146,11 +168,12 @@
 		}
 	} else {
 		if (LOWORD(funcName)-exports->Base > exports->NumberOfFunctions) {
-			dprintf_win32(stddeb,"	ordinal %d out of range!\n",
+			dprintf_info(win32,"	ordinal %d out of range!\n",
                                       LOWORD(funcName));
 			return NULL;
 		}
 		addr = function[(int)funcName-exports->Base];
+                if (!addr) return NULL;
 		if ((addr < rva_start) || (addr >= rva_end))
 			return (FARPROC32)RVA(addr);
 		forward = (char *)RVA(addr);
@@ -183,7 +206,7 @@
         modname = "<unknown>";
 
     /* OK, now dump the import list */
-    dprintf_win32 (stddeb, "\nDumping imports list\n");
+    dprintf_info(win32, "\nDumping imports list\n");
 
     /* first, count the number of imported non-internal modules */
     pe_imp = pem->pe_import;
@@ -230,27 +253,24 @@
 		xpem = xpem->next;
 	}
 	if (xpem) {
-		/* it has been loaded *BEFORE* us, so we have to init
-		 * it before us. we just swap the two modules which should
-		 * work.
+		/* It has been loaded *BEFORE* us, so we have to initialize
+		 * it before us. We cannot just link in the xpem before pem,
+		 * since xpem might reference more dlls which would be in the
+		 * wrong order after that.
+		 * Instead we link in pem right AFTER xpem, which should keep
+		 * the correct order. (I am not 100% sure about that.)
 		 */
-		/* unlink xpem from chain */
+		/* unlink pem from chain */
 		ypem = &(process->modref_list);
 		while (*ypem) {
-			if ((*ypem)==xpem)
-				break;
-			ypem = &((*ypem)->next);
-		}
-		*ypem		= xpem->next;
-
-		/* link it directly before pem */
-		ypem		= &(process->modref_list);
-		while (*ypem) {
 			if ((*ypem)==pem)
 				break;
 			ypem = &((*ypem)->next);
 		}
-		*ypem		= xpem;
+		*ypem		= pem->next;
+
+		/* link pem directly AFTER xpem */
+		pem->next	= xpem->next;
 		xpem->next	= pem;
 		
 	}
@@ -265,12 +285,12 @@
 
 	Module = (char *) RVA(pe_imp->Name);
         hImpModule = MODULE_HANDLEtoHMODULE32( MODULE_FindModule(Module) );
-	dprintf_win32 (stddeb, "%s\n", Module);
+	dprintf_info(win32, "%s\n", Module);
 
 	/* FIXME: forwarder entries ... */
 
 	if (pe_imp->u.OriginalFirstThunk != 0) { /* original MS style */
-	    dprintf_win32 (stddeb, "Microsoft style imports used\n");
+	    dprintf_info(win32, "Microsoft style imports used\n");
 	    import_list =(LPIMAGE_THUNK_DATA) RVA(pe_imp->u.OriginalFirstThunk);
 	    thunk_list = (LPIMAGE_THUNK_DATA) RVA(pe_imp->FirstThunk);
 
@@ -278,7 +298,7 @@
 		if (IMAGE_SNAP_BY_ORDINAL(import_list->u1.Ordinal)) {
 		    int ordinal = IMAGE_ORDINAL(import_list->u1.Ordinal);
 
-		    dprintf_win32 (stddeb, "--- Ordinal %s,%d\n", Module, ordinal);
+		    dprintf_info(win32, "--- Ordinal %s,%d\n", Module, ordinal);
 		    thunk_list->u1.Function=(LPDWORD)PE_FindExportedFunction(
                         process, hImpModule, (LPCSTR)ordinal);
 		    if (!thunk_list->u1.Function) {
@@ -288,7 +308,7 @@
 		    }
 		} else {		/* import by name */
 		    pe_name = (LPIMAGE_IMPORT_BY_NAME)RVA(import_list->u1.AddressOfData);
-		    dprintf_win32 (stddeb, "--- %s %s.%d\n", pe_name->Name, Module, pe_name->Hint);
+		    dprintf_info(win32, "--- %s %s.%d\n", pe_name->Name, Module, pe_name->Hint);
 		    thunk_list->u1.Function=(LPDWORD)PE_FindExportedFunction(
                         process, hImpModule, pe_name->Name);
 		    if (!thunk_list->u1.Function) {
@@ -301,14 +321,14 @@
 		thunk_list++;
 	    }
 	} else {	/* Borland style */
-	    dprintf_win32 (stddeb, "Borland style imports used\n");
+	    dprintf_info(win32, "Borland style imports used\n");
 	    thunk_list = (LPIMAGE_THUNK_DATA) RVA(pe_imp->FirstThunk);
 	    while (thunk_list->u1.Ordinal) {
 		if (IMAGE_SNAP_BY_ORDINAL(thunk_list->u1.Ordinal)) {
 		    /* not sure about this branch, but it seems to work */
 		    int ordinal = IMAGE_ORDINAL(thunk_list->u1.Ordinal);
 
-		    dprintf_win32(stddeb,"--- Ordinal %s.%d\n",Module,ordinal);
+		    dprintf_info(win32,"--- Ordinal %s.%d\n",Module,ordinal);
 		    thunk_list->u1.Function=(LPDWORD)PE_FindExportedFunction(
                         process, hImpModule, (LPCSTR) ordinal);
 		    if (!thunk_list->u1.Function) {
@@ -318,7 +338,7 @@
 		    }
 		} else {
 		    pe_name=(LPIMAGE_IMPORT_BY_NAME) RVA(thunk_list->u1.AddressOfData);
-		    dprintf_win32(stddeb,"--- %s %s.%d\n",
+		    dprintf_info(win32,"--- %s %s.%d\n",
 		   		  pe_name->Name,Module,pe_name->Hint);
 		    thunk_list->u1.Function=(LPDWORD)PE_FindExportedFunction(
                         process, hImpModule, pe_name->Name );
@@ -342,11 +362,11 @@
     int i,vma_size = 0;
     IMAGE_SECTION_HEADER *pe_seg = PE_SECTIONS(hModule);
 
-    dprintf_win32(stddeb, "Dump of segment table\n");
-    dprintf_win32(stddeb, "   Name    VSz  Vaddr     SzRaw   Fileadr  *Reloc *Lineum #Reloc #Linum Char\n");
+    dprintf_info(win32, "Dump of segment table\n");
+    dprintf_info(win32, "   Name    VSz  Vaddr     SzRaw   Fileadr  *Reloc *Lineum #Reloc #Linum Char\n");
     for (i = 0; i< PE_HEADER(hModule)->FileHeader.NumberOfSections; i++)
     {
-        dprintf_win32(stddeb, "%8s: %4.4lx %8.8lx %8.8lx %8.8lx %8.8lx %8.8lx %4.4x %4.4x %8.8lx\n", 
+        dprintf_info(win32, "%8s: %4.4lx %8.8lx %8.8lx %8.8lx %8.8lx %8.8lx %4.4x %4.4x %8.8lx\n", 
                       pe_seg->Name, 
                       pe_seg->Misc.VirtualSize,
                       pe_seg->VirtualAddress,
@@ -381,14 +401,14 @@
 		char *page = (char*) RVA(r->VirtualAddress);
 		int count = (r->SizeOfBlock - 8)/2;
 		int i;
-		dprintf_fixup(stddeb, "%x relocations for page %lx\n",
+		dprintf_info(fixup, "%x relocations for page %lx\n",
 			count, r->VirtualAddress);
 		/* patching in reverse order */
 		for(i=0;i<count;i++)
 		{
 			int offset = r->TypeOffset[i] & 0xFFF;
 			int type = r->TypeOffset[i] >> 12;
-			dprintf_fixup(stddeb,"patching %x type %x\n", offset, type);
+			dprintf_info(fixup,"patching %x type %x\n", offset, type);
 			switch(type)
 			{
 			case IMAGE_REL_BASED_ABSOLUTE: break;
@@ -495,8 +515,8 @@
 /**********************************************************************
  * This maps a loaded PE dll into the address space of the specified process.
  */
-static HMODULE32 PE_MapImage( HMODULE32 hModule, PDB32 *process,
-                              OFSTRUCT *ofs, DWORD flags )
+static BOOL32 PE_MapImage( HMODULE32 *phModule, PDB32 *process,
+                           OFSTRUCT *ofs, DWORD flags )
 {
 	PE_MODREF		*pem;
 	int			i, result;
@@ -504,6 +524,7 @@
 	IMAGE_DATA_DIRECTORY	dir;
 	char			*modname;
 	int			vma_size;
+	HMODULE32		hModule = *phModule;
 
         IMAGE_SECTION_HEADER *pe_seg;
         IMAGE_DOS_HEADER *dos_header = (IMAGE_DOS_HEADER *)hModule;
@@ -524,7 +545,7 @@
 
 	load_addr = nt_header->OptionalHeader.ImageBase;
 	vma_size = calc_vma_size( hModule );
-	dprintf_win32(stddeb, "Load addr is %lx\n",load_addr);
+	dprintf_info(win32, "Load addr is %lx\n",load_addr);
 	load_addr = (DWORD)VirtualAlloc( (void*)load_addr, vma_size,
                                          MEM_RESERVE | MEM_COMMIT,
                                          PAGE_EXECUTE_READWRITE );
@@ -533,9 +554,12 @@
 						 MEM_RESERVE | MEM_COMMIT,
 						 PAGE_EXECUTE_READWRITE );
 	}
-	pem->module = (HMODULE32)load_addr;
+	/* *phModule is the module32 entry in the NE_MODULE. We need to
+	 * change it here, since it can get referenced by fixup_imports()
+	 */
+	pem->module = *phModule = (HMODULE32)load_addr;
 
-	dprintf_win32(stddeb, "Load addr is really %lx, range %x\n",
+	dprintf_info(win32, "Load addr is really %lx, range %x\n",
                       load_addr, vma_size);
 	
         /* Store the NT header at the load addr
@@ -611,10 +635,10 @@
 	}
 
 	if(nt_header->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXCEPTION].Size)
-		dprintf_win32(stdnimp,"Exception directory ignored\n");
+		dprintf_fixme(win32,"Exception directory ignored\n");
 
 	if(nt_header->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_SECURITY].Size)
-		dprintf_win32(stdnimp,"Security directory ignored\n");
+		dprintf_fixme(win32,"Security directory ignored\n");
 
 
 
@@ -628,29 +652,29 @@
 
 	if(nt_header->OptionalHeader.DataDirectory
 		[IMAGE_DIRECTORY_ENTRY_COPYRIGHT].Size)
-		dprintf_win32(stdnimp,"Copyright string ignored\n");
+		dprintf_fixme(win32,"Copyright string ignored\n");
 
 	if(nt_header->OptionalHeader.DataDirectory
 		[IMAGE_DIRECTORY_ENTRY_GLOBALPTR].Size)
-		dprintf_win32(stdnimp,"Global Pointer (MIPS) ignored\n");
+		dprintf_fixme(win32,"Global Pointer (MIPS) ignored\n");
 
 	if(nt_header->OptionalHeader.DataDirectory
 		[IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG].Size)
-		dprintf_win32(stdnimp,"Load Configuration directory ignored\n");
+		dprintf_fixme(win32,"Load Configuration directory ignored\n");
 
 	if(nt_header->OptionalHeader.DataDirectory
 		[IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT].Size)
-		dprintf_win32(stdnimp,"Bound Import directory ignored\n");
+		dprintf_fixme(win32,"Bound Import directory ignored\n");
 
 	if(nt_header->OptionalHeader.DataDirectory
 		[IMAGE_DIRECTORY_ENTRY_IAT].Size)
-		dprintf_win32(stdnimp,"Import Address Table directory ignored\n");
+		dprintf_fixme(win32,"Import Address Table directory ignored\n");
 	if(nt_header->OptionalHeader.DataDirectory[13].Size)
-		dprintf_win32(stdnimp,"Unknown directory 13 ignored\n");
+		dprintf_fixme(win32,"Unknown directory 13 ignored\n");
 	if(nt_header->OptionalHeader.DataDirectory[14].Size)
-		dprintf_win32(stdnimp,"Unknown directory 14 ignored\n");
+		dprintf_fixme(win32,"Unknown directory 14 ignored\n");
 	if(nt_header->OptionalHeader.DataDirectory[15].Size)
-		dprintf_win32(stdnimp,"Unknown directory 15 ignored\n");
+		dprintf_fixme(win32,"Unknown directory 15 ignored\n");
 
 	if(pem->pe_reloc)	do_relocations(pem);
 	if(pem->pe_export)	dump_exports(pem->module);
@@ -691,7 +715,7 @@
         /* Now that we got everything at the right address,
          * we can unmap the previous module */
         UnmapViewOfFile( (LPVOID)hModule );
-        return (HMODULE32)load_addr;
+        return 1;
 }
 
 HINSTANCE16 MODULE_CreateInstance(HMODULE16 hModule,LOADPARAMS *params);
@@ -705,7 +729,7 @@
                                HFILE32 hFile, DWORD flags)
 {
 	OFSTRUCT	ofs;
-	HMODULE32	hModule,ret;
+	HMODULE32	hModule;
 	NE_MODULE	*pModule;
 	PE_MODREF	*pem;
 
@@ -767,13 +791,11 @@
 		if (pModule->module32 < 32) return 21;
 	}
 	/* recurse */
-	ret = PE_MapImage( pModule->module32, process, &ofs,flags);
-	if (!ret) {
+	if (!PE_MapImage( &(pModule->module32), process, &ofs,flags)) {
 		/* should free this module and the already referenced ones */
 		return 0;
 	}
-	pModule->module32 = ret;
-	return ret;
+	return pModule->module32;
 }
 
 /*****************************************************************************
@@ -784,7 +806,7 @@
 HINSTANCE16 PE_LoadModule( HFILE32 hFile, OFSTRUCT *ofs, LOADPARAMS* params )
 {
     HMODULE16 hModule16;
-    HMODULE32 hModule32, ret;
+    HMODULE32 hModule32;
     HINSTANCE16 hInstance;
     NE_MODULE *pModule;
     THDB *thdb = THREAD_Current();
@@ -807,20 +829,19 @@
         TDB *pTask = (TDB *)GlobalLock16( hTask );
         thdb = pTask->thdb;
     }
-    if (!(ret = PE_MapImage( hModule32, thdb->process, ofs, 0 )))
+    if (!PE_MapImage( &(pModule->module32), thdb->process, ofs, 0 ))
     {
-     	/* FIXME: should destroy the task created ... */
+     	/* FIXME: should destroy the task created and free referenced stuff */
         return 0;
     }
-    pModule->module32 = ret;
-    /* yuck. but there is no other good place to do that... */
+    /* FIXME: Yuck. Is there no other good place to do that? */
     PE_InitTls( thdb );
     return hInstance;
 }
 
 int PE_UnloadImage( HMODULE32 hModule )
 {
-	printf("PEunloadImage() called!\n");
+	fprintf(stderr,"PEunloadImage() called!\n");
 	/* free resources, image, unmap */
 	return 1;
 }
@@ -848,7 +869,7 @@
     ) {
         FARPROC32 entry = (FARPROC32)RVA_PTR( pem->module,
                                           OptionalHeader.AddressOfEntryPoint );
-        dprintf_relay( stddeb, "CallTo32(entryproc=%p,module=%08x,type=%ld,res=%p)\n",
+        dprintf_info(relay, "CallTo32(entryproc=%p,module=%08x,type=%ld,res=%p)\n",
                        entry, pem->module, type, lpReserved );
         entry( pem->module, type, lpReserved );
     }
@@ -899,7 +920,7 @@
 			DataDirectory[IMAGE_FILE_THREAD_LOCAL_STORAGE].VirtualAddress);
 		
 		if (!(pem->flags & PE_MODREF_TLS_ALLOCED)) {
-			pem->tlsindex = TlsAlloc();
+			pem->tlsindex = THREAD_TlsAlloc(thdb);
 			*(pdir->AddressOfIndex)=pem->tlsindex;   
 		}
 		pem->flags |= PE_MODREF_TLS_ALLOCED;
@@ -929,4 +950,3 @@
 	}
 	return TRUE;
 }
-
diff --git a/loader/pe_resource.c b/loader/pe_resource.c
index 60fa5b8..da06142 100644
--- a/loader/pe_resource.c
+++ b/loader/pe_resource.c
@@ -22,7 +22,6 @@
 #include "libres.h"
 #include "stackframe.h"
 #include "neexe.h"
-#include "stddebug.h"
 #include "debug.h"
 
 /**********************************************************************
diff --git a/loader/resource.c b/loader/resource.c
index 5e98fb5..8d7ad81 100644
--- a/loader/resource.c
+++ b/loader/resource.c
@@ -20,16 +20,10 @@
 #include "task.h"
 #include "module.h"
 #include "resource.h"
-#include "stddebug.h"
+#include "debugstr.h"
 #include "debug.h"
 #include "libres.h"
 
-#define PrintId(name) \
-    if (HIWORD((DWORD)name)) \
-        dprintf_resource( stddeb, "'%s'", (char *)PTR_SEG_TO_LIN(name)); \
-    else \
-        dprintf_resource( stddeb, "#%04x", LOWORD(name)); 
-
 extern WORD WINE_LanguageId;
 
 /* error message when 16-bit resource function is called for Win32 module */
@@ -45,28 +39,30 @@
     NE_MODULE *pModule;
 
     hModule = MODULE_HANDLEtoHMODULE16( hModule ); 
-    dprintf_resource(stddeb, "FindResource16: module=%04x", hModule );
 
     if (HIWORD(name))  /* Check for '#xxx' name */
     {
 	char *ptr = PTR_SEG_TO_LIN( name );
 	if (ptr[0] == '#')
-	    if (!(name = (SEGPTR)atoi( ptr + 1 ))) return 0;
+	    if (!(name = (SEGPTR)atoi( ptr + 1 ))) {
+	      dprintf_warn(resource, "Incorrect resource name: %s\n", ptr);
+	      return 0;
+	    }
     }
 
-    dprintf_resource( stddeb, " name=" );
-    PrintId( name );
-
     if (HIWORD(type))  /* Check for '#xxx' type */
     {
 	char *ptr = PTR_SEG_TO_LIN( type );
 	if (ptr[0] == '#')
-	    if (!(type = (SEGPTR)atoi( ptr + 1 ))) return 0;
+	  if (!(type = (SEGPTR)atoi( ptr + 1 ))){
+	    dprintf_warn(resource, "Incorrect resource type: %s\n", ptr);
+	    return 0;
+	  }
     }
 
-    dprintf_resource( stddeb, " type=" );
-    PrintId( type );
-    dprintf_resource( stddeb, "\n" );
+    dprintf_info(resource, "FindResource16: module=%04x name=%s type=%s\n", 
+		 hModule, debugres(PTR_SEG_TO_LIN(name)), 
+		 debugres(PTR_SEG_TO_LIN(type)) );
 
     if ((pModule = MODULE_GetPtr( hModule )))
     {
@@ -129,18 +125,11 @@
 
         if (!hModule) hModule = GetTaskDS();
         hModule = MODULE_HANDLEtoHMODULE32( hModule );
-        dprintf_resource(stddeb, "FindResource32W: module=%08x type=",
-                         hModule );
-        if (HIWORD(type))
-            dprintf_resource(stddeb,"%p",type);
-        else
-            dprintf_resource(stddeb,"#%p",type);
-        dprintf_resource( stddeb, " name=" );
-        if (HIWORD(name))
-            dprintf_resource(stddeb,"%p",name);
-        else
-            dprintf_resource(stddeb,"#%p",name);
-        dprintf_resource( stddeb, "\n" );
+        dprintf_info(resource, "FindResource32W: module=%08x "
+			 "type=%s%p name=%s%p\n", hModule,
+			 (HIWORD(type))? "" : "#", type, 
+			 (HIWORD(name))? "" : "#", name);
+
         if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
         if (!(pModule->flags & NE_FFLAGS_WIN32)) return 0;
         return PE_FindResourceEx32W(hModule,name,type,lang);
@@ -165,7 +154,7 @@
     NE_MODULE *pModule;
 
     hModule = MODULE_HANDLEtoHMODULE16( hModule );
-    dprintf_resource(stddeb, "LoadResource16: module=%04x res=%04x\n",
+    dprintf_info(resource, "LoadResource16: module=%04x res=%04x\n",
                      hModule, hRsrc );
     if (!hRsrc) return 0;
     if ((pModule = MODULE_GetPtr( hModule )))
@@ -193,7 +182,7 @@
 
         if (!hModule) hModule = GetTaskDS(); /* FIXME: see FindResource32W */
         hModule = MODULE_HANDLEtoHMODULE32( hModule );
-        dprintf_resource(stddeb, "LoadResource32: module=%04x res=%04x\n",
+        dprintf_info(resource, "LoadResource32: module=%04x res=%04x\n",
                          hModule, hRsrc );
         if (!hRsrc) return 0;
 
@@ -218,7 +207,7 @@
     HMODULE16 hModule;
     NE_MODULE *pModule;
 
-    dprintf_resource(stddeb, "LockResource: handle=%04x\n", handle );
+    dprintf_info(resource, "LockResource: handle=%04x\n", handle );
     if (!handle) return (SEGPTR)0;
     hModule = MODULE_HANDLEtoHMODULE16( handle );
     if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
@@ -238,7 +227,7 @@
         HMODULE16 hModule;
         NE_MODULE *pModule;
 
-        dprintf_resource(stddeb, "LockResource: handle=%04x\n", handle );
+        dprintf_info(resource, "LockResource: handle=%04x\n", handle );
         if (!handle) return NULL;
         hModule = MODULE_HANDLEtoHMODULE16( handle );
         if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
@@ -272,7 +261,7 @@
         HMODULE16 hModule;
         NE_MODULE *pModule;
 
-        dprintf_resource(stddeb, "FreeResource16: handle=%04x\n", handle );
+        dprintf_info(resource, "FreeResource16: handle=%04x\n", handle );
         if (!handle) return FALSE;
         hModule = MODULE_HANDLEtoHMODULE16( handle );
         if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
@@ -304,7 +293,7 @@
     NE_MODULE *pModule;
 
     hModule = MODULE_HANDLEtoHMODULE16( hModule );
-    dprintf_resource(stddeb, "AccessResource16: module=%04x res=%04x\n",
+    dprintf_info(resource, "AccessResource16: module=%04x res=%04x\n",
                      hModule, hRsrc );
     if (!hRsrc) return 0;
     if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
@@ -327,7 +316,7 @@
 INT32 WINAPI AccessResource32( HINSTANCE32 hModule, HRSRC32 hRsrc )
 {
     hModule = MODULE_HANDLEtoHMODULE32( hModule );
-    dprintf_resource(stddeb, "AccessResource: module=%04x res=%04x\n",
+    dprintf_info(resource, "AccessResource: module=%04x res=%04x\n",
                      hModule, hRsrc );
     if (!hRsrc) return 0;
     fprintf(stderr,"AccessResource32: not implemented\n");
@@ -343,7 +332,7 @@
     NE_MODULE *pModule;
 
     hModule = MODULE_HANDLEtoHMODULE16( hModule );
-    dprintf_resource(stddeb, "SizeofResource16: module=%04x res=%04x\n",
+    dprintf_info(resource, "SizeofResource16: module=%04x res=%04x\n",
                      hModule, hRsrc );
     if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
     if (!__winelib)
@@ -365,7 +354,7 @@
 DWORD WINAPI SizeofResource32( HINSTANCE32 hModule, HRSRC32 hRsrc )
 {
     hModule = MODULE_HANDLEtoHMODULE32( hModule );
-    dprintf_resource(stddeb, "SizeofResource32: module=%04x res=%04x\n",
+    dprintf_info(resource, "SizeofResource32: module=%04x res=%04x\n",
                      hModule, hRsrc );
     if (!__winelib) return PE_SizeofResource32(hModule,hRsrc);
     else
@@ -384,7 +373,7 @@
     NE_MODULE *pModule;
 
     hModule = MODULE_HANDLEtoHMODULE16( hModule );
-    dprintf_resource(stddeb, "AllocResource: module=%04x res=%04x size=%ld\n",
+    dprintf_info(resource, "AllocResource: module=%04x res=%04x size=%ld\n",
                      hModule, hRsrc, size );
     if (!hRsrc) return 0;
     if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
@@ -408,7 +397,7 @@
 HGLOBAL16 WINAPI DirectResAlloc( HINSTANCE16 hInstance, WORD wType,
                                  UINT16 wSize )
 {
-    dprintf_resource(stddeb,"DirectResAlloc(%04x,%04x,%04x)\n",
+    dprintf_info(resource,"DirectResAlloc(%04x,%04x,%04x)\n",
                      hInstance, wType, wSize );
     hInstance = MODULE_HANDLEtoHMODULE16(hInstance);
     if(!hInstance)return 0;
@@ -427,10 +416,10 @@
     HRSRC16	hRsrc;
 
     if (HIWORD(lpTableName))
-        dprintf_accel( stddeb, "LoadAccelerators: %04x '%s'\n",
+        dprintf_info(accel, "LoadAccelerators: %04x '%s'\n",
                       instance, (char *)PTR_SEG_TO_LIN( lpTableName ) );
     else
-        dprintf_accel( stddeb, "LoadAccelerators: %04x %04x\n",
+        dprintf_info(accel, "LoadAccelerators: %04x %04x\n",
                        instance, LOWORD(lpTableName) );
 
     if (!(hRsrc = FindResource16( instance, lpTableName, RT_ACCELERATOR )))
@@ -452,10 +441,10 @@
     HRSRC32 hRsrc;
 
     if (HIWORD(lpTableName))
-        dprintf_accel( stddeb, "LoadAccelerators: %04x '%s'\n",
+        dprintf_info(accel, "LoadAccelerators: %04x '%s'\n",
                       instance, (char *)( lpTableName ) );
     else
-        dprintf_accel( stddeb, "LoadAccelerators: %04x %04x\n",
+        dprintf_info(accel, "LoadAccelerators: %04x %04x\n",
                        instance, LOWORD(lpTableName) );
 
     if (!(hRsrc = FindResource32W( instance, lpTableName, 
@@ -516,7 +505,7 @@
     int string_num;
     int i;
 
-    dprintf_resource(stddeb,"LoadString: inst=%04x id=%04x buff=%08x len=%d\n",
+    dprintf_info(resource,"LoadString: inst=%04x id=%04x buff=%08x len=%d\n",
                      instance, resource_id, (int) buffer, buflen);
 
     hrsrc = FindResource16( instance, (SEGPTR)((resource_id>>4)+1), RT_STRING );
@@ -529,7 +518,7 @@
     for (i = 0; i < string_num; i++)
 	p += *p + 1;
     
-    dprintf_resource( stddeb, "strlen = %d\n", (int)*p );
+    dprintf_info(resource, "strlen = %d\n", (int)*p );
     
     i = MIN(buflen - 1, *p);
     if (buffer == NULL)
@@ -547,7 +536,7 @@
     }
     FreeResource16( hmem );
 
-    dprintf_resource(stddeb,"LoadString // '%s' copied !\n", buffer);
+    dprintf_info(resource,"LoadString // '%s' copied !\n", buffer);
     return i;
 }
 
@@ -565,7 +554,7 @@
 
     if (HIWORD(resource_id)==0xFFFF) /* netscape 3 passes this */
 	resource_id = (UINT32)(-((INT32)resource_id));
-    dprintf_resource(stddeb, "LoadString: instance = %04x, id = %04x, buffer = %08x, "
+    dprintf_info(resource, "LoadString: instance = %04x, id = %04x, buffer = %08x, "
 	   "length = %d\n", instance, (int)resource_id, (int) buffer, buflen);
 
     hrsrc = FindResource32W( instance, (LPCWSTR)((resource_id>>4)+1), 
@@ -579,7 +568,7 @@
     for (i = 0; i < string_num; i++)
 	p += *p + 1;
     
-    dprintf_resource( stddeb, "strlen = %d\n", (int)*p );
+    dprintf_info(resource, "strlen = %d\n", (int)*p );
     
     i = MIN(buflen - 1, *p);
     if (buffer == NULL)
@@ -598,7 +587,7 @@
 #endif
     }
 #if 0
-    dprintf_resource(stddeb,"LoadString // '%s' copied !\n", buffer);
+    dprintf_info(resource,"LoadString // '%s' copied !\n", buffer);
 #endif
     return i;
 }
@@ -669,8 +658,7 @@
 	CHAR	str[1];
     } *stre;
 
-    dprintf_resource(stddeb, "LoadMessage: instance = %04x, id = %04x, buffer = %08x, "
-	   "length = %d\n", instance, (int)id, (int) buffer, buflen);
+    dprintf_info(resource, "LoadMessage: instance = %08lx, id = %08lx, buffer = %p, length = %ld\n", (DWORD)instance, (DWORD)id, buffer, (DWORD)buflen);
 
     /*FIXME: I am not sure about the '1' ... But I've only seen those entries*/
     hrsrc = FindResourceEx32W(instance,(LPWSTR)1,(LPCWSTR)RT_MESSAGELIST,lang);
@@ -698,7 +686,7 @@
     	stre = (struct _stringentry*)(((char*)stre)+slen);
     }
     slen=stre->len;
-    dprintf_resource(stddeb,"	- strlen=%d\n",slen);
+    dprintf_info(resource,"	- strlen=%d\n",slen);
     i = MIN(buflen - 1, slen);
     if (buffer == NULL)
 	return slen; /* different to LoadString */
@@ -712,7 +700,7 @@
 	}
     }
     if (buffer)
-	    dprintf_resource(stddeb,"LoadMessage // '%s' copied !\n", buffer);
+	    dprintf_info(resource,"LoadMessage // '%s' copied !\n", buffer);
     return i;
 }
 
@@ -749,14 +737,13 @@
 
     hModule = GetExePtr( hModule );
 
-    dprintf_resource(stddeb, "SetResourceHandler: module=%04x type=", hModule );
-    PrintId( s );
-    dprintf_resource( stddeb, "\n" );
+    dprintf_info(resource, "SetResourceHandler: module=%04x type=%s\n", 
+		 hModule, debugres(PTR_SEG_TO_LIN(s)) );
 
     if ((pModule = MODULE_GetPtr( hModule )))
     {
 	if (pModule->flags & NE_FFLAGS_WIN32)
-	    fprintf(stderr,"SetResourceHandler: %s", NEWin32FailureString);
+	    fprintf(stderr,"SetResourceHandler: %s\n", NEWin32FailureString);
 	else if (pModule->res_table)
 	    return NE_SetResourceHandler( hModule, s, resourceHandler );
     }
diff --git a/loader/signal.c b/loader/signal.c
index 66def5d..0092b22 100644
--- a/loader/signal.c
+++ b/loader/signal.c
@@ -33,6 +33,7 @@
 
 #if defined(linux) && defined(__i386__)
 /* This is the sigaction structure from the Linux 2.1.20 kernel.  */
+#undef sa_handler
 struct kernel_sigaction
 {
     void (*sa_handler)();
diff --git a/loader/task.c b/loader/task.c
index eeeaeb0..ce56b0a 100644
--- a/loader/task.c
+++ b/loader/task.c
@@ -29,7 +29,6 @@
 #include "toolhelp.h"
 #include "winnt.h"
 #include "thread.h"
-#include "stddebug.h"
 #include "debug.h"
 #include "dde_proc.h"
 
@@ -177,9 +176,9 @@
     /* Display it */
 
     p = (char *) GlobalLock16( handle );
-    dprintf_task(stddeb, "Master DOS environment at %p\n", p);
-    for (; *p; p += strlen(p) + 1) dprintf_task(stddeb, "    %s\n", p);
-    dprintf_task( stddeb, "Progname: %s\n", p+3 );
+    dprintf_info(task, "Master DOS environment at %p\n", p);
+    for (; *p; p += strlen(p) + 1) dprintf_info(task, "    %s\n", p);
+    dprintf_info(task, "Progname: %s\n", p+3 );
 
     return handle;
 }
@@ -348,7 +347,7 @@
 
         InitApp( pTask->hModule );
         PE_InitializeDLLs( PROCESS_Current(), DLL_PROCESS_ATTACH, (LPVOID)-1 );
-        dprintf_relay( stddeb, "CallTo32(entryproc=%p)\n", entry );
+        dprintf_info(relay, "CallTo32(entryproc=%p)\n", entry );
         exit_code = entry();
         TASK_KillCurrentTask( exit_code );
     }
@@ -377,7 +376,7 @@
         ECX_reg(&context) = pModule->heap_size;
         EDI_reg(&context) = context.SegDs;
 
-        dprintf_task( stddeb, "Starting main program: cs:ip=%04lx:%04x ds=%04lx ss:sp=%04x:%04x\n",
+        dprintf_info(task, "Starting main program: cs:ip=%04lx:%04x ds=%04lx ss:sp=%04x:%04x\n",
                       CS_reg(&context), IP_reg(&context), DS_reg(&context),
                       SELECTOROF(pTask->thdb->cur_stack),
                       OFFSETOF(pTask->thdb->cur_stack) );
@@ -564,7 +563,7 @@
 
     TASK_LinkTask( hTask );
 
-    dprintf_task( stddeb, "CreateTask: module='%s' cmdline='%s' task=%04x\n",
+    dprintf_info(task, "CreateTask: module='%s' cmdline='%s' task=%04x\n",
                   name, cmdLine, hTask );
 
     return hTask;
@@ -622,7 +621,7 @@
     TDB* pTask = (TDB*) GlobalLock16( hCurrentTask );
     if (!pTask) USER_ExitWindows();  /* No current task yet */
 
-    dprintf_task(stddeb, "Killing task %04x\n", hCurrentTask );
+    dprintf_info(task, "Killing task %04x\n", hCurrentTask );
 
     /* Delete active sockets */
 
@@ -644,7 +643,7 @@
 
     if (nTaskCount <= 1)
     {
-        dprintf_task( stddeb, "\nthis is the last task, exiting\n" );
+        dprintf_info(task, "\nthis is the last task, exiting\n" );
         USER_ExitWindows();
     }
 
@@ -725,7 +724,7 @@
         {
             pNewTask = (TDB *)GlobalLock16( hTask );
 
-	    dprintf_task( stddeb, "\ttask = %04x, events = %i\n", hTask, pNewTask->nEvents);
+	    dprintf_info(task, "\ttask = %04x, events = %i\n", hTask, pNewTask->nEvents);
 
             if (pNewTask->nEvents) break;
             hTask = pNewTask->hNext;
@@ -740,11 +739,11 @@
 
     if (hTask == hCurrentTask) 
     {
-       dprintf_task( stddeb, "returning to the current task(%04x)\n", hTask );
+       dprintf_info(task, "returning to the current task(%04x)\n", hTask );
        return;  /* Nothing to do */
     }
     pNewTask = (TDB *)GlobalLock16( hTask );
-    dprintf_task( stddeb, "Switching to task %04x (%.8s)\n",
+    dprintf_info(task, "Switching to task %04x (%.8s)\n",
                   hTask, pNewTask->module_name );
 
      /* Make the task the last in the linked list (round-robin scheduling) */
@@ -1013,7 +1012,7 @@
     thunk = PTR_SEG_TO_LIN( thunkaddr );
     lfunc = PTR_SEG_TO_LIN( func );
 
-    dprintf_task( stddeb, "MakeProcInstance(%08lx,%04x): got thunk %08lx\n",
+    dprintf_info(task, "MakeProcInstance(%08lx,%04x): got thunk %08lx\n",
                   (DWORD)func, hInstance, (DWORD)thunkaddr );
     if (((lfunc[0]==0x8c) && (lfunc[1]==0xd8)) ||
     	((lfunc[0]==0x1e) && (lfunc[1]==0x58))
@@ -1037,7 +1036,7 @@
  */
 void WINAPI FreeProcInstance16( FARPROC16 func )
 {
-    dprintf_task( stddeb, "FreeProcInstance(%08lx)\n", (DWORD)func );
+    dprintf_info(task, "FreeProcInstance(%08lx)\n", (DWORD)func );
     if (!__winelib) TASK_FreeThunk( hCurrentTask, (SEGPTR)func );
 }
 
@@ -1119,7 +1118,7 @@
 
     if (!(pTask = (TDB *)GlobalLock16( hCurrentTask ))) return;
     if (!(pData = (INSTANCEDATA *)GlobalLock16( seg ))) return;
-    dprintf_task( stddeb, "SwitchStackTo: old=%04x:%04x new=%04x:%04x\n",
+    dprintf_info(task, "SwitchStackTo: old=%04x:%04x new=%04x:%04x\n",
                   SELECTOROF( pTask->thdb->cur_stack ),
                   OFFSETOF( pTask->thdb->cur_stack ), seg, ptr );
 
@@ -1168,7 +1167,7 @@
         fprintf( stderr, "SwitchStackBack: no previous SwitchStackTo\n" );
         return;
     }
-    dprintf_task( stddeb, "SwitchStackBack: restoring stack %04x:%04x\n",
+    dprintf_info(task, "SwitchStackBack: restoring stack %04x:%04x\n",
                   SELECTOROF(pData->old_ss_sp), OFFSETOF(pData->old_ss_sp) );
 
     oldFrame = (STACK16FRAME *)PTR_SEG_TO_LIN( pTask->thdb->cur_stack );
@@ -1182,7 +1181,7 @@
 
     newFrame = (STACK16FRAME *)PTR_SEG_TO_LIN( pTask->thdb->cur_stack );
     newFrame->frame32 = oldFrame->frame32;
-    if (debugging_relay)
+    if (debugging_info(relay))
     {
         newFrame->entry_ip = oldFrame->entry_ip;
         newFrame->entry_cs = oldFrame->entry_cs;
@@ -1447,7 +1446,7 @@
     TDB *pTask;
     INSTANCEDATA *pInstData;
 
-    dprintf_toolhelp( stddeb, "TaskNext(%p): task=%04x\n", lpte, lpte->hNext );
+    dprintf_info(toolhelp, "TaskNext(%p): task=%04x\n", lpte, lpte->hNext );
     if (!lpte->hNext) return FALSE;
     pTask = (TDB *)GlobalLock16( lpte->hNext );
     if (!pTask || pTask->magic != TDB_MAGIC) return FALSE;
diff --git a/memory/global.c b/memory/global.c
index 8dafd47..af33ce0 100644
--- a/memory/global.c
+++ b/memory/global.c
@@ -18,7 +18,6 @@
 #include "dde_mem.h"
 #include "stackframe.h"
 #include "module.h"
-#include "stddebug.h"
 #include "debug.h"
 #include "winerror.h"
 
@@ -50,6 +49,7 @@
 
 #define GLOBAL_MAX_ALLOC_SIZE 0x00ff0000  /* Largest allocation is 16M - 64K */
 
+#define VALID_HANDLE(handle) (((handle)>>__AHSHIFT)<globalArenaSize)
 #define GET_ARENA_PTR(handle)  (pGlobalArena + ((handle) >> __AHSHIFT))
 
 /***********************************************************************
@@ -165,6 +165,8 @@
 
     if (!handle) return TRUE;
     sel = GlobalHandleToSel( handle ); 
+    if (!VALID_HANDLE(sel))
+    	return FALSE;
     pArena = GET_ARENA_PTR(sel);
     SELECTOR_FreeBlock( sel, (pArena->size + 0xffff) / 0x10000 );
     memset( pArena, 0, sizeof(GLOBALARENA) );
@@ -184,7 +186,7 @@
     HGLOBAL16 handle;
     SHMDATA shmdata;
 
-    dprintf_global( stddeb, "GlobalAlloc: %ld flags=%04x\n", size, flags );
+    dprintf_info(global, "GlobalAlloc: %ld flags=%04x\n", size, flags );
 
     /* If size is 0, create a discarded block */
 
@@ -291,7 +293,7 @@
     GLOBALARENA *pArena, *pNewArena;
     WORD sel = GlobalHandleToSel( handle );
 
-    dprintf_global( stddeb, "GlobalReAlloc16: %04x %ld flags=%04x\n",
+    dprintf_info(global, "GlobalReAlloc16: %04x %ld flags=%04x\n",
                     handle, size, flags );
     if (!handle) return 0;
     
@@ -304,6 +306,10 @@
     }
 #endif  /* CONFIG_IPC */
 
+    if (!VALID_HANDLE(handle)) {
+    	fprintf(stderr," Invalid handle 0x%04x passed to GlobalReAlloc16!\n",handle);
+    	return 0;
+    }
     pArena = GET_ARENA_PTR( handle );
 
       /* Discard the block if requested */
@@ -344,7 +350,7 @@
 
     ptr = (void *)pArena->base;
     oldsize = pArena->size;
-    dprintf_global(stddeb,"oldsize %08lx\n",oldsize);
+    dprintf_info(global,"oldsize %08lx\n",oldsize);
     if (ptr && (size == oldsize)) return handle;  /* Nothing to do */
 
     ptr = HeapReAlloc( SystemHeap, 0, ptr, size );
@@ -395,9 +401,15 @@
  */
 HGLOBAL16 WINAPI GlobalFree16( HGLOBAL16 handle )
 {
-    void *ptr = (void *)GET_ARENA_PTR(handle)->base;
+    void *ptr;
 
-    dprintf_global( stddeb, "GlobalFree16: %04x\n", handle );
+    if (!VALID_HANDLE(handle)) {
+    	fprintf(stderr," Invalid handle 0x%04x passed to GlobalFree16!\n",handle);
+    	return 0;
+    }
+    ptr = (void *)GET_ARENA_PTR(handle)->base;
+
+    dprintf_info(global, "GlobalFree16: %04x\n", handle );
     if (!GLOBAL_FreeBlock( handle )) return handle;  /* failed */
 #ifdef CONFIG_IPC
     if (is_dde_handle(handle)) return DDE_GlobalFree(handle);
@@ -414,7 +426,7 @@
  */
 SEGPTR WINAPI WIN16_GlobalLock16( HGLOBAL16 handle )
 {
-    dprintf_global( stddeb, "WIN16_GlobalLock16(%04x) -> %08lx\n",
+    dprintf_info(global, "WIN16_GlobalLock16(%04x) -> %08lx\n",
                     handle, MAKELONG( 0, GlobalHandleToSel(handle)) );
     if (handle)
     {
@@ -425,6 +437,10 @@
 	    return PTR_SEG_OFF_TO_SEGPTR( DDE_GlobalHandleToSel(handle), 0 );
 #endif  /* CONFIG_IPC */
 
+	if (!VALID_HANDLE(handle)) {
+	    fprintf(stderr,"Invalid handle 0x%04x passed to WIN16_GlobalLock16!\n",handle);
+	    return (SEGPTR)0;
+	}
 	if (!GET_ARENA_PTR(handle)->base) return (SEGPTR)0;
         GET_ARENA_PTR(handle)->lockCount++;
 	return PTR_SEG_OFF_TO_SEGPTR( GlobalHandleToSel(handle), 0 );
@@ -442,6 +458,8 @@
 LPVOID WINAPI GlobalLock16( HGLOBAL16 handle )
 {
     if (!handle) return 0;
+    if (!VALID_HANDLE(handle))
+	return (LPVOID)0;
     GET_ARENA_PTR(handle)->lockCount++;
 #ifdef CONFIG_IPC
     if (is_dde_handle(handle)) return DDE_AttachHandle(handle, NULL);
@@ -456,7 +474,11 @@
 BOOL16 WINAPI GlobalUnlock16( HGLOBAL16 handle )
 {
     GLOBALARENA *pArena = GET_ARENA_PTR(handle);
-    dprintf_global( stddeb, "GlobalUnlock16: %04x\n", handle );
+    if (!VALID_HANDLE(handle)) {
+	fprintf(stderr,"Invalid handle 0x%04x passed to GlobalUnlock16!\n",handle);
+	return 0;
+    }
+    dprintf_info(global, "GlobalUnlock16: %04x\n", handle );
     if (pArena->lockCount) pArena->lockCount--;
     return pArena->lockCount;
 }
@@ -467,8 +489,10 @@
  */
 DWORD WINAPI GlobalSize16( HGLOBAL16 handle )
 {
-    dprintf_global( stddeb, "GlobalSize16: %04x\n", handle );
+    dprintf_info(global, "GlobalSize16: %04x\n", handle );
     if (!handle) return 0;
+    if (!VALID_HANDLE(handle))
+	return 0;
     return GET_ARENA_PTR(handle)->size;
 }
 
@@ -478,7 +502,11 @@
  */
 DWORD WINAPI GlobalHandle16( WORD sel )
 {
-    dprintf_global( stddeb, "GlobalHandle16: %04x\n", sel );
+    dprintf_info(global, "GlobalHandle16: %04x\n", sel );
+    if (!VALID_HANDLE(sel)) {
+	fprintf(stderr,"Invalid handle 0x%04x passed to GlobalHandle16!\n",sel);
+	return 0;
+    }
     return MAKELONG( GET_ARENA_PTR(sel)->handle, GlobalHandleToSel(sel) );
 }
 
@@ -502,7 +530,11 @@
 {
     GLOBALARENA *pArena;
 
-    dprintf_global( stddeb, "GlobalFlags16: %04x\n", handle );
+    dprintf_info(global, "GlobalFlags16: %04x\n", handle );
+    if (!VALID_HANDLE(handle)) {
+	fprintf(stderr,"Invalid handle 0x%04x passed to GlobalFlags16!\n",handle);
+	return 0;
+    }
     pArena = GET_ARENA_PTR(handle);
     return pArena->lockCount |
            ((pArena->flags & GA_DISCARDABLE) ? GMEM_DISCARDABLE : 0) |
@@ -515,8 +547,12 @@
  */
 HGLOBAL16 WINAPI LockSegment16( HGLOBAL16 handle )
 {
-    dprintf_global( stddeb, "LockSegment: %04x\n", handle );
+    dprintf_info(global, "LockSegment: %04x\n", handle );
     if (handle == (HGLOBAL16)-1) handle = CURRENT_DS;
+    if (!VALID_HANDLE(handle)) {
+	fprintf(stderr,"Invalid handle 0x%04x passed to LockSegment16!\n",handle);
+	return 0;
+    }
     GET_ARENA_PTR(handle)->lockCount++;
     return handle;
 }
@@ -527,8 +563,12 @@
  */
 void WINAPI UnlockSegment16( HGLOBAL16 handle )
 {
-    dprintf_global( stddeb, "UnlockSegment: %04x\n", handle );
+    dprintf_info(global, "UnlockSegment: %04x\n", handle );
     if (handle == (HGLOBAL16)-1) handle = CURRENT_DS;
+    if (!VALID_HANDLE(handle)) {
+	fprintf(stderr,"Invalid handle 0x%04x passed to UnlockSegment16!\n",handle);
+	return;
+    }
     GET_ARENA_PTR(handle)->lockCount--;
     /* FIXME: this ought to return the lock count in CX (go figure...) */
 }
@@ -583,7 +623,7 @@
  */
 LONG WINAPI SetSwapAreaSize16( WORD size )
 {
-    dprintf_global(stdnimp, "STUB: SetSwapAreaSize(%d)\n", size );
+    dprintf_fixme(global, "STUB: SetSwapAreaSize(%d)\n", size );
     return MAKELONG( size, 0xffff );
 }
 
@@ -593,7 +633,7 @@
  */
 HGLOBAL16 WINAPI GlobalLRUOldest( HGLOBAL16 handle )
 {
-    dprintf_global( stddeb, "GlobalLRUOldest: %04x\n", handle );
+    dprintf_info(global, "GlobalLRUOldest: %04x\n", handle );
     if (handle == (HGLOBAL16)-1) handle = CURRENT_DS;
     return handle;
 }
@@ -604,7 +644,7 @@
  */
 HGLOBAL16 WINAPI GlobalLRUNewest( HGLOBAL16 handle )
 {
-    dprintf_global( stddeb, "GlobalLRUNewest: %04x\n", handle );
+    dprintf_info(global, "GlobalLRUNewest: %04x\n", handle );
     if (handle == (HGLOBAL16)-1) handle = CURRENT_DS;
     return handle;
 }
@@ -662,7 +702,11 @@
  */
 WORD WINAPI GlobalPageLock( HGLOBAL16 handle )
 {
-    dprintf_global( stddeb, "GlobalPageLock: %04x\n", handle );
+    dprintf_info(global, "GlobalPageLock: %04x\n", handle );
+    if (!VALID_HANDLE(handle)) {
+	fprintf(stderr,"Invalid handle 0x%04x passed to GlobalPageLock!\n",handle);
+	return 0;
+    }
     return ++(GET_ARENA_PTR(handle)->pageLockCount);
 }
 
@@ -672,7 +716,11 @@
  */
 WORD WINAPI GlobalPageUnlock( HGLOBAL16 handle )
 {
-    dprintf_global( stddeb, "GlobalPageUnlock: %04x\n", handle );
+    dprintf_info(global, "GlobalPageUnlock: %04x\n", handle );
+    if (!VALID_HANDLE(handle)) {
+	fprintf(stderr,"Invalid handle 0x%04x passed to GlobalPageUnlock!\n",handle);
+	return 0;
+    }
     return --(GET_ARENA_PTR(handle)->pageLockCount);
 }
 
@@ -682,7 +730,11 @@
  */
 void WINAPI GlobalFix16( HGLOBAL16 handle )
 {
-    dprintf_global( stddeb, "GlobalFix16: %04x\n", handle );
+    dprintf_info(global, "GlobalFix16: %04x\n", handle );
+    if (!VALID_HANDLE(handle)) {
+	fprintf(stderr,"Invalid handle 0x%04x passed to GlobalFix16!\n",handle);
+	return;
+    }
     GET_ARENA_PTR(handle)->lockCount++;
 }
 
@@ -692,7 +744,11 @@
  */
 void WINAPI GlobalUnfix16( HGLOBAL16 handle )
 {
-    dprintf_global( stddeb, "GlobalUnfix16: %04x\n", handle );
+    dprintf_info(global, "GlobalUnfix16: %04x\n", handle );
+    if (!VALID_HANDLE(handle)) {
+	fprintf(stderr,"Invalid handle 0x%04x passed to GlobalUnfix16!\n",handle);
+	return;
+    }
     GET_ARENA_PTR(handle)->lockCount--;
 }
 
@@ -702,6 +758,10 @@
  */
 void WINAPI FarSetOwner( HGLOBAL16 handle, HANDLE16 hOwner )
 {
+    if (!VALID_HANDLE(handle)) {
+	fprintf(stderr,"Invalid handle 0x%04x passed to FarSetOwner!\n",handle);
+	return;
+    }
     GET_ARENA_PTR(handle)->hOwner = hOwner;
 }
 
@@ -711,6 +771,10 @@
  */
 HANDLE16 WINAPI FarGetOwner( HGLOBAL16 handle )
 {
+    if (!VALID_HANDLE(handle)) {
+	fprintf(stderr,"Invalid handle 0x%04x passed to FarGetOwner!\n",handle);
+	return 0;
+    }
     return GET_ARENA_PTR(handle)->hOwner;
 }
 
@@ -720,11 +784,15 @@
  */
 WORD WINAPI GlobalHandleToSel( HGLOBAL16 handle )
 {
-    dprintf_toolhelp( stddeb, "GlobalHandleToSel: %04x\n", handle );
+    dprintf_info(toolhelp, "GlobalHandleToSel: %04x\n", handle );
     if (!handle) return 0;
 #ifdef CONFIG_IPC
     if (is_dde_handle(handle)) return DDE_GlobalHandleToSel(handle);
 #endif
+    if (!VALID_HANDLE(handle)) {
+	fprintf(stderr,"Invalid handle 0x%04x passed to GlobalHandleToSel!\n",handle);
+	return 0;
+    }
     if (!(handle & 7))
     {
         fprintf( stderr, "Program attempted invalid selector conversion\n" );
@@ -961,7 +1029,7 @@
    }
    else
    {
-      dprintf_global(stddeb, "GlobalLock32: invalid handle\n");
+      dprintf_warn(global, "GlobalLock32: invalid handle\n");
       palloc=(LPVOID) NULL;
    }
    /* HeapUnlock(GetProcessHeap()); */;
@@ -992,7 +1060,7 @@
    }
    else
    {
-      dprintf_global(stddeb, "GlobalUnlock32: invalid handle\n");
+      dprintf_warn(global, "GlobalUnlock32: invalid handle\n");
       locked=FALSE;
    }
    /* HeapUnlock(GetProcessHeap()); */
@@ -1165,7 +1233,7 @@
       }
       else
       {
-	 dprintf_global(stddeb, "GlobalSize32: invalid handle\n");
+	 dprintf_warn(global, "GlobalSize32: invalid handle\n");
 	 retval=0;
       }
       /* HeapUnlock(GetProcessHeap()); */
@@ -1234,7 +1302,7 @@
       }
       else
       {
-	 dprintf_global(stddeb,"GlobalFlags32: invalid handle\n");
+	 dprintf_warn(global,"GlobalFlags32: invalid handle\n");
 	 retval=0;
       }
       /* HeapUnlock(GetProcessHeap()); */
@@ -1324,3 +1392,14 @@
     if (hmem) *hmem = xhmem;
     return WIN16_GlobalLock16(xhmem);
 }
+
+/**********************************************************************
+ *           WOWGlobalUnlockFree (KERNEL32.64)
+ *
+ * Combined GlobalUnlock and GlobalFree.
+ */
+WORD WOWGlobalUnlockFree16(DWORD vpmem) {
+    if (!GlobalUnlock16(HIWORD(vpmem)))
+    	return 0;
+    return GlobalFree16(HIWORD(vpmem));
+}
diff --git a/memory/heap.c b/memory/heap.c
index 9904b3d..6499172 100644
--- a/memory/heap.c
+++ b/memory/heap.c
@@ -14,7 +14,6 @@
 #include "winerror.h"
 #include "winnt.h"
 #include "heap.h"
-#include "stddebug.h"
 #include "debug.h"
 
 /* Note: the heap data structures are based on what Pietrek describes in his
@@ -189,7 +188,7 @@
         SetLastError( ERROR_INVALID_HANDLE );
         return NULL;
     }
-    if (debugging_heap && !HeapValidate( heap, 0, NULL ))
+    if (debugging_info(heap) && !HeapValidate( heap, 0, NULL ))
     {
         HEAP_Dump( heapPtr );
         assert( FALSE );
@@ -303,7 +302,7 @@
 
     /* If debugging, erase the freed block content */
 
-    if (debugging_heap)
+    if (debugging_info(heap))
     {
         char *pEnd = (char *)ptr + size;
         if (pEnd > (char *)subheap + subheap->commitSize)
@@ -322,7 +321,7 @@
         pNext->next->prev = pNext->prev;
         pNext->prev->next = pNext->next;
         size += (pNext->size & ARENA_SIZE_MASK) + sizeof(*pNext);
-        if (debugging_heap)
+        if (debugging_info(heap))
             memset( pNext, ARENA_FREE_FILLER, sizeof(ARENA_FREE) );
     }
 
@@ -541,7 +540,7 @@
     subheap->next = heap->subheap.next;
     heap->subheap.next = subheap;
     size = subheap->size;
-    dprintf_heap( stddeb, "HEAP_FindFreeBlock: created new sub-heap %08lx of %08lx bytes for heap %08lx\n",
+    dprintf_info(heap, "HEAP_FindFreeBlock: created new sub-heap %08lx of %08lx bytes for heap %08lx\n",
                   (DWORD)subheap, size, (DWORD)heap );
 
     HEAP_CreateFreeBlock( subheap, subheap + 1, size - sizeof(*subheap) );
@@ -851,7 +850,7 @@
     HEAP *heapPtr = HEAP_GetPtr( heap );
     SUBHEAP *subheap;
 
-    dprintf_heap( stddeb, "HeapDestroy: %08x\n", heap );
+    dprintf_info(heap, "HeapDestroy: %08x\n", heap );
     if (!heapPtr) return FALSE;
 
     DeleteCriticalSection( &heapPtr->critSection );
@@ -890,7 +889,7 @@
 
     if (!(pArena = HEAP_FindFreeBlock( heapPtr, size, &subheap )))
     {
-        dprintf_heap( stddeb, "HeapAlloc(%08x,%08lx,%08lx): returning NULL\n",
+        dprintf_info(heap, "HeapAlloc(%08x,%08lx,%08lx): returning NULL\n",
                   heap, flags, size  );
         if (!(flags & HEAP_NO_SERIALIZE)) HeapUnlock( heap );
         SetLastError( ERROR_COMMITMENT_LIMIT );
@@ -916,11 +915,11 @@
     HEAP_ShrinkBlock( subheap, pInUse, size );
 
     if (flags & HEAP_ZERO_MEMORY) memset( pInUse + 1, 0, size );
-    else if (debugging_heap) memset( pInUse + 1, ARENA_INUSE_FILLER, size );
+    else if (debugging_info(heap)) memset( pInUse + 1, ARENA_INUSE_FILLER, size );
 
     if (!(flags & HEAP_NO_SERIALIZE)) HeapUnlock( heap );
 
-    dprintf_heap( stddeb, "HeapAlloc(%08x,%08lx,%08lx): returning %08lx\n",
+    dprintf_info(heap, "HeapAlloc(%08x,%08lx,%08lx): returning %08lx\n",
                   heap, flags, size, (DWORD)(pInUse + 1) );
     return (LPVOID)(pInUse + 1);
 }
@@ -945,7 +944,7 @@
     {
         if (!(flags & HEAP_NO_SERIALIZE)) HeapUnlock( heap );
         SetLastError( ERROR_INVALID_PARAMETER );
-        dprintf_heap( stddeb, "HeapFree(%08x,%08lx,%08lx): returning FALSE\n",
+        dprintf_info(heap, "HeapFree(%08x,%08lx,%08lx): returning FALSE\n",
                       heap, flags, (DWORD)ptr );
         return FALSE;
     }
@@ -959,7 +958,7 @@
     if (!(flags & HEAP_NO_SERIALIZE)) HeapUnlock( heap );
 /*    SetLastError( 0 ); */
 
-    dprintf_heap( stddeb, "HeapFree(%08x,%08lx,%08lx): returning TRUE\n",
+    dprintf_info(heap, "HeapFree(%08x,%08lx,%08lx): returning TRUE\n",
                   heap, flags, (DWORD)ptr );
     return TRUE;
 }
@@ -991,7 +990,7 @@
     {
         if (!(flags & HEAP_NO_SERIALIZE)) HeapUnlock( heap );
         SetLastError( ERROR_INVALID_PARAMETER );
-        dprintf_heap( stddeb, "HeapReAlloc(%08x,%08lx,%08lx,%08lx): returning NULL\n",
+        dprintf_info(heap, "HeapReAlloc(%08x,%08lx,%08lx,%08lx): returning NULL\n",
                       heap, flags, (DWORD)ptr, size );
         return NULL;
     }
@@ -1065,7 +1064,7 @@
         if (flags & HEAP_ZERO_MEMORY)
             memset( (char *)(pArena + 1) + oldSize, 0,
                     (pArena->size & ARENA_SIZE_MASK) - oldSize );
-        else if (debugging_heap)
+        else if (debugging_info(heap))
             memset( (char *)(pArena + 1) + oldSize, ARENA_INUSE_FILLER,
                     (pArena->size & ARENA_SIZE_MASK) - oldSize );
     }
@@ -1075,7 +1074,7 @@
     pArena->callerEIP = *((DWORD *)&heap - 1);  /* hack hack */
     if (!(flags & HEAP_NO_SERIALIZE)) HeapUnlock( heap );
 
-    dprintf_heap( stddeb, "HeapReAlloc(%08x,%08lx,%08lx,%08lx): returning %08lx\n",
+    dprintf_info(heap, "HeapReAlloc(%08x,%08lx,%08lx,%08lx): returning %08lx\n",
                   heap, flags, (DWORD)ptr, size, (DWORD)(pArena + 1) );
     return (LPVOID)(pArena + 1);
 }
@@ -1138,7 +1137,7 @@
     }
     if (!(flags & HEAP_NO_SERIALIZE)) HeapUnlock( heap );
 
-    dprintf_heap( stddeb, "HeapSize(%08x,%08lx,%08lx): returning %08lx\n",
+    dprintf_info(heap, "HeapSize(%08x,%08lx,%08lx): returning %08lx\n",
                   heap, flags, (DWORD)ptr, ret );
     return ret;
 }
diff --git a/memory/ldt.c b/memory/ldt.c
index 50171b0..55a2875 100644
--- a/memory/ldt.c
+++ b/memory/ldt.c
@@ -10,7 +10,6 @@
 #include <string.h>
 #include <errno.h>
 #include "ldt.h"
-#include "stddebug.h"
 #include "debug.h"
 
 #ifdef __i386__
@@ -148,7 +147,7 @@
 {
     int ret = 0;
 
-    dprintf_ldt(stddeb,
+    dprintf_info(ldt,
 	  "LDT_SetEntry: entry=%04x base=%08lx limit=%05lx %s %d-bit flags=%c%c%c\n",
           entry, content->base, content->limit,
           content->limit_in_pages ? "pages" : "bytes",
diff --git a/memory/local.c b/memory/local.c
index cb572e8..2ebca30 100644
--- a/memory/local.c
+++ b/memory/local.c
@@ -24,7 +24,6 @@
 #include "module.h"
 #include "stackframe.h"
 #include "toolhelp.h"
-#include "stddebug.h"
 #include "debug.h"
 
 /* needed only  for GDI_HeapSel and USER_HeapSel */
@@ -126,7 +125,7 @@
 {
     LOCALHEAPINFO *pInfo;
     INSTANCEDATA *ptr = (INSTANCEDATA *)PTR_SEG_OFF_TO_LIN( ds, 0 );
-    dprintf_local( stddeb, "Heap at %p, %04x\n", ptr, ptr->heap );
+    dprintf_info(local, "Heap at %p, %04x\n", ptr, ptr->heap );
     if (!ptr || !ptr->heap) return NULL;
     if (IsBadReadPtr16( (SEGPTR)MAKELONG(ptr->heap,ds), sizeof(LOCALHEAPINFO)))
         return NULL;
@@ -164,7 +163,7 @@
         next = pNext->next;
     }
 
-    dprintf_local( stddeb, "Local_MakeBlockFree %04x, next %04x\n", block, next );
+    dprintf_info(local, "Local_MakeBlockFree %04x, next %04x\n", block, next );
       /* Insert the free block in the free-list */
 
     pArena->free_prev = pNext->free_prev;
@@ -229,7 +228,7 @@
 
       /* Remove the block from the free-list */
 
-    dprintf_local( stddeb, "Local_RemoveBlock\n");
+    dprintf_info(local, "Local_RemoveBlock\n");
     pArena = ARENA_PTR( baseptr, block );
     if ((pArena->prev & 3) == LOCAL_ARENA_FREE)
         LOCAL_RemoveFreeBlock( baseptr, block );
@@ -253,11 +252,18 @@
  */
 static void LOCAL_PrintHeap( HANDLE16 ds )
 {
-    char *ptr = PTR_SEG_OFF_TO_LIN( ds, 0 );
-    LOCALHEAPINFO *pInfo = LOCAL_GetHeap( ds );
+    char *ptr;
+    LOCALHEAPINFO *pInfo;
     WORD arena;
 
-    if (!debugging_local) return;
+    /* FIXME - the test should be done when calling the function! 
+               plus is not clear that we should print this info
+               only when debugging_info is on! */
+    if(!debugging_info(local)) return;
+
+    ptr = PTR_SEG_OFF_TO_LIN( ds, 0 );
+    pInfo = LOCAL_GetHeap( ds );
+
     if (!pInfo)
     {
         printf( "Local Heap corrupted!  ds=%04x\n", ds );
@@ -321,13 +327,13 @@
       /* - large free block    (FREE)       */
       /* - last arena          (FREE)       */
 
-    dprintf_local(stddeb, "LocalInit: %04x %04x-%04x\n", selector, start, end);
+    dprintf_info(local, "LocalInit: %04x %04x-%04x\n", selector, start, end);
     if (!selector) selector = CURRENT_DS;
 
-    if (debugging_heap)
+    if (debugging_info(heap))
     {
-        /* If debugging_heap is set, the global heap blocks are cleared */
-        /* before use, so we can test for double initialization. */
+        /* If debugging_info(heap) is set, the global heap blocks are */
+        /* cleared before use, so we can test for double initialization. */
         if (LOCAL_GetHeap(selector))
         {
             fprintf( stderr, "LocalInit: Heap %04x initialized twice.\n", selector);
@@ -349,7 +355,7 @@
 		start = GlobalSize16( GlobalHandle16( selector ) );
 		start -= end;
 		end += start;
-		dprintf_local( stddeb," new start %04x, minstart: %04x\n", start, pSeg->minsize + pModule->stack_size);
+		dprintf_info(local," new start %04x, minstart: %04x\n", start, pSeg->minsize + pModule->stack_size);
 	    }
 	}
     }
@@ -471,7 +477,7 @@
         pHeapInfo->items--;
     }
 
-    dprintf_local( stddeb, "Heap expanded\n" );
+    dprintf_info(local, "Heap expanded\n" );
     LOCAL_PrintHeap( ds );
 }
 
@@ -485,7 +491,7 @@
     LOCALHEAPINFO *pInfo;
     LOCALARENA *pArena, *pPrev, *pNext;
 
-    dprintf_local( stddeb, "LocalFreeArena: %04x ds=%04x\n", arena, ds );
+    dprintf_info(local, "LocalFreeArena: %04x ds=%04x\n", arena, ds );
     if (!(pInfo = LOCAL_GetHeap( ds ))) return arena;
 
     pArena = ARENA_PTR( ptr, arena );
@@ -654,16 +660,16 @@
         LOCAL_PrintHeap(ds);
         return 0;
     }
-    dprintf_local(stddeb,
+    dprintf_info(local,
                   "LOCAL_Compact: ds = %04x, minfree = %04x, flags = %04x\n",
                   ds, minfree, flags);
     freespace = LOCAL_GetFreeSpace(ds, minfree ? 0 : 1);
     if(freespace >= minfree || (flags & LMEM_NOCOMPACT))
     {
-        dprintf_local(stddeb, "Returning %04x.\n", freespace);
+        dprintf_info(local, "Returning %04x.\n", freespace);
         return freespace;
     }
-    dprintf_local(stddeb, "Local_Compact: Compacting heap %04x.\n", ds);
+    dprintf_info(local, "Local_Compact: Compacting heap %04x.\n", ds);
     table = pInfo->htable;
     while(table)
     {
@@ -673,7 +679,7 @@
             if((pEntry->lock == 0) && (pEntry->flags != (LMEM_DISCARDED >> 8)))
             {
                 /* OK we can move this one if we want */
-                dprintf_local(stddeb,
+                dprintf_info(local,
                               "handle %04x (block %04x) can be moved.\n",
                               (WORD)((char *)pEntry - ptr), pEntry->addr);
                 movearena = ARENA_HEADER(pEntry->addr);
@@ -701,7 +707,7 @@
                 }
                 if (finalarena) /* Actually got somewhere to move */
                 {
-                    dprintf_local(stddeb, "Moving it to %04x.\n", finalarena);
+                    dprintf_info(local, "Moving it to %04x.\n", finalarena);
                     pFinalArena = ARENA_PTR(ptr, finalarena);
                     size = pFinalArena->size;
                     LOCAL_RemoveFreeBlock(ptr, finalarena);
@@ -732,7 +738,7 @@
     freespace = LOCAL_GetFreeSpace(ds, minfree ? 0 : 1);
     if(freespace >= minfree || (flags & LMEM_NODISCARD))
     {
-        dprintf_local(stddeb, "Returning %04x.\n", freespace);
+        dprintf_info(local, "Returning %04x.\n", freespace);
         return freespace;
     }
 
@@ -745,7 +751,7 @@
             if(pEntry->addr && pEntry->lock == 0 &&
 	     (pEntry->flags & (LMEM_DISCARDABLE >> 8)))
 	    {
-                dprintf_local(stddeb, "Discarding handle %04x (block %04x).\n",
+                dprintf_info(local, "Discarding handle %04x (block %04x).\n",
                               (char *)pEntry - ptr, pEntry->addr);
                 LOCAL_FreeArena(ds, ARENA_HEADER(pEntry->addr));
                 pEntry->addr = 0;
@@ -784,7 +790,7 @@
 	if (arena == pArena->free_next) break;
         if (pArena->size >= size) return arena;
     }
-    dprintf_local( stddeb, "Local_FindFreeBlock: not enough space\n" );
+    dprintf_warn(local, "Local_FindFreeBlock: not enough space\n" );
     LOCAL_PrintHeap(ds);
     return 0;
 }
@@ -827,15 +833,15 @@
     }
     if (arena == 0) {
         if (ds == GDI_HeapSel) { 
-	    fprintf( stderr, 
+	    dprintf_warn(local, 
 	       "Local_GetBlock: not enough space in GDI local heap (%04x) for %d bytes\n",
 		     ds, size );
 	} else if (ds == USER_HeapSel) {
-	    fprintf( stderr, 
+	    dprintf_warn(local, 
 	       "Local_GetBlock: not enough space in USER local heap (%04x) for %d bytes\n",
 		     ds, size );
 	} else {
-	    dprintf_local( stddeb, 
+	    dprintf_warn(local, 
 	       "Local_GetBlock: not enough space in local heap %04x for %d bytes\n",
 		     ds, size );
 	}
@@ -844,7 +850,7 @@
 
       /* Make a block out of the free arena */
     pArena = ARENA_PTR( ptr, arena );
-    dprintf_local(stddeb, "LOCAL_GetBlock size = %04x, arena %04x size %04x\n",
+    dprintf_info(local, "LOCAL_GetBlock size = %04x, arena %04x size %04x\n",
                   size, arena, pArena->size );
     LOCAL_RemoveFreeBlock( ptr, arena );
     LOCAL_ShrinkArena( ds, arena, size );
@@ -866,7 +872,7 @@
     HLOCAL16 handle;
     int i;
 
-    dprintf_local( stddeb, "Local_NewHTable\n" );
+    dprintf_info(local, "Local_NewHTable\n" );
     if (!(pInfo = LOCAL_GetHeap( ds )))
     {
         fprintf( stderr, "Local heap not found\n");
@@ -938,7 +944,7 @@
 
     pEntry->lock = 0;
     pEntry->flags = 0;
-    dprintf_local( stddeb, "LOCAL_GetNewHandleEntry(%04x): %04x\n",
+    dprintf_info(local, "LOCAL_GetNewHandleEntry(%04x): %04x\n",
                    ds, ((char *)pEntry - ptr) );
     return (HLOCAL16)((char *)pEntry - ptr);
 }
@@ -990,7 +996,7 @@
     
     /* Remove the table from the linked list and free it */
 
-    dprintf_local( stddeb, "LOCAL_FreeHandleEntry(%04x): freeing table %04x\n",
+    dprintf_info(local, "LOCAL_FreeHandleEntry(%04x): freeing table %04x\n",
                    ds, table);
     *pTable = *(WORD *)pEntry;
     LOCAL_FreeArena( ds, ARENA_HEADER( table ) );
@@ -1006,7 +1012,7 @@
 {
     char *ptr = PTR_SEG_OFF_TO_LIN( ds, 0 );
 
-    dprintf_local( stddeb, "LocalFree: %04x ds=%04x\n", handle, ds );
+    dprintf_info(local, "LocalFree: %04x ds=%04x\n", handle, ds );
     
     if (!handle) { fprintf( stderr, "LOCAL_Free: handle is 0.\n" ); return 0; }
     if (HANDLE_FIXED( handle ))
@@ -1019,7 +1025,7 @@
         LOCALHANDLEENTRY *pEntry = (LOCALHANDLEENTRY *)(ptr + handle);
         if (pEntry->flags != (LMEM_DISCARDED >> 8))
         {
-            dprintf_local( stddeb, "LocalFree: real block at %04x\n",
+            dprintf_info(local, "LocalFree: real block at %04x\n",
 			   pEntry->addr );
             if (LOCAL_FreeArena( ds, ARENA_HEADER(pEntry->addr) ))
                 return handle; /* couldn't free it */
@@ -1041,7 +1047,7 @@
     char *ptr;
     HLOCAL16 handle;
     
-    dprintf_local( stddeb, "LocalAlloc: %04x %d ds=%04x\n", flags, size, ds );
+    dprintf_info(local, "LocalAlloc: %04x %d ds=%04x\n", flags, size, ds );
 
     if(size > 0 && size <= 4) size = 5;
     if (flags & LMEM_MOVEABLE)
@@ -1108,7 +1114,7 @@
      ((LOCALHANDLEENTRY *)(ptr + handle))->lock == 0xff) /* An unused handle */
 	return 0;
 
-    dprintf_local( stddeb, "LocalReAlloc: %04x %d %04x ds=%04x\n",
+    dprintf_info(local, "LocalReAlloc: %04x %d %04x ds=%04x\n",
                    handle, size, flags, ds );
     if (!(pInfo = LOCAL_GetHeap( ds ))) return 0;
     
@@ -1123,7 +1129,7 @@
 	    if(pEntry->addr)
 		fprintf(stderr,
 			"LOCAL_ReAlloc: Dicarded block has non-zero addr.\n");
-	    dprintf_local(stddeb, "ReAllocating discarded block\n");
+	    dprintf_info(local, "ReAllocating discarded block\n");
 	    if(size <= 4) size = 5;
 	    if (!(hl = LOCAL_GetBlock( ds, size + sizeof(HLOCAL16), flags)))
 		return 0;
@@ -1153,7 +1159,7 @@
 	{
 	    pEntry = (LOCALHANDLEENTRY *)(ptr + handle);
 	    pEntry->flags = (flags & 0x0f00) >> 8;
-	    dprintf_local(stddeb, "Changing flags to %x.\n", pEntry->flags);
+	    dprintf_info(local, "Changing flags to %x.\n", pEntry->flags);
 	}
 	return handle;
     }
@@ -1164,7 +1170,7 @@
         {
 	    if (HANDLE_FIXED(handle))
 	    {
-                dprintf_local(stddeb, "Freeing fixed block.\n");
+                dprintf_info(local, "Freeing fixed block.\n");
                 return LOCAL_Free( ds, handle );
             }
 	    else /* Moveable block */
@@ -1173,7 +1179,7 @@
 		if (pEntry->lock == 0)
 		{
 		    /* discards moveable blocks */
-                    dprintf_local(stddeb,"Discarding block\n");
+                    dprintf_info(local,"Discarding block\n");
                     LOCAL_FreeArena(ds, ARENA_HEADER(pEntry->addr));
                     pEntry->addr = 0;
                     pEntry->flags = (LMEM_DISCARDED >> 8);
@@ -1195,7 +1201,7 @@
     }
 
     arena = ARENA_HEADER( blockhandle );
-    dprintf_local( stddeb, "LocalReAlloc: arena is %04x\n", arena );
+    dprintf_info(local, "LocalReAlloc: arena is %04x\n", arena );
     pArena = ARENA_PTR( ptr, arena );
 
     if(size <= 4) size = 5;
@@ -1206,9 +1212,9 @@
 
     if (nextarena <= pArena->next)
     {
-	dprintf_local( stddeb, "size reduction, making new free block\n");
+	dprintf_info(local, "size reduction, making new free block\n");
 	LOCAL_ShrinkArena(ds, arena, nextarena - arena);
-        dprintf_local( stddeb, "LocalReAlloc: returning %04x\n", handle );
+        dprintf_info(local, "LocalReAlloc: returning %04x\n", handle );
         return handle;
     }
 
@@ -1218,9 +1224,9 @@
     if (((pNext->prev & 3) == LOCAL_ARENA_FREE) &&
         (nextarena <= pNext->next))
     {
-	dprintf_local( stddeb, "size increase, making new free block\n");
+	dprintf_info(local, "size increase, making new free block\n");
         LOCAL_GrowArenaUpward(ds, arena, nextarena - arena);
-        dprintf_local( stddeb, "LocalReAlloc: returning %04x\n", handle );
+        dprintf_info(local, "LocalReAlloc: returning %04x\n", handle );
         return handle;
     }
 
@@ -1231,7 +1237,7 @@
     {
 	if (HANDLE_FIXED(handle))
         {
-            dprintf_local(stddeb,
+            dprintf_warn(local,
 	     "Needed to move fixed block, but LMEM_MOVEABLE not specified.\n");
             return 0;
         }
@@ -1239,8 +1245,8 @@
 	{
 	    if(((LOCALHANDLEENTRY *)(ptr + handle))->lock != 0)
 	    {
-		dprintf_local(stddeb,
-	"Needed to move locked block, but LMEM_MOVEABLE not specified.\n");
+		dprintf_warn(local,
+	       "Needed to move locked block, but LMEM_MOVEABLE not specified.\n");
 		return 0;
 	    }
         }
@@ -1276,7 +1282,7 @@
     }
     if (HANDLE_MOVEABLE( handle ))
     {
-	dprintf_local( stddeb, "LocalReAlloc: fixing handle\n");
+	dprintf_info(local, "LocalReAlloc: fixing handle\n");
         pEntry = (LOCALHANDLEENTRY *)(ptr + handle);
         pEntry->addr = hmem + sizeof(HLOCAL16);
 	/* Back ptr should still be correct */
@@ -1285,7 +1291,7 @@
 	hmem = handle;
     }
     if (size == oldsize) hmem = 0;  /* Realloc failed */
-    dprintf_local( stddeb, "LocalReAlloc: returning %04x\n", hmem );
+    dprintf_info(local, "LocalReAlloc: returning %04x\n", hmem );
     return hmem;
 }
 
@@ -1295,7 +1301,8 @@
  */
 static HLOCAL16 LOCAL_InternalLock( LPSTR heap, HLOCAL16 handle )
 {
-    dprintf_local( stddeb, "LocalLock: %04x ", handle );
+    HLOCAL16 old_handle = handle;
+
     if (HANDLE_MOVEABLE(handle))
     {
         LOCALHANDLEENTRY *pEntry = (LOCALHANDLEENTRY *)(heap + handle);
@@ -1303,7 +1310,8 @@
         if (pEntry->lock < 0xfe) pEntry->lock++;
         handle = pEntry->addr;
     }
-    dprintf_local( stddeb, "returning %04x\n", handle );
+    dprintf_info(local, "LocalLock: %04x returning %04x\n", 
+		   old_handle, handle );
     return handle;
 }
 
@@ -1335,7 +1343,7 @@
 {
     char *ptr = PTR_SEG_OFF_TO_LIN( ds, 0 );
 
-    dprintf_local( stddeb, "LocalUnlock: %04x\n", handle );
+    dprintf_info(local, "LocalUnlock: %04x\n", handle );
     if (HANDLE_MOVEABLE(handle))
     {
         LOCALHANDLEENTRY *pEntry = (LOCALHANDLEENTRY *)(ptr + handle);
@@ -1358,7 +1366,7 @@
     char *ptr = PTR_SEG_OFF_TO_LIN( CURRENT_DS, 0 );
     LOCALARENA *pArena;
 
-    dprintf_local( stddeb, "LocalSize: %04x ds=%04x\n", handle, ds );
+    dprintf_info(local, "LocalSize: %04x ds=%04x\n", handle, ds );
 
     if (HANDLE_MOVEABLE( handle )) handle = *(WORD *)(ptr + handle);
     if (!handle) return 0;
@@ -1379,13 +1387,13 @@
     if (HANDLE_MOVEABLE(handle))
     {
         LOCALHANDLEENTRY *pEntry = (LOCALHANDLEENTRY *)(ptr + handle);
-        dprintf_local( stddeb, "LOCAL_Flags(%04x,%04x): returning %04x\n",
+        dprintf_info(local, "LOCAL_Flags(%04x,%04x): returning %04x\n",
                        ds, handle, pEntry->lock | (pEntry->flags << 8) );
         return pEntry->lock | (pEntry->flags << 8);
     }
     else
     {
-        dprintf_local( stddeb, "LOCAL_Flags(%04x,%04x): returning 0\n",
+        dprintf_info(local, "LOCAL_Flags(%04x,%04x): returning 0\n",
                        ds, handle );
         return 0;
     }
@@ -1434,7 +1442,7 @@
 	if (arena == pArena->free_next) break;
         total += pArena->size;
     }
-    dprintf_local( stddeb, "LOCAL_CountFree(%04x): returning %d\n", ds, total);
+    dprintf_info(local, "LOCAL_CountFree(%04x): returning %d\n", ds, total);
     return total;
 }
 
@@ -1552,7 +1560,7 @@
  */
 UINT16 WINAPI LocalCompact16( UINT16 minfree )
 {
-    dprintf_local( stddeb, "LocalCompact: %04x\n", minfree );
+    dprintf_info(local, "LocalCompact: %04x\n", minfree );
     return LOCAL_Compact( CURRENT_DS, minfree, 0 );
 }
 
@@ -1572,7 +1580,7 @@
 	LOCAL_PrintHeap( ds );
 	return 0;
     }
-    dprintf_local( stddeb, "LocalNotify(%04x): %08lx\n", ds, (DWORD)func );
+    dprintf_info(local, "LocalNotify(%04x): %08lx\n", ds, (DWORD)func );
     fprintf(stdnimp, "LocalNotify(): Half implemented\n");
     oldNotify = pInfo->notify;
     pInfo->notify = func;
@@ -1585,7 +1593,7 @@
  */
 UINT16 WINAPI LocalShrink16( HGLOBAL16 handle, UINT16 newsize )
 {
-    dprintf_local( stddeb, "LocalShrink: %04x %04x\n", handle, newsize );
+    dprintf_info(local, "LocalShrink: %04x %04x\n", handle, newsize );
     return 0;
 }
 
@@ -1618,7 +1626,7 @@
  */
 WORD WINAPI LocalHeapSize(void)
 {
-    dprintf_local( stddeb, "LocalHeapSize:\n" );
+    dprintf_info(local, "LocalHeapSize:\n" );
     return LOCAL_HeapSize( CURRENT_DS );
 }
 
@@ -1637,7 +1645,7 @@
 	return 0;
     }
     if (delta) pInfo->hdelta = delta;
-    dprintf_local(stddeb, "LocalHandleDelta: returning %04x\n", pInfo->hdelta);
+    dprintf_info(local, "LocalHandleDelta: returning %04x\n", pInfo->hdelta);
     return pInfo->hdelta;
 }
 
diff --git a/memory/selector.c b/memory/selector.c
index db7ca70..9188f55 100644
--- a/memory/selector.c
+++ b/memory/selector.c
@@ -10,7 +10,6 @@
 #include "miscemu.h"
 #include "selectors.h"
 #include "stackframe.h"
-#include "stddebug.h"
 #include "debug.h"
 
 
@@ -60,7 +59,7 @@
 
     count = sel ? ((GET_SEL_LIMIT(sel) >> 16) + 1) : 1;
     newsel = AllocSelectorArray( count );
-    dprintf_selector( stddeb, "AllocSelector(%04x): returning %04x\n",
+    dprintf_info(selector, "AllocSelector(%04x): returning %04x\n",
                       sel, newsel );
     if (!newsel) return 0;
     if (!sel) return newsel;  /* nothing to copy */
@@ -149,7 +148,7 @@
     ldt_entry entry;
     STACK16FRAME *frame;
 
-    dprintf_selector( stddeb, "SELECTOR_FreeBlock(%04x,%d)\n", sel, count );
+    dprintf_info(selector, "SELECTOR_FreeBlock(%04x,%d)\n", sel, count );
     sel &= ~(__AHINCR - 1);  /* clear bottom bits of selector */
     nextsel = sel + (count << __AHSHIFT);
 
@@ -253,7 +252,7 @@
     ldt_entry entry;
 
     newsel = AllocSelectorArray( 1 );
-    dprintf_selector( stddeb, "AllocCStoDSAlias(%04x): returning %04x\n",
+    dprintf_info(selector, "AllocCStoDSAlias(%04x): returning %04x\n",
                       sel, newsel );
     if (!newsel) return 0;
     LDT_GetEntry( SELECTOR_TO_ENTRY(sel), &entry );
@@ -272,7 +271,7 @@
     ldt_entry entry;
 
     newsel = AllocSelectorArray( 1 );
-    dprintf_selector( stddeb, "AllocDStoCSAlias(%04x): returning %04x\n",
+    dprintf_info(selector, "AllocDStoCSAlias(%04x): returning %04x\n",
                       sel, newsel );
     if (!newsel) return 0;
     LDT_GetEntry( SELECTOR_TO_ENTRY(sel), &entry );
diff --git a/memory/string.c b/memory/string.c
index fb94859..8a4a18a 100644
--- a/memory/string.c
+++ b/memory/string.c
@@ -10,7 +10,6 @@
 #include "windows.h"
 #include "winerror.h"
 #include "ldt.h"
-#include "stddebug.h"
 #include "debug.h"
 #include "debugstr.h"
 
@@ -78,7 +77,7 @@
  */
 LPSTR WINAPI lstrcat32A( LPSTR dst, LPCSTR src )
 {
-    dprintf_string(stddeb,"strcat: Append %s to %s\n",
+    dprintf_info(string,"strcat: Append %s to %s\n",
 		   debugstr_a (src), debugstr_a (dst));
     /* Windows does not check for NULL pointers here, so we don't either */
     strcat( dst, src );
@@ -92,7 +91,7 @@
 LPWSTR WINAPI lstrcat32W( LPWSTR dst, LPCWSTR src )
 {
     register LPWSTR p = dst;
-    dprintf_string(stddeb,"strcat: Append L%s to L%s\n",
+    dprintf_info(string,"strcat: Append L%s to L%s\n",
 		   debugstr_w (src), debugstr_w (dst));
     /* Windows does not check for NULL pointers here, so we don't either */
     while (*p) p++;
@@ -117,7 +116,7 @@
 LPSTR WINAPI lstrcatn32A( LPSTR dst, LPCSTR src, INT32 n )
 {
     register LPSTR p = dst;
-    dprintf_string(stddeb,"strcatn add %d chars from %s to %s\n",
+    dprintf_info(string,"strcatn add %d chars from %s to %s\n",
 		   n, debugstr_an (src, n), debugstr_a (dst));
     while (*p) p++;
     if ((n -= (INT32)(p - dst)) <= 0) return dst;
@@ -132,7 +131,7 @@
 LPWSTR WINAPI lstrcatn32W( LPWSTR dst, LPCWSTR src, INT32 n )
 {
     register LPWSTR p = dst;
-    dprintf_string(stddeb,"strcatn add %d chars from L%s to L%s\n",
+    dprintf_info(string,"strcatn add %d chars from L%s to L%s\n",
 		   n, debugstr_wn (src, n), debugstr_w (dst));
     while (*p) p++;
     if ((n -= (INT32)(p - dst)) <= 0) return dst;
@@ -155,7 +154,7 @@
  */
 INT32 WINAPI lstrcmp32A( LPCSTR str1, LPCSTR str2 )
 {
-    dprintf_string(stddeb,"strcmp: %s and %s\n",
+    dprintf_info(string,"strcmp: %s and %s\n",
 		   debugstr_a (str1), debugstr_a (str2));
     /* Win95 KERNEL32.DLL does it that way. Hands off! */
     if (!str1 || !str2) {
@@ -171,7 +170,7 @@
  */
 INT32 WINAPI lstrcmp32W( LPCWSTR str1, LPCWSTR str2 )
 {
-    dprintf_string(stddeb,"strcmp: L%s and L%s\n",
+    dprintf_info(string,"strcmp: L%s and L%s\n",
 		   debugstr_w (str1), debugstr_w (str2));
     if (!str1 || !str2) {
     	SetLastError(ERROR_INVALID_PARAMETER);
@@ -198,7 +197,7 @@
 {
     INT32 res;
 
-    dprintf_string(stddeb,"strcmpi %s and %s\n",
+    dprintf_info(string,"strcmpi %s and %s\n",
 		   debugstr_a (str1), debugstr_a (str2));
     if (!str1 || !str2) {
     	SetLastError(ERROR_INVALID_PARAMETER);
@@ -223,7 +222,7 @@
 
 #if 0
     /* Too much!  (From registry loading.)  */
-    dprintf_string(stddeb,"strcmpi L%s and L%s\n",
+    dprintf_info(string,"strcmpi L%s and L%s\n",
 		   debugstr_w (str1), debugstr_w (str2));
 #endif
     if (!str1 || !str2) {
@@ -256,7 +255,7 @@
  */
 LPSTR WINAPI lstrcpy32A( LPSTR dst, LPCSTR src )
 {
-    dprintf_string(stddeb,"strcpy %s\n", debugstr_a (src));
+    dprintf_info(string,"strcpy %s\n", debugstr_a (src));
     /* Windows does not check for NULL pointers here, so we don't either */
     strcpy( dst, src );
     return dst;
@@ -269,7 +268,7 @@
 LPWSTR WINAPI lstrcpy32W( LPWSTR dst, LPCWSTR src )
 {
     register LPWSTR p = dst;
-    dprintf_string(stddeb,"strcpy L%s\n", debugstr_w (src));
+    dprintf_info(string,"strcpy L%s\n", debugstr_w (src));
     /* Windows does not check for NULL pointers here, so we don't either */
     while ((*p++ = *src++));
     return dst;
@@ -292,7 +291,7 @@
 LPSTR WINAPI lstrcpyn32A( LPSTR dst, LPCSTR src, INT32 n )
 {
     LPSTR p = dst;
-    dprintf_string(stddeb,"strcpyn %s for %d chars\n",
+    dprintf_info(string,"strcpyn %s for %d chars\n",
 		   debugstr_an (src,n), n);
     /* Windows does not check for NULL pointers here, so we don't either */
     while ((n-- > 1) && *src) *p++ = *src++;
@@ -307,7 +306,7 @@
 LPWSTR WINAPI lstrcpyn32W( LPWSTR dst, LPCWSTR src, INT32 n )
 {
     LPWSTR p = dst;
-    dprintf_string(stddeb,"strcpyn L%s for %d chars\n",
+    dprintf_info(string,"strcpyn L%s for %d chars\n",
 		   debugstr_wn (src,n), n);
     /* Windows does not check for NULL pointers here, so we don't either */
     while ((n-- > 1) && *src) *p++ = *src++;
@@ -334,7 +333,7 @@
      * in lstrlen() ... we check only for NULL pointer reference.
      * - Marcus Meissner
      */
-    dprintf_string(stddeb,"strlen %s\n", debugstr_a (str));
+    dprintf_info(string,"strlen %s\n", debugstr_a (str));
     if (!str) return 0;
     return (INT32)strlen(str);
 }
@@ -346,7 +345,7 @@
 INT32 WINAPI lstrlen32W( LPCWSTR str )
 {
     INT32 len = 0;
-    dprintf_string(stddeb,"strlen L%s\n", debugstr_w (str));
+    dprintf_info(string,"strlen L%s\n", debugstr_w (str));
     if (!str) return 0;
     while (*str++) len++;
     return len;
@@ -358,7 +357,7 @@
  */
 INT32 WINAPI lstrncmp32A( LPCSTR str1, LPCSTR str2, INT32 n )
 {
-    dprintf_string(stddeb,"strncmp %s and %s for %d chars\n",
+    dprintf_info(string,"strncmp %s and %s for %d chars\n",
 		   debugstr_an (str1, n), debugstr_an (str2, n), n);
     return (INT32)strncmp( str1, str2, n );
 }
@@ -369,7 +368,7 @@
  */
 INT32 WINAPI lstrncmp32W( LPCWSTR str1, LPCWSTR str2, INT32 n )
 {
-    dprintf_string(stddeb,"strncmp L%s and L%s for %d chars\n",
+    dprintf_info(string,"strncmp L%s and L%s for %d chars\n",
 		   debugstr_wn (str1, n), debugstr_wn (str2, n), n);
     if (!n) return 0;
     while ((--n > 0) && *str1 && (*str1 == *str2)) { str1++; str2++; }
@@ -384,7 +383,7 @@
 {
     INT32 res;
 
-    dprintf_string(stddeb,"strncmpi %s and %s for %d chars\n",
+    dprintf_info(string,"strncmpi %s and %s for %d chars\n",
 		   debugstr_an (str1, n), debugstr_an (str2, n), n);
     if (!n) return 0;
     while ((--n > 0) && *str1)
@@ -401,7 +400,7 @@
 {
     INT32 res;
 
-    dprintf_string(stddeb,"strncmpi L%s and L%s for %d chars\n",
+    dprintf_info(string,"strncmpi L%s and L%s for %d chars\n",
 		   debugstr_wn (str1, n), debugstr_wn (str2, n), n);
     if (!n) return 0;
     while ((--n > 0) && *str1)
@@ -542,9 +541,9 @@
 {
     LPSTR oldd = d;
     if (!s || !d) return TRUE;
-    dprintf_string (stddeb,"CharToOem %s\n", debugstr_a (s));
+    dprintf_info(string,"CharToOem %s\n", debugstr_a (s));
     while ((*d++ = ANSI_TO_OEM(*s++)));
-    dprintf_string (stddeb,"       to %s\n", debugstr_a (oldd));
+    dprintf_info(string,"       to %s\n", debugstr_a (oldd));
     return TRUE;
 }
 
@@ -576,9 +575,9 @@
 {
     LPSTR oldd = d;
     if (!s || !d) return TRUE;
-    dprintf_string (stddeb,"CharToOem L%s\n", debugstr_w (s));
+    dprintf_info(string,"CharToOem L%s\n", debugstr_w (s));
     while ((*d++ = ANSI_TO_OEM(*s++)));
-    dprintf_string (stddeb,"       to %s\n", debugstr_a (oldd));
+    dprintf_info(string,"       to %s\n", debugstr_a (oldd));
     return TRUE;
 }
 
@@ -589,9 +588,9 @@
 BOOL32 WINAPI OemToChar32A( LPCSTR s, LPSTR d )
 {
     LPSTR oldd = d;
-    dprintf_string(stddeb,"OemToChar %s\n", debugstr_a (s));
+    dprintf_info(string,"OemToChar %s\n", debugstr_a (s));
     while ((*d++ = OEM_TO_ANSI(*s++)));
-    dprintf_string(stddeb,"       to %s\n", debugstr_a (oldd));
+    dprintf_info(string,"       to %s\n", debugstr_a (oldd));
     return TRUE;
 }
 
@@ -601,7 +600,7 @@
  */
 BOOL32 WINAPI OemToCharBuff32A( LPCSTR s, LPSTR d, DWORD len )
 {
-    dprintf_string(stddeb,"OemToCharBuff %s\n", debugstr_an (s, len));
+    dprintf_info(string,"OemToCharBuff %s\n", debugstr_an (s, len));
     while (len--) *d++ = OEM_TO_ANSI(*s++);
     return TRUE;
 }
@@ -612,7 +611,7 @@
  */
 BOOL32 WINAPI OemToCharBuff32W( LPCSTR s, LPWSTR d, DWORD len )
 {
-    dprintf_string(stddeb,"OemToCharBuff %s\n", debugstr_an (s, len));
+    dprintf_info(string,"OemToCharBuff %s\n", debugstr_an (s, len));
     while (len--) *d++ = (WCHAR)OEM_TO_ANSI(*s++);
     return TRUE;
 }
diff --git a/memory/virtual.c b/memory/virtual.c
index 442ccd5..0ee4f21 100644
--- a/memory/virtual.c
+++ b/memory/virtual.c
@@ -18,7 +18,6 @@
 #include "heap.h"
 #include "process.h"
 #include "xmalloc.h"
-#include "stddebug.h"
 #include "debug.h"
 
 #ifndef MS_SYNC
@@ -104,9 +103,14 @@
     NULL,                      /* satisfied */
     NULL,                      /* add_wait */
     NULL,                      /* remove_wait */
+    NULL,                      /* read */
+    NULL,                      /* write */
     VIRTUAL_DestroyMapping     /* destroy */
 };
 
+#define VIRTUAL_DEBUG_DUMP_VIEW(view) \
+   if (!debugging_info(virtual)); else VIRTUAL_DumpView(view)
+
 /***********************************************************************
  *           VIRTUAL_GetProtStr
  */
@@ -133,29 +137,28 @@
     UINT32 addr = view->base;
     BYTE prot = view->prot[0];
 
-    dprintf_virtual( stddeb, "View: %08x - %08x%s",
+    printf( "View: %08x - %08x%s",
              view->base, view->base + view->size - 1,
              (view->flags & VFLAG_SYSTEM) ? " (system)" : "" );
     if (view->mapping && view->mapping->file)
-        dprintf_virtual( stddeb, " %s @ %08x\n",
-                 view->mapping->file->unix_name, view->offset );
+        printf( " %s @ %08x\n", view->mapping->file->unix_name, view->offset );
     else
-        dprintf_virtual( stddeb, " (anonymous)\n");
+        printf( " (anonymous)\n");
 
     for (count = i = 1; i < view->size >> page_shift; i++, count++)
     {
         if (view->prot[i] == prot) continue;
-        dprintf_virtual( stddeb, "      %08x - %08x %s\n",
-                 addr, addr + (count << page_shift) - 1,
-                 VIRTUAL_GetProtStr(prot) );
+        printf( "      %08x - %08x %s\n",
+                addr, addr + (count << page_shift) - 1,
+                VIRTUAL_GetProtStr(prot) );
         addr += (count << page_shift);
         prot = view->prot[i];
         count = 0;
     }
     if (count)
-        dprintf_virtual( stddeb, "      %08x - %08x %s\n",
-                 addr, addr + (count << page_shift) - 1,
-                 VIRTUAL_GetProtStr(prot) );
+        printf( "      %08x - %08x %s\n",
+                addr, addr + (count << page_shift) - 1,
+                VIRTUAL_GetProtStr(prot) );
 }
 
 
@@ -165,7 +168,7 @@
 void VIRTUAL_Dump(void)
 {
     FILE_VIEW *view = VIRTUAL_FirstView;
-    dprintf_virtual( stddeb, "\nDump of all virtual memory views:\n\n" );
+    printf( "\nDump of all virtual memory views:\n\n" );
     while (view)
     {
         VIRTUAL_DumpView( view );
@@ -235,7 +238,7 @@
         if (view->next) view->next->prev = view;
         prev->next  = view;
     }
-    if (debugging_virtual) VIRTUAL_DumpView( view );
+    VIRTUAL_DEBUG_DUMP_VIEW( view );
     return view;
 }
 
@@ -342,7 +345,7 @@
 static BOOL32 VIRTUAL_SetProt( FILE_VIEW *view, UINT32 base,
                                UINT32 size, BYTE vprot )
 {
-    dprintf_virtual( stddeb, "VIRTUAL_SetProt: %08x-%08x %s\n",
+    dprintf_info(virtual, "VIRTUAL_SetProt: %08x-%08x %s\n",
                      base, base + size - 1, VIRTUAL_GetProtStr( vprot ) );
 
     if (mprotect( (void *)base, size, VIRTUAL_GetUnixProt(vprot) ))
@@ -350,7 +353,7 @@
 
     memset( view->prot + ((base - view->base) >> page_shift),
             vprot, size >> page_shift );
-    if (debugging_virtual) VIRTUAL_DumpView( view );
+    VIRTUAL_DEBUG_DUMP_VIEW( view );
     return TRUE;
 }
 
@@ -399,7 +402,7 @@
         int fd = open ("/proc/self/maps", O_RDONLY);
         if (fd >= 0)
         {
-            char buffer[80];
+            char buffer[512]; /* line might be rather long in 2.1 */
 
             for (;;)
             {
@@ -441,7 +444,7 @@
     UINT32 base, ptr, view_size;
     BYTE vprot;
 
-    dprintf_virtual( stddeb, "VirtualAlloc: %08x %08lx %lx %08lx\n",
+    dprintf_info(virtual, "VirtualAlloc: %08x %08lx %lx %08lx\n",
                      (UINT32)addr, size, type, protect );
 
     /* Round parameters to a page boundary */
@@ -470,6 +473,13 @@
         size = (size + page_mask) & ~page_mask;
     }
 
+    if (type & MEM_TOP_DOWN) {
+    	/* FIXME: MEM_TOP_DOWN allocates the largest possible address.
+	 *  	  Is there _ANY_ way to do it with UNIX mmap()?
+	 */
+    	fprintf(stderr,"VirtualAlloc:MEM_TOP_DOWN ignored\n");
+    	type &= ~MEM_TOP_DOWN;
+    }
     /* Compute the protection flags */
 
     if (!(type & (MEM_COMMIT | MEM_RESERVE)) ||
@@ -522,7 +532,7 @@
             SetLastError( ERROR_OUTOFMEMORY );
             return NULL;
         }
-        if (debugging_virtual) VIRTUAL_DumpView( view );
+        VIRTUAL_DEBUG_DUMP_VIEW( view );
         return (LPVOID)ptr;
     }
 
@@ -548,7 +558,7 @@
     FILE_VIEW *view;
     UINT32 base;
 
-    dprintf_virtual( stddeb, "VirtualFree: %08x %08lx %lx\n",
+    dprintf_info(virtual, "VirtualFree: %08x %08lx %lx\n",
                      (UINT32)addr, size, type );
 
     /* Fix the parameters */
@@ -618,7 +628,7 @@
     UINT32 base, i;
     BYTE vprot, *p;
 
-    dprintf_virtual( stddeb, "VirtualProtect: %08x %08lx %08lx\n",
+    dprintf_info(virtual, "VirtualProtect: %08x %08lx %08lx\n",
                      (UINT32)addr, size, new_prot );
 
     /* Fix the parameters */
@@ -890,7 +900,7 @@
 
     /* Check parameters */
 
-    dprintf_virtual(stddeb,"CreateFileMapping32A(%x,%p,%08lx,%08lx%08lx,%s)\n",
+    dprintf_info(virtual,"CreateFileMapping32A(%x,%p,%08lx,%08lx%08lx,%s)\n",
                     hFile, attr, protect, size_high, size_low, name );
 
     vprot = VIRTUAL_GetProt( protect );
@@ -1102,7 +1112,7 @@
 
     /* Map the file */
 
-    dprintf_virtual( stddeb, "MapViewOfFile: handle=%x size=%x offset=%lx\n",
+    dprintf_info(virtual, "MapViewOfFile: handle=%x size=%x offset=%lx\n",
                      handle, size, offset_low );
 
     ptr = (UINT32)FILE_dommap( mapping->file, addr, 0, size, 0, offset_low,
@@ -1137,7 +1147,7 @@
     FILE_VIEW *view;
     UINT32 addr = ROUND_ADDR( base );
 
-    dprintf_virtual( stddeb, "FlushViewOfFile at %p for %ld bytes\n",
+    dprintf_info(virtual, "FlushViewOfFile at %p for %ld bytes\n",
                      base, cbFlush );
 
     if (!(view = VIRTUAL_FindView( addr )))
diff --git a/misc/aspi.c b/misc/aspi.c
index 993cd4a..363c424 100644
--- a/misc/aspi.c
+++ b/misc/aspi.c
@@ -13,7 +13,7 @@
 #include "options.h"
 #include "heap.h"
 #include "debug.h"
-#include "stddebug.h"
+
 
 /* FIXME!
  * 1) Residual byte length reporting not handled
@@ -122,16 +122,16 @@
     sprintf(idstr, "scsi c%1dt%1dd%1d", prb->SRB_HaId, prb->SRB_Target, prb->SRB_Lun);
 
     if (!PROFILE_GetWineIniString(idstr, "Device", "", device_str, sizeof(device_str))) {
-	dprintf_aspi(stddeb, "Trying to open unlisted scsi device %s\n", idstr);
+	dprintf_info(aspi, "Trying to open unlisted scsi device %s\n", idstr);
 	return -1;
     }
 
-    dprintf_aspi(stddeb, "Opening device %s=%s\n", idstr, device_str);
+    dprintf_info(aspi, "Opening device %s=%s\n", idstr, device_str);
 
     fd = open(device_str, O_RDWR);
     if (fd == -1) {
 	int save_error = errno;
-	dprintf_aspi(stddeb, "Error opening device errno=%d\n", save_error);
+	dprintf_warn(aspi, "Error opening device errno=%d\n", save_error);
 	return -1;
     }
 
@@ -156,59 +156,58 @@
   int	i;
   BYTE *cdb;
   BYTE *lpBuf;
+  dbg_decl_str(aspi, 512);
 
   lpBuf = PTR_SEG_TO_LIN(prb->SRB_BufPointer);
 
   switch (prb->CDBByte[0]) {
   case CMD_INQUIRY:
-    dprintf_aspi(stddeb, "{\n");
-    dprintf_aspi(stddeb, "\tEVPD: %d\n", prb->CDBByte[1] & 1);
-    dprintf_aspi(stddeb, "\tLUN: %d\n", (prb->CDBByte[1] & 0xc) >> 1);
-    dprintf_aspi(stddeb, "\tPAGE CODE: %d\n", prb->CDBByte[2]);
-    dprintf_aspi(stddeb, "\tALLOCATION LENGTH: %d\n", prb->CDBByte[4]);
-    dprintf_aspi(stddeb, "\tCONTROL: %d\n", prb->CDBByte[5]);
-    dprintf_aspi(stddeb, "}\n");
+    dprintf_info(aspi, "{\n");
+    dprintf_info(aspi, "\tEVPD: %d\n", prb->CDBByte[1] & 1);
+    dprintf_info(aspi, "\tLUN: %d\n", (prb->CDBByte[1] & 0xc) >> 1);
+    dprintf_info(aspi, "\tPAGE CODE: %d\n", prb->CDBByte[2]);
+    dprintf_info(aspi, "\tALLOCATION LENGTH: %d\n", prb->CDBByte[4]);
+    dprintf_info(aspi, "\tCONTROL: %d\n", prb->CDBByte[5]);
+    dprintf_info(aspi, "}\n");
     break;
   case CMD_SCAN_SCAN:
-    dprintf_aspi(stddeb, "Transfer Length: %d\n", prb->CDBByte[4]);
+    dprintf_info(aspi, "Transfer Length: %d\n", prb->CDBByte[4]);
     break;
   }
 
-  dprintf_aspi(stddeb, "Host Adapter: %d\n", prb->SRB_HaId);
-  dprintf_aspi(stddeb, "Flags: %d\n", prb->SRB_Flags);
+  dprintf_info(aspi, "Host Adapter: %d\n", prb->SRB_HaId);
+  dprintf_info(aspi, "Flags: %d\n", prb->SRB_Flags);
   if (TARGET_TO_HOST(prb)) {
-    dprintf_aspi(stddeb, "\tData transfer: Target to host. Length checked.\n");
+    dprintf_info(aspi, "\tData transfer: Target to host. Length checked.\n");
   }
   else if (HOST_TO_TARGET(prb)) {
-    dprintf_aspi(stddeb, "\tData transfer: Host to target. Length checked.\n");
+    dprintf_info(aspi, "\tData transfer: Host to target. Length checked.\n");
   }
   else if (NO_DATA_TRANSFERED(prb)) {
-    dprintf_aspi(stddeb, "\tData transfer: none\n");
+    dprintf_info(aspi, "\tData transfer: none\n");
   }
   else {
-    dprintf_aspi(stddeb, "\tTransfer by scsi cmd. Length not checked\n");
+    dprintf_warn(aspi, "\tTransfer by scsi cmd. Length not checked\n");
   }
 
-  dprintf_aspi(stddeb, "\tResidual byte length reporting %s\n", prb->SRB_Flags & 0x4 ? "enabled" : "disabled");
-  dprintf_aspi(stddeb, "\tLinking %s\n", prb->SRB_Flags & 0x2 ? "enabled" : "disabled");
-  dprintf_aspi(stddeb, "\tPosting %s\n", prb->SRB_Flags & 0x1 ? "enabled" : "disabled");
-  dprintf_aspi(stddeb, "Target: %d\n", prb->SRB_Target);
-  dprintf_aspi(stddeb, "Lun: %d\n", prb->SRB_Lun);
-  dprintf_aspi(stddeb, "BufLen: %ld\n", prb->SRB_BufLen);
-  dprintf_aspi(stddeb, "SenseLen: %d\n", prb->SRB_SenseLen);
-  dprintf_aspi(stddeb, "BufPtr: %lx (%p)\n", prb->SRB_BufPointer, lpBuf);
-  dprintf_aspi(stddeb, "LinkPointer %lx\n", prb->SRB_Rsvd1);
-  dprintf_aspi(stddeb, "CDB Length: %d\n", prb->SRB_CDBLen);
-  dprintf_aspi(stddeb, "POST Proc: %lx\n", (DWORD) prb->SRB_PostProc);
+  dprintf_info(aspi, "\tResidual byte length reporting %s\n", prb->SRB_Flags & 0x4 ? "enabled" : "disabled");
+  dprintf_info(aspi, "\tLinking %s\n", prb->SRB_Flags & 0x2 ? "enabled" : "disabled");
+  dprintf_info(aspi, "\tPosting %s\n", prb->SRB_Flags & 0x1 ? "enabled" : "disabled");
+  dprintf_info(aspi, "Target: %d\n", prb->SRB_Target);
+  dprintf_info(aspi, "Lun: %d\n", prb->SRB_Lun);
+  dprintf_info(aspi, "BufLen: %ld\n", prb->SRB_BufLen);
+  dprintf_info(aspi, "SenseLen: %d\n", prb->SRB_SenseLen);
+  dprintf_info(aspi, "BufPtr: %lx (%p)\n", prb->SRB_BufPointer, lpBuf);
+  dprintf_info(aspi, "LinkPointer %lx\n", prb->SRB_Rsvd1);
+  dprintf_info(aspi, "CDB Length: %d\n", prb->SRB_CDBLen);
+  dprintf_info(aspi, "POST Proc: %lx\n", (DWORD) prb->SRB_PostProc);
   cdb = &prb->CDBByte[0];
-  dprintf_aspi(stddeb, "CDB buffer[");
   cmd = prb->CDBByte[0];
   for (i = 0; i < prb->SRB_CDBLen; i++) {
-    if (i != 0)
-      dprintf_aspi(stddeb, ",");
-    dprintf_aspi(stddeb, "%02x", *cdb++);
+    if (i != 0) dsprintf(aspi, ",");
+    dsprintf(aspi, "%02x", *cdb++);
   }
-  dprintf_aspi(stddeb, "]\n");
+  dprintf_info(aspi, "CDB buffer[%s]\n", dbg_str(aspi));
 }
 
 static void
@@ -216,15 +215,14 @@
 {
   int	i;
   BYTE *cdb;
+  dbg_decl_str(aspi, 512);
 
   cdb = &prb->CDBByte[0];
-  dprintf_aspi(stddeb, "SenseArea[");
   for (i = 0; i < prb->SRB_SenseLen; i++) {
-    if (i)
-      dprintf_aspi(stddeb, ",");
-    dprintf_aspi(stddeb, "%02x", *cdb++);
+    if (i) dsprintf(aspi, ",");
+    dsprintf(aspi, "%02x", *cdb++);
   }
-  dprintf_aspi(stddeb, "]\n");
+  dprintf_info(aspi, "SenseArea[%s]\n", dbg_str(aspi));
 }
 
 static void
@@ -236,7 +234,7 @@
 
   switch (prb->CDBByte[0]) {
   case CMD_INQUIRY:
-    dprintf_aspi(stddeb, "Vendor: %s\n", lpBuf + INQUIRY_VENDOR);
+    dprintf_info(aspi, "Vendor: %s\n", lpBuf + INQUIRY_VENDOR);
     break;
   case CMD_TEST_UNIT_READY:
     PrintSenseArea16(prb);
@@ -314,20 +312,20 @@
 	if (myerror == ENOMEM) {
 	    fprintf(stderr, "ASPI: Linux generic scsi driver\n  You probably need to re-compile your kernel with a larger SG_BIG_BUFF value (sg.h)\n  Suggest 130560\n");
 	}
-	dprintf_aspi(stddeb, "errno: = %d\n", myerror);
+	dprintf_warn(aspi, "errno: = %d\n", myerror);
     }
     goto error_exit;
   }
 
   status = read(fd, sg_reply_hdr, out_len);
   if (status < 0 || status != out_len) {
-    dprintf_aspi(stddeb, "not enough bytes read from scsi device%d\n", status);
+    dprintf_warn(aspi, "not enough bytes read from scsi device%d\n", status);
     goto error_exit;
   }
 
   if (sg_reply_hdr->result != 0) {
     error_code = sg_reply_hdr->result;
-    dprintf_aspi(stddeb, "reply header error (%d)\n", sg_reply_hdr->result);
+    dprintf_warn(aspi, "reply header error (%d)\n", sg_reply_hdr->result);
     goto error_exit;
   }
 
@@ -351,7 +349,7 @@
   /* now do  posting */
 
   if (ASPI_POSTING(prb) && prb->SRB_PostProc) {
-    dprintf_aspi(stddeb, "ASPI: Post Routine (%lx) called\n", (DWORD) prb->SRB_PostProc);
+    dprintf_info(aspi, "ASPI: Post Routine (%lx) called\n", (DWORD) prb->SRB_PostProc);
     Callbacks->CallASPIPostProc(prb->SRB_PostProc, segptr_prb);
   }
 
@@ -363,17 +361,17 @@
 error_exit:
   if (error_code == EBUSY) {
       prb->SRB_Status = SS_ASPI_IS_BUSY;
-      dprintf_aspi(stddeb, "ASPI: Device busy\n");
+      dprintf_info(aspi, "ASPI: Device busy\n");
   }
   else {
-      dprintf_aspi(stddeb, "ASPI_GenericHandleScsiCmd failed\n");
+      dprintf_warn(aspi, "ASPI_GenericHandleScsiCmd failed\n");
       prb->SRB_Status = SS_ERR;
   }
 
   /* I'm not sure exactly error codes work here
    * We probably should set prb->SRB_TargStat, SRB_HaStat ?
    */
-  dprintf_aspi(stddeb, "ASPI_GenericHandleScsiCmd: error_exit\n");
+  dprintf_warn(aspi, "ASPI_GenericHandleScsiCmd: error_exit\n");
   free(sg_reply_hdr);
   free(sg_hd);
   return prb->SRB_Status;
@@ -387,7 +385,7 @@
 WORD WINAPI GetASPISupportInfo16()
 {
 #ifdef linux
-    dprintf_aspi(stddeb, "GETASPISupportInfo\n");
+    dprintf_info(aspi, "GETASPISupportInfo\n");
     /* high byte SS_COMP - low byte number of host adapters.
      * FIXME!!! The number of host adapters is incorrect.
      * I'm not sure how to determine this under linux etc.
@@ -409,19 +407,19 @@
 
   switch (lpSRB->common.SRB_cmd) {
   case SC_HA_INQUIRY:
-    dprintf_aspi(stddeb, "ASPI: Not implemented SC_HA_INQUIRY\n");
+    dprintf_fixme(aspi, "ASPI: Not implemented SC_HA_INQUIRY\n");
     break;
   case SC_GET_DEV_TYPE:
-    dprintf_aspi(stddeb, "ASPI: Not implemented SC_GET_DEV_TYPE\n");
+    dprintf_fixme(aspi, "ASPI: Not implemented SC_GET_DEV_TYPE\n");
     break;
   case SC_EXEC_SCSI_CMD:
     return ASPI_ExecScsiCmd16(&lpSRB->cmd, segptr_srb);
     break;
   case SC_RESET_DEV:
-    dprintf_aspi(stddeb, "ASPI: Not implemented SC_RESET_DEV\n");
+    dprintf_fixme(aspi, "ASPI: Not implemented SC_RESET_DEV\n");
     break;
   default:
-    dprintf_aspi(stddeb, "ASPI: Unknown command %d\n", lpSRB->common.SRB_cmd);
+    dprintf_warn(aspi, "ASPI: Unknown command %d\n", lpSRB->common.SRB_cmd);
   }
   return SS_INVALID_SRB;
 #else
diff --git a/misc/comm.c b/misc/comm.c
index 73681d9..d418994 100644
--- a/misc/comm.c
+++ b/misc/comm.c
@@ -34,7 +34,6 @@
 #include "comm.h"
 #include "heap.h"
 #include "options.h"
-#include "stddebug.h"
 #include "debug.h"
 
 #ifndef TIOCINQ
@@ -84,7 +83,7 @@
 					COM[x].fd = 0;
 					strcpy(COM[x].devicename, temp);
 				}
-                dprintf_comm(stddeb,
+                dprintf_info(comm,
                         "Comm_Init: %s = %s\n", option, COM[x].devicename);
  		}
 
@@ -107,7 +106,7 @@
 					LPT[x].fd = 0;
 					strcpy(LPT[x].devicename, temp);
 				}
-                dprintf_comm(stddeb,
+                dprintf_info(comm,
                         "Comm_Init: %s = %s\n", option, LPT[x].devicename);
 		}
 
@@ -153,7 +152,7 @@
 
 int WinError(void)
 {
-        dprintf_comm(stddeb, "WinError: errno = %d\n", errno);
+        dprintf_info(comm, "WinError: errno = %d\n", errno);
 	switch (errno) {
 		default:
 			return CE_IOE;
@@ -170,7 +169,7 @@
 	int port;
 	char *ptr, temp[256];
 
-	dprintf_comm(stddeb,
+	dprintf_info(comm,
 		"BuildCommDCB: (%s), ptr %p\n", device, lpdcb);
 	commerror = 0;
 
@@ -208,13 +207,13 @@
 			lpdcb->BaudRate = COM[port].baudrate;
 		else
 			lpdcb->BaudRate = atoi(ptr);
-        	dprintf_comm(stddeb,"BuildCommDCB: baudrate (%d)\n", lpdcb->BaudRate);
+        	dprintf_info(comm,"BuildCommDCB: baudrate (%d)\n", lpdcb->BaudRate);
 
 		ptr = strtok(NULL, ", ");
 		if (islower(*ptr))
 			*ptr = toupper(*ptr);
 
-        	dprintf_comm(stddeb,"BuildCommDCB: parity (%c)\n", *ptr);
+        	dprintf_info(comm,"BuildCommDCB: parity (%c)\n", *ptr);
 		lpdcb->fParity = 1;
 		switch (*ptr) {
 			case 'N':
@@ -236,11 +235,11 @@
 		}
 
 		ptr = strtok(NULL, ", "); 
-         	dprintf_comm(stddeb, "BuildCommDCB: charsize (%c)\n", *ptr);
+         	dprintf_info(comm, "BuildCommDCB: charsize (%c)\n", *ptr);
 		lpdcb->ByteSize = *ptr - '0';
 
 		ptr = strtok(NULL, ", ");
-        	dprintf_comm(stddeb, "BuildCommDCB: stopbits (%c)\n", *ptr);
+        	dprintf_info(comm, "BuildCommDCB: stopbits (%c)\n", *ptr);
 		switch (*ptr) {
 			case '1':
 				lpdcb->StopBits = ONESTOPBIT;
@@ -274,7 +273,7 @@
 	int	port;
 	char	*ptr,*temp;
 
-	dprintf_comm(stddeb,"BuildCommDCBAndTimeouts32A(%s,%p,%p)\n",device,lpdcb,lptimeouts);
+	dprintf_info(comm,"BuildCommDCBAndTimeouts32A(%s,%p,%p)\n",device,lpdcb,lptimeouts);
 	commerror = 0;
 
 	if (!lstrncmpi32A(device,"COM",3)) {
@@ -401,7 +400,7 @@
 	LPSTR	devidA;
 	BOOL32	ret;
 
-	dprintf_comm(stddeb,"BuildCommDCBAndTimeouts32W(%p,%p,%p)\n",devid,lpdcb,lptimeouts);
+	dprintf_info(comm,"BuildCommDCBAndTimeouts32W(%p,%p,%p)\n",devid,lpdcb,lptimeouts);
 	devidA = HEAP_strdupWtoA( GetProcessHeap(), 0, devid );
 	ret=BuildCommDCBAndTimeouts32A(devidA,lpdcb,lptimeouts);
         HeapFree( GetProcessHeap(), 0, devidA );
@@ -423,7 +422,7 @@
 {
 	int port,fd;
 
-    	dprintf_comm(stddeb,
+    	dprintf_info(comm,
 		"OpenComm: %s, %d, %d\n", device, cbInQueue, cbOutQueue);
 	commerror = 0;
 
@@ -435,7 +434,7 @@
 			commerror = IE_BADID;
 		}
 
-                dprintf_comm(stddeb,
+                dprintf_info(comm,
                        "OpenComm: %s = %s\n", device, COM[port].devicename);
 
 		if (!ValidCOMPort(port)) {
@@ -488,7 +487,7 @@
 INT16 WINAPI CloseComm(INT16 fd)
 {
         int port;
-    	dprintf_comm(stddeb,"CloseComm: fd %d\n", fd);
+    	dprintf_info(comm,"CloseComm: fd %d\n", fd);
        	if ((port = GetCommPort(fd)) !=-1) {  /* [LW]       */
     	        SEGPTR_FREE(unknown[port]); 
     	        COM[port].fd = 0;       /*  my adaptation of RER's fix   */  
@@ -513,7 +512,7 @@
 {
 	struct DosDeviceStruct *ptr;
 
-	dprintf_comm(stddeb,"SetCommBreak: fd: %d\n", fd);
+	dprintf_info(comm,"SetCommBreak: fd: %d\n", fd);
 	if ((ptr = GetDeviceStruct(fd)) == NULL) {
 		commerror = IE_BADID;
 		return -1;
@@ -532,7 +531,7 @@
 
 	struct DosDeviceStruct *ptr;
 
-	dprintf_comm(stddeb,"SetCommBreak: fd: %d\n", fd);
+	dprintf_info(comm,"SetCommBreak: fd: %d\n", fd);
 	if ((ptr = GetDeviceStruct(fd)) == NULL) {
 		commerror = IE_BADID;
 		return FALSE;
@@ -550,7 +549,7 @@
 {
 	struct DosDeviceStruct *ptr;
 
-    	dprintf_comm(stddeb,"ClearCommBreak: fd: %d\n", fd);
+    	dprintf_info(comm,"ClearCommBreak: fd: %d\n", fd);
 	if ((ptr = GetDeviceStruct(fd)) == NULL) {
 		commerror = IE_BADID;
 		return -1;
@@ -568,7 +567,7 @@
 {
 	struct DosDeviceStruct *ptr;
 
-    	dprintf_comm(stddeb,"ClearCommBreak: fd: %d\n", fd);
+    	dprintf_info(comm,"ClearCommBreak: fd: %d\n", fd);
 	if ((ptr = GetDeviceStruct(fd)) == NULL) {
 		commerror = IE_BADID;
 		return FALSE;
@@ -587,7 +586,7 @@
 	int	max;
 	struct termios port;
 
-    	dprintf_comm(stddeb,"EscapeCommFunction fd: %d, function: %d\n", fd, nFunction);
+    	dprintf_info(comm,"EscapeCommFunction fd: %d, function: %d\n", fd, nFunction);
 	if (tcgetattr(fd,&port) == -1) {
 		commerror=WinError();	
 		return -1;
@@ -663,7 +662,7 @@
 	struct termios	port;
 	struct DosDeviceStruct *ptr;
 
-    	dprintf_comm(stddeb,"EscapeCommFunction fd: %d, function: %d\n", fd, nFunction);
+    	dprintf_info(comm,"EscapeCommFunction fd: %d, function: %d\n", fd, nFunction);
 	if (tcgetattr(fd,&port) == -1) {
 		commerror=WinError();	
 		return FALSE;
@@ -735,7 +734,7 @@
 {
 	int queue;
 
-    	dprintf_comm(stddeb,"FlushComm fd: %d, queue: %d\n", fd, fnQueue);
+    	dprintf_info(comm,"FlushComm fd: %d, queue: %d\n", fd, fnQueue);
 	switch (fnQueue) {
 		case 0:	queue = TCOFLUSH;
 			break;
@@ -760,7 +759,7 @@
  */
 BOOL32 WINAPI PurgeComm( HANDLE32 hFile, DWORD flags) 
 {
-    dprintf_comm(stdnimp, "PurgeComm(%08x %08lx) unimplemented stub\n",
+    dprintf_fixme(comm, "PurgeComm(%08x %08lx) unimplemented stub\n",
                  hFile, flags);
     return 0;
 }
@@ -785,15 +784,15 @@
                 if (rc) fprintf(stderr, "Error !\n");
 		lpStat->cbInQue = cnt;
 
-    		dprintf_comm(stddeb,
-			"GetCommError: fd %d, error %d, lpStat %d %d %d\n",
-			fd, commerror,
-			lpStat->status, lpStat->cbInQue, lpStat->cbOutQue);
+    		dprintf_info(comm,
+		       "GetCommError: fd %d, error %d, lpStat %d %d %d\n",
+		       fd, commerror, lpStat->status, lpStat->cbInQue, 
+		       lpStat->cbOutQue);
 	}
 	else
-		dprintf_comm(stddeb,
-                "GetCommError: fd %d, error %d, lpStat NULL\n",
-                fd, commerror);
+		dprintf_info(comm,
+		       "GetCommError: fd %d, error %d, lpStat NULL\n",
+		       fd, commerror);
 
 	/*
 	 * [RER] I have no idea what the following is trying to accomplish.
@@ -811,8 +810,8 @@
 {
 	int temperror;
 
-    	dprintf_comm(stddeb,
-		"ClearCommError: fd %d (current error %d)\n", fd, commerror);
+    	dprintf_info(comm, "ClearCommError: fd %d (current error %d)\n", 
+	       fd, commerror);
 	temperror = commerror;
 	commerror = 0;
 	return TRUE;
@@ -827,19 +826,18 @@
         int act;
         int repid;
         unsigned int mstat;
-    	dprintf_comm(stddeb,"SetCommEventMask:fd %d,mask %d\n",fd,fuEvtMask);
+    	dprintf_info(comm,"SetCommEventMask:fd %d,mask %d\n",fd,fuEvtMask);
 	eventmask |= fuEvtMask;
         if ((act = GetCommPort(fd)) == -1) {
-            dprintf_comm(stddeb," fd %d not comm port\n",act);
+            dprintf_warn(comm," fd %d not comm port\n",act);
             return NULL;}
         stol =  unknown[act];
         stol += msr;    
 	repid = ioctl(fd,TIOCMGET,&mstat);
-	dprintf_comm(stddeb,
-	" ioctl  %d, msr %x at %p %p\n",repid,mstat,stol,unknown[act]);
+	dprintf_info(comm, " ioctl  %d, msr %x at %p %p\n",repid,mstat,stol,unknown[act]);
 	if ((mstat&TIOCM_CAR)) {*stol |= 0x80;}
 	     else {*stol &=0x7f;}
-	dprintf_comm(stddeb," modem dcd construct %x\n",*stol);
+	dprintf_info(comm," modem dcd construct %x\n",*stol);
 	return SEGPTR_GET(unknown[act]);	
 }
 
@@ -850,7 +848,7 @@
 {
 	int	events = 0;
 
-    	dprintf_comm(stddeb,
+    	dprintf_info(comm,
 		"GetCommEventMask: fd %d, mask %d\n", fd, fnEvtClear);
 
 	/*
@@ -864,7 +862,7 @@
 		rc = ioctl(fd, TIOCINQ, &cnt);
 		if (cnt) events |= EV_RXCHAR;
 
-		dprintf_comm(stddeb,
+		dprintf_info(comm,
 			"GetCommEventMask: rxchar %ld\n", cnt);
 	}
 
@@ -873,7 +871,7 @@
 	 */
 	/* TODO */
 
-	dprintf_comm(stddeb,
+	dprintf_info(comm,
 		"GetCommEventMask: return events %d\n", events);
 	return events;
 
@@ -892,7 +890,7 @@
  */
 BOOL32 WINAPI SetupComm( HANDLE32 hFile, DWORD insize, DWORD outsize)
 {
-        dprintf_comm(stdnimp, "SetupComm: insize %ld outsize %ld unimplemented stub\n", insize, outsize);
+        dprintf_fixme(comm, "SetupComm: insize %ld outsize %ld unimplemented stub\n", insize, outsize);
        return FALSE;
 } 
 
@@ -901,7 +899,7 @@
  */
 BOOL32 WINAPI GetCommMask(INT32 fd,LPDWORD evtmask)
 {
-    	dprintf_comm(stddeb,
+    	dprintf_info(comm,
 		"GetCommMask: fd %d, mask %p\n", fd, evtmask);
 	*evtmask = eventmask;
 	return TRUE;
@@ -912,7 +910,7 @@
  */
 BOOL32 WINAPI SetCommMask(INT32 fd,DWORD evtmask)
 {
-    	dprintf_comm(stddeb,
+    	dprintf_info(comm,
 		"SetCommMask: fd %d, mask %lx\n", fd, evtmask);
 	eventmask = evtmask;
 	return TRUE;
@@ -926,7 +924,7 @@
 	struct termios port;
 	struct DosDeviceStruct *ptr;
 
-    	dprintf_comm(stddeb,
+    	dprintf_info(comm,
 		"SetCommState16: fd %d, ptr %p\n", lpdcb->Id, lpdcb);
 	if (tcgetattr(lpdcb->Id, &port) == -1) {
 		commerror = WinError();	
@@ -957,7 +955,7 @@
 	}
 	if (ptr->baudrate > 0)
 	  	lpdcb->BaudRate = ptr->baudrate;
-    	dprintf_comm(stddeb,"SetCommState: baudrate %d\n",lpdcb->BaudRate);
+    	dprintf_info(comm,"SetCommState: baudrate %d\n",lpdcb->BaudRate);
 #ifdef CBAUD
 	port.c_cflag &= ~CBAUD;
 	switch (lpdcb->BaudRate) {
@@ -1051,7 +1049,7 @@
         }
         port.c_ispeed = port.c_ospeed;
 #endif
-    	dprintf_comm(stddeb,"SetCommState: bytesize %d\n",lpdcb->ByteSize);
+    	dprintf_info(comm,"SetCommState: bytesize %d\n",lpdcb->ByteSize);
 	port.c_cflag &= ~CSIZE;
 	switch (lpdcb->ByteSize) {
 		case 5:
@@ -1071,7 +1069,7 @@
 			return -1;
 	}
 
-    	dprintf_comm(stddeb,"SetCommState: parity %d\n",lpdcb->Parity);
+    	dprintf_info(comm,"SetCommState: parity %d\n",lpdcb->Parity);
 	port.c_cflag &= ~(PARENB | PARODD);
 	if (lpdcb->fParity)
 		switch (lpdcb->Parity) {
@@ -1092,7 +1090,7 @@
 		}
 	
 
-    	dprintf_comm(stddeb,"SetCommState: stopbits %d\n",lpdcb->StopBits);
+    	dprintf_info(comm,"SetCommState: stopbits %d\n",lpdcb->StopBits);
 
 	switch (lpdcb->StopBits) {
 		case ONESTOPBIT:
@@ -1139,7 +1137,7 @@
 	struct termios port;
 	struct DosDeviceStruct *ptr;
 
-    	dprintf_comm(stddeb,"SetCommState32: fd %d, ptr %p\n",fd,lpdcb);
+    	dprintf_info(comm,"SetCommState32: fd %d, ptr %p\n",fd,lpdcb);
 	if (tcgetattr(fd,&port) == -1) {
 		commerror = WinError();	
 		return FALSE;
@@ -1169,7 +1167,7 @@
 	}
 	if (ptr->baudrate > 0)
 	  	lpdcb->BaudRate = ptr->baudrate;
-    	dprintf_comm(stddeb,"SetCommState: baudrate %ld\n",lpdcb->BaudRate);
+    	dprintf_info(comm,"SetCommState: baudrate %ld\n",lpdcb->BaudRate);
 #ifdef CBAUD
 	port.c_cflag &= ~CBAUD;
 	switch (lpdcb->BaudRate) {
@@ -1257,7 +1255,7 @@
         }
         port.c_ispeed = port.c_ospeed;
 #endif
-    	dprintf_comm(stddeb,"SetCommState: bytesize %d\n",lpdcb->ByteSize);
+    	dprintf_info(comm,"SetCommState: bytesize %d\n",lpdcb->ByteSize);
 	port.c_cflag &= ~CSIZE;
 	switch (lpdcb->ByteSize) {
 		case 5:
@@ -1277,7 +1275,7 @@
 			return FALSE;
 	}
 
-    	dprintf_comm(stddeb,"SetCommState: parity %d\n",lpdcb->Parity);
+    	dprintf_info(comm,"SetCommState: parity %d\n",lpdcb->Parity);
 	port.c_cflag &= ~(PARENB | PARODD);
 	if (lpdcb->fParity)
 		switch (lpdcb->Parity) {
@@ -1298,7 +1296,7 @@
 		}
 	
 
-    	dprintf_comm(stddeb,"SetCommState: stopbits %d\n",lpdcb->StopBits);
+    	dprintf_info(comm,"SetCommState: stopbits %d\n",lpdcb->StopBits);
 	switch (lpdcb->StopBits) {
 		case ONESTOPBIT:
 				port.c_cflag &= ~CSTOPB;
@@ -1346,7 +1344,7 @@
 {
 	struct termios port;
 
-    	dprintf_comm(stddeb,"GetCommState16: fd %d, ptr %p\n", fd, lpdcb);
+    	dprintf_info(comm,"GetCommState16: fd %d, ptr %p\n", fd, lpdcb);
 	if (tcgetattr(fd, &port) == -1) {
 		commerror = WinError();	
 		return -1;
@@ -1471,7 +1469,7 @@
 {
 	struct termios	port;
 
-    	dprintf_comm(stddeb,"GetCommState32: fd %d, ptr %p\n", fd, lpdcb);
+    	dprintf_info(comm,"GetCommState32: fd %d, ptr %p\n", fd, lpdcb);
         if (GetDeviceStruct(fd) == NULL) return FALSE;
 	if (tcgetattr(fd, &port) == -1) {
 		commerror = WinError();	
@@ -1587,7 +1585,7 @@
 {
 	struct DosDeviceStruct *ptr;
 
-    	dprintf_comm(stddeb,
+    	dprintf_info(comm,
 		"TransmitCommChar: fd %d, data %d \n", fd, chTransmit);
 	if ((ptr = GetDeviceStruct(fd)) == NULL) {
 		commerror = IE_BADID;
@@ -1615,7 +1613,7 @@
 {
 	struct DosDeviceStruct *ptr;
 
-    	dprintf_comm(stddeb,"TransmitCommChar32(%d,'%c')\n",fd,chTransmit);
+    	dprintf_info(comm,"TransmitCommChar32(%d,'%c')\n",fd,chTransmit);
 	if ((ptr = GetDeviceStruct(fd)) == NULL) {
 		commerror = IE_BADID;
 		return FALSE;
@@ -1641,7 +1639,7 @@
 {
 	struct DosDeviceStruct *ptr;
 
-    	dprintf_comm(stddeb,"UngetCommChar: fd %d (char %d)\n", fd, chUnget);
+    	dprintf_info(comm,"UngetCommChar: fd %d (char %d)\n", fd, chUnget);
 	if ((ptr = GetDeviceStruct(fd)) == NULL) {
 		commerror = IE_BADID;
 		return -1;
@@ -1663,10 +1661,10 @@
  */
 INT16 WINAPI ReadComm(INT16 fd,LPSTR lpvBuf,INT16 cbRead)
 {
-	int status, x, length;
+	int status, length;
 	struct DosDeviceStruct *ptr;
 
-    	dprintf_comm(stddeb,
+    	dprintf_info(comm,
 	    "ReadComm: fd %d, ptr %p, length %d\n", fd, lpvBuf, cbRead);
 	if ((ptr = GetDeviceStruct(fd)) == NULL) {
 		commerror = IE_BADID;
@@ -1698,9 +1696,7 @@
                         return length;
                 }
  	} else {
-                for (x=0; x < length+status; x++)  	
- 	        dprintf_comm(stddeb,"%c",*(lpvBuf+x));
- 	        dprintf_comm(stddeb,"\nthus  endeth\n");
+	        dprintf_info(comm,"%*s\n", length+status, lpvBuf);
 		commerror = 0;
 		return length + status;
 	}
@@ -1711,10 +1707,10 @@
  */
 INT16 WINAPI WriteComm(INT16 fd, LPSTR lpvBuf, INT16 cbWrite)
 {
-	int x, length;
+	int length;
 	struct DosDeviceStruct *ptr;
 
-    	dprintf_comm(stddeb,"WriteComm: fd %d, ptr %p, length %d\n", 
+    	dprintf_info(comm,"WriteComm: fd %d, ptr %p, length %d\n", 
 		fd, lpvBuf, cbWrite);
 	if ((ptr = GetDeviceStruct(fd)) == NULL) {
 		commerror = IE_BADID;
@@ -1726,9 +1722,7 @@
 		return -1;
 	}	
 	
-	for (x=0; x != cbWrite ; x++)
-        dprintf_comm(stddeb,"%c", *(lpvBuf + x) );
-        dprintf_comm(stddeb,"\n");
+	dprintf_info(comm,"%*s\n", cbWrite, lpvBuf );
 	length = write(fd, (void *) lpvBuf, cbWrite);
 	
 	if (length == -1) {
diff --git a/misc/commdlg.c b/misc/commdlg.c
index f81c7b1..c0f2a12 100644
--- a/misc/commdlg.c
+++ b/misc/commdlg.c
@@ -17,7 +17,6 @@
 #include "module.h"
 #include "resource.h"
 #include "drive.h"
-#include "stddebug.h"
 #include "debug.h"
 
 static	DWORD 		CommDlgLastError = 0;
@@ -138,7 +137,7 @@
 		    FreeResource16( hDlgTmpl );
     }
 
-    dprintf_commdlg(stddeb,"GetOpenFileName // return lpstrFile='%s' !\n", 
+    dprintf_info(commdlg,"GetOpenFileName // return lpstrFile='%s' !\n", 
            (LPSTR)PTR_SEG_TO_LIN(lpofn->lpstrFile));
     return bRet;
 }
@@ -232,7 +231,7 @@
 		    FreeResource16( hDlgTmpl );
     }
 
-    dprintf_commdlg(stddeb, "GetSaveFileName // return lpstrFile='%s' !\n", 
+    dprintf_info(commdlg, "GetSaveFileName // return lpstrFile='%s' !\n", 
             (LPSTR)PTR_SEG_TO_LIN(lpofn->lpstrFile));
     return bRet;
 }
@@ -475,7 +474,7 @@
   int i, n;
   LPOPENFILENAME16 lpofn;
   char tmpstr[512];
-  LPSTR pstr;
+  LPSTR pstr, old_pstr;
   SetWindowLong32A(hWnd, DWL_USER, lParam);
   lpofn = (LPOPENFILENAME16)PTR_SEG_TO_LIN(lParam);
   if (lpofn->lpstrTitle) SetWindowText16( hWnd, lpofn->lpstrTitle );
@@ -484,15 +483,16 @@
     {
       pstr = (LPSTR)PTR_SEG_TO_LIN(lpofn->lpstrCustomFilter);
       n = 0;
-      dprintf_commdlg(stddeb,"lpstrCustomFilter = %p\n", pstr);
+      dprintf_info(commdlg,"lpstrCustomFilter = %p\n", pstr);
       while(*pstr)
 	{
-	  dprintf_commdlg(stddeb,"lpstrCustomFilter // add str='%s' ",pstr);
+	  old_pstr = pstr;
           i = SendDlgItemMessage16(hWnd, cmb1, CB_ADDSTRING16, 0,
                                    (LPARAM)lpofn->lpstrCustomFilter + n );
           n += strlen(pstr) + 1;
 	  pstr += strlen(pstr) + 1;
-	  dprintf_commdlg(stddeb,"associated to '%s'\n", pstr);
+	  dprintf_info(commdlg,"lpstrCustomFilter // add str='%s' "
+			  "associated to '%s'\n", old_pstr, pstr);
           SendDlgItemMessage16(hWnd, cmb1, CB_SETITEMDATA16, i, (LPARAM)pstr);
           n += strlen(pstr) + 1;
 	  pstr += strlen(pstr) + 1;
@@ -503,12 +503,13 @@
 	pstr = (LPSTR)PTR_SEG_TO_LIN(lpofn->lpstrFilter);
 	n = 0;
 	while(*pstr) {
-	  dprintf_commdlg(stddeb,"lpstrFilter // add str='%s' ", pstr);
+	  old_pstr = pstr;
 	  i = SendDlgItemMessage16(hWnd, cmb1, CB_ADDSTRING16, 0,
 				       (LPARAM)lpofn->lpstrFilter + n );
 	  n += strlen(pstr) + 1;
 	  pstr += strlen(pstr) + 1;
-	  dprintf_commdlg(stddeb,"associated to '%s'\n", pstr);
+	  dprintf_info(commdlg,"lpstrFilter // add str='%s' "
+			  "associated to '%s'\n", old_pstr, pstr);
 	  SendDlgItemMessage16(hWnd, cmb1, CB_SETITEMDATA16, i, (LPARAM)pstr);
 	  n += strlen(pstr) + 1;
 	  pstr += strlen(pstr) + 1;
@@ -521,7 +522,7 @@
   strncpy(tmpstr, FILEDLG_GetFileType(PTR_SEG_TO_LIN(lpofn->lpstrCustomFilter),
 	     PTR_SEG_TO_LIN(lpofn->lpstrFilter), lpofn->nFilterIndex - 1),511);
   tmpstr[511]=0;
-  dprintf_commdlg(stddeb,"nFilterIndex = %ld // SetText of edt1 to '%s'\n", 
+  dprintf_info(commdlg,"nFilterIndex = %ld // SetText of edt1 to '%s'\n", 
   			lpofn->nFilterIndex, tmpstr);
   SetDlgItemText32A( hWnd, edt1, tmpstr );
   /* get drive list */
@@ -636,7 +637,7 @@
       if (lRet == LB_ERR)
 	return TRUE;
       pstr = (LPSTR)SendDlgItemMessage16(hWnd, cmb1, CB_GETITEMDATA16, lRet, 0);
-      dprintf_commdlg(stddeb,"Selected filter : %s\n", pstr);
+      dprintf_info(commdlg,"Selected filter : %s\n", pstr);
       SetDlgItemText32A( hWnd, edt1, pstr );
       FILEDLG_ScanDir(hWnd, tmpstr);
       return TRUE;
@@ -664,7 +665,7 @@
 	      strcpy(tmpstr2, tmpstr);
 	      *tmpstr=0;
 	    }
-	  dprintf_commdlg(stddeb,"commdlg: %s, %s\n", tmpstr, tmpstr2);
+	  dprintf_info(commdlg,"commdlg: %s, %s\n", tmpstr, tmpstr2);
           SetDlgItemText32A( hWnd, edt1, tmpstr2 );
 	  FILEDLG_ScanDir(hWnd, tmpstr);
 	  return TRUE;
@@ -677,7 +678,7 @@
       lRet = SendDlgItemMessage16(hWnd, cmb1, CB_GETCURSEL16, 0, 0);
       if (lRet == LB_ERR) return TRUE;
       lpofn->nFilterIndex = lRet + 1;
-      dprintf_commdlg(stddeb,"commdlg: lpofn->nFilterIndex=%ld\n", lpofn->nFilterIndex);
+      dprintf_info(commdlg,"commdlg: lpofn->nFilterIndex=%ld\n", lpofn->nFilterIndex);
       lstrcpyn32A(tmpstr2, 
 	     FILEDLG_GetFileType(PTR_SEG_TO_LIN(lpofn->lpstrCustomFilter),
 				 PTR_SEG_TO_LIN(lpofn->lpstrFilter),
@@ -1127,7 +1128,7 @@
     HWND32 hwndDialog;
     LPPRINTDLG16 lpPrint = (LPPRINTDLG16)PTR_SEG_TO_LIN(printdlg);
 
-    dprintf_commdlg(stddeb,"PrintDlg(%p) // Flags=%08lX\n", lpPrint, lpPrint->Flags );
+    dprintf_info(commdlg,"PrintDlg(%p) // Flags=%08lX\n", lpPrint, lpPrint->Flags );
 
     if (lpPrint->Flags & PD_RETURNDEFAULT)
         /* FIXME: should fill lpPrint->hDevMode and lpPrint->hDevNames here */
@@ -1179,7 +1180,7 @@
   switch (wMsg)
     {
     case WM_INITDIALOG:
-      dprintf_commdlg(stddeb,"PrintDlgProc // WM_INITDIALOG lParam=%08lX\n", lParam);
+      dprintf_info(commdlg,"PrintDlgProc // WM_INITDIALOG lParam=%08lX\n", lParam);
       ShowWindow16(hWnd, SW_SHOWNORMAL);
       return (TRUE);
     case WM_COMMAND:
@@ -1207,7 +1208,7 @@
   switch (wMsg)
     {
     case WM_INITDIALOG:
-      dprintf_commdlg(stddeb,"PrintSetupDlgProc // WM_INITDIALOG lParam=%08lX\n", lParam);
+      dprintf_info(commdlg,"PrintSetupDlgProc // WM_INITDIALOG lParam=%08lX\n", lParam);
       ShowWindow16(hWnd, SW_SHOWNORMAL);
       return (TRUE);
     case WM_COMMAND:
@@ -1239,7 +1240,7 @@
 short WINAPI GetFileTitle32A(LPCSTR lpFile, LPSTR lpTitle, UINT32 cbBuf)
 {
     int i, len;
-    dprintf_commdlg(stddeb,"GetFileTitle(%p %p %d); \n", lpFile, lpTitle, cbBuf);
+    dprintf_info(commdlg,"GetFileTitle(%p %p %d); \n", lpFile, lpTitle, cbBuf);
     if (lpFile == NULL || lpTitle == NULL)
     	return -1;
     len = strlen(lpFile);
@@ -1256,7 +1257,7 @@
 	i++;
 	break;
     }
-    dprintf_commdlg(stddeb,"\n---> '%s' ", &lpFile[i]);
+    dprintf_info(commdlg,"---> '%s' \n", &lpFile[i]);
     
     len = strlen(lpFile+i)+1;
     if (cbBuf < len)
@@ -1305,7 +1306,7 @@
     LPCVOID template;
     HWND32 hwndDialog;
 
-    dprintf_commdlg(stddeb,"ChooseColor\n");
+    dprintf_info(commdlg,"ChooseColor\n");
     if (!lpChCol) return FALSE;    
 
     if (lpChCol->Flags & CC_ENABLETEMPLATEHANDLE)
@@ -2069,7 +2070,7 @@
    POINT16 point;
    struct CCPRIVATE * lpp; 
    
-   dprintf_commdlg(stddeb,"ColorDlgProc // WM_INITDIALOG lParam=%08lX\n", lParam);
+   dprintf_info(commdlg,"ColorDlgProc // WM_INITDIALOG lParam=%08lX\n", lParam);
    lpp=calloc(1,sizeof(struct CCPRIVATE));
    lpp->lpcc=(LPCHOOSECOLOR)lParam;
    if (lpp->lpcc->lStructSize != sizeof(CHOOSECOLOR))
@@ -2138,7 +2139,7 @@
     HDC32 hdc;
     COLORREF *cr;
     struct CCPRIVATE * lpp=(struct CCPRIVATE *)GetWindowLong32A(hDlg, DWL_USER); 
-    dprintf_commdlg(stddeb,"CC_WMCommand wParam=%x lParam=%lx\n",wParam,lParam);
+    dprintf_info(commdlg,"CC_WMCommand wParam=%x lParam=%lx\n",wParam,lParam);
     switch (wParam)
     {
           case 0x2c2:  /* edit notify RGB */
@@ -2400,7 +2401,7 @@
     LPCVOID template;
     HWND32 hwndDialog;
 
-    dprintf_commdlg(stddeb,"ChooseFont\n");
+    dprintf_info(commdlg,"ChooseFont\n");
     if (!lpChFont) return FALSE;    
 
     if (lpChFont->Flags & CF_ENABLETEMPLATEHANDLE)
@@ -2482,7 +2483,7 @@
   LPCHOOSEFONT lpcf=(LPCHOOSEFONT)GetWindowLong32A(hDlg, DWL_USER); 
   LOGFONT16 *lplf = (LOGFONT16 *)PTR_SEG_TO_LIN( logfont );
 
-  dprintf_commdlg(stddeb,"FontFamilyEnumProc: font=%s (nFontType=%d)\n",
+  dprintf_info(commdlg,"FontFamilyEnumProc: font=%s (nFontType=%d)\n",
      			lplf->lfFaceName,nFontType);
 
   if (lpcf->Flags & CF_FIXEDPITCHONLY)
@@ -2601,8 +2602,8 @@
   TEXTMETRIC16 *lptm = (TEXTMETRIC16 *)PTR_SEG_TO_LIN(metrics);
   int i;
   
-  dprintf_commdlg(stddeb,"FontStyleEnumProc: (nFontType=%d)\n",nFontType);
-  dprintf_commdlg(stddeb,"  %s h=%d w=%d e=%d o=%d wg=%d i=%d u=%d s=%d ch=%d op=%d cp=%d q=%d pf=%xh\n",
+  dprintf_info(commdlg,"FontStyleEnumProc: (nFontType=%d)\n",nFontType);
+  dprintf_info(commdlg,"  %s h=%d w=%d e=%d o=%d wg=%d i=%d u=%d s=%d ch=%d op=%d cp=%d q=%d pf=%xh\n",
 	lplf->lfFaceName,lplf->lfHeight,lplf->lfWidth,lplf->lfEscapement,lplf->lfOrientation,
 	lplf->lfWeight,lplf->lfItalic,lplf->lfUnderline,lplf->lfStrikeOut,lplf->lfCharSet,
 	lplf->lfOutPrecision,lplf->lfClipPrecision,lplf->lfQuality,lplf->lfPitchAndFamily);
@@ -2638,11 +2639,11 @@
   SetWindowLong32A(hDlg, DWL_USER, lParam); 
   lpcf=(LPCHOOSEFONT)lParam;
   lpxx=PTR_SEG_TO_LIN(lpcf->lpLogFont);
-  dprintf_commdlg(stddeb,"FormatCharDlgProc // WM_INITDIALOG lParam=%08lX\n", lParam);
+  dprintf_info(commdlg,"FormatCharDlgProc // WM_INITDIALOG lParam=%08lX\n", lParam);
 
   if (lpcf->lStructSize != sizeof(CHOOSEFONT))
   {
-    dprintf_commdlg(stddeb,"WM_INITDIALOG: structure size failure !!!\n");
+    dprintf_err(commdlg,"WM_INITDIALOG: structure size failure !!!\n");
     EndDialog32 (hDlg, 0); 
     return FALSE;
   }
@@ -2681,7 +2682,7 @@
   {
     if (!EnumFontFamilies16(hdc, NULL,FontFamilyEnumProc,
                             (LPARAM)GetDlgItem32(hDlg,cmb1)))
-      dprintf_commdlg(stddeb,"WM_INITDIALOG: EnumFontFamilies returns 0\n");
+      dprintf_info(commdlg,"WM_INITDIALOG: EnumFontFamilies returns 0\n");
     if (lpcf->Flags & CF_INITTOLOGFONTSTRUCT)
     {
       /* look for fitting font name in combobox1 */
@@ -2728,7 +2729,7 @@
   }
   else
   {
-    dprintf_commdlg(stddeb,"WM_INITDIALOG: HDC failure !!!\n");
+    dprintf_warn(commdlg,"WM_INITDIALOG: HDC failure !!!\n");
     EndDialog32 (hDlg, 0); 
     return FALSE;
   }
@@ -2793,7 +2794,7 @@
    buffer = SEGPTR_ALLOC(40);
    switch (lpdi->CtlID)
    {
-    case cmb1:	/* dprintf_commdlg(stddeb,"WM_Drawitem cmb1\n"); */
+    case cmb1:	/* dprintf_info(commdlg,"WM_Drawitem cmb1\n"); */
 		SendMessage16(lpdi->hwndItem, CB_GETLBTEXT16, lpdi->itemID,
 			(LPARAM)SEGPTR_GET(buffer));	          
 		GetObject16( hBitmapTT, sizeof(bm), &bm );
@@ -2814,14 +2815,14 @@
 #endif
 		break;
     case cmb2:
-    case cmb3:	/* dprintf_commdlg(stddeb,"WM_DRAWITEN cmb2,cmb3\n"); */
+    case cmb3:	/* dprintf_info(commdlg,"WM_DRAWITEN cmb2,cmb3\n"); */
 		SendMessage16(lpdi->hwndItem, CB_GETLBTEXT16, lpdi->itemID,
 			(LPARAM)SEGPTR_GET(buffer));
 		TextOut16(lpdi->hDC, lpdi->rcItem.left,
                           lpdi->rcItem.top, buffer, lstrlen16(buffer));
 		break;
 
-    case cmb4:	/* dprintf_commdlg(stddeb,"WM_DRAWITEM cmb4 (=COLOR)\n"); */
+    case cmb4:	/* dprintf_info(commdlg,"WM_DRAWITEM cmb4 (=COLOR)\n"); */
 		SendMessage16(lpdi->hwndItem, CB_GETLBTEXT16, lpdi->itemID,
     		    (LPARAM)SEGPTR_GET(buffer));
 		TextOut16(lpdi->hDC, lpdi->rcItem.left +  25+5,
@@ -2880,7 +2881,7 @@
   LPCHOOSEFONT lpcf=(LPCHOOSEFONT)GetWindowLong32A(hDlg, DWL_USER); 
   LPLOGFONT16 lpxx=PTR_SEG_TO_LIN(lpcf->lpLogFont);
   
-  dprintf_commdlg(stddeb,"FormatCharDlgProc // WM_COMMAND lParam=%08lX\n", lParam);
+  dprintf_info(commdlg,"FormatCharDlgProc // WM_COMMAND lParam=%08lX\n", lParam);
   switch (wParam)
   {
 	case cmb1:if (HIWORD(lParam)==CBN_SELCHANGE)
@@ -2897,7 +2898,7 @@
                         char *str = SEGPTR_ALLOC(256);
                         SendDlgItemMessage16(hDlg,cmb1,CB_GETLBTEXT16,i,
                                              (LPARAM)SEGPTR_GET(str));
-	                dprintf_commdlg(stddeb,"WM_COMMAND/cmb1 =>%s\n",str);
+	                dprintf_info(commdlg,"WM_COMMAND/cmb1 =>%s\n",str);
        		        EnumFontFamilies16(hdc,str,FontStyleEnumProc,
 		             MAKELONG(GetDlgItem32(hDlg,cmb2),GetDlgItem32(hDlg,cmb3)));
 		        SetCursor16(hcursor);
@@ -2908,7 +2909,7 @@
  		    }
  		    else
                     {
-                      dprintf_commdlg(stddeb,"WM_COMMAND: HDC failure !!!\n");
+                      dprintf_warn(commdlg,"WM_COMMAND: HDC failure !!!\n");
                       EndDialog32 (hDlg, 0); 
                       return TRUE;
                     }
@@ -2919,7 +2920,7 @@
 	case cmb3:if (HIWORD(lParam)==CBN_SELCHANGE || HIWORD(lParam)== BN_CLICKED )
 	          {
                     char *str = SEGPTR_ALLOC(256);
-                    dprintf_commdlg(stddeb,"WM_COMMAND/cmb2,3 =%08lX\n", lParam);
+                    dprintf_info(commdlg,"WM_COMMAND/cmb2,3 =%08lX\n", lParam);
 		    i=SendDlgItemMessage16(hDlg,cmb1,CB_GETCURSEL16,0,0);
 		    if (i==CB_ERR)
                       i=GetDlgItemText32A( hDlg, cmb1, str, 256 );
@@ -3035,7 +3036,7 @@
       case WM_COMMAND:
                         return CFn_WMCommand(hDlg,wParam,lParam);
       case WM_CHOOSEFONT_GETLOGFONT: 
-                         dprintf_commdlg(stddeb,
+                         dprintf_info(commdlg,
                           "FormatCharDlgProc // WM_CHOOSEFONT_GETLOGFONT lParam=%08lX\n", lParam);
                         /* FIXME:  current logfont back to caller */
                         break;
diff --git a/misc/cpu.c b/misc/cpu.c
index 9265986..65e9ac4 100644
--- a/misc/cpu.c
+++ b/misc/cpu.c
@@ -10,6 +10,7 @@
 #include <string.h>
 #include "windows.h"
 #include "winnt.h"
+#include "winreg.h"
 
 static BYTE PF[64] = {0,};
 
@@ -20,6 +21,8 @@
 {
 	static int cache = 0;
 	static SYSTEM_INFO cachedsi;
+	HKEY	xhkey=0,hkey;
+	char	buf[20];
 
 	if (cache) {
 		memcpy(si,&cachedsi,sizeof(*si));
@@ -55,6 +58,8 @@
 
 	if (!f)
 		return;
+        xhkey = 0;
+	RegCreateKey16(HKEY_LOCAL_MACHINE,"\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor",&hkey);
 	while (fgets(line,200,f)!=NULL) {
 		char	*s,*value;
 
@@ -88,6 +93,10 @@
 					break;
 				}
 			}
+			/* set the CPU type of the current processor */
+			sprintf(buf,"CPU %ld",cachedsi.dwProcessorType);
+			if (xhkey)
+				RegSetValueEx32A(xhkey,"Identifier",0,REG_SZ,buf,strlen(buf));
 			continue;
 		}
 		/* old 2.0 method */
@@ -112,6 +121,10 @@
 					break;
 				}
 			}
+			/* set the CPU type of the current processor */
+			sprintf(buf,"CPU %ld",cachedsi.dwProcessorType);
+			if (xhkey)
+				RegSetValueEx32A(xhkey,"Identifier",0,REG_SZ,buf,strlen(buf));
 			continue;
 		}
 		if (!lstrncmpi32A(line,"fdiv_bug",strlen("fdiv_bug"))) {
@@ -133,6 +146,12 @@
 			if (sscanf(value,"%d",&x))
 				if (x+1>cachedsi.dwNumberOfProcessors)
 					cachedsi.dwNumberOfProcessors=x+1;
+
+			/* create a new processor subkey */
+			sprintf(buf,"%d",x);
+			if (xhkey)
+				RegCloseKey(xhkey);
+			RegCreateKey16(hkey,buf,&xhkey);
 		}
 		if (!lstrncmpi32A(line,"stepping",strlen("stepping"))) {
 			int	x;
@@ -151,11 +170,15 @@
 	fclose (f);
 	}
 	memcpy(si,&cachedsi,sizeof(*si));
-	return;
 #else  /* linux */
 	/* FIXME: how do we do this on other systems? */
-	return;
-#endif  /* linux */
+
+	RegCreateKey16(hkey,"0",&xhkey);
+	RegSetValueEx32A(xhkey,"Identifier",0,REG_SZ,"CPU 386",strlen("CPU 386"));
+#endif  /* !linux */
+	if (xhkey)
+		RegCloseKey(xhkey);
+	RegCloseKey(hkey);
 }
 
 /***********************************************************************
diff --git a/misc/crtdll.c b/misc/crtdll.c
index dac9b30..7ca8fb9 100644
--- a/misc/crtdll.c
+++ b/misc/crtdll.c
@@ -34,7 +34,6 @@
 #include <setjmp.h>
 #include "win.h"
 #include "windows.h"
-#include "stddebug.h"
 #include "debug.h"
 #include "module.h"
 #include "heap.h"
@@ -83,12 +82,12 @@
 	int	xargc,i,afterlastspace;
 	DWORD	version;
 
-	dprintf_crtdll(stddeb,"CRTDLL__GetMainArgs(%p,%p,%p,%ld).\n",
+	dprintf_info(crtdll,"CRTDLL__GetMainArgs(%p,%p,%p,%ld).\n",
 		argc,argv,environ,flag
 	);
 	CRTDLL_acmdln_dll = cmdline = HEAP_strdupA( GetProcessHeap(), 0,
                                                     GetCommandLine32A() );
- 	dprintf_crtdll(stddeb,"CRTDLL__GetMainArgs got \"%s\"\n",
+ 	dprintf_info(crtdll,"CRTDLL__GetMainArgs got \"%s\"\n",
 		cmdline);
 
 	version	= GetVersion32();
@@ -131,7 +130,7 @@
 	CRTDLL_argv_dll	= xargv;
 	*argv		= xargv;
 
-	dprintf_crtdll(stddeb,"CRTDLL__GetMainArgs found %d arguments\n",
+	dprintf_info(crtdll,"CRTDLL__GetMainArgs found %d arguments\n",
 		CRTDLL_argc_dll);
 	CRTDLL_environ_dll = *environ = GetEnvironmentStrings32A();
 	return 0;
@@ -147,7 +146,7 @@
 {
 	_INITTERMFUN	*current;
 
-	dprintf_crtdll(stddeb,"_initterm(%p,%p)\n",start,end);
+	dprintf_info(crtdll,"_initterm(%p,%p)\n",start,end);
 	current=start;
 	while (current<end) {
 		if (*current) (*current)();
@@ -174,7 +173,7 @@
     default:
       file=fdopen(handle,mode);
     }
-  dprintf_crtdll(stddeb,
+  dprintf_info(crtdll,
 		 "CRTDLL_fdopen open handle %d mode %s  got file %p\n",
 		 handle, mode, file);
   return (DWORD)file;
@@ -214,7 +213,7 @@
   DOS_FULL_NAME full_name;
   
   if (!DOSFS_GetFullName( path, FALSE, &full_name )) {
-    dprintf_crtdll(stddeb,"CRTDLL_fopen file %s bad name\n",path);
+    dprintf_warn(crtdll, "CRTDLL_fopen file %s bad name\n",path);
    return 0;
   }
   
@@ -235,14 +234,14 @@
   else if (strstr(mode,"a+")) flagmode= O_RDWR | O_CREAT | O_APPEND;
   else if (strchr(mode,'w')) flagmode = O_RDWR | O_CREAT | O_APPEND;
   else if (strchr(mode,'b'))
-    dprintf_crtdll(stderr,
+    dprintf_info(crtdll,
 		   "CRTDLL_fopen %s in BINARY mode\n",path);
       
   dos_fildes=FILE_Open(path, flagmode);
   unix_fildes=FILE_GetUnixHandle(dos_fildes);
   file = fdopen(unix_fildes,mode);
 
-  dprintf_crtdll(stddeb,
+  dprintf_info(crtdll,
 		 "CRTDLL_fopen file %s mode %s got ufh %d dfh %d file %p\n",
 		 path,mode,unix_fildes,dos_fildes,file);
   return (DWORD)file;
@@ -263,7 +262,7 @@
      known binary extensions must be unchanged */
   while ( (i < (nmemb*size)) && (ret==1)) {
     ret=fread(temp,1,1,file);
-    dprintf_crtdll(stddeb,
+    dprintf_info(crtdll,
 		 "CRTDLL_fread got %c 0x%02x ret %d\n",
 		   (isalpha(*(unsigned char*)temp))? *(unsigned char*)temp:
 		    ' ',*(unsigned char*)temp, ret);
@@ -272,18 +271,24 @@
       i++;
     }
     else
-      dprintf_crtdll(stddeb, "CRTDLL_fread skipping ^M\n");
+      dprintf_info(crtdll, "CRTDLL_fread skipping ^M\n");
   }
-  dprintf_crtdll(stddeb,
-		 "CRTDLL_fread 0x%08x items of size %d from file %p to %p%s\n",
-		 nmemb,size,file,ptr,(i!=nmemb)?" failed":"");
+  dprintf_info(crtdll,
+		 "CRTDLL_fread 0x%08x items of size %d from file %p to %p\n",
+		 nmemb,size,file,ptr,);
+  if(i!=nmemb)
+    dprintf_warn(crtdll, " failed!\n");
+
   return i;
 #else
     
   ret=fread(ptr,size,nmemb,file);
-  dprintf_crtdll(stddeb,
-		 "CRTDLL_fread 0x%08x items of size %d from file %p to %p%s\n",
-		 nmemb,size,file,ptr,(ret!=nmemb)?" failed":"");
+  dprintf_info(crtdll,
+	       "CRTDLL_fread 0x%08x items of size %d from file %p to %p\n",
+	       nmemb,size,file,ptr);
+  if(ret!=nmemb)
+    dprintf_warn(crtdll, " failed!\n");
+
   return ret;
 #endif
 }
@@ -296,12 +301,14 @@
   long ret;
 
   ret=fseek(stream,offset,whence);
-  dprintf_crtdll(stddeb,
-		 "CRTDLL_fseek file %p to 0x%08lx pos %s%s\n",
+  dprintf_info(crtdll,
+		 "CRTDLL_fseek file %p to 0x%08lx pos %s\n",
 		 stream,offset,(whence==SEEK_SET)?"SEEK_SET":
 		 (whence==SEEK_CUR)?"SEEK_CUR":
-		 (whence==SEEK_END)?"SEEK_END":"UNKNOWN",
-		 (ret)?"failed":"");
+		 (whence==SEEK_END)?"SEEK_END":"UNKNOWN");
+  if(ret)
+    dprintf_warn(crtdll, " failed!\n");
+
   return ret;
 }
   
@@ -313,7 +320,7 @@
   long ret;
 
   ret=ftell(stream);
-  dprintf_crtdll(stddeb,
+  dprintf_info(crtdll,
 		 "CRTDLL_ftell file %p at 0x%08lx\n",
 		 stream,ret);
   return ret;
@@ -327,9 +334,12 @@
   size_t ret;
 
   ret=fwrite(ptr,size,nmemb,file);
-  dprintf_crtdll(stddeb,
-		 "CRTDLL_fwrite 0x%08x items of size %d from %p to file %p%s\n",
-		 nmemb,size,ptr,file,(ret!=nmemb)?" failed":"");
+  dprintf_info(crtdll,
+		 "CRTDLL_fwrite 0x%08x items of size %d from %p to file %p\n",
+		 nmemb,size,ptr,file);
+  if(ret!=nmemb)
+    dprintf_warn(crtdll, " Failed!\n");
+
   return ret;
 }
 
@@ -338,7 +348,7 @@
  */
 INT32 __cdecl CRTDLL_setbuf(LPVOID file, LPSTR buf)
 {
-  dprintf_crtdll(stddeb,
+  dprintf_info(crtdll,
 		 "CRTDLL_setbuf(file %p buf %p)\n",
 		 file,buf);
   /* this doesn't work:"void value not ignored as it ought to be" 
@@ -371,7 +381,7 @@
 	default:
 	  return (-1);
 	}
-	dprintf_crtdll(stddeb,
+	dprintf_info(crtdll,
 		       "CRTDLL_open_osfhandle(handle %08lx,flags %d) return %d\n",
 		       osfhandle,flags,handle);
 	return handle;
@@ -445,7 +455,7 @@
  */
 BOOL32 __cdecl CRTDLL__isatty(DWORD x)
 {
-	dprintf_crtdll(stderr,"CRTDLL__isatty(%ld)\n",x);
+	dprintf_info(crtdll,"CRTDLL__isatty(%ld)\n",x);
 	return TRUE;
 }
 
@@ -462,7 +472,7 @@
 	  len = (UINT32)write(fd,buf,(LONG)count);
 	else
 	  len = _lwrite32(fd,buf,count);
-	dprintf_crtdll(stddeb,"CRTDLL_write %d/%d byte to dfh %d from %p,\n",
+	dprintf_info(crtdll,"CRTDLL_write %d/%d byte to dfh %d from %p,\n",
 		       len,count,fd,buf);
 	return len;
 }
@@ -482,7 +492,7 @@
  */
 void __cdecl CRTDLL__cexit(INT32 ret)
 {
-        dprintf_crtdll(stddeb,"CRTDLL__cexit(%d)\n",ret);
+        dprintf_info(crtdll,"CRTDLL__cexit(%d)\n",ret);
 	ExitProcess(ret);
 }
 
@@ -492,7 +502,7 @@
  */
 void __cdecl CRTDLL_exit(DWORD ret)
 {
-        dprintf_crtdll(stddeb,"CRTDLL_exit(%ld)\n",ret);
+        dprintf_info(crtdll,"CRTDLL_exit(%ld)\n",ret);
 	ExitProcess(ret);
 }
 
@@ -502,7 +512,7 @@
  */
 INT32 __cdecl CRTDLL__abnormal_termination(void)
 {
-        dprintf_crtdll(stddeb,"CRTDLL__abnormal_termination\n");
+        dprintf_info(crtdll,"CRTDLL__abnormal_termination\n");
 	return 0;
 }
 
@@ -515,7 +525,10 @@
     int ret;
 
     ret = fflush(stream);
-    dprintf_crtdll(stddeb,"CRTDLL_fflush %p returnd %d %s\n",stream,ret,(ret)?"":" failed");
+    dprintf_info(crtdll,"CRTDLL_fflush %p returnd %d\n",stream,ret);
+    if(ret)
+      dprintf_warn(crtdll, " Failed!\n");
+
     return ret;
 }
 
@@ -530,7 +543,7 @@
    * windows95's ftp.exe.
    */
    ret = gets(buf);
-   dprintf_crtdll(stddeb,"CRTDLL_gets got %s\n",ret);
+   dprintf_info(crtdll,"CRTDLL_gets got %s\n",ret);
    return ret;
 }
 
@@ -558,7 +571,7 @@
  */
 INT32 __cdecl CRTDLL_fputc( INT32 c, FILE *stream )
 {
-  dprintf_crtdll(stddeb,
+  dprintf_info(crtdll,
 		 "CRTDLL_fputc %c to file %p\n",c,stream);
     return fputc(c,stream);
 }
@@ -569,7 +582,7 @@
  */
 INT32 __cdecl CRTDLL_fputs( LPCSTR s, FILE *stream )
 {
-  dprintf_crtdll(stddeb,
+  dprintf_info(crtdll,
 		 "CRTDLL_fputs %s to file %p\n",s,stream);
     return fputs(s,stream);
 }
@@ -580,7 +593,7 @@
  */
 INT32 __cdecl CRTDLL_puts(LPCSTR s)
 {
-  dprintf_crtdll(stddeb,
+  dprintf_info(crtdll,
 		 "CRTDLL_fputs %s \n",s);
     return puts(s);
 }
@@ -591,7 +604,7 @@
  */
 INT32 __cdecl CRTDLL_putc(INT32 c, FILE *stream)
 {
-  dprintf_crtdll(stddeb,
+  dprintf_info(crtdll,
 		 "CRTDLL_putc %c to file %p\n",c,stream);
     return fputc(c,stream);
 }
@@ -601,7 +614,7 @@
 INT32 __cdecl CRTDLL_fgetc( FILE *stream )
 {
   int ret= fgetc(stream);
-  dprintf_crtdll(stddeb,
+  dprintf_info(crtdll,
 		 "CRTDLL_fgetc got %d\n",ret);
   return ret;
 }
@@ -613,7 +626,7 @@
 INT32 __cdecl CRTDLL_getc( FILE *stream )
 {
   int ret= fgetc(stream);
-  dprintf_crtdll(stddeb,
+  dprintf_info(crtdll,
 		 "CRTDLL_getc got %d\n",ret);
   return ret;
 }
@@ -625,7 +638,7 @@
 {
    unsigned int ret = (x >> shift)|( x >>((sizeof(x))-shift));
 
-   dprintf_crtdll(stddeb,
+   dprintf_info(crtdll,
 		  "CRTDLL_rotl got 0x%08x rot %d ret 0x%08x\n",
 		  x,shift,ret);
    return ret;
@@ -638,7 +651,7 @@
 {
    unsigned long ret = (x >> shift)|( x >>((sizeof(x))-shift));
 
-   dprintf_crtdll(stddeb,
+   dprintf_info(crtdll,
 		  "CRTDLL_lrotl got 0x%08lx rot %d ret 0x%08lx\n",
 		  x,shift,ret);
    return ret;
@@ -663,9 +676,12 @@
       *control_M='\n';
       *(control_M+1)=0;
     }
-  dprintf_crtdll(stddeb,
-		 "CRTDLL_fgets got %s for %d chars from file %p%s\n",
-		 s,size,stream,(ret)?"":" failed");
+  dprintf_info(crtdll,
+		 "CRTDLL_fgets got %s for %d chars from file %p\n",
+		 s,size,stream);
+  if(ret)
+    dprintf_warn(crtdll, " Failed!\n");
+
   return ret;
 }
 
@@ -720,7 +736,7 @@
  */
 unsigned char* __cdecl CRTDLL__mbscpy(unsigned char *x,unsigned char *y)
 {
-    dprintf_crtdll(stddeb,"CRTDLL_mbscpy %s and %s\n",x,y);
+    dprintf_info(crtdll,"CRTDLL_mbscpy %s and %s\n",x,y);
     return strcpy(x,y);
 }
 
@@ -761,14 +777,13 @@
 {
   unsigned char *y =x;
   
-  dprintf_crtdll(stddeb,
-		 "CRTDLL_strlwr got %s",x);
+  dprintf_info(crtdll, "CRTDLL_strlwr got %s\n", x);
   while (*y) {
     if ((*y > 0x40) && (*y< 0x5b))
       *y = *y + 0x20;
     y++;
   }
-  dprintf_crtdll(stddeb," returned %s\n",x);
+  dprintf_info(crtdll, "   returned %s\n", x);
 		 
   return x;
 }
@@ -795,7 +810,7 @@
   }
   /* If buffer too short, exit.  */
   if (i > SYSBUF_LENGTH) {
-    dprintf_crtdll(stddeb,"_system buffer to small\n");
+    dprintf_info(crtdll,"_system buffer to small\n");
     return 127;
   }
   
@@ -812,7 +827,7 @@
   }
   *bp++ = '"';
   *bp = 0;
-  dprintf_crtdll(stddeb,
+  dprintf_info(crtdll,
 		 "_system got \"%s\", executing \"%s\"\n",x,buffer);
 
   return system(buffer);
@@ -866,8 +881,7 @@
  */
 VOID __cdecl CRTDLL_longjmp(jmp_buf env, int val)
 {
-    dprintf_crtdll(stdnimp,"CRTDLL_longjmp semistup, expect crash\n");
-    dprintf_crtdll(stddeb, "CRTDLL_longjmp semistup, expect crash\n");
+    dprintf_fixme(crtdll,"CRTDLL_longjmp semistup, expect crash\n");
     return longjmp(env, val);
 }
 
@@ -956,8 +970,12 @@
       fclose(stream);
       ret = _lclose32( dos_handle);
     }
-    dprintf_crtdll(stddeb,"CRTDLL_fclose(%p) ufh %d dfh %d%s\n",
-		   stream,unix_handle,dos_handle,(ret)?" failed":"");
+    dprintf_info(crtdll,"CRTDLL_fclose(%p) ufh %d dfh %d\n",
+		   stream,unix_handle,dos_handle);
+
+    if(ret)
+      dprintf_warn(crtdll, " Failed!\n");
+
     return ret;
 }
 
@@ -970,13 +988,16 @@
     DOS_FULL_NAME full_name;
 
     if (!DOSFS_GetFullName( pathname, FALSE, &full_name )) {
-      dprintf_crtdll(stddeb,"CRTDLL_unlink file %s bad name\n",pathname);
+      dprintf_warn(crtdll, "CRTDLL_unlink file %s bad name\n",pathname);
       return EOF;
     }
   
     ret=unlink(full_name.long_name);
-    dprintf_crtdll(stddeb,"CRTDLL_unlink(%s unix %s)%s\n",
-		   pathname,full_name.long_name, (ret)?" failed":"");
+    dprintf_info(crtdll,"CRTDLL_unlink(%s unix %s)\n",
+		   pathname,full_name.long_name);
+    if(ret)
+      dprintf_warn(crtdll, " Failed!\n");
+
     return ret;
 }
 
@@ -1017,12 +1038,13 @@
 
     if (!DOSFS_GetFullName( filename, TRUE, &full_name ))
     {
-      dprintf_crtdll(stddeb,"CRTDLL__stat filename %s bad name\n",filename);
+      dprintf_warn(crtdll, "CRTDLL__stat filename %s bad name\n",filename);
       return -1;
     }
     ret=stat(full_name.long_name,&mystat);
-    dprintf_crtdll(stddeb,"CRTDLL__stat %s%s\n",
-		   filename, (ret)?" failed":"");
+    dprintf_info(crtdll,"CRTDLL__stat %s\n", filename);
+    if(ret) 
+      dprintf_warn(crtdll, " Failed!\n");
 
     /* FIXME: should check what Windows returns */
 
@@ -1061,11 +1083,11 @@
     if (flags & 0x0200 ) wineflags |= O_TRUNC;
     if (flags & 0x0400 ) wineflags |= O_EXCL;
     if (flags & 0xf0f4 ) 
-      dprintf_crtdll(stddeb,"CRTDLL_open file unsupported flags 0x%04x\n",flags);
+      dprintf_info(crtdll,"CRTDLL_open file unsupported flags 0x%04x\n",flags);
     /* End Fixme */
 
     ret = FILE_Open(path,wineflags);
-    dprintf_crtdll(stddeb,"CRTDLL_open file %s mode 0x%04x (lccmode 0x%04x) got dfh %d\n",
+    dprintf_info(crtdll,"CRTDLL_open file %s mode 0x%04x (lccmode 0x%04x) got dfh %d\n",
 		   path,wineflags,flags,ret);
     return ret;
 }
@@ -1077,7 +1099,10 @@
 {
     int ret=_lclose32(fd);
 
-    dprintf_crtdll(stddeb,"CRTDLL_close(%d)%s\n",fd,(ret)?" failed":"");
+    dprintf_info(crtdll,"CRTDLL_close(%d)\n",fd);
+    if(ret)
+      dprintf_warn(crtdll, " Failed!\n");
+
     return ret;
 }
 
@@ -1089,7 +1114,7 @@
     int ret;
     
     ret=feof(stream);
-    dprintf_crtdll(stddeb,"CRTDLL_feof(%p) %s\n",stream,(ret)?"true":"false");
+    dprintf_info(crtdll,"CRTDLL_feof(%p) %s\n",stream,(ret)?"true":"false");
     return ret;
 }
 
@@ -1335,10 +1360,9 @@
 #define O_TEXT     0x4000
 #define O_BINARY   0x8000
 
-	dprintf_crtdll(stddeb,
-		       "CRTDLL._setmode on fhandle %d mode %s, STUB.\n",
-		fh,(mode=O_TEXT)?"O_TEXT":
-		(mode=O_BINARY)?"O_BINARY":"UNKNOWN");
+	dprintf_fixme(crtdll, "CRTDLL._setmode on fhandle %d mode %s, STUB.\n",
+		      fh,(mode=O_TEXT)?"O_TEXT":
+		                        (mode=O_BINARY)?"O_BINARY":"UNKNOWN");
 	return -1;
 }
 
@@ -1368,7 +1392,7 @@
     else if (!(*mb))
       ret =0;
       
-    dprintf_crtdll(stderr,"CRTDLL_mlen %s for max %d bytes ret %d\n",mb,size,ret);
+    dprintf_info(crtdll,"CRTDLL_mlen %s for max %d bytes ret %d\n",mb,size,ret);
 
     return ret;
 }
@@ -1395,7 +1419,7 @@
     p++;
     ret = (p -wcs);
           
-    dprintf_crtdll(stddeb,"CRTDLL_mbstowcs %s for %d chars put %d wchars\n",
+    dprintf_info(crtdll,"CRTDLL_mbstowcs %s for %d chars put %d wchars\n",
 		   mbs,size,ret);
     return ret;
 }
@@ -1423,7 +1447,7 @@
      else
        ret = -1;
    
-   dprintf_crtdll(stderr,"CRTDLL_mbtowc %s for %d chars\n",mb,size);
+   dprintf_info(crtdll,"CRTDLL_mbtowc %s for %d chars\n",mb,size);
          
    return ret;
 }
@@ -1484,7 +1508,7 @@
   }
   if (!DOSFS_GetFullName( name, FALSE, &full_name )) return NULL;
   lstrcpyn32A(buf,full_name.short_name,size);
-  dprintf_crtdll(stderr,"CRTDLL_fullpath got %s\n",buf);
+  dprintf_info(crtdll,"CRTDLL_fullpath got %s\n",buf);
   return buf;
 }
 
@@ -1500,7 +1524,7 @@
      */
   char * drivechar,*dirchar,*namechar;
 
-  dprintf_crtdll(stddeb,"CRTDLL__splitpath got %s\n",path);
+  dprintf_info(crtdll,"CRTDLL__splitpath got %s\n",path);
 
   drivechar  = strchr(path,':');
   dirchar    = strrchr(path,'/');
@@ -1544,7 +1568,7 @@
 	}
     }
 
-  dprintf_crtdll(stddeb,"CRTDLL__splitpath found %s %s %s %s\n",drive,directory,filename,extension);
+  dprintf_info(crtdll,"CRTDLL__splitpath found %s %s %s %s\n",drive,directory,filename,extension);
   
 }
 
@@ -1574,7 +1598,7 @@
   if (len > size)
     {
       /* set error to ERANGE */
-      dprintf_crtdll(stddeb,"CRTDLL_getcwd buffer to small\n");
+      dprintf_info(crtdll,"CRTDLL_getcwd buffer to small\n");
       return NULL;
     }
   return buf;
@@ -1616,29 +1640,28 @@
      DOS_FULL_NAME tempname;
      
      if ((ret = tempnam(dir,prefix))==NULL) {
-       dprintf_crtdll(stddeb,
-		      "CRTDLL_tempnam Unable to get unique filename\n");
+       dprintf_warn(crtdll, "Unable to get unique filename\n");
        return NULL;
      }
      if (!DOSFS_GetFullName(ret,FALSE,&tempname))
      {
-       dprintf_crtdll(stddeb,
+       dprintf_info(crtdll,
 		      "CRTDLL_tempnam Wrong path?\n");
        return NULL;
      }
      free(ret);
      if ((ret = CRTDLL_malloc(strlen(tempname.short_name)+1)) == NULL) {
-	 dprintf_crtdll(stddeb,
+	 dprintf_warn(crtdll,
 			"CRTDLL_tempnam CRTDL_malloc for shortname failed\n");
 	 return NULL;
      }
      if ((ret = strcpy(ret,tempname.short_name)) == NULL) { 
-       dprintf_crtdll(stddeb,
+       dprintf_warn(crtdll,
 		      "CRTDLL_tempnam Malloc for shortname failed\n");
        return NULL;
      }
      
-     dprintf_crtdll(stddeb,"CRTDLL_tempnam dir %s prefix %s got %s\n",
+     dprintf_info(crtdll,"CRTDLL_tempnam dir %s prefix %s got %s\n",
 		    dir,prefix,ret);
      return ret;
 
@@ -1654,20 +1677,19 @@
      char *ret;
 
      if ((ret =tmpnam(s))== NULL) {
-       dprintf_crtdll(stddeb,
-		      "CRTDLL_tmpnam Unable to get unique filename\n");
+       dprintf_warn(crtdll, "Unable to get unique filename\n");
        return NULL;
      }
      if (!DOSFS_GetFullName(ret,FALSE,&CRTDLL_tmpname))
      {
-       dprintf_crtdll(stddeb,
+       dprintf_info(crtdll,
 		      "CRTDLL_tmpnam Wrong path?\n");
        return NULL;
      }
      strcat(CRTDLL_tmpname.short_name,".");
-     dprintf_crtdll(stddeb,"CRTDLL_tmpnam for buf %p got %s\n",
+     dprintf_info(crtdll,"CRTDLL_tmpnam for buf %p got %s\n",
 		    s,CRTDLL_tmpname.short_name);
-     dprintf_crtdll(stddeb,"CRTDLL_tmpnam long got %s\n",
+     dprintf_info(crtdll,"CRTDLL_tmpnam long got %s\n",
 		    CRTDLL_tmpname.long_name);
      if ( s != NULL) 
        return strcpy(s,CRTDLL_tmpname.short_name);
@@ -1692,7 +1714,7 @@
  */
 VOID __cdecl CRTDLL_signal(int sig, sig_handler_type ptr)
 {
-    dprintf_crtdll(stddeb,"CRTDLL_signal %d %p: STUB!\n",sig,ptr);
+    dprintf_fixme(crtdll, "CRTDLL_signal %d %p: STUB!\n", sig, ptr);
 }
 
 /*********************************************************************
@@ -1706,6 +1728,6 @@
  */
 VOID __cdecl CRTDLL__sleep(unsigned long timeout) 
 {
-  dprintf_crtdll(stddeb,"CRTDLL__sleep for %ld milliseconds\n",timeout);
+  dprintf_info(crtdll,"CRTDLL__sleep for %ld milliseconds\n",timeout);
   Sleep((timeout)?timeout:1);
 }
diff --git a/misc/ddeml.c b/misc/ddeml.c
index b430475..4367c53 100644
--- a/misc/ddeml.c
+++ b/misc/ddeml.c
@@ -9,7 +9,6 @@
 
 #include <stdio.h>
 #include "ddeml.h"
-#include "stddebug.h"
 #include "debug.h"
 
 
diff --git a/misc/debugstr.c b/misc/debugstr.c
index 2ef4649..e720a33 100644
--- a/misc/debugstr.c
+++ b/misc/debugstr.c
@@ -1,6 +1,7 @@
 #include "debugstr.h"
 #include "xmalloc.h"
 #include <stdlib.h>
+#include <stdio.h>
 
 /* ---------------------------------------------------------------------- */
 
@@ -125,3 +126,18 @@
 }
 
 /* ---------------------------------------------------------------------- */
+/* This routine returns a nicely formated name of the resource res
+   If the resource name is a string, it will return '<res-name>'
+   If it is a number, it will return #<4-digit-hex-number> */
+LPSTR
+debugres (const void *res)
+{
+  if (HIWORD((DWORD)res))
+    return debugstr_a((LPCSTR)res);
+  else{
+    char resname[10];
+    sprintf(resname, "#%04x", LOWORD(res));
+    return debugstr_a (resname);
+  }
+}
+
diff --git a/misc/error.c b/misc/error.c
index fc2e124..3a36237 100644
--- a/misc/error.c
+++ b/misc/error.c
@@ -9,14 +9,11 @@
 #include <string.h>
 
 #include "windows.h"
-#include "stddebug.h"
 #include "debug.h"
 
-#ifdef DEBUG_RUNTIME
-
 #define ErrorString(manifest) { manifest, # manifest }
 
-const struct {
+static const struct {
 	int constant;
 	const char *name;
 } ErrorStrings[] = {
@@ -47,9 +44,7 @@
 	ErrorString(ERR_SELBITMAP)
 };
 
-#define ErrorStringCount (sizeof(ErrorStrings) / sizeof(ErrorStrings[0]))
-
-const struct {
+static const struct {
 	int constant;
 	const char *name;
 } ParamErrorStrings[] = {
@@ -90,27 +85,25 @@
 	ErrorString(ERR_BAD_HMETAFILE)
 };
 
+#undef  ErrorString
+#define ErrorStringCount (sizeof(ErrorStrings) / sizeof(ErrorStrings[0]))
 #define ParamErrorStringCount (sizeof(ParamErrorStrings) / sizeof(ParamErrorStrings[0]))
 
-#endif /* DEBUG_RUNTIME */
-
 /***********************************************************************
 *	GetErrorString (internal)
 */
-static const char *GetErrorString(UINT16 uErr) {
-	static char buffer[80];
+static const char *GetErrorString(UINT16 uErr) 
+{
+  static char buffer[80];
+  int i;
 
-#ifdef DEBUG_RUNTIME
-	int i;
+  for (i = 0; i < ErrorStringCount; i++) {
+    if (uErr == ErrorStrings[i].constant)
+      return ErrorStrings[i].name;
+  }
 
-	for (i = 0; i < ErrorStringCount; i++) {
-		if (uErr == ErrorStrings[i].constant)
-			return ErrorStrings[i].name;
-	}
-#endif
-
-	sprintf(buffer, "%x", uErr);
-	return buffer;
+  sprintf(buffer, "%x", uErr);
+  return buffer;
 }
 
 
@@ -126,7 +119,6 @@
 	} else
 		buffer[0] = '\0';
 
-#ifdef DEBUG_RUNTIME
 	{
 		int i;
 
@@ -137,7 +129,6 @@
 			}
 		}
 	}
-#endif
 
 	sprintf(buffer + strlen(buffer), "%x", uErr);
 	return buffer;
diff --git a/misc/lstr.c b/misc/lstr.c
index 1e54527..252d081 100644
--- a/misc/lstr.c
+++ b/misc/lstr.c
@@ -31,7 +31,6 @@
 #include "ldt.h"
 #include "stackframe.h"
 #include "module.h"
-#include "stddebug.h"
 #include "debug.h"
 
 /* Funny to divide them between user and kernel. */
@@ -518,7 +517,7 @@
 	DWORD	width = dwFlags & FORMAT_MESSAGE_MAX_WIDTH_MASK;
 	DWORD	nolinefeed = 0;
 
-	dprintf_resource(stddeb,
+	dprintf_info(resource,
 		"FormatMessage32A(0x%lx,%p,%ld,0x%lx,%p,%ld,%p)\n",
 		dwFlags,lpSource,dwMessageId,dwLanguageId,lpBuffer,nSize,args
 	);
@@ -535,10 +534,10 @@
 		INT32	bufsize;
 
 		dwMessageId &= 0xFFFF;
-		bufsize=LoadMessage32A(0,dwMessageId,dwLanguageId,NULL,100);
+		bufsize=LoadMessage32A((HMODULE32)lpSource,dwMessageId,dwLanguageId,NULL,100);
 		if (bufsize) {
 			from = HeapAlloc( GetProcessHeap(), 0, bufsize + 1 );
-			LoadMessage32A(0,dwMessageId,dwLanguageId,from,bufsize+1);
+			LoadMessage32A((HMODULE32)lpSource,dwMessageId,dwLanguageId,from,bufsize+1);
 		}
 	}
 	target	= HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, 100);
@@ -684,7 +683,7 @@
 	DWORD	width = dwFlags & FORMAT_MESSAGE_MAX_WIDTH_MASK;
 	DWORD	nolinefeed = 0;
 
-	dprintf_resource(stddeb,
+	dprintf_info(resource,
 		"FormatMessage32A(0x%lx,%p,%ld,0x%lx,%p,%ld,%p)\n",
 		dwFlags,lpSource,dwMessageId,dwLanguageId,lpBuffer,nSize,args
 	);
@@ -702,11 +701,11 @@
 		INT32	bufsize;
 
 		dwMessageId &= 0xFFFF;
-		bufsize=LoadMessage32A(0,dwMessageId,dwLanguageId,NULL,100);
+		bufsize=LoadMessage32A((HMODULE32)lpSource,dwMessageId,dwLanguageId,NULL,100);
 		if (bufsize)
                 {
                     from = HeapAlloc( GetProcessHeap(), 0, bufsize + 1 );
-                    LoadMessage32A(0,dwMessageId,dwLanguageId,from,bufsize+1);
+                    LoadMessage32A((HMODULE32)lpSource,dwMessageId,dwLanguageId,from,bufsize+1);
 		}
 	}
 	target	= HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, 100 );
diff --git a/misc/lzexpand.c b/misc/lzexpand.c
index 90c2323..f9defeb 100644
--- a/misc/lzexpand.c
+++ b/misc/lzexpand.c
@@ -19,7 +19,6 @@
 #include "heap.h"
 #include "ldt.h"
 #include "lzexpand.h"
-#include "stddebug.h"
 #include "debug.h"
 
 
@@ -119,7 +118,7 @@
  */
 INT16 WINAPI LZStart16(void)
 {
-    dprintf_file(stddeb,"LZStart16(void)\n");
+    dprintf_info(file,"LZStart16(void)\n");
     return 1;
 }
 
@@ -129,7 +128,7 @@
  */
 INT32 WINAPI LZStart32(void)
 {
-    dprintf_file(stddeb,"LZStart32(void)\n");
+    dprintf_info(file,"LZStart32(void)\n");
     return 1;
 }
 
@@ -162,7 +161,7 @@
 	struct	lzstate		*lzs;
 	DWORD	ret;
 
-	dprintf_file(stddeb,"LZInit(%d)\n",hfSrc);
+	dprintf_info(file,"LZInit(%d)\n",hfSrc);
 	ret=read_header(hfSrc,&head);
 	if (ret<=0) {
 		_llseek32(hfSrc,0,SEEK_SET);
@@ -195,7 +194,7 @@
  */
 void WINAPI LZDone(void)
 {
-    dprintf_file(stddeb,"LZDone()\n");
+    dprintf_info(file,"LZDone()\n");
 }
 
 
@@ -227,7 +226,7 @@
 	INT32		fnislowercased,ret,len;
 	LPSTR		s,t;
 
-	dprintf_file(stddeb,"GetExpandedName(%s)\n",in);
+	dprintf_info(file,"GetExpandedName(%s)\n",in);
 	fd=OpenFile32(in,&ofs,OF_READ);
 	if (fd==HFILE_ERROR32)
 		return (INT32)(INT16)LZERROR_BADINHANDLE;
@@ -323,7 +322,7 @@
 	struct	lzstate	*lzs;
 
 	buf=(LPBYTE)vbuf;
-	dprintf_file(stddeb,"LZRead32(%d,%p,%d)\n",fd,buf,toread);
+	dprintf_info(file,"LZRead32(%d,%p,%d)\n",fd,buf,toread);
 	howmuch=toread;
 	for (i=0;i<nroflzstates;i++)
 		if (lzstates[i].lzfd==fd)
@@ -427,7 +426,7 @@
 	struct	lzstate	*lzs;
 	LONG	newwanted;
 
-	dprintf_file(stddeb,"LZSeek(%d,%ld,%d)\n",fd,off,type);
+	dprintf_info(file,"LZSeek(%d,%ld,%d)\n",fd,off,type);
 	for (i=0;i<nroflzstates;i++)
 		if (lzstates[i].lzfd==fd)
 			break;
@@ -480,7 +479,7 @@
 	BYTE	buf[BUFLEN];
 	INT32	WINAPI (*xread)(HFILE32,LPVOID,UINT32);
 
-	dprintf_file(stddeb,"LZCopy(%d,%d)\n",src,dest);
+	dprintf_info(file,"LZCopy(%d,%d)\n",src,dest);
 	for (i=0;i<nroflzstates;i++)
 		if (src==lzstates[i].lzfd)
 			break;
@@ -546,7 +545,7 @@
 {
 	HFILE32	fd,cfd;
 
-	dprintf_file(stddeb,"LZOpenFile(%s,%p,%d)\n",fn,ofs,mode);
+	dprintf_info(file,"LZOpenFile(%s,%p,%d)\n",fn,ofs,mode);
 	/* 0x70 represents all OF_SHARE_* flags, ignore them for the check */
 	fd=OpenFile32(fn,ofs,mode);
 	if (fd==HFILE_ERROR32)
@@ -604,7 +603,7 @@
 {
 	int	i;
 
-	dprintf_file(stddeb,"LZClose(%d)\n",fd);
+	dprintf_info(file,"LZClose(%d)\n",fd);
 	for (i=0;i<nroflzstates;i++)
 		if (lzstates[i].lzfd==fd)
 			break;
@@ -627,7 +626,7 @@
  */
 LONG WINAPI CopyLZFile16( HFILE16 src, HFILE16 dest )
 {
-    dprintf_file(stddeb,"CopyLZFile16(%d,%d)\n",src,dest);
+    dprintf_info(file,"CopyLZFile16(%d,%d)\n",src,dest);
     return LZCopy32(src,dest);
 }
 
@@ -640,6 +639,6 @@
  */
 LONG WINAPI CopyLZFile32( HFILE32 src, HFILE32 dest )
 {
-    dprintf_file(stddeb,"CopyLZFile32(%d,%d)\n",src,dest);
+    dprintf_info(file,"CopyLZFile32(%d,%d)\n",src,dest);
     return LZCopy32(src,dest);
 }
diff --git a/misc/main.c b/misc/main.c
index 2ca79c7..2ecb720 100644
--- a/misc/main.c
+++ b/misc/main.c
@@ -29,13 +29,11 @@
 #include "process.h"
 #include "shell.h"
 #include "winbase.h"
-#define DEBUG_DEFINE_VARIABLES
-#include "stddebug.h"
 #include "debug.h"
+#include "debugdefs.h"
 #include "xmalloc.h"
 #include "version.h"
 
-
 const WINE_LANGUAGE_DEF Languages[] =
 {
     {"En",0x0409},	/* LANG_En */
@@ -46,14 +44,14 @@
     {"Fi",0x040B},	/* LANG_Fi */
     {"Da",0x0406},	/* LANG_Da */
     {"Cz",0x0405},	/* LANG_Cz */
-    {"Eo",     0},	/* LANG_Eo */ /* FIXME languageid */
+    {"Eo",0x0425},	/* LANG_Eo */
     {"It",0x0410},	/* LANG_It */
     {"Ko",0x0412},	/* LANG_Ko */
     {"Hu",0x0436},	/* LANG_Hu */
-    {"Pl",0x0415},      /* LANG_Pl */
-    {"Po",0x0416},      /* LANG_Po */
-    {"Sw",0x0417},      /* LANG_Sw */
-    {"Ca",     0},      /* LANG_Ca */ /* FIXME languageid */
+    {"Pl",0x0415},	/* LANG_Pl */
+    {"Po",0x0416},	/* LANG_Po */
+    {"Sw",0x0417},	/* LANG_Sw */
+    {"Ca",0x0426},	/* LANG_Ca */
     {NULL,0}
 };
 
@@ -206,37 +204,53 @@
  *  Turns specific debug messages on or off, according to "options".
  *  Returns TRUE if parsing was successful
  */
-#ifdef DEBUG_RUNTIME
-
 BOOL32 ParseDebugOptions(char *options)
 {
-  int l;
+  int l, cls;
   if (strlen(options)<3)
     return FALSE;
   do
   {
-    if ((*options!='+')&&(*options!='-'))
-      return FALSE;
+    if ((*options!='+')&&(*options!='-')){
+      int j;
+
+      for(j=0; j<DEBUG_CLASS_COUNT; j++)
+	if(!lstrncmpi32A(options, debug_cl_name[j], strlen(debug_cl_name[j])))
+	  break;
+      if(j==DEBUG_CLASS_COUNT)
+	return FALSE;
+      options += strlen(debug_cl_name[j]);
+      if ((*options!='+')&&(*options!='-'))
+	return FALSE;
+      cls = j;
+    }
+    else
+      cls = -1; /* all classes */
+
     if (strchr(options,','))
       l=strchr(options,',')-options;
     else
       l=strlen(options);
+
     if (!lstrncmpi32A(options+1,"all",l-1))
       {
-	int i;
-	for (i=0;i<sizeof(debug_msg_enabled)/sizeof(short);i++)
-	  debug_msg_enabled[i]=(*options=='+');
+	int i, j;
+	for (i=0; i<DEBUG_CHANNEL_COUNT; i++)
+	  for(j=0; j<DEBUG_CLASS_COUNT; j++)
+	    if(cls == -1 || cls == j)
+	      debug_msg_enabled[i][j]=(*options=='+');
       }
     else
       {
-	int i;
-	for (i=0;i<sizeof(debug_msg_enabled)/sizeof(short);i++)
-	  if (debug_msg_name && (!lstrncmpi32A(options+1,debug_msg_name[i],l-1)))
-	    {
-	      debug_msg_enabled[i]=(*options=='+');
-	      break;
-	    }
-	if (i==sizeof(debug_msg_enabled)/sizeof(short))
+	int i, j;
+	for (i=0; i<DEBUG_CHANNEL_COUNT; i++)
+	  if (debug_ch_name && (!lstrncmpi32A(options+1,debug_ch_name[i],l-1))){
+	    for(j=0; j<DEBUG_CLASS_COUNT; j++)
+	      if(cls == -1 || cls == j)
+		debug_msg_enabled[i][j]=(*options=='+');
+	    break;
+	  }
+	if (i==DEBUG_CHANNEL_COUNT)
 	  return FALSE;
       }
     options+=l;
@@ -248,8 +262,6 @@
     return TRUE;
 }
 
-#endif
-
 /***********************************************************************
  *           MAIN_ParseLanguageOption
  *
@@ -370,29 +382,34 @@
         Options.managed = TRUE;
     if (MAIN_GetResource( db, ".mode", &value))
         MAIN_ParseModeOption( (char *)value.addr );
-
-#ifdef DEBUG_RUNTIME
     if (MAIN_GetResource( db, ".debugoptions", &value))
 	ParseDebugOptions((char*)value.addr);
-#endif
     if (MAIN_GetResource( db, ".debugmsg", &value))
       {
 #ifndef DEBUG_RUNTIME
 	fprintf(stderr,"%s: Option \"-debugmsg\" not implemented.\n" \
-          "    Recompile with DEBUG_RUNTIME in include/stddebug.h defined.\n",
+          "    Recompile with DEBUG_RUNTIME in include/debugtools.h defined.\n",
 	  argv[0]);
 	exit(1);
 #else
 	if (ParseDebugOptions((char*)value.addr)==FALSE)
 	  {
 	    int i;
-	    fprintf(stderr,"%s: Syntax: -debugmsg +xxx,...  or -debugmsg -xxx,...\n",argv[0]);
-	    fprintf(stderr,"Example: -debugmsg +all,-heap    turn on all messages except heap messages\n");
+	    fprintf(stderr,"%s: Syntax: -debugmsg [class]+xxx,...  or "
+		    "-debugmsg [class]-xxx,...\n",argv[0]);
+	    fprintf(stderr,"Example: -debugmsg +all,warn-heap"
+		    "turn on all messages except warning heap messages\n");
+
+	    fprintf(stderr,"Available message classes:\n");
+	    for(i=0;i<DEBUG_CLASS_COUNT;i++)
+	      fprintf(stderr, "%-9s", debug_cl_name[i]);
+	    fprintf(stderr,"\n\n");
+
 	    fprintf(stderr,"Available message types:\n");
 	    fprintf(stderr,"%-9s ","all");
-	    for(i=0;i<sizeof(debug_msg_enabled)/sizeof(short);i++)
-	      if(debug_msg_name[i])
-		fprintf(stderr,"%-9s%c",debug_msg_name[i],
+	    for(i=0;i<DEBUG_CHANNEL_COUNT;i++)
+	      if(debug_ch_name[i])
+		fprintf(stderr,"%-9s%c",debug_ch_name[i],
 			(((i+2)%8==0)?'\n':' '));
 	    fprintf(stderr,"\n\n");
 	    exit(1);
diff --git a/misc/mpr.c b/misc/mpr.c
index 3679aff..3691e61 100644
--- a/misc/mpr.c
+++ b/misc/mpr.c
@@ -5,7 +5,6 @@
 
 #include <stdio.h>
 #include "win.h"
-#include "stddebug.h"
 #include "debug.h"
 
 DWORD WINAPI WNetGetCachedPassword(
diff --git a/misc/ntdll.c b/misc/ntdll.c
index 933ae14..f48f370 100644
--- a/misc/ntdll.c
+++ b/misc/ntdll.c
@@ -14,7 +14,6 @@
 #include "windows.h"
 #include "ntdll.h"
 #include "heap.h"
-#include "stddebug.h"
 #include "debug.h"
 #include "module.h"
 #include "heap.h"
diff --git a/misc/registry.c b/misc/registry.c
index 1343fb4..3e47851 100644
--- a/misc/registry.c
+++ b/misc/registry.c
@@ -25,7 +25,6 @@
 #include "winerror.h"
 #include "file.h"
 #include "heap.h"
-#include "stddebug.h"
 #include "debug.h"
 #include "xmalloc.h"
 #include "winreg.h"
@@ -118,10 +117,10 @@
 
 	for (i=0;i<nrofopenhandles;i++) {
 		if (openhandles[i].lpkey==lpkey) {
-			dprintf_reg(stddeb,"add_handle:Tried to add %p twice!\n",lpkey);
+			dprintf_warn(reg, "add_handle:Tried to add %p twice!\n",lpkey);
 		}
 		if (openhandles[i].hkey==hkey) {
-			dprintf_reg(stddeb,"add_handle:Tried to add %lx twice!\n",(LONG)hkey);
+			dprintf_warn(reg, "add_handle:Tried to add %lx twice!\n",(LONG)hkey);
 		}
 	}
 	openhandles=xrealloc(	openhandles,
@@ -140,7 +139,7 @@
 	for (i=0;i<nrofopenhandles;i++)
 		if (openhandles[i].hkey==hkey)
 			return openhandles[i].lpkey;
-	dprintf_reg(stddeb,"get_handle:Didn't find handle %lx?\n",(LONG)hkey);
+	dprintf_warn(reg, "get_handle:Didn't find handle %lx?\n",(LONG)hkey);
 	return NULL;
 }
 
@@ -152,7 +151,7 @@
 		if (openhandles[i].hkey==hkey)
 			break;
 	if (i==nrofopenhandles) {
-		dprintf_reg(stddeb,"remove_handle:Didn't find handle %08x?\n",hkey);
+		dprintf_warn(reg, "remove_handle:Didn't find handle %08x?\n",hkey);
 		return;
 	}
 	memcpy(	openhandles+i,
@@ -200,7 +199,7 @@
 	case HKEY_CURRENT_CONFIG:
 		return key_current_config;
 	default:
-		dprintf_reg(stddeb,"lookup_hkey(%lx), special key!\n",
+		dprintf_warn(reg, "lookup_hkey(%lx), special key!\n",
 			(LONG)hkey
 		);
 		return get_handle(hkey);
@@ -289,42 +288,12 @@
 
 void
 SHELL_StartupRegistry() {
-	HKEY	hkey,xhkey=0;
-	FILE	*F;
-	char	buf[200],cpubuf[200];
+	HKEY	hkey;
+	char	buf[200];
 
-	RegCreateKey16(HKEY_DYN_DATA,"\\PerfStats\\StatData",&xhkey);
-	RegCloseKey(xhkey);
-        xhkey = 0;
-	RegCreateKey16(HKEY_LOCAL_MACHINE,"\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor",&hkey);
-#ifdef linux
-	F=fopen("/proc/cpuinfo","r");
-	if (F) {
-		int	procnr=-1,x;
-		while (NULL!=fgets(buf,200,F)) {
-			if (sscanf(buf,"processor\t: %d",&x)) {
-				sprintf(buf,"%d",x);
-				if (xhkey)
-					RegCloseKey(xhkey);
-				procnr=x;
-				RegCreateKey16(hkey,buf,&xhkey);
-			}
-			if (sscanf(buf,"cpu\t\t: %s",cpubuf)) {
-				sprintf(buf,"CPU %s",cpubuf);
-				if (xhkey)
-					RegSetValueEx32A(xhkey,"Identifier",0,REG_SZ,buf,strlen(buf));
-			}
-		}
-		fclose(F);
-	}
-	if (xhkey)
-		RegCloseKey(xhkey);
+	RegCreateKey16(HKEY_DYN_DATA,"\\PerfStats\\StatData",&hkey);
 	RegCloseKey(hkey);
-#else
-	/* FIXME */
-	RegCreateKey16(hkey,"0",&xhkey);
-	RegSetValueEx32A(xhkey,"Identifier",0,REG_SZ,"CPU 386",strlen("CPU 386"));
-#endif
+
 	RegOpenKey16(HKEY_LOCAL_MACHINE,"\\HARDWARE\\DESCRIPTION\\System",&hkey);
 	RegSetValueEx32A(hkey,"Identifier",0,REG_SZ,"SystemType WINE",strlen("SystemType WINE"));
 	RegCloseKey(hkey);
@@ -342,9 +311,9 @@
 	 * 						SysServices
 	 */						
 	if (-1!=gethostname(buf,200)) {
-		RegCreateKey16(HKEY_LOCAL_MACHINE,"System\\CurrentControlSet\\Control\\ComputerName\\ComputerName",&xhkey);
-		RegSetValueEx16(xhkey,"ComputerName",0,REG_SZ,buf,strlen(buf)+1);
-		RegCloseKey(xhkey);
+		RegCreateKey16(HKEY_LOCAL_MACHINE,"System\\CurrentControlSet\\Control\\ComputerName\\ComputerName",&hkey);
+		RegSetValueEx16(hkey,"ComputerName",0,REG_SZ,buf,strlen(buf)+1);
+		RegCloseKey(hkey);
 	}
 }
 /************************ SAVE Registry Function ****************************/
@@ -562,6 +531,10 @@
 _find_or_add_key(LPKEYSTRUCT lpkey,LPWSTR keyname) {
 	LPKEYSTRUCT	lpxkey,*lplpkey;
 
+	if (keyname[0]==0) {
+		free(keyname);
+		return lpkey;
+	}
 	lplpkey= &(lpkey->nextsub);
 	lpxkey	= *lplpkey;
 	while (lpxkey) {
@@ -833,7 +806,7 @@
 		return 0;
 	}
 	if (ver!=REGISTRY_SAVE_VERSION) {
-		dprintf_reg(stddeb,__FILE__":_wine_loadsubreg:Old format (%d) registry found, ignoring it. (buf was %s).\n",ver,buf);
+		dprintf_info(reg,__FILE__":_wine_loadsubreg:Old format (%d) registry found, ignoring it. (buf was %s).\n",ver,buf);
 		free(buf);
 		return 0;
 	}
@@ -855,8 +828,8 @@
 
 	F=fopen(fn,"rb");
 	if (F==NULL) {
-		dprintf_reg(stddeb,__FILE__":Couldn't open %s for reading: %s\n",
-			fn,strerror(errno)
+		dprintf_warn(reg,"Couldn't open %s for reading: %s\n",
+		       fn,strerror(errno)
 		);
 		return;
 	}
@@ -885,7 +858,7 @@
 			valfrom = from->values+j;
 			name=valfrom->name;
 			if (name) name=strdupW(name);
-			data=(LPBYTE)malloc(valfrom->len);
+			data=(LPBYTE)xmalloc(valfrom->len);
 			memcpy(data,valfrom->data,valfrom->len);
 
 			_find_or_add_value(
@@ -1033,7 +1006,7 @@
 
 {
   /* Disk Key Header structure (RGDB part) */
-  struct	dkh {
+	struct	dkh {
                 unsigned long		nextkeyoff; 
 		unsigned short		nrLS;
 		unsigned short		nrMS;
@@ -1098,6 +1071,7 @@
 	  return (NULL);
 	}
 
+        assert((dkh.keynamelen<2) || curdata[0]);
 	lpxkey=_find_or_add_key(lpkey,strcvtA2W(curdata, dkh.keynamelen));
 	curdata += dkh.keynamelen;
 
@@ -1194,7 +1168,7 @@
 	OFSTRUCT	ofs;
 	BY_HANDLE_FILE_INFORMATION hfdinfo;
 
-	dprintf_reg(stddeb,"Loading Win95 registry database '%s'\n",fn);
+	dprintf_info(reg,"Loading Win95 registry database '%s'\n",fn);
 	hfd=OpenFile32(fn,&ofs,OF_READ);
 	if (hfd==HFILE_ERROR32)
 		return;
@@ -1214,7 +1188,7 @@
 	if (4!=_lread32(hfd,magic,4))
 		return;
 	if (strcmp(magic,"RGKN")) {
-		dprintf_reg(stddeb,"second IFF header not RGKN, but %s\n",magic);
+		dprintf_warn(reg, "second IFF header not RGKN, but %s\n", magic);
 		return;
 	}
 
@@ -1379,7 +1353,7 @@
 				}
 			}
 		} else {
-			dprintf_reg(stddeb,"__w31_dumptree:strange: no directory key name, idx=%04x\n", idx);
+			dprintf_info(reg,"__w31_dumptree:strange: no directory key name, idx=%04x\n", idx);
 		}
 		__w31_dumptree(dir->child_idx,txt,tab,head,xlpkey,lastmodified,level+1);
 		idx=dir->sibling_idx;
@@ -1405,12 +1379,12 @@
 
 	/* read & dump header */
 	if (sizeof(head)!=_lread32(hf,&head,sizeof(head))) {
-		dprintf_reg(stddeb,"_w31_loadreg:reg.dat is too short.\n");
+		dprintf_err(reg, "_w31_loadreg:reg.dat is too short.\n");
 		_lclose32(hf);
 		return;
 	}
 	if (memcmp(head.cookie, "SHCC3.10", sizeof(head.cookie))!=0) {
-		dprintf_reg(stddeb,"_w31_loadreg:reg.dat has bad signature.\n");
+		dprintf_err(reg, "_w31_loadreg:reg.dat has bad signature.\n");
 		_lclose32(hf);
 		return;
 	}
@@ -1419,7 +1393,7 @@
 	/* read and dump index table */
 	tab = xmalloc(len);
 	if (len!=_lread32(hf,tab,len)) {
-		dprintf_reg(stderr,"_w31_loadreg:couldn't read %d bytes.\n",len); 
+		dprintf_err(reg,"_w31_loadreg:couldn't read %d bytes.\n",len); 
 		free(tab);
 		_lclose32(hf);
 		return;
@@ -1428,14 +1402,14 @@
 	/* read text */
 	txt = xmalloc(head.textsize);
 	if (-1==_llseek32(hf,head.textoff,SEEK_SET)) {
-		dprintf_reg(stderr,"_w31_loadreg:couldn't seek to textblock.\n"); 
+		dprintf_err(reg,"_w31_loadreg:couldn't seek to textblock.\n"); 
 		free(tab);
 		free(txt);
 		_lclose32(hf);
 		return;
 	}
 	if (head.textsize!=_lread32(hf,txt,head.textsize)) {
-		dprintf_reg(stderr,"_w31_loadreg:textblock too short (%d instead of %ld).\n",len,head.textsize); 
+		dprintf_err(reg,"_w31_loadreg:textblock too short (%d instead of %ld).\n",len,head.textsize); 
 		free(tab);
 		free(txt);
 		_lclose32(hf);
@@ -1443,7 +1417,7 @@
 	}
 
 	if (!GetFileInformationByHandle(hf,&hfinfo)) {
-		dprintf_reg(stderr,"_w31_loadreg:GetFileInformationByHandle failed?.\n"); 
+		dprintf_err(reg,"_w31_loadreg:GetFileInformationByHandle failed?.\n"); 
 		free(tab);
 		free(txt);
 		_lclose32(hf);
@@ -1555,7 +1529,7 @@
 	LPKEYSTRUCT	lpNextKey,lpxkey;
 	LPWSTR		*wps;
 	int		wpc,i;
-	dprintf_reg(stddeb,"RegOpenKeyEx32W(%lx,%s,%ld,%lx,%p)\n",
+	dprintf_info(reg,"RegOpenKeyEx32W(%lx,%s,%ld,%lx,%p)\n",
 		(LONG)hkey,W2C(lpszSubKey,0),dwReserved,samDesired,retkey
 	);
 
@@ -1597,7 +1571,7 @@
 	LPCWSTR	lpszSubKey,
 	LPHKEY	retkey
 ) {
-	dprintf_reg(stddeb,"RegOpenKey32W(%lx,%s,%p)\n",
+	dprintf_info(reg,"RegOpenKey32W(%lx,%s,%p)\n",
 		(LONG)hkey,W2C(lpszSubKey,0),retkey
 	);
 	return RegOpenKeyEx32W(hkey,lpszSubKey,0,KEY_ALL_ACCESS,retkey);
@@ -1615,7 +1589,7 @@
 	LPWSTR	lpszSubKeyW;
 	DWORD	ret;
 
-	dprintf_reg(stddeb,"RegOpenKeyEx32A(%lx,%s,%ld,%lx,%p)\n",
+	dprintf_info(reg,"RegOpenKeyEx32A(%lx,%s,%ld,%lx,%p)\n",
 		(LONG)hkey,lpszSubKey,dwReserved,samDesired,retkey
 	);
 	if (lpszSubKey)
@@ -1634,7 +1608,7 @@
 	LPCSTR	lpszSubKey,
 	LPHKEY	retkey
 ) {
-	dprintf_reg(stddeb,"RegOpenKey32A(%lx,%s,%p)\n",
+	dprintf_info(reg,"RegOpenKey32A(%lx,%s,%p)\n",
 		(LONG)hkey,lpszSubKey,retkey
 	);
 	return	RegOpenKeyEx32A(hkey,lpszSubKey,0,KEY_ALL_ACCESS,retkey);
@@ -1646,7 +1620,7 @@
 	LPCSTR	lpszSubKey,
 	LPHKEY	retkey
 ) {
-	dprintf_reg(stddeb,"RegOpenKey16(%lx,%s,%p)\n",
+	dprintf_info(reg,"RegOpenKey16(%lx,%s,%p)\n",
 		(LONG)hkey,lpszSubKey,retkey
 	);
 	return RegOpenKey32A(hkey,lpszSubKey,retkey);
@@ -1682,7 +1656,7 @@
 	int		wpc,i;
 
 /*FIXME: handle security/access/whatever */
-	dprintf_reg(stddeb,"RegCreateKeyEx32W(%lx,%s,%ld,%s,%lx,%lx,%p,%p,%p)\n",
+	dprintf_info(reg,"RegCreateKeyEx32W(%lx,%s,%ld,%s,%lx,%lx,%p,%p,%p)\n",
 		(LONG)hkey,
 		W2C(lpszSubKey,0),
 		dwReserved,
@@ -1778,7 +1752,7 @@
 ) {
 	DWORD	junk,ret;
 
-	dprintf_reg(stddeb,"RegCreateKey32W(%lx,%s,%p)\n",
+	dprintf_info(reg,"RegCreateKey32W(%lx,%s,%p)\n",
 		(LONG)hkey,W2C(lpszSubKey,0),retkey
 	);
 	ret=RegCreateKeyEx32W(
@@ -1810,7 +1784,7 @@
 	LPWSTR	lpszSubKeyW,lpszClassW;
 	DWORD	ret;
 
-	dprintf_reg(stddeb,"RegCreateKeyEx32A(%lx,%s,%ld,%s,%lx,%lx,%p,%p,%p)\n",
+	dprintf_info(reg,"RegCreateKeyEx32A(%lx,%s,%ld,%s,%lx,%lx,%p,%p,%p)\n",
 		(LONG)hkey,
 		lpszSubKey,
 		dwReserved,
@@ -1855,7 +1829,7 @@
 ) {
 	DWORD	junk;
 
-	dprintf_reg(stddeb,"RegCreateKey32A(%lx,%s,%p)\n",
+	dprintf_info(reg,"RegCreateKey32A(%lx,%s,%p)\n",
 		(LONG)hkey,lpszSubKey,retkey
 	);
 	return	RegCreateKeyEx32A(
@@ -1877,7 +1851,7 @@
 	LPCSTR	lpszSubKey,
 	LPHKEY	retkey
 ) {
-	dprintf_reg(stddeb,"RegCreateKey16(%lx,%s,%p)\n",
+	dprintf_info(reg,"RegCreateKey16(%lx,%s,%p)\n",
 		(LONG)hkey,lpszSubKey,retkey
 	);
 	return RegCreateKey32A(hkey,lpszSubKey,retkey);
@@ -1907,7 +1881,7 @@
 	LPKEYSTRUCT	lpkey;
 	int		i;
 
-	dprintf_reg(stddeb,"RegQueryValueEx32W(%x,%s,%p,%p,%p,%ld)\n",
+	dprintf_info(reg,"RegQueryValueEx32W(%x,%s,%p,%p,%p,%ld)\n",
 		hkey,W2C(lpszValueName,0),lpdwReserved,lpdwType,lpbData,
 		lpcbData?*lpcbData:0
 	);
@@ -1969,7 +1943,7 @@
 	HKEY	xhkey;
 	DWORD	ret,lpdwType;
 
-	dprintf_reg(stddeb,"RegQueryValue32W(%x,%s,%p,%ld)\n->",
+	dprintf_info(reg,"RegQueryValue32W(%x,%s,%p,%ld)\n",
 		hkey,W2C(lpszSubKey,0),lpszData,
 		lpcbData?*lpcbData:0
 	);
@@ -2011,7 +1985,7 @@
 	DWORD	*mylen;
 	DWORD	type;
 
-	dprintf_reg(stddeb,"RegQueryValueEx32A(%x,%s,%p,%p,%p,%ld)\n->",
+	dprintf_info(reg,"RegQueryValueEx32A(%x,%s,%p,%p,%p,%ld)\n",
 		hkey,lpszValueName,lpdwReserved,lpdwType,lpbData,
 		lpcbData?*lpcbData:0
 	);
@@ -2096,7 +2070,7 @@
 	LPBYTE	lpbData,
 	LPDWORD	lpcbData
 ) {
-	dprintf_reg(stddeb,"RegQueryValueEx16(%x,%s,%p,%p,%p,%ld)\n",
+	dprintf_info(reg,"RegQueryValueEx16(%x,%s,%p,%p,%p,%ld)\n",
 		hkey,lpszValueName,lpdwReserved,lpdwType,lpbData,
 		lpcbData?*lpcbData:0
 	);
@@ -2120,7 +2094,7 @@
 	HKEY	xhkey;
 	DWORD	ret,lpdwType;
 
-	dprintf_reg(stddeb,"RegQueryValue32A(%x,%s,%p,%ld)\n",
+	dprintf_info(reg,"RegQueryValue32A(%x,%s,%p,%ld)\n",
 		hkey,lpszSubKey,lpszData,
 		lpcbData?*lpcbData:0
 	);
@@ -2154,7 +2128,7 @@
 	LPSTR	lpszData,
 	LPDWORD	lpcbData
 ) {
-	dprintf_reg(stddeb,"RegQueryValue16(%x,%s,%p,%ld)\n",
+	dprintf_info(reg,"RegQueryValue16(%x,%s,%p,%ld)\n",
 		hkey,lpszSubKey,lpszData,lpcbData?*lpcbData:0
 	);
 	/* HACK: the 16bit RegQueryValue doesn't handle selectorblocks
@@ -2186,7 +2160,7 @@
 	LPKEYSTRUCT	lpkey;
 	int		i;
 
-	dprintf_reg(stddeb,"RegSetValueEx32W(%x,%s,%ld,%ld,%p,%ld)\n",
+	dprintf_info(reg,"RegSetValueEx32W(%x,%s,%ld,%ld,%p,%ld)\n",
 		hkey,W2C(lpszValueName,0),dwReserved,dwType,lpbData,cbData
 	);
 	/* we no longer care about the lpbData type here... */
@@ -2243,7 +2217,7 @@
 	LPWSTR	lpszValueNameW;
 	DWORD	ret;
 
-	dprintf_reg(stddeb,"RegSetValueEx32A(%x,%s,%ld,%ld,%p,%ld)\n->",
+	dprintf_info(reg,"RegSetValueEx32A(%x,%s,%ld,%ld,%p,%ld)\n",
 		hkey,lpszValueName,dwReserved,dwType,lpbData,cbData
 	);
 	if ((1<<dwType) & UNICONVMASK) {
@@ -2272,7 +2246,7 @@
 	LPBYTE	lpbData,
 	DWORD	cbData
 ) {
-	dprintf_reg(stddeb,"RegSetValueEx16(%x,%s,%ld,%ld,%p,%ld)\n->",
+	dprintf_info(reg,"RegSetValueEx16(%x,%s,%ld,%ld,%p,%ld)\n",
 		hkey,lpszValueName,dwReserved,dwType,lpbData,cbData
 	);
 	return RegSetValueEx32A(hkey,lpszValueName,dwReserved,dwType,lpbData,cbData);
@@ -2289,7 +2263,7 @@
 	HKEY	xhkey;
 	DWORD	ret;
 
-	dprintf_reg(stddeb,"RegSetValue32W(%x,%s,%ld,%s,%ld)\n->",
+	dprintf_info(reg,"RegSetValue32W(%x,%s,%ld,%s,%ld)\n",
 		hkey,W2C(lpszSubKey,0),dwType,W2C(lpszData,0),cbData
 	);
 	if (lpszSubKey && *lpszSubKey) {
@@ -2303,7 +2277,7 @@
 		dwType=REG_SZ;
 	}
 	if (cbData!=2*lstrlen32W(lpszData)+2) {
-		dprintf_reg(stddeb,"RegSetValueX called with len=%ld != strlen(%s)+1=%d!\n",
+		dprintf_info(reg,"RegSetValueX called with len=%ld != strlen(%s)+1=%d!\n",
 			cbData,W2C(lpszData,0),2*lstrlen32W(lpszData)+2
 		);
 		cbData=2*lstrlen32W(lpszData)+2;
@@ -2325,7 +2299,7 @@
 	DWORD	ret;
 	HKEY	xhkey;
 
-	dprintf_reg(stddeb,"RegSetValue32A(%x,%s,%ld,%s,%ld)\n->",
+	dprintf_info(reg,"RegSetValue32A(%x,%s,%ld,%s,%ld)\n",
 		hkey,lpszSubKey,dwType,lpszData,cbData
 	);
 	if (lpszSubKey && *lpszSubKey) {
@@ -2336,7 +2310,7 @@
 		xhkey=hkey;
 
 	if (dwType!=REG_SZ) {
-		dprintf_reg(stddeb,"RegSetValueA called with dwType=%ld!\n",dwType);
+		dprintf_info(reg,"RegSetValueA called with dwType=%ld!\n",dwType);
 		dwType=REG_SZ;
 	}
 	if (cbData!=strlen(lpszData)+1)
@@ -2356,7 +2330,7 @@
 	DWORD	cbData
 ) {
 	DWORD	ret;
-	dprintf_reg(stddeb,"RegSetValue16(%x,%s,%ld,%s,%ld)\n->",
+	dprintf_info(reg,"RegSetValue16(%x,%s,%ld,%s,%ld)\n",
 		hkey,lpszSubKey,dwType,lpszData,cbData
 	);
 	ret=RegSetValue32A(hkey,lpszSubKey,dwType,lpszData,cbData);
@@ -2384,7 +2358,7 @@
 ) {
 	LPKEYSTRUCT	lpkey,lpxkey;
 
-	dprintf_reg(stddeb,"RegEnumKeyEx32W(%x,%ld,%p,%ld,%p,%p,%p,%p)\n",
+	dprintf_info(reg,"RegEnumKeyEx32W(%x,%ld,%p,%ld,%p,%p,%p,%p)\n",
 		hkey,iSubkey,lpszName,*lpcchName,lpdwReserved,lpszClass,lpcchClass,ft
 	);
 	lpkey=lookup_hkey(hkey);
@@ -2420,7 +2394,7 @@
 ) {
 	FILETIME	ft;
 
-	dprintf_reg(stddeb,"RegEnumKey32W(%x,%ld,%p,%ld)\n->",
+	dprintf_info(reg,"RegEnumKey32W(%x,%ld,%p,%ld)\n",
 		hkey,iSubkey,lpszName,lpcchName
 	);
 	return RegEnumKeyEx32W(hkey,iSubkey,lpszName,&lpcchName,NULL,NULL,NULL,&ft);
@@ -2440,7 +2414,7 @@
 	LPWSTR	lpszNameW,lpszClassW;
 
 
-	dprintf_reg(stddeb,"RegEnumKeyEx32A(%x,%ld,%p,%ld,%p,%p,%p,%p)\n->",
+	dprintf_info(reg,"RegEnumKeyEx32A(%x,%ld,%p,%ld,%p,%p,%p,%p)\n",
 		hkey,iSubkey,lpszName,*lpcchName,lpdwReserved,lpszClass,lpcchClass,ft
 	);
 	if (lpszName) {
@@ -2491,7 +2465,7 @@
 ) {
 	FILETIME	ft;
 
-	dprintf_reg(stddeb,"RegEnumKey32A(%x,%ld,%p,%ld)\n->",
+	dprintf_info(reg,"RegEnumKey32A(%x,%ld,%p,%ld)\n",
 		hkey,iSubkey,lpszName,lpcchName
 	);
 	return	RegEnumKeyEx32A(
@@ -2513,7 +2487,7 @@
 	LPSTR	lpszName,
 	DWORD	lpcchName
 ) {
-	dprintf_reg(stddeb,"RegEnumKey16(%x,%ld,%p,%ld)\n->",
+	dprintf_info(reg,"RegEnumKey16(%x,%ld,%p,%ld)\n",
 		hkey,iSubkey,lpszName,lpcchName
 	);
 	return RegEnumKey32A(hkey,iSubkey,lpszName,lpcchName);
@@ -2540,7 +2514,7 @@
 	LPKEYSTRUCT	lpkey;
 	LPKEYVALUE	val;
 
-	dprintf_reg(stddeb,"RegEnumValue32W(%x,%ld,%p,%p,%p,%p,%p,%p)\n",
+	dprintf_info(reg,"RegEnumValue32W(%x,%ld,%p,%p,%p,%p,%p,%p)\n",
 		hkey,iValue,lpszValue,lpcchValue,lpdReserved,lpdwType,lpbData,lpcbData
 	);
 	lpkey = lookup_hkey(hkey);
@@ -2587,7 +2561,7 @@
 	LPBYTE	lpbDataW;
 	DWORD	ret,lpcbDataW;
 
-	dprintf_reg(stddeb,"RegEnumValue32A(%x,%ld,%p,%p,%p,%p,%p,%p)\n",
+	dprintf_info(reg,"RegEnumValue32A(%x,%ld,%p,%p,%p,%p,%p,%p)\n",
 		hkey,iValue,lpszValue,lpcchValue,lpdReserved,lpdwType,lpbData,lpcbData
 	);
 
@@ -2640,7 +2614,7 @@
 	LPBYTE	lpbData,
 	LPDWORD	lpcbData
 ) {
-	dprintf_reg(stddeb,"RegEnumValue(%x,%ld,%p,%p,%p,%p,%p,%p)\n",
+	dprintf_info(reg,"RegEnumValue(%x,%ld,%p,%p,%p,%p,%p,%p)\n",
 		hkey,iValue,lpszValue,lpcchValue,lpdReserved,lpdwType,lpbData,lpcbData
 	);
 	return RegEnumValue32A(
@@ -2660,7 +2634,7 @@
  */
 /* RegCloseKey			[SHELL.3] [KERNEL.220] [ADVAPI32.126] */
 DWORD WINAPI RegCloseKey(HKEY hkey) {
-	dprintf_reg(stddeb,"RegCloseKey(%x)\n",hkey);
+	dprintf_info(reg,"RegCloseKey(%x)\n",hkey);
 	remove_handle(hkey);
 	return ERROR_SUCCESS;
 }
@@ -2676,17 +2650,17 @@
 	LPWSTR		*wps;
 	int		wpc,i;
 
-	dprintf_reg(stddeb,"RegDeleteKey32W(%x,%s)\n",
+	dprintf_info(reg,"RegDeleteKey32W(%x,%s)\n",
 		hkey,W2C(lpszSubKey,0)
 	);
 	lpNextKey	= lookup_hkey(hkey);
 	if (!lpNextKey) {
-		dprintf_reg (stddeb, "  Badkey[1].\n");
+		dprintf_info(reg, "  Badkey[1].\n");
 		return SHELL_ERROR_BADKEY;
 	}
 	/* we need to know the previous key in the hier. */
 	if (!lpszSubKey || !*lpszSubKey) {
-		dprintf_reg (stddeb, "  Badkey[2].\n");
+		dprintf_info(reg, "  Badkey[2].\n");
 		return SHELL_ERROR_BADKEY;
 	}
 	split_keypath(lpszSubKey,&wps,&wpc);
@@ -2695,7 +2669,7 @@
 	while (i<wpc-1) {
 		lpxkey=lpNextKey->nextsub;
 		while (lpxkey) {
-			dprintf_reg (stddeb, "  Scanning [%s]\n",
+			dprintf_info(reg, "  Scanning [%s]\n",
 				     W2C (lpxkey->keyname, 0));
 			if (!lstrcmpi32W(wps[i],lpxkey->keyname))
 				break;
@@ -2703,7 +2677,7 @@
 		}
 		if (!lpxkey) {
 			FREE_KEY_PATH;
-			dprintf_reg (stddeb, "  Not found.\n");
+			dprintf_info(reg, "  Not found.\n");
 			/* not found is success */
 			return SHELL_ERROR_SUCCESS;
 		}
@@ -2713,7 +2687,7 @@
 	lpxkey	= lpNextKey->nextsub;
 	lplpPrevKey = &(lpNextKey->nextsub);
 	while (lpxkey) {
-		dprintf_reg (stddeb, "  Scanning [%s]\n",
+		dprintf_info(reg, "  Scanning [%s]\n",
 			     W2C (lpxkey->keyname, 0));
 		if (!lstrcmpi32W(wps[i],lpxkey->keyname))
 			break;
@@ -2722,13 +2696,12 @@
 	}
 	if (!lpxkey) {
 		FREE_KEY_PATH;
-		dprintf_reg (stddeb, "  Not found.\n");
+		dprintf_warn(reg , "  Not found.\n");
 		return SHELL_ERROR_BADKEY;
-		return SHELL_ERROR_SUCCESS;
 	}
 	if (lpxkey->nextsub) {
 		FREE_KEY_PATH;
-		dprintf_reg (stddeb, "  Not empty.\n");
+		dprintf_warn(reg , "  Not empty.\n");
 		return SHELL_ERROR_CANTWRITE;
 	}
 	*lplpPrevKey	= lpxkey->next;
@@ -2739,7 +2712,7 @@
 		free(lpxkey->values);
 	free(lpxkey);
 	FREE_KEY_PATH;
-	dprintf_reg (stddeb, "  Done.\n");
+	dprintf_info(reg, "  Done.\n");
 	return	SHELL_ERROR_SUCCESS;
 }
 
@@ -2748,7 +2721,7 @@
 	LPWSTR	lpszSubKeyW;
 	DWORD	ret;
 
-	dprintf_reg(stddeb,"RegDeleteKey32A(%x,%s)\n",
+	dprintf_info(reg,"RegDeleteKey32A(%x,%s)\n",
 		hkey,lpszSubKey
 	);
 	lpszSubKeyW=HEAP_strdupAtoW(GetProcessHeap(),0,lpszSubKey);
@@ -2759,7 +2732,7 @@
 
 /* RegDeleteKey			[SHELL.4] [KERNEL.219] */
 DWORD WINAPI RegDeleteKey16(HKEY hkey,LPCSTR lpszSubKey) {
-	dprintf_reg(stddeb,"RegDeleteKey16(%x,%s)\n",
+	dprintf_info(reg,"RegDeleteKey16(%x,%s)\n",
 		hkey,lpszSubKey
 	);
 	return RegDeleteKey32A(hkey,lpszSubKey);
@@ -2778,7 +2751,7 @@
 	LPKEYSTRUCT	lpkey;
 	LPKEYVALUE	val;
 
-	dprintf_reg(stddeb,"RegDeleteValue32W(%x,%s)\n",
+	dprintf_info(reg,"RegDeleteValue32W(%x,%s)\n",
 		hkey,W2C(lpszValue,0)
 	);
 	lpkey=lookup_hkey(hkey);
@@ -2819,7 +2792,7 @@
 	LPWSTR	lpszValueW;
 	DWORD	ret;
 
-	dprintf_reg( stddeb, "RegDeleteValue32A(%x,%s)\n", hkey,lpszValue );
+	dprintf_info(reg, "RegDeleteValue32A(%x,%s)\n", hkey,lpszValue );
         lpszValueW=HEAP_strdupAtoW(GetProcessHeap(),0,lpszValue);
 	ret=RegDeleteValue32W(hkey,lpszValueW);
         HeapFree(GetProcessHeap(),0,lpszValueW);
@@ -2829,14 +2802,14 @@
 /* RegDeleteValue		[KERNEL.222] */
 DWORD WINAPI RegDeleteValue16(HKEY hkey,LPSTR lpszValue)
 {
-	dprintf_reg( stddeb,"RegDeleteValue16(%x,%s)\n", hkey,lpszValue );
+	dprintf_info(reg,"RegDeleteValue16(%x,%s)\n", hkey,lpszValue );
 	return RegDeleteValue32A(hkey,lpszValue);
 }
 
 /* RegFlushKey			[ADVAPI32.143] [KERNEL.227] */
 DWORD WINAPI RegFlushKey(HKEY hkey)
 {
-	dprintf_reg(stddeb,"RegFlushKey(%x), STUB.\n",hkey);
+	dprintf_fixme(reg, "RegFlushKey(%x), STUB.\n", hkey);
 	return SHELL_ERROR_SUCCESS;
 }
 
@@ -2861,7 +2834,7 @@
 	int		nrofkeys,maxsubkey,maxclass,maxvalues,maxvname,maxvdata;
 	int		i;
 
-	dprintf_reg(stddeb,"RegQueryInfoKey32W(%x,......)\n",hkey);
+	dprintf_info(reg,"RegQueryInfoKey32W(%x,......)\n",hkey);
 	lpkey=lookup_hkey(hkey);
 	if (!lpkey)
 		return SHELL_ERROR_BADKEY;
@@ -2936,7 +2909,7 @@
 	LPWSTR		lpszClassW;
 	DWORD		ret;
 
-	dprintf_reg(stddeb,"RegQueryInfoKey32A(%x,......)\n",hkey);
+	dprintf_info(reg,"RegQueryInfoKey32A(%x,......)\n",hkey);
 	if (lpszClass) {
 		*lpcchClass*= 2;
 		lpszClassW  = (LPWSTR)xmalloc(*lpcchClass);
diff --git a/misc/shell.c b/misc/shell.c
index 7007c23..69f12aa 100644
--- a/misc/shell.c
+++ b/misc/shell.c
@@ -22,7 +22,6 @@
 #include "interfaces.h"
 #include "sysmetrics.h"
 #include "shlobj.h"
-#include "stddebug.h"
 #include "debug.h"
 #include "debugstr.h"
 #include "winreg.h"
@@ -34,6 +33,7 @@
     "Martin Ayotte",
     "Karl Backstr\366m",
     "Peter Bajusz",
+    "Marcel Baur",
     "Georg Beyerle",
     "Ross Biro",
     "Martin Boehme",
@@ -222,7 +222,7 @@
     LPSTR lpCurrent;
     WORD  i;
     
-    dprintf_reg(stddeb,"DragQueryFile(%04x, %i, %p, %u)\n",
+    dprintf_info(reg,"DragQueryFile(%04x, %i, %p, %u)\n",
 		hDrop,wFile,lpszFile,wLength);
     
     lpDropFileStruct = (LPDROPFILESTRUCT) GlobalLock16(hDrop); 
@@ -296,7 +296,7 @@
     int i;                  /* random counter */
     char xlpFile[256];      /* result of SearchPath */
 
-    dprintf_exec(stddeb, "SHELL_FindExecutable: %s\n",
+    dprintf_info(exec, "SHELL_FindExecutable: %s\n",
                  (lpFile != NULL?lpFile:"-") );
     lpResult[0]='\0'; /* Start off with an empty return string */
 
@@ -322,7 +322,7 @@
     /* Make local copy & lowercase it for reg & 'programs=' lookup */
     lstrcpyn32A( tmpext, extension, 5 );
     CharLower32A( tmpext );
-    dprintf_exec(stddeb, "SHELL_FindExecutable: %s file\n", tmpext);
+    dprintf_info(exec, "SHELL_FindExecutable: %s file\n", tmpext);
     
     /* Three places to check: */
     /* 1. win.ini, [windows], programs (NB no leading '.') */
@@ -348,7 +348,7 @@
 				strcpy(lpResult, xlpFile);
 				/* Need to perhaps check that the file has a path
 				 * attached */
-				dprintf_exec(stddeb, "SHELL_FindExecutable: found %s\n",
+				dprintf_info(exec, "SHELL_FindExecutable: found %s\n",
 							 lpResult);
                                 return 33;
 
@@ -366,7 +366,7 @@
                          &filetypelen ) == SHELL_ERROR_SUCCESS )
     {
 	filetype[filetypelen]='\0';
-	dprintf_exec(stddeb, "SHELL_FindExecutable: File type: %s\n",
+	dprintf_info(exec, "SHELL_FindExecutable: File type: %s\n",
 		     filetype);
 
 	/* Looking for ...buffer\shell\lpOperation\command */
@@ -420,7 +420,7 @@
 	  }
 	}
 
-    dprintf_exec(stddeb, "SHELL_FindExecutable: returning %s\n", lpResult);
+    dprintf_info(exec, "SHELL_FindExecutable: returning %s\n", lpResult);
     return retval;
 }
 
@@ -435,7 +435,7 @@
     char old_dir[1024];
     char cmd[256];
 
-    dprintf_exec(stddeb, "ShellExecute(%04x,'%s','%s','%s','%s',%x)\n",
+    dprintf_info(exec, "ShellExecute(%04x,'%s','%s','%s','%s',%x)\n",
 		hWnd, lpOperation ? lpOperation:"<null>", lpFile ? lpFile:"<null>",
 		lpParameters ? lpParameters : "<null>", 
 		lpDirectory ? lpDirectory : "<null>", iShowCmd);
@@ -460,7 +460,7 @@
             strcat(cmd,lpParameters);
         }
 
-        dprintf_exec(stddeb,"ShellExecute:starting %s\n",cmd);
+        dprintf_info(exec,"ShellExecute:starting %s\n",cmd);
         retval = WinExec32( cmd, iShowCmd );
     }
     if (lpDirectory) SetCurrentDirectory32A( old_dir );
@@ -498,7 +498,7 @@
     HINSTANCE32 retval=31;    /* default - 'No association was found' */
     char old_dir[1024];
 
-    dprintf_exec(stddeb, "FindExecutable: File %s, Dir %s\n", 
+    dprintf_info(exec, "FindExecutable: File %s, Dir %s\n", 
 		 (lpFile != NULL?lpFile:"-"), 
 		 (lpDirectory != NULL?lpDirectory:"-"));
 
@@ -519,7 +519,7 @@
 
     retval = SHELL_FindExecutable( lpFile, "open", lpResult );
 
-    dprintf_exec(stddeb, "FindExecutable: returning %s\n", lpResult);
+    dprintf_info(exec, "FindExecutable: returning %s\n", lpResult);
     if (lpDirectory) SetCurrentDirectory32A( old_dir );
     return retval;
 }
@@ -931,7 +931,7 @@
   HFILE32 	hFile = OpenFile32( lpszExeFileName, &ofs, OF_READ );
   UINT16	iconDirCount = 0,iconCount = 0;
   
-  dprintf_reg(stddeb,"InternalExtractIcon(%04x,file %s,start %d,extract %d\n", 
+  dprintf_info(reg,"InternalExtractIcon(%04x,file %s,start %d,extract %d\n", 
 		       hInstance, lpszExeFileName, nIconIndex, n);
 
   if( hFile == HFILE_ERROR32 || !n ) return 0;
@@ -966,13 +966,13 @@
 	  {
 	     iconDirCount = pTInfo->count;
 	     pIconDir = ((NE_NAMEINFO*)(pTInfo + 1));
-	     dprintf_reg(stddeb,"\tfound directory - %i icon families\n", iconDirCount);
+	     dprintf_info(reg,"\tfound directory - %i icon families\n", iconDirCount);
 	  }
 	if( pTInfo->type_id == NE_RSCTYPE_ICON ) 
 	  { 
 	     iconCount = pTInfo->count;
 	     pIconStorage = ((NE_NAMEINFO*)(pTInfo + 1));
-	     dprintf_reg(stddeb,"\ttotal icons - %i\n", iconCount);
+	     dprintf_info(reg,"\ttotal icons - %i\n", iconCount);
 	  }
   	pTInfo = (NE_TYPEINFO *)((char*)(pTInfo+1)+pTInfo->count*sizeof(NE_NAMEINFO));
     }
@@ -1323,7 +1323,7 @@
 
   CharToOem32A(str,str);
 
-  dprintf_reg(stddeb,"DoEnvSubst: accept %s", str);
+  dprintf_info(reg,"DoEnvSubst: accept %s\n", str);
 
   while( *lpstr && lpbstr - lpBuffer < length )
    {
@@ -1372,7 +1372,7 @@
   else
       length = 0;
 
-  dprintf_reg(stddeb," return %s\n", str);
+  dprintf_info(reg,"    return %s\n", str);
 
   OemToChar32A(str,str);
   HeapFree( GetProcessHeap(), 0, lpBuffer);
@@ -1389,7 +1389,7 @@
  */
 LRESULT WINAPI ShellHookProc(INT16 code, WPARAM16 wParam, LPARAM lParam)
 {
-    dprintf_reg(stddeb,"ShellHookProc: %i, %04x, %08x\n", code, wParam, 
+    dprintf_info(reg,"ShellHookProc: %i, %04x, %08x\n", code, wParam, 
 						      (unsigned)lParam );
     if( SHELL_hHook && SHELL_hWnd )
     {
@@ -1416,7 +1416,7 @@
  */
 BOOL32 WINAPI RegisterShellHook(HWND16 hWnd, UINT16 uAction)
 {
-    dprintf_reg(stddeb,"RegisterShellHook: %04x [%u]\n", hWnd, uAction );
+    dprintf_info(reg,"RegisterShellHook: %04x [%u]\n", hWnd, uAction );
 
     switch( uAction )
     {
@@ -1547,7 +1547,7 @@
 
 void WINAPI Control_RunDLL (HWND32 hwnd, LPCVOID code, LPCSTR cmd, DWORD arg4)
 {
-  dprintf_exec (stddeb, "Control_RunDLL (%08x, %p, \"%s\", %08lx)\n",
+  dprintf_info(exec, "Control_RunDLL (%08x, %p, \"%s\", %08lx)\n",
 		hwnd,
 		code ? code : "(null)",
 		cmd ? cmd : "(null)",
@@ -1573,8 +1573,8 @@
     HRESULT	hres = E_OUTOFMEMORY;
 
 
-    StringFromCLSID((LPCLSID)rclsid,xclsid);
-    StringFromCLSID((LPCLSID)iid,xiid);
+    WINE_StringFromCLSID((LPCLSID)rclsid,xclsid);
+    WINE_StringFromCLSID((LPCLSID)iid,xiid);
     fprintf(stderr,"SHELL32_DllGetClassObject(%s,%s,%p)\n",xclsid,xiid,ppv);
 
     *ppv = NULL;
@@ -1633,10 +1633,9 @@
  * What we are currently doing is not very wrong, since we always use the same
  * heap (ProcessHeap).
  */
-DWORD WINAPI SHGetMalloc(LPMALLOC *lpmal) {
+DWORD WINAPI SHGetMalloc(LPMALLOC32 *lpmal) {
 	fprintf(stderr,"SHGetMalloc()\n");
-	*lpmal = IMalloc_Constructor();
-	return NOERROR;
+	return CoGetMalloc32(0,lpmal);
 }
 
 /*************************************************************************
diff --git a/misc/shellord.c b/misc/shellord.c
index 1d4f857..9eda433 100644
--- a/misc/shellord.c
+++ b/misc/shellord.c
@@ -27,7 +27,6 @@
 #include "cursoricon.h"
 #include "interfaces.h"
 #include "shlobj.h"
-#include "stddebug.h"
 #include "debug.h"
 #include "winreg.h"
 
@@ -470,10 +469,10 @@
 	DWORD	pathlen,type,tmodellen;
 	DWORD	hres;
 	
-	StringFromCLSID(refiid,xiid);
+	WINE_StringFromCLSID(refiid,xiid);
 
 	if (clsid)
-		StringFromCLSID(clsid,xclsid);
+		WINE_StringFromCLSID(clsid,xclsid);
 	else {
 		if (!aclsid)
 		    return 0x80040154;
@@ -524,7 +523,7 @@
 	fprintf(stderr,"SHELL32_183(%08lx,%08lx,%08lx(%s),%08lx(%s),%08lx,%p),stub!\n",
 		(DWORD)hmod,(DWORD)hwnd,id,buf2,x,buf,type,arglist
 	);
-	MessageBox32A(hwnd,buf3,buf,id|0x10000);
+	/*MessageBox32A(hwnd,buf3,buf,id|0x10000);*/
 }
 
 
diff --git a/misc/spy.c b/misc/spy.c
index 45f368b..9a6b3fb 100644
--- a/misc/spy.c
+++ b/misc/spy.c
@@ -12,7 +12,6 @@
 #include "win.h"
 #include "module.h"
 #include "options.h"
-#include "stddebug.h"
 #include "debug.h"
 #include "spy.h"
 
@@ -643,21 +642,21 @@
 {
     LPCSTR pname;
 
-    if (!debugging_message || SPY_EXCLUDE(msg)) return;
+    if (!debugging_info(message) || SPY_EXCLUDE(msg)) return;
 
     /* each SPY_SENDMESSAGE must be complemented by call to SPY_ExitMessage */
     switch(iFlag)
     {
     case SPY_DISPATCHMESSAGE16:
 	pname = SPY_GetWndName(hWnd);
-        dprintf_message(stddeb,"%*s(%04x) %-16s message [%04x] %s dispatched  wp=%04x lp=%08lx\n",
+        dprintf_info(message,"%*s(%04x) %-16s message [%04x] %s dispatched  wp=%04x lp=%08lx\n",
                         SPY_IndentLevel, "", hWnd, pname, msg, SPY_GetMsgName( msg ),
                         wParam, lParam);
         break;
 
     case SPY_DISPATCHMESSAGE32:
 	pname = SPY_GetWndName(hWnd);
-        dprintf_message(stddeb,"%*s(%08x) %-16s message [%04x] %s dispatched  wp=%08x lp=%08lx\n",
+        dprintf_info(message,"%*s(%08x) %-16s message [%04x] %s dispatched  wp=%08x lp=%08lx\n",
                         SPY_IndentLevel, "", hWnd, pname, msg, SPY_GetMsgName( msg ),
                         wParam, lParam);
         break;
@@ -675,12 +674,12 @@
 	    pname = SPY_GetWndName(hWnd);
 
             if (iFlag == SPY_SENDMESSAGE16)
-                dprintf_message(stddeb,
+                dprintf_info(message,
 				"%*s(%04x) %-16s message [%04x] %s sent from %s wp=%04x lp=%08lx\n",
                                 SPY_IndentLevel, "", hWnd, pname, msg, SPY_GetMsgName( msg ), 
 				taskName, wParam, lParam );
             else
-                dprintf_message(stddeb,
+                dprintf_info(message,
 				"%*s(%08x) %-16s message [%04x] %s sent from %s wp=%08x lp=%08lx\n",
                                 SPY_IndentLevel, "", hWnd, pname, msg, SPY_GetMsgName( msg ), 
 				taskName, wParam, lParam );
@@ -689,14 +688,14 @@
 
     case SPY_DEFWNDPROC16:
 	if( SPY_ExcludeDWP ) return;
-        dprintf_message(stddeb, "%*s(%04x)  DefWindowProc16: %s [%04x]  wp=%04x lp=%08lx\n",
+        dprintf_info(message, "%*s(%04x)  DefWindowProc16: %s [%04x]  wp=%04x lp=%08lx\n",
                         SPY_IndentLevel, "", hWnd, SPY_GetMsgName( msg ),
                         msg, wParam, lParam );
         break;
 
     case SPY_DEFWNDPROC32:
 	if( SPY_ExcludeDWP ) return;
-        dprintf_message(stddeb, "%*s(%08x)  DefWindowProc32: %s [%04x]  wp=%08x lp=%08lx\n",
+        dprintf_info(message, "%*s(%08x)  DefWindowProc32: %s [%04x]  wp=%08x lp=%08lx\n",
                         SPY_IndentLevel, "", hWnd, SPY_GetMsgName( msg ),
                         msg, wParam, lParam );
         break;
@@ -712,7 +711,7 @@
 {
     LPCSTR pname;
 
-    if (!debugging_message || SPY_EXCLUDE(msg) ||
+    if (!debugging_info(message) || SPY_EXCLUDE(msg) ||
 	(SPY_ExcludeDWP && (iFlag == SPY_RESULT_DEFWND16 || iFlag == SPY_RESULT_DEFWND32)) )
 	return;
 
@@ -721,39 +720,39 @@
     switch(iFlag)
     {
     case SPY_RESULT_DEFWND16:
-	dprintf_message(stddeb,"%*s(%04x)  DefWindowProc16: %s [%04x] returned %08lx\n",
+	dprintf_info(message,"%*s(%04x)  DefWindowProc16: %s [%04x] returned %08lx\n",
 			SPY_IndentLevel, "", hWnd, SPY_GetMsgName( msg ), msg, lReturn );
 	break;
 
     case SPY_RESULT_DEFWND32:
-	dprintf_message(stddeb,"%*s(%08x)  DefWindowProc32: %s [%04x] returned %08lx\n",
+	dprintf_info(message,"%*s(%08x)  DefWindowProc32: %s [%04x] returned %08lx\n",
 			SPY_IndentLevel, "", hWnd, SPY_GetMsgName( msg ), msg, lReturn );
 	break;
 
     case SPY_RESULT_OK16:
 	pname = SPY_GetWndName(hWnd);
-        dprintf_message(stddeb,"%*s(%04x) %-16s message [%04x] %s returned %08lx\n",
+        dprintf_info(message,"%*s(%04x) %-16s message [%04x] %s returned %08lx\n",
                         SPY_IndentLevel, "", hWnd, pname, msg,
                         SPY_GetMsgName( msg ), lReturn );
         break;
 
     case SPY_RESULT_OK32:
 	pname = SPY_GetWndName(hWnd);
-        dprintf_message(stddeb,"%*s(%08x) %-16s message [%04x] %s returned %08lx\n",
+        dprintf_info(message,"%*s(%08x) %-16s message [%04x] %s returned %08lx\n",
                         SPY_IndentLevel, "", hWnd, pname, msg,
                         SPY_GetMsgName( msg ), lReturn );
         break; 
 
     case SPY_RESULT_INVALIDHWND16:
 	pname = SPY_GetWndName(hWnd);
-        dprintf_message(stddeb,"%*s(%04x) %-16s message [%04x] %s HAS INVALID HWND\n",
+        dprintf_warn(message, "%*s(%04x) %-16s message [%04x] %s HAS INVALID HWND\n",
                         SPY_IndentLevel, "", hWnd, pname, msg,
                         SPY_GetMsgName( msg ) );
         break;
 
     case SPY_RESULT_INVALIDHWND32:
 	pname = SPY_GetWndName(hWnd);
-        dprintf_message(stddeb,"%*s(%08x) %-16s message [%04x] %s HAS INVALID HWND\n",
+        dprintf_warn(message, "%*s(%08x) %-16s message [%04x] %s HAS INVALID HWND\n",
                         SPY_IndentLevel, "", hWnd, pname, msg,
                         SPY_GetMsgName( msg ) );
         break;
@@ -769,12 +768,12 @@
     int i;
     char buffer[1024];
 
-    if (!debugging_message) return TRUE;
+    if (!debugging_info(message)) return TRUE;
 
     PROFILE_GetWineIniString( "Spy", "Include", "", buffer, sizeof(buffer) );
     if (buffer[0] && strcmp( buffer, "INCLUDEALL" ))
     {
-        dprintf_message( stddeb, "SpyInit: Include=%s\n", buffer );
+        dprintf_info(message, "SpyInit: Include=%s\n", buffer );
         for (i = 0; i <= SPY_MAX_MSGNUM; i++)
             SPY_Exclude[i] = (MessageTypeNames[i] && !strstr(buffer,MessageTypeNames[i]));
     }
@@ -782,7 +781,7 @@
     PROFILE_GetWineIniString( "Spy", "Exclude", "", buffer, sizeof(buffer) );
     if (buffer[0])
     {
-        dprintf_message( stddeb, "SpyInit: Exclude=%s\n", buffer );
+        dprintf_info(message, "SpyInit: Exclude=%s\n", buffer );
         if (!strcmp( buffer, "EXCLUDEALL" ))
             for (i = 0; i <= SPY_MAX_MSGNUM; i++) SPY_Exclude[i] = TRUE;
         else
diff --git a/misc/stress.c b/misc/stress.c
index 6b4e2fe..5714552 100644
--- a/misc/stress.c
+++ b/misc/stress.c
@@ -2,22 +2,20 @@
 #include <limits.h>
 #include "windows.h"
 #include "stress.h"
-#include "stddebug.h"
-/* #define DEBUG_STRESS */
-/* #undef  DEBUG_STRESS */
 #include "debug.h"
 
 
 int WINAPI AllocDiskSpace(long lLeft, UINT16 uDrive)
 {
-	dprintf_stress(stdnimp, "stress.dll: AllocDiskSpace %d, %ld\n", uDrive, lLeft);
+	dprintf_fixme(stress, "stress.dll: AllocDiskSpace(%d, %ld) - stub\n", 
+		       uDrive, lLeft);
 
 	return 1;
 }
 
 int WINAPI AllocFileHandles(int Left)
 {
-	dprintf_stress(stddeb, "stress.dll: AllocFileHandles %d\n", Left);
+	dprintf_info(stress, "stress.dll: AllocFileHandles(%d) - stub\n", Left);
 
 	if (Left < 0)
 		return -1;
@@ -27,48 +25,48 @@
 
 BOOL16 WINAPI AllocGDIMem(UINT16 uLeft)
 {
-	dprintf_stress(stddeb, "stress.dll: AllocGDIMem %d\n", uLeft);
+	dprintf_info(stress, "stress.dll: AllocGDIMem(%d) - stub\n", uLeft);
 
 	return 1;
 }
 
 BOOL16 WINAPI AllocMem(DWORD dwLeft)
 {
-	dprintf_stress(stdnimp, "stress.dll: AllocMem %ld\n", dwLeft);
+	dprintf_fixme(stress, "stress.dll: AllocMem(%ld) - stub\n", dwLeft);
 
 	return 1;
 }
 
 BOOL16 WINAPI AllocUserMem(UINT16 uContig)
 {
-	dprintf_stress(stddeb, "stress.dll: AllocUserMem %d\n", uContig);
+	dprintf_info(stress, "stress.dll: AllocUserMem %d\n", uContig);
 
 	return 1;
 }
 
 void WINAPI FreeAllMem(void)
 {
-	dprintf_stress(stddeb, "stress.dll: FreeAllMem\n");
+	dprintf_info(stress, "stress.dll: FreeAllMem\n");
 }
 
 void WINAPI FreeAllGDIMem(void)
 {
-	dprintf_stress(stddeb, "stress.dll: FreeAllGDIMem\n");
+	dprintf_info(stress, "stress.dll: FreeAllGDIMem\n");
 }
 
 void WINAPI FreeAllUserMem(void)
 {
-	dprintf_stress(stddeb, "stress.dll: FreeAllUserMem\n");
+	dprintf_info(stress, "stress.dll: FreeAllUserMem\n");
 }
 
 void WINAPI GetFreeAllUserMem(void)
 {
-       dprintf_stress(stddeb, "stress.dll: GetFreeAllUserMem\n");
+       dprintf_info(stress, "stress.dll: GetFreeAllUserMem\n");
 }
 
 int WINAPI GetFreeFileHandles(void)
 {
-	dprintf_stress(stddeb, "stress.dll: GetFreeFileHandles\n");
+	dprintf_info(stress, "stress.dll: GetFreeFileHandles\n");
 
 #ifndef OPEN_MAX
 	return _POSIX_OPEN_MAX;
@@ -79,10 +77,10 @@
 
 void WINAPI UnAllocDiskSpace(UINT16 drive)
 {
-	dprintf_stress(stddeb, "stress.dll: UnAllocDiskSpace %d\n", drive);
+	dprintf_info(stress, "stress.dll: UnAllocDiskSpace %d\n", drive);
 }
 
 void WINAPI UnAllocFileHandles(void)
 {
-	dprintf_stress(stddeb, "stress.dll: GetFreeAllUserMem\n");
+	dprintf_info(stress, "stress.dll: GetFreeAllUserMem\n");
 }
diff --git a/misc/toolhelp.c b/misc/toolhelp.c
index 2e485ae..9ec8c6f 100644
--- a/misc/toolhelp.c
+++ b/misc/toolhelp.c
@@ -12,7 +12,6 @@
 #include "windows.h"
 #include "win.h"
 #include "toolhelp.h"
-#include "stddebug.h"
 #include "debug.h"
 #include "heap.h"
 
@@ -36,7 +35,7 @@
 {
     int	i;
 
-    dprintf_toolhelp( stddeb, "NotifyRegister(%x,%lx,%x) called.\n",
+    dprintf_info(toolhelp, "NotifyRegister(%x,%lx,%x) called.\n",
                       htask, (DWORD)lpfnCallback, wFlags );
     if (!htask) htask = GetCurrentTask();
     for (i=0;i<nrofnotifys;i++)
@@ -62,7 +61,7 @@
 {
     int	i;
     
-    dprintf_toolhelp( stddeb, "NotifyUnregister(%x) called.\n", htask );
+    dprintf_info(toolhelp, "NotifyUnregister(%x) called.\n", htask );
     if (!htask) htask = GetCurrentTask();
     for (i=nrofnotifys;i--;)
         if (notifys[i].htask==htask)
diff --git a/misc/tweak.c b/misc/tweak.c
index 53d7f42..e39f95a 100644
--- a/misc/tweak.c
+++ b/misc/tweak.c
@@ -210,7 +210,7 @@
 	    PROFILE_GetWineIniInt("Tweak.Colors", "Pen0095.Grn", 0x00),
 	    PROFILE_GetWineIniInt("Tweak.Colors", "Pen0095.Blu", 0x00)));
 
-    dprintf_tweak(stddeb, "TWEAK_VarInit: Using %s look and feel.\n",
+    dprintf_info(tweak, "TWEAK_VarInit: Using %s look and feel.\n",
 		  TWEAK_Win95Look ? "Win95" : "Win3.1");
     return 1;
 }
diff --git a/misc/ver.c b/misc/ver.c
index c548da7..d58df8a 100644
--- a/misc/ver.c
+++ b/misc/ver.c
@@ -17,7 +17,6 @@
 #include "lzexpand.h"
 #include "module.h"
 #include "neexe.h"
-#include "stddebug.h"
 #include "debug.h"
 #include "xmalloc.h"
 #include "winreg.h"
@@ -33,7 +32,7 @@
  *      char const * teststring,
  *      char const * epilogue )
  *
- *   This function will print via dprintf_ver to stddeb the prologue string,
+ *   This function will print via dprintf[_]ver to stddeb the prologue string,
  *   followed by the address of teststring and the string it contains if
  *   teststring is non-null or "(null)" otherwise, and then the epilogue
  *   string followed by a new line.
@@ -46,7 +45,7 @@
  *         this function should fix the problem.
  *      15-Feb-1998 Dimitrie Paun (dimi@cs.toronto.edu)
  *         Modified it to make it print the message using only one
- *         dprintf_ver call.
+ *         dprintf[_]ver call.
  *
  *****************************************************************************/
 
@@ -55,7 +54,7 @@
     char const * teststring,
     char const * epilogue )
 {
-    dprintf_ver(stddeb, "%s %p (\"%s\") %s\n", prologue, 
+    dprintf_info(ver, "%s %p (\"%s\") %s\n", prologue, 
 		(void const *) teststring, 
 		teststring ? teststring : "(null)",
 		epilogue);
@@ -63,7 +62,7 @@
 
 /******************************************************************************
  *
- *   This function will print via dprintf_ver to stddeb debug info regarding
+ *   This function will print via dprintf[_]ver to stddeb debug info regarding
  *   the file info structure vffi.
  *      15-Feb-1998 Dimitrie Paun (dimi@cs.toronto.edu)
  *      Added this function to clean up the code.
@@ -71,10 +70,9 @@
  *****************************************************************************/
 static void print_vffi_debug(VS_FIXEDFILEINFO *vffi)
 {
-        char buff[1024];
-	char *p;
+        dbg_decl_str(ver, 1024);
 
-	dprintf_ver(stddeb," structversion=0x%lx.0x%lx, fileversion=0x%lx.0x%lx, productversion=0x%lx.0x%lx, flagmask=0x%lx, flags=%s%s%s%s%s%s\n",
+	dprintf_info(ver," structversion=0x%lx.0x%lx, fileversion=0x%lx.0x%lx, productversion=0x%lx.0x%lx, flagmask=0x%lx, flags=%s%s%s%s%s%s\n",
 		    (vffi->dwStrucVersion>>16),vffi->dwStrucVersion&0xFFFF,
 		    vffi->dwFileVersionMS,vffi->dwFileVersionLS,
 		    vffi->dwProductVersionMS,vffi->dwProductVersionLS,
@@ -87,98 +85,96 @@
 		    (vffi->dwFileFlags & VS_FF_SPECIALBUILD) ? "SPECIALBUILD," : ""
 		    );
 
-	p = buff;
-	p+=sprintf(p," OS=0x%lx.0x%lx (",
+	dsprintf(ver," OS=0x%lx.0x%lx ",
 		(vffi->dwFileOS&0xFFFF0000)>>16,
 		vffi->dwFileOS&0x0000FFFF
 	);
 	switch (vffi->dwFileOS&0xFFFF0000) {
-	case VOS_DOS:p+=sprintf(p,"DOS,");break;
-	case VOS_OS216:p+=sprintf(p,"OS/2-16,");break;
-	case VOS_OS232:p+=sprintf(p,"OS/2-32,");break;
-	case VOS_NT:p+=sprintf(p,"NT,");break;
+	case VOS_DOS:dsprintf(ver,"DOS,");break;
+	case VOS_OS216:dsprintf(ver,"OS/2-16,");break;
+	case VOS_OS232:dsprintf(ver,"OS/2-32,");break;
+	case VOS_NT:dsprintf(ver,"NT,");break;
 	case VOS_UNKNOWN:
 	default:
-		p+=sprintf(p,"UNKNOWN(0x%lx),",vffi->dwFileOS&0xFFFF0000);break;
+		dsprintf(ver,"UNKNOWN(0x%lx),",vffi->dwFileOS&0xFFFF0000);break;
 	}
 	switch (vffi->dwFileOS & 0xFFFF) {
-	case VOS__BASE:p+=sprintf(p,"BASE");break;
-	case VOS__WINDOWS16:p+=sprintf(p,"WIN16");break;
-	case VOS__WINDOWS32:p+=sprintf(p,"WIN32");break;
-	case VOS__PM16:p+=sprintf(p,"PM16");break;
-	case VOS__PM32:p+=sprintf(p,"PM32");break;
-	default:p+=sprintf(p,"UNKNOWN(0x%lx)",vffi->dwFileOS&0xFFFF);break;
+	case VOS__BASE:dsprintf(ver,"BASE");break;
+	case VOS__WINDOWS16:dsprintf(ver,"WIN16");break;
+	case VOS__WINDOWS32:dsprintf(ver,"WIN32");break;
+	case VOS__PM16:dsprintf(ver,"PM16");break;
+	case VOS__PM32:dsprintf(ver,"PM32");break;
+	default:dsprintf(ver,"UNKNOWN(0x%lx)",vffi->dwFileOS&0xFFFF);break;
 	}
-	p+=sprintf(p,")");
-	dprintf_ver(stddeb, "%s\n", buff);
+	dprintf_info(ver, "(%s)\n", dbg_str(ver));
 
-	p = buff;
+	dbg_reset_str(ver);
 	switch (vffi->dwFileType) {
 	default:
 	case VFT_UNKNOWN:
-		p+=sprintf(p,"filetype=Unknown(0x%lx)",vffi->dwFileType);
+		dsprintf(ver,"filetype=Unknown(0x%lx)",vffi->dwFileType);
 		break;
-	case VFT_APP:p+=sprintf(p,"filetype=APP,");break;
-	case VFT_DLL:p+=sprintf(p,"filetype=DLL,");break;
+	case VFT_APP:dsprintf(ver,"filetype=APP,");break;
+	case VFT_DLL:dsprintf(ver,"filetype=DLL,");break;
 	case VFT_DRV:
-		p+=sprintf(p,"filetype=DRV,");
+		dsprintf(ver,"filetype=DRV,");
 		switch(vffi->dwFileSubtype) {
 		default:
 		case VFT2_UNKNOWN:
-			p+=sprintf(p,"UNKNOWN(0x%lx)",vffi->dwFileSubtype);
+			dsprintf(ver,"UNKNOWN(0x%lx)",vffi->dwFileSubtype);
 			break;
 		case VFT2_DRV_PRINTER:
-			p+=sprintf(p,"PRINTER");
+			dsprintf(ver,"PRINTER");
 			break;
 		case VFT2_DRV_KEYBOARD:
-			p+=sprintf(p,"KEYBOARD");
+			dsprintf(ver,"KEYBOARD");
 			break;
 		case VFT2_DRV_LANGUAGE:
-			p+=sprintf(p,"LANGUAGE");
+			dsprintf(ver,"LANGUAGE");
 			break;
 		case VFT2_DRV_DISPLAY:
-			p+=sprintf(p,"DISPLAY");
+			dsprintf(ver,"DISPLAY");
 			break;
 		case VFT2_DRV_MOUSE:
-			p+=sprintf(p,"MOUSE");
+			dsprintf(ver,"MOUSE");
 			break;
 		case VFT2_DRV_NETWORK:
-			p+=sprintf(p,"NETWORK");
+			dsprintf(ver,"NETWORK");
 			break;
 		case VFT2_DRV_SYSTEM:
-			p+=sprintf(p,"SYSTEM");
+			dsprintf(ver,"SYSTEM");
 			break;
 		case VFT2_DRV_INSTALLABLE:
-			p+=sprintf(p,"INSTALLABLE");
+			dsprintf(ver,"INSTALLABLE");
 			break;
 		case VFT2_DRV_SOUND:
-			p+=sprintf(p,"SOUND");
+			dsprintf(ver,"SOUND");
 			break;
 		case VFT2_DRV_COMM:
-			p+=sprintf(p,"COMM");
+			dsprintf(ver,"COMM");
 			break;
 		case VFT2_DRV_INPUTMETHOD:
-			p+=sprintf(p,"INPUTMETHOD");
+			dsprintf(ver,"INPUTMETHOD");
 			break;
 		}
 		break;
 	case VFT_FONT:
-		p+=sprintf(p,"filetype=FONT.");
+		dsprintf(ver,"filetype=FONT.");
 		switch (vffi->dwFileSubtype) {
 		default:
-			p+=sprintf(p,"UNKNOWN(0x%lx)",vffi->dwFileSubtype);
+			dsprintf(ver,"UNKNOWN(0x%lx)",vffi->dwFileSubtype);
 			break;
-		case VFT2_FONT_RASTER:p+=sprintf(p,"RASTER");break;
-		case VFT2_FONT_VECTOR:p+=sprintf(p,"VECTOR");break;
-		case VFT2_FONT_TRUETYPE:p+=sprintf(p,"TRUETYPE");break;
+		case VFT2_FONT_RASTER:dsprintf(ver,"RASTER");break;
+		case VFT2_FONT_VECTOR:dsprintf(ver,"VECTOR");break;
+		case VFT2_FONT_TRUETYPE:dsprintf(ver,"TRUETYPE");break;
 		}
 		break;
-	case VFT_VXD:p+=sprintf(p,"filetype=VXD");break;
-	case VFT_STATIC_LIB:p+=sprintf(p,"filetype=STATIC_LIB");break;
+	case VFT_VXD:dsprintf(ver,"filetype=VXD");break;
+	case VFT_STATIC_LIB:dsprintf(ver,"filetype=STATIC_LIB");break;
 	}
-	dprintf_ver(stddeb, "%s\n", buff);
+	dprintf_info(ver, "%s\n", dbg_str(ver));
 
-	dprintf_ver(stddeb, "  filedata=0x%lx.0x%lx\n",
+	dprintf_info(ver, "  filedata=0x%lx.0x%lx\n",
 		    vffi->dwFileDateMS,vffi->dwFileDateLS);
 }
 
@@ -320,13 +316,13 @@
 	nehdoffset = LZTELL(lzfd);
 	LZREAD(&nehd);
 	if (nehd.resource_tab_offset==nehd.rname_tab_offset) {
-		dprintf_ver(stddeb,"no resources in NE dll\n");
+		dprintf_info(ver,"no resources in NE dll\n");
 		return 0;
 	}
 	LZSeek32(lzfd,nehd.resource_tab_offset+nehdoffset,SEEK_SET);
 	LZREAD(&shiftcount);
-	dprintf_ver(stddeb,"shiftcount is %d\n",shiftcount);
-	dprintf_ver(stddeb,"reading resource typeinfo dir.\n");
+	dprintf_info(ver,"shiftcount is %d\n",shiftcount);
+	dprintf_info(ver,"reading resource typeinfo dir.\n");
 
 	if (!HIWORD(typeid)) typeid = (SEGPTR)(LOWORD(typeid) | 0x8000);
 	if (!HIWORD(resid))  resid  = (SEGPTR)(LOWORD(resid) | 0x8000);
@@ -336,7 +332,7 @@
 		LZREAD(&ti);
 		if (!ti.type_id)
 			return 0;
-		dprintf_ver(stddeb,"    ti.typeid =%04x,count=%d\n",ti.type_id,ti.count);
+		dprintf_info(ver,"    ti.typeid =%04x,count=%d\n",ti.type_id,ti.count);
 
 		skipflag=0;
 		if (!HIWORD(typeid)) {
@@ -360,7 +356,7 @@
 				str=xmalloc(len);
 				if (len!=LZRead32(lzfd,str,len))
 					return 0;
-				dprintf_ver(stddeb,"read %s to compare it with %s\n",
+				dprintf_info(ver,"read %s to compare it with %s\n",
 					str,(char*)PTR_SEG_TO_LIN(typeid)
 				);
 				if (lstrcmpi32A(str,(char*)PTR_SEG_TO_LIN(typeid)))
@@ -378,7 +374,7 @@
 			int	len;
 
 			LZREAD(&ni);
-			dprintf_ver(stddeb,"	ni.id=%4x,offset=%d,length=%d\n",
+			dprintf_info(ver,"	ni.id=%4x,offset=%d,length=%d\n",
 				ni.id,ni.offset,ni.length
 			);
 			skipflag=1;
@@ -401,7 +397,7 @@
 					str=xmalloc(len);
 					if (len!=LZRead32(lzfd,str,len))
 						return 0;
-					dprintf_ver(stddeb,"read %s to compare it with %s\n",
+					dprintf_info(ver,"read %s to compare it with %s\n",
 						str,(char*)PTR_SEG_TO_LIN(typeid)
 					);
 					if (!lstrcmpi32A(str,(char*)PTR_SEG_TO_LIN(typeid)))
@@ -420,7 +416,7 @@
 				free(rdata);
 				return 0;
 			}
-			dprintf_ver(stddeb,"resource found.\n");
+			dprintf_info(ver,"resource found.\n");
 			*resdata= (BYTE*)rdata;
 			*reslen	= len;
 			return 1;
@@ -449,7 +445,7 @@
 	pehdoffset = LZTELL(lzfd);
 	LZREAD(&pehd);
 	resdir = pehd.OptionalHeader.DataDirectory[IMAGE_FILE_RESOURCE_DIRECTORY];
-	dprintf_ver(stddeb,"find_pe_resource(.,%p,%p,....)\n",typeid,resid);
+	dprintf_info(ver,"find_pe_resource(.,%p,%p,....)\n",typeid,resid);
 	if (!resdir.Size) {
 		fprintf(stderr,"misc/ver.c:find_pe_resource() no resource directory found in PE file.\n");
 		return 0;
@@ -484,20 +480,20 @@
 	resourcedir = (LPIMAGE_RESOURCE_DIRECTORY)(image+resdir.VirtualAddress);
 	xresdir = GetResDirEntryW(resourcedir,typeid,(DWORD)resourcedir,FALSE);
 	if (!xresdir) {
-		dprintf_ver(stddeb,"...no typeid entry found for %p\n",typeid);
+		dprintf_info(ver,"...no typeid entry found for %p\n",typeid);
 		HeapFree(GetProcessHeap(),0,image);
 		return 0;
 	}
 	xresdir = GetResDirEntryW(xresdir,resid,(DWORD)resourcedir,FALSE);
 	if (!xresdir) {
-		dprintf_ver(stddeb,"...no resid entry found for %p\n",resid);
+		dprintf_info(ver,"...no resid entry found for %p\n",resid);
 		HeapFree(GetProcessHeap(),0,image);
 		return 0;
 	}
 	
 	xresdir = GetResDirEntryW(xresdir,0,(DWORD)resourcedir,TRUE);
 	if (!xresdir) {
-		dprintf_ver(stddeb,"...no 0 (default language) entry found for %p\n",resid);
+		dprintf_info(ver,"...no 0 (default language) entry found for %p\n",resid);
 		HeapFree(GetProcessHeap(),0,image);
 		return 0;
 	}
@@ -531,7 +527,7 @@
 	int			reslen=0;
 	int			res=0;
 
-	dprintf_ver(stddeb,"GetFileResourceSize(%s,%lx,%lx,%p)\n",
+	dprintf_info(ver,"GetFileResourceSize(%s,%lx,%lx,%p)\n",
 		filename,(LONG)restype,(LONG)resid,off
 	);
 	lzfd=LZOpenFile32A(filename,&ofs,OF_READ);
@@ -568,7 +564,7 @@
 	int			res=0;
 	int			reslen=datalen;
 
-	dprintf_ver(stddeb,"GetFileResource(%s,%lx,%lx,%ld,%ld,%p)\n",
+	dprintf_info(ver,"GetFileResource(%s,%lx,%lx,%ld,%ld,%p)\n",
 		filename,(LONG)restype,(LONG)resid,off,datalen,data
 	);
 
@@ -607,7 +603,7 @@
 	BYTE	buf[144];
 	VS_FIXEDFILEINFO *vffi;
 
-	dprintf_ver(stddeb,"GetFileVersionInfoSize16(%s,%p)\n",filename,handle);
+	dprintf_info(ver,"GetFileVersionInfoSize16(%s,%p)\n",filename,handle);
 	len=GetFileResourceSize(filename,VS_FILE_INFO,VS_VERSION_INFO,handle);
 	if (!len)
 		return 0;
@@ -633,7 +629,7 @@
 	if (*(WORD*)buf < len)
 		len = *(WORD*)buf;
 
-	if(debugging_ver)
+	if(debugging_info(ver))
 	  print_vffi_debug(vffi);
 
 	return len;
@@ -642,7 +638,7 @@
 /* GetFileVersionInfoSize32A			[VERSION.1] */
 DWORD WINAPI GetFileVersionInfoSize32A(LPCSTR filename,LPDWORD handle)
 {
-	dprintf_ver(stddeb,"GetFileVersionInfoSize32A(%s,%p)\n",filename,handle);
+	dprintf_info(ver,"GetFileVersionInfoSize32A(%s,%p)\n",filename,handle);
 	return GetFileVersionInfoSize16(filename,handle);
 }
 
@@ -659,7 +655,7 @@
 DWORD  WINAPI GetFileVersionInfo16(LPCSTR filename,DWORD handle,DWORD datasize,
                                    LPVOID data)
 {
-	dprintf_ver(stddeb,"GetFileVersionInfo16(%s,%ld,%ld,%p)\n->",
+	dprintf_info(ver,"GetFileVersionInfo16(%s,%ld,%ld,%p)\n",
 		filename,handle,datasize,data
 	);
 	return GetFileResource(
@@ -716,27 +712,27 @@
     retval = 0;
 
     /* Print out debugging information */
-    dprintf_ver(stddeb, "VerFindFile() called with parameters:\n"
+    dprintf_info(ver, "VerFindFile() called with parameters:\n"
 		"\tflags = %x", flags);
     if(flags & VFFF_ISSHAREDFILE)
-	dprintf_ver(stddeb, " (VFFF_ISSHAREDFILE)\n");
+	dprintf_info(ver, " (VFFF_ISSHAREDFILE)\n");
     else
-	dprintf_ver(stddeb, "\n");
+	dprintf_info(ver, "\n");
 
     ver_dstring("\tlpszFilename = ", lpszFilename, "");
     ver_dstring("\tlpszWinDir = ", lpszWinDir, "");
     ver_dstring("\tlpszAppDir = ", lpszAppDir, "");
 
-    dprintf_ver(stddeb, "\tlpszCurDir = %p\n", lpszCurDir);
+    dprintf_info(ver, "\tlpszCurDir = %p\n", lpszCurDir);
     if(lpuCurDirLen)
-	dprintf_ver(stddeb, "\tlpuCurDirLen = %p (%u)\n",
+	dprintf_info(ver, "\tlpuCurDirLen = %p (%u)\n",
 		    lpuCurDirLen, *lpuCurDirLen);
     else
-	dprintf_ver(stddeb, "\tlpuCurDirLen = (null)\n");
+	dprintf_info(ver, "\tlpuCurDirLen = (null)\n");
 
-    dprintf_ver(stddeb, "\tlpszDestDir = %p\n", lpszDestDir);
+    dprintf_info(ver, "\tlpszDestDir = %p\n", lpszDestDir);
     if(lpuDestDirLen)
-	dprintf_ver(stddeb, "\tlpuDestDirLen = %p (%u)\n",
+	dprintf_info(ver, "\tlpuDestDirLen = %p (%u)\n",
 		    lpuDestDirLen, *lpuDestDirLen);
 
     /* Figure out where the file should go; shared files default to the
@@ -824,21 +820,21 @@
 	*lpuCurDirLen = curDirSizeReq;
     }
 
-    dprintf_ver(stddeb, "VerFindFile() ret = %lu (%s%s%s)\n", retval,
+    dprintf_info(ver, "VerFindFile() ret = %lu (%s%s%s)\n", retval,
 		(retval & VFF_CURNEDEST) ? "VFF_CURNEDEST " : "",
 		(retval & VFF_FILEINUSE) ? "VFF_FILEINUSE " : "",
 		(retval & VFF_BUFFTOOSMALL) ? "VFF_BUFFTOOSMALL " : "");
 
     ver_dstring("\t(Exit) lpszCurDir = ", lpszCurDir, "");
     if(lpuCurDirLen)
-	dprintf_ver(stddeb, "\t(Exit) lpuCurDirLen = %p (%u)\n",
+	dprintf_info(ver, "\t(Exit) lpuCurDirLen = %p (%u)\n",
 		    lpuCurDirLen, *lpuCurDirLen);
     else
-	dprintf_ver(stddeb, "\t(Exit) lpuCurDirLen = (null)\n");
+	dprintf_info(ver, "\t(Exit) lpuCurDirLen = (null)\n");
 
     ver_dstring("\t(Exit) lpszDestDir = ", lpszDestDir, "");
     if(lpuDestDirLen)
-	dprintf_ver(stddeb, "\t(Exit) lpuDestDirLen = %p (%u)\n",
+	dprintf_info(ver, "\t(Exit) lpuDestDirLen = %p (%u)\n",
 		    lpuDestDirLen, *lpuDestDirLen);
 
     return retval;
@@ -1195,13 +1191,13 @@
 
 	while (1) {
 		db=(struct dbA*)block;
-		dprintf_ver(stddeb,"db=%p,db->nextoff=%d,db->datalen=%d,db->name=%s\n",
+		dprintf_info(ver,"db=%p,db->nextoff=%d,db->datalen=%d,db->name=%s\n",
 			db,db->nextoff,db->datalen,db->name
 		);
 		if ((!db->nextoff) || (buff_remain<=0)) /* no more entries ? */
 			return NULL;
 
-		dprintf_ver(stddeb,"comparing with %s\n",db->name);
+		dprintf_info(ver,"comparing with %s\n",db->name);
 		if (!lstrncmpi32A(db->name,str,substrlen)) {
 			if (nextslash) {
 				inc_size=DATA_OFFSET_A(db)+((db->datalen+3)&~3);
@@ -1252,7 +1248,7 @@
 		} else
 			vs = HEAP_strdupA(GetProcessHeap(),0,"no data");
 
-		dprintf_ver(stddeb,"db->nextoff=%d,db->name=%s,db->data=\"%s\"\n",
+		dprintf_info(ver,"db->nextoff=%d,db->name=%s,db->data=\"%s\"\n",
 			db->nextoff,xs,vs
 		);
 		HeapFree(GetProcessHeap(),0,vs);
@@ -1288,7 +1284,7 @@
 	LPSTR	s;
 	BYTE	*block=PTR_SEG_TO_LIN(segblock),*b;
 
-	dprintf_ver(stddeb,"VerQueryValue16(%p,%s,%p,%d)\n",
+	dprintf_info(ver,"VerQueryValue16(%p,%s,%p,%d)\n",
 		block,subblock,buffer,*buflen
 	);
 
@@ -1316,10 +1312,10 @@
 		*buflen	= db->datalen;
 		if (db->btext) {
 		    xs = HEAP_strdupWtoA(GetProcessHeap(),0,(WCHAR*)b);
-		    dprintf_ver(stderr,"->%s\n",xs);
+		    dprintf_info(ver,"->%s\n",xs);
 		    HeapFree(GetProcessHeap(),0,xs);
 		} else
-		    dprintf_ver(stderr,"->%p\n",b);
+		    dprintf_info(ver,"->%p\n",b);
 	} else {
 		struct	dbA	*db;
 		b=_find_dataA(block,s,*(WORD*)block);
@@ -1334,9 +1330,9 @@
 		*buflen	= db->datalen;
 		/* the string is only printable, if it is below \\StringFileInfo*/
 		if (!lstrncmpi32A("VS_VERSION_INFO\\StringFileInfo\\",s,strlen("VS_VERSION_INFO\\StringFileInfo\\")))
-		    dprintf_ver(stddeb,"	-> %s=%s\n",subblock,b);
+		    dprintf_info(ver,"	-> %s=%s\n",subblock,b);
 		else
-		    dprintf_ver(stddeb,"	-> %s=%p\n",subblock,b);
+		    dprintf_info(ver,"	-> %s=%p\n",subblock,b);
 	}
 	*buffer	= (b-block)+segblock;
 	free(s);
@@ -1349,7 +1345,7 @@
 	BYTE	*b,*block=(LPBYTE)vblock,**buffer=(LPBYTE*)vbuffer;
 	LPSTR	s;
 
-	dprintf_ver(stddeb,"VerQueryValue32A(%p,%s,%p,%d)\n",
+	dprintf_info(ver,"VerQueryValue32A(%p,%s,%p,%d)\n",
 		block,subblock,buffer,*buflen
 	);
 
@@ -1378,10 +1374,10 @@
 		b	= b+DATA_OFFSET_W(db);
 		if (db->btext) {
 		    xs = HEAP_strdupWtoA(GetProcessHeap(),0,(WCHAR*)b);
-		    dprintf_ver(stderr,"->%s\n",xs);
+		    dprintf_info(ver,"->%s\n",xs);
 		    HeapFree(GetProcessHeap(),0,xs);
 		} else
-		    dprintf_ver(stderr,"->%p\n",b);
+		    dprintf_info(ver,"->%p\n",b);
 		/* This is a leak.  */
 		b = HEAP_strdupWtoA(GetProcessHeap(),0,(WCHAR*)b);
 	} else {
@@ -1399,9 +1395,9 @@
 
 		/* the string is only printable, if it is below \\StringFileInfo*/
 		if (!lstrncmpi32A("VS_VERSION_INFO\\StringFileInfo\\",s,strlen("VS_VERSION_INFO\\StringFileInfo\\")))
-		    dprintf_ver(stddeb,"	-> %s=%s\n",subblock,b);
+		    dprintf_info(ver,"	-> %s=%s\n",subblock,b);
 		else
-		    dprintf_ver(stddeb,"	-> %s=%p\n",subblock,b);
+		    dprintf_info(ver,"	-> %s=%p\n",subblock,b);
 	}
 	*buffer	= b;
 	free(s);
diff --git a/misc/version.c b/misc/version.c
index b694a78..971e758 100644
--- a/misc/version.c
+++ b/misc/version.c
@@ -294,6 +294,7 @@
  *
  * writes a debug string into <windir>\bootlog.txt
  */
-void WINAPI DiagOutput()
+void WINAPI DiagOutput(LPCSTR str)
 {
+	fprintf(stderr,"DIAGOUTPUT:%s\n",str);
 }
diff --git a/misc/winsock.c b/misc/winsock.c
index 835151d..239c456 100644
--- a/misc/winsock.c
+++ b/misc/winsock.c
@@ -44,7 +44,6 @@
 #include "task.h"
 #include "message.h"
 #include "miscemu.h"
-#include "stddebug.h"
 #include "debug.h"
 
 #define DEBUG_SOCKADDR 0
@@ -206,7 +205,7 @@
 
     optlen = sizeof(optval);
     getsockopt(s, SOL_SOCKET, SO_ERROR, &optval, &optlen);
-    if (optval) dprintf_winsock(stddeb, "\t[%i] error: %d\n", s, optval);
+    if (optval) dprintf_warn(winsock, "\t[%i] error: %d\n", s, optval);
     return optval != 0;
 }
 
@@ -249,7 +248,7 @@
 	if( b32 ) wsfds32->fd_count = j;
 	else wsfds16->fd_count = j;
 
-	dprintf_winsock(stddeb, "\n");
+	dprintf_info(winsock, "\n");
 #undef wsfds32
 #undef wsfds16
     }
@@ -304,7 +303,7 @@
     HTASK16             tid = GetCurrentTask();
     LPWSINFO            pwsi;
 
-    dprintf_winsock(stddeb, "WSAStartup: verReq=%x\n", wVersionRequested);
+    dprintf_info(winsock, "WSAStartup: verReq=%x\n", wVersionRequested);
 
     if (LOBYTE(wVersionRequested) < 1 || (LOBYTE(wVersionRequested) == 1 &&
         HIBYTE(wVersionRequested) < 1)) return WSAVERNOTSUPPORTED;
@@ -359,7 +358,7 @@
 
     memcpy(lpWSAData, &WINSOCK_data, sizeof(WINSOCK_data));
 
-    dprintf_winsock(stddeb, "WSAStartup: succeeded\n");
+    dprintf_info(winsock, "WSAStartup: succeeded\n");
     return 0;
 }
 
@@ -411,12 +410,12 @@
 	WINSOCK_Shutdown();	/* just in case */
 
     if( pwsi->flags & WSI_BLOCKINGCALL )
-	dprintf_winsock(stddeb,"\tinside blocking call!\n");
+	dprintf_info(winsock,"\tinside blocking call!\n");
 
 /* FIXME: aop_control() doesn't decrement pwsi->num_async_rq
  *
  *    if( pwsi->num_async_rq )
- *	  dprintf_winsock(stddeb,"\thave %i outstanding async ops!\n", pwsi->num_async_rq );
+ *	  dprintf_warn(winsock,"\thave %i outstanding async ops!\n", pwsi->num_async_rq );
  */
 
     for(i = 0, j = 0, n = 0; i < WS_MAX_SOCKETS_PER_PROCESS; i++)
@@ -430,7 +429,7 @@
             close(pwsi->sock[i].fd); j++; 
         }
     if( j ) 
-	  dprintf_winsock(stddeb,"\tclosed %i sockets, killed %i async selects!\n", j, n);
+	  dprintf_info(winsock,"\tclosed %i sockets, killed %i async selects!\n", j, n);
 
     /* delete scratch buffers */
 
@@ -448,7 +447,7 @@
 {
     HTASK16	hTask = GetCurrentTask();
 
-    dprintf_winsock(stddeb, "WSACleanup(%04x)\n", hTask );
+    dprintf_info(winsock, "WSACleanup(%04x)\n", hTask );
     if( hTask )
     {
 	LPWSINFO pwsi = wsi_find(hTask);
@@ -467,14 +466,11 @@
  */
 INT32 WINAPI WSAGetLastError(void)
 {
-    LPWSINFO      pwsi = wsi_find(GetCurrentTask());
-    INT16		ret;
+    LPWSINFO pwsi = wsi_find(GetCurrentTask());
+    INT16    ret = (pwsi) ? pwsi->err : WSANOTINITIALISED;
 
-    dprintf_winsock(stddeb, "WSAGetLastError(%08x)", (unsigned)pwsi);
-
-    ret = (pwsi) ? pwsi->err : WSANOTINITIALISED;
-
-    dprintf_winsock(stddeb, " = %i\n", (int)ret);
+    dprintf_info(winsock, "WSAGetLastError(%08x) = %i\n", 
+		    (unsigned)pwsi, (int)ret);
     return ret;
 }
 
@@ -485,7 +481,7 @@
 {
     LPWSINFO      pwsi = wsi_find(GetCurrentTask());
 
-    dprintf_winsock(stddeb, "WSASetLastError(%08x): %d\n", (unsigned)pwsi, (int)iError);
+    dprintf_info(winsock, "WSASetLastError(%08x): %d\n", (unsigned)pwsi, (int)iError);
     if( pwsi ) pwsi->err = iError;
 }
 
@@ -526,7 +522,7 @@
     ws_socket*	pws  = (ws_socket*)WS_HANDLE2PTR((SOCKET16)s);
     LPWSINFO	pwsi = wsi_find(GetCurrentTask());
 
-    dprintf_winsock(stddeb, "WS_ACCEPT(%08x): socket %04x\n", 
+    dprintf_info(winsock, "WS_ACCEPT(%08x): socket %04x\n", 
 				  (unsigned)pwsi, (UINT16)s ); 
     if( _check_ws(pwsi, pws) )
     {
@@ -577,7 +573,7 @@
     ws_socket*    pws  = (ws_socket*)WS_HANDLE2PTR(s);
     LPWSINFO      pwsi = wsi_find(GetCurrentTask());
 
-    dprintf_winsock(stddeb, "WS_BIND(%08x): socket %04x, ptr %8x, length %d\n", 
+    dprintf_info(winsock, "WS_BIND(%08x): socket %04x, ptr %8x, length %d\n", 
 			   (unsigned)pwsi, s, (int) name, namelen);
 #if DEBUG_SOCKADDR
     dump_sockaddr(name);
@@ -589,7 +585,7 @@
 	  if ( bind(pws->fd, name, namelen) < 0 ) 
 	  {
 	     int	loc_errno = errno;
-	     dprintf_winsock(stddeb,"\tfailure - errno = %i\n", errno);
+	     dprintf_warn(winsock, "\tfailure - errno = %i\n", errno);
 	     errno = loc_errno;
 	     switch(errno)
 	     {
@@ -620,7 +616,7 @@
     ws_socket*    pws  = (ws_socket*)WS_HANDLE2PTR(s);
     LPWSINFO      pwsi = wsi_find(GetCurrentTask());
 
-    dprintf_winsock(stddeb, "WS_CLOSE(%08x): socket %08x\n", (unsigned)pwsi, s);
+    dprintf_info(winsock, "WS_CLOSE(%08x): socket %08x\n", (unsigned)pwsi, s);
 
     if( _check_ws(pwsi, pws) )
     { 
@@ -655,7 +651,7 @@
   ws_socket*    pws  = (ws_socket*)WS_HANDLE2PTR(s);
   LPWSINFO      pwsi = wsi_find(GetCurrentTask());
 
-  dprintf_winsock(stddeb, "WS_CONNECT(%08x): socket %04x, ptr %8x, length %d\n", 
+  dprintf_info(winsock, "WS_CONNECT(%08x): socket %04x, ptr %8x, length %d\n", 
 			   (unsigned)pwsi, s, (int) name, namelen);
 #if DEBUG_SOCKADDR
   dump_sockaddr(name);
@@ -713,7 +709,7 @@
     ws_socket*    pws  = (ws_socket*)WS_HANDLE2PTR(s);
     LPWSINFO      pwsi = wsi_find(GetCurrentTask());
 
-    dprintf_winsock(stddeb, "WS_GETPEERNAME(%08x): socket: %04x, ptr %8x, ptr %8x\n", 
+    dprintf_info(winsock, "WS_GETPEERNAME(%08x): socket: %04x, ptr %8x, ptr %8x\n", 
 			   (unsigned)pwsi, s, (int) name, *namelen);
     if( _check_ws(pwsi, pws) )
     {
@@ -750,7 +746,7 @@
     ws_socket*    pws  = (ws_socket*)WS_HANDLE2PTR(s);
     LPWSINFO      pwsi = wsi_find(GetCurrentTask());
 
-    dprintf_winsock(stddeb, "WS_GETSOCKNAME(%08x): socket: %04x, ptr %8x, ptr %8x\n", 
+    dprintf_info(winsock, "WS_GETSOCKNAME(%08x): socket: %04x, ptr %8x, ptr %8x\n", 
 			  (unsigned)pwsi, s, (int) name, (int) *namelen);
     if( _check_ws(pwsi, pws) )
     {
@@ -794,7 +790,7 @@
     ws_socket*    pws  = (ws_socket*)WS_HANDLE2PTR(s);
     LPWSINFO      pwsi = wsi_find(GetCurrentTask());
 
-    dprintf_winsock(stddeb, "WS_GETSOCKOPT(%08x): socket: %04x, opt %d, ptr %8x, ptr %8x\n", 
+    dprintf_info(winsock, "WS_GETSOCKOPT(%08x): socket: %04x, opt %d, ptr %8x, ptr %8x\n", 
 			   (unsigned)pwsi, s, level, (int) optval, (int) *optlen);
     if( _check_ws(pwsi, pws) )
     {
@@ -887,7 +883,7 @@
   ws_socket*    pws  = (ws_socket*)WS_HANDLE2PTR(s);
   LPWSINFO      pwsi = wsi_find(GetCurrentTask());
 
-  dprintf_winsock(stddeb, "WS_IOCTL(%08x): socket %04x, cmd %08x, ptr %8x\n", 
+  dprintf_info(winsock, "WS_IOCTL(%08x): socket %04x, cmd %08x, ptr %8x\n", 
 			  (unsigned)pwsi, s, cmd, (unsigned) argp);
   if( _check_ws(pwsi, pws) )
   {
@@ -920,7 +916,7 @@
 
 	default:	  
 		/* Netscape tries hard to use bogus ioctl 0x667e */
-		dprintf_winsock(stddeb,"\tunknown WS_IOCTL cmd (%08x)\n", cmd);
+		dprintf_warn(winsock, "\tunknown WS_IOCTL cmd (%08x)\n", cmd);
     }
     if( ioctl(pws->fd, newcmd, (char*)argp ) == 0 ) return 0;
     pwsi->err = (errno == EBADF) ? WSAENOTSOCK : wsaErrno(); 
@@ -945,7 +941,7 @@
     ws_socket*    pws  = (ws_socket*)WS_HANDLE2PTR(s);
     LPWSINFO      pwsi = wsi_find(GetCurrentTask());
 
-    dprintf_winsock(stddeb, "WS_LISTEN(%08x): socket %04x, backlog %d\n", 
+    dprintf_info(winsock, "WS_LISTEN(%08x): socket %04x, backlog %d\n", 
 			    (unsigned)pwsi, s, backlog);
     if( _check_ws(pwsi, pws) )
     {
@@ -983,14 +979,15 @@
     ws_socket*    pws  = (ws_socket*)WS_HANDLE2PTR(s);
     LPWSINFO      pwsi = wsi_find(GetCurrentTask());
 
-    dprintf_winsock(stddeb, "WS_RECV(%08x): socket %04x, buf %8x, len %d, flags %d",
-                          (unsigned)pwsi, s, (unsigned)buf, len, flags);
+    dprintf_info(winsock, "WS_RECV(%08x): socket %04x, buf %8x, len %d, "
+		    "flags %d\n", (unsigned)pwsi, s, (unsigned)buf, 
+		    len, flags);
     if( _check_ws(pwsi, pws) )
     {
 	INT32 length;
 	if ((length = recv(pws->fd, buf, len, flags)) >= 0) 
 	{ 
-	    dprintf_winsock(stddeb, " -> %i bytes\n", length);
+	    dprintf_info(winsock, " -> %i bytes\n", length);
 
 	    if( pws->psop && (pws->flags & (WS_FD_READ | WS_FD_CLOSE)) )
 		EVENT_AddIO( pws->fd, EVENT_IO_READ );	/* reenabler */
@@ -1000,7 +997,7 @@
 	pwsi->err = wsaErrno();
     }
     else if( pwsi ) pwsi->err = WSAENOTSOCK;
-    dprintf_winsock(stddeb, " -> ERROR\n");
+    dprintf_warn(winsock, " -> ERROR\n");
     return SOCKET_ERROR;
 }
 
@@ -1022,8 +1019,9 @@
     ws_socket*    pws  = (ws_socket*)WS_HANDLE2PTR(s);
     LPWSINFO      pwsi = wsi_find(GetCurrentTask());
 
-    dprintf_winsock(stddeb, "WS_RECVFROM(%08x): socket %04x, ptr %08x, len %d, flags %d",
-                          (unsigned)pwsi, s, (unsigned)buf, len, flags);
+    dprintf_info(winsock, "WS_RECVFROM(%08x): socket %04x, ptr %08x, "
+		    "len %d, flags %d\n", (unsigned)pwsi, s, (unsigned)buf,
+		    len, flags);
 #if DEBUG_SOCKADDR
     if( from ) dump_sockaddr(from);
     else fprintf(stderr, "\tfrom = NULL\n");
@@ -1035,7 +1033,7 @@
 
 	if ((length = recvfrom(pws->fd, buf, len, flags, from, fromlen32)) >= 0)
 	{
-	    dprintf_winsock(stddeb, " -> %i bytes\n", length);
+	    dprintf_info(winsock, " -> %i bytes\n", length);
 
 	    if( pws->psop && (pws->flags & (WS_FD_READ | WS_FD_CLOSE)) )
 		EVENT_AddIO( pws->fd, EVENT_IO_READ );  /* reenabler */
@@ -1045,7 +1043,7 @@
 	pwsi->err = wsaErrno();
     }
     else if( pwsi ) pwsi->err = WSAENOTSOCK;
-    dprintf_winsock(stddeb, " -> ERROR\n");
+    dprintf_warn(winsock, " -> ERROR\n");
     return SOCKET_ERROR;
 }
 
@@ -1073,7 +1071,7 @@
 {
     LPWSINFO      pwsi = wsi_find(GetCurrentTask());
 	
-    dprintf_winsock(stddeb, "WS_SELECT(%08x): read %8x, write %8x, excp %8x\n", 
+    dprintf_info(winsock, "WS_SELECT(%08x): read %8x, write %8x, excp %8x\n", 
     (unsigned) pwsi, (unsigned) ws_readfds, (unsigned) ws_writefds, (unsigned) ws_exceptfds);
 
     if( pwsi )
@@ -1152,7 +1150,7 @@
     ws_socket*    pws  = (ws_socket*)WS_HANDLE2PTR(s);
     LPWSINFO      pwsi = wsi_find(GetCurrentTask());
 
-    dprintf_winsock(stddeb, "WS_SEND(%08x): socket %04x, ptr %08x, length %d, flags %d\n", 
+    dprintf_info(winsock, "WS_SEND(%08x): socket %04x, ptr %08x, length %d, flags %d\n", 
 			   (unsigned)pwsi, s, (unsigned) buf, len, flags);
     if( _check_ws(pwsi, pws) )
     {
@@ -1188,7 +1186,7 @@
     ws_socket*    pws  = (ws_socket*)WS_HANDLE2PTR(s);
     LPWSINFO      pwsi = wsi_find(GetCurrentTask());
 
-    dprintf_winsock(stddeb, "WS_SENDTO(%08x): socket %04x, ptr %08x, length %d, flags %d\n",
+    dprintf_info(winsock, "WS_SENDTO(%08x): socket %04x, ptr %08x, length %d, flags %d\n",
                           (unsigned)pwsi, s, (unsigned) buf, len, flags);
     if( _check_ws(pwsi, pws) )
     {
@@ -1225,7 +1223,7 @@
     ws_socket*    pws  = (ws_socket*)WS_HANDLE2PTR(s);
     LPWSINFO      pwsi = wsi_find(GetCurrentTask());
 
-    dprintf_winsock(stddeb, "WS_SETSOCKOPT(%08x): socket %04x, lev %d, opt %d, ptr %08x, len %d\n",
+    dprintf_info(winsock, "WS_SETSOCKOPT(%08x): socket %04x, lev %d, opt %d, ptr %08x, len %d\n",
 			  (unsigned)pwsi, s, level, optname, (int) optval, optlen);
     if( _check_ws(pwsi, pws) )
     {
@@ -1265,7 +1263,7 @@
     ws_socket*    pws  = (ws_socket*)WS_HANDLE2PTR(s);
     LPWSINFO      pwsi = wsi_find(GetCurrentTask());
 
-    dprintf_winsock(stddeb, "WS_SHUTDOWN(%08x): socket %04x, how %i\n",
+    dprintf_info(winsock, "WS_SHUTDOWN(%08x): socket %04x, how %i\n",
 			    (unsigned)pwsi, s, how );
     if( _check_ws(pwsi, pws) )
     {
@@ -1330,7 +1328,7 @@
 {
   LPWSINFO      pwsi = wsi_find(GetCurrentTask());
 
-  dprintf_winsock(stddeb, "WS_SOCKET(%08x): af=%d type=%d protocol=%d\n", 
+  dprintf_info(winsock, "WS_SOCKET(%08x): af=%d type=%d protocol=%d\n", 
 			  (unsigned)pwsi, af, type, protocol);
 
   if( pwsi )
@@ -1374,7 +1372,7 @@
     {
         ws_socket*      pnew = wsi_alloc_socket(pwsi, sock);
 
-	dprintf_winsock(stddeb,"\tcreated %i (handle %04x)\n", sock, (UINT16)WS_PTR2HANDLE(pnew));
+	dprintf_info(winsock,"\tcreated %i (handle %04x)\n", sock, (UINT16)WS_PTR2HANDLE(pnew));
 
         if( pnew ) 
 	{
@@ -1394,7 +1392,7 @@
     } else pwsi->err = wsaErrno();
   }
  
-  dprintf_winsock(stddeb, "\t\tfailed!\n");
+  dprintf_warn(winsock, "\t\tfailed!\n");
   return INVALID_SOCKET32;
 }
 
@@ -1441,7 +1439,7 @@
 SEGPTR WINAPI WINSOCK_gethostbyaddr16(const char *addr, INT16 len, INT16 type)
 {
     struct WIN_hostent* retval;
-    dprintf_winsock(stddeb, "WS_GetHostByAddr16: ptr %08x, len %d, type %d\n",
+    dprintf_info(winsock, "WS_GetHostByAddr16: ptr %08x, len %d, type %d\n",
                             (unsigned) addr, len, type);
     retval = __ws_gethostbyaddr( addr, len, type, WS_DUP_SEGPTR );
     return retval ? SEGPTR_GET(retval) : ((SEGPTR)NULL);
@@ -1450,7 +1448,7 @@
 struct WIN_hostent* WINAPI WINSOCK_gethostbyaddr32(const char *addr, INT32 len,
                                                 INT32 type)
 {
-    dprintf_winsock(stddeb, "WS_GetHostByAddr32: ptr %08x, len %d, type %d\n",
+    dprintf_info(winsock, "WS_GetHostByAddr32: ptr %08x, len %d, type %d\n",
                              (unsigned) addr, len, type);
     return __ws_gethostbyaddr(addr, len, type, WS_DUP_LINEAR);
 }
@@ -1477,14 +1475,14 @@
 SEGPTR WINAPI WINSOCK_gethostbyname16(const char *name)
 {
     struct WIN_hostent* retval;
-    dprintf_winsock(stddeb, "WS_GetHostByName16: %s\n", (name)?name:NULL_STRING);
+    dprintf_info(winsock, "WS_GetHostByName16: %s\n", (name)?name:NULL_STRING);
     retval = __ws_gethostbyname( name, WS_DUP_SEGPTR );
     return (retval)? SEGPTR_GET(retval) : ((SEGPTR)NULL) ;
 }
 
 struct WIN_hostent* WINAPI WINSOCK_gethostbyname32(const char* name)
 {
-    dprintf_winsock(stddeb, "WS_GetHostByName32: %s\n", (name)?name:NULL_STRING);
+    dprintf_info(winsock, "WS_GetHostByName32: %s\n", (name)?name:NULL_STRING);
     return __ws_gethostbyname( name, WS_DUP_LINEAR );
 }
 
@@ -1511,14 +1509,14 @@
 SEGPTR WINAPI WINSOCK_getprotobyname16(const char *name)
 {
     struct WIN_protoent* retval;
-    dprintf_winsock(stddeb, "WS_GetProtoByName16: %s\n", (name)?name:NULL_STRING);
+    dprintf_info(winsock, "WS_GetProtoByName16: %s\n", (name)?name:NULL_STRING);
     retval = __ws_getprotobyname(name, WS_DUP_SEGPTR);
     return retval ? SEGPTR_GET(retval) : ((SEGPTR)NULL);
 }
 
 struct WIN_protoent* WINAPI WINSOCK_getprotobyname32(const char* name)
 {
-    dprintf_winsock(stddeb, "WS_GetProtoByName32: %s\n", (name)?name:NULL_STRING);
+    dprintf_info(winsock, "WS_GetProtoByName32: %s\n", (name)?name:NULL_STRING);
     return __ws_getprotobyname(name, WS_DUP_LINEAR);
 }
 
@@ -1545,14 +1543,14 @@
 SEGPTR WINAPI WINSOCK_getprotobynumber16(INT16 number)
 {
     struct WIN_protoent* retval;
-    dprintf_winsock(stddeb, "WS_GetProtoByNumber16: %i\n", number);
+    dprintf_info(winsock, "WS_GetProtoByNumber16: %i\n", number);
     retval = __ws_getprotobynumber(number, WS_DUP_SEGPTR);
     return retval ? SEGPTR_GET(retval) : ((SEGPTR)NULL);
 }
 
 struct WIN_protoent* WINAPI WINSOCK_getprotobynumber32(INT32 number)
 {
-    dprintf_winsock(stddeb, "WS_GetProtoByNumber32: %i\n", number);
+    dprintf_info(winsock, "WS_GetProtoByNumber32: %i\n", number);
     return __ws_getprotobynumber(number, WS_DUP_LINEAR);
 }
 
@@ -1583,7 +1581,7 @@
 SEGPTR WINAPI WINSOCK_getservbyname16(const char *name, const char *proto)
 {
     struct WIN_servent* retval;
-    dprintf_winsock(stddeb, "WS_GetServByName16: '%s', '%s'\n",
+    dprintf_info(winsock, "WS_GetServByName16: '%s', '%s'\n",
                             (name)?name:NULL_STRING, (proto)?proto:NULL_STRING);
     retval = __ws_getservbyname(name, proto, WS_DUP_SEGPTR);
     return retval ? SEGPTR_GET(retval) : ((SEGPTR)NULL);
@@ -1591,7 +1589,7 @@
 
 struct WIN_servent* WINAPI WINSOCK_getservbyname32(const char *name, const char *proto)
 {
-    dprintf_winsock(stddeb, "WS_GetServByName32: '%s', '%s'\n",
+    dprintf_info(winsock, "WS_GetServByName32: '%s', '%s'\n",
                             (name)?name:NULL_STRING, (proto)?proto:NULL_STRING);
     return __ws_getservbyname(name, proto, WS_DUP_LINEAR);
 }
@@ -1623,7 +1621,7 @@
 SEGPTR WINAPI WINSOCK_getservbyport16(INT16 port, const char *proto)
 {
     struct WIN_servent* retval;
-    dprintf_winsock(stddeb, "WS_GetServByPort16: %i, '%s'\n",
+    dprintf_info(winsock, "WS_GetServByPort16: %i, '%s'\n",
                             (int)port, (proto)?proto:NULL_STRING);
     retval = __ws_getservbyport(port, proto, WS_DUP_SEGPTR);
     return retval ? SEGPTR_GET(retval) : ((SEGPTR)NULL);
@@ -1631,7 +1629,7 @@
 
 struct WIN_servent* WINAPI WINSOCK_getservbyport32(INT32 port, const char *proto)
 {
-    dprintf_winsock(stddeb, "WS_GetServByPort32: %i, '%s'\n",
+    dprintf_info(winsock, "WS_GetServByPort32: %i, '%s'\n",
                             (int)port, (proto)?proto:NULL_STRING);
     return __ws_getservbyport(port, proto, WS_DUP_LINEAR);
 }
@@ -1644,7 +1642,7 @@
 {
     LPWSINFO              pwsi = wsi_find(GetCurrentTask());
 
-    dprintf_winsock(stddeb, "WS_GetHostName(%08x): name %s, len %d\n",
+    dprintf_info(winsock, "WS_GetHostName(%08x): name %s, len %d\n",
                           (unsigned)pwsi, (name)?name:NULL_STRING, namelen);
     if( pwsi )
     {
@@ -1684,7 +1682,7 @@
 {
   LPWSINFO              pwsi = wsi_find(GetCurrentTask());
 
-  dprintf_winsock(stddeb, "WS_AsyncGetHostByAddr16(%08x): hwnd %04x, msg %04x, addr %08x[%i]\n",
+  dprintf_info(winsock, "WS_AsyncGetHostByAddr16(%08x): hwnd %04x, msg %04x, addr %08x[%i]\n",
                           (unsigned)pwsi, hWnd, uMsg, (unsigned)addr , len );
 
   if( pwsi ) 
@@ -1701,7 +1699,7 @@
 {
   LPWSINFO              pwsi = wsi_find(GetCurrentTask());
 
-  dprintf_winsock(stddeb, "WS_AsyncGetHostByAddr32(%08x): hwnd %04x, msg %08x, addr %08x[%i]\n",
+  dprintf_info(winsock, "WS_AsyncGetHostByAddr32(%08x): hwnd %04x, msg %08x, addr %08x[%i]\n",
                           (unsigned)pwsi, (HWND16)hWnd, uMsg, (unsigned)addr , len );
 
   if( pwsi )
@@ -1719,7 +1717,7 @@
 {
   LPWSINFO              pwsi = wsi_find(GetCurrentTask());
 
-  dprintf_winsock(stddeb, "WS_AsyncGetHostByName16(%08x): hwnd %04x, msg %04x, host %s, 
+  dprintf_info(winsock, "WS_AsyncGetHostByName16(%08x): hwnd %04x, msg %04x, host %s, 
 buffer %i\n", (unsigned)pwsi, hWnd, uMsg, (name)?name:NULL_STRING, (int)buflen );
 
   if( pwsi )
@@ -1735,7 +1733,7 @@
 					LPSTR sbuf, INT32 buflen)
 {
   LPWSINFO              pwsi = wsi_find(GetCurrentTask());
-  dprintf_winsock(stddeb, "WS_AsyncGetHostByName32(%08x): hwnd %04x, msg %08x, host %s, 
+  dprintf_info(winsock, "WS_AsyncGetHostByName32(%08x): hwnd %04x, msg %08x, host %s, 
 buffer %i\n", (unsigned)pwsi, (HWND16)hWnd, uMsg, (name)?name:NULL_STRING, (int)buflen );
   if( pwsi )
     return __WSAsyncDBQuery(pwsi, hWnd, uMsg, 0, name, 0,
@@ -1752,7 +1750,7 @@
 {
   LPWSINFO              pwsi = wsi_find(GetCurrentTask());
 
-  dprintf_winsock(stddeb, "WS_AsyncGetProtoByName16(%08x): hwnd %04x, msg %08x, protocol %s\n",
+  dprintf_info(winsock, "WS_AsyncGetProtoByName16(%08x): hwnd %04x, msg %08x, protocol %s\n",
                           (unsigned)pwsi, (HWND16)hWnd, uMsg, (name)?name:NULL_STRING );
 
   if( pwsi )
@@ -1769,7 +1767,7 @@
 {
   LPWSINFO              pwsi = wsi_find(GetCurrentTask());
 
-  dprintf_winsock(stddeb, "WS_AsyncGetProtoByName32(%08x): hwnd %04x, msg %08x, protocol %s\n",
+  dprintf_info(winsock, "WS_AsyncGetProtoByName32(%08x): hwnd %04x, msg %08x, protocol %s\n",
                           (unsigned)pwsi, (HWND16)hWnd, uMsg, (name)?name:NULL_STRING );
 
   if( pwsi )
@@ -1787,7 +1785,7 @@
 {
   LPWSINFO              pwsi = wsi_find(GetCurrentTask());
 
-  dprintf_winsock(stddeb, "WS_AsyncGetProtoByNumber16(%08x): hwnd %04x, msg %04x, num %i\n",
+  dprintf_info(winsock, "WS_AsyncGetProtoByNumber16(%08x): hwnd %04x, msg %04x, num %i\n",
                           (unsigned)pwsi, hWnd, uMsg, number );
 
   if( pwsi )
@@ -1804,7 +1802,7 @@
 {
   LPWSINFO              pwsi = wsi_find(GetCurrentTask());
 
-  dprintf_winsock(stddeb, "WS_AsyncGetProtoByNumber32(%08x): hwnd %04x, msg %08x, num %i\n",
+  dprintf_info(winsock, "WS_AsyncGetProtoByNumber32(%08x): hwnd %04x, msg %08x, num %i\n",
                           (unsigned)pwsi, (HWND16)hWnd, uMsg, number );
 
   if( pwsi )
@@ -1822,7 +1820,7 @@
 {
   LPWSINFO              pwsi = wsi_find(GetCurrentTask());
 
-  dprintf_winsock(stddeb, "WS_AsyncGetServByName16(%08x): hwnd %04x, msg %04x, name %s, proto %s\n",
+  dprintf_info(winsock, "WS_AsyncGetServByName16(%08x): hwnd %04x, msg %04x, name %s, proto %s\n",
                    (unsigned)pwsi, hWnd, uMsg, (name)?name:NULL_STRING, (proto)?proto:NULL_STRING );
 
   if( pwsi )
@@ -1844,7 +1842,7 @@
 {
   LPWSINFO              pwsi = wsi_find(GetCurrentTask());
 
-  dprintf_winsock(stddeb, "WS_AsyncGetServByName32(%08x): hwnd %04x, msg %08x, name %s, proto %s\n",
+  dprintf_info(winsock, "WS_AsyncGetServByName32(%08x): hwnd %04x, msg %08x, name %s, proto %s\n",
            (unsigned)pwsi, (HWND16)hWnd, uMsg, (name)?name:NULL_STRING, (proto)?proto:NULL_STRING );
   if( pwsi )
   {
@@ -1866,7 +1864,7 @@
 {
   LPWSINFO              pwsi = wsi_find(GetCurrentTask());
 
-  dprintf_winsock(stddeb, "WS_AsyncGetServByPort16(%08x): hwnd %04x, msg %04x, port %i, proto %s\n",
+  dprintf_info(winsock, "WS_AsyncGetServByPort16(%08x): hwnd %04x, msg %04x, port %i, proto %s\n",
                            (unsigned)pwsi, hWnd, uMsg, port, (proto)?proto:NULL_STRING );
 
   if( pwsi )
@@ -1888,7 +1886,7 @@
 {
   LPWSINFO              pwsi = wsi_find(GetCurrentTask());
 
-  dprintf_winsock(stddeb, "WS_AsyncGetServByPort32(%08x): hwnd %04x, msg %08x, port %i, proto %s\n",
+  dprintf_info(winsock, "WS_AsyncGetServByPort32(%08x): hwnd %04x, msg %08x, port %i, proto %s\n",
                            (unsigned)pwsi, (HWND16)hWnd, uMsg, port, (proto)?proto:NULL_STRING );
 
   if( pwsi )
@@ -1912,7 +1910,7 @@
     LPWSINFO		pwsi = wsi_find(GetCurrentTask());
     ws_async_op*	p_aop = (ws_async_op*)WS_HANDLE2PTR(hAsyncTaskHandle);
 
-    dprintf_winsock(stddeb, "WS_CancelAsyncRequest(%08x): handle %08x\n", 
+    dprintf_info(winsock, "WS_CancelAsyncRequest(%08x): handle %08x\n", 
 			   (unsigned)pwsi, hAsyncTaskHandle);
     if( pwsi )
     {
@@ -1952,7 +1950,7 @@
     DWORD		dwEvent, dwErrBytes;
     int			num_posted;
 
-    dprintf_winsock(stddeb,"WINSOCK_HandleIO: %i pending descriptors\n", num_pending );
+    dprintf_info(winsock,"WINSOCK_HandleIO: %i pending descriptors\n", num_pending );
 
     for( num_posted = dwEvent = 0 ; psop; psop = psop->next )
     {
@@ -1970,7 +1968,7 @@
 	     * Reenabling calls turn them back on.
 	     */
 
-	    dprintf_winsock(stddeb,"\tchecking psop = 0x%08x\n", (unsigned) psop );
+	    dprintf_info(winsock,"\tchecking psop = 0x%08x\n", (unsigned) psop );
 
 	    num_pending--;
 
@@ -2046,7 +2044,7 @@
 		    if( PostMessage32A( psop->hWnd, psop->uMsg, (WPARAM32)WS_PTR2HANDLE(psop->pws), 
 			              (LPARAM)WSAMAKESELECTREPLY( WS_FD_WRITE, 0 ) ) )
 		    {
-			dprintf_winsock(stddeb, "\t    hwnd %04x - %04x, %08x\n",
+			dprintf_info(winsock, "\t    hwnd %04x - %04x, %08x\n",
                                 psop->hWnd, psop->uMsg, (unsigned)MAKELONG(WS_FD_WRITE, 0) );
 			FD_CLR( fd, &event_set[EVENT_IO_WRITE] );
 			num_posted++;
@@ -2108,7 +2106,7 @@
 
 	    if( bPost )
 	    {
-		dprintf_winsock(stddeb, "\t    hwnd %04x - %04x, %08x\n", 
+		dprintf_info(winsock, "\t    hwnd %04x - %04x, %08x\n", 
 				psop->hWnd, psop->uMsg, (unsigned)dwEvent );
 		PostMessage32A( psop->hWnd, psop->uMsg, 
 			      (WPARAM32)WS_PTR2HANDLE(psop->pws), (LPARAM)dwEvent );
@@ -2119,7 +2117,7 @@
 	if( num_pending <= 0 ) break;
     }
 
-    dprintf_winsock(stddeb, "\tdone, %i posted events\n", num_posted );
+    dprintf_info(winsock, "\tdone, %i posted events\n", num_posted );
     return ( num_posted ) ? TRUE : FALSE;
 }
 
@@ -2128,7 +2126,7 @@
     ws_socket*    pws  = (ws_socket*)WS_HANDLE2PTR(s);
     LPWSINFO      pwsi = wsi_find(GetCurrentTask());
 
-    dprintf_winsock(stddeb, "WS_AsyncSelect(%08x): %04x, hWnd %04x, uMsg %08x, event %08x\n",
+    dprintf_info(winsock, "WS_AsyncSelect(%08x): %04x, hWnd %04x, uMsg %08x, event %08x\n",
 			  (unsigned)pwsi, (SOCKET16)s, (HWND16)hWnd, uMsg, (unsigned)lEvent );
     if( _check_ws(pwsi, pws) )
     {
@@ -2149,7 +2147,7 @@
 	    if( pws->flags & (WS_FD_CONNECT | WS_FD_WRITE) )
 		EVENT_DeleteIO( pws->fd, EVENT_IO_WRITE );
 
-	    dprintf_winsock(stddeb,"\tremoving psop = 0x%08x\n", (unsigned) psop );
+	    dprintf_info(winsock,"\tremoving psop = 0x%08x\n", (unsigned) psop );
 
 	    WS_FREE( pws->psop );
 	    pws->flags &= ~(WS_FD_RAW | WS_FD_ACCEPT | WS_FD_CONNECT | 
@@ -2188,7 +2186,7 @@
 
 		/* TODO: handle WS_FD_ACCEPT right away if the socket is readable */
 
-		dprintf_winsock(stddeb,"\tcreating psop = 0x%08x\n", (unsigned)psop );
+		dprintf_info(winsock,"\tcreating psop = 0x%08x\n", (unsigned)psop );
 
 		return 0; /* success */
 	    }
@@ -2213,7 +2211,7 @@
 {
   int i = set->fd_count;
   
-  dprintf_winsock(stddeb, "__WSAFDIsSet16(%d,%8lx(%i))\n", s,(unsigned long)set, i);
+  dprintf_info(winsock, "__WSAFDIsSet16(%d,%8lx(%i))\n", s,(unsigned long)set, i);
     
   while (i--)
       if (set->fd_array[i] == s) return 1;
@@ -2227,7 +2225,7 @@
 {
   int i = set->fd_count;
 
-  dprintf_winsock(stddeb, "__WSAFDIsSet32(%d,%8lx(%i))\n", s,(unsigned long)set, i);
+  dprintf_info(winsock, "__WSAFDIsSet32(%d,%8lx(%i))\n", s,(unsigned long)set, i);
 
   while (i--)
       if (set->fd_array[i] == s) return 1;
@@ -2247,7 +2245,7 @@
    * Note: It is allowed to call this function without prior WSAStartup().
    */
 
-  dprintf_winsock(stddeb, "WS_IsBlocking()\n");
+  dprintf_info(winsock, "WS_IsBlocking()\n");
   return FALSE;
 }
 
@@ -2258,7 +2256,7 @@
 {
   LPWSINFO              pwsi = wsi_find(GetCurrentTask());
 
-  dprintf_winsock(stddeb, "WS_CancelBlockingCall(%08x)\n", (unsigned)pwsi);
+  dprintf_info(winsock, "WS_CancelBlockingCall(%08x)\n", (unsigned)pwsi);
 
   if( pwsi ) return 0;
   return SOCKET_ERROR;
@@ -2273,7 +2271,7 @@
   FARPROC16		prev;
   LPWSINFO              pwsi = wsi_find(GetCurrentTask());
 
-  dprintf_winsock(stddeb, "WS_SetBlockingHook16(%08x): hook %08x\n", 
+  dprintf_info(winsock, "WS_SetBlockingHook16(%08x): hook %08x\n", 
 			  (unsigned)pwsi, (unsigned) lpBlockFunc);
   if( pwsi ) 
   { 
@@ -2294,7 +2292,7 @@
   FARPROC32             prev;
   LPWSINFO              pwsi = wsi_find(GetCurrentTask());
 
-  dprintf_winsock(stddeb, "WS_SetBlockingHook32(%08x): hook %08x\n",
+  dprintf_info(winsock, "WS_SetBlockingHook32(%08x): hook %08x\n",
                           (unsigned)pwsi, (unsigned) lpBlockFunc);
   if( pwsi ) {
       prev = (FARPROC32)pwsi->blocking_hook;
@@ -2313,7 +2311,7 @@
 {
     LPWSINFO              pwsi = wsi_find(GetCurrentTask());
 
-    dprintf_winsock(stddeb, "WS_UnhookBlockingHook16(%08x)\n", (unsigned)pwsi);
+    dprintf_info(winsock, "WS_UnhookBlockingHook16(%08x)\n", (unsigned)pwsi);
     if( pwsi ) return (INT16)(pwsi->blocking_hook = 0);
     return SOCKET_ERROR;
 }
@@ -2326,7 +2324,7 @@
 {
     LPWSINFO              pwsi = wsi_find(GetCurrentTask());
 
-    dprintf_winsock(stddeb, "WS_UnhookBlockingHook32(%08x)\n", (unsigned)pwsi);
+    dprintf_info(winsock, "WS_UnhookBlockingHook32(%08x)\n", (unsigned)pwsi);
     if( pwsi )
     {
 	pwsi->blocking_hook = 0;
@@ -2573,10 +2571,10 @@
 {
     int	loc_errno = errno; 
 #if defined(__FreeBSD__)
-       dprintf_winsock(stderr, "winsock: errno %d, (%s).\n", 
+       dprintf_err(winsock, "winsock: errno %d, (%s).\n", 
                 			 errno, strerror(errno));
 #else
-       dprintf_winsock(stderr, "winsock: errno %d\n", errno);
+       dprintf_err(winsock, "winsock: errno %d\n", errno);
 #endif
 
     switch(loc_errno)
@@ -2648,13 +2646,10 @@
     int		loc_errno = h_errno;
 
 #if defined(__FreeBSD__)
-    dprintf_winsock(stderr, "winsock: h_errno %d, (%s).\n", 
+    dprintf_err(winsock, "winsock: h_errno %d, (%s).\n", 
                	    h_errno, strerror(h_errno));
 #else
-    dprintf_winsock(stderr, "winsock: h_errno %d.\n", h_errno);
-#ifndef sun
-    if( debugging_winsock )  herror("wine: winsock: wsaherrno");
-#endif
+    dprintf_err(winsock, "winsock: h_errno %d.\n", h_errno);
 #endif
 
     switch(loc_errno)
diff --git a/misc/winsock_dns.c b/misc/winsock_dns.c
index 4150b9c..029d973 100644
--- a/misc/winsock_dns.c
+++ b/misc/winsock_dns.c
@@ -136,7 +136,7 @@
     int num = 0;
     ws_async_op*   p, *next;
 
-    dprintf_winsock(stddeb,"\tcancelling async DNS requests... ");
+    dprintf_info(winsock," cancelling async DNS requests... \n");
 
     SIGNAL_MaskAsyncEvents( TRUE );
     next = __async_op_list;
@@ -153,7 +153,7 @@
 	}
     }
     SIGNAL_MaskAsyncEvents( FALSE );
-    dprintf_winsock(stddeb,"%i total\n", num );
+    dprintf_info(winsock," -> %i total\n", num );
 }
 
 void WINSOCK_link_async_op(ws_async_op* p_aop)
@@ -176,7 +176,7 @@
 	  {
 	      ws_async_op* dead = p;
 
-	      dprintf_winsock(stddeb,"\treaping dead aop [%08x]\n", (unsigned)p );
+	      dprintf_info(winsock,"\treaping dead aop [%08x]\n", (unsigned)p );
 
 	      p = p->next;
 	      WINSOCK_unlink_async_op( dead );
@@ -343,7 +343,7 @@
 	    async_ctl.ws_aop->pid = fork();
 	    if( async_ctl.ws_aop->pid )
 	    {
-		dprintf_winsock(stddeb, "\tasync_op = %04x (child %i)\n", 
+		dprintf_info(winsock, "\tasync_op = %04x (child %i)\n", 
 				handle, async_ctl.ws_aop->pid);
 
 		close(async_ctl.ws_aop->fd[1]);  /* write endpoint */
@@ -452,7 +452,7 @@
 	 : gethostbyaddr(async_ctl.rq.name,
 		 	 async_ctl.ilength, async_ctl.type);
 
-  dprintf_winsock(stddeb,"DNS: got hostent for [%s]\n", async_ctl.rq.name );
+  dprintf_info(winsock,"DNS: got hostent for [%s]\n", async_ctl.rq.name );
 
   if( p_he ) /* convert to the Winsock format with internal pointers as offsets */
       size = WS_dup_he(pwsi, p_he, WS_DUP_OFFSET | 
@@ -476,7 +476,7 @@
 	 ? getprotobyname(async_ctl.rq.name)
 	 : getprotobynumber(async_ctl.type);
 
-  dprintf_winsock(stddeb,"DNS: got protoent for [%s]\n", async_ctl.rq.name );
+  dprintf_info(winsock,"DNS: got protoent for [%s]\n", async_ctl.rq.name );
 
   if( p_pe ) /* convert to the Winsock format with internal pointers as offsets */
       size = WS_dup_pe(pwsi, p_pe, WS_DUP_OFFSET |
diff --git a/misc/wsprintf.c b/misc/wsprintf.c
index 936afd0..043f5e9 100644
--- a/misc/wsprintf.c
+++ b/misc/wsprintf.c
@@ -11,7 +11,7 @@
 #include "ldt.h"
 #include "stackframe.h"
 #include "debug.h"
-#include "stddebug.h"
+
 
 #define WPRINTF_LEFTALIGN   0x0001  /* Align output on the left ('-' prefix) */
 #define WPRINTF_PREFIX_HEX  0x0002  /* Prefix hex with 0x ('#' prefix) */
@@ -396,7 +396,7 @@
         maxlen -= len;
     }
     *p = 0;
-    dprintf_string(stddeb,"%s\n",buffer);
+    dprintf_info(string,"%s\n",buffer);
     return (maxlen > 1) ? (INT32)(p - buffer) : -1;
 }
 
@@ -477,7 +477,7 @@
  */
 INT16 WINAPI wvsprintf16( LPSTR buffer, LPCSTR spec, LPCVOID args )
 {
-    dprintf_string(stddeb,"wvsprintf16 for %p got ",buffer);
+    dprintf_info(string,"wvsprintf16 for %p got:\n",buffer);
     return wvsnprintf16( buffer, 0xffff, spec, args );
 }
 
@@ -487,7 +487,7 @@
  */
 INT32 WINAPI wvsprintf32A( LPSTR buffer, LPCSTR spec, va_list args )
 {
-    dprintf_string(stddeb,"wvsprintf32A for %p got ",buffer);
+    dprintf_info(string,"wvsprintf32A for %p got:\n",buffer);
     return wvsnprintf32A( buffer, 0xffffffff, spec, args );
 }
 
@@ -497,7 +497,7 @@
  */
 INT32 WINAPI wvsprintf32W( LPWSTR buffer, LPCWSTR spec, va_list args )
 {
-    dprintf_string(stddeb,"wvsprintf32W for %p got ",buffer);
+    dprintf_info(string,"wvsprintf32W for %p got:\n",buffer);
     return wvsnprintf32W( buffer, 0xffffffff, spec, args );
 }
 
@@ -511,7 +511,7 @@
     va_list valist;
     INT16 res;
 
-    dprintf_string(stddeb,"wsprintf16 for %p got ",buffer);
+    dprintf_info(string,"wsprintf16 for %p got:\n",buffer);
     va_start( valist, spec );
     /* Note: we call the 32-bit version, because the args are 32-bit */
     res = (INT16)wvsnprintf32A( buffer, 0xffffffff, spec, valist );
@@ -529,7 +529,7 @@
     VA_START16( valist );
     buffer = VA_ARG16( valist, SEGPTR );
     spec   = VA_ARG16( valist, SEGPTR );
-    dprintf_string(stddeb,"WIN16_wsprintf16 got ");
+    dprintf_info(string,"WIN16_wsprintf16 got:\n");
     res = wvsnprintf16( (LPSTR)PTR_SEG_TO_LIN(buffer), 0xffff,
                         (LPCSTR)PTR_SEG_TO_LIN(spec), valist );
     VA_END16( valist );
@@ -545,7 +545,7 @@
     va_list valist;
     INT32 res;
 
-    dprintf_string(stddeb,"wsprintf32A for %p got ",buffer);
+    dprintf_info(string,"wsprintf32A for %p got:\n",buffer);
     va_start( valist, spec );
     res = wvsnprintf32A( buffer, 0xffffffff, spec, valist );
     va_end( valist );
@@ -561,7 +561,7 @@
     va_list valist;
     INT32 res;
 
-    dprintf_string(stddeb,"wsprintf32W for %p\n",buffer);
+    dprintf_info(string,"wsprintf32W for %p\n",buffer);
     va_start( valist, spec );
     res = wvsnprintf32W( buffer, 0xffffffff, spec, valist );
     va_end( valist );
diff --git a/miscemu/emulate.c b/miscemu/emulate.c
index 6e5ec58..9261eaa 100644
--- a/miscemu/emulate.c
+++ b/miscemu/emulate.c
@@ -1,8 +1,6 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include "miscemu.h"
-#include "stddebug.h"
-/* #define DEBUG_INT */
 #include "debug.h"
 
 struct Win87EmInfoStruct
@@ -30,7 +28,7 @@
 
 void WINAPI WIN87_fpmath( CONTEXT *context )
 {
-    dprintf_int(stddeb, "_fpmath: (cs:eip=%x:%lx es=%x bx=%04x ax=%04x dx==%04x)\n",
+    dprintf_info(int, "_fpmath: (cs:eip=%x:%lx es=%x bx=%04x ax=%04x dx==%04x)\n",
                  (WORD)CS_reg(context), EIP_reg(context),
                  (WORD)ES_reg(context), BX_reg(context),
                  AX_reg(context), DX_reg(context) );
@@ -76,7 +74,7 @@
              */
 /* FIXME: could someone who really understands asm() fix this please? --AJ */
 /*            __asm__("fistp %0;wait" : "=m" (dw) : : "memory"); */
-            dprintf_int(stddeb,"emulate.c:On top of stack was %ld\n",dw);
+            dprintf_info(int,"emulate.c:On top of stack was %ld\n",dw);
             AX_reg(context) = LOWORD(dw);
             DX_reg(context) = HIWORD(dw);
         }
@@ -110,18 +108,18 @@
 void WINAPI WIN87_WinEm87Info(struct Win87EmInfoStruct *pWIS,
                               int cbWin87EmInfoStruct)
 {
-  dprintf_int(stddeb, "__WinEm87Info(%p,%d)\n",pWIS,cbWin87EmInfoStruct);
+  dprintf_info(int, "__WinEm87Info(%p,%d)\n",pWIS,cbWin87EmInfoStruct);
 }
 
 void WINAPI WIN87_WinEm87Restore(void *pWin87EmSaveArea,
                                  int cbWin87EmSaveArea)
 {
-  dprintf_int(stddeb, "__WinEm87Restore(%p,%d)\n",
+  dprintf_info(int, "__WinEm87Restore(%p,%d)\n",
 	pWin87EmSaveArea,cbWin87EmSaveArea);
 }
 
 void WINAPI WIN87_WinEm87Save(void *pWin87EmSaveArea, int cbWin87EmSaveArea)
 {
-  dprintf_int(stddeb, "__WinEm87Save(%p,%d)\n",
+  dprintf_info(int, "__WinEm87Save(%p,%d)\n",
 	pWin87EmSaveArea,cbWin87EmSaveArea);
 }
diff --git a/msdos/dosmem.c b/msdos/dosmem.c
index ba866a4..8c326db 100644
--- a/msdos/dosmem.c
+++ b/msdos/dosmem.c
@@ -226,6 +226,7 @@
                                   DOSMEM_dosmem+(addr), 0x10000, hKernel, \
                                   FALSE, FALSE, FALSE, NULL ))
 
+    SET_ENTRY_POINT( 183, 0x00000 );  /* KERNEL.183: __0000H */
     SET_ENTRY_POINT( 174, 0xa0000 );  /* KERNEL.174: __A000H */
     SET_ENTRY_POINT( 181, 0xb0000 );  /* KERNEL.181: __B000H */
     SET_ENTRY_POINT( 182, 0xb8000 );  /* KERNEL.182: __B800H */
@@ -386,7 +387,7 @@
    LPVOID       lin;
 
    lin=DOSMEM_dosmem+(x&0xffff)+(((x&0xffff0000)>>16)*16);
-   dprintf_selector(stddeb,"DOSMEM_MapR2L(0x%08lx) returns 0x%p.\n",
+   dprintf_info(selector,"DOSMEM_MapR2L(0x%08lx) returns 0x%p.\n",
                     x,lin );
    return lin;
 }
@@ -405,7 +406,7 @@
 		GMEM_FIXED,DOSMEM_dosmem+realsel*16,0x10000,
 		hModule,FALSE,FALSE,FALSE,NULL
 	);
-	dprintf_selector(stddeb,"DOSMEM_AllocSelector(0x%04x) returns 0x%04x.\n",
+	dprintf_info(selector,"DOSMEM_AllocSelector(0x%04x) returns 0x%04x.\n",
 		realsel,sel
 	);
 	return sel;
diff --git a/msdos/dpmi.c b/msdos/dpmi.c
index 907f081..d4648c6 100644
--- a/msdos/dpmi.c
+++ b/msdos/dpmi.c
@@ -15,7 +15,6 @@
 #include "drive.h"
 #include "msdos.h"
 #include "toolhelp.h"
-#include "stddebug.h"
 #include "debug.h"
 
 #define DOS_GET_DRIVE(reg) ((reg) ? (reg) - 1 : DRIVE_GetCurrentDrive())
@@ -461,9 +460,7 @@
             break;
         }
     case 0x0501:  /* Allocate memory block */
-        if (!(ptr = (BYTE *)HeapAlloc( GetProcessHeap(), 0,
-                                       MAKELONG( CX_reg(context),
-                                                 BX_reg(context) ))))
+	if (!(ptr = (BYTE *)VirtualAlloc(NULL, MAKELONG(CX_reg(context), BX_reg(context)), MEM_COMMIT, PAGE_EXECUTE_READWRITE)))
         {
             AX_reg(context) = 0x8012;  /* linear memory not available */
             SET_CFLAG(context);
@@ -476,8 +473,7 @@
         break;
 
     case 0x0502:  /* Free memory block */
-        HeapFree( GetProcessHeap(), 0,
-                  (void *)MAKELONG( DI_reg(context), SI_reg(context) ) );
+	VirtualFree((void *)MAKELONG(DI_reg(context), SI_reg(context)), 0, MEM_RELEASE);
         break;
 
     case 0x0503:  /* Resize memory block */
diff --git a/msdos/int10.c b/msdos/int10.c
index e73d5bd..2f37107 100644
--- a/msdos/int10.c
+++ b/msdos/int10.c
@@ -5,7 +5,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include "miscemu.h"
-#include "stddebug.h"
 /* #define DEBUG_INT */
 #include "debug.h"
 
diff --git a/msdos/int11.c b/msdos/int11.c
index c66f20c..4de3d41 100644
--- a/msdos/int11.c
+++ b/msdos/int11.c
@@ -7,7 +7,6 @@
 #include "miscemu.h"
 #include "msdos.h"
 #include "drive.h"
-#include "stddebug.h"
 #include "debug.h"
 
 /**********************************************************************
diff --git a/msdos/int13.c b/msdos/int13.c
index b46b6a2..8fa70ab 100644
--- a/msdos/int13.c
+++ b/msdos/int13.c
@@ -13,7 +13,6 @@
 #include <linux/fd.h>
 #endif
 #include "miscemu.h"
-#include "stddebug.h"
 /* #define DEBUG_INT */
 #include "debug.h"
 #include "drive.h"
diff --git a/msdos/int15.c b/msdos/int15.c
index 5d3ad57..7bc9c6a 100644
--- a/msdos/int15.c
+++ b/msdos/int15.c
@@ -5,7 +5,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include "miscemu.h"
-#include "stddebug.h"
 #include "debug.h"
 
 
diff --git a/msdos/int1a.c b/msdos/int1a.c
index 1e8157a..90c03c5 100644
--- a/msdos/int1a.c
+++ b/msdos/int1a.c
@@ -8,8 +8,6 @@
 #include <stdlib.h>
 #include "options.h"
 #include "miscemu.h"
-#include "stddebug.h"
-/* #define DEBUG_INT */
 #include "debug.h"
 
 #define	BCD_TO_BIN(x) ((x&15) + (x>>4)*10)
@@ -57,7 +55,7 @@
             CX_reg(context) = HIWORD(ticks);
             DX_reg(context) = LOWORD(ticks);
             AX_reg(context) = 0;  /* No midnight rollover */
-            dprintf_int(stddeb,"int1a_00 // ticks=%ld\n", ticks);
+            dprintf_info(int,"int1a_00 // ticks=%ld\n", ticks);
             break;
 		
 	case 2: 
diff --git a/msdos/int20.c b/msdos/int20.c
index a84a4d7..8ed6684 100644
--- a/msdos/int20.c
+++ b/msdos/int20.c
@@ -5,7 +5,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include "miscemu.h"
-#include "stddebug.h"
 /* #define DEBUG_INT */
 #include "debug.h"
 #include "task.h"
diff --git a/msdos/int21.c b/msdos/int21.c
index 0fa7a21..04df4e1 100644
--- a/msdos/int21.c
+++ b/msdos/int21.c
@@ -24,7 +24,6 @@
 #include "task.h"
 #include "options.h"
 #include "miscemu.h"
-#include "stddebug.h"
 #include "debug.h"
 #if defined(__svr4__) || defined(_SCO_DS)
 /* SVR4 DOESNT do locking the same way must implement properly */
@@ -170,7 +169,7 @@
         }
         else if (heap || INT21_CreateHeap())
         {
-                dprintf_int(stddeb, "int21: GetDrivePB not fully implemented.\n");
+                dprintf_fixme(int, "int21: GetDrivePB not fully implemented.\n");
 
                 /* FIXME: I have no idea what a lot of this information should
                  * say or whether it even really matters since we're not allowing
@@ -207,7 +206,7 @@
 static void ioctlGetDeviceInfo( CONTEXT *context )
 {
     int curr_drive;
-    dprintf_int (stddeb, "int21: ioctl (%d, GetDeviceInfo)\n", BX_reg(context));
+    dprintf_info(int, "int21: ioctl (%d, GetDeviceInfo)\n", BX_reg(context));
     
     curr_drive = DRIVE_GetCurrentDrive();
     DX_reg(context) = 0x0140 + curr_drive + ((curr_drive > 1) ? 0x0800 : 0); /* no floppy */
@@ -239,7 +238,7 @@
 	switch (CL_reg(context)) 
 	{
 		case 0x4a: /* lock logical volume */
-			dprintf_int(stddeb,"int21: lock logical volume (%d) level %d mode %d\n",drive,BH_reg(context),DX_reg(context));
+			dprintf_info(int,"int21: lock logical volume (%d) level %d mode %d\n",drive,BH_reg(context),DX_reg(context));
 			break;
 
 		case 0x60: /* get device parameters */
@@ -280,7 +279,7 @@
 			break;
 
 		case 0x6a:
-			dprintf_int(stddeb,"int21: logical volume %d unlocked.\n",drive);
+			dprintf_info(int,"int21: logical volume %d unlocked.\n",drive);
 			break;
 
 		default:
@@ -337,7 +336,7 @@
 	    break;
 
 	  case 0x30:    /* DENYREAD */
-	    dprintf_int(stddeb,
+	    dprintf_info(int,
 	      "OpenExistingFile (%s): DENYREAD changed to DENYALL\n",
 	      (char *)PTR_SEG_OFF_TO_LIN(DS_reg(context),DX_reg(context)));
 	  case 0x10:    /* DENYALL */  
@@ -425,7 +424,7 @@
 	  CloseFile(context);
 	  AX_reg(context) = 0x0050;	/*File exists*/
 	  SET_CFLAG(context);
-	  dprintf_int(stddeb, "int21: extended open/create: failed because file exists \n");
+	  dprintf_warn(int, "int21: extended open/create: failed because file exists \n");
       }
       else if ((action & 0x07) == 2) 
       {
@@ -434,7 +433,7 @@
 	{
 		  BX_reg(context) = AX_reg(context);
 		  CloseFile(context);
-		  dprintf_int(stddeb, "int21: extended open/create: failed, trunc on ro file");
+		  dprintf_warn(int, "int21: extended open/create: failed, trunc on ro file\n");
 		  AX_reg(context) = 0x000C;	/*Access code invalid*/
 		  SET_CFLAG(context);
 	}
@@ -443,19 +442,19 @@
 		/* Shuffle arguments to call CloseFile while
 		 * preserving BX and DX */
 
-		dprintf_int(stddeb, "int21: extended open/create: Closing before truncate\n");
+		dprintf_info(int, "int21: extended open/create: Closing before truncate\n");
 		BX_reg(context) = AX_reg(context);
 		CloseFile(context);
 		if (EFL_reg(context) & 0x0001) 
 		{
-		   dprintf_int(stddeb, "int21: extended open/create: close before trunc failed");
+		   dprintf_warn(int, "int21: extended open/create: close before trunc failed\n");
 		   AX_reg(context) = 0x0019;	/*Seek Error*/
 		   CX_reg(context) = 0;
 		   SET_CFLAG(context);
 		}
 		/* Shuffle arguments to call CreateFile */
 
-		dprintf_int(stddeb, "int21: extended open/create: Truncating\n");
+		dprintf_info(int, "int21: extended open/create: Truncating\n");
 		AL_reg(context) = BL_reg(context);
 		/* CX is still the same */
 		DX_reg(context) = SI_reg(context);
@@ -463,7 +462,7 @@
 
 		if (EFL_reg(context) & 0x0001) 	/*no file open, flags set */
 		{
-		    dprintf_int(stddeb, "int21: extended open/create: trunc failed");
+		    dprintf_warn(int, "int21: extended open/create: trunc failed\n");
 		    return bExtendedError;
 		}
 		uReturnCX = 0x3;
@@ -480,19 +479,19 @@
       {
 	CX_reg(context) = 0;
 	SET_CFLAG(context);
-	dprintf_int(stddeb, "int21: extended open/create: failed, file dosen't exist\n");
+	dprintf_warn(int, "int21: extended open/create: failed, file dosen't exist\n");
       }
       else
       {
         /* Shuffle arguments to call CreateFile */
-        dprintf_int(stddeb, "int21: extended open/create: Creating\n");
+        dprintf_info(int, "int21: extended open/create: Creating\n");
         AL_reg(context) = BL_reg(context);
         /* CX should still be the same */
         DX_reg(context) = SI_reg(context);
         bExtendedError = INT21_CreateFile(context);
         if (EFL_reg(context) & 0x0001)  /*no file open, flags set */
 	{
-  	    dprintf_int(stddeb, "int21: extended open/create: create failed\n");
+  	    dprintf_warn(int, "int21: extended open/create: create failed\n");
 	    return bExtendedError;
         }
         CX_reg(context) = 2;
@@ -508,7 +507,7 @@
     int drive;
     char *dirname = PTR_SEG_OFF_TO_LIN(DS_reg(context),DX_reg(context));
 
-    dprintf_int(stddeb,"int21: changedir %s\n", dirname);
+    dprintf_info(int,"int21: changedir %s\n", dirname);
     if (dirname[0] && (dirname[1] == ':'))
     {
         drive = toupper(dirname[0]) - 'A';
@@ -606,7 +605,7 @@
 
         if ((AX_reg(context) = _lcreat_uniq( name, 0 )) != (WORD)HFILE_ERROR16)
         {
-            dprintf_int( stddeb, "INT21_CreateTempFile: created %s\n", name );
+            dprintf_info(int, "INT21_CreateTempFile: created %s\n", name );
             return TRUE;
         }
         if (DOS_ExtendedError != ER_FileExists) return FALSE;
@@ -811,7 +810,7 @@
 {
     BOOL32	bSetDOSExtendedError = FALSE;
 
-    dprintf_int( stddeb, "int21: AX=%04x BX=%04x CX=%04x DX=%04x "
+    dprintf_info(int, "int21: AX=%04x BX=%04x CX=%04x DX=%04x "
                  "SI=%04x DI=%04x DS=%04x ES=%04x EFL=%08lx\n",
                  AX_reg(context), BX_reg(context), CX_reg(context),
                  DX_reg(context), SI_reg(context), DI_reg(context),
@@ -920,7 +919,7 @@
         {
             TDB *pTask = (TDB *)GlobalLock16( GetCurrentTask() );
             pTask->dta = PTR_SEG_OFF_TO_SEGPTR(DS_reg(context),DX_reg(context));
-            dprintf_int(stddeb, "int21: Set DTA: %08lx\n", pTask->dta);
+            dprintf_info(int, "int21: Set DTA: %08lx\n", pTask->dta);
         }
         break;
 
@@ -1584,9 +1583,9 @@
     case 0x70: /* MS-DOS 7 (Windows95) - ??? (country-specific?)*/
     case 0x72: /* MS-DOS 7 (Windows95) - ??? */
     case 0x73: /* MS-DOS 7 (Windows95) - DRIVE LOCKING ??? */
-        dprintf_int(stddeb,"int21: windows95 function AX %04x\n",
+        dprintf_info(int,"int21: windows95 function AX %04x\n",
                     AX_reg(context));
-        dprintf_int(stddeb, "        returning unimplemented\n");
+        dprintf_warn(int, "        returning unimplemented\n");
         SET_CFLAG(context);
         AL_reg(context) = 0;
         break;
@@ -1607,7 +1606,7 @@
 	SET_CFLAG(context);
     }
 
-    dprintf_int( stddeb, "ret21: AX=%04x BX=%04x CX=%04x DX=%04x "
+    dprintf_info(int, "ret21: AX=%04x BX=%04x CX=%04x DX=%04x "
                  "SI=%04x DI=%04x DS=%04x ES=%04x EFL=%08lx\n",
                  AX_reg(context), BX_reg(context), CX_reg(context),
                  DX_reg(context), SI_reg(context), DI_reg(context),
diff --git a/msdos/int25.c b/msdos/int25.c
index 2fd6d73..d927394 100644
--- a/msdos/int25.c
+++ b/msdos/int25.c
@@ -11,8 +11,6 @@
 #include "ldt.h"
 #include "miscemu.h"
 #include "drive.h"
-#include "stddebug.h"
-/* #define DEBUG_INT */
 #include "debug.h"
 
 /**********************************************************************
@@ -44,7 +42,7 @@
         begin  = DX_reg(context);
         length = CX_reg(context);
     }
-    dprintf_int( stdnimp, "int25: abs diskread, drive %d, sector %ld, "
+    dprintf_info(int, "int25: abs diskread, drive %d, sector %ld, "
                  "count %ld, buffer %d\n",
                  AL_reg(context), begin, length, (int) dataptr);
 
@@ -63,3 +61,4 @@
     }
     RESET_CFLAG(context);
 }
+
diff --git a/msdos/int26.c b/msdos/int26.c
index c24f1a9..b5ffe16 100644
--- a/msdos/int26.c
+++ b/msdos/int26.c
@@ -10,8 +10,6 @@
 #include "ldt.h"
 #include "miscemu.h"
 #include "drive.h"
-#include "stddebug.h"
-/* #define DEBUG_INT */
 #include "debug.h"
 
 /**********************************************************************
@@ -44,7 +42,7 @@
         length = CX_reg(context);
     }
 		
-    dprintf_int( stdnimp,"int26: abs diskwrite, drive %d, sector %ld, "
+    dprintf_info(int,"int26: abs diskwrite, drive %d, sector %ld, "
                  "count %ld, buffer %d\n",
                  AL_reg(context), begin, length, (int) dataptr );
 
diff --git a/msdos/int2a.c b/msdos/int2a.c
index 35b6c22..dcad173 100644
--- a/msdos/int2a.c
+++ b/msdos/int2a.c
@@ -6,7 +6,6 @@
 #include <stdlib.h>
 #include "msdos.h"
 #include "miscemu.h"
-#include "stddebug.h"
 /* #define DEBUG_INT */
 #include "debug.h"
 
diff --git a/msdos/int2f.c b/msdos/int2f.c
index c8efcab..f31ad61 100644
--- a/msdos/int2f.c
+++ b/msdos/int2f.c
@@ -11,7 +11,6 @@
 #include "msdos.h"
 #include "miscemu.h"
 #include "module.h"
-#include "stddebug.h"
 /* #define DEBUG_INT */
 #include "debug.h"
 
diff --git a/msdos/int3d.c b/msdos/int3d.c
index 8e517d4..57b9995 100644
--- a/msdos/int3d.c
+++ b/msdos/int3d.c
@@ -7,7 +7,6 @@
 #include <stdlib.h>
 #include "msdos.h"
 #include "miscemu.h"
-#include "stddebug.h"
 /* #define DEBUG_INT */
 #include "debug.h"
 
diff --git a/msdos/int5c.c b/msdos/int5c.c
index 6a17e8a..e5cce57 100644
--- a/msdos/int5c.c
+++ b/msdos/int5c.c
@@ -6,7 +6,6 @@
 
 #include "ldt.h"
 #include "miscemu.h"
-#include "stddebug.h"
 #include "debug.h"
 
 
diff --git a/msdos/interrupts.c b/msdos/interrupts.c
index 31710fd..6058be7 100644
--- a/msdos/interrupts.c
+++ b/msdos/interrupts.c
@@ -12,7 +12,6 @@
 #include "msdos.h"
 #include "module.h"
 #include "stackframe.h"
-#include "stddebug.h"
 #include "debug.h"
 
 static FARPROC16 INT_Vectors[256];
@@ -36,7 +35,7 @@
  */
 void INT_SetHandler( BYTE intnum, FARPROC16 handler )
 {
-    dprintf_int( stddeb, "Set interrupt vector %02x <- %04x:%04x\n",
+    dprintf_info(int, "Set interrupt vector %02x <- %04x:%04x\n",
                  intnum, HIWORD(handler), LOWORD(handler) );
     INT_Vectors[intnum] = handler;
 }
diff --git a/msdos/ioports.c b/msdos/ioports.c
index c357c37..a63d305 100644
--- a/msdos/ioports.c
+++ b/msdos/ioports.c
@@ -18,7 +18,6 @@
 #include <unistd.h>
 #include "windows.h"
 #include "options.h"
-#include "stddebug.h"
 #include "debug.h"
 
 static BYTE cmosaddress;
@@ -224,7 +223,7 @@
     }
 #endif
 
-    dprintf_int(stddeb, "IO: %d bytes from port 0x%02x ", count, port );
+    dprintf_info(int, "IO: %d bytes from port 0x%02x\n", count, port );
 
     while (count-- > 0)
     {
@@ -244,7 +243,7 @@
         port++;
         res = (res << 8) | b;
     }
-    dprintf_int(stddeb, "( 0x%lx )\n", res );
+    dprintf_info(int, "  returning ( 0x%lx )\n", res );
     return res;
 }
 
@@ -256,7 +255,7 @@
 {
     BYTE b;
 
-    dprintf_int( stddeb, "IO: 0x%lx (%d bytes) to port 0x%02x\n",
+    dprintf_info(int, "IO: 0x%lx (%d bytes) to port 0x%02x\n",
                  value, count, port );
 
 #ifdef DIRECT_IO_ACCESS
diff --git a/msdos/vxd.c b/msdos/vxd.c
index 643967f..8a3b77a 100644
--- a/msdos/vxd.c
+++ b/msdos/vxd.c
@@ -8,8 +8,6 @@
 #include "windows.h"
 #include "msdos.h"
 #include "miscemu.h"
-#include "stddebug.h"
-/* #define DEBUG_VXD */
 #include "debug.h"
 
 
@@ -37,18 +35,18 @@
 
     /* taken from Ralf Brown's Interrupt List */
 
-    dprintf_vxd(stddeb,"VxD: [%04x] PageFile\n", (UINT16)service );
+    dprintf_info(vxd,"VxD: [%04x] PageFile\n", (UINT16)service );
 
     switch(service)
     {
     case 0x00: /* get version, is this windows version? */
-	dprintf_vxd(stddeb,"VxD PageFile: returning version\n");
+	dprintf_info(vxd,"VxD PageFile: returning version\n");
         AX_reg(context) = VXD_WinVersion();
 	RESET_CFLAG(context);
 	break;
 
     case 0x01: /* get swap file info */
-	dprintf_vxd(stddeb,"VxD PageFile: returning swap file info\n");
+	dprintf_info(vxd,"VxD PageFile: returning swap file info\n");
 	AX_reg(context) = 0x00; /* paging disabled */
 	ECX_reg(context) = 0;   /* maximum size of paging file */	
 	/* FIXME: do I touch DS:SI or DS:DI? */
@@ -56,12 +54,12 @@
 	break;
 
     case 0x02: /* delete permanent swap on exit */
-	dprintf_vxd(stddeb,"VxD PageFile: supposed to delete swap\n");
+	dprintf_info(vxd,"VxD PageFile: supposed to delete swap\n");
 	RESET_CFLAG(context);
 	break;
 
     case 0x03: /* current temporary swap file size */
-	dprintf_vxd(stddeb,"VxD PageFile: what is current temp. swap size\n");
+	dprintf_info(vxd,"VxD PageFile: what is current temp. swap size\n");
 	RESET_CFLAG(context);
 	break;
 
@@ -82,12 +80,12 @@
 {
     unsigned	service = DX_reg(context);
 
-    dprintf_vxd(stddeb,"VxD: [%04x] Shell\n", (UINT16)service);
+    dprintf_info(vxd,"VxD: [%04x] Shell\n", (UINT16)service);
 
     switch (service) /* Ralf Brown says EDX, but I use DX instead */
     {
     case 0x0000:
-	dprintf_vxd(stddeb,"VxD Shell: returning version\n");
+	dprintf_info(vxd,"VxD Shell: returning version\n");
         AX_reg(context) = VXD_WinVersion();
 	EBX_reg(context) = 1; /* system VM Handle */
 	break;
@@ -97,12 +95,12 @@
     case 0x0003:
     case 0x0004:
     case 0x0005:
-	dprintf_vxd(stddeb,"VxD Shell: EDX = %08lx\n",EDX_reg(context));
+	dprintf_info(vxd,"VxD Shell: EDX = %08lx\n",EDX_reg(context));
 	VXD_BARF( context, "shell" );
 	break;
 
     case 0x0006: /* SHELL_Get_VM_State */
-	dprintf_vxd(stddeb,"VxD Shell: returning VM state\n");
+	dprintf_info(vxd,"VxD Shell: returning VM state\n");
 	/* Actually we don't, not yet. We have to return a structure
          * and I am not to sure how to set it up and return it yet,
          * so for now let's do nothing. I can (hopefully) get this
@@ -128,7 +126,7 @@
     case 0x0015:
     case 0x0016:
     default:
- 	dprintf_vxd(stddeb,"VxD Shell: EDX = %08lx\n",EDX_reg(context)); 
+ 	dprintf_info(vxd,"VxD Shell: EDX = %08lx\n",EDX_reg(context)); 
 	VXD_BARF( context, "shell");
 	break;
     }
@@ -142,12 +140,12 @@
 {
     unsigned	service = AX_reg(context);
 
-    dprintf_vxd(stddeb,"VxD: [%04x] Comm\n", (UINT16)service);
+    dprintf_info(vxd,"VxD: [%04x] Comm\n", (UINT16)service);
 
     switch (service)
     {
     case 0x0000: /* get version */
-	dprintf_vxd(stddeb,"VxD Comm: returning version\n");
+	dprintf_info(vxd,"VxD Comm: returning version\n");
         AX_reg(context) = VXD_WinVersion();
 	RESET_CFLAG(context);
 	break;
@@ -167,7 +165,7 @@
 {
     unsigned service = AX_reg(context);
 
-    dprintf_vxd(stddeb,"VxD: [%04x] Virtual Timer\n", (UINT16)service);
+    dprintf_info(vxd,"VxD: [%04x] Virtual Timer\n", (UINT16)service);
 
     switch(service)
     {
diff --git a/multimedia/audio.c b/multimedia/audio.c
index 8abae8c..768180f 100644
--- a/multimedia/audio.c
+++ b/multimedia/audio.c
@@ -24,7 +24,6 @@
 #include "mmsystem.h"
 #include "heap.h"
 #include "ldt.h"
-#include "stddebug.h"
 #include "debug.h"
 
 #ifdef HAVE_OSS
@@ -88,7 +87,7 @@
 static DWORD WAVE_NotifyClient(UINT16 wDevID, WORD wMsg, 
 				DWORD dwParam1, DWORD dwParam2)
 {
-	dprintf_mciwave(stddeb,"WAVE_NotifyClient // wDevID = %04X wMsg = %d dwParm1 = %04lX dwParam2 = %04lX\n",wDevID, wMsg, dwParam1, dwParam2);
+	dprintf_info(mciwave,"WAVE_NotifyClient // wDevID = %04X wMsg = %d dwParm1 = %04lX dwParam2 = %04lX\n",wDevID, wMsg, dwParam1, dwParam2);
 
 	switch (wMsg) {
 	case WOM_OPEN:
@@ -104,7 +103,7 @@
 		WOutDev[wDevID].waveDesc.dwInstance, 
                 dwParam1, 
                 dwParam2)) {
-	    dprintf_mciwave(stddeb,"WAVE_NotifyClient // can't notify client !\n");
+	    dprintf_warn(mciwave, "WAVE_NotifyClient // can't notify client !\n");
 	    return MMSYSERR_NOERROR;
 	  }
 	  break;
@@ -118,7 +117,7 @@
 		WInDev[wDevID].waveDesc.dwCallBack, WInDev[wDevID].wFlags, 
 		WInDev[wDevID].waveDesc.hWave, wMsg, 
 		WInDev[wDevID].waveDesc.dwInstance, dwParam1, dwParam2)) {
-	    dprintf_mciwave(stddeb,"WAVE_NotifyClient // can't notify client !\n");
+	    dprintf_warn(mciwave, "WAVE_NotifyClient // can't notify client !\n");
 	    return MMSYSERR_NOERROR;
 	  }
 	  break;
@@ -138,7 +137,7 @@
 	DWORD		dwRet;
 	char		str[128];
 
-	dprintf_mciwave(stddeb,"WAVE_mciOpen(%04X, %08lX, %p)\n", 
+	dprintf_info(mciwave,"WAVE_mciOpen(%04X, %08lX, %p)\n", 
 				wDevID, dwFlags, lpParms);
 	if (lpParms == NULL) return MCIERR_INTERNAL;
 
@@ -157,11 +156,11 @@
 
 	MCIWavDev[wDevID].fInput = FALSE;
 
-	dprintf_mciwave(stddeb,"WAVE_mciOpen // wDevID=%04X\n", wDevID);
-	dprintf_mciwave(stddeb,"WAVE_mciOpen // before OPEN_ELEMENT\n");
+	dprintf_info(mciwave,"WAVE_mciOpen // wDevID=%04X\n", wDevID);
+	dprintf_info(mciwave,"WAVE_mciOpen // before OPEN_ELEMENT\n");
 	if (dwFlags & MCI_OPEN_ELEMENT) {
 		lpstrElementName = (LPSTR)PTR_SEG_TO_LIN(lpParms->lpstrElementName);
-		dprintf_mciwave(stddeb,"WAVE_mciOpen // MCI_OPEN_ELEMENT '%s' !\n",
+		dprintf_info(mciwave,"WAVE_mciOpen // MCI_OPEN_ELEMENT '%s' !\n",
 						lpstrElementName);
 		if ( lpstrElementName && (strlen(lpstrElementName) > 0)) {
 			strcpy(str, lpstrElementName);
@@ -169,14 +168,14 @@
 			MCIWavDev[wDevID].hFile = mmioOpen16(str, NULL, 
 				MMIO_ALLOCBUF | MMIO_READWRITE | MMIO_EXCLUSIVE);
 			if (MCIWavDev[wDevID].hFile == 0) {
-				dprintf_mciwave(stddeb,"WAVE_mciOpen // can't find file='%s' !\n", str);
+				dprintf_warn(mciwave, "WAVE_mciOpen // can't find file='%s' !\n", str);
 				return MCIERR_FILE_NOT_FOUND;
 			}
 		}
 		else 
 			MCIWavDev[wDevID].hFile = 0;
 	}
-	dprintf_mciwave(stddeb,"WAVE_mciOpen // hFile=%u\n", MCIWavDev[wDevID].hFile);
+	dprintf_info(mciwave,"WAVE_mciOpen // hFile=%u\n", MCIWavDev[wDevID].hFile);
 	memcpy(&MCIWavDev[wDevID].openParms, lpParms, sizeof(MCI_WAVE_OPEN_PARMS16));
 	MCIWavDev[wDevID].wNotifyDeviceID = lpParms->wDeviceID;
 	lpWaveFormat = &MCIWavDev[wDevID].WaveFormat;
@@ -195,7 +194,7 @@
 		MMCKINFO	ckMainRIFF;
 		if (mmioDescend(MCIWavDev[wDevID].hFile, &ckMainRIFF, NULL, 0) != 0)
 			return MCIERR_INTERNAL;
-		dprintf_mciwave(stddeb,
+		dprintf_info(mciwave,
 				"WAVE_mciOpen // ParentChunk ckid=%.4s fccType=%.4s cksize=%08lX \n",
 				(LPSTR)&ckMainRIFF.ckid, (LPSTR)&ckMainRIFF.fccType,
 				ckMainRIFF.cksize);
@@ -205,7 +204,7 @@
 		mmckInfo.ckid = mmioFOURCC('f', 'm', 't', ' ');
 		if (mmioDescend(MCIWavDev[wDevID].hFile, &mmckInfo, &ckMainRIFF, MMIO_FINDCHUNK) != 0)
 			return MCIERR_INTERNAL;
-		dprintf_mciwave(stddeb,
+		dprintf_info(mciwave,
 				"WAVE_mciOpen // Chunk Found ckid=%.4s fccType=%.4s cksize=%08lX \n",
 				(LPSTR)&mmckInfo.ckid, (LPSTR)&mmckInfo.fccType,
 				mmckInfo.cksize);
@@ -215,11 +214,11 @@
 		mmckInfo.ckid = mmioFOURCC('d', 'a', 't', 'a');
 		if (mmioDescend(MCIWavDev[wDevID].hFile, &mmckInfo, &ckMainRIFF, MMIO_FINDCHUNK) != 0)
 			return MCIERR_INTERNAL;
-		dprintf_mciwave(stddeb,
+		dprintf_info(mciwave,
 				"WAVE_mciOpen // Chunk Found ckid=%.4s fccType=%.4s cksize=%08lX \n",
 				(LPSTR)&mmckInfo.ckid, (LPSTR)&mmckInfo.fccType,
 				mmckInfo.cksize);
-		dprintf_mciwave(stddeb,
+		dprintf_info(mciwave,
 			"WAVE_mciOpen // nChannels=%d nSamplesPerSec=%ld\n",
 			lpWaveFormat->wf.nChannels, lpWaveFormat->wf.nSamplesPerSec);
 		lpWaveFormat->wBitsPerSample = 0;
@@ -257,7 +256,7 @@
         DWORD		dwRet;
         WAVEOPENDESC	waveDesc;
 
-	dprintf_mciwave(stddeb,"WAVE_mciCue(%u, %08lX, %p);\n", wDevID, dwParam, lpParms);
+	dprintf_info(mciwave,"WAVE_mciCue(%u, %08lX, %p);\n", wDevID, dwParam, lpParms);
 
 /* always close elements ? */
 
@@ -295,7 +294,7 @@
 {
 	DWORD		dwRet;
 
-	dprintf_mciwave(stddeb,
+	dprintf_info(mciwave,
 			"WAVE_mciClose(%u, %08lX, %p);\n", wDevID, dwParam, lpParms);
 	MCIWavDev[wDevID].nUseCount--;
 	if (MCIWavDev[wDevID].nUseCount == 0) {
@@ -325,42 +324,41 @@
 	LPWAVEHDR	lpWaveHdr;
 	DWORD		dwRet;
 
-	dprintf_mciwave(stddeb,
+	dprintf_info(mciwave,
 		 "WAVE_mciPlay(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
 
 	if (MCIWavDev[wDevID].fInput) {
-	        dprintf_mciwave(stddeb,"WAVE_mciPlay // cannot play on input device\n");
+	        dprintf_warn(mciwave, "WAVE_mciPlay // cannot play on input device\n");
 		return MCIERR_NONAPPLICABLE_FUNCTION;
 	}
 
 	if (MCIWavDev[wDevID].hFile == 0) {
-                dprintf_mciwave(stddeb,"WAVE_mciPlay // can't find file='%08lx' !\n",
+                dprintf_warn(mciwave, "WAVE_mciPlay // can't find file='%08lx' !\n",
                         MCIWavDev[wDevID].openParms.lpstrElementName);
 		return MCIERR_FILE_NOT_FOUND;
 	}
 	start = 1; 		end = 99999;
 	if (dwFlags & MCI_FROM) {
 		start = lpParms->dwFrom; 
-		dprintf_mciwave(stddeb,
+		dprintf_info(mciwave,
 				"WAVE_mciPlay // MCI_FROM=%d \n", start);
 	}
 	if (dwFlags & MCI_TO) {
 		end = lpParms->dwTo;
-		dprintf_mciwave(stddeb,"WAVE_mciPlay // MCI_TO=%d \n", end);
+		dprintf_info(mciwave,"WAVE_mciPlay // MCI_TO=%d \n", end);
 	}
 #if 0
 	if (dwFlags & MCI_NOTIFY) {
-        dprintf_mciwave(stddeb,
+        dprintf_info(mciwave,
 	        "WAVE_mciPlay // MCI_NOTIFY %08lX !\n", lpParms->dwCallback);
 		switch(fork()) {
 			case -1:
-				dprintf_mciwave(stddeb,
-				  "WAVE_mciPlay // Can't 'fork' process !\n");
+				dprintf_warn(mciwave, "WAVE_mciPlay // Can't 'fork' process !\n");
 				break;
 			case 0:
 				break;         
 			default:
-				dprintf_mciwave(stddeb,"WAVE_mciPlay // process started ! return to caller...\n");
+				dprintf_info(mciwave,"WAVE_mciPlay // process started ! return to caller...\n");
 				return 0;
 			}
 		}
@@ -375,11 +373,11 @@
 	dwRet=wodMessage(wDevID,WODM_PREPARE,0,(DWORD)lpWaveHdr,sizeof(WAVEHDR));
 	while(TRUE) {
 		count = mmioRead(MCIWavDev[wDevID].hFile, lpWaveHdr->lpData, bufsize);
-		dprintf_mciwave(stddeb,"WAVE_mciPlay // mmioRead bufsize=%ld count=%ld\n", bufsize, count);
+		dprintf_info(mciwave,"WAVE_mciPlay // mmioRead bufsize=%ld count=%ld\n", bufsize, count);
 		if (count < 1) break;
 		lpWaveHdr->dwBufferLength = count;
 /*		lpWaveHdr->dwBytesRecorded = count; */
-		dprintf_mciwave(stddeb,"WAVE_mciPlay // before WODM_WRITE lpWaveHdr=%p dwBufferLength=%lu dwBytesRecorded=%lu\n",
+		dprintf_info(mciwave,"WAVE_mciPlay // before WODM_WRITE lpWaveHdr=%p dwBufferLength=%lu dwBytesRecorded=%lu\n",
 				lpWaveHdr, lpWaveHdr->dwBufferLength, lpWaveHdr->dwBytesRecorded);
 		dwRet=wodMessage(wDevID,WODM_WRITE,0,(DWORD)lpWaveHdr,sizeof(WAVEHDR));
 	}
@@ -390,7 +388,7 @@
 		lpWaveHdr->lpData = NULL;
 	}
 	if (dwFlags & MCI_NOTIFY) {
-		dprintf_mciwave(stddeb,"WAVE_mciPlay // MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
+		dprintf_info(mciwave,"WAVE_mciPlay // MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
 		mciDriverNotify((HWND16)LOWORD(lpParms->dwCallback), 
 			MCIWavDev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
 	}
@@ -409,28 +407,28 @@
 	LPWAVEHDR		lpWaveHdr;
 	DWORD			dwRet;
 
-	dprintf_mciwave(stddeb,
+	dprintf_info(mciwave,
 		"WAVE_mciRecord(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
 
 	if (!MCIWavDev[wDevID].fInput) {
-	        dprintf_mciwave(stddeb,"WAVE_mciPlay // cannot record on output device\n");
+	        dprintf_warn(mciwave, "WAVE_mciPlay // cannot record on output device\n");
 		return MCIERR_NONAPPLICABLE_FUNCTION;
 	}
 
 	if (MCIWavDev[wDevID].hFile == 0) {
-		dprintf_mciwave(stddeb,"WAVE_mciRecord // can't find file='%08lx' !\n", 
+		dprintf_warn(mciwave, "WAVE_mciRecord // can't find file='%08lx' !\n", 
 				MCIWavDev[wDevID].openParms.lpstrElementName);
 		return MCIERR_FILE_NOT_FOUND;
 	}
 	start = 1; 	end = 99999;
 	if (dwFlags & MCI_FROM) {
 		start = lpParms->dwFrom; 
-		dprintf_mciwave(stddeb,
+		dprintf_info(mciwave,
 				"WAVE_mciRecord // MCI_FROM=%d \n", start);
 	}
 	if (dwFlags & MCI_TO) {
 		end = lpParms->dwTo;
-		dprintf_mciwave(stddeb,"WAVE_mciRecord // MCI_TO=%d \n", end);
+		dprintf_info(mciwave,"WAVE_mciRecord // MCI_TO=%d \n", end);
 	}
 	bufsize = 64000;
 	lpWaveHdr = &MCIWavDev[wDevID].WaveHdr;
@@ -441,25 +439,25 @@
 	lpWaveHdr->dwFlags = 0L;
 	lpWaveHdr->dwLoops = 0L;
 	dwRet=widMessage(wDevID,WIDM_PREPARE,0,(DWORD)lpWaveHdr,sizeof(WAVEHDR));
-	dprintf_mciwave(stddeb,"WAVE_mciRecord // after WIDM_PREPARE \n");
+	dprintf_info(mciwave,"WAVE_mciRecord // after WIDM_PREPARE \n");
 	while(TRUE) {
 		lpWaveHdr->dwBytesRecorded = 0;
 		dwRet = widMessage(wDevID, WIDM_START, 0, 0L, 0L);
-		dprintf_mciwave(stddeb,
+		dprintf_info(mciwave,
                     "WAVE_mciRecord // after WIDM_START lpWaveHdr=%p dwBytesRecorded=%lu\n",
 					lpWaveHdr, lpWaveHdr->dwBytesRecorded);
 		if (lpWaveHdr->dwBytesRecorded == 0) break;
 	}
-	dprintf_mciwave(stddeb,"WAVE_mciRecord // before WIDM_UNPREPARE \n");
+	dprintf_info(mciwave,"WAVE_mciRecord // before WIDM_UNPREPARE \n");
 	dwRet = widMessage(wDevID,WIDM_UNPREPARE,0,(DWORD)lpWaveHdr,sizeof(WAVEHDR));
-	dprintf_mciwave(stddeb,"WAVE_mciRecord // after WIDM_UNPREPARE \n");
+	dprintf_info(mciwave,"WAVE_mciRecord // after WIDM_UNPREPARE \n");
 	if (lpWaveHdr->lpData != NULL) {
 		GlobalUnlock16(hData);
 		GlobalFree16(hData);
 		lpWaveHdr->lpData = NULL;
 	}
 	if (dwFlags & MCI_NOTIFY) {
-	  dprintf_mciwave(stddeb,"WAVE_mciRecord // MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
+	  dprintf_info(mciwave,"WAVE_mciRecord // MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
 		mciDriverNotify((HWND16)LOWORD(lpParms->dwCallback), 
 			MCIWavDev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
 	}
@@ -474,7 +472,7 @@
 {
         DWORD dwRet;
 
-	dprintf_mciwave(stddeb,
+	dprintf_info(mciwave,
 		"WAVE_mciStop(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
 	if (lpParms == NULL) return MCIERR_INTERNAL;
 	if (MCIWavDev[wDevID].fInput)
@@ -493,7 +491,7 @@
 {
         DWORD dwRet;
 
-	dprintf_mciwave(stddeb,
+	dprintf_info(mciwave,
 		"WAVE_mciPause(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
 	if (lpParms == NULL) return MCIERR_INTERNAL;
 	if (MCIWavDev[wDevID].fInput)
@@ -510,7 +508,7 @@
  */
 static DWORD WAVE_mciResume(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
 {
-	dprintf_mciwave(stddeb,
+	dprintf_info(mciwave,
 		"WAVE_mciResume(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
 	if (lpParms == NULL) return MCIERR_INTERNAL;
 	return 0;
@@ -522,26 +520,26 @@
  */
 static DWORD WAVE_mciSet(UINT16 wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms)
 {
-	dprintf_mciwave(stddeb,
+	dprintf_info(mciwave,
 		"WAVE_mciSet(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
 	if (lpParms == NULL) return MCIERR_INTERNAL;
-	dprintf_mciwave(stddeb,
+	dprintf_info(mciwave,
 		 "WAVE_mciSet // dwTimeFormat=%08lX\n", lpParms->dwTimeFormat);
-	dprintf_mciwave(stddeb,
+	dprintf_info(mciwave,
 		 "WAVE_mciSet // dwAudio=%08lX\n", lpParms->dwAudio);
 	if (dwFlags & MCI_SET_TIME_FORMAT) {
 		switch (lpParms->dwTimeFormat) {
 		case MCI_FORMAT_MILLISECONDS:
-			dprintf_mciwave(stddeb,	"WAVE_mciSet // MCI_FORMAT_MILLISECONDS !\n");
+			dprintf_info(mciwave,	"WAVE_mciSet // MCI_FORMAT_MILLISECONDS !\n");
 			break;
 		case MCI_FORMAT_BYTES:
-			dprintf_mciwave(stddeb, "WAVE_mciSet // MCI_FORMAT_BYTES !\n");
+			dprintf_info(mciwave, "WAVE_mciSet // MCI_FORMAT_BYTES !\n");
 			break;
 		case MCI_FORMAT_SAMPLES:
-			dprintf_mciwave(stddeb,	"WAVE_mciSet // MCI_FORMAT_SAMPLES !\n");
+			dprintf_info(mciwave,	"WAVE_mciSet // MCI_FORMAT_SAMPLES !\n");
 			break;
 		default:
-			dprintf_mciwave(stddeb,	"WAVE_mciSet // bad time format !\n");
+			dprintf_warn(mciwave,	"WAVE_mciSet // bad time format !\n");
 			return MCIERR_BAD_TIME_FORMAT;
 		}
 	}
@@ -549,38 +547,38 @@
 	if (dwFlags & MCI_SET_DOOR_OPEN) return MCIERR_UNSUPPORTED_FUNCTION;
 	if (dwFlags & MCI_SET_DOOR_CLOSED) return MCIERR_UNSUPPORTED_FUNCTION;
 	if (dwFlags & MCI_SET_AUDIO) 
-	  dprintf_mciwave(stddeb,"WAVE_mciSet // MCI_SET_AUDIO !\n");
+	  dprintf_info(mciwave,"WAVE_mciSet // MCI_SET_AUDIO !\n");
 	if (dwFlags && MCI_SET_ON) {
-	  dprintf_mciwave(stddeb,"WAVE_mciSet // MCI_SET_ON !\n");
+	  dprintf_info(mciwave,"WAVE_mciSet // MCI_SET_ON !\n");
 	  if (dwFlags && MCI_SET_AUDIO_LEFT) 
-	    dprintf_mciwave(stddeb,"WAVE_mciSet // MCI_SET_AUDIO_LEFT !\n");
+	    dprintf_info(mciwave,"WAVE_mciSet // MCI_SET_AUDIO_LEFT !\n");
 	  if (dwFlags && MCI_SET_AUDIO_RIGHT) 
-	    dprintf_mciwave(stddeb,"WAVE_mciSet // MCI_SET_AUDIO_RIGHT !\n");
+	    dprintf_info(mciwave,"WAVE_mciSet // MCI_SET_AUDIO_RIGHT !\n");
 	}
 	if (dwFlags & MCI_SET_OFF) 
-	  dprintf_mciwave(stddeb,"WAVE_mciSet // MCI_SET_OFF !\n");
+	  dprintf_info(mciwave,"WAVE_mciSet // MCI_SET_OFF !\n");
 	if (dwFlags & MCI_WAVE_INPUT) 
-	  dprintf_mciwave(stddeb,"WAVE_mciSet // MCI_WAVE_INPUT !\n");
+	  dprintf_info(mciwave,"WAVE_mciSet // MCI_WAVE_INPUT !\n");
       	if (dwFlags & MCI_WAVE_OUTPUT) 
-	  dprintf_mciwave(stddeb,"WAVE_mciSet // MCI_WAVE_OUTPUT !\n");
+	  dprintf_info(mciwave,"WAVE_mciSet // MCI_WAVE_OUTPUT !\n");
 	if (dwFlags & MCI_WAVE_SET_ANYINPUT) 
-	  dprintf_mciwave(stddeb,"WAVE_mciSet // MCI_WAVE_SET_ANYINPUT !\n");
+	  dprintf_info(mciwave,"WAVE_mciSet // MCI_WAVE_SET_ANYINPUT !\n");
 	if (dwFlags & MCI_WAVE_SET_ANYOUTPUT) 
-	  dprintf_mciwave(stddeb,"WAVE_mciSet // MCI_WAVE_SET_ANYOUTPUT !\n");
+	  dprintf_info(mciwave,"WAVE_mciSet // MCI_WAVE_SET_ANYOUTPUT !\n");
 	if (dwFlags & MCI_WAVE_SET_AVGBYTESPERSEC) 
-	  dprintf_mciwave(stddeb,
+	  dprintf_info(mciwave,
 			  "WAVE_mciSet // MCI_WAVE_SET_AVGBYTESPERSEC !\n");
 	if (dwFlags & MCI_WAVE_SET_BITSPERSAMPLE) 
-	  dprintf_mciwave(stddeb,
+	  dprintf_info(mciwave,
 			  "WAVE_mciSet // MCI_WAVE_SET_BITSPERSAMPLE !\n");
 	if (dwFlags & MCI_WAVE_SET_BLOCKALIGN) 
-	  dprintf_mciwave(stddeb,"WAVE_mciSet // MCI_WAVE_SET_BLOCKALIGN !\n");
+	  dprintf_info(mciwave,"WAVE_mciSet // MCI_WAVE_SET_BLOCKALIGN !\n");
 	if (dwFlags & MCI_WAVE_SET_CHANNELS) 
-	  dprintf_mciwave(stddeb,"WAVE_mciSet // MCI_WAVE_SET_CHANNELS !\n");
+	  dprintf_info(mciwave,"WAVE_mciSet // MCI_WAVE_SET_CHANNELS !\n");
 	if (dwFlags & MCI_WAVE_SET_FORMATTAG) 
-	  dprintf_mciwave(stddeb,"WAVE_mciSet // MCI_WAVE_SET_FORMATTAG !\n");
+	  dprintf_info(mciwave,"WAVE_mciSet // MCI_WAVE_SET_FORMATTAG !\n");
 	if (dwFlags & MCI_WAVE_SET_SAMPLESPERSEC) 
-	  dprintf_mciwave(stddeb,
+	  dprintf_info(mciwave,
 			  "WAVE_mciSet // MCI_WAVE_SET_SAMPLESPERSEC !\n");
  	return 0;
 }
@@ -591,7 +589,7 @@
  */
 static DWORD WAVE_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpParms)
 {
-	dprintf_mciwave(stddeb,
+	dprintf_info(mciwave,
 		"WAVE_mciStatus(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
 	if (lpParms == NULL) return MCIERR_INTERNAL;
 	if (dwFlags & MCI_STATUS_ITEM) {
@@ -610,7 +608,7 @@
 			lpParms->dwReturn = MCI_MODE_STOP;
 			break;
 		case MCI_STATUS_MEDIA_PRESENT:
-			dprintf_mciwave(stddeb,"WAVE_mciStatus // MCI_STATUS_MEDIA_PRESENT !\n");
+			dprintf_info(mciwave,"WAVE_mciStatus // MCI_STATUS_MEDIA_PRESENT !\n");
 			lpParms->dwReturn = TRUE;
 			break;
 		case MCI_STATUS_NUMBER_OF_TRACKS:
@@ -626,56 +624,56 @@
 			}
 			break;
 		case MCI_STATUS_READY:
-			dprintf_mciwave(stddeb,"WAVE_mciStatus // MCI_STATUS_READY !\n");
+			dprintf_info(mciwave,"WAVE_mciStatus // MCI_STATUS_READY !\n");
 			lpParms->dwReturn = TRUE;
 			break;
 		case MCI_STATUS_TIME_FORMAT:
-			dprintf_mciwave(stddeb,"WAVE_mciStatus // MCI_STATUS_TIME_FORMAT !\n");
+			dprintf_info(mciwave,"WAVE_mciStatus // MCI_STATUS_TIME_FORMAT !\n");
 			lpParms->dwReturn = MCI_FORMAT_MILLISECONDS;
 			break;
 		case MCI_WAVE_INPUT:
-			dprintf_mciwave(stddeb,"WAVE_mciStatus // MCI_WAVE_INPUT !\n");
+			dprintf_info(mciwave,"WAVE_mciStatus // MCI_WAVE_INPUT !\n");
 			lpParms->dwReturn = 0;
 			break;
 		case MCI_WAVE_OUTPUT:
-			dprintf_mciwave(stddeb,"WAVE_mciStatus // MCI_WAVE_OUTPUT !\n");
+			dprintf_info(mciwave,"WAVE_mciStatus // MCI_WAVE_OUTPUT !\n");
 			lpParms->dwReturn = 0;
 			break;
 		case MCI_WAVE_STATUS_AVGBYTESPERSEC:
-			dprintf_mciwave(stddeb,"WAVE_mciStatus // MCI_WAVE_STATUS_AVGBYTESPERSEC !\n");
+			dprintf_info(mciwave,"WAVE_mciStatus // MCI_WAVE_STATUS_AVGBYTESPERSEC !\n");
 			lpParms->dwReturn = 22050;
 			break;
 		case MCI_WAVE_STATUS_BITSPERSAMPLE:
-			dprintf_mciwave(stddeb,"WAVE_mciStatus // MCI_WAVE_STATUS_BITSPERSAMPLE !\n");
+			dprintf_info(mciwave,"WAVE_mciStatus // MCI_WAVE_STATUS_BITSPERSAMPLE !\n");
 			lpParms->dwReturn = 8;
 			break;
 		case MCI_WAVE_STATUS_BLOCKALIGN:
-			dprintf_mciwave(stddeb,"WAVE_mciStatus // MCI_WAVE_STATUS_BLOCKALIGN !\n");
+			dprintf_info(mciwave,"WAVE_mciStatus // MCI_WAVE_STATUS_BLOCKALIGN !\n");
 			lpParms->dwReturn = 1;
 			break;
 		case MCI_WAVE_STATUS_CHANNELS:
-			dprintf_mciwave(stddeb,"WAVE_mciStatus // MCI_WAVE_STATUS_CHANNELS !\n");
+			dprintf_info(mciwave,"WAVE_mciStatus // MCI_WAVE_STATUS_CHANNELS !\n");
 			lpParms->dwReturn = 1;
 			break;
 		case MCI_WAVE_STATUS_FORMATTAG:
-			dprintf_mciwave(stddeb,"WAVE_mciStatus // MCI_WAVE_FORMATTAG !\n");
+			dprintf_info(mciwave,"WAVE_mciStatus // MCI_WAVE_FORMATTAG !\n");
 			lpParms->dwReturn = WAVE_FORMAT_PCM;
 			break;
 		case MCI_WAVE_STATUS_LEVEL:
-			dprintf_mciwave(stddeb,"WAVE_mciStatus // MCI_WAVE_STATUS_LEVEL !\n");
+			dprintf_info(mciwave,"WAVE_mciStatus // MCI_WAVE_STATUS_LEVEL !\n");
 			lpParms->dwReturn = 0xAAAA5555;
 			break;
 		case MCI_WAVE_STATUS_SAMPLESPERSEC:
-			dprintf_mciwave(stddeb,"WAVE_mciStatus // MCI_WAVE_STATUS_SAMPLESPERSEC !\n");
+			dprintf_info(mciwave,"WAVE_mciStatus // MCI_WAVE_STATUS_SAMPLESPERSEC !\n");
 			lpParms->dwReturn = 22050;
 			break;
 		default:
-			dprintf_mciwave(stddeb,"WAVE_mciStatus // unknown command %08lX !\n", lpParms->dwItem);
+			dprintf_warn(mciwave,"WAVE_mciStatus // unknown command %08lX !\n", lpParms->dwItem);
 			return MCIERR_UNRECOGNIZED_COMMAND;
 		}
 	}
 	if (dwFlags & MCI_NOTIFY) {
-		dprintf_mciwave(stddeb,"WAVE_mciStatus // MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
+		dprintf_info(mciwave,"WAVE_mciStatus // MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
 		mciDriverNotify((HWND16)LOWORD(lpParms->dwCallback), 
 			MCIWavDev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
 	}
@@ -688,7 +686,7 @@
 static DWORD WAVE_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags, 
 					LPMCI_GETDEVCAPS_PARMS lpParms)
 {
-	dprintf_mciwave(stddeb,
+	dprintf_info(mciwave,
 		"WAVE_mciGetDevCaps(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
 	if (lpParms == NULL) return MCIERR_INTERNAL;
 	if (dwFlags & MCI_GETDEVCAPS_ITEM) {
@@ -738,7 +736,7 @@
  */
 static DWORD WAVE_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMS16 lpParms)
 {
-	dprintf_mciwave(stddeb,
+	dprintf_info(mciwave,
 		"WAVE_mciInfo(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
 	if (lpParms == NULL) return MCIERR_INTERNAL;
 	lpParms->lpstrReturn = NULL;
@@ -781,7 +779,7 @@
 	int	dsp_stereo = 1;
 	int	bytespersmpl;
 
-	dprintf_mciwave(stddeb,
+	dprintf_info(mciwave,
 		   "wodGetDevCaps(%u, %p, %lu);\n", wDevID, lpCaps, dwSize);
 	if (lpCaps == NULL) return MMSYSERR_NOTENABLED;
 	if (access(SOUND_DEV,0) != 0) return MMSYSERR_NOTENABLED;
@@ -836,7 +834,7 @@
 		}
 	}
 	close(audio);
-	dprintf_mciwave(stddeb,
+	dprintf_info(mciwave,
 		"wodGetDevCaps // dwFormats = %08lX\n", lpCaps->dwFormats);
 	return MMSYSERR_NOERROR;
 }
@@ -850,44 +848,44 @@
 	int 	 audio,abuf_size,smplrate,samplesize,dsp_stereo;
 	LPWAVEFORMAT	lpFormat;
 
-	dprintf_mciwave(stddeb,
+	dprintf_info(mciwave,
 		"wodOpen(%u, %p, %08lX);\n", wDevID, lpDesc, dwFlags);
 	if (lpDesc == NULL) {
-		dprintf_mciwave(stddeb,"Linux 'wodOpen' // Invalid Parameter !\n");
+		dprintf_warn(mciwave, "Linux 'wodOpen' // Invalid Parameter !\n");
 		return MMSYSERR_INVALPARAM;
 	}
 	if (wDevID >= MAX_WAVOUTDRV) {
-		dprintf_mciwave(stddeb,"Linux 'wodOpen' // MAX_WAVOUTDRV reached !\n");
+		dprintf_info(mciwave,"Linux 'wodOpen' // MAX_WAVOUTDRV reached !\n");
 		return MMSYSERR_ALLOCATED;
 	}
 	WOutDev[wDevID].unixdev = 0;
 	if (access(SOUND_DEV,0) != 0) return MMSYSERR_NOTENABLED;
 	audio = open (SOUND_DEV, O_WRONLY, 0);
 	if (audio == -1) {
-		dprintf_mciwave(stddeb,"Linux 'wodOpen' // can't open !\n");
+		dprintf_warn(mciwave, "Linux 'wodOpen' // can't open !\n");
 		return MMSYSERR_ALLOCATED ;
 	}
 	IOCTL(audio, SNDCTL_DSP_GETBLKSIZE, abuf_size);
 	if (abuf_size < 1024 || abuf_size > 65536) {
 		if (abuf_size == -1)
-			dprintf_mciwave(stddeb,"Linux 'wodOpen' // IOCTL can't 'SNDCTL_DSP_GETBLKSIZE' !\n");
+			dprintf_warn(mciwave, "Linux 'wodOpen' // IOCTL can't 'SNDCTL_DSP_GETBLKSIZE' !\n");
 		else
-			dprintf_mciwave(stddeb,"Linux 'wodOpen' // SNDCTL_DSP_GETBLKSIZE Invalid bufsize !\n");
+			dprintf_warn(mciwave, "Linux 'wodOpen' // SNDCTL_DSP_GETBLKSIZE Invalid bufsize !\n");
 		return MMSYSERR_NOTENABLED;
 	}
 	WOutDev[wDevID].wFlags = HIWORD(dwFlags & CALLBACK_TYPEMASK);
 	switch(WOutDev[wDevID].wFlags) {
 	case DCB_NULL:
-		dprintf_mciwave(stddeb,	"Linux 'wodOpen' // CALLBACK_NULL !\n");
+		dprintf_info(mciwave,	"Linux 'wodOpen' // CALLBACK_NULL !\n");
 		break;
 	case DCB_WINDOW:
-		dprintf_mciwave(stddeb,	"Linux 'wodOpen' // CALLBACK_WINDOW !\n");
+		dprintf_info(mciwave,	"Linux 'wodOpen' // CALLBACK_WINDOW !\n");
 		break;
 	case DCB_TASK:
-		dprintf_mciwave(stddeb,	"Linux 'wodOpen' // CALLBACK_TASK !\n");
+		dprintf_info(mciwave,	"Linux 'wodOpen' // CALLBACK_TASK !\n");
 		break;
 	case DCB_FUNCTION:
-		dprintf_mciwave(stddeb,	"Linux 'wodOpen' // CALLBACK_FUNCTION !\n");
+		dprintf_info(mciwave,	"Linux 'wodOpen' // CALLBACK_FUNCTION !\n");
 		break;
 	}
 	WOutDev[wDevID].lpQueueHdr = NULL;
@@ -896,22 +894,22 @@
 	WOutDev[wDevID].bufsize = abuf_size;
 	/* FIXME: copy lpFormat too? */
 	memcpy(&WOutDev[wDevID].waveDesc, lpDesc, sizeof(WAVEOPENDESC));
-	dprintf_mciwave(stddeb,"Linux 'wodOpen' // lpDesc->lpFormat = %p\n",lpDesc->lpFormat);
+	dprintf_info(mciwave,"Linux 'wodOpen' // lpDesc->lpFormat = %p\n",lpDesc->lpFormat);
         lpFormat = lpDesc->lpFormat; 
-	dprintf_mciwave(stddeb,"Linux 'wodOpen' // lpFormat = %p\n",lpFormat);
+	dprintf_info(mciwave,"Linux 'wodOpen' // lpFormat = %p\n",lpFormat);
 	if (lpFormat->wFormatTag != WAVE_FORMAT_PCM) {
-		dprintf_mciwave(stddeb,"Linux 'wodOpen' // Bad format %04X !\n",
+		dprintf_warn(mciwave,"Linux 'wodOpen' // Bad format %04X !\n",
 				lpFormat->wFormatTag);
-		dprintf_mciwave(stddeb,"Linux 'wodOpen' // Bad nChannels %d !\n",
+		dprintf_warn(mciwave,"Linux 'wodOpen' // Bad nChannels %d !\n",
 				lpFormat->nChannels);
-		dprintf_mciwave(stddeb,"Linux 'wodOpen' // Bad nSamplesPerSec %ld !\n",
+		dprintf_warn(mciwave,"Linux 'wodOpen' // Bad nSamplesPerSec %ld !\n",
 				lpFormat->nSamplesPerSec);
 		return WAVERR_BADFORMAT;
 	}
 	memcpy(&WOutDev[wDevID].Format, lpFormat, sizeof(PCMWAVEFORMAT));
 	if (WOutDev[wDevID].Format.wf.nChannels == 0) return WAVERR_BADFORMAT;
 	if (WOutDev[wDevID].Format.wf.nSamplesPerSec == 0) return WAVERR_BADFORMAT;
-	dprintf_mciwave(stddeb,"Linux 'wodOpen' // wBitsPerSample=%u !\n",
+	dprintf_info(mciwave,"Linux 'wodOpen' // wBitsPerSample=%u !\n",
 				WOutDev[wDevID].Format.wBitsPerSample);
 	if (WOutDev[wDevID].Format.wBitsPerSample == 0) {
 		WOutDev[wDevID].Format.wBitsPerSample = 8 *
@@ -925,16 +923,16 @@
 	IOCTL(audio, SNDCTL_DSP_SPEED, smplrate);
 	IOCTL(audio, SNDCTL_DSP_SAMPLESIZE, samplesize);
 	IOCTL(audio, SNDCTL_DSP_STEREO, dsp_stereo);
-	dprintf_mciwave(stddeb,"Linux 'wodOpen' // wBitsPerSample=%u !\n",
+	dprintf_info(mciwave,"Linux 'wodOpen' // wBitsPerSample=%u !\n",
 				WOutDev[wDevID].Format.wBitsPerSample);
-	dprintf_mciwave(stddeb,"Linux 'wodOpen' // nAvgBytesPerSec=%lu !\n",
+	dprintf_info(mciwave,"Linux 'wodOpen' // nAvgBytesPerSec=%lu !\n",
 				WOutDev[wDevID].Format.wf.nAvgBytesPerSec);
-	dprintf_mciwave(stddeb,"Linux 'wodOpen' // nSamplesPerSec=%lu !\n",
+	dprintf_info(mciwave,"Linux 'wodOpen' // nSamplesPerSec=%lu !\n",
 				WOutDev[wDevID].Format.wf.nSamplesPerSec);
-	dprintf_mciwave(stddeb,"Linux 'wodOpen' // nChannels=%u !\n",
+	dprintf_info(mciwave,"Linux 'wodOpen' // nChannels=%u !\n",
 				WOutDev[wDevID].Format.wf.nChannels);
 	if (WAVE_NotifyClient(wDevID, WOM_OPEN, 0L, 0L) != MMSYSERR_NOERROR) {
-		dprintf_mciwave(stddeb,"Linux 'wodOpen' // can't notify client !\n");
+		dprintf_warn(mciwave, "Linux 'wodOpen' // can't notify client !\n");
 		return MMSYSERR_INVALPARAM;
 	}
 	return MMSYSERR_NOERROR;
@@ -945,14 +943,14 @@
  */
 static DWORD wodClose(WORD wDevID)
 {
-	dprintf_mciwave(stddeb,"wodClose(%u);\n", wDevID);
+	dprintf_info(mciwave,"wodClose(%u);\n", wDevID);
 	if (wDevID > MAX_WAVOUTDRV) return MMSYSERR_INVALPARAM;
 	if (WOutDev[wDevID].unixdev == 0) {
-		dprintf_mciwave(stddeb,"Linux 'wodClose' // can't close !\n");
+		dprintf_warn(mciwave, "Linux 'wodClose' // can't close !\n");
 		return MMSYSERR_NOTENABLED;
 	}
 	if (WOutDev[wDevID].lpQueueHdr != NULL) {
-	        dprintf_mciwave(stddeb,"linux 'wodclose' // still buffers open !\n");
+	        dprintf_warn(mciwave, "linux 'wodclose' // still buffers open !\n");
 		/* Don't care. Who needs those buffers anyway */
 		/*return WAVERR_STILLPLAYING; */
 	}
@@ -961,7 +959,7 @@
 	WOutDev[wDevID].bufsize = 0;
 	WOutDev[wDevID].lpQueueHdr = NULL;
 	if (WAVE_NotifyClient(wDevID, WOM_CLOSE, 0L, 0L) != MMSYSERR_NOERROR) {
-		dprintf_mciwave(stddeb,"Linux 'wodClose' // can't notify client !\n");
+		dprintf_warn(mciwave, "Linux 'wodClose' // can't notify client !\n");
 		return MMSYSERR_INVALPARAM;
 	}
 	return MMSYSERR_NOERROR;
@@ -978,9 +976,9 @@
 	LPSTR	        lpData;
 	LPWAVEHDR	xwavehdr;
 
-	dprintf_mciwave(stddeb,"wodWrite(%u, %p, %08lX);\n", wDevID, lpWaveHdr, dwSize);
+	dprintf_info(mciwave,"wodWrite(%u, %p, %08lX);\n", wDevID, lpWaveHdr, dwSize);
 	if (WOutDev[wDevID].unixdev == 0) {
-        dprintf_mciwave(stddeb,"Linux 'wodWrite' // can't play !\n");
+        dprintf_warn(mciwave, "Linux 'wodWrite' // can't play !\n");
 		return MMSYSERR_NOTENABLED;
 	}
 	if (lpWaveHdr->lpData == NULL) return WAVERR_UNPREPARED;
@@ -988,15 +986,15 @@
 	if (lpWaveHdr->dwFlags & WHDR_INQUEUE) return WAVERR_STILLPLAYING;
 	lpWaveHdr->dwFlags &= ~WHDR_DONE;
 	lpWaveHdr->dwFlags |= WHDR_INQUEUE;
-	dprintf_mciwave(stddeb,
+	dprintf_info(mciwave,
 		"wodWrite() // dwBufferLength %lu !\n", lpWaveHdr->dwBufferLength);
-	dprintf_mciwave(stddeb,
+	dprintf_info(mciwave,
 		"wodWrite() // WOutDev[%u].unixdev %u !\n", wDevID, WOutDev[wDevID].unixdev);
 	lpData = lpWaveHdr->lpData;
 	count = write (WOutDev[wDevID].unixdev, lpData, lpWaveHdr->dwBufferLength);
-	dprintf_mciwave(stddeb,"wodWrite()//write returned count %u !\n",count);
+	dprintf_info(mciwave,"wodWrite()//write returned count %u !\n",count);
 	if (count != lpWaveHdr->dwBufferLength) {
-		dprintf_mciwave(stddeb,"Linux 'wodWrite' // error writting !\n");
+		dprintf_warn(mciwave, "Linux 'wodWrite' // error writting !\n");
 		return MMSYSERR_NOTENABLED;
 	}
 	WOutDev[wDevID].dwTotalPlayed += count;
@@ -1008,14 +1006,14 @@
 		memcpy(xwavehdr,lpWaveHdr,sizeof(WAVEHDR));
 		xwavehdr->lpData = (LPBYTE)xwavehdr->reserved;
 		if (WAVE_NotifyClient(wDevID, WOM_DONE, (DWORD)SEGPTR_GET(xwavehdr), count) != MMSYSERR_NOERROR) {
-			dprintf_mciwave(stddeb,"Linux 'wodWrite' // can't notify client !\n");
+			dprintf_warn(mciwave, "Linux 'wodWrite' // can't notify client !\n");
 			SEGPTR_FREE(xwavehdr);
 			return MMSYSERR_INVALPARAM;
 		}
 		SEGPTR_FREE(xwavehdr);
 	} else {
 		if (WAVE_NotifyClient(wDevID, WOM_DONE, (DWORD)lpWaveHdr, count) != MMSYSERR_NOERROR) {
-			dprintf_mciwave(stddeb,"Linux 'wodWrite' // can't notify client !\n");
+			dprintf_warn(mciwave, "Linux 'wodWrite' // can't notify client !\n");
 			return MMSYSERR_INVALPARAM;
 		}
 	}
@@ -1027,10 +1025,10 @@
  */
 static DWORD wodPrepare(WORD wDevID, LPWAVEHDR lpWaveHdr, DWORD dwSize)
 {
-	dprintf_mciwave(stddeb,
+	dprintf_info(mciwave,
 		"wodPrepare(%u, %p, %08lX);\n", wDevID, lpWaveHdr, dwSize);
 	if (WOutDev[wDevID].unixdev == 0) {
-		dprintf_mciwave(stddeb,"Linux 'wodPrepare' // can't prepare !\n");
+		dprintf_warn(mciwave, "Linux 'wodPrepare' // can't prepare !\n");
 		return MMSYSERR_NOTENABLED;
 	}
 	/* don't append to queue, wodWrite does that */
@@ -1047,10 +1045,10 @@
  */
 static DWORD wodUnprepare(WORD wDevID, LPWAVEHDR lpWaveHdr, DWORD dwSize)
 {
-	dprintf_mciwave(stddeb,
+	dprintf_info(mciwave,
 		"wodUnprepare(%u, %p, %08lX);\n", wDevID, lpWaveHdr, dwSize);
 	if (WOutDev[wDevID].unixdev == 0) {
-		dprintf_mciwave(stddeb,"Linux 'wodUnprepare' // can't unprepare !\n");
+		dprintf_warn(mciwave, "Linux 'wodUnprepare' // can't unprepare !\n");
 		return MMSYSERR_NOTENABLED;
 	}
 	if (lpWaveHdr->dwFlags & WHDR_INQUEUE)
@@ -1058,7 +1056,7 @@
 	
 	lpWaveHdr->dwFlags &= ~WHDR_PREPARED;
 	lpWaveHdr->dwFlags |= WHDR_DONE;
-	dprintf_mciwave(stddeb,
+	dprintf_info(mciwave,
 		"Linux 'wodUnprepare' // all headers unprepared !\n");
 	return MMSYSERR_NOERROR;
 }
@@ -1068,14 +1066,14 @@
  */
 static DWORD wodRestart(WORD wDevID)
 {
-	dprintf_mciwave(stddeb,"wodRestart(%u);\n", wDevID);
+	dprintf_info(mciwave,"wodRestart(%u);\n", wDevID);
 	if (WOutDev[wDevID].unixdev == 0) {
-		dprintf_mciwave(stddeb,"Linux 'wodRestart' // can't restart !\n");
+		dprintf_warn(mciwave, "Linux 'wodRestart' // can't restart !\n");
 		return MMSYSERR_NOTENABLED;
 	}
 	/* FIXME: is NotifyClient with WOM_DONE right ? (Comet Busters 1.3.3 needs this notification) */
        	if (WAVE_NotifyClient(wDevID, WOM_DONE, 0L, 0L) != MMSYSERR_NOERROR) {
-               	dprintf_mciwave(stddeb,"Linux 'wodRestart' // can't notify client !\n");
+               	dprintf_warn(mciwave, "Linux 'wodRestart' // can't notify client !\n");
                	return MMSYSERR_INVALPARAM;
         }
 
@@ -1087,9 +1085,9 @@
  */
 static DWORD wodReset(WORD wDevID)
 {
-	dprintf_mciwave(stddeb,"wodReset(%u);\n", wDevID);
+	dprintf_info(mciwave,"wodReset(%u);\n", wDevID);
 	if (WOutDev[wDevID].unixdev == 0) {
-		dprintf_mciwave(stddeb,"Linux 'wodReset' // can't reset !\n");
+		dprintf_warn(mciwave, "Linux 'wodReset' // can't reset !\n");
 		return MMSYSERR_NOTENABLED;
 		}
 	return MMSYSERR_NOERROR;
@@ -1102,35 +1100,35 @@
 static DWORD wodGetPosition(WORD wDevID, LPMMTIME16 lpTime, DWORD uSize)
 {
 	int		time;
-	dprintf_mciwave(stddeb,"wodGetPosition(%u, %p, %lu);\n", wDevID, lpTime, uSize);
+	dprintf_info(mciwave,"wodGetPosition(%u, %p, %lu);\n", wDevID, lpTime, uSize);
 	if (WOutDev[wDevID].unixdev == 0) {
-		dprintf_mciwave(stddeb,"Linux 'wodGetPosition' // can't get pos !\n");
+		dprintf_warn(mciwave, "Linux 'wodGetPosition' // can't get pos !\n");
 		return MMSYSERR_NOTENABLED;
 	}
 	if (lpTime == NULL)	return MMSYSERR_INVALPARAM;
-	dprintf_mciwave(stddeb,"wodGetPosition // wType=%04X !\n", 
+	dprintf_info(mciwave,"wodGetPosition // wType=%04X !\n", 
 			lpTime->wType);
-	dprintf_mciwave(stddeb,"wodGetPosition // wBitsPerSample=%u\n",
+	dprintf_info(mciwave,"wodGetPosition // wBitsPerSample=%u\n",
 			WOutDev[wDevID].Format.wBitsPerSample); 
-	dprintf_mciwave(stddeb,"wodGetPosition // nSamplesPerSec=%lu\n",
+	dprintf_info(mciwave,"wodGetPosition // nSamplesPerSec=%lu\n",
 			WOutDev[wDevID].Format.wf.nSamplesPerSec); 
-	dprintf_mciwave(stddeb,"wodGetPosition // nChannels=%u\n",
+	dprintf_info(mciwave,"wodGetPosition // nChannels=%u\n",
 			WOutDev[wDevID].Format.wf.nChannels); 
-	dprintf_mciwave(stddeb,"wodGetPosition // nAvgBytesPerSec=%lu\n",
+	dprintf_info(mciwave,"wodGetPosition // nAvgBytesPerSec=%lu\n",
 			WOutDev[wDevID].Format.wf.nAvgBytesPerSec); 
 	switch(lpTime->wType) {
 	case TIME_BYTES:
 		lpTime->u.cb = WOutDev[wDevID].dwTotalPlayed;
-		dprintf_mciwave(stddeb,"wodGetPosition // TIME_BYTES=%lu\n", lpTime->u.cb);
+		dprintf_info(mciwave,"wodGetPosition // TIME_BYTES=%lu\n", lpTime->u.cb);
 		break;
 	case TIME_SAMPLES:
-		dprintf_mciwave(stddeb,"wodGetPosition // dwTotalPlayed=%lu\n", 
+		dprintf_info(mciwave,"wodGetPosition // dwTotalPlayed=%lu\n", 
 				WOutDev[wDevID].dwTotalPlayed);
-		dprintf_mciwave(stddeb,"wodGetPosition // wBitsPerSample=%u\n", 
+		dprintf_info(mciwave,"wodGetPosition // wBitsPerSample=%u\n", 
 				WOutDev[wDevID].Format.wBitsPerSample);
 		lpTime->u.sample = WOutDev[wDevID].dwTotalPlayed * 8 /
 					WOutDev[wDevID].Format.wBitsPerSample;
-		dprintf_mciwave(stddeb,"wodGetPosition // TIME_SAMPLES=%lu\n", lpTime->u.sample);
+		dprintf_info(mciwave,"wodGetPosition // TIME_SAMPLES=%lu\n", lpTime->u.sample);
 		break;
 	case TIME_SMPTE:
 		time = WOutDev[wDevID].dwTotalPlayed /
@@ -1143,18 +1141,18 @@
 		time -= lpTime->u.smpte.sec * 30;
 		lpTime->u.smpte.frame = time;
 		lpTime->u.smpte.fps = 30;
-		dprintf_mciwave(stddeb,
+		dprintf_info(mciwave,
 		  "wodGetPosition // TIME_SMPTE=%02u:%02u:%02u:%02u\n",
 		  lpTime->u.smpte.hour, lpTime->u.smpte.min,
 		  lpTime->u.smpte.sec, lpTime->u.smpte.frame);
 		break;
 	default:
-		dprintf_mciwave(stddeb,"wodGetPosition() format not supported ! use TIME_MS !\n");
+		dprintf_fixme(mciwave, "wodGetPosition() format not supported ! use TIME_MS !\n");
 		lpTime->wType = TIME_MS;
 	case TIME_MS:
 		lpTime->u.ms = WOutDev[wDevID].dwTotalPlayed /
 				(WOutDev[wDevID].Format.wf.nAvgBytesPerSec / 1000);
-		dprintf_mciwave(stddeb,"wodGetPosition // TIME_MS=%lu\n", lpTime->u.ms);
+		dprintf_info(mciwave,"wodGetPosition // TIME_MS=%lu\n", lpTime->u.ms);
 		break;
 	}
 	return MMSYSERR_NOERROR;
@@ -1167,20 +1165,20 @@
 {
 	int 	mixer;
 	int		volume, left, right;
-	dprintf_mciwave(stddeb,"wodGetVolume(%u, %p);\n", wDevID, lpdwVol);
+	dprintf_info(mciwave,"wodGetVolume(%u, %p);\n", wDevID, lpdwVol);
 	if (lpdwVol == NULL) return MMSYSERR_NOTENABLED;
 	if ((mixer = open(MIXER_DEV, O_RDONLY)) < 0) {
-		dprintf_mciwave(stddeb, "Linux 'wodGetVolume' // mixer device not available !\n");
+		dprintf_warn(mciwave, "Linux 'wodGetVolume' // mixer device not available !\n");
 		return MMSYSERR_NOTENABLED;
 	}
 	if (ioctl(mixer, SOUND_MIXER_READ_PCM, &volume) == -1) {
-		dprintf_mciwave(stddeb,"Linux 'wodGetVolume' // unable read mixer !\n");
+		dprintf_warn(mciwave, "Linux 'wodGetVolume' // unable read mixer !\n");
 		return MMSYSERR_NOTENABLED;
 	}
 	close(mixer);
 	left = volume & 0x7F;
 	right = (volume >> 8) & 0x7F;
-	dprintf_mciwave(stddeb,"Linux 'wodGetVolume' // left=%d right=%d !\n", left, right);
+	dprintf_info(mciwave,"Linux 'wodGetVolume' // left=%d right=%d !\n", left, right);
 	*lpdwVol = MAKELONG(left << 9, right << 9);
 	return MMSYSERR_NOERROR;
 }
@@ -1193,15 +1191,15 @@
 {
 	int 	mixer;
 	int		volume;
-	dprintf_mciwave(stddeb,"wodSetVolume(%u, %08lX);\n", wDevID, dwParam);
+	dprintf_info(mciwave,"wodSetVolume(%u, %08lX);\n", wDevID, dwParam);
 	volume = (LOWORD(dwParam) >> 9 & 0x7F) + 
 		((HIWORD(dwParam) >> 9  & 0x7F) << 8);
 	if ((mixer = open(MIXER_DEV, O_WRONLY)) < 0) {
-		dprintf_mciwave(stddeb,	"Linux 'wodSetVolume' // mixer device not available !\n");
+		dprintf_warn(mciwave,	"Linux 'wodSetVolume' // mixer device not available !\n");
 		return MMSYSERR_NOTENABLED;
 		}
     if (ioctl(mixer, SOUND_MIXER_WRITE_PCM, &volume) == -1) {
-		dprintf_mciwave(stddeb,"Linux 'wodSetVolume' // unable set mixer !\n");
+		dprintf_warn(mciwave, "Linux 'wodSetVolume' // unable set mixer !\n");
 		return MMSYSERR_NOTENABLED;
 		}
 	close(mixer);
@@ -1214,7 +1212,7 @@
 DWORD wodMessage(WORD wDevID, WORD wMsg, DWORD dwUser, 
 					DWORD dwParam1, DWORD dwParam2)
 {
-	dprintf_mciwave(stddeb,"wodMessage(%u, %04X, %08lX, %08lX, %08lX);\n",
+	dprintf_info(mciwave,"wodMessage(%u, %04X, %08lX, %08lX, %08lX);\n",
 			wDevID, wMsg, dwUser, dwParam1, dwParam2);
         switch(wMsg) {
 	case WODM_OPEN:
@@ -1256,7 +1254,7 @@
 	case WODM_RESET:
 		return wodReset(wDevID);
 	default:
-		dprintf_mciwave(stddeb,"wodMessage // unknown message !\n");
+		dprintf_warn(mciwave,"wodMessage // unknown message !\n");
 	}
 	return MMSYSERR_NOTSUPPORTED;
 }
@@ -1271,7 +1269,7 @@
 {
 	int 	audio,smplrate,samplesize=16,dsp_stereo=1,bytespersmpl;
 
-	dprintf_mciwave(stddeb,
+	dprintf_info(mciwave,
 		"widGetDevCaps(%u, %p, %lu);\n", wDevID, lpCaps, dwSize);
 	if (lpCaps == NULL) return MMSYSERR_NOTENABLED;
 	if (access(SOUND_DEV,0) != 0) return MMSYSERR_NOTENABLED;
@@ -1323,7 +1321,7 @@
 		}
 	}
 	close(audio);
-	dprintf_mciwave(stddeb,
+	dprintf_info(mciwave,
 		"widGetDevCaps // dwFormats = %08lX\n", lpCaps->dwFormats);
 	return MMSYSERR_NOERROR;
 }
@@ -1337,43 +1335,43 @@
 	int 		audio,abuf_size,smplrate,samplesize,dsp_stereo;
 	LPWAVEFORMAT	lpFormat;
 
-	dprintf_mciwave(stddeb, "widOpen(%u, %p, %08lX);\n", wDevID, lpDesc, dwFlags);
+	dprintf_info(mciwave, "widOpen(%u, %p, %08lX);\n", wDevID, lpDesc, dwFlags);
 	if (lpDesc == NULL) {
-		dprintf_mciwave(stddeb,"Linux 'widOpen' // Invalid Parameter !\n");
+		dprintf_warn(mciwave, "Linux 'widOpen' // Invalid Parameter !\n");
 		return MMSYSERR_INVALPARAM;
 	}
 	if (wDevID >= MAX_WAVINDRV) {
-		dprintf_mciwave(stddeb,"Linux 'widOpen' // MAX_WAVINDRV reached !\n");
+		dprintf_info(mciwave,"Linux 'widOpen' // MAX_WAVINDRV reached !\n");
 		return MMSYSERR_ALLOCATED;
 	}
 	WInDev[wDevID].unixdev = 0;
 	if (access(SOUND_DEV,0) != 0) return MMSYSERR_NOTENABLED;
 	audio = open (SOUND_DEV, O_RDONLY, 0);
 	if (audio == -1) {
-		dprintf_mciwave(stddeb,"Linux 'widOpen' // can't open !\n");
+		dprintf_warn(mciwave,"Linux 'widOpen' // can't open !\n");
 		return MMSYSERR_ALLOCATED;
 	}
 	IOCTL(audio, SNDCTL_DSP_GETBLKSIZE, abuf_size);
 	if (abuf_size < 1024 || abuf_size > 65536) {
 		if (abuf_size == -1)
-			dprintf_mciwave(stddeb,"Linux 'widOpen' // IOCTL can't 'SNDCTL_DSP_GETBLKSIZE' !\n");
+			dprintf_warn(mciwave, "Linux 'widOpen' // IOCTL can't 'SNDCTL_DSP_GETBLKSIZE' !\n");
 		else
-			dprintf_mciwave(stddeb,"Linux 'widOpen' // SNDCTL_DSP_GETBLKSIZE Invalid bufsize !\n");
+			dprintf_warn(mciwave, "Linux 'widOpen' // SNDCTL_DSP_GETBLKSIZE Invalid bufsize !\n");
 		return MMSYSERR_NOTENABLED;
 	}
 	WInDev[wDevID].wFlags = HIWORD(dwFlags & CALLBACK_TYPEMASK);
 	switch(WInDev[wDevID].wFlags) {
 	case DCB_NULL:
-		dprintf_mciwave(stddeb,"Linux 'widOpen' // CALLBACK_NULL!\n");
+		dprintf_info(mciwave,"Linux 'widOpen' // CALLBACK_NULL!\n");
 		break;
 	case DCB_WINDOW:
-		dprintf_mciwave(stddeb,"Linux 'widOpen' // CALLBACK_WINDOW!\n");
+		dprintf_info(mciwave,"Linux 'widOpen' // CALLBACK_WINDOW!\n");
 		break;
 	case DCB_TASK:
-		dprintf_mciwave(stddeb,"Linux 'widOpen' // CALLBACK_TASK!\n");
+		dprintf_info(mciwave,"Linux 'widOpen' // CALLBACK_TASK!\n");
 		break;
 	case DCB_FUNCTION:
-		dprintf_mciwave(stddeb,"Linux 'widOpen' // CALLBACK_FUNCTION!\n");
+		dprintf_info(mciwave,"Linux 'widOpen' // CALLBACK_FUNCTION!\n");
 		break;
 	}
 	if (WInDev[wDevID].lpQueueHdr) {
@@ -1386,7 +1384,7 @@
 	memcpy(&WInDev[wDevID].waveDesc, lpDesc, sizeof(WAVEOPENDESC));
         lpFormat = (LPWAVEFORMAT) lpDesc->lpFormat; 
 	if (lpFormat->wFormatTag != WAVE_FORMAT_PCM) {
-		dprintf_mciwave(stddeb,"Linux 'widOpen' // Bad format %04X !\n",
+		dprintf_warn(mciwave, "Linux 'widOpen' // Bad format %04X !\n",
 					lpFormat->wFormatTag);
 		return WAVERR_BADFORMAT;
 	}
@@ -1406,16 +1404,16 @@
 	IOCTL(audio, SNDCTL_DSP_SPEED, smplrate);
 	IOCTL(audio, SNDCTL_DSP_SAMPLESIZE, samplesize);
 	IOCTL(audio, SNDCTL_DSP_STEREO, dsp_stereo);
-	dprintf_mciwave(stddeb,"Linux 'widOpen' // wBitsPerSample=%u !\n",
+	dprintf_info(mciwave,"Linux 'widOpen' // wBitsPerSample=%u !\n",
 				WInDev[wDevID].Format.wBitsPerSample);
-	dprintf_mciwave(stddeb,"Linux 'widOpen' // nSamplesPerSec=%lu !\n",
+	dprintf_info(mciwave,"Linux 'widOpen' // nSamplesPerSec=%lu !\n",
 				WInDev[wDevID].Format.wf.nSamplesPerSec);
-	dprintf_mciwave(stddeb,"Linux 'widOpen' // nChannels=%u !\n",
+	dprintf_info(mciwave,"Linux 'widOpen' // nChannels=%u !\n",
 				WInDev[wDevID].Format.wf.nChannels);
-	dprintf_mciwave(stddeb,"Linux 'widOpen' // nAvgBytesPerSec=%lu\n",
+	dprintf_info(mciwave,"Linux 'widOpen' // nAvgBytesPerSec=%lu\n",
 			WInDev[wDevID].Format.wf.nAvgBytesPerSec); 
 	if (WAVE_NotifyClient(wDevID, WIM_OPEN, 0L, 0L) != MMSYSERR_NOERROR) {
-		dprintf_mciwave(stddeb,"Linux 'widOpen' // can't notify client !\n");
+		dprintf_warn(mciwave,"Linux 'widOpen' // can't notify client !\n");
 		return MMSYSERR_INVALPARAM;
 	}
 	return MMSYSERR_NOERROR;
@@ -1426,21 +1424,21 @@
  */
 static DWORD widClose(WORD wDevID)
 {
-	dprintf_mciwave(stddeb,"widClose(%u);\n", wDevID);
+	dprintf_info(mciwave,"widClose(%u);\n", wDevID);
 	if (wDevID > MAX_WAVINDRV) return MMSYSERR_INVALPARAM;
 	if (WInDev[wDevID].unixdev == 0) {
-		dprintf_mciwave(stddeb,"Linux 'widClose' // can't close !\n");
+		dprintf_warn(mciwave,"Linux 'widClose' // can't close !\n");
 		return MMSYSERR_NOTENABLED;
 	}
 	if (WInDev[wDevID].lpQueueHdr != NULL) {
-	        dprintf_mciwave(stddeb,"linux 'widclose' // still buffers open !\n");
+	        dprintf_warn(mciwave, "linux 'widclose' // still buffers open !\n");
 		return WAVERR_STILLPLAYING;
 	}
 	close(WInDev[wDevID].unixdev);
 	WInDev[wDevID].unixdev = 0;
 	WInDev[wDevID].bufsize = 0;
 	if (WAVE_NotifyClient(wDevID, WIM_CLOSE, 0L, 0L) != MMSYSERR_NOERROR) {
-		dprintf_mciwave(stddeb,"Linux 'widClose' // can't notify client !\n");
+		dprintf_warn(mciwave,"Linux 'widClose' // can't notify client !\n");
 		return MMSYSERR_INVALPARAM;
 	}
 	return MMSYSERR_NOERROR;
@@ -1454,18 +1452,18 @@
 	int		count	= 1;
 	LPWAVEHDR 	lpWIHdr;
 
-	dprintf_mciwave(stddeb,
+	dprintf_info(mciwave,
 		"widAddBuffer(%u, %p, %08lX);\n", wDevID, lpWaveHdr, dwSize);
 	if (WInDev[wDevID].unixdev == 0) {
-		dprintf_mciwave(stddeb,"Linux 'widAddBuffer' // can't do it !\n");
+		dprintf_warn(mciwave,"Linux 'widAddBuffer' // can't do it !\n");
 		return MMSYSERR_NOTENABLED;
 	}
 	if (!(lpWaveHdr->dwFlags & WHDR_PREPARED)) {
-		dprintf_mciwave(stddeb,	"Linux 'widAddBuffer' // never been prepared !\n");
+		dprintf_info(mciwave,	"Linux 'widAddBuffer' // never been prepared !\n");
 		return WAVERR_UNPREPARED;
 	}
 	if (lpWaveHdr->dwFlags & WHDR_INQUEUE) {
-		dprintf_mciwave(stddeb,	"Linux 'widAddBuffer' // header already in use !\n");
+		dprintf_info(mciwave,	"Linux 'widAddBuffer' // header already in use !\n");
 		return WAVERR_STILLPLAYING;
 	}
 	lpWaveHdr->dwFlags |= WHDR_PREPARED;
@@ -1484,7 +1482,7 @@
 		lpWaveHdr->lpNext = NULL;
 		count++;
 	}
-	dprintf_mciwave(stddeb,
+	dprintf_info(mciwave,
 		"widAddBuffer // buffer added ! (now %u in queue)\n", count);
 	return MMSYSERR_NOERROR;
 }
@@ -1494,10 +1492,10 @@
  */
 static DWORD widPrepare(WORD wDevID, LPWAVEHDR lpWaveHdr, DWORD dwSize)
 {
-	dprintf_mciwave(stddeb,
+	dprintf_info(mciwave,
 		"widPrepare(%u, %p, %08lX);\n", wDevID, lpWaveHdr, dwSize);
 	if (WInDev[wDevID].unixdev == 0) {
-		dprintf_mciwave(stddeb,"Linux 'widPrepare' // can't prepare !\n");
+		dprintf_warn(mciwave,"Linux 'widPrepare' // can't prepare !\n");
 		return MMSYSERR_NOTENABLED;
 	}
 	if (lpWaveHdr->dwFlags & WHDR_INQUEUE)
@@ -1506,7 +1504,7 @@
 	lpWaveHdr->dwFlags &= ~WHDR_INQUEUE;
 	lpWaveHdr->dwFlags &= ~WHDR_DONE;
 	lpWaveHdr->dwBytesRecorded = 0;
-	dprintf_mciwave(stddeb,"Linux 'widPrepare' // header prepared !\n");
+	dprintf_info(mciwave,"Linux 'widPrepare' // header prepared !\n");
 	return MMSYSERR_NOERROR;
 }
 
@@ -1515,17 +1513,17 @@
  */
 static DWORD widUnprepare(WORD wDevID, LPWAVEHDR lpWaveHdr, DWORD dwSize)
 {
-	dprintf_mciwave(stddeb,
+	dprintf_info(mciwave,
 		"widUnprepare(%u, %p, %08lX);\n", wDevID, lpWaveHdr, dwSize);
 	if (WInDev[wDevID].unixdev == 0) {
-		dprintf_mciwave(stddeb,"Linux 'widUnprepare' // can't unprepare !\n");
+		dprintf_warn(mciwave,"Linux 'widUnprepare' // can't unprepare !\n");
 		return MMSYSERR_NOTENABLED;
 	}
 	lpWaveHdr->dwFlags &= ~WHDR_PREPARED;
 	lpWaveHdr->dwFlags &= ~WHDR_INQUEUE;
 	lpWaveHdr->dwFlags |= WHDR_DONE;
 
-	dprintf_mciwave(stddeb, "Linux 'widUnprepare' // all headers unprepared !\n");
+	dprintf_info(mciwave, "Linux 'widUnprepare' // all headers unprepared !\n");
 	return MMSYSERR_NOERROR;
 }
 
@@ -1539,22 +1537,22 @@
 	LPWAVEHDR 	lpWIHdr;
 	LPWAVEHDR	*lpWaveHdr;
 
-	dprintf_mciwave(stddeb,"widStart(%u);\n", wDevID);
+	dprintf_info(mciwave,"widStart(%u);\n", wDevID);
 	if (WInDev[wDevID].unixdev == 0) {
-		dprintf_mciwave(stddeb,	"Linux 'widStart' // can't start recording !\n");
+		dprintf_warn(mciwave,	"Linux 'widStart' // can't start recording !\n");
 		return MMSYSERR_NOTENABLED;
 	}
 
 	lpWaveHdr = &(WInDev[wDevID].lpQueueHdr);
-	dprintf_mciwave(stddeb,"Linux 'widstart'// lpWaveHdr = %08lx\n",(DWORD)lpWaveHdr);
+	dprintf_info(mciwave,"Linux 'widstart'// lpWaveHdr = %08lx\n",(DWORD)lpWaveHdr);
 	if (!*lpWaveHdr || !(*lpWaveHdr)->lpData) {
-		dprintf_mciwave(stddeb,"Linux 'widStart' // never been prepared !\n");
+		dprintf_info(mciwave,"Linux 'widStart' // never been prepared !\n");
 		return WAVERR_UNPREPARED;
 	}
 
 	while(*lpWaveHdr != NULL) {
 	        lpWIHdr = *lpWaveHdr;
-		dprintf_mciwave(stddeb,
+		dprintf_info(mciwave,
 			"widStart // recording buf#%u=%p size=%lu \n",
 			count, lpWIHdr->lpData, lpWIHdr->dwBufferLength);
 		fflush(stddeb);
@@ -1571,14 +1569,14 @@
 
 		/* FIXME: should pass segmented pointer here, do we need that?*/
 		if (WAVE_NotifyClient(wDevID, WIM_DATA, (DWORD)lpWaveHdr, lpWIHdr->dwBytesRecorded) != MMSYSERR_NOERROR) {
-			dprintf_mciwave(stddeb,	"Linux 'widStart' // can't notify client !\n");
+			dprintf_warn(mciwave,	"Linux 'widStart' // can't notify client !\n");
 			return MMSYSERR_INVALPARAM;
 		}
 		/* removes the current block from the queue */
 		*lpWaveHdr = lpWIHdr->lpNext;
 		count++;
 	}
-	dprintf_mciwave(stddeb,"widStart // end of recording !\n");
+	dprintf_info(mciwave,"widStart // end of recording !\n");
 	fflush(stddeb);
 	return MMSYSERR_NOERROR;
 }
@@ -1588,9 +1586,9 @@
  */
 static DWORD widStop(WORD wDevID)
 {
-	dprintf_mciwave(stddeb,"widStop(%u);\n", wDevID);
+	dprintf_info(mciwave,"widStop(%u);\n", wDevID);
 	if (WInDev[wDevID].unixdev == 0) {
-		dprintf_mciwave(stddeb,"Linux 'widStop' // can't stop !\n");
+		dprintf_warn(mciwave,"Linux 'widStop' // can't stop !\n");
 		return MMSYSERR_NOTENABLED;
 	}
 	return MMSYSERR_NOERROR;
@@ -1601,9 +1599,9 @@
  */
 static DWORD widReset(WORD wDevID)
 {
-	dprintf_mciwave(stddeb,"widReset(%u);\n", wDevID);
+	dprintf_info(mciwave,"widReset(%u);\n", wDevID);
 	if (WInDev[wDevID].unixdev == 0) {
-		dprintf_mciwave(stddeb,"Linux 'widReset' // can't reset !\n");
+		dprintf_warn(mciwave,"Linux 'widReset' // can't reset !\n");
 		return MMSYSERR_NOTENABLED;
 	}
 	return MMSYSERR_NOERROR;
@@ -1616,34 +1614,34 @@
 {
 	int		time;
     
-	dprintf_mciwave(stddeb,
+	dprintf_info(mciwave,
 		"widGetPosition(%u, %p, %lu);\n", wDevID, lpTime, uSize);
 	if (WInDev[wDevID].unixdev == 0) {
-		dprintf_mciwave(stddeb,"Linux 'widGetPosition' // can't get pos !\n");
+		dprintf_warn(mciwave,"Linux 'widGetPosition' // can't get pos !\n");
 		return MMSYSERR_NOTENABLED;
 	}
 	if (lpTime == NULL)	return MMSYSERR_INVALPARAM;
-	dprintf_mciwave(stddeb,"widGetPosition // wType=%04X !\n", 
+	dprintf_info(mciwave,"widGetPosition // wType=%04X !\n", 
 			lpTime->wType);
-	dprintf_mciwave(stddeb,"widGetPosition // wBitsPerSample=%u\n",
+	dprintf_info(mciwave,"widGetPosition // wBitsPerSample=%u\n",
 			WInDev[wDevID].Format.wBitsPerSample); 
-	dprintf_mciwave(stddeb,"widGetPosition // nSamplesPerSec=%lu\n",
+	dprintf_info(mciwave,"widGetPosition // nSamplesPerSec=%lu\n",
 			WInDev[wDevID].Format.wf.nSamplesPerSec); 
-	dprintf_mciwave(stddeb,"widGetPosition // nChannels=%u\n",
+	dprintf_info(mciwave,"widGetPosition // nChannels=%u\n",
 			WInDev[wDevID].Format.wf.nChannels); 
-	dprintf_mciwave(stddeb,"widGetPosition // nAvgBytesPerSec=%lu\n",
+	dprintf_info(mciwave,"widGetPosition // nAvgBytesPerSec=%lu\n",
 			WInDev[wDevID].Format.wf.nAvgBytesPerSec); 
 	fflush(stddeb);
 	switch(lpTime->wType) {
 	case TIME_BYTES:
 		lpTime->u.cb = WInDev[wDevID].dwTotalRecorded;
-		dprintf_mciwave(stddeb,
+		dprintf_info(mciwave,
 		    "widGetPosition // TIME_BYTES=%lu\n", lpTime->u.cb);
 		break;
 	case TIME_SAMPLES:
 		lpTime->u.sample = WInDev[wDevID].dwTotalRecorded * 8 /
 				  WInDev[wDevID].Format.wBitsPerSample;
-		dprintf_mciwave(stddeb,
+		dprintf_info(mciwave,
 				"widGetPosition // TIME_SAMPLES=%lu\n", 
 				lpTime->u.sample);
 		break;
@@ -1658,17 +1656,17 @@
 		time -= lpTime->u.smpte.sec * 30;
 		lpTime->u.smpte.frame = time;
 		lpTime->u.smpte.fps = 30;
-dprintf_mciwave(stddeb,"widGetPosition // TIME_SMPTE=%02u:%02u:%02u:%02u\n",
+dprintf_info(mciwave,"widGetPosition // TIME_SMPTE=%02u:%02u:%02u:%02u\n",
 				lpTime->u.smpte.hour, lpTime->u.smpte.min,
 				lpTime->u.smpte.sec, lpTime->u.smpte.frame);
 		break;
 	default:
-		dprintf_mciwave(stddeb,"widGetPosition() format not supported ! use TIME_MS !\n");
+		dprintf_fixme(mciwave, "widGetPosition() format not supported ! use TIME_MS !\n");
 		lpTime->wType = TIME_MS;
 	case TIME_MS:
 		lpTime->u.ms = WInDev[wDevID].dwTotalRecorded /
 				(WInDev[wDevID].Format.wf.nAvgBytesPerSec / 1000);
-		dprintf_mciwave(stddeb,
+		dprintf_info(mciwave,
 		      "widGetPosition // TIME_MS=%lu\n", lpTime->u.ms);
 		break;
 	}
@@ -1681,7 +1679,7 @@
 DWORD widMessage(WORD wDevID, WORD wMsg, DWORD dwUser, 
 					DWORD dwParam1, DWORD dwParam2)
 {
-	dprintf_mciwave(stddeb,"widMessage(%u, %04X, %08lX, %08lX, %08lX);\n",
+	dprintf_info(mciwave,"widMessage(%u, %04X, %08lX, %08lX, %08lX);\n",
 			wDevID, wMsg, dwUser, dwParam1, dwParam2);
 	switch(wMsg) {
 	case WIDM_OPEN:
@@ -1709,7 +1707,7 @@
 	case WIDM_STOP:
 		return widStop(wDevID);
 	default:
-		dprintf_mciwave(stddeb,"widMessage // unknown message !\n");
+		dprintf_warn(mciwave,"widMessage // unknown message !\n");
 	}
 	return MMSYSERR_NOTSUPPORTED;
 }
@@ -1721,7 +1719,7 @@
 LONG WAVE_DriverProc(DWORD dwDevID, HDRVR16 hDriv, WORD wMsg, 
 		     DWORD dwParam1, DWORD dwParam2)
 {
-	dprintf_mciwave(stddeb,"WAVE_DriverProc(%08lX, %04X, %04X, %08lX, %08lX)\n", 
+	dprintf_info(mciwave,"WAVE_DriverProc(%08lX, %04X, %04X, %08lX, %08lX)\n", 
 		dwDevID, hDriv, wMsg, dwParam1, dwParam2);
 	switch(wMsg) {
 	case DRV_LOAD:
diff --git a/multimedia/dsound.c b/multimedia/dsound.c
index e931f78..a719048 100644
--- a/multimedia/dsound.c
+++ b/multimedia/dsound.c
@@ -42,7 +42,6 @@
 #include "mmsystem.h"
 #include "dsound.h"
 #include "thread.h"
-#include "stddebug.h"
 #include "debug.h"
 
 #ifdef HAVE_OSS
@@ -50,7 +49,6 @@
 #include <sys/soundcard.h>
 
 static int audiofd = -1;
-static int current_buffered_frags = 4;
 static LPDIRECTSOUND	dsound = NULL;
 
 static short playbuf[2048];
@@ -98,7 +96,7 @@
 ) {
 	char xbuf[50];
 
-	StringFromCLSID(riid,xbuf);
+	WINE_StringFromCLSID(riid,xbuf);
 	fprintf(stderr,"IDirectSound(%p)->QueryInterface(%s,%p)\n",this,xbuf,ppobj);
 	return E_FAIL;
 }
@@ -129,9 +127,11 @@
 ) {
 	int	i;
 
-	fprintf(stderr,"IDirectSoundNotify(%p)->SetNotificationPositions(0x%08lx,%p),stub!\n",this,howmuch,notify);
-	for (i=0;i<howmuch;i++)
-		fprintf(stderr,"	notify at %ld to 0x%08lx\n",notify[i].dwOffset,notify[i].hEventNotify);
+	if (debugging_info(dsound)) {
+	    fprintf(stderr,"IDirectSoundNotify(%p)->SetNotificationPositions(0x%08lx,%p)\n",this,howmuch,notify);
+	    for (i=0;i<howmuch;i++)
+		    fprintf(stderr,"	notify at %ld to 0x%08lx\n",notify[i].dwOffset,(DWORD)notify[i].hEventNotify);
+	}
 	this->dsb->notifies = HeapReAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,this->dsb->notifies,(this->dsb->nrofnotifies+howmuch)*sizeof(DSBPOSITIONNOTIFY));
 	memcpy(	this->dsb->notifies+this->dsb->nrofnotifies,
 		notify,
@@ -139,8 +139,6 @@
 	);
 	this->dsb->nrofnotifies+=howmuch;
 	qsort(this->dsb->notifies,this->dsb->nrofnotifies,sizeof(DSBPOSITIONNOTIFY),_sort_notifies);
-	for (i=0;i<this->dsb->nrofnotifies;i++)
-		fprintf(stderr,"	notify at %ld to 0x%08lx\n",this->dsb->notifies[i].dwOffset,this->dsb->notifies[i].hEventNotify);
 	return 0;
 }
 
@@ -159,9 +157,9 @@
 ) {
 
 	memcpy(&(this->wfx),wfex,sizeof(this->wfx));
-	dprintf_dsound(stderr,"IDirectSoundBuffer(%p)->SetFormat(%p),stub!\n",
+	dprintf_fixme(dsound,"IDirectSoundBuffer(%p)->SetFormat(%p)\n",
 		       this,wfex);
-	dprintf_dsound(stderr,"	[formattag=0x%04x,chans=%d,samplerate=%ld"
+	dprintf_info(dsound,"	[formattag=0x%04x,chans=%d,samplerate=%ld"
 		   "bytespersec=%ld,blockalign=%d,bitspersamp=%d,cbSize=%d]\n",
 		   wfex->wFormatTag, wfex->nChannels, wfex->nSamplesPerSec,
 		   wfex->nAvgBytesPerSec, wfex->nBlockAlign, 
@@ -173,15 +171,16 @@
 static HRESULT WINAPI IDirectSoundBuffer_SetVolume(
 	LPDIRECTSOUNDBUFFER this,LONG vol
 ) {
-	fprintf(stderr,"IDirectSoundBuffer(%p)->SetVolume(%ld),stub!\n",this,vol);
+	fprintf(stderr,"IDirectSoundBuffer(%p)->SetVolume(%ld)\n",this,vol);
 	this->volume = vol;
+	this->volfac = ((double)vol+10000.0)/10000.0;
 	return 0;
 }
 
 static HRESULT WINAPI IDirectSoundBuffer_GetVolume(
 	LPDIRECTSOUNDBUFFER this,LPLONG vol
 ) {
-	dprintf_dsound(stderr,"IDirectSoundBuffer(%p)->GetVolume(%p),stub!\n",this,vol);
+	dprintf_fixme(dsound,"IDirectSoundBuffer(%p)->GetVolume(%p)\n",this,vol);
 	*vol = this->volume;
 	return 0;
 }
@@ -189,14 +188,16 @@
 static HRESULT WINAPI IDirectSoundBuffer_SetFrequency(
 	LPDIRECTSOUNDBUFFER this,DWORD freq
 ) {
-	fprintf(stderr,"IDirectSoundBuffer(%p)->SetFrequency(%08lx),stub!\n",this,freq);
+	dprintf_fixme(dsound,"IDirectSoundBuffer(%p)->SetFrequency(%ld)\n",this,freq);
+	this->wfx.nSamplesPerSec = freq;
+	this->wfx.nAvgBytesPerSec = freq*this->wfx.nChannels*(this->wfx.wBitsPerSample/8);
 	return 0;
 }
 
 static HRESULT WINAPI IDirectSoundBuffer_Play(
 	LPDIRECTSOUNDBUFFER this,DWORD reserved1,DWORD reserved2,DWORD flags
 ) {
-	dprintf_dsound(stderr,"IDirectSoundBuffer(%p)->Play(%08lx,%08lx,%08lx),stub!\n",
+	dprintf_fixme(dsound,"IDirectSoundBuffer(%p)->Play(%08lx,%08lx,%08lx)\n",
 		this,reserved1,reserved2,flags
 	);
 	this->playpos = 0;
@@ -206,7 +207,7 @@
 }
 
 static HRESULT WINAPI IDirectSoundBuffer_Stop(LPDIRECTSOUNDBUFFER this) {
-	dprintf_dsound(stderr,"IDirectSoundBuffer(%p)->Stop()\n",this);
+	dprintf_info(dsound,"IDirectSoundBuffer(%p)->Stop()\n",this);
 	this->playing = 0;
 	this->writepos = 0; /* hmm */
 	return 0;
@@ -240,7 +241,7 @@
 static HRESULT WINAPI IDirectSoundBuffer_GetCurrentPosition(
 	LPDIRECTSOUNDBUFFER this,LPDWORD playpos,LPDWORD writepos
 ) {
-	dprintf_dsound(stderr,"IDirectSoundBuffer(%p)->GetCurrentPosition(%p,%p),stub!\n",this,playpos,writepos);
+	dprintf_fixme(dsound,"IDirectSoundBuffer(%p)->GetCurrentPosition(%p,%p)\n",this,playpos,writepos);
 	if (playpos) *playpos = this->playpos;
 	if (writepos) *writepos = this->writepos;
 	return 0;
@@ -249,7 +250,7 @@
 static HRESULT WINAPI IDirectSoundBuffer_GetStatus(
 	LPDIRECTSOUNDBUFFER this,LPDWORD status
 ) {
-	dprintf_dsound(stderr,"IDirectSoundBuffer(%p)->GetStatus(%p)\n",this,status);
+	dprintf_info(dsound,"IDirectSoundBuffer(%p)->GetStatus(%p)\n",this,status);
 	*status = 0;
 	if (this->playing)
 		*status |= DSBSTATUS_PLAYING;
@@ -261,7 +262,7 @@
 static HRESULT WINAPI IDirectSoundBuffer_GetFormat(
 	LPDIRECTSOUNDBUFFER this,LPWAVEFORMATEX lpwf,DWORD wfsize,LPDWORD wfwritten
 ) {
-	dprintf_dsound(stderr,"IDirectSoundBuffer(%p)->GetFormat(%p,%ld,%p)\n",this,lpwf,wfsize,wfwritten);
+	dprintf_info(dsound,"IDirectSoundBuffer(%p)->GetFormat(%p,%ld,%p)\n",this,lpwf,wfsize,wfwritten);
 	if (wfsize>sizeof(this->wfx)) wfsize = sizeof(this->wfx);
 	memcpy(lpwf,&(this->wfx),wfsize);
 	if (wfwritten) *wfwritten = wfsize;
@@ -272,7 +273,7 @@
 	LPDIRECTSOUNDBUFFER this,DWORD writecursor,DWORD writebytes,LPVOID lplpaudioptr1,LPDWORD audiobytes1,LPVOID lplpaudioptr2,LPDWORD audiobytes2,DWORD flags
 ) {
 
-	dprintf_dsound(stderr,"IDirectSoundBuffer(%p)->Lock(%ld,%ld,%p,%p,%p,%p,0x%08lx)\n",
+	dprintf_info(dsound,"IDirectSoundBuffer(%p)->Lock(%ld,%ld,%p,%p,%p,%p,0x%08lx)\n",
 		this,
 		writecursor,
 		writebytes,
@@ -293,7 +294,7 @@
 			*(LPBYTE*)lplpaudioptr2 = NULL;
 		if (audiobytes2)
 			*audiobytes2 = 0;
-		dprintf_dsound(stderr,"->%ld.0\n",writebytes);
+		dprintf_info(dsound,"->%ld.0\n",writebytes);
 	} else {
 		*(LPBYTE*)lplpaudioptr1 = this->buffer+writecursor;
 		*audiobytes1 = this->buflen-writecursor;
@@ -301,7 +302,7 @@
 			*(LPBYTE*)lplpaudioptr2 = this->buffer;
 		if (audiobytes2)
 			*audiobytes2 = writebytes-(this->buflen-writecursor);
-		dprintf_dsound(stderr,"->%ld.%ld\n",*audiobytes1,audiobytes2?*audiobytes2:0);
+		dprintf_info(dsound,"->%ld.%ld\n",*audiobytes1,audiobytes2?*audiobytes2:0);
 	}
 	this->writepos=(writecursor+writebytes)%this->buflen;
 	return 0;
@@ -310,7 +311,7 @@
 static HRESULT WINAPI IDirectSoundBuffer_SetCurrentPosition(
 	LPDIRECTSOUNDBUFFER this,DWORD newpos
 ) {
-	dprintf_dsound(stderr,"IDirectSoundBuffer(%p)->SetCurrentPosition(%ld)\n",this,newpos);
+	dprintf_info(dsound,"IDirectSoundBuffer(%p)->SetCurrentPosition(%ld)\n",this,newpos);
 	this->playpos = newpos;
 	return 0;
 }
@@ -318,7 +319,7 @@
 static HRESULT WINAPI IDirectSoundBuffer_SetPan(
 	LPDIRECTSOUNDBUFFER this,LONG newpan
 ) {
-	dprintf_dsound(stderr,"IDirectSoundBuffer(%p)->SetPan(%ld),stub!\n",this,newpan);
+	dprintf_fixme(dsound,"IDirectSoundBuffer(%p)->SetPan(%ld)\n",this,newpan);
 	this->pan = newpan;
 	return 0;
 }
@@ -326,7 +327,7 @@
 static HRESULT WINAPI IDirectSoundBuffer_GetPan(
 	LPDIRECTSOUNDBUFFER this,LPLONG pan
 ) {
-	dprintf_dsound(stderr,"IDirectSoundBuffer(%p)->GetPan(%p),stub!\n",this,pan);
+	dprintf_fixme(dsound,"IDirectSoundBuffer(%p)->GetPan(%p)\n",this,pan);
 	*pan = this->pan;
 	return 0;
 }
@@ -334,7 +335,7 @@
 static HRESULT WINAPI IDirectSoundBuffer_Unlock(
 	LPDIRECTSOUNDBUFFER this,LPVOID p1,DWORD x1,LPVOID p2,DWORD x2
 ) {
-	dprintf_dsound(stderr,"IDirectSoundBuffer(%p)->Unlock(%p,%ld,%p,%ld)\n",
+	dprintf_info(dsound,"IDirectSoundBuffer(%p)->Unlock(%p,%ld,%p,%ld)\n",
 		this,p1,x1,p2,x2
 	);
 	return 0;
@@ -343,7 +344,7 @@
 static HRESULT WINAPI IDirectSoundBuffer_GetFrequency(
 	LPDIRECTSOUNDBUFFER this,LPDWORD freq
 ) {
-	dprintf_dsound(stderr,"IDirectSoundBuffer(%p)->GetFrequency(%p)\n",
+	dprintf_info(dsound,"IDirectSoundBuffer(%p)->GetFrequency(%p)\n",
 		this,freq
 	);
 	*freq = this->wfx.nSamplesPerSec;
@@ -353,7 +354,7 @@
 static HRESULT WINAPI IDirectSoundBuffer_Initialize(
 	LPDIRECTSOUNDBUFFER this,LPDIRECTSOUND dsound,LPDSBUFFERDESC dbsd
 ) {
-	fprintf(stderr,"IDirectSoundBuffer(%p)->Initialize(%p,%p),stub!\n",this,dsound,dbsd);
+	fprintf(stderr,"IDirectSoundBuffer(%p)->Initialize(%p,%p)\n",this,dsound,dbsd);
 	return DSERR_ALREADYINITIALIZED;
 }
 
@@ -384,7 +385,7 @@
 		*ppobj = (LPVOID)dsn;
 		return 0;
 	}
-	StringFromCLSID(riid,xbuf);
+	WINE_StringFromCLSID(riid,xbuf);
 	fprintf(stderr,"IDirectSoundBuffer(%p)->QueryInterface(%s,%p)\n",this,xbuf,ppobj);
 	return E_FAIL;
 }
@@ -419,7 +420,7 @@
 static HRESULT WINAPI IDirectSound_SetCooperativeLevel(
 	LPDIRECTSOUND this,HWND32 hwnd,DWORD level
 ) {
-	dprintf_dsound(stderr,"IDirectSound(%p)->SetCooperativeLevel(%08lx,%ld)\n",
+	dprintf_info(dsound,"IDirectSound(%p)->SetCooperativeLevel(%08lx,%ld)\n",
 		this,(DWORD)hwnd,level
 	);
 	return 0;
@@ -429,8 +430,8 @@
 static HRESULT WINAPI IDirectSound_CreateSoundBuffer(
 	LPDIRECTSOUND this,LPDSBUFFERDESC dsbd,LPLPDIRECTSOUNDBUFFER ppdsb,LPUNKNOWN lpunk
 ) {
-	if (debugging_dsound) {
-		fprintf(stderr,"IDirectSound(%p)->CreateSoundBuffer(%p,%p,%p),stub!\n",this,dsbd,ppdsb,lpunk);
+	if (debugging_info(dsound)) {
+		fprintf(stderr,"IDirectSound(%p)->CreateSoundBuffer(%p,%p,%p)\n",this,dsbd,ppdsb,lpunk);
 		fprintf(stderr,"[size=%ld,",dsbd->dwSize);
 		fprintf(stderr,"flags = 0x%08lx,",dsbd->dwFlags);
 		_dump_DSBCAPS(dsbd->dwFlags);
@@ -446,6 +447,7 @@
 	(*ppdsb)->lpvtbl = &dsbvt;
 	(*ppdsb)->dsound = this;
 	(*ppdsb)->playing = 0;
+	(*ppdsb)->volfac = 1.0;
 	memcpy(&((*ppdsb)->dsbd),dsbd,sizeof(*dsbd));
 
 	/* register buffer */
@@ -461,7 +463,7 @@
 static HRESULT WINAPI IDirectSound_DuplicateSoundBuffer(
 	LPDIRECTSOUND this,LPDIRECTSOUNDBUFFER pdsb,LPLPDIRECTSOUNDBUFFER ppdsb
 ) {
-	fprintf(stderr,"IDirectSound(%p)->DuplicateSoundBuffer(%p,%p),stub!\n",this,pdsb,ppdsb);
+	dprintf_fixme(dsound,"IDirectSound(%p)->DuplicateSoundBuffer(%p,%p)\n",this,pdsb,ppdsb);
 
 	*ppdsb = (LPDIRECTSOUNDBUFFER)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirectSoundBuffer));
 	(*ppdsb)->ref =1;
@@ -483,8 +485,8 @@
 
 
 static HRESULT WINAPI IDirectSound_GetCaps(LPDIRECTSOUND this,LPDSCAPS caps) {
-	fprintf(stderr,"IDirectSound(%p)->GetCaps(%p),stub!\n",this,caps);
-	fprintf(stderr,"	flags = 0x%08lx\n",caps->dwFlags);
+	dprintf_fixme(dsound,"IDirectSound(%p)->GetCaps(%p)\n",this,caps);
+	dprintf_fixme(dsound,"	flags = 0x%08lx\n",caps->dwFlags);
 
 	caps->dwSize = sizeof(*caps);
 	caps->dwFlags = DSCAPS_PRIMARYSTEREO|DSCAPS_PRIMARY16BIT|DSCAPS_EMULDRIVER|DSCAPS_SECONDARYSTEREO|DSCAPS_SECONDARY16BIT;
@@ -522,7 +524,7 @@
 ) {
 	char xbuf[50];
 
-	StringFromCLSID(riid,xbuf);
+	WINE_StringFromCLSID(riid,xbuf);
 	fprintf(stderr,"IDirectSound(%p)->QueryInterface(%s,%p)\n",this,xbuf,ppobj);
 	return E_FAIL;
 }
@@ -545,14 +547,19 @@
 DSOUND_setformat(LPWAVEFORMATEX wfex) {
 	int	xx,channels,speed,format,nformat;
 
+
 	switch (wfex->wFormatTag) {
 	default:
 		fprintf(stderr,"unknown WAVE_FORMAT tag %d\n",wfex->wFormatTag);
 		return DSERR_BADFORMAT;
 	case WAVE_FORMAT_PCM:
-		format = AFMT_S16_LE;
 		break;
 	}
+	if (wfex->wBitsPerSample==8)
+		format = AFMT_U8;
+	else
+		format = AFMT_S16_LE;
+
 	if (-1==ioctl(audiofd,SNDCTL_DSP_GETFMTS,&xx)) {
 		perror("ioctl SNDCTL_DSP_GETFMTS");
 		return -1;
@@ -581,6 +588,9 @@
 		perror("ioctl SNDCTL_DSP_SPEED");
 		return -1;
 	}
+	fprintf(stderr,"freq %ld channels %d bits %d\n",
+		wfex->nSamplesPerSec,wfex->nChannels,wfex->wBitsPerSample
+	);
 	return 0;
 }
 
@@ -610,68 +620,137 @@
 
 static void 
 DSOUND_MixInBuffer(IDirectSoundBuffer *dsb) {
-	int	i,j,buflen = dsb->buflen;
+	int	j,buflen = dsb->buflen;
 	LPDSBPOSITIONNOTIFY	nextevent;
+	int	xdiff = dsb->wfx.nSamplesPerSec-dsound->wfx.nSamplesPerSec;
+	double	volfac = dsb->volfac;
 
-	if (dsb->wfx.nSamplesPerSec != dsound->wfx.nSamplesPerSec) {
-		fprintf(stderr,"mixing in buffer of different frequency, argh!\n");
+	if (xdiff<0) xdiff=-xdiff;
+	if (xdiff>1500) {
+		fprintf(stderr,"mixing in buffer of different frequency (%ld vs %ld), argh!\n",dsb->wfx.nSamplesPerSec,dsound->wfx.nSamplesPerSec);
 	}
 	nextevent = DSOUND_nextevent(dsb);
+/*	fprintf(stderr,"%d.%d.%d.%d\n",dsound->wfx.wBitsPerSample,dsb->wfx.wBitsPerSample,dsound->wfx.nChannels,dsb->wfx.nChannels);*/
 
-	if (dsb->wfx.wBitsPerSample == 8) {
-		unsigned char	*xbuf = (unsigned char*)(dsb->buffer);
-		if (dsb->wfx.nChannels == 1) {
-			for (j=0;j<sizeof(playbuf)/sizeof(playbuf[0])/2;j++) {
-				dsb->playpos=(dsb->playpos+1)%buflen;
-				if (!dsb->playpos && !(dsb->playflags&DSBPLAY_LOOPING)) {
-					dsb->playing = 0;
-					dsb->playpos = buflen;
-					return;
+	if (dsound->wfx.wBitsPerSample == 8) {
+		char	*playbuf8 = (char*)playbuf;
+
+		if (dsb->wfx.wBitsPerSample == 8) {
+			unsigned char	*xbuf = (unsigned char*)(dsb->buffer);
+			if (dsb->wfx.nChannels == 1) {
+				for (j=0;j<sizeof(playbuf)/2;j++) {
+			
+					dsb->playpos=(dsb->playpos+1)%buflen;
+					if (!dsb->playpos && !(dsb->playflags&DSBPLAY_LOOPING)) {
+						dsb->playing = 0;
+						dsb->playpos = buflen;
+						return;
+					}
+					/* FIXME: pan,volume */
+					playbuf8[(j<<1)  ]+=xbuf[dsb->playpos]*volfac;
+					playbuf8[(j<<1)+1]+=xbuf[dsb->playpos]*volfac;
+					CHECK_EVENT
 				}
-				/* FIXME: pan,volume */
-				playbuf[(j<<1)  ]+=xbuf[dsb->playpos]<<8;
-				playbuf[(j<<1)+1]+=xbuf[dsb->playpos]<<8;
-				CHECK_EVENT
+			} else {
+				for (j=0;j<sizeof(playbuf);j++) {
+					dsb->playpos=(dsb->playpos+1)%buflen;
+					if (!dsb->playpos && !(dsb->playflags&DSBPLAY_LOOPING)) {
+						dsb->playing = 0;
+						dsb->playpos = buflen;
+						return;
+					}
+					/* FIXME: pan,volume */
+					playbuf8[j]+=xbuf[dsb->playpos]*volfac;
+					CHECK_EVENT
+				}
 			}
-		} else {
-			for (j=0;j<sizeof(playbuf)/sizeof(playbuf[0]);j++) {
-				dsb->playpos=(dsb->playpos+1)%buflen;
-				if (!dsb->playpos && !(dsb->playflags&DSBPLAY_LOOPING)) {
-					dsb->playing = 0;
-					dsb->playpos = buflen;
-					return;
+		} else { /* 16 */
+			short	*xbuf = (short*)(dsb->buffer);
+			if (dsb->wfx.nChannels == 1) {
+				for (j=0;j<sizeof(playbuf)/2;j++) {
+					dsb->playpos=(dsb->playpos+2)%buflen;
+					if (!dsb->playpos && !(dsb->playflags&DSBPLAY_LOOPING)) {
+						dsb->playing = 0;
+						dsb->playpos = buflen;
+						return;
+					}
+					/* FIXME: pan,volume */
+					playbuf8[(j<<1)  ]+=(xbuf[dsb->playpos>>1]>>8)*volfac;
+					playbuf8[(j<<1)+1]+=(xbuf[dsb->playpos>>1]>>8)*volfac;
+					CHECK_EVENT
 				}
-				/* FIXME: pan,volume */
-				playbuf[j]+=xbuf[dsb->playpos]<<8;
-				CHECK_EVENT
+			} else {
+				for (j=0;j<sizeof(playbuf);j++) {
+					dsb->playpos=(dsb->playpos+2)%buflen;
+					if (!dsb->playpos && !(dsb->playflags&DSBPLAY_LOOPING)) {
+						dsb->playing = 0;
+						dsb->playpos = buflen;
+						return;
+					}
+					/* FIXME: pan,volume */
+					playbuf8[j]+=(xbuf[dsb->playpos>>1]>>8)*volfac;
+					CHECK_EVENT
+				}
 			}
 		}
-	} else { /* 16 */
-		short	*xbuf = (short*)(dsb->buffer);
-		if (dsb->wfx.nChannels == 1) {
-			for (j=0;j<sizeof(playbuf)/sizeof(playbuf[0])/2;j++) {
-				dsb->playpos=(dsb->playpos+2)%buflen;
-				if (!dsb->playpos && !(dsb->playflags&DSBPLAY_LOOPING)) {
-					dsb->playing = 0;
-					dsb->playpos = buflen;
-					return;
+	} else { /* 16 bit */
+		if (dsb->wfx.wBitsPerSample == 8) {
+			unsigned char	*xbuf = (unsigned char*)(dsb->buffer);
+			if (dsb->wfx.nChannels == 1) {
+				for (j=0;j<sizeof(playbuf)/sizeof(playbuf[0])/2;j++) {
+					dsb->playpos=(dsb->playpos+1)%buflen;
+					if (!dsb->playpos && !(dsb->playflags&DSBPLAY_LOOPING)) {
+						dsb->playing = 0;
+						dsb->playpos = buflen;
+						return;
+					}
+					/* FIXME: pan,volume */
+					/* FIXME: should be *256 */
+					playbuf[(j<<1)  ]+=(xbuf[dsb->playpos]<<7)*volfac;
+					playbuf[(j<<1)+1]+=(xbuf[dsb->playpos]<<7)*volfac;
+					CHECK_EVENT
 				}
-				/* FIXME: pan,volume */
-				playbuf[(j<<1)  ]+=xbuf[dsb->playpos>>1];
-				playbuf[(j<<1)+1]+=xbuf[dsb->playpos>>1];
-				CHECK_EVENT
+			} else {
+				for (j=0;j<sizeof(playbuf)/sizeof(playbuf[0]);j++) {
+					dsb->playpos=(dsb->playpos+1)%buflen;
+					if (!dsb->playpos && !(dsb->playflags&DSBPLAY_LOOPING)) {
+						dsb->playing = 0;
+						dsb->playpos = buflen;
+						return;
+					}
+					/* FIXME: pan,volume */
+					/* FIXME: should be *256 */
+					playbuf[j]+=(xbuf[dsb->playpos]<<7)*volfac;
+					CHECK_EVENT
+				}
 			}
-		} else {
-			for (j=0;j<sizeof(playbuf)/sizeof(playbuf[0]);j++) {
-				dsb->playpos=(dsb->playpos+2)%buflen;
-				if (!dsb->playpos && !(dsb->playflags&DSBPLAY_LOOPING)) {
-					dsb->playing = 0;
-					dsb->playpos = buflen;
-					return;
+		} else { /* 16 */
+			short	*xbuf = (short*)(dsb->buffer);
+			if (dsb->wfx.nChannels == 1) {
+				for (j=0;j<sizeof(playbuf)/sizeof(playbuf[0])/2;j++) {
+					dsb->playpos=(dsb->playpos+2)%buflen;
+					if (!dsb->playpos && !(dsb->playflags&DSBPLAY_LOOPING)) {
+						dsb->playing = 0;
+						dsb->playpos = buflen;
+						return;
+					}
+					/* FIXME: pan,volume */
+					playbuf[(j<<1)  ]+=(xbuf[dsb->playpos>>1]*volfac);
+					playbuf[(j<<1)+1]+=(xbuf[dsb->playpos>>1]*volfac);
+					CHECK_EVENT
 				}
-				/* FIXME: pan,volume */
-				playbuf[j]+=xbuf[dsb->playpos>>1];
-				CHECK_EVENT
+			} else {
+				for (j=0;j<sizeof(playbuf)/sizeof(playbuf[0]);j++) {
+					dsb->playpos=(dsb->playpos+2)%buflen;
+					if (!dsb->playpos && !(dsb->playflags&DSBPLAY_LOOPING)) {
+						dsb->playing = 0;
+						dsb->playpos = buflen;
+						return;
+					}
+					/* FIXME: pan,volume */
+					playbuf[j]+=xbuf[dsb->playpos>>1]*volfac;
+					CHECK_EVENT
+				}
 			}
 		}
 	}
@@ -679,17 +758,20 @@
 
 static DWORD
 DSOUND_thread(LPVOID arg) {
-	int	fragsdiff,res,i,curleft,playing;
+	int	res,i,curleft,playing,haveprimary = 0;
 	struct audio_buf_info	abi;
 
 	fprintf(stderr,"dsound is at pid %d\n",getpid());
 	ioctl(audiofd,SNDCTL_DSP_GETOSPACE,&abi);
-	fragsdiff = abi.fragstotal-abi.fragments;
 	while (1) {
 		if (!dsound) {
 			fprintf(stderr,"DSOUND thread giving up.\n");
 			ExitThread(0);
 		}
+		if (getppid()==1) {
+			fprintf(stderr,"DSOUND father died? Giving up.\n");
+			ExitThread(0);
+		}
 		/* RACE: dsound could be deleted */
 		dsound->lpvtbl->fnAddRef(dsound);
 		if (!dsound->nrofbuffers) {
@@ -698,20 +780,17 @@
 			continue;
 		}
 		memset(playbuf,0,sizeof(playbuf));
-		/* empty in memory soundbuffers */
-		while (1) {
-			ioctl(audiofd,SNDCTL_DSP_GETOSPACE,&abi);
-			if (abi.fragstotal-abi.fragments<=fragsdiff+current_buffered_frags)
-				break;
-			Sleep(1);
-		}
 		playing = 0;
 		dsound->lpvtbl->fnAddRef(dsound); 
+		haveprimary = 0;
 		for (i=dsound->nrofbuffers;i--;) {
 			IDirectSoundBuffer	*dsb = dsound->buffers[i];
 
 			dsb->lpvtbl->fnAddRef(dsb);
+			if (dsb->playing && dsb->buflen)
+				playing++;
 			if (dsb->dsbd.dwFlags & DSBCAPS_PRIMARYBUFFER) {
+				haveprimary = 1;
 				if (memcmp(&dsound->wfx,&(dsb->wfx),sizeof(dsound->wfx))) {
 					DSOUND_setformat(&(dsb->wfx));
 					memcpy(&dsound->wfx,&(dsb->wfx),sizeof(dsb->wfx));
@@ -719,6 +798,21 @@
 			}
 			dsb->lpvtbl->fnRelease(dsb);
 		}
+		/* We have just one playbuffer, so use its format */
+		if ((playing==1) && !haveprimary) {
+			for (i=dsound->nrofbuffers;i--;) {
+				IDirectSoundBuffer	*dsb = dsound->buffers[i];
+
+				dsb->lpvtbl->fnAddRef(dsb);
+				if (dsb->playing && dsb->buflen) {
+					if (memcmp(&dsound->wfx,&(dsb->wfx),sizeof(dsound->wfx))) {
+						DSOUND_setformat(&(dsb->wfx));
+						memcpy(&dsound->wfx,&(dsb->wfx),sizeof(dsb->wfx));
+					}
+				}
+				dsb->lpvtbl->fnRelease(dsb);
+			}
+		}
 		for (i=dsound->nrofbuffers;i--;) {
 			IDirectSoundBuffer	*dsb = dsound->buffers[i];
 
@@ -733,12 +827,6 @@
 
 		/*fputc('0'+playing,stderr);*/
 		curleft = 0;
-		ioctl(audiofd,SNDCTL_DSP_GETOSPACE,&abi);
-		if ((abi.fragstotal-abi.fragments)<=1+fragsdiff) {
-			current_buffered_frags++;
-		} else if ((abi.fragstotal-abi.fragments)>2+fragsdiff) {
-			current_buffered_frags--;
-		}
 		while (curleft < sizeof(playbuf)) {
 			res = write(audiofd,(LPBYTE)playbuf+curleft,sizeof(playbuf)-curleft);
 			if (res==-1) {
@@ -755,6 +843,7 @@
 #endif /* HAVE_OSS */
 
 HRESULT WINAPI DirectSoundCreate(LPGUID lpGUID,LPDIRECTSOUND *ppDS,IUnknown *pUnkOuter ) {
+	int	xx;
 	if (lpGUID)
 		fprintf(stderr,"DirectSoundCreate(%p,%p,%p)\n",lpGUID,ppDS,pUnkOuter);
 #ifdef HAVE_OSS
@@ -766,11 +855,12 @@
 		audiofd=0;
 		return DSERR_NODRIVER;
 	}
-	/*
-	xx=0x0004000c;
+	xx=0x0002000c;
 	if (-1==ioctl(audiofd,SNDCTL_DSP_SETFRAGMENT,&xx))
 		perror("ioctl SETFRAGMENT");
-	*/
+	fprintf(stderr,"SETFRAGMENT. count is now %d, fragsize is %d\n",
+		(xx>>16)+1,xx&0xffff
+	);
 
 	*ppDS = (LPDIRECTSOUND)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectSound));
 	(*ppDS)->ref		= 1;
diff --git a/multimedia/joystick.c b/multimedia/joystick.c
index 15dd0fa..ae1c568 100644
--- a/multimedia/joystick.c
+++ b/multimedia/joystick.c
@@ -25,7 +25,6 @@
 #include "user.h"
 #include "driver.h"
 #include "mmsystem.h"
-#include "stddebug.h"
 #include "debug.h"
 
 #define MAXJOYDRIVERS	4
@@ -95,7 +94,7 @@
 		} else
 			return;
         if (joyCaptured == FALSE) return;
-	dprintf_mmsys(stddeb, "JoySendMessages()\n");
+	dprintf_info(mmsys, "JoySendMessages()\n");
         for (joy=0; joy < MAXJOYDRIVERS; joy++) {
 		if (joyOpenDriver(joy) == FALSE) continue;
                 dev_stat = read(joy_dev[joy], &js, sizeof(js));
@@ -138,14 +137,16 @@
     int joy;
     UINT16 joy_cnt = 0;
 
-    dprintf_mmsys(stddeb, "JoyGetNumDevs: ");
     for (joy=0; joy<MAXJOYDRIVERS; joy++)
 	if (joyOpenDriver(joy) == TRUE) {		
 		joyCloseDriver(joy);
 		joy_cnt++;
     }
-    dprintf_mmsys(stddeb, "returning %d\n", joy_cnt);
-    if (!joy_cnt) fprintf(stderr, "No joystick found - perhaps get joystick-0.8.0.tar.gz and load it as module or use Linux >= 2.1.45 to be able to use joysticks.\n");
+    dprintf_info(mmsys, "returning %d\n", joy_cnt);
+    if (!joy_cnt) fprintf(stderr, "No joystick found - "
+			  "perhaps get joystick-0.8.0.tar.gz and load"
+			  "it as module or use Linux >= 2.1.45 to be "
+			  "able to use joysticks.\n");
     return joy_cnt;
 }
 
@@ -225,7 +226,7 @@
  */
 MMRESULT16 WINAPI joyGetDevCaps16(UINT16 wID, LPJOYCAPS16 lpCaps, UINT16 wSize)
 {
-    dprintf_mmsys(stderr, "JoyGetDevCaps(%04X, %p, %d);\n",
+    dprintf_info(mmsys, "JoyGetDevCaps(%04X, %p, %d);\n",
             wID, lpCaps, wSize);
     if (joyOpenDriver(wID) == TRUE) {
         lpCaps->wMid = MM_MICROSOFT;
@@ -265,7 +266,7 @@
 /**************************************************************************
  *                              JoyGetPosEx             [WINMM.31]
  */
-MMRESULT32 WINAPI joyGetPosEx(UINT32 wID, LPJOYINFO32 lpInfo)
+MMRESULT32 WINAPI joyGetPosEx(UINT32 wID, LPJOYINFOEX lpInfo)
 {
 	/* FIXME: implement it */
 	return MMSYSERR_NODRIVER;
@@ -293,7 +294,7 @@
 {
         struct js_status js;
 
-        dprintf_mmsys(stderr, "JoyGetPos(%04X, %p)\n", wID, lpInfo);
+        dprintf_info(mmsys, "JoyGetPos(%04X, %p)\n", wID, lpInfo);
         if (joyOpenDriver(wID) == FALSE) return MMSYSERR_NODRIVER;
 	dev_stat = read(joy_dev[wID], &js, sizeof(js));
 	if (dev_stat != sizeof(js)) {
@@ -307,7 +308,7 @@
 	lpInfo->wYpos = js.y;
 	lpInfo->wZpos = 0; /* FIXME: Don't know what to do with this value as joystick driver doesn't provide a Z value */
 	lpInfo->wButtons = js.buttons;
-	dprintf_mmsys(stderr, "JoyGetPos: x: %d, y: %d, buttons: %d\n", js.x, js.y, js.buttons);
+	dprintf_info(mmsys, "JoyGetPos: x: %d, y: %d, buttons: %d\n", js.x, js.y, js.buttons);
 	return JOYERR_NOERROR;
 }
 
@@ -328,7 +329,7 @@
  */
 MMRESULT16 WINAPI joyGetThreshold16(UINT16 wID, LPUINT16 lpThreshold)
 {
-    dprintf_mmsys(stderr, "JoyGetThreshold(%04X, %p);\n", wID, lpThreshold);
+    dprintf_info(mmsys, "JoyGetThreshold(%04X, %p);\n", wID, lpThreshold);
     if (wID >= MAXJOYDRIVERS) return JOYERR_PARMS;
     *lpThreshold = joy_threshold[wID];
     return JOYERR_NOERROR;
@@ -347,7 +348,7 @@
  */
 MMRESULT16 WINAPI joyReleaseCapture16(UINT16 wID)
 {
-    dprintf_mmsys(stderr, "JoyReleaseCapture(%04X);\n", wID);
+    dprintf_info(mmsys, "JoyReleaseCapture(%04X);\n", wID);
     joyCaptured = FALSE;
     joyCloseDriver(wID);
     joy_dev[wID] = -1;
@@ -369,7 +370,7 @@
 MMRESULT16 WINAPI joySetCapture16(HWND16 hWnd,UINT16 wID,UINT16 wPeriod,BOOL16 bChanged)
 {
 
-    dprintf_mmsys(stderr, "JoySetCapture(%04X, %04X, %d, %d);\n",
+    dprintf_info(mmsys, "JoySetCapture(%04X, %04X, %d, %d);\n",
 	    hWnd, wID, wPeriod, bChanged);
 
     if (!CaptureWnd[wID]) {
@@ -394,7 +395,7 @@
  */
 MMRESULT16 WINAPI joySetThreshold16(UINT16 wID, UINT16 wThreshold)
 {
-    dprintf_mmsys(stderr, "JoySetThreshold(%04X, %d);\n", wID, wThreshold);
+    dprintf_info(mmsys, "JoySetThreshold(%04X, %d);\n", wID, wThreshold);
 
     if (wID > 3) return JOYERR_PARMS;
     joy_threshold[wID] = wThreshold;
diff --git a/multimedia/mcianim.c b/multimedia/mcianim.c
index 39fcdf1..aa545a5 100644
--- a/multimedia/mcianim.c
+++ b/multimedia/mcianim.c
@@ -14,7 +14,6 @@
 #include "user.h"
 #include "driver.h"
 #include "mmsystem.h"
-#include "stddebug.h"
 #include "debug.h"
 
 #define MAX_ANIMDRV 		2
@@ -55,7 +54,7 @@
 	LPSTR		lpstrElementName;
 	char		str[128];
 
-	dprintf_mcianim(stddeb,"ANIM_mciOpen(%04X, %08lX, %p);\n", 
+	dprintf_info(mcianim,"ANIM_mciOpen(%04X, %08lX, %p);\n", 
 					wDevID, dwFlags, lpParms);
 	if (lpParms == NULL) return MCIERR_INTERNAL;
 	if (AnimDev[wDevID].nUseCount > 0) {
@@ -71,12 +70,12 @@
 		AnimDev[wDevID].nUseCount = 1;
 		AnimDev[wDevID].fShareable = dwFlags & MCI_OPEN_SHAREABLE;
 		}
-	dprintf_mcianim(stddeb,"ANIM_mciOpen // wDevID=%04X\n", wDevID);
+	dprintf_info(mcianim,"ANIM_mciOpen // wDevID=%04X\n", wDevID);
 	lpParms->wDeviceID = wDevID;
-	dprintf_mcianim(stddeb,"ANIM_mciOpen // lpParms->wDevID=%04X\n", lpParms->wDeviceID);
+	dprintf_info(mcianim,"ANIM_mciOpen // lpParms->wDevID=%04X\n", lpParms->wDeviceID);
     if (dwFlags & MCI_OPEN_ELEMENT) {
 		lpstrElementName = (LPSTR)PTR_SEG_TO_LIN(lpParms->lpstrElementName);
-		dprintf_mcianim(stddeb,"ANIM_mciOpen // MCI_OPEN_ELEMENT '%s' !\n",
+		dprintf_info(mcianim,"ANIM_mciOpen // MCI_OPEN_ELEMENT '%s' !\n",
 						lpstrElementName);
 		if (strlen(lpstrElementName) > 0) {
 			strcpy(str, lpstrElementName);
@@ -96,7 +95,7 @@
    Moved to mmsystem.c mciOpen routine 
 
 	if (dwFlags & MCI_NOTIFY) {
-		dprintf_mcianim(stddeb,
+		dprintf_info(mcianim,
 			"ANIM_mciOpen // MCI_NOTIFY_SUCCESSFUL %08lX !\n", 
 			lpParms->dwCallback);
 		mciDriverNotify((HWND16)LOWORD(lpParms->dwCallback), 
@@ -115,7 +114,7 @@
 static DWORD ANIM_mciClose(UINT16 wDevID, DWORD dwParam, LPMCI_GENERIC_PARMS lpParms)
 {
 #if defined(linux) || defined(__FreeBSD__)
-	dprintf_mcianim(stddeb,"ANIM_mciClose(%u, %08lX, %p);\n", 
+	dprintf_info(mcianim,"ANIM_mciClose(%u, %08lX, %p);\n", 
 				wDevID, dwParam, lpParms);
 	if (AnimDev[wDevID].lpdwTrackLen != NULL) free(AnimDev[wDevID].lpdwTrackLen);
 	if (AnimDev[wDevID].lpdwTrackPos != NULL) free(AnimDev[wDevID].lpdwTrackPos);
@@ -130,11 +129,11 @@
 						LPMCI_GETDEVCAPS_PARMS lpParms)
 {
 #if defined(linux) || defined(__FreeBSD__)
-	dprintf_mcianim(stddeb,"ANIM_mciGetDevCaps(%u, %08lX, %p);\n", 
+	dprintf_info(mcianim,"ANIM_mciGetDevCaps(%u, %08lX, %p);\n", 
 				wDevID, dwFlags, lpParms);
 	if (lpParms == NULL) return MCIERR_INTERNAL;
 	if (dwFlags & MCI_GETDEVCAPS_ITEM) {
-        	dprintf_mcianim(stddeb,
+        	dprintf_info(mcianim,
 		"ANIM_mciGetDevCaps // MCI_GETDEVCAPS_ITEM dwItem=%08lX;\n",
 				lpParms->dwItem);
 		switch(lpParms->dwItem) {
@@ -169,7 +168,7 @@
 				return MCIERR_UNRECOGNIZED_COMMAND;
 			}
 		}
-	dprintf_mcianim(stddeb,
+	dprintf_info(mcianim,
 		"ANIM_mciGetDevCaps // lpParms->dwReturn=%08lX;\n", 
 		lpParms->dwReturn);
  	return 0;
@@ -190,13 +189,13 @@
 	UINT16	wMinutes;
 	UINT16	wSeconds;
 	UINT16	wFrames;
-	dprintf_mcianim(stddeb,"ANIM_CalcTime(%u, %08lX, %lu);\n", 
+	dprintf_info(mcianim,"ANIM_CalcTime(%u, %08lX, %lu);\n", 
 			wDevID, dwFormatType, dwFrame);
     
 	switch (dwFormatType) {
 		case MCI_FORMAT_MILLISECONDS:
 			dwTime = dwFrame / ANIMFRAMES_PERSEC * 1000;
-			dprintf_mcianim(stddeb,
+			dprintf_info(mcianim,
 				"ANIM_CalcTime // MILLISECONDS %lu\n", dwTime);
 			break;
 		case MCI_FORMAT_MSF:
@@ -205,7 +204,7 @@
 			wFrames = dwFrame - ANIMFRAMES_PERMIN * wMinutes - 
 								ANIMFRAMES_PERSEC * wSeconds;
 			dwTime = MCI_MAKE_MSF(wMinutes, wSeconds, wFrames);
-			dprintf_mcianim(stddeb,"ANIM_CalcTime // MSF %02u:%02u:%02u -> dwTime=%lu\n",
+			dprintf_info(mcianim,"ANIM_CalcTime // MSF %02u:%02u:%02u -> dwTime=%lu\n",
 								wMinutes, wSeconds, wFrames, dwTime);
 			break;
 		default:
@@ -223,7 +222,7 @@
 			wFrames = dwFrame - ANIMFRAMES_PERMIN * wMinutes - 
 								ANIMFRAMES_PERSEC * wSeconds;
 			dwTime = MCI_MAKE_TMSF(wTrack, wMinutes, wSeconds, wFrames);
-			dprintf_mcianim(stddeb,
+			dprintf_info(mcianim,
 				"ANIM_CalcTime // %02u-%02u:%02u:%02u\n",
 				wTrack, wMinutes, wSeconds, wFrames);
 			break;
@@ -241,17 +240,17 @@
 	DWORD	dwFrame = 0;
 #if defined(linux) || defined(__FreeBSD__)
 	UINT16	wTrack;
-	dprintf_mcianim(stddeb,"ANIM_CalcFrame(%u, %08lX, %lu);\n", 
+	dprintf_info(mcianim,"ANIM_CalcFrame(%u, %08lX, %lu);\n", 
 			wDevID, dwFormatType, dwTime);
 
         switch (dwFormatType) {
 		case MCI_FORMAT_MILLISECONDS:
 			dwFrame = dwTime * ANIMFRAMES_PERSEC / 1000;
-			dprintf_mcianim(stddeb,
+			dprintf_info(mcianim,
 				"ANIM_CalcFrame // MILLISECONDS %lu\n", dwFrame);
 			break;
 		case MCI_FORMAT_MSF:
-			dprintf_mcianim(stddeb,
+			dprintf_info(mcianim,
 				"ANIM_CalcFrame // MSF %02u:%02u:%02u\n",
 				MCI_MSF_MINUTE(dwTime), MCI_MSF_SECOND(dwTime), 
 				MCI_MSF_FRAME(dwTime));
@@ -264,11 +263,11 @@
 			dwFormatType = MCI_FORMAT_TMSF;
 		case MCI_FORMAT_TMSF:
 			wTrack = MCI_TMSF_TRACK(dwTime);
-			dprintf_mcianim(stddeb,
+			dprintf_info(mcianim,
 				"ANIM_CalcFrame // TMSF %02u-%02u:%02u:%02u\n",
 				MCI_TMSF_TRACK(dwTime), MCI_TMSF_MINUTE(dwTime), 
 				MCI_TMSF_SECOND(dwTime), MCI_TMSF_FRAME(dwTime));
-			dprintf_mcianim(stddeb,
+			dprintf_info(mcianim,
 				"ANIM_CalcFrame // TMSF trackpos[%u]=%lu\n",
 				wTrack, AnimDev[wDevID].lpdwTrackPos[wTrack - 1]);
 			dwFrame = AnimDev[wDevID].lpdwTrackPos[wTrack - 1];
@@ -288,7 +287,7 @@
 static DWORD ANIM_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMS16 lpParms)
 {
 #if defined(linux) || defined(__FreeBSD__)
-	dprintf_mcianim(stddeb,"ANIM_mciInfo(%u, %08lX, %p);\n", 
+	dprintf_info(mcianim,"ANIM_mciInfo(%u, %08lX, %p);\n", 
 		wDevID, dwFlags, lpParms);
 	if (lpParms == NULL) return MCIERR_INTERNAL;
 	lpParms->lpstrReturn = NULL;
@@ -322,11 +321,11 @@
 static DWORD ANIM_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpParms)
 {
 #if defined(linux) || defined(__FreeBSD__)
-	dprintf_mcianim(stddeb,"ANIM_mciStatus(%u, %08lX, %p);\n", 
+	dprintf_info(mcianim,"ANIM_mciStatus(%u, %08lX, %p);\n", 
 			wDevID, dwFlags, lpParms);
 	if (lpParms == NULL) return MCIERR_INTERNAL;
 	if (dwFlags & MCI_NOTIFY) {
-		dprintf_mcianim(stddeb,
+		dprintf_info(mcianim,
 			"ANIM_mciStatus // MCI_NOTIFY_SUCCESSFUL %08lX !\n", 
 			lpParms->dwCallback);
 		mciDriverNotify((HWND16)LOWORD(lpParms->dwCallback), 
@@ -336,11 +335,11 @@
 		switch(lpParms->dwItem) {
 			case MCI_STATUS_CURRENT_TRACK:
 				lpParms->dwReturn = AnimDev[wDevID].nCurTrack;
-				dprintf_mcianim(stddeb,"ANIM_mciStatus // CURRENT_TRACK=%lu!\n", lpParms->dwReturn);
+				dprintf_info(mcianim,"ANIM_mciStatus // CURRENT_TRACK=%lu!\n", lpParms->dwReturn);
 			 	return 0;
 			case MCI_STATUS_LENGTH:
 				if (dwFlags & MCI_TRACK) {
-					dprintf_mcianim(stddeb,"ANIM_mciStatus // MCI_TRACK #%lu LENGTH=??? !\n",
+					dprintf_info(mcianim,"ANIM_mciStatus // MCI_TRACK #%lu LENGTH=??? !\n",
 														lpParms->dwTrack);
 					if (lpParms->dwTrack > AnimDev[wDevID].nTracks)
 						return MCIERR_OUTOFRANGE;
@@ -350,20 +349,20 @@
 					lpParms->dwReturn = AnimDev[wDevID].dwTotalLen;
 				lpParms->dwReturn = ANIM_CalcTime(wDevID, 
 					AnimDev[wDevID].dwTimeFormat, lpParms->dwReturn);
-                		dprintf_mcianim(stddeb,"ANIM_mciStatus // LENGTH=%lu !\n", lpParms->dwReturn);
+                		dprintf_info(mcianim,"ANIM_mciStatus // LENGTH=%lu !\n", lpParms->dwReturn);
 			 	return 0;
 			case MCI_STATUS_MODE:
 				lpParms->dwReturn = AnimDev[wDevID].mode;
-				dprintf_mcianim(stddeb,"ANIM_mciStatus // MCI_STATUS_MODE=%08lX !\n",
+				dprintf_info(mcianim,"ANIM_mciStatus // MCI_STATUS_MODE=%08lX !\n",
 												lpParms->dwReturn);
 			 	return 0;
 			case MCI_STATUS_MEDIA_PRESENT:
 				lpParms->dwReturn = TRUE;
-				dprintf_mcianim(stddeb,"ANIM_mciStatus // MCI_STATUS_MEDIA_PRESENT !\n");
+				dprintf_info(mcianim,"ANIM_mciStatus // MCI_STATUS_MEDIA_PRESENT !\n");
 			 	return 0;
 			case MCI_STATUS_NUMBER_OF_TRACKS:
 				lpParms->dwReturn = 1;
-				dprintf_mcianim(stddeb,"ANIM_mciStatus // MCI_STATUS_NUMBER_OF_TRACKS = %lu !\n",
+				dprintf_info(mcianim,"ANIM_mciStatus // MCI_STATUS_NUMBER_OF_TRACKS = %lu !\n",
 											lpParms->dwReturn);
 				if (lpParms->dwReturn == (WORD)-1) return MCIERR_INTERNAL;
 			 	return 0;
@@ -371,25 +370,25 @@
 				lpParms->dwReturn = AnimDev[wDevID].dwCurFrame;
 				if (dwFlags & MCI_STATUS_START) {
 					lpParms->dwReturn = 0;
-					dprintf_mcianim(stddeb,"CDAUDIO_mciStatus // get MCI_STATUS_START !\n");
+					dprintf_info(mcianim,"CDAUDIO_mciStatus // get MCI_STATUS_START !\n");
 					}
 				if (dwFlags & MCI_TRACK) {
 					if (lpParms->dwTrack > AnimDev[wDevID].nTracks)
 						return MCIERR_OUTOFRANGE;
 					lpParms->dwReturn = AnimDev[wDevID].lpdwTrackPos[lpParms->dwTrack - 1];
-					dprintf_mcianim(stddeb,"ANIM_mciStatus // get MCI_TRACK #%lu !\n", lpParms->dwTrack);
+					dprintf_info(mcianim,"ANIM_mciStatus // get MCI_TRACK #%lu !\n", lpParms->dwTrack);
 					}
 				lpParms->dwReturn = ANIM_CalcTime(wDevID, 
 					AnimDev[wDevID].dwTimeFormat, lpParms->dwReturn);
-					dprintf_mcianim(stddeb,"ANIM_mciStatus // MCI_STATUS_POSITION=%08lX !\n",
+					dprintf_info(mcianim,"ANIM_mciStatus // MCI_STATUS_POSITION=%08lX !\n",
 														lpParms->dwReturn);
 			 	return 0;
 			case MCI_STATUS_READY:
-				dprintf_mcianim(stddeb,"ANIM_mciStatus // MCI_STATUS_READY !\n");
+				dprintf_info(mcianim,"ANIM_mciStatus // MCI_STATUS_READY !\n");
 				lpParms->dwReturn = TRUE;
 			 	return 0;
 			case MCI_STATUS_TIME_FORMAT:
-				dprintf_mcianim(stddeb,"ANIM_mciStatus // MCI_STATUS_TIME_FORMAT !\n");
+				dprintf_info(mcianim,"ANIM_mciStatus // MCI_STATUS_TIME_FORMAT !\n");
 				lpParms->dwReturn = MCI_FORMAT_MILLISECONDS;
 			 	return 0;
 			default:
@@ -412,7 +411,7 @@
 {
 #if defined(linux) || defined(__FreeBSD__)
 	int 	start, end;
-	dprintf_mcianim(stddeb,"ANIM_mciPlay(%u, %08lX, %p);\n", 
+	dprintf_info(mcianim,"ANIM_mciPlay(%u, %08lX, %p);\n", 
 		wDevID, dwFlags, lpParms);
 	if (lpParms == NULL) return MCIERR_INTERNAL;
 	start = 0; 		end = AnimDev[wDevID].dwTotalLen;
@@ -420,19 +419,19 @@
 	if (dwFlags & MCI_FROM) {
 		start = ANIM_CalcFrame(wDevID, 
 			AnimDev[wDevID].dwTimeFormat, lpParms->dwFrom); 
-        dprintf_mcianim(stddeb,"ANIM_mciPlay // MCI_FROM=%08lX -> %u \n",
+        dprintf_info(mcianim,"ANIM_mciPlay // MCI_FROM=%08lX -> %u \n",
 				lpParms->dwFrom, start);
 		}
 	if (dwFlags & MCI_TO) {
 		end = ANIM_CalcFrame(wDevID, 
 			AnimDev[wDevID].dwTimeFormat, lpParms->dwTo);
-        	dprintf_mcianim(stddeb,
+        	dprintf_info(mcianim,
 			"ANIM_mciPlay // MCI_TO=%08lX -> %u \n",
 			lpParms->dwTo, end);
 		}
 	AnimDev[wDevID].mode = MCI_MODE_PLAY;
 	if (dwFlags & MCI_NOTIFY) {
-		dprintf_mcianim(stddeb,
+		dprintf_info(mcianim,
 			"ANIM_mciPlay // MCI_NOTIFY_SUCCESSFUL %08lX !\n", 
 			lpParms->dwCallback);
 		mciDriverNotify((HWND16)LOWORD(lpParms->dwCallback), 
@@ -450,12 +449,12 @@
 static DWORD ANIM_mciStop(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
 {
 #if defined(linux) || defined(__FreeBSD__)
-	dprintf_mcianim(stddeb,"ANIM_mciStop(%u, %08lX, %p);\n", 
+	dprintf_info(mcianim,"ANIM_mciStop(%u, %08lX, %p);\n", 
 			wDevID, dwFlags, lpParms);
 	if (lpParms == NULL) return MCIERR_INTERNAL;
 	AnimDev[wDevID].mode = MCI_MODE_STOP;
 	if (dwFlags & MCI_NOTIFY) {
-		dprintf_mcianim(stddeb,
+		dprintf_info(mcianim,
 			"ANIM_mciStop // MCI_NOTIFY_SUCCESSFUL %08lX !\n", 
 			lpParms->dwCallback);
 		mciDriverNotify((HWND16)LOWORD(lpParms->dwCallback), 
@@ -473,12 +472,12 @@
 static DWORD ANIM_mciPause(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
 {
 #if defined(linux) || defined(__FreeBSD__)
-	dprintf_mcianim(stddeb,"ANIM_mciPause(%u, %08lX, %p);\n", 
+	dprintf_info(mcianim,"ANIM_mciPause(%u, %08lX, %p);\n", 
 		wDevID, dwFlags, lpParms);
 	if (lpParms == NULL) return MCIERR_INTERNAL;
 	AnimDev[wDevID].mode = MCI_MODE_PAUSE;
 	if (dwFlags & MCI_NOTIFY) {
-		dprintf_mcianim(stddeb,
+		dprintf_info(mcianim,
 			"ANIM_mciPause // MCI_NOTIFY_SUCCESSFUL %08lX !\n", 
 			lpParms->dwCallback);
 		mciDriverNotify((HWND16)LOWORD(lpParms->dwCallback), 
@@ -496,12 +495,12 @@
 static DWORD ANIM_mciResume(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
 {
 #if defined(linux) || defined(__FreeBSD__)
-	dprintf_mcianim(stddeb,"ANIM_mciResume(%u, %08lX, %p);\n", 
+	dprintf_info(mcianim,"ANIM_mciResume(%u, %08lX, %p);\n", 
 		wDevID, dwFlags, lpParms);
 	if (lpParms == NULL) return MCIERR_INTERNAL;
 	AnimDev[wDevID].mode = MCI_MODE_STOP;
 	if (dwFlags & MCI_NOTIFY) {
-		dprintf_mcianim(stddeb,
+		dprintf_info(mcianim,
 			"ANIM_mciResume // MCI_NOTIFY_SUCCESSFUL %08lX !\n", 
 			lpParms->dwCallback);
 		mciDriverNotify((HWND16)LOWORD(lpParms->dwCallback), 
@@ -521,7 +520,7 @@
 #if defined(linux) || defined(__FreeBSD__)
 	DWORD	dwRet;
 	MCI_PLAY_PARMS PlayParms;
-	dprintf_mcianim(stddeb,"ANIM_mciSeek(%u, %08lX, %p);\n", 
+	dprintf_info(mcianim,"ANIM_mciSeek(%u, %08lX, %p);\n", 
 		wDevID, dwFlags, lpParms);
 	if (lpParms == NULL) return MCIERR_INTERNAL;
 	AnimDev[wDevID].mode = MCI_MODE_SEEK;
@@ -540,7 +539,7 @@
 	if (dwRet != 0) return dwRet;
 	dwRet = ANIM_mciStop(wDevID, MCI_WAIT, (LPMCI_GENERIC_PARMS)&PlayParms);
 	if (dwFlags & MCI_NOTIFY) {
-		dprintf_mcianim(stddeb,
+		dprintf_info(mcianim,
 			"ANIM_mciSeek // MCI_NOTIFY_SUCCESSFUL %08lX !\n", 
 			lpParms->dwCallback);
 		mciDriverNotify((HWND16)LOWORD(lpParms->dwCallback), 
@@ -559,7 +558,7 @@
 static DWORD ANIM_mciSet(UINT16 wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms)
 {
 #if defined(linux) || defined(__FreeBSD__)
-	dprintf_mcianim(stddeb,"ANIM_mciSet(%u, %08lX, %p);\n", 
+	dprintf_info(mcianim,"ANIM_mciSet(%u, %08lX, %p);\n", 
 		wDevID, dwFlags, lpParms);
 	if (lpParms == NULL) return MCIERR_INTERNAL;
 /*
@@ -569,14 +568,14 @@
 	if (dwFlags & MCI_SET_TIME_FORMAT) {
 		switch (lpParms->dwTimeFormat) {
 			case MCI_FORMAT_MILLISECONDS:
-				dprintf_mcianim(stddeb,
+				dprintf_info(mcianim,
 					"ANIM_mciSet // MCI_FORMAT_MILLISECONDS !\n");
 				break;
 			case MCI_FORMAT_MSF:
-				dprintf_mcianim(stddeb,"ANIM_mciSet // MCI_FORMAT_MSF !\n");
+				dprintf_info(mcianim,"ANIM_mciSet // MCI_FORMAT_MSF !\n");
 				break;
 			case MCI_FORMAT_TMSF:
-				dprintf_mcianim(stddeb,"ANIM_mciSet // MCI_FORMAT_TMSF !\n");
+				dprintf_info(mcianim,"ANIM_mciSet // MCI_FORMAT_TMSF !\n");
 				break;
 			default:
 				fprintf(stderr,"ANIM_mciSet // bad time format !\n");
@@ -588,7 +587,7 @@
 	if (dwFlags & MCI_SET_ON) return MCIERR_UNSUPPORTED_FUNCTION;
 	if (dwFlags & MCI_SET_OFF) return MCIERR_UNSUPPORTED_FUNCTION;
 	if (dwFlags & MCI_NOTIFY) {
-		dprintf_mcianim(stddeb,
+		dprintf_info(mcianim,
 			"ANIM_mciSet // MCI_NOTIFY_SUCCESSFUL %08lX !\n", 
 			lpParms->dwCallback);
 		mciDriverNotify((HWND16)LOWORD(lpParms->dwCallback), 
diff --git a/multimedia/mcicda.c b/multimedia/mcicda.c
index 65a3375..7c43b7d 100644
--- a/multimedia/mcicda.c
+++ b/multimedia/mcicda.c
@@ -14,7 +14,6 @@
 #include "user.h"
 #include "driver.h"
 #include "mmsystem.h"
-#include "stddebug.h"
 #include "debug.h"
 
 #ifdef linux
@@ -96,7 +95,7 @@
 			  CDIOREADTOCHEADER
 #endif
 			  , &hdr)) {
-            		dprintf_cdaudio(stddeb,
+            		dprintf_warn(cdaudio,
 				"GetNumberOfTracks(%04X) // Error occured !\n", 
 				wDevID);
 			return (WORD)-1;
@@ -133,7 +132,7 @@
 	if (CDADev[wDevID].nTracks == 0) {
 		if (CDAUDIO_GetNumberOfTracks(wDevID) == (WORD)-1) return FALSE;
 		}
-    	dprintf_cdaudio(stddeb,"CDAUDIO_GetTracksInfo // nTracks=%u\n", 
+    	dprintf_info(cdaudio,"CDAUDIO_GetTracksInfo // nTracks=%u\n", 
 		CDADev[wDevID].nTracks);
 	if (CDADev[wDevID].lpdwTrackLen != NULL) 
 		free(CDADev[wDevID].lpdwTrackLen);
@@ -145,7 +144,7 @@
 		(CDADev[wDevID].nTracks + 1) * sizeof(DWORD));
 	if (CDADev[wDevID].lpdwTrackLen == NULL ||
 		CDADev[wDevID].lpdwTrackPos == NULL) {
-        		dprintf_cdaudio(stddeb,
+        		dprintf_warn(cdaudio,
 				"CDAUDIO_GetTracksInfo // error allocating track table !\n");
 		return FALSE;
 		}
@@ -182,7 +181,7 @@
 			  CDIOREADTOCENTRYS
 #endif
 			  , &entry)) {
-            		dprintf_cdaudio(stddeb,
+            		dprintf_warn(cdaudio,
 				"CDAUDIO_GetTracksInfo // error read entry\n");
 			return FALSE;
 			}
@@ -198,7 +197,7 @@
 		if (i == 0) {
 			last_start = start;
 			CDADev[wDevID].dwFirstOffset = start;
-            		dprintf_cdaudio(stddeb,
+            		dprintf_info(cdaudio,
 				"CDAUDIO_GetTracksInfo // dwFirstOffset=%u\n", 
 				start);
 			}
@@ -209,13 +208,13 @@
 			total_length += length;
 			CDADev[wDevID].lpdwTrackLen[i - 1] = length;
 			CDADev[wDevID].lpdwTrackPos[i - 1] = start;
-            		dprintf_cdaudio(stddeb,
+            		dprintf_info(cdaudio,
 			"CDAUDIO_GetTracksInfo // track #%u start=%u len=%u\n",
 				i, start, length);
 			}
 		}
 	CDADev[wDevID].dwTotalLen = total_length;
-    	dprintf_cdaudio(stddeb,"CDAUDIO_GetTracksInfo // total_len=%u\n", 
+    	dprintf_info(cdaudio,"CDAUDIO_GetTracksInfo // total_len=%u\n", 
 		total_length);
 	return TRUE;
 #else
@@ -230,7 +229,7 @@
 static DWORD CDAUDIO_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_OPEN_PARMS16 lpParms)
 {
 #if defined(linux) || defined(__FreeBSD__)
-    	dprintf_cdaudio(stddeb,"CDAUDIO_mciOpen(%04X, %08lX, %p);\n", 
+    	dprintf_info(cdaudio,"CDAUDIO_mciOpen(%04X, %08lX, %p);\n", 
 					wDevID, dwFlags, lpParms);
 	if (lpParms == NULL) return MCIERR_INTERNAL;
 
@@ -248,14 +247,14 @@
 		CDADev[wDevID].fShareable = dwFlags & MCI_OPEN_SHAREABLE;
 		}
     if (dwFlags & MCI_OPEN_ELEMENT) {
-		dprintf_cdaudio(stddeb,"CDAUDIO_mciOpen // MCI_OPEN_ELEMENT !\n");
+		dprintf_info(cdaudio,"CDAUDIO_mciOpen // MCI_OPEN_ELEMENT !\n");
 /*		return MCIERR_NO_ELEMENT_ALLOWED; */
 		}
 	memcpy(&CDADev[wDevID].openParms, lpParms, sizeof(MCI_OPEN_PARMS16));
 	CDADev[wDevID].wNotifyDeviceID = lpParms->wDeviceID;
 	CDADev[wDevID].unixdev = open (CDAUDIO_DEV, O_RDONLY, 0);
 	if (CDADev[wDevID].unixdev == -1) {
-		dprintf_cdaudio(stddeb,"CDAUDIO_mciOpen // can't open '%s' !\n", CDAUDIO_DEV);
+		dprintf_warn(cdaudio,"CDAUDIO_mciOpen // can't open '%s' !\n", CDAUDIO_DEV);
 		return MCIERR_HARDWARE;
 		}
 	CDADev[wDevID].mode = 0;
@@ -267,7 +266,7 @@
 	CDADev[wDevID].lpdwTrackLen = NULL;
 	CDADev[wDevID].lpdwTrackPos = NULL;
 	if (!CDAUDIO_GetTracksInfo(wDevID)) {
-		dprintf_cdaudio(stddeb,"CDAUDIO_mciOpen // error reading TracksInfo !\n");
+		dprintf_warn(cdaudio,"CDAUDIO_mciOpen // error reading TracksInfo !\n");
 /*		return MCIERR_INTERNAL; */
 		}
 
@@ -275,7 +274,7 @@
    Moved to mmsystem.c mciOpen routine
 
 	if (dwFlags & MCI_NOTIFY) {
-        	dprintf_cdaudio(stddeb,
+        	dprintf_info(cdaudio,
 			"CDAUDIO_mciOpen // MCI_NOTIFY_SUCCESSFUL %08lX !\n", 
 			lpParms->dwCallback);
 		mciDriverNotify((HWND16)LOWORD(lpParms->dwCallback), 
@@ -294,7 +293,7 @@
 static DWORD CDAUDIO_mciClose(UINT16 wDevID, DWORD dwParam, LPMCI_GENERIC_PARMS lpParms)
 {
 #if defined(linux) || defined(__FreeBSD__)
-    	dprintf_cdaudio(stddeb,"CDAUDIO_mciClose(%04X, %08lX, %p);\n", 
+    	dprintf_info(cdaudio,"CDAUDIO_mciClose(%04X, %08lX, %p);\n", 
 		wDevID, dwParam, lpParms);
 	if (CDADev[wDevID].lpdwTrackLen != NULL) free(CDADev[wDevID].lpdwTrackLen);
 	if (CDADev[wDevID].lpdwTrackPos != NULL) free(CDADev[wDevID].lpdwTrackPos);
@@ -310,11 +309,11 @@
 						LPMCI_GETDEVCAPS_PARMS lpParms)
 {
 #if defined(linux) || defined(__FreeBSD__)
-    	dprintf_cdaudio(stddeb,"CDAUDIO_mciGetDevCaps(%04X, %08lX, %p);\n", 
+    	dprintf_info(cdaudio,"CDAUDIO_mciGetDevCaps(%04X, %08lX, %p);\n", 
 		wDevID, dwFlags, lpParms);
 	if (lpParms == NULL) return MCIERR_INTERNAL;
 	if (dwFlags & MCI_GETDEVCAPS_ITEM) {
-        	dprintf_cdaudio(stddeb,
+        	dprintf_info(cdaudio,
 		"CDAUDIO_mciGetDevCaps // MCI_GETDEVCAPS_ITEM dwItem=%08lX;\n",
 				lpParms->dwItem);
 		switch(lpParms->dwItem) {
@@ -349,7 +348,7 @@
 				return MCIERR_UNRECOGNIZED_COMMAND;
 			}
 		}
-    	dprintf_cdaudio(stddeb,
+    	dprintf_info(cdaudio,
 		"CDAUDIO_mciGetDevCaps // lpParms->dwReturn=%08lX;\n", 
 		lpParms->dwReturn);
  	return 0;
@@ -364,7 +363,7 @@
 static DWORD CDAUDIO_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMS16 lpParms)
 {
 #if defined(linux) || defined(__FreeBSD__)
-    	dprintf_cdaudio(stddeb,"CDAUDIO_mciInfo(%04X, %08lX, %p);\n", 
+    	dprintf_info(cdaudio,"CDAUDIO_mciInfo(%04X, %08lX, %p);\n", 
 		wDevID, dwFlags, lpParms);
 	if (lpParms == NULL) return MCIERR_INTERNAL;
 	lpParms->lpstrReturn = NULL;
@@ -395,18 +394,18 @@
 #if defined(linux) || defined(__FreeBSD__)
 	UINT16	wTrack;
     
-    	dprintf_cdaudio(stddeb,"CDAUDIO_CalcFrame(%04X, %08lX, %lu);\n", 
+    	dprintf_info(cdaudio,"CDAUDIO_CalcFrame(%04X, %08lX, %lu);\n", 
 		wDevID, dwFormatType, dwTime);
     
 	switch (dwFormatType) {
 		case MCI_FORMAT_MILLISECONDS:
 			dwFrame = dwTime * CDFRAMES_PERSEC / 1000;
-            		dprintf_cdaudio(stddeb,
+            		dprintf_info(cdaudio,
 				"CDAUDIO_CalcFrame // MILLISECONDS %lu\n", 
 				dwFrame);
 			break;
 		case MCI_FORMAT_MSF:
-            		dprintf_cdaudio(stddeb,
+            		dprintf_info(cdaudio,
 				"CDAUDIO_CalcFrame // MSF %02u:%02u:%02u\n",
 				MCI_MSF_MINUTE(dwTime), MCI_MSF_SECOND(dwTime), 
 				MCI_MSF_FRAME(dwTime));
@@ -419,11 +418,11 @@
 			dwFormatType = MCI_FORMAT_TMSF;
 		case MCI_FORMAT_TMSF:
 			wTrack = MCI_TMSF_TRACK(dwTime);
-            		dprintf_cdaudio(stddeb,
+            		dprintf_info(cdaudio,
 			"CDAUDIO_CalcFrame // TMSF %02u-%02u:%02u:%02u\n",
 					MCI_TMSF_TRACK(dwTime), MCI_TMSF_MINUTE(dwTime), 
 					MCI_TMSF_SECOND(dwTime), MCI_TMSF_FRAME(dwTime));
-            		dprintf_cdaudio(stddeb,
+            		dprintf_info(cdaudio,
 				"CDAUDIO_CalcFrame // TMSF trackpos[%u]=%lu\n",
 				wTrack, CDADev[wDevID].lpdwTrackPos[wTrack - 1]);
 			dwFrame = CDADev[wDevID].lpdwTrackPos[wTrack - 1];
@@ -462,7 +461,7 @@
 		  CDIOCREADSUBCHANNEL, &read_sc
 #endif
 		  )) {
-        	dprintf_cdaudio(stddeb,"CDAUDIO_GetCDStatus // opened or no_media !\n");
+        	dprintf_info(cdaudio,"CDAUDIO_GetCDStatus // opened or no_media !\n");
 		CDADev[wDevID].mode = MCI_MODE_NOT_READY;
 		return TRUE;
 		}
@@ -478,7 +477,7 @@
 #elif __FreeBSD__
 		case CD_AS_AUDIO_INVALID:
 #endif
-            		dprintf_cdaudio(stddeb,"CDAUDIO_GetCDStatus // device doesn't support status, returning NOT_READY.\n");
+            		dprintf_warn(cdaudio, "CDAUDIO_GetCDStatus // device doesn't support status, returning NOT_READY.\n");
 #ifdef linux
 			CDADev[wDevID].mode = MCI_MODE_NOT_READY;
 #elif __FreeBSD__
@@ -491,7 +490,7 @@
 		case CD_AS_NO_STATUS:
 #endif
 			CDADev[wDevID].mode = MCI_MODE_STOP;
-            		dprintf_cdaudio(stddeb,"CDAUDIO_GetCDStatus // MCI_MODE_STOP !\n");
+            		dprintf_info(cdaudio,"CDAUDIO_GetCDStatus // MCI_MODE_STOP !\n");
 			break;
 #ifdef linux
 		case CDROM_AUDIO_PLAY: 
@@ -499,7 +498,7 @@
 		case CD_AS_PLAY_IN_PROGRESS:
 #endif
 			CDADev[wDevID].mode = MCI_MODE_PLAY;
-            		dprintf_cdaudio(stddeb,"CDAUDIO_GetCDStatus // MCI_MODE_PLAY !\n");
+            		dprintf_info(cdaudio,"CDAUDIO_GetCDStatus // MCI_MODE_PLAY !\n");
 			break;
 #ifdef linux
 		case CDROM_AUDIO_PAUSED:
@@ -507,16 +506,16 @@
 		case CD_AS_PLAY_PAUSED:
 #endif
 			CDADev[wDevID].mode = MCI_MODE_PAUSE;
-            		dprintf_cdaudio(stddeb,"CDAUDIO_GetCDStatus // MCI_MODE_PAUSE !\n");
+            		dprintf_info(cdaudio,"CDAUDIO_GetCDStatus // MCI_MODE_PAUSE !\n");
 			break;
 		default:
-            		dprintf_cdaudio(stddeb,"CDAUDIO_GetCDStatus // status=%02X !\n",
 #ifdef linux
-					CDADev[wDevID].sc.cdsc_audiostatus
+            		dprintf_info(cdaudio,"CDAUDIO_GetCDStatus // status=%02X !\n",
+				     CDADev[wDevID].sc.cdsc_audiostatus);
 #elif __FreeBSD__
-					CDADev[wDevID].sc.header.audio_status
+            		dprintf_info(cdaudio,"CDAUDIO_GetCDStatus // status=%02X !\n",
+				     CDADev[wDevID].sc.header.audio_status);
 #endif
-					);
 		}
 #ifdef linux
 	CDADev[wDevID].nCurTrack = CDADev[wDevID].sc.cdsc_trk;
@@ -531,22 +530,23 @@
 		CDFRAMES_PERSEC * CDADev[wDevID].sc.what.position.absaddr.msf.second +
 		CDADev[wDevID].sc.what.position.absaddr.msf.frame;
 #endif
-    	dprintf_cdaudio(stddeb,"CDAUDIO_GetCDStatus // %02u-%02u:%02u:%02u \n",
 #ifdef linux
-		CDADev[wDevID].sc.cdsc_trk,
-		CDADev[wDevID].sc.cdsc_absaddr.msf.minute,
-		CDADev[wDevID].sc.cdsc_absaddr.msf.second,
-		CDADev[wDevID].sc.cdsc_absaddr.msf.frame
+    	dprintf_info(cdaudio,"CDAUDIO_GetCDStatus // %02u-%02u:%02u:%02u \n",
+		     CDADev[wDevID].sc.cdsc_trk,
+		     CDADev[wDevID].sc.cdsc_absaddr.msf.minute,
+		     CDADev[wDevID].sc.cdsc_absaddr.msf.second,
+		     CDADev[wDevID].sc.cdsc_absaddr.msf.frame);
 #elif __FreeBSD__
-		CDADev[wDevID].sc.what.position.track_number,
-		CDADev[wDevID].sc.what.position.absaddr.msf.minute,
-		CDADev[wDevID].sc.what.position.absaddr.msf.second,
-		CDADev[wDevID].sc.what.position.absaddr.msf.frame
+    	dprintf_info(cdaudio,"CDAUDIO_GetCDStatus // %02u-%02u:%02u:%02u \n",
+		     CDADev[wDevID].sc.what.position.track_number,
+		     CDADev[wDevID].sc.what.position.absaddr.msf.minute,
+		     CDADev[wDevID].sc.what.position.absaddr.msf.second,
+		     CDADev[wDevID].sc.what.position.absaddr.msf.frame);
 #endif
-			);
+			
 	if (oldmode != CDADev[wDevID].mode && oldmode == MCI_MODE_OPEN) {
 		if (!CDAUDIO_GetTracksInfo(wDevID)) {
-            dprintf_cdaudio(stddeb,"CDAUDIO_GetCDStatus // error updating TracksInfo !\n");
+		  dprintf_warn(cdaudio, "CDAUDIO_GetCDStatus // error updating TracksInfo !\n");
 			return MCIERR_INTERNAL;
 			}
 		}
@@ -569,13 +569,13 @@
 	UINT16	wSeconds;
 	UINT16	wFrames;
 
-    	dprintf_cdaudio(stddeb,"CDAUDIO_CalcTime(%04X, %08lX, %lu);\n", 
+    	dprintf_info(cdaudio,"CDAUDIO_CalcTime(%04X, %08lX, %lu);\n", 
 		wDevID, dwFormatType, dwFrame);
 
 	switch (dwFormatType) {
 		case MCI_FORMAT_MILLISECONDS:
 			dwTime = dwFrame / CDFRAMES_PERSEC * 1000;
-            		dprintf_cdaudio(stddeb,
+            		dprintf_info(cdaudio,
 				"CDAUDIO_CalcTime // MILLISECONDS %lu\n", 
 				dwTime);
 			break;
@@ -585,7 +585,7 @@
 			wFrames = dwFrame - CDFRAMES_PERMIN * wMinutes - 
 								CDFRAMES_PERSEC * wSeconds;
 			dwTime = MCI_MAKE_MSF(wMinutes, wSeconds, wFrames);
-            		dprintf_cdaudio(stddeb,"CDAUDIO_CalcTime // MSF %02u:%02u:%02u -> dwTime=%lu\n",
+            		dprintf_info(cdaudio,"CDAUDIO_CalcTime // MSF %02u:%02u:%02u -> dwTime=%lu\n",
 								wMinutes, wSeconds, wFrames, dwTime);
 			break;
 		default:
@@ -603,7 +603,7 @@
 			wFrames = dwFrame - CDFRAMES_PERMIN * wMinutes - 
 								CDFRAMES_PERSEC * wSeconds;
 			dwTime = MCI_MAKE_TMSF(wTrack, wMinutes, wSeconds, wFrames);
-            		dprintf_cdaudio(stddeb,
+            		dprintf_info(cdaudio,
 				"CDAUDIO_CalcTime // %02u-%02u:%02u:%02u\n",
 					wTrack, wMinutes, wSeconds, wFrames);
 			break;
@@ -619,12 +619,12 @@
 static DWORD CDAUDIO_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpParms)
 {
 #if defined(linux) || defined(__FreeBSD__)
-    	dprintf_cdaudio(stddeb,"CDAUDIO_mciStatus(%04X, %08lX, %p);\n", 
+    	dprintf_info(cdaudio,"CDAUDIO_mciStatus(%04X, %08lX, %p);\n", 
 		wDevID, dwFlags, lpParms);
 	if (lpParms == NULL) return MCIERR_INTERNAL;
 	if (CDADev[wDevID].unixdev == 0) return MMSYSERR_NOTENABLED;
 	if (dwFlags & MCI_NOTIFY) {
-        	dprintf_cdaudio(stddeb,
+        	dprintf_info(cdaudio,
 			"CDAUDIO_mciStatus // MCI_NOTIFY_SUCCESSFUL %08lX !\n", 
 			lpParms->dwCallback);
 		mciDriverNotify((HWND16)LOWORD(lpParms->dwCallback), 
@@ -635,17 +635,17 @@
 			case MCI_STATUS_CURRENT_TRACK:
 				if (!CDAUDIO_GetCDStatus(wDevID)) return MCIERR_INTERNAL;
 				lpParms->dwReturn = CDADev[wDevID].nCurTrack;
-                		dprintf_cdaudio(stddeb,"CDAUDIO_mciStatus // CURRENT_TRACK=%lu!\n", lpParms->dwReturn);
+                		dprintf_info(cdaudio,"CDAUDIO_mciStatus // CURRENT_TRACK=%lu!\n", lpParms->dwReturn);
 			 	return 0;
 			case MCI_STATUS_LENGTH:
 				if (CDADev[wDevID].nTracks == 0) {
 					if (!CDAUDIO_GetTracksInfo(wDevID)) {
-                        			dprintf_cdaudio(stddeb,"CDAUDIO_mciStatus // error reading TracksInfo !\n");
+                        			dprintf_warn(cdaudio, "CDAUDIO_mciStatus // error reading TracksInfo !\n");
 						return MCIERR_INTERNAL;
 						}
 					}
 				if (dwFlags & MCI_TRACK) {
-					dprintf_cdaudio(stddeb,"CDAUDIO_mciStatus // MCI_TRACK #%lu LENGTH=??? !\n",
+					dprintf_info(cdaudio,"CDAUDIO_mciStatus // MCI_TRACK #%lu LENGTH=??? !\n",
 							lpParms->dwTrack);
 					if (lpParms->dwTrack > CDADev[wDevID].nTracks)
 						return MCIERR_OUTOFRANGE;
@@ -655,24 +655,24 @@
 					lpParms->dwReturn = CDADev[wDevID].dwTotalLen;
 				lpParms->dwReturn = CDAUDIO_CalcTime(wDevID, 
 					CDADev[wDevID].dwTimeFormat, lpParms->dwReturn);
-                		dprintf_cdaudio(stddeb,"CDAUDIO_mciStatus // LENGTH=%lu !\n", lpParms->dwReturn);
+                		dprintf_info(cdaudio,"CDAUDIO_mciStatus // LENGTH=%lu !\n", lpParms->dwReturn);
 			 	return 0;
 			case MCI_STATUS_MODE:
 				if (!CDAUDIO_GetCDStatus(wDevID)) return MCIERR_INTERNAL;
 				lpParms->dwReturn = CDADev[wDevID].mode;
-                		dprintf_cdaudio(stddeb,"CDAUDIO_mciStatus // MCI_STATUS_MODE=%08lX !\n",
+                		dprintf_info(cdaudio,"CDAUDIO_mciStatus // MCI_STATUS_MODE=%08lX !\n",
 												lpParms->dwReturn);
 			 	return 0;
 			case MCI_STATUS_MEDIA_PRESENT:
 				lpParms->dwReturn = (CDADev[wDevID].nTracks > 0) ? TRUE : FALSE;
 				if (lpParms->dwReturn == FALSE)
-                    			dprintf_cdaudio(stddeb,"CDAUDIO_mciStatus // MEDIA_NOT_PRESENT !\n");
+                    			dprintf_info(cdaudio,"CDAUDIO_mciStatus // MEDIA_NOT_PRESENT !\n");
 				else
-                    			dprintf_cdaudio(stddeb,"CDAUDIO_mciStatus // MCI_STATUS_MEDIA_PRESENT !\n");
+                    			dprintf_info(cdaudio,"CDAUDIO_mciStatus // MCI_STATUS_MEDIA_PRESENT !\n");
 			 	return 0;
 			case MCI_STATUS_NUMBER_OF_TRACKS:
 				lpParms->dwReturn = CDAUDIO_GetNumberOfTracks(wDevID);
-                		dprintf_cdaudio(stddeb,"CDAUDIO_mciStatus // MCI_STATUS_NUMBER_OF_TRACKS = %lu !\n",
+                		dprintf_info(cdaudio,"CDAUDIO_mciStatus // MCI_STATUS_NUMBER_OF_TRACKS = %lu !\n",
 													lpParms->dwReturn);
 				if (lpParms->dwReturn == (WORD)-1) return MCIERR_INTERNAL;
 			 	return 0;
@@ -681,33 +681,33 @@
 				lpParms->dwReturn = CDADev[wDevID].dwCurFrame;
 				if (dwFlags & MCI_STATUS_START) {
 					lpParms->dwReturn = CDADev[wDevID].dwFirstOffset;
-                    			dprintf_cdaudio(stddeb,"CDAUDIO_mciStatus // get MCI_STATUS_START !\n");
+                    			dprintf_info(cdaudio,"CDAUDIO_mciStatus // get MCI_STATUS_START !\n");
 					}
 				if (dwFlags & MCI_TRACK) {
 					if (lpParms->dwTrack > CDADev[wDevID].nTracks)
 						return MCIERR_OUTOFRANGE;
 					lpParms->dwReturn = CDADev[wDevID].lpdwTrackPos[lpParms->dwTrack - 1];
-                    			dprintf_cdaudio(stddeb,"CDAUDIO_mciStatus // get MCI_TRACK #%lu !\n", lpParms->dwTrack);
+                    			dprintf_info(cdaudio,"CDAUDIO_mciStatus // get MCI_TRACK #%lu !\n", lpParms->dwTrack);
 					}
 				lpParms->dwReturn = CDAUDIO_CalcTime(wDevID,
 					CDADev[wDevID].dwTimeFormat, lpParms->dwReturn);
-                			dprintf_cdaudio(stddeb,"CDAUDIO_mciStatus // MCI_STATUS_POSITION=%08lX !\n",
+                			dprintf_info(cdaudio,"CDAUDIO_mciStatus // MCI_STATUS_POSITION=%08lX !\n",
 														lpParms->dwReturn);
 			 	return 0;
 			case MCI_STATUS_READY:
-                		dprintf_cdaudio(stddeb,"CDAUDIO_mciStatus // MCI_STATUS_READY !\n");
+                		dprintf_info(cdaudio,"CDAUDIO_mciStatus // MCI_STATUS_READY !\n");
 				lpParms->dwReturn = TRUE;
 			 	return 0;
 			case MCI_STATUS_TIME_FORMAT:
-                		dprintf_cdaudio(stddeb,"CDAUDIO_mciStatus // MCI_STATUS_TIME_FORMAT !\n");
+                		dprintf_info(cdaudio,"CDAUDIO_mciStatus // MCI_STATUS_TIME_FORMAT !\n");
 				lpParms->dwReturn = CDADev[wDevID].dwTimeFormat;
 			 	return 0;
 			default:
-                		dprintf_cdaudio(stddeb,"CDAUDIO_mciStatus // unknown command %08lX !\n", lpParms->dwItem);
+                		dprintf_warn(cdaudio, "CDAUDIO_mciStatus // unknown command %08lX !\n", lpParms->dwItem);
 				return MCIERR_UNRECOGNIZED_COMMAND;
 			}
 		}
-	dprintf_cdaudio(stddeb,"CDAUDIO_mciStatus // not MCI_STATUS_ITEM !\n");
+	dprintf_warn(cdaudio, "CDAUDIO_mciStatus // not MCI_STATUS_ITEM !\n");
  	return 0;
 #else
 	return MMSYSERR_NOTENABLED;
@@ -728,7 +728,7 @@
 	struct	ioc_play_msf	msf;
 #endif
 
-    	dprintf_cdaudio(stddeb,"CDAUDIO_mciPlay(%04X, %08lX, %p);\n", 
+    	dprintf_info(cdaudio,"CDAUDIO_mciPlay(%04X, %08lX, %p);\n", 
 		wDevID, dwFlags, lpParms);
 	if (lpParms == NULL) return MCIERR_INTERNAL;
 	if (CDADev[wDevID].unixdev == 0) return MMSYSERR_NOTENABLED;
@@ -737,13 +737,13 @@
 	if (dwFlags & MCI_FROM) {
 		start = CDAUDIO_CalcFrame(wDevID, 
 			CDADev[wDevID].dwTimeFormat, lpParms->dwFrom); 
-        dprintf_cdaudio(stddeb,"CDAUDIO_mciPlay // MCI_FROM=%08lX -> %u \n",
+        dprintf_info(cdaudio,"CDAUDIO_mciPlay // MCI_FROM=%08lX -> %u \n",
 				lpParms->dwFrom, start);
 		}
 	if (dwFlags & MCI_TO) {
 		end = CDAUDIO_CalcFrame(wDevID, 
 			CDADev[wDevID].dwTimeFormat, lpParms->dwTo);
-        	dprintf_cdaudio(stddeb,
+        	dprintf_info(cdaudio,
 			"CDAUDIO_mciPlay // MCI_TO=%08lX -> %u \n",
 			lpParms->dwTo, end);
 		}
@@ -771,7 +771,7 @@
 		  CDIOCSTART
 #endif
 		  )) {
-        	dprintf_cdaudio(stddeb,"CDAUDIO_mciPlay // motor doesn't start !\n");
+        	dprintf_warn(cdaudio, "CDAUDIO_mciPlay // motor doesn't start !\n");
 		return MCIERR_HARDWARE;
 		}
 	if (ioctl(CDADev[wDevID].unixdev, 
@@ -781,21 +781,21 @@
 		  CDIOCPLAYMSF
 #endif
 		  , &msf)) {
-        	dprintf_cdaudio(stddeb,"CDAUDIO_mciPlay // device doesn't play !\n");
+        	dprintf_warn(cdaudio, "CDAUDIO_mciPlay // device doesn't play !\n");
 		return MCIERR_HARDWARE;
 		}
-    	dprintf_cdaudio(stddeb,"CDAUDIO_mciPlay // msf = %d:%d:%d %d:%d:%d\n",
 #ifdef linux
+    	dprintf_info(cdaudio,"CDAUDIO_mciPlay // msf = %d:%d:%d %d:%d:%d\n",
 		msf.cdmsf_min0, msf.cdmsf_sec0, msf.cdmsf_frame0,
-		msf.cdmsf_min1, msf.cdmsf_sec1, msf.cdmsf_frame1
+		msf.cdmsf_min1, msf.cdmsf_sec1, msf.cdmsf_frame1);
 #elif __FreeBSD__
+    	dprintf_info(cdaudio,"CDAUDIO_mciPlay // msf = %d:%d:%d %d:%d:%d\n",
 		msf.start_m, msf.start_s, msf.start_f,
-		msf.end_m,   msf.end_s,   msf.end_f
+		msf.end_m,   msf.end_s,   msf.end_f);
 #endif
-			);
 	CDADev[wDevID].mode = MCI_MODE_PLAY;
 	if (dwFlags & MCI_NOTIFY) {
-        	dprintf_cdaudio(stddeb,
+        	dprintf_info(cdaudio,
 			"CDAUDIO_mciPlay // MCI_NOTIFY_SUCCESSFUL %08lX !\n", 
 			lpParms->dwCallback);
 /*
@@ -815,7 +815,7 @@
 static DWORD CDAUDIO_mciStop(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
 {
 #if defined(linux) || defined(__FreeBSD__)
-    	dprintf_cdaudio(stddeb,"CDAUDIO_mciStop(%04X, %08lX, %p);\n", 
+    	dprintf_info(cdaudio,"CDAUDIO_mciStop(%04X, %08lX, %p);\n", 
 		wDevID, dwFlags, lpParms);
 	if (lpParms == NULL) return MCIERR_INTERNAL;
 	if (ioctl(CDADev[wDevID].unixdev,
@@ -827,7 +827,7 @@
 		  )) return MCIERR_HARDWARE;
 	CDADev[wDevID].mode = MCI_MODE_STOP;
 	if (dwFlags & MCI_NOTIFY) {
-        	dprintf_cdaudio(stddeb,
+        	dprintf_info(cdaudio,
 			"CDAUDIO_mciStop // MCI_NOTIFY_SUCCESSFUL %08lX !\n", 
 			lpParms->dwCallback);
 		mciDriverNotify((HWND16)LOWORD(lpParms->dwCallback), 
@@ -845,7 +845,7 @@
 static DWORD CDAUDIO_mciPause(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
 {
 #if defined(linux) || defined(__FreeBSD__)
-    	dprintf_cdaudio(stddeb,"CDAUDIO_mciPause(%04X, %08lX, %p);\n", 
+    	dprintf_info(cdaudio,"CDAUDIO_mciPause(%04X, %08lX, %p);\n", 
 		wDevID, dwFlags, lpParms);
 	if (lpParms == NULL) return MCIERR_INTERNAL;
 	if (ioctl(CDADev[wDevID].unixdev,
@@ -857,7 +857,7 @@
 		  )) return MCIERR_HARDWARE;
 	CDADev[wDevID].mode = MCI_MODE_PAUSE;
 	if (dwFlags & MCI_NOTIFY) {
-        dprintf_cdaudio(stddeb,
+        dprintf_info(cdaudio,
 		"CDAUDIO_mciPause // MCI_NOTIFY_SUCCESSFUL %08lX !\n", 
 		lpParms->dwCallback);
 		mciDriverNotify((HWND16)LOWORD(lpParms->dwCallback), 
@@ -875,7 +875,7 @@
 static DWORD CDAUDIO_mciResume(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
 {
 #if defined(linux) || defined(__FreeBSD__)
-    	dprintf_cdaudio(stddeb,"CDAUDIO_mciResume(%04X, %08lX, %p);\n", 
+    	dprintf_info(cdaudio,"CDAUDIO_mciResume(%04X, %08lX, %p);\n", 
 		wDevID, dwFlags, lpParms);
 	if (lpParms == NULL) return MCIERR_INTERNAL;
 	if (ioctl(CDADev[wDevID].unixdev, 
@@ -887,7 +887,7 @@
 		  )) return MCIERR_HARDWARE;
 	CDADev[wDevID].mode = MCI_MODE_STOP;
 	if (dwFlags & MCI_NOTIFY) {
-        	dprintf_cdaudio(stddeb,
+        	dprintf_info(cdaudio,
 			"CDAUDIO_mciResume // MCI_NOTIFY_SUCCESSFUL %08lX !\n", 
 			lpParms->dwCallback);
 		mciDriverNotify((HWND16)LOWORD(lpParms->dwCallback), 
@@ -907,7 +907,7 @@
 #if defined(linux) || defined(__FreeBSD__)
 	DWORD	dwRet;
 	MCI_PLAY_PARMS PlayParms;
-    	dprintf_cdaudio(stddeb,"CDAUDIO_mciSeek(%04X, %08lX, %p);\n", 
+    	dprintf_info(cdaudio,"CDAUDIO_mciSeek(%04X, %08lX, %p);\n", 
 		wDevID, dwFlags, lpParms);
 	if (lpParms == NULL) return MCIERR_INTERNAL;
 	if (ioctl(CDADev[wDevID].unixdev,
@@ -936,7 +936,7 @@
 	if (dwRet != 0) return dwRet;
 	dwRet = CDAUDIO_mciStop(wDevID, MCI_WAIT, (LPMCI_GENERIC_PARMS)&PlayParms);
 	if (dwFlags & MCI_NOTIFY) {
-        	dprintf_cdaudio(stddeb,
+        	dprintf_info(cdaudio,
 			"CDAUDIO_mciSeek // MCI_NOTIFY_SUCCESSFUL %08lX !\n", 
 			lpParms->dwCallback);
 		mciDriverNotify((HWND16)LOWORD(lpParms->dwCallback), 
@@ -955,7 +955,7 @@
 static DWORD CDAUDIO_mciSet(UINT16 wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms)
 {
 #if defined(linux) || defined(__FreeBSD__)
-    	dprintf_cdaudio(stddeb,"CDAUDIO_mciSet(%04X, %08lX, %p);\n", 
+    	dprintf_info(cdaudio,"CDAUDIO_mciSet(%04X, %08lX, %p);\n", 
 		wDevID, dwFlags, lpParms);
 	if (lpParms == NULL) return MCIERR_INTERNAL;
 /*
@@ -965,23 +965,23 @@
 	if (dwFlags & MCI_SET_TIME_FORMAT) {
 		switch (lpParms->dwTimeFormat) {
 			case MCI_FORMAT_MILLISECONDS:
-                		dprintf_cdaudio(stddeb,
+                		dprintf_info(cdaudio,
 				"CDAUDIO_mciSet // MCI_FORMAT_MILLISECONDS !\n");
 				break;
 			case MCI_FORMAT_MSF:
-                		dprintf_cdaudio(stddeb,"CDAUDIO_mciSet // MCI_FORMAT_MSF !\n");
+                		dprintf_info(cdaudio,"CDAUDIO_mciSet // MCI_FORMAT_MSF !\n");
 				break;
 			case MCI_FORMAT_TMSF:
-                		dprintf_cdaudio(stddeb,"CDAUDIO_mciSet // MCI_FORMAT_TMSF !\n");
+                		dprintf_info(cdaudio,"CDAUDIO_mciSet // MCI_FORMAT_TMSF !\n");
 				break;
 			default:
-                		dprintf_cdaudio(stddeb,"CDAUDIO_mciSet // bad time format !\n");
+                		dprintf_warn(cdaudio, "CDAUDIO_mciSet // bad time format !\n");
 				return MCIERR_BAD_TIME_FORMAT;
 			}
 		CDADev[wDevID].dwTimeFormat = lpParms->dwTimeFormat;
 		}
 	if (dwFlags & MCI_SET_DOOR_OPEN) {
-        	dprintf_cdaudio(stddeb,
+        	dprintf_info(cdaudio,
 			"CDAUDIO_mciSet // MCI_SET_DOOR_OPEN !\n");
 #ifdef __FreeBSD__
 		if (ioctl(CDADev[wDevID].unixdev, CDIOCALLOW)) return MCIERR_HARDWARE;
@@ -993,7 +993,7 @@
 		CDADev[wDevID].nTracks = 0;
 		}
 	if (dwFlags & MCI_SET_DOOR_CLOSED) {
-        	dprintf_cdaudio(stddeb,
+        	dprintf_info(cdaudio,
 			"CDAUDIO_mciSet // MCI_SET_DOOR_CLOSED !\n");
 #ifdef __FreeBSD__
                 if (ioctl(CDADev[wDevID].unixdev, CDIOCALLOW)) return MCIERR_HARDWARE;
@@ -1009,7 +1009,7 @@
 	if (dwFlags & MCI_SET_ON) return MCIERR_UNSUPPORTED_FUNCTION;
 	if (dwFlags & MCI_SET_OFF) return MCIERR_UNSUPPORTED_FUNCTION;
 	if (dwFlags & MCI_NOTIFY) {
-        	dprintf_cdaudio(stddeb,
+        	dprintf_info(cdaudio,
 			"CDAUDIO_mciSet // MCI_NOTIFY_SUCCESSFUL %08lX !\n", 
 			lpParms->dwCallback);
 		mciDriverNotify((HWND16)LOWORD(lpParms->dwCallback), 
@@ -1084,7 +1084,7 @@
 			return CDAUDIO_mciSeek(dwDevID, dwParam1, 
 				(LPMCI_SEEK_PARMS)PTR_SEG_TO_LIN(dwParam2));
 		case MCI_SET_DOOR_OPEN:
-            		dprintf_cdaudio(stddeb,
+            		dprintf_info(cdaudio,
 				"CDAUDIO_DriverProc // MCI_SET_DOOR_OPEN !\n");
 #ifdef __FreeBSD__
 			if (ioctl(CDADev[dwDevID].unixdev, CDIOCALLOW)) return MCIERR_HARDWARE;
@@ -1096,7 +1096,7 @@
 			CDADev[dwDevID].nTracks = 0;
 			return 0;
 		case MCI_SET_DOOR_CLOSED:
-            		dprintf_cdaudio(stddeb,"CDAUDIO_DriverProc // MCI_SET_DOOR_CLOSED !\n");
+            		dprintf_info(cdaudio,"CDAUDIO_DriverProc // MCI_SET_DOOR_CLOSED !\n");
 #ifdef __FreeBSD__
 			if (ioctl(CDADev[dwDevID].unixdev, CDIOCALLOW)) return MCIERR_HARDWARE;
 			if (ioctl(CDADev[dwDevID].unixdev, CDIOCCLOSE)) return MCIERR_HARDWARE;
diff --git a/multimedia/mcistring.c b/multimedia/mcistring.c
index 88cf60a..bdd2887 100644
--- a/multimedia/mcistring.c
+++ b/multimedia/mcistring.c
@@ -24,7 +24,6 @@
 #include "driver.h"
 #include "mmsystem.h"
 #include "callback.h"
-#include "stddebug.h"
 #include "debug.h"
 #include "xmalloc.h"
 
@@ -66,10 +65,10 @@
  * for use in mciSendString()
  */
 #define _MCI_STR(s) do {\
-	dprintf_mci(stddeb,"->returns \"%s\"",s);\
+	dprintf_info(mci,"->returns \"%s\"",s);\
 	if (lpstrReturnString) {\
 	    lstrcpyn32A(lpstrReturnString,s,uReturnLength);\
-	    dprintf_mci(stddeb,"-->\"%s\"\n",lpstrReturnString);\
+	    dprintf_info(mci,"-->\"%s\"\n",lpstrReturnString);\
 	}\
 } while(0)
 
@@ -89,7 +88,7 @@
 		res=ANIM_DriverProc(GetDrv(wDevID)->modp.wDeviceID,0,cmd,dwFlags,(DWORD)(params));\
 		break;\
 	case MCI_DEVTYPE_DIGITAL_VIDEO:\
-		dprintf_mci(stddeb,"_MCI_CALL_DRIVER //No DIGITAL_VIDEO yet !\n");\
+		dprintf_fixme(mci,"_MCI_CALL_DRIVER //No DIGITAL_VIDEO yet !\n");\
 		res=MCIERR_DEVICE_NOT_INSTALLED;\
 		break;\
 	default:\
@@ -336,7 +335,7 @@
 	while(GetDrv(wDevID)->modp.wType) {
 		wDevID = MMSYSTEM_NextDevID(wDevID);
 		if (!MMSYSTEM_DevIDValid(wDevID)) {
-			dprintf_mci(stddeb, __FILE__":MCISTR_Open:MAXMCIDRIVERS reached (%x) !\n", wDevID);
+			dprintf_info(mci, __FILE__":MCISTR_Open:MAXMCIDRIVERS reached (%x) !\n", wDevID);
 			SEGPTR_FREE(PTR_SEG_TO_LIN(pU->openParams.lpstrElementName));
 			SEGPTR_FREE(pU);
 			return MCIERR_INTERNAL;
@@ -2113,7 +2112,7 @@
 	DWORD	dwFlags;
 	int	res=0,i,nrofkeywords;
 
-	dprintf_mci(stddeb,"mciSendString('%s', %p, %d, %X)\n", lpstrCommand, 
+	dprintf_info(mci,"mciSendString('%s', %p, %d, %X)\n", lpstrCommand, 
 		lpstrReturnString, uReturnLength, hwndCallback
 	);
 	/* format is <command> <device> <optargs> */
@@ -2183,7 +2182,7 @@
 				break;
 			wDevID = MMSYSTEM_NextDevID(wDevID);
 			if (!MMSYSTEM_DevIDValid(wDevID)) {
-				dprintf_mci(stddeb, __FILE__":mciSendString:MAXMCIDRIVERS reached!\n");
+				dprintf_info(mci, __FILE__":mciSendString:MAXMCIDRIVERS reached!\n");
 				free(keywords);free(cmd);
 				return MCIERR_INVALID_DEVICE_NAME;
 			}
diff --git a/multimedia/midi.c b/multimedia/midi.c
index f38d5dd..6a5b94a 100644
--- a/multimedia/midi.c
+++ b/multimedia/midi.c
@@ -18,8 +18,6 @@
 #include "driver.h"
 #include "mmsystem.h"
 #include "xmalloc.h"
-
-#include "stddebug.h"
 #include "debug.h"
 
 #ifdef linux
@@ -91,7 +89,7 @@
 static DWORD MIDI_NotifyClient(UINT16 wDevID, WORD wMsg, 
 				DWORD dwParam1, DWORD dwParam2)
 {
-	dprintf_midi(stddeb,"MIDI_NotifyClient // wDevID = %04X wMsg = %d dwParm1 = %04lX dwParam2 = %04lX\n",wDevID, wMsg, dwParam1, dwParam2);
+	dprintf_info(midi,"MIDI_NotifyClient // wDevID = %04X wMsg = %d dwParm1 = %04lX dwParam2 = %04lX\n",wDevID, wMsg, dwParam1, dwParam2);
 
 #if defined(linux) || defined(__FreeBSD__)
 
@@ -109,7 +107,7 @@
 		MidiOutDev[wDevID].midiDesc.dwInstance, 
                 dwParam1, 
                 dwParam2)) {
-	    dprintf_midi(stddeb,"MIDI_NotifyClient // can't notify client !\n");
+	    dprintf_warn(midi,"MIDI_NotifyClient // can't notify client !\n");
 	    return MMSYSERR_NOERROR;
 	  }
 	  break;
@@ -122,7 +120,7 @@
 		MidiInDev[wDevID].midiDesc.dwCallback, MidiInDev[wDevID].wFlags, 
 		MidiInDev[wDevID].midiDesc.hMidi, wMsg, 
 		MidiInDev[wDevID].midiDesc.dwInstance, dwParam1, dwParam2)) {
-	    dprintf_mciwave(stddeb,"MIDI_NotifyClient // can't notify client !\n");
+	    dprintf_warn(mciwave,"MIDI_NotifyClient // can't notify client !\n");
 		return MMSYSERR_NOERROR;
 		}
 	  break;
@@ -146,7 +144,7 @@
 			return 0;
 		}
 	}
-	dprintf_midi(stddeb, "MIDI_ReadByte // error reading wDevID=%04X\n", wDevID);
+	dprintf_warn(midi, "MIDI_ReadByte // error reading wDevID=%04X\n", wDevID);
 	return MCIERR_INTERNAL;
 
 #else
@@ -169,7 +167,7 @@
 			}
 		}
 	}
-	dprintf_midi(stddeb, "MIDI_ReadWord // error reading wDevID=%04X\n", wDevID);
+	dprintf_warn(midi, "MIDI_ReadWord // error reading wDevID=%04X\n", wDevID);
 	return MCIERR_INTERNAL;
 }
 
@@ -188,7 +186,7 @@
 			}
 		}
 	}
-	dprintf_midi(stddeb, "MIDI_ReadLong // error reading wDevID=%04X\n", wDevID);
+	dprintf_warn(midi, "MIDI_ReadLong // error reading wDevID=%04X\n", wDevID);
 	return MCIERR_INTERNAL;
 }
 
@@ -202,20 +200,20 @@
 	DWORD	value;
 	if (lpdw == NULL) return MCIERR_INTERNAL;
 	if (MIDI_ReadByte(wDevID, &byte) != 0) {
-		dprintf_midi(stddeb, "MIDI_ReadVaryLen // error reading wDevID=%04X\n", wDevID);
+		dprintf_warn(midi, "MIDI_ReadVaryLen // error reading wDevID=%04X\n", wDevID);
 		return MCIERR_INTERNAL;
 	}
 	value = (DWORD)(byte & 0x7F);
 	while (byte & 0x80) {
 		if (MIDI_ReadByte(wDevID, &byte) != 0) {
-			dprintf_midi(stddeb, "MIDI_ReadVaryLen // error reading wDevID=%04X\n", wDevID);
+			dprintf_warn(midi, "MIDI_ReadVaryLen // error reading wDevID=%04X\n", wDevID);
 			return MCIERR_INTERNAL;
 		}
 		value = (value << 7) + (byte & 0x7F);
 	}
 	*lpdw = value;
 /*
-	dprintf_midi(stddeb, "MIDI_ReadVaryLen // val=%08lX \n", value);
+	dprintf_info(midi, "MIDI_ReadVaryLen // val=%08lX \n", value);
 */
 	return 0;
 }
@@ -229,9 +227,9 @@
 #if defined(linux) || defined(__FreeBSD__)
 	DWORD	toberead;
 	FOURCC	fourcc;
-	dprintf_midi(stddeb, "MIDI_ReadMThd(%04X, %08lX);\n", wDevID, dwOffset);
+	dprintf_info(midi, "MIDI_ReadMThd(%04X, %08lX);\n", wDevID, dwOffset);
 	if (mmioSeek(MCIMidiDev[wDevID].hFile, dwOffset, SEEK_SET) != dwOffset) {
-		dprintf_midi(stddeb, "MIDI_ReadMThd // can't seek at %08lX begin of 'MThd' \n", dwOffset);
+		dprintf_warn(midi, "MIDI_ReadMThd // can't seek at %08lX begin of 'MThd' \n", dwOffset);
 		return MCIERR_INTERNAL;
 	}
 	if (mmioRead(MCIMidiDev[wDevID].hFile, (HPSTR)&fourcc,
@@ -245,7 +243,7 @@
 		return MCIERR_INTERNAL;
 	if (MIDI_ReadWord(wDevID, &MCIMidiDev[wDevID].nTempo) != 0)
 		return MCIERR_INTERNAL;
-	dprintf_midi(stddeb, "MIDI_ReadMThd // toberead=%08lX, wFormat=%04X nTracks=%04X nTempo=%04X\n",
+	dprintf_info(midi, "MIDI_ReadMThd // toberead=%08lX, wFormat=%04X nTracks=%04X nTempo=%04X\n",
 		toberead, MCIMidiDev[wDevID].wFormat,
 		MCIMidiDev[wDevID].nTracks,
 		MCIMidiDev[wDevID].nTempo);
@@ -267,7 +265,7 @@
 	DWORD	toberead;
 	FOURCC	fourcc;
 	if (mmioSeek(MCIMidiDev[wDevID].hFile, dwOffset, SEEK_SET) != dwOffset) {
-		dprintf_midi(stddeb, "MIDI_ReadMTrk // can't seek at %08lX begin of 'MThd' \n", dwOffset);
+		dprintf_warn(midi, "MIDI_ReadMTrk // can't seek at %08lX begin of 'MThd' \n", dwOffset);
 		}
 	if (mmioRead(MCIMidiDev[wDevID].hFile, (HPSTR)&fourcc,
 		(long) sizeof(FOURCC)) != (long) sizeof(FOURCC)) {
@@ -276,7 +274,7 @@
 	if (MIDI_ReadLong(wDevID, &toberead) != 0) {
 		return MCIERR_INTERNAL;
 		}
-	dprintf_midi(stddeb, "MIDI_ReadMTrk // toberead=%08lX\n", toberead);
+	dprintf_info(midi, "MIDI_ReadMTrk // toberead=%08lX\n", toberead);
 	toberead -= 3 * sizeof(WORD);
 	MCIMidiDev[wDevID].dwTotalLen = toberead;
 	return 0;
@@ -298,7 +296,7 @@
 	LPSTR		lpstrElementName;
 	char		str[128];
 
-	dprintf_midi(stddeb, "MIDI_mciOpen(%08lX, %p)\n", dwFlags, lpParms);
+	dprintf_info(midi, "MIDI_mciOpen(%08lX, %p)\n", dwFlags, lpParms);
 	if (lpParms == NULL) return MCIERR_INTERNAL;
 
 	if (MCIMidiDev[wDevID].nUseCount > 0) {
@@ -315,26 +313,26 @@
 		MCIMidiDev[wDevID].hMidiHdr = USER_HEAP_ALLOC(sizeof(MIDIHDR));
 	}
 
-	dprintf_midi(stddeb, "MIDI_mciOpen // wDevID=%04X\n", wDevID);
+	dprintf_info(midi, "MIDI_mciOpen // wDevID=%04X\n", wDevID);
 /*	lpParms->wDeviceID = wDevID;*/
-	dprintf_midi(stddeb, "MIDI_mciOpen // lpParms->wDevID=%04X\n", lpParms->wDeviceID);
-	dprintf_midi(stddeb, "MIDI_mciOpen // before OPEN_ELEMENT\n");
+	dprintf_info(midi, "MIDI_mciOpen // lpParms->wDevID=%04X\n", lpParms->wDeviceID);
+	dprintf_info(midi, "MIDI_mciOpen // before OPEN_ELEMENT\n");
 	if (dwFlags & MCI_OPEN_ELEMENT) {
 		lpstrElementName = (LPSTR)PTR_SEG_TO_LIN(lpParms->lpstrElementName);
-		dprintf_midi(stddeb, "MIDI_mciOpen // MCI_OPEN_ELEMENT '%s' !\n", lpstrElementName);
+		dprintf_info(midi, "MIDI_mciOpen // MCI_OPEN_ELEMENT '%s' !\n", lpstrElementName);
 		if (strlen(lpstrElementName) > 0) {
 			strcpy(str, lpstrElementName);
 			CharUpper32A(str);
 			MCIMidiDev[wDevID].hFile = mmioOpen16(str, NULL, 
 				MMIO_ALLOCBUF | MMIO_READWRITE | MMIO_EXCLUSIVE);
 			if (MCIMidiDev[wDevID].hFile == 0) {
-				dprintf_midi(stddeb, "MIDI_mciOpen // can't find file='%s' !\n", str);
+				dprintf_warn(midi, "MIDI_mciOpen // can't find file='%s' !\n", str);
 				return MCIERR_FILE_NOT_FOUND;
 			}
 		} else 
 			MCIMidiDev[wDevID].hFile = 0;
 	}
-	dprintf_midi(stddeb, "MIDI_mciOpen // hFile=%u\n", MCIMidiDev[wDevID].hFile);
+	dprintf_info(midi, "MIDI_mciOpen // hFile=%u\n", MCIMidiDev[wDevID].hFile);
 	memcpy(&MCIMidiDev[wDevID].openParms, lpParms, sizeof(MCI_OPEN_PARMS16));
 	MCIMidiDev[wDevID].wNotifyDeviceID = lpParms->wDeviceID;
 	MCIMidiDev[wDevID].dwStatus = MCI_MODE_STOP;
@@ -346,30 +344,30 @@
 		if (mmioDescend(MCIMidiDev[wDevID].hFile, &ckMainRIFF, NULL, 0) != 0) {
 			return MCIERR_INTERNAL;
 		}
-		dprintf_midi(stddeb,"MIDI_mciOpen // ParentChunk ckid=%.4s fccType=%.4s cksize=%08lX \n",
+		dprintf_info(midi,"MIDI_mciOpen // ParentChunk ckid=%.4s fccType=%.4s cksize=%08lX \n",
 				(LPSTR)&ckMainRIFF.ckid, (LPSTR)&ckMainRIFF.fccType,
 				ckMainRIFF.cksize);
 		dwOffset = 0;
 		if (ckMainRIFF.ckid == mmioFOURCC('R', 'M', 'I', 'D')) {
-			dprintf_midi(stddeb, "MIDI_mciOpen // is a 'RMID' file \n");
+			dprintf_info(midi, "MIDI_mciOpen // is a 'RMID' file \n");
 			dwOffset = ckMainRIFF.dwDataOffset;
 		}
 		if (ckMainRIFF.ckid != mmioFOURCC('M', 'T', 'h', 'd')) {
-			dprintf_midi(stddeb, "MIDI_mciOpen // unknown format !\n");
+			dprintf_warn(midi, "MIDI_mciOpen // unknown format !\n");
 			return MCIERR_INTERNAL;
 		}
 		if (MIDI_ReadMThd(wDevID, dwOffset) != 0) {
-			dprintf_midi(stddeb, "MIDI_mciOpen // can't read 'MThd' header \n");
+			dprintf_warn(midi, "MIDI_mciOpen // can't read 'MThd' header \n");
 			return MCIERR_INTERNAL;
 		}
 		dwOffset = mmioSeek(MCIMidiDev[wDevID].hFile, 0, SEEK_CUR);
 		if (MIDI_ReadMTrk(wDevID, dwOffset) != 0) {
-			dprintf_midi(stddeb, "MIDI_mciOpen // can't read 'MTrk' header \n");
+			dprintf_warn(midi, "MIDI_mciOpen // can't read 'MTrk' header \n");
 			return MCIERR_INTERNAL;
 		}
 		dwOffset = mmioSeek(MCIMidiDev[wDevID].hFile, 0, SEEK_CUR);
 		MCIMidiDev[wDevID].dwBeginData = dwOffset;
-		dprintf_midi(stddeb, "MIDI_mciOpen // Chunk Found ckid=%.4s fccType=%.4s cksize=%08lX \n",
+		dprintf_info(midi, "MIDI_mciOpen // Chunk Found ckid=%.4s fccType=%.4s cksize=%08lX \n",
 				(LPSTR)&ckMainRIFF.ckid, (LPSTR)&ckMainRIFF.fccType,
 				ckMainRIFF.cksize);
 	}
@@ -389,10 +387,10 @@
 static DWORD MIDI_mciStop(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
 {
 #if defined(linux) || defined(__FreeBSD__)
-	dprintf_midi(stddeb, "MIDI_mciStop(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
+	dprintf_info(midi, "MIDI_mciStop(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
 	if (lpParms == NULL) return MCIERR_INTERNAL;
 	MCIMidiDev[wDevID].dwStatus = MCI_MODE_STOP;
-	dprintf_midi(stddeb, "MIDI_mciStop // MCIMidiDev[wDevID].dwStatus=%p %d\n",
+	dprintf_info(midi, "MIDI_mciStop // MCIMidiDev[wDevID].dwStatus=%p %d\n",
 			&MCIMidiDev[wDevID].dwStatus, MCIMidiDev[wDevID].dwStatus);
 	return 0;
 #else
@@ -409,7 +407,7 @@
 #if defined(linux) || defined(__FreeBSD__)
 	DWORD		dwRet;
 
-	dprintf_midi(stddeb, "MIDI_mciClose(%04X, %08lX, %p);\n", wDevID, dwParam, lpParms);
+	dprintf_info(midi, "MIDI_mciClose(%04X, %08lX, %p);\n", wDevID, dwParam, lpParms);
 	if (MCIMidiDev[wDevID].dwStatus != MCI_MODE_STOP) {
 		MIDI_mciStop(wDevID, MCI_WAIT, lpParms);
 		}
@@ -419,7 +417,7 @@
 		if (MCIMidiDev[wDevID].hFile != 0) {
 			mmioClose(MCIMidiDev[wDevID].hFile, 0);
 			MCIMidiDev[wDevID].hFile = 0;
-			dprintf_midi(stddeb, "MIDI_mciClose // hFile closed !\n");
+			dprintf_info(midi, "MIDI_mciClose // hFile closed !\n");
 			}
 		USER_HEAP_FREE(MCIMidiDev[wDevID].hMidiHdr);
 		dwRet = modMessage(wDevID, MODM_CLOSE, 0, 0L, 0L);
@@ -447,33 +445,33 @@
 	DWORD		dwData,dwRet;
 	LPWORD		ptr;
 
-	dprintf_midi(stddeb, "MIDI_mciPlay(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
+	dprintf_info(midi, "MIDI_mciPlay(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
 	if (MCIMidiDev[wDevID].hFile == 0) {
-		dprintf_midi(stddeb, "MIDI_mciPlay // can't find file='%08lx' !\n", 
+		dprintf_warn(midi, "MIDI_mciPlay // can't find file='%08lx' !\n", 
 				(DWORD)MCIMidiDev[wDevID].openParms.lpstrElementName);
 		return MCIERR_FILE_NOT_FOUND;
 	}
 	start = 1; 		end = 99999;
 	if (dwFlags & MCI_FROM) {
 		start = lpParms->dwFrom; 
-		dprintf_midi(stddeb, "MIDI_mciPlay // MCI_FROM=%d \n", start);
+		dprintf_info(midi, "MIDI_mciPlay // MCI_FROM=%d \n", start);
 	}
 	if (dwFlags & MCI_TO) {
 		end = lpParms->dwTo;
-		dprintf_midi(stddeb, "MIDI_mciPlay // MCI_TO=%d \n", end);
+		dprintf_info(midi, "MIDI_mciPlay // MCI_TO=%d \n", end);
 	}
 #if 0
 	if (dwFlags & MCI_NOTIFY) {
-		dprintf_midi(stddeb, "MIDI_mciPlay // MCI_NOTIFY %08lX !\n", lpParms->dwCallback);
+		dprintf_info(midi, "MIDI_mciPlay // MCI_NOTIFY %08lX !\n", lpParms->dwCallback);
 		switch(fork()) {
 		case -1:
-			dprintf_midi(stddeb, "MIDI_mciPlay // Can't 'fork' process !\n");
+			dprintf_warn(midi, "MIDI_mciPlay // Can't 'fork' process !\n");
 			break;
 		case 0:
-			dprintf_midi(stddeb, "MIDI_mciPlay // process started ! play in background ...\n");
+			dprintf_info(midi, "MIDI_mciPlay // process started ! play in background ...\n");
 			break;
 		default:
-			dprintf_midi(stddeb, "MIDI_mciPlay // process started ! return to caller...\n");
+			dprintf_info(midi, "MIDI_mciPlay // process started ! return to caller...\n");
 			return 0;
 		}
 	}
@@ -488,11 +486,11 @@
 	lpMidiHdr->dwFlags = 0L;
 	dwRet = modMessage(wDevID, MODM_PREPARE, 0, (DWORD)lpMidiHdr, sizeof(MIDIHDR));
 
-/*	dprintf_midi(stddeb, "MIDI_mciPlay // after MODM_PREPARE \n"); */
+/*	dprintf_info(midi, "MIDI_mciPlay // after MODM_PREPARE \n"); */
 
 	MCIMidiDev[wDevID].dwStatus = MCI_MODE_PLAY;
 	while(MCIMidiDev[wDevID].dwStatus != MCI_MODE_STOP) {
-		dprintf_midi(stddeb, "MIDI_mciPlay // MCIMidiDev[wDevID].dwStatus=%p %d\n",
+		dprintf_info(midi, "MIDI_mciPlay // MCIMidiDev[wDevID].dwStatus=%p %d\n",
 			&MCIMidiDev[wDevID].dwStatus, MCIMidiDev[wDevID].dwStatus);
 
 		ptr = (LPWORD)lpMidiHdr->lpData;
@@ -503,11 +501,11 @@
 /*
 		count = mmioRead(MCIMidiDev[wDevID].hFile, lpMidiHdr->lpData, lpMidiHdr->dwBufferLength);
 */
-		dprintf_midi(stddeb, "MIDI_mciPlay // after read count = %d\n",count);
+		dprintf_info(midi, "MIDI_mciPlay // after read count = %d\n",count);
 
 		if (count < 1) break;
 		lpMidiHdr->dwBytesRecorded = count;
-		dprintf_midi(stddeb, "MIDI_mciPlay // before MODM_LONGDATA lpMidiHdr=%p dwBytesRecorded=%lu\n",
+		dprintf_info(midi, "MIDI_mciPlay // before MODM_LONGDATA lpMidiHdr=%p dwBytesRecorded=%lu\n",
 					lpMidiHdr, lpMidiHdr->dwBytesRecorded);
 		dwRet = modMessage(wDevID, MODM_LONGDATA, 0, (DWORD)lpMidiHdr, sizeof(MIDIHDR));
 		if (dwRet != MMSYSERR_NOERROR) {
@@ -539,7 +537,7 @@
 	}
 	MCIMidiDev[wDevID].dwStatus = MCI_MODE_STOP;
 	if (dwFlags & MCI_NOTIFY) {
-		dprintf_midi(stddeb, "MIDI_mciPlay // MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
+		dprintf_info(midi, "MIDI_mciPlay // MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
 		mciDriverNotify((HWND16)LOWORD(lpParms->dwCallback), 
 			MCIMidiDev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
 #if 0
@@ -563,20 +561,20 @@
 	LPMIDIHDR	lpMidiHdr;
 	DWORD		dwRet;
 
-	dprintf_midi(stddeb, "MIDI_mciRecord(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
+	dprintf_info(midi, "MIDI_mciRecord(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
 	if (MCIMidiDev[wDevID].hFile == 0) {
-		dprintf_midi(stddeb, "MIDI_mciRecord // can't find file='%08lx' !\n", 
+		dprintf_warn(midi, "MIDI_mciRecord // can't find file='%08lx' !\n", 
 			(DWORD)MCIMidiDev[wDevID].openParms.lpstrElementName);
 		return MCIERR_FILE_NOT_FOUND;
 	}
 	start = 1; 		end = 99999;
 	if (dwFlags & MCI_FROM) {
 		start = lpParms->dwFrom; 
-		dprintf_midi(stddeb, "MIDI_mciRecord // MCI_FROM=%d \n", start);
+		dprintf_info(midi, "MIDI_mciRecord // MCI_FROM=%d \n", start);
 	}
 	if (dwFlags & MCI_TO) {
 		end = lpParms->dwTo;
-		dprintf_midi(stddeb, "MIDI_mciRecord // MCI_TO=%d \n", end);
+		dprintf_info(midi, "MIDI_mciRecord // MCI_TO=%d \n", end);
 	}
 	lpMidiHdr = USER_HEAP_LIN_ADDR(MCIMidiDev[wDevID].hMidiHdr);
 	lpMidiHdr->lpData = (LPSTR) xmalloc(1200);
@@ -584,27 +582,27 @@
 	lpMidiHdr->dwUser = 0L;
 	lpMidiHdr->dwFlags = 0L;
 	dwRet = midMessage(wDevID, MIDM_PREPARE, 0, (DWORD)lpMidiHdr, sizeof(MIDIHDR));
-	dprintf_midi(stddeb, "MIDI_mciRecord // after MIDM_PREPARE \n");
+	dprintf_info(midi, "MIDI_mciRecord // after MIDM_PREPARE \n");
 	MCIMidiDev[wDevID].dwStatus = MCI_MODE_RECORD;
 	while(MCIMidiDev[wDevID].dwStatus != MCI_MODE_STOP) {
-		dprintf_midi(stddeb, "MIDI_mciRecord // MCIMidiDev[wDevID].dwStatus=%p %d\n",
+		dprintf_info(midi, "MIDI_mciRecord // MCIMidiDev[wDevID].dwStatus=%p %d\n",
 			&MCIMidiDev[wDevID].dwStatus, MCIMidiDev[wDevID].dwStatus);
 		lpMidiHdr->dwBytesRecorded = 0;
 		dwRet = midMessage(wDevID, MIDM_START, 0, 0L, 0L);
-		dprintf_midi(stddeb, "MIDI_mciRecord // after MIDM_START lpMidiHdr=%p dwBytesRecorded=%lu\n",
+		dprintf_info(midi, "MIDI_mciRecord // after MIDM_START lpMidiHdr=%p dwBytesRecorded=%lu\n",
 					lpMidiHdr, lpMidiHdr->dwBytesRecorded);
 		if (lpMidiHdr->dwBytesRecorded == 0) break;
 	}
-	dprintf_midi(stddeb, "MIDI_mciRecord // before MIDM_UNPREPARE \n");
+	dprintf_info(midi, "MIDI_mciRecord // before MIDM_UNPREPARE \n");
 	dwRet = midMessage(wDevID, MIDM_UNPREPARE, 0, (DWORD)lpMidiHdr, sizeof(MIDIHDR));
-	dprintf_midi(stddeb, "MIDI_mciRecord // after MIDM_UNPREPARE \n");
+	dprintf_info(midi, "MIDI_mciRecord // after MIDM_UNPREPARE \n");
 	if (lpMidiHdr->lpData != NULL) {
 		free(lpMidiHdr->lpData);
 		lpMidiHdr->lpData = NULL;
 	}
 	MCIMidiDev[wDevID].dwStatus = MCI_MODE_STOP;
 	if (dwFlags & MCI_NOTIFY) {
-		dprintf_midi(stddeb, "MIDI_mciRecord // MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
+		dprintf_info(midi, "MIDI_mciRecord // MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
 		mciDriverNotify((HWND16)LOWORD(lpParms->dwCallback), 
 			MCIMidiDev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
 	}
@@ -621,7 +619,7 @@
 static DWORD MIDI_mciPause(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
 {
 #if defined(linux) || defined(__FreeBSD__)
-	dprintf_midi(stddeb, "MIDI_mciPause(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
+	dprintf_info(midi, "MIDI_mciPause(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
 	if (lpParms == NULL) return MCIERR_INTERNAL;
 	return 0;
 #else
@@ -636,7 +634,7 @@
 static DWORD MIDI_mciResume(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
 {
 #if defined(linux) || defined(__FreeBSD__)
-	dprintf_midi(stddeb, "MIDI_mciResume(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
+	dprintf_info(midi, "MIDI_mciResume(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
 	if (lpParms == NULL) return MCIERR_INTERNAL;
 	return 0;
 #else
@@ -651,23 +649,23 @@
 static DWORD MIDI_mciSet(UINT16 wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms)
 {
 #if defined(linux) || defined(__FreeBSD__)
-	dprintf_midi(stddeb, "MIDI_mciSet(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
+	dprintf_info(midi, "MIDI_mciSet(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
 	if (lpParms == NULL) return MCIERR_INTERNAL;
-	dprintf_midi(stddeb, "MIDI_mciSet // dwTimeFormat=%08lX\n", lpParms->dwTimeFormat);
-	dprintf_midi(stddeb, "MIDI_mciSet // dwAudio=%08lX\n", lpParms->dwAudio);
+	dprintf_info(midi, "MIDI_mciSet // dwTimeFormat=%08lX\n", lpParms->dwTimeFormat);
+	dprintf_info(midi, "MIDI_mciSet // dwAudio=%08lX\n", lpParms->dwAudio);
 	if (dwFlags & MCI_SET_TIME_FORMAT) {
 		switch (lpParms->dwTimeFormat) {
 		case MCI_FORMAT_MILLISECONDS:
-			dprintf_midi(stddeb, "MIDI_mciSet // MCI_FORMAT_MILLISECONDS !\n");
+			dprintf_info(midi, "MIDI_mciSet // MCI_FORMAT_MILLISECONDS !\n");
 			break;
 		case MCI_FORMAT_BYTES:
-			dprintf_midi(stddeb, "MIDI_mciSet // MCI_FORMAT_BYTES !\n");
+			dprintf_info(midi, "MIDI_mciSet // MCI_FORMAT_BYTES !\n");
 			break;
 		case MCI_FORMAT_SAMPLES:
-			dprintf_midi(stddeb, "MIDI_mciSet // MCI_FORMAT_SAMPLES !\n");
+			dprintf_info(midi, "MIDI_mciSet // MCI_FORMAT_SAMPLES !\n");
 			break;
 		default:
-			dprintf_midi(stddeb, "MIDI_mciSet // bad time format !\n");
+			dprintf_warn(midi, "MIDI_mciSet // bad time format !\n");
 			return MCIERR_BAD_TIME_FORMAT;
 		}
 	}
@@ -675,26 +673,26 @@
 	if (dwFlags & MCI_SET_DOOR_OPEN) return MCIERR_UNSUPPORTED_FUNCTION;
 	if (dwFlags & MCI_SET_DOOR_CLOSED) return MCIERR_UNSUPPORTED_FUNCTION;
 	if (dwFlags & MCI_SET_AUDIO)
-		dprintf_midi(stddeb, "MIDI_mciSet // MCI_SET_AUDIO !\n");
+		dprintf_info(midi, "MIDI_mciSet // MCI_SET_AUDIO !\n");
 	if (dwFlags && MCI_SET_ON) {
-		dprintf_midi(stddeb, "MIDI_mciSet // MCI_SET_ON !\n");
+		dprintf_info(midi, "MIDI_mciSet // MCI_SET_ON !\n");
 		if (dwFlags && MCI_SET_AUDIO_LEFT)
-			dprintf_midi(stddeb, "MIDI_mciSet // MCI_SET_AUDIO_LEFT !\n");
+			dprintf_info(midi, "MIDI_mciSet // MCI_SET_AUDIO_LEFT !\n");
 		if (dwFlags && MCI_SET_AUDIO_RIGHT)
-			dprintf_midi(stddeb, "MIDI_mciSet // MCI_SET_AUDIO_RIGHT !\n");
+			dprintf_info(midi, "MIDI_mciSet // MCI_SET_AUDIO_RIGHT !\n");
 	}
 	if (dwFlags & MCI_SET_OFF)
-		dprintf_midi(stddeb, "MIDI_mciSet // MCI_SET_OFF !\n");
+		dprintf_info(midi, "MIDI_mciSet // MCI_SET_OFF !\n");
 	if (dwFlags & MCI_SEQ_SET_MASTER)
-		dprintf_midi(stddeb, "MIDI_mciSet // MCI_SEQ_SET_MASTER !\n");
+		dprintf_info(midi, "MIDI_mciSet // MCI_SEQ_SET_MASTER !\n");
 	if (dwFlags & MCI_SEQ_SET_SLAVE)
-		dprintf_midi(stddeb, "MIDI_mciSet // MCI_SEQ_SET_SLAVE !\n");
+		dprintf_info(midi, "MIDI_mciSet // MCI_SEQ_SET_SLAVE !\n");
 	if (dwFlags & MCI_SEQ_SET_OFFSET)
-		dprintf_midi(stddeb, "MIDI_mciSet // MCI_SEQ_SET_OFFSET !\n");
+		dprintf_info(midi, "MIDI_mciSet // MCI_SEQ_SET_OFFSET !\n");
 	if (dwFlags & MCI_SEQ_SET_PORT)
-		dprintf_midi(stddeb, "MIDI_mciSet // MCI_SEQ_SET_PORT !\n");
+		dprintf_info(midi, "MIDI_mciSet // MCI_SEQ_SET_PORT !\n");
 	if (dwFlags & MCI_SEQ_SET_TEMPO)
-		dprintf_midi(stddeb, "MIDI_mciSet // MCI_SEQ_SET_TEMPO !\n");
+		dprintf_info(midi, "MIDI_mciSet // MCI_SEQ_SET_TEMPO !\n");
  	return 0;
 #else
 	return MCIERR_INTERNAL;
@@ -708,7 +706,7 @@
 static DWORD MIDI_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpParms)
 {
 #if defined(linux) || defined(__FreeBSD__)
-	dprintf_midi(stddeb, "MIDI_mciStatus(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
+	dprintf_info(midi, "MIDI_mciStatus(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
 	if (lpParms == NULL) return MCIERR_INTERNAL;
 	if (dwFlags & MCI_STATUS_ITEM) {
 		switch(lpParms->dwItem) {
@@ -726,7 +724,7 @@
 			lpParms->dwReturn = MCI_MODE_STOP;
 			break;
 		case MCI_STATUS_MEDIA_PRESENT:
-			dprintf_midi(stddeb, "MIDI_mciStatus // MCI_STATUS_MEDIA_PRESENT !\n");
+			dprintf_info(midi, "MIDI_mciStatus // MCI_STATUS_MEDIA_PRESENT !\n");
 			lpParms->dwReturn = TRUE;
 			break;
 		case MCI_STATUS_NUMBER_OF_TRACKS:
@@ -742,44 +740,44 @@
 			}
 			break;
 		case MCI_STATUS_READY:
-			dprintf_midi(stddeb, "MIDI_mciStatus // MCI_STATUS_READY !\n");
+			dprintf_info(midi, "MIDI_mciStatus // MCI_STATUS_READY !\n");
 			lpParms->dwReturn = TRUE;
 			break;
 		case MCI_STATUS_TIME_FORMAT:
-			dprintf_midi(stddeb, "MIDI_mciStatus // MCI_STATUS_TIME_FORMAT !\n");
+			dprintf_info(midi, "MIDI_mciStatus // MCI_STATUS_TIME_FORMAT !\n");
 			lpParms->dwReturn = MCI_FORMAT_MILLISECONDS;
 			break;
 		case MCI_SEQ_STATUS_DIVTYPE:
-			dprintf_midi(stddeb, "MIDI_mciStatus // MCI_SEQ_STATUS_DIVTYPE !\n");
+			dprintf_info(midi, "MIDI_mciStatus // MCI_SEQ_STATUS_DIVTYPE !\n");
 			lpParms->dwReturn = 0;
 			break;
 		case MCI_SEQ_STATUS_MASTER:
-			dprintf_midi(stddeb, "MIDI_mciStatus // MCI_SEQ_STATUS_MASTER !\n");
+			dprintf_info(midi, "MIDI_mciStatus // MCI_SEQ_STATUS_MASTER !\n");
 			lpParms->dwReturn = 0;
 			break;
 		case MCI_SEQ_STATUS_SLAVE:
-			dprintf_midi(stddeb, "MIDI_mciStatus // MCI_SEQ_STATUS_SLAVE !\n");
+			dprintf_info(midi, "MIDI_mciStatus // MCI_SEQ_STATUS_SLAVE !\n");
 			lpParms->dwReturn = 0;
 			break;
 		case MCI_SEQ_STATUS_OFFSET:
-			dprintf_midi(stddeb, "MIDI_mciStatus // MCI_SEQ_STATUS_OFFSET !\n");
+			dprintf_info(midi, "MIDI_mciStatus // MCI_SEQ_STATUS_OFFSET !\n");
 			lpParms->dwReturn = 0;
 			break;
 		case MCI_SEQ_STATUS_PORT:
-			dprintf_midi(stddeb, "MIDI_mciStatus // MCI_SEQ_STATUS_PORT !\n");
+			dprintf_info(midi, "MIDI_mciStatus // MCI_SEQ_STATUS_PORT !\n");
 			lpParms->dwReturn = 0;
 			break;
 		case MCI_SEQ_STATUS_TEMPO:
-			dprintf_midi(stddeb, "MIDI_mciStatus // MCI_SEQ_STATUS_TEMPO !\n");
+			dprintf_info(midi, "MIDI_mciStatus // MCI_SEQ_STATUS_TEMPO !\n");
 			lpParms->dwReturn = 0;
 			break;
 		default:
-			dprintf_midi(stddeb, "MIDI_mciStatus // unknowm command %08lX !\n", lpParms->dwItem);
+			dprintf_warn(midi, "MIDI_mciStatus // unknowm command %08lX !\n", lpParms->dwItem);
 			return MCIERR_UNRECOGNIZED_COMMAND;
 		}
 	}
 	if (dwFlags & MCI_NOTIFY) {
-		dprintf_midi(stddeb, "MIDI_mciStatus // MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
+		dprintf_info(midi, "MIDI_mciStatus // MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
 		mciDriverNotify((HWND16)LOWORD(lpParms->dwCallback), 
 			MCIMidiDev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
 	}
@@ -796,7 +794,7 @@
 					LPMCI_GETDEVCAPS_PARMS lpParms)
 {
 #if defined(linux) || defined(__FreeBSD__)
-	dprintf_midi(stddeb, "MIDI_mciGetDevCaps(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
+	dprintf_info(midi, "MIDI_mciGetDevCaps(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
 	if (lpParms == NULL) return MCIERR_INTERNAL;
 	if (dwFlags & MCI_GETDEVCAPS_ITEM) {
 		switch(lpParms->dwItem) {
@@ -843,7 +841,7 @@
 static DWORD MIDI_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMS16 lpParms)
 {
 #if defined(linux) || defined(__FreeBSD__)
-	dprintf_midi(stddeb, "MIDI_mciInfo(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
+	dprintf_info(midi, "MIDI_mciInfo(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
 	if (lpParms == NULL) return MCIERR_INTERNAL;
 	lpParms->lpstrReturn = NULL;
 	switch(dwFlags) {
@@ -875,7 +873,7 @@
  */
 static DWORD midGetDevCaps(WORD wDevID, LPMIDIINCAPS16 lpCaps, DWORD dwSize)
 {
-	dprintf_midi(stddeb, "midGetDevCaps(%04X, %p, %08lX);\n", wDevID, lpCaps, dwSize);
+	dprintf_info(midi, "midGetDevCaps(%04X, %p, %08lX);\n", wDevID, lpCaps, dwSize);
 	lpCaps->wMid = 0x00FF; 	        /* Manufac ID */
 	lpCaps->wPid = 0x0001; 	        /* Product ID */
 	lpCaps->vDriverVersion = 0x001; /* Product Version */
@@ -891,37 +889,37 @@
 {
 #if defined(linux) || defined(__FreeBSD__)
 	int		midi;
-	dprintf_midi(stddeb,
+	dprintf_info(midi,
 		"midOpen(%04X, %p, %08lX);\n", wDevID, lpDesc, dwFlags);
 	if (lpDesc == NULL) {
-		dprintf_midi(stddeb,"Linux 'midOpen' // Invalid Parameter !\n");
+		dprintf_warn(midi, "Linux 'midOpen' // Invalid Parameter !\n");
 		return MMSYSERR_INVALPARAM;
 	}
 	if (wDevID >= MAX_MIDIINDRV) {
-		dprintf_midi(stddeb,"Linux 'midOpen' // MAX_MIDIINDRV reached !\n");
+		dprintf_info(midi,"Linux 'midOpen' // MAX_MIDIINDRV reached !\n");
 		return MMSYSERR_ALLOCATED;
 	}
 	MidiInDev[wDevID].unixdev = 0;
 	midi = open (MIDI_DEV, O_RDONLY, 0);
 	if (midi == -1) {
-		dprintf_midi(stddeb,"Linux 'midOpen' // can't open !\n");
+		dprintf_warn(midi,"Linux 'midOpen' // can't open !\n");
 		return MMSYSERR_NOTENABLED;
 	}
 	MidiInDev[wDevID].wFlags = HIWORD(dwFlags & CALLBACK_TYPEMASK);
 	switch(MidiInDev[wDevID].wFlags) {
 		case DCB_NULL:
-			dprintf_midi(stddeb,"Linux 'midOpen' // CALLBACK_NULL !\n");
+			dprintf_info(midi,"Linux 'midOpen' // CALLBACK_NULL !\n");
 			break;
 		case DCB_WINDOW:
-			dprintf_midi(stddeb,
+			dprintf_info(midi,
 				"Linux 'midOpen' // CALLBACK_WINDOW !\n");
 			break;
 		case DCB_TASK:
-			dprintf_midi(stddeb,
+			dprintf_info(midi,
 				   "Linux 'midOpen' // CALLBACK_TASK !\n");
 			break;
 		case DCB_FUNCTION:
-			dprintf_midi(stddeb,
+			dprintf_info(midi,
 				   "Linux 'midOpen' // CALLBACK_FUNCTION !\n");
 			break;
 	}
@@ -930,7 +928,7 @@
 	MidiInDev[wDevID].dwTotalPlayed = 0;
 	MidiInDev[wDevID].bufsize = 0x3FFF;
 	if (MIDI_NotifyClient(wDevID, MIM_OPEN, 0L, 0L) != MMSYSERR_NOERROR) {
-		dprintf_midi(stddeb,"Linux 'midOpen' // can't notify client !\n");
+		dprintf_warn(midi,"Linux 'midOpen' // can't notify client !\n");
 		return MMSYSERR_INVALPARAM;
 	}
 	return MMSYSERR_NOERROR;
@@ -945,16 +943,16 @@
 static DWORD midClose(WORD wDevID)
 {
 #if defined(linux) || defined(__FreeBSD__)
-	dprintf_midi(stddeb, "midClose(%04X);\n", wDevID);
+	dprintf_info(midi, "midClose(%04X);\n", wDevID);
 	if (MidiInDev[wDevID].unixdev == 0) {
-		dprintf_midi(stddeb,"Linux 'midClose' // can't close !\n");
+		dprintf_warn(midi,"Linux 'midClose' // can't close !\n");
 		return MMSYSERR_NOTENABLED;
 	}
 	close(MidiInDev[wDevID].unixdev);
 	MidiInDev[wDevID].unixdev = 0;
 	MidiInDev[wDevID].bufsize = 0;
 	if (MIDI_NotifyClient(wDevID, MIM_CLOSE, 0L, 0L) != MMSYSERR_NOERROR) {
-		dprintf_midi(stddeb,"Linux 'midClose' // can't notify client !\n");
+		dprintf_warn(midi,"Linux 'midClose' // can't notify client !\n");
 		return MMSYSERR_INVALPARAM;
 	}
 	return MMSYSERR_NOERROR;
@@ -968,7 +966,7 @@
  */
 static DWORD midAddBuffer(WORD wDevID, LPMIDIHDR lpMidiHdr, DWORD dwSize)
 {
-	dprintf_midi(stddeb, "midAddBuffer(%04X, %p, %08lX);\n", wDevID, lpMidiHdr, dwSize);
+	dprintf_info(midi, "midAddBuffer(%04X, %p, %08lX);\n", wDevID, lpMidiHdr, dwSize);
 	return MMSYSERR_NOTENABLED;
 }
 
@@ -977,7 +975,7 @@
  */
 static DWORD midPrepare(WORD wDevID, LPMIDIHDR lpMidiHdr, DWORD dwSize)
 {
-	dprintf_midi(stddeb, "midPrepare(%04X, %p, %08lX);\n", wDevID, lpMidiHdr, dwSize);
+	dprintf_info(midi, "midPrepare(%04X, %p, %08lX);\n", wDevID, lpMidiHdr, dwSize);
 	return MMSYSERR_NOTENABLED;
 }
 
@@ -986,7 +984,7 @@
  */
 static DWORD midUnprepare(WORD wDevID, LPMIDIHDR lpMidiHdr, DWORD dwSize)
 {
-	dprintf_midi(stddeb, "midUnprepare(%04X, %p, %08lX);\n", wDevID, lpMidiHdr, dwSize);
+	dprintf_info(midi, "midUnprepare(%04X, %p, %08lX);\n", wDevID, lpMidiHdr, dwSize);
 	return MMSYSERR_NOTENABLED;
 }
 
@@ -995,7 +993,7 @@
  */
 static DWORD midReset(WORD wDevID)
 {
-	dprintf_midi(stddeb, "midReset(%04X);\n", wDevID);
+	dprintf_info(midi, "midReset(%04X);\n", wDevID);
 	return MMSYSERR_NOTENABLED;
 }
 
@@ -1005,7 +1003,7 @@
  */
 static DWORD midStart(WORD wDevID)
 {
-	dprintf_midi(stddeb, "midStart(%04X);\n", wDevID);
+	dprintf_info(midi, "midStart(%04X);\n", wDevID);
 	return MMSYSERR_NOTENABLED;
 }
 
@@ -1015,7 +1013,7 @@
  */
 static DWORD midStop(WORD wDevID)
 {
-	dprintf_midi(stddeb, "midStop(%04X);\n", wDevID);
+	dprintf_info(midi, "midStop(%04X);\n", wDevID);
 	return MMSYSERR_NOTENABLED;
 }
 
@@ -1026,7 +1024,7 @@
 DWORD midMessage(WORD wDevID, WORD wMsg, DWORD dwUser, 
 					DWORD dwParam1, DWORD dwParam2)
 {
-	dprintf_midi(stddeb, "midMessage(%04X, %04X, %08lX, %08lX, %08lX);\n", 
+	dprintf_info(midi, "midMessage(%04X, %04X, %08lX, %08lX, %08lX);\n", 
 			wDevID, wMsg, dwUser, dwParam1, dwParam2);
 	switch(wMsg) {
 	case MIDM_OPEN:
@@ -1063,7 +1061,7 @@
  */
 static DWORD modGetDevCaps(WORD wDevID, LPMIDIOUTCAPS16 lpCaps, DWORD dwSize)
 {
-	dprintf_midi(stddeb, "modGetDevCaps(%04X, %p, %08lX);\n", wDevID, lpCaps, dwSize);
+	dprintf_info(midi, "modGetDevCaps(%04X, %p, %08lX);\n", wDevID, lpCaps, dwSize);
 	lpCaps->wMid = 0x00FF; 	/* Manufac ID */
 	lpCaps->wPid = 0x0001; 	/* Product ID */
 	lpCaps->vDriverVersion = 0x001; /* Product Version */
@@ -1076,7 +1074,7 @@
 	lpCaps->wVoices     = 14;       /* make it ioctl */
 	lpCaps->wNotes      = 14;       /* make it ioctl */
 	lpCaps->dwSupport   = MIDICAPS_VOLUME|MIDICAPS_LRVOLUME;
-	dprintf_midi(stddeb,"Linux modGetDevCaps // techn = %d voices=%d notes = %d support = %ld\n",lpCaps->wTechnology,lpCaps->wVoices,lpCaps->wNotes,lpCaps->dwSupport);
+	dprintf_info(midi,"Linux modGetDevCaps // techn = %d voices=%d notes = %d support = %ld\n",lpCaps->wTechnology,lpCaps->wVoices,lpCaps->wNotes,lpCaps->dwSupport);
 
 	return MMSYSERR_NOERROR;
 }
@@ -1090,37 +1088,37 @@
 #if defined(linux) || defined(__FreeBSD__)
 	int		midi;
 
-	dprintf_midi(stddeb,
+	dprintf_info(midi,
 		"modOpen(%04X, %p, %08lX);\n", wDevID, lpDesc, dwFlags);
 	if (lpDesc == NULL) {
-		dprintf_midi(stddeb,"Linux 'modOpen' // Invalid Parameter !\n");
+		dprintf_warn(midi, "Linux 'modOpen' // Invalid Parameter !\n");
 		return MMSYSERR_INVALPARAM;
 	}
 	if (wDevID>= MAX_MIDIOUTDRV) {
-		dprintf_midi(stddeb,"Linux 'modOpen' // MAX_MIDIOUTDRV reached !\n");
+		dprintf_info(midi,"Linux 'modOpen' // MAX_MIDIOUTDRV reached !\n");
 		return MMSYSERR_ALLOCATED;
 	}
 	MidiOutDev[wDevID].unixdev = 0;
 	midi = open (MIDI_DEV, O_WRONLY, 0);
 	if (midi == -1) {
-		dprintf_midi(stddeb,"Linux 'modOpen' // can't open !\n");
+		dprintf_warn(midi,"Linux 'modOpen' // can't open !\n");
 		return MMSYSERR_NOTENABLED;
 	}
 	MidiOutDev[wDevID].wFlags = HIWORD(dwFlags & CALLBACK_TYPEMASK);
 	switch(MidiOutDev[wDevID].wFlags) {
 	case DCB_NULL:
-		dprintf_midi(stddeb,"Linux 'modOpen' // CALLBACK_NULL !\n");
+		dprintf_info(midi,"Linux 'modOpen' // CALLBACK_NULL !\n");
 		break;
 	case DCB_WINDOW:
-		dprintf_midi(stddeb,
+		dprintf_info(midi,
 			"Linux 'modOpen' // CALLBACK_WINDOW !\n");
 		break;
 	case DCB_TASK:
-		dprintf_midi(stddeb,
+		dprintf_info(midi,
 			"Linux 'modOpen' // CALLBACK_TASK !\n");
 		break;
 	case DCB_FUNCTION:
-		dprintf_midi(stddeb,
+		dprintf_info(midi,
 			"Linux 'modOpen' // CALLBACK_FUNCTION !\n");
 		break;
 	}
@@ -1129,10 +1127,10 @@
 	MidiOutDev[wDevID].dwTotalPlayed = 0;
 	MidiOutDev[wDevID].bufsize = 0x3FFF;
 	if (MIDI_NotifyClient(wDevID, MOM_OPEN, 0L, 0L) != MMSYSERR_NOERROR) {
-		dprintf_midi(stddeb,"Linux 'modOpen' // can't notify client !\n");
+		dprintf_warn(midi,"Linux 'modOpen' // can't notify client !\n");
 		return MMSYSERR_INVALPARAM;
 	}
-	dprintf_midi(stddeb,
+	dprintf_info(midi,
 		"Linux 'modOpen' // Succesful unixdev=%d !\n", midi);
 	return MMSYSERR_NOERROR;
 #else
@@ -1147,16 +1145,16 @@
 static DWORD modClose(WORD wDevID)
 {
 #if defined(linux) || defined(__FreeBSD__)
-	dprintf_midi(stddeb, "modClose(%04X);\n", wDevID);
+	dprintf_info(midi, "modClose(%04X);\n", wDevID);
 	if (MidiOutDev[wDevID].unixdev == 0) {
-		dprintf_midi(stddeb,"Linux 'modClose' // can't close !\n");
+		dprintf_warn(midi,"Linux 'modClose' // can't close !\n");
 		return MMSYSERR_NOTENABLED;
 	}
 	close(MidiOutDev[wDevID].unixdev);
 	MidiOutDev[wDevID].unixdev = 0;
 	MidiOutDev[wDevID].bufsize = 0;
 	if (MIDI_NotifyClient(wDevID, MOM_CLOSE, 0L, 0L) != MMSYSERR_NOERROR) {
-		dprintf_midi(stddeb,"Linux 'modClose' // can't notify client !\n");
+		dprintf_warn(midi,"Linux 'modClose' // can't notify client !\n");
 		return MMSYSERR_INVALPARAM;
 	}
 	return MMSYSERR_NOERROR;
@@ -1173,17 +1171,16 @@
 #if defined(linux) || defined(__FreeBSD__)
 	WORD	event;
 
-	dprintf_midi(stddeb,	
+	dprintf_info(midi,	
 		"modData(%04X, %08lX);\n", wDevID, dwParam);
 	if (MidiOutDev[wDevID].unixdev == 0) {
-        	dprintf_midi(stddeb,"Linux 'modData' // can't play !\n");
+        	dprintf_warn(midi,"Linux 'modData' // can't play !\n");
 		return MIDIERR_NODEVICE;
 	}
 	event = LOWORD(dwParam);
 	if (write (MidiOutDev[wDevID].unixdev, 
 		&event, sizeof(WORD)) != sizeof(WORD)) {
-		dprintf_midi(stddeb,
-			"modData() // error writting unixdev !\n");
+		dprintf_warn(midi, "modData() // error writting unixdev !\n");
 	}
 	return MMSYSERR_NOTENABLED;
 #else
@@ -1201,10 +1198,10 @@
 	LPWORD	ptr;
 	int     en;
 
-	dprintf_midi(stddeb,	
+	dprintf_info(midi,	
 		"modLongData(%04X, %p, %08lX);\n", wDevID, lpMidiHdr, dwSize);
 	if (MidiOutDev[wDevID].unixdev == 0) {
-        dprintf_midi(stddeb,"Linux 'modLongData' // can't play !\n");
+        dprintf_warn(midi,"Linux 'modLongData' // can't play !\n");
 		return MIDIERR_NODEVICE;
 		}
 	if (lpMidiHdr->lpData == NULL) return MIDIERR_UNPREPARED;
@@ -1212,9 +1209,9 @@
 	if (lpMidiHdr->dwFlags & MHDR_INQUEUE) return MIDIERR_STILLPLAYING;
 	lpMidiHdr->dwFlags &= ~MHDR_DONE;
 	lpMidiHdr->dwFlags |= MHDR_INQUEUE;
-	dprintf_midi(stddeb,
+	dprintf_info(midi,
 		"modLongData() // dwBytesRecorded %lu !\n", lpMidiHdr->dwBytesRecorded);
-	dprintf_midi(stddeb,
+	dprintf_info(midi,
                 "                 %02X %02X %02X %02X\n",lpMidiHdr->lpData[0],
                                                          lpMidiHdr->lpData[1],
 		                                         lpMidiHdr->lpData[2],
@@ -1231,19 +1228,19 @@
 	}
 
 	en = errno;
-	dprintf_midi(stddeb, "Linux 'modLongData' // after write count = %d\n",count);
+	dprintf_info(midi, "Linux 'modLongData' // after write count = %d\n",count);
 	if (count != lpMidiHdr->dwBytesRecorded) {
-		dprintf_midi(stddeb,
-			"modLongData() // error writting unixdev #%d ! (%d != %ld)\n",
+		dprintf_warn(midi,
+		       "modLongData() // error writting unixdev #%d ! (%d != %ld)\n",
 			MidiOutDev[wDevID].unixdev, count, lpMidiHdr->dwBytesRecorded);
-		dprintf_midi(stddeb,
-			"                 errno = %d error = %s\n",en,strerror(en));
+		dprintf_info(midi,
+			"\terrno = %d error = %s\n",en,strerror(en));
 		return MMSYSERR_NOTENABLED;
 	}
 	lpMidiHdr->dwFlags &= ~MHDR_INQUEUE;
 	lpMidiHdr->dwFlags |= MHDR_DONE;
 	if (MIDI_NotifyClient(wDevID, MOM_DONE, 0L, 0L) != MMSYSERR_NOERROR) {
-		dprintf_midi(stddeb,"Linux 'modLongData' // can't notify client !\n");
+		dprintf_warn(midi,"Linux 'modLongData' // can't notify client !\n");
 		return MMSYSERR_INVALPARAM;
 	}
 	return MMSYSERR_NOERROR;
@@ -1258,14 +1255,14 @@
 static DWORD modPrepare(WORD wDevID, LPMIDIHDR lpMidiHdr, DWORD dwSize)
 {
 #if defined(linux) || defined(__FreeBSD__)
-	dprintf_midi(stddeb,
+	dprintf_info(midi,
 		  "modPrepare(%04X, %p, %08lX);\n", wDevID, lpMidiHdr, dwSize);
 	if (MidiOutDev[wDevID].unixdev == 0) {
-		dprintf_midi(stddeb,"Linux 'modPrepare' // can't prepare !\n");
+		dprintf_warn(midi,"Linux 'modPrepare' // can't prepare !\n");
 		return MMSYSERR_NOTENABLED;
 	}
 	if (MidiOutDev[wDevID].lpQueueHdr != NULL) {
-		dprintf_midi(stddeb,"Linux 'modPrepare' // already prepare !\n");
+		dprintf_info(midi,"Linux 'modPrepare' // already prepare !\n");
 		return MMSYSERR_NOTENABLED;
 	}
 	MidiOutDev[wDevID].dwTotalPlayed = 0;
@@ -1285,10 +1282,10 @@
 static DWORD modUnprepare(WORD wDevID, LPMIDIHDR lpMidiHdr, DWORD dwSize)
 {
 #if defined(linux) || defined(__FreeBSD__)
-	dprintf_midi(stddeb,
+	dprintf_info(midi,
 		"modUnprepare(%04X, %p, %08lX);\n", wDevID, lpMidiHdr, dwSize);
 	if (MidiOutDev[wDevID].unixdev == 0) {
-		dprintf_midi(stddeb,"Linux 'modUnprepare' // can't unprepare !\n");
+		dprintf_warn(midi,"Linux 'modUnprepare' // can't unprepare !\n");
 		return MMSYSERR_NOTENABLED;
 	}
 	return MMSYSERR_NOERROR;
@@ -1302,7 +1299,7 @@
  */
 static DWORD modReset(WORD wDevID)
 {
-	dprintf_midi(stddeb, "modReset(%04X);\n", wDevID);
+	dprintf_info(midi, "modReset(%04X);\n", wDevID);
 	return MMSYSERR_NOTENABLED;
 }
 
@@ -1313,7 +1310,7 @@
 DWORD modMessage(WORD wDevID, WORD wMsg, DWORD dwUser, 
 					DWORD dwParam1, DWORD dwParam2)
 {
-	dprintf_midi(stddeb, "modMessage(%04X, %04X, %08lX, %08lX, %08lX);\n", 
+	dprintf_info(midi, "modMessage(%04X, %04X, %08lX, %08lX, %08lX);\n", 
 			wDevID, wMsg, dwUser, dwParam1, dwParam2);
 	switch(wMsg) {
 	case MODM_OPEN:
diff --git a/multimedia/mixer.c b/multimedia/mixer.c
index 89f9394..9bcb24d 100644
--- a/multimedia/mixer.c
+++ b/multimedia/mixer.c
@@ -13,6 +13,7 @@
 #include "user.h"
 #include "driver.h"
 #include "mmsystem.h"
+#include "debug.h"
 
 #ifdef linux
 #include <linux/soundcard.h>
@@ -20,9 +21,6 @@
 #include <machine/soundcard.h>
 #endif
 
-#include "stddebug.h"
-#include "debug.h"
-
 #define MIXER_DEV "/dev/mixer"
 
 #ifdef SOUND_VERSION
@@ -40,10 +38,10 @@
 #ifdef linux
 	int 		mixer,mask;
 
-	dprintf_mmaux(stddeb,"MIX_GetDevCaps(%04X, %p, %lu);\n", wDevID, lpCaps, dwSize);
+	dprintf_info(mmaux,"MIX_GetDevCaps(%04X, %p, %lu);\n", wDevID, lpCaps, dwSize);
 	if (lpCaps == NULL) return MMSYSERR_NOTENABLED;
 	if ((mixer = open(MIXER_DEV, O_RDWR)) < 0) {
-		dprintf_mmaux(stddeb,"MIX_GetDevCaps // mixer device not available !\n");
+		dprintf_warn(mmaux, "MIX_GetDevCaps // mixer device not available !\n");
 		return MMSYSERR_NOTENABLED;
 	}
 	lpCaps->wMid = 0xAA;
@@ -79,7 +77,7 @@
 #ifdef linux
 	int 		mixer,i,j,devmask,recsrc,recmask;
 
-	dprintf_mmaux(stddeb,"MIX_GetDevLineInfo(%04X, %p, %lu);\n", wDevID, lpml, fdwInfo);
+	dprintf_info(mmaux,"MIX_GetDevLineInfo(%04X, %p, %lu);\n", wDevID, lpml, fdwInfo);
 	if (lpml == NULL) return MMSYSERR_NOTENABLED;
 	if ((mixer = open(MIXER_DEV, O_RDWR)) < 0)
 		return MMSYSERR_NOTENABLED;
@@ -180,7 +178,7 @@
 {
 #ifdef linux
 
-	dprintf_mmaux(stddeb,"MIX_Open(%04X, %p, %lu);\n",wDevID,lpmod,flags);
+	dprintf_info(mmaux,"MIX_Open(%04X, %p, %lu);\n",wDevID,lpmod,flags);
 	if (lpmod == NULL) return MMSYSERR_NOTENABLED;
 	/* hmm. We don't keep the mixer device open. So just pretend it works */
 	return MMSYSERR_NOERROR;
@@ -195,7 +193,7 @@
 DWORD mixMessage(WORD wDevID, WORD wMsg, DWORD dwUser, 
 					DWORD dwParam1, DWORD dwParam2)
 {
-	dprintf_mmaux(stddeb,"mixMessage(%04X, %04X, %08lX, %08lX, %08lX);\n", 
+	dprintf_info(mmaux,"mixMessage(%04X, %04X, %08lX, %08lX, %08lX);\n", 
 			wDevID, wMsg, dwUser, dwParam1, dwParam2);
 	switch(wMsg) {
 	case MXDM_GETDEVCAPS:
@@ -203,12 +201,12 @@
 	case MXDM_GETLINEINFO:
 		return MIX_GetLineInfo(wDevID,(LPMIXERLINE16)dwParam1,dwParam2);
 	case MXDM_GETNUMDEVS:
-		dprintf_mmsys(stddeb,"MIX_GetNumDevs() return 1;\n");
+		dprintf_info(mmsys,"MIX_GetNumDevs() return 1;\n");
 		return 1;
 	case MXDM_OPEN:
 		return MIX_Open(wDevID,(LPMIXEROPENDESC)dwParam1,dwParam2);
 	default:
-		dprintf_mmaux(stddeb,"mixMessage // unknown message %d!\n",wMsg);
+		dprintf_warn(mmaux,"mixMessage // unknown message %d!\n",wMsg);
 	}
 	return MMSYSERR_NOTSUPPORTED;
 }
diff --git a/multimedia/mmaux.c b/multimedia/mmaux.c
index de34c4f..14598b9 100644
--- a/multimedia/mmaux.c
+++ b/multimedia/mmaux.c
@@ -15,6 +15,7 @@
 #include "user.h"
 #include "driver.h"
 #include "mmsystem.h"
+#include "debug.h"
 
 #ifdef linux
 #include <linux/soundcard.h>
@@ -22,9 +23,6 @@
 #include <machine/soundcard.h>
 #endif
 
-#include "stddebug.h"
-#include "debug.h"
-
 #define SOUND_DEV "/dev/dsp"
 #define MIXER_DEV "/dev/mixer"
 
@@ -48,15 +46,15 @@
 #ifdef linux
 	int 	mixer,volume;
 
-	dprintf_mmaux(stddeb,"AUX_GetDevCaps(%04X, %p, %lu);\n", wDevID, lpCaps, dwSize);
+	dprintf_info(mmaux,"AUX_GetDevCaps(%04X, %p, %lu);\n", wDevID, lpCaps, dwSize);
 	if (lpCaps == NULL) return MMSYSERR_NOTENABLED;
 	if ((mixer = open(MIXER_DEV, O_RDWR)) < 0) {
-		dprintf_mmaux(stddeb,"AUX_GetDevCaps // mixer device not available !\n");
+		dprintf_warn(mmaux, "AUX_GetDevCaps // mixer device not available !\n");
 		return MMSYSERR_NOTENABLED;
 	}
 	if (ioctl(mixer, SOUND_MIXER_READ_LINE, &volume) == -1) {
 		close(mixer);
-		dprintf_mmaux(stddeb,"AUX_GetDevCaps // unable read mixer !\n");
+		dprintf_warn(mmaux, "AUX_GetDevCaps // unable read mixer !\n");
 		return MMSYSERR_NOTENABLED;
 	}
 	close(mixer);
@@ -119,49 +117,49 @@
 #ifdef linux
 	int 	mixer,volume,left,right,cmd;
 
-	dprintf_mmaux(stddeb,"AUX_GetVolume(%04X, %p);\n", wDevID, lpdwVol);
+	dprintf_info(mmaux,"AUX_GetVolume(%04X, %p);\n", wDevID, lpdwVol);
 	if (lpdwVol == NULL) return MMSYSERR_NOTENABLED;
 	if ((mixer = open(MIXER_DEV, O_RDWR)) < 0) {
-		dprintf_mmaux(stddeb,"Linux 'AUX_GetVolume' // mixer device not available !\n");
+		dprintf_warn(mmaux, "Linux 'AUX_GetVolume' // mixer device not available !\n");
 		return MMSYSERR_NOTENABLED;
 	}
 	switch(wDevID) {
 		case 0:
-			dprintf_mmaux(stddeb,"Linux 'AUX_GetVolume' // SOUND_MIXER_READ_PCM !\n");
+			dprintf_info(mmaux,"Linux 'AUX_GetVolume' // SOUND_MIXER_READ_PCM !\n");
 			cmd = SOUND_MIXER_READ_PCM;
 			break;
 		case 1:
-			dprintf_mmaux(stddeb,"Linux 'AUX_GetVolume' // SOUND_MIXER_READ_SYNTH !\n");
+			dprintf_info(mmaux,"Linux 'AUX_GetVolume' // SOUND_MIXER_READ_SYNTH !\n");
 			cmd = SOUND_MIXER_READ_SYNTH;
 			break;
 		case 2:
-			dprintf_mmaux(stddeb,"Linux 'AUX_GetVolume' // SOUND_MIXER_READ_CD !\n");
+			dprintf_info(mmaux,"Linux 'AUX_GetVolume' // SOUND_MIXER_READ_CD !\n");
 			cmd = SOUND_MIXER_READ_CD;
 			break;
 		case 3:
-			dprintf_mmaux(stddeb,"Linux 'AUX_GetVolume' // SOUND_MIXER_READ_LINE !\n");
+			dprintf_info(mmaux,"Linux 'AUX_GetVolume' // SOUND_MIXER_READ_LINE !\n");
 			cmd = SOUND_MIXER_READ_LINE;
 			break;
 		case 4:
-			dprintf_mmaux(stddeb,"Linux 'AUX_GetVolume' // SOUND_MIXER_READ_MIC !\n");
+			dprintf_info(mmaux,"Linux 'AUX_GetVolume' // SOUND_MIXER_READ_MIC !\n");
 			cmd = SOUND_MIXER_READ_MIC;
 			break;
 		case 5:
-			dprintf_mmaux(stddeb,"Linux 'AUX_GetVolume' // SOUND_MIXER_READ_VOLUME !\n");
+			dprintf_info(mmaux,"Linux 'AUX_GetVolume' // SOUND_MIXER_READ_VOLUME !\n");
 			cmd = SOUND_MIXER_READ_VOLUME;
 			break;
 		default:
-			dprintf_mmaux(stddeb, "Linux 'AUX_GetVolume' // invalid device id=%04X !\n", wDevID);
+			dprintf_warn(mmaux, "Linux 'AUX_GetVolume' // invalid device id=%04X !\n", wDevID);
 			return MMSYSERR_NOTENABLED;
 		}
 	if (ioctl(mixer, cmd, &volume) == -1) {
-		dprintf_mmaux(stddeb,"Linux 'AUX_GetVolume' // unable read mixer !\n");
+		dprintf_warn(mmaux, "Linux 'AUX_GetVolume' // unable read mixer !\n");
 		return MMSYSERR_NOTENABLED;
 	}
 	close(mixer);
 	left = volume & 0x7F;
 	right = (volume >> 8) & 0x7F;
-	dprintf_mmaux(stddeb,"Linux 'AUX_GetVolume' // left=%d right=%d !\n", left, right);
+	dprintf_info(mmaux,"Linux 'AUX_GetVolume' // left=%d right=%d !\n", left, right);
 	*lpdwVol = MAKELONG(left << 9, right << 9);
 	return MMSYSERR_NOERROR;
 #else
@@ -178,44 +176,44 @@
 	int 	mixer;
 	int		volume;
 	int		cmd;
-	dprintf_mmaux(stddeb,"AUX_SetVolume(%04X, %08lX);\n", wDevID, dwParam);
+	dprintf_info(mmaux,"AUX_SetVolume(%04X, %08lX);\n", wDevID, dwParam);
 	volume = (LOWORD(dwParam) >> 9 & 0x7F) + 
 		((HIWORD(dwParam) >> 9  & 0x7F) << 8);
 	if ((mixer = open(MIXER_DEV, O_RDWR)) < 0) {
-		dprintf_mmaux(stddeb,"Linux 'AUX_SetVolume' // mixer device not available !\n");
+		dprintf_warn(mmaux, "Linux 'AUX_SetVolume' // mixer device not available !\n");
 		return MMSYSERR_NOTENABLED;
 		}
 	switch(wDevID) {
 		case 0:
-			dprintf_mmaux(stddeb,"Linux 'AUX_SetVolume' // SOUND_MIXER_WRITE_PCM !\n");
+			dprintf_info(mmaux,"Linux 'AUX_SetVolume' // SOUND_MIXER_WRITE_PCM !\n");
 			cmd = SOUND_MIXER_WRITE_PCM;
 			break;
 		case 1:
-			dprintf_mmaux(stddeb,"Linux 'AUX_SetVolume' // SOUND_MIXER_WRITE_SYNTH !\n");
+			dprintf_info(mmaux,"Linux 'AUX_SetVolume' // SOUND_MIXER_WRITE_SYNTH !\n");
 			cmd = SOUND_MIXER_WRITE_SYNTH;
 			break;
 		case 2:
-			dprintf_mmaux(stddeb,"Linux 'AUX_SetVolume' // SOUND_MIXER_WRITE_CD !\n");
+			dprintf_info(mmaux,"Linux 'AUX_SetVolume' // SOUND_MIXER_WRITE_CD !\n");
 			cmd = SOUND_MIXER_WRITE_CD;
 			break;
 		case 3:
-			dprintf_mmaux(stddeb,"Linux 'AUX_SetVolume' // SOUND_MIXER_WRITE_LINE !\n");
+			dprintf_info(mmaux,"Linux 'AUX_SetVolume' // SOUND_MIXER_WRITE_LINE !\n");
 			cmd = SOUND_MIXER_WRITE_LINE;
 			break;
 		case 4:
-			dprintf_mmaux(stddeb,"Linux 'AUX_SetVolume' // SOUND_MIXER_WRITE_MIC !\n");
+			dprintf_info(mmaux,"Linux 'AUX_SetVolume' // SOUND_MIXER_WRITE_MIC !\n");
 			cmd = SOUND_MIXER_WRITE_MIC;
 			break;
 		case 5:
-			dprintf_mmaux(stddeb,"Linux 'AUX_SetVolume' // SOUND_MIXER_WRITE_VOLUME !\n");
+			dprintf_info(mmaux,"Linux 'AUX_SetVolume' // SOUND_MIXER_WRITE_VOLUME !\n");
 			cmd = SOUND_MIXER_WRITE_VOLUME;
 			break;
 		default:
-			dprintf_mmaux(stddeb, "Linux 'AUX_SetVolume' // invalid device id=%04X !\n", wDevID);
+			dprintf_warn(mmaux, "Linux 'AUX_SetVolume' // invalid device id=%04X !\n", wDevID);
 			return MMSYSERR_NOTENABLED;
 		}
     if (ioctl(mixer, cmd, &volume) == -1) {
-		dprintf_mmaux(stddeb,"Linux 'AUX_SetVolume' // unable set mixer !\n");
+		dprintf_warn(mmaux, "Linux 'AUX_SetVolume' // unable set mixer !\n");
 		return MMSYSERR_NOTENABLED;
 		}
 	close(mixer);
@@ -232,20 +230,20 @@
 DWORD auxMessage(WORD wDevID, WORD wMsg, DWORD dwUser, 
 					DWORD dwParam1, DWORD dwParam2)
 {
-	dprintf_mmaux(stddeb,"auxMessage(%04X, %04X, %08lX, %08lX, %08lX);\n", 
+	dprintf_info(mmaux,"auxMessage(%04X, %04X, %08lX, %08lX, %08lX);\n", 
 			wDevID, wMsg, dwUser, dwParam1, dwParam2);
 	switch(wMsg) {
 	case AUXDM_GETDEVCAPS:
 		return AUX_GetDevCaps(wDevID,(LPAUXCAPS16)dwParam1,dwParam2);
 	case AUXDM_GETNUMDEVS:
-		dprintf_mmaux(stddeb,"AUX_GetNumDevs() return %d;\n", NumDev);
+		dprintf_info(mmaux,"AUX_GetNumDevs() return %d;\n", NumDev);
 		return NumDev;
 	case AUXDM_GETVOLUME:
 		return AUX_GetVolume(wDevID,(LPDWORD)dwParam1);
 	case AUXDM_SETVOLUME:
 		return AUX_SetVolume(wDevID,dwParam1);
 	default:
-		dprintf_mmaux(stddeb,"auxMessage // unknown message !\n");
+		dprintf_warn(mmaux, "auxMessage // unknown message !\n");
 	}
 	return MMSYSERR_NOTSUPPORTED;
 }
diff --git a/multimedia/mmio.c b/multimedia/mmio.c
index d140fe1..597350a 100644
--- a/multimedia/mmio.c
+++ b/multimedia/mmio.c
@@ -19,7 +19,6 @@
 #include "user.h"
 #include "file.h"
 #include "mmsystem.h"
-#include "stddebug.h"
 #include "debug.h"
 #include "xmalloc.h"
 
@@ -27,7 +26,7 @@
 *               mmioDosIOProc           [internal]
 */
 static LRESULT mmioDosIOProc(LPMMIOINFO16 lpmmioinfo, UINT16 uMessage, LPARAM lParam1, LPARAM lParam2) {
-	dprintf_mmio(stddeb, "mmioDosIOProc(%p, %X, %ld, %ld);\n", lpmmioinfo, uMessage, lParam1, lParam2);
+	dprintf_info(mmio, "mmioDosIOProc(%p, %X, %ld, %ld);\n", lpmmioinfo, uMessage, lParam1, lParam2);
 
 	switch (uMessage) {
 
@@ -43,7 +42,7 @@
 			LPSTR szFileName = (LPSTR) lParam1;
 
 			if (lpmmioinfo->dwFlags & MMIO_GETTEMP) {
-				dprintf_mmio(stdnimp, "mmioDosIOProc // MMIO_GETTEMP not implemented\n");
+				dprintf_fixme(mmio, "mmioDosIOProc // MMIO_GETTEMP not implemented\n");
 				return MMIOERR_CANNOTOPEN;
 			}
 
@@ -145,12 +144,12 @@
              * Returns: zero on success, non-zero on failure
              */
 
-            dprintf_mmio(stddeb, "mmioDosIOProc: MMIOM_RENAME unimplemented\n");
+            dprintf_fixme(mmio, "mmioDosIOProc: MMIOM_RENAME unimplemented\n");
             return MMIOERR_FILENOTFOUND;
 		}
 
 		default:
-			dprintf_mmio(stddeb, "mmioDosIOProc: unexpected message %u\n", uMessage);
+			dprintf_warn(mmio, "mmioDosIOProc: unexpected message %u\n", uMessage);
 			return 0;
 	}
 	
@@ -196,7 +195,7 @@
 	HMMIO16 hmmio;
 	UINT16 result;
 
-	dprintf_mmio(stddeb, "mmioOpen('%s', %p, %08lX);\n", szFileName, lpmmioinfo, dwOpenFlags);
+	dprintf_info(mmio, "mmioOpen('%s', %p, %08lX);\n", szFileName, lpmmioinfo, dwOpenFlags);
 
 	hmmio = GlobalAlloc16(GHND, sizeof(MMIOINFO16));
 	lpmminfo = (LPMMIOINFO16)GlobalLock16(hmmio);
@@ -257,7 +256,7 @@
 	LPMMIOINFO16 lpmminfo;
 	UINT16 result;
 
-	dprintf_mmio(stddeb, "mmioClose(%04X, %04X);\n", hmmio, uFlags);
+	dprintf_info(mmio, "mmioClose(%04X, %04X);\n", hmmio, uFlags);
 
 	lpmminfo = (LPMMIOINFO16) GlobalLock16(hmmio);
 	if (lpmminfo == NULL)
@@ -287,7 +286,7 @@
 	LONG count;
 	LPMMIOINFO16 lpmminfo;
 
-	dprintf_mmio(stddeb, "mmioRead(%04X, %p, %ld);\n", hmmio, pch, cch);
+	dprintf_info(mmio, "mmioRead(%04X, %p, %ld);\n", hmmio, pch, cch);
 
 	lpmminfo = (LPMMIOINFO16)GlobalLock16(hmmio);
 	if (lpmminfo == NULL)
@@ -296,7 +295,7 @@
 	count = mmioSendMessage(hmmio, MMIOM_READ, (LPARAM) pch, (LPARAM) cch);
 
 	GlobalUnlock16(hmmio);
-	dprintf_mmio(stddeb, "mmioRead // count=%ld\n", count);
+	dprintf_info(mmio, "mmioRead // count=%ld\n", count);
 	return count;
 }
 
@@ -310,7 +309,7 @@
 	LONG count;
 	LPMMIOINFO16 lpmminfo;
 
-	dprintf_mmio(stddeb, "mmioWrite(%04X, %p, %ld);\n", hmmio, pch, cch);
+	dprintf_info(mmio, "mmioWrite(%04X, %p, %ld);\n", hmmio, pch, cch);
 
 	lpmminfo = (LPMMIOINFO16)GlobalLock16(hmmio);
 	if (lpmminfo == NULL)
@@ -319,7 +318,7 @@
 	count = mmioSendMessage(hmmio, MMIOM_WRITE, (LPARAM) pch, (LPARAM) cch);
 
 	GlobalUnlock16(hmmio);
-	dprintf_mmio(stddeb, "mmioWrite // count=%ld\n", count);
+	dprintf_info(mmio, "mmioWrite // count=%ld\n", count);
 	return count;
 }
 
@@ -331,7 +330,7 @@
 	int offset;
 	LPMMIOINFO16 lpmminfo;
 
-	dprintf_mmio(stddeb, "mmioSeek(%04X, %08lX, %d);\n", hmmio, lOffset, iOrigin);
+	dprintf_info(mmio, "mmioSeek(%04X, %08lX, %d);\n", hmmio, lOffset, iOrigin);
 
 	lpmminfo = (LPMMIOINFO16)GlobalLock16(hmmio);
 	if (lpmminfo == NULL)
@@ -349,7 +348,7 @@
 UINT16 WINAPI mmioGetInfo(HMMIO16 hmmio, MMIOINFO16 * lpmmioinfo, UINT16 uFlags)
 {
 	LPMMIOINFO16	lpmminfo;
-	dprintf_mmio(stddeb, "mmioGetInfo\n");
+	dprintf_info(mmio, "mmioGetInfo\n");
 	lpmminfo = (LPMMIOINFO16)GlobalLock16(hmmio);
 	if (lpmminfo == NULL) return 0;
 	memcpy(lpmmioinfo, lpmminfo, sizeof(MMIOINFO16));
@@ -363,7 +362,7 @@
 UINT16 WINAPI mmioSetInfo(HMMIO16 hmmio, const MMIOINFO16 * lpmmioinfo, UINT16 uFlags)
 {
 	LPMMIOINFO16	lpmminfo;
-	dprintf_mmio(stddeb, "mmioSetInfo\n");
+	dprintf_info(mmio, "mmioSetInfo\n");
 	lpmminfo = (LPMMIOINFO16)GlobalLock16(hmmio);
 	if (lpmminfo == NULL) return 0;
 	GlobalUnlock16(hmmio);
@@ -376,7 +375,7 @@
 UINT16 WINAPI mmioSetBuffer(HMMIO16 hmmio, LPSTR pchBuffer, 
                             LONG cchBuffer, UINT16 uFlags)
 {
-	dprintf_mmio(stddeb, "mmioSetBuffer // empty stub \n");
+	dprintf_fixme(mmio, "mmioSetBuffer // empty stub \n");
 	return 0;
 }
 
@@ -386,7 +385,7 @@
 UINT16 WINAPI mmioFlush(HMMIO16 hmmio, UINT16 uFlags)
 {
 	LPMMIOINFO16	lpmminfo;
-	dprintf_mmio(stddeb, "mmioFlush(%04X, %04X)\n", hmmio, uFlags);
+	dprintf_info(mmio, "mmioFlush(%04X, %04X)\n", hmmio, uFlags);
 	lpmminfo = (LPMMIOINFO16)GlobalLock16(hmmio);
 	if (lpmminfo == NULL) return 0;
 	GlobalUnlock16(hmmio);
@@ -400,7 +399,7 @@
 {
 	int		count = 0;
 	LPMMIOINFO16	lpmminfo;
-	dprintf_mmio(stddeb, "mmioAdvance\n");
+	dprintf_info(mmio, "mmioAdvance\n");
 	lpmminfo = (LPMMIOINFO16)GlobalLock16(hmmio);
 	if (lpmminfo == NULL) return 0;
 	if (uFlags == MMIO_READ) {
@@ -442,7 +441,7 @@
  */
 FOURCC WINAPI mmioStringToFOURCC16(LPCSTR sz, UINT16 uFlags)
 {
-	dprintf_mmio(stddeb, "mmioStringToFOURCC // empty stub \n");
+	dprintf_fixme(mmio, "mmioStringToFOURCC // empty stub \n");
 	return 0;
 }
 
@@ -452,7 +451,7 @@
 LPMMIOPROC16 WINAPI mmioInstallIOProc16(FOURCC fccIOProc, 
                                         LPMMIOPROC16 pIOProc, DWORD dwFlags)
 {
-	dprintf_mmio(stddeb, "mmioInstallIOProc(%ld, %p, %08lX)\n",
+	dprintf_info(mmio, "mmioInstallIOProc(%ld, %p, %08lX)\n",
 				 fccIOProc, pIOProc, dwFlags);
 
 	if (dwFlags & MMIO_GLOBALPROC) {
@@ -484,7 +483,7 @@
 LPMMIOPROC32 WINAPI mmioInstallIOProc32A(FOURCC fccIOProc, 
                                          LPMMIOPROC32 pIOProc, DWORD dwFlags)
 {
-	dprintf_mmio(stddeb, "mmioInstallIOProcA (%c%c%c%c,%p,0x%08lx)// empty stub \n",
+	dprintf_fixme(mmio, "mmioInstallIOProcA (%c%c%c%c,%p,0x%08lx)// empty stub \n",
                      (char)((fccIOProc&0xff000000)>>24),
                      (char)((fccIOProc&0x00ff0000)>>16),
                      (char)((fccIOProc&0x0000ff00)>> 8),
@@ -518,10 +517,10 @@
 #endif
 
 	if (msg)
-		dprintf_mmio(stddeb, "mmioSendMessage(%04X, %s, %ld, %ld)\n",
+		dprintf_info(mmio, "mmioSendMessage(%04X, %s, %ld, %ld)\n",
 					 hmmio, msg, lParam1, lParam2);
 	else
-		dprintf_mmio(stddeb, "mmioSendMessage(%04X, %u, %ld, %ld)\n",
+		dprintf_info(mmio, "mmioSendMessage(%04X, %u, %ld, %ld)\n",
 					 hmmio, uMessage, lParam1, lParam2);
 	
 	lpmminfo = (LPMMIOINFO16)GlobalLock16(hmmio);
@@ -544,20 +543,20 @@
 {
 	DWORD	dwfcc, dwOldPos;
 
-	dprintf_mmio(stddeb, "mmioDescend(%04X, %p, %p, %04X);\n", 
+	dprintf_info(mmio, "mmioDescend(%04X, %p, %p, %04X);\n", 
 				hmmio, lpck, lpckParent, uFlags);
 
 	if (lpck == NULL)
 	    return 0;
 
 	dwfcc = lpck->ckid;
-	dprintf_mmio(stddeb, "mmioDescend // dwfcc=%08lX\n", dwfcc);
+	dprintf_info(mmio, "mmioDescend // dwfcc=%08lX\n", dwfcc);
 
 	dwOldPos = mmioSeek(hmmio, 0, SEEK_CUR);
-	dprintf_mmio(stddeb, "mmioDescend // dwOldPos=%ld\n", dwOldPos);
+	dprintf_info(mmio, "mmioDescend // dwOldPos=%ld\n", dwOldPos);
 
 	if (lpckParent != NULL) {
-		dprintf_mmio(stddeb, "mmioDescend // seek inside parent at %ld !\n", lpckParent->dwDataOffset);
+		dprintf_info(mmio, "mmioDescend // seek inside parent at %ld !\n", lpckParent->dwDataOffset);
 		dwOldPos = mmioSeek(hmmio, lpckParent->dwDataOffset, SEEK_SET);
 	}
 /*
@@ -569,19 +568,19 @@
 		(uFlags & MMIO_FINDLIST)) {
 */
 	if ((uFlags & MMIO_FINDCHUNK) || (uFlags & MMIO_FINDLIST)) {
-		dprintf_mmio(stddeb, "mmioDescend // MMIO_FINDxxxx dwfcc=%08lX !\n", dwfcc);
+		dprintf_info(mmio, "mmioDescend // MMIO_FINDxxxx dwfcc=%08lX !\n", dwfcc);
 		while (TRUE) {
 		        LONG ix;
 
 			ix = mmioRead(hmmio, (LPSTR)lpck, sizeof(MMCKINFO));
-			dprintf_mmio(stddeb, "mmioDescend // after _lread32 ix = %ld req = %d, errno = %d\n",ix,sizeof(MMCKINFO),errno);
+			dprintf_info(mmio, "mmioDescend // after _lread32 ix = %ld req = %d, errno = %d\n",ix,sizeof(MMCKINFO),errno);
 			if (ix < sizeof(MMCKINFO)) {
 
 				mmioSeek(hmmio, dwOldPos, SEEK_SET);
-				dprintf_mmio(stddeb, "mmioDescend // return ChunkNotFound\n");
+				dprintf_warn(mmio, "mmioDescend // return ChunkNotFound\n");
 				return MMIOERR_CHUNKNOTFOUND;
 			}
-			dprintf_mmio(stddeb, "mmioDescend // dwfcc=%08lX ckid=%08lX cksize=%08lX !\n", 
+			dprintf_info(mmio, "mmioDescend // dwfcc=%08lX ckid=%08lX cksize=%08lX !\n", 
 									dwfcc, lpck->ckid, lpck->cksize);
 			if (dwfcc == lpck->ckid)
 				break;
@@ -595,7 +594,7 @@
 	else {
 		if (mmioRead(hmmio, (LPSTR)lpck, sizeof(MMCKINFO)) < sizeof(MMCKINFO)) {
 			mmioSeek(hmmio, dwOldPos, SEEK_SET);
-			dprintf_mmio(stddeb, "mmioDescend // return ChunkNotFound 2nd\n");
+			dprintf_warn(mmio, "mmioDescend // return ChunkNotFound 2nd\n");
 			return MMIOERR_CHUNKNOTFOUND;
 		}
 	}
@@ -604,9 +603,9 @@
 		lpck->dwDataOffset += sizeof(DWORD);
 	mmioSeek(hmmio, lpck->dwDataOffset, SEEK_SET);
 
-	dprintf_mmio(stddeb, "mmioDescend // lpck->ckid=%08lX lpck->cksize=%ld !\n", 
+	dprintf_info(mmio, "mmioDescend // lpck->ckid=%08lX lpck->cksize=%ld !\n", 
 								lpck->ckid, lpck->cksize);
-	dprintf_mmio(stddeb, "mmioDescend // lpck->fccType=%08lX !\n", lpck->fccType);
+	dprintf_info(mmio, "mmioDescend // lpck->fccType=%08lX !\n", lpck->fccType);
 
 	return 0;
 }
@@ -616,7 +615,7 @@
 */
 UINT16 WINAPI mmioAscend(HMMIO16 hmmio, MMCKINFO * lpck, UINT16 uFlags)
 {
-	dprintf_mmio(stddeb, "mmioAscend // empty stub !\n");
+	dprintf_fixme(mmio, "mmioAscend // empty stub !\n");
 	return 0;
 }
 
@@ -625,7 +624,7 @@
 */
 UINT16 WINAPI mmioCreateChunk(HMMIO16 hmmio, MMCKINFO * lpck, UINT16 uFlags)
 {
-	dprintf_mmio(stddeb, "mmioCreateChunk // empty stub \n");
+	dprintf_fixme(mmio, "mmioCreateChunk // empty stub \n");
 	return 0;
 }
 
@@ -640,7 +639,7 @@
 	LPMMIOINFO16 lpmminfo;
 	HMMIO16 hmmio;
 
-	dprintf_mmio(stddeb, "mmioRename('%s', '%s', %p, %08lX);\n",
+	dprintf_info(mmio, "mmioRename('%s', '%s', %p, %08lX);\n",
 				 szFileName, szNewFileName, lpmmioinfo, dwRenameFlags);
 
 	hmmio = GlobalAlloc16(GHND, sizeof(MMIOINFO16));
diff --git a/multimedia/mmsystem.c b/multimedia/mmsystem.c
index 1ee0023..35e94e7 100644
--- a/multimedia/mmsystem.c
+++ b/multimedia/mmsystem.c
@@ -22,8 +22,6 @@
 #include "driver.h"
 #include "file.h"
 #include "mmsystem.h"
-#include "stddebug.h"
-/* #define DEBUG_MMSYS */
 #include "debug.h"
 #include "xmalloc.h"
 #include "callback.h"
@@ -123,7 +121,7 @@
  */
 BOOL32 WINAPI PlaySound32A(LPCSTR pszSound, HMODULE32 hmod, DWORD fdwSound)
 {
-  dprintf_mmsys(stddeb, "PlaySoundA: pszSound='%p' hmod=%04X fdwSound=%08lX\n",
+  dprintf_info(mmsys, "PlaySoundA: pszSound='%p' hmod=%04X fdwSound=%08lX\n",
 		pszSound, hmod, fdwSound);
   if(hmod != 0 || !(fdwSound & SND_FILENAME)) {
     fprintf(stderr, "PlaySoundA: only disk sound files are supported\n");
@@ -156,37 +154,37 @@
 	char			str[128];
 	LPSTR			ptr;
 
-	dprintf_mmsys(stddeb, "sndPlaySound // SoundName='%s' uFlags=%04X !\n", 
+	dprintf_info(mmsys, "sndPlaySound // SoundName='%s' uFlags=%04X !\n", 
 									lpszSoundName, uFlags);
 	if (lpszSoundName == NULL) {
-		dprintf_mmsys(stddeb, "sndPlaySound // Stop !\n");
+		dprintf_info(mmsys, "sndPlaySound // Stop !\n");
 		return FALSE;
 		}
 	hmmio = mmioOpen16((LPSTR)lpszSoundName, NULL, 
 		MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE);
 
 	if (uFlags & SND_MEMORY) {
-		dprintf_mmsys(stddeb, "sndPlaySound // SND_MEMORY flag not implemented!\n");
+		dprintf_fixme(mmsys, "sndPlaySound // SND_MEMORY flag not implemented!\n");
 		return FALSE;
 	}
 
 	if (hmmio == 0) 
 	{
-		dprintf_mmsys(stddeb, "sndPlaySound // searching in SystemSound List !\n");
+		dprintf_info(mmsys, "sndPlaySound // searching in SystemSound List !\n");
 		GetProfileString32A("Sounds", (LPSTR)lpszSoundName, "", str, sizeof(str));
 		if (strlen(str) == 0) return FALSE;
 		if ( (ptr = (LPSTR)strchr(str, ',')) != NULL) *ptr = '\0';
 		hmmio = mmioOpen16(str, NULL, MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE);
 		if (hmmio == 0) 
 		{
-			dprintf_mmsys(stddeb, "sndPlaySound // can't find SystemSound='%s' !\n", str);
+			dprintf_warn(mmsys, "sndPlaySound // can't find SystemSound='%s' !\n", str);
 			return FALSE;
 		}
 	}
 
 	if (mmioDescend(hmmio, &ckMainRIFF, NULL, 0) == 0) 
         {
-	    dprintf_mmsys(stddeb, "sndPlaySound // ParentChunk ckid=%.4s fccType=%.4s cksize=%08lX \n",
+	    dprintf_info(mmsys, "sndPlaySound // ParentChunk ckid=%.4s fccType=%.4s cksize=%08lX \n",
 				(LPSTR)&ckMainRIFF.ckid, (LPSTR)&ckMainRIFF.fccType, ckMainRIFF.cksize);
 
 	    if ((ckMainRIFF.ckid == FOURCC_RIFF) &&
@@ -200,19 +198,19 @@
 		{
 		    PCMWAVEFORMAT           pcmWaveFormat;
 
-		    dprintf_mmsys(stddeb, "sndPlaySound // Chunk Found ckid=%.4s fccType=%.4s cksize=%08lX \n",
+		    dprintf_info(mmsys, "sndPlaySound // Chunk Found ckid=%.4s fccType=%.4s cksize=%08lX \n",
 				(LPSTR)&mmckInfo.ckid, (LPSTR)&mmckInfo.fccType, mmckInfo.cksize);
 
 		    if (mmioRead(hmmio, (HPSTR) &pcmWaveFormat,
 			        (long) sizeof(PCMWAVEFORMAT)) == (long) sizeof(PCMWAVEFORMAT))
 		    {
 
-			dprintf_mmsys(stddeb, "sndPlaySound // wFormatTag=%04X !\n", pcmWaveFormat.wf.wFormatTag);
-			dprintf_mmsys(stddeb, "sndPlaySound // nChannels=%d \n", pcmWaveFormat.wf.nChannels);
-			dprintf_mmsys(stddeb, "sndPlaySound // nSamplesPerSec=%ld\n", pcmWaveFormat.wf.nSamplesPerSec);
-			dprintf_mmsys(stddeb, "sndPlaySound // nAvgBytesPerSec=%ld\n", pcmWaveFormat.wf.nAvgBytesPerSec);
-			dprintf_mmsys(stddeb, "sndPlaySound // nBlockAlign=%d \n", pcmWaveFormat.wf.nBlockAlign);
-			dprintf_mmsys(stddeb, "sndPlaySound // wBitsPerSample=%u !\n", pcmWaveFormat.wBitsPerSample);
+			dprintf_info(mmsys, "sndPlaySound // wFormatTag=%04X !\n", pcmWaveFormat.wf.wFormatTag);
+			dprintf_info(mmsys, "sndPlaySound // nChannels=%d \n", pcmWaveFormat.wf.nChannels);
+			dprintf_info(mmsys, "sndPlaySound // nSamplesPerSec=%ld\n", pcmWaveFormat.wf.nSamplesPerSec);
+			dprintf_info(mmsys, "sndPlaySound // nAvgBytesPerSec=%ld\n", pcmWaveFormat.wf.nAvgBytesPerSec);
+			dprintf_info(mmsys, "sndPlaySound // nBlockAlign=%d \n", pcmWaveFormat.wf.nBlockAlign);
+			dprintf_info(mmsys, "sndPlaySound // wBitsPerSample=%u !\n", pcmWaveFormat.wBitsPerSample);
 
 			mmckInfo.ckid = mmioFOURCC('d', 'a', 't', 'a');
 			if (mmioDescend(hmmio, &mmckInfo, &ckMainRIFF, MMIO_FINDCHUNK) == 0)
@@ -220,7 +218,7 @@
 			    WAVEOPENDESC	waveDesc;
 			    DWORD		dwRet;
 
-			    dprintf_mmsys(stddeb, "sndPlaySound // Chunk Found \
+			    dprintf_info(mmsys, "sndPlaySound // Chunk Found \
  ckid=%.4s fccType=%.4s cksize=%08lX \n", (LPSTR)&mmckInfo.ckid, (LPSTR)&mmckInfo.fccType, mmckInfo.cksize);
 
 			    pcmWaveFormat.wf.nAvgBytesPerSec = pcmWaveFormat.wf.nSamplesPerSec * 
@@ -260,7 +258,7 @@
 
 				    bRet = TRUE;
 				}
-				else dprintf_mmsys(stddeb, "sndPlaySound // can't prepare WaveOut device !\n");
+				else dprintf_warn(mmsys, "sndPlaySound // can't prepare WaveOut device !\n");
 
 				GlobalUnlock16(hData);
 				GlobalFree16(hData);
@@ -289,7 +287,7 @@
  */
 UINT16 WINAPI mmsystemGetVersion16()
 {
-	dprintf_mmsys(stddeb, "mmsystemGetVersion // 3.10 (Win95?)\n");
+	dprintf_info(mmsys, "mmsystemGetVersion // 3.10 (Win95?)\n");
 	return 0x030a;
 }
 
@@ -310,14 +308,14 @@
 {
 	LPWAVEOPENDESC	lpDesc;
 
-	dprintf_mmsys(stddeb, "DriverCallback(%08lX, %04X, %04X, %04X, %08lX, %08lX, %08lX); !\n",
+	dprintf_info(mmsys, "DriverCallback(%08lX, %04X, %04X, %04X, %08lX, %08lX, %08lX); !\n",
 		dwCallBack, uFlags, hDev, wMsg, dwUser, dwParam1, dwParam2);
 	switch(uFlags & DCB_TYPEMASK) {
 		case DCB_NULL:
-			dprintf_mmsys(stddeb, "DriverCallback() // CALLBACK_NULL !\n");
+			dprintf_info(mmsys, "DriverCallback() // CALLBACK_NULL !\n");
 			break;
 		case DCB_WINDOW:
-			dprintf_mmsys(stddeb, "DriverCallback() // CALLBACK_WINDOW = %04lX handle = %04X!\n",dwCallBack,hDev);
+			dprintf_info(mmsys, "DriverCallback() // CALLBACK_WINDOW = %04lX handle = %04X!\n",dwCallBack,hDev);
 			if (!IsWindow32(dwCallBack)) return FALSE;
 			lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hDev);
 			if (lpDesc == NULL) return FALSE;
@@ -325,10 +323,10 @@
 			PostMessage16((HWND16)dwCallBack, wMsg, hDev, dwParam1);
 			break;
 		case DCB_TASK:
-			dprintf_mmsys(stddeb, "DriverCallback() // CALLBACK_TASK !\n");
+			dprintf_info(mmsys, "DriverCallback() // CALLBACK_TASK !\n");
 			return FALSE;
 		case DCB_FUNCTION:
-			dprintf_mmsys(stddeb, "DriverCallback() // CALLBACK_FUNCTION !\n");
+			dprintf_info(mmsys, "DriverCallback() // CALLBACK_FUNCTION !\n");
 			Callbacks->CallDriverCallback( (FARPROC16)dwCallBack,
                                                        hDev, wMsg, dwUser,
                                                        dwParam1, dwParam2 );
@@ -366,7 +364,7 @@
 	UINT16	count;
 
 	count = mixMessage(0,MXDM_GETNUMDEVS,0L,0L,0L);
-	dprintf_mmaux(stddeb,"mixerGetNumDevs returns %d\n",count);
+	dprintf_info(mmaux,"mixerGetNumDevs returns %d\n",count);
 	return count;
 }
 
@@ -700,9 +698,9 @@
 UINT16 WINAPI auxGetNumDevs16()
 {
 	UINT16	count = 0;
-	dprintf_mmsys(stddeb, "auxGetNumDevs !\n");
+	dprintf_info(mmsys, "auxGetNumDevs !\n");
 	count += auxMessage(0, AUXDM_GETNUMDEVS, 0L, 0L, 0L);
-	dprintf_mmsys(stddeb, "auxGetNumDevs return %u \n", count);
+	dprintf_info(mmsys, "auxGetNumDevs return %u \n", count);
 	return count;
 }
 
@@ -745,7 +743,7 @@
  */
 UINT16 WINAPI auxGetDevCaps16(UINT16 uDeviceID,LPAUXCAPS16 lpCaps, UINT16 uSize)
 {
-	dprintf_mmsys(stddeb, "auxGetDevCaps(%04X, %p, %d) !\n", 
+	dprintf_info(mmsys, "auxGetDevCaps(%04X, %p, %d) !\n", 
 					uDeviceID, lpCaps, uSize);
 	return auxMessage(uDeviceID, AUXDM_GETDEVCAPS,
 				0L, (DWORD)lpCaps, (DWORD)uSize);
@@ -764,7 +762,7 @@
  */
 UINT16 WINAPI auxGetVolume16(UINT16 uDeviceID, DWORD * lpdwVolume)
 {
-	dprintf_mmsys(stddeb, "auxGetVolume(%04X, %p) !\n", uDeviceID, lpdwVolume);
+	dprintf_info(mmsys, "auxGetVolume(%04X, %p) !\n", uDeviceID, lpdwVolume);
 	return auxMessage(uDeviceID, AUXDM_GETVOLUME, 0L, (DWORD)lpdwVolume, 0L);
 }
 
@@ -781,7 +779,7 @@
  */
 UINT16 WINAPI auxSetVolume16(UINT16 uDeviceID, DWORD dwVolume)
 {
-	dprintf_mmsys(stddeb, "auxSetVolume(%04X, %08lX) !\n", uDeviceID, dwVolume);
+	dprintf_info(mmsys, "auxSetVolume(%04X, %08lX) !\n", uDeviceID, dwVolume);
 	return auxMessage(uDeviceID, AUXDM_SETVOLUME, 0L, dwVolume, 0L);
 }
 
@@ -812,7 +810,7 @@
  */
 DWORD WINAPI auxOutMessage16(UINT16 uDeviceID, UINT16 uMessage, DWORD dw1, DWORD dw2)
 {
-	dprintf_mmsys(stddeb, "auxOutMessage(%04X, %04X, %08lX, %08lX)\n", 
+	dprintf_info(mmsys, "auxOutMessage(%04X, %04X, %08lX, %08lX)\n", 
 				uDeviceID, uMessage, dw1, dw2);
 	switch (uMessage) {
 	case AUXDM_GETNUMDEVS:
@@ -859,7 +857,8 @@
 BOOL16 WINAPI mciGetErrorString16(DWORD wError,LPSTR lpstrBuffer,UINT16 uLength)
 {
 	LPSTR	msgptr;
-	dprintf_mmsys(stddeb, "mciGetErrorString(%08lX, %p, %d);\n", wError, lpstrBuffer, uLength);
+	dprintf_info(mmsys, "mciGetErrorString(%08lX, %p, %d);\n", 
+	       wError, lpstrBuffer, uLength);
 	if ((lpstrBuffer == NULL) || (uLength < 1)) return(FALSE);
 	lpstrBuffer[0] = '\0';
 	switch(wError) {
@@ -1124,7 +1123,7 @@
 			break;
 	}
         lstrcpyn32A(lpstrBuffer, msgptr, uLength);
-	dprintf_mmsys(stddeb, "mciGetErrorString // msg = %s;\n", msgptr);
+	dprintf_info(mmsys, "mciGetErrorString // msg = %s;\n", msgptr);
 	return TRUE;
 }
 
@@ -1134,9 +1133,9 @@
  */
 BOOL16 WINAPI mciDriverNotify(HWND16 hWndCallBack, UINT16 wDevID, UINT16 wStatus)
 {
-	dprintf_mmsys(stddeb, "mciDriverNotify(%04X, %u, %04X)\n", hWndCallBack, wDevID, wStatus);
+	dprintf_info(mmsys, "mciDriverNotify(%04X, %u, %04X)\n", hWndCallBack, wDevID, wStatus);
 	if (!IsWindow32(hWndCallBack)) return FALSE;
-	dprintf_mmsys(stddeb, "mciDriverNotify // before PostMessage\n");
+	dprintf_info(mmsys, "mciDriverNotify // before PostMessage\n");
 	PostMessage16( hWndCallBack, MM_MCINOTIFY, wStatus, 
                        MAKELONG(wDevID, 0));
 	return TRUE;
@@ -1155,23 +1154,23 @@
 	DWORD dwret;
 
 	lpParms = PTR_SEG_TO_LIN(lp16Parms);
-	dprintf_mmsys(stddeb, "mciOpen(%08lX, %p (%p))\n", dwParam, lp16Parms, lpParms);
+	dprintf_info(mmsys, "mciOpen(%08lX, %p (%p))\n", dwParam, lp16Parms, lpParms);
 	if (lp16Parms == NULL) return MCIERR_INTERNAL;
 
 	while(GetDrv(wDevID)->modp.wType != 0) {
 		wDevID = MMSYSTEM_NextDevID(wDevID);
 		if (!MMSYSTEM_DevIDValid(wDevID)) {
-			dprintf_mmsys(stddeb, "MCI_OPEN // MAXMCIDRIVERS reached !\n");
+			dprintf_info(mmsys, "MCI_OPEN // MAXMCIDRIVERS reached !\n");
 			return MCIERR_INTERNAL;
 		}
 	}
-	dprintf_mmsys(stddeb, "mciOpen // wDevID=%04X \n", wDevID);
+	dprintf_info(mmsys, "mciOpen // wDevID=%04X \n", wDevID);
 	memcpy(GetOpenDrv(wDevID),lpParms,sizeof(*lpParms));
 
 	if (dwParam & MCI_OPEN_ELEMENT) {
 		char	*s,*t;
 
-		dprintf_mmsys(stddeb,"mciOpen // lpstrElementName='%s'\n",
+		dprintf_info(mmsys,"mciOpen // lpstrElementName='%s'\n",
 			(char*)PTR_SEG_TO_LIN(lpParms->lpstrElementName)
 		);
 		s=(char*)PTR_SEG_TO_LIN(lpParms->lpstrElementName);
@@ -1179,7 +1178,7 @@
 		if (t) {
 			GetProfileString32A("mci extensions",t+1,"*",str,sizeof(str));
 			CharUpper32A(str);
-			dprintf_mmsys(stddeb, "mciOpen // str = %s \n", str);
+			dprintf_info(mmsys, "mciOpen // str = %s \n", str);
 			if (strcmp(str, "CDAUDIO") == 0) {
 				uDevTyp = MCI_DEVTYPE_CD_AUDIO;
 			} else
@@ -1196,7 +1195,7 @@
 				uDevTyp = MCI_DEVTYPE_DIGITAL_VIDEO;
 			} else 
 			if (strcmp(str,"*") == 0) {
-				dprintf_mmsys(stddeb,"No [mci extensions] entry for %s found.\n",t);
+				dprintf_info(mmsys,"No [mci extensions] entry for %s found.\n",t);
 				return MCIERR_EXTENSION_NOT_FOUND;
 #if testing16
 			} else  {
@@ -1209,7 +1208,7 @@
 					GetDrv(wDevID)->driverproc = GetProcAddress16(hmod,SEGPTR_GET(SEGPTR_STRDUP("DRIVERPROC")));
 					uDevTyp = MCI_DEVTYPE_OTHER;
 				} else {
-					dprintf_mmsys(stddeb,"[mci extensions] entry %s for %s not supported.\n",str,t);
+					dprintf_fixme(mmsys, "[mci extensions] entry %s for %s not supported.\n",str,t);
 					return MCIERR_DEVICE_NOT_INSTALLED;
 				}
 #endif
@@ -1219,7 +1218,7 @@
 	}
 
 	if (dwParam & MCI_OPEN_ALIAS) {
-		dprintf_mmsys(stddeb, "MCI_OPEN // Alias='%s' !\n",
+		dprintf_info(mmsys, "MCI_OPEN // Alias='%s' !\n",
 			(char*)PTR_SEG_TO_LIN(lpParms->lpstrAlias));
                 GetOpenDrv(wDevID)->lpstrAlias = (LPSTR)SEGPTR_GET(
                     SEGPTR_STRDUP((char*)PTR_SEG_TO_LIN(lpParms->lpstrAlias)));
@@ -1227,12 +1226,12 @@
 	}
 	if (dwParam & MCI_OPEN_TYPE) {
 		if (dwParam & MCI_OPEN_TYPE_ID) {
-			dprintf_mmsys(stddeb, "MCI_OPEN // Dev=%08lx!\n", (DWORD)lpParms->lpstrDeviceType);
+			dprintf_info(mmsys, "MCI_OPEN // Dev=%08lx!\n", (DWORD)lpParms->lpstrDeviceType);
 			uDevTyp = LOWORD((DWORD)lpParms->lpstrDeviceType);
  			GetOpenDrv(wDevID)->lpstrDeviceType=(LPSTR)lpParms->lpstrDeviceType;
 		} else {
 			if (lpParms->lpstrDeviceType == NULL) return MCIERR_INTERNAL;
-			dprintf_mmsys(stddeb, "MCI_OPEN // Dev='%s' !\n",
+			dprintf_info(mmsys, "MCI_OPEN // Dev='%s' !\n",
                               (char*)PTR_SEG_TO_LIN(lpParms->lpstrDeviceType));
                         GetOpenDrv(wDevID)->lpstrDeviceType=(LPSTR)SEGPTR_GET(
               SEGPTR_STRDUP((char*)PTR_SEG_TO_LIN(lpParms->lpstrDeviceType)));
@@ -1273,7 +1272,7 @@
 	GetDrv(wDevID)->modp.wType = uDevTyp;
 	GetDrv(wDevID)->modp.wDeviceID = 0;  /* FIXME? for multiple devices */
 	lpParms->wDeviceID = wDevID;
-	dprintf_mmsys(stddeb, "MCI_OPEN // mcidev=%d, uDevTyp=%04X wDeviceID=%04X !\n", 
+	dprintf_info(mmsys, "MCI_OPEN // mcidev=%d, uDevTyp=%04X wDeviceID=%04X !\n", 
 				wDevID, uDevTyp, lpParms->wDeviceID);
 	switch(uDevTyp)
         {
@@ -1294,12 +1293,12 @@
 				  dwParam, (DWORD)lp16Parms);
 	  break;
         case MCI_DEVTYPE_DIGITAL_VIDEO:
-	  dprintf_mmsys(stddeb, "MCI_OPEN // No DIGITAL_VIDEO yet !\n");
+	  dprintf_info(mmsys, "MCI_OPEN // No DIGITAL_VIDEO yet !\n");
 	  return MCIERR_DEVICE_NOT_INSTALLED;
         default:
 #if testing16
 	  dwret = Callbacks->CallDriverProc(GetDrv(wDevID)->driverproc,0,GetDrv(wDevID)->hdrv,MCI_OPEN_DRIVER,dwParam,(DWORD)lp16Parms);
-	  dprintf_mmsys(stddeb, "MCI_OPEN // Invalid Device Name '%08lx' !\n", (DWORD)lpParms->lpstrDeviceType);
+	  dprintf_warn(mmsys, "MCI_OPEN // Invalid Device Name '%08lx' !\n", (DWORD)lpParms->lpstrDeviceType);
 #endif
 	  return MCIERR_INVALID_DEVICE_NAME;
         }
@@ -1310,7 +1309,7 @@
 			  (dwret==0?MCI_NOTIFY_SUCCESSFUL:MCI_NOTIFY_FAILURE));
 
 	/* only handled devices fall through */
-	dprintf_mmsys(stddeb, "MCI_OPEN // wDevID = %04X wDeviceID = %d dwret = %ld\n",wDevID, lpParms->wDeviceID, dwret);
+	dprintf_info(mmsys, "MCI_OPEN // wDevID = %04X wDeviceID = %d dwret = %ld\n",wDevID, lpParms->wDeviceID, dwret);
 	return dwret;
 }
 
@@ -1337,7 +1336,7 @@
 {
 	DWORD	dwRet = MCIERR_INTERNAL;
 
-	dprintf_mmsys(stddeb, "mciClose(%04x, %08lX, %p)\n", wDevID, dwParam, lpParms);
+	dprintf_info(mmsys, "mciClose(%04x, %08lX, %p)\n", wDevID, dwParam, lpParms);
 	switch(GetDrv(wDevID)->modp.wType) {
 	case MCI_DEVTYPE_CD_AUDIO:
 		dwRet = CDAUDIO_DriverProc(GetDrv(wDevID)->modp.wDeviceID,0,
@@ -1369,7 +1368,7 @@
 	  mciDriverNotify(lpParms->dwCallback,wDevID,
 			  (dwRet==0?MCI_NOTIFY_SUCCESSFUL:MCI_NOTIFY_FAILURE));
 
-	dprintf_mmsys(stddeb, "mciClose() // returns %ld\n",dwRet);
+	dprintf_info(mmsys, "mciClose() // returns %ld\n",dwRet);
 	return dwRet;
 }
 
@@ -1384,23 +1383,23 @@
 	LPSTR	lpstrReturn;
 	DWORD	*lpdwRet;
 	LPSTR	SysFile = "SYSTEM.INI";
-	dprintf_mci(stddeb, "mciSysInfo(%08lX, %08lX)\n", dwFlags, (DWORD)lpParms);
+	dprintf_info(mci, "mciSysInfo(%08lX, %08lX)\n", dwFlags, (DWORD)lpParms);
 	lpstrReturn = PTR_SEG_TO_LIN(lpParms->lpstrReturn);
 	switch(dwFlags) {
 	case MCI_SYSINFO_QUANTITY:
-		dprintf_mci(stddeb, "mciSysInfo // MCI_SYSINFO_QUANTITY \n");
+		dprintf_info(mci, "mciSysInfo // MCI_SYSINFO_QUANTITY \n");
 		lpdwRet = (DWORD *)lpstrReturn;
 		*(lpdwRet) = InstalledCount;
 		return 0;
 	case MCI_SYSINFO_INSTALLNAME:
-		dprintf_mci(stddeb, "mciSysInfo // MCI_SYSINFO_INSTALLNAME \n");
+		dprintf_info(mci, "mciSysInfo // MCI_SYSINFO_INSTALLNAME \n");
 		if (lpInstallNames == NULL) {
 			InstalledCount = 0;
 			InstalledListLen = 0;
 			ptr = lpInstallNames = xmalloc(2048);
 			GetPrivateProfileString32A("mci", NULL, "", lpInstallNames, 2000, SysFile);
 			while(strlen(ptr) > 0) {
-				dprintf_mci(stddeb, "---> '%s' \n", ptr);
+				dprintf_info(mci, "---> '%s' \n", ptr);
 				len = strlen(ptr) + 1;
 				ptr += len;
 				InstalledListLen += len;
@@ -1413,10 +1412,10 @@
 			strcpy(lpstrReturn, lpInstallNames);
 		return 0;
 	case MCI_SYSINFO_NAME:
-		dprintf_mci(stddeb, "mciSysInfo // MCI_SYSINFO_NAME \n");
+		dprintf_info(mci, "mciSysInfo // MCI_SYSINFO_NAME \n");
 		return 0;
 	case MCI_SYSINFO_OPEN:
-		dprintf_mci(stddeb, "mciSysInfo // MCI_SYSINFO_OPEN \n");
+		dprintf_info(mci, "mciSysInfo // MCI_SYSINFO_OPEN \n");
 		return 0;
 	}
 	return MMSYSERR_INVALPARAM;
@@ -1487,7 +1486,7 @@
 {
 	if (lpParms == NULL) return MCIERR_INTERNAL;
 	if (dwParam & MCI_SOUND_NAME)
-		dprintf_mci(stddeb, "MCI_SOUND // file='%s' !\n", lpParms->lpstrSoundName);
+		dprintf_info(mci, "MCI_SOUND // file='%s' !\n", lpParms->lpstrSoundName);
 	return MCIERR_INVALID_DEVICE_ID;
 }
  *
@@ -1552,7 +1551,7 @@
     	LPMCI_OPEN_PARMS32A	lpmop = (LPMCI_OPEN_PARMS32A)dwParam2;
     	fprintf(stderr,"	MCI_OPEN(%s,%s,%s)\n",
 		(dwParam1&MCI_OPEN_TYPE)   ?lpmop->lpstrDeviceType:"<null>",
-		(dwParam1&MCI_OPEN_ELEMENT)?lpmop->lpstrElementName:"<null>",
+		(dwParam1&MCI_OPEN_ELEMENT)?(HIWORD(lpmop->lpstrElementName)?lpmop->lpstrElementName:"<id>"):"<null>",
 		(dwParam1&MCI_OPEN_ALIAS)  ?lpmop->lpstrAlias:"<null>"
 	);
 	break;
@@ -1567,7 +1566,7 @@
                             DWORD dwParam2)
 {
     HDRVR16 hDrv = 0;
-    dprintf_mci(stddeb, "mciSendCommand(%04X, %s, %08lX, %08lX)\n", 
+    dprintf_info(mci, "mciSendCommand(%04X, %s, %08lX, %08lX)\n", 
                 wDevID, _mciCommandToString(wMsg), dwParam1, dwParam2);
     switch(wMsg)
     {
@@ -1599,7 +1598,7 @@
         default:
 	    return Callbacks->CallDriverProc(GetDrv(wDevID)->driverproc,GetDrv(wDevID)->modp.wDeviceID,GetDrv(wDevID)->hdrv,MCI_CLOSE,dwParam1,dwParam2);
 
-            dprintf_mci(stddeb,
+            dprintf_warn(mci,
                         "mciSendCommand() // unknown device type=%04X !\n", 
                         GetDrv(wDevID)->modp.wType);
         }
@@ -1614,7 +1613,7 @@
 {
     UINT16 wDevID;
 
-    dprintf_mci(stddeb, "mciGetDeviceID(\"%s\")\n", lpstrName);
+    dprintf_info(mci, "mciGetDeviceID(\"%s\")\n", lpstrName);
     if (lpstrName && !lstrcmpi32A(lpstrName, "ALL"))
         return MCI_ALL_DEVICE_ID;
 
@@ -1683,9 +1682,9 @@
 UINT16 WINAPI midiOutGetNumDevs16(void)
 {
 	UINT16	count = 0;
-	dprintf_mmsys(stddeb, "midiOutGetNumDevs\n");
+	dprintf_info(mmsys, "midiOutGetNumDevs\n");
 	count += modMessage(0, MODM_GETNUMDEVS, 0L, 0L, 0L);
-	dprintf_mmsys(stddeb, "midiOutGetNumDevs return %u \n", count);
+	dprintf_info(mmsys, "midiOutGetNumDevs return %u \n", count);
 	return count;
 }
 
@@ -1735,7 +1734,7 @@
  */
 UINT16 WINAPI midiOutGetDevCaps16(UINT16 uDeviceID,LPMIDIOUTCAPS16 lpCaps, UINT16 uSize)
 {
-	dprintf_mmsys(stddeb, "midiOutGetDevCaps\n");
+	dprintf_info(mmsys, "midiOutGetDevCaps\n");
 	return modMessage(uDeviceID,MODM_GETDEVCAPS,0,(DWORD)lpCaps,uSize);
 }
 
@@ -1744,7 +1743,7 @@
  */
 UINT32 WINAPI midiOutGetErrorText32A(UINT32 uError, LPSTR lpText, UINT32 uSize)
 {
-	dprintf_mmsys(stddeb, "midiOutGetErrorText\n");
+	dprintf_info(mmsys, "midiOutGetErrorText\n");
 	return midiGetErrorText(uError, lpText, uSize);
 }
 
@@ -1755,7 +1754,8 @@
 {
 	LPSTR	xstr = HeapAlloc(GetProcessHeap(),0,uSize);
 	UINT32	ret;
-	dprintf_mmsys(stddeb, "midiOutGetErrorText\n");
+
+	dprintf_info(mmsys, "midiOutGetErrorText\n");
 	ret = midiGetErrorText(uError, xstr, uSize);
 	lstrcpyAtoW(lpText,xstr);
 	HeapFree(GetProcessHeap(),0,xstr);
@@ -1766,7 +1766,7 @@
  */
 UINT16 WINAPI midiOutGetErrorText16(UINT16 uError, LPSTR lpText, UINT16 uSize)
 {
-	dprintf_mmsys(stddeb, "midiOutGetErrorText\n");
+        dprintf_info(mmsys, "midiOutGetErrorText\n");
 	return midiGetErrorText(uError, lpText, uSize);
 }
 
@@ -1839,10 +1839,10 @@
 	DWORD	dwRet = 0;
 	BOOL32	bMapperFlg = FALSE;
 	if (lphMidiOut != NULL) *lphMidiOut = 0;
-	dprintf_mmsys(stddeb, "midiOutOpen(%p, %d, %08lX, %08lX, %08lX);\n", 
+	dprintf_info(mmsys, "midiOutOpen(%p, %d, %08lX, %08lX, %08lX);\n", 
 		lphMidiOut, uDeviceID, dwCallback, dwInstance, dwFlags);
 	if (uDeviceID == (UINT16)MIDI_MAPPER) {
-		dprintf_mmsys(stddeb, "midiOutOpen	// MIDI_MAPPER mode requested !\n");
+		dprintf_info(mmsys, "midiOutOpen	// MIDI_MAPPER mode requested !\n");
 		bMapperFlg = TRUE;
 		uDeviceID = 0;
 	}
@@ -1860,7 +1860,7 @@
 		if (dwRet == MMSYSERR_NOERROR) break;
 		if (!bMapperFlg) break;
 		uDeviceID++;
-		dprintf_mmsys(stddeb, "midiOutOpen	// MIDI_MAPPER mode ! try next driver...\n");
+		dprintf_info(mmsys, "midiOutOpen	// MIDI_MAPPER mode ! try next driver...\n");
 	}
 	return dwRet;
 }
@@ -1879,7 +1879,7 @@
 UINT16 WINAPI midiOutClose16(HMIDIOUT16 hMidiOut)
 {
 	LPMIDIOPENDESC	lpDesc;
-	dprintf_mmsys(stddeb, "midiOutClose(%04X)\n", hMidiOut);
+	dprintf_info(mmsys, "midiOutClose(%04X)\n", hMidiOut);
 	lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiOut);
 	if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
 	return modMessage(0, MODM_CLOSE, lpDesc->dwInstance, 0L, 0L);
@@ -1901,7 +1901,7 @@
                                      MIDIHDR * lpMidiOutHdr, UINT16 uSize)
 {
 	LPMIDIOPENDESC	lpDesc;
-	dprintf_mmsys(stddeb, "midiOutPrepareHeader(%04X, %p, %d)\n", 
+	dprintf_info(mmsys, "midiOutPrepareHeader(%04X, %p, %d)\n", 
 					hMidiOut, lpMidiOutHdr, uSize);
 	lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiOut);
 	if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
@@ -1924,7 +1924,7 @@
                                      MIDIHDR * lpMidiOutHdr, UINT16 uSize)
 {
 	LPMIDIOPENDESC	lpDesc;
-	dprintf_mmsys(stddeb, "midiOutUnprepareHeader(%04X, %p, %d)\n", 
+	dprintf_info(mmsys, "midiOutUnprepareHeader(%04X, %p, %d)\n", 
 					hMidiOut, lpMidiOutHdr, uSize);
 	lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiOut);
 	if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
@@ -1945,7 +1945,7 @@
 UINT16 WINAPI midiOutShortMsg16(HMIDIOUT16 hMidiOut, DWORD dwMsg)
 {
 	LPMIDIOPENDESC	lpDesc;
-	dprintf_mmsys(stddeb, "midiOutShortMsg(%04X, %08lX)\n", hMidiOut, dwMsg);
+	dprintf_info(mmsys, "midiOutShortMsg(%04X, %08lX)\n", hMidiOut, dwMsg);
 	lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiOut);
 	if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
 	return modMessage(0, MODM_DATA, lpDesc->dwInstance, dwMsg, 0L);
@@ -1967,7 +1967,7 @@
                                MIDIHDR * lpMidiOutHdr, UINT16 uSize)
 {
 	LPMIDIOPENDESC	lpDesc;
-	dprintf_mmsys(stddeb, "midiOutLongMsg(%04X, %p, %d)\n", 
+	dprintf_info(mmsys, "midiOutLongMsg(%04X, %p, %d)\n", 
 				hMidiOut, lpMidiOutHdr, uSize);
 	lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiOut);
 	if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
@@ -1989,7 +1989,7 @@
 UINT16 WINAPI midiOutReset16(HMIDIOUT16 hMidiOut)
 {
 	LPMIDIOPENDESC	lpDesc;
-	dprintf_mmsys(stddeb, "midiOutReset(%04X)\n", hMidiOut);
+	dprintf_info(mmsys, "midiOutReset(%04X)\n", hMidiOut);
 	lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiOut);
 	if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
 	return modMessage(0, MODM_RESET, lpDesc->dwInstance, 0L, 0L);
@@ -2007,7 +2007,7 @@
  */
 UINT16 WINAPI midiOutGetVolume16(UINT16 uDeviceID, DWORD * lpdwVolume)
 {
-	dprintf_mmsys(stddeb, "midiOutGetVolume(%04X, %p);\n", uDeviceID, lpdwVolume);
+	dprintf_info(mmsys, "midiOutGetVolume(%04X, %p);\n", uDeviceID, lpdwVolume);
 	return modMessage(uDeviceID, MODM_GETVOLUME, 0L, (DWORD)lpdwVolume, 0L);
 }
 
@@ -2024,7 +2024,7 @@
  */
 UINT16 WINAPI midiOutSetVolume16(UINT16 uDeviceID, DWORD dwVolume)
 {
-	dprintf_mmsys(stddeb, "midiOutSetVolume(%04X, %08lX);\n", uDeviceID, dwVolume);
+	dprintf_info(mmsys, "midiOutSetVolume(%04X, %08lX);\n", uDeviceID, dwVolume);
 	return modMessage(uDeviceID, MODM_SETVOLUME, 0L, dwVolume, 0L);
 }
 
@@ -2085,7 +2085,7 @@
  */
 UINT16 WINAPI midiOutGetID16(HMIDIOUT16 hMidiOut, UINT16 * lpuDeviceID)
 {
-	dprintf_mmsys(stddeb, "midiOutGetID\n");
+	dprintf_info(mmsys, "midiOutGetID\n");
 	return 0;
 }
 
@@ -2097,7 +2097,7 @@
 {
 	LPMIDIOPENDESC	lpDesc;
 
-	dprintf_mmsys(stddeb, "midiOutMessage(%04X, %04X, %08lX, %08lX)\n", 
+	dprintf_info(mmsys, "midiOutMessage(%04X, %04X, %08lX, %08lX)\n", 
 			hMidiOut, uMessage, dwParam1, dwParam2);
 	lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiOut);
 	if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
@@ -2134,7 +2134,7 @@
 {
 	LPMIDIOPENDESC	lpDesc;
 
-	dprintf_mmsys(stddeb, "midiOutMessage(%04X, %04X, %08lX, %08lX)\n", 
+	dprintf_info(mmsys, "midiOutMessage(%04X, %04X, %08lX, %08lX)\n", 
 			hMidiOut, uMessage, dwParam1, dwParam2);
 	lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiOut);
 	if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
@@ -2179,9 +2179,9 @@
 UINT16 WINAPI midiInGetNumDevs16(void)
 {
 	UINT16	count = 0;
-	dprintf_mmsys(stddeb, "midiInGetNumDevs\n");
+	dprintf_info(mmsys, "midiInGetNumDevs\n");
 	count += midMessage(0, MIDM_GETNUMDEVS, 0L, 0L, 0L);
-	dprintf_mmsys(stddeb, "midiInGetNumDevs return %u \n", count);
+	dprintf_info(mmsys, "midiInGetNumDevs return %u \n", count);
 	return count;
 }
 
@@ -2225,7 +2225,7 @@
 UINT16 WINAPI midiInGetDevCaps16(UINT16 uDeviceID,
                                LPMIDIINCAPS16 lpCaps, UINT16 uSize)
 {
-	dprintf_mmsys(stddeb, "midiInGetDevCaps\n");
+	dprintf_info(mmsys, "midiInGetDevCaps\n");
 	return midMessage(uDeviceID,MIDM_GETDEVCAPS,0,(DWORD)lpCaps,uSize);;
 }
 
@@ -2253,7 +2253,7 @@
  */
 UINT16 WINAPI midiInGetErrorText16(UINT16 uError, LPSTR lpText, UINT16 uSize)
 {
-	dprintf_mmsys(stddeb, "midiInGetErrorText\n");
+	dprintf_info(mmsys, "midiInGetErrorText\n");
 	return (midiGetErrorText(uError, lpText, uSize));
 }
 
@@ -2281,10 +2281,10 @@
 	BOOL32	bMapperFlg = FALSE;
 
 	if (lphMidiIn != NULL) *lphMidiIn = 0;
-	dprintf_mmsys(stddeb, "midiInOpen(%p, %d, %08lX, %08lX, %08lX);\n", 
+	dprintf_info(mmsys, "midiInOpen(%p, %d, %08lX, %08lX, %08lX);\n", 
 		lphMidiIn, uDeviceID, dwCallback, dwInstance, dwFlags);
 	if (uDeviceID == (UINT16)MIDI_MAPPER) {
-		dprintf_mmsys(stddeb, "midiInOpen	// MIDI_MAPPER mode requested !\n");
+		dprintf_info(mmsys, "midiInOpen	// MIDI_MAPPER mode requested !\n");
 		bMapperFlg = TRUE;
 		uDeviceID = 0;
 	}
@@ -2301,7 +2301,7 @@
 		if (dwRet == MMSYSERR_NOERROR) break;
 		if (!bMapperFlg) break;
 		uDeviceID++;
-		dprintf_mmsys(stddeb, "midiInOpen	// MIDI_MAPPER mode ! try next driver...\n");
+		dprintf_info(mmsys, "midiInOpen	// MIDI_MAPPER mode ! try next driver...\n");
 	}
 	return dwRet;
 }
@@ -2320,7 +2320,7 @@
 UINT16 WINAPI midiInClose16(HMIDIIN16 hMidiIn)
 {
 	LPMIDIOPENDESC	lpDesc;
-	dprintf_mmsys(stddeb, "midiInClose(%04X)\n", hMidiIn);
+	dprintf_info(mmsys, "midiInClose(%04X)\n", hMidiIn);
 	lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiIn);
 	if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
 	return midMessage(0, MIDM_CLOSE, lpDesc->dwInstance, 0L, 0L);
@@ -2342,7 +2342,7 @@
                                     MIDIHDR * lpMidiInHdr, UINT16 uSize)
 {
 	LPMIDIOPENDESC	lpDesc;
-	dprintf_mmsys(stddeb, "midiInPrepareHeader(%04X, %p, %d)\n", 
+	dprintf_info(mmsys, "midiInPrepareHeader(%04X, %p, %d)\n", 
 					hMidiIn, lpMidiInHdr, uSize);
 	lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiIn);
 	if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
@@ -2366,7 +2366,7 @@
                                       MIDIHDR * lpMidiInHdr, UINT16 uSize)
 {
 	LPMIDIOPENDESC	lpDesc;
-	dprintf_mmsys(stddeb, "midiInUnprepareHeader(%04X, %p, %d)\n", 
+	dprintf_info(mmsys, "midiInUnprepareHeader(%04X, %p, %d)\n", 
 					hMidiIn, lpMidiInHdr, uSize);
 	lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiIn);
 	if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
@@ -2389,7 +2389,7 @@
 UINT16 WINAPI midiInAddBuffer16(HMIDIIN16 hMidiIn,
                                 MIDIHDR * lpMidiInHdr, UINT16 uSize)
 {
-	dprintf_mmsys(stddeb, "midiInAddBuffer\n");
+	dprintf_info(mmsys, "midiInAddBuffer\n");
 	return 0;
 }
 
@@ -2406,7 +2406,7 @@
  */
 UINT16 WINAPI midiInStart16(HMIDIIN16 hMidiIn)
 {
-	dprintf_mmsys(stddeb, "midiInStart\n");
+	dprintf_info(mmsys, "midiInStart\n");
 	return 0;
 }
 
@@ -2423,7 +2423,7 @@
  */
 UINT16 WINAPI midiInStop16(HMIDIIN16 hMidiIn)
 {
-	dprintf_mmsys(stddeb, "midiInStop\n");
+	dprintf_info(mmsys, "midiInStop\n");
 	return 0;
 }
 
@@ -2440,7 +2440,7 @@
  */
 UINT16 WINAPI midiInReset16(HMIDIIN16 hMidiIn)
 {
-	dprintf_mmsys(stddeb, "midiInReset\n");
+	dprintf_info(mmsys, "midiInReset\n");
 	return 0;
 }
 
@@ -2449,7 +2449,7 @@
  */
 UINT32 WINAPI midiInGetID32(HMIDIIN32 hMidiIn, UINT32 * lpuDeviceID)
 {
-	dprintf_mmsys(stddeb, "midiInGetID\n");
+	dprintf_info(mmsys, "midiInGetID\n");
 	return 0;
 }
 
@@ -2458,7 +2458,7 @@
  */
 UINT16 WINAPI midiInGetID16(HMIDIIN16 hMidiIn, UINT16 * lpuDeviceID)
 {
-	dprintf_mmsys(stddeb, "midiInGetID\n");
+	dprintf_info(mmsys, "midiInGetID\n");
 	return 0;
 }
 
@@ -2469,7 +2469,7 @@
                              DWORD dwParam1, DWORD dwParam2)
 {
 	LPMIDIOPENDESC	lpDesc;
-	dprintf_mmsys(stddeb, "midiInMessage(%04X, %04X, %08lX, %08lX)\n", 
+	dprintf_info(mmsys, "midiInMessage(%04X, %04X, %08lX, %08lX)\n", 
 			hMidiIn, uMessage, dwParam1, dwParam2);
 	lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiIn);
 	if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
@@ -2508,7 +2508,7 @@
                              DWORD dwParam1, DWORD dwParam2)
 {
 	LPMIDIOPENDESC	lpDesc;
-	dprintf_mmsys(stddeb, "midiInMessage(%04X, %04X, %08lX, %08lX)\n", 
+	dprintf_info(mmsys, "midiInMessage(%04X, %04X, %08lX, %08lX)\n", 
 			hMidiIn, uMessage, dwParam1, dwParam2);
 	lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiIn);
 	if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
@@ -2554,9 +2554,9 @@
 UINT16 WINAPI waveOutGetNumDevs16()
 {
 	UINT16	count = 0;
-	dprintf_mmsys(stddeb, "waveOutGetNumDevs\n");
+	dprintf_info(mmsys, "waveOutGetNumDevs\n");
 	count += wodMessage( MMSYSTEM_FirstDevID(), WODM_GETNUMDEVS, 0L, 0L, 0L);
-	dprintf_mmsys(stddeb, "waveOutGetNumDevs return %u \n", count);
+	dprintf_info(mmsys, "waveOutGetNumDevs return %u \n", count);
 	return count;
 }
 
@@ -2568,7 +2568,7 @@
 {
 	if (uDeviceID > waveOutGetNumDevs16() - 1) return MMSYSERR_BADDEVICEID;
 	if (uDeviceID == (UINT16)WAVE_MAPPER) return MMSYSERR_BADDEVICEID; /* FIXME: do we have a wave mapper ? */
-	dprintf_mmsys(stddeb, "waveOutGetDevCaps\n");
+	dprintf_info(mmsys, "waveOutGetDevCaps\n");
 	return wodMessage(uDeviceID, WODM_GETDEVCAPS, 0L, (DWORD)lpCaps, uSize);
 }
 
@@ -2615,7 +2615,7 @@
  */
 UINT16 WINAPI waveOutGetErrorText16(UINT16 uError, LPSTR lpText, UINT16 uSize)
 {
-	dprintf_mmsys(stddeb, "waveOutGetErrorText\n");
+	dprintf_info(mmsys, "waveOutGetErrorText\n");
 	return(waveGetErrorText(uError, lpText, uSize));
 }
 
@@ -2647,7 +2647,8 @@
 static UINT16 waveGetErrorText(UINT16 uError, LPSTR lpText, UINT16 uSize)
 {
 	LPSTR	msgptr;
-	dprintf_mmsys(stddeb, "waveGetErrorText(%04X, %p, %d);\n", uError, lpText, uSize);
+	dprintf_info(mmsys, "waveGetErrorText(%04X, %p, %d);\n", 
+	       uError, lpText, uSize);
 	if ((lpText == NULL) || (uSize < 1)) return(FALSE);
 	lpText[0] = '\0';
 	switch(uError) {
@@ -2732,12 +2733,12 @@
 	DWORD		dwRet = 0;
 	BOOL32		bMapperFlg = FALSE;
 
-	dprintf_mmsys(stddeb, "waveOutOpen(%p, %d, %p, %08lX, %08lX, %08lX);\n", 
+	dprintf_info(mmsys, "waveOutOpen(%p, %d, %p, %08lX, %08lX, %08lX);\n", 
 		lphWaveOut, uDeviceID, lpFormat, dwCallback, dwInstance, dwFlags);
 	if (dwFlags & WAVE_FORMAT_QUERY)
-		dprintf_mmsys(stddeb, "waveOutOpen	// WAVE_FORMAT_QUERY requested !\n");
+		dprintf_info(mmsys, "waveOutOpen	// WAVE_FORMAT_QUERY requested !\n");
 	if (uDeviceID == (UINT16)WAVE_MAPPER) {
-		dprintf_mmsys(stddeb, "waveOutOpen	// WAVE_MAPPER mode requested !\n");
+		dprintf_info(mmsys, "waveOutOpen	// WAVE_MAPPER mode requested !\n");
 		bMapperFlg = TRUE;
 		uDeviceID = 0;
 	}
@@ -2759,11 +2760,11 @@
 		if (dwRet == MMSYSERR_NOERROR) break;
 		if (!bMapperFlg) break;
 		uDeviceID++;
-		dprintf_mmsys(stddeb, "waveOutOpen	// WAVE_MAPPER mode ! try next driver...\n");
+		dprintf_info(mmsys, "waveOutOpen	// WAVE_MAPPER mode ! try next driver...\n");
 	}
 	lpDesc->uDeviceID = uDeviceID;  /* save physical Device ID */
 	if (dwFlags & WAVE_FORMAT_QUERY) {
-		dprintf_mmsys(stddeb, "waveOutOpen	// End of WAVE_FORMAT_QUERY !\n");
+		dprintf_info(mmsys, "waveOutOpen	// End of WAVE_FORMAT_QUERY !\n");
 		dwRet = waveOutClose32(hWaveOut);
 	}
 	return dwRet;
@@ -2783,7 +2784,7 @@
 {
 	LPWAVEOPENDESC	lpDesc;
 
-	dprintf_mmsys(stddeb, "waveOutClose(%04X)\n", hWaveOut);
+	dprintf_info(mmsys, "waveOutClose(%04X)\n", hWaveOut);
 	lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
 	if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
 	return wodMessage( lpDesc->uDeviceID, WODM_CLOSE, lpDesc->dwInstance, 0L, 0L);
@@ -2797,7 +2798,7 @@
 {
 	LPWAVEOPENDESC	lpDesc;
 
-	dprintf_mmsys(stddeb, "waveOutPrepareHeader(%04X, %p, %u);\n", 
+	dprintf_info(mmsys, "waveOutPrepareHeader(%04X, %p, %u);\n", 
 					hWaveOut, lpWaveOutHdr, uSize);
 	lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
 	if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
@@ -2814,7 +2815,7 @@
 	LPBYTE		saveddata = lpWaveOutHdr->lpData;
 	UINT16		ret;
 
-	dprintf_mmsys(stddeb, "waveOutPrepareHeader(%04X, %p, %u);\n", 
+	dprintf_info(mmsys, "waveOutPrepareHeader(%04X, %p, %u);\n", 
 					hWaveOut, lpWaveOutHdr, uSize);
 	lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
 	if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
@@ -2833,7 +2834,7 @@
 {
 	LPWAVEOPENDESC	lpDesc;
 
-	dprintf_mmsys(stddeb, "waveOutUnprepareHeader(%04X, %p, %u);\n", 
+	dprintf_info(mmsys, "waveOutUnprepareHeader(%04X, %p, %u);\n", 
 						hWaveOut, lpWaveOutHdr, uSize);
 	lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
 	if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
@@ -2850,7 +2851,7 @@
 	LPBYTE		saveddata = lpWaveOutHdr->lpData;
 	UINT16		ret;
 
-	dprintf_mmsys(stddeb, "waveOutUnprepareHeader(%04X, %p, %u);\n", 
+	dprintf_info(mmsys, "waveOutUnprepareHeader(%04X, %p, %u);\n", 
 						hWaveOut, lpWaveOutHdr, uSize);
 	lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
 	if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
@@ -2868,7 +2869,7 @@
                              UINT32 uSize)
 {
 	LPWAVEOPENDESC	lpDesc;
-	dprintf_mmsys(stddeb, "waveOutWrite(%04X, %p, %u);\n", hWaveOut, lpWaveOutHdr, uSize);
+	dprintf_info(mmsys, "waveOutWrite(%04X, %p, %u);\n", hWaveOut, lpWaveOutHdr, uSize);
 	lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
 	if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
 	lpWaveOutHdr->reserved = (DWORD)lpWaveOutHdr->lpData;
@@ -2883,7 +2884,7 @@
 	LPWAVEOPENDESC	lpDesc;
 	UINT16		ret;
 
-	dprintf_mmsys(stddeb, "waveOutWrite(%04X, %p, %u);\n", hWaveOut, lpWaveOutHdr, uSize);
+	dprintf_info(mmsys, "waveOutWrite(%04X, %p, %u);\n", hWaveOut, lpWaveOutHdr, uSize);
 	lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
 	if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
 	lpWaveOutHdr->reserved=(DWORD)lpWaveOutHdr->lpData;/*save original ptr*/
@@ -2908,7 +2909,7 @@
 {
 	LPWAVEOPENDESC	lpDesc;
 
-	dprintf_mmsys(stddeb, "waveOutPause(%04X)\n", hWaveOut);
+	dprintf_info(mmsys, "waveOutPause(%04X)\n", hWaveOut);
 	lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
 	if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
 	return wodMessage( lpDesc->uDeviceID, WODM_PAUSE, lpDesc->dwInstance, 0L, 0L);
@@ -2928,7 +2929,7 @@
 {
 	LPWAVEOPENDESC	lpDesc;
 
-	dprintf_mmsys(stddeb, "waveOutRestart(%04X)\n", hWaveOut);
+	dprintf_info(mmsys, "waveOutRestart(%04X)\n", hWaveOut);
 	lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
 	if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
 	return wodMessage( lpDesc->uDeviceID, WODM_RESTART, lpDesc->dwInstance, 0L, 0L);
@@ -2948,7 +2949,7 @@
 UINT16 WINAPI waveOutReset16(HWAVEOUT16 hWaveOut)
 {
 	LPWAVEOPENDESC	lpDesc;
-	dprintf_mmsys(stddeb, "waveOutReset(%04X)\n", hWaveOut);
+	dprintf_info(mmsys, "waveOutReset(%04X)\n", hWaveOut);
 	lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
 	if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
 	return wodMessage( lpDesc->uDeviceID, WODM_RESET, lpDesc->dwInstance, 0L, 0L);
@@ -2972,7 +2973,7 @@
                                    UINT16 uSize)
 {
 	LPWAVEOPENDESC	lpDesc;
-	dprintf_mmsys(stddeb, "waveOutGetPosition(%04X, %p, %u);\n", hWaveOut, lpTime, uSize);
+	dprintf_info(mmsys, "waveOutGetPosition(%04X, %p, %u);\n", hWaveOut, lpTime, uSize);
 	lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
 	if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
 	return wodMessage( lpDesc->uDeviceID, WODM_GETPOS, lpDesc->dwInstance, 
@@ -2987,7 +2988,7 @@
 UINT16 WINAPI waveOut##xx##16(HWAVEOUT16 hWaveOut, atype x)		\
 {									\
 	LPWAVEOPENDESC	lpDesc;						\
-	dprintf_mmsys(stddeb, "waveOut"#xx"(%04X, %08lx);\n", hWaveOut,(DWORD)x);\
+	dprintf_info(mmsys, "waveOut"#xx"(%04X, %08lx);\n", hWaveOut,(DWORD)x);\
 	lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);		\
 	if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;		\
 	return wodMessage(lpDesc->uDeviceID, WODM_##XX, lpDesc->dwInstance,\
@@ -3006,7 +3007,7 @@
 }									\
 UINT16 WINAPI waveOut##xx##16(UINT16 devid, atype x)			\
 {									\
-	dprintf_mmsys(stddeb, "waveOut"#xx"(%04X, %08lx);\n", devid,(DWORD)x);	\
+	dprintf_info(mmsys, "waveOut"#xx"(%04X, %08lx);\n", devid,(DWORD)x);	\
 	return wodMessage(devid, WODM_##XX, 0L,	(DWORD)x, 0L);		\
 }
 	
@@ -3027,7 +3028,7 @@
  */
 UINT16 WINAPI waveOutBreakLoop16(HWAVEOUT16 hWaveOut)
 {
-	dprintf_mmsys(stddeb, "waveOutBreakLoop(%04X)\n", hWaveOut);
+	dprintf_info(mmsys, "waveOutBreakLoop(%04X)\n", hWaveOut);
 	return MMSYSERR_INVALHANDLE;
 }
 
@@ -3037,7 +3038,7 @@
 UINT32 WINAPI waveOutGetID32(HWAVEOUT32 hWaveOut, UINT32 * lpuDeviceID)
 {
 	LPWAVEOPENDESC	lpDesc;
-	dprintf_mmsys(stddeb, "waveOutGetID(%04X, %p);\n", hWaveOut, lpuDeviceID);
+	dprintf_info(mmsys, "waveOutGetID(%04X, %p);\n", hWaveOut, lpuDeviceID);
 	lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
 	if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
 	if (lpuDeviceID == NULL) return MMSYSERR_INVALHANDLE;
@@ -3050,7 +3051,7 @@
 UINT16 WINAPI waveOutGetID16(HWAVEOUT16 hWaveOut, UINT16 * lpuDeviceID)
 {
 	LPWAVEOPENDESC	lpDesc;
-	dprintf_mmsys(stddeb, "waveOutGetID(%04X, %p);\n", hWaveOut, lpuDeviceID);
+	dprintf_info(mmsys, "waveOutGetID(%04X, %p);\n", hWaveOut, lpuDeviceID);
 	lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
 	if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
 	if (lpuDeviceID == NULL) return MMSYSERR_INVALHANDLE;
@@ -3164,9 +3165,9 @@
 UINT16 WINAPI waveInGetNumDevs16()
 {
 	UINT16	count = 0;
-	dprintf_mmsys(stddeb, "waveInGetNumDevs\n");
+	dprintf_info(mmsys, "waveInGetNumDevs\n");
 	count += widMessage(0, WIDM_GETNUMDEVS, 0L, 0L, 0L);
-	dprintf_mmsys(stddeb, "waveInGetNumDevs return %u \n", count);
+	dprintf_info(mmsys, "waveInGetNumDevs return %u \n", count);
 	return count;
 }
 
@@ -3208,7 +3209,7 @@
  */
 UINT16 WINAPI waveInGetDevCaps16(UINT16 uDeviceID, LPWAVEINCAPS16 lpCaps, UINT16 uSize)
 {
-	dprintf_mmsys(stddeb, "waveInGetDevCaps\n");
+	dprintf_info(mmsys, "waveInGetDevCaps\n");
 	return widMessage(uDeviceID, WIDM_GETDEVCAPS, 0L, (DWORD)lpCaps, uSize);
 }
 
@@ -3217,7 +3218,7 @@
  */
 UINT32 WINAPI waveInGetErrorText32A(UINT32 uError, LPSTR lpText, UINT32 uSize)
 {
-   dprintf_mmsys(stddeb, "waveInGetErrorText\n");
+   dprintf_info(mmsys, "waveInGetErrorText\n");
    return(waveGetErrorText(uError, lpText, uSize));
 }
 
@@ -3239,7 +3240,7 @@
  */
 UINT16 WINAPI waveInGetErrorText16(UINT16 uError, LPSTR lpText, UINT16 uSize)
 {
-   dprintf_mmsys(stddeb, "waveInGetErrorText\n");
+   dprintf_info(mmsys, "waveInGetErrorText\n");
    return(waveGetErrorText(uError, lpText, uSize));
 }
 
@@ -3268,12 +3269,12 @@
 	LPWAVEOPENDESC	lpDesc;
 	DWORD	dwRet = 0;
 	BOOL32	bMapperFlg = FALSE;
-	dprintf_mmsys(stddeb, "waveInOpen(%p, %d, %p, %08lX, %08lX, %08lX);\n", 
+	dprintf_info(mmsys, "waveInOpen(%p, %d, %p, %08lX, %08lX, %08lX);\n", 
 		lphWaveIn, uDeviceID, lpFormat, dwCallback, dwInstance, dwFlags);
 	if (dwFlags & WAVE_FORMAT_QUERY)
-		dprintf_mmsys(stddeb, "waveInOpen // WAVE_FORMAT_QUERY requested !\n");
+		dprintf_info(mmsys, "waveInOpen // WAVE_FORMAT_QUERY requested !\n");
 	if (uDeviceID == (UINT16)WAVE_MAPPER) {
-		dprintf_mmsys(stddeb, "waveInOpen	// WAVE_MAPPER mode requested !\n");
+		dprintf_info(mmsys, "waveInOpen	// WAVE_MAPPER mode requested !\n");
 		bMapperFlg = TRUE;
 		uDeviceID = 0;
 	}
@@ -3292,11 +3293,11 @@
 		if (dwRet == MMSYSERR_NOERROR) break;
 		if (!bMapperFlg) break;
 		uDeviceID++;
-		dprintf_mmsys(stddeb, "waveInOpen	// WAVE_MAPPER mode ! try next driver...\n");
+		dprintf_info(mmsys, "waveInOpen	// WAVE_MAPPER mode ! try next driver...\n");
 	}
 	lpDesc->uDeviceID = uDeviceID;
 	if (dwFlags & WAVE_FORMAT_QUERY) {
-		dprintf_mmsys(stddeb, "waveInOpen	// End of WAVE_FORMAT_QUERY !\n");
+		dprintf_info(mmsys, "waveInOpen	// End of WAVE_FORMAT_QUERY !\n");
 		dwRet = waveInClose16(hWaveIn);
 	}
 	return dwRet;
@@ -3316,7 +3317,7 @@
 {
 	LPWAVEOPENDESC	lpDesc;
 
-	dprintf_mmsys(stddeb, "waveInClose(%04X)\n", hWaveIn);
+	dprintf_info(mmsys, "waveInClose(%04X)\n", hWaveIn);
 	lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
 	if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
 	return widMessage(lpDesc->uDeviceID, WIDM_CLOSE, lpDesc->dwInstance, 0L, 0L);
@@ -3330,7 +3331,7 @@
 {
 	LPWAVEOPENDESC	lpDesc;
 
-	dprintf_mmsys(stddeb, "waveInPrepareHeader(%04X, %p, %u);\n", 
+	dprintf_info(mmsys, "waveInPrepareHeader(%04X, %p, %u);\n", 
 					hWaveIn, lpWaveInHdr, uSize);
 	lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
 	if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
@@ -3338,7 +3339,7 @@
 	lpWaveInHdr = lpWaveInHdr;
 	lpWaveInHdr->lpNext = NULL;
     	lpWaveInHdr->dwBytesRecorded = 0;
-	dprintf_mmsys(stddeb, "waveInPrepareHeader // lpData=%p size=%lu \n", 
+	dprintf_info(mmsys, "waveInPrepareHeader // lpData=%p size=%lu \n", 
 		lpWaveInHdr->lpData, lpWaveInHdr->dwBufferLength);
 	return widMessage(lpDesc->uDeviceID,WIDM_PREPARE,lpDesc->dwInstance, 
 			  (DWORD)lpWaveInHdr, uSize);
@@ -3353,7 +3354,7 @@
 	LPBYTE		saveddata = lpWaveInHdr->lpData;
 	UINT16		ret;
 
-	dprintf_mmsys(stddeb, "waveInPrepareHeader(%04X, %p, %u);\n", 
+	dprintf_info(mmsys, "waveInPrepareHeader(%04X, %p, %u);\n", 
 					hWaveIn, lpWaveInHdr, uSize);
 	lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
 	if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
@@ -3362,7 +3363,7 @@
 	lpWaveInHdr->lpNext = NULL;
     	lpWaveInHdr->dwBytesRecorded = 0;
 
-	dprintf_mmsys(stddeb, "waveInPrepareHeader // lpData=%p size=%lu \n", 
+	dprintf_info(mmsys, "waveInPrepareHeader // lpData=%p size=%lu \n", 
 		lpWaveInHdr->lpData, lpWaveInHdr->dwBufferLength);
 	lpWaveInHdr->lpData = PTR_SEG_TO_LIN(lpWaveInHdr->lpData);
 	ret = widMessage(lpDesc->uDeviceID,WIDM_PREPARE,lpDesc->dwInstance, 
@@ -3380,7 +3381,7 @@
 {
 	LPWAVEOPENDESC	lpDesc;
 
-	dprintf_mmsys(stddeb, "waveInUnprepareHeader(%04X, %p, %u);\n", 
+	dprintf_info(mmsys, "waveInUnprepareHeader(%04X, %p, %u);\n", 
 						hWaveIn, lpWaveInHdr, uSize);
 	lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
 	if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
@@ -3399,7 +3400,7 @@
 {
 	LPWAVEOPENDESC	lpDesc;
 
-	dprintf_mmsys(stddeb, "waveInUnprepareHeader(%04X, %p, %u);\n", 
+	dprintf_info(mmsys, "waveInUnprepareHeader(%04X, %p, %u);\n", 
 						hWaveIn, lpWaveInHdr, uSize);
 	lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
 	if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
@@ -3419,13 +3420,13 @@
 {
 	LPWAVEOPENDESC	lpDesc;
 
-	dprintf_mmsys(stddeb, "waveInAddBuffer(%04X, %p, %u);\n", hWaveIn, lpWaveInHdr, uSize);
+	dprintf_info(mmsys, "waveInAddBuffer(%04X, %p, %u);\n", hWaveIn, lpWaveInHdr, uSize);
 	lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
 	if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
 	if (lpWaveInHdr == NULL) return MMSYSERR_INVALHANDLE;
 	lpWaveInHdr->lpNext = NULL;
 	lpWaveInHdr->dwBytesRecorded = 0;
-	dprintf_mmsys(stddeb, "waveInAddBuffer // lpData=%p size=%lu \n", 
+	dprintf_info(mmsys, "waveInAddBuffer // lpData=%p size=%lu \n", 
 		lpWaveInHdr->lpData, lpWaveInHdr->dwBufferLength);
 	return widMessage(lpDesc->uDeviceID, WIDM_ADDBUFFER, lpDesc->dwInstance,
 								(DWORD)lpWaveInHdr, uSize);
@@ -3441,14 +3442,14 @@
 	LPWAVEOPENDESC	lpDesc;
 	UINT16		ret;
 
-	dprintf_mmsys(stddeb, "waveInAddBuffer(%04X, %p, %u);\n", hWaveIn, lpWaveInHdr, uSize);
+	dprintf_info(mmsys, "waveInAddBuffer(%04X, %p, %u);\n", hWaveIn, lpWaveInHdr, uSize);
 	lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
 	if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
 	if (lpWaveInHdr == NULL) return MMSYSERR_INVALHANDLE;
 	lpWaveInHdr->lpNext = NULL;
 	lpWaveInHdr->dwBytesRecorded = 0;
 	lpWaveInHdr->lpData = PTR_SEG_TO_LIN(lpWaveInHdr->lpData);
-	dprintf_mmsys(stddeb, "waveInAddBuffer // lpData=%p size=%lu \n", 
+	dprintf_info(mmsys, "waveInAddBuffer // lpData=%p size=%lu \n", 
 		lpWaveInHdr->lpData, lpWaveInHdr->dwBufferLength);
 	ret = widMessage(lpDesc->uDeviceID, WIDM_ADDBUFFER, lpDesc->dwInstance,
 			  (DWORD)lpWaveInHdr, uSize);
@@ -3471,7 +3472,7 @@
 {
 	LPWAVEOPENDESC	lpDesc;
 
-	dprintf_mmsys(stddeb, "waveInStart(%04X)\n", hWaveIn);
+	dprintf_info(mmsys, "waveInStart(%04X)\n", hWaveIn);
 	lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
 	if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
 	return widMessage(lpDesc->uDeviceID,WIDM_START,lpDesc->dwInstance,0,0);
@@ -3492,7 +3493,7 @@
 {
 	LPWAVEOPENDESC	lpDesc;
 
-	dprintf_mmsys(stddeb, "waveInStop(%04X)\n", hWaveIn);
+	dprintf_info(mmsys, "waveInStop(%04X)\n", hWaveIn);
 	lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
 	if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
 	return widMessage(lpDesc->uDeviceID, WIDM_STOP, lpDesc->dwInstance, 0L, 0L);
@@ -3513,7 +3514,7 @@
 {
 	LPWAVEOPENDESC	lpDesc;
 
-	dprintf_mmsys(stddeb, "waveInReset(%04X)\n", hWaveIn);
+	dprintf_info(mmsys, "waveInReset(%04X)\n", hWaveIn);
 	lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
 	if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
 	return widMessage(lpDesc->uDeviceID,WIDM_RESET,lpDesc->dwInstance,0,0);
@@ -3540,7 +3541,7 @@
 {
 	LPWAVEOPENDESC	lpDesc;
 
-	dprintf_mmsys(stddeb, "waveInGetPosition(%04X, %p, %u);\n", hWaveIn, lpTime, uSize);
+	dprintf_info(mmsys, "waveInGetPosition(%04X, %p, %u);\n", hWaveIn, lpTime, uSize);
 	lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
 	if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
 	return widMessage(lpDesc->uDeviceID, WIDM_GETPOS, lpDesc->dwInstance,
@@ -3554,7 +3555,7 @@
 {
 	LPWAVEOPENDESC	lpDesc;
 
-	dprintf_mmsys(stddeb, "waveInGetID\n");
+	dprintf_info(mmsys, "waveInGetID\n");
 	if (lpuDeviceID == NULL) return MMSYSERR_INVALHANDLE;
 	lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
 	if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
@@ -3570,7 +3571,7 @@
 {
 	LPWAVEOPENDESC	lpDesc;
 
-	dprintf_mmsys(stddeb, "waveInGetID\n");
+	dprintf_info(mmsys, "waveInGetID\n");
 	if (lpuDeviceID == NULL) return MMSYSERR_INVALHANDLE;
 	lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
 	if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
@@ -3662,7 +3663,7 @@
 */
 HDRVR16 WINAPI DrvOpen(LPSTR lpDriverName, LPSTR lpSectionName, LPARAM lParam)
 {
-	dprintf_mmsys(stddeb, "DrvOpen('%s', '%s', %08lX);\n",
+	dprintf_info(mmsys, "DrvOpen('%s', '%s', %08lX);\n",
 		lpDriverName, lpSectionName, lParam);
 	return OpenDriver(lpDriverName, lpSectionName, lParam);
 }
@@ -3673,7 +3674,7 @@
 */
 LRESULT WINAPI DrvClose(HDRVR16 hDrvr, LPARAM lParam1, LPARAM lParam2)
 {
-	dprintf_mmsys(stddeb, "DrvClose(%04X, %08lX, %08lX);\n", hDrvr, lParam1, lParam2);
+	dprintf_info(mmsys, "DrvClose(%04X, %08lX, %08lX);\n", hDrvr, lParam1, lParam2);
 	return CloseDriver(hDrvr, lParam1, lParam2);
 }
 
@@ -3685,7 +3686,7 @@
                               LPARAM lParam2)
 {
 	DWORD 	dwDriverID = 0;
-	dprintf_mmsys(stddeb, "DrvSendMessage(%04X, %04X, %08lX, %08lX);\n",
+	dprintf_info(mmsys, "DrvSendMessage(%04X, %04X, %08lX, %08lX);\n",
 					hDriver, msg, lParam1, lParam2);
 	return CDAUDIO_DriverProc(dwDriverID, hDriver, msg, lParam1, lParam2);
 }
@@ -3695,7 +3696,7 @@
 */
 HANDLE16 WINAPI DrvGetModuleHandle(HDRVR16 hDrvr)
 {
-	dprintf_mmsys(stddeb, "DrvGetModuleHandle(%04X);\n", hDrvr);
+	dprintf_info(mmsys, "DrvGetModuleHandle(%04X);\n", hDrvr);
         return 0;
 }
 
diff --git a/multimedia/time.c b/multimedia/time.c
index 5a6d267..0e60234 100644
--- a/multimedia/time.c
+++ b/multimedia/time.c
@@ -15,7 +15,6 @@
 #include "user.h"
 #include "driver.h"
 #include "mmsystem.h"
-#include "stddebug.h"
 #include "debug.h"
 #include "xmalloc.h"
 
@@ -61,10 +60,10 @@
 	    lpTimer->wCurTime = lpTimer->wDelay;
 
 	    if (lpTimer->lpFunc != (FARPROC16) NULL) {
-		dprintf_mmtime(stddeb, "MMSysTimeCallback // before CallBack16 !\n");
-		dprintf_mmtime(stddeb, "MMSysTimeCallback // lpFunc=%p wTimerID=%04X dwUser=%08lX !\n",
+		dprintf_info(mmtime, "MMSysTimeCallback // before CallBack16 !\n");
+		dprintf_info(mmtime, "MMSysTimeCallback // lpFunc=%p wTimerID=%04X dwUser=%08lX !\n",
 			lpTimer->lpFunc, lpTimer->wTimerID, lpTimer->dwUser);
-		dprintf_mmtime(stddeb, "MMSysTimeCallback // hInstance=%04X !\n", lpTimer->hInstance);
+		dprintf_info(mmtime, "MMSysTimeCallback // hInstance=%04X !\n", lpTimer->hInstance);
 
 
 /*        - TimeProc callback that is called here is something strange, under Windows 3.1x it is called 
@@ -80,7 +79,7 @@
 						    lpTimer->dwUser,0,0
 			);
 
-		dprintf_mmtime(stddeb, "MMSysTimeCallback // after CallBack16 !\n");
+		dprintf_info(mmtime, "MMSysTimeCallback // after CallBack16 !\n");
 	    }
 	    if (lpTimer->wFlags & TIME_ONESHOT)
 		timeKillEvent32(lpTimer->wTimerID);
@@ -104,16 +103,16 @@
 	    lpTimer->wCurTime = lpTimer->wDelay;
 
 	    if (lpTimer->lpFunc != (FARPROC16) NULL) {
-		dprintf_mmtime(stddeb, "MMSysTimeCallback // before CallBack16 !\n");
-		dprintf_mmtime(stddeb, "MMSysTimeCallback // lpFunc=%p wTimerID=%04X dwUser=%08lX !\n",
+		dprintf_info(mmtime, "MMSysTimeCallback // before CallBack16 !\n");
+		dprintf_info(mmtime, "MMSysTimeCallback // lpFunc=%p wTimerID=%04X dwUser=%08lX !\n",
 			lpTimer->lpFunc, lpTimer->wTimerID, lpTimer->dwUser);
-		dprintf_mmtime(stddeb, "MMSysTimeCallback // hInstance=%04X !\n", lpTimer->hInstance);
+		dprintf_info(mmtime, "MMSysTimeCallback // hInstance=%04X !\n", lpTimer->hInstance);
 
 /* This is wrong (lpFunc is NULL all the time)
 
    	        lpFunc = MODULE_GetEntryPoint( lpTimer->hInstance,
                          MODULE_GetOrdinal(lpTimer->hInstance,"TimerCallBack" ));
-		dprintf_mmtime(stddeb, "MMSysTimeCallback // lpFunc=%08lx !\n", lpFunc);
+		dprintf_info(mmtime, "MMSysTimeCallback // lpFunc=%08lx !\n", lpFunc);
 */
 
 
@@ -130,7 +129,7 @@
 						    lpTimer->dwUser,0,0
 			);
 
-		dprintf_mmtime(stddeb, "MMSysTimeCallback // after CallBack16 !\n");
+		dprintf_info(mmtime, "MMSysTimeCallback // after CallBack16 !\n");
 		fflush(stdout);
 	    }
 	    if (lpTimer->wFlags & TIME_ONESHOT)
@@ -165,7 +164,7 @@
  */
 MMRESULT32 WINAPI timeGetSystemTime32(LPMMTIME32 lpTime, UINT32 wSize)
 {
-    dprintf_mmsys(stddeb, "timeGetSystemTime32(%p, %u);\n", lpTime, wSize);
+    dprintf_info(mmsys, "timeGetSystemTime32(%p, %u);\n", lpTime, wSize);
     if (!mmTimeStarted)
 	StartMMTime();
     lpTime->wType = TIME_MS;
@@ -178,7 +177,7 @@
  */
 MMRESULT16 WINAPI timeGetSystemTime16(LPMMTIME16 lpTime, UINT16 wSize)
 {
-    dprintf_mmsys(stddeb, "timeGetSystemTime16(%p, %u);\n", lpTime, wSize);
+    dprintf_info(mmsys, "timeGetSystemTime16(%p, %u);\n", lpTime, wSize);
     if (!mmTimeStarted)
 	StartMMTime();
     lpTime->wType = TIME_MS;
@@ -197,7 +196,7 @@
     LPTIMERENTRY lpNewTimer;
     LPTIMERENTRY lpTimer = lpTimerList;
 
-    dprintf_mmtime(stddeb, "timeSetEvent32(%u, %u, %p, %08lX, %04X);\n",
+    dprintf_info(mmtime, "timeSetEvent32(%u, %u, %p, %08lX, %04X);\n",
 		  wDelay, wResol, lpFunc, dwUser, wFlags);
     if (!mmTimeStarted)
 	StartMMTime();
@@ -219,8 +218,8 @@
     lpNewTimer->lpFunc = (FARPROC16) lpFunc;
     lpNewTimer->iswin32 = 1;
     lpNewTimer->hInstance = GetTaskDS();
-	dprintf_mmtime(stddeb, "timeSetEvent // hInstance=%04X !\n", lpNewTimer->hInstance);
-	dprintf_mmtime(stddeb, "timeSetEvent // lpFunc=%p !\n", 
+	dprintf_info(mmtime, "timeSetEvent // hInstance=%04X !\n", lpNewTimer->hInstance);
+	dprintf_info(mmtime, "timeSetEvent // lpFunc=%p !\n", 
 				lpFunc);
     lpNewTimer->dwUser = dwUser;
     lpNewTimer->wFlags = wFlags;
@@ -237,7 +236,7 @@
     WORD wNewID = 0;
     LPTIMERENTRY lpNewTimer;
     LPTIMERENTRY lpTimer = lpTimerList;
-    dprintf_mmtime(stddeb, "timeSetEvent(%u, %u, %p, %08lX, %04X);\n",
+    dprintf_info(mmtime, "timeSetEvent(%u, %u, %p, %08lX, %04X);\n",
 		  wDelay, wResol, lpFunc, dwUser, wFlags);
     if (!mmTimeStarted)
 	StartMMTime();
@@ -259,8 +258,8 @@
     lpNewTimer->lpFunc = (FARPROC16) lpFunc;
     lpNewTimer->iswin32 = 0;
     lpNewTimer->hInstance = GetTaskDS();
-	dprintf_mmtime(stddeb, "timeSetEvent // hInstance=%04X !\n", lpNewTimer->hInstance);
-	dprintf_mmtime(stddeb, "timeSetEvent // PTR_SEG_TO_LIN(lpFunc)=%p !\n", 
+	dprintf_info(mmtime, "timeSetEvent // hInstance=%04X !\n", lpNewTimer->hInstance);
+	dprintf_info(mmtime, "timeSetEvent // PTR_SEG_TO_LIN(lpFunc)=%p !\n", 
 				PTR_SEG_TO_LIN(lpFunc));
     lpNewTimer->dwUser = dwUser;
     lpNewTimer->wFlags = wFlags;
@@ -298,7 +297,7 @@
  */
 MMRESULT32 WINAPI timeGetDevCaps32(LPTIMECAPS32 lpCaps,UINT32 wSize)
 {
-    dprintf_mmtime(stddeb, "timeGetDevCaps(%p, %u) !\n", lpCaps, wSize);
+    dprintf_info(mmtime, "timeGetDevCaps(%p, %u) !\n", lpCaps, wSize);
     if (!mmTimeStarted)
 	StartMMTime();
     lpCaps->wPeriodMin = MMSYSTIME_MININTERVAL;
@@ -311,7 +310,7 @@
  */
 MMRESULT16 WINAPI timeGetDevCaps16(LPTIMECAPS16 lpCaps, UINT16 wSize)
 {
-    dprintf_mmtime(stddeb, "timeGetDevCaps(%p, %u) !\n", lpCaps, wSize);
+    dprintf_info(mmtime, "timeGetDevCaps(%p, %u) !\n", lpCaps, wSize);
     if (!mmTimeStarted)
 	StartMMTime();
     lpCaps->wPeriodMin = MMSYSTIME_MININTERVAL;
@@ -324,7 +323,7 @@
  */
 MMRESULT32 WINAPI timeBeginPeriod32(UINT32 wPeriod)
 {
-    dprintf_mmtime(stddeb, "timeBeginPeriod32(%u) !\n", wPeriod);
+    dprintf_info(mmtime, "timeBeginPeriod32(%u) !\n", wPeriod);
     if (!mmTimeStarted)
 	StartMMTime();
     if (wPeriod < MMSYSTIME_MININTERVAL || wPeriod > MMSYSTIME_MAXINTERVAL) 
@@ -336,7 +335,7 @@
  */
 MMRESULT16 WINAPI timeBeginPeriod16(UINT16 wPeriod)
 {
-    dprintf_mmtime(stddeb, "timeBeginPeriod(%u) !\n", wPeriod);
+    dprintf_info(mmtime, "timeBeginPeriod(%u) !\n", wPeriod);
     if (!mmTimeStarted)
 	StartMMTime();
     if (wPeriod < MMSYSTIME_MININTERVAL || wPeriod > MMSYSTIME_MAXINTERVAL) 
@@ -349,7 +348,7 @@
  */
 MMRESULT32 WINAPI timeEndPeriod32(UINT32 wPeriod)
 {
-    dprintf_mmtime(stddeb, "timeEndPeriod(%u) !\n", wPeriod);
+    dprintf_info(mmtime, "timeEndPeriod(%u) !\n", wPeriod);
     if (wPeriod < MMSYSTIME_MININTERVAL || wPeriod > MMSYSTIME_MAXINTERVAL) 
         return TIMERR_NOCANDO;
     return 0;
@@ -360,7 +359,7 @@
  */
 MMRESULT16 WINAPI timeEndPeriod16(UINT16 wPeriod)
 {
-    dprintf_mmtime(stddeb, "timeEndPeriod(%u) !\n", wPeriod);
+    dprintf_info(mmtime, "timeEndPeriod(%u) !\n", wPeriod);
     if (wPeriod < MMSYSTIME_MININTERVAL || wPeriod > MMSYSTIME_MAXINTERVAL) 
         return TIMERR_NOCANDO;
     return 0;
@@ -374,7 +373,7 @@
     static DWORD lasttick=0;
     DWORD	newtick;
 
-    dprintf_mmtime(stddeb, "timeGetTime(); !\n");
+    dprintf_info(mmtime, "timeGetTime(); !\n");
     if (!mmTimeStarted)
 	StartMMTime();
     newtick = GetTickCount();
@@ -382,7 +381,7 @@
     if (newtick!=lasttick)
     	check_MMtimers();
     lasttick = newtick;
-    dprintf_mmtime(stddeb, "timeGetTime() // Time = %ld\n",mmSysTimeMS.u.ms);
+    dprintf_info(mmtime, "timeGetTime() // Time = %ld\n",mmSysTimeMS.u.ms);
 
 
     return mmSysTimeMS.u.ms;
diff --git a/objects/bitmap.c b/objects/bitmap.c
index 7d8a36d..df9bd2a 100644
--- a/objects/bitmap.c
+++ b/objects/bitmap.c
@@ -14,7 +14,6 @@
 #include "dc.h"
 #include "bitmap.h"
 #include "heap.h"
-#include "stddebug.h"
 #include "debug.h"
 
 #ifdef PRELIMINARY_WING16_SUPPORT
@@ -143,7 +142,7 @@
     planes = (BYTE)planes;
     bpp    = (BYTE)bpp;
 
-    dprintf_gdi( stddeb, "CreateBitmap: %dx%d, %d colors\n", 
+    dprintf_info(gdi, "CreateBitmap: %dx%d, %d colors\n", 
                  width, height, 1 << (planes*bpp) );
 
       /* Check parameters */
@@ -199,11 +198,11 @@
     HBITMAP32 hbmpRet = 0;
     DC *dc;
 
-    dprintf_gdi( stddeb, "CreateCompatibleBitmap(%04x,%d,%d) = \n", 
+    dprintf_info(gdi, "CreateCompatibleBitmap(%04x,%d,%d) = \n", 
                  hdc, width, height );
     if (!(dc = DC_GetDCPtr( hdc ))) return 0;
     hbmpRet = CreateBitmap32( width, height, 1, dc->w.bitsPerPixel, NULL );
-    dprintf_gdi(stddeb,"\t\t%04x\n", hbmpRet);
+    dprintf_info(gdi,"\t\t%04x\n", hbmpRet);
     return hbmpRet;
 }
 
@@ -272,7 +271,7 @@
     height = count / bmp->bitmap.bmWidthBytes;
     if (height > bmp->bitmap.bmHeight) height = bmp->bitmap.bmHeight;
 
-    dprintf_bitmap(stddeb, "GetBitmapBits: %dx%d %d colors %p fetched height: %ld\n",
+    dprintf_info(bitmap, "GetBitmapBits: %dx%d %d colors %p fetched height: %ld\n",
 	    bmp->bitmap.bmWidth, bmp->bitmap.bmHeight,
 	    1 << bmp->bitmap.bmBitsPixel, buffer, height );
 
@@ -395,7 +394,7 @@
     bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
     if (!bmp) return 0;
 
-    dprintf_bitmap(stddeb, "SetBitmapBits: %dx%d %d colors %p\n",
+    dprintf_info(bitmap, "SetBitmapBits: %dx%d %d colors %p\n",
 	    bmp->bitmap.bmWidth, bmp->bitmap.bmHeight,
 	    1 << bmp->bitmap.bmBitsPixel, buffer );
 
@@ -506,11 +505,11 @@
 	}
 	switch (type) {
 	case IMAGE_BITMAP:
-		return LoadBitmap16(hinst,name);
+		return LoadBitmap16(hinst,(SEGPTR)name);
 	case IMAGE_ICON:
-		return LoadIcon16(hinst,name);
+		return LoadIcon16(hinst,(SEGPTR)name);
 	case IMAGE_CURSOR:
-		return LoadCursor16(hinst,name);
+		return LoadCursor16(hinst,(SEGPTR)name);
 	}
 	return 0;
 	
@@ -525,11 +524,11 @@
                               INT32 desiredx, INT32 desiredy, UINT32 loadflags)
 {
 	if (HIWORD(name)) {
-		dprintf_resource(stddeb,"LoadImage32A(0x%04x,%s,%d,%d,%d,0x%08x)\n",
+		dprintf_info(resource,"LoadImage32A(0x%04x,%s,%d,%d,%d,0x%08x)\n",
 			hinst,name,type,desiredx,desiredy,loadflags
 		);
 	} else {
-		dprintf_resource(stddeb,"LoadImage32A(0x%04x,%p,%d,%d,%d,0x%08x)\n",
+		dprintf_info(resource,"LoadImage32A(0x%04x,%p,%d,%d,%d,0x%08x)\n",
 			hinst,name,type,desiredx,desiredy,loadflags
 		);
 	}
@@ -548,11 +547,11 @@
                               INT32 desiredx, INT32 desiredy, UINT32 loadflags)
 {
 	if (HIWORD(name)) {
-		dprintf_resource(stddeb,"LoadImage32W(0x%04x,%p,%d,%d,%d,0x%08x)\n",
+		dprintf_info(resource,"LoadImage32W(0x%04x,%p,%d,%d,%d,0x%08x)\n",
 			hinst,name,type,desiredx,desiredy,loadflags
 		);
 	} else {
-		dprintf_resource(stddeb,"LoadImage32W(0x%04x,%p,%d,%d,%d,0x%08x)\n",
+		dprintf_info(resource,"LoadImage32W(0x%04x,%p,%d,%d,%d,0x%08x)\n",
 			hinst,name,type,desiredx,desiredy,loadflags
 		);
 	}
@@ -620,11 +619,11 @@
     if (HIWORD(name))
     {
         char *str = (char *)PTR_SEG_TO_LIN( name );
-        dprintf_bitmap( stddeb, "LoadBitmap16(%04x,'%s')\n", instance, str );
+        dprintf_info(bitmap, "LoadBitmap16(%04x,'%s')\n", instance, str );
         if (str[0] == '#') name = (SEGPTR)(DWORD)(WORD)atoi( str + 1 );
     }
     else
-        dprintf_bitmap( stddeb, "LoadBitmap16(%04x,%04x)\n",
+        dprintf_info(bitmap, "LoadBitmap16(%04x,%04x)\n",
                         instance, LOWORD(name) );
 
     if (!instance)  /* OEM bitmap */
diff --git a/objects/brush.c b/objects/brush.c
index 88a232b..af68d4c 100644
--- a/objects/brush.c
+++ b/objects/brush.c
@@ -9,7 +9,6 @@
 #include "bitmap.h"
 #include "metafile.h"
 #include "color.h"
-#include "stddebug.h"
 #include "debug.h"
 
 
@@ -53,7 +52,7 @@
 HBRUSH16 WINAPI CreateHatchBrush16( INT16 style, COLORREF color )
 {
     LOGBRUSH32 logbrush = { BS_HATCHED, color, style };
-    dprintf_gdi(stddeb, "CreateHatchBrush16: %d %06lx\n", style, color );
+    dprintf_info(gdi, "CreateHatchBrush16: %d %06lx\n", style, color );
     if ((style < 0) || (style >= NB_HATCH_STYLES)) return 0;
     return CreateBrushIndirect32( &logbrush );
 }
@@ -65,7 +64,7 @@
 HBRUSH32 WINAPI CreateHatchBrush32( INT32 style, COLORREF color )
 {
     LOGBRUSH32 logbrush = { BS_HATCHED, color, style };
-    dprintf_gdi(stddeb, "CreateHatchBrush32: %d %06lx\n", style, color );
+    dprintf_info(gdi, "CreateHatchBrush32: %d %06lx\n", style, color );
     if ((style < 0) || (style >= NB_HATCH_STYLES)) return 0;
     return CreateBrushIndirect32( &logbrush );
 }
@@ -88,7 +87,7 @@
     LOGBRUSH32 logbrush = { BS_PATTERN, 0, 0 };
     BITMAPOBJ *bmp, *newbmp;
 
-    dprintf_gdi(stddeb, "CreatePatternBrush: %04x\n", hbitmap );
+    dprintf_info(gdi, "CreatePatternBrush: %04x\n", hbitmap );
 
       /* Make a copy of the bitmap */
 
@@ -119,7 +118,7 @@
     BITMAPINFO *info, *newInfo;
     INT32 size;
     
-    dprintf_gdi(stddeb, "CreateDIBPatternBrush: %04x\n", hbitmap );
+    dprintf_info(gdi, "CreateDIBPatternBrush: %04x\n", hbitmap );
 
       /* Make a copy of the bitmap */
 
@@ -154,7 +153,7 @@
     BITMAPINFO *info, *newInfo;
     INT32 size;
     
-    dprintf_gdi(stddeb, "CreateDIBPatternBrush: %04x\n", hbitmap );
+    dprintf_info(gdi, "CreateDIBPatternBrush: %04x\n", hbitmap );
 
       /* Make a copy of the bitmap */
 
@@ -186,7 +185,7 @@
 HBRUSH16 WINAPI CreateSolidBrush16( COLORREF color )
 {
     LOGBRUSH32 logbrush = { BS_SOLID, color, 0 };
-    dprintf_gdi(stddeb, "CreateSolidBrush16: %06lx\n", color );
+    dprintf_info(gdi, "CreateSolidBrush16: %06lx\n", color );
     return CreateBrushIndirect32( &logbrush );
 }
 
@@ -197,7 +196,7 @@
 HBRUSH32 WINAPI CreateSolidBrush32( COLORREF color )
 {
     LOGBRUSH32 logbrush = { BS_SOLID, color, 0 };
-    dprintf_gdi(stddeb, "CreateSolidBrush32: %06lx\n", color );
+    dprintf_info(gdi, "CreateSolidBrush32: %06lx\n", color );
     return CreateBrushIndirect32( &logbrush );
 }
 
diff --git a/objects/clipping.c b/objects/clipping.c
index 7f9acb2..c435711 100644
--- a/objects/clipping.c
+++ b/objects/clipping.c
@@ -8,7 +8,6 @@
 #include "dc.h"
 #include "metafile.h"
 #include "region.h"
-#include "stddebug.h"
 #include "debug.h"
 
 #define UPDATE_DIRTY_DC(dc) \
@@ -66,7 +65,7 @@
     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
     if (!dc) return ERROR;
 
-    dprintf_clipping(stddeb, "SelectClipRgn: %04x %04x\n", hdc, hrgn );
+    dprintf_info(clipping, "SelectClipRgn: %04x %04x\n", hdc, hrgn );
 
     if (hrgn)
     {
@@ -95,7 +94,7 @@
     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
     if (!dc || !hrgn) return ERROR;
 
-    dprintf_clipping(stddeb, "SelectVisRgn: %04x %04x\n", hdc, hrgn );
+    dprintf_info(clipping, "SelectVisRgn: %04x %04x\n", hdc, hrgn );
 
     dc->w.flags &= ~DC_DIRTY;
 
@@ -130,7 +129,7 @@
 	return NULLREGION;   /* ?? */
     }
 
-    dprintf_clipping(stddeb, "OffsetClipRgn: %04x %d,%d\n", hdc, x, y );
+    dprintf_info(clipping, "OffsetClipRgn: %04x %d,%d\n", hdc, x, y );
 
     if (dc->w.hClipRgn)
     {
@@ -152,7 +151,7 @@
     INT16 retval;
     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
     if (!dc) return ERROR;    
-    dprintf_clipping(stddeb, "OffsetVisRgn: %04x %d,%d\n", hdc, x, y );
+    dprintf_info(clipping, "OffsetVisRgn: %04x %d,%d\n", hdc, x, y );
     retval = OffsetRgn32( dc->w.hVisRgn, x, y );
     CLIPPING_UpdateGCRegion( dc );
     GDI_HEAP_UNLOCK( hdc );
@@ -229,7 +228,7 @@
     top    = YLPTODP( dc, top );
     bottom = YLPTODP( dc, bottom );
 
-    dprintf_clipping(stddeb, "ExcludeClipRect: %04x %dx%d,%dx%d\n",
+    dprintf_info(clipping, "ExcludeClipRect: %04x %dx%d,%dx%d\n",
 	    hdc, left, top, right, bottom );
     ret = CLIPPING_IntersectClipRect( dc, left, top, right, bottom, CLIP_EXCLUDE );
     GDI_HEAP_UNLOCK( hdc );
@@ -269,7 +268,7 @@
     top    = YLPTODP( dc, top );
     bottom = YLPTODP( dc, bottom );
 
-    dprintf_clipping(stddeb, "IntersectClipRect: %04x %dx%d,%dx%d\n",
+    dprintf_info(clipping, "IntersectClipRect: %04x %dx%d,%dx%d\n",
 	    hdc, left, top, right, bottom );
     ret = CLIPPING_IntersectClipRect( dc, left, top, right, bottom, CLIP_INTERSECT );
     GDI_HEAP_UNLOCK( hdc );
@@ -327,7 +326,7 @@
 {
     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
     if (!dc) return ERROR;    
-    dprintf_clipping(stddeb, "ExcludeVisRect: %04x %dx%d,%dx%d\n",
+    dprintf_info(clipping, "ExcludeVisRect: %04x %dx%d,%dx%d\n",
 	    hdc, left, top, right, bottom );
 
     return CLIPPING_IntersectVisRect( dc, left, top, right, bottom, TRUE );
@@ -342,7 +341,7 @@
 {
     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
     if (!dc) return ERROR;    
-    dprintf_clipping(stddeb, "IntersectVisRect: %04x %dx%d,%dx%d\n",
+    dprintf_info(clipping, "IntersectVisRect: %04x %dx%d,%dx%d\n",
 	    hdc, left, top, right, bottom );
 
     return CLIPPING_IntersectVisRect( dc, left, top, right, bottom, FALSE );
@@ -366,7 +365,7 @@
     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
     if (!dc) return ERROR;    
 
-    dprintf_clipping(stddeb, "PtVisible: %04x %d,%d\n", hdc, x, y );
+    dprintf_info(clipping, "PtVisible: %04x %d,%d\n", hdc, x, y );
     if (!dc->w.hGCClipRgn) return FALSE;
 
     if( dc->w.flags & DC_DIRTY ) UPDATE_DIRTY_DC(dc);
@@ -384,7 +383,7 @@
     RECT16 tmpRect;
     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
     if (!dc) return FALSE;
-    dprintf_clipping(stddeb,"RectVisible: %04x %d,%dx%d,%d\n",
+    dprintf_info(clipping,"RectVisible: %04x %d,%dx%d,%d\n",
                      hdc, rect->left, rect->top, rect->right, rect->bottom );
     if (!dc->w.hGCClipRgn) return FALSE;
     /* copy rectangle to avoid overwriting by LPtoDP */
@@ -461,7 +460,7 @@
     RGNOBJ *obj, *copyObj;
     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
     if (!dc) return 0;
-    dprintf_clipping(stddeb, "SaveVisRgn: %04x\n", hdc );
+    dprintf_info(clipping, "SaveVisRgn: %04x\n", hdc );
     if (!dc->w.hVisRgn)
     {
         fprintf( stderr, "SaveVisRgn: hVisRgn is zero. Please report this.\n" );
@@ -513,7 +512,7 @@
         GDI_HEAP_UNLOCK( hdc );
         return ERROR;    
     }
-    dprintf_clipping(stddeb, "RestoreVisRgn: %04x\n", hdc );
+    dprintf_info(clipping, "RestoreVisRgn: %04x\n", hdc );
     if (!(obj = (RGNOBJ *) GDI_GetObjPtr( dc->w.hVisRgn, REGION_MAGIC )))
     {
         GDI_HEAP_UNLOCK( hdc );
diff --git a/objects/color.c b/objects/color.c
index 5476a75..6399d39 100644
--- a/objects/color.c
+++ b/objects/color.c
@@ -13,7 +13,6 @@
 #include "options.h"
 #include "gdi.h"
 #include "color.h"
-#include "stddebug.h"
 #include "debug.h"
 #include "xmalloc.h"
 
@@ -289,7 +288,7 @@
 
     COLOR_sysPal = (PALETTEENTRY*)xmalloc(sizeof(PALETTEENTRY)*cs->size);
 
-    dprintf_palette(stddeb,"\tbuilding private map - %i palette entries\n", cs->size);
+    dprintf_info(palette,"\tbuilding private map - %i palette entries\n", cs->size);
 
       /* Allocate system palette colors */ 
 
@@ -346,9 +345,9 @@
    COLOR_max = PROFILE_GetWineIniInt( "options", "AllocSystemColors", 256);
    if (COLOR_max > 256) COLOR_max = 256;
    else if (COLOR_max < 20) COLOR_max = 20;
-   dprintf_palette(stddeb,"COLOR_Init: %d colors configured.\n", COLOR_max);
+   dprintf_info(palette,"COLOR_Init: %d colors configured.\n", COLOR_max);
    
-   dprintf_palette(stddeb,"\tbuilding shared map - %i palette entries\n", cs->size);
+   dprintf_info(palette,"\tbuilding shared map - %i palette entries\n", cs->size);
 
    /* Be nice and allocate system colors as read-only */
 
@@ -365,7 +364,7 @@
 	     
              if( !warn++ ) 
 	     {
-		  dprintf_palette(stddeb, "Not enough colors for the full system palette.\n");
+		  dprintf_warn(palette, "Not enough colors for the full system palette.\n");
 
 	          bp = BlackPixel(display, DefaultScreen(display));
 	          wp = WhitePixel(display, DefaultScreen(display));
@@ -403,7 +402,7 @@
 
         sysPixel[i] = color.pixel;
 
-        dprintf_palette(stddeb,"\tsyscolor(%lx) -> pixel %i\n",
+        dprintf_info(palette,"\tsyscolor(%lx) -> pixel %i\n",
 		      *(COLORREF*)(__sysPalTemplate+i), (int)color.pixel);
 
         /* Set EGA mapping if color in the first or last eight */
@@ -420,7 +419,7 @@
      {
 	int c_min = 0, c_max = cs->size, c_val;
 
-	dprintf_palette(stddeb,"\tdynamic colormap... ");
+	dprintf_info(palette,"\tdynamic colormap... \n");
 
 	/* comment this out if you want to debug palette init */
 
@@ -462,7 +461,7 @@
 
 	TSXUngrabServer(display);
 
-	dprintf_palette(stddeb,"adjusted size %i colorcells\n", cs->size);
+	dprintf_info(palette,"adjusted size %i colorcells\n", cs->size);
      }
    else if( cSpace.flags & COLOR_VIRTUAL ) 
 	{
@@ -471,12 +470,12 @@
 	   * to maintain compatibility
 	   */
 	  cs->size = 256;
-	  dprintf_palette(stddeb,"\tvirtual colorspace - screendepth %i\n", screenDepth);
+	  dprintf_info(palette,"\tvirtual colorspace - screendepth %i\n", screenDepth);
 	}
    else cs->size = NB_RESERVED_COLORS;	/* system palette only - however we can alloc a bunch
 			                 * of colors and map to them */
 
-   dprintf_palette(stddeb,"Shared system palette uses %i colors.\n", cs->size);
+   dprintf_info(palette,"Shared system palette uses %i colors.\n", cs->size);
 
    /* set gap to account for pixel shortage. It has to be right in the center
     * of the system palette because otherwise raster ops get screwed. */
@@ -530,7 +529,7 @@
            else
              COLOR_PaletteToPixel[i] = i;
 
-      dprintf_palette(stddeb,"\tindex %i -> pixel %i\n", i, COLOR_PaletteToPixel[i]);
+      dprintf_info(palette,"\tindex %i -> pixel %i\n", i, COLOR_PaletteToPixel[i]);
 
       if( COLOR_PixelToPalette )
           COLOR_PixelToPalette[COLOR_PaletteToPixel[i]] = i;
@@ -575,7 +574,7 @@
 
     visual = DefaultVisual( display, DefaultScreen(display) );
 
-    dprintf_palette(stddeb,"COLOR_Init: initializing palette manager...");
+    dprintf_info(palette,"COLOR_Init: initializing palette manager...\n");
 
     white = WhitePixelOfScreen( screen );
     black = BlackPixelOfScreen( screen );
@@ -650,7 +649,7 @@
     }
     }
 
-    dprintf_palette(stddeb," visual class %i (%i)\n", 
+    dprintf_info(palette," visual class %i (%i)\n", 
 		    visual->class, cSpace.monoPlane);
 
     memset(COLOR_freeList, 0, 256*sizeof(unsigned char));
@@ -942,7 +941,7 @@
 
 	if( !palPtr ) return 0;
 	else if( !palPtr->mapping ) 
-            dprintf_palette(stddeb,"\tpalette %04x is not realized\n", dc->w.hPalette);
+            dprintf_warn(palette, "\tpalette %04x is not realized\n", dc->w.hPalette);
 
 	switch(spec_type)	/* we have to peruse DC and system palette */
     	{
@@ -961,7 +960,7 @@
 	    	index = COLOR_PaletteLookupPixel( COLOR_sysPal, 256, 
 						  COLOR_PaletteToPixel, color, FALSE);
 
-		/* dprintf_palette(stddeb,"\tRGB(%lx) -> pixel %i\n", color, index);
+		/* dprintf_info(palette,"\tRGB(%lx) -> pixel %i\n", color, index);
 		 */
 	    	break;
        	    case 1:  /* PALETTEINDEX */
@@ -971,14 +970,14 @@
 		    fprintf(stderr, "\tRGB(%lx) : index %i is out of bounds\n", color, index); 
 		else if( palPtr->mapping ) index = palPtr->mapping[index];
 
-		/*  dprintf_palette(stddeb,"\tPALETTEINDEX(%04x) -> pixel %i\n", (WORD)color, index);
+		/*  dprintf_info(palette,"\tPALETTEINDEX(%04x) -> pixel %i\n", (WORD)color, index);
 		 */
 		break;
             case 2:  /* PALETTERGB */
 		index = COLOR_PaletteLookupPixel( palPtr->logpalette.palPalEntry, 
                                              palPtr->logpalette.palNumEntries,
                                              palPtr->mapping, color, FALSE);
-		/* dprintf_palette(stddeb,"\tPALETTERGB(%lx) -> pixel %i\n", color, index);
+		/* dprintf_info(palette,"\tPALETTERGB(%lx) -> pixel %i\n", color, index);
 		 */
 		break;
 	}
@@ -1078,7 +1077,7 @@
         if( !prevMapping || palPtr->mapping[uStart] != index ) iRemapped++;
         palPtr->mapping[uStart] = index;
 
-        dprintf_palette(stddeb,"\tentry %i (%lx) -> pixel %i\n", uStart, 
+        dprintf_info(palette,"\tentry %i (%lx) -> pixel %i\n", uStart, 
 				*(COLORREF*)(palPtr->logpalette.palPalEntry + uStart), index);
 	
     }
diff --git a/objects/cursoricon.c b/objects/cursoricon.c
index 888e95e..db23574 100644
--- a/objects/cursoricon.c
+++ b/objects/cursoricon.c
@@ -38,7 +38,6 @@
 #include "sysmetrics.h"
 #include "module.h"
 #include "win.h"
-#include "stddebug.h"
 #include "debug.h"
 #include "task.h"
 #include "user.h"
@@ -290,7 +289,7 @@
     BITMAPINFO *bmi;
     HDC32 hdc;
 
-    dprintf_cursor(stddeb,"CreateFromResource: %08x (%u bytes), ver %08x, %ix%i %s %s\n",
+    dprintf_info(cursor,"CreateFromResource: %08x (%u bytes), ver %08x, %ix%i %s %s\n",
                         (unsigned)bits, cbSize, (unsigned)dwVersion, width, height,
                                   bIcon ? "icon" : "cursor", cFlag ? "mono" : "" );
     if (dwVersion == 0x00020000)
@@ -455,7 +454,7 @@
     HICON32 ret;
     ret = CreateIconFromResourceEx16( bits, cbSize, bIcon, dwVersion, 0,0,0);
     fprintf(stdnimp,"CreateIconFromResource3 probably only a stub\n");
-    dprintf_icon(stddeb, 
+    dprintf_info(icon, 
 	"CreateIconFromResource32 %s at %p size %d winver %d return 0x%04x\n",
                  (bIcon)?"Icon":"Cursor",bits,cbSize,bIcon,ret);
     return ret;
@@ -638,7 +637,7 @@
            COLORREF       col;
            CURSORICONINFO cI;
 
-	   dprintf_icon(stddeb, "IconToCursor:[%04x] %ix%i %ibpp (bogus %ibps)\n", 
+	   dprintf_info(icon, "IconToCursor:[%04x] %ix%i %ibpp (bogus %ibps)\n", 
 		hIcon, pIcon->nWidth, pIcon->nHeight, pIcon->bBitsPerPixel, pIcon->nWidthBytes );
 
 	   xor_width = BITMAP_GetBitsWidth( pIcon->nWidth, bpp );
@@ -705,10 +704,10 @@
 HCURSOR16 WINAPI LoadCursor16( HINSTANCE16 hInstance, SEGPTR name )
 {
     if (HIWORD(name))
-        dprintf_cursor( stddeb, "LoadCursor16: %04x '%s'\n",
+        dprintf_info(cursor, "LoadCursor16: %04x '%s'\n",
                         hInstance, (char *)PTR_SEG_TO_LIN( name ) );
     else
-        dprintf_cursor( stddeb, "LoadCursor16: %04x %04x\n",
+        dprintf_info(cursor, "LoadCursor16: %04x %04x\n",
                         hInstance, LOWORD(name) );
 
     return CURSORICON_Load16( hInstance, name,
@@ -722,10 +721,10 @@
 HICON16 WINAPI LoadIcon16( HINSTANCE16 hInstance, SEGPTR name )
 {
     if (HIWORD(name))
-        dprintf_icon( stddeb, "LoadIcon: %04x '%s'\n",
+        dprintf_info(icon, "LoadIcon: %04x '%s'\n",
                       hInstance, (char *)PTR_SEG_TO_LIN( name ) );
     else
-        dprintf_icon( stddeb, "LoadIcon: %04x %04x\n",
+        dprintf_info(icon, "LoadIcon: %04x %04x\n",
                       hInstance, LOWORD(name) );
 
     return CURSORICON_Load16( hInstance, name,
@@ -744,7 +743,7 @@
 {
     CURSORICONINFO info = { { xHotSpot, yHotSpot }, nWidth, nHeight, 0, 1, 1 };
 
-    dprintf_cursor( stddeb, "CreateCursor: %dx%d spot=%d,%d xor=%p and=%p\n",
+    dprintf_info(cursor, "CreateCursor: %dx%d spot=%d,%d xor=%p and=%p\n",
                     nWidth, nHeight, xHotSpot, yHotSpot, lpXORbits, lpANDbits);
     return CreateCursorIconIndirect( hInstance, &info, lpANDbits, lpXORbits );
 }
@@ -760,7 +759,7 @@
 {
     CURSORICONINFO info = { { xHotSpot, yHotSpot }, nWidth, nHeight, 0, 1, 1 };
 
-    dprintf_cursor( stddeb, "CreateCursor: %dx%d spot=%d,%d xor=%p and=%p\n",
+    dprintf_info(cursor, "CreateCursor: %dx%d spot=%d,%d xor=%p and=%p\n",
                     nWidth, nHeight, xHotSpot, yHotSpot, lpXORbits, lpANDbits);
     return CreateCursorIconIndirect( MODULE_HANDLEtoHMODULE16( hInstance ),
                                      &info, lpANDbits, lpXORbits );
@@ -776,7 +775,7 @@
 {
     CURSORICONINFO info = { { 0, 0 }, nWidth, nHeight, 0, bPlanes, bBitsPixel};
 
-    dprintf_icon( stddeb, "CreateIcon: %dx%dx%d, xor=%p, and=%p\n",
+    dprintf_info(icon, "CreateIcon: %dx%dx%d, xor=%p, and=%p\n",
                   nWidth, nHeight, bPlanes * bBitsPixel, lpXORbits, lpANDbits);
     return CreateCursorIconIndirect( hInstance, &info, lpANDbits, lpXORbits );
 }
@@ -791,7 +790,7 @@
 {
     CURSORICONINFO info = { { 0, 0 }, nWidth, nHeight, 0, bPlanes, bBitsPixel};
 
-    dprintf_icon( stddeb, "CreateIcon: %dx%dx%d, xor=%p, and=%p\n",
+    dprintf_info(icon, "CreateIcon: %dx%dx%d, xor=%p, and=%p\n",
                   nWidth, nHeight, bPlanes * bBitsPixel, lpXORbits, lpANDbits);
     return CreateCursorIconIndirect( MODULE_HANDLEtoHMODULE16( hInstance ),
                                      &info, lpANDbits, lpXORbits );
@@ -832,7 +831,7 @@
  */
 HICON16 WINAPI CopyIcon16( HINSTANCE16 hInstance, HICON16 hIcon )
 {
-    dprintf_icon( stddeb, "CopyIcon16: %04x %04x\n", hInstance, hIcon );
+    dprintf_info(icon, "CopyIcon16: %04x %04x\n", hInstance, hIcon );
     return CURSORICON_Copy( hInstance, hIcon );
 }
 
@@ -844,7 +843,7 @@
 {
   HTASK16 hTask = GetCurrentTask ();
   TDB* pTask = (TDB *) GlobalLock16 (hTask);
-    dprintf_icon( stddeb, "CopyIcon32: %04x\n", hIcon );
+    dprintf_info(icon, "CopyIcon32: %04x\n", hIcon );
   return CURSORICON_Copy( pTask->hInstance, hIcon );
 }
 
@@ -854,7 +853,7 @@
  */
 HCURSOR16 WINAPI CopyCursor16( HINSTANCE16 hInstance, HCURSOR16 hCursor )
 {
-    dprintf_cursor( stddeb, "CopyCursor16: %04x %04x\n", hInstance, hCursor );
+    dprintf_info(cursor, "CopyCursor16: %04x %04x\n", hInstance, hCursor );
     return CURSORICON_Copy( hInstance, hCursor );
 }
 
@@ -873,7 +872,7 @@
  */
 BOOL32 WINAPI DestroyIcon32( HICON32 hIcon )
 {
-    dprintf_icon( stddeb, "DestroyIcon: %04x\n", hIcon );
+    dprintf_info(icon, "DestroyIcon: %04x\n", hIcon );
     /* FIXME: should check for OEM icon here */
     return (FreeResource16( hIcon ) == 0);
 }
@@ -893,7 +892,7 @@
  */
 BOOL32 WINAPI DestroyCursor32( HCURSOR32 hCursor )
 {
-    dprintf_cursor( stddeb, "DestroyCursor: %04x\n", hCursor );
+    dprintf_info(cursor, "DestroyCursor: %04x\n", hCursor );
     /* FIXME: should check for OEM cursor here */
     return (FreeResource16( hCursor ) == 0);
 }
@@ -1126,7 +1125,7 @@
     HCURSOR32 hOldCursor;
 
     if (hCursor == hActiveCursor) return hActiveCursor;  /* No change */
-    dprintf_cursor( stddeb, "SetCursor: %04x\n", hCursor );
+    dprintf_info(cursor, "SetCursor: %04x\n", hCursor );
     hOldCursor = hActiveCursor;
     hActiveCursor = hCursor;
     /* Change the cursor shape only if it is visible */
@@ -1154,7 +1153,7 @@
  */
 BOOL32 WINAPI SetCursorPos32( INT32 x, INT32 y )
 {
-    dprintf_cursor( stddeb, "SetCursorPos: x=%d y=%d\n", x, y );
+    dprintf_info(cursor, "SetCursorPos: x=%d y=%d\n", x, y );
     TSXWarpPointer( display, rootWindow, rootWindow, 0, 0, 0, 0, x, y );
     return TRUE;
 }
@@ -1174,7 +1173,7 @@
  */
 INT32 WINAPI ShowCursor32( BOOL32 bShow )
 {
-    dprintf_cursor( stddeb, "ShowCursor: %d, count=%d\n",
+    dprintf_info(cursor, "ShowCursor: %d, count=%d\n",
                     bShow, CURSOR_ShowCount );
 
     EnterCriticalSection( &X11DRV_CritSection );
@@ -1263,7 +1262,7 @@
         else
             MouseButtonsStates[2] = FALSE;
     }
-    dprintf_cursor(stddeb, "GetCursorPos: ret=%d,%d\n", pt->x, pt->y );
+    dprintf_info(cursor, "GetCursorPos: ret=%d,%d\n", pt->x, pt->y );
 }
 
 
@@ -1321,7 +1320,7 @@
 	    if( entry ) retVal = entry->wResId;
 	}
     }
-    else dprintf_cursor(stddeb,"IconId: invalid resource directory\n");
+    else dprintf_warn(cursor, "IconId: invalid resource directory\n");
     return retVal;
 }
 
@@ -1361,7 +1360,7 @@
 {
     LPBYTE lpDir = (LPBYTE)GlobalLock16(hResource);
 
-    dprintf_cursor( stddeb, "GetIconID: hRes=%04x, entries=%i\n",
+    dprintf_info(cursor, "GetIconID: hRes=%04x, entries=%i\n",
                     hResource, lpDir ? ((CURSORICONDIR*)lpDir)->idCount : 0);
 
     switch(resType)
@@ -1439,7 +1438,7 @@
 {
     LPBYTE bits = (LPBYTE)LockResource16( hResource );
 
-    dprintf_cursor(stddeb,"LoadIconHandler: hRes=%04x\n",hResource);
+    dprintf_info(cursor,"LoadIconHandler: hRes=%04x\n",hResource);
 
     return CURSORICON_CreateFromResource( 0, 0, bits, 0, TRUE, 
 		      bNew ? 0x00030000 : 0x00020000, 0, 0, LR_DEFAULTCOLOR );
@@ -1577,7 +1576,7 @@
     HDC32 hMemDC = CreateCompatibleDC32 (hdc);
     BOOL32 result = FALSE;
 
-    dprintf_icon (stddeb, "DrawIconEx32: part stub.\n");
+    dprintf_fixme(icon, "DrawIconEx32: part stub.\n");
 
     if (hMemDC && ptr)
     {
diff --git a/objects/dc.c b/objects/dc.c
index a0ccb3f..70a65c7 100644
--- a/objects/dc.c
+++ b/objects/dc.c
@@ -10,7 +10,6 @@
 #include "gdi.h"
 #include "heap.h"
 #include "metafile.h"
-#include "stddebug.h"
 #include "color.h"
 #include "debug.h"
 #include "font.h"
@@ -450,7 +449,7 @@
     }
     newdc = (DC *) GDI_HEAP_LOCK( handle );
 
-    dprintf_dc(stddeb, "GetDCState(%04x): returning %04x\n", hdc, handle );
+    dprintf_info(dc, "GetDCState(%04x): returning %04x\n", hdc, handle );
 
     memset( &newdc->u.x, 0, sizeof(newdc->u.x) );
     newdc->w.flags           = dc->w.flags | DC_SAVED;
@@ -538,7 +537,7 @@
       GDI_HEAP_UNLOCK( hdcs );
       return;
     }
-    dprintf_dc(stddeb, "SetDCState: %04x %04x\n", hdc, hdcs );
+    dprintf_info(dc, "SetDCState: %04x %04x\n", hdc, hdcs );
 
     dc->w.flags           = dcs->w.flags & ~DC_SAVED;
     dc->w.devCaps         = dcs->w.devCaps;
@@ -643,7 +642,7 @@
     
     dcs->header.hNext = dc->header.hNext;
     dc->header.hNext = hdcs;
-    dprintf_dc(stddeb, "SaveDC(%04x): returning %d\n", hdc, dc->saveLevel+1 );
+    dprintf_info(dc, "SaveDC(%04x): returning %d\n", hdc, dc->saveLevel+1 );
     ret = ++dc->saveLevel;
     GDI_HEAP_UNLOCK( hdcs );
     GDI_HEAP_UNLOCK( hdc );
@@ -668,7 +667,7 @@
     DC * dc, * dcs;
     BOOL32 success;
 
-    dprintf_dc(stddeb, "RestoreDC: %04x %d\n", hdc, level );
+    dprintf_info(dc, "RestoreDC: %04x %d\n", hdc, level );
     dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
     if (!dc) 
     {
@@ -728,13 +727,13 @@
     if (!(dc = DC_AllocDC( funcs ))) return 0;
     dc->w.flags = 0;
 
-    dprintf_dc(stddeb, "CreateDC(%s %s %s): returning %04x\n",
+    dprintf_info(dc, "CreateDC(%s %s %s): returning %04x\n",
                driver, device, output, dc->hSelf );
 
     if (dc->funcs->pCreateDC &&
         !dc->funcs->pCreateDC( dc, driver, device, output, initData ))
     {
-        dprintf_dc( stddeb, "CreateDC: creation aborted by device\n" );
+        dprintf_warn(dc, "CreateDC: creation aborted by device\n" );
         GDI_HEAP_FREE( dc->hSelf );
         return 0;
     }
@@ -830,7 +829,7 @@
 
     if (!(dc = DC_AllocDC( funcs ))) return 0;
 
-    dprintf_dc(stddeb, "CreateCompatibleDC(%04x): returning %04x\n",
+    dprintf_info(dc, "CreateCompatibleDC(%04x): returning %04x\n",
                hdc, dc->hSelf );
 
       /* Create default bitmap */
@@ -847,7 +846,7 @@
     if (dc->funcs->pCreateDC &&
         !dc->funcs->pCreateDC( dc, NULL, NULL, NULL, NULL ))
     {
-        dprintf_dc(stddeb, "CreateCompatibleDC: creation aborted by device\n");
+        dprintf_warn(dc, "CreateCompatibleDC: creation aborted by device\n");
         DeleteObject32( hbitmap );
         GDI_HEAP_FREE( dc->hSelf );
         return 0;
@@ -876,7 +875,7 @@
     DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
     if (!dc) return FALSE;
 
-    dprintf_dc(stddeb, "DeleteDC: %04x\n", hdc );
+    dprintf_info(dc, "DeleteDC: %04x\n", hdc );
 
     while (dc->saveLevel)
     {
@@ -962,7 +961,7 @@
       return 0;
     }
     
-    dprintf_dc(stddeb, "GetDeviceCaps(%04x,%d): returning %d\n",
+    dprintf_info(dc, "GetDeviceCaps(%04x,%d): returning %d\n",
 	    hdc, cap, *(WORD *)(((char *)dc->w.devCaps) + cap) );
     ret = *(WORD *)(((char *)dc->w.devCaps) + cap);
     GDI_HEAP_UNLOCK( hdc );
@@ -1269,7 +1268,7 @@
 {
     DC *dc = (DC *)GDI_GetObjPtr( hdc, DC_MAGIC );
 
-    dprintf_dc( stddeb, "SetDCHook: hookProc %08x, default is %08x\n",
+    dprintf_info(dc, "SetDCHook: hookProc %08x, default is %08x\n",
                 (UINT32)hookProc, (UINT32)DCHook );
 
     if (!dc) return FALSE;
@@ -1307,7 +1306,7 @@
         /* "Undocumented Windows" info is slightly confusing.
          */
 
-        dprintf_dc(stddeb,"SetHookFlags: hDC %04x, flags %04x\n",hDC,flags);
+        dprintf_info(dc,"SetHookFlags: hDC %04x, flags %04x\n",hDC,flags);
 
         if( flags & DCHF_INVALIDATEVISRGN )
             dc->w.flags |= DC_DIRTY;
diff --git a/objects/dib.c b/objects/dib.c
index c4227ef..1622d17 100644
--- a/objects/dib.c
+++ b/objects/dib.c
@@ -12,7 +12,6 @@
 #include "bitmap.h"
 #include "callback.h"
 #include "palette.h"
-#include "stddebug.h"
 #include "color.h"
 #include "debug.h"
 
@@ -578,7 +577,7 @@
 			  line 	-= (*pIn++);
 			  if (line == 0)
 			    {
-			      dprintf_bitmap(stddeb, 
+			      dprintf_info(bitmap, 
 					     "DIB_SetImageBits_RLE8(): "
 					     "Delta to last line of bitmap "
 					     "(wrongly?) causes loop exit\n");
@@ -625,7 +624,7 @@
      */
     if ( (*(pIn-2) != 0/*escape*/) || (*(pIn-1)!= RleEnd) )
       {
-	dprintf_bitmap(stddeb, "DIB_SetImageBits_RLE8(): End-of-bitmap "
+	dprintf_info(bitmap, "DIB_SetImageBits_RLE8(): End-of-bitmap "
 		       "without (strictly) proper escape code.  Last two "
 		       "bytes were: %02X %02X.\n",
 		       (int)*(pIn-2),
@@ -1180,7 +1179,7 @@
 	BYTE*	bbits = bits;
 	int	pad, yend, xend = bmp->bitmap.bmWidth;
 
-        dprintf_bitmap(stddeb, "GetDIBits: %u scanlines of (%i,%i) -> (%i,%i) starting from %u\n",
+        dprintf_info(bitmap, "GetDIBits: %u scanlines of (%i,%i) -> (%i,%i) starting from %u\n",
 			    lines, bmp->bitmap.bmWidth, bmp->bitmap.bmHeight,
 			    (int)info->bmiHeader.biWidth, (int)info->bmiHeader.biHeight, startscan );
 
diff --git a/objects/font.c b/objects/font.c
index b1ac08d..04fe131 100644
--- a/objects/font.c
+++ b/objects/font.c
@@ -12,7 +12,6 @@
 #include "heap.h"
 #include "metafile.h"
 #include "options.h"
-#include "stddebug.h"
 #include "debug.h"
 #include "debugstr.h"
 
@@ -223,7 +222,7 @@
 	    fontPtr = (FONTOBJ *) GDI_HEAP_LOCK( hFont );
 	    memcpy( &fontPtr->logfont, font, sizeof(LOGFONT16) );
 
-	    dprintf_font(stddeb,"CreateFontIndirect(%i %i) '%s' %s %s => %04x\n",
+	    dprintf_info(font,"CreateFontIndirect(%i %i) '%s' %s %s => %04x\n",
 				 font->lfHeight, font->lfWidth, 
 				 font->lfFaceName ? font->lfFaceName : "NULL",
 				 font->lfWeight > 400 ? "Bold" : "",
@@ -271,7 +270,7 @@
     LOGFONT16 logfont = { height, width, esc, orient, weight, italic, underline,
                           strikeout, charset, outpres, clippres, quality, pitch, };
 
-    dprintf_font(stddeb,"CreateFont16('%s',%d,%d)\n",
+    dprintf_info(font,"CreateFont16('%s',%d,%d)\n",
 		 (name ? name : "(null)") , height, width);
     if (name) 
 	lstrcpyn32A(logfont.lfFaceName,name,sizeof(logfont.lfFaceName));
@@ -716,7 +715,7 @@
         !dc->funcs->pGetTextExtentPoint( dc, str, count, size ))
         return FALSE;
 
-    dprintf_font(stddeb,"GetTextExtentPoint(%08x %s %d %p): returning %d,%d\n",
+    dprintf_info(font,"GetTextExtentPoint(%08x %s %d %p): returning %d,%d\n",
                  hdc, debugstr_an (str, count), count,
 		 size, size->cx, size->cy );
     return TRUE;
@@ -742,7 +741,7 @@
 BOOL32 WINAPI GetTextExtentPoint32ABuggy( HDC32 hdc, LPCSTR str, INT32 count,
                                           LPSIZE32 size )
 {
-    dprintf_font( stddeb, "GetTextExtentPoint32ABuggy: not bug compatible.\n");
+    dprintf_info(font, "GetTextExtentPoint32ABuggy: not bug compatible.\n");
     return GetTextExtentPoint32A( hdc, str, count, size );
 }
 
@@ -752,7 +751,7 @@
 BOOL32 WINAPI GetTextExtentPoint32WBuggy( HDC32 hdc, LPCWSTR str, INT32 count,
                                           LPSIZE32 size )
 {
-    dprintf_font( stddeb, "GetTextExtentPoint32WBuggy: not bug compatible.\n");
+    dprintf_info(font, "GetTextExtentPoint32WBuggy: not bug compatible.\n");
     return GetTextExtentPoint32W( hdc, str, count, size );
 }
 
@@ -792,7 +791,7 @@
     size->cx = extent;
    *lpnFit = nFit;
 
-    dprintf_font(stddeb,"GetTextExtentExPoint32A(%08x '%.*s' %d) returning %d %d %d\n",
+    dprintf_info(font,"GetTextExtentExPoint32A(%08x '%.*s' %d) returning %d %d %d\n",
                hdc,count,str,maxExt,nFit, size->cx,size->cy);
     return TRUE;
 }
@@ -861,7 +860,7 @@
     metrics->tmMaxCharWidth     = WDPTOLP(metrics->tmMaxCharWidth);
     metrics->tmOverhang         = WDPTOLP(metrics->tmOverhang);
 
-    dprintf_font(stddeb,"text metrics:
+    dprintf_info(font,"text metrics:
     Weight = %03i\t FirstChar = %03i\t AveCharWidth = %i
     Italic = % 3i\t LastChar = %03i\t\t MaxCharWidth = %i
     UnderLined = %01i\t DefaultChar = %03i\t Overhang = %i
@@ -988,8 +987,8 @@
  */
 DWORD WINAPI SetMapperFlags32( HDC32 hDC, DWORD dwFlag )
 {
-    dprintf_font(stdnimp,"SetMapperFlags(%04x, %08lX) // Empty Stub !\n",
-                 hDC, dwFlag);
+    dprintf_fixme(font, "SetMapperFlags(%04x, %08lX) // Empty Stub !\n",
+		  hDC, dwFlag);
     return 0L;
 }
 
@@ -998,9 +997,8 @@
  */
 BOOL16 GetAspectRatioFilterEx16( HDC16 hdc, LPVOID pAspectRatio )
 {
-  dprintf_font(stdnimp, 
-      "GetAspectRatioFilterEx(%04x, %p): // Empty Stub !\n",
-	       hdc, pAspectRatio);
+  dprintf_fixme(font, "GetAspectRatioFilterEx(%04x, %p): // Empty Stub !\n",
+		hdc, pAspectRatio);
   return FALSE;
 }
 
diff --git a/objects/gdiobj.c b/objects/gdiobj.c
index 0557012..d19aad3 100644
--- a/objects/gdiobj.c
+++ b/objects/gdiobj.c
@@ -16,7 +16,6 @@
 #include "palette.h"
 #include "pen.h"
 #include "region.h"
-#include "stddebug.h"
 #include "debug.h"
 #include "gdi.h"
 
@@ -361,7 +360,7 @@
         return TRUE;
     if (!(header = (GDIOBJHDR *) GDI_HEAP_LOCK( obj ))) return FALSE;
 
-    dprintf_gdi(stddeb, "DeleteObject: %04x\n", obj );
+    dprintf_info(gdi, "DeleteObject: %04x\n", obj );
 
       /* Delete object */
 
@@ -394,7 +393,7 @@
 {
     if ((obj < 0) || (obj >= NB_STOCK_OBJECTS)) return 0;
     if (!StockObjects[obj]) return 0;
-    dprintf_gdi(stddeb, "GetStockObject: returning %d\n",
+    dprintf_info(gdi, "GetStockObject: returning %d\n",
                 FIRST_STOCK_HANDLE + obj );
     return (HGDIOBJ16)(FIRST_STOCK_HANDLE + obj);
 }
@@ -407,7 +406,7 @@
 {
     GDIOBJHDR * ptr = NULL;
     INT16 result = 0;
-    dprintf_gdi(stddeb, "GetObject16: %04x %d %p\n", handle, count, buffer );
+    dprintf_info(gdi, "GetObject16: %04x %d %p\n", handle, count, buffer );
     if (!count) return 0;
 
     if ((handle >= FIRST_STOCK_HANDLE) && (handle <= LAST_STOCK_HANDLE))
@@ -446,7 +445,7 @@
 {
     GDIOBJHDR * ptr = NULL;
     INT32 result = 0;
-    dprintf_gdi(stddeb, "GetObject32A: %08x %d %p\n", handle, count, buffer );
+    dprintf_info(gdi, "GetObject32A: %08x %d %p\n", handle, count, buffer );
     if (!count) return 0;
 
     if ((handle >= FIRST_STOCK_HANDLE) && (handle <= LAST_STOCK_HANDLE))
@@ -485,7 +484,7 @@
 {
     GDIOBJHDR * ptr = NULL;
     INT32 result = 0;
-    dprintf_gdi(stddeb, "GetObjectType: %08x\n", handle );
+    dprintf_info(gdi, "GetObjectType: %08x\n", handle );
 
     if ((handle >= FIRST_STOCK_HANDLE) && (handle <= LAST_STOCK_HANDLE))
       ptr = StockObjects[handle - FIRST_STOCK_HANDLE];
@@ -582,7 +581,7 @@
 {
     DC * dc = DC_GetDCPtr( hdc );
     if (!dc || !dc->funcs->pSelectObject) return 0;
-    dprintf_gdi(stddeb, "SelectObject: hdc=%04x %04x\n", hdc, handle );
+    dprintf_info(gdi, "SelectObject: hdc=%04x %04x\n", hdc, handle );
     return dc->funcs->pSelectObject( dc, handle );
 }
 
@@ -607,7 +606,7 @@
     GDIOBJHDR * header = (GDIOBJHDR *) GDI_HEAP_LOCK( obj );
     if (!header) return FALSE;
 
-    dprintf_gdi( stddeb, "UnrealizeObject: %04x\n", obj );
+    dprintf_info(gdi, "UnrealizeObject: %04x\n", obj );
 
       /* Unrealize object */
 
@@ -648,7 +647,7 @@
     LOGPEN16 *pen;
     LOGBRUSH16 *brush = NULL;
 
-    dprintf_gdi( stddeb, "EnumObjects16: %04x %d %08lx %08lx\n",
+    dprintf_info(gdi, "EnumObjects16: %04x %d %08lx %08lx\n",
                  hdc, nObjType, (DWORD)lpEnumFunc, lParam );
     switch(nObjType)
     {
@@ -662,7 +661,7 @@
             pen->lopnWidth.y = 0;
             pen->lopnColor   = solid_colors[i];
             retval = lpEnumFunc( SEGPTR_GET(pen), lParam );
-            dprintf_gdi( stddeb, "EnumObjects16: solid pen %08lx, ret=%d\n",
+            dprintf_info(gdi, "EnumObjects16: solid pen %08lx, ret=%d\n",
                          solid_colors[i], retval);
             if (!retval) break;
         }
@@ -678,7 +677,7 @@
             brush->lbColor = solid_colors[i];
             brush->lbHatch = 0;
             retval = lpEnumFunc( SEGPTR_GET(brush), lParam );
-            dprintf_gdi( stddeb, "EnumObjects16: solid brush %08lx, ret=%d\n",
+            dprintf_info(gdi, "EnumObjects16: solid brush %08lx, ret=%d\n",
                          solid_colors[i], retval);
             if (!retval) break;
         }
@@ -690,7 +689,7 @@
             brush->lbColor = RGB(0,0,0);
             brush->lbHatch = i;
             retval = lpEnumFunc( SEGPTR_GET(brush), lParam );
-            dprintf_gdi( stddeb, "EnumObjects16: hatched brush %d, ret=%d\n",
+            dprintf_info(gdi, "EnumObjects16: hatched brush %d, ret=%d\n",
                          i, retval);
             if (!retval) break;
         }
@@ -727,7 +726,7 @@
     LOGPEN32 pen;
     LOGBRUSH32 brush;
 
-    dprintf_gdi( stddeb, "EnumObjects32: %04x %d %08lx %08lx\n",
+    dprintf_info(gdi, "EnumObjects32: %04x %d %08lx %08lx\n",
                  hdc, nObjType, (DWORD)lpEnumFunc, lParam );
     switch(nObjType)
     {
@@ -740,7 +739,7 @@
             pen.lopnWidth.y = 0;
             pen.lopnColor   = solid_colors[i];
             retval = lpEnumFunc( &pen, lParam );
-            dprintf_gdi( stddeb, "EnumObjects32: solid pen %08lx, ret=%d\n",
+            dprintf_info(gdi, "EnumObjects32: solid pen %08lx, ret=%d\n",
                          solid_colors[i], retval);
             if (!retval) break;
         }
@@ -754,7 +753,7 @@
             brush.lbColor = solid_colors[i];
             brush.lbHatch = 0;
             retval = lpEnumFunc( &brush, lParam );
-            dprintf_gdi( stddeb, "EnumObjects32: solid brush %08lx, ret=%d\n",
+            dprintf_info(gdi, "EnumObjects32: solid brush %08lx, ret=%d\n",
                          solid_colors[i], retval);
             if (!retval) break;
         }
@@ -766,7 +765,7 @@
             brush.lbColor = RGB(0,0,0);
             brush.lbHatch = i;
             retval = lpEnumFunc( &brush, lParam );
-            dprintf_gdi( stddeb, "EnumObjects32: hatched brush %d, ret=%d\n",
+            dprintf_info(gdi, "EnumObjects32: hatched brush %d, ret=%d\n",
                          i, retval);
             if (!retval) break;
         }
diff --git a/objects/metafile.c b/objects/metafile.c
index 4d426d7..1d58af0 100644
--- a/objects/metafile.c
+++ b/objects/metafile.c
@@ -16,7 +16,6 @@
 #include "metafile.h"
 #include "metafiledrv.h"
 #include "toolhelp.h"
-#include "stddebug.h"
 #include "debug.h"
 
 /******************************************************************
@@ -80,7 +79,7 @@
   HFILE32 hFile;
   DWORD size;
   
-  dprintf_metafile(stddeb,"GetMetaFile: %s\n", lpFilename);
+  dprintf_info(metafile,"GetMetaFile: %s\n", lpFilename);
 
   if (!lpFilename)
     return 0;
@@ -190,7 +189,7 @@
     METAHEADER *mh2;
     HFILE32 hFile;
     
-    dprintf_metafile(stddeb,"CopyMetaFile: %s\n", lpFilename);
+    dprintf_info(metafile,"CopyMetaFile: %s\n", lpFilename);
     
     mh = (METAHEADER *)GlobalLock16(hSrcMetaFile);
     
@@ -261,7 +260,7 @@
             resu=TRUE;
       GlobalUnlock16(hmf);
     }
-    dprintf_metafile(stddeb,"IsValidMetaFile %x => %d\n",hmf,resu);
+    dprintf_info(metafile,"IsValidMetaFile %x => %d\n",hmf,resu);
     return resu;         
 }
 
@@ -297,7 +296,7 @@
     HFONT32 hFont;
     DC *dc;
     
-    dprintf_metafile(stddeb,"PlayMetaFile(%04x %04x)\n",hdc,hmf);
+    dprintf_info(metafile,"PlayMetaFile(%04x %04x)\n",hdc,hmf);
     if (!mh) return FALSE;
     if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return 0;
     hPen = dc->w.hPen;
@@ -315,7 +314,7 @@
     while (offset < mh->mtSize * 2)
     {
         mr = (METARECORD *)((char *)mh + offset);
-	dprintf_metafile(stddeb,"offset = %04x size = %08lx\n",
+	dprintf_info(metafile,"offset = %04x size = %08lx\n",
 			 offset, mr->rdSize);
 	if (!mr->rdSize) {
 		fprintf(stderr,"METAFILE entry got size 0 at offset %d, total mf length is %ld\n",offset,mh->mtSize*2);
@@ -375,7 +374,7 @@
     DC *dc;
     BOOL16 result = TRUE;
     
-    dprintf_metafile(stddeb,"EnumMetaFile(%04x, %04x, %08lx, %08lx)\n",
+    dprintf_info(metafile,"EnumMetaFile(%04x, %04x, %08lx, %08lx)\n",
 		     hdc, hmf, (DWORD)lpEnumFunc, lpData);
 
     if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return 0;
@@ -461,7 +460,7 @@
     char *ptr;
     BITMAPINFOHEADER *infohdr;
 
-    dprintf_metafile(stddeb,
+    dprintf_info(metafile,
 "PlayMetaFileRecord(%04x %08lx %08lx %04x) function %04x\n",
 		     hdc,(LONG)ht, (LONG)mr, nHandles, mr->rdFunction);
     
@@ -712,7 +711,7 @@
 	break;
 
     case META_ESCAPE:
-	dprintf_metafile(stddeb,"PlayMetaFileRecord: META_ESCAPE unimplemented.\n");
+	dprintf_fixme(metafile, "PlayMetaFileRecord: META_ESCAPE unimplemented.\n");
         break;
 
         /* --- Begin of fixed or new metafile operations. July 1996 ----*/
@@ -737,7 +736,7 @@
             dxx = (LPINT16)(sot+(((s1+1)>>1)*2));	   
           else 
 	  {
-	   dprintf_metafile(stddeb,"EXTTEXTOUT: %s  len: %ld\n",
+	   dprintf_info(metafile,"EXTTEXTOUT: %s  len: %ld\n",
              sot,mr->rdSize);
            fprintf(stderr,
 	     "Please report: PlayMetaFile/ExtTextOut len=%ld slen=%d rdSize=%ld opt=%04x\n",
@@ -751,7 +750,7 @@
 		           sot,				/* string */
                            s1, dxx);                    /* length, dx array */
         if (dxx)                      
-          dprintf_metafile(stddeb,"EXTTEXTOUT: %s  len: %ld  dx0: %d\n",
+          dprintf_info(metafile,"EXTTEXTOUT: %s  len: %ld  dx0: %d\n",
             sot,mr->rdSize,dxx[0]);
        }
        break;
@@ -842,7 +841,7 @@
 
      case META_DIBCREATEPATTERNBRUSH:
 	/*  *(mr->rdParam) may be BS_PATTERN or BS_DIBPATTERN: but there's no difference */
-        dprintf_metafile(stddeb,"META_DIBCREATEPATTERNBRUSH: %d\n",*(mr->rdParam));
+        dprintf_info(metafile,"META_DIBCREATEPATTERNBRUSH: %d\n",*(mr->rdParam));
 	s1 = mr->rdSize * 2 - sizeof(METARECORD) - 2;
 	hndl = GlobalAlloc16(GMEM_MOVEABLE, s1);
 	ptr = GlobalLock16(hndl);
@@ -908,7 +907,7 @@
 				 HMETAFILE16 hmf /* metafile handle */
 				 )
 {
-    dprintf_metafile(stddeb,"GetMetaFileBits: hMem out: %04x\n", hmf);
+    dprintf_info(metafile,"GetMetaFileBits: hMem out: %04x\n", hmf);
     return hmf;
 }
 
@@ -925,7 +924,7 @@
 			/* handle to a memory region holding a metafile */
 )
 {
-    dprintf_metafile(stddeb,"SetMetaFileBits: hmf out: %04x\n", hMem);
+    dprintf_info(metafile,"SetMetaFileBits: hmf out: %04x\n", hMem);
 
     return hMem;
 }
@@ -1043,7 +1042,7 @@
 	memcpy((WORD *)physDev->mh + physDev->mh->mtSize, mr, rlen);
         break;
     case METAFILE_DISK:
-        dprintf_metafile(stddeb,"Writing record to disk\n");
+        dprintf_info(metafile,"Writing record to disk\n");
 	if (_lwrite32(physDev->mh->mtNoParameters, (char *)mr, rlen) == -1)
 	    return FALSE;
         break;
@@ -1443,7 +1442,7 @@
     *(mr->rdParam + 9) = BM.bmWidthBytes;
     *(mr->rdParam +10) = BM.bmPlanes;
     *(mr->rdParam +11) = BM.bmBitsPixel;
-    dprintf_metafile(stddeb,"MF_StretchBlt->len = %ld  rop=%lx  \n",len,rop);
+    dprintf_info(metafile,"MF_StretchBlt->len = %ld  rop=%lx  \n",len,rop);
     if (GetBitmapBits32(dcSrc->w.hBitmap,BM.bmWidthBytes * BM.bmHeight,
                         mr->rdParam +12))
     {
@@ -1508,7 +1507,7 @@
     lpBMI->biYPelsPerMeter = MulDiv32(GetDeviceCaps(dcSrc->hSelf,LOGPIXELSY),3937,100);
     lpBMI->biClrImportant  = 0;                          /* 1 meter  = 39.37 inch */
 
-    dprintf_metafile(stddeb,"MF_StretchBltViaDIB->len = %ld  rop=%lx  PixYPM=%ld Caps=%d\n",
+    dprintf_info(metafile,"MF_StretchBltViaDIB->len = %ld  rop=%lx  PixYPM=%ld Caps=%d\n",
                len,rop,lpBMI->biYPelsPerMeter,GetDeviceCaps(hdcSrc,LOGPIXELSY));
     if (GetDIBits(hdcSrc,dcSrc->w.hBitmap,0,(UINT32)lpBMI->biHeight,
                   (LPSTR)lpBMI + DIB_BitmapInfoSize( (BITMAPINFO *)lpBMI,
@@ -1525,7 +1524,7 @@
     *(mr->rdParam +12) = BM.bmWidthBytes;
     *(mr->rdParam +13) = BM.bmPlanes;
     *(mr->rdParam +14) = BM.bmBitsPixel;
-    dprintf_metafile(stddeb,"MF_StretchBlt->len = %ld  rop=%lx  \n",len,rop);
+    dprintf_info(metafile,"MF_StretchBlt->len = %ld  rop=%lx  \n",len,rop);
     if (GetBitmapBits32( dcSrc->w.hBitmap, BM.bmWidthBytes * BM.bmHeight,
                          mr->rdParam +15))
 #endif    
diff --git a/objects/oembitmap.c b/objects/oembitmap.c
index 700e9fe..d362f77 100644
--- a/objects/oembitmap.c
+++ b/objects/oembitmap.c
@@ -16,7 +16,6 @@
 #include "color.h"
 #include "cursoricon.h"
 #include "heap.h"
-#include "stddebug.h"
 #include "tweak.h"
 #include "debug.h"
 
diff --git a/objects/palette.c b/objects/palette.c
index 67f4411..d11c2cd 100644
--- a/objects/palette.c
+++ b/objects/palette.c
@@ -16,8 +16,6 @@
 #include "color.h"
 #include "palette.h"
 #include "xmalloc.h"
-#include "stddebug.h"
-/* #define DEBUG_PALETTE */
 #include "debug.h"
 
 static UINT32 SystemPaletteUse = SYSPAL_STATIC;  /* currently not considered */
@@ -95,7 +93,7 @@
     HPALETTE32 hpalette;
     int size = sizeof(LOGPALETTE) + (palette->palNumEntries - 1) * sizeof(PALETTEENTRY);
 
-    dprintf_palette(stddeb,"CreatePalette: %i entries, ",
+    dprintf_info(palette,"CreatePalette: %i entries \n",
                     palette->palNumEntries);
 
     hpalette = GDI_AllocObject( size + sizeof(int*) +sizeof(GDIOBJHDR) , PALETTE_MAGIC );
@@ -108,7 +106,7 @@
     palettePtr->mapping = NULL;
     GDI_HEAP_UNLOCK( hpalette );
 
-    dprintf_palette(stddeb,"returning %04x\n", hpalette);
+    dprintf_info(palette,"   returning %04x\n", hpalette);
     return hpalette;
 }
 
@@ -140,7 +138,7 @@
     PALETTEOBJ * palPtr;
     INT32 numEntries;
 
-    dprintf_palette( stddeb,"GetPaletteEntries: hpal = %04x, %i entries\n",
+    dprintf_info(palette,"GetPaletteEntries: hpal = %04x, %i entries\n",
                      hpalette, count );
         
     palPtr = (PALETTEOBJ *) GDI_GetObjPtr( hpalette, PALETTE_MAGIC );
@@ -182,7 +180,7 @@
     PALETTEOBJ * palPtr;
     INT32 numEntries;
 
-    dprintf_palette( stddeb,"SetPaletteEntries: hpal = %04x, %i entries\n",
+    dprintf_info(palette,"SetPaletteEntries: hpal = %04x, %i entries\n",
                      hpalette, count );
 
     palPtr = (PALETTEOBJ *) GDI_GetObjPtr( hpalette, PALETTE_MAGIC );
@@ -225,7 +223,7 @@
     int		 prevsize, size = sizeof(LOGPALETTE) + (cEntries - 1) * sizeof(PALETTEENTRY);
     int*	 mapping = NULL;
 
-    dprintf_palette(stddeb,"ResizePalette: hpal = %04x, prev = %i, new = %i\n",
+    dprintf_info(palette,"ResizePalette: hpal = %04x, prev = %i, new = %i\n",
 		    hPal, palPtr ? palPtr->logpalette.palNumEntries : -1,
                     cEntries );
     if( !palPtr ) return FALSE;
@@ -277,7 +275,7 @@
 BOOL32 WINAPI AnimatePalette32( HPALETTE32 hPal, UINT32 StartIndex,
                                UINT32 NumEntries, LPPALETTEENTRY PaletteColors)
 {
-    dprintf_palette(stddeb, "AnimatePalette: %04x (%i - %i)", hPal, 
+    dprintf_info(palette, "AnimatePalette: %04x (%i - %i)\n", hPal, 
                     StartIndex, StartIndex + NumEntries );
 
     if( hPal != STOCK_DEFAULT_PALETTE ) 
@@ -358,7 +356,8 @@
     UINT32 i;
     DC *dc;
 
-    dprintf_palette(stddeb,"GetSystemPaletteEntries: hdc = %04x, cound = %i", hdc, count );
+    dprintf_info(palette, "GetSystemPaletteEntries: hdc = %04x, "
+		    "cound = %i\n", hdc, count );
 
     if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return 0;
     if (start >= dc->w.devCaps->sizePalette)
@@ -372,7 +371,7 @@
     {
 	*(COLORREF*)(entries + i) = COLOR_GetSystemPaletteEntry( start + i );
 
-        dprintf_palette( stddeb,"\tidx(%02x) -> RGB(%08lx)\n",
+        dprintf_info(palette,"\tidx(%02x) -> RGB(%08lx)\n",
                          start + i, *(COLORREF*)(entries + i) );
     }
     GDI_HEAP_UNLOCK( hdc );
@@ -402,7 +401,7 @@
 				          palObj->logpalette.palNumEntries,
                                           NULL, color, FALSE );
 
-    dprintf_palette(stddeb,"GetNearestPaletteIndex(%04x,%06lx): returning %d\n", 
+    dprintf_info(palette,"GetNearestPaletteIndex(%04x,%06lx): returning %d\n", 
                     hpalette, color, index );
     GDI_HEAP_UNLOCK( hpalette );
     return index;
@@ -438,7 +437,7 @@
       GDI_HEAP_UNLOCK( dc->w.hPalette );
     }
 
-    dprintf_palette(stddeb,"GetNearestColor(%06lx): returning %06lx\n", 
+    dprintf_info(palette,"GetNearestColor(%06lx): returning %06lx\n", 
                     color, nearest );
     GDI_HEAP_UNLOCK( hdc );    
     return nearest;
@@ -490,7 +489,7 @@
     HPALETTE16 prev;
     DC *dc;
 
-    dprintf_palette(stddeb, "GDISelectPalette: %04x %04x\n", hdc, hpal );
+    dprintf_info(palette, "GDISelectPalette: %04x %04x\n", hdc, hpal );
     
     dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
     if (!dc) 
@@ -520,7 +519,7 @@
 	if (!dc) return 0;
     }
 
-    dprintf_palette(stddeb, "GDIRealizePalette: %04x...", hdc );
+    dprintf_info(palette, "GDIRealizePalette: %04x...\n", hdc );
     
     if( dc &&  dc->w.hPalette != hLastRealizedPalette )
     {
@@ -535,11 +534,11 @@
 	GDI_HEAP_UNLOCK( dc->w.hPalette );
 	hLastRealizedPalette = dc->w.hPalette;
     }
-    else dprintf_palette(stddeb, " skipping (hLastRealizedPalette = %04x) ",
+    else dprintf_info(palette, "  skipping (hLastRealizedPalette = %04x)\n",
 			 hLastRealizedPalette);
     
     GDI_HEAP_UNLOCK( hdc );
-    dprintf_palette(stdnimp, " realized %i colors\n", realized );
+    dprintf_fixme(palette, "   realized %i colors - not impmenented?\n", realized );
     return (UINT16)realized;
 }
 
@@ -553,7 +552,7 @@
     PALETTEOBJ*  palPtr;
     int          i, index, realized = 0;
 
-    dprintf_palette(stddeb,"RealizeDefaultPalette: %04x\n", hdc );
+    dprintf_info(palette,"RealizeDefaultPalette: %04x\n", hdc );
 
     dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
     if (!dc) 
@@ -620,11 +619,11 @@
     WORD	wBkgPalette = 1;
     PALETTEOBJ* lpt = (PALETTEOBJ*) GDI_GetObjPtr( hPal, PALETTE_MAGIC );
 
-    dprintf_palette(stddeb,"SelectPalette: dc %04x pal %04x, force=%i ", 
+    dprintf_info(palette,"SelectPalette: dc %04x pal %04x, force=%i \n", 
 			    hDC, hPal, bForceBackground);
     if( !lpt ) return 0;
 
-    dprintf_palette(stddeb," entries = %d\n", 
+    dprintf_info(palette," entries = %d\n", 
 			    lpt->logpalette.palNumEntries);
     GDI_HEAP_UNLOCK( hPal );
 
diff --git a/objects/pen.c b/objects/pen.c
index ca3a191..e1f44a9 100644
--- a/objects/pen.c
+++ b/objects/pen.c
@@ -7,7 +7,6 @@
 #include "pen.h"
 #include "metafile.h"
 #include "color.h"
-#include "stddebug.h"
 #include "debug.h"
 
 
@@ -18,7 +17,7 @@
 HPEN16 WINAPI CreatePen16( INT16 style, INT16 width, COLORREF color )
 {
     LOGPEN32 logpen = { style, { width, 0 }, color };
-    dprintf_gdi(stddeb, "CreatePen16: %d %d %06lx\n", style, width, color );
+    dprintf_info(gdi, "CreatePen16: %d %d %06lx\n", style, width, color );
     return CreatePenIndirect32( &logpen );
 }
 
@@ -29,7 +28,7 @@
 HPEN32 WINAPI CreatePen32( INT32 style, INT32 width, COLORREF color )
 {
     LOGPEN32 logpen = { style, { width, 0 }, color };
-    dprintf_gdi(stddeb, "CreatePen32: %d %d %06lx\n", style, width, color );
+    dprintf_info(gdi, "CreatePen32: %d %d %06lx\n", style, width, color );
     return CreatePenIndirect32( &logpen );
 }
 
diff --git a/objects/region.c b/objects/region.c
index f3adee4..ef798dd 100644
--- a/objects/region.c
+++ b/objects/region.c
@@ -82,7 +82,6 @@
 
 #include <stdio.h>
 #include "region.h"
-#include "stddebug.h"
 #include "debug.h"
 #include "heap.h"
 #include "dc.h"
@@ -107,11 +106,11 @@
 {
     RECT32 *pRect, *pRectEnd = pReg->rects + pReg->numRects;
 
-    dprintf_region(stddeb, "Region %p: %d,%d - %d,%d %d rects\n", pReg,
+    dprintf_info(region, "Region %p: %d,%d - %d,%d %d rects\n", pReg,
 	    pReg->extents.left, pReg->extents.top,
 	    pReg->extents.right, pReg->extents.bottom, pReg->numRects);
     for(pRect = pReg->rects; pRect < pRectEnd; pRect++)
-        dprintf_region(stddeb, "\t%d,%d - %d,%d\n", pRect->left, pRect->top,
+        dprintf_info(region, "\t%d,%d - %d,%d\n", pRect->left, pRect->top,
 		       pRect->right, pRect->bottom);
     return;
 }
@@ -171,7 +170,7 @@
  */
 BOOL32 REGION_DeleteObject( HRGN32 hrgn, RGNOBJ * obj )
 {
-    dprintf_region(stddeb, "DeleteRegion: %04x\n", hrgn );
+    dprintf_info(region, "DeleteRegion: %04x\n", hrgn );
 
     REGION_DestroyWineRegion( obj->rgn );
     return GDI_FreeObject( hrgn );
@@ -198,7 +197,7 @@
 	int nbox = obj->rgn->numRects;
 	RECT32 *pbox = obj->rgn->rects;
 	
-	dprintf_region(stddeb, "OffsetRgn: %04x %d,%d\n", hrgn, x, y );
+	dprintf_info(region, "OffsetRgn: %04x %d,%d\n", hrgn, x, y );
 	if(nbox && (x || y)) {
 	    while(nbox--) {
 	        pbox->left += x;
@@ -240,7 +239,7 @@
     if (obj)
     {
 	INT32 ret;
-	dprintf_region(stddeb, "GetRgnBox: %04x\n", hrgn );
+	dprintf_info(region, "GetRgnBox: %04x\n", hrgn );
 	rect->left = obj->rgn->extents.left;
 	rect->top = obj->rgn->extents.top;
 	rect->right = obj->rgn->extents.right;
@@ -271,7 +270,7 @@
 
     if (!(hrgn = REGION_CreateRegion()))
 	return 0;
-    dprintf_region(stddeb, "CreateRectRgn: ");
+    dprintf_info(region, "CreateRectRgn: \n");
     SetRectRgn32(hrgn, left, top, right, bottom);
     return hrgn;
 }
@@ -312,7 +311,7 @@
 {
     RGNOBJ * obj;
 
-    dprintf_region(stddeb, "SetRectRgn: %04x %d,%d-%d,%d\n", 
+    dprintf_info(region, "SetRectRgn: %04x %d,%d-%d,%d\n", 
 		   hrgn, left, top, right, bottom );
     
     if (!(obj = (RGNOBJ *) GDI_GetObjPtr( hrgn, REGION_MAGIC ))) return;
@@ -365,7 +364,7 @@
 
     if (!(hrgn = REGION_CreateRegion())) return 0;
     obj = (RGNOBJ *) GDI_HEAP_LOCK( hrgn );
-    dprintf_region(stddeb,"CreateRoundRectRgn(%d,%d-%d,%d %dx%d): ret=%04x\n",
+    dprintf_info(region,"CreateRoundRectRgn(%d,%d-%d,%d %dx%d): ret=%04x\n",
 	       left, top, right, bottom, ellipse_width, ellipse_height, hrgn );
 
       /* Check parameters */
@@ -496,7 +495,7 @@
     DWORD size;
     RGNOBJ *obj = (RGNOBJ *) GDI_GetObjPtr( hrgn, REGION_MAGIC );
     
-    dprintf_region(stddeb, "GetRegionData: %04x count = %ld, rgndata = %p\n",
+    dprintf_info(region, "GetRegionData: %04x count = %ld, rgndata = %p\n",
 		   hrgn, count, rgndata);
 
     if(!obj) return 0;
@@ -533,7 +532,7 @@
     RGNOBJ *obj = (RGNOBJ *) GDI_GetObjPtr( hrgn, REGION_MAGIC );
     RECT32 *pCurRect, *pEndRect;
 
-    dprintf_region(stddeb, "ExtCreateRegion: %p %ld %p. Returning %04x\n",
+    dprintf_info(region, "ExtCreateRegion: %p %ld %p. Returning %04x\n",
 		   lpXform, dwCount, rgndata, hrgn);
     if(!hrgn)
     {
@@ -774,7 +773,7 @@
     DC * dc = DC_GetDCPtr( hdc );
     RECT32 tmpRect;
 
-    dprintf_region( stddeb, "REGION_LPTODP: hdc=%04x dest=%04x src=%04x\n",
+    dprintf_info(region, "REGION_LPTODP: hdc=%04x dest=%04x src=%04x\n",
 		    hdc, hDest, hSrc) ;
     
     if (dc->w.MapMode == MM_TEXT) /* Requires only a translation */
@@ -829,7 +828,7 @@
     RGNOBJ *destObj = (RGNOBJ *) GDI_GetObjPtr( hDest, REGION_MAGIC);
     INT32 result = ERROR;
 
-    dprintf_region(stddeb, "CombineRgn: %04x,%04x -> %04x mode=%x\n", 
+    dprintf_info(region, "CombineRgn: %04x,%04x -> %04x mode=%x\n", 
 		   hSrc1, hSrc2, hDest, mode );
     if (destObj)
     {
@@ -837,8 +836,9 @@
 
 	if (src1Obj)
 	{
-	    dprintf_region(stddeb, "src1:\n");
-	    if(debugging_region) REGION_DumpRegion(src1Obj->rgn);
+	    dprintf_info(region, "src1:\n");
+	    if(debugging_info(region)) 
+	      REGION_DumpRegion(src1Obj->rgn);
 	    if (mode == RGN_COPY)
 	    {
 		REGION_CopyRegion( destObj->rgn, src1Obj->rgn );
@@ -850,8 +850,9 @@
 
 		if (src2Obj)
 		{
-		    dprintf_region(stddeb, "src2:\n");
-		    if(debugging_region) REGION_DumpRegion(src2Obj->rgn);
+		    dprintf_info(region, "src2:\n");
+		    if(debugging_info(region)) 
+		      REGION_DumpRegion(src2Obj->rgn);
 		    switch (mode)
 		    {
 		    case RGN_AND:
@@ -873,8 +874,9 @@
 	    }
 	    GDI_HEAP_UNLOCK( hSrc1 );
 	}
-	dprintf_region(stddeb, "dest:\n");
-	if(debugging_region) REGION_DumpRegion(destObj->rgn);
+	dprintf_info(region, "dest:\n");
+	if(debugging_info(region)) 
+	  REGION_DumpRegion(destObj->rgn);
 
 	GDI_HEAP_UNLOCK( hDest );
     }
diff --git a/objects/text.c b/objects/text.c
index 60ec10c..87cab6d 100644
--- a/objects/text.c
+++ b/objects/text.c
@@ -10,8 +10,6 @@
 #include "dc.h"
 #include "gdi.h"
 #include "heap.h"
-#include "stddebug.h"
-/* #define DEBUG_TEXT */
 #include "debug.h"
 #include "cache.h"
 
@@ -200,7 +198,7 @@
     int width = rect->right - rect->left;
     int max_width = 0;
 
-    dprintf_text(stddeb,"DrawText: '%s', %d , [(%d,%d),(%d,%d)]\n", str,
+    dprintf_info(text,"DrawText: '%s', %d , [(%d,%d),(%d,%d)]\n", str,
 		 count, rect->left, rect->top, rect->right, rect->bottom);
     
     if (count == -1) count = strlen(str);
@@ -638,7 +636,7 @@
                              INT16 count, INT16 cTabStops,
                              const INT16 *lpTabPos, INT16 nTabOrg )
 {
-    dprintf_text( stddeb, "TabbedTextOut16: %04x %d,%d '%.*s' %d\n",
+    dprintf_info(text, "TabbedTextOut16: %04x %d,%d '%.*s' %d\n",
                   hdc, x, y, count, lpstr, count );
     return TEXT_TabbedTextOut( hdc, x, y, lpstr, count, cTabStops,
                                lpTabPos, NULL, nTabOrg, TRUE );
@@ -652,7 +650,7 @@
                               INT32 count, INT32 cTabStops,
                               const INT32 *lpTabPos, INT32 nTabOrg )
 {
-    dprintf_text( stddeb, "TabbedTextOut32A: %04x %d,%d '%.*s' %d\n",
+    dprintf_info(text, "TabbedTextOut32A: %04x %d,%d '%.*s' %d\n",
                   hdc, x, y, count, lpstr, count );
     return TEXT_TabbedTextOut( hdc, x, y, lpstr, count, cTabStops,
                                NULL, lpTabPos, nTabOrg, TRUE );
@@ -682,7 +680,7 @@
 DWORD WINAPI GetTabbedTextExtent16( HDC16 hdc, LPCSTR lpstr, INT16 count, 
                                     INT16 cTabStops, const INT16 *lpTabPos )
 {
-    dprintf_text( stddeb, "GetTabbedTextExtent: %04x '%.*s' %d\n",
+    dprintf_info(text, "GetTabbedTextExtent: %04x '%.*s' %d\n",
                   hdc, count, lpstr, count );
     return TEXT_TabbedTextOut( hdc, 0, 0, lpstr, count, cTabStops,
                                lpTabPos, NULL, 0, FALSE );
@@ -695,7 +693,7 @@
 DWORD WINAPI GetTabbedTextExtent32A( HDC32 hdc, LPCSTR lpstr, INT32 count, 
                                      INT32 cTabStops, const INT32 *lpTabPos )
 {
-    dprintf_text( stddeb, "GetTabbedTextExtent: %04x '%.*s' %d\n",
+    dprintf_info(text, "GetTabbedTextExtent: %04x '%.*s' %d\n",
                   hdc, count, lpstr, count );
     return TEXT_TabbedTextOut( hdc, 0, 0, lpstr, count, cTabStops,
                                NULL, lpTabPos, 0, FALSE );
diff --git a/ole/Makefile.in b/ole/Makefile.in
index 1d923733..85e981a 100644
--- a/ole/Makefile.in
+++ b/ole/Makefile.in
@@ -13,7 +13,8 @@
 	ole2disp.c \
 	ole2nls.c \
 	olecli.c \
-	olesvr.c
+	olesvr.c \
+	storage.c
 
 all: $(MODULE).o
 
diff --git a/ole/compobj.c b/ole/compobj.c
index ef476a9..0484f78 100644
--- a/ole/compobj.c
+++ b/ole/compobj.c
@@ -12,10 +12,12 @@
 #include <time.h>
 #include "ole.h"
 #include "ole2.h"
-#include "stddebug.h"
+#include "winerror.h"
 #include "debug.h"
 #include "file.h"
 #include "compobj.h"
+#include "heap.h"
+#include "ldt.h"
 #include "interfaces.h"
 #include "shlobj.h"
 #include "ddraw.h"
@@ -23,27 +25,36 @@
 #include "dinput.h"
 #include "d3d.h"
 
-DWORD currentMalloc=0;
+LPMALLOC16 currentMalloc16=NULL;
+LPMALLOC32 currentMalloc32=NULL;
 
 /***********************************************************************
  *           CoBuildVersion [COMPOBJ.1]
  */
 DWORD WINAPI CoBuildVersion()
 {
-	dprintf_ole(stddeb,"CoBuildVersion()\n");
-	return (rmm<<16)+rup;
+    dprintf_info(ole,"CoBuildVersion()\n");
+    return (rmm<<16)+rup;
 }
 
 /***********************************************************************
  *           CoInitialize	[COMPOBJ.2]
- * lpReserved is an IMalloc pointer in 16bit OLE. We just stored it as-is.
+ * lpReserved is an IMalloc pointer in 16bit OLE.
  */
-HRESULT WINAPI CoInitialize(DWORD lpReserved)
+HRESULT WINAPI CoInitialize16(LPMALLOC16 lpReserved)
 {
-	dprintf_ole(stdnimp,"CoInitialize\n");
-	/* remember the LPMALLOC, maybe somebody wants to read it later on */
-	currentMalloc = lpReserved;
-	return S_OK;
+    currentMalloc16 = lpReserved;
+    return S_OK;
+}
+
+/***********************************************************************
+ *           CoInitialize	(OLE32.26)
+ * lpReserved is an IMalloc pointer in 32bit OLE.
+ */
+HRESULT WINAPI CoInitialize32(LPMALLOC32 lpReserved)
+{
+    currentMalloc32 = lpReserved;
+    return S_OK;
 }
 
 /***********************************************************************
@@ -51,22 +62,29 @@
  */
 void WINAPI CoUnitialize()
 {
-	dprintf_ole(stdnimp,"CoUnitialize()\n");
+    dprintf_info(ole,"CoUnitialize()\n");
 }
 
 /***********************************************************************
  *           CoGetMalloc    [COMPOBJ.4]
  */
-HRESULT WINAPI CoGetMalloc(DWORD dwMemContext, DWORD * lpMalloc)
+HRESULT WINAPI CoGetMalloc16(DWORD dwMemContext, LPMALLOC16 * lpMalloc)
 {
-	if(currentMalloc)
-	{
-		*lpMalloc = currentMalloc;
-		return S_OK;
-	}
-	*lpMalloc = 0;
-	/* 16-bit E_NOTIMPL */
-	return 0x80000001L;
+    if(!currentMalloc16)
+	currentMalloc16 = IMalloc16_Constructor();
+    *lpMalloc = currentMalloc16;
+    return S_OK;
+}
+
+/***********************************************************************
+ *           CoGetMalloc    (OLE32.4]
+ */
+HRESULT WINAPI CoGetMalloc32(DWORD dwMemContext, LPMALLOC32 *lpMalloc)
+{
+    if(!currentMalloc32)
+	currentMalloc32 = IMalloc32_Constructor();
+    *lpMalloc = currentMalloc32;
+    return S_OK;
 }
 
 /***********************************************************************
@@ -74,8 +92,8 @@
  */
 OLESTATUS WINAPI CoDisconnectObject( LPUNKNOWN lpUnk, DWORD reserved )
 {
-    dprintf_ole(stdnimp,"CoDisconnectObject:%p %lx\n",lpUnk,reserved);
-    return OLE_OK;
+    dprintf_info(ole,"CoDisconnectObject:%p %lx\n",lpUnk,reserved);
+    return S_OK;
 }
 
 /***********************************************************************
@@ -92,14 +110,14 @@
 
 /* Class id: DWORD-WORD-WORD-BYTES[2]-BYTES[6] */
 
-OLESTATUS WINAPI CLSIDFromString(const LPCSTR idstr, CLSID *id)
+OLESTATUS WINAPI CLSIDFromString16(const LPCOLESTR16 idstr, CLSID *id)
 {
   BYTE *s = (BYTE *) idstr;
   BYTE *p;
   int	i;
   BYTE table[256];
 
-  dprintf_ole(stddeb,"ClsIDFromString() %s -> %p\n", idstr, id);
+  dprintf_info(ole,"ClsIDFromString() %s -> %p\n", idstr, id);
 
   /* quick lookup table */
   memset(table, 0, 256);
@@ -153,13 +171,25 @@
     s += 2;
   }
 
-  return OLE_OK;
+  return S_OK;
+}
+
+/***********************************************************************
+ *           CLSIDFromString (OLE32.3)
+ */
+OLESTATUS WINAPI CLSIDFromString32(const LPCOLESTR32 idstr, CLSID *id)
+{
+    LPOLESTR16      xid = HEAP_strdupWtoA(GetProcessHeap(),0,idstr);
+    OLESTATUS       ret = CLSIDFromString16(xid,id);
+
+    HeapFree(GetProcessHeap(),0,xid);
+    return ret;
 }
 
 /***********************************************************************
  *           StringFromCLSID [COMPOBJ.19]
  */
-OLESTATUS WINAPI StringFromCLSID(const CLSID *id, LPSTR idstr)
+OLESTATUS WINAPI WINE_StringFromCLSID(const CLSID *id, LPSTR idstr)
 {
   static const char *hex = "0123456789ABCDEF";
   char *s;
@@ -183,16 +213,64 @@
     idstr[i] = toupper(idstr[i]);
   }
 
-  dprintf_ole(stddeb,"StringFromClsID: %p->%s\n", id, idstr);
+  dprintf_info(ole,"StringFromClsID: %p->%s\n", id, idstr);
 
   return OLE_OK;
 }
 
+OLESTATUS WINAPI StringFromCLSID16(const CLSID *id, LPOLESTR16 *idstr)
+{
+    LPMALLOC16	mllc;
+    OLESTATUS	ret;
+    DWORD	args[2];
+
+    ret = CoGetMalloc16(0,&mllc);
+    if (ret) return ret;
+
+    args[0] = (DWORD)mllc;
+    args[1] = 40;
+
+    /* No need for a Callback entry, we have WOWCallback16Ex which does
+     * everything we need.
+     */
+    if (!WOWCallback16Ex(
+    	(FARPROC16)((LPMALLOC16_VTABLE)PTR_SEG_TO_LIN(
+		((LPMALLOC16)PTR_SEG_TO_LIN(mllc))->lpvtbl)
+	)->fnAlloc,
+	WCB16_CDECL,
+	2,
+	(LPVOID)args,
+	(LPDWORD)idstr
+    )) {
+    	fprintf(stderr,"CallTo16 IMalloc16 failed\n");
+    	return E_FAIL;
+    }
+    return WINE_StringFromCLSID(id,PTR_SEG_TO_LIN(*idstr));
+}
+
+OLESTATUS WINAPI StringFromCLSID32(const CLSID *id, LPOLESTR32 *idstr)
+{
+	char            buf[80];
+	OLESTATUS       ret;
+	LPMALLOC32	mllc;
+
+	if ((ret=CoGetMalloc32(0,&mllc)))
+		return ret;
+
+	ret=WINE_StringFromCLSID(id,buf);
+	if (!ret) {
+		*idstr = mllc->lpvtbl->fnAlloc(mllc,strlen(buf)*2+2);
+		lstrcpyAtoW(*idstr,buf);
+	}
+	return ret;
+}
+
+
 /***********************************************************************
  *           CLSIDFromProgID [COMPOBJ.61]
  */
 
-OLESTATUS WINAPI CLSIDFromProgID(LPCSTR progid,LPCLSID riid)
+OLESTATUS WINAPI CLSIDFromProgID16(LPCSTR progid,LPCLSID riid)
 {
 	char	*buf,buf2[80];
 	DWORD	buf2len;
@@ -212,7 +290,19 @@
 		return OLE_ERROR_GENERIC;
 	}
 	RegCloseKey(xhkey);
-	return CLSIDFromString(buf2,riid);
+	return CLSIDFromString16(buf2,riid);
+}
+
+/***********************************************************************
+ *           CLSIDFromProgID (OLE32.2)
+ */
+OLESTATUS WINAPI CLSIDFromProgID32(LPCOLESTR32 progid,LPCLSID riid)
+{
+	LPOLESTR16 pid = HEAP_strdupWtoA(GetProcessHeap(),0,progid);
+	OLESTATUS       ret = CLSIDFromProgID16(pid,riid);
+
+	HeapFree(GetProcessHeap(),0,pid);
+	return ret;
 }
 
 OLESTATUS WINAPI LookupETask(LPVOID p1,LPVOID p2) {
@@ -228,13 +318,13 @@
 /***********************************************************************
  *		CoRegisterClassObject [COMPOBJ.5]
  */
-OLESTATUS WINAPI CoRegisterClassObject(
+OLESTATUS WINAPI CoRegisterClassObject16(
 	REFCLSID rclsid, LPUNKNOWN pUnk,DWORD dwClsContext,DWORD flags,
 	LPDWORD lpdwRegister
 ) {
 	char	buf[80];
 
-	StringFromCLSID(rclsid,buf);
+	WINE_StringFromCLSID(rclsid,buf);
 
 	fprintf(stderr,"CoRegisterClassObject(%s,%p,0x%08lx,0x%08lx,%p),stub\n",
 		buf,pUnk,dwClsContext,flags,lpdwRegister
@@ -243,7 +333,24 @@
 }
 
 /***********************************************************************
- *		CoRegisterClassObject [COMPOBJ.27]
+ *		CoRegisterClassObject (OLE32.36)
+ */
+OLESTATUS WINAPI CoRegisterClassObject32(
+	REFCLSID rclsid, LPUNKNOWN pUnk,DWORD dwClsContext,DWORD flags,
+	LPDWORD lpdwRegister
+) {
+    char buf[80];
+
+    WINE_StringFromCLSID(rclsid,buf);
+
+    fprintf(stderr,"CoRegisterClassObject(%s,%p,0x%08lx,0x%08lx,%p),stub\n",
+	    buf,pUnk,dwClsContext,flags,lpdwRegister
+    );
+    return 0;
+}
+
+/***********************************************************************
+ *		CoRegisterMessageFilter [COMPOBJ.27]
  */
 OLESTATUS WINAPI CoRegisterMessageFilter16(
 	LPMESSAGEFILTER lpMessageFilter,LPMESSAGEFILTER *lplpMessageFilter
@@ -283,3 +390,34 @@
 	DOSFS_UnixTimeToFileTime(time(NULL), lpFileTime, 0);
 	return S_OK;
 }
+
+/***********************************************************************
+ *           CoTaskMemAlloc (OLE32.43)
+ */
+LPVOID WINAPI CoTaskMemAlloc(ULONG size) {
+    LPMALLOC32	lpmalloc;
+    HRESULT	ret = CoGetMalloc32(0,&lpmalloc);
+
+    if (ret) 
+	return NULL;
+    return lpmalloc->lpvtbl->fnAlloc(lpmalloc,size);
+}
+
+/***********************************************************************
+ *           CoTaskMemFree (OLE32.44)
+ */
+VOID WINAPI CoTaskMemFree(LPVOID ptr) {
+    LPMALLOC32	lpmalloc;
+    HRESULT	ret = CoGetMalloc32(0,&lpmalloc);
+
+    if (ret) return;
+    return lpmalloc->lpvtbl->fnFree(lpmalloc,ptr);
+}
+
+/***********************************************************************
+ *           CoInitializeWOW (OLE32.27)
+ */
+HRESULT WINAPI CoInitializeWOW(DWORD x,DWORD y) {
+    fprintf(stderr,"CoInitializeWOW(0x%08lx,0x%08lx),stub!\n",x,y);
+    return 0;
+}
diff --git a/ole/folders.c b/ole/folders.c
index 45d5466..7903e89 100644
--- a/ole/folders.c
+++ b/ole/folders.c
@@ -9,7 +9,6 @@
 #include <string.h>
 #include "ole.h"
 #include "ole2.h"
-#include "stddebug.h"
 #include "debug.h"
 #include "compobj.h"
 #include "interfaces.h"
@@ -95,7 +94,7 @@
 ) {
 	char	xclsid[50];
 
-	StringFromCLSID(riid,xclsid);
+	WINE_StringFromCLSID(riid,xclsid);
 	fprintf(stderr,"IShellFolder(%p)->BindToObject(%p,%p,%s,%p),stub!\n",
 		this,pidl,pbcReserved,xclsid,ppvOut
 	);
@@ -105,10 +104,10 @@
 
 static HRESULT WINAPI IShellFolder_ParseDisplayName(
 	LPSHELLFOLDER this,HWND32 hwndOwner,LPBC pbcReserved,
-	LPOLESTR lpszDisplayName,DWORD *pchEaten,LPITEMIDLIST *ppidl,
+	LPOLESTR32 lpszDisplayName,DWORD *pchEaten,LPITEMIDLIST *ppidl,
 	DWORD *pdwAttributes
 ) {
-	fprintf(stderr,"IShellFolder(%p)->ParseDisplayName(%08x,%p,%s,%p,%p,%p),stub!\n",
+	fprintf(stderr,"IShellFolder(%p)->ParseDisplayName(%08x,%p,%p,%p,%p,%p),stub!\n",
 		this,hwndOwner,pbcReserved,lpszDisplayName,pchEaten,ppidl,pdwAttributes
 	);
 	*(DWORD*)pbcReserved = 0;
@@ -131,7 +130,7 @@
 ) {
 	char	xclsid[50];
 
-	StringFromCLSID(riid,xclsid);
+	WINE_StringFromCLSID(riid,xclsid);
 	fprintf(stderr,"IShellFolder(%p)->CreateViewObject(0x%04x,%s,%p),stub!\n",
 		this,hwndOwner,xclsid,ppv
 	);
diff --git a/ole/ifs.c b/ole/ifs.c
index 958a0ae..8e6147b 100644
--- a/ole/ifs.c
+++ b/ole/ifs.c
@@ -7,21 +7,28 @@
 #include <ctype.h>
 #include <stdlib.h>
 #include <string.h>
+#include <assert.h>
 #include "winerror.h"
 #include "ole.h"
 #include "ole2.h"
+#include "ldt.h"
+#include "heap.h"
 #include "compobj.h"
 #include "interfaces.h"
 #include "shlobj.h"
-#include "stddebug.h"
+#include "local.h"
+#include "module.h"
 #include "debug.h"
 
+/****************************************************************************
+ * IUnknown
+ */
 static ULONG WINAPI IUnknown_AddRef(LPUNKNOWN this) { 
-	dprintf_relay(stddeb,"IUnknown(%p)->AddRef()\n",this);
+	dprintf_info(relay,"IUnknown(%p)->AddRef()\n",this);
 	return ++(this->ref);
 }
 static ULONG WINAPI IUnknown_Release(LPUNKNOWN this) {
-	dprintf_relay(stddeb,"IUnknown(%p)->Release()\n",this);
+	dprintf_info(relay,"IUnknown(%p)->Release()\n",this);
 	if (!--(this->ref)) {
 		HeapFree(GetProcessHeap(),0,this);
 		return 0;
@@ -32,8 +39,8 @@
 static HRESULT WINAPI IUnknown_QueryInterface(LPUNKNOWN this,REFIID refiid,LPVOID *obj) {
 	char	xrefiid[50];
 
-	StringFromCLSID((LPCLSID)refiid,xrefiid);
-	dprintf_relay(stddeb,"IUnknown(%p)->QueryInterface(%s,%p)\n",this,xrefiid,obj);
+	WINE_StringFromCLSID((LPCLSID)refiid,xrefiid);
+	dprintf_info(relay,"IUnknown(%p)->QueryInterface(%s,%p)\n",this,xrefiid,obj);
 
 	if (!memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown))) {
 		*obj = this;
@@ -53,28 +60,30 @@
 IUnknown_Constructor() {
 	LPUNKNOWN	unk;
 
-	fprintf(stderr,"cloning IUnknown.\n");
 	unk = (LPUNKNOWN)HeapAlloc(GetProcessHeap(),0,sizeof(IUnknown));
 	unk->lpvtbl	= &uvt;
 	unk->ref	= 1;
 	return unk;
 }
 
-static ULONG WINAPI IMalloc_AddRef(LPMALLOC this) {
-	dprintf_relay(stddeb,"IMalloc(%p)->AddRef()\n",this);
+/****************************************************************************
+ * IMalloc16
+ */
+ULONG WINAPI IMalloc16_AddRef(LPMALLOC16 this) {
+	dprintf_info(relay,"IMalloc16(%p)->AddRef()\n",this);
 	return 1; /* cannot be freed */
 }
 
-static ULONG WINAPI IMalloc_Release(LPMALLOC this) {
-	dprintf_relay(stddeb,"IMalloc(%p)->Release()\n",this);
+ULONG WINAPI IMalloc16_Release(LPMALLOC16 this) {
+	dprintf_info(relay,"IMalloc16(%p)->Release()\n",this);
 	return 1; /* cannot be freed */
 }
 
-static HRESULT WINAPI IMalloc_QueryInterface(LPMALLOC this,REFIID refiid,LPVOID *obj) {
+HRESULT WINAPI IMalloc16_QueryInterface(LPMALLOC16 this,REFIID refiid,LPVOID *obj) {
 	char	xrefiid[50];
 
-	StringFromCLSID((LPCLSID)refiid,xrefiid);
-	dprintf_relay(stddeb,"IMalloc(%p)->QueryInterface(%s,%p)\n",this,xrefiid,obj);
+	WINE_StringFromCLSID((LPCLSID)refiid,xrefiid);
+	dprintf_info(relay,"IMalloc16(%p)->QueryInterface(%s,%p)\n",this,xrefiid,obj);
 	if (	!memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown)) ||
 		!memcmp(&IID_IMalloc,refiid,sizeof(IID_IMalloc))
 	) {
@@ -84,53 +93,164 @@
 	return OLE_E_ENUM_NOMORE; 
 }
 
-static LPVOID WINAPI IMalloc_Alloc(LPMALLOC this,DWORD cb) {
-	dprintf_relay(stddeb,"IMalloc(%p)->Alloc(%ld)\n",this,cb);
-	return HeapAlloc(GetProcessHeap(),0,cb);
+LPVOID WINAPI IMalloc16_Alloc(LPMALLOC16 this,DWORD cb) {
+	dprintf_info(relay,"IMalloc16(%p)->Alloc(%ld)\n",this,cb);
+	return (LPVOID)PTR_SEG_OFF_TO_SEGPTR(this->heap,LOCAL_Alloc(this->heap,0,cb));
 }
 
-static LPVOID WINAPI IMalloc_Realloc(LPMALLOC this,LPVOID pv,DWORD cb) {
-	dprintf_relay(stddeb,"IMalloc(%p)->Realloc(%p,%ld)\n",this,pv,cb);
-	return HeapReAlloc(GetProcessHeap(),0,pv,cb);
+LPVOID WINAPI IMalloc16_Realloc(LPMALLOC16 this,LPVOID pv,DWORD cb) {
+	dprintf_info(relay,"IMalloc16(%p)->Realloc(%p,%ld)\n",this,pv,cb);
+	return (LPVOID)PTR_SEG_OFF_TO_SEGPTR(this->heap,LOCAL_ReAlloc(this->heap,0,LOWORD(pv),cb));
 }
-static VOID WINAPI IMalloc_Free(LPMALLOC this,LPVOID pv) {
-	dprintf_relay(stddeb,"IMalloc(%p)->Free(%p)\n",this,pv);
-	HeapFree(GetProcessHeap(),0,pv);
+VOID WINAPI IMalloc16_Free(LPMALLOC16 this,LPVOID pv) {
+	dprintf_info(relay,"IMalloc16(%p)->Free(%p)\n",this,pv);
+	LOCAL_Free(this->heap,LOWORD(pv));
 }
 
-static DWORD WINAPI IMalloc_GetSize(LPMALLOC this,LPVOID pv) {
-	dprintf_relay(stddeb,"IMalloc(%p)->GetSize(%p)\n",this,pv);
-	return HeapSize(GetProcessHeap(),0,pv);
+DWORD WINAPI IMalloc16_GetSize(LPMALLOC16 this,LPVOID pv) {
+	dprintf_info(relay,"IMalloc16(%p)->GetSize(%p)\n",this,pv);
+	return LOCAL_Size(this->heap,LOWORD(pv));
 }
 
-static LPINT32 WINAPI IMalloc_DidAlloc(LPMALLOC this,LPVOID pv) {
-	dprintf_relay(stddeb,"IMalloc(%p)->DidAlloc(%p)\n",this,pv);
-	return (LPINT32)0xffffffff;
+INT16 WINAPI IMalloc16_DidAlloc(LPMALLOC16 this,LPVOID pv) {
+	dprintf_info(relay,"IMalloc16(%p)->DidAlloc(%p)\n",this,pv);
+	return (INT16)-1;
 }
-static LPVOID WINAPI IMalloc_HeapMinimize(LPMALLOC this) {
-	dprintf_relay(stddeb,"IMalloc(%p)->HeapMinimize()\n",this);
+LPVOID WINAPI IMalloc16_HeapMinimize(LPMALLOC16 this) {
+	dprintf_info(relay,"IMalloc16(%p)->HeapMinimize()\n",this);
 	return NULL;
 }
 
-static IMalloc_VTable VT_IMalloc = {
-	IMalloc_QueryInterface,
-	IMalloc_AddRef,
-	IMalloc_Release,
-	IMalloc_Alloc,
-	IMalloc_Realloc,
-	IMalloc_Free,
-	IMalloc_GetSize,
-	IMalloc_DidAlloc,
-	IMalloc_HeapMinimize,
+static IMalloc16_VTable mvt16 = {
+	IMalloc16_QueryInterface,
+	IMalloc16_AddRef,
+	IMalloc16_Release,
+	IMalloc16_Alloc,
+	IMalloc16_Realloc,
+	IMalloc16_Free,
+	IMalloc16_GetSize,
+	IMalloc16_DidAlloc,
+	IMalloc16_HeapMinimize,
+};
+static IMalloc16_VTable *msegvt16 = NULL;
+
+LPMALLOC16
+IMalloc16_Constructor() {
+	LPMALLOC16	this;
+
+	this = (LPMALLOC16)SEGPTR_NEW(IMalloc16);
+	if (__winelib) {
+		this->lpvtbl = &mvt16;
+	} else {
+		HMODULE16	hcomp = GetModuleHandle16("COMPOBJ");
+		if (!msegvt16) {
+			msegvt16 = SEGPTR_NEW(IMalloc16_VTable);
+#define FN(x) this->lpvtbl->fn##x = (void*)WIN32_GetProcAddress16(hcomp,"IMalloc16_"#x);assert(this->lpvtbl->fn##x);
+			FN(QueryInterface)
+			FN(AddRef)
+			FN(Release)
+			FN(Alloc)
+			FN(Realloc)
+			FN(Free)
+			FN(GetSize)
+			FN(DidAlloc)
+			FN(HeapMinimize)
+			msegvt16 = (LPMALLOC16_VTABLE)SEGPTR_GET(msegvt16);
+#undef FN
+		}
+		this->lpvtbl = msegvt16;
+	}
+	this->ref = 1;
+	/* FIXME: implement multiple heaps */
+	this->heap = GlobalAlloc16(GMEM_MOVEABLE,64000);
+	LocalInit(this->heap,0,64000);
+	return (LPMALLOC16)SEGPTR_GET(this);
+}
+
+/****************************************************************************
+ * IMalloc32
+ */
+static ULONG WINAPI IMalloc32_AddRef(LPMALLOC32 this) {
+	dprintf_info(relay,"IMalloc32(%p)->AddRef()\n",this);
+	return 1; /* cannot be freed */
+}
+
+static ULONG WINAPI IMalloc32_Release(LPMALLOC32 this) {
+	dprintf_info(relay,"IMalloc32(%p)->Release()\n",this);
+	return 1; /* cannot be freed */
+}
+
+static HRESULT WINAPI IMalloc32_QueryInterface(LPMALLOC32 this,REFIID refiid,LPVOID *obj) {
+	char	xrefiid[50];
+
+	WINE_StringFromCLSID((LPCLSID)refiid,xrefiid);
+	dprintf_info(relay,"IMalloc32(%p)->QueryInterface(%s,%p)\n",this,xrefiid,obj);
+	if (	!memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown)) ||
+		!memcmp(&IID_IMalloc,refiid,sizeof(IID_IMalloc))
+	) {
+		*obj = this;
+		return 0;
+	}
+	return OLE_E_ENUM_NOMORE; 
+}
+
+static LPVOID WINAPI IMalloc32_Alloc(LPMALLOC32 this,DWORD cb) {
+	dprintf_info(relay,"IMalloc32(%p)->Alloc(%ld)\n",this,cb);
+	return HeapAlloc(GetProcessHeap(),0,cb);
+}
+
+static LPVOID WINAPI IMalloc32_Realloc(LPMALLOC32 this,LPVOID pv,DWORD cb) {
+	dprintf_info(relay,"IMalloc32(%p)->Realloc(%p,%ld)\n",this,pv,cb);
+	return HeapReAlloc(GetProcessHeap(),0,pv,cb);
+}
+static VOID WINAPI IMalloc32_Free(LPMALLOC32 this,LPVOID pv) {
+	dprintf_info(relay,"IMalloc32(%p)->Free(%p)\n",this,pv);
+	HeapFree(GetProcessHeap(),0,pv);
+}
+
+static DWORD WINAPI IMalloc32_GetSize(LPMALLOC32 this,LPVOID pv) {
+	dprintf_info(relay,"IMalloc32(%p)->GetSize(%p)\n",this,pv);
+	return HeapSize(GetProcessHeap(),0,pv);
+}
+
+static INT32 WINAPI IMalloc32_DidAlloc(LPMALLOC32 this,LPVOID pv) {
+	dprintf_info(relay,"IMalloc32(%p)->DidAlloc(%p)\n",this,pv);
+	return -1;
+}
+static LPVOID WINAPI IMalloc32_HeapMinimize(LPMALLOC32 this) {
+	dprintf_info(relay,"IMalloc32(%p)->HeapMinimize()\n",this);
+	return NULL;
+}
+
+static IMalloc32_VTable VT_IMalloc32 = {
+	IMalloc32_QueryInterface,
+	IMalloc32_AddRef,
+	IMalloc32_Release,
+	IMalloc32_Alloc,
+	IMalloc32_Realloc,
+	IMalloc32_Free,
+	IMalloc32_GetSize,
+	IMalloc32_DidAlloc,
+	IMalloc32_HeapMinimize,
 };
 
-LPMALLOC
-IMalloc_Constructor() {
-	LPMALLOC	this;
+LPMALLOC32
+IMalloc32_Constructor() {
+	LPMALLOC32	this;
 
-	fprintf(stderr,"cloning IMalloc\n");
-	this = (LPMALLOC)HeapAlloc(GetProcessHeap(),0,sizeof(IMalloc));
-	this->lpvtbl = &VT_IMalloc;
+	this = (LPMALLOC32)HeapAlloc(GetProcessHeap(),0,sizeof(IMalloc32));
+	this->lpvtbl = &VT_IMalloc32;
 	this->ref = 1;
 	return this;
 }
+/****************************************************************************
+ * API Functions
+ */
+BOOL32 WINAPI IsValidInterface32(LPUNKNOWN punk) {
+	return !(
+		IsBadReadPtr32(punk,4)					||
+		IsBadReadPtr32(punk->lpvtbl,4)				||
+		IsBadReadPtr32(punk->lpvtbl->fnQueryInterface,9)	||
+		IsBadCodePtr32(punk->lpvtbl->fnQueryInterface)
+	);
+}
diff --git a/ole/ole2.c b/ole/ole2.c
index 565b0a6..8171ac4 100644
--- a/ole/ole2.c
+++ b/ole/ole2.c
@@ -9,7 +9,7 @@
 
 #include "windows.h"
 #include "ole2.h"
-#include "stddebug.h"
+#include "process.h"
 #include "debug.h"
 
 /***********************************************************************
@@ -17,7 +17,7 @@
  */
 DWORD WINAPI OleBuildVersion()
 {
-    dprintf_ole(stddeb,"OleBuildVersion()\n");
+    dprintf_info(ole,"OleBuildVersion()\n");
     return (rmm<<16)+rup;
 }
 
@@ -26,8 +26,12 @@
  */
 HRESULT WINAPI OleInitialize(LPVOID reserved)
 {
-    dprintf_ole(stdnimp,"OleInitialize\n");
-	return S_OK;
+    dprintf_fixme(ole,"OleInitialize - stub\n");
+    return S_OK;
+}
+
+DWORD WINAPI CoGetCurrentProcess() {
+	return PROCESS_Current();
 }
 
 /***********************************************************************
@@ -35,7 +39,7 @@
  */
 void WINAPI OleUninitialize(void)
 {
-    dprintf_ole(stdnimp,"OleUninitialize()\n");
+    dprintf_fixme(ole,"OleUninitialize() - stub\n");
 }
 
 /***********************************************************************
@@ -53,9 +57,17 @@
     LPMESSAGEFILTER lpMessageFilter,	/* Pointer to interface */
     LPMESSAGEFILTER *lplpMessageFilter	/* Indirect pointer to prior instance if non-NULL */
 ) {
-    dprintf_ole(stdnimp,"CoRegisterMessageFilter()\n");
+    dprintf_fixme(ole,"CoRegisterMessageFilter() - stub\n");
     if (lplpMessageFilter) {
 	*lplpMessageFilter = NULL;
     }
     return S_OK;
 }
+
+/***********************************************************************
+ *           OleInitializeWOW (OLE32.27)
+ */
+HRESULT WINAPI OleInitializeWOW(DWORD x) {
+        fprintf(stderr,"OleInitializeWOW(0x%08lx),stub!\n",x);
+        return 0;
+}
diff --git a/ole/ole2disp.c b/ole/ole2disp.c
index 405ce66..e07538f 100644
--- a/ole/ole2disp.c
+++ b/ole/ole2disp.c
@@ -10,7 +10,6 @@
 #include "interfaces.h"
 #include "heap.h"
 #include "ldt.h"
-#include "stddebug.h"
 #include "debug.h"
 
 /* This implementation of the BSTR API is 16-bit only. It
@@ -104,7 +103,7 @@
 	IUnknown * punk,REFCLSID rclsid,DWORD dwFlags, DWORD * pdwRegister
 ) {
 	char	buf[80];
-	StringFromCLSID(rclsid,buf);
+	WINE_StringFromCLSID(rclsid,buf);
 	fprintf(stderr,"RegisterActiveObject(%p,%s,0x%08lx,%p),stub\n",punk,buf,dwFlags,pdwRegister);
 	return 0;
 }
diff --git a/ole/ole2nls.c b/ole/ole2nls.c
index 477927b..b61c78d 100644
--- a/ole/ole2nls.c
+++ b/ole/ole2nls.c
@@ -2,10 +2,12 @@
  *	OLE2NLS library
  *
  *	Copyright 1995	Martin von Loewis
+ *      Copyright 1998  David Lee Lambert
  */
 
 #include <string.h>
 #include <ctype.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include "windows.h"
 #include "heap.h"
@@ -14,7 +16,6 @@
 #include "winnls.h"
 #include "winreg.h"
 #include "winerror.h"
-#include "stddebug.h"
 #include "debug.h"
 
 /* Locale name to id map. used by EnumSystemLocales, GetLocalInfoA 
@@ -261,7 +262,7 @@
 	char	*retString;
 	int	found,i;
 
-	dprintf_ole(stddeb,"GetLocaleInfo32A(%8lX,%8lX,%p,%4X)\n",
+	dprintf_info(ole,"GetLocaleInfo32A(%8lX,%8lX,%p,%4X)\n",
 			lcid,LCType,buf,len);
 
 	LCType &= ~(LOCALE_NOUSEROVERRIDE|LOCALE_USE_CP_ACP);
@@ -530,13 +531,13 @@
 LOCVAL(LOCALE_ILANGUAGE,"9")
 LOCVAL(LOCALE_SLANGUAGE,"English")
 LOCVAL(LOCALE_SENGLANGUAGE,"English")
-LOCVAL(LOCALE_SABBREVLANGNAME,"enu")
+LOCVAL(LOCALE_SABBREVLANGNAME,"en")
 LOCVAL(LOCALE_SNATIVELANGNAME,"English")
 LOCVAL(LOCALE_ICOUNTRY,"11")
-LOCVAL(LOCALE_SCOUNTRY,"Deutschland")
-LOCVAL(LOCALE_SENGCOUNTRY,"Deutschland")
-LOCVAL(LOCALE_SABBREVCTRYNAME,"De")
-LOCVAL(LOCALE_SNATIVECTRYNAME,"Deutschland")
+LOCVAL(LOCALE_SCOUNTRY,"United States")
+LOCVAL(LOCALE_SENGCOUNTRY,"United States")
+LOCVAL(LOCALE_SABBREVCTRYNAME,"US")
+LOCVAL(LOCALE_SNATIVECTRYNAME,"United States")
 LOCVAL(LOCALE_IDEFAULTLANGUAGE,"9")
 LOCVAL(LOCALE_IDEFAULTCOUNTRY,"49")
 LOCVAL(LOCALE_IDEFAULTCODEPAGE,"437")
@@ -545,8 +546,8 @@
 */
 LOCVAL(LOCALE_SLIST,";")
 LOCVAL(LOCALE_IMEASURE,"0")
-LOCVAL(LOCALE_SDECIMAL,",")
-LOCVAL(LOCALE_STHOUSAND,".")
+LOCVAL(LOCALE_SDECIMAL,".")
+LOCVAL(LOCALE_STHOUSAND,",")
 LOCVAL(LOCALE_SGROUPING, "3;0")
 LOCVAL(LOCALE_IDIGITS,"2")
 LOCVAL(LOCALE_ILZERO,"1")
@@ -566,7 +567,7 @@
 LOCVAL(LOCALE_INEGCURR,"8")
 LOCVAL(LOCALE_SDATE,".")
 LOCVAL(LOCALE_STIME,":")
-LOCVAL(LOCALE_SSHORTDATE,"dd.MM.yyyy")
+LOCVAL(LOCALE_SSHORTDATE,"MM/dd/yy")
 LOCVAL(LOCALE_SLONGDATE,"ddd, d. MMMM yyyy")
 LOCVAL(LOCALE_STIMEFORMAT, "h:mm:ss tt")
 LOCVAL(LOCALE_IDATE,"1")
@@ -591,49 +592,49 @@
 LOCVAL(LOCALE_IFIRSTDAYOFWEEK)
 LOCVAL(LOCALE_IFIRSTWEEKOFYEAR)
 */
-LOCVAL(LOCALE_SDAYNAME1,"Montag")
-LOCVAL(LOCALE_SDAYNAME2,"Dienstag")
-LOCVAL(LOCALE_SDAYNAME3,"Mittwoch")
-LOCVAL(LOCALE_SDAYNAME4,"Donnerstag")
-LOCVAL(LOCALE_SDAYNAME5,"Freitag")
-LOCVAL(LOCALE_SDAYNAME6,"Sonnabend")
-LOCVAL(LOCALE_SDAYNAME7,"Sonntag")
-LOCVAL(LOCALE_SABBREVDAYNAME1,"Mo")
-LOCVAL(LOCALE_SABBREVDAYNAME2,"Di")
-LOCVAL(LOCALE_SABBREVDAYNAME3,"Mi")
-LOCVAL(LOCALE_SABBREVDAYNAME4,"Do")
-LOCVAL(LOCALE_SABBREVDAYNAME5,"Fr")
-LOCVAL(LOCALE_SABBREVDAYNAME6,"Sa")
-LOCVAL(LOCALE_SABBREVDAYNAME7,"So")
-LOCVAL(LOCALE_SMONTHNAME1,"Januar")
-LOCVAL(LOCALE_SMONTHNAME2,"Februar")
-LOCVAL(LOCALE_SMONTHNAME3,"März")
+LOCVAL(LOCALE_SDAYNAME1,"Monday")
+LOCVAL(LOCALE_SDAYNAME2,"Tuesday")
+LOCVAL(LOCALE_SDAYNAME3,"Wednesday")
+LOCVAL(LOCALE_SDAYNAME4,"Thursday")
+LOCVAL(LOCALE_SDAYNAME5,"Friday")
+LOCVAL(LOCALE_SDAYNAME6,"Saturday")
+LOCVAL(LOCALE_SDAYNAME7,"Sunday")
+LOCVAL(LOCALE_SABBREVDAYNAME1,"Mon")
+LOCVAL(LOCALE_SABBREVDAYNAME2,"Tue")
+LOCVAL(LOCALE_SABBREVDAYNAME3,"Wed")
+LOCVAL(LOCALE_SABBREVDAYNAME4,"Thu")
+LOCVAL(LOCALE_SABBREVDAYNAME5,"Fri")
+LOCVAL(LOCALE_SABBREVDAYNAME6,"Sat")
+LOCVAL(LOCALE_SABBREVDAYNAME7,"Sun")
+LOCVAL(LOCALE_SMONTHNAME1,"January")
+LOCVAL(LOCALE_SMONTHNAME2,"February")
+LOCVAL(LOCALE_SMONTHNAME3,"March")
 LOCVAL(LOCALE_SMONTHNAME4,"April")
-LOCVAL(LOCALE_SMONTHNAME5,"Mai")
-LOCVAL(LOCALE_SMONTHNAME6,"Juni")
-LOCVAL(LOCALE_SMONTHNAME7,"Juli")
+LOCVAL(LOCALE_SMONTHNAME5,"May")
+LOCVAL(LOCALE_SMONTHNAME6,"June")
+LOCVAL(LOCALE_SMONTHNAME7,"July")
 LOCVAL(LOCALE_SMONTHNAME8,"August")
 LOCVAL(LOCALE_SMONTHNAME9,"September")
-LOCVAL(LOCALE_SMONTHNAME10,"Oktober")
+LOCVAL(LOCALE_SMONTHNAME10,"October")
 LOCVAL(LOCALE_SMONTHNAME11,"November")
-LOCVAL(LOCALE_SMONTHNAME12,"Dezember")
+LOCVAL(LOCALE_SMONTHNAME12,"December")
 LOCVAL(LOCALE_SMONTHNAME13,"")
 LOCVAL(LOCALE_SABBREVMONTHNAME1,"Jan")
 LOCVAL(LOCALE_SABBREVMONTHNAME2,"Feb")
-LOCVAL(LOCALE_SABBREVMONTHNAME3,"Mär")
+LOCVAL(LOCALE_SABBREVMONTHNAME3,"Mar")
 LOCVAL(LOCALE_SABBREVMONTHNAME4,"Apr")
-LOCVAL(LOCALE_SABBREVMONTHNAME5,"Mai")
+LOCVAL(LOCALE_SABBREVMONTHNAME5,"May")
 LOCVAL(LOCALE_SABBREVMONTHNAME6,"Jun")
 LOCVAL(LOCALE_SABBREVMONTHNAME7,"Jul")
 LOCVAL(LOCALE_SABBREVMONTHNAME8,"Aug")
 LOCVAL(LOCALE_SABBREVMONTHNAME9,"Sep")
-LOCVAL(LOCALE_SABBREVMONTHNAME10,"Okt")
+LOCVAL(LOCALE_SABBREVMONTHNAME10,"Oct")
 LOCVAL(LOCALE_SABBREVMONTHNAME11,"Nov")
-LOCVAL(LOCALE_SABBREVMONTHNAME12,"Dez")
+LOCVAL(LOCALE_SABBREVMONTHNAME12,"Dec")
 LOCVAL(LOCALE_SABBREVMONTHNAME13,"")
+LOCVAL(LOCALE_SPOSITIVESIGN,"")
+LOCVAL(LOCALE_SNEGATIVESIGN,"-")
 /*
-LOCVAL(LOCALE_SPOSITIVESIGN)
-LOCVAL(LOCALE_SNEGATIVESIGN)
 LOCVAL(LOCALE_IPOSSIGNPOSN)
 LOCVAL(LOCALE_INEGSIGNPOSN)
 LOCVAL(LOCALE_IPOSSYMPRECEDES)
@@ -1908,7 +1909,7 @@
 	WCHAR	buffer[200];
 	HKEY	xhkey;
 
-	dprintf_win32(stddeb,"EnumSystemLocales32W(%p,%08lx)\n",
+	dprintf_info(win32,"EnumSystemLocales32W(%p,%08lx)\n",
                       lpfnLocaleEnum,flags );
 	/* see if we can reuse the Win95 registry entries.... */
 	if (ERROR_SUCCESS==RegOpenKey32A(HKEY_LOCAL_MACHINE,"\\System\\CurrentControlSet\\control\\Nls\\Locale\\",&xhkey)) {
@@ -1951,7 +1952,7 @@
 	CHAR	buffer[200];
 	HKEY	xhkey;
 
-	dprintf_win32(stddeb,"EnumSystemLocales32A(%p,%08lx)\n",
+	dprintf_info(win32,"EnumSystemLocales32A(%p,%08lx)\n",
 		lpfnLocaleEnum,flags
 	);
 	if (ERROR_SUCCESS==RegOpenKey32A(HKEY_LOCAL_MACHINE,"\\System\\CurrentControlSet\\control\\Nls\\Locale\\",&xhkey)) {
@@ -2081,7 +2082,7 @@
 	int	i;
 	char	*buf;
 
-	dprintf_ver(stddeb,"VerLanguageName(%d,%p,%d)\n",langid,langname,langnamelen);
+	dprintf_info(ver,"VerLanguageName(%d,%p,%d)\n",langid,langname,langnamelen);
 	/* First, check \System\CurrentControlSet\control\Nls\Locale\<langid>
 	 * from the registry. 
 	 */
@@ -2140,7 +2141,7 @@
 ) {
 	int	i,len;
 
-	dprintf_string(stderr,"LCMapStringA(0x%04lx,0x%08lx,%s,%d,%p,%d)\n",
+	dprintf_info(string,"LCMapStringA(0x%04lx,0x%08lx,%s,%d,%p,%d)\n",
 		lcid,mapflags,srcstr,srclen,dststr,dstlen);
 	if (!dstlen || !dststr) {
 		dststr = (LPSTR)srcstr;
@@ -2178,7 +2179,7 @@
 ) {
 	int	i,len;
 
-	dprintf_string(stderr,"LCMapStringW(0x%04lx,0x%08lx,%p,%d,%p,%d)\n",
+	dprintf_info(string,"LCMapStringW(0x%04lx,0x%08lx,%p,%d,%p,%d)\n",
 		lcid,mapflags,srcstr,srclen,dststr,dstlen
 	);
 	if (!dstlen || !dststr) {
@@ -2209,23 +2210,253 @@
 	return len;
 }
 
+/* FIXME: these shouldn't be needed */
+
+static char *any_locale_days[] = 
+{"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
+
+static char *any_locale_months[] =
+{"zero", "Jan", "Feb", "Mar", "Apr", "May", "Jun", 
+         "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
+
+typedef struct {
+    int inpos;   /* place in the input buffer */
+    int outpos;  /* place in the output buffer */
+    int count;   
+    int inquote; 
+    char type;
+  } PARSING_STATE;
+
+/*****************************************************************
+ *
+ *  GetDateFormat()
+
+  This function uses format to format the date,  or,  if format
+  is NULL, uses the default for the locale.  format is a string
+  of literal fields and characters as follows:
+
+  d    single-digit (no leading zero) day (of month)
+  dd   two-digit day (of month)
+  ddd  short day-of-week name
+  dddd long day-of-week name
+  M    single-digit month
+  MM   two-digit month
+  MMM  short month name
+  MMMM full month name
+  y    two-digit year, no leading 0
+  yy   two-digit year
+  yyyy four-digit year
+  gg   era string
+
+ * ***********************/
 
 INT32 WINAPI GetDateFormat32A(LCID locale,DWORD flags,LPSYSTEMTIME xtime,
-			      LPCSTR format, LPSTR date,INT32 datelen
-) {
-	fprintf(stderr,"GetDateFormat(0x%04lx,0x%08lx,%p,%s,%p,%d), stub\n",
-		locale,flags,xtime,format,date,datelen
-	);
-	lstrcpyn32A(date,"1.4.1997",datelen);
-	return strlen("1.4.1997");
+			      LPCSTR format, LPSTR date,INT32 datelen) 
+{
+  PARSING_STATE state;   
+  char buf[40];
+  int buflen;
+  LPCSTR thisformat;
+
+  dprintf_info(ole,"GetDateFormat(0x%04lx,0x%08lx,%p,%s,%p,%d)\n",
+	      locale,flags,xtime,format,date,datelen);
+
+  /* FIXME: Get the default for this locale */
+  if (format) {
+    thisformat = format;
+  } else {
+    thisformat = "yyyy-MM-dd (ddd) ";
+  };
+
+  
+  /* initialize state variables */
+  state.inpos = state.outpos = 0;
+  state.count = state.inquote = 0;
+  state.type = '\0';
+  /* initialise output buffer */
+  date[0] = '\0';
+      
+  for (state.inpos = 0; thisformat[state.inpos] ; state.inpos++) {
+       if (state.inquote) {
+	    if (thisformat[state.inpos] == '\'') {
+		 state.inquote = 0;
+		 continue;
+	    } else {
+		 date[state.outpos++] = thisformat[state.inpos];
+	    };	    
+       } else if ( (state.count && (thisformat[state.inpos] != state.type)) 
+		   || state.count == 4 
+		   || (state.count == 2 && state.type == 'g' ) ) 
+       {
+	    /* end of a format-type string */
+	    if         (state.type == 'd') {
+		 if        (state.count == 1) {
+		      sprintf(buf, "%d", xtime->wDay);
+		 } else if (state.count == 2) {
+		      sprintf(buf, "%02d", xtime->wDay);
+		 } else if (state.count == 3) {
+		      /* day of week, short */
+		      /* FIXME: This is the way to do it everywhere */
+		      if (locale) {
+			   
+			   GetLocaleInfo32A(locale, 
+					    LOCALE_SABBREVDAYNAME1 
+					    + xtime->wDayOfWeek - 1,
+					    buf, sizeof(buf));
+		      } else {
+			   strcpy(buf, 
+				  any_locale_days[xtime->wDayOfWeek -1]);
+		      };
+		 } else if (state.count == 4) {
+		      /* day of week, long */
+
+		      /* FIXME: get the days from the locale */
+		      /* FIXME: these should be long days */
+		      sprintf(buf, "%.*s", (int) sizeof(buf),
+			      any_locale_days[xtime->wDayOfWeek]);
+		 } else {
+		      dprintf_info(ole, 
+				  "GetDateFormat(): unbekannt format, \
+c=%c, n=%d\n",
+				  state.type, state.count);
+		 };
+	    } else if (state.type == 'M') {
+		 if        (state.count == 1) {
+		      sprintf(buf, "%d", xtime->wMonth);
+		 } else if (state.count == 2) {
+		      sprintf(buf, "%02d", xtime->wMonth);
+		 } else if (state.count == 3) {
+		      /* FIXME: get the month-name from the locale */
+		      sprintf(buf, "%.*s", (int) sizeof(buf),
+			      any_locale_months[xtime->wMonth]);
+		 } else if (state.count == 4) {
+		      /* FIXME: get the month-name from the locale */
+		      /* FIXME: should return a long month */
+		      sprintf(buf, "%.*s", (int) sizeof(buf), 
+			      any_locale_months[xtime->wMonth]);
+		 } else {
+		      dprintf_info(ole, 
+			  "GetDateFormat(): unbekannt format, c=%c, n=%d\n",
+				  state.type, state.count);
+		 };
+	    } else if (state.type == 'y') {
+		 if        (state.count == 1) {
+		      sprintf(buf, "%d", xtime->wYear % 100);
+		 } else if (state.count == 2) {
+		      sprintf(buf, "02%d", xtime->wYear % 100);
+		 } else if (state.count == 4) {
+		      sprintf(buf, "%d", xtime->wYear);
+		 } else {
+		      dprintf_info(ole, 
+			 "GetDateFormat(): unbekannt format, c=%c, n=%d\n",
+				  state.type, state.count);
+		 };
+	    } else if (state.type == 'g') {
+		 if        (state.count == 2) {
+		      /* FIXME: Get era from the locale */
+		      strcpy(buf, "AD (CE)");
+		 } else {
+		      dprintf_info(ole, 
+			 "GetDateFormat(): unbekannt format, c=%c, n=%d",
+				  state.type, state.count);
+		 };
+	    } else {
+		 dprintf_info(ole, 
+		     "GetDateFormat(): unbekannt format, c=%c, n=%d\n",
+			     state.type, state.count);
+	    };
+	    buflen = strlen(buf);
+
+	    /* we need to check the next char again, one
+	       way or another */
+	    state.inpos--;
+	    
+            /* now, add buf to the output buffer */
+	    if (state.outpos + buflen < datelen) {
+		 date[state.outpos] = '\0'; /* for strcat to hook on */
+		 strcat(date, buf);
+		 state.outpos += buflen;
+	    } else {
+		 date[state.outpos] = '\0';
+		 strncat(date, buf, datelen - state.outpos - 1);
+		 date[datelen - 1] = '\0';
+		 SetLastError(ERROR_INSUFFICIENT_BUFFER);
+		 return 0;
+	    };
+
+	    /* reset other variables */
+	    state.count = 0;
+	    state.type = '\0';
+
+	    /* end of code for printing format-strings */
+       } else if (state.count) {
+	    /* and char is of same type (see above) */
+	    state.count += 1;;
+       } else if (strchr("yMdg", thisformat[state.inpos])) {
+	    state.type = thisformat[state.inpos];
+	    state.count = 1;
+       } else if (thisformat[state.inpos] == '\'') {
+	    state.inquote = 1;
+       } else {
+	    date[state.outpos++] = thisformat[state.inpos];
+       };
+     if (state.outpos >= datelen) {
+       date[datelen - 1] = '\0';
+       SetLastError(ERROR_INSUFFICIENT_BUFFER);
+       return 0;
+     };
+   };
+
+  state.outpos++;
+  if (state.outpos >= datelen - 1) {
+       state.outpos = datelen - 1;
+  };
+
+  date[state.outpos] = '\0';
+
+   dprintf_info(ole, 
+	       "GetDateFormat32A() returning %d, with data=%s\n",
+	       state.outpos, date);
+   return state.outpos;
 }
 
+/*****************************************************************
+ *
+ * GetTimeFormat() 
+
+ Formats date according to format,  or locale default if format is NULL.
+ The format consists of literal characters and fields as follows:
+
+ h  hours with no leading zero (12-hour)
+ hh hours with full two digits
+ H  hours with no leading zero (24-hour)
+ HH hours with full two digits
+ m  minutes with no leading zero
+ mm minutes with full two digits
+ s  seconds with no leading zero
+ ss seconds with full two digits
+ t  time marker (A or P)
+ tt time marker (AM, PM)
+
+ */
+
 INT32 WINAPI GetTimeFormat32A(LCID locale,DWORD flags,LPSYSTEMTIME xtime,
 			      LPCSTR format, LPSTR timestr,INT32 timelen
 ) {
-	fprintf(stderr,"GetDateFormat(0x%04lx,0x%08lx,%p,%s,%p,%d), stub\n",
+   dprintf_info(ole,"GetTimeFormat(0x%04lx,0x%08lx,%p,%s,%p,%d), stub\n",
 		locale,flags,xtime,format,timestr,timelen
 	);
+   
+   /* FIXME: implement this one.  Perhaps a common codebase? */
+
+
+
+
+
 	lstrcpyn32A(timestr,"00:00:42",timelen);
 	return strlen("00:00:42");
 }
+
+
+
+
diff --git a/ole/olecli.c b/ole/olecli.c
index a218213..bc63ef1 100644
--- a/ole/olecli.c
+++ b/ole/olecli.c
@@ -10,7 +10,6 @@
 #include "windows.h"
 #include "ole.h"
 #include "gdi.h"
-#include "stddebug.h"
 #include "debug.h"
 
 extern LONG	OLE_current_handle;
@@ -111,7 +110,7 @@
  */
 BOOL16 WINAPI OleIsDcMeta(HDC16 hdc)
 {
-	dprintf_ole(stddeb,"OleIsDCMeta(%04x)\n",hdc);
+	dprintf_info(ole,"OleIsDCMeta(%04x)\n",hdc);
 	return GDI_GetObjPtr( hdc, METAFILE_DC_MAGIC ) != 0;
 }
 
diff --git a/ole/olesvr.c b/ole/olesvr.c
index ad68eb1..186475e 100644
--- a/ole/olesvr.c
+++ b/ole/olesvr.c
@@ -9,7 +9,6 @@
 
 #include "windows.h"
 #include "ole.h"
-#include "stddebug.h"
 #include "debug.h"
 
 LONG	OLE_current_handle;
@@ -21,7 +20,7 @@
                                       LHSERVER *hRet, HINSTANCE16 hServer,
                                       OLE_SERVER_USE use )
 {
-    dprintf_ole(stdnimp,"OleRegisterServer:%s\n",name);
+    dprintf_fixme(ole,"OleRegisterServer:%s - stub\n",name);
     *hRet=++OLE_current_handle;
     /* return OLE_ERROR_MEMORY, OLE_ERROR_PROTECT_ONLY if you want it fail*/
     return OLE_OK;
@@ -74,7 +73,8 @@
                                          LPOLESERVERDOC document,
                                          LHSERVERDOC *hRet)
 {
-    dprintf_ole(stdnimp,"OleRegisterServerDoc:%ld,%s\n", hServer, docname);
+    dprintf_fixme(ole,"OleRegisterServerDoc:%ld,%s - stub\n", 
+		hServer, docname);
     *hRet=++OLE_current_handle;
     return OLE_OK;
 }
@@ -84,7 +84,7 @@
  */
 OLESTATUS WINAPI OleRevokeServerDoc16(LHSERVERDOC hServerDoc)
 {
-    dprintf_ole(stdnimp,"OleRevokeServerDoc:%ld\n",hServerDoc);
+    dprintf_fixme(ole,"OleRevokeServerDoc:%ld  - stub\n",hServerDoc);
     return OLE_OK;
 }
 
@@ -102,7 +102,7 @@
  */
 OLESTATUS WINAPI OleRevokeServer(LHSERVER hServer)
 {
-    dprintf_ole(stdnimp,"OleRevokeServer:%ld\n",hServer);
+    dprintf_fixme(ole,"OleRevokeServer:%ld - stub\n",hServer);
     return OLE_OK;
 }
 
diff --git a/ole/storage.c b/ole/storage.c
new file mode 100644
index 0000000..06d67a8
--- /dev/null
+++ b/ole/storage.c
@@ -0,0 +1,1595 @@
+/* Compound Storage
+ *
+ * Implemented using the documentation of the LAOLA project at
+ * <URL:http://wwwwbs.cs.tu-berlin.de/~schwartz/pmh/index.html>
+ * (Thanks to Martin Schwartz <schwartz@cs.tu-berlin.de>)
+ *
+ * Copyright 1998 Marcus Meissner
+ */
+
+#include <stdio.h>
+#include <assert.h>
+#include <time.h>
+#include <string.h>
+#include "windows.h"
+#include "winerror.h"
+#include "file.h"
+#include "ole.h"
+#include "ole2.h"
+#include "compobj.h"
+#include "interfaces.h"
+#include "storage.h"
+#include "heap.h"
+#include "module.h"
+#include "ldt.h"
+#include "debug.h"
+#include "debugstr.h"
+
+static const BYTE STORAGE_magic[8]   ={0xd0,0xcf,0x11,0xe0,0xa1,0xb1,0x1a,0xe1};
+static const BYTE STORAGE_notmagic[8]={0x0e,0x11,0xfc,0x0d,0xd0,0xcf,0x11,0xe0};
+static const BYTE STORAGE_oldmagic[8]={0xd0,0xcf,0x11,0xe0,0x0e,0x11,0xfc,0x0d};
+
+#define BIGSIZE		512
+#define SMALLSIZE		64
+
+#define SMALLBLOCKS_PER_BIGBLOCK	(BIGSIZE/SMALLSIZE)
+
+#define READ_HEADER	assert(STORAGE_get_big_block(hf,-1,(LPBYTE)&sth));assert(!memcmp(STORAGE_magic,sth.magic,sizeof(STORAGE_magic)));
+static IStorage16_VTable stvt16;
+static IStorage16_VTable *segstvt16 = NULL;
+static IStorage32_VTable stvt32;
+static IStream16_VTable strvt16;
+static IStream16_VTable *segstrvt16 = NULL;
+static IStream32_VTable strvt32;
+
+ULONG WINAPI IStorage16_AddRef(LPSTORAGE16 this);
+static void _create_istorage16(LPSTORAGE16 *stg);
+static void _create_istream16(LPSTREAM16 *str);
+
+#define IMPLEMENTED 1
+
+/******************************************************************************
+ * Reading OLE compound storage
+ */
+static BOOL32
+STORAGE_get_big_block(HFILE32 hf,int n,BYTE *block) {
+	assert(n>=-1);
+	if (-1==_llseek32(hf,(n+1)*BIGSIZE,SEEK_SET)) {
+		fprintf(stderr,"STORAGE_get_big_block: seek failed (%ld)\n",GetLastError());
+		return FALSE;
+	}
+	assert((n+1)*BIGSIZE==_llseek32(hf,0,SEEK_CUR));
+	if (BIGSIZE!=_lread32(hf,block,BIGSIZE)) {
+		fprintf(stderr,"STORAGE_get_big_block(%d): read didn't (%ld)\n",n,GetLastError());
+		assert(0);
+		return FALSE;
+	}
+	return TRUE;
+}
+
+static BOOL32
+STORAGE_put_big_block(HFILE32 hf,int n,BYTE *block) {
+	assert(n>=-1);
+	if (-1==_llseek32(hf,(n+1)*BIGSIZE,SEEK_SET)) {
+		fprintf(stderr,"STORAGE_put_big_block: seek failed (%ld)\n",GetLastError());
+		return FALSE;
+	}
+	assert((n+1)*BIGSIZE==_llseek32(hf,0,SEEK_CUR));
+	if (BIGSIZE!=_lwrite32(hf,block,BIGSIZE)) {
+		fprintf(stderr,"STORAGE_put_big_block: write failed (%ld)\n",GetLastError());
+		return FALSE;
+	}
+	return TRUE;
+}
+
+static int
+STORAGE_get_next_big_blocknr(HFILE32 hf,int blocknr) {
+	INT32	bbs[BIGSIZE/sizeof(INT32)];
+	struct	storage_header	sth;
+
+	READ_HEADER;
+	
+	assert(blocknr>>7<sth.num_of_bbd_blocks);
+	if (sth.bbd_list[blocknr>>7]==0xffffffff)
+		return -5;
+	if (!STORAGE_get_big_block(hf,sth.bbd_list[blocknr>>7],(LPBYTE)bbs))
+		return -5;
+	assert(bbs[blocknr&0x7f]!=STORAGE_CHAINENTRY_FREE);
+	return bbs[blocknr&0x7f];
+}
+
+static int
+STORAGE_get_nth_next_big_blocknr(HFILE32 hf,int blocknr,int nr) {
+	INT32	bbs[BIGSIZE/sizeof(INT32)];
+	int	lastblock = -1;
+	struct storage_header sth;
+
+	READ_HEADER;
+	
+	assert(blocknr>=0);
+	while (nr--) {
+		assert((blocknr>>7)<sth.num_of_bbd_blocks);
+		assert(sth.bbd_list[blocknr>>7]!=0xffffffff);
+
+		/* simple caching... */
+		if (lastblock!=sth.bbd_list[blocknr>>7]) {
+			assert(STORAGE_get_big_block(hf,sth.bbd_list[blocknr>>7],(LPBYTE)bbs));
+			lastblock = sth.bbd_list[blocknr>>7];
+		}
+		blocknr = bbs[blocknr&0x7f];
+	}
+	return blocknr;
+}
+
+
+static BOOL32
+STORAGE_get_root_pps_entry(HFILE32 hf,struct storage_pps_entry *pstde) {
+	int	blocknr,i;
+	BYTE	block[BIGSIZE];
+	struct storage_pps_entry	*stde=(struct storage_pps_entry*)block;
+	struct storage_header sth;
+
+	READ_HEADER;
+	blocknr = sth.root_startblock;
+	while (blocknr>=0) {
+		assert(STORAGE_get_big_block(hf,blocknr,block));
+		for (i=0;i<4;i++) {
+			if (!stde[i].pps_sizeofname)
+				continue;
+			if (stde[i].pps_type==5) {
+				*pstde=stde[i];
+				return TRUE;
+			}
+		}
+		blocknr=STORAGE_get_next_big_blocknr(hf,blocknr);
+	}
+	return FALSE;
+}
+
+static BOOL32
+STORAGE_get_small_block(HFILE32 hf,int blocknr,BYTE *sblock) {
+	BYTE				block[BIGSIZE];
+	int				bigblocknr;
+	struct storage_pps_entry	root;
+
+	assert(blocknr>=0);
+	assert(STORAGE_get_root_pps_entry(hf,&root));
+	bigblocknr = STORAGE_get_nth_next_big_blocknr(hf,root.pps_sb,blocknr/SMALLBLOCKS_PER_BIGBLOCK);
+	assert(bigblocknr>=0);
+	assert(STORAGE_get_big_block(hf,bigblocknr,block));
+
+	memcpy(sblock,((LPBYTE)block)+SMALLSIZE*(blocknr&(SMALLBLOCKS_PER_BIGBLOCK-1)),SMALLSIZE);
+	return TRUE;
+}
+
+static BOOL32
+STORAGE_put_small_block(HFILE32 hf,int blocknr,BYTE *sblock) {
+	BYTE				block[BIGSIZE];
+	int				bigblocknr;
+	struct storage_pps_entry	root;
+
+	assert(blocknr>=0);
+
+	assert(STORAGE_get_root_pps_entry(hf,&root));
+	bigblocknr = STORAGE_get_nth_next_big_blocknr(hf,root.pps_sb,blocknr/SMALLBLOCKS_PER_BIGBLOCK);
+	assert(bigblocknr>=0);
+	assert(STORAGE_get_big_block(hf,bigblocknr,block));
+
+	memcpy(((LPBYTE)block)+SMALLSIZE*(blocknr&(SMALLBLOCKS_PER_BIGBLOCK-1)),sblock,SMALLSIZE);
+	assert(STORAGE_put_big_block(hf,bigblocknr,block));
+	return TRUE;
+}
+
+
+static int
+STORAGE_get_next_small_blocknr(HFILE32 hf,int blocknr) {
+	BYTE				block[BIGSIZE];
+	LPINT32				sbd = (LPINT32)block;
+	int				bigblocknr;
+	struct storage_header		sth;
+
+	READ_HEADER;
+	assert(blocknr>=0);
+	bigblocknr = STORAGE_get_nth_next_big_blocknr(hf,sth.sbd_startblock,blocknr/128);
+	assert(bigblocknr>=0);
+	assert(STORAGE_get_big_block(hf,bigblocknr,block));
+	assert(sbd[blocknr & 127]!=STORAGE_CHAINENTRY_FREE);
+	return sbd[blocknr & (128-1)];
+}
+
+static int
+STORAGE_get_nth_next_small_blocknr(HFILE32 hf,int blocknr,int nr) {
+	int	lastblocknr;
+	BYTE	block[BIGSIZE];
+	LPINT32	sbd = (LPINT32)block;
+	struct storage_header sth;
+
+	READ_HEADER;
+	lastblocknr=-1;
+	assert(blocknr>=0);
+	while ((nr--) && (blocknr>=0)) {
+		if (lastblocknr/128!=blocknr/128) {
+			int	bigblocknr;
+			bigblocknr = STORAGE_get_nth_next_big_blocknr(hf,sth.sbd_startblock,blocknr/128);
+			assert(bigblocknr>=0);
+			assert(STORAGE_get_big_block(hf,bigblocknr,block));
+			lastblocknr = blocknr;
+		}
+		assert(lastblocknr>=0);
+		lastblocknr=blocknr;
+		blocknr=sbd[blocknr & (128-1)];
+		assert(blocknr!=STORAGE_CHAINENTRY_FREE);
+	}
+	return blocknr;
+}
+
+static int
+STORAGE_get_pps_entry(HFILE32 hf,int n,struct storage_pps_entry *pstde) {
+	int	blocknr;
+	BYTE	block[BIGSIZE];
+	struct storage_pps_entry *stde = (struct storage_pps_entry*)(((LPBYTE)block)+128*(n&3));
+	struct storage_header sth;
+
+	READ_HEADER;
+	/* we have 4 pps entries per big block */
+	blocknr = STORAGE_get_nth_next_big_blocknr(hf,sth.root_startblock,n/4);
+	assert(blocknr>=0);
+	assert(STORAGE_get_big_block(hf,blocknr,block));
+
+	*pstde=*stde;
+	return 1;
+}
+
+static int
+STORAGE_put_pps_entry(HFILE32 hf,int n,struct storage_pps_entry *pstde) {
+	int	blocknr;
+	BYTE	block[BIGSIZE];
+	struct storage_pps_entry *stde = (struct storage_pps_entry*)(((LPBYTE)block)+128*(n&3));
+	struct storage_header sth;
+
+	READ_HEADER;
+
+	/* we have 4 pps entries per big block */
+	blocknr = STORAGE_get_nth_next_big_blocknr(hf,sth.root_startblock,n/4);
+	assert(blocknr>=0);
+	assert(STORAGE_get_big_block(hf,blocknr,block));
+	*stde=*pstde;
+	assert(STORAGE_put_big_block(hf,blocknr,block));
+	return 1;
+}
+
+static int
+STORAGE_look_for_named_pps(HFILE32 hf,int n,LPOLESTR32 name) {
+	struct storage_pps_entry	stde;
+	int				ret;
+
+	if (n==-1)
+		return -1;
+	if (1!=STORAGE_get_pps_entry(hf,n,&stde))
+		return -1;
+
+	if (!lstrcmp32W(name,stde.pps_rawname))
+		return n;
+	if (stde.pps_prev != -1) {
+		ret=STORAGE_look_for_named_pps(hf,stde.pps_prev,name);
+		if (ret!=-1)
+			return ret;
+	}
+	if (stde.pps_next != -1) {
+		ret=STORAGE_look_for_named_pps(hf,stde.pps_next,name);
+		if (ret!=-1)
+			return ret;
+	}
+	return -1;
+}
+
+static void
+STORAGE_dump_pps_entry(struct storage_pps_entry *stde) {
+	char	name[33],xguid[50];
+
+	WINE_StringFromCLSID(&(stde->pps_guid),xguid);
+
+	lstrcpyWtoA(name,stde->pps_rawname);
+	if (!stde->pps_sizeofname)
+		return;
+	fprintf(stderr,"name: %s\n",name);
+	fprintf(stderr,"type: %d\n",stde->pps_type);
+	fprintf(stderr,"prev pps: %ld\n",stde->pps_prev);
+	fprintf(stderr,"next pps: %ld\n",stde->pps_next);
+	fprintf(stderr,"dir pps: %ld\n",stde->pps_dir);
+	fprintf(stderr,"guid: %s\n",xguid);
+	if (stde->pps_type !=2) {
+		time_t	t;
+
+		t = DOSFS_FileTimeToUnixTime(&(stde->pps_ft1),NULL);
+		fprintf(stderr,"ts1: %s\n",ctime(&t));
+		t = DOSFS_FileTimeToUnixTime(&(stde->pps_ft2),NULL);
+		fprintf(stderr,"ts2: %s\n",ctime(&t));
+	}
+	fprintf(stderr,"startblock: %ld\n",stde->pps_sb);
+	fprintf(stderr,"size: %ld\n",stde->pps_size);
+}
+
+static BOOL32 
+STORAGE_init_storage(HFILE32 hf) {
+	BYTE	block[BIGSIZE];
+	LPDWORD	bbs;
+	struct storage_header *sth;
+	struct storage_pps_entry *stde;
+
+	assert(-1!=_llseek32(hf,0,SEEK_SET));
+	/* block -1 is the storage header */
+	sth = (struct storage_header*)block;
+	memcpy(sth->magic,STORAGE_magic,8);
+	memset(sth->unknown1,0,sizeof(sth->unknown1));
+	memset(sth->unknown2,0,sizeof(sth->unknown2));
+	memset(sth->unknown3,0,sizeof(sth->unknown3));
+	sth->num_of_bbd_blocks	= 1;
+	sth->root_startblock	= 1;
+	sth->sbd_startblock	= 0xffffffff;
+	memset(sth->bbd_list,0xff,sizeof(sth->bbd_list));
+	sth->bbd_list[0]	= 0;
+	assert(BIGSIZE==_lwrite32(hf,block,BIGSIZE));
+	/* block 0 is the big block directory */
+	bbs=(LPDWORD)block;
+	memset(block,0xff,sizeof(block)); /* mark all blocks as free */
+	bbs[0]=STORAGE_CHAINENTRY_ENDOFCHAIN; /* for this block */
+	bbs[1]=STORAGE_CHAINENTRY_ENDOFCHAIN; /* for directory entry */
+	assert(BIGSIZE==_lwrite32(hf,block,BIGSIZE));
+	/* block 1 is the root directory entry */
+	memset(block,0x00,sizeof(block));
+	stde = (struct storage_pps_entry*)block;
+	lstrcpyAtoW(stde->pps_rawname,"RootEntry");
+	stde->pps_sizeofname	= lstrlen32W(stde->pps_rawname)*2+2;
+	stde->pps_type		= 5;
+	stde->pps_dir		= -1;
+	stde->pps_next		= -1;
+	stde->pps_prev		= -1;
+	stde->pps_sb		= 0xffffffff;
+	stde->pps_size		= 0;
+	assert(BIGSIZE==_lwrite32(hf,block,BIGSIZE));
+	return TRUE;
+}
+
+static BOOL32
+STORAGE_set_big_chain(HFILE32 hf,int blocknr,INT32 type) {
+	BYTE	block[BIGSIZE];
+	LPINT32	bbd = (LPINT32)block;
+	int	nextblocknr,bigblocknr;
+	struct storage_header sth;
+
+	READ_HEADER;
+	assert(blocknr!=type);
+	while (blocknr>=0) {
+		bigblocknr = sth.bbd_list[blocknr/128];
+		assert(bigblocknr>=0);
+		assert(STORAGE_get_big_block(hf,bigblocknr,block));
+
+		nextblocknr = bbd[blocknr&(128-1)];
+		bbd[blocknr&(128-1)] = type;
+		if (type>=0)
+			return TRUE;
+		assert(STORAGE_put_big_block(hf,bigblocknr,block));
+		type = STORAGE_CHAINENTRY_FREE;
+		blocknr = nextblocknr;
+	}
+	return TRUE;
+}
+
+static BOOL32
+STORAGE_set_small_chain(HFILE32 hf,int blocknr,INT32 type) {
+	BYTE	block[BIGSIZE];
+	LPINT32	sbd = (LPINT32)block;
+	int	lastblocknr,nextsmallblocknr,bigblocknr;
+	struct storage_header sth;
+
+	READ_HEADER;
+
+	assert(blocknr!=type);
+	lastblocknr=-129;bigblocknr=-2;
+	while (blocknr>=0) {
+		/* cache block ... */
+		if (lastblocknr/128!=blocknr/128) {
+			bigblocknr = STORAGE_get_nth_next_big_blocknr(hf,sth.sbd_startblock,blocknr/128);
+			assert(bigblocknr>=0);
+			assert(STORAGE_get_big_block(hf,bigblocknr,block));
+		}
+		lastblocknr = blocknr;
+		nextsmallblocknr = sbd[blocknr&(128-1)];
+		sbd[blocknr&(128-1)] = type;
+		assert(STORAGE_put_big_block(hf,bigblocknr,block));
+		if (type>=0)
+			return TRUE;
+		type = STORAGE_CHAINENTRY_FREE;
+		blocknr = nextsmallblocknr;
+	}
+	return TRUE;
+}
+
+static int 
+STORAGE_get_free_big_blocknr(HFILE32 hf) {
+	BYTE	block[BIGSIZE];
+	LPINT32	sbd = (LPINT32)block;
+	int	lastbigblocknr,i,curblock,bigblocknr;
+	struct storage_header sth;
+
+	READ_HEADER;
+	curblock	= 0;
+	lastbigblocknr	= -1;
+	bigblocknr	= sth.bbd_list[curblock];
+	while (curblock<sth.num_of_bbd_blocks) {
+		assert(bigblocknr>=0);
+		assert(STORAGE_get_big_block(hf,bigblocknr,block));
+		for (i=0;i<128;i++)
+			if (sbd[i]==STORAGE_CHAINENTRY_FREE) {
+				sbd[i] = STORAGE_CHAINENTRY_ENDOFCHAIN;
+				assert(STORAGE_put_big_block(hf,bigblocknr,block));
+				memset(block,0x42,sizeof(block));
+				assert(STORAGE_put_big_block(hf,i+curblock*128,block));
+				return i+curblock*128;
+			}
+		lastbigblocknr = bigblocknr;
+		bigblocknr = sth.bbd_list[++curblock];
+	}
+	bigblocknr = curblock*128;
+	/* since we have marked all blocks from 0 up to curblock*128-1 
+	 * the next free one is curblock*128, where we happily put our 
+	 * next large block depot.
+	 */
+	memset(block,0xff,sizeof(block));
+	/* mark the block allocated and returned by this function */
+	sbd[1] = STORAGE_CHAINENTRY_ENDOFCHAIN;
+	assert(STORAGE_put_big_block(hf,bigblocknr,block));
+
+	/* if we had a bbd block already (mostlikely) we need
+	 * to link the new one into the chain 
+	 */
+	if (lastbigblocknr!=-1)
+		assert(STORAGE_set_big_chain(hf,lastbigblocknr,bigblocknr));
+	sth.bbd_list[curblock]=bigblocknr;
+	sth.num_of_bbd_blocks++;
+	assert(sth.num_of_bbd_blocks==curblock+1);
+	assert(STORAGE_put_big_block(hf,-1,(LPBYTE)&sth));
+
+	/* Set the end of the chain for the bigblockdepots */
+	assert(STORAGE_set_big_chain(hf,bigblocknr,STORAGE_CHAINENTRY_ENDOFCHAIN));
+	/* add 1, for the first entry is used for the additional big block 
+	 * depot. (means we already used bigblocknr) */
+	memset(block,0x42,sizeof(block));
+	/* allocate this block (filled with 0x42) */
+	assert(STORAGE_put_big_block(hf,bigblocknr+1,block));
+	return bigblocknr+1;
+}
+
+
+static int 
+STORAGE_get_free_small_blocknr(HFILE32 hf) {
+	BYTE	block[BIGSIZE];
+	LPINT32	sbd = (LPINT32)block;
+	int	lastbigblocknr,newblocknr,i,curblock,bigblocknr;
+	struct storage_pps_entry	root;
+	struct storage_header sth;
+
+	READ_HEADER;
+	bigblocknr	= sth.sbd_startblock;
+	curblock	= 0;
+	lastbigblocknr	= -1;
+	newblocknr	= -1;
+	while (bigblocknr>=0) {
+		if (!STORAGE_get_big_block(hf,bigblocknr,block))
+			return -1;
+		for (i=0;i<128;i++)
+			if (sbd[i]==STORAGE_CHAINENTRY_FREE) {
+				sbd[i]=STORAGE_CHAINENTRY_ENDOFCHAIN;
+				newblocknr = i+curblock*128;
+				break;
+			}
+		if (i!=128)
+			break;
+		lastbigblocknr = bigblocknr;
+		bigblocknr = STORAGE_get_next_big_blocknr(hf,bigblocknr);
+		curblock++;
+	}
+	if (newblocknr==-1) {
+		bigblocknr = STORAGE_get_free_big_blocknr(hf);
+		if (bigblocknr<0)
+			return -1;
+		READ_HEADER;
+		memset(block,0xff,sizeof(block));
+		sbd[0]=STORAGE_CHAINENTRY_ENDOFCHAIN;
+		if (!STORAGE_put_big_block(hf,bigblocknr,block))
+			return -1;
+		if (lastbigblocknr==-1) {
+			sth.sbd_startblock = bigblocknr;
+			if (!STORAGE_put_big_block(hf,-1,(LPBYTE)&sth)) /* need to write it */
+				return -1;
+		} else {
+			if (!STORAGE_set_big_chain(hf,lastbigblocknr,bigblocknr))
+				return -1;
+		}
+		if (!STORAGE_set_big_chain(hf,bigblocknr,STORAGE_CHAINENTRY_ENDOFCHAIN))
+			return -1;
+		newblocknr = curblock*128;
+	}
+	/* allocate enough big blocks for storing the allocated small block */
+	if (!STORAGE_get_root_pps_entry(hf,&root))
+		return -1;
+	if (root.pps_sb==-1)
+		lastbigblocknr	= -1;
+	else
+		lastbigblocknr	= STORAGE_get_nth_next_big_blocknr(hf,root.pps_sb,(root.pps_size-1)/BIGSIZE);
+	while (root.pps_size < (newblocknr*SMALLSIZE+SMALLSIZE-1)) {
+		/* we need to allocate more stuff */
+		bigblocknr = STORAGE_get_free_big_blocknr(hf);
+		if (bigblocknr<0)
+			return -1;
+		READ_HEADER;
+		if (root.pps_sb==-1) {
+			root.pps_sb	 = bigblocknr;
+			root.pps_size	+= BIGSIZE;
+		} else {
+			if (!STORAGE_set_big_chain(hf,lastbigblocknr,bigblocknr))
+				return -1;
+			root.pps_size	+= BIGSIZE;
+		}
+		lastbigblocknr = bigblocknr;
+	}
+	if (!STORAGE_set_big_chain(hf,lastbigblocknr,STORAGE_CHAINENTRY_ENDOFCHAIN))
+		return -1;
+	if (!STORAGE_put_pps_entry(hf,0,&root))
+		return -1;
+	return newblocknr;
+}
+
+static int
+STORAGE_get_free_pps_entry(HFILE32 hf) {
+	int	blocknr,i,curblock,lastblocknr;
+	BYTE	block[BIGSIZE];
+	struct storage_pps_entry *stde = (struct storage_pps_entry*)block;
+	struct storage_header sth;
+
+	READ_HEADER;
+	blocknr = sth.root_startblock;
+	assert(blocknr>=0);
+	curblock=0;
+	while (blocknr>=0) {
+		if (!STORAGE_get_big_block(hf,blocknr,block))
+			return -1;
+		for (i=0;i<4;i++) 
+			if (stde[i].pps_sizeofname==0) /* free */
+				return curblock*4+i;
+		lastblocknr = blocknr;
+		blocknr = STORAGE_get_next_big_blocknr(hf,blocknr);
+		curblock++;
+	}
+	assert(blocknr==STORAGE_CHAINENTRY_ENDOFCHAIN);
+	blocknr = STORAGE_get_free_big_blocknr(hf);
+	/* sth invalidated */
+	if (blocknr<0)
+		return -1;
+	
+	if (!STORAGE_set_big_chain(hf,lastblocknr,blocknr))
+		return -1;
+	if (!STORAGE_set_big_chain(hf,blocknr,STORAGE_CHAINENTRY_ENDOFCHAIN))
+		return -1;
+	memset(block,0,sizeof(block));
+	STORAGE_put_big_block(hf,blocknr,block);
+	return curblock*4;
+}
+
+/******************************************************************************
+ *		IStream
+ */
+HRESULT WINAPI IStream16_QueryInterface(
+	LPSTREAM16 this,REFIID refiid,LPVOID *obj
+) {
+	char    xrefiid[50];
+
+	WINE_StringFromCLSID((LPCLSID)refiid,xrefiid);
+	dprintf_info(relay,"IStream16(%p)->QueryInterface(%s,%p)\n",this,xrefiid,obj);
+	if (!memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown))) {
+		*obj = this;
+		return 0;
+	}
+	return OLE_E_ENUM_NOMORE;
+	
+}
+
+ULONG WINAPI IStream16_AddRef(LPSTREAM16 this) {
+	return ++(this->ref);
+}
+
+ULONG WINAPI IStream16_Release(LPSTREAM16 this) {
+	FlushFileBuffers(this->hf);
+	this->ref--;
+	if (!this->ref) {
+		CloseHandle(this->hf);
+		SEGPTR_FREE(this);
+		return 0;
+	}
+	return this->ref;
+}
+
+/* FIXME: not handling 64 bit */
+HRESULT WINAPI IStream16_Seek(
+	LPSTREAM16 this,LARGE_INTEGER offset,DWORD whence,ULARGE_INTEGER *newpos
+) {
+	dprintf_info(relay,"IStream16(%p)->Seek([%ld.%ld],%ld,%p)\n",this,offset.HighPart,offset.LowPart,whence,newpos);
+
+	switch (whence) {
+	/* unix SEEK_xx should be the same as win95 ones */
+	case SEEK_SET:
+		/* offset must be ==0 (<0 is invalid, and >0 cannot be handled
+		 * right now.
+		 */
+		assert(offset.HighPart==0);
+		this->offset.HighPart = offset.HighPart;
+		this->offset.LowPart = offset.LowPart;
+		break;
+	case SEEK_CUR:
+		if (offset.HighPart < 0) {
+			/* FIXME: is this negation correct ? */
+			offset.HighPart = -offset.HighPart;
+			offset.LowPart = (0xffffffff ^ offset.LowPart)+1;
+
+			assert(offset.HighPart==0);
+			assert(this->offset.LowPart >= offset.LowPart);
+			this->offset.LowPart -= offset.LowPart;
+		} else {
+			assert(offset.HighPart==0);
+			this->offset.LowPart+= offset.LowPart;
+		}
+		break;
+	case SEEK_END:
+		assert(offset.HighPart==0);
+		this->offset.LowPart = this->stde.pps_size-offset.LowPart;
+		break;
+	}
+	if (this->offset.LowPart>this->stde.pps_size)
+		this->offset.LowPart=this->stde.pps_size;
+	if (newpos) *newpos = this->offset;
+	return OLE_OK;
+}
+
+HRESULT WINAPI IStream16_Read(
+        LPSTREAM16 this,void  *pv,ULONG cb,ULONG  *pcbRead
+) {
+	BYTE	block[BIGSIZE];
+	ULONG	*bytesread=pcbRead,xxread;
+	int	blocknr;
+
+	dprintf_info(relay,"IStream16(%p)->Read(%p,%ld,%p)\n",this,pv,cb,pcbRead);
+	if (!pcbRead) bytesread=&xxread;
+	*bytesread = 0;
+
+	if (cb>this->stde.pps_size-this->offset.LowPart)
+		cb=this->stde.pps_size-this->offset.LowPart;
+	if (this->stde.pps_size < 0x1000) {
+		/* use small block reader */
+		blocknr = STORAGE_get_nth_next_small_blocknr(this->hf,this->stde.pps_sb,this->offset.LowPart/SMALLSIZE);
+		while (cb) {
+			int	cc;
+
+			if (!STORAGE_get_small_block(this->hf,blocknr,block)) {
+				fprintf(stderr,"small block read failed!!!!\n");
+				return E_FAIL;
+			}
+			cc = cb; 
+			if (cc>SMALLSIZE-(this->offset.LowPart&(SMALLSIZE-1)))
+				cc=SMALLSIZE-(this->offset.LowPart&(SMALLSIZE-1));
+			memcpy((LPBYTE)pv,block+(this->offset.LowPart&(SMALLSIZE-1)),cc);
+			this->offset.LowPart+=cc;
+			(LPBYTE)pv+=cc;
+			*bytesread+=cc;
+			cb-=cc;
+			blocknr = STORAGE_get_next_small_blocknr(this->hf,blocknr);
+		}
+	} else {
+		/* use big block reader */
+		blocknr = STORAGE_get_nth_next_big_blocknr(this->hf,this->stde.pps_sb,this->offset.LowPart/BIGSIZE);
+		while (cb) {
+			int	cc;
+
+			if (!STORAGE_get_big_block(this->hf,blocknr,block)) {
+				fprintf(stderr,"big block read failed!!!!\n");
+				return E_FAIL;
+			}
+			cc = cb; 
+			if (cc>BIGSIZE-(this->offset.LowPart&(BIGSIZE-1)))
+				cc=BIGSIZE-(this->offset.LowPart&(BIGSIZE-1));
+			memcpy((LPBYTE)pv,block+(this->offset.LowPart&(BIGSIZE-1)),cc);
+			this->offset.LowPart+=cc;
+			(LPBYTE)pv+=cc;
+			*bytesread+=cc;
+			cb-=cc;
+			blocknr=STORAGE_get_next_big_blocknr(this->hf,blocknr);
+		}
+	}
+	return OLE_OK;
+}
+
+HRESULT WINAPI IStream16_Write(
+        LPSTREAM16 this,const void *pv,ULONG cb,ULONG *pcbWrite
+) {
+	BYTE	block[BIGSIZE];
+	ULONG	*byteswritten=pcbWrite,xxwritten;
+	int	oldsize,newsize,i,curoffset=0,lastblocknr,blocknr,cc;
+	HFILE32	hf = this->hf;
+
+	if (!pcbWrite) byteswritten=&xxwritten;
+	*byteswritten = 0;
+
+	dprintf_info(relay,"IStream16(%p)->Write(%p,%ld,%p)\n",this,pv,cb,pcbWrite);
+	/* do we need to junk some blocks? */
+	newsize	= this->offset.LowPart+cb;
+	oldsize	= this->stde.pps_size;
+	if (newsize < oldsize) {
+		if (oldsize < 0x1000) {
+			/* only small blocks */
+			blocknr=STORAGE_get_nth_next_small_blocknr(hf,this->stde.pps_sb,newsize/SMALLSIZE);
+
+			assert(blocknr>=0);
+
+			/* will set the rest of the chain to 'free' */
+			if (!STORAGE_set_small_chain(hf,blocknr,STORAGE_CHAINENTRY_ENDOFCHAIN))
+				return E_FAIL;
+		} else {
+			if (newsize >= 0x1000) {
+				blocknr=STORAGE_get_nth_next_big_blocknr(hf,this->stde.pps_sb,newsize/BIGSIZE);
+				assert(blocknr>=0);
+
+				/* will set the rest of the chain to 'free' */
+				if (!STORAGE_set_big_chain(hf,blocknr,STORAGE_CHAINENTRY_ENDOFCHAIN))
+					return E_FAIL;
+			} else {
+				/* Migrate large blocks to small blocks 
+				 * (we just migrate newsize bytes)
+				 */
+				LPBYTE	curdata,data = HeapAlloc(GetProcessHeap(),0,newsize+BIGSIZE);
+				cc	= newsize;
+				blocknr = this->stde.pps_sb;
+				curdata = data;
+				while (cc>0) {
+					if (!STORAGE_get_big_block(hf,blocknr,curdata)) {
+						HeapFree(GetProcessHeap(),0,data);
+						return E_FAIL;
+					}
+					curdata	+= BIGSIZE;
+					cc	-= BIGSIZE;
+					blocknr	 = STORAGE_get_next_big_blocknr(hf,blocknr);
+				}
+				/* frees complete chain for this stream */
+				if (!STORAGE_set_big_chain(hf,this->stde.pps_sb,STORAGE_CHAINENTRY_FREE))
+					return E_FAIL;
+				curdata	= data;
+				blocknr = this->stde.pps_sb = STORAGE_get_free_small_blocknr(hf);
+				if (blocknr<0)
+					return E_FAIL;
+				cc	= newsize;
+				while (cc>0) {
+					if (!STORAGE_put_small_block(hf,blocknr,curdata))
+						return E_FAIL;
+					cc	-= SMALLSIZE;
+					if (cc<=0) {
+						if (!STORAGE_set_small_chain(hf,blocknr,STORAGE_CHAINENTRY_ENDOFCHAIN))
+							return E_FAIL;
+						break;
+					} else {
+						int newblocknr = STORAGE_get_free_small_blocknr(hf);
+						if (newblocknr<0)
+							return E_FAIL;
+						if (!STORAGE_set_small_chain(hf,blocknr,newblocknr))
+							return E_FAIL;
+						blocknr = newblocknr;
+					}
+					curdata	+= SMALLSIZE;
+				}
+				HeapFree(GetProcessHeap(),0,data);
+			}
+		}
+		this->stde.pps_size = newsize;
+	}
+
+	if (newsize > oldsize) {
+		if (oldsize >= 0x1000) {
+			/* should return the block right before the 'endofchain' */
+			blocknr = STORAGE_get_nth_next_big_blocknr(hf,this->stde.pps_sb,this->stde.pps_size/BIGSIZE);
+			assert(blocknr>=0);
+			lastblocknr	= blocknr;
+			for (i=oldsize/BIGSIZE;i<newsize/BIGSIZE;i++) {
+				blocknr = STORAGE_get_free_big_blocknr(hf);
+				if (blocknr<0)
+					return E_FAIL;
+				if (!STORAGE_set_big_chain(hf,lastblocknr,blocknr))
+					return E_FAIL;
+				lastblocknr = blocknr;
+			}
+			if (!STORAGE_set_big_chain(hf,blocknr,STORAGE_CHAINENTRY_ENDOFCHAIN))
+				return E_FAIL;
+		} else {
+			if (newsize < 0x1000) {
+				/* find startblock */
+				if (!oldsize)
+					this->stde.pps_sb = blocknr = STORAGE_get_free_small_blocknr(hf);
+				else
+					blocknr = STORAGE_get_nth_next_small_blocknr(hf,this->stde.pps_sb,this->stde.pps_size/SMALLSIZE);
+				if (blocknr<0)
+					return E_FAIL;
+
+				/* allocate required new small blocks */
+				lastblocknr = blocknr;
+				for (i=oldsize/SMALLSIZE;i<newsize/SMALLSIZE;i++) {
+					blocknr = STORAGE_get_free_small_blocknr(hf);
+					if (blocknr<0)
+						return E_FAIL;
+					if (!STORAGE_set_small_chain(hf,lastblocknr,blocknr))
+						return E_FAIL;
+					lastblocknr = blocknr;
+				}
+				/* and terminate the chain */
+				if (!STORAGE_set_small_chain(hf,lastblocknr,STORAGE_CHAINENTRY_ENDOFCHAIN))
+					return E_FAIL;
+			} else {
+				if (!oldsize) {
+					/* no single block allocated yet */
+					blocknr=STORAGE_get_free_big_blocknr(hf);
+					if (blocknr<0)
+						return E_FAIL;
+					this->stde.pps_sb = blocknr;
+				} else {
+					/* Migrate small blocks to big blocks */
+					LPBYTE	curdata,data = HeapAlloc(GetProcessHeap(),0,oldsize+BIGSIZE);
+					cc	= oldsize;
+					blocknr = this->stde.pps_sb;
+					curdata = data;
+					/* slurp in */
+					while (cc>0) {
+						if (!STORAGE_get_small_block(hf,blocknr,curdata)) {
+							HeapFree(GetProcessHeap(),0,data);
+							return E_FAIL;
+						}
+						curdata	+= SMALLSIZE;
+						cc	-= SMALLSIZE;
+						blocknr	 = STORAGE_get_next_small_blocknr(hf,blocknr);
+					}
+					/* free small block chain */
+					if (!STORAGE_set_small_chain(hf,this->stde.pps_sb,STORAGE_CHAINENTRY_FREE))
+						return E_FAIL;
+					curdata	= data;
+					blocknr = this->stde.pps_sb = STORAGE_get_free_big_blocknr(hf);
+					if (blocknr<0)
+						return E_FAIL;
+					/* put the data into the big blocks */
+					cc	= this->stde.pps_size;
+					while (cc>0) {
+						if (!STORAGE_put_big_block(hf,blocknr,curdata))
+							return E_FAIL;
+						cc	-= BIGSIZE;
+						if (cc<=0) {
+							if (!STORAGE_set_big_chain(hf,blocknr,STORAGE_CHAINENTRY_ENDOFCHAIN))
+								return E_FAIL;
+							break;
+						} else {
+							int newblocknr = STORAGE_get_free_big_blocknr(hf);
+							if (newblocknr<0)
+								return E_FAIL;
+							if (!STORAGE_set_big_chain(hf,blocknr,newblocknr))
+								return E_FAIL;
+							blocknr = newblocknr;
+						}
+						curdata	+= BIGSIZE;
+					}
+					HeapFree(GetProcessHeap(),0,data);
+				}
+				/* generate big blocks to fit the new data */
+				lastblocknr	= blocknr;
+				for (i=oldsize/BIGSIZE;i<newsize/BIGSIZE;i++) {
+					blocknr = STORAGE_get_free_big_blocknr(hf);
+					if (blocknr<0)
+						return E_FAIL;
+					if (!STORAGE_set_big_chain(hf,lastblocknr,blocknr))
+						return E_FAIL;
+					lastblocknr = blocknr;
+				}
+				/* terminate chain */
+				if (!STORAGE_set_big_chain(hf,lastblocknr,STORAGE_CHAINENTRY_ENDOFCHAIN))
+					return E_FAIL;
+			}
+		}
+		this->stde.pps_size = newsize;
+	}
+
+	/* There are just some cases where we didn't modify it, we write it out
+	 * everytime
+	 */
+	if (!STORAGE_put_pps_entry(hf,this->ppsent,&(this->stde)))
+		return E_FAIL;
+
+	/* finally the write pass */
+	if (this->stde.pps_size < 0x1000) {
+		blocknr = STORAGE_get_nth_next_small_blocknr(hf,this->stde.pps_sb,this->offset.LowPart/SMALLSIZE);
+		assert(blocknr>=0);
+		while (cb>0) {
+			/* we ensured that it is allocated above */
+			assert(blocknr>=0);
+			/* Read old block everytime, since we can have
+			 * overlapping data at START and END of the write
+			 */
+			if (!STORAGE_get_small_block(hf,blocknr,block))
+				return E_FAIL;
+
+			cc = SMALLSIZE-(this->offset.LowPart&(SMALLSIZE-1));
+			if (cc>cb)
+				cc=cb;
+			memcpy(	((LPBYTE)block)+(this->offset.LowPart&(SMALLSIZE-1)),
+				(LPBYTE)(pv+curoffset),
+				cc
+			);
+			if (!STORAGE_put_small_block(hf,blocknr,block))
+				return E_FAIL;
+			cb			-= cc;
+			curoffset		+= cc;
+			(LPBYTE)pv		+= cc;
+			this->offset.LowPart	+= cc;
+			*byteswritten		+= cc;
+			blocknr = STORAGE_get_next_small_blocknr(hf,blocknr);
+		}
+	} else {
+		blocknr = STORAGE_get_nth_next_big_blocknr(hf,this->stde.pps_sb,this->offset.LowPart/BIGSIZE);
+		assert(blocknr>=0);
+		while (cb>0) {
+			/* we ensured that it is allocated above, so it better is */
+			assert(blocknr>=0);
+			/* read old block everytime, since we can have
+			 * overlapping data at START and END of the write
+			 */
+			if (!STORAGE_get_big_block(hf,blocknr,block))
+				return E_FAIL;
+
+			cc = BIGSIZE-(this->offset.LowPart&(BIGSIZE-1));
+			if (cc>cb)
+				cc=cb;
+			memcpy(	((LPBYTE)block)+(this->offset.LowPart&(BIGSIZE-1)),
+				(LPBYTE)(pv+curoffset),
+				cc
+			);
+			if (!STORAGE_put_big_block(hf,blocknr,block))
+				return E_FAIL;
+			cb			-= cc;
+			curoffset		+= cc;
+			(LPBYTE)pv		+= cc;
+			this->offset.LowPart	+= cc;
+			*byteswritten		+= cc;
+			blocknr = STORAGE_get_next_big_blocknr(hf,blocknr);
+		}
+	}
+	return OLE_OK;
+}
+
+static void _create_istream16(LPSTREAM16 *str) {
+	LPSTREAM16	lpst;
+
+	if (!strvt16.fnQueryInterface) {
+		HMODULE16	wp = GetModuleHandle16("STORAGE");
+		if (wp>=32) {
+#define VTENT(x)  strvt16.fn##x = (void*)WIN32_GetProcAddress16(wp,"IStream16_"#x);
+			VTENT(QueryInterface)
+			VTENT(AddRef)
+			VTENT(Release)
+			VTENT(Read)
+			VTENT(Write)
+			VTENT(Seek)
+			VTENT(SetSize)
+			VTENT(CopyTo)
+			VTENT(Commit)
+			VTENT(Revert)
+			VTENT(LockRegion)
+			VTENT(UnlockRegion)
+			VTENT(Stat)
+			VTENT(Clone)
+#undef VTENT
+			segstrvt16 = SEGPTR_NEW(IStream16_VTable);
+			memcpy(segstrvt16,&strvt16,sizeof(strvt16));
+			segstrvt16 = (LPSTREAM16_VTABLE)SEGPTR_GET(segstrvt16);
+		} else {
+#define VTENT(x) strvt16.fn##x = IStream16_##x;
+			VTENT(QueryInterface)
+			VTENT(AddRef)
+			VTENT(Release)
+			VTENT(Read)
+			VTENT(Write)
+			VTENT(Seek)
+	/*
+			VTENT(CopyTo)
+			VTENT(Commit)
+			VTENT(SetSize)
+			VTENT(Revert)
+			VTENT(LockRegion)
+			VTENT(UnlockRegion)
+			VTENT(Stat)
+			VTENT(Clone)
+	*/
+#undef VTENT
+			segstrvt16 = &strvt16;
+		}
+	}
+	lpst = SEGPTR_NEW(IStream16);
+	lpst->lpvtbl	= segstrvt16;
+	lpst->ref	= 1;
+	lpst->thisptr	= SEGPTR_GET(lpst);
+	*str = (void*)lpst->thisptr;
+}
+
+/*****************************************************************************
+ *			IStream32
+ */
+HRESULT WINAPI IStream32_QueryInterface(
+	LPSTREAM32 this,REFIID refiid,LPVOID *obj
+) {
+	char    xrefiid[50];
+
+	WINE_StringFromCLSID((LPCLSID)refiid,xrefiid);
+	dprintf_info(relay,"IStream16(%p)->QueryInterface(%s,%p)\n",this,xrefiid,obj);
+	if (!memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown))) {
+		*obj = this;
+		return 0;
+	}
+	return OLE_E_ENUM_NOMORE;
+	
+}
+
+ULONG WINAPI IStream32_AddRef(LPSTREAM32 this) {
+	return ++(this->ref);
+}
+
+ULONG WINAPI IStream32_Release(LPSTREAM32 this) {
+	FlushFileBuffers(this->hf);
+	this->ref--;
+	if (!this->ref) {
+		CloseHandle(this->hf);
+		SEGPTR_FREE(this);
+		return 0;
+	}
+	return this->ref;
+}
+
+static IStream32_VTable strvt32 = {
+	IStream32_QueryInterface,
+	IStream32_AddRef,
+	IStream32_Release,
+	(void*)4,
+	(void*)5,
+	(void*)6,
+	(void*)7,
+	(void*)8,
+	(void*)9,
+	(void*)10,
+	(void*)11,
+};
+
+/******************************************************************************
+ *		IStorage
+ */
+HRESULT WINAPI IStorage16_QueryInterface(
+	LPSTORAGE16 this,REFIID refiid,LPVOID *obj
+) {
+	char    xrefiid[50];
+
+	WINE_StringFromCLSID((LPCLSID)refiid,xrefiid);
+	dprintf_info(relay,"IStorage16(%p)->QueryInterface(%s,%p)\n",this,xrefiid,obj);
+
+	if (!memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown))) {
+		*obj = this;
+		return 0;
+	}
+	return OLE_E_ENUM_NOMORE;
+}
+
+ULONG WINAPI IStorage16_AddRef(LPSTORAGE16 this) {
+	return ++(this->ref);
+}
+
+ULONG WINAPI IStorage16_Release(LPSTORAGE16 this) {
+	this->ref--;
+	if (this->ref)
+		return this->ref;
+	SEGPTR_FREE(this);
+	return 0;
+}
+
+HRESULT WINAPI IStorage16_Stat(
+        LPSTORAGE16 this,STATSTG *pstatstg, DWORD grfStatFlag
+) {
+	fprintf(stderr,"IStorage16(%p)->Stat(%p,0x%08lx)\n",
+		this,pstatstg,grfStatFlag
+	);
+	pstatstg->pwcsName=SEGPTR_GET(SEGPTR_STRDUP_WtoA(this->stde.pps_rawname));
+	pstatstg->type = this->stde.pps_type;
+	pstatstg->cbSize.LowPart = this->stde.pps_size;
+	pstatstg->mtime = this->stde.pps_ft1; /* FIXME */
+	pstatstg->atime = this->stde.pps_ft2; /* FIXME */
+	pstatstg->ctime = this->stde.pps_ft2; /* FIXME */
+	pstatstg->grfMode	= 0; /* FIXME */
+	pstatstg->grfLocksSupported = 0; /* FIXME */
+	pstatstg->clsid		= this->stde.pps_guid;
+	pstatstg->grfStateBits	= 0; /* FIXME */
+	pstatstg->reserved	= 0;
+	return OLE_OK;
+}
+
+HRESULT WINAPI IStorage16_Commit(
+        LPSTORAGE16 this,DWORD commitflags
+) {
+	fprintf(stderr,"IStorage16(%p)->Commit(0x%08lx),STUB!\n",
+		this,commitflags
+	);
+	return OLE_OK;
+}
+
+HRESULT WINAPI IStorage16_CopyTo(LPSTORAGE16 this,DWORD ciidExclude,const IID *rgiidExclude,SNB16 SNB16Exclude,IStorage16 *pstgDest) {
+	char	xguid[50];
+
+	if (rgiidExclude)
+		WINE_StringFromCLSID(rgiidExclude,xguid);
+	else
+		strcpy(xguid,"<no guid>");
+	fprintf(stderr,"IStorage16(%p)->CopyTo(0x%08lx,%s,%p,%p),stub!\n",
+		this,ciidExclude,xguid,SNB16Exclude,pstgDest
+	);
+	return OLE_OK;
+}
+
+
+
+HRESULT WINAPI IStorage16_CreateStorage(
+	LPSTORAGE16 this,LPCOLESTR16 pwcsName,DWORD grfMode,DWORD dwStgFormat,DWORD reserved2, IStorage16 **ppstg
+) {
+	LPSTORAGE16	lpstg;
+	int		ppsent,x;
+	struct storage_pps_entry	stde;
+	struct storage_header sth;
+	HFILE32		hf=this->hf;
+
+	READ_HEADER;
+
+	fprintf(stderr,"IStorage16(%p)->CreateStorage(%s,0x%08lx,0x%08lx,0x%08lx,%p)\n",
+		this,pwcsName,grfMode,dwStgFormat,reserved2,ppstg
+	);
+	if (grfMode & STGM_TRANSACTED)
+		fprintf(stderr,"IStorage::CreateStorage:We do not support transacted Compound Storage. Using direct mode.\n");
+	_create_istorage16(ppstg);
+	lpstg = (LPSTORAGE16)PTR_SEG_TO_LIN(*ppstg);
+	lpstg->hf		= this->hf;
+
+	ppsent=STORAGE_get_free_pps_entry(lpstg->hf);
+	if (ppsent<0)
+		return E_FAIL;
+	stde=this->stde;
+	if (stde.pps_dir==-1) {
+		stde.pps_dir = ppsent;
+		x = this->ppsent;
+	} else {
+		/* FIXME: use prev chain too ? */
+		x=stde.pps_dir;
+		if (1!=STORAGE_get_pps_entry(lpstg->hf,x,&stde))
+			return E_FAIL;
+		while (stde.pps_next!=-1) {
+			x=stde.pps_next;
+			if (1!=STORAGE_get_pps_entry(lpstg->hf,x,&stde))
+				return E_FAIL;
+		}
+		stde.pps_next = ppsent;
+	}
+	assert(STORAGE_put_pps_entry(lpstg->hf,x,&stde));
+	assert(1==STORAGE_get_pps_entry(lpstg->hf,ppsent,&(lpstg->stde)));
+	lstrcpyAtoW(lpstg->stde.pps_rawname,pwcsName);
+	lpstg->stde.pps_sizeofname = lstrlen32A(pwcsName)*2+2;
+	lpstg->stde.pps_next	= -1;
+	lpstg->stde.pps_prev	= -1;
+	lpstg->stde.pps_dir	= -1;
+	lpstg->stde.pps_sb	= -1;
+	lpstg->stde.pps_size	=  0;
+	lpstg->stde.pps_type	=  1;
+	lpstg->ppsent		= ppsent;
+	/* FIXME: timestamps? */
+	if (!STORAGE_put_pps_entry(lpstg->hf,ppsent,&(lpstg->stde)))
+		return E_FAIL;
+	return OLE_OK;
+}
+
+HRESULT WINAPI IStorage16_CreateStream(
+	LPSTORAGE16 this,LPCOLESTR16 pwcsName,DWORD grfMode,DWORD reserved1,DWORD reserved2, IStream16 **ppstm
+) {
+	LPSTREAM16	lpstr;
+	int		ppsent,x;
+	struct storage_pps_entry	stde;
+
+	fprintf(stderr,"IStorage16(%p)->CreateStream(%s,0x%08lx,0x%08lx,0x%08lx,%p)\n",
+		this,pwcsName,grfMode,reserved1,reserved2,ppstm
+	);
+	if (grfMode & STGM_TRANSACTED)
+		fprintf(stderr,"IStorage::CreateStream:We do not support transacted Compound Storage. Using direct mode.\n");
+	_create_istream16(ppstm);
+	lpstr = (LPSTREAM16)PTR_SEG_TO_LIN(*ppstm);
+	lpstr->hf		= FILE_Dup(this->hf);
+	lpstr->offset.LowPart	= 0;
+	lpstr->offset.HighPart	= 0;
+
+	ppsent=STORAGE_get_free_pps_entry(lpstr->hf);
+	if (ppsent<0)
+		return E_FAIL;
+	stde=this->stde;
+	if (stde.pps_next==-1)
+		x=this->ppsent;
+	else
+		while (stde.pps_next!=-1) {
+			x=stde.pps_next;
+			if (1!=STORAGE_get_pps_entry(lpstr->hf,x,&stde))
+				return E_FAIL;
+		}
+	stde.pps_next = ppsent;
+	assert(STORAGE_put_pps_entry(lpstr->hf,x,&stde));
+	assert(1==STORAGE_get_pps_entry(lpstr->hf,ppsent,&(lpstr->stde)));
+	lstrcpyAtoW(lpstr->stde.pps_rawname,pwcsName);
+	lpstr->stde.pps_sizeofname = lstrlen32A(pwcsName)*2+2;
+	lpstr->stde.pps_next	= -1;
+	lpstr->stde.pps_prev	= -1;
+	lpstr->stde.pps_dir	= -1;
+	lpstr->stde.pps_sb	= -1;
+	lpstr->stde.pps_size	=  0;
+	lpstr->stde.pps_type	=  2;
+	lpstr->ppsent		= ppsent;
+	/* FIXME: timestamps? */
+	if (!STORAGE_put_pps_entry(lpstr->hf,ppsent,&(lpstr->stde)))
+		return E_FAIL;
+	return OLE_OK;
+}
+
+HRESULT WINAPI IStorage16_OpenStorage(
+	LPSTORAGE16 this,LPCOLESTR16 pwcsName, IStorage16 *pstgPrio, DWORD grfMode, SNB16 snbExclude, DWORD reserved, IStorage16 **ppstg
+) {
+	LPSTREAM16	lpstg;
+	WCHAR		name[33];
+	int		newpps;
+
+	dprintf_info(relay,"IStorage16(%p)->OpenStorage(%s,%p,0x%08lx,%p,0x%08lx,%p)\n",
+		this,pwcsName,pstgPrio,grfMode,snbExclude,reserved,ppstg
+	);
+	if (grfMode & STGM_TRANSACTED)
+		fprintf(stderr,"IStorage::OpenStorage:We do not support transacted Compound Storage. Using direct mode.\n");
+	_create_istorage16(ppstg);
+	lpstg = (LPSTREAM16)PTR_SEG_TO_LIN(*ppstg);
+	lpstg->hf = FILE_Dup(this->hf);
+	lstrcpyAtoW(name,pwcsName);
+	newpps = STORAGE_look_for_named_pps(lpstg->hf,this->stde.pps_dir,name);
+	if (newpps==-1) {
+		IStream16_Release(lpstg);
+		return E_FAIL;
+	}
+
+	if (1!=STORAGE_get_pps_entry(lpstg->hf,newpps,&(lpstg->stde))) {
+		IStream16_Release(lpstg);
+		return E_FAIL;
+	}
+	lpstg->ppsent		= newpps;
+	return OLE_OK;
+}
+
+HRESULT WINAPI IStorage16_OpenStream(
+	LPSTORAGE16 this,LPCOLESTR16 pwcsName, void *reserved1, DWORD grfMode, DWORD reserved2, IStream16 **ppstm
+) {
+	LPSTREAM16	lpstr;
+	WCHAR		name[33];
+	int		newpps;
+
+	dprintf_info(relay,"IStorage16(%p)->OpenStream(%s,%p,0x%08lx,0x%08lx,%p)\n",
+		this,pwcsName,reserved1,grfMode,reserved2,ppstm
+	);
+	if (grfMode & STGM_TRANSACTED)
+		fprintf(stderr,"IStorage::OpenStream:We do not support transacted Compound Storage. Using direct mode.\n");
+	_create_istream16(ppstm);
+	lpstr = (LPSTREAM16)PTR_SEG_TO_LIN(*ppstm);
+	lpstr->hf = FILE_Dup(this->hf);
+	lstrcpyAtoW(name,pwcsName);
+	newpps = STORAGE_look_for_named_pps(lpstr->hf,this->stde.pps_dir,name);
+	if (newpps==-1) {
+		IStream16_Release(lpstr);
+		return E_FAIL;
+	}
+
+	if (1!=STORAGE_get_pps_entry(lpstr->hf,newpps,&(lpstr->stde))) {
+		IStream16_Release(lpstr);
+		return E_FAIL;
+	}
+	lpstr->offset.LowPart	= 0;
+	lpstr->offset.HighPart	= 0;
+	lpstr->ppsent		= newpps;
+	return OLE_OK;
+}
+
+static void _create_istorage16(LPSTORAGE16 *stg) {
+	LPSTORAGE16	lpst;
+
+	if (!stvt16.fnQueryInterface) {
+		HMODULE16	wp = GetModuleHandle16("STORAGE");
+		if (wp>=32) {
+#define VTENT(x)  stvt16.fn##x = (void*)WIN32_GetProcAddress16(wp,"IStorage16_"#x);
+			VTENT(QueryInterface)
+			VTENT(AddRef)
+			VTENT(Release)
+			VTENT(CreateStream)
+			VTENT(OpenStream)
+			VTENT(CreateStorage)
+			VTENT(OpenStorage)
+			VTENT(CopyTo)
+			VTENT(MoveElementTo)
+			VTENT(Commit)
+			VTENT(Revert)
+			VTENT(EnumElements)
+			VTENT(DestroyElement)
+			VTENT(RenameElement)
+			VTENT(SetElementTimes)
+			VTENT(SetClass)
+			VTENT(SetStateBits)
+			VTENT(Stat)
+#undef VTENT
+			segstvt16 = SEGPTR_NEW(IStorage16_VTable);
+			memcpy(segstvt16,&stvt16,sizeof(stvt16));
+			segstvt16 = (LPSTORAGE16_VTABLE)SEGPTR_GET(segstvt16);
+		} else {
+#define VTENT(x) stvt16.fn##x = IStorage16_##x;
+			VTENT(QueryInterface)
+			VTENT(AddRef)
+			VTENT(Release)
+			VTENT(CreateStream)
+			VTENT(OpenStream)
+			VTENT(CreateStorage)
+			VTENT(OpenStorage)
+			VTENT(CopyTo)
+			VTENT(Commit)
+	/*  not (yet) implemented ...
+			VTENT(MoveElementTo)
+			VTENT(Revert)
+			VTENT(EnumElements)
+			VTENT(DestroyElement)
+			VTENT(RenameElement)
+			VTENT(SetElementTimes)
+			VTENT(SetClass)
+			VTENT(SetStateBits)
+			VTENT(Stat)
+	*/
+#undef VTENT
+			segstvt16 = &stvt16;
+		}
+	}
+	lpst = SEGPTR_NEW(IStorage16);
+	lpst->lpvtbl	= segstvt16;
+	lpst->ref	= 1;
+	lpst->thisptr	= SEGPTR_GET(lpst);
+	*stg = (void*)lpst->thisptr;
+}
+
+/******************************************************************************
+ *		IStorage32
+ */
+HRESULT WINAPI IStorage32_QueryInterface(
+	LPSTORAGE32 this,REFIID refiid,LPVOID *obj
+) {
+	char    xrefiid[50];
+
+	WINE_StringFromCLSID((LPCLSID)refiid,xrefiid);
+	dprintf_info(relay,"IStorage32(%p)->QueryInterface(%s,%p)\n",this,xrefiid,obj);
+
+	if (!memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown))) {
+		*obj = this;
+		return 0;
+	}
+	return OLE_E_ENUM_NOMORE;
+}
+
+ULONG WINAPI IStorage32_AddRef(LPSTORAGE32 this) {
+	return ++(this->ref);
+}
+
+ULONG WINAPI IStorage32_Release(LPSTORAGE32 this) {
+	this->ref--;
+	if (this->ref)
+		return this->ref;
+	HeapFree(GetProcessHeap(),0,this);
+	return 0;
+}
+
+HRESULT WINAPI IStorage32_CreateStream(
+	LPSTORAGE32 this,LPCOLESTR32 pwcsName,DWORD grfMode,DWORD reserved1,DWORD reserved2, IStream32 **ppstm
+) {
+	fprintf(stderr,"IStorage32(%p)->CreateStream(%p,0x%08lx,0x%08lx,0x%08lx,%p)\n",
+		this,pwcsName,grfMode,reserved1,reserved2,ppstm
+	);
+	*ppstm = (IStream32*)HeapAlloc(GetProcessHeap(),0,sizeof(IStream32));
+	(*ppstm)->lpvtbl= &strvt32;
+	(*ppstm)->ref	= 1;
+
+	return OLE_OK;
+}
+
+HRESULT WINAPI IStorage32_OpenStream(
+	LPSTORAGE32 this,LPCOLESTR32 pwcsName, void *reserved1, DWORD grfMode, DWORD reserved2, IStream32 **ppstm
+) {
+	fprintf(stderr,"IStorage32(%p)->OpenStream(%p,%p,0x%08lx,0x%08lx,%p)\n",
+		this,pwcsName,reserved1,grfMode,reserved2,ppstm
+	);
+	*ppstm = (IStream32*)HeapAlloc(GetProcessHeap(),0,sizeof(IStream32));
+	(*ppstm)->lpvtbl= &strvt32;
+	(*ppstm)->ref	= 1;
+	return OLE_OK;
+}
+
+static IStorage32_VTable stvt32 = {
+	IStorage32_QueryInterface,
+	IStorage32_AddRef,
+	IStorage32_Release,
+	IStorage32_CreateStream,
+	IStorage32_OpenStream,
+	(void*)6,
+	(void*)7,
+	(void*)8,
+	(void*)9,
+	(void*)10,
+	(void*)11,
+	(void*)12,
+	(void*)13,
+	(void*)14,
+	(void*)15,
+};
+
+/******************************************************************************
+ *	Storage API functions
+ */
+
+OLESTATUS WINAPI StgCreateDocFile16(
+	LPCOLESTR16 pwcsName,DWORD grfMode,DWORD reserved,IStorage16 **ppstgOpen
+) {
+	HFILE32		hf;
+	int		i,ret;
+	LPSTORAGE16	lpstg;
+	struct storage_pps_entry	stde;
+
+	fprintf(stderr,"StgCreateDocfile(%s,0x%08lx,0x%08lx,%p)\n",
+		pwcsName,grfMode,reserved,ppstgOpen
+	);
+	_create_istorage16(ppstgOpen);
+	hf = CreateFile32A(pwcsName,GENERIC_READ|GENERIC_WRITE,0,NULL,CREATE_NEW,0,0);
+	if (hf==INVALID_HANDLE_VALUE32) {
+		fprintf(stderr,"couldn't open file for storage:%ld\n",GetLastError());
+		return E_FAIL;
+	}
+	lpstg = (LPSTORAGE16)PTR_SEG_TO_LIN(*ppstgOpen);
+	lpstg->hf = hf;
+	/* FIXME: check for existance before overwriting? */
+	if (!STORAGE_init_storage(hf)) {
+		CloseHandle(hf);
+		return E_FAIL;
+	}
+	i=0;ret=0;
+	while (!ret) { /* neither 1 nor <0 */
+		ret=STORAGE_get_pps_entry(hf,i,&stde);
+		if ((ret==1) && (stde.pps_type==5)) {
+			lpstg->stde	= stde;
+			lpstg->ppsent	= i;
+			break;
+		}
+		i++;
+	}
+	if (ret!=1) {
+		IStorage16_Release(lpstg); /* will remove it */
+		return E_FAIL;
+	}
+	return OLE_OK;
+}
+
+OLESTATUS WINAPI StgCreateDocFile32(
+	LPCOLESTR32 pwcsName,DWORD grfMode,DWORD reserved,IStorage32 **ppstgOpen
+) {
+	fprintf(stderr,"StgCreateDocfile(%p,0x%08lx,0x%08lx,%p)\n",
+		pwcsName,grfMode,reserved,ppstgOpen
+	);
+	*ppstgOpen = (IStorage32*)HeapAlloc(GetProcessHeap(),0,sizeof(IStorage32));
+	(*ppstgOpen)->ref = 1;
+	(*ppstgOpen)->lpvtbl = &stvt32;
+	return OLE_OK;
+}
+
+OLESTATUS WINAPI StgIsStorageFile16(LPCOLESTR16 fn) {
+	HFILE32		hf;
+	OFSTRUCT	ofs;
+	BYTE		magic[24];
+
+	fprintf(stderr,"StgIsStorageFile(%s)",fn);
+	hf = OpenFile32(fn,&ofs,OF_SHARE_DENY_NONE);
+	if (hf==HFILE_ERROR32)
+		return STG_E_FILENOTFOUND;
+	if (24!=_lread32(hf,magic,24)) {
+		fprintf(stderr," too short\n");
+		_lclose32(hf);
+		return S_FALSE;
+	}
+	if (!memcmp(magic,STORAGE_magic,8)) {
+		fprintf(stderr," -> YES\n");
+		_lclose32(hf);
+		return S_OK;
+	}
+	if (!memcmp(magic,STORAGE_notmagic,8)) {
+		fprintf(stderr," -> NO\n");
+		_lclose32(hf);
+		return S_FALSE;
+	}
+	if (!memcmp(magic,STORAGE_oldmagic,8)) {
+		fprintf(stderr," -> old format\n");
+		_lclose32(hf);
+		return STG_E_OLDFORMAT;
+	}
+	fprintf(stderr," -> Invalid header.\n");
+	_lclose32(hf);
+	return STG_E_INVALIDHEADER;
+}
+
+OLESTATUS WINAPI StgIsStorageFile32(LPCOLESTR32 fn) {
+	LPOLESTR16	xfn = HEAP_strdupWtoA(GetProcessHeap(),0,fn);
+	OLESTATUS	ret = StgIsStorageFile16(xfn);
+
+	HeapFree(GetProcessHeap(),0,xfn);
+	return ret;
+}
+
+
+
+OLESTATUS WINAPI StgOpenStorage16(
+	const OLECHAR16 * pwcsName,IStorage16 *pstgPriority,DWORD grfMode,
+	SNB16 snbExclude,DWORD reserved, IStorage16 **ppstgOpen
+) {
+	HFILE32		hf;
+	int		ret,i;
+	LPSTORAGE16	lpstg;
+	struct storage_pps_entry	stde;
+
+	fprintf(stderr,"StgOpenStorage(%s,%p,0x%08lx,%p,%ld,%p)\n",
+		pwcsName,pstgPriority,grfMode,snbExclude,reserved,ppstgOpen
+	);
+	_create_istorage16(ppstgOpen);
+	hf = CreateFile32A(pwcsName,GENERIC_READ,0,NULL,0,0,0);
+	if (hf==INVALID_HANDLE_VALUE32) {
+		fprintf(stderr,"couldn't open file for storage\n");
+		return E_FAIL;
+	}
+	lpstg = (LPSTORAGE16)PTR_SEG_TO_LIN(*ppstgOpen);
+	lpstg->hf = hf;
+
+	i=0;ret=0;
+	while (!ret) { /* neither 1 nor <0 */
+		ret=STORAGE_get_pps_entry(hf,i,&stde);
+		if ((ret==1) && (stde.pps_type==5)) {
+			lpstg->stde=stde;
+			break;
+		}
+		i++;
+	}
+	if (ret!=1) {
+		IStorage16_Release(lpstg); /* will remove it */
+		return E_FAIL;
+	}
+	return OLE_OK;
+	
+}
+
+OLESTATUS WINAPI StgOpenStorage32(
+	const OLECHAR32 * pwcsName,IStorage32 *pstgPriority,DWORD grfMode,
+	SNB32 snbExclude,DWORD reserved, IStorage32 **ppstgOpen
+) {
+	fprintf(stderr,"StgOpenStorage32(%p,%p,0x%08lx,%p,%ld,%p),stub!\n",
+		pwcsName,pstgPriority,grfMode,snbExclude,reserved,ppstgOpen
+	);
+	*ppstgOpen = (IStorage32*)HeapAlloc(GetProcessHeap(),0,sizeof(IStorage32));
+	(*ppstgOpen)->ref = 1;
+	(*ppstgOpen)->lpvtbl = &stvt32;
+	return OLE_OK;
+}
diff --git a/programs/Makefile.in b/programs/Makefile.in
index 2f2e839..653c7f3 100644
--- a/programs/Makefile.in
+++ b/programs/Makefile.in
@@ -1,6 +1,8 @@
 SUBDIRS = \
+	clock \
 	notepad \
 	progman \
+	view \
 	winhelp \
 	winver
 
diff --git a/programs/clock/ChangeLog b/programs/clock/ChangeLog
new file mode 100644
index 0000000..ce10b4f
--- /dev/null
+++ b/programs/clock/ChangeLog
@@ -0,0 +1,14 @@
+Tue Feb 24 23:26:40 1998  Karl Backström <karl_b@geocities.com>
+       * [language.c] [language.h] NEW
+	 Moved language stuff here.
+       * [main.c] [winclock.c] [clock.rc]
+	 Made the clock appear in the center.
+	 Fixed problems with menues.
+
+Mon Feb 23 19:59:27 1998  Marcel Baur <mbaur@g26.ethz.ch>
+       * [ChangeLog] [De.rc] [En.rc] [Sw.rc] [clock.rc]
+         [license.c] [license.h] [License_En.c]
+         [README] [TODO]
+         [main.c] [main.h] [winclock.c] [winclock.h]
+
+	 Originals by Marcel Baur
diff --git a/programs/clock/De.rc b/programs/clock/De.rc
new file mode 100644
index 0000000..ab1371e
--- /dev/null
+++ b/programs/clock/De.rc
@@ -0,0 +1,33 @@
+/*
+ * Clock (German resources)
+ *
+ * Copyright 1997 Marcel Baur <mbaur@g26.ethz.ch>
+ *
+ */
+
+#define LANGUAGE_ID                  De
+#define LANGUAGE_NUMBER              2
+#define LANGUAGE_MENU_ITEM           "&Deutsch"
+
+/* Menu */
+
+#define MENU_PROPERTIES              "&Einstellungen"
+#define MENU_ANALOG                  "Ana&log"
+#define MENU_DIGITAL                 "Digi&tal"
+#define MENU_FONT                    "Schrift&art..."
+#define MENU_WITHOUT_TITLE           "&Ohne Titelleiste"
+#define MENU_ON_TOP                  "&Immer im Vordergrund"
+#define MENU_SECONDS                 "&Sekunden"
+#define MENU_DATE                    "&Datum"
+
+#define MENU_LANGUAGE                "&Sprache"
+
+#define MENU_INFO                    "Inf&o..."
+#define MENU_INFO_LICENSE            "&Lizenz"
+#define MENU_INFO_NO_WARRANTY        "&KEINE GARANTIE"
+#define MENU_INFO_ABOUT_WINE         "&Über Uhr..."
+
+/* Strings */
+#define STRING_CLOCK                 "Uhr"
+
+#include "clock.rc"
diff --git a/programs/clock/En.rc b/programs/clock/En.rc
new file mode 100644
index 0000000..3330cf7
--- /dev/null
+++ b/programs/clock/En.rc
@@ -0,0 +1,34 @@
+/*
+ * Clock (English resources)
+ *
+ * Copyright 1998 Marcel Baur <mbaur@g26.ethz.ch>
+ * FIXME: Weak translation !
+ */
+
+#define LANGUAGE_ID                  En
+#define LANGUAGE_NUMBER              0
+#define LANGUAGE_MENU_ITEM           "&English"
+
+/* Menu */
+
+#define MENU_PROPERTIES              "&Properties"
+#define MENU_ANALOG                  "Ana&log"
+#define MENU_DIGITAL                 "Digi&tal"
+#define MENU_FONT                    "&Font..."
+#define MENU_WITHOUT_TITLE           "&Without Titlebar"
+#define MENU_ON_TOP                  "&Always on Top"
+#define MENU_SECONDS                 "&Seconds"
+#define MENU_DATE                    "&Date"
+
+#define MENU_LANGUAGE                "&Language"
+
+#define MENU_INFO                    "Inf&o..."
+#define MENU_INFO_LICENSE            "&License"
+#define MENU_INFO_NO_WARRANTY        "&NO WARRANTY"
+#define MENU_INFO_ABOUT_WINE         "&About Clock..."
+
+/* Strings */
+#define STRING_CLOCK                 "Clock"
+
+
+#include "clock.rc"
diff --git a/programs/clock/License_En.c b/programs/clock/License_En.c
new file mode 100644
index 0000000..bec66d9
--- /dev/null
+++ b/programs/clock/License_En.c
@@ -0,0 +1,48 @@
+#include "windows.h"
+#include "license.h"
+
+static CHAR LicenseCaption_En[] = "LICENSE";
+static CHAR License_En[] = "\
+You may without charge, royalty or other payment, copy and\
+ distribute copies of this work and derivative works of this work\
+ in source or binary form provided that: (1)\
+ you appropriately publish on each copy an appropriate copyright\
+ notice; (2) faithfully reproduce all prior copyright notices\
+ included in the original work (you may also add your own\
+ copyright notice); and (3) agree to indemnify and hold all prior\
+ authors, copyright holders and licensors of the work harmless\
+ from and against all damages arising from use of the work.\
+\n\
+You may distribute sources of derivative works of the work\
+ provided that (1) (a) all source files of the original work that\
+ have been modified, (b) all source files of the derivative work\
+ that contain any party of the original work, and (c) all source\
+ files of the derivative work that are necessary to compile, link\
+ and run the derivative work without unresolved external calls and\
+ with the same functionality of the original work (\"Necessary\
+ Sources\") carry a prominent notice explaining the nature and date\
+ of the modification and/or creation.  You are encouraged to make\
+ the Necessary Sources available under this license in order to\
+ further the development and acceptance of the work.\
+\n\
+EXCEPT AS OTHERWISE RESTRICTED BY LAW, THIS WORK IS PROVIDED\
+ WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES OF ANY KIND, INCLUDING\
+ BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF FITNESS FOR A\
+ PARTICULAR PURPOSE, MERCHANTABILITY OR TITLE.  EXCEPT AS\
+ OTHERWISE PROVIDED BY LAW, NO AUTHOR, COPYRIGHT HOLDER OR\
+ LICENSOR SHALL BE LIABLE TO YOU FOR DAMAGES OF ANY KIND, EVEN IF\
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.";
+
+static CHAR NoWarrantyCaption_En[] = "NO WARRANTY";
+static CHAR NoWarranty_En[] = "\
+EXCEPT AS OTHERWISE RESTRICTED BY LAW, THIS WORK IS PROVIDED\
+ WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES OF ANY KIND, INCLUDING\
+ BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF FITNESS FOR A\
+ PARTICULAR PURPOSE, MERCHANTABILITY OR TITLE.  EXCEPT AS\
+ OTHERWISE PROVIDED BY LAW, NO AUTHOR, COPYRIGHT HOLDER OR\
+ LICENSOR SHALL BE LIABLE TO YOU FOR DAMAGES OF ANY KIND, EVEN IF\
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.";
+
+LICENSE WineLicense_En = {License_En, LicenseCaption_En,
+			  NoWarranty_En, NoWarrantyCaption_En};
+
diff --git a/programs/clock/Makefile.in b/programs/clock/Makefile.in
new file mode 100644
index 0000000..06b37d1
--- /dev/null
+++ b/programs/clock/Makefile.in
@@ -0,0 +1,47 @@
+DEFS      = -DWINELIB
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../..
+SRCDIR    = @srcdir@
+VPATH     = @srcdir@
+MODULE    = none
+PROGRAMS  = clock
+ALL_LIBS  = $(WINELIB) $(X_LIBS) $(XPM_LIB) $(XLIB) $(LIBS)
+RCFLAGS   = -w32 -h
+
+LANGUAGES   = En De Sw
+LICENSELANG = En
+
+MOSTSRCS = \
+	language.c \
+	license.c \
+	winclock.c \
+	main.c
+
+# Some strings need addresses >= 0x10000
+STRINGSRCS = \
+	$(LICENSELANG:%=License_%.c)
+
+RC_SRCS = $(LANGUAGES:%=%.rc)
+
+C_SRCS = $(MOSTSRCS) $(STRINGSRCS)
+
+MOSTOBJS = $(MOSTSRCS:.c=.o)
+STRINGOBJS = $(STRINGSRCS:.c=.o) $(RC_SRCS:.rc=.o)
+
+all: check_winerc $(PROGRAMS)
+
+depend:: $(RC_SRCS:.rc=.h)
+
+@MAKE_RULES@
+
+clock: $(MOSTOBJS) $(STRINGOBJS)
+	$(CC) -o clock $(MOSTOBJS) $(LDOPTIONS) $(ALL_LIBS) $(STRINGOBJS)
+
+install: dummy
+	$(INSTALL_PROGRAM) clock $(bindir)/clock
+
+$(RC_SRCS:.rc=.c) $(RC_SRCS:.rc=.h): $(WINERC)
+
+dummy:
+
+### Dependencies:
diff --git a/programs/clock/README b/programs/clock/README
new file mode 100644
index 0000000..40cc048
--- /dev/null
+++ b/programs/clock/README
@@ -0,0 +1,18 @@
+
+ Clock for Wine
+ ==============
+ 
+ This is a first attempt to realize a desktop clock for Wine as done in 
+ Windows. It'a an early release and most of the code is still broken.
+
+ Please see file TODO for things to do and keep the file ChangeLog
+ up to date.
+
+ Code is currently under heavy construction. Nearly all files will 
+ change until next release. You can speed up development of clock
+ if you send patches and additions directly to my personal email 
+ address <mbaur@g26.ethz.ch>.
+
+ I also try to read news:comp.emulators.ms-windows.wine frequently, 
+ so I can also integrate patches posted via usenet.
+
diff --git a/programs/clock/Sw.rc b/programs/clock/Sw.rc
new file mode 100644
index 0000000..9e58cc9
--- /dev/null
+++ b/programs/clock/Sw.rc
@@ -0,0 +1,33 @@
+/*
+ * Clock (Swedish resources)
+ *
+ * Copyright 1998 Marcel Baur <mbaur@g26.ethz.ch>
+ * Translated into swedish by Karl Backström <karl_b@geocities.com> 
+ */
+
+#define LANGUAGE_ID                  Sw
+#define LANGUAGE_NUMBER              1d
+#define LANGUAGE_MENU_ITEM           "&Svenska"
+
+/* Menu */
+
+#define MENU_PROPERTIES              "&Egenskaper"
+#define MENU_ANALOG                  "Ana&log"
+#define MENU_DIGITAL                 "Digi&tal"
+#define MENU_FONT                    "&Font..."
+#define MENU_WITHOUT_TITLE           "&Utan Titlebar"
+#define MENU_ON_TOP                  "&Alltid överst"
+#define MENU_SECONDS                 "&Sekunder"
+#define MENU_DATE                    "&Datum"
+
+#define MENU_LANGUAGE                "&Språk"
+
+#define MENU_INFO                    "Inf&o..."
+#define MENU_INFO_LICENSE            "&Licens"
+#define MENU_INFO_NO_WARRANTY        "&INGEN GARANTI"
+#define MENU_INFO_ABOUT_WINE         "&Om Klockan..."
+
+/* Strings */
+#define STRING_CLOCK                 "Klockan"
+
+#include "clock.rc"
diff --git a/programs/clock/TODO b/programs/clock/TODO
new file mode 100644
index 0000000..7d15d1a
--- /dev/null
+++ b/programs/clock/TODO
@@ -0,0 +1,36 @@
+
+Some ideas for improvements:
+============================
+
+- Add Font Selection Dialog (should be CommDlg).
+
+- Make "Without Titlebar", Double-clicking the clock should reveal the caption
+  again.
+
+- Move the "Without Titlebar" into the System Menu (as in Windows)
+
+- Implement a "digital clock"
+
+- Font Handling of Digital Clock.
+
+- Make distinction between analog clock and digital clock according to
+  Globals.bAnalog setting / CL_ANALOG menu event.
+
+- Implement Date (Window caption), but mind the different languages.
+
+- Make distinction between Date / no Date according to
+  Globals.bDate setting / CL_DATE menu event.
+
+- Implement Timer Mechanism instead Polling.
+  Clock does not run if menu is being selected (?).
+
+- Fix Clock Background (sometimes destroyed).
+  ( This is because the old "Hands" are removed one more time )
+
+- Fix English translation by comparing strings from an original English
+  Windows Clock application (I only have a German version).
+
+- Add new .rc resources for all languages you know.
+
+
+Please don't forget a ChangeLog entry.
diff --git a/programs/clock/clock.rc b/programs/clock/clock.rc
new file mode 100644
index 0000000..2d79ea5
--- /dev/null
+++ b/programs/clock/clock.rc
@@ -0,0 +1,60 @@
+/*
+ * Clock (clock.rc)
+ *
+ * Copyright 1998 Marcel Baur <mbaur@g26.ethz.ch>
+ */
+
+#include "main.h"
+ 
+#define CONCAT(a, b) CONCAT1(a, b)
+#define CONCAT1(a, b) a##b
+
+/* Main Menu */
+
+CONCAT(MENU_, LANGUAGE_ID) MENU
+{
+ POPUP MENU_PROPERTIES {
+   MENUITEM MENU_ANALOG,                CL_ANALOG
+   MENUITEM MENU_DIGITAL,               CL_DIGITAL
+   MENUITEM SEPARATOR
+   MENUITEM MENU_FONT,                  CL_FONT
+   MENUITEM SEPARATOR
+   MENUITEM MENU_WITHOUT_TITLE,         CL_WITHOUT_TITLE
+   MENUITEM SEPARATOR
+   MENUITEM MENU_SECONDS,               CL_SECONDS
+   MENUITEM MENU_DATE,                  CL_DATE
+   MENUITEM SEPARATOR
+   MENUITEM MENU_ON_TOP,                CL_ON_TOP
+   }
+   POPUP MENU_LANGUAGE {
+     /* Dummy item, will be removed */
+     MENUITEM SEPARATOR
+   }
+   
+   POPUP MENU_INFO {
+      MENUITEM MENU_INFO_LICENSE,       CL_INFO_LICENSE
+      MENUITEM MENU_INFO_NO_WARRANTY,   CL_INFO_NO_WARRANTY
+      MENUITEM MENU_INFO_ABOUT_WINE,    CL_INFO_ABOUT_WINE
+   }
+ 
+}
+
+/* Strings */
+
+#define ADDSTRING(str) ADDSTRING1(LANGUAGE_NUMBER, IDS_ ## str) STRING_ ## str
+#define ADDSTRING1(langnum, ids) ADDSTRING2(langnum, ids)
+#define ADDSTRING2(langnum, ids) 0x ## langnum ## ids
+
+#define STRINGIFY(str) STRINGIFY1(str)
+#define STRINGIFY1(str) #str
+
+#define STRING_LANGUAGE_ID        STRINGIFY(LANGUAGE_ID)
+#define STRING_LANGUAGE_MENU_ITEM LANGUAGE_MENU_ITEM
+
+
+STRINGTABLE
+{
+ADDSTRING(LANGUAGE_ID)
+ADDSTRING(LANGUAGE_MENU_ITEM)
+ADDSTRING(CLOCK)
+}
diff --git a/programs/clock/language.c b/programs/clock/language.c
new file mode 100644
index 0000000..3074f0d
--- /dev/null
+++ b/programs/clock/language.c
@@ -0,0 +1,146 @@
+/*
+ * Clock
+ *
+ * Copyright 1998 Marcel Baur <mbaur@g26.ethz.ch>
+ * Copyright 1998 Karl Backström <karl_b@geocities.com>
+ */
+
+#include <stdio.h>
+#include "windows.h"
+#include "main.h"
+#include "language.h"
+#ifdef WINELIB
+#include "options.h"
+#endif
+
+CHAR STRING_MENU_Xx[]      = "MENU_Xx";
+
+static BOOL LANGUAGE_LoadStringOtherLanguage(UINT num, UINT ids, LPSTR str, UINT len)
+{
+  ids -= Globals.wStringTableOffset;
+  ids += num * 0x100;
+  return(LoadString(Globals.hInstance, ids, str, len));
+};
+
+VOID LANGUAGE_SelectLanguageByName(LPCSTR lang)
+{
+  INT i;
+  CHAR newlang[3];
+
+  for (i = 0; i <= MAX_LANGUAGE_NUMBER; i++)
+    if (LANGUAGE_LoadStringOtherLanguage(i, IDS_LANGUAGE_ID, newlang, sizeof(newlang)) &&
+	!lstrcmp(lang, newlang))
+      {
+        LANGUAGE_SelectLanguageByNumber(i);
+	return;
+      }
+
+  /* Fallback */
+    for (i = 0; i <= MAX_LANGUAGE_NUMBER; i++)
+    if (LANGUAGE_LoadStringOtherLanguage(i, IDS_LANGUAGE_ID, newlang, sizeof(newlang)))
+      {
+	LANGUAGE_SelectLanguageByNumber(i);
+	return;
+      }
+
+  MessageBox(Globals.hMainWnd, "No language found", "FATAL ERROR", MB_OK);
+  PostQuitMessage(1);
+}
+
+VOID LANGUAGE_SelectLanguageByNumber(UINT num)
+{
+  INT    i;
+  CHAR   lang[3];
+  CHAR   caption[MAX_STRING_LEN];
+  CHAR   item[MAX_STRING_LEN];
+  HMENU  hMainMenu;
+
+  /* Select string table */
+  Globals.wStringTableOffset = num * 0x100;
+
+  /* Get Language id */
+  LoadString(Globals.hInstance, IDS_LANGUAGE_ID, lang, sizeof(lang));
+  Globals.lpszLanguage = lang;
+  printf(" Globals.lpszLanguage: %s\n", Globals.lpszLanguage);
+
+  /* Set frame caption */
+  LoadString(Globals.hInstance, IDS_CLOCK, caption, sizeof(caption));
+  SetWindowText(Globals.hMainWnd, caption);
+
+  /* Change Resource names */
+  lstrcpyn(STRING_MENU_Xx    + sizeof(STRING_MENU_Xx)    - 3, lang, 3);
+
+  /* Create menu */
+  hMainMenu = LoadMenu(Globals.hInstance, STRING_MENU_Xx);
+    Globals.hPropertiesMenu     = GetSubMenu(hMainMenu, 0);
+    Globals.hLanguageMenu 	= GetSubMenu(hMainMenu, 1);
+    Globals.hInfoMenu     	= GetSubMenu(hMainMenu, 2);
+
+  /* Remove dummy item */
+  RemoveMenu(Globals.hLanguageMenu, 0, MF_BYPOSITION);
+  /* Add language items */
+  for (i = 0; i <= MAX_LANGUAGE_NUMBER; i++)
+    if (LANGUAGE_LoadStringOtherLanguage(i, IDS_LANGUAGE_MENU_ITEM, item, sizeof(item)))
+      AppendMenu(Globals.hLanguageMenu, MF_STRING | MF_BYCOMMAND,
+		 CL_FIRST_LANGUAGE + i, item);
+
+  SetMenu(Globals.hMainWnd, hMainMenu);
+
+  /* Destroy old menu */
+  if (Globals.hMainMenu) DestroyMenu(Globals.hMainMenu);
+  Globals.hMainMenu = hMainMenu;
+
+#ifdef WINELIB
+  /* Update system menus */
+  for (i = 0; Languages[i].name && lstrcmp(lang, Languages[i].name);) i++;
+  if (Languages[i].name) Options.language = i;
+
+#endif
+
+/* Specific for clock */
+if(Globals.bAnalog == TRUE) {
+	CheckMenuItem(Globals.hPropertiesMenu, CL_ANALOG, \
+                       MF_BYCOMMAND | MF_CHECKED);
+        CheckMenuItem(Globals.hPropertiesMenu, CL_DIGITAL, \
+                       MF_BYCOMMAND | MF_UNCHECKED);
+}
+else {
+	CheckMenuItem(Globals.hPropertiesMenu, CL_ANALOG, \
+                       MF_BYCOMMAND | MF_UNCHECKED);
+        CheckMenuItem(Globals.hPropertiesMenu, CL_DIGITAL, \
+                       MF_BYCOMMAND | MF_CHECKED);
+}
+	CheckMenuItem(Globals.hPropertiesMenu, CL_WITHOUT_TITLE, MF_BYCOMMAND | \
+	                     (Globals.bWithoutTitle ? MF_CHECKED : MF_UNCHECKED));
+	CheckMenuItem(Globals.hPropertiesMenu, CL_ON_TOP, MF_BYCOMMAND | \
+	                     (Globals.bAlwaysOnTop ? MF_CHECKED : MF_UNCHECKED));
+	CheckMenuItem(Globals.hPropertiesMenu, CL_SECONDS, MF_BYCOMMAND | \
+	                     (Globals.bSeconds ? MF_CHECKED : MF_UNCHECKED));
+	CheckMenuItem(Globals.hPropertiesMenu, CL_DATE, MF_BYCOMMAND | \
+	                     (Globals.bDate ? MF_CHECKED : MF_UNCHECKED));
+}
+
+VOID LANGUAGE_DefaultLanguageHandle(WPARAM wParam)
+{
+  if ((wParam >=CL_FIRST_LANGUAGE) && (wParam<=CL_LAST_LANGUAGE))
+          LANGUAGE_SelectLanguageByNumber(wParam - CL_FIRST_LANGUAGE);
+     else printf("Unimplemented menu command %i\n", wParam);
+}
+
+VOID LANGUAGE_InitLanguage(VOID)
+{
+  #ifdef WINELIB
+   Globals.lpszLanguage = Languages[Options.language].name;
+  #else
+  CHAR buffer[MAX_PATHNAME_LEN], *p;
+
+    PROFILE_GetWineIniString("programs", "language", "language", 
+                             buffer, sizeof(buffer));
+  Globals.lpszLanguage = p = LocalLock(LocalAlloc(LMEM_FIXED, lstrlen(buffer)));
+  hmemcpy(p, buffer, 1 + lstrlen(buffer));
+  #endif
+}
+
+/* Local Variables:    */
+/* c-file-style: "GNU" */
+/* End:                */
diff --git a/programs/clock/language.h b/programs/clock/language.h
new file mode 100644
index 0000000..70a7452
--- /dev/null
+++ b/programs/clock/language.h
@@ -0,0 +1,15 @@
+/*
+ * Clock
+ *
+ * Copyright 1998 Marcel Baur <mbaur@g26.ethz.ch>
+ * Copyright 1998 Karl Backström <karl_b@geocities.com>
+ */
+
+VOID LANGUAGE_SelectLanguageByNumber(UINT num);
+VOID LANGUAGE_SelectLanguageByName(LPCSTR lang);
+VOID LANGUAGE_DefaultLanguageHandle(WPARAM wParam);
+VOID LANGUAGE_InitLanguage(VOID);
+
+/* Local Variables:    */
+/* c-file-style: "GNU" */
+/* End:                */
diff --git a/programs/clock/license.c b/programs/clock/license.c
new file mode 100644
index 0000000..095da57
--- /dev/null
+++ b/programs/clock/license.c
@@ -0,0 +1,52 @@
+/*
+ * Clock (license.c)
+ *
+ * Copyright 1998 by Marcel Baur <mbaur@g26.ethz.ch>
+ * Adapted from Program Manager (Original by Ulrich Schmied)
+ */
+
+#include "windows.h"
+#include "license.h"
+
+static LICENSE* SelectLanguage(LPCSTR Language)
+{
+/*
+  if (!lstrcmp(Language, "Ca")) return(&WineLicense_Ca);
+  if (!lstrcmp(Language, "Cz")) return(&WineLicense_Cz);
+  if (!lstrcmp(Language, "Da")) return(&WineLicense_Da);
+  if (!lstrcmp(Language, "De")) return(&WineLicense_De);
+  if (!lstrcmp(Language, "En")) return(&WineLicense_En);
+  if (!lstrcmp(Language, "Eo")) return(&WineLicense_Eo);
+  if (!lstrcmp(Language, "Es")) return(&WineLicense_Es);
+  if (!lstrcmp(Language, "Fi")) return(&WineLicense_Fi);
+  if (!lstrcmp(Language, "Fr")) return(&WineLicense_Fr);
+  if (!lstrcmp(Language, "Hu")) return(&WineLicense_Hu);
+  if (!lstrcmp(Language, "It")) return(&WineLicense_It);
+  if (!lstrcmp(Langauge, "Ko")) return(&WineLicense_Ko);
+  if (!lstrcmp(Language, "No")) return(&WineLicense_No);
+  if (!lstrcmp(Language, "Pl")) return(&WineLicense_Pl);
+  if (!lstrcmp(Language, "Po")) return(&WineLicense_Po);
+  if (!lstrcmp(Language, "Sw")) return(&WineLicense_Sw); 
+  if (!lstrcmp(Language, "Va")) return(&WineLicense_Va);
+*/
+  return(&WineLicense_En);
+}
+
+
+VOID WineLicense(HWND Wnd, LPCSTR Language)
+{
+  LICENSE *License = SelectLanguage(Language);
+
+  MessageBox(Wnd, License->License, License->LicenseCaption,
+             MB_ICONINFORMATION | MB_OK);
+}
+
+
+VOID WineWarranty(HWND Wnd, LPCSTR Language)
+{
+  LICENSE *License = SelectLanguage(Language);
+
+  MessageBox(Wnd, License->Warranty, License->WarrantyCaption,
+             MB_ICONEXCLAMATION | MB_OK);
+}
+
diff --git a/programs/clock/license.h b/programs/clock/license.h
new file mode 100644
index 0000000..de1d403
--- /dev/null
+++ b/programs/clock/license.h
@@ -0,0 +1,48 @@
+/*
+ * Clock (license.h)
+ *
+ * Copyright 1998 by Marcel Baur <mbaur@g26.ethz.ch>
+ * Adapted from Program Manager (Original by Ulrich Schmied)
+ */
+
+
+/* function prototypes */
+ 
+VOID WineLicense(HWND hWnd, LPCSTR lpszLanguage);
+VOID WineWarranty(HWND hWnd, LPCSTR language);
+
+
+/* typedefs */
+
+typedef struct
+{
+  LPCSTR License, LicenseCaption;
+  LPCSTR Warranty, WarrantyCaption;
+} LICENSE;
+
+
+/* external references */
+
+/* 
+extern LICENSE WineLicense_Ca;
+extern LICENSE WineLicense_Cz;
+extern LICENSE WineLicense_Da;
+extern LICENSE WineLicense_De;
+*/
+
+extern LICENSE WineLicense_En;
+
+/*
+extern LICENSE WineLicense_Eo;
+extern LICENSE WineLicense_Es;
+extern LICENSE WineLicense_Fi;
+extern LICENSE WineLicense_Fr;
+extern LICENSE WineLicense_Hu;
+extern LICENSE WineLicense_It;
+extern LICENSE WineLicense_Ko;
+extern LICENSE WineLicense_No;
+extern LICENSE WineLicense_Pl;
+extern LICENSE WineLicense_Po;
+extern LICENSE WineLicense_Sw;
+extern LICENSE WineLicense_Va;
+*/
diff --git a/programs/clock/main.c b/programs/clock/main.c
new file mode 100644
index 0000000..33ba643
--- /dev/null
+++ b/programs/clock/main.c
@@ -0,0 +1,265 @@
+/*
+ * Clock
+ *
+ * Copyright 1998 Marcel Baur <mbaur@g26.ethz.ch>
+ *
+ * Clock is partially based on
+ * - Program Manager by Ulrich Schmied
+ * - rolex.c by Jim Peterson
+ *
+ */
+
+#include <stdio.h>
+#include "windows.h"
+#include "main.h"
+#include "license.h"
+#include "version.h"
+#include "language.h"
+#include "winclock.h"
+// #include "commdlg.h"
+
+#ifdef WINELIB
+   #include "options.h"
+   #include "resource.h"
+   #include "shell.h"
+   void LIBWINE_Register_De();
+   void LIBWINE_Register_En();
+   void LIBWINE_Register_Sw();
+#endif
+
+CLOCK_GLOBALS Globals;
+
+/***********************************************************************
+ *
+ *           CLOCK_MenuCommand
+ *
+ *  All handling of main menu events
+ */
+
+int CLOCK_MenuCommand (WPARAM wParam)
+{  
+   switch (wParam) {
+     case CL_ANALOG: {
+         Globals.bAnalog = TRUE;
+	 CheckMenuItem(Globals.hPropertiesMenu, CL_ANALOG, \
+	               MF_BYCOMMAND | MF_CHECKED);
+	 CheckMenuItem(Globals.hPropertiesMenu, CL_DIGITAL, \
+	               MF_BYCOMMAND | MF_UNCHECKED);
+	 break;	     
+       } 
+     case CL_DIGITAL: {
+         Globals.bAnalog = FALSE;
+	 CheckMenuItem(Globals.hPropertiesMenu, CL_ANALOG, \
+	               MF_BYCOMMAND | MF_UNCHECKED);
+	 CheckMenuItem(Globals.hPropertiesMenu, CL_DIGITAL, \
+	               MF_BYCOMMAND | MF_CHECKED);
+	 break;	       
+       }
+     case CL_FONT:
+       printf("FONT:");
+/*	CHOOSEFONT fontl;
+	fontl.lStructSize	= 0;
+        fontl.hwndOwner		= Globals.hMainWnd;
+        fontl.hDC		= NULL;
+        fontl.lpLogFont  	= 0;
+        fontl.iPointSize	   	= 0;
+        fontl.Flags		= 0;
+        fontl.rgbColors		= 0;
+        fontl.lCustData		= 0;
+        fontl.lpfnHook		= 0;
+        fontl.lpTemplateName	= 0;
+        fontl.hInstance		= Globals.hInstance;
+        fontl.lpszStyle		= 0;
+        fontl.nFontType		= 0;
+        fontl.nSizeMin		= 0;
+        fontl.nSizeMax		= 100;
+
+	if (ChooseFont(&font)); 
+*/
+       break;
+     case CL_WITHOUT_TITLE:
+       Globals.bWithoutTitle = !Globals.bWithoutTitle;
+       CheckMenuItem(Globals.hPropertiesMenu, CL_WITHOUT_TITLE, MF_BYCOMMAND | \
+                     (Globals.bWithoutTitle ? MF_CHECKED : MF_UNCHECKED));
+       printf("NO TITLE:");
+       break;
+     case CL_ON_TOP:
+       Globals.bAlwaysOnTop = !Globals.bAlwaysOnTop;
+       CheckMenuItem(Globals.hPropertiesMenu, CL_ON_TOP, MF_BYCOMMAND | \
+                     (Globals.bAlwaysOnTop ? MF_CHECKED : MF_UNCHECKED));
+       break;
+     case CL_SECONDS:
+       Globals.bSeconds = !Globals.bSeconds;
+       CheckMenuItem(Globals.hPropertiesMenu, CL_SECONDS, MF_BYCOMMAND | \
+                     (Globals.bSeconds ? MF_CHECKED : MF_UNCHECKED));
+       break;
+     case CL_DATE:
+       Globals.bDate = !Globals.bDate;
+       CheckMenuItem(Globals.hPropertiesMenu, CL_DATE, MF_BYCOMMAND | \
+                     (Globals.bDate ? MF_CHECKED : MF_UNCHECKED));
+       break;
+     case CL_INFO_LICENSE:
+       WineLicense(Globals.hMainWnd, Globals.lpszLanguage);
+       break;
+     case CL_INFO_NO_WARRANTY:
+       WineWarranty(Globals.hMainWnd, Globals.lpszLanguage);
+       break;
+     case CL_INFO_ABOUT_WINE:
+       ShellAbout(Globals.hMainWnd, "Clock", "Clock\n" WINE_RELEASE_INFO, 0);
+     break;
+     // Handle languages
+     default:
+       LANGUAGE_DefaultLanguageHandle(wParam); 
+   }
+   return 0;
+}
+
+
+
+/***********************************************************************
+ *
+ *           CLOCK_WndProc
+ */
+
+LRESULT CLOCK_WndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+    PAINTSTRUCT ps;
+    HDC context;
+
+    switch (msg) {
+
+       case WM_CREATE:
+        printf("WM_CREATE\n");
+   	break;
+
+        case WM_RBUTTONUP:
+	  printf("WM_RBUTTONUP\n");
+	break;
+
+	case WM_PAINT:
+	  printf("WM_PAINT\n");
+	  context = BeginPaint(hWnd, &ps);
+	  if(Globals.bAnalog) {
+	    DrawFace(context);
+	    Idle(context);
+	  }
+	  else {
+
+	  }
+          EndPaint(hWnd, &ps);
+   	break;
+
+       case WM_SIZE:
+          printf("WM_SIZE\n");
+	  Globals.MaxX = LOWORD(lParam);
+	  Globals.MaxY = HIWORD(lParam);
+	  break;
+	  
+       case WM_COMMAND:
+          CLOCK_MenuCommand(wParam);
+          break;
+
+       case WM_DESTROY:
+          printf("WM_DESTROY\n");
+          PostQuitMessage (0);
+          break;
+
+       default:
+          return DefWindowProc (hWnd, msg, wParam, lParam);
+    }
+    return 0l;
+}
+
+
+
+/***********************************************************************
+ *
+ *           WinMain
+ */
+
+void DumpGlobals(void) {
+
+    printf("DumpGlobals()\n");
+    printf(" Globals.lpszIniFile: %s\n", Globals.lpszIniFile); 
+    printf(" Globals.lpszIcoFile: %s\n", Globals.lpszIcoFile);
+    printf("Globals.lpszLanguage: %s\n", Globals.lpszLanguage);
+    printf("   Globals.hInstance: %i\n", Globals.hInstance);
+    printf("   Globals.hMainMenu: %i\n", Globals.hMainMenu);
+    
+}
+ 
+int PASCAL WinMain (HANDLE hInstance, HANDLE prev, LPSTR cmdline, int show)
+{
+    MSG      msg;
+    WNDCLASS class;
+    char className[] = "CLClass";  /* To make sure className >= 0x10000 */
+    char winName[]   = "Clock";
+
+    #if defined(WINELIB) && !defined(HAVE_WINE_CONSTRUCTOR)
+      /* Register resources */
+      LIBWINE_Register_De();
+      LIBWINE_Register_En();
+      LIBWINE_Register_Sw();
+    #endif
+
+    printf("WinMain()\n");
+    
+    /* Setup Globals */
+
+    Globals.bAnalog	  = TRUE;
+    Globals.bSeconds      = TRUE;
+    Globals.lpszIniFile   = "clock.ini";
+    Globals.lpszIcoFile   = "clock.ico";
+
+  /* Select Language */
+    LANGUAGE_InitLanguage();
+
+    Globals.hInstance     = hInstance;
+    Globals.hMainIcon     = ExtractIcon(Globals.hInstance, 
+                                        Globals.lpszIcoFile, 0);
+    if (!Globals.hMainIcon) Globals.hMainIcon = 
+                                  LoadIcon(0, MAKEINTRESOURCE(DEFAULTICON));
+
+    DumpGlobals();				  
+				  
+    if (!prev){
+	class.style         = CS_HREDRAW | CS_VREDRAW;
+	class.lpfnWndProc   = CLOCK_WndProc;
+	class.cbClsExtra    = 0;
+	class.cbWndExtra    = 0;
+	class.hInstance     = Globals.hInstance;
+	class.hIcon         = LoadIcon (0, IDI_APPLICATION);
+	class.hCursor       = LoadCursor (0, IDC_ARROW);
+	class.hbrBackground = GetStockObject (GRAY_BRUSH);
+	class.lpszMenuName  = "\0";
+	class.lpszClassName = (SEGPTR)className;
+    }
+    if (!RegisterClass (&class))
+	return FALSE;
+
+    Globals.hMainWnd = CreateWindow (className, winName, WS_OVERLAPPEDWINDOW,
+			CW_USEDEFAULT, 0, CW_USEDEFAULT, Globals.MaxX, Globals.MaxY, 
+			LoadMenu(Globals.hInstance, STRING_MENU_Xx),
+			Globals.hInstance, 0);
+			
+    LANGUAGE_SelectLanguageByName(Globals.lpszLanguage);
+    SetMenu(Globals.hMainWnd, Globals.hMainMenu);
+    ShowWindow (Globals.hMainWnd, show);
+    UpdateWindow (Globals.hMainWnd);
+
+    while (TRUE) {
+      Sleep(1);
+      if (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) {
+        if (msg.message == WM_QUIT) return msg.wParam;
+	TranslateMessage(&msg);
+	DispatchMessage(&msg);
+	Idle(NULL);
+      }
+      else Idle(NULL);
+    }
+
+    // We will never reach the following statement !  
+    return 0;    
+}
+
+
diff --git a/programs/clock/main.h b/programs/clock/main.h
new file mode 100644
index 0000000..63741c9
--- /dev/null
+++ b/programs/clock/main.h
@@ -0,0 +1,84 @@
+/*
+ * Clock (main.h)
+ *
+ * Copyright 1998 Marcel Baur <mbaur@g26.ethz.ch>
+ */
+
+#define MAX_STRING_LEN      255
+#define MAX_PATHNAME_LEN    1024
+#define MAX_LANGUAGE_NUMBER (CL_LAST_LANGUAGE - CL_FIRST_LANGUAGE)
+
+#define HELPFILE    "clock.hlp"
+#define DEFAULTICON OIC_WINEICON
+
+/* hide the following from winerc */
+#ifndef RC_INVOKED
+
+typedef struct
+{
+  HANDLE  hInstance;
+  HWND    hMainWnd;
+  HICON   hMainIcon;
+  HICON   hDefaultIcon;
+  HMENU   hMainMenu;
+  HMENU   hPropertiesMenu;
+  HMENU   hLanguageMenu;
+  HMENU   hInfoMenu;
+  LPCSTR  lpszIniFile;
+  LPCSTR  lpszIcoFile;
+  LPCSTR  lpszLanguage;
+  UINT    wStringTableOffset;
+
+  BOOL    bAnalog;
+  BOOL    bAlwaysOnTop;
+  BOOL    bWithoutTitle;
+  BOOL    bSeconds;
+  BOOL    bDate;  
+
+  int     MaxX;
+  int     MaxY;
+} CLOCK_GLOBALS;
+
+extern CLOCK_GLOBALS Globals;
+
+/* function prototypes */
+VOID MAIN_SelectLanguageByName(LPCSTR);
+VOID MAIN_SelectLanguageByNumber(UINT);
+
+/* class names */
+
+/* Resource names */
+extern CHAR STRING_MENU_Xx[];
+
+   #define STRINGID(id) (0x##id + Globals.wStringTableOffset)
+   
+#else  /* RC_INVOKED */
+
+   #define STRINGID(id) id
+   
+#endif
+
+/* string table index */
+#define IDS_LANGUAGE_ID                STRINGID(00)
+#define IDS_LANGUAGE_MENU_ITEM         STRINGID(01)
+#define IDS_CLOCK                      STRINGID(02)
+
+/* main menu */
+
+#define CL_ANALOG                100
+#define CL_DIGITAL               101
+#define CL_FONT                  102
+#define CL_WITHOUT_TITLE         103
+#define CL_ON_TOP                104
+#define CL_SECONDS               105
+#define CL_DATE                  106
+
+#define CL_LANGUAGE              108
+
+#define CL_INFO                  186
+#define CL_INFO_LICENSE          187
+#define CL_INFO_NO_WARRANTY      188
+#define CL_INFO_ABOUT_WINE       189
+
+#define CL_FIRST_LANGUAGE        109
+#define CL_LAST_LANGUAGE         185
diff --git a/programs/clock/winclock.c b/programs/clock/winclock.c
new file mode 100644
index 0000000..4e7af5f
--- /dev/null
+++ b/programs/clock/winclock.c
@@ -0,0 +1,206 @@
+/* 
+ *  Clock (winclock.c)
+ *
+ *  Copyright 1998 by Marcel Baur <mbaur@g26.ethz.ch>
+ *
+ *  This file is based on  rolex.c  by Jim Peterson.
+ *
+ *  I just managed to move the relevant parts into the Clock application
+ *  and made it look like the original Windows one. You can find the original
+ *  rolex.c in the wine /libtest directory.
+ *
+ *  Original file header:
+ *  >
+ *  > rolex.c: Windows clock application for WINE (by Jim Peterson)    
+ *  >                                                                 
+ *  > This is a translation of a Turbo Pascal OWL application I made   
+ *  > once, so it's a little flaky (tons of globals, functions that    
+ *  > could have been in-lined, etc.).  The source code should easily  
+ *  > compile with a standard Win32 C compiler.                        
+ *  >                                                                 
+ *  > To try it out, type 'make rolex'.                               
+ *  >
+ *
+ */
+
+#include <math.h>
+#include <string.h>
+#include "winclock.h"
+#include "windows.h"
+#include "main.h"
+
+COLORREF FaceColor = RGB(192,192,192);
+COLORREF HandColor = RGB(0,0,0);
+COLORREF EtchColor = RGB(0,0,0);
+
+float Pi=3.1415926;
+
+HandData OldSecond,OldHour,OldMinute;
+
+int MiddleX(void) {
+  int X, diff;
+
+  X    = (Globals.MaxX/2);  
+  diff = (Globals.MaxX-Globals.MaxY);
+  if (diff>0) { X = (X-(diff/2)); }
+  return X;
+}
+
+int MiddleY(void) {
+  int Y, diff;
+  
+  Y    = (Globals.MaxY/2);
+  diff = (Globals.MaxX-Globals.MaxY);
+  if (diff<0) { Y = Y+(diff/2); }
+  return Y;
+}
+
+void DrawFace(HDC dc)
+{
+  int MidX, MidY, t, DiffX, DiffY;
+  
+  MidX = MiddleX();
+  MidY = MiddleY();
+  DiffX = (Globals.MaxX-MidX*2)/2;
+  DiffY = (Globals.MaxY-MidY*2)/2;
+
+  SelectObject(dc,CreateSolidBrush(FaceColor));
+  SelectObject(dc,CreatePen(PS_SOLID,1,EtchColor));
+  Ellipse(dc,DiffX,DiffY,2*MidX+DiffX,2*MidY+DiffY);
+
+  for(t=0; t<12; t++)
+  {
+    MoveToEx(dc,(MidX+DiffX)+sin(t*Pi/6)*0.9*MidX,(MidY+DiffY)-cos(t*Pi/6)*0.9*MidY,NULL);
+    LineTo(dc,(MidY+DiffX)+sin(t*Pi/6)*0.8*MidX,(MidY+DiffY)-cos(t*Pi/6)*0.8*MidY);
+  }
+  if(Globals.MaxX>64 && Globals.MaxY>64)
+    for(t=0; t<60; t++)
+      SetPixel(dc,(MidX+DiffX)+sin(t*Pi/30)*0.9*MidX,(MidY+DiffY)-cos(t*Pi/30)*0.9*MidY
+	       ,EtchColor);
+  DeleteObject(SelectObject(dc,GetStockObject(NULL_BRUSH)));
+  DeleteObject(SelectObject(dc,GetStockObject(NULL_PEN)));
+  memset(&OldSecond,0,sizeof(OldSecond));
+  memset(&OldMinute,0,sizeof(OldMinute));
+  memset(&OldHour,0,sizeof(OldHour));
+}
+
+void DrawHourHand(HDC dc)
+{
+  MoveToEx(dc, OldHour.StartX, OldHour.StartY, NULL);
+  LineTo(dc, OldHour.EndX, OldHour.EndY);
+}
+
+void DrawMinuteHand(HDC dc)
+{
+  MoveToEx(dc, OldMinute.StartX, OldMinute.StartY, NULL);
+  LineTo(dc, OldMinute.EndX, OldMinute.EndY);
+}
+
+void DrawSecondHand(HDC dc)
+{
+    MoveToEx(dc, OldSecond.StartX, OldSecond.StartY, NULL);
+    LineTo(dc, OldSecond.EndX, OldSecond.EndY);
+}
+
+BOOL UpdateHourHand(HDC dc,int MidX,int MidY,int XExt,int YExt,WORD Pos)
+{
+  int Sx, Sy, Ex, Ey;
+  BOOL rv;
+
+  rv = FALSE;
+  Sx = MidX; Sy = MidY;
+  Ex = MidX+sin(Pos*Pi/6000)*XExt;
+  Ey = MidY-cos(Pos*Pi/6000)*YExt;
+  rv = ( Sx!=OldHour.StartX || Ex!=OldHour.EndX || 
+	 Sy!=OldHour.StartY || Ey!=OldHour.EndY );
+  if (Globals.bAnalog && rv)DrawHourHand(dc);
+  OldHour.StartX = Sx; OldHour.EndX = Ex;
+  OldHour.StartY = Sy; OldHour.EndY = Ey;
+  return rv;
+}
+
+BOOL UpdateMinuteHand(HDC dc,int MidX,int MidY,int XExt,int YExt,WORD Pos)
+{
+  int Sx, Sy, Ex, Ey;
+  BOOL rv;
+
+  rv = FALSE;
+  Sx = MidX; Sy = MidY;
+  Ex = MidX+sin(Pos*Pi/30000)*XExt;
+  Ey = MidY-cos(Pos*Pi/30000)*YExt;
+  rv = ( Sx!=OldMinute.StartX || Ex!=OldMinute.EndX ||
+	 Sy!=OldMinute.StartY || Ey!=OldMinute.EndY );
+  if (Globals.bAnalog && rv)DrawMinuteHand(dc);
+  OldMinute.StartX = Sx; OldMinute.EndX = Ex;
+  OldMinute.StartY = Sy; OldMinute.EndY = Ey;
+  return rv;
+}
+
+BOOL UpdateSecondHand(HDC dc,int MidX,int MidY,int XExt,int YExt,WORD Pos)
+{
+  int Sx, Sy, Ex, Ey;
+  BOOL rv;
+
+  rv = FALSE;
+  
+  if (Globals.bSeconds) {
+    Sx = MidX; Sy = MidY;
+    Ex = MidX+sin(Pos*Pi/3000)*XExt;
+    Ey = MidY-cos(Pos*Pi/3000)*YExt;
+    rv = ( Sx!=OldSecond.StartX || Ex!=OldSecond.EndX ||
+  	 Sy!=OldSecond.StartY || Ey!=OldSecond.EndY );
+    if (Globals.bAnalog && rv)DrawSecondHand(dc);
+    OldSecond.StartX = Sx; OldSecond.EndX = Ex;
+    OldSecond.StartY = Sy; OldSecond.EndY = Ey;
+  }
+  
+  return rv;
+}
+
+void Idle(HDC idc)
+{
+  SYSTEMTIME st;
+  WORD H, M, S, F;
+  int MidX, MidY, DiffX, DiffY;
+  HDC dc;
+  BOOL Redraw;
+
+  if(idc)
+    dc=idc;
+  else
+    dc=GetDC(Globals.hMainWnd);
+  if(!dc)return;
+
+  GetLocalTime(&st);
+  H = st.wHour;
+  M = st.wMinute;
+  S = st.wSecond;
+  F = st.wMilliseconds / 10;
+  F = F + S*100;
+  M = M*1000+F/6;
+  H = H*1000+M/60;
+  MidX = MiddleX();
+  MidY = MiddleY();
+  DiffX = (Globals.MaxX-MidX*2)/2;
+  DiffY = (Globals.MaxY-MidY*2)/2;
+
+  SelectObject(dc,CreatePen(PS_SOLID,1,FaceColor));
+  Redraw = FALSE;
+  if(UpdateHourHand(dc,MidX+DiffX,MidY+DiffY,MidX*0.5,MidY*0.5,H)) Redraw = TRUE;
+  if(UpdateMinuteHand(dc,MidX+DiffX,MidY+DiffY,MidX*0.65,MidY*0.65,M)) Redraw = TRUE;
+  if(UpdateSecondHand(dc,MidX+DiffX,MidY+DiffY,MidX*0.79,MidY*0.79,F)) Redraw = TRUE;
+  if (Globals.bAnalog)
+  {
+  DeleteObject(SelectObject(dc,CreatePen(PS_SOLID,1,HandColor)));
+    if(Redraw)
+    {
+      DrawSecondHand(dc);
+      DrawMinuteHand(dc);
+      DrawHourHand(dc);
+    }
+  DeleteObject(SelectObject(dc,GetStockObject(NULL_PEN))); 
+  }
+  if(!idc) ReleaseDC(Globals.hMainWnd,dc);
+}
+
+//    class.hbrBackground = (HBRUSH)(COLOR_BACKGROUND + 1);
diff --git a/programs/clock/winclock.h b/programs/clock/winclock.h
new file mode 100644
index 0000000..bbeb73d
--- /dev/null
+++ b/programs/clock/winclock.h
@@ -0,0 +1,30 @@
+/* 
+ *  Clock (winclock.h)
+ *
+ *  Copyright 1998 by Marcel Baur <mbaur@g26.ethz.ch>
+ *  This file is essentially rolex.c by Jim Peterson.
+ *  Please see my winclock.c and/or his rolex.c for references.
+ *
+ */
+
+ #include <windows.h>
+ 
+typedef struct
+{
+  int StartX,StartY,EndX,EndY;
+} HandData;
+
+/* function prototypes */
+
+
+void DrawFace(HDC dc);
+
+
+void DrawHourHand(HDC dc);
+void DrawMinuteHand(HDC dc);
+void DrawSecondHand(HDC dc);
+BOOL UpdateHourHand(HDC dc,int MidX,int MidY,int XExt,int YExt,WORD Pos);
+BOOL UpdateMinuteHand(HDC dc,int MidX,int MidY,int XExt,int YExt,WORD Pos);
+BOOL UpdateSecondHand(HDC dc,int MidX,int MidY,int XExt,int YExt,WORD Pos);
+void Idle(HDC idc);
+
diff --git a/programs/view/Makefile.in b/programs/view/Makefile.in
new file mode 100644
index 0000000..5efd9f9
--- /dev/null
+++ b/programs/view/Makefile.in
@@ -0,0 +1,32 @@
+DEFS      = -DWINELIB
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../..
+SRCDIR    = @srcdir@
+VPATH     = @srcdir@
+MODULE    = none
+PROGRAMS  = view
+ALL_LIBS  = $(WINELIB) $(X_LIBS) $(XPM_LIB) $(XLIB) $(LIBS)
+RCFLAGS   = -w32 -h
+
+C_SRCS = \
+	init.c \
+	view.c \
+	winmain.c
+
+all: check_winerc $(PROGRAMS)
+
+depend:: $(RC_SRCS:.rc=.h)
+
+@MAKE_RULES@
+
+view: $(OBJS)
+	$(CC) -o view $(OBJS) $(LDOPTIONS) $(ALL_LIBS)
+
+install: dummy
+	$(INSTALL_PROGRAM) view $(bindir)/view
+
+$(RC_SRCS:.rc=.c) $(RC_SRCS:.rc=.h): $(WINERC)
+
+dummy:
+
+### Dependencies:
diff --git a/programs/view/globals.h b/programs/view/globals.h
new file mode 100644
index 0000000..40a27c1
--- /dev/null
+++ b/programs/view/globals.h
@@ -0,0 +1,29 @@
+/*  Add global function prototypes here */
+
+BOOL InitApplication(HINSTANCE);
+BOOL InitInstance(HINSTANCE, int);
+BOOL CenterWindow(HWND, HWND);
+
+/* Add new callback function prototypes here  */
+
+LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
+
+/* Global variable declarations */
+
+extern HINSTANCE hInst;          /* The current instance handle */
+extern char      szAppName[];    /* The name of this application */
+extern char      szTitle[];      /* The title bar text */
+
+typedef struct
+{
+	DWORD	key;
+	HANDLE	hmf;
+	RECT	bbox;
+	WORD	inch;
+	DWORD	reserved;
+	WORD	checksum;
+} APMFILEHEADER;
+
+#define APMHEADER_KEY	0x9AC6CDD7l
+
+
diff --git a/programs/view/init.c b/programs/view/init.c
new file mode 100644
index 0000000..eeaa149
--- /dev/null
+++ b/programs/view/init.c
@@ -0,0 +1,84 @@
+#include <windows.h>
+#include "globals.h"
+#include "resource.h"
+
+/* global variables */
+
+HINSTANCE hInst;
+char szAppName[9];
+char szTitle[40];
+
+BOOL InitApplication(HINSTANCE hInstance)
+{
+  WNDCLASSEX wc;
+
+  /* Load the application name and description strings */
+  
+  LoadString(hInstance, IDS_APPNAME, szAppName, sizeof(szAppName));
+  LoadString(hInstance, IDS_DESCRIPTION, szTitle, sizeof(szTitle));
+
+  /* Fill in window class structure with parameters that describe the
+     main window */
+
+  wc.cbSize = sizeof(WNDCLASSEX);
+
+  /* Load small icon image */
+  wc.hIconSm = LoadImage(hInstance,		
+			 MAKEINTRESOURCE(IDI_APPICON),
+			 IMAGE_ICON,
+			 16, 16,
+			 0);
+
+  wc.style         = CS_HREDRAW | CS_VREDRAW;             /* Class style(s) */
+  wc.lpfnWndProc   = (WNDPROC)WndProc;                  /* Window Procedure */
+  wc.cbClsExtra    = 0;                          /* No per-class extra data */
+  wc.cbWndExtra    = 0;                         /* No per-window extra data */
+  wc.hInstance     = hInstance;                      /* Owner of this class */
+  wc.hIcon         = LoadIcon(hInstance, szAppName);  /* Icon name from .rc */
+  wc.hCursor       = LoadCursor(NULL, IDC_ARROW);                 /* Cursor */
+  wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);           /* Default color */
+  wc.lpszMenuName  = szAppName;                       /* Menu name from .rc */
+  wc.lpszClassName = szAppName;                      /* Name to register as */
+
+  /* Register the window class and return FALSE if unsuccesful */
+
+  if (!RegisterClassEx(&wc))
+    {
+      if (!RegisterClass((LPWNDCLASS)&wc.style))
+	return FALSE;
+    }
+
+  /* Call module specific initialization functions here */
+
+  return TRUE;
+}
+
+BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
+{
+    HWND hwnd; 
+
+    /* Save the instance handle in a global variable for later use */
+    hInst = hInstance;
+
+    /* Create main window */
+    hwnd = CreateWindow(szAppName,           /* See RegisterClass() call */
+                        szTitle,             /* window title */
+                        WS_OVERLAPPEDWINDOW, /* Window style */
+                        CW_USEDEFAULT, 0,    /* positioning */
+                        CW_USEDEFAULT, 0,    /* size */
+                        NULL,                /* Overlapped has no parent */
+                        NULL,                /* Use the window class menu */
+                        hInstance,           
+                        NULL);               
+    
+    if (!hwnd)
+        return FALSE;
+
+    /* Call module specific instance initialization functions here */
+
+    /* show the window, and paint it for the first time */
+    ShowWindow(hwnd, nCmdShow);
+    UpdateWindow(hwnd);
+
+    return TRUE;
+}
diff --git a/programs/view/lccmakefile b/programs/view/lccmakefile
new file mode 100644
index 0000000..dbd19ae
--- /dev/null
+++ b/programs/view/lccmakefile
@@ -0,0 +1,19 @@
+
+WINE = ../../wine
+LCCINC = c:\\lcc\\include
+OBJS = view.obj init.obj winmain.obj 
+RES = viewrc.res
+
+.SUFFIXES: .rc .obj .res
+
+.c.obj:
+	$(WINE) "lcc -I$(LCCINC) $<"
+
+.rc.res:
+	$(WINE) "lrc $<"
+
+view.exe: $(OBJS) $(RES)
+	$(WINE) "lcclnk $(OBJS) $(RES)"
+
+clean:
+	rm *.exe *.obj *.res
diff --git a/programs/view/resource.h b/programs/view/resource.h
new file mode 100644
index 0000000..0ff2b5c
--- /dev/null
+++ b/programs/view/resource.h
@@ -0,0 +1,10 @@
+#define IDS_APPNAME                     1
+#define IDS_DESCRIPTION                 2
+#define IDI_APPICON                     101
+#define IDM_EXIT                        1000
+#define IDM_HELLO                       501
+#define IDM_OPEN                        502
+#define IDM_LEFT                        601
+#define IDM_RIGHT                       602
+#define IDM_UP                          603
+#define IDM_DOWN                        604
diff --git a/programs/view/view.c b/programs/view/view.c
new file mode 100644
index 0000000..52fb99a
--- /dev/null
+++ b/programs/view/view.c
@@ -0,0 +1,193 @@
+#include <windows.h>
+
+/* 
+#include <windowsx.h>
+   Wine doesn't have windowsx.h, so we use this
+*/
+#define       GET_WM_COMMAND_ID(wp,lp)        LOWORD(wp)
+
+/* Wine seems to need this */
+#include <commdlg.h>
+
+#include "globals.h"        
+#include "resource.h"
+
+BOOL FileIsPlaceable( LPCSTR szFileName );
+HMETAFILE GetPlaceableMetaFile( LPCSTR szFileName );
+
+#define FN_LENGTH 80
+
+HMETAFILE hmf;
+int deltax = 0, deltay = 0;
+int width = 0, height = 0;
+BOOL isAldus;
+
+BOOL FileOpen(HWND hWnd, char *fn)
+{
+  OPENFILENAME ofn = { sizeof(OPENFILENAME),
+		       0, NULL, "Metafiles\0*.wmf\0", NULL, 0, 0, NULL, 
+		       FN_LENGTH, NULL, 0, NULL, NULL, OFN_CREATEPROMPT |
+		       OFN_SHOWHELP, 0, 0, NULL, 0, NULL };
+  ofn.hwndOwner = hWnd;
+  ofn.lpstrFile = fn;
+  return GetOpenFileName(&ofn);
+}
+
+
+LRESULT CALLBACK WndProc(HWND hwnd,
+                         UINT uMessage,
+                         WPARAM wparam,
+                         LPARAM lparam)
+{
+  switch (uMessage)
+    {
+    case WM_PAINT: 
+      {
+	PAINTSTRUCT ps; 
+	BeginPaint(hwnd, &ps);
+	SetMapMode(ps.hdc, MM_ANISOTROPIC);
+	SetViewportExt(ps.hdc, width, height);
+	SetViewportOrgEx(ps.hdc, deltax, deltay, NULL);
+	if(hmf) PlayMetaFile(ps.hdc, hmf);
+	EndPaint(hwnd, &ps);
+
+      }
+      break;
+
+    case WM_COMMAND: /* message: command from application menu */
+      switch (GET_WM_COMMAND_ID(wparam,lparam))
+	{
+	case IDM_HELLO:
+	  MessageBox( hwnd , "Hello there world!", "Hello", MB_OK);
+	  break;
+
+	case IDM_OPEN:
+	  {
+	    char filename[FN_LENGTH];
+	    if (FileOpen(hwnd, filename)) {
+	      isAldus = FileIsPlaceable(filename);
+	      if (isAldus) {
+#if 0
+		hmf = GetPlaceableMetaFile(filename);
+#else
+		MessageBox(hwnd, "This is an Aldus placeable metafile: I can't deal with those!",
+			   "Aldus", MB_OK);
+#endif
+	      } else {
+		RECT r;
+		hmf = GetMetaFile(filename);
+		GetClientRect(hwnd, &r);
+		width = r.right - r.left;
+		height = r.bottom - r.top;
+	      }
+	      InvalidateRect( hwnd, NULL, TRUE );
+	    }
+	  }
+	  break;
+	  
+	case IDM_LEFT:
+	  deltax += 100;
+	  InvalidateRect( hwnd, NULL, TRUE );
+	  break;
+	case IDM_RIGHT:
+	  deltax -= 100;
+	  InvalidateRect( hwnd, NULL, TRUE );
+	  break;
+	case IDM_UP:
+	  deltay += 100;
+	  InvalidateRect( hwnd, NULL, TRUE );
+	  break;
+	case IDM_DOWN:
+	  deltay -= 100;
+	  InvalidateRect( hwnd, NULL, TRUE );
+	  break;
+
+	case IDM_EXIT:
+	  DestroyWindow(hwnd);
+	  break;
+
+	default:
+	  return DefWindowProc(hwnd, uMessage, wparam, lparam);
+	}
+      break;
+
+    case WM_DESTROY:  /* message: window being destroyed */
+      PostQuitMessage(0);
+      break;
+
+    default:          /* Passes it on if unproccessed */
+      return DefWindowProc(hwnd, uMessage, wparam, lparam);
+    }
+    return 0;
+}
+
+BOOL FileIsPlaceable( LPCSTR szFileName )
+{
+  HFILE		hInFile;
+  OFSTRUCT		inof;
+  APMFILEHEADER	apmh;
+
+  if( (hInFile = OpenFile( szFileName, &inof, OF_READ ) ) == HFILE_ERROR )
+    return FALSE;
+
+  if( _lread( hInFile, &apmh, sizeof(APMFILEHEADER) ) 
+      != sizeof(APMFILEHEADER) )
+    {
+      _lclose( hInFile );
+      return FALSE;
+    }
+  _lclose( hInFile );
+
+  /* Is it placeable? */
+  return (apmh.key == APMHEADER_KEY);
+}
+
+/* this code doesn't work */
+HMETAFILE GetPlaceableMetaFile( LPCSTR szFileName )
+{
+  HANDLE hData;
+  LPSTR	lpData;
+  METAHEADER mfHeader;
+  APMFILEHEADER	APMHeader;
+  HMETAFILE hmf = NULL;
+  HFILE	fh;
+  OFSTRUCT inof;
+
+  if( (fh = OpenFile( szFileName, &inof, OF_READ ) ) == HFILE_ERROR ) return NULL;
+  _llseek(fh, 0, 0);
+  if (!_lread(fh, (LPSTR)&APMHeader, sizeof(APMFILEHEADER))) return NULL;
+  _llseek(fh, sizeof(APMFILEHEADER), 0);
+  if (!_lread(fh, (LPSTR)&mfHeader, sizeof(METAHEADER))) return NULL;
+
+  /* somehow mtSize is being swapped */
+
+  if (!(hData = GlobalAlloc(GHND, (mfHeader.mtSize * 2L)))) return NULL;
+
+  if (!(lpData = GlobalLock(hData)))
+  {
+    GlobalFree(hData);
+    return NULL;
+  }
+
+  _llseek(fh, sizeof(APMFILEHEADER), 0);
+  if (!_lread(fh, lpData, (UINT)(mfHeader.mtSize * 2L)))
+  {
+    GlobalUnlock(hData);
+    GlobalFree(hData);
+    return NULL;
+  }
+  _lclose(fh);
+  GlobalUnlock(hData);
+
+  if (!(hmf = (HMETAFILE) SetMetaFileBits(hData))) return NULL;
+
+  
+  width = APMHeader.bbox.right - APMHeader.bbox.left;
+  height = APMHeader.bbox.bottom - APMHeader.bbox.top;
+  deltax = 0;
+  deltay = 0 ;
+  return hmf;
+}
+
+
+
diff --git a/programs/view/viewrc.rc b/programs/view/viewrc.rc
new file mode 100644
index 0000000..c493950
--- /dev/null
+++ b/programs/view/viewrc.rc
@@ -0,0 +1,60 @@
+#include "resource.h"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+/*IDI_APPICON             ICON    DISCARDABLE     "view.ico"*/
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Menu
+//
+
+VIEW MENU
+BEGIN
+    POPUP "&File"
+    BEGIN
+	MENUITEM "&Open",			IDM_OPEN
+        MENUITEM "E&xit",                       IDM_EXIT
+    END
+    POPUP "&Pan"
+    BEGIN
+      MENUITEM "&Left",				IDM_LEFT
+      MENUITEM "&Right",			IDM_RIGHT
+      MENUITEM "&Up",				IDM_UP
+      MENUITEM "&Down",				IDM_DOWN
+    END
+    POPUP "&Info"
+    BEGIN
+	MENUITEM "&Hello",			IDM_HELLO
+    END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Accelerator
+//
+
+VIEW ACCELERATORS 
+BEGIN
+    "Q",            IDM_EXIT,                CONTROL
+END
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// String Table
+//
+
+STRINGTABLE DISCARDABLE
+BEGIN
+    IDS_APPNAME             "View"
+    IDS_DESCRIPTION         "Regular Metafile Viewer"
+END
+
+
+
diff --git a/programs/view/winmain.c b/programs/view/winmain.c
new file mode 100644
index 0000000..70e4b8c
--- /dev/null
+++ b/programs/view/winmain.c
@@ -0,0 +1,49 @@
+#include <windows.h>            /* required for all Windows applications */ 
+#include "globals.h"            /* prototypes specific to this application */
+
+
+int APIENTRY WinMain(HINSTANCE hInstance,
+                     HINSTANCE hPrevInstance, 
+                     LPSTR     lpCmdLine, 
+                     int       nCmdShow)
+{
+    MSG msg;
+    HANDLE hAccelTable;
+    
+    /* Other instances of app running? */
+    if (!hPrevInstance)
+    {
+      /* stuff to be done once */
+      if (!InitApplication(hInstance))
+      {
+	return FALSE;              /* exit */ 
+      }
+    }
+
+    /* stuff to be done every time */
+    if (!InitInstance(hInstance, nCmdShow))
+    {
+      return FALSE;
+    }
+
+    hAccelTable = LoadAccelerators(hInstance, szAppName);
+
+    /* Main loop */
+    /* Acquire and dispatch messages until a WM_QUIT message is received */
+    while (GetMessage(&msg, NULL, 0, 0))
+    {
+      /* Add other Translation functions (for modeless dialogs
+	 and/or MDI windows) here. */
+
+      if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
+        {
+            TranslateMessage(&msg);
+            DispatchMessage(&msg); 
+        }
+    }
+
+    /* Add module specific instance free/delete functions here */
+
+    /* Returns the value from PostQuitMessage */
+    return msg.wParam;
+}
diff --git a/programs/winhelp/macro.lex.l b/programs/winhelp/macro.lex.l
index f0d1498..0e6823d 100644
--- a/programs/winhelp/macro.lex.l
+++ b/programs/winhelp/macro.lex.l
@@ -21,98 +21,98 @@
 #define YY_NO_UNPUT
 %}
 %%
-About			yylval = MACRO_About;			return VOID_FUNCTION_VOID;
-AddAccelerator|AA	yylval = MACRO_AddAccelerator;		return VOID_FUNCTION_2UINT_STRING;
-ALink|AL		yylval = MACRO_ALink;			return VOID_FUNCTION_STRING_UINT_STRING;
-Annotate		yylval = MACRO_Annotate;		return VOID_FUNCTION_VOID;
-AppendItem		yylval = MACRO_AppendItem;		return VOID_FUNCTION_4STRING;
-Back			yylval = MACRO_Back;			return VOID_FUNCTION_VOID;
-BackFlush|BF		yylval = MACRO_BackFlush;		return VOID_FUNCTION_VOID;
-BookmarkDefine		yylval = MACRO_BookmarkDefine;		return VOID_FUNCTION_VOID;
-BookmarkMore		yylval = MACRO_BookmarkMore;		return VOID_FUNCTION_VOID;
-BrowseButtons		yylval = MACRO_BrowseButtons;		return VOID_FUNCTION_VOID;
-ChangeButtonBinding|CBB	yylval = MACRO_ChangeButtonBinding;	return VOID_FUNCTION_2STRING;
-ChangeEnable|CE		yylval = MACRO_ChangeEnable;		return VOID_FUNCTION_2STRING;
-ChangeItemBinding|CIB	yylval = MACRO_ChangeItemBinding;	return VOID_FUNCTION_2STRING;
-CheckItem|CI		yylval = MACRO_CheckItem;		return VOID_FUNCTION_STRING;
-CloseSecondarys|CS	yylval = MACRO_CloseSecondarys;		return VOID_FUNCTION_VOID;
-CloseWindow|CW		yylval = MACRO_CloseWindow;		return VOID_FUNCTION_STRING;
-Compare			yylval = MACRO_Compare;			return VOID_FUNCTION_STRING;
-Contents		yylval = MACRO_Contents;		return VOID_FUNCTION_VOID;
-ControlPanel		yylval = MACRO_ControlPanel;		return VOID_FUNCTION_2STRING_UINT;
-CopyDialog		yylval = MACRO_CopyDialog;		return VOID_FUNCTION_VOID;
-CopyTopic|CT		yylval = MACRO_CopyTopic;		return VOID_FUNCTION_VOID;
-CreateButton|CB		yylval = MACRO_CreateButton;		return VOID_FUNCTION_3STRING;
-DeleteItem		yylval = MACRO_DeleteItem;		return VOID_FUNCTION_STRING;
-DeleteMark		yylval = MACRO_DeleteMark;		return VOID_FUNCTION_STRING;
-DestroyButton		yylval = MACRO_DestroyButton;		return VOID_FUNCTION_STRING;
-DisableButton|DB	yylval = MACRO_DisableButton;		return VOID_FUNCTION_STRING;
-DisableItem|DI		yylval = MACRO_DisableItem;		return VOID_FUNCTION_STRING;
-EnableButton|EB		yylval = MACRO_EnableButton;		return VOID_FUNCTION_STRING;
-EnableItem|EI		yylval = MACRO_EnableItem;		return VOID_FUNCTION_STRING;
-EndMPrint		yylval = MACRO_EndMPrint;		return VOID_FUNCTION_VOID;
-ExecFile|EF		yylval = MACRO_ExecFile;		return VOID_FUNCTION_2STRING_UINT_STRING;
-ExecProgram|EP		yylval = MACRO_ExecProgram;		return VOID_FUNCTION_STRING_UINT;
-Exit			yylval = MACRO_Exit;			return VOID_FUNCTION_VOID;
-ExtAbleItem		yylval = MACRO_ExtAbleItem;		return VOID_FUNCTION_STRING_UINT;
-ExtInsertItem		yylval = MACRO_ExtInsertItem;		return VOID_FUNCTION_4STRING_2UINT;
-ExtInsertMenu		yylval = MACRO_ExtInsertMenu;		return VOID_FUNCTION_3STRING_2UINT;
-FileExist|FE		yylval = MACRO_FileExist;		return BOOL_FUNCTION_STRING;
-FileOpen|FO		yylval = MACRO_FileOpen;		return VOID_FUNCTION_VOID;
-Find			yylval = MACRO_Find;			return VOID_FUNCTION_VOID;
-Finder|FD		yylval = MACRO_Finder;			return VOID_FUNCTION_VOID;
-FloatingMenu		yylval = MACRO_FloatingMenu;		return VOID_FUNCTION_VOID;
-Flush|FH		yylval = MACRO_Flush;			return VOID_FUNCTION_VOID;
-FocusWindow		yylval = MACRO_FocusWindow;		return VOID_FUNCTION_STRING;
-Generate		yylval = MACRO_Generate;		return VOID_FUNCTION_STRING_WPARAM_LPARAM;
-GotoMark		yylval = MACRO_GotoMark;		return VOID_FUNCTION_STRING;
-HelpOn			yylval = MACRO_HelpOn;			return VOID_FUNCTION_VOID;
-HelpOnTop		yylval = MACRO_HelpOnTop;		return VOID_FUNCTION_VOID;
-History			yylval = MACRO_History;			return VOID_FUNCTION_VOID;
+About			yylval = (YYSTYPE)MACRO_About;			return VOID_FUNCTION_VOID;
+AddAccelerator|AA	yylval = (YYSTYPE)MACRO_AddAccelerator;		return VOID_FUNCTION_2UINT_STRING;
+ALink|AL		yylval = (YYSTYPE)MACRO_ALink;			return VOID_FUNCTION_STRING_UINT_STRING;
+Annotate		yylval = (YYSTYPE)MACRO_Annotate;		return VOID_FUNCTION_VOID;
+AppendItem		yylval = (YYSTYPE)MACRO_AppendItem;		return VOID_FUNCTION_4STRING;
+Back			yylval = (YYSTYPE)MACRO_Back;			return VOID_FUNCTION_VOID;
+BackFlush|BF		yylval = (YYSTYPE)MACRO_BackFlush;		return VOID_FUNCTION_VOID;
+BookmarkDefine		yylval = (YYSTYPE)MACRO_BookmarkDefine;		return VOID_FUNCTION_VOID;
+BookmarkMore		yylval = (YYSTYPE)MACRO_BookmarkMore;		return VOID_FUNCTION_VOID;
+BrowseButtons		yylval = (YYSTYPE)MACRO_BrowseButtons;		return VOID_FUNCTION_VOID;
+ChangeButtonBinding|CBB	yylval = (YYSTYPE)MACRO_ChangeButtonBinding;	return VOID_FUNCTION_2STRING;
+ChangeEnable|CE		yylval = (YYSTYPE)MACRO_ChangeEnable;		return VOID_FUNCTION_2STRING;
+ChangeItemBinding|CIB	yylval = (YYSTYPE)MACRO_ChangeItemBinding;	return VOID_FUNCTION_2STRING;
+CheckItem|CI		yylval = (YYSTYPE)MACRO_CheckItem;		return VOID_FUNCTION_STRING;
+CloseSecondarys|CS	yylval = (YYSTYPE)MACRO_CloseSecondarys;		return VOID_FUNCTION_VOID;
+CloseWindow|CW		yylval = (YYSTYPE)MACRO_CloseWindow;		return VOID_FUNCTION_STRING;
+Compare			yylval = (YYSTYPE)MACRO_Compare;			return VOID_FUNCTION_STRING;
+Contents		yylval = (YYSTYPE)MACRO_Contents;		return VOID_FUNCTION_VOID;
+ControlPanel		yylval = (YYSTYPE)MACRO_ControlPanel;		return VOID_FUNCTION_2STRING_UINT;
+CopyDialog		yylval = (YYSTYPE)MACRO_CopyDialog;		return VOID_FUNCTION_VOID;
+CopyTopic|CT		yylval = (YYSTYPE)MACRO_CopyTopic;		return VOID_FUNCTION_VOID;
+CreateButton|CB		yylval = (YYSTYPE)MACRO_CreateButton;		return VOID_FUNCTION_3STRING;
+DeleteItem		yylval = (YYSTYPE)MACRO_DeleteItem;		return VOID_FUNCTION_STRING;
+DeleteMark		yylval = (YYSTYPE)MACRO_DeleteMark;		return VOID_FUNCTION_STRING;
+DestroyButton		yylval = (YYSTYPE)MACRO_DestroyButton;		return VOID_FUNCTION_STRING;
+DisableButton|DB	yylval = (YYSTYPE)MACRO_DisableButton;		return VOID_FUNCTION_STRING;
+DisableItem|DI		yylval = (YYSTYPE)MACRO_DisableItem;		return VOID_FUNCTION_STRING;
+EnableButton|EB		yylval = (YYSTYPE)MACRO_EnableButton;		return VOID_FUNCTION_STRING;
+EnableItem|EI		yylval = (YYSTYPE)MACRO_EnableItem;		return VOID_FUNCTION_STRING;
+EndMPrint		yylval = (YYSTYPE)MACRO_EndMPrint;		return VOID_FUNCTION_VOID;
+ExecFile|EF		yylval = (YYSTYPE)MACRO_ExecFile;		return VOID_FUNCTION_2STRING_UINT_STRING;
+ExecProgram|EP		yylval = (YYSTYPE)MACRO_ExecProgram;		return VOID_FUNCTION_STRING_UINT;
+Exit			yylval = (YYSTYPE)MACRO_Exit;			return VOID_FUNCTION_VOID;
+ExtAbleItem		yylval = (YYSTYPE)MACRO_ExtAbleItem;		return VOID_FUNCTION_STRING_UINT;
+ExtInsertItem		yylval = (YYSTYPE)MACRO_ExtInsertItem;		return VOID_FUNCTION_4STRING_2UINT;
+ExtInsertMenu		yylval = (YYSTYPE)MACRO_ExtInsertMenu;		return VOID_FUNCTION_3STRING_2UINT;
+FileExist|FE		yylval = (YYSTYPE)MACRO_FileExist;		return BOOL_FUNCTION_STRING;
+FileOpen|FO		yylval = (YYSTYPE)MACRO_FileOpen;		return VOID_FUNCTION_VOID;
+Find			yylval = (YYSTYPE)MACRO_Find;			return VOID_FUNCTION_VOID;
+Finder|FD		yylval = (YYSTYPE)MACRO_Finder;			return VOID_FUNCTION_VOID;
+FloatingMenu		yylval = (YYSTYPE)MACRO_FloatingMenu;		return VOID_FUNCTION_VOID;
+Flush|FH		yylval = (YYSTYPE)MACRO_Flush;			return VOID_FUNCTION_VOID;
+FocusWindow		yylval = (YYSTYPE)MACRO_FocusWindow;		return VOID_FUNCTION_STRING;
+Generate		yylval = (YYSTYPE)MACRO_Generate;		return VOID_FUNCTION_STRING_WPARAM_LPARAM;
+GotoMark		yylval = (YYSTYPE)MACRO_GotoMark;		return VOID_FUNCTION_STRING;
+HelpOn			yylval = (YYSTYPE)MACRO_HelpOn;			return VOID_FUNCTION_VOID;
+HelpOnTop		yylval = (YYSTYPE)MACRO_HelpOnTop;		return VOID_FUNCTION_VOID;
+History			yylval = (YYSTYPE)MACRO_History;			return VOID_FUNCTION_VOID;
 IfThen|IF							return IF_THEN;
 IfThenElse|IE							return IF_THEN_ELSE;
-InitMPrint		yylval = MACRO_InitMPrint;		return BOOL_FUNCTION_VOID;
-InsertItem		yylval = MACRO_InsertItem;		return VOID_FUNCTION_4STRING_UINT;
-InsertMenu		yylval = MACRO_InsertMenu;		return VOID_FUNCTION_2STRING_UINT;
-IsBook			yylval = MACRO_IsBook;			return BOOL_FUNCTION_VOID;
-IsMark			yylval = MACRO_IsMark;			return BOOL_FUNCTION_STRING;
-IsNotMark|NM		yylval = MACRO_IsNotMark;		return BOOL_FUNCTION_STRING;
-JumpContents		yylval = MACRO_JumpContents;		return VOID_FUNCTION_FILE_WIN;
-JumpContext|JC		yylval = MACRO_JumpContext;		return VOID_FUNCTION_FILE_WIN_UINT;
-JumpHash|JH		yylval = MACRO_JumpHash;		return VOID_FUNCTION_FILE_WIN_UINT;
-JumpHelpOn		yylval = MACRO_JumpHelpOn;		return VOID_FUNCTION_VOID;
-JumpID|JI		yylval = MACRO_JumpID;			return VOID_FUNCTION_FILE_WIN_STRING;
-JumpKeyword|JK		yylval = MACRO_JumpKeyword;		return VOID_FUNCTION_FILE_WIN_STRING;
-KLink|KL		yylval = MACRO_KLink;			return VOID_FUNCTION_STRING_UINT_2STRING;
-Menu|MU			yylval = MACRO_Menu;			return VOID_FUNCTION_VOID;
-MPrintHash		yylval = MACRO_MPrintHash;		return VOID_FUNCTION_UINT;
-MPrintID		yylval = MACRO_MPrintID;		return VOID_FUNCTION_STRING;
-Next			yylval = MACRO_Next;			return VOID_FUNCTION_VOID;
-NoShow			yylval = MACRO_NoShow;			return VOID_FUNCTION_VOID;
+InitMPrint		yylval = (YYSTYPE)MACRO_InitMPrint;		return BOOL_FUNCTION_VOID;
+InsertItem		yylval = (YYSTYPE)MACRO_InsertItem;		return VOID_FUNCTION_4STRING_UINT;
+InsertMenu		yylval = (YYSTYPE)MACRO_InsertMenu;		return VOID_FUNCTION_2STRING_UINT;
+IsBook			yylval = (YYSTYPE)MACRO_IsBook;			return BOOL_FUNCTION_VOID;
+IsMark			yylval = (YYSTYPE)MACRO_IsMark;			return BOOL_FUNCTION_STRING;
+IsNotMark|NM		yylval = (YYSTYPE)MACRO_IsNotMark;		return BOOL_FUNCTION_STRING;
+JumpContents		yylval = (YYSTYPE)MACRO_JumpContents;		return VOID_FUNCTION_FILE_WIN;
+JumpContext|JC		yylval = (YYSTYPE)MACRO_JumpContext;		return VOID_FUNCTION_FILE_WIN_UINT;
+JumpHash|JH		yylval = (YYSTYPE)MACRO_JumpHash;		return VOID_FUNCTION_FILE_WIN_UINT;
+JumpHelpOn		yylval = (YYSTYPE)MACRO_JumpHelpOn;		return VOID_FUNCTION_VOID;
+JumpID|JI		yylval = (YYSTYPE)MACRO_JumpID;			return VOID_FUNCTION_FILE_WIN_STRING;
+JumpKeyword|JK		yylval = (YYSTYPE)MACRO_JumpKeyword;		return VOID_FUNCTION_FILE_WIN_STRING;
+KLink|KL		yylval = (YYSTYPE)MACRO_KLink;			return VOID_FUNCTION_STRING_UINT_2STRING;
+Menu|MU			yylval = (YYSTYPE)MACRO_Menu;			return VOID_FUNCTION_VOID;
+MPrintHash		yylval = (YYSTYPE)MACRO_MPrintHash;		return VOID_FUNCTION_UINT;
+MPrintID		yylval = (YYSTYPE)MACRO_MPrintID;		return VOID_FUNCTION_STRING;
+Next			yylval = (YYSTYPE)MACRO_Next;			return VOID_FUNCTION_VOID;
+NoShow			yylval = (YYSTYPE)MACRO_NoShow;			return VOID_FUNCTION_VOID;
 Not								return NOT;
-PopupContext|PC		yylval = MACRO_PopupContext;		return VOID_FUNCTION_STRING_UINT;
-PopupHash		yylval = MACRO_PopupHash;		return VOID_FUNCTION_STRING_UINT;
-PopupId|PI		yylval = MACRO_PopupId;			return VOID_FUNCTION_2STRING;
-PositionWindow|PW	yylval = MACRO_PositionWindow;		return VOID_FUNCTION_2INT_3UINT_STRING;
-Prev			yylval = MACRO_Prev;			return VOID_FUNCTION_VOID;
-Print			yylval = MACRO_Print;			return VOID_FUNCTION_VOID;
-PrinterSetup		yylval = MACRO_PrinterSetup;		return VOID_FUNCTION_VOID;
-RegisterRoutine|RR	yylval = MACRO_RegisterRoutine;		return VOID_FUNCTION_3STRING;
-RemoveAccelerator|RA	yylval = MACRO_RemoveAccelerator;	return VOID_FUNCTION_2UINT;
-ResetMenu		yylval = MACRO_ResetMenu;		return VOID_FUNCTION_VOID;
-SaveMark		yylval = MACRO_SaveMark;		return VOID_FUNCTION_STRING;
-Search			yylval = MACRO_Search;			return VOID_FUNCTION_VOID;
-SetContents		yylval = MACRO_SetContents;		return VOID_FUNCTION_STRING_UINT;
-SetHelpOnFile		yylval = MACRO_SetHelpOnFile;		return VOID_FUNCTION_STRING;
-SetPopupColor|SPC	yylval = MACRO_SetPopupColor;		return VOID_FUNCTION_3UINT;
-ShellExecute|SE		yylval = MACRO_ShellExecute;		return VOID_FUNCTION_2STRING_2UINT_2STRING;
-ShortCut|SH		yylval = MACRO_ShortCut;		return VOID_FUNCTION_2STRING_WPARAM_LPARAM_STRING;
-TCard			yylval = MACRO_TCard;			return VOID_FUNCTION_UINT;
-Test			yylval = MACRO_Test;			return VOID_FUNCTION_UINT;
-TestALink		yylval = MACRO_TestALink;		return BOOL_FUNCTION_STRING;
-TestKLink		yylval = MACRO_TestKLink;		return BOOL_FUNCTION_STRING;
-UncheckItem|UI		yylval = MACRO_UncheckItem;		return VOID_FUNCTION_STRING;
-UpdateWindow|UW		yylval = MACRO_UpdateWindow;		return VOID_FUNCTION_2STRING;
+PopupContext|PC		yylval = (YYSTYPE)MACRO_PopupContext;		return VOID_FUNCTION_STRING_UINT;
+PopupHash		yylval = (YYSTYPE)MACRO_PopupHash;		return VOID_FUNCTION_STRING_UINT;
+PopupId|PI		yylval = (YYSTYPE)MACRO_PopupId;			return VOID_FUNCTION_2STRING;
+PositionWindow|PW	yylval = (YYSTYPE)MACRO_PositionWindow;		return VOID_FUNCTION_2INT_3UINT_STRING;
+Prev			yylval = (YYSTYPE)MACRO_Prev;			return VOID_FUNCTION_VOID;
+Print			yylval = (YYSTYPE)MACRO_Print;			return VOID_FUNCTION_VOID;
+PrinterSetup		yylval = (YYSTYPE)MACRO_PrinterSetup;		return VOID_FUNCTION_VOID;
+RegisterRoutine|RR	yylval = (YYSTYPE)MACRO_RegisterRoutine;		return VOID_FUNCTION_3STRING;
+RemoveAccelerator|RA	yylval = (YYSTYPE)MACRO_RemoveAccelerator;	return VOID_FUNCTION_2UINT;
+ResetMenu		yylval = (YYSTYPE)MACRO_ResetMenu;		return VOID_FUNCTION_VOID;
+SaveMark		yylval = (YYSTYPE)MACRO_SaveMark;		return VOID_FUNCTION_STRING;
+Search			yylval = (YYSTYPE)MACRO_Search;			return VOID_FUNCTION_VOID;
+SetContents		yylval = (YYSTYPE)MACRO_SetContents;		return VOID_FUNCTION_STRING_UINT;
+SetHelpOnFile		yylval = (YYSTYPE)MACRO_SetHelpOnFile;		return VOID_FUNCTION_STRING;
+SetPopupColor|SPC	yylval = (YYSTYPE)MACRO_SetPopupColor;		return VOID_FUNCTION_3UINT;
+ShellExecute|SE		yylval = (YYSTYPE)MACRO_ShellExecute;		return VOID_FUNCTION_2STRING_2UINT_2STRING;
+ShortCut|SH		yylval = (YYSTYPE)MACRO_ShortCut;		return VOID_FUNCTION_2STRING_WPARAM_LPARAM_STRING;
+TCard			yylval = (YYSTYPE)MACRO_TCard;			return VOID_FUNCTION_UINT;
+Test			yylval = (YYSTYPE)MACRO_Test;			return VOID_FUNCTION_UINT;
+TestALink		yylval = (YYSTYPE)MACRO_TestALink;		return BOOL_FUNCTION_STRING;
+TestKLink		yylval = (YYSTYPE)MACRO_TestKLink;		return BOOL_FUNCTION_STRING;
+UncheckItem|UI		yylval = (YYSTYPE)MACRO_UncheckItem;		return VOID_FUNCTION_STRING;
+UpdateWindow|UW		yylval = (YYSTYPE)MACRO_UpdateWindow;		return VOID_FUNCTION_2STRING;
 
 [-+]?[0-9]+		yylval.integer = strtol(yytext, NULL, 10);	return INTEGER;
 [-+]?0[xX][0-9a-f]+	yylval.integer = strtol(yytext, NULL, 16);	return INTEGER;
@@ -124,7 +124,7 @@
 			      hStringBuffer = GlobalAlloc(GMEM_FIXED, strlen(macroptr));
 			      strptr = GlobalLock(hStringBuffer);
 			    }
-			  yylval = strptr;
+			  yylval = (YYSTYPE)strptr;
 			  BEGIN (yytext[0] == '`' ? quote : dquote);
 			}
 
diff --git a/relay32/advapi32.spec b/relay32/advapi32.spec
index a53a955..7c2edcc 100644
--- a/relay32/advapi32.spec
+++ b/relay32/advapi32.spec
@@ -201,3 +201,67 @@
 0197 stdcall StartServiceCtrlDispatcherW(ptr) StartServiceCtrlDispatcher32W
 0198 stub StartServiceW
 0199 stub UnlockServiceDatabase
+0200 stub LsaOpenPolicy
+0201 stub LsaLookupSids
+0202 stub LsaFreeMemory
+0203 stub LsaQueryInformationPolicy
+0204 stub LsaClose
+0205 stub LsaSetInformationPolicy
+0206 stub LsaLookupNames
+0207 stub SystemFunction001
+0208 stub SystemFunction002
+0209 stub SystemFunction003
+0210 stub SystemFunction004
+0211 stub SystemFunction005
+0212 stub SystemFunction006
+0213 stub SystemFunction007
+0214 stub SystemFunction008
+0215 stub SystemFunction009
+0216 stub SystemFunction010
+0217 stub SystemFunction011
+0218 stub SystemFunction012
+0219 stub SystemFunction013
+0220 stub SystemFunction014
+0221 stub SystemFunction015
+0222 stub SystemFunction016
+0223 stub SystemFunction017
+0224 stub SystemFunction018
+0225 stub SystemFunction019
+0226 stub SystemFunction020
+0227 stub SystemFunction021
+0228 stub SystemFunction022
+0229 stub SystemFunction023
+0230 stub SystemFunction024
+0231 stub SystemFunction025
+0232 stub SystemFunction026
+0233 stub SystemFunction027
+0234 stub SystemFunction028
+0235 stub SystemFunction029
+0236 stub SystemFunction030
+0237 stub LsaQueryInfoTrustedDomain
+0238 stub LsaQuerySecret
+0239 stub LsaCreateSecret
+0240 stub LsaOpenSecret
+0241 stub LsaCreateTrustedDomain
+0242 stub LsaOpenTrustedDomain
+0243 stub LsaSetSecret
+0244 stub LsaQuerySecret
+0245 stub LsaCreateAccount
+0246 stub LsaAddPrivilegesToAccount
+0247 stub LsaRemovePrivilegesFromAccount
+0248 stub LsaDelete
+0249 stub LsaSetSystemAccessAccount
+0250 stub LsaEnumeratePrivilegesOfAccount
+0251 stub LsaEnumerateAccounts
+0252 stub LsaOpenTrustedDomain
+0253 stub LsaGetSystemAccessAccount
+0254 stub LsaSetInformationTrustedDomain
+0255 stub LsaEnumerateTrustedDomains
+0256 stub LsaOpenAccount
+0257 stub LsaEnumeratePrivileges
+0258 stub LsaLookupPrivilegeDisplayName
+0259 stub LsaICLookupNames
+0260 stub ElfRegisterEventSourceW
+0261 stub ElfReportEventW
+0262 stub ElfDeregisterEventSource
+0263 stub ElfDeregisterEventSourceW
diff --git a/relay32/builtin32.c b/relay32/builtin32.c
index c1c7803..d124093 100644
--- a/relay32/builtin32.c
+++ b/relay32/builtin32.c
@@ -11,7 +11,6 @@
 #include "module.h"
 #include "task.h"
 #include "process.h"
-#include "stddebug.h"
 #include "debug.h"
 
 typedef struct
@@ -73,7 +72,7 @@
     { &COMCTL32_Descriptor, NULL, FALSE },
     { &COMDLG32_Descriptor, NULL, TRUE  },
     { &CRTDLL_Descriptor,   NULL, TRUE  },
-    { &DCIMAN32_Descriptor, NULL, TRUE  },
+    { &DCIMAN32_Descriptor, NULL, FALSE },
     { &DDRAW_Descriptor,    NULL, TRUE  },
     { &DINPUT_Descriptor,   NULL, TRUE  },
     { &DPLAY_Descriptor,    NULL, TRUE  },
@@ -82,19 +81,19 @@
     { &KERNEL32_Descriptor, NULL, TRUE  },
     { &LZ32_Descriptor,     NULL, TRUE  },
     { &MPR_Descriptor,      NULL, TRUE  },
-    { &MSVFW32_Descriptor,  NULL, TRUE  },
+    { &MSVFW32_Descriptor,  NULL, FALSE },
     { &NTDLL_Descriptor,    NULL, TRUE  },
     { &OLE32_Descriptor,    NULL, FALSE },
     { &OLECLI32_Descriptor, NULL, FALSE },
     { &OLESVR32_Descriptor, NULL, FALSE },
     { &SHELL32_Descriptor,  NULL, TRUE  },
-    { &TAPI32_Descriptor,   NULL, TRUE  },
+    { &TAPI32_Descriptor,   NULL, FALSE },
     { &USER32_Descriptor,   NULL, TRUE  },
     { &VERSION_Descriptor,  NULL, TRUE  },
     { &W32SKRNL_Descriptor, NULL, TRUE  },
     { &WINMM_Descriptor,    NULL, TRUE  },
     { &WINSPOOL_Descriptor, NULL, TRUE  },
-    { &WOW32_Descriptor,    NULL, TRUE  },
+    { &WOW32_Descriptor,    NULL, FALSE },
     { &WSOCK32_Descriptor,  NULL, TRUE  },
     /* Last entry */
     { NULL, NULL, FALSE }
@@ -137,7 +136,7 @@
             + dll->descr->nb_names * sizeof(LPSTR)
             + dll->descr->nb_reg_funcs * sizeof(REG_ENTRY_POINT));
 #ifdef __i386__
-    if (debugging_relay)
+    if (debugging_info(relay))
         size += dll->descr->nb_funcs * sizeof(DEBUG_ENTRY_POINT);
 #endif
     addr  = VirtualAlloc( NULL, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE );
@@ -202,7 +201,7 @@
     strcpy( sec->Name, ".code" );
     sec->SizeOfRawData = dll->descr->nb_reg_funcs * sizeof(REG_ENTRY_POINT);
 #ifdef __i386__
-    if (debugging_relay)
+    if (debugging_info(relay))
         sec->SizeOfRawData += dll->descr->nb_funcs * sizeof(DEBUG_ENTRY_POINT);
 #endif
     sec->Misc.VirtualSize = sec->SizeOfRawData;
@@ -223,7 +222,7 @@
 
     /* Build the funcs table */
 
-    if (debugging_relay) dll->dbg_funcs = debug;
+    if (debugging_info(relay)) dll->dbg_funcs = debug;
     for (i = 0; i < dll->descr->nb_funcs; i++, funcs++, debug++)
     {
         BYTE args = dll->descr->args[i];
@@ -237,7 +236,7 @@
             regs->jmp         = 0xe9;
             regs->call32_regs = (DWORD)CALL32_Regs - (DWORD)&regs->nop;
             regs->nop         = 0x9090;
-            if (debugging_relay)
+            if (debugging_info(relay))
             {
                 debug->call       = 0xe8;
                 debug->callfrom32 = (DWORD)regs - (DWORD)&debug->ret;
@@ -252,7 +251,7 @@
             *funcs = (LPVOID)((BYTE *)dll->descr->functions[i] - addr);
             break;
         default:  /* normal function (stdcall or cdecl) */
-            if (debugging_relay)
+            if (debugging_info(relay))
             {
                 debug->call       = 0xe8;
                 debug->callfrom32 = (DWORD)RELAY_CallFrom32 -
diff --git a/relay32/crtdll.spec b/relay32/crtdll.spec
index f1c8972..b80e9fc 100644
--- a/relay32/crtdll.spec
+++ b/relay32/crtdll.spec
@@ -52,7 +52,7 @@
  48 stub _cabs
  49 cdecl _cexit(long) CRTDLL__cexit
  50 stub _cgets
- 51 cdecl _chdir(ptr) CRTDLL__chdir
+ 51 cdecl _chdir(str) CRTDLL__chdir
  52 cdecl _chdrive(long) CRTDLL__chdrive
  53 stub _chgsign
  54 stub _chmod
@@ -115,7 +115,7 @@
 111 stub _fstat
 112 stub _ftime
 113 cdecl _ftol(double) CRTDLL__ftol
-114 cdecl _fullpath(ptr ptr long) CRTDLL__fullpath
+114 cdecl _fullpath(ptr str long) CRTDLL__fullpath
 115 stub _futime
 116 stub _gcvt
 117 stub _get_osfhandle
@@ -198,15 +198,15 @@
 194 stub _mbctoupper
 195 stub _mbctype
 196 stub _mbsbtype
-197 cdecl _mbscat(ptr ptr) CRTDLL__mbscat
+197 cdecl _mbscat(str str) CRTDLL__mbscat
 198 stub _mbschr
 199 stub _mbscmp
-200 cdecl _mbscpy(ptr ptr) CRTDLL__mbscpy
+200 cdecl _mbscpy(ptr str) CRTDLL__mbscpy
 201 stub _mbscspn
 202 stub _mbsdec
 203 stub _mbsdup
-204 cdecl _mbsicmp(ptr ptr) CRTDLL__mbsicmp
-205 cdecl _mbsinc(ptr) CRTDLL__mbsinc
+204 cdecl _mbsicmp(str str) CRTDLL__mbsicmp
+205 cdecl _mbsinc(str) CRTDLL__mbsinc
 206 stub _mbslen
 207 stub _mbslwr
 208 stub _mbsnbcat
@@ -235,12 +235,12 @@
 231 stub _mbsupr
 232 stub _memccpy
 233 stub _memicmp
-234 cdecl _mkdir(ptr) CRTDLL__mkdir
+234 cdecl _mkdir(str) CRTDLL__mkdir
 235 stub _mktemp
 236 stub _msize
 237 stub _nextafter
 238 stub _onexit
-239 cdecl _open(ptr long) CRTDLL__open
+239 cdecl _open(str long) CRTDLL__open
 240 cdecl _open_osfhandle(long long) CRTDLL__open_osfhandle
 241 extern _osmajor_dll CRTDLL_osmajor_dll
 242 extern _osminor_dll CRTDLL_osminor_dll
@@ -280,33 +280,33 @@
 276 stub _spawnve
 277 stub _spawnvp
 278 stub _spawnvpe
-279 cdecl _splitpath (ptr ptr ptr ptr ptr) CRTDLL__splitpath
-280 cdecl _stat (ptr ptr) CRTDLL__stat
+279 cdecl _splitpath (str ptr ptr ptr ptr) CRTDLL__splitpath
+280 cdecl _stat (str ptr) CRTDLL__stat
 281 stub _statusfp
-282 cdecl _strcmpi(ptr ptr) CRTDLL__strcmpi
+282 cdecl _strcmpi(str str) CRTDLL__strcmpi
 283 stub _strdate
 284 stub _strdec
-285 cdecl _strdup(ptr) CRTDLL__strdup
+285 cdecl _strdup(str) CRTDLL__strdup
 286 stub _strerror
-287 cdecl _stricmp(ptr ptr) CRTDLL__strcmpi
+287 cdecl _stricmp(str str) CRTDLL__strcmpi
 288 stub _stricoll
 289 stub _strinc
-290 cdecl _strlwr(ptr) CRTDLL__strlwr
+290 cdecl _strlwr(str) CRTDLL__strlwr
 291 stub _strncnt
 292 stub _strnextc
-293 cdecl _strnicmp(ptr ptr long) CRTDLL__strnicmp
+293 cdecl _strnicmp(str str long) CRTDLL__strnicmp
 294 stub _strninc
 295 stub _strnset
 296 stub _strrev
 297 stub _strset
 298 stub _strspnp
 299 stub _strtime
-300 cdecl _strupr(ptr) CRTDLL__strupr
+300 cdecl _strupr(str) CRTDLL__strupr
 301 stub _swab
 302 stub _sys_errlist
 303 stub _sys_nerr_dll
 304 stub _tell
-305 cdecl _tempnam(ptr ptr) CRTDLL__tempnam
+305 cdecl _tempnam(str ptr) CRTDLL__tempnam
 306 stub _timezone_dll
 307 stub _tolower
 308 stub _toupper
@@ -316,20 +316,20 @@
 312 stub _ultow
 313 stub _umask
 314 stub _ungetch
-315 cdecl _unlink(ptr) CRTDLL__unlink
+315 cdecl _unlink(str) CRTDLL__unlink
 316 stub _unloaddll
 317 stub _utime
 318 stub _vsnprintf
 319 stub _vsnwprintf
 320 stub _wcsdup
-321 cdecl _wcsicmp(ptr ptr) CRTDLL__wcsicmp
-322 cdecl _wcsicoll(ptr ptr) CRTDLL__wcsicoll
-323 cdecl _wcslwr(ptr) CRTDLL__wcslwr
-324 cdecl _wcsnicmp(ptr ptr long) CRTDLL__wcsnicmp
+321 cdecl _wcsicmp(wstr wstr) CRTDLL__wcsicmp
+322 cdecl _wcsicoll(wstr wstr) CRTDLL__wcsicoll
+323 cdecl _wcslwr(wstr) CRTDLL__wcslwr
+324 cdecl _wcsnicmp(wstr wstr long) CRTDLL__wcsnicmp
 325 stub _wcsnset
-326 cdecl _wcsrev(ptr) CRTDLL__wcsrev
+326 cdecl _wcsrev(wstr) CRTDLL__wcsrev
 327 stub _wcsset
-328 cdecl _wcsupr(ptr) CRTDLL__wcsupr
+328 cdecl _wcsupr(wstr) CRTDLL__wcsupr
 329 extern _winmajor_dll CRTDLL_winmajor_dll
 330 extern _winminor_dll CRTDLL_winminor_dll
 331 extern _winver_dll CRTDLL_winver_dll
@@ -347,9 +347,9 @@
 343 cdecl atan(double) atan
 344 cdecl atan2(double double) atan2
 345 cdecl atexit(ptr) CRTDLL_atexit
-346 cdecl atof(ptr) atof
-347 cdecl atoi(ptr) atoi
-348 cdecl atol(ptr) atol
+346 cdecl atof(str) atof
+347 cdecl atoi(str) atoi
+348 cdecl atol(str) atol
 349 stub bsearch
 350 cdecl calloc(long long) CRTDLL_calloc
 351 stub ceil
@@ -373,10 +373,10 @@
 369 stub fgetwc
 370 cdecl floor(double) floor
 371 cdecl fmod(double double) fmod
-372 cdecl fopen(ptr ptr) CRTDLL_fopen
+372 cdecl fopen(str str) CRTDLL_fopen
 373 varargs fprintf() CRTDLL_fprintf
 374 cdecl fputc(long ptr) CRTDLL_fputc
-375 cdecl fputs(ptr ptr) CRTDLL_fputs
+375 cdecl fputs(str ptr) CRTDLL_fputs
 376 stub fputwc
 377 cdecl fread(ptr long long ptr) CRTDLL_fread
 378 cdecl free(ptr) CRTDLL_free
@@ -429,8 +429,8 @@
 425 cdecl log10(double) log10
 426 cdecl longjmp(ptr long) CRTDLL_longjmp
 427 cdecl malloc(ptr) CRTDLL_malloc
-428 cdecl mblen(ptr long) CRTDLL_mblen
-429 cdecl mbstowcs(ptr ptr long) CRTDLL_mbstowcs
+428 cdecl mblen(str long) CRTDLL_mblen
+429 cdecl mbstowcs(ptr str long) CRTDLL_mbstowcs
 430 cdecl mbtowc(ptr ptr long) CRTDLL_mbtowc
 431 cdecl memchr(ptr long long) memchr
 432 cdecl memcmp(ptr ptr long) memcmp
@@ -444,7 +444,7 @@
 440 varargs printf() printf
 441 cdecl putc(long ptr) CRTDLL_putc
 442 cdecl putchar(long) CRTDLL_putchar
-443 cdecl puts(ptr) CRTDLL_puts
+443 cdecl puts(str) CRTDLL_puts
 444 cdecl qsort(ptr long long ptr) qsort
 445 stub raise
 446 cdecl rand() CRTDLL_rand
@@ -463,62 +463,62 @@
 459 cdecl sqrt(double) sqrt
 460 cdecl srand(long) CRTDLL_srand
 461 varargs sscanf() sscanf
-462 cdecl strcat(ptr ptr) strcat
-463 cdecl strchr(ptr long) strchr
-464 cdecl strcmp(ptr ptr) strcmp
-465 cdecl strcoll(ptr ptr) strcoll
-466 cdecl strcpy(ptr ptr) strcpy
-467 cdecl strcspn(ptr ptr) strcspn
+462 cdecl strcat(str str) strcat
+463 cdecl strchr(str long) strchr
+464 cdecl strcmp(str str) strcmp
+465 cdecl strcoll(str str) strcoll
+466 cdecl strcpy(ptr str) strcpy
+467 cdecl strcspn(str str) strcspn
 468 stub strerror
-469 cdecl strftime(ptr long ptr ptr) strftime
-470 cdecl strlen(ptr) strlen
-471 cdecl strncat(ptr ptr long) strncat
-472 cdecl strncmp(ptr ptr long) strncmp
-473 cdecl strncpy(ptr ptr long) strncpy
-474 cdecl strpbrk(ptr ptr) strpbrk
-475 cdecl strrchr(ptr long) strrchr
-476 cdecl strspn(ptr ptr) strspn
-477 cdecl strstr(ptr ptr) strstr
-478 cdecl strtod(ptr ptr) strtod
-479 cdecl strtok(ptr ptr) strtok
-480 cdecl strtol(ptr ptr long) strtol
-481 cdecl strtoul(ptr ptr long) strtoul
-482 cdecl strxfrm(ptr ptr long) strxfrm
+469 cdecl strftime(ptr long str ptr) strftime
+470 cdecl strlen(str) strlen
+471 cdecl strncat(str str long) strncat
+472 cdecl strncmp(str str long) strncmp
+473 cdecl strncpy(ptr str long) strncpy
+474 cdecl strpbrk(str str) strpbrk
+475 cdecl strrchr(str long) strrchr
+476 cdecl strspn(str str) strspn
+477 cdecl strstr(str str) strstr
+478 cdecl strtod(str ptr) strtod
+479 cdecl strtok(str str) strtok
+480 cdecl strtol(str ptr long) strtol
+481 cdecl strtoul(str ptr long) strtoul
+482 cdecl strxfrm(ptr str long) strxfrm
 483 varargs swprintf() wsprintf32W
 484 stub swscanf
-485 cdecl system(ptr) CRTDLL_system
+485 cdecl system(str) CRTDLL_system
 486 cdecl tan(double) tan
 487 cdecl tanh(double) tanh
 488 cdecl time(ptr) CRTDLL_time
 489 stub tmpfile
-490 cdecl tmpnam(ptr) CRTDLL_tmpnam
+490 cdecl tmpnam(str) CRTDLL_tmpnam
 491 cdecl tolower(long) tolower
 492 cdecl toupper(long) toupper
 493 stub towlower
 494 cdecl towupper(long) CRTDLL_towupper
 495 stub ungetc
 496 stub ungetwc
-497 cdecl vfprintf(ptr ptr ptr) CRTDLL_vfprintf
+497 cdecl vfprintf(ptr str ptr) CRTDLL_vfprintf
 498 stub vfwprintf
 499 stub vprintf
-500 cdecl vsprintf(ptr ptr ptr) CRTDLL_vsprintf
-501 cdecl vswprintf(ptr ptr ptr) CRTDLL_vswprintf
+500 cdecl vsprintf(ptr str ptr) CRTDLL_vsprintf
+501 cdecl vswprintf(ptr wstr ptr) CRTDLL_vswprintf
 502 stub vwprintf
-503 cdecl wcscat(ptr ptr) CRTDLL_wcscat
-504 cdecl wcschr(ptr long) CRTDLL_wcschr
-505 cdecl wcscmp(ptr ptr) CRTDLL_wcscmp
-506 cdecl wcscoll(ptr ptr) CRTDLL_wcscoll
-507 cdecl wcscpy(ptr ptr) CRTDLL_wcscpy
-508 cdecl wcscspn(ptr ptr) CRTDLL_wcscspn
+503 cdecl wcscat(wstr wstr) CRTDLL_wcscat
+504 cdecl wcschr(wstr long) CRTDLL_wcschr
+505 cdecl wcscmp(wstr wstr) CRTDLL_wcscmp
+506 cdecl wcscoll(wstr wstr) CRTDLL_wcscoll
+507 cdecl wcscpy(ptr wstr) CRTDLL_wcscpy
+508 cdecl wcscspn(wstr wstr) CRTDLL_wcscspn
 509 stub wcsftime
-510 cdecl wcslen(ptr) CRTDLL_wcslen
-511 cdecl wcsncat(ptr ptr long) CRTDLL_wcsncat
-512 cdecl wcsncmp(ptr ptr long) CRTDLL_wcsncmp
-513 cdecl wcsncpy(ptr ptr long) CRTDLL_wcsncpy
+510 cdecl wcslen(wstr) CRTDLL_wcslen
+511 cdecl wcsncat(wstr wstr long) CRTDLL_wcsncat
+512 cdecl wcsncmp(wstr wstr long) CRTDLL_wcsncmp
+513 cdecl wcsncpy(ptr wstr long) CRTDLL_wcsncpy
 514 stub wcspbrk
-515 cdecl wcsrchr(ptr long) CRTDLL_wcsrchr
-516 cdecl wcsspn(ptr ptr) CRTDLL_wcsspn
-517 cdecl wcsstr(ptr ptr) CRTDLL_wcsstr
+515 cdecl wcsrchr(wstr long) CRTDLL_wcsrchr
+516 cdecl wcsspn(wstr wstr) CRTDLL_wcsspn
+517 cdecl wcsstr(wstr wstr) CRTDLL_wcsstr
 518 stub wcstod
 519 stub wcstok
 520 stub wcstol
diff --git a/relay32/dinput.spec b/relay32/dinput.spec
index 23ba6e9..5d2e9e1 100644
--- a/relay32/dinput.spec
+++ b/relay32/dinput.spec
@@ -7,4 +7,3 @@
 3 stub DllGetClassObject
 4 stub DllRegisterServer
 5 stub DllUnregisterServer
-
diff --git a/relay32/kernel32.spec b/relay32/kernel32.spec
index 0b10e0e..5da486c 100644
--- a/relay32/kernel32.spec
+++ b/relay32/kernel32.spec
@@ -53,7 +53,7 @@
  61 stdcall WOWGlobalUnlock16(long) GlobalUnlock16
  62 stdcall WOWGlobalFree16(long) GlobalFree16
  63 stdcall WOWGlobalAllocLock16(long long ptr) WOWGlobalAllocLock16
- 64 stub WOWGlobalUnlockFree16
+ 64 stdcall WOWGlobalUnlockFree16(long) WOWGlobalUnlockFree16
  65 stub WOWGlobalLockSize16
  66 stub WOWYield16
  67 stub WOWDirectedYield16
@@ -249,7 +249,7 @@
 258 stdcall FindResourceW(long wstr wstr) FindResource32W
 259 stdcall FlushConsoleInputBuffer(long) FlushConsoleInputBuffer
 260 stdcall FlushFileBuffers(long) FlushFileBuffers
-261 stub FlushInstructionCache
+261 stdcall FlushInstructionCache(long long long) FlushInstructionCache
 262 stdcall FlushViewOfFile(ptr long) FlushViewOfFile
 263 stub FoldStringA
 264 stub FoldStringW
diff --git a/relay32/mpr.spec b/relay32/mpr.spec
index c1977b4..c7f0fd1 100644
--- a/relay32/mpr.spec
+++ b/relay32/mpr.spec
@@ -83,3 +83,8 @@
 0102 stub WNetVerifyPasswordW 
 #additions
 0103 stub WNetRestoreConnection
+0104 stub WNetLogonNotify
+0105 stub WNetPasswordChangeNotify
+0106 stub WNetGetPropertyTextA
+0107 stub WNetPropertyDialogA
+0108 stub WNetGetDirectoryTypeA
diff --git a/relay32/ntdll.spec b/relay32/ntdll.spec
index 531ef80..4e6bad6 100644
--- a/relay32/ntdll.spec
+++ b/relay32/ntdll.spec
@@ -872,21 +872,21 @@
 869 stub _snprintf
 870 stub _snwprintf
 871 stub _splitpath
-872 cdecl _strcmpi(ptr ptr) CRTDLL__strcmpi
-873 cdecl _stricmp(ptr ptr) CRTDLL__strcmpi
+872 cdecl _strcmpi(str str) CRTDLL__strcmpi
+873 cdecl _stricmp(str str) CRTDLL__strcmpi
 874 stub _strlwr
-875 cdecl _strnicmp(ptr ptr long) CRTDLL__strnicmp
-876 cdecl _strupr(ptr) CRTDLL__strupr
+875 cdecl _strnicmp(str str long) CRTDLL__strnicmp
+876 cdecl _strupr(str) CRTDLL__strupr
 877 stub _ultoa
 878 stub _vsnprintf
-879 cdecl _wcsicmp(ptr ptr) CRTDLL__wcsicmp
-880 cdecl _wcslwr(ptr) CRTDLL__wcslwr
-881 cdecl _wcsnicmp(ptr ptr long) CRTDLL__wcsnicmp
-882 cdecl _wcsupr(ptr) CRTDLL__wcsupr
+879 cdecl _wcsicmp(wstr wstr) CRTDLL__wcsicmp
+880 cdecl _wcslwr(wstr) CRTDLL__wcslwr
+881 cdecl _wcsnicmp(wstr wstr long) CRTDLL__wcsnicmp
+882 cdecl _wcsupr(wstr) CRTDLL__wcsupr
 883 stub abs
 884 stub atan
-885 cdecl atoi(ptr) atoi
-886 cdecl atol(ptr) atol
+885 cdecl atoi(str) atoi
+886 cdecl atol(str) atol
 887 stub ceil
 888 stub cos
 889 stub fabs
@@ -914,39 +914,39 @@
 911 varargs sprintf() wsprintf32A
 912 stub sqrt
 913 varargs sscanf() sscanf
-914 cdecl strcat(ptr ptr) strcat
-915 cdecl strchr(ptr long) strchr
-916 cdecl strcmp(ptr ptr) strcmp
-917 cdecl strcpy(ptr ptr) strcpy
-918 cdecl strcspn(ptr ptr) strcspn
-919 cdecl strlen(ptr) strlen
-920 cdecl strncat(ptr ptr long) strncat
-921 cdecl strncmp(ptr ptr long) strncmp
-922 cdecl strncpy(ptr ptr long) strncpy
-923 cdecl strpbrk(ptr ptr long) strpbrk
-924 cdecl strrchr(ptr long) strrchr
-925 cdecl strspn(ptr ptr) strspn
-926 cdecl strstr(ptr ptr) strstr
+914 cdecl strcat(str str) strcat
+915 cdecl strchr(str long) strchr
+916 cdecl strcmp(str str) strcmp
+917 cdecl strcpy(ptr str) strcpy
+918 cdecl strcspn(str str) strcspn
+919 cdecl strlen(str) strlen
+920 cdecl strncat(str str long) strncat
+921 cdecl strncmp(str str long) strncmp
+922 cdecl strncpy(ptr str long) strncpy
+923 cdecl strpbrk(str str long) strpbrk
+924 cdecl strrchr(str long) strrchr
+925 cdecl strspn(str str) strspn
+926 cdecl strstr(str str) strstr
 927 varargs swprintf() wsprintf32W
 928 stub tan
 929 cdecl tolower(long) tolower
 930 cdecl toupper(long) toupper
 931 stub towlower
 932 stub towupper
-933 cdecl vsprintf(ptr ptr ptr) CRTDLL_vsprintf
-934 cdecl wcscat(ptr ptr) CRTDLL_wcscat
-935 cdecl wcschr(ptr long) CRTDLL_wcschr
+933 cdecl vsprintf(ptr str ptr) CRTDLL_vsprintf
+934 cdecl wcscat(wstr wstr) CRTDLL_wcscat
+935 cdecl wcschr(wstr long) CRTDLL_wcschr
 936 stub wcscmp
-937 cdecl wcscpy(ptr ptr) CRTDLL_wcscpy
+937 cdecl wcscpy(ptr wstr) CRTDLL_wcscpy
 938 stub wcscspn
-939 cdecl wcslen(ptr) CRTDLL_wcslen
+939 cdecl wcslen(wstr) CRTDLL_wcslen
 940 stub wcsncat
 941 stub wcsncmp
-942 cdecl wcsncpy(ptr ptr long) CRTDLL_wcsncpy
+942 cdecl wcsncpy(ptr wstr long) CRTDLL_wcsncpy
 943 stub wcspbrk
-944 cdecl wcsrchr(ptr long) CRTDLL_wcsrchr
-945 stub wcsspn
-946 cdecl wcsstr(ptr ptr) CRTDLL_wcsstr
+944 cdecl wcsrchr(wstr long) CRTDLL_wcsrchr
+945 cdecl wcsspn(wstr wstr) CRTDLL_wcsspn
+946 cdecl wcsstr(wstr wstr) CRTDLL_wcsstr
 947 stub wcstok
 948 stub wcstol
 949 cdecl wcstombs(ptr ptr long) CRTDLL_wcstombs
diff --git a/relay32/ole32.spec b/relay32/ole32.spec
index 1547f4c..9fcd3b3 100644
--- a/relay32/ole32.spec
+++ b/relay32/ole32.spec
@@ -2,8 +2,8 @@
 type	win32
 
   1 stub BindMoniker
-  2 stub CLSIDFromProgID
-  3 stdcall CLSIDFromString(str ptr) CLSIDFromString
+  2 stdcall CLSIDFromProgID(wstr ptr) CLSIDFromProgID32
+  3 stdcall CLSIDFromString(wstr ptr) CLSIDFromString32
   4 stdcall CoBuildVersion() CoBuildVersion
   5 stub CoCreateFreeThreadedMarshaler
   6 stub CoCreateGuid
@@ -18,16 +18,16 @@
  15 stub CoGetCallerTID
  16 stub CoGetClassObject
  17 stub CoGetCurrentLogicalThreadId
- 18 stub CoGetCurrentProcess
+ 18 stdcall CoGetCurrentProcess() CoGetCurrentProcess
  19 stub CoGetInterfaceAndReleaseStream
- 20 stdcall CoGetMalloc(long ptr) CoGetMalloc
+ 20 stdcall CoGetMalloc(long ptr) CoGetMalloc32
  21 stub CoGetMarshalSizeMax
  22 stub CoGetPSClsid
  23 stub CoGetStandardMarshal
  24 stub CoGetState
  25 stub CoGetTreatAsClass
- 26 stdcall CoInitialize(long) CoInitialize
- 27 stub CoInitializeWOW
+ 26 stdcall CoInitialize(long) CoInitialize32
+ 27 stdcall CoInitializeWOW(long long) CoInitializeWOW
  28 stub CoIsHandlerConnected
  29 stub CoIsOle1Class
  30 stub CoLoadLibrary
@@ -36,15 +36,15 @@
  33 stub CoMarshalInterThreadInterfaceInStream
  34 stub CoMarshalInterface
  35 stub CoQueryReleaseObject
- 36 stub CoRegisterClassObject
+ 36 stdcall CoRegisterClassObject(ptr ptr long long ptr) CoRegisterClassObject32
  37 stub CoRegisterMallocSpy
  38 stdcall CoRegisterMessageFilter(ptr ptr) CoRegisterMessageFilter32
  39 stub CoReleaseMarshalData
  40 stub CoRevokeClassObject
  41 stub CoRevokeMallocSpy
  42 stub CoSetState
- 43 stub CoTaskMemAlloc
- 44 stub CoTaskMemFree
+ 43 stdcall CoTaskMemAlloc(long) CoTaskMemAlloc
+ 44 stdcall CoTaskMemFree(ptr) CoTaskMemFree
  45 stub CoTaskMemRealloc
  46 stub CoTreatAsClass
  47 stdcall CoUninitialize() CoUnitialize
@@ -78,13 +78,13 @@
  75 stub IsAccelerator
  76 stub IsEqualGUID
  77 stub IsValidIid
- 78 stub IsValidInterface
+ 78 stdcall IsValidInterface(ptr) IsValidInterface32
  79 stub IsValidPtrIn
  80 stub IsValidPtrOut
  81 stub MkParseDisplayName
  82 stub MonikerCommonPrefixWith
  83 stub MonikerRelativePathTo
- 84 stub OleBuildVersion
+ 84 stdcall OleBuildVersion() OleBuildVersion
  85 stub OleConvertIStorageToOLESTREAM
  86 stub OleConvertIStorageToOLESTREAMEx
  87 stub OleConvertOLESTREAMToIStorage
@@ -109,7 +109,7 @@
 106 stub OleGetIconOfClass
 107 stub OleGetIconOfFile
 108 stdcall OleInitialize(ptr) OleInitialize
-109 stub OleInitializeWOW
+109 stdcall OleInitializeWOW(long) OleInitializeWOW
 110 stub OleIsCurrentClipboard
 111 stub OleIsRunning
 112 stub OleLoad
@@ -144,14 +144,14 @@
 141 stub RevokeDragDrop
 142 stub SetConvertStg
 143 stub SetDocumentBitStg
-144 stub StgCreateDocfile
+144 stdcall StgCreateDocfile(wstr long long ptr) StgCreateDocFile32
 145 stub StgCreateDocfileOnILockBytes
-146 stub StgIsStorageFile
+146 stdcall StgIsStorageFile(wstr) StgIsStorageFile32
 147 stub StgIsStorageILockBytes
-148 stub StgOpenStorage
+148 stdcall StgOpenStorage(wstr ptr long ptr long ptr) StgOpenStorage32
 149 stub StgOpenStorageOnILockBytes
 150 stub StgSetTimes
-151 stdcall StringFromCLSID(ptr ptr) StringFromCLSID
+151 stdcall StringFromCLSID(ptr ptr) StringFromCLSID32
 152 stub StringFromGUID2
 153 stub StringFromIID
 154 stub UtConvertDvtd16toDvtd32
diff --git a/relay32/relay386.c b/relay32/relay386.c
index 1b5f706..734c2a5 100644
--- a/relay32/relay386.c
+++ b/relay32/relay386.c
@@ -11,7 +11,6 @@
 #include "windows.h"
 #include "builtin32.h"
 #include "selectors.h"
-#include "stddebug.h"
 #include "debug.h"
 
 static void _dumpstr(unsigned char *s) {
@@ -54,7 +53,7 @@
     BYTE *relay_addr = (BYTE *)args[-1];
     WORD nb_args = *(WORD *)(relay_addr + 1) / sizeof(int);
 
-    assert(debugging_relay);
+    assert(debugging_info(relay));
     func = (FARPROC32)BUILTIN32_GetEntryPoint( buffer, relay_addr - 5,
                                                &typemask );
     printf( "Call %s(", buffer );
@@ -175,7 +174,7 @@
  * Stack layout:
  *  ...      ...
  * (esp+216) ret_addr
- * (esp+212) return to relay debugging code (only when debugging_relay)
+ * (esp+212) return to relay debugging code (only when debugging(relay))
  * (esp+208) entry point to call
  * (esp+4)   CONTEXT
  * (esp)     return addr to relay code
@@ -184,7 +183,7 @@
                            void (CALLBACK *entry_point)(CONTEXT *),
                            BYTE *relay_addr, int ret_addr )
 {
-    if (!debugging_relay)
+    if (!debugging_info(relay))
     {
         /* Simply call the entry point */
         entry_point( &context );
diff --git a/relay32/user32.spec b/relay32/user32.spec
index dc4f01a..ac39942 100644
--- a/relay32/user32.spec
+++ b/relay32/user32.spec
@@ -595,7 +595,7 @@
 589 stub ChangeDisplaySettingsA
 590 stub ChangeDisplaySettingsW
 591 stub EnumDesktopWindows
-592 stub EnumDisplaySettingsA
+592 stdcall EnumDisplaySettingsA(str long ptr) EnumDisplaySettings32A
 593 stub EnumDisplaySettingsW
 594 stub GetWindowRgn
 595 stub MapVirtualKeyExW
diff --git a/relay32/wow32.spec b/relay32/wow32.spec
index 5ff4692..9b5bace 100644
--- a/relay32/wow32.spec
+++ b/relay32/wow32.spec
@@ -14,7 +14,7 @@
  11 stub    WOWGlobalLock16
  12 stub    WOWGlobalLockSize16
  13 stub    WOWGlobalUnlock16
- 14 stub    WOWGlobalUnlockFree16
+ 14 stdcall WOWGlobalUnlockFree16(long) WOWGlobalUnlockFree16
  15 stub    WOWHandle16
  16 stdcall WOWHandle32(long long) WOWHandle32
  17 stub    WOWYield16
diff --git a/scheduler/critsection.c b/scheduler/critsection.c
index c97c295..9c92351 100644
--- a/scheduler/critsection.c
+++ b/scheduler/critsection.c
@@ -50,6 +50,8 @@
     CRIT_SECTION_Satisfied,    /* satisfied */
     CRIT_SECTION_AddWait,      /* add_wait */
     CRIT_SECTION_RemoveWait,   /* remove_wait */
+    NULL,                      /* read */
+    NULL,                      /* write */
     CRIT_SECTION_Destroy       /* destroy */
 };
 
diff --git a/scheduler/event.c b/scheduler/event.c
index fdebbe8..9cf505c 100644
--- a/scheduler/event.c
+++ b/scheduler/event.c
@@ -32,6 +32,8 @@
     EVENT_Satisfied,    /* satisfied */
     EVENT_AddWait,      /* add_wait */
     EVENT_RemoveWait,   /* remove_wait */
+    NULL,               /* read */
+    NULL,               /* write */
     EVENT_Destroy       /* destroy */
 };
 
diff --git a/scheduler/k32obj.c b/scheduler/k32obj.c
index c9fad71..30717fb 100644
--- a/scheduler/k32obj.c
+++ b/scheduler/k32obj.c
@@ -28,6 +28,8 @@
     NULL,    /* satisfied */
     NULL,    /* add_wait */
     NULL,    /* remove_wait */
+    NULL,    /* read */
+    NULL,    /* write */
     NULL     /* destroy */
 };
 
diff --git a/scheduler/mutex.c b/scheduler/mutex.c
index b082976..ae69498 100644
--- a/scheduler/mutex.c
+++ b/scheduler/mutex.c
@@ -35,6 +35,8 @@
     MUTEX_Satisfied,   /* satisfied */
     MUTEX_AddWait,     /* add_wait */
     MUTEX_RemoveWait,  /* remove_wait */
+    NULL,              /* read */
+    NULL,              /* write */
     MUTEX_Destroy      /* destroy */
 };
 
diff --git a/scheduler/process.c b/scheduler/process.c
index 84a6bf24..27d8765 100644
--- a/scheduler/process.c
+++ b/scheduler/process.c
@@ -33,6 +33,8 @@
     PROCESS_Satisfied,   /* satisfied */
     PROCESS_AddWait,     /* add_wait */
     PROCESS_RemoveWait,  /* remove_wait */
+    NULL,                /* read */
+    NULL,                /* write */
     PROCESS_Destroy      /* destroy */
 };
 
@@ -203,6 +205,7 @@
 BOOL32 PROCESS_Init(void)
 {
     extern BOOL32 VIRTUAL_Init(void);
+    extern BOOL32 THREAD_InitDone;
     PDB32 *pdb;
     THDB *thdb;
 
@@ -217,6 +220,7 @@
     if (!(pdb = PROCESS_CreatePDB( NULL ))) return FALSE;
     if (!(thdb = THREAD_Create( pdb, 0, NULL, NULL ))) return FALSE;
     SET_CUR_THREAD( thdb );
+    THREAD_InitDone = TRUE;
 
     return TRUE;
 }
@@ -311,9 +315,29 @@
     return K32OBJ_OPS( pdb->event )->remove_wait( pdb->event, thread_id );
 }
 
+/***********************************************************************
+ *		PROCESS_CloseObjHandles
+ *
+ *	closes all handles that reference "ptr"
+ * note: need to add 1 to the array entry to get to what
+ * CloseHandle expects (there is no zero handle)
+ */
+void PROCESS_CloseObjHandles(PDB32 *pdb, K32OBJ *ptr)
+{
+	HANDLE32 handle;
+
+	assert( pdb->header.type == K32OBJ_PROCESS );
+
+	/* Close all handles that have a pointer to ptr */
+	for (handle = 0; handle < pdb->handle_table->count; handle++)
+		if (pdb->handle_table->entries[handle].ptr == ptr) 
+			CloseHandle( handle+1 );
+}
 
 /***********************************************************************
  *           PROCESS_Destroy
+ * note: need to add 1 to the array entry to get to what
+ * CloseHandle expects (there is no zero handle)
  */
 static void PROCESS_Destroy( K32OBJ *ptr )
 {
@@ -323,7 +347,7 @@
 
     /* Close all handles */
     for (handle = 0; handle < pdb->handle_table->count; handle++)
-        if (pdb->handle_table->entries[handle].ptr) CloseHandle( handle );
+        if (pdb->handle_table->entries[handle].ptr) CloseHandle( handle+1 );
 
     /* Free everything */
 
@@ -343,6 +367,7 @@
     /* FIXME: should kill all running threads of this process */
     pdb->exit_code = status;
     EVENT_Set( pdb->event );
+    if (pdb->console) FreeConsole();
     SYSTEM_UNLOCK();
 
     __RESTORE_ES;  /* Necessary for Pietrek's showseh example program */
diff --git a/scheduler/semaphore.c b/scheduler/semaphore.c
index 19160fd..361bf1f 100644
--- a/scheduler/semaphore.c
+++ b/scheduler/semaphore.c
@@ -32,6 +32,8 @@
     SEMAPHORE_Satisfied,   /* satisfied */
     SEMAPHORE_AddWait,     /* add_wait */
     SEMAPHORE_RemoveWait,  /* remove_wait */
+    NULL,                  /* read */
+    NULL,                  /* write */
     SEMAPHORE_Destroy      /* destroy */
 };
 
diff --git a/scheduler/synchro.c b/scheduler/synchro.c
index 4195fc2..8056c4a 100644
--- a/scheduler/synchro.c
+++ b/scheduler/synchro.c
@@ -14,7 +14,6 @@
 #include "process.h"
 #include "thread.h"
 #include "winerror.h"
-#include "stddebug.h"
 #include "debug.h"
 
 /***********************************************************************
@@ -146,7 +145,7 @@
 
     /* Now wait for it */
 
-    dprintf_win32( stddeb, "SYNC: starting wait (%p %04x)\n",
+    dprintf_info(win32, "SYNC: starting wait (%p %04x)\n",
                    THREAD_Current(), THREAD_Current()->teb_sel );
 
     sigprocmask( SIG_SETMASK, NULL, &set );
@@ -182,7 +181,7 @@
     /* Grab the system lock again */
 
     while (count--) SYSTEM_LOCK();
-    dprintf_win32( stddeb, "SYNC: wait finished (%p %04x)\n",
+    dprintf_info(win32, "SYNC: wait finished (%p %04x)\n",
                    THREAD_Current(), THREAD_Current()->teb_sel );
 
     /* Remove ourselves from the lists */
@@ -245,7 +244,7 @@
         THDB *thdb = entry->thread;
         if (SYNC_CheckCondition( &thdb->wait_struct, THDB_TO_THREAD_ID(thdb) ))
         {
-            dprintf_win32( stddeb, "SYNC: waking up %04x\n", thdb->teb_sel );
+            dprintf_info(win32, "SYNC: waking up %04x\n", thdb->teb_sel );
             kill( thdb->unix_pid, SIGUSR1 );
             if (!--max) break;
         }
diff --git a/scheduler/sysdeps.c b/scheduler/sysdeps.c
index e020953..b1a7c56 100644
--- a/scheduler/sysdeps.c
+++ b/scheduler/sysdeps.c
@@ -17,13 +17,8 @@
 #include "thread.h"
 #include "winbase.h"
 
-/* FIXME: X libs compiled w/o -D_REENTRANT should be detected by autoconf. */
-#define NO_REENTRANT_X11
-
-#ifdef NO_REENTRANT_X11
 /* Xlib critical section (FIXME: does not belong here) */
 CRITICAL_SECTION X11DRV_CritSection = { 0, };
-#endif
 
 #ifdef __linux__
 # ifdef HAVE_SCHED_H
@@ -123,24 +118,19 @@
 
 /**********************************************************************
  *           NtCurrentTeb   (NTDLL.89)
+ *
+ * This will crash and burn if called before threading is initialized
  */
 TEB * WINAPI NtCurrentTeb(void)
 {
 #ifdef __i386__
     TEB *teb;
-    WORD ds, fs;
 
-    /* Check if we have a current thread */
-    GET_FS( fs );
-    if (!fs) return NULL;
-    GET_DS( ds );
-    if (fs == ds) return NULL; /* FIXME: should be an assert */
     /* Get the TEB self-pointer */
     __asm__( ".byte 0x64\n\tmovl (%1),%0"
              : "=r" (teb) : "r" (&((TEB *)0)->self) );
     return teb;
 #else
-    if (!pCurrentThread) return NULL;
     return &pCurrentThread->teb;
 #endif  /* __i386__ */
 }
diff --git a/scheduler/thread.c b/scheduler/thread.c
index 023f93d..fdfb34b 100644
--- a/scheduler/thread.c
+++ b/scheduler/thread.c
@@ -16,7 +16,6 @@
 #include "miscemu.h"
 #include "winnt.h"
 #include "debug.h"
-#include "stddebug.h"
 
 #ifndef __i386__
 THDB *pCurrentThread;
@@ -34,11 +33,16 @@
     THREAD_Satisfied,   /* satisfied */
     THREAD_AddWait,     /* add_wait */
     THREAD_RemoveWait,  /* remove_wait */
+    NULL,               /* read */
+    NULL,               /* write */
     THREAD_Destroy      /* destroy */
 };
 
 
-/***********************************************************************
+/* Is threading code initialized? */
+BOOL32 THREAD_InitDone = FALSE;
+
+/**********************************************************************
  *           THREAD_GetPtr
  *
  * Return a pointer to a thread object. The object count must be decremented
@@ -65,9 +69,8 @@
  */
 THDB *THREAD_Current(void)
 {
-    TEB *teb = NtCurrentTeb();
-    if (!teb) return NULL;
-    return (THDB *)((char *)teb - (int)&((THDB *)0)->teb);
+    if (!THREAD_InitDone) return NULL;
+    return (THDB *)((char *)NtCurrentTeb() - (int)&((THDB *)0)->teb);
 }
 
 
@@ -143,6 +146,7 @@
     thdb->teb.stack_sel   = 0; /* FIXME */
     thdb->teb.self        = &thdb->teb;
     thdb->teb.tls_ptr     = thdb->tls_array;
+    thdb->teb.process     = pdb;
     thdb->wait_list       = &thdb->wait_struct;
     thdb->exit_code       = 0x103; /* STILL_ACTIVE */
     thdb->entry_point     = start_addr;
@@ -150,7 +154,18 @@
 
     /* Allocate the stack */
 
-    if (!stack_size) stack_size = 1024 * 1024;  /* default size = 1Mb */
+    /* FIXME:
+     * If stacksize smaller than 1 MB, allocate 1MB 
+     * (one program wanted only 10 kB, which is recommendable, but some WINE
+     *  functions, noteably in the files subdir, push HUGE structures and
+     *  arrays on the stack. They probably shouldn't.)
+     * If stacksize larger than 16 MB, warn the user. (We could shrink the stack
+     * but this could give more or less unexplainable crashes.)
+     */
+    if (stack_size<1024*1024)
+    	stack_size = 1024 * 1024;
+    if (stack_size >= 16*1024*1024)
+    	fprintf(stderr,"Warning:Thread stack size is %ld MB.\n",stack_size/1024/1024);
     thdb->stack_base = VirtualAlloc( NULL, stack_size, MEM_COMMIT,
                                      PAGE_EXECUTE_READWRITE );
     if (!thdb->stack_base) goto error;
@@ -377,12 +392,11 @@
 
 
 /**********************************************************************
- *           TlsAlloc   (KERNEL32.530)
+ *           THREAD_TlsAlloc
  */
-DWORD WINAPI TlsAlloc(void)
+DWORD THREAD_TlsAlloc(THDB *thread)
 {
     DWORD i, mask, ret = 0;
-    THDB *thread = THREAD_Current();
     DWORD *bits = thread->process->tls_bits;
     EnterCriticalSection( &thread->process->crit_section );
     if (*bits == 0xffffffff)
@@ -402,6 +416,14 @@
     return ret + i;
 }
 
+/**********************************************************************
+ *           TlsAlloc   (KERNEL32.530)
+ */
+DWORD WINAPI TlsAlloc(void)
+{
+    return THREAD_TlsAlloc(THREAD_Current());
+}
+
 
 /**********************************************************************
  *           TlsFree   (KERNEL32.531)
diff --git a/tools/build.c b/tools/build.c
index 34995d2..154f679 100644
--- a/tools/build.c
+++ b/tools/build.c
@@ -1308,16 +1308,21 @@
 static int TransferArgs16To32( FILE *outfile, char *args, int usecdecl )
 {
     int i, pos16, pos32;
+    char *xargs;
 
     /* Copy the arguments */
 
     pos16 = 6;  /* skip bp and return address */
     pos32 = usecdecl ? -(strlen(args) * 4) : 0;
+    xargs = usecdecl ? args:args+strlen(args);
 
     for (i = strlen(args); i > 0; i--)
     {
-        if (!usecdecl) pos32 -= 4;
-        switch(args[i-1])
+        if (!usecdecl) {
+            pos32 -= 4;
+            xargs--;
+        }
+        switch(*xargs)
         {
         case 'w':  /* word */
             fprintf( outfile, "\tmovzwl %d(%%ebp),%%eax\n", pos16 );
@@ -1353,9 +1358,12 @@
             break;
 
         default:
-            fprintf( stderr, "Unknown arg type '%c'\n", args[i-1] );
+            fprintf( stderr, "Unknown arg type '%c'\n", *xargs );
         }
-        if (usecdecl) pos32 += 4;
+        if (usecdecl) {
+            pos32 += 4;
+            xargs++;
+        }
     }
 
     return pos16 - 6;  /* Return the size of the 16-bit args */
@@ -2087,7 +2095,7 @@
  *
  * Stack layout:
  *   ...     ...
- * (esp+208) ret addr (or relay addr when debugging_relay is on)
+ * (esp+208) ret addr (or relay addr when debugging(relay) is on)
  * (esp+204) entry point
  * (esp+0)   CONTEXT struct
  */
diff --git a/tools/find_debug_channels b/tools/find_debug_channels
new file mode 100644
index 0000000..39c5666
--- /dev/null
+++ b/tools/find_debug_channels
@@ -0,0 +1,41 @@
+#!/bin/bash
+#
+# This script scans the whole source code for symbols of the form 
+# 'dprintf_xxx(yyy' where yyy is a C identifier and outputs, on the
+# standard output a sorted list of the identifiers found in the .c 
+# files. Each identifier is reported once. Header files are not
+# scanned.
+#
+# The script can be given an argument that specify the files to be
+# searched according to the following scheme:
+#    - if the argument does not contain a slash (/), the script
+#      will search the tree rooted in the current directory for
+#      files that match that description. You can also pass
+#      wildcard arguments, but remember to quote them to prevent
+#      expansion by the shell
+#    - if the argument does contain a slash, only that file is
+#      searched
+#    - if no argument is given, the argument defaults to "*.c"
+#      that is, all C files are searched.
+#    - if more than a argument is given, only the listed files are
+#      searched. Note that in this case, the script will not
+#      attempt to find them in some subdirectories, but rather
+#      it will try to open them in the current directory.
+# Thus, if you want to disable the automatic searching when the file
+# name does not contain a /, either prefix the filename with ./
+# or add /dev/null as another argument.
+#
+# Dimitrie O. Paun <dimi@cs.toronto.edu>
+#
+
+case "$#" in
+    0 | 1)  files=${1:-'*.c'}
+	    if [ ${files#*/} = "$files" ]; then
+		files=$(find . -name "$files" -print)
+	    fi;;
+    *    )  files="$@";;
+esac
+
+grep -h dprintf_ $files /dev/null | \
+    sed 's/.*dprintf_[A-Za-z0-9_]\+ *( *\([A-Za-z0-9_]*\).*/\1/g' | \
+    sort | uniq
diff --git a/tools/fnt2bdf.c b/tools/fnt2bdf.c
index 80537be..f678e85 100644
--- a/tools/fnt2bdf.c
+++ b/tools/fnt2bdf.c
@@ -81,7 +81,8 @@
                 }
             break;
             }
-	case(dfString):
+		case(dfString):
+			break;
         } 
     return ret_val;
 }
diff --git a/tools/make_X11wrappers b/tools/make_X11wrappers
index 0f2db0b..08b470c 100755
--- a/tools/make_X11wrappers
+++ b/tools/make_X11wrappers
@@ -78,7 +78,6 @@
 
 $x11_incl#include <X11/$extensions_dir$name.h>
 #include "x11drv.h"
-#include "stddebug.h"
 #include "debug.h"
 END
 
@@ -212,13 +211,13 @@
 #    print OUTH "#define $fn_name TS$fn_name\n";
     print OUTC "{\n";
     print OUTC "  $resultdecl;\n" if $resultdecl;
-    print OUTC "  dprintf_x11(stddeb, \"Call $fn_name\\n\");\n";
+    print OUTC "  dprintf_info(x11, \"Call $fn_name\\n\");\n";
     print OUTC "  EnterCriticalSection( &X11DRV_CritSection );\n";
     print OUTC "  ";
     print OUTC "r = " if $resultdecl;
     print OUTC "$fn_name($actuals);\n";
     print OUTC "  LeaveCriticalSection( &X11DRV_CritSection );\n";
-    print OUTC "  dprintf_x11(stddeb, \"Ret $fn_name\\n\");\n";
+    print OUTC "  dprintf_info(x11, \"Ret $fn_name\\n\");\n";
     print OUTC "  return r;\n" if $resultdecl;
     print OUTC "}\n";
     $want{$fn_name} = 2;
diff --git a/tools/make_debug b/tools/make_debug
index d836f3b..67451f6 100755
--- a/tools/make_debug
+++ b/tools/make_debug
@@ -1,164 +1,75 @@
-#!/bin/sh
+#!/bin/bash
 #
-# This script scans the whole source code for symbols of the form dprintf_xxx,
-# generates the necessary macro definitions and puts them into the files
-# include/stddebug.h and include/debug.h . This script must be started with 
-# cwd = rootdir of the Wine-distribution.
+# This script generates the required files for supporting the debug
+# channels used throught the code.
+# The generated files are 
+#   include/debugdefs.h
+#   include/debug.h
+# The script must be run in the root directory of the project.
 #
-# Michael Patra  <micky@marie.physik.tu-berlin.de>
+# Dimitrie O. Paun <dimi@cs.toronto.edu>
 #
-DEBUG_H=include/debug.h
-STDDEBUG_H=include/stddebug.h
+DEBUG_H="include/debug.h"
+DEBUG_DEFS_H="include/debugdefs.h"
 
-mv $DEBUG_H $DEBUG_H.old
-mv $STDDEBUG_H $STDDEBUG_H.old
+DEBUG_CHANNELS="$( tools/find_debug_channels )"
 
-# Build the list of debug identifiers
-grep -h dprintf_ `find . -name '*.c' -print` | \
-    sed 's/.*dprintf_\([A-Za-z0-9_]*\).*/\1/g' | sort | uniq > temp.$$
-
-# Build debug.h
-
-sed '/^\/\* Do not remove this line or change anything below this line \*\//q'\
-      <$DEBUG_H.old >$DEBUG_H
-cat <<++EOF++ >> $DEBUG_H
-
-#ifdef DEBUG_NONE_EXT
-++EOF++
-
-cat temp.$$ | tr a-z A-Z |
 {
-while read x
-do
-	echo "#undef DEBUG_$x" >> $DEBUG_H
-done
-}
+    cat <<EOF
+/* Do not modify this file -- it is automatically generated! */
 
-cat <<++EOF++ >>$DEBUG_H
+#ifndef __DEBUGTOOLS_H
+#include "debugtools.h"
 #endif
 
-#ifdef DEBUG_ALL_EXT
-++EOF++
-
-cat temp.$$ | tr a-z A-Z |
-{
-while read x
-do
-	echo "#define DEBUG_$x" >> $DEBUG_H
-done
-}
-
-cat <<++EOF++ >>$DEBUG_H
-#endif
-
-#ifdef DEBUG_RUNTIME
-#ifdef DEBUG_DEFINE_VARIABLES
-short debug_msg_enabled[]={
-++EOF++
-
-cat temp.$$ | tr a-z A-Z |
-{
-while read x
-do
-	cat <<++EOF++ >>$DEBUG_H
-#ifdef DEBUG_$x
-    1,
-#else
-    0,
-#endif
-++EOF++
-
-done
-}
-
-cat <<++EOF++ >>$DEBUG_H
-    0
-};
-#else
-extern short debug_msg_enabled[];
-#endif
-#endif
-
-++EOF++
-
-i=0
-cat temp.$$ |
-{
-while read x 
-do
-	y=`echo $x | tr a-z A-Z`
-	cat <<++EOF++ >>$DEBUG_H
-#ifdef DEBUG_RUNTIME
-#define dprintf_$x if(!debug_msg_enabled[$i]) ; else fprintf
-#define debugging_$x debug_msg_enabled[$i]
-#else
-#ifdef DEBUG_$y
-#define dprintf_$x fprintf
-#define debugging_$x 1
-#else
-#define dprintf_$x while(0) fprintf
-#define debugging_$x 0
-#endif
-#endif
-
-++EOF++
+EOF
+    i=0
+    for ch in $DEBUG_CHANNELS
+    do
+	echo "#define dbch_${ch} $i"
 	let i=$i+1
-done
-}
+    done
+} > $DEBUG_H
 
-cat <<++EOF++ >>$DEBUG_H
+# Now, on the last step, we proceed to construct
+# the definitions to be used by the main function.
+# These will be stored in include/debugdefs.h
+{
+    cat <<EOF
+/* Do not modify this file -- it is automatically generated! */
 
+#ifndef __DEBUGTOOLS_H
+#include "debugtools.h"
+#endif
+
+#define DEBUG_CHANNEL_COUNT $i
 #ifdef DEBUG_RUNTIME
-#ifdef DEBUG_DEFINE_VARIABLES
-static char *debug_msg_name[] = {
-++EOF++
+short debug_msg_enabled[][DEBUG_CLASS_COUNT] = {
+EOF
 
-cat temp.$$ | 
-{
-while read x
-do
-	echo "    \"$x\"," >> $DEBUG_H
-done
-}
+    for ch in $DEBUG_CHANNELS
+    do
+	echo "{1, 1, 0, 0},"
+    done
+    echo '};'
 
-cat <<++EOF++ >>$DEBUG_H
-    ""
-};
-#endif
-#endif
-++EOF++
+    echo 'const char* debug_ch_name[] = {'
+    for ch in $DEBUG_CHANNELS
+    do
+	echo "\"${ch}\","
+    done
+    echo '};'
+    
+    cat <<EOF
 
-# Build stddebug.h
+const char* debug_cl_name[] =
+{ "fixme", "err", "warn", "info" };
 
-sed '/^\/\* Do not remove this line or change anything below this line \*\//q'\
-      <$STDDEBUG_H.old >$STDDEBUG_H
+#endif /*DEBUG_RUNTIME*/
 
-cat <<++EOF++ >>$STDDEBUG_H
+/* end of automatically generated debug.h */
+EOF
 
-#ifdef DEBUG_NONE
-++EOF++
+} > $DEBUG_DEFS_H
 
-cat temp.$$ | tr a-z A-Z |
-{
-while read x
-do
-	echo "#undef DEBUG_$x" >> $STDDEBUG_H
-done
-}
 
-cat <<++EOF++ >>$STDDEBUG_H
-#endif
-
-#ifdef DEBUG_ALL
-++EOF++
-
-cat temp.$$ | tr a-z A-Z |
-{
-while read x
-do
-	echo "#define DEBUG_$x" >> $STDDEBUG_H
-done
-}
-echo "#endif" >> $STDDEBUG_H
-
-rm temp.$$ $DEBUG_H.old $STDDEBUG_H.old
diff --git a/tsx11/ts_xlib.c b/tsx11/ts_xlib.c
index 765e52d..d81cbdf 100644
--- a/tsx11/ts_xlib.c
+++ b/tsx11/ts_xlib.c
@@ -6,1258 +6,1257 @@
 
 #include <X11/Xlib.h>
 #include "x11drv.h"
-#include "stddebug.h"
 #include "debug.h"
 
 XFontStruct * TSXLoadQueryFont(Display* a0, const  char* a1)
 {
   XFontStruct * r;
-  dprintf_x11(stddeb, "Call XLoadQueryFont\n");
+  dprintf_info(x11, "Call XLoadQueryFont\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XLoadQueryFont(a0, a1);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XLoadQueryFont\n");
+  dprintf_info(x11, "Ret XLoadQueryFont\n");
   return r;
 }
 
 XModifierKeymap	* TSXGetModifierMapping(Display* a0)
 {
   XModifierKeymap	* r;
-  dprintf_x11(stddeb, "Call XGetModifierMapping\n");
+  dprintf_info(x11, "Call XGetModifierMapping\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XGetModifierMapping(a0);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XGetModifierMapping\n");
+  dprintf_info(x11, "Ret XGetModifierMapping\n");
   return r;
 }
 
 XImage * TSXCreateImage(Display* a0, Visual* a1, unsigned int a2, int a3, int a4, char* a5, unsigned int a6, unsigned int a7, int a8, int a9)
 {
   XImage * r;
-  dprintf_x11(stddeb, "Call XCreateImage\n");
+  dprintf_info(x11, "Call XCreateImage\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XCreateImage(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XCreateImage\n");
+  dprintf_info(x11, "Ret XCreateImage\n");
   return r;
 }
 
 XImage * TSXGetImage(Display* a0, Drawable a1, int a2, int a3, unsigned int a4, unsigned int a5, unsigned long a6, int a7)
 {
   XImage * r;
-  dprintf_x11(stddeb, "Call XGetImage\n");
+  dprintf_info(x11, "Call XGetImage\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XGetImage(a0, a1, a2, a3, a4, a5, a6, a7);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XGetImage\n");
+  dprintf_info(x11, "Ret XGetImage\n");
   return r;
 }
 
 Display * TSXOpenDisplay(const  char* a0)
 {
   Display * r;
-  dprintf_x11(stddeb, "Call XOpenDisplay\n");
+  dprintf_info(x11, "Call XOpenDisplay\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XOpenDisplay(a0);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XOpenDisplay\n");
+  dprintf_info(x11, "Ret XOpenDisplay\n");
   return r;
 }
 
 void  TSXrmInitialize(void)
 {
-  dprintf_x11(stddeb, "Call XrmInitialize\n");
+  dprintf_info(x11, "Call XrmInitialize\n");
   EnterCriticalSection( &X11DRV_CritSection );
   XrmInitialize();
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XrmInitialize\n");
+  dprintf_info(x11, "Ret XrmInitialize\n");
 }
 
 char * TSXGetAtomName(Display* a0, Atom a1)
 {
   char * r;
-  dprintf_x11(stddeb, "Call XGetAtomName\n");
+  dprintf_info(x11, "Call XGetAtomName\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XGetAtomName(a0, a1);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XGetAtomName\n");
+  dprintf_info(x11, "Ret XGetAtomName\n");
   return r;
 }
 
 char * TSXKeysymToString(KeySym a0)
 {
   char * r;
-  dprintf_x11(stddeb, "Call XKeysymToString\n");
+  dprintf_info(x11, "Call XKeysymToString\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XKeysymToString(a0);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XKeysymToString\n");
+  dprintf_info(x11, "Ret XKeysymToString\n");
   return r;
 }
 
 Atom  TSXInternAtom(Display* a0, const  char* a1, int a2)
 {
   Atom  r;
-  dprintf_x11(stddeb, "Call XInternAtom\n");
+  dprintf_info(x11, "Call XInternAtom\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XInternAtom(a0, a1, a2);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XInternAtom\n");
+  dprintf_info(x11, "Ret XInternAtom\n");
   return r;
 }
 
 Colormap  TSXCreateColormap(Display* a0, Window a1, Visual* a2, int a3)
 {
   Colormap  r;
-  dprintf_x11(stddeb, "Call XCreateColormap\n");
+  dprintf_info(x11, "Call XCreateColormap\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XCreateColormap(a0, a1, a2, a3);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XCreateColormap\n");
+  dprintf_info(x11, "Ret XCreateColormap\n");
   return r;
 }
 
 Cursor  TSXCreatePixmapCursor(Display* a0, Pixmap a1, Pixmap a2, XColor* a3, XColor* a4, unsigned int a5, unsigned int a6)
 {
   Cursor  r;
-  dprintf_x11(stddeb, "Call XCreatePixmapCursor\n");
+  dprintf_info(x11, "Call XCreatePixmapCursor\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XCreatePixmapCursor(a0, a1, a2, a3, a4, a5, a6);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XCreatePixmapCursor\n");
+  dprintf_info(x11, "Ret XCreatePixmapCursor\n");
   return r;
 }
 
 Cursor  TSXCreateFontCursor(Display* a0, unsigned int a1)
 {
   Cursor  r;
-  dprintf_x11(stddeb, "Call XCreateFontCursor\n");
+  dprintf_info(x11, "Call XCreateFontCursor\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XCreateFontCursor(a0, a1);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XCreateFontCursor\n");
+  dprintf_info(x11, "Ret XCreateFontCursor\n");
   return r;
 }
 
 GC  TSXCreateGC(Display* a0, Drawable a1, unsigned long a2, XGCValues* a3)
 {
   GC  r;
-  dprintf_x11(stddeb, "Call XCreateGC\n");
+  dprintf_info(x11, "Call XCreateGC\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XCreateGC(a0, a1, a2, a3);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XCreateGC\n");
+  dprintf_info(x11, "Ret XCreateGC\n");
   return r;
 }
 
 Pixmap  TSXCreatePixmap(Display* a0, Drawable a1, unsigned int a2, unsigned int a3, unsigned int a4)
 {
   Pixmap  r;
-  dprintf_x11(stddeb, "Call XCreatePixmap\n");
+  dprintf_info(x11, "Call XCreatePixmap\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XCreatePixmap(a0, a1, a2, a3, a4);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XCreatePixmap\n");
+  dprintf_info(x11, "Ret XCreatePixmap\n");
   return r;
 }
 
 Pixmap  TSXCreateBitmapFromData(Display* a0, Drawable a1, const  char* a2, unsigned int a3, unsigned int a4)
 {
   Pixmap  r;
-  dprintf_x11(stddeb, "Call XCreateBitmapFromData\n");
+  dprintf_info(x11, "Call XCreateBitmapFromData\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XCreateBitmapFromData(a0, a1, a2, a3, a4);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XCreateBitmapFromData\n");
+  dprintf_info(x11, "Ret XCreateBitmapFromData\n");
   return r;
 }
 
 Window  TSXGetSelectionOwner(Display* a0, Atom a1)
 {
   Window  r;
-  dprintf_x11(stddeb, "Call XGetSelectionOwner\n");
+  dprintf_info(x11, "Call XGetSelectionOwner\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XGetSelectionOwner(a0, a1);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XGetSelectionOwner\n");
+  dprintf_info(x11, "Ret XGetSelectionOwner\n");
   return r;
 }
 
 Window  TSXCreateWindow(Display* a0, Window a1, int a2, int a3, unsigned int a4, unsigned int a5, unsigned int a6, int a7, unsigned int a8, Visual* a9, unsigned long a10, XSetWindowAttributes* a11)
 {
   Window  r;
-  dprintf_x11(stddeb, "Call XCreateWindow\n");
+  dprintf_info(x11, "Call XCreateWindow\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XCreateWindow(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XCreateWindow\n");
+  dprintf_info(x11, "Ret XCreateWindow\n");
   return r;
 }
 
 char ** TSXListFonts(Display* a0, const  char* a1, int a2, int* a3)
 {
   char ** r;
-  dprintf_x11(stddeb, "Call XListFonts\n");
+  dprintf_info(x11, "Call XListFonts\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XListFonts(a0, a1, a2, a3);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XListFonts\n");
+  dprintf_info(x11, "Ret XListFonts\n");
   return r;
 }
 
 KeySym  TSXKeycodeToKeysym(Display* a0, unsigned int a1, int a2)
 {
   KeySym  r;
-  dprintf_x11(stddeb, "Call XKeycodeToKeysym\n");
+  dprintf_info(x11, "Call XKeycodeToKeysym\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XKeycodeToKeysym(a0, a1, a2);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XKeycodeToKeysym\n");
+  dprintf_info(x11, "Ret XKeycodeToKeysym\n");
   return r;
 }
 
 KeySym  TSXLookupKeysym(XKeyEvent* a0, int a1)
 {
   KeySym  r;
-  dprintf_x11(stddeb, "Call XLookupKeysym\n");
+  dprintf_info(x11, "Call XLookupKeysym\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XLookupKeysym(a0, a1);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XLookupKeysym\n");
+  dprintf_info(x11, "Ret XLookupKeysym\n");
   return r;
 }
 
 KeySym * TSXGetKeyboardMapping(Display* a0, unsigned int a1, int a2, int* a3)
 {
   KeySym * r;
-  dprintf_x11(stddeb, "Call XGetKeyboardMapping\n");
+  dprintf_info(x11, "Call XGetKeyboardMapping\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XGetKeyboardMapping(a0, a1, a2, a3);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XGetKeyboardMapping\n");
+  dprintf_info(x11, "Ret XGetKeyboardMapping\n");
   return r;
 }
 
 char * TSXResourceManagerString(Display* a0)
 {
   char * r;
-  dprintf_x11(stddeb, "Call XResourceManagerString\n");
+  dprintf_info(x11, "Call XResourceManagerString\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XResourceManagerString(a0);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XResourceManagerString\n");
+  dprintf_info(x11, "Ret XResourceManagerString\n");
   return r;
 }
 
 int   TSXInitThreads(void)
 {
   int   r;
-  dprintf_x11(stddeb, "Call XInitThreads\n");
+  dprintf_info(x11, "Call XInitThreads\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XInitThreads();
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XInitThreads\n");
+  dprintf_info(x11, "Ret XInitThreads\n");
   return r;
 }
 
 int * TSXListDepths(Display* a0, int a1, int* a2)
 {
   int * r;
-  dprintf_x11(stddeb, "Call XListDepths\n");
+  dprintf_info(x11, "Call XListDepths\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XListDepths(a0, a1, a2);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XListDepths\n");
+  dprintf_info(x11, "Ret XListDepths\n");
   return r;
 }
 
 int   TSXReconfigureWMWindow(Display* a0, Window a1, int a2, unsigned int a3, XWindowChanges* a4)
 {
   int   r;
-  dprintf_x11(stddeb, "Call XReconfigureWMWindow\n");
+  dprintf_info(x11, "Call XReconfigureWMWindow\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XReconfigureWMWindow(a0, a1, a2, a3, a4);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XReconfigureWMWindow\n");
+  dprintf_info(x11, "Ret XReconfigureWMWindow\n");
   return r;
 }
 
 int   TSXSetWMProtocols(Display* a0, Window a1, Atom* a2, int a3)
 {
   int   r;
-  dprintf_x11(stddeb, "Call XSetWMProtocols\n");
+  dprintf_info(x11, "Call XSetWMProtocols\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XSetWMProtocols(a0, a1, a2, a3);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XSetWMProtocols\n");
+  dprintf_info(x11, "Ret XSetWMProtocols\n");
   return r;
 }
 
 int  TSXSetTransientForHint(Display* a0, Window a1, Window a2)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XSetTransientForHint\n");
+  dprintf_info(x11, "Call XSetTransientForHint\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XSetTransientForHint(a0, a1, a2);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XSetTransientForHint\n");
+  dprintf_info(x11, "Ret XSetTransientForHint\n");
   return r;
 }
 
 int  TSXActivateScreenSaver(Display* a0)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XActivateScreenSaver\n");
+  dprintf_info(x11, "Call XActivateScreenSaver\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XActivateScreenSaver(a0);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XActivateScreenSaver\n");
+  dprintf_info(x11, "Ret XActivateScreenSaver\n");
   return r;
 }
 
 int   TSXAllocColor(Display* a0, Colormap a1, XColor* a2)
 {
   int   r;
-  dprintf_x11(stddeb, "Call XAllocColor\n");
+  dprintf_info(x11, "Call XAllocColor\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XAllocColor(a0, a1, a2);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XAllocColor\n");
+  dprintf_info(x11, "Ret XAllocColor\n");
   return r;
 }
 
 int   TSXAllocColorCells(Display* a0, Colormap a1, int a2, unsigned long* a3, unsigned int a4, unsigned long* a5, unsigned int a6)
 {
   int   r;
-  dprintf_x11(stddeb, "Call XAllocColorCells\n");
+  dprintf_info(x11, "Call XAllocColorCells\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XAllocColorCells(a0, a1, a2, a3, a4, a5, a6);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XAllocColorCells\n");
+  dprintf_info(x11, "Ret XAllocColorCells\n");
   return r;
 }
 
 int  TSXBell(Display* a0, int a1)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XBell\n");
+  dprintf_info(x11, "Call XBell\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XBell(a0, a1);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XBell\n");
+  dprintf_info(x11, "Ret XBell\n");
   return r;
 }
 
 int  TSXChangeGC(Display* a0, GC a1, unsigned long a2, XGCValues* a3)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XChangeGC\n");
+  dprintf_info(x11, "Call XChangeGC\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XChangeGC(a0, a1, a2, a3);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XChangeGC\n");
+  dprintf_info(x11, "Ret XChangeGC\n");
   return r;
 }
 
 int  TSXChangeKeyboardControl(Display* a0, unsigned long a1, XKeyboardControl* a2)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XChangeKeyboardControl\n");
+  dprintf_info(x11, "Call XChangeKeyboardControl\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XChangeKeyboardControl(a0, a1, a2);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XChangeKeyboardControl\n");
+  dprintf_info(x11, "Ret XChangeKeyboardControl\n");
   return r;
 }
 
 int  TSXChangeProperty(Display* a0, Window a1, Atom a2, Atom a3, int a4, int a5, const  unsigned char* a6, int a7)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XChangeProperty\n");
+  dprintf_info(x11, "Call XChangeProperty\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XChangeProperty(a0, a1, a2, a3, a4, a5, a6, a7);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XChangeProperty\n");
+  dprintf_info(x11, "Ret XChangeProperty\n");
   return r;
 }
 
 int  TSXChangeWindowAttributes(Display* a0, Window a1, unsigned long a2, XSetWindowAttributes* a3)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XChangeWindowAttributes\n");
+  dprintf_info(x11, "Call XChangeWindowAttributes\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XChangeWindowAttributes(a0, a1, a2, a3);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XChangeWindowAttributes\n");
+  dprintf_info(x11, "Ret XChangeWindowAttributes\n");
   return r;
 }
 
 int   TSXCheckTypedWindowEvent(Display* a0, Window a1, int a2, XEvent* a3)
 {
   int   r;
-  dprintf_x11(stddeb, "Call XCheckTypedWindowEvent\n");
+  dprintf_info(x11, "Call XCheckTypedWindowEvent\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XCheckTypedWindowEvent(a0, a1, a2, a3);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XCheckTypedWindowEvent\n");
+  dprintf_info(x11, "Ret XCheckTypedWindowEvent\n");
   return r;
 }
 
 int   TSXCheckWindowEvent(Display* a0, Window a1, long a2, XEvent* a3)
 {
   int   r;
-  dprintf_x11(stddeb, "Call XCheckWindowEvent\n");
+  dprintf_info(x11, "Call XCheckWindowEvent\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XCheckWindowEvent(a0, a1, a2, a3);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XCheckWindowEvent\n");
+  dprintf_info(x11, "Ret XCheckWindowEvent\n");
   return r;
 }
 
 int  TSXConvertSelection(Display* a0, Atom a1, Atom a2, Atom a3, Window a4, Time a5)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XConvertSelection\n");
+  dprintf_info(x11, "Call XConvertSelection\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XConvertSelection(a0, a1, a2, a3, a4, a5);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XConvertSelection\n");
+  dprintf_info(x11, "Ret XConvertSelection\n");
   return r;
 }
 
 int  TSXCopyArea(Display* a0, Drawable a1, Drawable a2, GC a3, int a4, int a5, unsigned int a6, unsigned int a7, int a8, int a9)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XCopyArea\n");
+  dprintf_info(x11, "Call XCopyArea\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XCopyArea(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XCopyArea\n");
+  dprintf_info(x11, "Ret XCopyArea\n");
   return r;
 }
 
 int  TSXCopyPlane(Display* a0, Drawable a1, Drawable a2, GC a3, int a4, int a5, unsigned int a6, unsigned int a7, int a8, int a9, unsigned long a10)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XCopyPlane\n");
+  dprintf_info(x11, "Call XCopyPlane\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XCopyPlane(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XCopyPlane\n");
+  dprintf_info(x11, "Ret XCopyPlane\n");
   return r;
 }
 
 int  TSXDefineCursor(Display* a0, Window a1, Cursor a2)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XDefineCursor\n");
+  dprintf_info(x11, "Call XDefineCursor\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XDefineCursor(a0, a1, a2);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XDefineCursor\n");
+  dprintf_info(x11, "Ret XDefineCursor\n");
   return r;
 }
 
 int  TSXDestroyWindow(Display* a0, Window a1)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XDestroyWindow\n");
+  dprintf_info(x11, "Call XDestroyWindow\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XDestroyWindow(a0, a1);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XDestroyWindow\n");
+  dprintf_info(x11, "Ret XDestroyWindow\n");
   return r;
 }
 
 int  TSXDisplayKeycodes(Display* a0, int* a1, int* a2)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XDisplayKeycodes\n");
+  dprintf_info(x11, "Call XDisplayKeycodes\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XDisplayKeycodes(a0, a1, a2);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XDisplayKeycodes\n");
+  dprintf_info(x11, "Ret XDisplayKeycodes\n");
   return r;
 }
 
 int  TSXDrawArc(Display* a0, Drawable a1, GC a2, int a3, int a4, unsigned int a5, unsigned int a6, int a7, int a8)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XDrawArc\n");
+  dprintf_info(x11, "Call XDrawArc\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XDrawArc(a0, a1, a2, a3, a4, a5, a6, a7, a8);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XDrawArc\n");
+  dprintf_info(x11, "Ret XDrawArc\n");
   return r;
 }
 
 int  TSXDrawLine(Display* a0, Drawable a1, GC a2, int a3, int a4, int a5, int a6)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XDrawLine\n");
+  dprintf_info(x11, "Call XDrawLine\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XDrawLine(a0, a1, a2, a3, a4, a5, a6);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XDrawLine\n");
+  dprintf_info(x11, "Ret XDrawLine\n");
   return r;
 }
 
 int  TSXDrawLines(Display* a0, Drawable a1, GC a2, XPoint* a3, int a4, int a5)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XDrawLines\n");
+  dprintf_info(x11, "Call XDrawLines\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XDrawLines(a0, a1, a2, a3, a4, a5);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XDrawLines\n");
+  dprintf_info(x11, "Ret XDrawLines\n");
   return r;
 }
 
 int  TSXDrawPoint(Display* a0, Drawable a1, GC a2, int a3, int a4)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XDrawPoint\n");
+  dprintf_info(x11, "Call XDrawPoint\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XDrawPoint(a0, a1, a2, a3, a4);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XDrawPoint\n");
+  dprintf_info(x11, "Ret XDrawPoint\n");
   return r;
 }
 
 int  TSXDrawRectangle(Display* a0, Drawable a1, GC a2, int a3, int a4, unsigned int a5, unsigned int a6)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XDrawRectangle\n");
+  dprintf_info(x11, "Call XDrawRectangle\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XDrawRectangle(a0, a1, a2, a3, a4, a5, a6);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XDrawRectangle\n");
+  dprintf_info(x11, "Ret XDrawRectangle\n");
   return r;
 }
 
 int  TSXDrawSegments(Display* a0, Drawable a1, GC a2, XSegment* a3, int a4)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XDrawSegments\n");
+  dprintf_info(x11, "Call XDrawSegments\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XDrawSegments(a0, a1, a2, a3, a4);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XDrawSegments\n");
+  dprintf_info(x11, "Ret XDrawSegments\n");
   return r;
 }
 
 int  TSXDrawString(Display* a0, Drawable a1, GC a2, int a3, int a4, const  char* a5, int a6)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XDrawString\n");
+  dprintf_info(x11, "Call XDrawString\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XDrawString(a0, a1, a2, a3, a4, a5, a6);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XDrawString\n");
+  dprintf_info(x11, "Ret XDrawString\n");
   return r;
 }
 
 int  TSXDrawText(Display* a0, Drawable a1, GC a2, int a3, int a4, XTextItem* a5, int a6)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XDrawText\n");
+  dprintf_info(x11, "Call XDrawText\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XDrawText(a0, a1, a2, a3, a4, a5, a6);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XDrawText\n");
+  dprintf_info(x11, "Ret XDrawText\n");
   return r;
 }
 
 int  TSXFillArc(Display* a0, Drawable a1, GC a2, int a3, int a4, unsigned int a5, unsigned int a6, int a7, int a8)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XFillArc\n");
+  dprintf_info(x11, "Call XFillArc\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XFillArc(a0, a1, a2, a3, a4, a5, a6, a7, a8);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XFillArc\n");
+  dprintf_info(x11, "Ret XFillArc\n");
   return r;
 }
 
 int  TSXFillPolygon(Display* a0, Drawable a1, GC a2, XPoint* a3, int a4, int a5, int a6)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XFillPolygon\n");
+  dprintf_info(x11, "Call XFillPolygon\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XFillPolygon(a0, a1, a2, a3, a4, a5, a6);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XFillPolygon\n");
+  dprintf_info(x11, "Ret XFillPolygon\n");
   return r;
 }
 
 int  TSXFillRectangle(Display* a0, Drawable a1, GC a2, int a3, int a4, unsigned int a5, unsigned int a6)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XFillRectangle\n");
+  dprintf_info(x11, "Call XFillRectangle\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XFillRectangle(a0, a1, a2, a3, a4, a5, a6);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XFillRectangle\n");
+  dprintf_info(x11, "Ret XFillRectangle\n");
   return r;
 }
 
 int  TSXFlush(Display* a0)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XFlush\n");
+  dprintf_info(x11, "Call XFlush\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XFlush(a0);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XFlush\n");
+  dprintf_info(x11, "Ret XFlush\n");
   return r;
 }
 
 int  TSXFree(void* a0)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XFree\n");
+  dprintf_info(x11, "Call XFree\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XFree(a0);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XFree\n");
+  dprintf_info(x11, "Ret XFree\n");
   return r;
 }
 
 int  TSXFreeColormap(Display* a0, Colormap a1)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XFreeColormap\n");
+  dprintf_info(x11, "Call XFreeColormap\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XFreeColormap(a0, a1);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XFreeColormap\n");
+  dprintf_info(x11, "Ret XFreeColormap\n");
   return r;
 }
 
 int  TSXFreeColors(Display* a0, Colormap a1, unsigned long* a2, int a3, unsigned long a4)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XFreeColors\n");
+  dprintf_info(x11, "Call XFreeColors\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XFreeColors(a0, a1, a2, a3, a4);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XFreeColors\n");
+  dprintf_info(x11, "Ret XFreeColors\n");
   return r;
 }
 
 int  TSXFreeCursor(Display* a0, Cursor a1)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XFreeCursor\n");
+  dprintf_info(x11, "Call XFreeCursor\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XFreeCursor(a0, a1);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XFreeCursor\n");
+  dprintf_info(x11, "Ret XFreeCursor\n");
   return r;
 }
 
 int  TSXFreeFont(Display* a0, XFontStruct* a1)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XFreeFont\n");
+  dprintf_info(x11, "Call XFreeFont\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XFreeFont(a0, a1);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XFreeFont\n");
+  dprintf_info(x11, "Ret XFreeFont\n");
   return r;
 }
 
 int  TSXFreeFontNames(char** a0)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XFreeFontNames\n");
+  dprintf_info(x11, "Call XFreeFontNames\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XFreeFontNames(a0);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XFreeFontNames\n");
+  dprintf_info(x11, "Ret XFreeFontNames\n");
   return r;
 }
 
 int  TSXFreeGC(Display* a0, GC a1)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XFreeGC\n");
+  dprintf_info(x11, "Call XFreeGC\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XFreeGC(a0, a1);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XFreeGC\n");
+  dprintf_info(x11, "Ret XFreeGC\n");
   return r;
 }
 
 int  TSXFreeModifiermap(XModifierKeymap* a0)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XFreeModifiermap\n");
+  dprintf_info(x11, "Call XFreeModifiermap\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XFreeModifiermap(a0);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XFreeModifiermap\n");
+  dprintf_info(x11, "Ret XFreeModifiermap\n");
   return r;
 }
 
 int  TSXFreePixmap(Display* a0, Pixmap a1)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XFreePixmap\n");
+  dprintf_info(x11, "Call XFreePixmap\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XFreePixmap(a0, a1);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XFreePixmap\n");
+  dprintf_info(x11, "Ret XFreePixmap\n");
   return r;
 }
 
 int   TSXGetFontProperty(XFontStruct* a0, Atom a1, unsigned long* a2)
 {
   int   r;
-  dprintf_x11(stddeb, "Call XGetFontProperty\n");
+  dprintf_info(x11, "Call XGetFontProperty\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XGetFontProperty(a0, a1, a2);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XGetFontProperty\n");
+  dprintf_info(x11, "Ret XGetFontProperty\n");
   return r;
 }
 
 int   TSXGetGeometry(Display* a0, Drawable a1, Window* a2, int* a3, int* a4, unsigned int* a5, unsigned int* a6, unsigned int* a7, unsigned int* a8)
 {
   int   r;
-  dprintf_x11(stddeb, "Call XGetGeometry\n");
+  dprintf_info(x11, "Call XGetGeometry\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XGetGeometry(a0, a1, a2, a3, a4, a5, a6, a7, a8);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XGetGeometry\n");
+  dprintf_info(x11, "Ret XGetGeometry\n");
   return r;
 }
 
 int  TSXGetInputFocus(Display* a0, Window* a1, int* a2)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XGetInputFocus\n");
+  dprintf_info(x11, "Call XGetInputFocus\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XGetInputFocus(a0, a1, a2);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XGetInputFocus\n");
+  dprintf_info(x11, "Ret XGetInputFocus\n");
   return r;
 }
 
 int  TSXGetKeyboardControl(Display* a0, XKeyboardState* a1)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XGetKeyboardControl\n");
+  dprintf_info(x11, "Call XGetKeyboardControl\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XGetKeyboardControl(a0, a1);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XGetKeyboardControl\n");
+  dprintf_info(x11, "Ret XGetKeyboardControl\n");
   return r;
 }
 
 int  TSXGetScreenSaver(Display* a0, int* a1, int* a2, int* a3, int* a4)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XGetScreenSaver\n");
+  dprintf_info(x11, "Call XGetScreenSaver\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XGetScreenSaver(a0, a1, a2, a3, a4);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XGetScreenSaver\n");
+  dprintf_info(x11, "Ret XGetScreenSaver\n");
   return r;
 }
 
 int  TSXGetWindowProperty(Display* a0, Window a1, Atom a2, long a3, long a4, int a5, Atom a6, Atom* a7, int* a8, unsigned long* a9, unsigned long* a10, unsigned char** a11)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XGetWindowProperty\n");
+  dprintf_info(x11, "Call XGetWindowProperty\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XGetWindowProperty(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XGetWindowProperty\n");
+  dprintf_info(x11, "Ret XGetWindowProperty\n");
   return r;
 }
 
 int   TSXGetWindowAttributes(Display* a0, Window a1, XWindowAttributes* a2)
 {
   int   r;
-  dprintf_x11(stddeb, "Call XGetWindowAttributes\n");
+  dprintf_info(x11, "Call XGetWindowAttributes\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XGetWindowAttributes(a0, a1, a2);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XGetWindowAttributes\n");
+  dprintf_info(x11, "Ret XGetWindowAttributes\n");
   return r;
 }
 
 int  TSXGrabPointer(Display* a0, Window a1, int a2, unsigned int a3, int a4, int a5, Window a6, Cursor a7, Time a8)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XGrabPointer\n");
+  dprintf_info(x11, "Call XGrabPointer\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XGrabPointer(a0, a1, a2, a3, a4, a5, a6, a7, a8);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XGrabPointer\n");
+  dprintf_info(x11, "Ret XGrabPointer\n");
   return r;
 }
 
 int  TSXGrabServer(Display* a0)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XGrabServer\n");
+  dprintf_info(x11, "Call XGrabServer\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XGrabServer(a0);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XGrabServer\n");
+  dprintf_info(x11, "Ret XGrabServer\n");
   return r;
 }
 
 int  TSXInstallColormap(Display* a0, Colormap a1)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XInstallColormap\n");
+  dprintf_info(x11, "Call XInstallColormap\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XInstallColormap(a0, a1);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XInstallColormap\n");
+  dprintf_info(x11, "Ret XInstallColormap\n");
   return r;
 }
 
 KeyCode  TSXKeysymToKeycode(Display* a0, KeySym a1)
 {
   KeyCode  r;
-  dprintf_x11(stddeb, "Call XKeysymToKeycode\n");
+  dprintf_info(x11, "Call XKeysymToKeycode\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XKeysymToKeycode(a0, a1);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XKeysymToKeycode\n");
+  dprintf_info(x11, "Ret XKeysymToKeycode\n");
   return r;
 }
 
 int  TSXMapWindow(Display* a0, Window a1)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XMapWindow\n");
+  dprintf_info(x11, "Call XMapWindow\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XMapWindow(a0, a1);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XMapWindow\n");
+  dprintf_info(x11, "Ret XMapWindow\n");
   return r;
 }
 
 int  TSXNextEvent(Display* a0, XEvent* a1)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XNextEvent\n");
+  dprintf_info(x11, "Call XNextEvent\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XNextEvent(a0, a1);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XNextEvent\n");
+  dprintf_info(x11, "Ret XNextEvent\n");
   return r;
 }
 
 int  TSXParseGeometry(const  char* a0, int* a1, int* a2, unsigned int* a3, unsigned int* a4)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XParseGeometry\n");
+  dprintf_info(x11, "Call XParseGeometry\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XParseGeometry(a0, a1, a2, a3, a4);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XParseGeometry\n");
+  dprintf_info(x11, "Ret XParseGeometry\n");
   return r;
 }
 
 int  TSXPending(Display* a0)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XPending\n");
+  dprintf_info(x11, "Call XPending\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XPending(a0);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XPending\n");
+  dprintf_info(x11, "Ret XPending\n");
   return r;
 }
 
 int  TSXPutBackEvent(Display* a0, XEvent* a1)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XPutBackEvent\n");
+  dprintf_info(x11, "Call XPutBackEvent\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XPutBackEvent(a0, a1);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XPutBackEvent\n");
+  dprintf_info(x11, "Ret XPutBackEvent\n");
   return r;
 }
 
 int  TSXPutImage(Display* a0, Drawable a1, GC a2, XImage* a3, int a4, int a5, int a6, int a7, unsigned int a8, unsigned int a9)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XPutImage\n");
+  dprintf_info(x11, "Call XPutImage\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XPutImage(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XPutImage\n");
+  dprintf_info(x11, "Ret XPutImage\n");
   return r;
 }
 
 int  TSXQueryColor(Display* a0, Colormap a1, XColor* a2)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XQueryColor\n");
+  dprintf_info(x11, "Call XQueryColor\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XQueryColor(a0, a1, a2);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XQueryColor\n");
+  dprintf_info(x11, "Ret XQueryColor\n");
   return r;
 }
 
 int   TSXQueryPointer(Display* a0, Window a1, Window* a2, Window* a3, int* a4, int* a5, int* a6, int* a7, unsigned int* a8)
 {
   int   r;
-  dprintf_x11(stddeb, "Call XQueryPointer\n");
+  dprintf_info(x11, "Call XQueryPointer\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XQueryPointer(a0, a1, a2, a3, a4, a5, a6, a7, a8);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XQueryPointer\n");
+  dprintf_info(x11, "Ret XQueryPointer\n");
   return r;
 }
 
 int   TSXQueryTree(Display* a0, Window a1, Window* a2, Window* a3, Window** a4, unsigned int* a5)
 {
   int   r;
-  dprintf_x11(stddeb, "Call XQueryTree\n");
+  dprintf_info(x11, "Call XQueryTree\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XQueryTree(a0, a1, a2, a3, a4, a5);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XQueryTree\n");
+  dprintf_info(x11, "Ret XQueryTree\n");
   return r;
 }
 
 int  TSXResetScreenSaver(Display* a0)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XResetScreenSaver\n");
+  dprintf_info(x11, "Call XResetScreenSaver\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XResetScreenSaver(a0);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XResetScreenSaver\n");
+  dprintf_info(x11, "Ret XResetScreenSaver\n");
   return r;
 }
 
 int  TSXRestackWindows(Display* a0, Window* a1, int a2)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XRestackWindows\n");
+  dprintf_info(x11, "Call XRestackWindows\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XRestackWindows(a0, a1, a2);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XRestackWindows\n");
+  dprintf_info(x11, "Ret XRestackWindows\n");
   return r;
 }
 
 int   TSXSendEvent(Display* a0, Window a1, int a2, long a3, XEvent* a4)
 {
   int   r;
-  dprintf_x11(stddeb, "Call XSendEvent\n");
+  dprintf_info(x11, "Call XSendEvent\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XSendEvent(a0, a1, a2, a3, a4);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XSendEvent\n");
+  dprintf_info(x11, "Ret XSendEvent\n");
   return r;
 }
 
 int  TSXSetArcMode(Display* a0, GC a1, int a2)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XSetArcMode\n");
+  dprintf_info(x11, "Call XSetArcMode\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XSetArcMode(a0, a1, a2);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XSetArcMode\n");
+  dprintf_info(x11, "Ret XSetArcMode\n");
   return r;
 }
 
 int  TSXSetBackground(Display* a0, GC a1, unsigned long a2)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XSetBackground\n");
+  dprintf_info(x11, "Call XSetBackground\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XSetBackground(a0, a1, a2);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XSetBackground\n");
+  dprintf_info(x11, "Ret XSetBackground\n");
   return r;
 }
 
 int  TSXSetClipMask(Display* a0, GC a1, Pixmap a2)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XSetClipMask\n");
+  dprintf_info(x11, "Call XSetClipMask\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XSetClipMask(a0, a1, a2);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XSetClipMask\n");
+  dprintf_info(x11, "Ret XSetClipMask\n");
   return r;
 }
 
 int  TSXSetClipOrigin(Display* a0, GC a1, int a2, int a3)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XSetClipOrigin\n");
+  dprintf_info(x11, "Call XSetClipOrigin\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XSetClipOrigin(a0, a1, a2, a3);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XSetClipOrigin\n");
+  dprintf_info(x11, "Ret XSetClipOrigin\n");
   return r;
 }
 
 int  TSXSetClipRectangles(Display* a0, GC a1, int a2, int a3, XRectangle* a4, int a5, int a6)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XSetClipRectangles\n");
+  dprintf_info(x11, "Call XSetClipRectangles\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XSetClipRectangles(a0, a1, a2, a3, a4, a5, a6);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XSetClipRectangles\n");
+  dprintf_info(x11, "Ret XSetClipRectangles\n");
   return r;
 }
 
 int  TSXSetDashes(Display* a0, GC a1, int a2, const  char* a3, int a4)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XSetDashes\n");
+  dprintf_info(x11, "Call XSetDashes\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XSetDashes(a0, a1, a2, a3, a4);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XSetDashes\n");
+  dprintf_info(x11, "Ret XSetDashes\n");
   return r;
 }
 
 int  TSXSetFillStyle(Display* a0, GC a1, int a2)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XSetFillStyle\n");
+  dprintf_info(x11, "Call XSetFillStyle\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XSetFillStyle(a0, a1, a2);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XSetFillStyle\n");
+  dprintf_info(x11, "Ret XSetFillStyle\n");
   return r;
 }
 
 int  TSXSetForeground(Display* a0, GC a1, unsigned long a2)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XSetForeground\n");
+  dprintf_info(x11, "Call XSetForeground\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XSetForeground(a0, a1, a2);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XSetForeground\n");
+  dprintf_info(x11, "Ret XSetForeground\n");
   return r;
 }
 
 int  TSXSetFunction(Display* a0, GC a1, int a2)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XSetFunction\n");
+  dprintf_info(x11, "Call XSetFunction\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XSetFunction(a0, a1, a2);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XSetFunction\n");
+  dprintf_info(x11, "Ret XSetFunction\n");
   return r;
 }
 
 int  TSXSetGraphicsExposures(Display* a0, GC a1, int a2)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XSetGraphicsExposures\n");
+  dprintf_info(x11, "Call XSetGraphicsExposures\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XSetGraphicsExposures(a0, a1, a2);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XSetGraphicsExposures\n");
+  dprintf_info(x11, "Ret XSetGraphicsExposures\n");
   return r;
 }
 
 int  TSXSetIconName(Display* a0, Window a1, const  char* a2)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XSetIconName\n");
+  dprintf_info(x11, "Call XSetIconName\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XSetIconName(a0, a1, a2);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XSetIconName\n");
+  dprintf_info(x11, "Ret XSetIconName\n");
   return r;
 }
 
 int  TSXSetInputFocus(Display* a0, Window a1, int a2, Time a3)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XSetInputFocus\n");
+  dprintf_info(x11, "Call XSetInputFocus\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XSetInputFocus(a0, a1, a2, a3);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XSetInputFocus\n");
+  dprintf_info(x11, "Ret XSetInputFocus\n");
   return r;
 }
 
 int  TSXSetLineAttributes(Display* a0, GC a1, unsigned int a2, int a3, int a4, int a5)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XSetLineAttributes\n");
+  dprintf_info(x11, "Call XSetLineAttributes\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XSetLineAttributes(a0, a1, a2, a3, a4, a5);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XSetLineAttributes\n");
+  dprintf_info(x11, "Ret XSetLineAttributes\n");
   return r;
 }
 
 int  TSXSetScreenSaver(Display* a0, int a1, int a2, int a3, int a4)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XSetScreenSaver\n");
+  dprintf_info(x11, "Call XSetScreenSaver\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XSetScreenSaver(a0, a1, a2, a3, a4);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XSetScreenSaver\n");
+  dprintf_info(x11, "Ret XSetScreenSaver\n");
   return r;
 }
 
 int  TSXSetSelectionOwner(Display* a0, Atom a1, Window a2, Time a3)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XSetSelectionOwner\n");
+  dprintf_info(x11, "Call XSetSelectionOwner\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XSetSelectionOwner(a0, a1, a2, a3);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XSetSelectionOwner\n");
+  dprintf_info(x11, "Ret XSetSelectionOwner\n");
   return r;
 }
 
 int  TSXSetSubwindowMode(Display* a0, GC a1, int a2)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XSetSubwindowMode\n");
+  dprintf_info(x11, "Call XSetSubwindowMode\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XSetSubwindowMode(a0, a1, a2);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XSetSubwindowMode\n");
+  dprintf_info(x11, "Ret XSetSubwindowMode\n");
   return r;
 }
 
 int  TSXStoreColor(Display* a0, Colormap a1, XColor* a2)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XStoreColor\n");
+  dprintf_info(x11, "Call XStoreColor\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XStoreColor(a0, a1, a2);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XStoreColor\n");
+  dprintf_info(x11, "Ret XStoreColor\n");
   return r;
 }
 
 int  TSXStoreName(Display* a0, Window a1, const  char* a2)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XStoreName\n");
+  dprintf_info(x11, "Call XStoreName\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XStoreName(a0, a1, a2);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XStoreName\n");
+  dprintf_info(x11, "Ret XStoreName\n");
   return r;
 }
 
 int  TSXSync(Display* a0, int a1)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XSync\n");
+  dprintf_info(x11, "Call XSync\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XSync(a0, a1);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XSync\n");
+  dprintf_info(x11, "Ret XSync\n");
   return r;
 }
 
 int  TSXTextExtents(XFontStruct* a0, const  char* a1, int a2, int* a3, int* a4, int* a5, XCharStruct* a6)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XTextExtents\n");
+  dprintf_info(x11, "Call XTextExtents\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XTextExtents(a0, a1, a2, a3, a4, a5, a6);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XTextExtents\n");
+  dprintf_info(x11, "Ret XTextExtents\n");
   return r;
 }
 
 int  TSXTextWidth(XFontStruct* a0, const  char* a1, int a2)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XTextWidth\n");
+  dprintf_info(x11, "Call XTextWidth\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XTextWidth(a0, a1, a2);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XTextWidth\n");
+  dprintf_info(x11, "Ret XTextWidth\n");
   return r;
 }
 
 int  TSXUngrabPointer(Display* a0, Time a1)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XUngrabPointer\n");
+  dprintf_info(x11, "Call XUngrabPointer\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XUngrabPointer(a0, a1);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XUngrabPointer\n");
+  dprintf_info(x11, "Ret XUngrabPointer\n");
   return r;
 }
 
 int  TSXUngrabServer(Display* a0)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XUngrabServer\n");
+  dprintf_info(x11, "Call XUngrabServer\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XUngrabServer(a0);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XUngrabServer\n");
+  dprintf_info(x11, "Ret XUngrabServer\n");
   return r;
 }
 
 int  TSXUninstallColormap(Display* a0, Colormap a1)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XUninstallColormap\n");
+  dprintf_info(x11, "Call XUninstallColormap\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XUninstallColormap(a0, a1);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XUninstallColormap\n");
+  dprintf_info(x11, "Ret XUninstallColormap\n");
   return r;
 }
 
 int  TSXUnmapWindow(Display* a0, Window a1)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XUnmapWindow\n");
+  dprintf_info(x11, "Call XUnmapWindow\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XUnmapWindow(a0, a1);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XUnmapWindow\n");
+  dprintf_info(x11, "Ret XUnmapWindow\n");
   return r;
 }
 
 int  TSXWarpPointer(Display* a0, Window a1, Window a2, int a3, int a4, unsigned int a5, unsigned int a6, int a7, int a8)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XWarpPointer\n");
+  dprintf_info(x11, "Call XWarpPointer\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XWarpPointer(a0, a1, a2, a3, a4, a5, a6, a7, a8);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XWarpPointer\n");
+  dprintf_info(x11, "Ret XWarpPointer\n");
   return r;
 }
 
 int (*TSXSynchronize(Display *a0, Bool a1))(Display *)
 {
   int (*r)(Display *);
-  dprintf_x11(stddeb, "Call XSynchronize\n");
+  dprintf_info(x11, "Call XSynchronize\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XSynchronize(a0, a1);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XSynchronize\n");
+  dprintf_info(x11, "Ret XSynchronize\n");
   return r;
 }
 
@@ -1265,9 +1264,9 @@
 
 void TS_XInitImageFuncPtrs(XImage *a0)
 {
-  dprintf_x11(stddeb, "Call _XInitImageFuncPtrs\n");
+  dprintf_info(x11, "Call _XInitImageFuncPtrs\n");
   EnterCriticalSection( &X11DRV_CritSection );
   _XInitImageFuncPtrs(a0);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret _XInitImageFuncPtrs\n");
+  dprintf_info(x11, "Ret _XInitImageFuncPtrs\n");
 }
diff --git a/tsx11/ts_xpm.c b/tsx11/ts_xpm.c
index 26b2dc9..9ef6d9c 100644
--- a/tsx11/ts_xpm.c
+++ b/tsx11/ts_xpm.c
@@ -6,27 +6,26 @@
 
 #include <X11/xpm.h>
 #include "x11drv.h"
-#include "stddebug.h"
 #include "debug.h"
 
 int TSXpmCreatePixmapFromData(Display *a0, Drawable a1, char **a2, Pixmap *a3, Pixmap *a4, XpmAttributes *a5)
 {
   int r;
-  dprintf_x11(stddeb, "Call XpmCreatePixmapFromData\n");
+  dprintf_info(x11, "Call XpmCreatePixmapFromData\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XpmCreatePixmapFromData(a0, a1, a2, a3, a4, a5);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XpmCreatePixmapFromData\n");
+  dprintf_info(x11, "Ret XpmCreatePixmapFromData\n");
   return r;
 }
 
 int TSXpmAttributesSize(void)
 {
   int r;
-  dprintf_x11(stddeb, "Call XpmAttributesSize\n");
+  dprintf_info(x11, "Call XpmAttributesSize\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XpmAttributesSize();
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XpmAttributesSize\n");
+  dprintf_info(x11, "Ret XpmAttributesSize\n");
   return r;
 }
diff --git a/tsx11/ts_xresource.c b/tsx11/ts_xresource.c
index 4eda899..b272b1e 100644
--- a/tsx11/ts_xresource.c
+++ b/tsx11/ts_xresource.c
@@ -7,67 +7,66 @@
 #include <X11/Xlib.h>
 #include <X11/Xresource.h>
 #include "x11drv.h"
-#include "stddebug.h"
 #include "debug.h"
 
 XrmQuark  TSXrmUniqueQuark(void)
 {
   XrmQuark  r;
-  dprintf_x11(stddeb, "Call XrmUniqueQuark\n");
+  dprintf_info(x11, "Call XrmUniqueQuark\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XrmUniqueQuark();
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XrmUniqueQuark\n");
+  dprintf_info(x11, "Ret XrmUniqueQuark\n");
   return r;
 }
 
 int   TSXrmGetResource(XrmDatabase a0, const  char* a1, const  char* a2, char** a3, XrmValue* a4)
 {
   int   r;
-  dprintf_x11(stddeb, "Call XrmGetResource\n");
+  dprintf_info(x11, "Call XrmGetResource\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XrmGetResource(a0, a1, a2, a3, a4);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XrmGetResource\n");
+  dprintf_info(x11, "Ret XrmGetResource\n");
   return r;
 }
 
 XrmDatabase  TSXrmGetFileDatabase(const  char* a0)
 {
   XrmDatabase  r;
-  dprintf_x11(stddeb, "Call XrmGetFileDatabase\n");
+  dprintf_info(x11, "Call XrmGetFileDatabase\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XrmGetFileDatabase(a0);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XrmGetFileDatabase\n");
+  dprintf_info(x11, "Ret XrmGetFileDatabase\n");
   return r;
 }
 
 XrmDatabase  TSXrmGetStringDatabase(const  char* a0)
 {
   XrmDatabase  r;
-  dprintf_x11(stddeb, "Call XrmGetStringDatabase\n");
+  dprintf_info(x11, "Call XrmGetStringDatabase\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XrmGetStringDatabase(a0);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XrmGetStringDatabase\n");
+  dprintf_info(x11, "Ret XrmGetStringDatabase\n");
   return r;
 }
 
 void  TSXrmMergeDatabases(XrmDatabase a0, XrmDatabase* a1)
 {
-  dprintf_x11(stddeb, "Call XrmMergeDatabases\n");
+  dprintf_info(x11, "Call XrmMergeDatabases\n");
   EnterCriticalSection( &X11DRV_CritSection );
   XrmMergeDatabases(a0, a1);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XrmMergeDatabases\n");
+  dprintf_info(x11, "Ret XrmMergeDatabases\n");
 }
 
 void  TSXrmParseCommand(XrmDatabase* a0, XrmOptionDescList a1, int a2, const  char* a3, int* a4, char** a5)
 {
-  dprintf_x11(stddeb, "Call XrmParseCommand\n");
+  dprintf_info(x11, "Call XrmParseCommand\n");
   EnterCriticalSection( &X11DRV_CritSection );
   XrmParseCommand(a0, a1, a2, a3, a4, a5);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XrmParseCommand\n");
+  dprintf_info(x11, "Ret XrmParseCommand\n");
 }
diff --git a/tsx11/ts_xshm.c b/tsx11/ts_xshm.c
index ff5ee60..9892f8f 100644
--- a/tsx11/ts_xshm.c
+++ b/tsx11/ts_xshm.c
@@ -7,49 +7,48 @@
 #include <X11/Xlib.h>
 #include <X11/extensions/XShm.h>
 #include "x11drv.h"
-#include "stddebug.h"
 #include "debug.h"
 
 Bool TSXShmQueryExtension(Display *a0)
 {
   Bool r;
-  dprintf_x11(stddeb, "Call XShmQueryExtension\n");
+  dprintf_info(x11, "Call XShmQueryExtension\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XShmQueryExtension(a0);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XShmQueryExtension\n");
+  dprintf_info(x11, "Ret XShmQueryExtension\n");
   return r;
 }
 
 int TSXShmPixmapFormat(Display *a0)
 {
   int r;
-  dprintf_x11(stddeb, "Call XShmPixmapFormat\n");
+  dprintf_info(x11, "Call XShmPixmapFormat\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XShmPixmapFormat(a0);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XShmPixmapFormat\n");
+  dprintf_info(x11, "Ret XShmPixmapFormat\n");
   return r;
 }
 
 Status TSXShmDetach(Display *a0, XShmSegmentInfo *a1)
 {
   Status r;
-  dprintf_x11(stddeb, "Call XShmDetach\n");
+  dprintf_info(x11, "Call XShmDetach\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XShmDetach(a0, a1);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XShmDetach\n");
+  dprintf_info(x11, "Ret XShmDetach\n");
   return r;
 }
 
 Status TSXShmAttach(Display *a0, XShmSegmentInfo *a1)
 {
   Status r;
-  dprintf_x11(stddeb, "Call XShmAttach\n");
+  dprintf_info(x11, "Call XShmAttach\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XShmAttach(a0, a1);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XShmAttach\n");
+  dprintf_info(x11, "Ret XShmAttach\n");
   return r;
 }
diff --git a/tsx11/ts_xutil.c b/tsx11/ts_xutil.c
index cd499bb..ab44751 100644
--- a/tsx11/ts_xutil.c
+++ b/tsx11/ts_xutil.c
@@ -8,353 +8,352 @@
 #include <X11/Xresource.h>
 #include <X11/Xutil.h>
 #include "x11drv.h"
-#include "stddebug.h"
 #include "debug.h"
 
 XClassHint * TSXAllocClassHint(void)
 {
   XClassHint * r;
-  dprintf_x11(stddeb, "Call XAllocClassHint\n");
+  dprintf_info(x11, "Call XAllocClassHint\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XAllocClassHint();
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XAllocClassHint\n");
+  dprintf_info(x11, "Ret XAllocClassHint\n");
   return r;
 }
 
 XSizeHints * TSXAllocSizeHints(void)
 {
   XSizeHints * r;
-  dprintf_x11(stddeb, "Call XAllocSizeHints\n");
+  dprintf_info(x11, "Call XAllocSizeHints\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XAllocSizeHints();
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XAllocSizeHints\n");
+  dprintf_info(x11, "Ret XAllocSizeHints\n");
   return r;
 }
 
 XWMHints * TSXAllocWMHints(void)
 {
   XWMHints * r;
-  dprintf_x11(stddeb, "Call XAllocWMHints\n");
+  dprintf_info(x11, "Call XAllocWMHints\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XAllocWMHints();
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XAllocWMHints\n");
+  dprintf_info(x11, "Ret XAllocWMHints\n");
   return r;
 }
 
 int  TSXClipBox(Region a0, XRectangle* a1)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XClipBox\n");
+  dprintf_info(x11, "Call XClipBox\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XClipBox(a0, a1);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XClipBox\n");
+  dprintf_info(x11, "Ret XClipBox\n");
   return r;
 }
 
 Region  TSXCreateRegion(void)
 {
   Region  r;
-  dprintf_x11(stddeb, "Call XCreateRegion\n");
+  dprintf_info(x11, "Call XCreateRegion\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XCreateRegion();
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XCreateRegion\n");
+  dprintf_info(x11, "Ret XCreateRegion\n");
   return r;
 }
 
 int  TSXDeleteContext(Display* a0, XID a1, XContext a2)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XDeleteContext\n");
+  dprintf_info(x11, "Call XDeleteContext\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XDeleteContext(a0, a1, a2);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XDeleteContext\n");
+  dprintf_info(x11, "Ret XDeleteContext\n");
   return r;
 }
 
 int  TSXDestroyRegion(Region a0)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XDestroyRegion\n");
+  dprintf_info(x11, "Call XDestroyRegion\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XDestroyRegion(a0);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XDestroyRegion\n");
+  dprintf_info(x11, "Ret XDestroyRegion\n");
   return r;
 }
 
 int  TSXEmptyRegion(Region a0)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XEmptyRegion\n");
+  dprintf_info(x11, "Call XEmptyRegion\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XEmptyRegion(a0);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XEmptyRegion\n");
+  dprintf_info(x11, "Ret XEmptyRegion\n");
   return r;
 }
 
 int  TSXEqualRegion(Region a0, Region a1)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XEqualRegion\n");
+  dprintf_info(x11, "Call XEqualRegion\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XEqualRegion(a0, a1);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XEqualRegion\n");
+  dprintf_info(x11, "Ret XEqualRegion\n");
   return r;
 }
 
 int  TSXFindContext(Display* a0, XID a1, XContext a2, XPointer* a3)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XFindContext\n");
+  dprintf_info(x11, "Call XFindContext\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XFindContext(a0, a1, a2, a3);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XFindContext\n");
+  dprintf_info(x11, "Ret XFindContext\n");
   return r;
 }
 
 XVisualInfo * TSXGetVisualInfo(Display* a0, long a1, XVisualInfo* a2, int* a3)
 {
   XVisualInfo * r;
-  dprintf_x11(stddeb, "Call XGetVisualInfo\n");
+  dprintf_info(x11, "Call XGetVisualInfo\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XGetVisualInfo(a0, a1, a2, a3);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XGetVisualInfo\n");
+  dprintf_info(x11, "Ret XGetVisualInfo\n");
   return r;
 }
 
 int   TSXGetWMSizeHints(Display* a0, Window a1, XSizeHints* a2, long* a3, Atom a4)
 {
   int   r;
-  dprintf_x11(stddeb, "Call XGetWMSizeHints\n");
+  dprintf_info(x11, "Call XGetWMSizeHints\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XGetWMSizeHints(a0, a1, a2, a3, a4);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XGetWMSizeHints\n");
+  dprintf_info(x11, "Ret XGetWMSizeHints\n");
   return r;
 }
 
 int  TSXIntersectRegion(Region a0, Region a1, Region a2)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XIntersectRegion\n");
+  dprintf_info(x11, "Call XIntersectRegion\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XIntersectRegion(a0, a1, a2);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XIntersectRegion\n");
+  dprintf_info(x11, "Ret XIntersectRegion\n");
   return r;
 }
 
 int  TSXLookupString(XKeyEvent* a0, char* a1, int a2, KeySym* a3, XComposeStatus* a4)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XLookupString\n");
+  dprintf_info(x11, "Call XLookupString\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XLookupString(a0, a1, a2, a3, a4);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XLookupString\n");
+  dprintf_info(x11, "Ret XLookupString\n");
   return r;
 }
 
 int  TSXOffsetRegion(Region a0, int a1, int a2)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XOffsetRegion\n");
+  dprintf_info(x11, "Call XOffsetRegion\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XOffsetRegion(a0, a1, a2);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XOffsetRegion\n");
+  dprintf_info(x11, "Ret XOffsetRegion\n");
   return r;
 }
 
 int   TSXPointInRegion(Region a0, int a1, int a2)
 {
   int   r;
-  dprintf_x11(stddeb, "Call XPointInRegion\n");
+  dprintf_info(x11, "Call XPointInRegion\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XPointInRegion(a0, a1, a2);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XPointInRegion\n");
+  dprintf_info(x11, "Ret XPointInRegion\n");
   return r;
 }
 
 Region  TSXPolygonRegion(XPoint* a0, int a1, int a2)
 {
   Region  r;
-  dprintf_x11(stddeb, "Call XPolygonRegion\n");
+  dprintf_info(x11, "Call XPolygonRegion\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XPolygonRegion(a0, a1, a2);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XPolygonRegion\n");
+  dprintf_info(x11, "Ret XPolygonRegion\n");
   return r;
 }
 
 int  TSXRectInRegion(Region a0, int a1, int a2, unsigned int a3, unsigned int a4)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XRectInRegion\n");
+  dprintf_info(x11, "Call XRectInRegion\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XRectInRegion(a0, a1, a2, a3, a4);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XRectInRegion\n");
+  dprintf_info(x11, "Ret XRectInRegion\n");
   return r;
 }
 
 int  TSXSaveContext(Display* a0, XID a1, XContext a2, const  char* a3)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XSaveContext\n");
+  dprintf_info(x11, "Call XSaveContext\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XSaveContext(a0, a1, a2, a3);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XSaveContext\n");
+  dprintf_info(x11, "Ret XSaveContext\n");
   return r;
 }
 
 void  TSXSetWMProperties(Display* a0, Window a1, XTextProperty* a2, XTextProperty* a3, char** a4, int a5, XSizeHints* a6, XWMHints* a7, XClassHint* a8)
 {
-  dprintf_x11(stddeb, "Call XSetWMProperties\n");
+  dprintf_info(x11, "Call XSetWMProperties\n");
   EnterCriticalSection( &X11DRV_CritSection );
   XSetWMProperties(a0, a1, a2, a3, a4, a5, a6, a7, a8);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XSetWMProperties\n");
+  dprintf_info(x11, "Ret XSetWMProperties\n");
 }
 
 void  TSXSetWMSizeHints(Display* a0, Window a1, XSizeHints* a2, Atom a3)
 {
-  dprintf_x11(stddeb, "Call XSetWMSizeHints\n");
+  dprintf_info(x11, "Call XSetWMSizeHints\n");
   EnterCriticalSection( &X11DRV_CritSection );
   XSetWMSizeHints(a0, a1, a2, a3);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XSetWMSizeHints\n");
+  dprintf_info(x11, "Ret XSetWMSizeHints\n");
 }
 
 int  TSXSetRegion(Display* a0, GC a1, Region a2)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XSetRegion\n");
+  dprintf_info(x11, "Call XSetRegion\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XSetRegion(a0, a1, a2);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XSetRegion\n");
+  dprintf_info(x11, "Ret XSetRegion\n");
   return r;
 }
 
 int  TSXShrinkRegion(Region a0, int a1, int a2)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XShrinkRegion\n");
+  dprintf_info(x11, "Call XShrinkRegion\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XShrinkRegion(a0, a1, a2);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XShrinkRegion\n");
+  dprintf_info(x11, "Ret XShrinkRegion\n");
   return r;
 }
 
 int   TSXStringListToTextProperty(char** a0, int a1, XTextProperty* a2)
 {
   int   r;
-  dprintf_x11(stddeb, "Call XStringListToTextProperty\n");
+  dprintf_info(x11, "Call XStringListToTextProperty\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XStringListToTextProperty(a0, a1, a2);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XStringListToTextProperty\n");
+  dprintf_info(x11, "Ret XStringListToTextProperty\n");
   return r;
 }
 
 int  TSXSubtractRegion(Region a0, Region a1, Region a2)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XSubtractRegion\n");
+  dprintf_info(x11, "Call XSubtractRegion\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XSubtractRegion(a0, a1, a2);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XSubtractRegion\n");
+  dprintf_info(x11, "Ret XSubtractRegion\n");
   return r;
 }
 
 int  TSXUnionRectWithRegion(XRectangle* a0, Region a1, Region a2)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XUnionRectWithRegion\n");
+  dprintf_info(x11, "Call XUnionRectWithRegion\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XUnionRectWithRegion(a0, a1, a2);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XUnionRectWithRegion\n");
+  dprintf_info(x11, "Ret XUnionRectWithRegion\n");
   return r;
 }
 
 int  TSXUnionRegion(Region a0, Region a1, Region a2)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XUnionRegion\n");
+  dprintf_info(x11, "Call XUnionRegion\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XUnionRegion(a0, a1, a2);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XUnionRegion\n");
+  dprintf_info(x11, "Ret XUnionRegion\n");
   return r;
 }
 
 int  TSXXorRegion(Region a0, Region a1, Region a2)
 {
   int  r;
-  dprintf_x11(stddeb, "Call XXorRegion\n");
+  dprintf_info(x11, "Call XXorRegion\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XXorRegion(a0, a1, a2);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XXorRegion\n");
+  dprintf_info(x11, "Ret XXorRegion\n");
   return r;
 }
 
 int TSXDestroyImage(struct _XImage *a0)
 {
   int r;
-  dprintf_x11(stddeb, "Call XDestroyImage\n");
+  dprintf_info(x11, "Call XDestroyImage\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XDestroyImage(a0);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XDestroyImage\n");
+  dprintf_info(x11, "Ret XDestroyImage\n");
   return r;
 }
 
 struct _XImage * TSXSubImage(struct _XImage *a0, int a1, int a2, unsigned int a3, unsigned int a4)
 {
   struct _XImage * r;
-  dprintf_x11(stddeb, "Call XSubImage\n");
+  dprintf_info(x11, "Call XSubImage\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XSubImage(a0, a1, a2, a3, a4);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XSubImage\n");
+  dprintf_info(x11, "Ret XSubImage\n");
   return r;
 }
 
 int TSXAddPixel(struct _XImage *a0, long a1)
 {
   int r;
-  dprintf_x11(stddeb, "Call XAddPixel\n");
+  dprintf_info(x11, "Call XAddPixel\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XAddPixel(a0, a1);
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XAddPixel\n");
+  dprintf_info(x11, "Ret XAddPixel\n");
   return r;
 }
 
 XContext TSXUniqueContext(void)
 {
   XContext r;
-  dprintf_x11(stddeb, "Call XUniqueContext\n");
+  dprintf_info(x11, "Call XUniqueContext\n");
   EnterCriticalSection( &X11DRV_CritSection );
   r = XUniqueContext();
   LeaveCriticalSection( &X11DRV_CritSection );
-  dprintf_x11(stddeb, "Ret XUniqueContext\n");
+  dprintf_info(x11, "Ret XUniqueContext\n");
   return r;
 }
diff --git a/win32/advapi.c b/win32/advapi.c
index 5404f41..50cae53 100644
--- a/win32/advapi.c
+++ b/win32/advapi.c
@@ -11,7 +11,6 @@
 #include "winerror.h"
 #include "shell.h"
 #include "heap.h"
-#include "stddebug.h"
 #include "debug.h"
 
 /***********************************************************************
diff --git a/win32/code_page.c b/win32/code_page.c
index 2771061..bcd80ce 100644
--- a/win32/code_page.c
+++ b/win32/code_page.c
@@ -10,7 +10,6 @@
 #include "winerror.h"
 #include "winnls.h"
 #include "heap.h"
-#include "stddebug.h"
 #include "debug.h"
 
 
@@ -85,9 +84,9 @@
 /***********************************************************************
  *              MultiByteToWideChar                (KERNEL32.392)
  */
-int WINAPI MultiByteToWideChar(UINT32 page, DWORD flags,
-			       const char *src, int srclen,
-                               WCHAR *dst, int dstlen)
+INT32 WINAPI MultiByteToWideChar(UINT32 page, DWORD flags,
+			         LPCSTR src, INT32 srclen,
+                                 LPWSTR dst, INT32 dstlen)
 {
     int ret;
 
@@ -111,8 +110,9 @@
     return ret;
 }
 
-int WINAPI WideCharToMultiByte(UINT32 page, DWORD flags, WCHAR *src, int srclen,
-                               char *dst, int dstlen, char* defchar, BOOL32 *used)
+INT32 WINAPI WideCharToMultiByte(UINT32 page, DWORD flags, LPCWSTR src,
+				 INT32 srclen,LPSTR dst, INT32 dstlen,
+				 LPCSTR defchar, BOOL32 *used)
 {
     int count = 0;
     int eos = 0;
@@ -207,7 +207,7 @@
  */
 BOOL32 WINAPI EnumSystemCodePages32A(CODEPAGE_ENUMPROC32A lpfnCodePageEnum,DWORD flags)
 {
-	dprintf_win32(stddeb,"EnumSystemCodePages32A(%p,%08lx)\n",
+	dprintf_info(win32,"EnumSystemCodePages32A(%p,%08lx)\n",
 		lpfnCodePageEnum,flags
 	);
 	lpfnCodePageEnum("437");
@@ -221,7 +221,7 @@
                                       DWORD flags)
 {
     WCHAR	*cp;
-    dprintf_win32(stddeb,"EnumSystemCodePages32W(%p,%08lx)\n",
+    dprintf_info(win32,"EnumSystemCodePages32W(%p,%08lx)\n",
                   lpfnCodePageEnum,flags );
 
     cp = HEAP_strdupAtoW( GetProcessHeap(), 0, "437" );
diff --git a/win32/console.c b/win32/console.c
index 2396f34..d2f13b5 100644
--- a/win32/console.c
+++ b/win32/console.c
@@ -9,7 +9,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
-#include <pty.h>
 #include <termios.h>
 #include <sys/ioctl.h>
 #include <sys/types.h>
@@ -25,7 +24,6 @@
 #include "winerror.h"
 #include "wincon.h"
 #include "heap.h"
-#include "stddebug.h"
 #include "debug.h"
 
 static CONSOLE_SCREEN_BUFFER_INFO dummyinfo =
@@ -39,23 +37,26 @@
 
 /* The console -- I chose to keep the master and slave
  * (UNIX) file descriptors around in case they are needed for
- * ioctls later.  The pid is needed to detroy the xterm if needed.
+ * ioctls later.  The pid is needed to destroy the xterm on close
  */
 typedef struct _CONSOLE {
 	K32OBJ  header;
 	int	master;			/* xterm side of pty */
 	int	slave;			/* wine side of pty */
 	int	pid;			/* xterm's pid, -1 if no xterm */
-	int	flags;			/* CONSOLE_STARTED_FROM */
-        K32OBJ *file_in;                /* console input */
-        K32OBJ *file_out;               /* console output */
-        K32OBJ *file_err;               /* console error */
 } CONSOLE;
 
-#define CONSOLE_STARTED_FROM  (0x1)	/* FIXME: this is lame, it should have 
-					   something to do with sharing... */
 
 static void CONSOLE_Destroy( K32OBJ *obj );
+static BOOL32 CONSOLE_Write(K32OBJ *ptr, LPCVOID lpBuffer, 
+			    DWORD nNumberOfChars,  LPDWORD lpNumberOfChars, 
+			    LPOVERLAPPED lpOverlapped);
+static BOOL32 CONSOLE_Read(K32OBJ *ptr, LPVOID lpBuffer, 
+			   DWORD nNumberOfChars, LPDWORD lpNumberOfChars, 
+			   LPOVERLAPPED lpOverlapped);
+static int wine_openpty(int *master, int *slave, char *name, 
+		     struct termios *term, struct winsize *winsize);
+static BOOL32 wine_createConsole(int *master, int *slave, int *pid);
 
 const K32OBJ_OPS CONSOLE_Ops =
 {
@@ -63,13 +64,12 @@
 	NULL,			/* satisfied */
 	NULL,			/* add_wait */
 	NULL,			/* remove_wait */
+	CONSOLE_Read,		/* read */
+	CONSOLE_Write,		/* write */
 	CONSOLE_Destroy		/* destroy */
 };
 
 
-static int wine_openpty(int *master, int *slave, char *name, 
-		     struct termios *term, struct winsize *winsize);
-
 
 
 static void CONSOLE_Destroy(K32OBJ *obj)
@@ -84,10 +84,55 @@
 		kill(console->pid, SIGTERM);
 	}
 	HeapFree(SystemHeap, 0, console);
-
 }
 
 
+/* lpOverlapped is ignored */
+static BOOL32 CONSOLE_Read(K32OBJ *ptr, LPVOID lpBuffer, DWORD nNumberOfChars,
+			LPDWORD lpNumberOfChars, LPOVERLAPPED lpOverlapped)
+{
+	CONSOLE *console = (CONSOLE *)ptr;
+	int result;
+
+	dprintf_info(console, "CONSOLE_Read: %p %p %ld\n", ptr, lpBuffer,
+		      nNumberOfChars);
+
+	*lpNumberOfChars = 0; 
+
+	if ((result = read(console->slave, lpBuffer, nNumberOfChars)) == -1) {
+		FILE_SetDosError();
+		return FALSE;
+	}
+	*lpNumberOfChars = result;
+	return TRUE;
+}
+
+/* lpOverlapped is ignored */
+static BOOL32 CONSOLE_Write(K32OBJ *ptr, LPCVOID lpBuffer, 
+			    DWORD nNumberOfChars,
+			    LPDWORD lpNumberOfChars, LPOVERLAPPED lpOverlapped)
+{
+	CONSOLE *console = (CONSOLE *)ptr;
+	int result;
+
+	dprintf_info(console, "CONSOLE_Write: %p %p %ld\n", ptr, lpBuffer,
+		      nNumberOfChars);
+
+	*lpNumberOfChars = 0; 
+
+	/* FIXME: there was a loop here before, why??? */
+
+	if ((result = write(console->slave, lpBuffer, nNumberOfChars)) == -1) {
+		FILE_SetDosError();
+		return FALSE;
+	}
+	*lpNumberOfChars = result;
+	return TRUE;
+}
+
+
+
+
 /***********************************************************************
  *           SetConsoleCtrlHandler               (KERNEL32.459)
  */
@@ -164,9 +209,8 @@
 		return FALSE;
 	}
 
-        if (console->file_in) K32OBJ_DecCount( console->file_in );
-        if (console->file_out) K32OBJ_DecCount( console->file_out );
-        if (console->file_err) K32OBJ_DecCount( console->file_err );
+	PROCESS_CloseObjHandles(pdb, &console->header);
+
 	K32OBJ_DecCount( &console->header );
 	pdb->console = NULL;
 	SYSTEM_UNLOCK();
@@ -264,6 +308,24 @@
 
 }
 
+/***********************************************************************
+ *		CONSOLE_GetConsoleHandle
+ *	 returns a 16-bit style console handle
+ * note: only called from _lopen
+ */
+HFILE32 CONSOLE_GetConsoleHandle(VOID)
+{
+	PDB32 *pdb = PROCESS_Current();
+	HFILE32 handle = HFILE_ERROR32;
+
+	SYSTEM_LOCK();
+	if (pdb->console != NULL) {
+		CONSOLE *console = (CONSOLE *)pdb->console;
+		handle = (HFILE32)HANDLE_Alloc(&console->header, 0, TRUE);
+	}
+	SYSTEM_UNLOCK();
+	return handle;
+}
 
 /***********************************************************************
  *            AllocConsole (KERNEL32.103)
@@ -287,13 +349,8 @@
 
 	console = (CONSOLE *)pdb->console;
 
-	/* we only want to be able to open a console if the process doesn't have one
-	 * now or we got the one we have from our parent
-	 *  - invalid handle comes from when the console was closed via FreeConsole()
-	 *  - CONSOLE_STARTED_FROM is when this process inherits its console from
-	 *    its parent
-	 */
-	if (console && (console->flags & CONSOLE_STARTED_FROM) == 0) {
+	/* don't create a console if we already have one */
+	if (console != NULL) {
 		SetLastError(ERROR_ACCESS_DENIED);
 		SYSTEM_UNLOCK();
 		return FALSE;
@@ -308,9 +365,6 @@
         console->header.type     = K32OBJ_CONSOLE;
         console->header.refcount = 1;
         console->pid             = -1;
-        console->file_in         = NULL;
-        console->file_out        = NULL;
-        console->file_err        = NULL;
 
 	if (wine_createConsole(&master, &slave, &pid) == FALSE) {
 		K32OBJ_DecCount(&console->header);
@@ -322,26 +376,24 @@
         console->master = master;
 	console->slave = slave;
 	console->pid = pid;
-	console->flags = 0;
 
-	if ((hIn = FILE_DupUnixHandle(slave)) == INVALID_HANDLE_VALUE32)
+	if ((hIn = HANDLE_Alloc(&console->header, 0, TRUE)) == INVALID_HANDLE_VALUE32)
         {
             K32OBJ_DecCount(&console->header);
             SYSTEM_UNLOCK();
             return FALSE;
 	}
-	FILE_SetFileType(hIn, FILE_TYPE_CHAR);
 
-	if ((hOut = FILE_DupUnixHandle(slave)) == INVALID_HANDLE_VALUE32)
+	if ((hOut = HANDLE_Alloc(&console->header, 0, TRUE)) == INVALID_HANDLE_VALUE32)
         {
             CloseHandle(hIn);
             K32OBJ_DecCount(&console->header);
             SYSTEM_UNLOCK();
             return FALSE;
 	}
-	FILE_SetFileType(hOut, FILE_TYPE_CHAR);
 
-	if ((hErr = FILE_DupUnixHandle(slave)) == INVALID_HANDLE_VALUE32)
+
+	if ((hErr = HANDLE_Alloc(&console->header, 0, TRUE)) == INVALID_HANDLE_VALUE32)
         {
             CloseHandle(hIn);
             CloseHandle(hOut);
@@ -349,11 +401,6 @@
             SYSTEM_UNLOCK();
             return FALSE;
 	}
-	FILE_SetFileType(hErr, FILE_TYPE_CHAR);
-
-        console->file_in = HANDLE_GetObjPtr( hIn, K32OBJ_FILE, 0 /*FIXME*/ );
-        console->file_out = HANDLE_GetObjPtr( hIn, K32OBJ_FILE, 0 /*FIXME*/ );
-        console->file_err = HANDLE_GetObjPtr( hIn, K32OBJ_FILE, 0 /*FIXME*/ );
 
 	/* associate this console with the process */
         if (pdb->console) K32OBJ_DecCount( pdb->console );
@@ -436,18 +483,6 @@
 	/* FIXME: should I check if this is a console handle? */
 	return WriteFile(hConsoleOutput, lpBuffer, nNumberOfCharsToWrite,
 			 lpNumberOfCharsWritten, NULL);
-
-#ifdef OLD
-	*lpNumberOfCharsWritten = fprintf(CONSOLE_console.conIO, "%.*s",
-					   (int)nNumberOfCharsToWrite,
-					   (LPSTR)lpBuffer );
-	if (ferror(CONSOLE_console.conIO) {
-		clearerr();
-		return FALSE;
-	}
-
-	return TRUE;
-#endif
 }
 
 /***********************************************************************
@@ -476,20 +511,6 @@
 	return WriteFile(hConsoleOutput, lpBuffer, nNumberOfCharsToWrite,
 			 lpNumberOfCharsWritten, NULL);
 
-
-#ifdef OLD
-	LPSTR buf =  HEAP_strdupWtoA( GetProcessHeap(), 0, lpBuffer );
-	*lpNumberOfCharsWritten = fprintf(CONSOLE_console.conIO, "%.*s",
-					  (int)nNumberOfCharsToWrite, buf );
-	HeapFree( GetProcessHeap(), 0, buf );
-
-	if (ferror(CONSOLE_console.conIO) {
-		clearerr();
-		return FALSE;
-	}
-
-	return TRUE;
-#endif
 }
 
 /***********************************************************************
diff --git a/win32/environment.c b/win32/environment.c
index 0680d1e..70c253a 100644
--- a/win32/environment.c
+++ b/win32/environment.c
@@ -11,7 +11,6 @@
 #include "winerror.h"
 #include "module.h"
 #include "task.h"
-#include "stddebug.h"
 #include "debug.h"
 #include "process.h"  /* for PROCESS_Current() */
 
diff --git a/win32/error.c b/win32/error.c
index 62c55bf..39d2832 100644
--- a/win32/error.c
+++ b/win32/error.c
@@ -8,7 +8,6 @@
 #include <errno.h>
 #include "windows.h"
 #include "winerror.h"
-#include "stddebug.h"
 #include "debug.h"
 
 /* The errno_xlat_table contains the errno-to-Win32 error
diff --git a/win32/except.c b/win32/except.c
index 0feae88..08cc70d 100644
--- a/win32/except.c
+++ b/win32/except.c
@@ -38,7 +38,6 @@
 #include "ldt.h"
 #include "process.h"
 #include "thread.h"
-#include "stddebug.h"
 #include "debug.h"
 #include "except.h"
 
@@ -82,7 +81,7 @@
           (TEB_EXCEPTION_FRAME(pcontext) != ((void *)0xffffffff)) &&
           (TEB_EXCEPTION_FRAME(pcontext) != pEndFrame))
    {
-       dprintf_win32( stddeb, "calling exception handler at 0x%x\n",
+       dprintf_info(win32, "calling exception handler at 0x%x\n",
                       (int)TEB_EXCEPTION_FRAME(pcontext)->Handler );
 
        dispatch=0;       
@@ -90,7 +89,7 @@
                                                 TEB_EXCEPTION_FRAME(pcontext),
                                                 pcontext, &dispatch);
                                          
-       dprintf_win32(stddeb,"exception handler returns 0x%x, dispatch=0x%x\n",
+       dprintf_info(win32,"exception handler returns 0x%x, dispatch=0x%x\n",
                               retval, (int) dispatch);
   
        if (	(retval == ExceptionCollidedUnwind) &&
@@ -150,14 +149,14 @@
     
     while((pframe!=NULL)&&(pframe!=((void *)0xFFFFFFFF)))
     {
-       dprintf_win32(stddeb,"calling exception handler at 0x%x\n",
+       dprintf_info(win32,"calling exception handler at 0x%x\n",
                                                 (int) pframe->Handler);
        dispatch=0;  
-       dprintf_relay(stddeb,"CallTo32(except=%p,record=%p,frame=%p,context=%p,dispatch=%p)\n",
+       dprintf_info(relay,"CallTo32(except=%p,record=%p,frame=%p,context=%p,dispatch=%p)\n",
                      pframe->Handler, &record, pframe, pcontext, &dispatch );
        retval=pframe->Handler(&record,pframe,pcontext,&dispatch);
  
-       dprintf_win32(stddeb,"exception handler returns 0x%x, dispatch=0x%x\n",
+       dprintf_info(win32,"exception handler returns 0x%x, dispatch=0x%x\n",
                               retval, (int) dispatch);
                               
        if(retval==ExceptionContinueExecution)
@@ -168,7 +167,7 @@
    if (retval!=ExceptionContinueExecution)
    {    
        /* FIXME: what should we do here? */
-       dprintf_win32(stddeb,"no handler wanted to handle the exception, exiting\n");
+       dprintf_info(win32,"no handler wanted to handle the exception, exiting\n");
        ExitProcess(dwExceptionCode); /* what status should be used here ? */
    }
 }
diff --git a/win32/file.c b/win32/file.c
index f634dce..85ea01f 100644
--- a/win32/file.c
+++ b/win32/file.c
@@ -18,9 +18,8 @@
 #include "winbase.h"
 #include "winerror.h"
 #include "file.h"
+#include "process.h"
 #include "heap.h"
-#include "stddebug.h"
-#define DEBUG_WIN32
 #include "debug.h"
 
 DWORD ErrnoToLastError(int errno_num);
@@ -31,38 +30,44 @@
 /***********************************************************************
  *             WriteFile               (KERNEL32.578)
  */
-BOOL32 WINAPI WriteFile(HFILE32 hFile, LPVOID lpBuffer, DWORD numberOfBytesToWrite,
+BOOL32 WINAPI WriteFile(HANDLE32 hFile, LPCVOID lpBuffer, 
+			DWORD numberOfBytesToWrite,
                         LPDWORD numberOfBytesWritten, LPOVERLAPPED lpOverlapped)
 {
-    LONG	res;
-
-    res = _lwrite32(hFile,lpBuffer,numberOfBytesToWrite);
-    if (res==-1) {
-    	SetLastError(ErrnoToLastError(errno));
-    	return FALSE;
-    }
-    if(numberOfBytesWritten)
-        *numberOfBytesWritten = res;
-    return TRUE;
+	K32OBJ *ioptr;
+	BOOL32 status = FALSE;
+	
+	dprintf_info(file, "WriteFile: %d %p %ld\n", hFile, lpBuffer, 
+		      numberOfBytesToWrite);
+	
+	if (!(ioptr = HANDLE_GetObjPtr( hFile, K32OBJ_UNKNOWN, 0 ))) 
+		return HFILE_ERROR32;
+        if (K32OBJ_OPS(ioptr)->write)
+            status = K32OBJ_OPS(ioptr)->write(ioptr, lpBuffer, numberOfBytesToWrite, 
+                                              numberOfBytesWritten, lpOverlapped);
+	K32OBJ_DecCount( ioptr );
+	return status;
 }
 
 /***********************************************************************
  *              ReadFile                (KERNEL32.428)
  */
-BOOL32 WINAPI ReadFile(HFILE32 hFile, LPVOID lpBuffer, DWORD numtoread,
-                       LPDWORD numread, LPOVERLAPPED lpOverlapped)
+BOOL32 WINAPI ReadFile(HANDLE32 hFile, LPVOID lpBuffer, DWORD numberOfBytesToRead,
+                       LPDWORD numberOfBytesRead, LPOVERLAPPED lpOverlapped)
 {
-    int actual_read;
-
-    actual_read = _lread32(hFile,lpBuffer,numtoread);
-    if(actual_read == -1) {
-        SetLastError(ErrnoToLastError(errno));
-        return FALSE;
-    }
-    if(numread)
-        *numread = actual_read;
-
-    return TRUE;
+	K32OBJ *ioptr;
+	BOOL32 status = FALSE;
+	
+	dprintf_info(file, "ReadFile: %d %p %ld\n", hFile, lpBuffer, 
+		      numberOfBytesToRead);
+	
+	if (!(ioptr = HANDLE_GetObjPtr( hFile, K32OBJ_UNKNOWN, 0 ))) 
+		return HFILE_ERROR32;
+        if (K32OBJ_OPS(ioptr)->read)
+            status = K32OBJ_OPS(ioptr)->read(ioptr, lpBuffer, numberOfBytesToRead, 
+                                             numberOfBytesRead, lpOverlapped);
+	K32OBJ_DecCount( ioptr );
+	return status;
 }
 
 
@@ -107,7 +112,7 @@
     create_flags = TranslateCreationFlags(creation);
 
     if(template)
-        dprintf_file(stddeb, "CreateFile: template handles not supported.\n");
+        dprintf_fixme(file, "CreateFile: template handles not supported.\n");
 
     /* If the name starts with '\\?' or '\\.', ignore the first 3 chars.
      */
@@ -118,7 +123,7 @@
      */
     if(!strncmp(filename, "\\\\", 2))
     {
-        dprintf_file(stddeb, "CreateFile: UNC names not supported.\n");
+        dprintf_fixme(file, "CreateFile: UNC names not supported.\n");
         SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
         return HFILE_ERROR32;
     }
@@ -220,7 +225,7 @@
     if (!DOSFS_GetFullName( lpFileName, TRUE, &full_name ))
         return FALSE;
 
-    dprintf_file(stddeb,"SetFileAttributes(%s,%lx)\n",lpFileName,attributes);
+    dprintf_info(file,"SetFileAttributes(%s,%lx)\n",lpFileName,attributes);
     if (attributes & FILE_ATTRIBUTE_NORMAL) {
       attributes &= ~FILE_ATTRIBUTE_NORMAL;
       if (attributes)
diff --git a/win32/init.c b/win32/init.c
index 50a44cd..1472cc0 100644
--- a/win32/init.c
+++ b/win32/init.c
@@ -13,7 +13,6 @@
 #include "except.h"
 #include "heap.h"
 #include "task.h"
-#include "stddebug.h"
 #include "debug.h"
   
 /***********************************************************************
@@ -83,6 +82,7 @@
   char *name;
 
   name=getlogin();
+  if (!name) name=cuserid(NULL);
   len = name ? strlen(name) : 0;
   if (!len || !lpSize || len > *lpSize) {
     if (lpszName) *lpszName = 0;
diff --git a/win32/kernel32.c b/win32/kernel32.c
index a22c775..b1dd942 100644
--- a/win32/kernel32.c
+++ b/win32/kernel32.c
@@ -1,7 +1,7 @@
 /*
  * KERNEL32 thunks and other undocumented stuff
  *
- * Copyright 1997 Marcus Meissner
+ * Copyright 1997-1998 Marcus Meissner
  */
 
 #include <stdio.h>
@@ -14,10 +14,10 @@
 #include "module.h"
 #include "process.h"
 #include "stackframe.h"
+#include "heap.h"
 #include "selectors.h"
 #include "task.h"
 #include "win.h"
-#include "stddebug.h"
 #include "debug.h"
 
 /***********************************************************************
@@ -103,16 +103,16 @@
 	SEGPTR		thkbuf;
 	struct	thunkstruct	*ths16;
 
-	dprintf_thunk(stddeb,"ThunkConnect32(<struct>,%s,%s,%s,%x,%lx)\n",
+	dprintf_info(thunk,"ThunkConnect32(<struct>,%s,%s,%s,%x,%lx)\n",
 		thunkfun16,module32,module16,hmod32,dllinitarg1
 	);
-	dprintf_thunk(stddeb,"	magic = %c%c%c%c\n",
+	dprintf_info(thunk,"	magic = %c%c%c%c\n",
 		ths->magic[0],
 		ths->magic[1],
 		ths->magic[2],
 		ths->magic[3]
 	);
-	dprintf_thunk(stddeb,"	length = %lx\n",ths->length);
+	dprintf_info(thunk,"	length = %lx\n",ths->length);
 	if (lstrncmp32A(ths->magic,"SL01",4)&&lstrncmp32A(ths->magic,"LS01",4))
 		return 0;
 	hmm=LoadModule16(module16,NULL);
@@ -130,7 +130,7 @@
 			return 0;
 		ths->x0C = (DWORD)ths16;
 
-		dprintf_thunk(stddeb,"	ths16 magic is 0x%08lx\n",*(DWORD*)ths16->magic);
+		dprintf_info(thunk,"	ths16 magic is 0x%08lx\n",*(DWORD*)ths16->magic);
 		if (*((DWORD*)ths16->magic) != 0x0000304C)
 			return 0;
 		if (!*(WORD*)(((LPBYTE)ths16)+0x12))
@@ -187,9 +187,9 @@
 DWORD WINAPI WOWCallback16(FARPROC16 fproc,DWORD arg)
 {
 	DWORD	ret;
-	dprintf_thunk(stddeb,"WOWCallback16(%p,0x%08lx) ",fproc,arg);
+	dprintf_info(thunk,"WOWCallback16(%p,0x%08lx)...\n",fproc,arg);
 	ret =  Callbacks->CallWOWCallbackProc(fproc,arg);
-	dprintf_thunk(stddeb,"... returns %ld\n",ret);
+	dprintf_info(thunk,"... returns %ld\n",ret);
 	return ret;
 }
 
@@ -212,7 +212,7 @@
 {
 	HMODULE32	hmod = LoadLibrary16("systhunk.dll");
 
-	dprintf_thunk(stddeb, "_KERNEL32_52: systhunk.dll module %d\n", hmod);
+	dprintf_info(thunk, "_KERNEL32_52: systhunk.dll module %d\n", hmod);
 	
 	if (hmod<=32)
 		return 0;
@@ -256,7 +256,7 @@
 		return 0;
 	*(DWORD*)thunk = addr[1];
 
-	dprintf_thunk(stddeb, "_KERNEL32_43: loaded module %d, func %s (%d) @ %p (%p), returning %p\n",
+	dprintf_info(thunk, "_KERNEL32_43: loaded module %d, func %s (%d) @ %p (%p), returning %p\n",
 		      hmod, HIWORD(thkbuf)==0 ? "<ordinal>" : thkbuf, (int)thkbuf, (void*)segaddr, addr, (void*)addr[1]);
 
 	return addr[1];
@@ -277,11 +277,11 @@
         DWORD ret,stacksize;
 	THDB *thdb = THREAD_Current();
 
-	dprintf_thunk(stddeb,"KERNEL32_45(%%eax=0x%08lx(%%cx=0x%04lx,%%edx=0x%08lx))\n",
+	dprintf_info(thunk,"KERNEL32_45(%%eax=0x%08lx(%%cx=0x%04lx,%%edx=0x%08lx))\n",
 		(DWORD)EAX_reg(context),(DWORD)CX_reg(context),(DWORD)EDX_reg(context)
 	);
 	stacksize = EBP_reg(context)-ESP_reg(context);
-	dprintf_thunk(stddeb,"	stacksize = %ld\n",stacksize);
+	dprintf_info(thunk,"	stacksize = %ld\n",stacksize);
 
 	memcpy(&context16,context,sizeof(context16));
 
@@ -294,7 +294,7 @@
 	ret = Callbacks->CallRegisterLongProc(&context16,0);
 	STACK16_POP( thdb, stacksize );
 
-	dprintf_thunk(stddeb,". returned %08lx\n",ret);
+	dprintf_info(thunk,". returned %08lx\n",ret);
 	EAX_reg(context) 	 = ret;
 }
 
@@ -312,12 +312,12 @@
 	DWORD	ret,stacksize;
 	THDB *thdb = THREAD_Current();
 
-	dprintf_thunk(stddeb,"_KERNEL32_40(EDX=0x%08lx)\n",
+	dprintf_info(thunk,"_KERNEL32_40(EDX=0x%08lx)\n",
 		EDX_reg(context)
 	);
 	stacksize = EBP_reg(context)-ESP_reg(context);
-	dprintf_thunk(stddeb,"	stacksize = %ld\n",stacksize);
-	dprintf_thunk(stddeb,"on top of stack: 0x%04x\n",*(WORD*)ESP_reg(context));
+	dprintf_info(thunk,"	stacksize = %ld\n",stacksize);
+	dprintf_info(thunk,"on top of stack: 0x%04x\n",*(WORD*)ESP_reg(context));
 
 	memcpy(&context16,context,sizeof(context16));
 
@@ -329,7 +329,7 @@
 	ret = Callbacks->CallRegisterShortProc(&context16,0);
 	STACK16_POP( thdb, stacksize );
 
-	dprintf_thunk(stddeb,". returned %08lx\n",ret);
+	dprintf_info(thunk,". returned %08lx\n",ret);
 	EAX_reg(context) 	 = ret;
 }
 
@@ -404,7 +404,7 @@
 	if (HIWORD(addr2))
 		*(DWORD*)thunk = (DWORD)addr2;
 
-	dprintf_thunk(stddeb, "_KERNEL32_41: loaded module %d, func %s(%d) @ %p (%p), returning %p\n",
+	dprintf_info(thunk, "_KERNEL32_41: loaded module %d, func %s(%d) @ %p (%p), returning %p\n",
 		      hmod, HIWORD(thkbuf)==0 ? "<ordinal>" : thkbuf, (int)thkbuf, (void*)segaddr, addr, addr2);
 
 	return addr2;
@@ -419,7 +419,7 @@
  */
 VOID WINAPI _KERNEL32_90(CONTEXT *context)
 {
-	dprintf_thunk(stddeb, "_KERNEL32_90: QT Thunk priming; context %p\n", context);
+	dprintf_info(thunk, "_KERNEL32_90: QT Thunk priming; context %p\n", context);
 	
 	_write_qtthunk((LPBYTE)EAX_reg(context),*(DWORD*)(EAX_reg(context)+EDX_reg(context)));
 	/* we just call the real QT_Thunk right now 
@@ -461,7 +461,7 @@
 	}
 	*(DWORD*)PTR_SEG_TO_LIN(addr[1]) = (DWORD)thunk;
 
-	dprintf_thunk(stddeb, "_KERNEL32_46: loaded module %d, func %s(%d) @ %p (%p)\n",
+	dprintf_info(thunk, "_KERNEL32_46: loaded module %d, func %s(%d) @ %p (%p)\n",
 		      hmod, HIWORD(thkbuf)==0 ? "<ordinal>" : thkbuf, (int)thkbuf, (void*)segaddr, addr);
 }
 
@@ -473,7 +473,7 @@
  */
 BOOL32 WINAPI _KERNEL32_87()
 {
-    dprintf_thunk(stddeb, "_KERNEL32_87: Yes, thunking is initialized\n");
+    dprintf_info(thunk, "_KERNEL32_87: Yes, thunking is initialized\n");
     return TRUE;
 }
 
@@ -490,9 +490,13 @@
     DWORD i,ret;
     DWORD *args = ((DWORD *)&fun) + 1;
 
-    dprintf_thunk(stddeb,"KERNEL32_88(%ld,0x%08lx,%p,[ ",nr,flags,fun);
-    for (i=0;i<nr/4;i++) { dprintf_thunk(stddeb,"0x%08lx,",args[i]); }
-    dprintf_thunk(stddeb,"])\n");
+    if(debugging_info(thunk)){
+      dbg_decl_str(thunk, 256);
+      for (i=0;i<nr/4;i++) 
+	dsprintf(thunk,"0x%08lx,",args[i]);
+      dprintf_info(thunk,"KERNEL32_88(%ld,0x%08lx,%p,[%s])\n",
+		    nr,flags,fun,dbg_str(thunk));
+    }
     switch (nr) {
     case 0:	ret = fun();
 		break;
@@ -526,7 +530,7 @@
 	break;
 
     }
-    dprintf_thunk(stddeb," returning %ld ...\n",ret);
+    dprintf_info(thunk," returning %ld ...\n",ret);
     return ret;
 }
 
@@ -624,6 +628,15 @@
 }
 
 /**********************************************************************
+ * 		KERNEL_471		(KERNEL)
+ * Seems to return the uncrypted current process pointer. [Not 100% sure].
+ */
+LPVOID WINAPI
+_KERNEL_471() {
+	return PROCESS_Current();
+}
+
+/**********************************************************************
  * 		KERNEL_472		(KERNEL)
  * something like GetCurrenthInstance.
  */
diff --git a/win32/newfns.c b/win32/newfns.c
index bc40e49..fd3e646 100644
--- a/win32/newfns.c
+++ b/win32/newfns.c
@@ -13,7 +13,6 @@
 #include "windows.h"
 #include "winnt.h"
 #include "winerror.h"
-#include "stddebug.h"
 #include "debug.h"
 
 /****************************************************************************
@@ -91,3 +90,11 @@
 	return FALSE;
 
 }
+
+/****************************************************************************
+ *		FlushInstructionCache (KERNEL32.261)
+ */
+BOOL32 WINAPI FlushInstructionCache(DWORD x,DWORD y,DWORD z) {
+	fprintf(stderr,"FlushInstructionCache(0x%08lx,0x%08lx,0x%08lx)\n",x,y,z);
+	return TRUE;
+}
diff --git a/win32/ordinals.c b/win32/ordinals.c
index a27fdd5..6ac155b 100644
--- a/win32/ordinals.c
+++ b/win32/ordinals.c
@@ -15,9 +15,9 @@
 #include "module.h"
 #include "callback.h"
 #include "debug.h"
-#include "stddebug.h"
 
 static CRITICAL_SECTION Win16Mutex;
+static SEGPTR segWin16Mutex = NULL;
 
 /***********************************************
  *           GetPWinLock    (KERNEL32)
@@ -132,3 +132,19 @@
 	fprintf(stderr,"KERNEL32_98(0x%08lx),stub\n",x);
 	return 1;
 }
+
+/************************************************************************
+ *		KERNEL_449		(KERNEL.449)
+ * This returns a segmented static pointer to a linear pointer to a critical
+ * section in kernel32 address space. This is most likely the Win16 Lock,
+ * but I am not sure.
+ */
+SEGPTR WINAPI KERNEL_449(void) { 
+	if (!segWin16Mutex) {
+		LPDWORD	w16m = SEGPTR_ALLOC(4);
+		
+		*w16m = (DWORD)&Win16Mutex;
+		segWin16Mutex = SEGPTR_GET(w16m);
+	}
+	return segWin16Mutex;
+}
diff --git a/win32/process.c b/win32/process.c
index 459883f..c4571ab 100644
--- a/win32/process.c
+++ b/win32/process.c
@@ -15,7 +15,6 @@
 #include "process.h"
 #include "pe_image.h"
 #include "file.h"
-#include "stddebug.h"
 #include "debug.h"
 
 
@@ -51,7 +50,7 @@
                                      LPDWORD lpProcessAffinityMask,
                                      LPDWORD lpSystemAffinityMask)
 {
-	dprintf_task(stddeb,"GetProcessAffinityMask(%x,%lx,%lx)\n",
+	dprintf_info(task,"GetProcessAffinityMask(%x,%lx,%lx)\n",
 		hProcess,(lpProcessAffinityMask?*lpProcessAffinityMask:0),
 		(lpSystemAffinityMask?*lpSystemAffinityMask:0));
 	/* It is definitely important for a process to know on what processor
diff --git a/win32/security.c b/win32/security.c
index 6516eb7..91fc6c0 100644
--- a/win32/security.c
+++ b/win32/security.c
@@ -5,7 +5,6 @@
 #include "windows.h"
 #include "winerror.h"
 #include "ntdll.h"
-#include "stddebug.h"
 #include "debug.h"
 
 BOOL32 WINAPI IsValidSid (LPSID pSid);
diff --git a/win32/struct32.c b/win32/struct32.c
index f0631e0..19b7a36 100644
--- a/win32/struct32.c
+++ b/win32/struct32.c
@@ -8,7 +8,6 @@
 #include "windows.h"
 #include "winerror.h"
 #include "struct32.h"
-#include "stddebug.h"
 #include "debug.h"
 
 void STRUCT32_MSG16to32(const MSG16 *msg16,MSG32 *msg32)
diff --git a/win32/thread.c b/win32/thread.c
index 7ad6585..e3d8e71 100644
--- a/win32/thread.c
+++ b/win32/thread.c
@@ -11,7 +11,6 @@
 #include "windows.h"
 #include "winbase.h"
 #include "winerror.h"
-#include "stddebug.h"
 #include "debug.h"
 
 
diff --git a/win32/time.c b/win32/time.c
index 67c3cb5..333ab7f 100644
--- a/win32/time.c
+++ b/win32/time.c
@@ -10,7 +10,6 @@
 #include <unistd.h>
 #include "windows.h"
 #include "winerror.h"
-#include "stddebug.h"
 #include "debug.h"
 
 /***********************************************************************
diff --git a/win32/user32.c b/win32/user32.c
index daeb8c9..86ee37f 100644
--- a/win32/user32.c
+++ b/win32/user32.c
@@ -16,7 +16,6 @@
 #include "struct32.h"
 #include "win.h"
 #include "debug.h"
-#include "stddebug.h"
 
 /***********************************************************************
  *          GetMessage32A   (USER32.269)
diff --git a/windows/caret.c b/windows/caret.c
index 315ce72..50e326b 100644
--- a/windows/caret.c
+++ b/windows/caret.c
@@ -7,8 +7,6 @@
 
 #include "windows.h"
 #include "module.h"
-#include "stddebug.h"
-/* #define DEBUG_CARET */
 #include "debug.h"
 
 typedef struct
@@ -79,7 +77,7 @@
  */
 static VOID CARET_Callback( HWND32 hwnd, UINT32 msg, UINT32 id, DWORD ctime)
 {
-    dprintf_caret(stddeb,"CARET_Callback: hwnd=%04x, timerid=%d, caret=%d\n",
+    dprintf_info(caret,"CARET_Callback: hwnd=%04x, timerid=%d, caret=%d\n",
                   hwnd, id, Caret.on);
     CARET_DisplayCaret(CARET_TOGGLE);
 }
@@ -138,7 +136,7 @@
 BOOL32 WINAPI CreateCaret32( HWND32 hwnd, HBITMAP32 bitmap,
                              INT32 width, INT32 height )
 {
-    dprintf_caret(stddeb,"CreateCaret: hwnd=%04x\n", hwnd);
+    dprintf_info(caret,"CreateCaret: hwnd=%04x\n", hwnd);
 
     if (!hwnd) return FALSE;
 
@@ -190,7 +188,7 @@
 {
     if (!Caret.hwnd) return FALSE;
 
-    dprintf_caret(stddeb,"DestroyCaret: hwnd=%04x, timerid=%d\n",
+    dprintf_info(caret,"DestroyCaret: hwnd=%04x, timerid=%d\n",
 		Caret.hwnd, Caret.timerid);
 
     CARET_KillTimer();
@@ -218,7 +216,7 @@
     if (!Caret.hwnd) return FALSE;
     if ((x == Caret.x) && (y == Caret.y)) return TRUE;
 
-    dprintf_caret(stddeb,"SetCaretPos: x=%d, y=%d\n", x, y);
+    dprintf_info(caret,"SetCaretPos: x=%d, y=%d\n", x, y);
 
     CARET_KillTimer();
     CARET_DisplayCaret(CARET_OFF);
@@ -250,7 +248,7 @@
     if (!Caret.hwnd) return FALSE;
     if (hwnd && (Caret.hwnd != hwnd)) return FALSE;
 
-    dprintf_caret(stddeb,"HideCaret: hwnd=%04x, hidden=%d\n",
+    dprintf_info(caret,"HideCaret: hwnd=%04x, hidden=%d\n",
                   hwnd, Caret.hidden);
 
     CARET_KillTimer();
@@ -277,7 +275,7 @@
     if (!Caret.hwnd) return FALSE;
     if (hwnd && (Caret.hwnd != hwnd)) return FALSE;
 
-    dprintf_caret(stddeb,"ShowCaret: hwnd=%04x, hidden=%d\n",
+    dprintf_info(caret,"ShowCaret: hwnd=%04x, hidden=%d\n",
 		hwnd, Caret.hidden);
 
     if (Caret.hidden)
@@ -308,7 +306,7 @@
 {
     if (!Caret.hwnd) return FALSE;
 
-    dprintf_caret(stddeb,"SetCaretBlinkTime: hwnd=%04x, msecs=%d\n",
+    dprintf_info(caret,"SetCaretBlinkTime: hwnd=%04x, msecs=%d\n",
 		Caret.hwnd, msecs);
 
     Caret.timeout = msecs;
@@ -342,7 +340,7 @@
 {
     if (!Caret.hwnd || !pt) return;
 
-    dprintf_caret(stddeb,"GetCaretPos: hwnd=%04x, pt=%p, x=%d, y=%d\n",
+    dprintf_info(caret,"GetCaretPos: hwnd=%04x, pt=%p, x=%d, y=%d\n",
                   Caret.hwnd, pt, Caret.x, Caret.y);
     pt->x = (INT16)Caret.x;
     pt->y = (INT16)Caret.y;
diff --git a/windows/class.c b/windows/class.c
index ca349f0..f9355c8 100644
--- a/windows/class.c
+++ b/windows/class.c
@@ -19,7 +19,6 @@
 #include "ldt.h"
 #include "toolhelp.h"
 #include "winproc.h"
-#include "stddebug.h"
 #include "debug.h"
 
 
@@ -318,7 +317,7 @@
         return 0;
     }
 
-    dprintf_class( stddeb, "RegisterClass16: atom=%04x wndproc=%08lx hinst=%04x
+    dprintf_info(class, "RegisterClass16: atom=%04x wndproc=%08lx hinst=%04x
 bg=%04x style=%08x clsExt=%d winExt=%d class=%p name='%s'\n",
                    atom, (DWORD)wc->lpfnWndProc, hInstance,
                    wc->hbrBackground, wc->style, wc->cbClsExtra,
@@ -355,7 +354,7 @@
         return 0;
     }
 
-    dprintf_class( stddeb, "RegisterClass32A: atom=%04x wndproc=%08lx
+    dprintf_info(class, "RegisterClass32A: atom=%04x wndproc=%08lx
 hinst=%04x bg=%04x style=%08x clsExt=%d winExt=%d class=%p name='%s'\n",
                    atom, (DWORD)wc->lpfnWndProc, wc->hInstance,
                    wc->hbrBackground, wc->style, wc->cbClsExtra,
@@ -389,7 +388,7 @@
         return 0;
     }
 
-    dprintf_class( stddeb, "RegisterClass32W: atom=%04x wndproc=%08lx hinst=%04x bg=%04x style=%08x clsExt=%d winExt=%d class=%p\n",
+    dprintf_info(class, "RegisterClass32W: atom=%04x wndproc=%08lx hinst=%04x bg=%04x style=%08x clsExt=%d winExt=%d class=%p\n",
                    atom, (DWORD)wc->lpfnWndProc, wc->hInstance,
                    wc->hbrBackground, wc->style, wc->cbClsExtra,
                    wc->cbWndExtra, classPtr );
@@ -421,7 +420,7 @@
         return 0;
     }
 
-    dprintf_class( stddeb, "RegisterClassEx16: atom=%04x wndproc=%08lx hinst=%04x bg=%04x style=%08x clsExt=%d winExt=%d class=%p\n",
+    dprintf_info(class, "RegisterClassEx16: atom=%04x wndproc=%08lx hinst=%04x bg=%04x style=%08x clsExt=%d winExt=%d class=%p\n",
                    atom, (DWORD)wc->lpfnWndProc, hInstance,
                    wc->hbrBackground, wc->style, wc->cbClsExtra,
                    wc->cbWndExtra, classPtr );
@@ -455,7 +454,7 @@
         return 0;
     }
 
-    dprintf_class( stddeb, "RegisterClassEx32A: atom=%04x wndproc=%08lx hinst=%04x bg=%04x style=%08x clsExt=%d winExt=%d class=%p\n",
+    dprintf_info(class, "RegisterClassEx32A: atom=%04x wndproc=%08lx hinst=%04x bg=%04x style=%08x clsExt=%d winExt=%d class=%p\n",
                    atom, (DWORD)wc->lpfnWndProc, wc->hInstance,
                    wc->hbrBackground, wc->style, wc->cbClsExtra,
                    wc->cbWndExtra, classPtr );
@@ -487,7 +486,7 @@
         return 0;
     }
 
-    dprintf_class( stddeb, "RegisterClassEx32W: atom=%04x wndproc=%08lx hinst=%04x bg=%04x style=%08x clsExt=%d winExt=%d class=%p\n",
+    dprintf_info(class, "RegisterClassEx32W: atom=%04x wndproc=%08lx hinst=%04x bg=%04x style=%08x clsExt=%d winExt=%d class=%p\n",
                    atom, (DWORD)wc->lpfnWndProc, wc->hInstance,
                    wc->hbrBackground, wc->style, wc->cbClsExtra,
                    wc->cbWndExtra, classPtr );
diff --git a/windows/clipboard.c b/windows/clipboard.c
index ca97837..393bed5 100644
--- a/windows/clipboard.c
+++ b/windows/clipboard.c
@@ -21,7 +21,6 @@
 #include "message.h"
 #include "clipboard.h"
 #include "xmalloc.h"
-#include "stddebug.h"
 #include "debug.h"
 
 #define  CF_REGFORMATBASE 	0xC000
@@ -93,7 +92,7 @@
  */
 static void CLIPBOARD_CheckSelection(WND* pWnd)
 {
-    dprintf_clipboard(stddeb,"\tchecking %08x\n", (unsigned)pWnd->window);
+    dprintf_info(clipboard,"\tchecking %08x\n", (unsigned)pWnd->window);
 
     if( selectionAcquired && selectionWindow != None &&
         pWnd->window == selectionWindow )
@@ -107,7 +106,7 @@
              if( pWnd->parent->child != pWnd ) 
                  selectionWindow = pWnd->parent->child->window;
 
-	dprintf_clipboard(stddeb,"\tswitching selection from %08x to %08x\n", 
+	dprintf_info(clipboard,"\tswitching selection from %08x to %08x\n", 
                     (unsigned)selectionPrevWindow, (unsigned)selectionWindow);
 
 	if( selectionWindow != None )
@@ -147,7 +146,7 @@
 {
     LPCLIPFORMAT lpFormat = ClipFormats;
 
-    dprintf_clipboard(stddeb,"DisOwn: clipboard owner = %04x, selection = %08x\n", 
+    dprintf_info(clipboard,"DisOwn: clipboard owner = %04x, selection = %08x\n", 
 				hWndClipOwner, (unsigned)selectionWindow);
 
     if( pWnd->hwndSelf == hWndClipOwner)
@@ -160,7 +159,7 @@
 	{
 	    if( lpFormat->wDataPresent && !lpFormat->hData )
 	    {
-		dprintf_clipboard( stddeb,"\tdata missing for clipboard format %i\n", 
+		dprintf_info(clipboard,"\tdata missing for clipboard format %i\n", 
 				   lpFormat->wFormatID); 
 		lpFormat->wDataPresent = 0;
 	    }
@@ -205,7 +204,7 @@
 
     if( !hWnd ) return FALSE;
 
-    dprintf_clipboard(stddeb,"Requesting selection...\n");
+    dprintf_info(clipboard,"Requesting selection...\n");
 
   /* request data type XA_STRING, later
    * CLIPBOARD_ReadSelection() will be invoked 
@@ -225,7 +224,7 @@
     while(selectionWait) EVENT_WaitNetEvent( TRUE, FALSE );
 
   /* we treat Unix text as CF_OEMTEXT */
-    dprintf_clipboard(stddeb,"\tgot CF_OEMTEXT = %i\n", 
+    dprintf_info(clipboard,"\tgot CF_OEMTEXT = %i\n", 
 		      ClipFormats[CF_OEMTEXT-1].wDataPresent);
 
     return (BOOL32)ClipFormats[CF_OEMTEXT-1].wDataPresent;
@@ -267,7 +266,7 @@
 {
     BOOL32 bRet;
 
-    dprintf_clipboard(stddeb,"OpenClipboard(%04x) = ", hWnd);
+    dprintf_info(clipboard,"OpenClipboard(%04x)...\n", hWnd);
 
     if (!hqClipLock)
     {
@@ -278,7 +277,7 @@
     }
     else bRet = FALSE;
 
-    dprintf_clipboard(stddeb,"%i\n", bRet);
+    dprintf_info(clipboard,"   returning %i\n", bRet);
     return bRet;
 }
 
@@ -297,7 +296,7 @@
  */
 BOOL32 WINAPI CloseClipboard32(void)
 {
-    dprintf_clipboard(stddeb,"CloseClipboard(); !\n");
+    dprintf_info(clipboard,"CloseClipboard(); !\n");
 
     if (hqClipLock == GetTaskQueue(0))
     {
@@ -327,7 +326,7 @@
 {
     LPCLIPFORMAT lpFormat = ClipFormats; 
 
-    dprintf_clipboard(stddeb,"EmptyClipboard()\n");
+    dprintf_info(clipboard,"EmptyClipboard()\n");
 
     if (hqClipLock != GetTaskQueue(0)) return FALSE;
 
@@ -352,7 +351,7 @@
 	selectionPrevWindow 	= selectionWindow;
 	selectionWindow 	= None;
 
-	dprintf_clipboard(stddeb, "\tgiving up selection (spw = %08x)\n", 
+	dprintf_info(clipboard, "\tgiving up selection (spw = %08x)\n", 
 				 	(unsigned)selectionPrevWindow);
 
 	TSXSetSelectionOwner(display, XA_PRIMARY, None, CurrentTime);
@@ -387,7 +386,7 @@
     LPCLIPFORMAT lpFormat = __lookup_format( ClipFormats, wFormat );
     Window       owner;
 
-    dprintf_clipboard(stddeb,
+    dprintf_info(clipboard,
 		"SetClipboardData(%04X, %04x) !\n", wFormat, hData);
 
     /* NOTE: If the hData is zero and current owner doesn't match
@@ -412,7 +411,7 @@
 	    selectionAcquired = True;
 	    selectionWindow = owner;
 
-	    dprintf_clipboard(stddeb,"Grabbed X selection, owner=(%08x)\n", 
+	    dprintf_info(clipboard,"Grabbed X selection, owner=(%08x)\n", 
 						(unsigned) owner);
 	}
     }
@@ -460,7 +459,7 @@
                      (WPARAM16)lpFormat->wFormatID,0L);
    else
    {
-       dprintf_clipboard(stddeb,"\thWndClipOwner (%04x) is lost!\n", 
+       dprintf_warn(clipboard, "\thWndClipOwner (%04x) is lost!\n", 
                                       hWndClipOwner);
        hWndClipOwner = 0; lpFormat->wDataPresent = 0;
        return FALSE;
@@ -480,7 +479,7 @@
     LPSTR  lpstrT;
 
     if( !lpstrS ) return FALSE;
-    dprintf_clipboard(stddeb,"\tconverting from '%s' to '%s', %i chars\n",
+    dprintf_info(clipboard,"\tconverting from '%s' to '%s', %i chars\n",
 			   	      lpSource->Name, lpTarget->Name, size);
 
     lpTarget->hData = GlobalAlloc16(GMEM_ZEROINIT, size); 
@@ -492,7 +491,7 @@
 	    CharToOemBuff32A(lpstrS, lpstrT, size);
 	else
 	    OemToCharBuff32A(lpstrS, lpstrT, size);
-	dprintf_clipboard(stddeb,"\tgot %s\n", lpstrT);
+	dprintf_info(clipboard,"\tgot %s\n", lpstrT);
 	return TRUE;
     }
 
@@ -510,7 +509,7 @@
 
     if (hqClipLock != GetTaskQueue(0)) return 0;
 
-    dprintf_clipboard(stddeb,"GetClipboardData(%04X)\n", wFormat);
+    dprintf_info(clipboard,"GetClipboardData(%04X)\n", wFormat);
 
     if( wFormat == CF_TEXT && !lpRender[CF_TEXT-1].wDataPresent 
 			   &&  lpRender[CF_OEMTEXT-1].wDataPresent )
@@ -518,7 +517,7 @@
 	lpRender = &ClipFormats[CF_OEMTEXT-1];
 	lpUpdate = &ClipFormats[CF_TEXT-1];
 
-	dprintf_clipboard(stddeb,"\tOEMTEXT -> TEXT\n");
+	dprintf_info(clipboard,"\tOEMTEXT -> TEXT\n");
     }
     else if( wFormat == CF_OEMTEXT && !lpRender[CF_OEMTEXT-1].wDataPresent
 				   &&  lpRender[CF_TEXT-1].wDataPresent )
@@ -526,7 +525,7 @@
         lpRender = &ClipFormats[CF_TEXT-1];
 	lpUpdate = &ClipFormats[CF_OEMTEXT-1];
 	
-	dprintf_clipboard(stddeb,"\tTEXT -> OEMTEXT\n");
+	dprintf_info(clipboard,"\tTEXT -> OEMTEXT\n");
     }
     else
     {
@@ -538,7 +537,7 @@
     if( lpUpdate != lpRender && !lpUpdate->hData ) 
 	CLIPBOARD_RenderText(lpUpdate, lpRender);
 
-    dprintf_clipboard(stddeb,"\treturning %04x (type %i)\n", 
+    dprintf_info(clipboard,"\treturning %04x (type %i)\n", 
 			      lpUpdate->hData, lpUpdate->wFormatID);
     return lpUpdate->hData;
 }
@@ -570,7 +569,7 @@
     INT32 FormatCount = 0;
     LPCLIPFORMAT lpFormat = ClipFormats; 
 
-    dprintf_clipboard(stddeb,"CountClipboardFormats()\n");
+    dprintf_info(clipboard,"CountClipboardFormats()\n");
 
     if( !selectionAcquired ) CLIPBOARD_RequestXSelection();
 
@@ -582,13 +581,13 @@
 	if (lpFormat == NULL) break;
 	if (lpFormat->wDataPresent) 
 	{
-            dprintf_clipboard(stddeb, "\tdata found for format %i\n", lpFormat->wFormatID);
+            dprintf_info(clipboard, "\tdata found for format %i\n", lpFormat->wFormatID);
 	    FormatCount++;
 	}
 	lpFormat = lpFormat->NextFormat;
     }
 
-    dprintf_clipboard(stddeb,"\ttotal %d\n", FormatCount);
+    dprintf_info(clipboard,"\ttotal %d\n", FormatCount);
     return FormatCount;
 }
 
@@ -609,7 +608,7 @@
 {
     LPCLIPFORMAT lpFormat = ClipFormats; 
 
-    dprintf_clipboard(stddeb,"EnumClipboardFormats(%04X)\n", wFormat);
+    dprintf_info(clipboard,"EnumClipboardFormats(%04X)\n", wFormat);
 
     if( hqClipLock != GetTaskQueue(0) ) return 0;
 
@@ -652,7 +651,7 @@
 
     if (FormatName == NULL) return 0;
 
-    dprintf_clipboard(stddeb,"RegisterClipboardFormat('%s') !\n", FormatName);
+    dprintf_info(clipboard,"RegisterClipboardFormat('%s') !\n", FormatName);
 
     /* walk format chain to see if it's already registered */
 
@@ -725,13 +724,13 @@
 {
     LPCLIPFORMAT lpFormat = __lookup_format( ClipFormats, wFormat );
 
-    dprintf_clipboard(stddeb,
+    dprintf_info(clipboard,
 	"GetClipboardFormatName(%04X, %p, %d) !\n", wFormat, retStr, maxlen);
 
     if (lpFormat == NULL || lpFormat->Name == NULL || 
 	lpFormat->wFormatID < CF_REGFORMATBASE) return 0;
 
-    dprintf_clipboard(stddeb,
+    dprintf_info(clipboard,
 		"GetClipboardFormat // Name='%s' !\n", lpFormat->Name);
 
     lstrcpyn32A( retStr, lpFormat->Name, maxlen );
@@ -768,7 +767,7 @@
 {
     HWND32 hwndPrev = hWndViewer;
 
-    dprintf_clipboard(stddeb,"SetClipboardViewer(%04x): returning %04x\n", hWnd, hwndPrev);
+    dprintf_info(clipboard,"SetClipboardViewer(%04x): returning %04x\n", hWnd, hwndPrev);
 
     hWndViewer = hWnd;
     return hwndPrev;
@@ -808,13 +807,14 @@
 {
     BOOL32 bRet = 0;
 
-    dprintf_clipboard(stdnimp, "ChangeClipboardChain(%04x, %04x)\n", hWnd, hWndNext);
+    dprintf_fixme(clipboard, "ChangeClipboardChain(%04x, %04x) - stub?\n", 
+		      hWnd, hWndNext);
 
     if( hWndViewer )
 	bRet = !SendMessage16( hWndViewer, WM_CHANGECBCHAIN,
                              (WPARAM16)hWnd, (LPARAM)hWndNext);   
     else
-	dprintf_clipboard(stddeb,"ChangeClipboardChain: hWndViewer is lost\n");
+	dprintf_warn(clipboard, "ChangeClipboardChain: hWndViewer is lost\n");
 
     if( hWnd == hWndViewer ) hWndViewer = hWndNext;
 
@@ -837,7 +837,7 @@
  */
 BOOL32 WINAPI IsClipboardFormatAvailable32( UINT32 wFormat )
 {
-    dprintf_clipboard(stddeb,"IsClipboardFormatAvailable(%04X) !\n", wFormat);
+    dprintf_info(clipboard,"IsClipboardFormatAvailable(%04X) !\n", wFormat);
 
     if( (wFormat == CF_TEXT || wFormat == CF_OEMTEXT) &&
         !selectionAcquired ) CLIPBOARD_RequestXSelection();
@@ -907,7 +907,7 @@
     HANDLE16 	 hText = 0;
     LPCLIPFORMAT lpFormat = ClipFormats; 
 
-    dprintf_clipboard(stddeb,"ReadSelection callback\n");
+    dprintf_info(clipboard,"ReadSelection callback\n");
 
     if(prop != None)
     {
@@ -916,16 +916,16 @@
 	unsigned long 	nitems,remain;
 	unsigned char*	val=NULL;
 
-        dprintf_clipboard(stddeb,"\tgot property %s\n",TSXGetAtomName(display,prop));
+        dprintf_info(clipboard,"\tgot property %s\n",TSXGetAtomName(display,prop));
 
         /* TODO: Properties longer than 64K */
 
 	if(TSXGetWindowProperty(display,w,prop,0,0x3FFF,True,XA_STRING,
 	    &atype, &aformat, &nitems, &remain, &val) != Success)
-	    dprintf_clipboard(stddeb,"\tcouldn't read property\n");
+	    dprintf_warn(clipboard, "\tcouldn't read property\n");
 	else
 	{
-           dprintf_clipboard(stddeb,"\tType %s,Format %d,nitems %ld,value %s\n",
+           dprintf_info(clipboard,"\tType %s,Format %d,nitems %ld,value %s\n",
 		             TSXGetAtomName(display,atype),aformat,nitems,val);
 
 	   if(atype == XA_STRING && aformat == 8)
@@ -933,7 +933,7 @@
 	      int 	i,inlcount = 0;
 	      char*	lpstr;
 
-	      dprintf_clipboard(stddeb,"\tselection is '%s'\n",val);
+	      dprintf_info(clipboard,"\tselection is '%s'\n",val);
 
 	      for(i=0; i <= nitems; i++)
 		  if( val[i] == '\n' ) inlcount++;
@@ -985,7 +985,7 @@
      * selectionPrevWindow is nonzero if CheckSelection() was called. 
      */
 
-    dprintf_clipboard(stddeb,"\tevent->window = %08x (sw = %08x, spw=%08x)\n", 
+    dprintf_info(clipboard,"\tevent->window = %08x (sw = %08x, spw=%08x)\n", 
 	  (unsigned)w, (unsigned)selectionWindow, (unsigned)selectionPrevWindow );
 
     if( selectionAcquired )
diff --git a/windows/dce.c b/windows/dce.c
index 9ff60c5..21d1080 100644
--- a/windows/dce.c
+++ b/windows/dce.c
@@ -25,8 +25,6 @@
 #include "region.h"
 #include "heap.h"
 #include "sysmetrics.h"
-#include "stddebug.h"
-/* #define DEBUG_DC */
 #include "debug.h"
 
 #define NB_DCE    5  /* Number of DCEs created at startup */
@@ -174,7 +172,7 @@
 
     dce->hClipRgn = 0;
 
-    dprintf_dc(stddeb,"\trestoring VisRgn\n");
+    dprintf_info(dc,"\trestoring VisRgn\n");
 
     RestoreVisRgn(dce->hDC);
 }
@@ -228,10 +226,11 @@
     {
 	DCE *dce;
 
-	dprintf_dc(stddeb,"InvalidateDCE: scope hwnd = %04x, (%i,%i - %i,%i)\n",
-                         wndScope->hwndSelf, pRectUpdate->left,pRectUpdate->top,
-				        pRectUpdate->right,pRectUpdate->bottom);
-	if( debugging_dc ) DCE_DumpCache();
+	dprintf_info(dc,"InvalidateDCE: scope hwnd = %04x, (%i,%i - %i,%i)\n",
+		     wndScope->hwndSelf, pRectUpdate->left,pRectUpdate->top,
+		     pRectUpdate->right,pRectUpdate->bottom);
+	if(debugging_info(dc)) 
+	  DCE_DumpCache();
 
  	/* walk all DCEs and fixup non-empty entries */
 
@@ -268,7 +267,7 @@
 				{
 				    /* Don't bother with visible regions of unused DCEs */
 
-				    dprintf_dc(stddeb,"\tpurged %08x dce [%04x]\n", 
+				    dprintf_info(dc,"\tpurged %08x dce [%04x]\n", 
 						(unsigned)dce, wndCurrent->hwndSelf);
 
 				    dce->hwndCurrent = 0;
@@ -279,7 +278,7 @@
 				{
 				    /* Set dirty bits in the hDC and DCE structs */
 
-				    dprintf_dc(stddeb,"\tfixed up %08x dce [%04x]\n", 
+				    dprintf_info(dc,"\tfixed up %08x dce [%04x]\n", 
 						(unsigned)dce, wndCurrent->hwndSelf);
 
 				    dce->DCXflags |= DCX_DCEDIRTY;
@@ -606,7 +605,7 @@
     BOOL32	bUpdateVisRgn = TRUE;
     BOOL32	bUpdateClipOrigin = FALSE;
 
-    dprintf_dc(stddeb,"GetDCEx: hwnd %04x, hrgnClip %04x, flags %08x\n", 
+    dprintf_info(dc,"GetDCEx: hwnd %04x, hrgnClip %04x, flags %08x\n", 
 				hwnd, hrgnClip, (unsigned)flags);
     
     if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0;
@@ -685,7 +684,7 @@
 		   ((dce->DCXflags & (DCX_CLIPSIBLINGS | DCX_CLIPCHILDREN |
 				      DCX_CACHE | DCX_WINDOW | DCX_PARENTCLIP)) == dcxFlags))
 		{
-		    dprintf_dc(stddeb,"\tfound valid %08x dce [%04x], flags %08x\n", 
+		    dprintf_info(dc,"\tfound valid %08x dce [%04x], flags %08x\n", 
 					(unsigned)dce, hwnd, (unsigned)dcxFlags );
 		    bUpdateVisRgn = FALSE; 
 		    bUpdateClipOrigin = TRUE;
@@ -700,7 +699,7 @@
         dce = (wndPtr->class->style & CS_OWNDC) ? wndPtr->dce : wndPtr->class->dce;
 	if( dce->hwndCurrent == hwnd )
 	{
-	    dprintf_dc(stddeb,"\tskipping hVisRgn update\n");
+	    dprintf_info(dc,"\tskipping hVisRgn update\n");
 	    bUpdateVisRgn = FALSE; /* updated automatically, via DCHook() */
 
 	    if( (dce->DCXflags & (DCX_EXCLUDERGN | DCX_INTERSECTRGN)) &&
@@ -734,7 +733,7 @@
     DCE_SetDrawable( wndPtr, dc, flags, bUpdateClipOrigin );
     if( bUpdateVisRgn )
     {
-	dprintf_dc(stddeb,"updating visrgn for %08x dce, hwnd [%04x]\n", (unsigned)dce, hwnd);
+	dprintf_info(dc,"updating visrgn for %08x dce, hwnd [%04x]\n", (unsigned)dce, hwnd);
 
 	if (flags & DCX_PARENTCLIP)
         {
@@ -770,7 +769,7 @@
 	SelectVisRgn( hdc, hrgnVisible );
     }
     else
-	dprintf_dc(stddeb,"no visrgn update %08x dce, hwnd [%04x]\n", (unsigned)dce, hwnd);
+	dprintf_info(dc,"no visrgn update %08x dce, hwnd [%04x]\n", (unsigned)dce, hwnd);
 
     /* apply additional region operation (if any) */
 
@@ -781,7 +780,7 @@
 	dce->DCXflags |= flags & (DCX_KEEPCLIPRGN | DCX_INTERSECTRGN | DCX_EXCLUDERGN);
 	dce->hClipRgn = hrgnClip;
 
-	dprintf_dc(stddeb, "\tsaved VisRgn, clipRgn = %04x\n", hrgnClip);
+	dprintf_info(dc, "\tsaved VisRgn, clipRgn = %04x\n", hrgnClip);
 
 	SaveVisRgn( hdc );
         CombineRgn32( hrgnVisible, InquireVisRgn( hdc ), hrgnClip,
@@ -791,7 +790,7 @@
 
     if( hrgnVisible ) DeleteObject32( hrgnVisible );
 
-    dprintf_dc(stddeb, "GetDCEx(%04x,%04x,0x%lx): returning %04x\n", 
+    dprintf_info(dc, "GetDCEx(%04x,%04x,0x%lx): returning %04x\n", 
 	       hwnd, hrgnClip, flags, hdc);
     return hdc;
 }
@@ -853,7 +852,7 @@
 {
     DCE * dce = firstDCE;
     
-    dprintf_dc(stddeb, "ReleaseDC: %04x %04x\n", hwnd, hdc );
+    dprintf_info(dc, "ReleaseDC: %04x %04x\n", hwnd, hdc );
         
     while (dce && (dce->hDC != hdc)) dce = dce->next;
 
@@ -873,7 +872,7 @@
     HRGN32 hVisRgn;
     DCE *dce = firstDCE;;
 
-    dprintf_dc(stddeb,"DCHook: hDC = %04x, %i\n", hDC, code);
+    dprintf_info(dc,"DCHook: hDC = %04x, %i\n", hDC, code);
 
     while (dce && (dce->hDC != hDC)) dce = dce->next;
     if (!dce) return 0;
@@ -892,7 +891,7 @@
 	       SetHookFlags(hDC, DCHF_VALIDATEVISRGN);
 	       hVisRgn = DCE_GetVisRgn(dce->hwndCurrent, dce->DCXflags);
 
-	       dprintf_dc(stddeb,"\tapplying saved clipRgn\n");
+	       dprintf_info(dc,"\tapplying saved clipRgn\n");
   
 	       /* clip this region with saved clipping region */
 
@@ -912,7 +911,7 @@
 	       DeleteObject32( hVisRgn );
 	   }
            else /* non-fatal but shouldn't happen */
-	     dprintf_dc(stddeb,"DCHook: DC is not in use!\n");
+	     dprintf_warn(dc, "DCHook: DC is not in use!\n");
 	   break;
 
       case DCHC_DELETEDC: /* FIXME: ?? */
diff --git a/windows/defwnd.c b/windows/defwnd.c
index 3cb57b8..cc3ec64 100644
--- a/windows/defwnd.c
+++ b/windows/defwnd.c
@@ -14,7 +14,6 @@
 #include "winpos.h"
 #include "dce.h"
 #include "sysmetrics.h"
-#include "stddebug.h"
 #include "debug.h"
 #include "spy.h"
 
@@ -98,7 +97,7 @@
 {
     BOOL32 bVisible = wndPtr->dwStyle & WS_VISIBLE;
 
-dprintf_win(stddeb,"SetRedraw: %04x %i\n", wndPtr->hwndSelf, (wParam!=0) );
+dprintf_info(win,"SetRedraw: %04x %i\n", wndPtr->hwndSelf, (wParam!=0) );
 
     if( wParam )
     {
@@ -185,7 +184,7 @@
 			SYSMETRICS_CXICON)/2;
 	        int y = (wndPtr->rectWindow.bottom - wndPtr->rectWindow.top -
 			SYSMETRICS_CYICON)/2;
-		dprintf_win(stddeb,"Painting class icon: vis rect=(%i,%i - %i,%i)\n",
+		dprintf_info(win,"Painting class icon: vis rect=(%i,%i - %i,%i)\n",
 		ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right, ps.rcPaint.bottom );
 	        DrawIcon32( hdc, x, y, wndPtr->class->hIcon );
 	      }
diff --git a/windows/dialog.c b/windows/dialog.c
index 59ddae6..2e2c85f 100644
--- a/windows/dialog.c
+++ b/windows/dialog.c
@@ -21,7 +21,6 @@
 #include "winproc.h"
 #include "message.h"
 #include "sysmetrics.h"
-#include "stddebug.h"
 #include "debug.h"
 
 
@@ -84,7 +83,7 @@
     if (!(tm.tmPitchAndFamily & TMPF_FIXED_PITCH))
         xBaseUnit = xBaseUnit * 5 / 4;
 
-    dprintf_dialog( stddeb, "DIALOG_Init: base units = %d,%d\n",
+    dprintf_info(dialog, "DIALOG_Init: base units = %d,%d\n",
                     xBaseUnit, yBaseUnit );
     return TRUE;
 }
@@ -147,12 +146,12 @@
     p += *p + 1;
 
     if(int_id)
-      dprintf_dialog( stddeb,"   %s %04x %d, %d, %d, %d, %d, %08lx, %08lx\n", 
+      dprintf_info(dialog,"   %s %04x %d, %d, %d, %d, %d, %08lx, %08lx\n", 
 		      info->className,  LOWORD(info->windowName),
 		      info->id, info->x, info->y, info->cx, info->cy,
 		      info->style, (DWORD)info->data);
     else
-      dprintf_dialog( stddeb,"   %s '%s' %d, %d, %d, %d, %d, %08lx, %08lx\n", 
+      dprintf_info(dialog,"   %s '%s' %d, %d, %d, %d, %d, %08lx, %08lx\n", 
 		      info->className,  info->windowName,
 		      info->id, info->x, info->y, info->cx, info->cy,
 		      info->style, (DWORD)info->data);
@@ -222,12 +221,12 @@
     p++;
 
     if(int_id)
-      dprintf_dialog( stddeb,"   %p %04x %d, %d, %d, %d, %d, %08lx, %08lx, %08lx\n", 
+      dprintf_info(dialog,"   %p %04x %d, %d, %d, %d, %d, %08lx, %08lx, %08lx\n", 
 		      info->className, LOWORD(info->windowName),
 		      info->id, info->x, info->y, info->cx, info->cy,
 		      info->style, info->exStyle, (DWORD)info->data);
     else
-      dprintf_dialog( stddeb,"   %p '%p' %d, %d, %d, %d, %d, %08lx, %08lx, %08lx\n", 
+      dprintf_info(dialog,"   %p '%p' %d, %d, %d, %d, %d, %08lx, %08lx, %08lx\n", 
 		      info->className, info->windowName,
 		      info->id, info->x, info->y, info->cx, info->cy,
 		      info->style, info->exStyle, (DWORD)info->data);
@@ -249,7 +248,7 @@
     DLG_CONTROL_INFO info;
     HWND32 hwndCtrl, hwndDefButton = 0;
 
-    dprintf_dialog(stddeb, " BEGIN\n" );
+    dprintf_info(dialog, " BEGIN\n" );
     while (items--)
     {
         if (!win32)
@@ -313,7 +312,7 @@
             dlgInfo->idResult = GetWindowWord32( hwndCtrl, GWW_ID );
         }
     }    
-    dprintf_dialog(stddeb, " END\n" );
+    dprintf_info(dialog, " END\n" );
     return TRUE;
 }
 
@@ -333,9 +332,9 @@
     result->y       = GET_WORD(p);  p += sizeof(WORD);
     result->cx      = GET_WORD(p);  p += sizeof(WORD);
     result->cy      = GET_WORD(p);  p += sizeof(WORD);
-    dprintf_dialog( stddeb, "DIALOG %d, %d, %d, %d\n",
+    dprintf_info(dialog, "DIALOG %d, %d, %d, %d\n",
                     result->x, result->y, result->cx, result->cy );
-    dprintf_dialog( stddeb, " STYLE %08lx\n", result->style );
+    dprintf_info(dialog, " STYLE %08lx\n", result->style );
 
     /* Get the menu name */
 
@@ -348,11 +347,11 @@
     case 0xff:
         result->menuName = (LPCSTR)(UINT32)GET_WORD( p + 1 );
         p += 3;
-	dprintf_dialog(stddeb, " MENU %04x\n", LOWORD(result->menuName) );
+	dprintf_info(dialog, " MENU %04x\n", LOWORD(result->menuName) );
         break;
     default:
         result->menuName = p;
-        dprintf_dialog( stddeb, " MENU '%s'\n", p );
+        dprintf_info(dialog, " MENU '%s'\n", p );
         p += strlen(p) + 1;
         break;
     }
@@ -362,7 +361,7 @@
     if (*p)
     {
         result->className = p;
-        dprintf_dialog( stddeb, " CLASS '%s'\n", result->className );
+        dprintf_info(dialog, " CLASS '%s'\n", result->className );
     }
     else result->className = DIALOG_CLASS_ATOM;
     p += strlen(p) + 1;
@@ -371,7 +370,7 @@
 
     result->caption = p;
     p += strlen(p) + 1;
-    dprintf_dialog( stddeb, " CAPTION '%s'\n", result->caption );
+    dprintf_info(dialog, " CAPTION '%s'\n", result->caption );
 
     /* Get the font name */
 
@@ -381,7 +380,7 @@
         p += sizeof(WORD);
 	result->faceName = p;
         p += strlen(p) + 1;
-	dprintf_dialog( stddeb, " FONT %d,'%s'\n",
+	dprintf_info(dialog, " FONT %d,'%s'\n",
                         result->pointSize, result->faceName );
     }
     return p;
@@ -405,10 +404,10 @@
     result->y       = GET_WORD(p); p++;
     result->cx      = GET_WORD(p); p++;
     result->cy      = GET_WORD(p); p++;
-    dprintf_dialog( stddeb, "DIALOG %d, %d, %d, %d\n",
+    dprintf_info(dialog, "DIALOG %d, %d, %d, %d\n",
                     result->x, result->y, result->cx, result->cy );
-    dprintf_dialog( stddeb, " STYLE %08lx\n", result->style );
-    dprintf_dialog( stddeb, " EXSTYLE %08lx\n", result->exStyle );
+    dprintf_info(dialog, " STYLE %08lx\n", result->style );
+    dprintf_info(dialog, " EXSTYLE %08lx\n", result->exStyle );
 
     /* Get the menu name */
 
@@ -421,11 +420,11 @@
     case 0xffff:
         result->menuName = (LPCSTR)(UINT32)GET_WORD( p + 1 );
         p += 2;
-	dprintf_dialog(stddeb, " MENU %04x\n", LOWORD(result->menuName) );
+	dprintf_info(dialog, " MENU %04x\n", LOWORD(result->menuName) );
         break;
     default:
         result->menuName = (LPCSTR)p;
-        dprintf_dialog( stddeb, " MENU '%p'\n", p );
+        dprintf_info(dialog, " MENU '%p'\n", p );
         p += lstrlen32W( (LPCWSTR)p ) + 1;
         break;
     }
@@ -441,11 +440,11 @@
     case 0xffff:
         result->className = (LPCSTR)(UINT32)GET_WORD( p + 1 );
         p += 2;
-	dprintf_dialog(stddeb, " CLASS %04x\n", LOWORD(result->className) );
+	dprintf_info(dialog, " CLASS %04x\n", LOWORD(result->className) );
         break;
     default:
         result->className = (LPCSTR)p;
-        dprintf_dialog( stddeb, " CLASS '%p'\n", p );
+        dprintf_info(dialog, " CLASS '%p'\n", p );
         p += lstrlen32W( (LPCWSTR)p ) + 1;
         break;
     }
@@ -454,7 +453,7 @@
 
     result->caption = (LPCSTR)p;
     p += lstrlen32W( (LPCWSTR)p ) + 1;
-    dprintf_dialog( stddeb, " CAPTION '%p'\n", result->caption );
+    dprintf_info(dialog, " CAPTION '%p'\n", result->caption );
 
     /* Get the font name */
 
@@ -464,7 +463,7 @@
         p++;
 	result->faceName = (LPCSTR)p;
         p += lstrlen32W( (LPCWSTR)p ) + 1;
-	dprintf_dialog( stddeb, " FONT %d,'%p'\n",
+	dprintf_info(dialog, " FONT %d,'%p'\n",
                         result->pointSize, result->faceName );
     }
     /* First control is on dword boundary */
@@ -667,7 +666,7 @@
     HGLOBAL16 hmem;
     LPCVOID data;
 
-    dprintf_dialog(stddeb, "CreateDialogParam16: %04x,%08lx,%04x,%08lx,%ld\n",
+    dprintf_info(dialog, "CreateDialogParam16: %04x,%08lx,%04x,%08lx,%ld\n",
                    hInst, (DWORD)dlgTemplate, owner, (DWORD)dlgProc, param );
 
     if (!(hRsrc = FindResource16( hInst, dlgTemplate, RT_DIALOG ))) return 0;
@@ -915,7 +914,7 @@
     WND * wndPtr = WIN_FindWndPtr( hwnd );
     DIALOGINFO * dlgInfo = (DIALOGINFO *)wndPtr->wExtra;
 
-    dprintf_dialog(stddeb, "EndDialog: %04x %d\n", hwnd, retval );
+    dprintf_info(dialog, "EndDialog: %04x %d\n", hwnd, retval );
 
     if( dlgInfo )
     {
@@ -1557,7 +1556,7 @@
     BOOL32 ret;
     HWND32 listbox = GetDlgItem32( hwnd, id );
 
-    dprintf_dialog( stddeb, "DlgDirSelect: %04x '%s' %d\n", hwnd, str, id );
+    dprintf_info(dialog, "DlgDirSelect: %04x '%s' %d\n", hwnd, str, id );
     if (!listbox) return FALSE;
     if (win32)
     {
@@ -1606,7 +1605,7 @@
     if (unicode) lstrcpynAtoW( (LPWSTR)str, ptr, len );
     else lstrcpyn32A( str, ptr, len );
     SEGPTR_FREE( buffer );
-    dprintf_dialog( stddeb, "Returning %d '%s'\n", ret, str );
+    dprintf_info(dialog, "Returning %d '%s'\n", ret, str );
     return ret;
 }
 
@@ -1627,7 +1626,7 @@
     ((attrib & DDL_POSTMSGS) ? PostMessage32A( hwnd, msg, wparam, lparam ) \
                              : SendMessage32A( hwnd, msg, wparam, lparam ))
 
-    dprintf_dialog( stddeb, "DlgDirList: %04x '%s' %d %d %04x\n",
+    dprintf_info(dialog, "DlgDirList: %04x '%s' %d %d %04x\n",
                     hDlg, spec ? spec : "NULL", idLBox, idStatic, attrib );
 
     if (spec && spec[0] && (spec[1] == ':'))
@@ -1659,7 +1658,7 @@
         }
     }
 
-    dprintf_dialog( stddeb, "ListBoxDirectory: path=%c:\\%s mask=%s\n",
+    dprintf_info(dialog, "ListBoxDirectory: path=%c:\\%s mask=%s\n",
                     'A' + drive, DRIVE_GetDosCwd(drive), spec );
 
     if (idLBox && ((hwnd = GetDlgItem32( hDlg, idLBox )) != 0))
diff --git a/windows/dinput.c b/windows/dinput.c
index 5f510cd..101435f 100644
--- a/windows/dinput.c
+++ b/windows/dinput.c
@@ -5,9 +5,13 @@
 /* Status:
  *
  * - Tomb Raider 2 Demo:
- *   Doesn't accept input yet. Although I am sure I've done everything right...
+ *   Playable using keyboard only.
  * - WingCommander Prophecy Demo:
- *   dito.
+ *   Doesn't get Input Focus.
+ * 
+ * FIXME: The keyboard handling needs to (and will) be merged into keyboard.c
+ *	  (The current implementation is currently only a proof of concept and
+ *	   an utter mess.)
  */
 
 #include "config.h"
@@ -28,9 +32,11 @@
 #include "heap.h"
 #include "win.h"
 #include "dinput.h"
-#include "stddebug.h"
 #include "debug.h"
 
+extern BYTE InputKeyStateTable[256];
+extern BYTE vkey2scode[512];
+
 static IDirectInputA_VTable ddiavt;
 static IDirectInputDeviceA_VTable SysKeyboardAvt;
 static IDirectInputDeviceA_VTable SysMouseAvt;
@@ -73,13 +79,14 @@
 ) {
 	char	xbuf[50];
 	
-	StringFromCLSID(rguid,xbuf);
+	WINE_StringFromCLSID(rguid,xbuf);
 	fprintf(stderr,"IDirectInputA(%p)->CreateDevice(%s,%p,%p),stub!\n",this,xbuf,pdev,punk);
 	if (!memcmp(&GUID_SysKeyboard,rguid,sizeof(GUID_SysKeyboard))) {
-		*pdev = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirectInputDevice32A));
+		*pdev = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(SysKeyboard32A));
 		(*pdev)->ref = 1;
 		(*pdev)->lpvtbl = &SysKeyboardAvt;
 		memcpy(&((*pdev)->guid),rguid,sizeof(*rguid));
+		memset(((LPSYSKEYBOARD32A)(*pdev))->keystate,0,256);
 		return 0;
 	}
 	if (!memcmp(&GUID_SysMouse,rguid,sizeof(GUID_SysMouse))) {
@@ -97,7 +104,7 @@
 ) {
 	char	xbuf[50];
 
-	StringFromCLSID(riid,xbuf);
+	WINE_StringFromCLSID(riid,xbuf);
 	fprintf(stderr,"IDirectInputA(%p)->QueryInterface(%s,%p)\n",this,xbuf,ppobj);
 	if (!memcmp(&IID_IUnknown,riid,sizeof(*riid))) {
 		this->lpvtbl->fnAddRef(this);
@@ -112,6 +119,12 @@
 	return E_FAIL;
 }
 
+static HRESULT WINAPI IDirectInputA_Initialize(
+	LPDIRECTINPUT32A this,HINSTANCE32 hinst,DWORD x
+) {
+	return DIERR_ALREADYINITIALIZED;
+}
+
 static IDirectInputA_VTable ddiavt= {
 	IDirectInputA_QueryInterface,
 	IDirectInputA_AddRef,
@@ -120,7 +133,7 @@
 	IDirectInputA_EnumDevices,
 	(void*)6,
 	(void*)7,
-	(void*)8
+	IDirectInputA_Initialize
 };
 
 /******************************************************************************
@@ -143,7 +156,7 @@
 		char	xbuf[50];
 
 		if (df->rgodf[i].pguid)
-			StringFromCLSID(df->rgodf[i].pguid,xbuf);
+			WINE_StringFromCLSID(df->rgodf[i].pguid,xbuf);
 		else
 			strcpy(xbuf,"<no guid>");
 		fprintf(stderr,"df.rgodf[%d].guid %s\n",i,xbuf);
@@ -168,10 +181,23 @@
 	char	xbuf[50];
 
 	if (HIWORD(rguid))
-		StringFromCLSID(rguid,xbuf);
+		WINE_StringFromCLSID(rguid,xbuf);
 	else
-		strcpy(xbuf,"<no guid>");
+		sprintf(xbuf,"<special guid %ld>",(DWORD)rguid);
 	fprintf(stderr,"IDirectInputDeviceA(%p)->SetProperty(%s,%p)\n",this,xbuf,ph);
+	if (!HIWORD(rguid)) {
+		switch ((DWORD)rguid) {
+		case DIPROP_BUFFERSIZE: {
+			LPCDIPROPDWORD	pd = (LPCDIPROPDWORD)ph;
+
+			fprintf(stderr,"	buffersize = %ld\n",pd->dwData);
+			break;
+		}
+		default:
+			fprintf(stderr,"	unknown type %ld\n",(DWORD)rguid);
+			break;
+		}
+	}
 	return 0;
 }
 
@@ -183,15 +209,14 @@
 }
 
 static HRESULT WINAPI IDirectInputDeviceA_GetDeviceData(
-	LPDIRECTINPUTDEVICE32A this,DWORD x,LPDIDEVICEOBJECTDATA dod,
-	LPDWORD y,DWORD z
+	LPDIRECTINPUTDEVICE32A this,DWORD dodsize,LPDIDEVICEOBJECTDATA dod,
+	LPDWORD entries,DWORD flags
 ) {
-/*
-	fprintf(stderr,"IDirectInputDeviceA(%p)->GetDeviceData(0x%08lx,%p,%p,0x%08lx)\n",this,x,dod,y,z);
- */
+/*	fprintf(stderr,"IDirectInputDeviceA(%p)->GetDeviceData(%ld,%p,%p(0x%08lx),0x%08lx)\n",this,dodsize,dod,entries,*entries,flags);*/
 	return 0;
 }
 
+
 static HRESULT WINAPI IDirectInputDeviceA_Acquire(LPDIRECTINPUTDEVICE32A this) {
 	fprintf(stderr,"IDirectInputDeviceA(%p)->Aquire()\n",this);
 	return 0;
@@ -210,29 +235,100 @@
 	return 0;
 }
 
+static HRESULT WINAPI SysKeyboardA_SetProperty(
+	LPDIRECTINPUTDEVICE32A this,REFGUID rguid,LPCDIPROPHEADER ph
+) {
+	LPSYSKEYBOARD32A	kthis = (LPSYSKEYBOARD32A)this;
+	char			xbuf[50];
 
-extern BYTE InputKeyStateTable[256];
-extern BYTE vkey2scode[512];
+	if (HIWORD(rguid))
+		WINE_StringFromCLSID(rguid,xbuf);
+	else
+		sprintf(xbuf,"<special guid %ld>",(DWORD)rguid);
+	fprintf(stderr,"SysKeyboardA(%p)->SetProperty(%s,%p)\n",this,xbuf,ph);
+	fprintf(stderr,"	size is %ld, headersize is %ld,obj is %ld,how is %ld\n",ph->dwSize,ph->dwHeaderSize,ph->dwObj,ph->dwHow);
+	if (!HIWORD(rguid)) {
+		switch ((DWORD)rguid) {
+		case DIPROP_BUFFERSIZE: {
+			LPCDIPROPDWORD	pd = (LPCDIPROPDWORD)ph;
+
+			fprintf(stderr,"	buffersize = %ld\n",pd->dwData);
+			break;
+		}
+		default:
+			fprintf(stderr,"	unknown type %ld\n",(DWORD)rguid);
+			break;
+		}
+	}
+	return 0;
+}
+
+static HRESULT WINAPI SysKeyboardA_GetDeviceState(
+	LPDIRECTINPUTDEVICE32A this,DWORD len,LPVOID ptr
+) {
+	if (len==256) {
+		int	i;
+
+		memset(ptr,0,256);
+		for (i=0;i<256;i++)
+			if (InputKeyStateTable[i]&0x80) {
+				((LPBYTE)ptr)[vkey2scode[i]     ]=0x80;
+				((LPBYTE)ptr)[vkey2scode[i]|0x80]=0x80;
+			}
+		return 0;
+	}
+	fprintf(stderr,"whoops, SysKeyboardA_GetDeviceState got len %ld?\n",len);
+	return 0;
+}
+
+static HRESULT WINAPI SysKeyboardA_GetDeviceData(
+	LPDIRECTINPUTDEVICE32A this,DWORD dodsize,LPDIDEVICEOBJECTDATA dod,
+	LPDWORD entries,DWORD flags
+) {
+	int			i,n,xentries;
+	LPSYSKEYBOARD32A	kthis = (LPSYSKEYBOARD32A)this;
+
+/*	fprintf(stderr,"SysKeyboardA(%p)->GetDeviceData(%ld,%p,%p(%ld),0x%08lx)\n",this,dodsize,dod,entries,entries?*entries:0,flags);*/
+	if (entries)
+		xentries = *entries; 
+	else
+		xentries = 1;
+
+	for (n=i=0;(i<256) && (n<*entries);i++) {
+		if (kthis->keystate[i] == (InputKeyStateTable[i]&0x80))
+			continue;
+		if (dod) {
+			/* add an entry */
+			dod[n].dwOfs		= vkey2scode[i];
+			dod[n].dwData		= InputKeyStateTable[i]&0x80;
+			dod[n].dwTimeStamp	= 0; /* umm */
+			dod[n].dwSequence	= 0; /* umm */
+			n++;
+		}
+		if (!(flags & DIGDD_PEEK))
+			kthis->keystate[i] = InputKeyStateTable[i]&0x80;
+	}
+	*entries = n;
+	return 0;
+}
+
+static HRESULT WINAPI SysKeyboardA_Acquire(LPDIRECTINPUTDEVICE32A this) {
+	fprintf(stderr,"SysKeyboardA(%p)->Aquire()\n",this);
+	return 0;
+}
+
+static HRESULT WINAPI SysKeyboardA_Unacquire(LPDIRECTINPUTDEVICE32A this) {
+	fprintf(stderr,"SysKeyboardA(%p)->Unaquire()\n",this);
+	return 0;
+}
+
 
 static HRESULT WINAPI IDirectInputDeviceA_GetDeviceState(
 	LPDIRECTINPUTDEVICE32A this,DWORD len,LPVOID ptr
 ) {
-/*
 	fprintf(stderr,"IDirectInputDeviceA(%p)->GetDeviceState(0x%08lx,%p)\n",
 		this,len,ptr
 	);
- */
-	if (len==256) {/* && this_is_a_keyboard */
-		int	i;
-
-		memset(ptr,0,256);
-		for (i=0;i<256;i++) {
-			if (InputKeyStateTable[i]&0x80)
-				fprintf(stderr,"VKEY %d pressed (DIK 0x%02x\n",i,vkey2scode[i]);
-			((LPBYTE)ptr)[i]=vkey2scode[InputKeyStateTable[i]]&0x80;
-		}
-		return 0;
-	}
 	return 0;
 }
 
@@ -241,7 +337,7 @@
 ) {
 	char	xbuf[50];
 
-	StringFromCLSID(riid,xbuf);
+	WINE_StringFromCLSID(riid,xbuf);
 	fprintf(stderr,"IDirectInputA(%p)->QueryInterface(%s,%p)\n",this,xbuf,ppobj);
 	if (!memcmp(&IID_IUnknown,riid,sizeof(*riid))) {
 		this->lpvtbl->fnAddRef(this);
@@ -263,11 +359,11 @@
 	(void*)4,
 	(void*)5,
 	(void*)6,
-	IDirectInputDeviceA_SetProperty,
-	IDirectInputDeviceA_Acquire,
-	IDirectInputDeviceA_Unacquire,
-	IDirectInputDeviceA_GetDeviceState,
-	IDirectInputDeviceA_GetDeviceData,
+	SysKeyboardA_SetProperty,
+	SysKeyboardA_Acquire,
+	SysKeyboardA_Unacquire,
+	SysKeyboardA_GetDeviceState,
+	SysKeyboardA_GetDeviceData,
 	IDirectInputDeviceA_SetDataFormat,
 	IDirectInputDeviceA_SetEventNotification,
 	IDirectInputDeviceA_SetCooperativeLevel,
diff --git a/windows/driver.c b/windows/driver.c
index dbc8531..85eefe3 100644
--- a/windows/driver.c
+++ b/windows/driver.c
@@ -10,7 +10,6 @@
 #include "callback.h"
 #include "driver.h"
 #include "module.h"
-#include "stddebug.h"
 #include "debug.h"
 
 LPDRIVERITEM lpDrvItemList = NULL;
@@ -32,12 +31,12 @@
     ptr = str;
     while (lstrlen32A( ptr ) != 0)
     {
-	dprintf_driver( stddeb, "LoadStartupDrivers // str='%s'\n", ptr );
+	dprintf_info(driver, "LoadStartupDrivers // str='%s'\n", ptr );
 	hDrv = OpenDriver( ptr, "drivers", 0L );
-	dprintf_driver( stddeb, "LoadStartupDrivers // hDrv=%04x\n", hDrv );
+	dprintf_info(driver, "LoadStartupDrivers // hDrv=%04x\n", hDrv );
 	ptr += lstrlen32A(ptr) + 1;
     }
-    dprintf_driver( stddeb, "LoadStartupDrivers // end of list !\n" );
+    dprintf_info(driver, "LoadStartupDrivers // end of list !\n" );
 
     return;
 }
@@ -51,7 +50,7 @@
     LPDRIVERITEM lpdrv;
     LRESULT retval;
 
-    dprintf_driver( stddeb, "SendDriverMessage(%04x, %04X, %08lX, %08lX)\n",
+    dprintf_info(driver, "SendDriverMessage(%04x, %04X, %08lX, %08lX)\n",
 		    hDriver, msg, lParam1, lParam2 );
 
     lpdrv = (LPDRIVERITEM)GlobalLock16( hDriver );
@@ -64,7 +63,7 @@
     retval = Callbacks->CallDriverProc( lpdrv->lpDrvProc, 0L /* FIXME */,
                                         hDriver, msg, lParam1, lParam2 );
 
-    dprintf_driver( stddeb, "SendDriverMessage // retval = %ld\n", retval );
+    dprintf_info(driver, "SendDriverMessage // retval = %ld\n", retval );
 
     GlobalUnlock16( hDriver );
     return retval;
@@ -80,13 +79,13 @@
     char DrvName[128];
     WORD ordinal;
 
-    dprintf_driver( stddeb,"OpenDriver('%s', '%s', %08lX);\n",
+    dprintf_info(driver,"OpenDriver('%s', '%s', %08lX);\n",
 		    lpDriverName, lpSectionName, lParam );
 
     if (lpSectionName == NULL) lpSectionName = "drivers";
     GetPrivateProfileString32A( lpSectionName, lpDriverName, "", DrvName,
 			     sizeof(DrvName), "SYSTEM.INI" );
-    dprintf_driver( stddeb,"OpenDriver // DrvName='%s'\n", DrvName );
+    dprintf_info(driver,"OpenDriver // DrvName='%s'\n", DrvName );
     if (lstrlen32A(DrvName) < 1) return 0;
 
     lpdrv = lpDrvItemList;
@@ -147,7 +146,7 @@
     SendDriverMessage( hDrvr, DRV_ENABLE, 0L, lParam );
     SendDriverMessage( hDrvr, DRV_OPEN, 0L, lParam );
 
-    dprintf_driver( stddeb, "OpenDriver // hDrvr=%04x loaded !\n", hDrvr );
+    dprintf_info(driver, "OpenDriver // hDrvr=%04x loaded !\n", hDrvr );
     return hDrvr;
 }
 
@@ -158,7 +157,7 @@
 {
     LPDRIVERITEM lpdrv;
 
-    dprintf_driver( stddeb, "CloseDriver(%04x, %08lX, %08lX);\n",
+    dprintf_info(driver, "CloseDriver(%04x, %08lX, %08lX);\n",
 		    hDrvr, lParam1, lParam2 );
 
     lpdrv = (LPDRIVERITEM)GlobalLock16( hDrvr );
@@ -182,7 +181,7 @@
 	    GlobalFree16( hDrvr );
 	}
 
-        dprintf_driver( stddeb, "CloseDriver // hDrvr=%04x closed !\n",
+        dprintf_info(driver, "CloseDriver // hDrvr=%04x closed !\n",
 		        hDrvr );
 	return TRUE;
     }
@@ -197,7 +196,7 @@
     LPDRIVERITEM lpdrv;
     HMODULE16 hModule = 0;
 
-    dprintf_driver( stddeb, "GetDriverModuleHandle(%04x);\n", hDrvr);
+    dprintf_info(driver, "GetDriverModuleHandle(%04x);\n", hDrvr);
 
     lpdrv = (LPDRIVERITEM)GlobalLock16( hDrvr );
     if (lpdrv != NULL && lpdrv->dis.hDriver == hDrvr)
@@ -253,7 +252,7 @@
 {
     LPDRIVERITEM lpdrv;
 
-    dprintf_driver( stddeb, "GetDriverInfo(%04x, %p);\n", hDrvr, lpDrvInfo );
+    dprintf_info(driver, "GetDriverInfo(%04x, %p);\n", hDrvr, lpDrvInfo );
 
     if (lpDrvInfo == NULL) return FALSE;
 
@@ -273,17 +272,17 @@
     LPDRIVERITEM lpdrv;
     HDRVR16 hRetDrv = 0;
 
-    dprintf_driver( stddeb, "GetNextDriver(%04x, %08lX);\n", hDrvr, dwFlags );
+    dprintf_info(driver, "GetNextDriver(%04x, %08lX);\n", hDrvr, dwFlags );
 
     if (hDrvr == 0)
     {
 	if (lpDrvItemList == NULL)
 	{
-	    dprintf_driver(stddeb, "GetNextDriver // drivers list empty !\n");
+	    dprintf_info(driver, "GetNextDriver // drivers list empty !\n");
 	    LoadStartupDrivers();
 	    if (lpDrvItemList == NULL) return 0;
 	}
-	dprintf_driver( stddeb,"GetNextDriver // return first %04x !\n",
+	dprintf_info(driver,"GetNextDriver // return first %04x !\n",
 		        lpDrvItemList->dis.hDriver );
 	return lpDrvItemList->dis.hDriver;
     }
@@ -304,6 +303,6 @@
 	GlobalUnlock16( hDrvr );
     }
 
-    dprintf_driver( stddeb, "GetNextDriver // return %04x !\n", hRetDrv );
+    dprintf_info(driver, "GetNextDriver // return %04x !\n", hRetDrv );
     return hRetDrv;
 }
diff --git a/windows/event.c b/windows/event.c
index 84bc271..0350f14 100644
--- a/windows/event.c
+++ b/windows/event.c
@@ -37,7 +37,6 @@
 #include "drive.h"
 #include "shell.h"
 #include "keyboard.h"
-#include "stddebug.h"
 #include "debug.h"
 #include "dde_proc.h"
 
@@ -155,7 +154,7 @@
                       (char **)&pWnd ) != 0)
         return;  /* Not for a registered window */
 
-    dprintf_event( stddeb, "Got event %s for hwnd %04x\n",
+    dprintf_info(event, "Got event %s for hwnd %04x\n",
                    event_names[event->type], pWnd->hwndSelf );
 
     switch(event->type)
@@ -249,7 +248,7 @@
 	break;
 
     default:    
-	dprintf_event(stddeb, "Unprocessed event %s for hwnd %04x\n",
+	dprintf_warn(event, "Unprocessed event %s for hwnd %04x\n",
 	        event_names[event->type], pWnd->hwndSelf );
 	break;
     }
@@ -510,7 +509,7 @@
         TSXQueryTree( display, w, &root, &parent, &children, &total );
         if( children ) TSXFree( children );
     } while( parent && parent != ancestor );
-    dprintf_event( stddeb, "\t%08x -> %08x\n", (unsigned)prev, (unsigned)w );
+    dprintf_info(event, "\t%08x -> %08x\n", (unsigned)prev, (unsigned)w );
     return ( parent ) ? w : 0 ;
 }
 
@@ -932,7 +931,7 @@
     }
 
     if(rprop == None) 
-       dprintf_event(stddeb,"Request for %s ignored\n", TSXGetAtomName(display,event->target));
+       dprintf_info(event,"Request for %s ignored\n", TSXGetAtomName(display,event->target));
 
     result.type = SelectionNotify;
     result.display = display;
@@ -955,7 +954,7 @@
     if (event->target != XA_STRING) CLIPBOARD_ReadSelection( 0, None );
     else CLIPBOARD_ReadSelection( event->requestor, event->property );
 
-    dprintf_clipboard(stddeb,"\tSelectionNotify done!\n");
+    dprintf_info(clipboard,"\tSelectionNotify done!\n");
 }
 
 
@@ -1087,7 +1086,7 @@
 	  } /* WS_EX_ACCEPTFILES */
        } /* dndProtocol */
        else
-	  dprintf_event( stddeb, "unrecognized ClientMessage\n" );
+	  dprintf_info(event, "unrecognized ClientMessage\n" );
     }
 }
 
@@ -1145,7 +1144,7 @@
                            GrabModeAsync, GrabModeAsync,
                            None, None, CurrentTime ) == GrabSuccess) )
 	{
-            dprintf_win(stddeb, "SetCapture(0x%04x)\n", hwnd );
+            dprintf_info(win, "SetCapture(0x%04x)\n", hwnd );
             captureWnd   = hwnd;
 	    captureHT    = ht;
         }
@@ -1191,7 +1190,7 @@
  */
 void WINAPI ReleaseCapture(void)
 {
-    dprintf_win(stddeb, "ReleaseCapture() [%04x]\n", captureWnd );
+    dprintf_info(win, "ReleaseCapture() [%04x]\n", captureWnd );
     if( captureWnd ) EVENT_Capture( 0, 0 );
 }
 
@@ -1271,7 +1270,7 @@
 BOOL16 WINAPI EnableHardwareInput(BOOL16 bEnable)
 {
   BOOL16 bOldState = InputEnabled;
-  dprintf_event(stdnimp,"EnableHardwareInput(%d);\n", bEnable);
+  dprintf_fixme(event,"EnableHardwareInput(%d) - stub\n", bEnable);
   InputEnabled = bEnable;
   return bOldState;
 }
diff --git a/windows/hook.c b/windows/hook.c
index ebf20c6..cff8d1a 100644
--- a/windows/hook.c
+++ b/windows/hook.c
@@ -21,7 +21,6 @@
 #include "heap.h"
 #include "struct32.h"
 #include "winproc.h"
-#include "stddebug.h"
 #include "debug.h"
 
 #pragma pack(1)
@@ -848,7 +847,7 @@
 
     if ((id < WH_MINHOOK) || (id > WH_MAXHOOK)) return 0;
 
-    dprintf_hook( stddeb, "Setting hook %d: %08x %04x %04x\n",
+    dprintf_info(hook, "Setting hook %d: %08x %04x %04x\n",
                   id, (UINT32)proc, hInst, hTask );
 
     if (!hInst && (type!=HOOK_WIN16))
@@ -886,7 +885,7 @@
         data->next = HOOK_systemHooks[id - WH_MINHOOK];
         HOOK_systemHooks[id - WH_MINHOOK] = handle;
     }
-    dprintf_hook( stddeb, "Setting hook %d: ret=%04x [next=%04x]\n", 
+    dprintf_info(hook, "Setting hook %d: ret=%04x [next=%04x]\n", 
 			   id, handle, data->next );
     return handle;
 }
@@ -902,13 +901,13 @@
     HOOKDATA *data;
     HANDLE16 *prevHook;
 
-    dprintf_hook( stddeb, "Removing hook %04x\n", hook );
+    dprintf_info(hook, "Removing hook %04x\n", hook );
 
     if (!(data = (HOOKDATA *)USER_HEAP_LIN_ADDR(hook))) return FALSE;
     if (data->flags & HOOK_INUSE)
     {
         /* Mark it for deletion later on */
-        dprintf_hook( stddeb, "Hook still running, deletion delayed\n" );
+        dprintf_warn(hook, "Hook still running, deletion delayed\n" );
         data->proc = (HOOKPROC32)0;
         return TRUE;
     }
@@ -982,12 +981,12 @@
     queue->hCurHook = hook;
     data->flags |= HOOK_INUSE;
 
-    dprintf_hook( stddeb, "Calling hook %04x: %d %08x %08lx\n",
+    dprintf_info(hook, "Calling hook %04x: %d %08x %08lx\n",
                   hook, code, wParam, lParam );
 
     ret = data->proc(code, wParam, lParam);
 
-    dprintf_hook( stddeb, "Ret hook %04x = %08lx\n", hook, ret );
+    dprintf_info(hook, "Ret hook %04x = %08lx\n", hook, ret );
 
     data->flags &= ~HOOK_INUSE;
     queue->hCurHook = prevHook;
@@ -1275,7 +1274,7 @@
 {
     HANDLE16 hook = HOOK_GetHook( id , GetTaskQueue(0) );
 
-    dprintf_hook( stddeb, "UnhookWindowsHook: %d %08lx\n", id, (DWORD)proc );
+    dprintf_info(hook, "UnhookWindowsHook: %d %08lx\n", id, (DWORD)proc );
 
     while (hook)
     {
@@ -1295,7 +1294,7 @@
 {
     HANDLE16 hook = HOOK_GetHook( id , GetTaskQueue(0) );
 
-    dprintf_hook( stddeb, "UnhookWindowsHook: %d %08lx\n", id, (DWORD)proc );
+    dprintf_info(hook, "UnhookWindowsHook: %d %08lx\n", id, (DWORD)proc );
 
     while (hook)
     {
diff --git a/windows/keyboard.c b/windows/keyboard.c
index b99656d..90189fc 100644
--- a/windows/keyboard.c
+++ b/windows/keyboard.c
@@ -23,8 +23,6 @@
 #include "heap.h"
 #include "keyboard.h"
 #include "message.h"
-#include "stddebug.h"
-/* #define DEBUG_KEYBOARD */
 #include "debug.h"
 #include "struct32.h"
 
@@ -191,12 +189,12 @@
                     if (TSXKeycodeToKeysym(display, *kcp, k) == XK_Mode_switch)
 		    {
                         AltGrMask = 1 << i;
-                        dprintf_key(stddeb, "AltGrMask is %x\n", AltGrMask);
+                        dprintf_info(key, "AltGrMask is %x\n", AltGrMask);
 		    }
                     else if (TSXKeycodeToKeysym(display, *kcp, k) == XK_Num_Lock)
 		    {
                         NumLockMask = 1 << i;
-                        dprintf_key(stddeb, "NumLockMask is %x\n", NumLockMask);
+                        dprintf_info(key, "NumLockMask is %x\n", NumLockMask);
 		    }
             }
     }
@@ -283,10 +281,12 @@
 
                 vkey = OEMvkey;
 		  
-                if (debugging_keyboard)
+                if (debugging_info(keyboard))
                 {
-                    fprintf(stddeb,"OEM specific virtual key %X assigned to keycode %X :\n ("
-                            ,OEMvkey,e2.keycode);
+		    dbg_decl_str(keyboard, 1024);
+
+                    dprintf_info(keyboard, "OEM specific virtual key %X assigned"
+				 "to keycode %X :\n", OEMvkey, e2.keycode);
                     for (i = 0; i < keysyms_per_keycode; i += 1)
                     {
                         char	*ksname;
@@ -295,9 +295,9 @@
                         ksname = TSXKeysymToString(keysym);
                         if (!ksname)
 			    ksname = "NoSymbol";
-                        fprintf(stddeb, "%lX (%s) ", keysym, ksname);
+                        dsprintf(keyboard, "%lX (%s) ", keysym, ksname);
                     }
-                    fprintf(stddeb, ")\n");
+                    dprintf_info(keyboard, "(%s)\n", dbg_str(keyboard));
                 }
             }
         }
@@ -318,14 +318,14 @@
        don't treat it. It's from the same key press. Then the state goes to ON.
        And from there, a 'release' event will switch off the toggle key. */
     *State=FALSE;
-    dprintf_keyboard(stddeb,"INTERM : don\'t treat release of toggle key. InputKeyStateTable[%#x] = %#x\n",vkey,InputKeyStateTable[vkey]);
+    dprintf_info(keyboard,"INTERM : don\'t treat release of toggle key. InputKeyStateTable[%#x] = %#x\n",vkey,InputKeyStateTable[vkey]);
   } else
     {
 	if ( InputKeyStateTable[vkey] & 0x1 ) /* it was ON */
 	  {
 	    if (Evtype!=KeyPress)
 	      {
-		dprintf_keyboard(stddeb,"ON + KeyRelease => generating DOWN and UP messages.\n");
+		dprintf_info(keyboard,"ON + KeyRelease => generating DOWN and UP messages.\n");
 		localkeylp.lp1.previous = 0; /* ? */
 		localkeylp.lp1.transition = 0;
 		hardware_event( WM_KEYDOWN, vkey, localkeylp.lp2,
@@ -339,7 +339,7 @@
 	else /* it was OFF */
 	  if (Evtype==KeyPress)
 	    {
-	      dprintf_keyboard(stddeb,"OFF + Keypress => generating DOWN and UP messages.\n");
+	      dprintf_info(keyboard,"OFF + Keypress => generating DOWN and UP messages.\n");
 	      hardware_event( WM_KEYDOWN, vkey, localkeylp.lp2,
                               event_x, event_y, event_time, 0 );
 	      localkeylp.lp1.previous = 1;
@@ -372,15 +372,15 @@
     INT32 event_y = pWnd->rectWindow.top + event->y;
     DWORD event_time = event->time - MSG_WineStartTicks;
 
-    dprintf_key(stddeb, "EVENT_key : state = %X\n", event->state);
+    dprintf_info(key, "EVENT_key : state = %X\n", event->state);
     if (keysym == XK_Mode_switch)
 	{
-	dprintf_key(stddeb, "Alt Gr key event received\n");
+	dprintf_info(key, "Alt Gr key event received\n");
 	event->keycode = TSXKeysymToKeycode(event->display, XK_Control_L);
-	dprintf_key(stddeb, "Control_L is keycode 0x%x\n", event->keycode);
+	dprintf_info(key, "Control_L is keycode 0x%x\n", event->keycode);
 	KEYBOARD_HandleEvent( pWnd, event );
 	event->keycode = TSXKeysymToKeycode(event->display, XK_Alt_L);
-	dprintf_key(stddeb, "Alt_L is keycode 0x%x\n", event->keycode);
+	dprintf_info(key, "Alt_L is keycode 0x%x\n", event->keycode);
 	force_extended = TRUE;
 	KEYBOARD_HandleEvent( pWnd, event );
 	force_extended = FALSE;
@@ -388,22 +388,21 @@
 	}
 
     Str[ascii_chars] = '\0';
-    if (debugging_key)
-	{
+    if (debugging_info(key)){
 	char	*ksname;
 
 	ksname = TSXKeysymToString(keysym);
 	if (!ksname)
-	    ksname = "No Name";
-	fprintf(stddeb, "%s : keysym=%lX (%s), ascii chars=%u / %X / '%s'\n", 
-                (event->type == KeyPress) ? "KeyPress" : "KeyRelease",
-                keysym, ksname, ascii_chars, Str[0] & 0xff, Str);
-	}
+	  ksname = "No Name";
+	dprintf_info(key, "%s : keysym=%lX (%s), ascii chars=%u / %X / '%s'\n", 
+		     (event->type == KeyPress) ? "KeyPress" : "KeyRelease",
+		     keysym, ksname, ascii_chars, Str[0] & 0xff, Str);
+    }
 
     vkey = EVENT_event_to_vkey(event);
     if (force_extended) vkey |= 0x100;
 
-    dprintf_key(stddeb, "keycode 0x%x converted to vkey 0x%x\n",
+    dprintf_info(key, "keycode 0x%x converted to vkey 0x%x\n",
 		    event->keycode, vkey);
 
    if (vkey)
@@ -424,10 +423,10 @@
                             event_time, keylp);
       break;
     case VK_CAPITAL:
-      dprintf_keyboard(stddeb,"Caps Lock event. (type %d). State before : %#.2x\n",event->type,InputKeyStateTable[vkey]);
+      dprintf_info(keyboard,"Caps Lock event. (type %d). State before : %#.2x\n",event->type,InputKeyStateTable[vkey]);
       KEYBOARD_GenerateMsg( VK_CAPITAL, event->type, event_x, event_y,
                             event_time, keylp ); 
-      dprintf_keyboard(stddeb,"State after : %#.2x\n",InputKeyStateTable[vkey]);
+      dprintf_info(keyboard,"State after : %#.2x\n",InputKeyStateTable[vkey]);
       break;
     default:
       {
@@ -458,7 +457,7 @@
 			      (InputKeyStateTable[VK_MENU] & 0x80)) ? 1 : 0;
 	if (!(InputKeyStateTable[VK_NUMLOCK] & 0x01) != !(event->state & NumLockMask))
 	  { 
-	    dprintf_keyboard(stddeb,"Adjusting NumLock state. \n");
+	    dprintf_info(keyboard,"Adjusting NumLock state. \n");
 	    KEYBOARD_GenerateMsg( VK_NUMLOCK, KeyPress, event_x, event_y,
                                   event_time, keylp );
 	    KEYBOARD_GenerateMsg( VK_NUMLOCK, KeyRelease, event_x, event_y,
@@ -466,20 +465,20 @@
 	  }
 	if (!(InputKeyStateTable[VK_CAPITAL] & 0x01) != !(event->state & LockMask))
 	  {
-	    dprintf_keyboard(stddeb,"Adjusting Caps Lock state. State before %#.2x \n",InputKeyStateTable[VK_CAPITAL]);
+	    dprintf_info(keyboard,"Adjusting Caps Lock state. State before %#.2x \n",InputKeyStateTable[VK_CAPITAL]);
 	    KEYBOARD_GenerateMsg( VK_CAPITAL, KeyPress, event_x, event_y,
                                   event_time, keylp );
 	    KEYBOARD_GenerateMsg( VK_CAPITAL, KeyRelease, event_x, event_y,
                                   event_time, keylp );
-	    dprintf_keyboard(stddeb,"State after %#.2x \n",InputKeyStateTable[VK_CAPITAL]);
+	    dprintf_info(keyboard,"State after %#.2x \n",InputKeyStateTable[VK_CAPITAL]);
 	  }
 	/* End of intermediary states. */
 	NumState = FALSE;
 	CapsState = FALSE;
 
-	dprintf_key(stddeb,"            wParam=%04X, lParam=%08lX\n", 
+	dprintf_info(key,"            wParam=%04X, lParam=%08lX\n", 
 		    vkey, keylp.lp2 );
-	dprintf_key(stddeb,"            InputKeyState=%X\n",
+	dprintf_info(key,"            InputKeyState=%X\n",
 		    InputKeyStateTable[vkey]);
 
 	hardware_event( message, vkey, keylp.lp2,
@@ -525,7 +524,7 @@
 	    retval = ( (WORD)(QueueKeyStateTable[vkey] & 0x80) << 8 ) |
 		       (WORD)(QueueKeyStateTable[vkey] & 0x01);
 	}
-    dprintf_key(stddeb, "GetKeyState(0x%x) -> %x\n", vkey, retval);
+    dprintf_info(key, "GetKeyState(0x%x) -> %x\n", vkey, retval);
     return retval;
 }
 
@@ -537,7 +536,7 @@
  */
 VOID WINAPI GetKeyboardState(LPBYTE lpKeyState)
 {
-    dprintf_key(stddeb, "GetKeyboardState()\n");
+    dprintf_info(key, "GetKeyboardState()\n");
     if (lpKeyState != NULL) {
 	QueueKeyStateTable[VK_LBUTTON] = MouseButtonsStates[0] ? 0x80 : 0;
 	QueueKeyStateTable[VK_MBUTTON] = MouseButtonsStates[1] ? 0x80 : 0;
@@ -551,7 +550,7 @@
  */
 VOID WINAPI SetKeyboardState(LPBYTE lpKeyState)
 {
-    dprintf_key(stddeb, "SetKeyboardState()\n");
+    dprintf_info(key, "SetKeyboardState()\n");
     if (lpKeyState != NULL) {
 	memcpy(QueueKeyStateTable, lpKeyState, 256);
 	MouseButtonsStates[0] = (QueueKeyStateTable[VK_LBUTTON] != 0);
@@ -600,7 +599,7 @@
     memset( AsyncMouseButtonsStates, 0, sizeof(AsyncMouseButtonsStates) );
     memset( AsyncKeyStateTable, 0, sizeof(AsyncKeyStateTable) );
 
-    dprintf_key(stddeb, "GetAsyncKeyState(%x) -> %x\n", nKey, retval);
+    dprintf_info(key, "GetAsyncKeyState(%x) -> %x\n", nKey, retval);
     return retval;
 }
 
@@ -635,13 +634,14 @@
     	if (msg->message == WM_CHAR) {
         if ( !(fVirt & FALT) && !(fVirt & FVIRTKEY) )
         {
-   	  dprintf_accel(stddeb,"found accel for WM_CHAR: ('%c')",msg->wParam&0xff);
+   	  dprintf_info(accel,"found accel for WM_CHAR: ('%c')\n",
+			msg->wParam&0xff);
    	  sendmsg=TRUE;
    	}  
       } else {
        if(fVirt & FVIRTKEY) {
 	INT32 mask = 0;
-        dprintf_accel(stddeb,"found accel for virt_key %04x (scan %04x)",
+        dprintf_info(accel,"found accel for virt_key %04x (scan %04x)\n",
   	                       msg->wParam,0xff & HIWORD(msg->lParam));                
 	if(GetKeyState32(VK_SHIFT) & 0x8000) mask |= FSHIFT;
 	if(GetKeyState32(VK_CONTROL) & 0x8000) mask |= FCONTROL;
@@ -649,7 +649,7 @@
 	if(mask == (fVirt & (FSHIFT | FCONTROL | FALT)))
           sendmsg=TRUE;			    
         else
-          dprintf_accel(stddeb,", but incorrect SHIFT/CTRL/ALT-state\n");
+          dprintf_info(accel,", but incorrect SHIFT/CTRL/ALT-state\n");
        }
        else
        {
@@ -657,7 +657,7 @@
          {
            if ((fVirt & FALT) && (msg->lParam & 0x20000000))
            {                                                   /* ^^ ALT pressed */
-	    dprintf_accel(stddeb,"found accel for Alt-%c", msg->wParam&0xff);
+	    dprintf_info(accel,"found accel for Alt-%c\n", msg->wParam&0xff);
 	    sendmsg=TRUE;	    
 	   } 
          } 
@@ -714,7 +714,7 @@
           }
           if ( mesg==WM_COMMAND || mesg==WM_SYSCOMMAND )
           {
-              dprintf_accel(stddeb,", sending %s, wParam=%0x\n",
+              dprintf_info(accel,", sending %s, wParam=%0x\n",
                   mesg==WM_COMMAND ? "WM_COMMAND" : "WM_SYSCOMMAND",
                   cmd);
 	      SendMessage32A(hWnd, mesg, cmd, 0x00010000L);
@@ -730,7 +730,9 @@
 	    *   #5: it's a menu option, but window is iconic
 	    *   #6: it's a menu option, but disabled
 	    */
-	    dprintf_accel(stddeb,", but won't send WM_{SYS}COMMAND, reason is #%d\n",mesg);
+	    dprintf_info(accel,", but won't send WM_{SYS}COMMAND, reason is #%d\n",mesg);
+	    if(mesg==0)
+	      dprintf_err(accel, " unknown reason - please report!");
 	  }          
           return TRUE;         
       }
@@ -750,7 +752,7 @@
 	msg->message != WM_SYSKEYUP &&
     	msg->message != WM_CHAR) return 0;
 
-    dprintf_accel(stddeb, "TranslateAccelerators hAccel=%04x, hWnd=%04x,\
+    dprintf_info(accel, "TranslateAccelerators hAccel=%04x, hWnd=%04x,\
 msg->hwnd=%04x, msg->message=%04x\n", hAccel,hWnd,msg->hwnd,msg->message);
 
     for (i = 0; lpAccelTbl[i].key ; i++)
@@ -773,7 +775,7 @@
 	msg->message != WM_SYSKEYUP &&
     	msg->message != WM_CHAR) return 0;
 
-    dprintf_accel(stddeb, "TranslateAccelerators hAccel=%04x, hWnd=%04x,\
+    dprintf_info(accel, "TranslateAccelerators hAccel=%04x, hWnd=%04x,\
 msg->hwnd=%04x, msg->message=%04x\n", hAccel,hWnd,msg->hwnd,msg->message);
     STRUCT32_MSG16to32(msg,&msg32);
 
@@ -791,7 +793,7 @@
  */
 DWORD WINAPI OemKeyScan(WORD wOemChar)
 {
-    dprintf_keyboard(stddeb,"*OemKeyScan (%d)\n",wOemChar);
+    dprintf_info(keyboard,"*OemKeyScan (%d)\n",wOemChar);
 
     return wOemChar;
 }
@@ -831,8 +833,8 @@
 	  keycode = TSXKeysymToKeycode(display, keysym | 0xFE00);
 	}
 
-	dprintf_keyboard(stddeb,"VkKeyScan '%c'(%#lx, %lu) : got keycode %#.2x ",
-	    cChar,keysym,keysym,keycode);
+	dprintf_info(keyboard,"VkKeyScan '%c'(%#lx, %lu): got keycode %#.2x\n",
+			 cChar,keysym,keysym,keycode);
 	
 	if (keycode)
 	  {
@@ -854,7 +856,7 @@
 	      index : ?     adds 0x0700 (ctrl+alt+shift (used?))
 	     */
 	  }
-	dprintf_keyboard(stddeb," ... returning %#.2x\n", keyc2vkey[keycode]+highbyte);
+	dprintf_info(keyboard," ... returning %#.2x\n", keyc2vkey[keycode]+highbyte);
 	return keyc2vkey[keycode]+highbyte;   /* keycode -> (keyc2vkey) vkey */
 }
 
@@ -887,7 +889,7 @@
  */
 INT32 WINAPI GetKeyboardType32(INT32 nTypeFlag)
 {
-  dprintf_keyboard(stddeb,"GetKeyboardType(%d)\n",nTypeFlag);
+  dprintf_info(keyboard,"GetKeyboardType(%d)\n",nTypeFlag);
   switch(nTypeFlag)
     {
     case 0:      /* Keyboard type */
@@ -928,9 +930,10 @@
  */
 UINT16 WINAPI MapVirtualKey16(UINT16 wCode, UINT16 wMapType)
 {
-#define returnMVK(value) { dprintf_keyboard(stddeb,"returning 0x%x.\n",value); return value; }
+#define returnMVK(value) { dprintf_info(keyboard,"returning 0x%x.\n",value); return value; }
 
-	dprintf_keyboard(stddeb,"MapVirtualKey wCode=0x%x wMapType=%d ... ",wCode,wMapType);
+	dprintf_info(keyboard,"MapVirtualKey wCode=0x%x wMapType=%d ... \n",
+			 wCode,wMapType);
 	switch(wMapType) {
 		case 0:	{ /* vkey-code to scan-code */
 			/* let's do vkey -> keycode -> scan */
@@ -974,7 +977,7 @@
  */
 INT16 WINAPI GetKBCodePage16(void)
 {
-    dprintf_keyboard(stddeb,"GetKBCodePage()\n");
+    dprintf_info(keyboard,"GetKBCodePage()\n");
     return 850;
 }
 
@@ -984,7 +987,7 @@
  */
 UINT32 WINAPI GetKBCodePage32(void)
 {
-    dprintf_keyboard(stddeb,"GetKbCodePage()\n");
+    dprintf_info(keyboard,"GetKbCodePage()\n");
     return 850;
 }
 
@@ -1017,7 +1020,7 @@
 {
   /*	int i; */
 	
-    	dprintf_keyboard(stddeb,"GetKeyNameText(%ld,<ptr>,%d)\n",lParam,nSize);
+    	dprintf_info(keyboard,"GetKeyNameText(%ld,<ptr>,%d)\n",lParam,nSize);
 
 	lParam >>= 16;
 	lParam &= 0xff;
@@ -1065,7 +1068,7 @@
 	  {
 	    if ((e.keycode) && ((virtKey<0x10) || (virtKey>0x12))) 
 		/* it's normal to have 2 shift, control, and alt ! */
-		dprintf_keyboard(stddeb,"ToAscii : The keycodes %d and %d are matching the same vkey %#X\n",
+		dprintf_info(keyboard,"ToAscii : The keycodes %d and %d are matching the same vkey %#X\n",
 				 e.keycode,keyc,virtKey);
 	    e.keycode = keyc;
 	  }
@@ -1085,7 +1088,7 @@
     e.state = 0;
     if (lpKeyState[VK_SHIFT] & 0x80)
 	e.state |= ShiftMask;
-    dprintf_keyboard(stddeb,"ToAscii : lpKeyState[0x14(VK_CAPITAL)]=%#x\n",lpKeyState[VK_CAPITAL]);
+    dprintf_info(keyboard,"ToAscii : lpKeyState[0x14(VK_CAPITAL)]=%#x\n",lpKeyState[VK_CAPITAL]);
     if (lpKeyState[VK_CAPITAL] & 0x01)
 	e.state |= LockMask;
     if (lpKeyState[VK_CONTROL] & 0x80)
@@ -1095,7 +1098,7 @@
 	    e.state |= ControlMask;
     if (lpKeyState[VK_NUMLOCK] & 0x01)
 	e.state |= NumLockMask;
-    dprintf_key(stddeb, "ToAscii(%04X, %04X) : faked state = %X\n",
+    dprintf_info(key, "ToAscii(%04X, %04X) : faked state = %X\n",
 		virtKey, scanCode, e.state);
     ret = TSXLookupString(&e, (LPVOID)lpChar, 2, &keysym, &cs);
     if (ret == 0)
@@ -1209,7 +1212,7 @@
 		}
 	    }
 	}
-    dprintf_key(stddeb, "ToAscii about to return %d with char %x\n",
+    dprintf_info(key, "ToAscii about to return %d with char %x\n",
 		ret, *(char*)lpChar);
     return ret;
 }
diff --git a/windows/mdi.c b/windows/mdi.c
index e2049fd..6bae674 100644
--- a/windows/mdi.c
+++ b/windows/mdi.c
@@ -26,7 +26,6 @@
 #include "resource.h"
 #include "struct32.h"
 #include "sysmetrics.h"
-#include "stddebug.h"
 #include "debug.h"
 
 #define MDIF_NEEDUPDATE		0x0001
@@ -113,7 +112,7 @@
 	wndPtr = WIN_FindWndPtr(MDI_GetChildByID(clientWnd,index));
 	if( !wndPtr )
 	{
-	      dprintf_mdi(stddeb,"MDIMenuDeleteItem: no window for id=%i\n",index);
+	      dprintf_info(mdi,"MDIMenuDeleteItem: no window for id=%i\n",index);
 	      continue;
 	}
     
@@ -195,7 +194,7 @@
     HWND32 hwndFrame = GetParent32(hwnd);
     HMENU32 oldFrameMenu = GetMenu32(hwndFrame);
 
-    dprintf_mdi(stddeb, "WM_MDISETMENU: %04x %04x %04x\n",
+    dprintf_info(mdi, "WM_MDISETMENU: %04x %04x %04x\n",
                 hwnd, hmenuFrame, hmenuWindow);
 
     ci = (MDICLIENTINFO *) w->wExtra;
@@ -265,7 +264,7 @@
     WORD	     wIDmenu = ci->idFirstChild + ci->nActiveChildren;
     char	     lpstrDef[]="junk!";
 
-    dprintf_mdi(stdnimp,"MDICreateChild: origin %i,%i - dim %i,%i, style %08x\n", 
+    dprintf_info(mdi, "MDICreateChild: origin %i,%i - dim %i,%i, style %08x\n", 
                 cs->x, cs->y, cs->cx, cs->cy, (unsigned)cs->style);    
     /* calculate placement */
     MDI_CalcDefaultChildPos(w, ci->nTotalCreated++, pos, 0);
@@ -354,7 +353,7 @@
                 MDI_UpdateFrameText( w->parent, ci->self, MDI_REPAINTFRAME, NULL ); 
 	    }
 	}
-        dprintf_mdi(stddeb, "MDICreateChild: created child - %04x\n",hwnd);
+        dprintf_info(mdi, "MDICreateChild: created child - %04x\n",hwnd);
     }
     else
     {
@@ -389,7 +388,7 @@
     lpMinMax->ptMaxPosition.x = rect.left;
     lpMinMax->ptMaxPosition.y = rect.top; 
 
-    dprintf_mdi(stddeb,"\tChildMinMaxInfo: max rect (%i,%i - %i, %i)\n", 
+    dprintf_info(mdi,"\tChildMinMaxInfo: max rect (%i,%i - %i, %i)\n", 
                         rect.left,rect.top,rect.right,rect.bottom);
 }
 
@@ -411,7 +410,7 @@
  
     ci = (MDICLIENTINFO *) w->wExtra;
 
-    dprintf_mdi(stddeb, "MDI_SwitchActiveChild: from %04x, to %04x\n",childHwnd,hwndTo);
+    dprintf_info(mdi, "MDI_SwitchActiveChild: from %04x, to %04x\n",childHwnd,hwndTo);
 
     if ( !hwndTo ) return; /* no window to switch to */
 
@@ -471,7 +470,7 @@
 	
         ci->nActiveChildren--;
 
-        dprintf_mdi(stddeb,"MDIDestroyChild: child destroyed - %04x\n",child);
+        dprintf_info(mdi,"MDIDestroyChild: child destroyed - %04x\n",child);
 
         if (flagDestroy)
 	{
@@ -502,7 +501,7 @@
     if( wndPtr )
         if( wndPtr->dwStyle & WS_DISABLED ) return 0L;
 
-    dprintf_mdi(stddeb,"MDI_ChildActivate: %04x\n", hWndChild);
+    dprintf_info(mdi,"MDI_ChildActivate: %04x\n", hWndChild);
 
     if( GetActiveWindow32() == clientPtr->parent->hwndSelf )
         isActiveFrameWnd = TRUE;
@@ -626,7 +625,7 @@
 	    /* walk the list and move windows */
 	    while ( *ppWnd )
 	    {
-		dprintf_mdi(stddeb, "MDICascade: move %04x to (%d,%d) size [%d,%d]\n", 
+		dprintf_info(mdi, "MDICascade: move %04x to (%d,%d) size [%d,%d]\n", 
                             (*ppWnd)->hwndSelf, pos[0].x, pos[0].y, pos[1].x, pos[1].y);
 
 		MDI_CalcDefaultChildPos(clientWnd, n++, pos, delta);
@@ -660,7 +659,7 @@
     ppWnd = WIN_BuildWinArray(wndClient, BWA_SKIPHIDDEN | BWA_SKIPOWNED | BWA_SKIPICONIC |
 	    ((wParam & MDITILE_SKIPDISABLED)? BWA_SKIPDISABLED : 0), &total );
 
-    dprintf_mdi(stddeb,"MDITile: %u windows to tile\n", total);
+    dprintf_info(mdi,"MDITile: %u windows to tile\n", total);
 
     if( ppWnd )
     {
@@ -729,7 +728,7 @@
     WND*	child = WIN_FindWndPtr(hChild);
     HMENU32  	hSysPopup = 0;
 
-    dprintf_mdi(stddeb,"MDI_AugmentFrameMenu: frame %p,child %04x\n",frame,hChild);
+    dprintf_info(mdi,"MDI_AugmentFrameMenu: frame %p,child %04x\n",frame,hChild);
 
     if( !frame->wIDmenu || !child->hSysMenu ) return 0; 
 
@@ -738,7 +737,8 @@
     if (!(hSysPopup = LoadMenuIndirect32A(SYSRES_GetResPtr(SYSRES_MENU_SYSMENU))))
 	return 0;
  
-    dprintf_mdi(stddeb,"\t\tgot popup %04x\n in sysmenu %04x",hSysPopup,child->hSysMenu);
+    dprintf_info(mdi,"\tgot popup %04x in sysmenu %04x\n", 
+		hSysPopup, child->hSysMenu);
  
     if( !InsertMenu32A(frame->wIDmenu,0,MF_BYPOSITION | MF_BITMAP | MF_POPUP,
                     hSysPopup, (LPSTR)(DWORD)hBmpClose ))
@@ -771,7 +771,7 @@
 {
     INT32 nItems = GetMenuItemCount32(frameWnd->wIDmenu) - 1;
 
-    dprintf_mdi(stddeb,"MDI_RestoreFrameMenu: for child %04x\n",hChild);
+    dprintf_info(mdi,"MDI_RestoreFrameMenu: for child %04x\n",hChild);
 
     if( GetMenuItemID32(frameWnd->wIDmenu,nItems) != SC_RESTORE )
 	return 0; 
@@ -798,7 +798,7 @@
     WND*   clientWnd = WIN_FindWndPtr(hClient);
     MDICLIENTINFO *ci = (MDICLIENTINFO *) clientWnd->wExtra;
 
-    dprintf_mdi(stddeb, "MDI: repaint %i, frameText %s\n", repaint, (lpTitle)?lpTitle:"NULL");
+    dprintf_info(mdi, "MDI: repaint %i, frameText %s\n", repaint, (lpTitle)?lpTitle:"NULL");
 
     if (!clientWnd)
            return;
@@ -925,7 +925,7 @@
 	NC_HandleNCCalcSize( w, &rect );
 	w->rectClient = rect;
 
-	dprintf_mdi(stddeb,"MDI: Client created - hwnd = %04x, idFirst = %u\n",
+	dprintf_info(mdi,"MDI: Client created - hwnd = %04x, idFirst = %u\n",
 			   hwnd, ci->idFirstChild );
 
 	return 0;
@@ -1017,7 +1017,7 @@
             POINT16  pt = MAKEPOINT16(lParam);
             HWND16 child = ChildWindowFromPoint16(hwnd, pt);
 
-	    dprintf_mdi(stddeb,"MDIClient: notification from %04x (%i,%i)\n",child,pt.x,pt.y);
+	    dprintf_info(mdi,"MDIClient: notification from %04x (%i,%i)\n",child,pt.x,pt.y);
 
             if( child && child != hwnd && child != ci->hwndActiveChild )
                 SetWindowPos32(child, 0,0,0,0,0, SWP_NOSIZE | SWP_NOMOVE );
@@ -1265,7 +1265,7 @@
 	return 0;
 
       case WM_NCPAINT:
-	dprintf_mdi(stddeb,"DefMDIChildProc: WM_NCPAINT for %04x, active %04x\n",
+	dprintf_info(mdi,"DefMDIChildProc: WM_NCPAINT for %04x, active %04x\n",
 					     hwnd, ci->hwndActiveChild );
 	break;
 
@@ -1332,7 +1332,7 @@
 	        SendMessage16( hMaxChild, WM_SETREDRAW, TRUE, 0L );
 	    }
 
-	    dprintf_mdi(stddeb,"\tMDI: maximizing child %04x\n", hwnd );
+	    dprintf_info(mdi,"\tMDI: maximizing child %04x\n", hwnd );
 
 	    ci->hwndChildMaximized = hwnd; /* !!! */
 
@@ -1523,7 +1523,7 @@
 		    default:
 			 return 0;
 		}
-	        dprintf_mdi(stddeb,"TranslateMDISysAccel: wParam = %04x\n", wParam);
+	        dprintf_info(mdi,"TranslateMDISysAccel: wParam = %04x\n", wParam);
 	        SendMessage16( ci->hwndActiveChild, WM_SYSCOMMAND, 
 					wParam, (LPARAM)msg->wParam);
 	        return 1;
diff --git a/windows/message.c b/windows/message.c
index 5ac2407..6b627a0 100644
--- a/windows/message.c
+++ b/windows/message.c
@@ -24,8 +24,6 @@
 #include "queue.h"
 #include "winproc.h"
 #include "options.h"
-#include "stddebug.h"
-/* #define DEBUG_MSG */
 #include "debug.h"
 
 #define WM_NCMOUSEFIRST         WM_NCMOUSEMOVE
@@ -357,7 +355,7 @@
   tmpMsg = SEGPTR_NEW(EVENTMSG16);
   wtime=HOOK_CallHooks16( WH_JOURNALPLAYBACK, HC_GETNEXT, 0,
 			  (LPARAM)SEGPTR_GET(tmpMsg));
-  /*  dprintf_msg(stddeb,"Playback wait time =%ld\n",wtime); */
+  /*  dprintf_info(msg,"Playback wait time =%ld\n",wtime); */
   if (wtime<=0)
   {
    wtime=0;
@@ -598,12 +596,12 @@
     if (IsTaskLocked() || !IsWindow32(hwnd)) return 0;
 
     debugSMRL+=4;
-    dprintf_sendmsg(stddeb,"%*sSM: %s [%04x] (%04x -> %04x)\n", 
+    dprintf_info(sendmsg,"%*sSM: %s [%04x] (%04x -> %04x)\n", 
 		    prevSMRL, "", SPY_GetMsgName(msg), msg, queue->self, hDestQueue );
 
     if( !(queue->wakeBits & QS_SMPARAMSFREE) )
     {
-      dprintf_sendmsg(stddeb,"\tIntertask SendMessage: sleeping since unreplied SendMessage pending\n");
+      dprintf_info(sendmsg,"\tIntertask SendMessage: sleeping since unreplied SendMessage pending\n");
       queue->changeBits &= ~QS_SMPARAMSFREE;
       QUEUE_WaitBits( QS_SMPARAMSFREE );
     }
@@ -621,7 +619,7 @@
     queue->wakeBits &= ~QS_SMPARAMSFREE;
     queue->flags = (queue->flags & ~(QUEUE_SM_WIN32|QUEUE_SM_UNICODE)) | flags;
 
-    dprintf_sendmsg(stddeb,"%*ssm: smResultInit = %08x\n", prevSMRL, "", (unsigned)&qCtrl);
+    dprintf_info(sendmsg,"%*ssm: smResultInit = %08x\n", prevSMRL, "", (unsigned)&qCtrl);
 
     queue->smResultInit = &qCtrl;
 
@@ -636,11 +634,11 @@
         queue->changeBits &= ~QS_SMRESULT;
         DirectedYield( destQ->hTask );
         QUEUE_WaitBits( QS_SMRESULT );
-	dprintf_sendmsg(stddeb,"\tsm: have result!\n");
+	dprintf_info(sendmsg,"\tsm: have result!\n");
       }
       /* got something */
 
-      dprintf_sendmsg(stddeb,"%*ssm: smResult = %08x\n", prevSMRL, "", (unsigned)queue->smResult );
+      dprintf_info(sendmsg,"%*ssm: smResult = %08x\n", prevSMRL, "", (unsigned)queue->smResult );
 
       if (queue->smResult) { /* FIXME, smResult should always be set */
         queue->smResult->lResult = queue->SendMessageReturn;
@@ -649,11 +647,11 @@
       queue->wakeBits &= ~QS_SMRESULT;
 
       if( queue->smResult != &qCtrl )
-	  dprintf_sendmsg(stddeb,"%*ssm: weird scenes inside the goldmine!\n", prevSMRL, "");
+	  dprintf_err(sendmsg, "%*ssm: weird scenes inside the goldmine!\n", prevSMRL, "");
     }
     queue->smResultInit = NULL;
     
-    dprintf_sendmsg(stddeb,"%*sSM: [%04x] returning %08lx\n", prevSMRL, "", msg, qCtrl.lResult);
+    dprintf_info(sendmsg,"%*sSM: [%04x] returning %08lx\n", prevSMRL, "", msg, qCtrl.lResult);
     debugSMRL-=4;
 
     return qCtrl.lResult;
@@ -670,11 +668,11 @@
 
     if (!(queue = (MESSAGEQUEUE*)GlobalLock16( GetTaskQueue(0) ))) return;
 
-    dprintf_msg(stddeb,"ReplyMessage, queue %04x\n", queue->self);
+    dprintf_info(msg,"ReplyMessage, queue %04x\n", queue->self);
 
     while( (senderQ = (MESSAGEQUEUE*)GlobalLock16( queue->InSendMessageHandle)))
     {
-      dprintf_msg(stddeb,"\trpm: replying to %04x (%04x -> %04x)\n",
+      dprintf_info(msg,"\trpm: replying to %04x (%04x -> %04x)\n",
                           queue->msg, queue->self, senderQ->self);
 
       if( queue->wakeBits & QS_SENDMESSAGE )
@@ -686,10 +684,10 @@
       if(!(senderQ->wakeBits & QS_SMRESULT) ) break;
       OldYield();
     } 
-    if( !senderQ ) { dprintf_msg(stddeb,"\trpm: done\n"); return; }
+    if( !senderQ ) { dprintf_info(msg,"\trpm: done\n"); return; }
 
     senderQ->SendMessageReturn = result;
-    dprintf_msg(stddeb,"\trpm: smResult = %08x, result = %08lx\n", 
+    dprintf_info(msg,"\trpm: smResult = %08x, result = %08lx\n", 
 			(unsigned)queue->smResultCurrent, result );
 
     senderQ->smResult = queue->smResultCurrent;
@@ -939,7 +937,7 @@
     MSG_PeekMessage( lpmsg,
                      hwnd, first, last, PM_REMOVE, FALSE );
 
-    dprintf_msg(stddeb,"message %04x, hwnd %04x, filter(%04x - %04x)\n", lpmsg->message,
+    dprintf_info(msg,"message %04x, hwnd %04x, filter(%04x - %04x)\n", lpmsg->message,
 		     				                 hwnd, first, last );
     HOOK_CallHooks16( WH_GETMESSAGE, HC_ACTION, 0, (LPARAM)msg );
     return (lpmsg->message != WM_QUIT);
@@ -970,17 +968,17 @@
     
     if (hwnd == HWND_BROADCAST)
     {
-        dprintf_msg(stddeb,"PostMessage // HWND_BROADCAST !\n");
+        dprintf_info(msg,"PostMessage // HWND_BROADCAST !\n");
         for (wndPtr = WIN_GetDesktop()->child; wndPtr; wndPtr = wndPtr->next)
         {
             if (wndPtr->dwStyle & WS_POPUP || wndPtr->dwStyle & WS_CAPTION)
             {
-                dprintf_msg(stddeb,"BROADCAST Message to hWnd=%04x m=%04X w=%04X l=%08lX !\n",
+                dprintf_info(msg,"BROADCAST Message to hWnd=%04x m=%04X w=%04X l=%08lX !\n",
                             wndPtr->hwndSelf, message, wParam, lParam);
                 PostMessage16( wndPtr->hwndSelf, message, wParam, lParam );
             }
         }
-        dprintf_msg(stddeb,"PostMessage // End of HWND_BROADCAST !\n");
+        dprintf_info(msg,"PostMessage // End of HWND_BROADCAST !\n");
         return TRUE;
     }
 
@@ -1053,20 +1051,20 @@
     {
         if (!(list = WIN_BuildWinArray( WIN_GetDesktop(), 0, NULL )))
             return TRUE;
-        dprintf_msg(stddeb,"SendMessage // HWND_BROADCAST !\n");
+        dprintf_info(msg,"SendMessage // HWND_BROADCAST !\n");
         for (ppWnd = list; *ppWnd; ppWnd++)
         {
             wndPtr = *ppWnd;
             if (!IsWindow32(wndPtr->hwndSelf)) continue;
             if (wndPtr->dwStyle & WS_POPUP || wndPtr->dwStyle & WS_CAPTION)
             {
-                dprintf_msg(stddeb,"BROADCAST Message to hWnd=%04x m=%04X w=%04lX l=%08lX !\n",
+                dprintf_info(msg,"BROADCAST Message to hWnd=%04x m=%04X w=%04lX l=%08lX !\n",
                             wndPtr->hwndSelf, msg, (DWORD)wParam, lParam);
                 SendMessage16( wndPtr->hwndSelf, msg, wParam, lParam );
             }
         }
         HeapFree( SystemHeap, 0, list );
-        dprintf_msg(stddeb,"SendMessage // End of HWND_BROADCAST !\n");
+        dprintf_info(msg,"SendMessage // End of HWND_BROADCAST !\n");
         return TRUE;
     }
 
@@ -1424,15 +1422,16 @@
     static int dead_char;
     BYTE wp[2];
     
-    if ((debugging_msg && message != WM_MOUSEMOVE && message != WM_TIMER)
-        || (debugging_key
-            && message >= WM_KEYFIRST && message <= WM_KEYLAST))
-        fprintf(stddeb, "TranslateMessage(%s, %04X, %08lX)\n",
-		SPY_GetMsgName(message), wParam, lParam );
+    if (message != WM_MOUSEMOVE && message != WM_TIMER)
+        dprintf_info(msg, "TranslateMessage(%s, %04X, %08lX)\n",
+		     SPY_GetMsgName(message), wParam, lParam );
+    if(message >= WM_KEYFIRST && message <= WM_KEYLAST)
+        dprintf_info(key, "TranslateMessage(%s, %04X, %08lX)\n",
+		     SPY_GetMsgName(message), wParam, lParam );
 
     if ((message != WM_KEYDOWN) && (message != WM_SYSKEYDOWN)) return FALSE;
 
-    dprintf_key( stddeb, "Translating key %04X, scancode %04X\n",
+    dprintf_info(key, "Translating key %04X, scancode %04X\n",
                  wParam, HIWORD(lParam) );
 
     /* FIXME : should handle ToAscii yielding 2 */
@@ -1463,14 +1462,14 @@
                 }
             dead_char = 0;
         }
-        dprintf_key(stddeb, "1 -> PostMessage(%s)\n", SPY_GetMsgName(message));
+        dprintf_info(key, "1 -> PostMessage(%s)\n", SPY_GetMsgName(message));
         PostMessage16( hwnd, message, wp[0], lParam );
         return TRUE;
 
     case -1 :
         message = (message == WM_KEYDOWN) ? WM_DEADCHAR : WM_SYSDEADCHAR;
         dead_char = wp[0];
-        dprintf_key( stddeb, "-1 -> PostMessage(%s)\n",
+        dprintf_info(key, "-1 -> PostMessage(%s)\n",
                      SPY_GetMsgName(message));
         PostMessage16( hwnd, message, wp[0], lParam );
         return TRUE;
@@ -1643,7 +1642,7 @@
  */
 WORD WINAPI RegisterWindowMessage16( SEGPTR str )
 {
-    dprintf_msg(stddeb, "RegisterWindowMessage16: %08lx\n", (DWORD)str );
+    dprintf_info(msg, "RegisterWindowMessage16: %08lx\n", (DWORD)str );
     return GlobalAddAtom16( str );
 }
 
@@ -1653,7 +1652,7 @@
  */
 WORD WINAPI RegisterWindowMessage32A( LPCSTR str )
 {
-    dprintf_msg(stddeb, "RegisterWindowMessage32A: %s\n", str );
+    dprintf_info(msg, "RegisterWindowMessage32A: %s\n", str );
     return GlobalAddAtom32A( str );
 }
 
@@ -1663,7 +1662,7 @@
  */
 WORD WINAPI RegisterWindowMessage32W( LPCWSTR str )
 {
-    dprintf_msg(stddeb, "RegisterWindowMessage32W: %p\n", str );
+    dprintf_info(msg, "RegisterWindowMessage32W: %p\n", str );
     return GlobalAddAtom32W( str );
 }
 
diff --git a/windows/nonclient.c b/windows/nonclient.c
index 145ded0..03ebe51 100644
--- a/windows/nonclient.c
+++ b/windows/nonclient.c
@@ -21,7 +21,6 @@
 #include "graphics.h"
 #include "queue.h"
 #include "selectors.h"
-#include "stddebug.h"
 #include "tweak.h"
 #include "debug.h"
 #include "options.h"
@@ -202,7 +201,7 @@
     exStyle &= WS_EX_DLGMODALFRAME;
     if (exStyle & WS_EX_DLGMODALFRAME) style &= ~WS_THICKFRAME;
 
-    dprintf_nonclient(stddeb, "AdjustWindowRectEx: (%d,%d)-(%d,%d) %08lx %d %08lx\n",
+    dprintf_info(nonclient, "AdjustWindowRectEx: (%d,%d)-(%d,%d) %08lx %d %08lx\n",
                       rect->left, rect->top, rect->right, rect->bottom,
                       style, menu, exStyle );
 
@@ -256,7 +255,7 @@
 	winRect->bottom -= tmpRect.bottom;
 
 	if (HAS_MENU(pWnd)) {
-	    dprintf_nonclient( stddeb, "NC_HandleNCCalcSize: Calling "
+	    dprintf_info(nonclient, "NC_HandleNCCalcSize: Calling "
 			       "GetMenuBarHeight with HWND 0x%x, width %d, "
 			       "at (%d, %d).\n", pWnd->hwndSelf,
 			       winRect->right - winRect->left,
@@ -323,7 +322,7 @@
     WND *wndPtr = WIN_FindWndPtr( hwnd );
     if (!wndPtr) return HTERROR;
 
-    dprintf_nonclient(stddeb, "NC_HandleNCHitTest: hwnd=%04x pt=%d,%d\n",
+    dprintf_info(nonclient, "NC_HandleNCHitTest: hwnd=%04x pt=%d,%d\n",
 		      hwnd, pt.x, pt.y );
 
     GetWindowRect16( hwnd, &rect );
@@ -1013,7 +1012,7 @@
 
     active  = wndPtr->flags & WIN_NCACTIVATED;
 
-    dprintf_nonclient(stddeb, "NC_DoNCPaint: %04x %d\n", hwnd, active );
+    dprintf_info(nonclient, "NC_DoNCPaint: %04x %d\n", hwnd, active );
 
     if (!(hdc = GetDCEx32( hwnd, 0, DCX_USESTYLE | DCX_WINDOW ))) return;
 
@@ -1120,7 +1119,7 @@
 
     active  = wndPtr->flags & WIN_NCACTIVATED;
 
-    dprintf_nonclient(stddeb, "NC_DoNCPaint95: %04x %d\n", hwnd, active );
+    dprintf_info(nonclient, "NC_DoNCPaint95: %04x %d\n", hwnd, active );
 
     if (!(hdc = GetDCEx32( hwnd, 0, DCX_USESTYLE | DCX_WINDOW ))) return;
 
@@ -1173,14 +1172,14 @@
 	r.bottom = rect.top + sysMetrics[SM_CYMENU] - sysMetrics[SM_CYBORDER];
 	r.top -= sysMetrics[SM_CYBORDER];
 	
-	dprintf_nonclient(stddeb, "DoNCPaint95: Calling DrawMenuBar with "
+	dprintf_info(nonclient, "DoNCPaint95: Calling DrawMenuBar with "
 			  "rect (%d, %d)-(%d, %d)\n", r.left, r.top,
 			  r.right, r.bottom);
 
 	rect.top += MENU_DrawMenuBar( hdc, &r, hwnd, suppress_menupaint );
     }
 
-    dprintf_nonclient( stddeb, "After MenuBar, rect is (%d, %d)-(%d, %d).\n",
+    dprintf_info(nonclient, "After MenuBar, rect is (%d, %d)-(%d, %d).\n",
 		       rect.left, rect.top, rect.right, rect.bottom );
 
     /* Draw the inner frames */
@@ -1882,7 +1881,7 @@
     POINT32 pt32;
     UINT16 uCommand = wParam & 0xFFF0;
 
-    dprintf_nonclient(stddeb, "Handling WM_SYSCOMMAND %x %d,%d\n", 
+    dprintf_info(nonclient, "Handling WM_SYSCOMMAND %x %d,%d\n", 
 		      wParam, pt.x, pt.y );
 
     if (wndPtr->dwStyle & WS_CHILD && uCommand != SC_KEYMENU )
diff --git a/windows/painting.c b/windows/painting.c
index 9baba58..20c8b12 100644
--- a/windows/painting.c
+++ b/windows/painting.c
@@ -14,8 +14,6 @@
 #include "gdi.h"
 #include "dce.h"
 #include "heap.h"
-#include "stddebug.h"
-/* #define DEBUG_WIN */
 #include "debug.h"
 
   /* Last CTLCOLOR id */
@@ -30,7 +28,7 @@
     POINT16 pt = {0, 0}; 
     HRGN32 hClip = 1;
 
-    dprintf_nonclient(stddeb,"NCUpdate: hwnd %04x, hrgnUpdate %04x\n", 
+    dprintf_info(nonclient,"NCUpdate: hwnd %04x, hrgnUpdate %04x\n", 
                       wnd->hwndSelf, wnd->hrgnUpdate );
 
     /* desktop window doesn't have nonclient area */
@@ -112,7 +110,7 @@
 
     HideCaret32( hwnd );
 
-    dprintf_win(stddeb,"hrgnUpdate = %04x, ", hrgnUpdate);
+    dprintf_info(win,"hrgnUpdate = %04x, \n", hrgnUpdate);
 
     /* When bIcon is TRUE hrgnUpdate is automatically in window coordinates
      * (because rectClient == rectWindow for WS_MINIMIZE windows).
@@ -133,7 +131,7 @@
                              (bIcon ? DCX_WINDOW : 0) );
     }
 
-    dprintf_win(stddeb,"hdc = %04x\n", lps->hdc);
+    dprintf_info(win,"hdc = %04x\n", lps->hdc);
 
     if (!lps->hdc)
     {
@@ -143,7 +141,7 @@
 
     GetRgnBox16( InquireVisRgn(lps->hdc), &lps->rcPaint );
 
-dprintf_win(stddeb,"box = (%i,%i - %i,%i)\n", lps->rcPaint.left, lps->rcPaint.top,
+dprintf_info(win,"box = (%i,%i - %i,%i)\n", lps->rcPaint.left, lps->rcPaint.top,
 		    lps->rcPaint.right, lps->rcPaint.bottom );
 
     DPtoLP16( lps->hdc, (LPPOINT16)&lps->rcPaint, 2 );
@@ -297,13 +295,13 @@
     bIcon = (wndPtr->dwStyle & WS_MINIMIZE && wndPtr->class->hIcon);
     if (rectUpdate)
     {
-        dprintf_win(stddeb, "RedrawWindow: %04x %d,%d-%d,%d %04x flags=%04x\n",
+        dprintf_info(win, "RedrawWindow: %04x %d,%d-%d,%d %04x flags=%04x\n",
                     hwnd, rectUpdate->left, rectUpdate->top,
                     rectUpdate->right, rectUpdate->bottom, hrgnUpdate, flags );
     }
     else
     {
-        dprintf_win(stddeb, "RedrawWindow: %04x NULL %04x flags=%04x\n",
+        dprintf_info(win, "RedrawWindow: %04x NULL %04x flags=%04x\n",
                      hwnd, hrgnUpdate, flags);
     }
 
diff --git a/windows/property.c b/windows/property.c
index c44f871..221048c 100644
--- a/windows/property.c
+++ b/windows/property.c
@@ -7,7 +7,6 @@
 #include <string.h>
 #include "win.h"
 #include "heap.h"
-#include "stddebug.h"
 #include "debug.h"
 
 
@@ -74,10 +73,10 @@
     PROPERTY *prop = PROP_FindProp( hwnd, str );
 
     if (HIWORD(str))
-        dprintf_prop( stddeb, "GetProp(%08x,'%s'): returning %08x\n",
+        dprintf_info(prop, "GetProp(%08x,'%s'): returning %08x\n",
                       hwnd, str, prop ? prop->handle : 0 );
     else
-        dprintf_prop( stddeb, "GetProp(%08x,#%04x): returning %08x\n",
+        dprintf_info(prop, "GetProp(%08x,#%04x): returning %08x\n",
                       hwnd, LOWORD(str), prop ? prop->handle : 0 );
 
     return prop ? prop->handle : 0;
@@ -117,9 +116,9 @@
     PROPERTY *prop;
 
     if (HIWORD(str))
-        dprintf_prop( stddeb, "SetProp: %04x '%s' %08x\n", hwnd, str, handle );
+        dprintf_info(prop, "SetProp: %04x '%s' %08x\n", hwnd, str, handle );
     else
-        dprintf_prop( stddeb, "SetProp: %04x #%04x %08x\n",
+        dprintf_info(prop, "SetProp: %04x #%04x %08x\n",
                       hwnd, LOWORD(str), handle );
 
     if (!(prop = PROP_FindProp( hwnd, str )))
@@ -178,9 +177,9 @@
     WND *pWnd = WIN_FindWndPtr( hwnd );
 
     if (HIWORD(str))
-      dprintf_prop( stddeb, "RemoveProp: %04x '%s'\n", hwnd, str );
+      dprintf_info(prop, "RemoveProp: %04x '%s'\n", hwnd, str );
     else
-      dprintf_prop( stddeb, "RemoveProp: %04x #%04x\n", hwnd, LOWORD(str));
+      dprintf_info(prop, "RemoveProp: %04x #%04x\n", hwnd, LOWORD(str));
 
 
     if (!pWnd) return NULL;
@@ -263,7 +262,7 @@
     WND *pWnd;
     INT16 ret = -1;
 
-    dprintf_prop( stddeb, "EnumProps: %04x %08x\n", hwnd, (UINT32)func );
+    dprintf_info(prop, "EnumProps: %04x %08x\n", hwnd, (UINT32)func );
     if (!(pWnd = WIN_FindWndPtr( hwnd ))) return -1;
     for (prop = pWnd->pProp; (prop); prop = next)
     {
@@ -271,7 +270,7 @@
         /* function removes the current property.    */
         next = prop->next;
 
-        dprintf_prop( stddeb, "  Callback: handle=%08x str='%s'\n",
+        dprintf_info(prop, "  Callback: handle=%08x str='%s'\n",
                       prop->handle, prop->string );
         ret = func( hwnd, SEGPTR_GET(prop->string), prop->handle );
         if (!ret) break;
@@ -307,7 +306,7 @@
     WND *pWnd;
     INT32 ret = -1;
 
-    dprintf_prop( stddeb, "EnumPropsEx32A: %04x %08x %08lx\n",
+    dprintf_info(prop, "EnumPropsEx32A: %04x %08x %08lx\n",
                   hwnd, (UINT32)func, lParam );
     if (!(pWnd = WIN_FindWndPtr( hwnd ))) return -1;
     for (prop = pWnd->pProp; (prop); prop = next)
@@ -316,7 +315,7 @@
         /* function removes the current property.    */
         next = prop->next;
 
-        dprintf_prop( stddeb, "  Callback: handle=%08x str='%s'\n",
+        dprintf_info(prop, "  Callback: handle=%08x str='%s'\n",
                       prop->handle, prop->string );
         ret = func( hwnd, prop->string, prop->handle, lParam );
         if (!ret) break;
@@ -334,7 +333,7 @@
     WND *pWnd;
     INT32 ret = -1;
 
-    dprintf_prop( stddeb, "EnumPropsEx32W: %04x %08x %08lx\n",
+    dprintf_info(prop, "EnumPropsEx32W: %04x %08x %08lx\n",
                   hwnd, (UINT32)func, lParam );
     if (!(pWnd = WIN_FindWndPtr( hwnd ))) return -1;
     for (prop = pWnd->pProp; (prop); prop = next)
@@ -343,7 +342,7 @@
         /* function removes the current property.    */
         next = prop->next;
 
-        dprintf_prop( stddeb, "  Callback: handle=%08x str='%s'\n",
+        dprintf_info(prop, "  Callback: handle=%08x str='%s'\n",
                       prop->handle, prop->string );
         if (HIWORD(prop->string))
         {
diff --git a/windows/queue.c b/windows/queue.c
index f23542f..d305334 100644
--- a/windows/queue.c
+++ b/windows/queue.c
@@ -15,7 +15,6 @@
 #include "hook.h"
 #include "thread.h"
 #include "process.h"
-#include "stddebug.h"
 #include "debug.h"
 
 #define MAX_QUEUE_SIZE   120  /* Max. size of a message queue */
@@ -123,7 +122,7 @@
     int queueSize;
     TDB *pTask = (TDB *)GlobalLock16( GetCurrentTask() );
 
-    dprintf_msg(stddeb,"Creating message queue...\n");
+    dprintf_info(msg,"Creating message queue...\n");
 
     queueSize = sizeof(MESSAGEQUEUE) + size * sizeof(QMSG);
     if (!(hQueue = GlobalAlloc16( GMEM_FIXED | GMEM_ZEROINIT, queueSize )))
@@ -153,11 +152,11 @@
     HQUEUE16  senderQ;
     HQUEUE16 *pPrev;
 
-    dprintf_msg(stddeb,"Deleting message queue %04x\n", hQueue);
+    dprintf_info(msg,"Deleting message queue %04x\n", hQueue);
 
     if (!hQueue || !msgQueue)
     {
-	dprintf_msg(stddeb,"DeleteMsgQueue: invalid argument.\n");
+	dprintf_warn(msg, "DeleteMsgQueue: invalid argument.\n");
 	return 0;
     }
     if( pCursorQueue == msgQueue ) pCursorQueue = NULL;
@@ -224,7 +223,7 @@
  */
 void QUEUE_SetWakeBit( MESSAGEQUEUE *queue, WORD bit )
 {
-    dprintf_msg(stddeb,"SetWakeBit: queue = %04x (wm=%04x), bit = %04x\n", 
+    dprintf_info(msg,"SetWakeBit: queue = %04x (wm=%04x), bit = %04x\n", 
 	                queue->self, queue->wakeMask, bit );
 
     if (bit & QS_MOUSE) pMouseQueue = queue;
@@ -258,7 +257,7 @@
 {
     MESSAGEQUEUE *queue;
 
-    dprintf_msg(stddeb,"WaitBits: q %04x waiting for %04x\n", GetTaskQueue(0), bits);
+    dprintf_info(msg,"WaitBits: q %04x waiting for %04x\n", GetTaskQueue(0), bits);
 
     for (;;)
     {
@@ -282,7 +281,7 @@
         queue->wakeMask = bits | QS_SENDMESSAGE;
 	if(queue->changeBits & bits) continue;
 	
-	dprintf_msg(stddeb,"wb: (%04x) wakeMask is %04x, waiting\n", queue->self, queue->wakeMask);
+	dprintf_info(msg,"wb: (%04x) wakeMask is %04x, waiting\n", queue->self, queue->wakeMask);
 
         WaitEvent( 0 );
     }
@@ -301,10 +300,10 @@
     QSMCTRL*      prevCtrlPtr = NULL;
     LRESULT       result = 0;
 
-    dprintf_msg(stddeb, "ReceiveMessage, queue %04x\n", queue->self );
+    dprintf_info(msg, "ReceiveMessage, queue %04x\n", queue->self );
     if (!(queue->wakeBits & QS_SENDMESSAGE) ||
         !(senderQ = (MESSAGEQUEUE*)GlobalLock16( queue->hSendingTask))) 
-	{ dprintf_msg(stddeb,"\trcm: nothing to do\n"); return; }
+	{ dprintf_info(msg,"\trcm: nothing to do\n"); return; }
 
     if( !senderQ->hPrevSendingTask )
     {
@@ -321,11 +320,11 @@
     queue->smResultCurrent     = senderQ->smResultInit;
     queue->hSendingTask	       = senderQ->hPrevSendingTask;
 
-    dprintf_msg(stddeb, "\trcm: smResultCurrent = %08x, prevCtrl = %08x\n", 
+    dprintf_info(msg, "\trcm: smResultCurrent = %08x, prevCtrl = %08x\n", 
 				(unsigned)queue->smResultCurrent, (unsigned)prevCtrlPtr );
     QUEUE_SetWakeBit( senderQ, QS_SMPARAMSFREE );
 
-    dprintf_msg(stddeb, "\trcm: calling wndproc - %04x %04x %04x%04x %08x\n",
+    dprintf_info(msg, "\trcm: calling wndproc - %04x %04x %04x%04x %08x\n",
                 senderQ->hWnd, senderQ->msg, senderQ->wParamHigh,
                 senderQ->wParam, (unsigned)senderQ->lParam );
 
@@ -338,7 +337,7 @@
         if (senderQ->flags & QUEUE_SM_WIN32)
         {
             WPARAM32 wParam = MAKELONG( senderQ->wParam, senderQ->wParamHigh );
-            dprintf_msg(stddeb, "\trcm: msg is Win32\n" );
+            dprintf_info(msg, "\trcm: msg is Win32\n" );
             if (senderQ->flags & QUEUE_SM_UNICODE)
                 result = CallWindowProc32W( wndPtr->winproc,
                                             senderQ->hWnd, senderQ->msg,
@@ -354,9 +353,9 @@
                                        senderQ->wParam, senderQ->lParam );
 
         queue->GetMessageExtraInfoVal = extraInfo;  /* Restore extra info */
-	dprintf_msg(stddeb,"\trcm: result =  %08x\n", (unsigned)result );
+	dprintf_info(msg,"\trcm: result =  %08x\n", (unsigned)result );
     }
-    else dprintf_msg(stddeb,"\trcm: bad hWnd\n");
+    else dprintf_warn(msg, "\trcm: bad hWnd\n");
 
     /* Return the result to the sender task */
     ReplyMessage16( result );
@@ -364,7 +363,7 @@
     queue->InSendMessageHandle = prevSender;
     queue->smResultCurrent     = prevCtrlPtr;
 
-    dprintf_msg(stddeb,"ReceiveMessage: done!\n");
+    dprintf_info(msg,"ReceiveMessage: done!\n");
 }
 
 /***********************************************************************
@@ -448,7 +447,7 @@
 {
     int i, pos = msgQueue->nextMessage;
 
-    dprintf_msg(stddeb,"QUEUE_FindMsg: hwnd=%04x pos=%d\n", hwnd, pos );
+    dprintf_info(msg,"QUEUE_FindMsg: hwnd=%04x pos=%d\n", hwnd, pos );
 
     if (!msgQueue->msgCount) return -1;
     if (!hwnd && !first && !last) return pos;
@@ -539,7 +538,7 @@
       }
       if( !queue )
       { 
-        dprintf_msg(stddeb,"WakeSomeone: couldn't find queue\n"); 
+        dprintf_warn(msg, "WakeSomeone: couldn't find queue\n"); 
         return; 
       }
     }
@@ -735,13 +734,13 @@
     HQUEUE16 hQueue, hNewQueue;
     MESSAGEQUEUE *queuePtr;
 
-    dprintf_msg(stddeb,"SetMessageQueue: task %04x size %i\n", GetCurrentTask(), size); 
+    dprintf_info(msg,"SetMessageQueue: task %04x size %i\n", GetCurrentTask(), size); 
 
     if ((size > MAX_QUEUE_SIZE) || (size <= 0)) return TRUE;
 
     if( !(hNewQueue = QUEUE_CreateMsgQueue( size ))) 
     {
-	dprintf_msg(stddeb,"SetMessageQueue: failed!\n");
+	dprintf_warn(msg, "SetMessageQueue: failed!\n");
 	return FALSE;
     }
     queuePtr = (MESSAGEQUEUE *)GlobalLock16( hNewQueue );
diff --git a/windows/scroll.c b/windows/scroll.c
index 6b7e866..c656d57 100644
--- a/windows/scroll.c
+++ b/windows/scroll.c
@@ -16,7 +16,6 @@
 #include "region.h"
 #include "graphics.h"
 #include "sysmetrics.h"
-#include "stddebug.h"
 #include "debug.h"
 
 extern HWND32 CARET_GetHwnd();			/* windows/caret.c */
@@ -51,7 +50,7 @@
     HWND32 	hCaretWnd = CARET_GetHwnd();
     WND*	wndScroll = WIN_FindWndPtr( hwnd );
 
-    dprintf_scroll(stddeb,"ScrollWindow: hwnd=%04x, dx=%d, dy=%d, lpRect =%p clipRect=%i,%i,%i,%i\n", 
+    dprintf_info(scroll,"ScrollWindow: hwnd=%04x, dx=%d, dy=%d, lpRect =%p clipRect=%i,%i,%i,%i\n", 
                    hwnd, dx, dy, rect,
                    clipRect ? clipRect->left : 0,
                    clipRect ? clipRect->top : 0,
@@ -157,7 +156,7 @@
     INT32  ldx, ldy;
     DC *dc = (DC *)GDI_GetObjPtr(hdc, DC_MAGIC);
 
-    dprintf_scroll(stddeb,"ScrollDC: %04x %d,%d hrgnUpdate=%04x rcUpdate = %p cliprc = (%d,%d-%d,%d), rc=(%d,%d-%d,%d)\n",
+    dprintf_info(scroll,"ScrollDC: %04x %d,%d hrgnUpdate=%04x rcUpdate = %p cliprc = (%d,%d-%d,%d), rc=(%d,%d-%d,%d)\n",
                    (HDC16)hdc, dx, dy, hrgnUpdate, rcUpdate, 
 		   prLClip ? prLClip->left : 0, prLClip ? prLClip->top : 0, prLClip ? prLClip->right : 0, prLClip ? prLClip->bottom : 0,
 		   rc ? rc->left : 0, rc ? rc->top : 0, rc ? rc->right : 0, rc ? rc->bottom : 0 );
@@ -374,7 +373,7 @@
 	BOOL32  bUpdate = (rcUpdate || hrgnUpdate || flags & (SW_INVALIDATE | SW_ERASE));
 	HRGN32  hrgnClip = CreateRectRgnIndirect32(&cliprc);
 
-dprintf_scroll(stddeb,"ScrollWindowEx: %04x, %d,%d hrgnUpdate=%04x rcUpdate = %p \
+dprintf_info(scroll,"ScrollWindowEx: %04x, %d,%d hrgnUpdate=%04x rcUpdate = %p \
 cliprc = (%d,%d-%d,%d), rc=(%d,%d-%d,%d) %04x\n",             
 (HWND16)hwnd, dx, dy, hrgnUpdate, rcUpdate,
 clipRect?clipRect->left:0, clipRect?clipRect->top:0, clipRect?clipRect->right:0, clipRect?clipRect->bottom:0,
diff --git a/windows/timer.c b/windows/timer.c
index a28a375..4524573 100644
--- a/windows/timer.c
+++ b/windows/timer.c
@@ -7,8 +7,6 @@
 #include "windows.h"
 #include "queue.h"
 #include "winproc.h"
-#include "stddebug.h"
-/* #define DEBUG_TIMER */
 #include "debug.h"
 
 
@@ -202,7 +200,7 @@
     if (!pTimer || (pTimer->expires > curTime)) return FALSE; /* No timer */
     if (remove)	TIMER_RestartTimer( pTimer, curTime );  /* Restart it */
 
-    dprintf_timer( stddeb, "Timer expired: %04x, %04x, %04x, %08lx\n", 
+    dprintf_info(timer, "Timer expired: %04x, %04x, %04x, %08lx\n", 
 		   pTimer->hwnd, pTimer->msg, pTimer->id, (DWORD)pTimer->proc);
 
       /* Build the message */
@@ -264,7 +262,7 @@
     pTimer->expires = GetTickCount() + timeout;
     pTimer->proc    = (HWINDOWPROC)0;
     if (proc) WINPROC_SetProc( &pTimer->proc, proc, type, WIN_PROC_TIMER );
-    dprintf_timer( stddeb, "Timer added: %p, %04x, %04x, %04x, %08lx\n", 
+    dprintf_info(timer, "Timer added: %p, %04x, %04x, %04x, %08lx\n", 
 		   pTimer, pTimer->hwnd, pTimer->msg, pTimer->id,
                    (DWORD)pTimer->proc );
     TIMER_InsertTimer( pTimer );
@@ -304,7 +302,7 @@
 UINT16 WINAPI SetTimer16( HWND16 hwnd, UINT16 id, UINT16 timeout,
                           TIMERPROC16 proc )
 {
-    dprintf_timer( stddeb, "SetTimer16: %04x %d %d %08lx\n",
+    dprintf_info(timer, "SetTimer16: %04x %d %d %08lx\n",
                    hwnd, id, timeout, (LONG)proc );
     return TIMER_SetTimer( hwnd, id, timeout, (WNDPROC16)proc,
                            WIN_PROC_16, FALSE );
@@ -317,7 +315,7 @@
 UINT32 WINAPI SetTimer32( HWND32 hwnd, UINT32 id, UINT32 timeout,
                           TIMERPROC32 proc )
 {
-    dprintf_timer( stddeb, "SetTimer32: %04x %d %d %08lx\n",
+    dprintf_info(timer, "SetTimer32: %04x %d %d %08lx\n",
                    hwnd, id, timeout, (LONG)proc );
     return TIMER_SetTimer( hwnd, id, timeout, (WNDPROC16)proc,
                            WIN_PROC_32A, FALSE );
@@ -330,7 +328,7 @@
 UINT16 WINAPI SetSystemTimer16( HWND16 hwnd, UINT16 id, UINT16 timeout,
                                 TIMERPROC16 proc )
 {
-    dprintf_timer( stddeb, "SetSystemTimer16: %04x %d %d %08lx\n", 
+    dprintf_info(timer, "SetSystemTimer16: %04x %d %d %08lx\n", 
                    hwnd, id, timeout, (LONG)proc );
     return TIMER_SetTimer( hwnd, id, timeout, (WNDPROC16)proc,
                            WIN_PROC_16, TRUE );
@@ -343,7 +341,7 @@
 UINT32 WINAPI SetSystemTimer32( HWND32 hwnd, UINT32 id, UINT32 timeout,
                                 TIMERPROC32 proc )
 {
-    dprintf_timer( stddeb, "SetSystemTimer32: %04x %d %d %08lx\n", 
+    dprintf_info(timer, "SetSystemTimer32: %04x %d %d %08lx\n", 
                    hwnd, id, timeout, (LONG)proc );
     return TIMER_SetTimer( hwnd, id, timeout, (WNDPROC16)proc,
                            WIN_PROC_32A, TRUE );
@@ -355,7 +353,7 @@
  */
 BOOL16 WINAPI KillTimer16( HWND16 hwnd, UINT16 id )
 {
-    dprintf_timer(stddeb, "KillTimer16: %04x %d\n", hwnd, id );
+    dprintf_info(timer, "KillTimer16: %04x %d\n", hwnd, id );
     return TIMER_KillTimer( hwnd, id, FALSE );
 }
 
@@ -365,7 +363,7 @@
  */
 BOOL32 WINAPI KillTimer32( HWND32 hwnd, UINT32 id )
 {
-    dprintf_timer(stddeb, "KillTimer32: %04x %d\n", hwnd, id );
+    dprintf_info(timer, "KillTimer32: %04x %d\n", hwnd, id );
     return TIMER_KillTimer( hwnd, id, FALSE );
 }
 
@@ -375,7 +373,7 @@
  */
 BOOL16 WINAPI KillSystemTimer16( HWND16 hwnd, UINT16 id )
 {
-    dprintf_timer( stddeb, "KillSystemTimer16: %04x %d\n", hwnd, id );
+    dprintf_info(timer, "KillSystemTimer16: %04x %d\n", hwnd, id );
     return TIMER_KillTimer( hwnd, id, TRUE );
 }
 
@@ -385,6 +383,6 @@
  */
 BOOL32 WINAPI KillSystemTimer32( HWND32 hwnd, UINT32 id )
 {
-    dprintf_timer( stddeb, "KillSystemTimer32: %04x %d\n", hwnd, id );
+    dprintf_info(timer, "KillSystemTimer32: %04x %d\n", hwnd, id );
     return TIMER_KillTimer( hwnd, id, TRUE );
 }
diff --git a/windows/user.c b/windows/user.c
index 8faf91b..f7aea01 100644
--- a/windows/user.c
+++ b/windows/user.c
@@ -300,6 +300,20 @@
     return FALSE;
 }
 
+/***********************************************************************
+ *           EnumDisplaySettingsA   (USER32.592)
+ */
+BOOL32 WINAPI EnumDisplaySettings32A(LPCSTR name,DWORD n,LPDEVMODE32A devmode) {
+	fprintf(stderr,"EnumDisplaySettings32A(%s,%ld,%p)\n",name,n,devmode);
+	if (n==0) {
+		devmode->dmBitsPerPel = DefaultDepthOfScreen(screen);
+		devmode->dmPelsHeight = screenHeight;
+		devmode->dmPelsWidth = screenWidth;
+		return TRUE;
+	}
+	return FALSE;
+}
+
 
 /***********************************************************************
  *           SetEventHook   (USER.321)
diff --git a/windows/win.c b/windows/win.c
index 74b55ea..d431b51 100644
--- a/windows/win.c
+++ b/windows/win.c
@@ -30,10 +30,8 @@
 #include "clipboard.h"
 #include "winproc.h"
 #include "thread.h"
-#include "stddebug.h"
-/* #define DEBUG_WIN  */ 
-/* #define DEBUG_MENU */
 #include "debug.h"
+#include "debugstr.h"
 
 /* Desktop window */
 static WND *pWndDesktop = NULL;
@@ -237,7 +235,7 @@
     {
         if (!(pWnd->dwStyle & WS_VISIBLE))
         {
-            dprintf_win( stddeb, "FindWinToRepaint: skipping window %04x\n",
+            dprintf_info(win, "FindWinToRepaint: skipping window %04x\n",
                          pWnd->hwndSelf );
             continue;
         }
@@ -260,7 +258,7 @@
         pWnd = pWnd->next;
     }
     if (pWnd) hwndRet = pWnd->hwndSelf;
-    dprintf_win(stddeb,"FindWinToRepaint: found %04x\n",hwndRet);
+    dprintf_info(win,"FindWinToRepaint: found %04x\n",hwndRet);
     return hwndRet;
 }
 
@@ -275,7 +273,7 @@
     HWND32 hwnd = wndPtr->hwndSelf;
     WND *pWnd;
 
-    dprintf_win( stddeb, "WIN_DestroyWindow: %04x\n", wndPtr->hwndSelf );
+    dprintf_info(win, "WIN_DestroyWindow: %04x\n", wndPtr->hwndSelf );
 
 #ifdef CONFIG_IPC
     if (main_block)
@@ -405,7 +403,7 @@
     CLASS *class;
     HWND32 hwndDesktop;
 
-    dprintf_win(stddeb,"Creating desktop window\n");
+    dprintf_info(win,"Creating desktop window\n");
 
     if (!ICONTITLE_Init() ||
 	!WINPOS_CreateInternalPosAtom() ||
@@ -469,14 +467,10 @@
     POINT32 maxSize, maxPos, minTrack, maxTrack;
     LRESULT (WINAPI *localSend32)(HWND32, UINT32, WPARAM32, LPARAM);
 
-    dprintf_win( stddeb, "CreateWindowEx: " );
-    if (HIWORD(cs->lpszName)) dprintf_win( stddeb, "'%s' ", cs->lpszName );
-    else dprintf_win( stddeb, "#%04x ", LOWORD(cs->lpszName) );
-    if (HIWORD(cs->lpszClass)) dprintf_win( stddeb, "'%s' ", cs->lpszClass );
-    else dprintf_win( stddeb, "#%04x ", LOWORD(cs->lpszClass) );
-
-    dprintf_win( stddeb, "%08lx %08lx %d,%d %dx%d %04x %04x %08x %p\n",
-		 cs->dwExStyle, cs->style, cs->x, cs->y, cs->cx, cs->cy,
+    dprintf_info(win, "CreateWindowEx: %s %s %08lx %08lx %d,%d %dx%d "
+		 "%04x %04x %08x %p\n", debugres(cs->lpszName), 
+		 debugres(cs->lpszClass), cs->dwExStyle, 
+		 cs->style, cs->x, cs->y, cs->cx, cs->cy,
 		 cs->hwndParent, cs->hMenu, cs->hInstance, cs->lpCreateParams);
 
     /* Find the parent window */
@@ -521,7 +515,7 @@
     if (!(hwnd = USER_HEAP_ALLOC( sizeof(*wndPtr) + classPtr->cbWndExtra
                                   - sizeof(wndPtr->wExtra) )))
     {
-	dprintf_win( stddeb, "CreateWindowEx: out of memory\n" );
+	dprintf_info(win, "CreateWindowEx: out of memory\n" );
 	return 0;
     }
 
@@ -580,7 +574,7 @@
 	cbtc.hwndInsertAfter = hwndLinkAfter;
 	if ( HOOK_CallHooks32A(WH_CBT, HCBT_CREATEWND, hwnd, (LPARAM)&cbtc) )
 	{
-	    dprintf_win(stddeb, "CreateWindowEx: CBT-hook returned 0\n");
+	    dprintf_info(win, "CreateWindowEx: CBT-hook returned 0\n");
 	    USER_HEAP_FREE( hwnd );
 	    return 0;
 	}
@@ -711,9 +705,11 @@
                        LoadMenu(cs->hInstance,(SEGPTR)classPtr->menuNameA);
 #else
 	    SEGPTR menuName = (SEGPTR)GetClassLong16( hwnd, GCL_MENUNAME );
-	    if (HIWORD(cs->hInstance))
+	    /* hInstance is still 16-bit in 980215 winelib */
+	    if (HIWORD(cs->hInstance) || __winelib)
 	    	cs->hMenu = LoadMenu32A(cs->hInstance,PTR_SEG_TO_LIN(menuName));
 	    else
+	      /* doesn't work for winelib, since resources are unicode */
 	    	cs->hMenu = LoadMenu16(cs->hInstance,menuName);
 #endif
         }
@@ -780,14 +776,14 @@
             if (!(wndPtr->dwStyle & WS_CHILD) && !wndPtr->owner)
                 HOOK_CallHooks16( WH_SHELL, HSHELL_WINDOWCREATED, hwnd, 0 );
 
-            dprintf_win(stddeb, "CreateWindowEx: created window %04x\n", hwnd);
+            dprintf_info(win, "CreateWindowEx: created window %04x\n", hwnd);
             return hwnd;
         }
     }
 
     /* Abort window creation */
 
-    dprintf_win(stddeb,"CreateWindowEx: aborted by WM_xxCREATE!\n");
+    dprintf_warn(win, "CreateWindowEx: aborted by WM_xxCREATE!\n");
     WIN_UnlinkWindow( hwnd );
     WIN_DestroyWindow( wndPtr );
     return 0;
@@ -851,7 +847,7 @@
 
 
 /***********************************************************************
- *           CreateWindowEx32A   (USER32.82)
+ *           CreateWindowEx32A   (USER32.83)
  */
 HWND32 WINAPI CreateWindowEx32A( DWORD exStyle, LPCSTR className,
                                  LPCSTR windowName, DWORD style, INT32 x,
@@ -891,7 +887,7 @@
 
 
 /***********************************************************************
- *           CreateWindowEx32W   (USER32.83)
+ *           CreateWindowEx32W   (USER32.84)
  */
 HWND32 WINAPI CreateWindowEx32W( DWORD exStyle, LPCWSTR className,
                                  LPCWSTR windowName, DWORD style, INT32 x,
@@ -969,7 +965,7 @@
 	WIN_CheckFocus(pWnd);
     }
     else
-	dprintf_win(stddeb,"\tdestroyed itself while in WM_DESTROY!\n");
+	dprintf_warn(win, "\tdestroyed itself while in WM_DESTROY!\n");
 }
 
 
@@ -983,13 +979,13 @@
 
 
 /***********************************************************************
- *           DestroyWindow32   (USER32.134)
+ *           DestroyWindow32   (USER32.135)
  */
 BOOL32 WINAPI DestroyWindow32( HWND32 hwnd )
 {
     WND * wndPtr;
 
-    dprintf_win(stddeb, "DestroyWindow(%04x)\n", hwnd);
+    dprintf_info(win, "DestroyWindow(%04x)\n", hwnd);
     
       /* Initialization */
 
@@ -1085,7 +1081,7 @@
 
  
 /***********************************************************************
- *           CloseWindow32   (USER32.55)
+ *           CloseWindow32   (USER32.56)
  */
 BOOL32 WINAPI CloseWindow32( HWND32 hwnd )
 {
@@ -1106,7 +1102,7 @@
 
 
 /***********************************************************************
- *           OpenIcon32   (USER32.409)
+ *           OpenIcon32   (USER32.410)
  */
 BOOL32 WINAPI OpenIcon32( HWND32 hwnd )
 {
@@ -1192,7 +1188,7 @@
 {
     ATOM atom = 0;
 
-    dprintf_win(stddeb, "FindWindowEx16: %04x %04x '%s' '%s'\n", parent,
+    dprintf_info(win, "FindWindowEx16: %04x %04x '%s' '%s'\n", parent,
 		child, HIWORD(className)?(char *)PTR_SEG_TO_LIN(className):"",
 		title ? title : "");
 
@@ -1207,7 +1203,7 @@
 
 
 /***********************************************************************
- *           FindWindow32A   (USER32.197)
+ *           FindWindow32A   (USER32.198)
  */
 HWND32 WINAPI FindWindow32A( LPCSTR className, LPCSTR title )
 {
@@ -1216,7 +1212,7 @@
 
 
 /***********************************************************************
- *           FindWindowEx32A   (USER32.198)
+ *           FindWindowEx32A   (USER32.199)
  */
 HWND32 WINAPI FindWindowEx32A( HWND32 parent, HWND32 child,
                                LPCSTR className, LPCSTR title )
@@ -1234,7 +1230,7 @@
 
 
 /***********************************************************************
- *           FindWindowEx32W   (USER32.199)
+ *           FindWindowEx32W   (USER32.200)
  */
 HWND32 WINAPI FindWindowEx32W( HWND32 parent, HWND32 child,
                                LPCWSTR className, LPCWSTR title )
@@ -1257,7 +1253,7 @@
 
 
 /***********************************************************************
- *           FindWindow32W   (USER32.200)
+ *           FindWindow32W   (USER32.201)
  */
 HWND32 WINAPI FindWindow32W( LPCWSTR className, LPCWSTR title )
 {
@@ -1284,7 +1280,7 @@
 
 
 /**********************************************************************
- *           GetDesktopWindow32   (USER32.231)
+ *           GetDesktopWindow32   (USER32.232)
  */
 HWND32 WINAPI GetDesktopWindow32(void)
 {
@@ -1314,7 +1310,7 @@
 
 
 /*******************************************************************
- *           EnableWindow32   (USER32.171)
+ *           EnableWindow32   (USER32.172)
  */
 BOOL32 WINAPI EnableWindow32( HWND32 hwnd, BOOL32 enable )
 {
@@ -1353,7 +1349,7 @@
 
 
 /***********************************************************************
- *           IsWindowEnabled32   (USER32.348)
+ *           IsWindowEnabled32   (USER32.349)
  */ 
 BOOL32 WINAPI IsWindowEnabled32(HWND32 hWnd)
 {
@@ -1365,7 +1361,7 @@
 
 
 /***********************************************************************
- *           IsWindowUnicode   (USER32.349)
+ *           IsWindowUnicode   (USER32.350)
  */
 BOOL32 WINAPI IsWindowUnicode( HWND32 hwnd )
 {
@@ -1386,7 +1382,7 @@
 
 
 /**********************************************************************
- *	     GetWindowWord32    (USER32.313)
+ *	     GetWindowWord32    (USER32.314)
  */
 WORD WINAPI GetWindowWord32( HWND32 hwnd, INT32 offset )
 {
@@ -1440,7 +1436,7 @@
 
 
 /**********************************************************************
- *	     SetWindowWord32    (USER32.523)
+ *	     SetWindowWord32    (USER32.524)
  */
 WORD WINAPI SetWindowWord32( HWND32 hwnd, INT32 offset, WORD newval )
 {
@@ -1584,7 +1580,7 @@
 
 
 /**********************************************************************
- *	     GetWindowLong32A    (USER32.304)
+ *	     GetWindowLong32A    (USER32.305)
  */
 LONG WINAPI GetWindowLong32A( HWND32 hwnd, INT32 offset )
 {
@@ -1593,7 +1589,7 @@
 
 
 /**********************************************************************
- *	     GetWindowLong32W    (USER32.305)
+ *	     GetWindowLong32W    (USER32.306)
  */
 LONG WINAPI GetWindowLong32W( HWND32 hwnd, INT32 offset )
 {
@@ -1611,7 +1607,7 @@
 
 
 /**********************************************************************
- *	     SetWindowLong32A    (USER32.516)
+ *	     SetWindowLong32A    (USER32.517)
  */
 LONG WINAPI SetWindowLong32A( HWND32 hwnd, INT32 offset, LONG newval )
 {
@@ -1620,7 +1616,7 @@
 
 
 /**********************************************************************
- *	     SetWindowLong32W    (USER32.517)
+ *	     SetWindowLong32W    (USER32.518)
  */
 LONG WINAPI SetWindowLong32W( HWND32 hwnd, INT32 offset, LONG newval )
 {
@@ -1638,7 +1634,7 @@
 
 
 /*******************************************************************
- *	     GetWindowText32A    (USER32.308)
+ *	     GetWindowText32A    (USER32.309)
  */
 INT32 WINAPI GetWindowText32A( HWND32 hwnd, LPSTR lpString, INT32 nMaxCount )
 {
@@ -1648,7 +1644,7 @@
 
 
 /*******************************************************************
- *	     GetWindowText32W    (USER32.311)
+ *	     GetWindowText32W    (USER32.312)
  */
 INT32 WINAPI GetWindowText32W( HWND32 hwnd, LPWSTR lpString, INT32 nMaxCount )
 {
@@ -1676,7 +1672,7 @@
 
 
 /*******************************************************************
- *	     SetWindowText32W    (USER32.522)
+ *	     SetWindowText32W    (USER32.523)
  */
 void WINAPI SetWindowText32W( HWND32 hwnd, LPCWSTR lpString )
 {
@@ -1694,7 +1690,7 @@
 
 
 /*******************************************************************
- *         GetWindowTextLength32A   (USER32.309)
+ *         GetWindowTextLength32A   (USER32.310)
  */
 INT32 WINAPI GetWindowTextLength32A( HWND32 hwnd )
 {
@@ -1702,7 +1698,7 @@
 }
 
 /*******************************************************************
- *         GetWindowTextLength32W   (USER32.309)
+ *         GetWindowTextLength32W   (USER32.311)
  */
 INT32 WINAPI GetWindowTextLength32W( HWND32 hwnd )
 {
@@ -1720,7 +1716,7 @@
 
 
 /*******************************************************************
- *         IsWindow32   (USER32.347)
+ *         IsWindow32   (USER32.348)
  */
 BOOL32 WINAPI IsWindow32( HWND32 hwnd )
 {
@@ -1739,7 +1735,7 @@
 
 
 /*****************************************************************
- *         GetParent32   (USER32.277)
+ *         GetParent32   (USER32.278)
  */
 HWND32 WINAPI GetParent32( HWND32 hwnd )
 {
@@ -1782,7 +1778,7 @@
 
 
 /*****************************************************************
- *         SetParent32   (USER32.494)
+ *         SetParent32   (USER32.495)
  */
 HWND32 WINAPI SetParent32( HWND32 hwndChild, HWND32 hwndNewParent )
 {
@@ -1841,7 +1837,7 @@
 
 
 /*******************************************************************
- *         IsChild32    (USER32.338)
+ *         IsChild32    (USER32.339)
  */
 BOOL32 WINAPI IsChild32( HWND32 parent, HWND32 child )
 {
@@ -1865,7 +1861,7 @@
 
 
 /***********************************************************************
- *           IsWindowVisible32   (USER32.350)
+ *           IsWindowVisible32   (USER32.351)
  */
 BOOL32 WINAPI IsWindowVisible32( HWND32 hwnd )
 {
@@ -1928,7 +1924,7 @@
 
 
 /*******************************************************************
- *         GetWindow32    (USER32.301)
+ *         GetWindow32    (USER32.302)
  */
 HWND32 WINAPI GetWindow32( HWND32 hwnd, WORD rel )
 {
@@ -1989,7 +1985,7 @@
 
 
 /*******************************************************************
- *         ShowOwnedPopups32  (USER32.530)
+ *         ShowOwnedPopups32  (USER32.531)
  */
 BOOL32 WINAPI ShowOwnedPopups32( HWND32 owner, BOOL32 fShow )
 {
@@ -2014,7 +2010,7 @@
 }
 
 /*******************************************************************
- *         GetLastActivePopup32   (USER32.255)
+ *         GetLastActivePopup32   (USER32.256)
  */
 HWND32 WINAPI GetLastActivePopup32( HWND32 hwnd )
 {
@@ -2105,7 +2101,7 @@
 
 
 /*******************************************************************
- *           EnumWindows32   (USER32.192)
+ *           EnumWindows32   (USER32.193)
  */
 BOOL32 WINAPI EnumWindows32( WNDENUMPROC32 lpEnumFunc, LPARAM lParam )
 {
@@ -2142,7 +2138,7 @@
 
 
 /**********************************************************************
- *           EnumThreadWindows   (USER32.189)
+ *           EnumThreadWindows   (USER32.190)
  */
 BOOL32 WINAPI EnumThreadWindows( DWORD id, WNDENUMPROC32 func, LPARAM lParam )
 {
@@ -2196,7 +2192,7 @@
 
 
 /**********************************************************************
- *           EnumChildWindows32   (USER32.177)
+ *           EnumChildWindows32   (USER32.178)
  */
 BOOL32 WINAPI EnumChildWindows32( HWND32 parent, WNDENUMPROC32 func,
                                   LPARAM lParam )
@@ -2216,7 +2212,7 @@
 
 
 /*******************************************************************
- *           AnyPopup32   (USER32.3)
+ *           AnyPopup32   (USER32.4)
  */
 BOOL32 WINAPI AnyPopup32(void)
 {
@@ -2237,13 +2233,13 @@
 
 
 /*******************************************************************
- *            FlashWindow32   (USER32.201)
+ *            FlashWindow32   (USER32.202)
  */
 BOOL32 WINAPI FlashWindow32( HWND32 hWnd, BOOL32 bInvert )
 {
     WND *wndPtr = WIN_FindWndPtr(hWnd);
 
-    dprintf_win(stddeb,"FlashWindow: %04x\n", hWnd);
+    dprintf_info(win,"FlashWindow: %04x\n", hWnd);
 
     if (!wndPtr) return FALSE;
 
@@ -2286,7 +2282,7 @@
 {
     HWND32 hWndOldModal = hwndSysModal;
     hwndSysModal = hWnd;
-    dprintf_win(stdnimp,"EMPTY STUB !! SetSysModalWindow(%04x) !\n", hWnd);
+    dprintf_fixme(win, "EMPTY STUB !! SetSysModalWindow(%04x) !\n", hWnd);
     return hWndOldModal;
 }
 
@@ -2344,7 +2340,7 @@
 
 	 if(ptrWnd)
          {
-	    dprintf_msg(stddeb,"DragQueryUpdate: hwnd = %04x, %d %d - %d %d\n",
+	    dprintf_info(msg,"DragQueryUpdate: hwnd = %04x, %d %d - %d %d\n",
                         ptrWnd->hwndSelf, ptrWnd->rectWindow.left, ptrWnd->rectWindow.top,
 			ptrWnd->rectWindow.right, ptrWnd->rectWindow.bottom );
             if( !(ptrWnd->dwStyle & WS_DISABLED) )
@@ -2383,7 +2379,7 @@
 }
 
 /*******************************************************************
- *             DragDetect32   (USER32.150)
+ *             DragDetect32   (USER32.151)
  */
 BOOL32 WINAPI DragDetect32( HWND32 hWnd, POINT32 pt )
 {
@@ -2483,7 +2479,7 @@
 	lpDragInfo->pt = msg.pt;
 
 	/* update DRAGINFO struct */
-	dprintf_msg(stddeb,"drag: lpDI->hScope = %04x\n",lpDragInfo->hScope);
+	dprintf_info(msg,"drag: lpDI->hScope = %04x\n",lpDragInfo->hScope);
 
 	if( DRAG_QueryUpdate(hwndScope, spDragInfo, FALSE) > 0 )
 	    hCurrentCursor = hCursor;
diff --git a/windows/winpos.c b/windows/winpos.c
index 1c1bdd4..53b4ed5 100644
--- a/windows/winpos.c
+++ b/windows/winpos.c
@@ -20,8 +20,6 @@
 #include "winpos.h"
 #include "dce.h"
 #include "nonclient.h"
-#include "stddebug.h"
-/* #define DEBUG_WIN */
 #include "debug.h"
 
 #define HAS_DLGFRAME(style,exStyle) \
@@ -87,7 +85,7 @@
     if( hwnd == hwndActive )
     {
 	hwndActive = 0; 
-	dprintf_win(stddeb,"\tattempt to activate destroyed window!\n");
+	dprintf_warn(win, "\tattempt to activate destroyed window!\n");
     }
 
     if( lpPos )
@@ -725,7 +723,7 @@
 {    
     int flags = SWP_NOZORDER | SWP_NOACTIVATE;
     if (!repaint) flags |= SWP_NOREDRAW;
-    dprintf_win(stddeb, "MoveWindow: %04x %d,%d %dx%d %d\n", 
+    dprintf_info(win, "MoveWindow: %04x %d,%d %dx%d %d\n", 
 	    hwnd, x, y, cx, cy, repaint );
     return SetWindowPos32( hwnd, 0, x, y, cx, cy, flags );
 }
@@ -791,7 +789,7 @@
     {
 	HWND16 hWnd = lpPos->hwndIconTitle;
 
-	dprintf_win(stddeb,"ShowIconTitle: 0x%04x %i\n", pWnd->hwndSelf, (bShow != 0) );
+	dprintf_info(win,"ShowIconTitle: 0x%04x %i\n", pWnd->hwndSelf, (bShow != 0) );
 
 	if( !hWnd )
 	    lpPos->hwndIconTitle = hWnd = ICONTITLE_Create( pWnd );
@@ -868,7 +866,7 @@
 
       /* Some sanity checks */
 
-    dprintf_win(stddeb,"GetMinMaxInfo: %d %d / %d %d / %d %d / %d %d\n",
+    dprintf_info(win,"GetMinMaxInfo: %d %d / %d %d / %d %d / %d %d\n",
                       MinMax.ptMaxSize.x, MinMax.ptMaxSize.y,
                       MinMax.ptMaxPosition.x, MinMax.ptMaxPosition.y,
                       MinMax.ptMaxTrackSize.x, MinMax.ptMaxTrackSize.y,
@@ -899,7 +897,7 @@
     LPINTERNALPOS lpPos = WINPOS_InitInternalPos( wndPtr, size,
                                                   &wndPtr->rectWindow );
 
-    dprintf_win(stddeb,"MinMaximize: 0x%04x %u\n", wndPtr->hwndSelf, cmd );
+    dprintf_info(win,"MinMaximize: 0x%04x %u\n", wndPtr->hwndSelf, cmd );
 
     if (lpPos && !HOOK_CallHooks16(WH_CBT, HCBT_MINMAX, wndPtr->hwndSelf, cmd))
     {
@@ -997,7 +995,7 @@
 
     if (!wndPtr) return FALSE;
 
-    dprintf_win(stddeb,"ShowWindow: hwnd=%04x, cmd=%d\n", hwnd, cmd);
+    dprintf_info(win,"ShowWindow: hwnd=%04x, cmd=%d\n", hwnd, cmd);
 
     wasVisible = (wndPtr->dwStyle & WS_VISIBLE) != 0;
 
@@ -1375,7 +1373,7 @@
     if( (wndTemp = WIN_FindWndPtr(hwndActive)) )
 	wIconized = HIWORD(wndTemp->dwStyle & WS_MINIMIZE);
     else
-	dprintf_win(stddeb,"WINPOS_ActivateWindow: no current active window.\n");
+	dprintf_info(win,"WINPOS_ActivateWindow: no current active window.\n");
 
     /* call CBT hook chain */
     if ((cbtStruct = SEGPTR_NEW(CBTACTIVATESTRUCT16)))
@@ -1617,7 +1615,7 @@
     }
     result = SendMessage32A( hwnd, WM_NCCALCSIZE, calcValidRect,
                              (LPARAM)&params );
-    dprintf_win( stddeb, "WINPOS_SendNCCalcSize: %d,%d-%d,%d\n",
+    dprintf_info(win, "WINPOS_SendNCCalcSize: %d,%d-%d,%d\n",
                  params.rgrc[0].left, params.rgrc[0].top,
                  params.rgrc[0].right, params.rgrc[0].bottom );
     *newClientRect = params.rgrc[0];
@@ -1817,7 +1815,7 @@
  HRGN32 dirtyRgn = CreateRectRgn32(0,0,0,0);
  int  other, my;
 
- dprintf_win(stddeb,"cleaning up...new wnd=(%i %i-%i %i) old wnd=(%i %i-%i %i)\n\
+ dprintf_info(win,"cleaning up...new wnd=(%i %i-%i %i) old wnd=(%i %i-%i %i)\n\
 \t\tnew client=(%i %i-%i %i) old client=(%i %i-%i %i)\n",
              Wnd->rectWindow.left, Wnd->rectWindow.top,
              Wnd->rectWindow.right, Wnd->rectWindow.bottom,
@@ -2057,7 +2055,7 @@
     int 	result = 0;
     UINT32 	uFlags = 0;
 
-    dprintf_win(stddeb,"SetWindowPos: hwnd %04x, (%i,%i)-(%i,%i) flags %08x\n", 
+    dprintf_info(win,"SetWindowPos: hwnd %04x, (%i,%i)-(%i,%i) flags %08x\n", 
 						 hwnd, x, y, x+cx, y+cy, flags);  
       /* Check window handle */
 
@@ -2192,14 +2190,16 @@
 
          /* FIXME: WVR_ALIGNxxx */
 
-         if( newClientRect.left != wndPtr->rectClient.left ||
-             newClientRect.top != wndPtr->rectClient.top )
+         if( !(winpos.flags & SWP_NOMOVE) &&
+	     (newClientRect.left != wndPtr->rectClient.left ||
+	      newClientRect.top != wndPtr->rectClient.top) )
              winpos.flags &= ~SWP_NOCLIENTMOVE;
 
-         if( (newClientRect.right - newClientRect.left !=
-              wndPtr->rectClient.right - wndPtr->rectClient.left) ||
-	     (newClientRect.bottom - newClientRect.top !=
-	      wndPtr->rectClient.bottom - wndPtr->rectClient.top) )
+         if( !(winpos.flags & SWP_NOSIZE) &&
+	     ((newClientRect.right - newClientRect.left !=
+	       wndPtr->rectClient.right - wndPtr->rectClient.left) ||
+	      (newClientRect.bottom - newClientRect.top !=
+	       wndPtr->rectClient.bottom - wndPtr->rectClient.top)) )
 	     winpos.flags &= ~SWP_NOCLIENTSIZE;
     }
     else
@@ -2398,7 +2398,7 @@
 
       /* And last, send the WM_WINDOWPOSCHANGED message */
 
-    dprintf_win(stddeb,"\tstatus flags = %04x\n", winpos.flags & SWP_AGG_STATUSFLAGS);
+    dprintf_info(win,"\tstatus flags = %04x\n", winpos.flags & SWP_AGG_STATUSFLAGS);
 
     if ( ((winpos.flags & SWP_AGG_STATUSFLAGS) != SWP_AGG_NOPOSCHANGE) && 
 	 !(winpos.flags & SWP_NOSENDCHANGING))
diff --git a/windows/winproc.c b/windows/winproc.c
index 1402b6c..1474a77 100644
--- a/windows/winproc.c
+++ b/windows/winproc.c
@@ -13,7 +13,6 @@
 #include "struct32.h"
 #include "win.h"
 #include "winproc.h"
-#include "stddebug.h"
 #include "debug.h"
 
 /* Window procedure 16-to-32-bit thunk,
@@ -115,7 +114,7 @@
 static LRESULT WINPROC_CallWndProc32( WNDPROC32 proc, HWND32 hwnd, UINT32 msg,
                                       WPARAM32 wParam, LPARAM lParam )
 {
-    dprintf_relay( stddeb, "CallTo32(wndproc=%p,hwnd=%08x,msg=%08x,wp=%08x,lp=%08lx)\n",
+    dprintf_info(relay, "CallTo32(wndproc=%p,hwnd=%08x,msg=%08x,wp=%08x,lp=%08lx)\n",
                    proc, hwnd, msg, wParam, lParam );
     return proc( hwnd, msg, wParam, lParam );
 }
@@ -225,7 +224,7 @@
         proc->user  = user;
     }
     proc->next  = NULL;
-    dprintf_win( stddeb, "WINPROC_AllocWinProc(%08x,%d): returning %08x\n",
+    dprintf_info(win, "WINPROC_AllocWinProc(%08x,%d): returning %08x\n",
                  (UINT32)func, type, (UINT32)proc );
     return proc;
 }
@@ -340,7 +339,7 @@
 
     /* Add the win proc at the head of the list */
 
-    dprintf_win( stddeb, "WINPROC_SetProc(%08x,%08x,%d): res=%08x\n",
+    dprintf_info(win, "WINPROC_SetProc(%08x,%08x,%d): res=%08x\n",
                  (UINT32)*pFirst, (UINT32)func, type, (UINT32)proc );
     proc->next  = *(WINDOWPROC **)pFirst;
     *(WINDOWPROC **)pFirst = proc;
@@ -359,7 +358,7 @@
     {
         WINDOWPROC *next = ((WINDOWPROC *)proc)->next;
         if (((WINDOWPROC *)proc)->user != user) break;
-        dprintf_win( stddeb, "WINPROC_FreeProc: freeing %08x\n", (UINT32)proc);
+        dprintf_info(win, "WINPROC_FreeProc: freeing %08x\n", (UINT32)proc);
         HeapFree( WinProcHeap, 0, proc );
         proc = next;
     }