Release 971221

Fri Dec 19 10:50:46 1997  Douglas Ridgway  <ridgway@winehq.com>

	* [Make.rules.in] [Makefile.in] [documentation/Makefile.in]
 	  [documentation/README.documentation]
	First cut at Wine API documentation. No longer install reference
	manual by default.

Wed Dec 17 21:32:23 1997  Andreas Mohr <100.30936@germany.net>

	* [files/file.c]
	Fixed GetTempFileName16() to use current path of requested drive
	as needed.

	* [if1632/Makefile.in] [if1632/builtin.c] [if1632/dciman32.spec]
	  [if1632/msvfw32.spec] [if1632/tapi32.spec] [if1632/wow32.spec]
	Added misc DLLs needed by various apps.

Wed Dec 17 12:01:50 1997  Morten Eriksen <mortene@sim.no>

	* [if1632/gdi32.spec] [include/windows.h] [objects/palette.c]
	Inserted empty stub for CreateHalftonePalette.

Tue Dec 16 22:08:06 1997  Huw D M Davies <h.davies1@physics.oxford.ac.uk>

	* [windows/mdi.c]
	Use VK_TAB instead of VK_SEPARATOR in TranslateMDISysAccel().

	* [graphics/metafiledrv/init.c]
	DeleteDC() on a MetaDC doesn't do anything - it shouldn't. Therefore
	fix cleanup of MetaDCs in CloseMetaFile(); they now actually get
	removed from the GDI heap!

	* [graphics/x11drv/xfont.c]
	Preserve FO_MATCH_XYINDEP flag in XFONT_MatchFIList(). Should reduce
	the number of bold-italic matches.

Tue Dec 16 20:11:43 1997  Bertho Stultiens <bertho@panter.soci.aau.dk>

	* [graphics/painting.c]
	Included an implementation of DrawState

	* [if1632/thunk.c]
	Changed many fprintfs into dprintf_thunk

	* [include/cache.h] [graphics/cache.c]
	New files to hold cached handles to regulary used GDI object.

	* [include/windows.h]
	Added DRAWSTATExx typedefs
	Added DSS_DEFAULT define for DrawState

	* [objects/text.c]
	New implementation of GrayString()

	* [controls/uitools.c]
	Implemented DrawFrameControl() functions
	Changed DrawEdge() behaviour to win95 implementation

