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/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 */