Mon Dec 15 23:43:01 1997  Martin Boehme <boehme@informatik.mu-luebeck.de>

	* [graphics/path.c] [include/path.h] [graphics/painting.c]
	  [if1632/gdi32.spec] [include/gdi.h] [include/windows.h]
	  [objects/dc.c]
        Added preliminary support for GDI paths.

	* [objects/dc.c]
	Added DC_Init_DC_INFO function for initializing WIN_DC_INFO
	structure.

	* [include/windows.h] [include/gdi.h] [objects/gdiobj.c]
	Added DEFAULT_GUI_FONT.

	* [include/winerror.h]
	Added a few error codes.

	* [memory/heap.c]
	Changed HeapAlloc to make the correct calls to SetLastError
	(now conforms to NT's behaviour).

	* [windows/win.c]
	Changed WIN_CreateWindowEx to allow child windows with zero
	width / height.

Sun Dec 14 12:01:07 1997  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [if1632/*] [relay32/*]
	Moved all 32-bit relay stuff to relay32/

	* [fi1632/thunk.c] [win32/kernel32.c]
	Moved all KERNEL32 ordinal functions to kernel32.c

	* [memory/selector.c]
	Initialize selectors in AllocSelectorArray.

	* [tools/build.c]
	Generate C instead of assembly for Win32 relays.
	Fixed stack corruption in CallTo16 functions, found by Bertho
	Stultiens.
	
Sun Dec 14 10:55:00 1997  Andreas Mohr <100.30936@germany.net>

	* [if1632/Makefile.in] [if1632/builtin.c] [if1632/ole2thk.spec]
	Added built-in OLE2THK.DLL. 

	* [if1632/toolhelp.spec] [include/toolhelp.h] [memory/selector.c]
	  [misc/toolhelp.c]
	Added stubs for StackTraceFirst(), StackTraceCSIPFirst(),
	StackTraceNext(), UTSelectorOffsetToLinear()
	and UTLinearToSelectorOffset().

Sat Dec 13 17:26:41 1997  Alex Korobka  <alex@trantor.pharm.sunysb.edu>

	* [misc/winsock.c]
	32-bit API fixes for reported problems (thanks to Marcus
	and David).

	* [graphics/x11drv/xfont.c]
	Little tweak in point size calculation.

	* [windows/defwnd.c] [windows/dce.c] [windows/winhelp.c]
	  [windows/winproc.c] [windows/win.c]
	Bug fixes.

Sat Dec 13 16:35:14 1997  Kai Morich <kai.morich@rhein-neckar.netsurf.de>

	* [files/dos_fs.c]
	OpenFile with empty filename and OF_PARSE returns current dir.

	* [misc/commdlg.c]
	Ignore initial dir if bogus.

	* [files/file.c]
	Locking an identic region in a file must not be an error.

	* [misc/lstr.c]
	Use wide char ctype functions.

Fri Dec 12 23:46:22 1997  Uwe Bonnes  <bon@elektron.ikp.physik.tu-darmstadt.de>

	* [file/drive.c]
	First attempt for GetDiskFreeSpaceEx.

Fri Dec 12 23:18:41 1997  Marcus Meissner  <msmeissn@cip.informatik.uni-erlangen.de>

	* [loader/pe_resource.c]	
	Fixed wrongly appearing menus problem (only use default lookups in
	last resource subtree).

	* [multimedia/*.c]
	Added win32 support for time* and joy* lowlevel drivers,
	(not excessively tested), some misc fixes and cleanups.

	* [misc/shellord.c][misc/shell.c][ole/folders.c][ole/ifs.c]
	  [include/interfaces.h][include/shlobj.h]
	Added some more undocumented SHELL32 functions, some shell folder
 	interface stubs added, SHGetMalloc, SHGetDesktopFolder,
	SHGetSpecialFolderLocation, SHGetPathFromIDList stubs added,
	IMalloc, IUnknown implemented.

	* [windows/msgbox.c]
	Implemented MessageBoxIndirect*, some internal changes.

	* [if1632/thunk.c]
	KERNEL_431 implemented.

	* [objects/gdiobj.c]
	GetCurrentObject implemented.

Wed Dec  3 01:09:17 1997  Gordon Chaffee  <chaffee@apu.cs.berkeley.edu>

	* [objects/dib.c]
	Fix a couple small DIB problems.

	* [controls/edit.c]
	Fix a typo.

	* [files/dos_fs.c]
	Try normal readdir in case fs is specified as vfat but isn't.

	* [files/profile.c]
	Implementation of WritePrivateProfileSection32A from Uwe Bonnes.

	* [misc/printdrv.c]
	OpenPrinter32A stub, helps Word97 start.

	* [objects/text.c]
	Fixup implementation of GetTextCharsetInfo.

	* [scheduler/process.c]
	Fix environment variable expansion.

	* [win32/code_page.c]
	Make MultiByteToWideChar and WideCharToMultiByte conform in return
	values and error conditions to those in Windows NT 4.0.

	* [windows/message.c]
	Fix broadcasting problems in Win32.  The Win32 docs say to use
	HWND_TOPMOST to broadcast to all Win32 Windows.

	* [memory/virtual.c] [loader/pe_image.c]
	Do not map in VirtualAlloc if address is specified and space is
	not available.  This is required by Win32.

	* [include/pen.h] [include/x11drv.h] [objects/dc.c]
	  [objects/pen.c] [graphics/x11drv/pen.c]
	Support for ExtCreatePen.

Tue Dec  2 20:22:06 1997  Morten Welinder  <terra@diku.dk>

	* [*/*.c] [*/*.h]
	Add lots of prototypes.

	* [if1632/kernel32.spec][include/windows.h][include/winnt.h]
	  [misc/cpu.c]
	Define IsProcessorFeaturePresent.

	* [misc/crtdll.c]
 	(CRTDLL__getcwd): Allocate enough memory for the terminating zero.

	* [misc/ver.c]
	Improve check for null component in _find_data[AW].  Plug leaks
	in VerQueryValue*.

	* [win32/console.c][if1632/kernel32.spec]
	Add stubs for GetConsoleCursorInfo32, SetConsoleCursorInfo32.

	* [windows/message.c][if1632/user32.spec][include/windows.h]
	Define SendMessageTimeout*.

	* [graphics/x11drv/xfont.c]
	Change algorithm of __genericCheckSum to be alignment safe.

	* [misc/main.c] [misc/winsock.c] [misc/winsock_dns.c]
	Include winsock.h early to avoid Solaris problem.

	* [include/windows.h]
	Undef FSHIFT before we define it.

	* [rc/winerc.c]
	Include <fcntl.h> instead of <sys/fcntl.h>.

	* [files/file.c]
	Use strerror in FILE_SetDosError if available.

	* [include/config.h.in] [configure.in]
	Check for strerror.

	* [objects/gdiobj.c]
	Make static font structures aligned.

Mon Dec  1 10:10:21 1997  Karl Garrison  <karlos@eznet.net>

	* [win32/console.c] [if1632/kernel32.spec] [include/windows.h]
	Added stub for GetNumberOfConsoleMouseButtons.
	Added stub for PeekConsoleInput(A,W).
	Fixed parameter list for WriteConsole(A,W).
	GetNumberOfConsoleInputEvents now returns 0 events instead of 1
	(since low-level console functions are not yet supported).
	GetConsoleMode no longer returns ENABLE_WINDOW_INPUT and
	ENABLE_MOUSE_INPUT since these are not currently implemented.
diff --git a/include/builtin32.h b/include/builtin32.h
new file mode 100644
index 0000000..56532a3
--- /dev/null
+++ b/include/builtin32.h
@@ -0,0 +1,31 @@
+/*
+ * Win32 built-in DLLs definitions
+ *
+ * Copyright 1997 Alexandre Julliard
+ */
+
+#ifndef __WINE_BUILTIN32_H
+#define __WINE_BUILTIN32_H
+
+typedef void (*ENTRYPOINT32)();
+
+typedef struct
+{
+    const char           *name;         /* DLL name */
+    int                   base;         /* Ordinal base */
+    int                   nb_funcs;     /* Number of functions */
+    int                   nb_names;     /* Number of function names */
+    int                   nb_reg_funcs; /* Number of register functions */
+    const ENTRYPOINT32   *functions;    /* Pointer to function table */
+    const char * const   *names;        /* Pointer to names table */
+    const unsigned short *ordinals;     /* Pointer to ordinals table */
+    const unsigned char  *args;         /* Pointer to argument lengths */
+    const unsigned int   *argtypes;     /* Pointer to argument types bitmask */
+} BUILTIN32_DESCRIPTOR;
+
+extern ENTRYPOINT32 BUILTIN32_GetEntryPoint( char *buffer, void *relay,
+                                             unsigned int *typemask );
+extern void BUILTIN32_Unimplemented( const BUILTIN32_DESCRIPTOR *descr,
+                                     int ordinal );
+
+#endif /* __WINE_BUILTIN32_H */
diff --git a/include/cache.h b/include/cache.h
new file mode 100644
index 0000000..aa10b03
--- /dev/null
+++ b/include/cache.h
@@ -0,0 +1,17 @@
+/*
+ * Wine internally cached objects to speedup some things and prevent 
+ * infinite duplication of trivial code and data. 
+ * 
+ * Copyright 1997 Bertho A. Stultiens
+ *
+ */
+
+#ifndef __WINE_CACHE_H
+#define __WINE_CACHE_H
+
+#include "wintypes.h"
+
+HBRUSH32  CACHE_GetPattern55AABrush(void);
+HBITMAP32 CACHE_GetPattern55AABitmap(void);
+
+#endif /* __WINE_CACHE_H */
diff --git a/include/callback.h b/include/callback.h
index 86b604f..c02abcc 100644
--- a/include/callback.h
+++ b/include/callback.h
@@ -19,7 +19,8 @@
 
 typedef struct
 {
-    VOID (CALLBACK *CallRegisterProc)( CONTEXT *, INT32 );
+    LONG (CALLBACK *CallRegisterShortProc)( CONTEXT *, INT32 );
+    LONG (CALLBACK *CallRegisterLongProc)( CONTEXT *, INT32 );
     VOID (CALLBACK *CallTaskRescheduleProc)(void);
     VOID (CALLBACK *CallFrom16WndProc)(void);
     LRESULT (CALLBACK *CallWndProc)( WNDPROC16, HWND16, UINT16,
@@ -36,6 +37,7 @@
     VOID (CALLBACK *CallBootAppProc)( FARPROC16, HANDLE16, HFILE16 );
     WORD (CALLBACK *CallLoadAppSegProc)( FARPROC16, HANDLE16, HFILE16, WORD );
     VOID (CALLBACK *CallSystemTimerProc)( FARPROC16 );
+    DWORD (CALLBACK *CallWOWCallbackProc)( FARPROC16, DWORD );
     LRESULT (CALLBACK *CallASPIPostProc)( FARPROC16, SEGPTR );
     /* Following are the graphics driver callbacks */
     WORD (CALLBACK *CallDrvControlProc)( FARPROC16, SEGPTR, WORD,
diff --git a/include/color.h b/include/color.h
index 735e629..d226a19 100644
--- a/include/color.h
+++ b/include/color.h
@@ -14,6 +14,7 @@
 #define PC_SYS_RESERVED 0x40		/* system palentry is not to be mapped to */
 #define PC_SYS_MAPPED   0x10		/* logical palentry is a direct alias for system palentry */
 
+extern BOOL32     COLOR_Init(void);
 extern void	  COLOR_Cleanup(void);
 extern COLORREF	  COLOR_ToLogical(int pixel);
 extern int 	  COLOR_ToPhysical( DC *dc, COLORREF color );
@@ -22,11 +23,13 @@
 extern Colormap	  COLOR_GetColormap();
 extern UINT16	  COLOR_GetSystemPaletteSize();
 extern UINT16	  COLOR_GetSystemPaletteFlags();
+extern const PALETTEENTRY* COLOR_GetSystemPaletteTemplate(void);
 extern BOOL32	  COLOR_GetMonoPlane( int* );
 
 extern COLORREF	  COLOR_LookupNearestColor( PALETTEENTRY*, int, COLORREF );
 extern int        COLOR_PaletteLookupPixel( PALETTEENTRY*, int, int* , COLORREF, BOOL32 );
 extern COLORREF   COLOR_GetSystemPaletteEntry(UINT32);
+extern int COLOR_LookupSystemPixel(COLORREF col);
 
 extern int 	COLOR_mapEGAPixel[16];
 extern int* 	COLOR_PaletteToPixel;
diff --git a/include/compobj.h b/include/compobj.h
index 9aca771..6f2289f 100644
--- a/include/compobj.h
+++ b/include/compobj.h
@@ -11,7 +11,7 @@
     BYTE  Data4[8];
 };
 
-typedef struct tagGUID	GUID;
+typedef struct tagGUID	GUID,*LPGUID;
 typedef struct tagGUID	CLSID,*LPCLSID,*REFCLSID;
 typedef struct tagGUID	IID,*REFIID,*LPIID;
 
diff --git a/include/config.h.in b/include/config.h.in
index 12cd82d..2d301c7 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -21,6 +21,9 @@
 /* Define if you have the memmove function.  */
 #undef HAVE_MEMMOVE
 
+/* Define if you have the strerror function.  */
+#undef HAVE_STRERROR
+
 /* Define if you have the tcgetattr function.  */
 #undef HAVE_TCGETATTR
 
diff --git a/include/cursoricon.h b/include/cursoricon.h
index 14c34b8..691487e 100644
--- a/include/cursoricon.h
+++ b/include/cursoricon.h
@@ -50,6 +50,9 @@
 
 #pragma pack(4)
 
+extern HCURSOR16 CURSORICON_IconToCursor( HICON16 hIcon,
+                                          BOOL32 bSemiTransparent );
+
 extern Cursor CURSORICON_XCursor;  /* Current X cursor */
 
 #endif /* __WINE_CURSORICON_H */
diff --git a/include/dce.h b/include/dce.h
index 11d235f..089ad22 100644
--- a/include/dce.h
+++ b/include/dce.h
@@ -22,6 +22,7 @@
 
 #define DCX_DCEEMPTY		0x00000800
 #define DCX_DCEBUSY		0x00001000
+#define DCX_DCEDIRTY		0x00002000
 #define DCX_WINDOWPAINT		0x00020000
 #define DCX_KEEPCLIPRGN		0x00040000
 #define DCX_NOCLIPCHILDREN      0x00080000
diff --git a/include/debug.h b/include/debug.h
index 365c0ea..a34519d 100644
--- a/include/debug.h
+++ b/include/debug.h
@@ -78,6 +78,7 @@
 #undef DEBUG_STRING
 #undef DEBUG_TASK
 #undef DEBUG_TEXT
+#undef DEBUG_THUNK
 #undef DEBUG_TIMER
 #undef DEBUG_TOOLHELP
 #undef DEBUG_TWEAK
@@ -164,6 +165,7 @@
 #define DEBUG_STRING
 #define DEBUG_TASK
 #define DEBUG_TEXT
+#define DEBUG_THUNK
 #define DEBUG_TIMER
 #define DEBUG_TOOLHELP
 #define DEBUG_TWEAK
@@ -540,6 +542,11 @@
 #else
     0,
 #endif
+#ifdef DEBUG_THUNK
+    1,
+#else
+    0,
+#endif
 #ifdef DEBUG_TIMER
     1,
 #else
@@ -1539,8 +1546,21 @@
 #endif
 
 #ifdef DEBUG_RUNTIME
-#define dprintf_timer if(!debug_msg_enabled[72]) ; else fprintf
-#define debugging_timer debug_msg_enabled[72]
+#define dprintf_thunk if(!debug_msg_enabled[72]) ; else fprintf
+#define debugging_thunk debug_msg_enabled[72]
+#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[73]) ; else fprintf
+#define debugging_timer debug_msg_enabled[73]
 #else
 #ifdef DEBUG_TIMER
 #define dprintf_timer fprintf
@@ -1552,8 +1572,8 @@
 #endif
 
 #ifdef DEBUG_RUNTIME
-#define dprintf_toolhelp if(!debug_msg_enabled[73]) ; else fprintf
-#define debugging_toolhelp debug_msg_enabled[73]
+#define dprintf_toolhelp if(!debug_msg_enabled[74]) ; else fprintf
+#define debugging_toolhelp debug_msg_enabled[74]
 #else
 #ifdef DEBUG_TOOLHELP
 #define dprintf_toolhelp fprintf
@@ -1565,8 +1585,8 @@
 #endif
 
 #ifdef DEBUG_RUNTIME
-#define dprintf_tweak if(!debug_msg_enabled[74]) ; else fprintf
-#define debugging_tweak debug_msg_enabled[74]
+#define dprintf_tweak if(!debug_msg_enabled[75]) ; else fprintf
+#define debugging_tweak debug_msg_enabled[75]
 #else
 #ifdef DEBUG_TWEAK
 #define dprintf_tweak fprintf
@@ -1578,8 +1598,8 @@
 #endif
 
 #ifdef DEBUG_RUNTIME
-#define dprintf_updown if(!debug_msg_enabled[75]) ; else fprintf
-#define debugging_updown debug_msg_enabled[75]
+#define dprintf_updown if(!debug_msg_enabled[76]) ; else fprintf
+#define debugging_updown debug_msg_enabled[76]
 #else
 #ifdef DEBUG_UPDOWN
 #define dprintf_updown fprintf
@@ -1591,8 +1611,8 @@
 #endif
 
 #ifdef DEBUG_RUNTIME
-#define dprintf_ver if(!debug_msg_enabled[76]) ; else fprintf
-#define debugging_ver debug_msg_enabled[76]
+#define dprintf_ver if(!debug_msg_enabled[77]) ; else fprintf
+#define debugging_ver debug_msg_enabled[77]
 #else
 #ifdef DEBUG_VER
 #define dprintf_ver fprintf
@@ -1604,8 +1624,8 @@
 #endif
 
 #ifdef DEBUG_RUNTIME
-#define dprintf_virtual if(!debug_msg_enabled[77]) ; else fprintf
-#define debugging_virtual debug_msg_enabled[77]
+#define dprintf_virtual if(!debug_msg_enabled[78]) ; else fprintf
+#define debugging_virtual debug_msg_enabled[78]
 #else
 #ifdef DEBUG_VIRTUAL
 #define dprintf_virtual fprintf
@@ -1617,8 +1637,8 @@
 #endif
 
 #ifdef DEBUG_RUNTIME
-#define dprintf_vxd if(!debug_msg_enabled[78]) ; else fprintf
-#define debugging_vxd debug_msg_enabled[78]
+#define dprintf_vxd if(!debug_msg_enabled[79]) ; else fprintf
+#define debugging_vxd debug_msg_enabled[79]
 #else
 #ifdef DEBUG_VXD
 #define dprintf_vxd fprintf
@@ -1630,8 +1650,8 @@
 #endif
 
 #ifdef DEBUG_RUNTIME
-#define dprintf_win if(!debug_msg_enabled[79]) ; else fprintf
-#define debugging_win debug_msg_enabled[79]
+#define dprintf_win if(!debug_msg_enabled[80]) ; else fprintf
+#define debugging_win debug_msg_enabled[80]
 #else
 #ifdef DEBUG_WIN
 #define dprintf_win fprintf
@@ -1643,8 +1663,8 @@
 #endif
 
 #ifdef DEBUG_RUNTIME
-#define dprintf_win16drv if(!debug_msg_enabled[80]) ; else fprintf
-#define debugging_win16drv debug_msg_enabled[80]
+#define dprintf_win16drv if(!debug_msg_enabled[81]) ; else fprintf
+#define debugging_win16drv debug_msg_enabled[81]
 #else
 #ifdef DEBUG_WIN16DRV
 #define dprintf_win16drv fprintf
@@ -1656,8 +1676,8 @@
 #endif
 
 #ifdef DEBUG_RUNTIME
-#define dprintf_win32 if(!debug_msg_enabled[81]) ; else fprintf
-#define debugging_win32 debug_msg_enabled[81]
+#define dprintf_win32 if(!debug_msg_enabled[82]) ; else fprintf
+#define debugging_win32 debug_msg_enabled[82]
 #else
 #ifdef DEBUG_WIN32
 #define dprintf_win32 fprintf
@@ -1669,8 +1689,8 @@
 #endif
 
 #ifdef DEBUG_RUNTIME
-#define dprintf_winsock if(!debug_msg_enabled[82]) ; else fprintf
-#define debugging_winsock debug_msg_enabled[82]
+#define dprintf_winsock if(!debug_msg_enabled[83]) ; else fprintf
+#define debugging_winsock debug_msg_enabled[83]
 #else
 #ifdef DEBUG_WINSOCK
 #define dprintf_winsock fprintf
@@ -1757,6 +1777,7 @@
     "string",
     "task",
     "text",
+    "thunk",
     "timer",
     "toolhelp",
     "tweak",
diff --git a/include/gdi.h b/include/gdi.h
index d744a41..ed90b94 100644
--- a/include/gdi.h
+++ b/include/gdi.h
@@ -11,6 +11,7 @@
 #include "ldt.h"
 #include "local.h"
 #include "x11drv.h"
+#include "path.h"
 
   /* GDI objects magic numbers */
 #define PEN_MAGIC             0x4f47
@@ -100,6 +101,8 @@
     HBITMAP16     hFirstBitmap; /* Bitmap selected at creation of the DC */
     HANDLE16      hDevice;
     HPALETTE16    hPalette;
+    
+    GdiPath       path;
 
     WORD          ROPmode;
     WORD          polyFillMode;
@@ -246,7 +249,7 @@
 
   /* Stock objects handles */
 
-#define NB_STOCK_OBJECTS          (SYSTEM_FIXED_FONT + 1)
+#define NB_STOCK_OBJECTS          (DEFAULT_GUI_FONT + 1)
 
 #define STOCK_WHITE_BRUSH       ((HBRUSH16)(FIRST_STOCK_HANDLE+WHITE_BRUSH))
 #define STOCK_LTGRAY_BRUSH      ((HBRUSH16)(FIRST_STOCK_HANDLE+LTGRAY_BRUSH))
@@ -265,11 +268,12 @@
 #define STOCK_DEVICE_DEFAULT_FONT ((HFONT16)(FIRST_STOCK_HANDLE+DEVICE_DEFAULT_FONT))
 #define STOCK_DEFAULT_PALETTE   ((HPALETTE16)(FIRST_STOCK_HANDLE+DEFAULT_PALETTE))
 #define STOCK_SYSTEM_FIXED_FONT ((HFONT16)(FIRST_STOCK_HANDLE+SYSTEM_FIXED_FONT))
+#define STOCK_DEFAULT_GUI_FONT  ((HFONT16)(FIRST_STOCK_HANDLE+DEFAULT_GUI_FONT))
 
 #define FIRST_STOCK_FONT        STOCK_OEM_FIXED_FONT
-#define LAST_STOCK_FONT         STOCK_SYSTEM_FIXED_FONT
+#define LAST_STOCK_FONT         STOCK_DEFAULT_GUI_FONT
 
-#define LAST_STOCK_HANDLE       ((DWORD)STOCK_SYSTEM_FIXED_FONT)
+#define LAST_STOCK_HANDLE       ((DWORD)STOCK_DEFAULT_GUI_FONT)
 
   /* Device <-> logical coords conversion */
 
diff --git a/include/interfaces.h b/include/interfaces.h
index 5e912da..ef70a22 100644
--- a/include/interfaces.h
+++ b/include/interfaces.h
@@ -5,6 +5,13 @@
 #include "ole2.h"
 #include "compobj.h"
 
+#define STDMETHOD(xfn) HRESULT (CALLBACK *fn##xfn)
+#define STDMETHOD_(ret,xfn) ret (CALLBACK *fn##xfn)
+#define PURE
+#define FAR
+#define	THIS_ THIS,
+
+
 DEFINE_OLEGUID(IID_IUnknown,0,0,0);
 DEFINE_OLEGUID(IID_IClassFactory,1,0,0);
 DEFINE_OLEGUID(IID_IMalloc,2,0,0);
@@ -18,28 +25,65 @@
 DEFINE_OLEGUID(IID_IMessageFilter,0x16,0,0);
 DEFINE_OLEGUID(IID_IStdMarshalInfo,0x18,0,0);
 
-typedef struct tagUNKNOWN *LPUNKNOWN,IUnknown;
+#define THIS LPUNKNOWN this
+typedef struct IUnknown *LPUNKNOWN,IUnknown;
 typedef struct {
-	HRESULT	(CALLBACK *fnQueryInterface)(LPUNKNOWN this,REFIID refiid,LPVOID *obj);
-	HRESULT	(CALLBACK *fnAddRef)(LPUNKNOWN this);
-	HRESULT	(CALLBACK *fnRelease)(LPUNKNOWN this);
-} *LPUNKNOWN_VTABLE;
+	STDMETHOD(QueryInterface) (THIS_ REFIID riid,LPVOID FAR* ppvObj) PURE;
+	STDMETHOD_(ULONG,AddRef) (THIS) PURE;
+	STDMETHOD_(ULONG,Release) (THIS) PURE;
+} *LPUNKNOWN_VTABLE,IUnknown_VTable;
 
-struct tagUNKNOWN {
+struct IUnknown {
 	LPUNKNOWN_VTABLE	lpvtbl;
-	/* internal stuff. Not needed until we actually implement IUnknown */
+	DWORD			ref;
 };
+#undef THIS
 
-typedef struct tagCLASSFACTORY *LPCLASSFACTORY,IClassFactory;
+#define THIS LPCLASSFACTORY this
+typedef struct IClassFactory *LPCLASSFACTORY,IClassFactory;
 typedef struct {
-	HRESULT	(CALLBACK *fnQueryInterface)(LPCLASSFACTORY this,REFIID refiid,LPVOID *obj);
-	HRESULT	(CALLBACK *fnAddRef)(LPCLASSFACTORY this);
-	HRESULT	(CALLBACK *fnRelease)(LPCLASSFACTORY this);
-	HRESULT (CALLBACK *fnCreateInstance)(LPCLASSFACTORY this,LPUNKNOWN pUnkOuter,REFIID riid,LPVOID * ppvObject);
-} *LPCLASSFACTORY_VTABLE;
+	STDMETHOD(QueryInterface) (THIS_ REFIID riid,LPVOID FAR* ppvObj) PURE;
+	STDMETHOD_(ULONG,AddRef) (THIS) PURE;
+	STDMETHOD_(ULONG,Release) (THIS) PURE;
+	STDMETHOD(CreateInstance) (THIS_ LPUNKNOWN pUnkOuter, REFIID riid, LPVOID FAR* ppvObject) PURE;
+} *LPCLASSFACTORY_VTABLE,IClassFactory_VTable;
 
-struct tagCLASSFACTORY {
-	LPCLASSFACTORY_VTABLE lpvtbl;
-	/*internal stuff. Not needed until we actually implement IClassFactory*/
+struct IClassFactory {
+	LPCLASSFACTORY_VTABLE	lpvtbl;
+	DWORD			ref;
 };
+#undef THIS
+
+#define THIS LPMALLOC this
+typedef struct IMalloc *LPMALLOC,IMalloc;
+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_(LPINT32,DidAlloc) ( THIS_ LPVOID pv);
+	STDMETHOD_(LPVOID,HeapMinimize) ( THIS );
+} *LPMALLOC_VTABLE,IMalloc_VTable;
+
+struct IMalloc {
+	LPMALLOC_VTABLE lpvtbl;
+	DWORD		ref;
+};
+#undef THIS
+
+/* private prototypes for the constructors */
+#ifdef __WINE__
+LPUNKNOWN	IUnknown_Constructor();
+LPMALLOC	IMalloc_Constructor();
+#endif
+
+#undef STDMETHOD
+#undef STDMETHOD_
+#undef PURE
+#undef FAR
+#undef THIS_
 #endif /*_WINE_INTERFACES_H*/
diff --git a/include/mmsystem.h b/include/mmsystem.h
index fa5a50b..6845f35 100644
--- a/include/mmsystem.h
+++ b/include/mmsystem.h
@@ -18,6 +18,7 @@
 
 #define MAXPNAMELEN      32     /* max product name length (including NULL) */
 #define MAXERRORLENGTH   128    /* max error text length (including NULL) */
+#define MAX_JOYSTICKOEMVXDNAME	260
 
 typedef WORD    VERSION;        /* major (high byte), minor (low byte) */
 
@@ -27,6 +28,9 @@
 typedef UINT16	MCIDEVICEID16;
 typedef UINT32	MCIDEVICEID32;
 DECL_WINELIB_TYPE(MCIDEVICEID);
+typedef	UINT16	MMRESULT16;
+typedef	UINT32	MMRESULT32;
+DECL_WINELIB_TYPE(MMRESULT);
 
 typedef struct {
     UINT16    wType;		/* indicates the contents of the union */
@@ -733,24 +737,45 @@
 #define TIMERR_NOCANDO        (TIMERR_BASE+1)      /* request not completed */
 #define TIMERR_STRUCT         (TIMERR_BASE+33)     /* time struct size */
 
-typedef void (CALLBACK *LPTIMECALLBACK) (UINT16 uTimerID, UINT16 uMessage, DWORD dwUser, DWORD dw1, DWORD dw2);
+typedef void (CALLBACK *LPTIMECALLBACK16)(UINT16 uTimerID, UINT16 uMessage, DWORD dwUser, DWORD dw1, DWORD dw2);
+typedef void (CALLBACK *LPTIMECALLBACK32)(UINT32 uTimerID, UINT32 uMessage, DWORD dwUser, DWORD dw1, DWORD dw2);
+DECL_WINELIB_TYPE(LPTIMECALLBACK);
 
 #define TIME_ONESHOT    0   /* program timer for single event */
 #define TIME_PERIODIC   1   /* program for continuous periodic event */
 
 typedef struct {
-    UINT16    wPeriodMin;     /* minimum period supported  */
-    UINT16    wPeriodMax;     /* maximum period supported  */
-} TIMECAPS, *LPTIMECAPS;
+    UINT16	wPeriodMin;	/* minimum period supported  */
+    UINT16	wPeriodMax;	/* maximum period supported  */
+} TIMECAPS16,*LPTIMECAPS16;
 
-UINT16 WINAPI timeGetSystemTime(LPMMTIME16 lpTime, UINT16 uSize);
-DWORD WINAPI timeGetTime(void);
-UINT16 WINAPI timeSetEvent(UINT16 uDelay, UINT16 uResolution,
-    LPTIMECALLBACK lpFunction, DWORD dwUser, UINT16 uFlags);
-UINT16 WINAPI timeKillEvent(UINT16 uTimerID);
-UINT16 WINAPI timeGetDevCaps(TIMECAPS * lpTimeCaps, UINT16 uSize);
-UINT16 WINAPI timeBeginPeriod(UINT16 uPeriod);
-UINT16 WINAPI timeEndPeriod(UINT16 uPeriod);
+typedef struct {
+    UINT32	wPeriodMin;
+    UINT32	wPeriodMax;
+} TIMECAPS32, *LPTIMECAPS32;
+
+DECL_WINELIB_TYPE(TIMECAPS);
+DECL_WINELIB_TYPE(LPTIMECAPS);
+
+MMRESULT16 WINAPI timeGetSystemTime16(LPMMTIME16,UINT16);
+MMRESULT32 WINAPI timeGetSystemTime32(LPMMTIME32,UINT32);
+#define timeGetSystemTime WINELIB_NAME(timeGetSystemTime)
+DWORD WINAPI timeGetTime();	/* same for win32/win16 */
+MMRESULT16 WINAPI timeSetEvent16(UINT16,UINT16,LPTIMECALLBACK16,DWORD,UINT16);
+MMRESULT32 WINAPI timeSetEvent32(UINT32,UINT32,LPTIMECALLBACK32,DWORD,UINT32);
+#define timeSetEvent WINELIB_NAME(timeSetEvent)
+MMRESULT16 WINAPI timeKillEvent16(UINT16);
+MMRESULT32 WINAPI timeKillEvent32(UINT32);
+#define timeKillEvent WINELIB_NAME(timeKillEvent)
+MMRESULT16 WINAPI timeGetDevCaps16(LPTIMECAPS16,UINT16);
+MMRESULT32 WINAPI timeGetDevCaps32(LPTIMECAPS32,UINT32);
+#define timeGetDevCaps WINELIB_NAME(timeGetDevCaps)
+MMRESULT16 WINAPI timeBeginPeriod16(UINT16);
+MMRESULT32 WINAPI timeBeginPeriod32(UINT32);
+#define timeBeginPeriod WINELIB_NAME(timeBeginPeriod)
+MMRESULT16 WINAPI timeEndPeriod16(UINT16);
+MMRESULT32 WINAPI timeEndPeriod32(UINT32);
+#define timeEndPeriod WINELIB_NAME(timeEndPeriod)
 
 #define JOYERR_NOERROR        (0)                  /* no error */
 #define JOYERR_PARMS          (JOYERR_BASE+5)      /* bad parameters */
@@ -770,8 +795,8 @@
 #define JOYSTICKID2         1
 
 typedef struct {
-    UINT16 wMid;                  /* manufacturer ID */
-    UINT16 wPid;                  /* product ID */
+    WORD wMid;                  /* manufacturer ID */
+    WORD wPid;                  /* product ID */
     char szPname[MAXPNAMELEN];  /* product name (NULL terminated string) */
     UINT16 wXmin;                 /* minimum x position value */
     UINT16 wXmax;                 /* maximum x position value */
@@ -782,23 +807,116 @@
     UINT16 wNumButtons;           /* number of buttons */
     UINT16 wPeriodMin;            /* minimum message period when captured */
     UINT16 wPeriodMax;            /* maximum message period when captured */
-} JOYCAPS, *LPJOYCAPS;
+    /* win95,nt4 additions: */
+    UINT16 wRmin;		/* minimum r position value */
+    UINT16 wRmax;		/* maximum r position value */
+    UINT16 wUmin;		/* minimum u (5th axis) position value */
+    UINT16 wUmax;		/* maximum u (5th axis) position value */
+    UINT16 wVmin;		/* minimum v (6th axis) position value */
+    UINT16 wVmax;		/* maximum v (6th axis) position value */
+    UINT16 wCaps;		/* joystick capabilites */
+    UINT16 wMaxAxes;		/* maximum number of axes supported */
+    UINT16 wNumAxes;		/* number of axes in use */
+    UINT16 wMaxButtons;		/* maximum number of buttons supported */
+    CHAR szRegKey[MAXPNAMELEN]; /* registry key */
+    CHAR szOEMVxD[MAX_JOYSTICKOEMVXDNAME]; /* OEM VxD in use */
+} JOYCAPS16, *LPJOYCAPS16;
+
+typedef struct {
+    WORD wMid;
+    WORD wPid;
+    CHAR szPname[MAXPNAMELEN];
+    UINT32 wXmin;
+    UINT32 wXmax;
+    UINT32 wYmin;
+    UINT32 wYmax;
+    UINT32 wZmin;
+    UINT32 wZmax;
+    UINT32 wNumButtons;
+    UINT32 wPeriodMin;
+    UINT32 wPeriodMax;
+    UINT32 wRmin;
+    UINT32 wRmax;
+    UINT32 wUmin;
+    UINT32 wUmax;
+    UINT32 wVmin;
+    UINT32 wVmax;
+    UINT32 wCaps;
+    UINT32 wMaxAxes;
+    UINT32 wNumAxes;
+    UINT32 wMaxButtons;
+    CHAR szRegKey[MAXPNAMELEN];
+    CHAR szOEMVxD[MAX_JOYSTICKOEMVXDNAME];
+} JOYCAPS32A, *LPJOYCAPS32A;
+
+typedef struct {
+    WORD wMid;
+    WORD wPid;
+    WCHAR szPname[MAXPNAMELEN];
+    UINT32 wXmin;
+    UINT32 wXmax;
+    UINT32 wYmin;
+    UINT32 wYmax;
+    UINT32 wZmin;
+    UINT32 wZmax;
+    UINT32 wNumButtons;
+    UINT32 wPeriodMin;
+    UINT32 wPeriodMax;
+    UINT32 wRmin;
+    UINT32 wRmax;
+    UINT32 wUmin;
+    UINT32 wUmax;
+    UINT32 wVmin;
+    UINT32 wVmax;
+    UINT32 wCaps;
+    UINT32 wMaxAxes;
+    UINT32 wNumAxes;
+    UINT32 wMaxButtons;
+    WCHAR szRegKey[MAXPNAMELEN];
+    WCHAR szOEMVxD[MAX_JOYSTICKOEMVXDNAME];
+} JOYCAPS32W, *LPJOYCAPS32W;
+DECL_WINELIB_TYPE_AW(JOYCAPS)
+DECL_WINELIB_TYPE_AW(LPJOYCAPS)
 
 typedef struct {
     UINT16 wXpos;                 /* x position */
     UINT16 wYpos;                 /* y position */
     UINT16 wZpos;                 /* z position */
     UINT16 wButtons;              /* button states */
-} JOYINFO, *LPJOYINFO;
+} JOYINFO16, *LPJOYINFO16;
 
-UINT16 WINAPI joyGetDevCaps(UINT16 uJoyID, JOYCAPS * lpCaps, UINT16 uSize);
-UINT16 WINAPI joyGetNumDevs(void);
-UINT16 WINAPI joyGetPos(UINT16 uJoyID, JOYINFO * lpInfo);
-UINT16 WINAPI joyGetThreshold(UINT16 uJoyID, UINT16 * lpuThreshold);
-UINT16 WINAPI joyReleaseCapture(UINT16 uJoyID);
-UINT16 WINAPI joySetCapture(HWND16 hwnd, UINT16 uJoyID, UINT16 uPeriod,
-    BOOL16 bChanged);
-UINT16 WINAPI joySetThreshold(UINT16 uJoyID, UINT16 uThreshold);
+typedef struct {
+    UINT32 wXpos;
+    UINT32 wYpos;
+    UINT32 wZpos;
+    UINT32 wButtons;
+} JOYINFO32, *LPJOYINFO32;
+
+DECL_WINELIB_TYPE(JOYINFO)
+DECL_WINELIB_TYPE(LPJOYINFO)
+
+MMRESULT16 WINAPI joyGetDevCaps16 (UINT16,LPJOYCAPS16 ,UINT16);
+MMRESULT32 WINAPI joyGetDevCaps32A(UINT32,LPJOYCAPS32A,UINT32);
+MMRESULT32 WINAPI joyGetDevCaps32W(UINT32,LPJOYCAPS32W,UINT32);
+#define joyGetDevCaps WINELIB_NAME_AW(joyGetDevCaps)
+UINT16 WINAPI joyGetNumDevs16(void);
+UINT32 WINAPI joyGetNumDevs32(void);
+#define joyGetNumDevs WINELIB_NAME(joyGetNumDevs)
+MMRESULT16 WINAPI joyGetPos16(UINT16,LPJOYINFO16);
+MMRESULT32 WINAPI joyGetPos32(UINT32,LPJOYINFO32);
+#define joyGetPos WINELIB_NAME(joyGetPos)
+MMRESULT16 WINAPI joyGetThreshold16(UINT16,UINT16*);
+MMRESULT32 WINAPI joyGetThreshold32(UINT32,UINT32*);
+#define joyGetThreshold WINELIB_NAME(joyGetThreshold)
+MMRESULT16 WINAPI joyReleaseCapture16(UINT16);
+MMRESULT32 WINAPI joyReleaseCapture32(UINT32);
+#define joyReleaseCapture WINELIB_NAME(joyReleaseCapture)
+MMRESULT16 WINAPI joySetCapture16(HWND16,UINT16,UINT16,BOOL16);
+MMRESULT32 WINAPI joySetCapture32(HWND32,UINT32,UINT32,BOOL32);
+#define joySetCapture WINELIB_NAME(joySetCapture)
+MMRESULT16 WINAPI joySetThreshold16(UINT16,UINT16);
+MMRESULT32 WINAPI joySetThreshold32(UINT32,UINT32);
+#define joySetThreshold WINELIB_NAME(joySetThreshold)
 
 typedef struct {
 	WORD		wMid;		/* manufacturer id */
@@ -2560,11 +2678,11 @@
 } MIDIOPENDESC, *LPMIDIOPENDESC;
 
 typedef struct {
-	UINT16		wDelay;
-	UINT16		wResolution;
-	LPTIMECALLBACK	lpFunction;
-	DWORD		dwUser;
-	UINT16		wFlags;
+	UINT16			wDelay;
+	UINT16			wResolution;
+	LPTIMECALLBACK16	lpFunction;
+	DWORD			dwUser;
+	UINT16			wFlags;
 } TIMEREVENT, *LPTIMEREVENT;
 
 typedef struct tMIXEROPENDESC
@@ -2603,6 +2721,16 @@
                              WORD wMsg, DWORD dwUser, DWORD dwParam1, DWORD dwParam2);
 DWORD WINAPI auxMessage(WORD wDevID, WORD wMsg, DWORD dwUser, 
 					DWORD dwParam1, DWORD dwParam2);
+
+struct LINUX_MCIDRIVER {
+	HDRVR16			hdrv;
+	DRIVERPROC16		driverproc;
+	MCI_OPEN_DRIVER_PARMS	modp;
+	MCI_OPEN_PARMS16	mop;
+	DWORD			private;
+};
+
+#pragma pack(4)
 DWORD WINAPI mixMessage(WORD wDevID, WORD wMsg, DWORD dwUser, 
 					DWORD dwParam1, DWORD dwParam2);
 DWORD WINAPI midMessage(WORD wDevID, WORD wMsg, DWORD dwUser, 
diff --git a/include/ntdll.h b/include/ntdll.h
index 2f1bf8b..28f3583 100644
--- a/include/ntdll.h
+++ b/include/ntdll.h
@@ -156,6 +156,27 @@
 	LPWSTR	Buffer;
 } UNICODE_STRING,*LPUNICODE_STRING;
 
+
+BOOL32 WINAPI IsValidSid(LPSID);
+BOOL32 WINAPI EqualSid(LPSID,LPSID);
+BOOL32 WINAPI EqualPrefixSid(LPSID,LPSID);
+DWORD  WINAPI GetSidLengthRequired(BYTE);
+BOOL32 WINAPI AllocateAndInitializeSid(LPSID_IDENTIFIER_AUTHORITY,BYTE,DWORD,
+                                       DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,
+                                       DWORD,LPSID*);
+VOID*  WINAPI FreeSid(LPSID);
+BOOL32 WINAPI InitializeSecurityDescriptor(SECURITY_DESCRIPTOR*,DWORD);
+BOOL32 WINAPI InitializeSid(LPSID,LPSID_IDENTIFIER_AUTHORITY,BYTE);
+DWORD* WINAPI GetSidSubAuthority(LPSID,DWORD);
+BYTE * WINAPI GetSidSubAuthorityCount(LPSID);
+DWORD  WINAPI GetLengthSid(LPSID);
+BOOL32 WINAPI CopySid(DWORD,LPSID,LPSID);
+BOOL32 WINAPI LookupAccountSid32A(LPCSTR,PSID,LPCSTR,LPDWORD,LPCSTR,LPDWORD,
+                                  PSID_NAME_USE);
+BOOL32 WINAPI LookupAccountSid32W(LPCWSTR,PSID,LPCWSTR,LPDWORD,LPCWSTR,LPDWORD,
+                                  PSID_NAME_USE);
+LPSID_IDENTIFIER_AUTHORITY WINAPI GetSidIdentifierAuthority(LPSID);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/include/path.h b/include/path.h
new file mode 100644
index 0000000..fbf00e1
--- /dev/null
+++ b/include/path.h
@@ -0,0 +1,45 @@
+/*
+ * Graphics paths (BeginPath, EndPath etc.)
+ *
+ * Copyright 1997 Martin Boehme
+ */
+
+#ifndef __WINE_PATH_H
+#define __WINE_PATH_H
+
+/* It should not be necessary to access the contents of the GdiPath
+ * structure directly; if you find that the exported functions don't
+ * allow you to do what you want, then please place a new exported
+ * function that does this job in path.c.
+ */
+
+typedef enum tagGdiPathState
+{
+   PATH_Null,
+   PATH_Open,
+   PATH_Closed
+} GdiPathState;
+
+typedef struct tagGdiPath
+{
+   GdiPathState state;
+   POINT32      *pPoints;
+   BYTE         *pFlags;
+   int          numEntriesUsed, numEntriesAllocated;
+   BOOL32       newStroke;
+} GdiPath;
+
+#define PATH_IsPathOpen(path) ((path).state==PATH_Open)
+/* Returns TRUE if the specified path is in the open state, i.e. in the
+ * state where points will be added to the path, or FALSE otherwise. This
+ * function is implemented as a macro for performance reasons.
+ */
+
+extern void   PATH_InitGdiPath(GdiPath *pPath);
+extern void   PATH_DestroyGdiPath(GdiPath *pPath);
+extern BOOL32 PATH_AssignGdiPath(GdiPath *pPathDest,
+   const GdiPath *pPathSrc);
+extern BOOL32 PATH_MoveTo(HDC32 hdc);
+extern BOOL32 PATH_LineTo(HDC32 hdc, INT32 x, INT32 y);
+
+#endif /* __WINE_PATH_H */
diff --git a/include/pe_image.h b/include/pe_image.h
index b432c83..b6876e9 100644
--- a/include/pe_image.h
+++ b/include/pe_image.h
@@ -41,6 +41,6 @@
 struct _PDB32; /* forward definition */
 extern void PE_InitializeDLLs(struct _PDB32*,DWORD,LPVOID);
 
-extern LPIMAGE_RESOURCE_DIRECTORY GetResDirEntryW(LPIMAGE_RESOURCE_DIRECTORY,LPCWSTR,DWORD);
+extern LPIMAGE_RESOURCE_DIRECTORY GetResDirEntryW(LPIMAGE_RESOURCE_DIRECTORY,LPCWSTR,DWORD,BOOL32);
 
 #endif /* __WINE_PE_IMAGE_H */
diff --git a/include/shell.h b/include/shell.h
index 2ddf3a3..ee0ba36 100644
--- a/include/shell.h
+++ b/include/shell.h
@@ -32,6 +32,16 @@
 	/* memory block with filenames follows */     
 } DROPFILESTRUCT, *LPDROPFILESTRUCT; 
 
+typedef struct _NOTIFYICONDATA {
+	DWORD cbSize;
+	HWND32 hWnd;
+	UINT32 uID;
+	UINT32 uFlags;
+	UINT32 uCallbackMessage;
+	HICON32 hIcon;
+	CHAR szTip[64];
+} NOTIFYICONDATA, *PNOTIFYICONDATA;
+
 typedef struct tagSHFILEINFO32A {
 	HICON32	hIcon;			/* icon */
 	int	iIcon;			/* icon index */
@@ -59,8 +69,6 @@
 	LPARAM	lParam;
 } APPBARDATA, *PAPPBARDATA;
 
-DECL_WINELIB_TYPE(APPBARDATA);
-
 #define SHGFI_ICON              0x000000100     /* get icon */
 #define SHGFI_DISPLAYNAME       0x000000200     /* get display name */
 #define SHGFI_TYPENAME          0x000000400     /* get type name */
@@ -87,4 +95,22 @@
 #define SE_ERR_DDEBUSY          30
 #define SE_ERR_NOASSOC          31
 
+#define	CSIDL_DESKTOP		0x0000
+#define	CSIDL_PROGRAMS		0x0002
+#define	CSIDL_CONTROLS		0x0003
+#define	CSIDL_PRINTERS		0x0004
+#define	CSIDL_PERSONAL		0x0005
+#define	CSIDL_FAVORITES		0x0006
+#define	CSIDL_STARTUP		0x0007
+#define	CSIDL_RECENT		0x0008
+#define	CSIDL_SENDTO		0x0009
+#define	CSIDL_BITBUCKET		0x000a
+#define	CSIDL_STARTMENU		0x000b
+#define	CSIDL_DESKTOPDIRECTORY	0x0010
+#define	CSIDL_DRIVES		0x0011
+#define	CSIDL_NETWORK		0x0012
+#define	CSIDL_NETHOOD		0x0013
+#define	CSIDL_FONTS		0x0014
+#define	CSIDL_TEMPLATES		0x0015
+
 #endif  /* __WINE_SHELL_H */
diff --git a/include/shlobj.h b/include/shlobj.h
index bb06efe..d51a190 100644
--- a/include/shlobj.h
+++ b/include/shlobj.h
@@ -1,12 +1,19 @@
 #ifndef _WINE_SHLOBJ_H
 #define _WINE_SHLOBJ_H
 
+#include "shell.h"
 #include "ole.h"
 #include "ole2.h"
 #include "compobj.h"
 
+#define STDMETHOD(xfn) HRESULT (CALLBACK *fn##xfn)
+#define STDMETHOD_(type,xfn) type (CALLBACK *fn##xfn)
+#define PURE
+#define FAR
+#define THIS_ THIS,
+
+
 typedef LPVOID	LPBC; /* *IBindCtx really */
-typedef LPVOID	LPSTRRET,LPENUMIDLIST;
 
 /*
  * shell32 classids
@@ -28,6 +35,21 @@
 DEFINE_SHLGUID(IID_IEnumIDList,         0x000214F2L, 0, 0);
 DEFINE_SHLGUID(IID_IFileViewerSite,     0x000214F3L, 0, 0);
 
+#define	STRRET_WSTR	0x0000
+#define	STRRET_OFFSET	0x0001
+#define	STRRET_CSTR	0x0002
+
+typedef struct _STRRET
+{
+    UINT32 uType;		/* STRRET_xxx */
+    union
+    {
+        LPWSTR	pOleStr;	/* OLESTR that will be freed */
+        UINT32	uOffset;	/* Offset into SHITEMID (ANSI) */
+        char	cStr[MAX_PATH];	/* Buffer to fill in */
+    } DUMMYUNIONNAME;
+} STRRET,*LPSTRRET;
+
 typedef struct {
 	WORD		cb;	/* nr of bytes in this item */
 	BYTE		abID[1];/* first byte in this item */
@@ -37,29 +59,198 @@
 	SHITEMID	mkid; /* first itemid in list */
 } ITEMIDLIST,*LPITEMIDLIST,*LPCITEMIDLIST;
 
-/* The IShellFolder interface ... the basic interface for a lot of stuff */
+/*****************************************************************************
+ * IEnumIDList interface
+ */
+#define THIS LPENUMIDLIST this
+
+typedef struct IEnumIDList IEnumIDList,*LPENUMIDLIST;
+typedef struct IEnumIDList_VTable {
+    /* *** IUnknown methods *** */
+    STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
+    STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
+    STDMETHOD_(ULONG,Release) (THIS) PURE;
+
+    /* *** IEnumIDList methods *** */
+    STDMETHOD(Next)  (THIS_ ULONG celt,
+                      LPITEMIDLIST *rgelt,
+                      ULONG *pceltFetched) PURE;
+    STDMETHOD(Skip)  (THIS_ ULONG celt) PURE;
+    STDMETHOD(Reset) (THIS) PURE;
+    STDMETHOD(Clone) (THIS_ IEnumIDList **ppenum) PURE;
+} IEnumIDList_VTable,*LPENUMIDLIST_VTABLE;
+
+struct IEnumIDList {
+	LPENUMIDLIST_VTABLE	lpvtbl;
+	DWORD			ref;
+};
+#undef THIS
+/************************************************************************
+ * The IShellFolder interface ... the basic interface for a lot of stuff
+ */
+
+#define THIS LPSHELLFOLDER this
+
+/* IShellFolder::GetDisplayNameOf/SetNameOf uFlags */
+typedef enum
+{
+    SHGDN_NORMAL            = 0,        /* default (display purpose) */
+    SHGDN_INFOLDER          = 1,        /* displayed under a folder (relative)*/
+    SHGDN_FORPARSING        = 0x8000,   /* for ParseDisplayName or path */
+} SHGNO;
+
+/* IShellFolder::EnumObjects */
+typedef enum tagSHCONTF
+{
+    SHCONTF_FOLDERS         = 32,       /* for shell browser */
+    SHCONTF_NONFOLDERS      = 64,       /* for default view */
+    SHCONTF_INCLUDEHIDDEN   = 128,      /* for hidden/system objects */
+} SHCONTF;
+
+/* from oleidl.h */
+#define	DROPEFFECT_NONE		0
+#define	DROPEFFECT_COPY		1
+#define	DROPEFFECT_MOVE		2
+#define	DROPEFFECT_LINK		4
+#define	DROPEFFECT_SCROLL       0x80000000
+
+/* IShellFolder::GetAttributesOf flags */
+#define SFGAO_CANCOPY           DROPEFFECT_COPY /* Objects can be copied */
+#define SFGAO_CANMOVE           DROPEFFECT_MOVE /* Objects can be moved */
+#define SFGAO_CANLINK           DROPEFFECT_LINK /* Objects can be linked */
+#define SFGAO_CANRENAME         0x00000010L     /* Objects can be renamed */
+#define SFGAO_CANDELETE         0x00000020L     /* Objects can be deleted */
+#define SFGAO_HASPROPSHEET      0x00000040L     /* Objects have property sheets */
+#define SFGAO_DROPTARGET        0x00000100L     /* Objects are drop target */
+#define SFGAO_CAPABILITYMASK    0x00000177L
+#define SFGAO_LINK              0x00010000L     /* Shortcut (link) */
+#define SFGAO_SHARE             0x00020000L     /* shared */
+#define SFGAO_READONLY          0x00040000L     /* read-only */
+#define SFGAO_GHOSTED           0x00080000L     /* ghosted icon */
+#define SFGAO_DISPLAYATTRMASK   0x000F0000L
+#define SFGAO_FILESYSANCESTOR   0x10000000L     /* It contains file system folder */
+#define SFGAO_FOLDER            0x20000000L     /* It's a folder. */
+#define SFGAO_FILESYSTEM        0x40000000L     /* is a file system thing (file/folder/root) */
+#define SFGAO_HASSUBFOLDER      0x80000000L     /* Expandable in the map pane */
+#define SFGAO_CONTENTSMASK      0x80000000L
+#define SFGAO_VALIDATE          0x01000000L     /* invalidate cached information */
+#define SFGAO_REMOVABLE        0x02000000L      /* is this removeable media? */
+
 
 typedef struct tagSHELLFOLDER *LPSHELLFOLDER,IShellFolder;
-typedef struct {
-	HRESULT	(CALLBACK *fnQueryInterface)(LPSHELLFOLDER this,REFIID refiid,LPVOID *obj);
-	HRESULT	(CALLBACK *fnAddRef)(LPSHELLFOLDER this);
-	HRESULT	(CALLBACK *fnRelease)(LPSHELLFOLDER this);
-	/* IShellFolder methods */
+typedef struct IShellFolder_VTable {
+    /* *** IUnknown methods *** */
+    STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
+    STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
+    STDMETHOD_(ULONG,Release) (THIS) PURE;
 
-	HRESULT (CALLBACK *fnParseDisplayName) (LPSHELLFOLDER this,HWND32 hwndOwner,LPBC pbcReserved,LPOLESTR lpszDisplayName,DWORD * pchEaten,LPITEMIDLIST * ppidl, DWORD *pdwAttributes) ;
-
-	HRESULT (CALLBACK *fnEnumObjects)( LPSHELLFOLDER this,HWND32 hwndOwner, DWORD grfFlags, LPENUMIDLIST* ppenumIDList);
-	HRESULT (CALLBACK *fnBindToObject)(LPSHELLFOLDER this, LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut);
-	HRESULT (CALLBACK *fnBindToStorage)(LPSHELLFOLDER this, LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvObj);
-    	HRESULT (CALLBACK *fnCompareIDs) (LPSHELLFOLDER this, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2);
-	HRESULT (CALLBACK *fnCreateViewObject) (LPSHELLFOLDER this, HWND32 hwndOwner, REFIID riid, LPVOID * ppvOut);
-	HRESULT (CALLBACK *fnGetAttributesOf)  (LPSHELLFOLDER this, UINT32 cidl, LPCITEMIDLIST * apidl, DWORD * rgfInOut);
-	HRESULT (CALLBACK *fnGetUIObjectOf)    (LPSHELLFOLDER this, HWND32 hwndOwner, UINT32 cidl, LPCITEMIDLIST * apidl, REFIID riid, UINT32 * prgfInOut, LPVOID * ppvOut);
-	HRESULT (CALLBACK *fnGetDisplayNameOf) (LPSHELLFOLDER this, LPCITEMIDLIST pidl, DWORD uFlags, LPSTRRET lpName);
-	HRESULT (CALLBACK *fnSetNameOf)        (LPSHELLFOLDER this, HWND32 hwndOwner, LPCITEMIDLIST pidl, LPCOLESTR lpszName, DWORD uFlags, LPITEMIDLIST * ppidlOut);
-} *LPSHELLFOLDER_VTABLE;
+    /* *** IShellFolder methods *** */
+    STDMETHOD(ParseDisplayName) (THIS_ HWND32 hwndOwner,
+        LPBC pbcReserved, LPOLESTR lpszDisplayName,
+        ULONG * pchEaten, LPITEMIDLIST * ppidl, ULONG *pdwAttributes) PURE;
+    STDMETHOD(EnumObjects) ( THIS_ HWND32 hwndOwner, DWORD grfFlags, LPENUMIDLIST
+* ppenumIDList) PURE;
+    STDMETHOD(BindToObject)     (THIS_ LPCITEMIDLIST pidl, LPBC pbcReserved,
+                                 REFIID riid, LPVOID * ppvOut) PURE;
+    STDMETHOD(BindToStorage)    (THIS_ LPCITEMIDLIST pidl, LPBC pbcReserved,
+                                 REFIID riid, LPVOID * ppvObj) PURE;
+    STDMETHOD(CompareIDs)       (THIS_ LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2) PURE;
+    STDMETHOD(CreateViewObject) (THIS_ HWND32 hwndOwner, REFIID riid, LPVOID * ppvOut) PURE;
+    STDMETHOD(GetAttributesOf)  (THIS_ UINT32 cidl, LPCITEMIDLIST * apidl,
+                                    ULONG * rgfInOut) PURE;
+    STDMETHOD(GetUIObjectOf)    (THIS_ HWND32 hwndOwner, UINT32 cidl, LPCITEMIDLIST
+* apidl,
+                                 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,
+                                 LPITEMIDLIST * ppidlOut) PURE;
+} *LPSHELLFOLDER_VTABLE,IShellFolder_VTable;
 
 struct tagSHELLFOLDER {
-	LPSHELLFOLDER_VTABLE	*lpvtbl;
+	LPSHELLFOLDER_VTABLE	lpvtbl;
+	DWORD			ref;
 };
+
+#undef THIS
+
+/****************************************************************************
+ * IShellLink interface
+ */
+
+#define THIS LPSHELLLINK this
+/* IShellLink::Resolve fFlags */
+typedef enum {
+    SLR_NO_UI           = 0x0001,
+    SLR_ANY_MATCH       = 0x0002,
+    SLR_UPDATE          = 0x0004,
+} SLR_FLAGS;
+
+/* IShellLink::GetPath fFlags */
+typedef enum {
+    SLGP_SHORTPATH      = 0x0001,
+    SLGP_UNCPRIORITY    = 0x0002,
+} SLGP_FLAGS;
+
+
+
+typedef struct IShellLink IShellLink,*LPSHELLLINK;
+typedef struct IShellLink_VTable
+{
+    // *** IUnknown methods ***
+    STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
+    STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
+    STDMETHOD_(ULONG,Release) (THIS) PURE;
+
+    STDMETHOD(GetPath)(THIS_ LPSTR pszFile, INT32 cchMaxPath, WIN32_FIND_DATA32A *pfd, DWORD fFlags) PURE;
+
+    STDMETHOD(GetIDList)(THIS_ LPITEMIDLIST * ppidl) PURE;
+    STDMETHOD(SetIDList)(THIS_ LPCITEMIDLIST pidl) PURE;
+
+    STDMETHOD(GetDescription)(THIS_ LPSTR pszName, int cchMaxName) PURE;
+    STDMETHOD(SetDescription)(THIS_ LPCSTR pszName) PURE;
+
+    STDMETHOD(GetWorkingDirectory)(THIS_ LPSTR pszDir, int cchMaxPath) PURE;
+    STDMETHOD(SetWorkingDirectory)(THIS_ LPCSTR pszDir) PURE;
+
+    STDMETHOD(GetArguments)(THIS_ LPSTR pszArgs, int cchMaxPath) PURE;
+    STDMETHOD(SetArguments)(THIS_ LPCSTR pszArgs) PURE;
+
+    STDMETHOD(GetHotkey)(THIS_ WORD *pwHotkey) PURE;
+    STDMETHOD(SetHotkey)(THIS_ WORD wHotkey) PURE;
+
+    STDMETHOD(GetShowCmd)(THIS_ INT32 *piShowCmd) PURE;
+    STDMETHOD(SetShowCmd)(THIS_ INT32 iShowCmd) PURE;
+
+    STDMETHOD(GetIconLocation)(THIS_ LPSTR pszIconPath, INT32 cchIconPath, INT32 *piIcon) PURE;
+    STDMETHOD(SetIconLocation)(THIS_ LPCSTR pszIconPath, INT32 iIcon) PURE;
+
+    STDMETHOD(SetRelativePath)(THIS_ LPCSTR pszPathRel, DWORD dwReserved) PURE;
+
+    STDMETHOD(Resolve)(THIS_ HWND32 hwnd, DWORD fFlags) PURE;
+
+    STDMETHOD(SetPath)(THIS_ LPCSTR pszFile) PURE;
+} IShellLink_VTable,*LPSHELLLINK_VTABLE;
+
+struct IShellLink {
+	LPSHELLLINK_VTABLE	lpvtbl;
+	DWORD			ref;
+};
+
+#undef THIS
+
+#ifdef __WINE__
+extern LPSHELLFOLDER IShellFolder_Constructor();
+extern LPSHELLLINK IShellLink_Constructor();
+extern LPENUMIDLIST IEnumIDList_Constructor();
+#endif
+
+DWORD WINAPI SHELL32_DllGetClassObject(LPCLSID,REFIID,LPVOID*);
+
+#undef PURE
+#undef FAR
+#undef THIS
+#undef THIS_
+#undef STDMETHOD
+#undef STDMETHOD_
 #endif /*_WINE_SHLOBJ_H*/
diff --git a/include/stddebug.h b/include/stddebug.h
index 8f73efc..0f51994 100644
--- a/include/stddebug.h
+++ b/include/stddebug.h
@@ -148,6 +148,7 @@
 #undef DEBUG_STRING
 #undef DEBUG_TASK
 #undef DEBUG_TEXT
+#undef DEBUG_THUNK
 #undef DEBUG_TIMER
 #undef DEBUG_TOOLHELP
 #undef DEBUG_TWEAK
@@ -234,6 +235,7 @@
 #define DEBUG_STRING
 #define DEBUG_TASK
 #define DEBUG_TEXT
+#define DEBUG_THUNK
 #define DEBUG_TIMER
 #define DEBUG_TOOLHELP
 #define DEBUG_TWEAK
diff --git a/include/task.h b/include/task.h
index ef54135..460f5de 100644
--- a/include/task.h
+++ b/include/task.h
@@ -131,5 +131,6 @@
                                 UINT16 cmdShow );
 extern void TASK_KillCurrentTask( INT16 exitCode );
 extern HTASK16 TASK_GetNextTask( HTASK16 hTask );
+extern void TASK_Reschedule(void);
 
 #endif /* __WINE_TASK_H */
diff --git a/include/toolhelp.h b/include/toolhelp.h
index 8d1cd81..1d2ddb7 100644
--- a/include/toolhelp.h
+++ b/include/toolhelp.h
@@ -348,6 +348,18 @@
     void      **lpBadParam;
 } NFYLOGPARAMERROR;
 
+typedef struct {
+    DWORD dwSize;
+    HTASK16 hTask;
+    WORD wSS;
+    WORD wBP;
+    WORD wCS;
+    WORD wIP;
+    HMODULE16 hModule;
+    WORD wSegment;
+    WORD wFlags;
+} STACKTRACEENTRY;
+
 #pragma pack(4)
 
 #endif /* __WINE_TOOLHELP_H */
diff --git a/include/user.h b/include/user.h
index 68e023f..b235b76 100644
--- a/include/user.h
+++ b/include/user.h
@@ -24,5 +24,8 @@
          ((handle) ? PTR_SEG_OFF_TO_SEGPTR(USER_HeapSel, (handle)) : (SEGPTR)0)
 
 void USER_SignalProc(HANDLE16, UINT16, UINT16, HINSTANCE16, HQUEUE16);
+void USER_ExitWindows(void);
+HGLOBAL16 USER_CallDefaultRsrcHandler( HGLOBAL16 hMemObj, HMODULE16 hModule,
+				       HRSRC16 hRsrc );
 
 #endif  /* __WINE_USER_H */
diff --git a/include/version.h b/include/version.h
index b0cfc85..d3413e2 100644
--- a/include/version.h
+++ b/include/version.h
@@ -1 +1 @@
-#define WINE_RELEASE_INFO "Wine release 971130"
+#define WINE_RELEASE_INFO "Wine release 971221"
diff --git a/include/windows.h b/include/windows.h
index 997208a..86cb5b8 100644
--- a/include/windows.h
+++ b/include/windows.h
@@ -1591,13 +1591,30 @@
 DECL_WINELIB_TYPE(LOGPEN);
 DECL_WINELIB_TYPE(LPLOGPEN);
 
-#define PS_SOLID	  0
-#define PS_DASH           1
-#define PS_DOT            2
-#define PS_DASHDOT        3
-#define PS_DASHDOTDOT     4
-#define PS_NULL 	  5
-#define PS_INSIDEFRAME 	  6
+#define PS_SOLID         0x00000000
+#define PS_DASH          0x00000001
+#define PS_DOT           0x00000002
+#define PS_DASHDOT       0x00000003
+#define PS_DASHDOTDOT    0x00000004
+#define PS_NULL          0x00000005
+#define PS_INSIDEFRAME   0x00000006
+#define PS_USERSTYLE     0x00000007
+#define PS_ALTERNATE     0x00000008
+#define PS_STYLE_MASK    0x0000000f
+
+#define PS_ENDCAP_ROUND  0x00000000
+#define PS_ENDCAP_SQUARE 0x00000100
+#define PS_ENDCAP_FLAT   0x00000200
+#define PS_ENDCAP_MASK   0x00000f00
+
+#define PS_JOIN_ROUND    0x00000000
+#define PS_JOIN_BEVEL    0x00001000
+#define PS_JOIN_MITER    0x00002000
+#define PS_JOIN_MASK     0x0000f000
+
+#define PS_COSMETIC      0x00000000
+#define PS_GEOMETRIC     0x00010000
+#define PS_TYPE_MASK     0x000f0000
 
   /* Regions */
 
@@ -1947,6 +1964,10 @@
 	HBITMAP32	hbmColor;
 } ICONINFO,*LPICONINFO;
 
+#ifdef FSHIFT
+/* Gcc on Solaris has a version of this that we don't care about.  */
+#undef FSHIFT
+#endif
 
 #define	FVIRTKEY	TRUE          /* Assumed to be == TRUE */
 #define	FNOINVERT	0x02
@@ -2557,6 +2578,7 @@
 #define DEVICE_DEFAULT_FONT 14
 #define DEFAULT_PALETTE     15
 #define SYSTEM_FIXED_FONT   16
+#define DEFAULT_GUI_FONT    17
 
 /* DragObject stuff */
 
@@ -3038,33 +3060,47 @@
 #define GCW_HBRBACKGROUND (-10)
 #endif
 
-#define MB_OK               0x0000
-#define MB_OKCANCEL         0x0001
-#define MB_ABORTRETRYIGNORE 0x0002
-#define MB_YESNOCANCEL      0x0003
-#define MB_YESNO            0x0004
-#define MB_RETRYCANCEL      0x0005
-#define MB_TYPEMASK         0x000F
+#define MB_OK			0x00000000
+#define MB_OKCANCEL		0x00000001
+#define MB_ABORTRETRYIGNORE	0x00000002
+#define MB_YESNOCANCEL		0x00000003
+#define MB_YESNO		0x00000004
+#define MB_RETRYCANCEL		0x00000005
+#define MB_TYPEMASK		0x0000000F
 
-#define MB_ICONHAND         0x0010
-#define MB_ICONQUESTION     0x0020
-#define MB_ICONEXCLAMATION  0x0030
-#define MB_ICONASTERISK     0x0040
-#define MB_ICONMASK         0x00F0
+#define MB_ICONHAND		0x00000010
+#define MB_ICONQUESTION		0x00000020
+#define MB_ICONEXCLAMATION	0x00000030
+#define MB_ICONASTERISK		0x00000040
+#define	MB_USERICON		0x00000080
+#define MB_ICONMASK		0x000000F0
 
-#define MB_ICONINFORMATION  MB_ICONASTERISK
-#define MB_ICONSTOP         MB_ICONHAND
+#define MB_ICONINFORMATION	MB_ICONASTERISK
+#define MB_ICONSTOP		MB_ICONHAND
+#define MB_ICONWARNING		MB_ICONEXCLAMATION
+#define MB_ICONERROR		MB_ICONHAND
 
-#define MB_DEFBUTTON1       0x0000
-#define MB_DEFBUTTON2       0x0100
-#define MB_DEFBUTTON3       0x0200
-#define MB_DEFMASK          0x0F00
+#define MB_DEFBUTTON1		0x00000000
+#define MB_DEFBUTTON2		0x00000100
+#define MB_DEFBUTTON3		0x00000200
+#define MB_DEFBUTTON4		0x00000300
+#define MB_DEFMASK		0x00000F00
 
-#define MB_APPLMODAL        0x0000
-#define MB_SYSTEMMODAL      0x1000
-#define MB_TASKMODAL        0x2000
+#define MB_APPLMODAL		0x00000000
+#define MB_SYSTEMMODAL		0x00001000
+#define MB_TASKMODAL		0x00002000
+#define MB_MODEMASK		0x00003000
 
-#define MB_NOFOCUS          0x8000
+#define MB_HELP			0x00004000
+#define MB_NOFOCUS		0x00008000
+#define MB_MISCMASK		0x0000C000
+
+#define MB_SETFOREGROUND	0x00010000
+#define MB_DEFAULT_DESKTOP_ONLY	0x00020000
+#define MB_SERVICE_NOTIFICATION	0x00040000
+#define MB_TOPMOST		0x00040000
+#define MB_RIGHT		0x00080000
+#define MB_RTLREADING		0x00100000
 
 
 #define DT_TOP 0
@@ -3165,7 +3201,9 @@
 #define DFCS_MONO               0x8000
 
 /* DrawState defines ... */
-typedef BOOL32 (CALLBACK *DRAWSTATEPROC)(HDC32,LPARAM,WPARAM32,INT32,INT32);
+typedef BOOL16 (CALLBACK *DRAWSTATEPROC16)(HDC16,LPARAM,WPARAM16,INT16,INT16);
+typedef BOOL32 (CALLBACK *DRAWSTATEPROC32)(HDC32,LPARAM,WPARAM32,INT32,INT32);
+DECL_WINELIB_TYPE(DRAWSTATEPROC);
 
 /* Image type */
 #define	DST_COMPLEX	0x0000
@@ -3178,6 +3216,7 @@
 #define	DSS_NORMAL	0x0000
 #define	DSS_UNION	0x0010  /* Gray string appearance */
 #define	DSS_DISABLED	0x0020
+#define	DSS_DEFAULT	0x0040  /* Make it bold */
 #define	DSS_MONO	0x0080
 #define	DSS_RIGHT	0x8000
 
@@ -4875,6 +4914,20 @@
 DECL_WINELIB_TYPE_AW(DEVMODE);
 DECL_WINELIB_TYPE_AW(LPDEVMODE);
 
+typedef struct _PRINTER_DEFAULTS32A {
+    LPSTR        pDatatype;
+    LPDEVMODE32A pDevMode;
+    ACCESS_MASK  DesiredAccess;
+} PRINTER_DEFAULTS32A, *LPPRINTER_DEFAULTS32A;
+
+typedef struct _PRINTER_DEFAULTS32W {
+    LPWSTR       pDatatype;
+    LPDEVMODE32W pDevMode;
+    ACCESS_MASK  DesiredAccess;
+} PRINTER_DEFAULTS32W, *LPPRINTER_DEFAULTS32W;
+
+DECL_WINELIB_TYPE_AW(PRINTER_DEFAULTS);
+
 typedef struct _SYSTEM_POWER_STATUS
 {
   BOOL16  ACLineStatus;
@@ -4910,6 +4963,12 @@
 #define LR_LOADREALSIZE		0x0020
 #define LR_LOADMAP3DCOLORS	0x1000
 
+/* Flags for PolyDraw and GetPath */
+#define PT_CLOSEFIGURE          0x0001
+#define PT_LINETO               0x0002
+#define PT_BEZIERTO             0x0004
+#define PT_MOVETO               0x0006
+
 typedef struct _LARGE_INTEGER
 {
     DWORD    LowPart;
@@ -5333,6 +5392,79 @@
     } HighWord;
 } LDT_ENTRY, *LPLDT_ENTRY;
 
+#define	RDH_RECTANGLES  1
+
+typedef struct _RGNDATAHEADER {
+    DWORD	dwSize;
+    DWORD	iType;
+    DWORD	nCount;
+    DWORD	nRgnSize;
+    RECT32	rcBound;
+} RGNDATAHEADER,*LPRGNDATAHEADER;
+
+typedef struct _RGNDATA {
+    RGNDATAHEADER	rdh;
+    char		Buffer[1];
+} RGNDATA,*PRGNDATA,*LPRGNDATA;
+
+#define	HELPINFO_WINDOW		0x0001
+#define	HELPINFO_MENUITEM	0x0002
+typedef struct			/* Structure pointed to by lParam of WM_HELP */
+{
+    UINT32	cbSize;		/* Size in bytes of this struct  */
+    INT32	iContextType;	/* Either HELPINFO_WINDOW or HELPINFO_MENUITEM */
+    INT32	iCtrlId;	/* Control Id or a Menu item Id. */
+    HANDLE32	hItemHandle;	/* hWnd of control or hMenu.     */
+    DWORD	dwContextId;	/* Context Id associated with this item */
+    POINT32	MousePos;	/* Mouse Position in screen co-ordinates */
+}  HELPINFO,*LPHELPINFO;
+
+typedef void (CALLBACK *MSGBOXCALLBACK)(LPHELPINFO lpHelpInfo);
+
+typedef struct /* not sure if the 16bit version is correct */
+{
+    UINT16	cbSize;
+    HWND16	hwndOwner;
+    HINSTANCE16	hInstance;
+    LPCSTR	lpszText;
+    LPCSTR	lpszCaption;
+    DWORD	dwStyle;
+    LPCSTR	lpszIcon;
+    DWORD	dwContextHelpId;
+    MSGBOXCALLBACK	lpfnMsgBoxCallback;
+    DWORD	dwLanguageId;
+} MSGBOXPARAMS16,*LPMSGBOXPARAMS16;
+
+typedef struct
+{
+    UINT32	cbSize;
+    HWND32	hwndOwner;
+    HINSTANCE32	hInstance;
+    LPCSTR	lpszText;
+    LPCSTR	lpszCaption;
+    DWORD	dwStyle;
+    LPCSTR	lpszIcon;
+    DWORD	dwContextHelpId;
+    MSGBOXCALLBACK	lpfnMsgBoxCallback;
+    DWORD	dwLanguageId;
+} MSGBOXPARAMS32A,*LPMSGBOXPARAMS32A;
+
+typedef struct
+{
+    UINT32	cbSize;
+    HWND32	hwndOwner;
+    HINSTANCE32	hInstance;
+    LPCWSTR	lpszText;
+    LPCWSTR	lpszCaption;
+    DWORD	dwStyle;
+    LPCWSTR	lpszIcon;
+    DWORD	dwContextHelpId;
+    MSGBOXCALLBACK	lpfnMsgBoxCallback;
+    DWORD	dwLanguageId;
+} MSGBOXPARAMS32W,*LPMSGBOXPARAMS32W;
+
+DECL_WINELIB_TYPE_AW(MSGBOXPARAMS)
+
 #pragma pack(4)
 
 /* Declarations for functions that exist only in Win16 */
@@ -5390,6 +5522,7 @@
 DWORD       WINAPI GetFileResourceSize(LPCSTR,SEGPTR,SEGPTR,LPDWORD);
 DWORD       WINAPI GetFileResource(LPCSTR,SEGPTR,SEGPTR,DWORD,DWORD,LPVOID);
 DWORD       WINAPI GetHeapSpaces(HMODULE16);
+WORD        WINAPI GetIconID(HGLOBAL16,DWORD);
 INT16       WINAPI GetInstanceData(HINSTANCE16,WORD,INT16);
 HGLOBAL16   WINAPI GetMetaFileBits(HMETAFILE16);
 BOOL16      WINAPI GetModuleName(HINSTANCE16,LPSTR,INT16);
@@ -5434,6 +5567,7 @@
 WORD        WINAPI LocalCountFree(void);
 WORD        WINAPI LocalHandleDelta(WORD);
 WORD        WINAPI LocalHeapSize(void);
+HICON16     WINAPI LoadIconHandler(HGLOBAL16,BOOL16);
 BOOL16      WINAPI LocalInit(HANDLE16,WORD,WORD);
 FARPROC16   WINAPI LocalNotify(FARPROC16);
 HTASK16     WINAPI LockCurrentTask(BOOL16);
@@ -5509,6 +5643,7 @@
 HFILE32     WINAPI CreateFile32W(LPCWSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES,
                                  DWORD,DWORD,HANDLE32);
 #define     CreateFile WINELIB_NAME_AW(CreateFile)
+HPALETTE32  WINAPI CreateHalftonePalette(HDC32);
 HANDLE32    WINAPI CreateFileMapping32A(HANDLE32,LPSECURITY_ATTRIBUTES,DWORD,
                                         DWORD,DWORD,LPCSTR);
 HANDLE32    WINAPI CreateFileMapping32W(HANDLE32,LPSECURITY_ATTRIBUTES,DWORD,
@@ -5558,7 +5693,11 @@
 HRSRC32     WINAPI FindResourceEx32A(HINSTANCE32,LPCSTR,LPCSTR,WORD);
 HRSRC32     WINAPI FindResourceEx32W(HINSTANCE32,LPCWSTR,LPCWSTR,WORD);
 #define     FindResourceEx WINELIB_NAME_AW(FindResourceEx)
+BOOL32      WINAPI FlushConsoleInputBuffer(HANDLE32);
 BOOL32      WINAPI FlushFileBuffers(HFILE32);
+DWORD       WINAPI FormatMessage32A(DWORD,LPCVOID,DWORD,DWORD,LPSTR,
+				    DWORD,LPDWORD);
+#define     FormatMessage WINELIB_NAME_AW(FormatMessage)
 BOOL32      WINAPI FreeEnvironmentStrings32A(LPSTR);
 BOOL32      WINAPI FreeEnvironmentStrings32W(LPWSTR);
 #define     FreeEnvironmentStrings WINELIB_NAME_AW(FreeEnvironmentStrings)
@@ -5570,7 +5709,14 @@
 BOOL32      WINAPI GetComputerName32A(LPSTR,LPDWORD);
 BOOL32      WINAPI GetComputerName32W(LPWSTR,LPDWORD);
 #define     GetComputerName WINELIB_NAME_AW(GetComputerName)
+UINT32      WINAPI GetConsoleCP();
+BOOL32      WINAPI GetConsoleMode(HANDLE32,LPDWORD);
+UINT32      WINAPI GetConsoleOutputCP();
+DWORD       WINAPI GetConsoleTitle32A(LPSTR,DWORD);
+DWORD       WINAPI GetConsoleTitle32W(LPWSTR,DWORD);
+#define     GetConsoleTitle WINELIB_NAME_AW(GetConsoleTitle)
 BOOL32      WINAPI GetCPInfo(UINT32,LPCPINFO);
+HANDLE32    WINAPI GetCurrentObject(HDC32,UINT32);
 HANDLE32    WINAPI GetCurrentProcess(void);
 DWORD       WINAPI GetCurrentProcessId(void);
 HANDLE32    WINAPI GetCurrentThread(void);
@@ -5589,11 +5735,14 @@
 DWORD       WINAPI GetFullPathName32A(LPCSTR,DWORD,LPSTR,LPSTR*);
 DWORD       WINAPI GetFullPathName32W(LPCWSTR,DWORD,LPWSTR,LPWSTR*);
 #define     GetFullPathName WINELIB_NAME_AW(GetFullPathName)
+DWORD       WINAPI GetLargestConsoleWindowSize(HANDLE32);
 VOID        WINAPI GetLocalTime(LPSYSTEMTIME);
 DWORD       WINAPI GetLogicalDrives(void);
 BOOL32      WINAPI GetMenuItemInfo32A(HMENU32,UINT32,BOOL32,MENUITEMINFO32A*);
 BOOL32      WINAPI GetMenuItemInfo32W(HMENU32,UINT32,BOOL32,MENUITEMINFO32W*);
 #define     GetMenuItemInfo WINELIB_NAME_AW(GetMenuItemInfo)
+BOOL32      WINAPI GetNumberOfConsoleInputEvents(HANDLE32,LPDWORD);
+BOOL32      WINAPI GetNumberOfConsoleMouseButtons(LPDWORD);
 DWORD       WINAPI GetObjectType(HANDLE32);
 UINT32      WINAPI GetOEMCP(void);
 DWORD       WINAPI GetPriorityClass(HANDLE32);
@@ -5635,6 +5784,7 @@
 BOOL32      WINAPI HeapUnlock(HANDLE32);
 BOOL32      WINAPI HeapValidate(HANDLE32,DWORD,LPCVOID);
 BOOL32      WINAPI IsDBCSLeadByteEx(UINT32,BYTE);
+BOOL32      WINAPI IsProcessorFeaturePresent(DWORD);
 BOOL32      WINAPI IsWindowUnicode(HWND32);
 BOOL32      WINAPI IsValidLocale(DWORD,DWORD);
 BOOL32      WINAPI LocalFileTimeToFileTime(const FILETIME*,LPFILETIME);
@@ -5702,6 +5852,7 @@
 BOOL32      WINAPI SetBrushOrgEx(HDC32,INT32,INT32,LPPOINT32);
 BOOL32      WINAPI SetCommMask(INT32,DWORD);
 BOOL32      WINAPI SetCommTimeouts(INT32,LPCOMMTIMEOUTS);
+BOOL32      WINAPI SetConsoleMode(HANDLE32,DWORD);
 BOOL32      WINAPI SetConsoleTitle32A(LPCSTR);
 BOOL32      WINAPI SetConsoleTitle32W(LPCWSTR);
 #define     SetConsoleTitle WINELIB_NAME_AW(SetConsoleTitle)
@@ -5743,8 +5894,8 @@
 BOOL32      WINAPI VirtualQuery(LPCVOID,LPMEMORY_BASIC_INFORMATION,DWORD);
 BOOL32      WINAPI VirtualQueryEx(HANDLE32,LPCVOID,LPMEMORY_BASIC_INFORMATION,DWORD);
 BOOL32      WINAPI VirtualUnlock(LPVOID,DWORD);
-BOOL32      WINAPI WriteConsole32A(HANDLE32,LPVOID,DWORD,LPDWORD,LPVOID);
-BOOL32      WINAPI WriteConsole32W(HANDLE32,LPVOID,DWORD,LPDWORD,LPVOID);
+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);
 
@@ -5778,6 +5929,9 @@
 
 /* Declarations for functions that change between Win16 and Win32 */
 
+BOOL16      WINAPI AbortPath16(HDC16);
+BOOL32      WINAPI AbortPath32(HDC32);
+#define     AbortPath WINELIB_NAME(AbortPath)
 LRESULT     WINAPI AboutDlgProc16(HWND16,UINT16,WPARAM16,LPARAM);
 LRESULT     WINAPI AboutDlgProc32(HWND32,UINT32,WPARAM32,LPARAM);
 #define     AboutDlgProc WINELIB_NAME(AboutDlgProc)
@@ -5855,6 +6009,9 @@
 HDC16       WINAPI BeginPaint16(HWND16,LPPAINTSTRUCT16);
 HDC32       WINAPI BeginPaint32(HWND32,LPPAINTSTRUCT32);
 #define     BeginPaint WINELIB_NAME(BeginPaint)
+BOOL16      WINAPI BeginPath16(HDC16);
+BOOL32      WINAPI BeginPath32(HDC32);
+#define     BeginPath WINELIB_NAME(BeginPath)
 BOOL16      WINAPI BitBlt16(HDC16,INT16,INT16,INT16,INT16,HDC16,INT16,INT16,DWORD);
 BOOL32      WINAPI BitBlt32(HDC32,INT32,INT32,INT32,INT32,HDC32,INT32,INT32,DWORD);
 #define     BitBlt WINELIB_NAME(BitBlt)
@@ -5946,6 +6103,9 @@
 BOOL16      WINAPI CloseClipboard16(void);
 BOOL32      WINAPI CloseClipboard32(void);
 #define     CloseClipboard WINELIB_NAME(CloseClipboard)
+BOOL16      WINAPI CloseFigure16(HDC16);
+BOOL32      WINAPI CloseFigure32(HDC32);
+#define     CloseFigure WINELIB_NAME(CloseFigure)
 HMETAFILE16 WINAPI CloseMetaFile16(HDC16);
 HMETAFILE32 WINAPI CloseMetaFile32(HDC32);
 #define     CloseMetaFile WINELIB_NAME(CloseMetaFile)
@@ -6304,6 +6464,9 @@
 BOOL16      WINAPI EndPaint16(HWND16,const PAINTSTRUCT16*);
 BOOL32      WINAPI EndPaint32(HWND32,const PAINTSTRUCT32*);
 #define     EndPaint WINELIB_NAME(EndPaint)
+BOOL16      WINAPI EndPath16(HDC16);
+BOOL32      WINAPI EndPath32(HDC32);
+#define     EndPath WINELIB_NAME(EndPath)
 BOOL16      WINAPI EnumChildWindows16(HWND16,WNDENUMPROC16,LPARAM);
 BOOL32      WINAPI EnumChildWindows32(HWND32,WNDENUMPROC32,LPARAM);
 #define     EnumChildWindows WINELIB_NAME(EnumChildWindows)
@@ -6360,6 +6523,9 @@
 BOOL16      WINAPI ExitWindows16(DWORD,UINT16);
 #define     ExitWindows32(a,b) ExitWindowsEx(EWX_LOGOFF,0xffffffff)
 #define     ExitWindows WINELIB_NAME(ExitWindows)
+HPEN16      WINAPI ExtCreatePen16(DWORD,DWORD,const LOGBRUSH16*,DWORD,const DWORD*);
+HPEN32      WINAPI ExtCreatePen32(DWORD,DWORD,const LOGBRUSH32*,DWORD,const DWORD*);
+#define     ExtCreatePen WINELIB_NAME(ExtCreatePen)
 BOOL16      WINAPI ExtFloodFill16(HDC16,INT16,INT16,COLORREF,UINT16);
 BOOL32      WINAPI ExtFloodFill32(HDC32,INT32,INT32,COLORREF,UINT32);
 #define     ExtFloodFill WINELIB_NAME(ExtFloodFill)
@@ -6382,6 +6548,9 @@
 void        WINAPI FatalAppExit32A(UINT32,LPCSTR);
 void        WINAPI FatalAppExit32W(UINT32,LPCWSTR);
 #define     FatalAppExit WINELIB_NAME_AW(FatalAppExit)
+BOOL16      WINAPI FillPath16(HDC16);
+BOOL32      WINAPI FillPath32(HDC32);
+#define     FillPath WINELIB_NAME(FillPath)
 INT16       WINAPI FillRect16(HDC16,const RECT16*,HBRUSH16);
 INT32       WINAPI FillRect32(HDC32,const RECT32*,HBRUSH32);
 #define     FillRect WINELIB_NAME(FillRect)
@@ -6402,11 +6571,11 @@
 HANDLE16    WINAPI FindFirstFile16(LPCSTR,LPWIN32_FIND_DATA32A);
 HANDLE32    WINAPI FindFirstFile32A(LPCSTR,LPWIN32_FIND_DATA32A);
 HANDLE32    WINAPI FindFirstFile32W(LPCWSTR,LPWIN32_FIND_DATA32W);
-#define     FindFirst WINELIB_NAME_AW(FindFirst)
+#define     FindFirstFile WINELIB_NAME_AW(FindFirstFile)
 BOOL16      WINAPI FindNextFile16(HANDLE16,LPWIN32_FIND_DATA32A);
 BOOL32      WINAPI FindNextFile32A(HANDLE32,LPWIN32_FIND_DATA32A);
 BOOL32      WINAPI FindNextFile32W(HANDLE32,LPWIN32_FIND_DATA32W);
-#define     FindNext WINELIB_NAME_AW(FindNext)
+#define     FindNextFile WINELIB_NAME_AW(FindNextFile)
 HRSRC16     WINAPI FindResource16(HINSTANCE16,SEGPTR,SEGPTR);
 HRSRC32     WINAPI FindResource32A(HINSTANCE32,LPCSTR,LPCSTR);
 HRSRC32     WINAPI FindResource32W(HINSTANCE32,LPCWSTR,LPCWSTR);
@@ -6563,6 +6732,9 @@
 INT16       WINAPI GetDeviceCaps16(HDC16,INT16);
 INT32       WINAPI GetDeviceCaps32(HDC32,INT32);
 #define     GetDeviceCaps WINELIB_NAME(GetDeviceCaps)
+UINT16      WINAPI GetDIBColorTable16(HDC16,UINT16,UINT16,RGBQUAD*);
+UINT32      WINAPI GetDIBColorTable32(HDC32,UINT32,UINT32,RGBQUAD*);
+#define     GetDIBColorTable WINELIB_NAME(GetDIBColorTable)
 INT16       WINAPI GetDIBits16(HDC16,HBITMAP16,UINT16,UINT16,LPSTR,LPBITMAPINFO,UINT16);
 INT32       WINAPI GetDIBits32(HDC32,HBITMAP32,UINT32,UINT32,LPSTR,LPBITMAPINFO,UINT32);
 #define     GetDIBits WINELIB_NAME(GetDIBits)
@@ -6718,6 +6890,9 @@
 HWND16      WINAPI GetParent16(HWND16);
 HWND32      WINAPI GetParent32(HWND32);
 #define     GetParent WINELIB_NAME(GetParent)
+INT16       WINAPI GetPath16(HDC16,LPPOINT16,LPBYTE,INT16);
+INT32       WINAPI GetPath32(HDC32,LPPOINT32,LPBYTE,INT32);
+#define     GetPath WINELIB_NAME(GetPath)
 COLORREF    WINAPI GetPixel16(HDC16,INT16,INT16);
 COLORREF    WINAPI GetPixel32(HDC32,INT32,INT32);
 #define     GetPixel WINELIB_NAME(GetPixel)
@@ -7228,6 +7403,10 @@
 INT32       WINAPI MessageBox32A(HWND32,LPCSTR,LPCSTR,UINT32);
 INT32       WINAPI MessageBox32W(HWND32,LPCWSTR,LPCWSTR,UINT32);
 #define     MessageBox WINELIB_NAME_AW(MessageBox)
+INT16       WINAPI MessageBoxIndirect16(LPMSGBOXPARAMS16);
+INT32       WINAPI MessageBoxIndirect32A(LPMSGBOXPARAMS32A);
+INT32       WINAPI MessageBoxIndirect32W(LPMSGBOXPARAMS32W);
+#define     MessageBoxIndirect WINELIB_NAME_AW(MessageBoxIndirect)
 BOOL16      WINAPI ModifyMenu16(HMENU16,UINT16,UINT16,UINT16,SEGPTR);
 BOOL32      WINAPI ModifyMenu32A(HMENU32,UINT32,UINT32,UINT32,LPCSTR);
 BOOL32      WINAPI ModifyMenu32W(HMENU32,UINT32,UINT32,UINT32,LPCWSTR);
@@ -7292,6 +7471,9 @@
 BOOL16      WINAPI PatBlt16(HDC16,INT16,INT16,INT16,INT16,DWORD);
 BOOL32      WINAPI PatBlt32(HDC32,INT32,INT32,INT32,INT32,DWORD);
 #define     PatBlt WINELIB_NAME(PatBlt)
+HRGN16      WINAPI PathToRegion16(HDC16);
+HRGN32      WINAPI PathToRegion32(HDC32);
+#define     PathToRegion WINELIB_NAME(PathToRegion)
 BOOL16      WINAPI PeekMessage16(LPMSG16,HWND16,UINT16,UINT16,UINT16);
 BOOL32      WINAPI PeekMessage32A(LPMSG32,HWND32,UINT32,UINT32,UINT32);
 BOOL32      WINAPI PeekMessage32W(LPMSG32,HWND32,UINT32,UINT32,UINT32);
@@ -7469,6 +7651,9 @@
 INT32       WINAPI ScrollWindowEx32(HWND32,INT32,INT32,const RECT32*,
                                     const RECT32*,HRGN32,LPRECT32,UINT32);
 #define     ScrollWindowEx WINELIB_NAME(ScrollWindowEx)
+BOOL16      WINAPI SelectClipPath16(HDC16,INT16);
+BOOL32      WINAPI SelectClipPath32(HDC32,INT32);
+#define     SelectClipPath WINELIB_NAME(SelectClipPath)
 INT16       WINAPI SelectClipRgn16(HDC16,HRGN16);
 INT32       WINAPI SelectClipRgn32(HDC32,HRGN32);
 #define     SelectClipRgn WINELIB_NAME(SelectClipRgn)
@@ -7486,6 +7671,13 @@
 LRESULT     WINAPI SendMessage32A(HWND32,UINT32,WPARAM32,LPARAM);
 LRESULT     WINAPI SendMessage32W(HWND32,UINT32,WPARAM32,LPARAM);
 #define     SendMessage WINELIB_NAME_AW(SendMessage)
+LRESULT     WINAPI SendMessageTimeout16(HWND16,UINT16,WPARAM16,LPARAM,UINT16,
+					UINT16,LPWORD);
+LRESULT     WINAPI SendMessageTimeout32A(HWND32,UINT32,WPARAM32,LPARAM,UINT32,
+					 UINT32,LPDWORD);
+LRESULT     WINAPI SendMessageTimeout32W(HWND32,UINT32,WPARAM32,LPARAM,UINT32,
+					 UINT32,LPDWORD);
+#define     SendMessageTimeout WINELIB_NAME_AW(SendMessageTimeout)
 HWND16      WINAPI SetActiveWindow16(HWND16);
 HWND32      WINAPI SetActiveWindow32(HWND32);
 #define     SetActiveWindow WINELIB_NAME(SetActiveWindow)
@@ -7542,6 +7734,9 @@
 BOOL16      WINAPI SetDeskWallPaper16(LPCSTR);
 BOOL32      WINAPI SetDeskWallPaper32(LPCSTR);
 #define     SetDeskWallPaper WINELIB_NAME(SetDeskWallPaper)
+UINT16      WINAPI SetDIBColorTable16(HDC16,UINT16,UINT16,RGBQUAD*);
+UINT32      WINAPI SetDIBColorTable32(HDC32,UINT32,UINT32,RGBQUAD*);
+#define     SetDIBColorTable WINELIB_NAME(SetDIBColorTable)
 INT16       WINAPI SetDIBits16(HDC16,HBITMAP16,UINT16,UINT16,LPCVOID,const BITMAPINFO*,UINT16);
 INT32       WINAPI SetDIBits32(HDC32,HBITMAP32,UINT32,UINT32,LPCVOID,const BITMAPINFO*,UINT32);
 #define     SetDIBits WINELIB_NAME(SetDIBits)
diff --git a/include/winerror.h b/include/winerror.h
index ce1a3fe..dd2f3f3 100644
--- a/include/winerror.h
+++ b/include/winerror.h
@@ -17,6 +17,7 @@
 #define ERROR_TOO_MANY_OPEN_FILES   4
 #define ERROR_ACCESS_DENIED         5
 #define ERROR_INVALID_HANDLE        6
+#define ERROR_NOT_ENOUGH_MEMORY     8
 #define ERROR_BAD_FORMAT            11
 #define ERROR_OUTOFMEMORY           14
 #define ERROR_NO_MORE_FILES         18
@@ -28,6 +29,7 @@
 #define ERROR_BROKEN_PIPE           109
 #define ERROR_DISK_FULL             112
 #define ERROR_CALL_NOT_IMPLEMENTED  120
+#define ERROR_INSUFFICIENT_BUFFER   122
 #define ERROR_SEEK_ON_DEVICE        132
 #define ERROR_DIR_NOT_EMPTY         145
 #define ERROR_BUSY                  170
@@ -35,9 +37,22 @@
 #define ERROR_FILENAME_EXCED_RANGE  206
 #define ERROR_MORE_DATA             234
 #define ERROR_NO_MORE_ITEMS         259
+#define ERROR_INVALID_ADDRESS       487
+#define ERROR_CAN_NOT_COMPLETE      1003
 #define ERROR_IO_DEVICE             1117
 #define ERROR_POSSIBLE_DEADLOCK     1131
 #define ERROR_BAD_DEVICE            1200
 #define ERROR_NO_NETWORK            1222
+#define ERROR_COMMITMENT_LIMIT      1455
+
+/* HRESULT values for OLE, SHELL and other Interface stuff */
+#define	NOERROR				0
+#define	S_OK				0
+#define	E_UNEXPECTED			0x8000FFFF
+#define	E_OUTOFMEMORY			0x8007000E
+#define	E_INVALIDARG			0x80070057
+
+#define	OLE_E_ENUM_NOMORE		0x80040002
+#define	CLASS_E_CLASSNOTAVAILABLE	0x80040111
 
 #endif  /* __WINE_WINERROR_H */
diff --git a/include/winnt.h b/include/winnt.h
index a23df14..0d53299 100644
--- a/include/winnt.h
+++ b/include/winnt.h
@@ -24,6 +24,12 @@
 #define HEAP_WINE_SEGPTR                0x01000000  /* Not a Win32 flag */
 #define HEAP_WINE_CODESEG               0x02000000  /* Not a Win32 flag */
 
+/* Processor feature flags.  */
+#define PF_FLOATING_POINT_PRECISION_ERRATA    0
+#define PF_FLOATING_POINT_EMULATED            1
+#define PF_COMPARE_EXCHANGE_DOUBLE            2
+#define PF_MMX_INSTRUCTIONS_AVAILABLE         3
+
 /* The Win32 register context */
 
 #define CONTEXT_i386      0x00010000
diff --git a/include/winpos.h b/include/winpos.h
index f07431e..a572d93 100644
--- a/include/winpos.h
+++ b/include/winpos.h
@@ -41,5 +41,8 @@
 extern LONG WINPOS_HandleWindowPosChanging16(WND *wndPtr, WINDOWPOS16 *winpos);
 extern LONG WINPOS_HandleWindowPosChanging32(WND *wndPtr, WINDOWPOS32 *winpos);
 extern INT16 WINPOS_WindowFromPoint( WND* scopeWnd, POINT16 pt, WND **ppWnd );
+extern void WINPOS_CheckInternalPos( HWND32 hwnd );
+extern BOOL32 WINPOS_ActivateOtherWindow(WND* pWnd);
+extern BOOL32 WINPOS_CreateInternalPosAtom(void);
 
 #endif  /* __WINE_WINPOS_H */
diff --git a/include/winsock.h b/include/winsock.h
index d202655..edee250 100644
--- a/include/winsock.h
+++ b/include/winsock.h
@@ -61,46 +61,62 @@
 {
         UINT16    fd_count;               /* how many are SET? */
         SOCKET16  fd_array[FD_SETSIZE];   /* an array of SOCKETs */
-} ws_fd_set;
+} ws_fd_set16;
+
+typedef struct
+{
+        UINT32    fd_count;               /* how many are SET? */
+        SOCKET32  fd_array[FD_SETSIZE];   /* an array of SOCKETs */
+} ws_fd_set32;
 
 /* ws_fd_set operations */
 
-INT16 WINAPI __WSAFDIsSet16( SOCKET16, ws_fd_set * );
-INT32 WINAPI __WSAFDIsSet32( SOCKET32, ws_fd_set * );
+INT16 WINAPI __WSAFDIsSet16( SOCKET16, ws_fd_set16 * );
+INT32 WINAPI __WSAFDIsSet32( SOCKET32, ws_fd_set32 * );
 #define __WSAFDIsSet WINELIB_NAME(__WSAFDIsSet);
 
-#define WS_FD_CLR(fd, set) do { \
+#define __WS_FD_CLR(fd, set, cast) do { \
     UINT16 __i; \
-    for (__i = 0; __i < ((ws_fd_set*)(set))->fd_count ; __i++) \
+    for (__i = 0; __i < ((cast*)(set))->fd_count ; __i++) \
     { \
-        if (((ws_fd_set*)(set))->fd_array[__i] == fd) \
+        if (((cast*)(set))->fd_array[__i] == fd) \
 	{ \
-            while (__i < ((ws_fd_set*)(set))->fd_count-1) \
+            while (__i < ((cast*)(set))->fd_count-1) \
 	    { \
-                ((ws_fd_set*)(set))->fd_array[__i] = \
-                    ((ws_fd_set*)(set))->fd_array[__i+1]; \
+                ((cast*)(set))->fd_array[__i] = \
+                    ((cast*)(set))->fd_array[__i+1]; \
                 __i++; \
             } \
-            ((ws_fd_set*)(set))->fd_count--; \
+            ((cast*)(set))->fd_count--; \
             break; \
         } \
     } \
 } while(0)
+#define WS_FD_CLR16(fd, set)	__WS_FD_CLR((fd),(set), ws_fd_set16)
+#define WS_FD_CLR32(fd, set)	__WS_FD_CLR((fd),(set), ws_fd_set32)
+#define WS_FD_CLR 		WINELIB_NAME(WS_FD_CLR);
 
-#define WS_FD_SET(fd, set) do { \
-    if (((ws_fd_set*)(set))->fd_count < FD_SETSIZE) \
-        ((ws_fd_set*)(set))->fd_array[((ws_fd_set*)(set))->fd_count++]=(fd);\
+#define __WS_FD_SET(fd, set, cast) do { \
+    if (((cast*)(set))->fd_count < FD_SETSIZE) \
+        ((cast*)(set))->fd_array[((cast*)(set))->fd_count++]=(fd);\
 } while(0)
+#define WS_FD_SET16(fd, set)    __WS_FD_SET((fd),(set), ws_fd_set16)
+#define WS_FD_SET32(fd, set)    __WS_FD_SET((fd),(set), ws_fd_set32)
+#define WS_FD_SET		WINELIB_NAME(WS_FD_SET);
 
-#define WS_FD_ZERO(set) (((ws_fd_set*)(set))->fd_count=0)
+#define WS_FD_ZERO16(set) (((ws_fd_set16*)(set))->fd_count=0)
+#define WS_FD_ZERO32(set) (((ws_fd_set32*)(set))->fd_count=0)
+#define WS_FD_ZERO		WINELIB_NAME(WS_FD_ZERO);
 
-#define WS_FD_ISSET(fd, set) __WSAFDIsSet((SOCKET16)(fd), (ws_fd_set*)(set))
+#define WS_FD_ISSET16(fd, set) __WSAFDIsSet16((SOCKET16)(fd), (ws_fd_set16*)(set))
+#define WS_FD_ISSET32(fd, set) __WSAFDIsSet32((SOCKET32)(fd), (ws_fd_set32*)(set))
+#define WS_FD_ISSET		WINELIB_NAME(WS_FD_ISSET);
 
 /* 
  * Internet address (old style... should be updated) 
  */
 
-typedef struct ws_addr_in
+struct ws_in_addr
 {
         union {
                 struct { BYTE   s_b1,s_b2,s_b3,s_b4; } S_un_b;
@@ -113,15 +129,15 @@
 #define ws_imp   S_un.S_un_w.s_w2	/* imp */
 #define ws_impno S_un.S_un_b.s_b4	/* imp # */
 #define ws_lh    S_un.S_un_b.s_b3	/* logical host */
-} _ws_in_addr;
+};
 
-typedef struct ws_sockaddr_in
+struct ws_sockaddr_in
 {
         INT16		sin_family;
         UINT16 		sin_port;
-        _ws_in_addr 	sin_addr;
-        char    	sin_zero[8];
-} _ws_sockaddr_in;
+        struct ws_in_addr sin_addr;
+        BYTE    	sin_zero[8];
+};
 
 #define WSADESCRIPTION_LEN      256
 #define WSASYS_STATUS_LEN       128
@@ -356,27 +372,51 @@
 FARPROC16 WINAPI WSASetBlockingHook16(FARPROC16 lpBlockFunc);
 FARPROC32 WINAPI WSASetBlockingHook32(FARPROC32 lpBlockFunc);
 #define   WSASetBlockingHook WINELIB_NAME(WSASetBlockingHook)
-HANDLE16  WINAPI WSAAsyncGetServByName(HWND16 hWnd, UINT16 wMsg,
-                                       LPCSTR name, LPCSTR proto,
-                                       SEGPTR buf, INT16 buflen);
 
-HANDLE16  WINAPI WSAAsyncGetServByPort(HWND16 hWnd, UINT16 wMsg, INT16 port,
-                                       LPCSTR proto, SEGPTR buf, INT16 buflen);
+HANDLE16  WINAPI WSAAsyncGetServByName16(HWND16 hWnd, UINT16 wMsg, LPCSTR name, LPCSTR proto,
+                                         SEGPTR buf, INT16 buflen);
+HANDLE32  WINAPI WSAAsyncGetServByName32(HWND32 hWnd, UINT32 uMsg, LPCSTR name, LPCSTR proto,
+					 LPSTR sbuf, INT32 buflen);
+#define   WSAAsyncGetServByName WINELIB_NAME(WSAAsyncGetServByName)
 
-HANDLE16  WINAPI WSAAsyncGetProtoByName(HWND16 hWnd, UINT16 wMsg,
-                                        LPCSTR name, SEGPTR buf, INT16 buflen);
+HANDLE16  WINAPI WSAAsyncGetServByPort16(HWND16 hWnd, UINT16 wMsg, INT16 port,
+                                         LPCSTR proto, SEGPTR buf, INT16 buflen);
+HANDLE32  WINAPI WSAAsyncGetServByPort32(HWND32 hWnd, UINT32 uMsg, INT32 port,
+					 LPCSTR proto, LPSTR sbuf, INT32 buflen);
+#define   WSAAsyncGetServByPort WINELIB_NAME(WSAAsyncGetServByPort)
 
-HANDLE16  WINAPI WSAAsyncGetProtoByNumber(HWND16 hWnd, UINT16 wMsg,
-                                       INT16 number, SEGPTR buf, INT16 buflen);
+HANDLE16  WINAPI WSAAsyncGetProtoByName16(HWND16 hWnd, UINT16 wMsg,
+                                          LPCSTR name, SEGPTR buf, INT16 buflen);
+HANDLE32  WINAPI WSAAsyncGetProtoByName32(HWND32 hWnd, UINT32 uMsg,
+					  LPCSTR name, LPSTR sbuf, INT32 buflen);
+#define   WSAAsyncGetProtoByByName WINELIB_NAME(WSAAsyncGetProtoByByName)
 
-HANDLE16  WINAPI WSAAsyncGetHostByName(HWND16 hWnd, UINT16 wMsg,
-                                       LPCSTR name, SEGPTR buf, INT16 buflen);
+HANDLE16  WINAPI WSAAsyncGetProtoByNumber16(HWND16 hWnd, UINT16 wMsg,
+                                            INT16 number, SEGPTR buf, INT16 buflen);
+HANDLE32  WINAPI WSAAsyncGetProtoByNumber32(HWND32 hWnd, UINT32 uMsg,
+					    INT32 number, LPSTR sbuf, INT32 buflen);
+#define   WSAAsyncGetProtoByNumber WINELIB_NAME(WSAAsyncGetProtoByNumber)
 
-HANDLE16  WINAPI WSAAsyncGetHostByAddr(HWND16 hWnd, UINT16 wMsg, LPCSTR addr,
+HANDLE16  WINAPI WSAAsyncGetHostByName16(HWND16 hWnd, UINT16 wMsg,
+                                         LPCSTR name, SEGPTR buf, INT16 buflen);
+HANDLE32  WINAPI WSAAsyncGetHostByName32(HWND32 hWnd, UINT32 uMsg,
+					 LPCSTR name, LPSTR sbuf, INT32 buflen);
+#define   WSAAsyncGetHostByName WINELIB_NAME(WSAAsyncGetHostByName)
+
+HANDLE16  WINAPI WSAAsyncGetHostByAddr16(HWND16 hWnd, UINT16 wMsg, LPCSTR addr,
                               INT16 len, INT16 type, SEGPTR buf, INT16 buflen);
-INT16 	  WINAPI WSACancelAsyncRequest(HANDLE16 hAsyncTaskHandle);
-INT16     WINAPI WSAAsyncSelect(SOCKET16 s, HWND16 hWnd, UINT16 wMsg,
-                                UINT32 lEvent);
+HANDLE32  WINAPI WSAAsyncGetHostByAddr32(HWND32 hWnd, UINT32 uMsg, LPCSTR addr,
+			      INT32 len, INT32 type, LPSTR sbuf, INT32 buflen);
+#define   WSAAsyncGetHostByAddr WINELIB_NAME(WSAAsyncGetHostByAddr)
+
+INT16 	  WINAPI WSACancelAsyncRequest16(HANDLE16 hAsyncTaskHandle);
+INT32     WINAPI WSACancelAsyncRequest32(HANDLE32 hAsyncTaskHandle);
+#define   WSACancelAsyncRequest WINELIB_NAME(WSACancelAsyncRequest)
+
+INT16     WINAPI WSAAsyncSelect16(SOCKET16 s, HWND16 hWnd, UINT16 wMsg, UINT32 lEvent);
+INT32     WINAPI WSAAsyncSelect32(SOCKET32 s, HWND32 hWnd, UINT32 uMsg, UINT32 lEvent);
+#define   WSAAsyncSelect WINELIB_NAME(WSAAsyncSelect)
+
 
 #ifdef __cplusplus
 }
@@ -458,12 +498,18 @@
 
   /* custom data */
 
-  HWND16        hWnd;				/* hWnd to post */ 
-  UINT16        uMsg;				/* uMsg message to. */
+  HWND32        hWnd;				/* hWnd to post */ 
+  UINT32        uMsg;				/* uMsg message to. */
 
-  SEGPTR	buffer_base;			/* buffer to copy result to */
-  UINT16        buflen;
-  UINT16	flags;				/* WSMSG_ASYNC_... */
+  union 
+  {
+    SEGPTR seg_base;
+    LPSTR  lin_base;
+    void*  ptr_base;
+  } 		b;				/* buffer to copy result to */
+
+  UINT32        buflen;
+  UINT32	flags;				/* WSMSG_ASYNC_... */
 } ws_async_op;
 
 #define WSMSG_ASYNC_HOSTBYNAME  0x0001
@@ -472,6 +518,7 @@
 #define WSMSG_ASYNC_PROTOBYNUM  0x0020
 #define WSMSG_ASYNC_SERVBYNAME  0x0100
 #define WSMSG_ASYNC_SERVBYPORT  0x0200
+#define WSMSG_ASYNC_WIN32	0x1000
 #define WSMSG_DEAD_AOP		0x8000
 
 typedef struct __sop	/* WSAAsyncSelect() control struct */
@@ -479,8 +526,8 @@
   struct __sop *next, *prev;
 
   struct __ws*  pws;
-  HWND16        hWnd;
-  UINT16        uMsg;
+  HWND32        hWnd;
+  UINT32        uMsg;
 } ws_select_op;
 
 typedef struct	__ws	/* socket */
diff --git a/include/wintypes.h b/include/wintypes.h
index 5092157..a5ab556 100644
--- a/include/wintypes.h
+++ b/include/wintypes.h
@@ -88,6 +88,7 @@
 typedef unsigned int    UINT32;
 typedef unsigned short  WORD;
 typedef unsigned long   DWORD;
+typedef unsigned long   ULONG;
 typedef unsigned char   BYTE;
 typedef long            LONG;
 typedef char            CHAR;
diff --git a/include/x11drv.h b/include/x11drv.h
index da3588f..0db6b86 100644
--- a/include/x11drv.h
+++ b/include/x11drv.h
@@ -14,6 +14,8 @@
 typedef struct
 {
     int          style;
+    int          endcap;
+    int          linejoin;
     int          pixel;
     int          width;
     char *       dashes;