Release 960516

Thu May 16 13:35:31 1996  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [*/*.c]
	Renamed RECT, POINT and SIZE structures to RECT16, POINT16 and
	SIZE16. Implemented Win32 version of most functions that take
	these types as parameters.

	* [configure]
	Patched autoconf to attempt to correctly detect -lnsl and
	-lsocket. Please check this out.
	
	* [controls/button.c]
	Added support for Win32 BM_* messages.

	* [controls/menu.c]
	Avoid sending extra WM_MENUSELECT messages. This avoids crashes
	with Excel.

	* [memory.heap.c] [include/heap.h]
	Added support for SEGPTRs in Win32 heaps. Added a few macros to
 	make using SEGPTRs easier. They are a bit slower than MAKE_SEGPTR,
 	but they work with Win32.

	* [memory/atom.c]
	Implemented Win32 atom functions.

	* [memory/local.c]
	Fixed LocalReAlloc() changes to avoid copying the whole block twice.

	* [win32/memory.c]
	Use /dev/zero instead of MAP_ANON for VirtualAlloc().

	* [windows/class.c]
	Properly implemented the Win32 class functions.

	* [windows/winproc.c] (New file)
	New file handling the message translation between Win16 and Win32.

Mon May 13 18:00:00 1996 Alex Korobka <alex@phm30.pharm.sunysb.edu>

	* [windows/mdi.c] [windows/menu.c]
	Improved WM_MDICREATE and WM_MDICASCADE handling.

	* [windows/event.c] [objects/bitblt.c]
	Handle GraphicsExpose event for BitBlt from screen to screen.

	* [windows/event.c] [windows/win.c] [windows/nonclient.c]
	Bunch of fixes for problems with -managed.

	* [windows/win.c] [windows/winpos.c]
	Changed conditions for WM_SIZE, WM_MOVE, and WM_GETMINMAXINFO
	in CreateWindow.

	* [windows/win.c] [windows/queue.c] [misc/user.c]
	Do not send WM_PARENTNOTIFY when in AppExit and call WH_SHELL
	on window creation/destruction.

	* [objects/palette.c]
	Crude RealizePalette(). At least something is visible in LviewPro.

Sun May 12 02:05:00 1996  Thomas Sandford <t.d.g.sandford@prds-grn.demon.co.uk>

	* [if1632/gdi32.spec]
	Added Rectangle (use win16 version).

	* [if1632/kernel32.spec]
	Added GetWindowsDirectoryA (use win16 GetWindowsDirectory).

	* [if1632/user32.spec]
	Added GetSubMenu, MoveWindow, SetScrollPos, SetScrollRange (use win16
	versions).
	Added SetWindowsHookExA (empty stub for now).

	* [include/handle32.h]
	Changed #include <malloc.h> to #include <stdlib.h> to prevent
	hate message from FreeBSD compiler.

	* [win32/newfns.c]
	Added new function SetWindowsHookEx32A (empty stub for now).

	* [win32/user32.c]
	Removed redundant debugging printf statement.

Sun May 12 01:24:57 1996  Huw D. M. Davies <h.davies1@physics.oxford.ac.uk>

	* [memory/local.c]
	Avoid creating adjacent free blocks.
	Free the block in LocalReAlloc() before allocating a new one.
	Fixed LocalReAlloc() for discarded blocks.
	
Fri May 10 23:05:12 1996  Jukka Iivonen <iivonen@cc.helsinki.fi>

	* [resources/sysres_Fi.rc]
	ChooseFont and ChooseColor dialogs updated.

Fri May 10 17:19:33 1996  Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>

	* [files/drive.c,if1632/kernel.spec]
	GetCurrentDirectory(),SetCurrentDirectory() implemented.

	* [if1632/advapi32.spec] [if1632/kernel.spec] [if1632/shell.spec]
	  [include/windows.h] [include/winreg.h] [loader/main.c]
	  [misc/main.c] [misc/shell.c] [misc/registry.c]
	Registry fixes:
	- loads win95 registry databases,
	- save only updated keys on default,
	- now adhers to the new function naming standard,
	- minor cleanups.

Tue May 7 22:36:13 1996  Albrecht Kleine  <kleine@ak.sax.de>

	* [combo.c]
	Added WM_COMMAND-handling for interaction between EDIT and COMBOLBOX
        and synchronized mine with Greg Kreider's works.

	* [commdlg.c]
	Bugfix in ChooseFont: font size handling.
diff --git a/include/bitmap.h b/include/bitmap.h
index fc07762..5c3b763 100644
--- a/include/bitmap.h
+++ b/include/bitmap.h
@@ -15,7 +15,7 @@
     GDIOBJHDR   header;
     BITMAP      bitmap;
     Pixmap      pixmap;
-    SIZE        size;   /* For SetBitmapDimension() */
+    SIZE16      size;   /* For SetBitmapDimension() */
 } BITMAPOBJ;
 
   /* GCs used for B&W and color bitmap operations */
diff --git a/include/callback.h b/include/callback.h
index 3eb529b..f252007 100644
--- a/include/callback.h
+++ b/include/callback.h
@@ -64,7 +64,7 @@
     CallTo16_long_wwl( func, CURRENT_DS, code, wParam, lParam )
 #define CallTimeFuncProc( func, id, msg, dwUser, dw1, dw2 ) \
     CallTo16_word_wwlll( func, CURRENT_DS, id, msg, dwUser, dw1, dw2 )
-#define CallWndProc( func, ds, hwnd, msg, wParam, lParam ) \
+#define CallWndProc16( func, ds, hwnd, msg, wParam, lParam ) \
     CallTo16_long_wwwl( func, ds, hwnd, msg, wParam, lParam )
 #define CallWordBreakProc( func, lpch, ichCurrent, cch, code ) \
     CallTo16_word_lwww( func, CURRENT_DS, lpch, ichCurrent, cch, code )
@@ -73,9 +73,9 @@
 /* List of the 32-bit callback functions. This list is used  */
 /* by the build program to generate the file if1632/callto32.S */
 
-extern LONG CallTo32_0( FARPROC );
-extern LONG CallTo32_3( FARPROC, DWORD, DWORD, DWORD );
-extern LONG CallTo32_4( FARPROC, DWORD, DWORD, DWORD, DWORD );
+extern LONG CallTo32_0( FARPROC32 );
+extern LONG CallTo32_3( FARPROC32, DWORD, DWORD, DWORD );
+extern LONG CallTo32_4( FARPROC32, DWORD, DWORD, DWORD, DWORD );
 
 #define CallTaskStart32( func ) \
     CallTo32_0( func )
@@ -111,11 +111,14 @@
     (*func)( code, wParam, lParam )
 #define CallTimeFuncProc( func, id, msg, dwUser, dw1, dw2 ) \
     (*func)( id, msg, dwUser, dw1, dw2 )
-#define CallWndProc( func, ds, hwnd, msg, wParam, lParam ) \
+#define CallWndProc16( func, ds, hwnd, msg, wParam, lParam ) \
+    (*func)( hwnd, msg, wParam, lParam )
+#define CallWndProc32( func, hwnd, msg, wParam, lParam ) \
     (*func)( hwnd, msg, wParam, lParam )
 #define CallWordBreakProc( func, lpch, ichCurrent, cch, code ) \
     (*func)( lpch, ichCurrent, cch, code )
 
+
 #endif  /* WINELIB */
 
 
diff --git a/include/class.h b/include/class.h
index f110089..599fb23 100644
--- a/include/class.h
+++ b/include/class.h
@@ -17,22 +17,29 @@
     UINT32           magic;         /* Magic number */
     UINT32           cWindows;      /* Count of existing windows */
     UINT32           style;         /* Class style */
+    UINT32           flags;         /* Class flags (see below) */
     WNDPROC16        lpfnWndProc;   /* 16-bit window procedure */ 
     INT32            cbClsExtra;    /* Class extra bytes */
     INT32            cbWndExtra;    /* Window extra bytes */
-    SEGPTR           lpszMenuName;  /* Default menu name */
-    HANDLE16         hInstance;     /* Module that created the task */
+    LPSTR            menuNameA;     /* Default menu name (ASCII string) */
+    LPWSTR           menuNameW;     /* Default menu name (Unicode) */
+    HINSTANCE32      hInstance;     /* Module that created the task */
     HICON16          hIcon;         /* Default icon */
+    HICON16          hIconSm;       /* Default small icon */
     HCURSOR16        hCursor;       /* Default cursor */
     HBRUSH16         hbrBackground; /* Default background */
     ATOM             atomName;      /* Name of the class */
     HANDLE16         hdce;          /* Class DCE (if CS_CLASSDC) */
-    WORD             wExtra[1];     /* Class extra bytes */
+    LONG             wExtra[1];     /* Class extra bytes */
 } CLASS;
 
+/* Class flags */
+#define CLASS_FLAG_UNICODE  0x0001  /* Window procedure expects Unicode */
+
 extern void CLASS_DumpClass( CLASS *class );
 extern void CLASS_WalkClasses(void);
 extern void CLASS_FreeModuleClasses( HMODULE hModule );
+extern CLASS *CLASS_FindClassByAtom( ATOM atom, HINSTANCE16 hinstance );
 extern CLASS * CLASS_FindClassByName( SEGPTR name, HINSTANCE hinstance );
 
 #endif  /* CLASS_H */
diff --git a/include/color.h b/include/color.h
index 543b4ff..61486d3 100644
--- a/include/color.h
+++ b/include/color.h
@@ -3,7 +3,7 @@
 
 #include "gdi.h"
 
-extern HPALETTE COLOR_Init(void);
+extern HPALETTE16 COLOR_Init(void);
 extern int COLOR_ToPhysical( DC *dc, COLORREF color );
 extern void COLOR_SetMapping( DC *dc, HANDLE map, HANDLE revMap, WORD size );
 extern BOOL COLOR_IsSolid( COLORREF color );
diff --git a/include/combo.h b/include/combo.h
index d89bd6e..0e177f6 100644
--- a/include/combo.h
+++ b/include/combo.h
@@ -4,16 +4,16 @@
 
 
 typedef struct {
-  DWORD dwStyle;
-  DWORD dwState;
-  HWND  hWndEdit;
-  HWND  hWndLBox;
-  WORD  LBoxTop;
-  BOOL  DropDownVisible;
-  short LastSel;
-  RECT  RectEdit;
-  RECT  RectButton;
-  BOOL  bRedrawFlag;
+  DWORD   dwStyle;
+  DWORD   dwState;
+  HWND    hWndEdit;
+  HWND    hWndLBox;
+  WORD    LBoxTop;
+  BOOL    DropDownVisible;
+  short   LastSel;
+  RECT16  RectEdit;
+  RECT16  RectButton;
+  BOOL    bRedrawFlag;
 } HEADCOMBO,*LPHEADCOMBO;
 
 LRESULT ComboBoxWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
diff --git a/include/desktop.h b/include/desktop.h
index ba9876c..5c06635 100644
--- a/include/desktop.h
+++ b/include/desktop.h
@@ -13,7 +13,7 @@
 {
     HBRUSH   hbrushPattern;
     HBITMAP  hbitmapWallPaper;
-    SIZE     bitmapSize;
+    SIZE16   bitmapSize;
     BOOL     fTileWallPaper;
 } DESKTOPINFO;
 
diff --git a/include/font.h b/include/font.h
index 6b2f8c8..8a8dae7 100644
--- a/include/font.h
+++ b/include/font.h
@@ -27,7 +27,7 @@
 {
 	UINT	gmBlackBoxX;
 	UINT	gmBlackBoxY;
-	POINT	gmptGlyphOrigin;
+	POINT16	gmptGlyphOrigin;
 	int	gmCellIncX;
 	int	gmCellIncY;
 } GLYPHMETRICS,*LPGLYPHMETRICS;
diff --git a/include/gdi.h b/include/gdi.h
index 9581bb7..96847b9 100644
--- a/include/gdi.h
+++ b/include/gdi.h
@@ -90,13 +90,13 @@
     HRGN          hClipRgn;     /* Clip region (may be 0) */
     HRGN          hVisRgn;      /* Visible region (must never be 0) */
     HRGN          hGCClipRgn;   /* GC clip region (ClipRgn AND VisRgn) */
-    HPEN          hPen;
+    HPEN16        hPen;
     HBRUSH        hBrush;
     HFONT         hFont;
     HBITMAP       hBitmap;
     HBITMAP       hFirstBitmap; /* Bitmap selected at creation of the DC */
     HANDLE        hDevice;
-    HPALETTE      hPalette;
+    HPALETTE16    hPalette;
 
     WORD          ROPmode;
     WORD          polyFillMode;
@@ -214,15 +214,15 @@
 #define STOCK_BLACK_BRUSH         ((HBRUSH)(FIRST_STOCK_HANDLE+BLACK_BRUSH))
 #define STOCK_NULL_BRUSH          ((HBRUSH)(FIRST_STOCK_HANDLE+NULL_BRUSH))
 #define STOCK_HOLLOW_BRUSH        ((HBRUSH)(FIRST_STOCK_HANDLE+HOLLOW_BRUSH))
-#define STOCK_WHITE_PEN	          ((HPEN)(FIRST_STOCK_HANDLE+WHITE_PEN))
-#define STOCK_BLACK_PEN	          ((HPEN)(FIRST_STOCK_HANDLE+BLACK_PEN))
-#define STOCK_NULL_PEN	          ((HPEN)(FIRST_STOCK_HANDLE+NULL_PEN))
+#define STOCK_WHITE_PEN	          ((HPEN16)(FIRST_STOCK_HANDLE+WHITE_PEN))
+#define STOCK_BLACK_PEN	          ((HPEN16)(FIRST_STOCK_HANDLE+BLACK_PEN))
+#define STOCK_NULL_PEN	          ((HPEN16)(FIRST_STOCK_HANDLE+NULL_PEN))
 #define STOCK_OEM_FIXED_FONT      ((HFONT)(FIRST_STOCK_HANDLE+OEM_FIXED_FONT))
 #define STOCK_ANSI_FIXED_FONT     ((HFONT)(FIRST_STOCK_HANDLE+ANSI_FIXED_FONT))
 #define STOCK_ANSI_VAR_FONT       ((HFONT)(FIRST_STOCK_HANDLE+ANSI_VAR_FONT))
 #define STOCK_SYSTEM_FONT         ((HFONT)(FIRST_STOCK_HANDLE+SYSTEM_FONT))
 #define STOCK_DEVICE_DEFAULT_FONT ((HFONT)(FIRST_STOCK_HANDLE+DEVICE_DEFAULT_FONT))
-#define STOCK_DEFAULT_PALETTE     ((HPALETTE)(FIRST_STOCK_HANDLE+DEFAULT_PALETTE))
+#define STOCK_DEFAULT_PALETTE     ((HPALETTE16)(FIRST_STOCK_HANDLE+DEFAULT_PALETTE))
 #define STOCK_SYSTEM_FIXED_FONT   ((HFONT)(FIRST_STOCK_HANDLE+SYSTEM_FIXED_FONT))
 
 #define FIRST_STOCK_FONT          STOCK_OEM_FIXED_FONT
diff --git a/include/graphics.h b/include/graphics.h
index 2fba422..a9d4423 100644
--- a/include/graphics.h
+++ b/include/graphics.h
@@ -8,7 +8,7 @@
 #ifndef __WINE_GRAPHICS_H
 #define __WINE_GRAPHICS_H
 
-extern void GRAPH_DrawReliefRect( HDC hdc, RECT *rect, int highlight_size,
+extern void GRAPH_DrawReliefRect( HDC hdc, RECT16 *rect, int highlight_size,
                                   int shadow_size, BOOL pressed );
 extern BOOL GRAPH_DrawBitmap( HDC hdc, HBITMAP hbitmap, int xdest, int ydest,
                               int xsrc, int ysrc, int width, int height );
diff --git a/include/handle32.h b/include/handle32.h
index 6ebbaa2..93162cd 100644
--- a/include/handle32.h
+++ b/include/handle32.h
@@ -1,7 +1,7 @@
 #ifndef __WINE_HANDLE32_H
 #define __WINE_HANDLE32_H
 
-#include <malloc.h>
+#include <stdlib.h>
 #include "wintypes.h"
 
 /* The _*_OBJECT structures contain information needed about each
diff --git a/include/heap.h b/include/heap.h
index e541815..ee55f9b 100644
--- a/include/heap.h
+++ b/include/heap.h
@@ -11,5 +11,23 @@
 #include "winnt.h"
 
 extern HANDLE32 SystemHeap;
+extern HANDLE32 SegptrHeap;
+
+extern int HEAP_IsInsideHeap( HANDLE32 heap, DWORD flags, LPCVOID ptr );
+extern SEGPTR HEAP_GetSegptr( HANDLE32 heap, DWORD flags, LPCVOID ptr );
+extern LPSTR HEAP_strdupA( HANDLE32 heap, DWORD flags, LPCSTR str );
+
+/* SEGPTR helper macros */
+
+#define SEGPTR_ALLOC(size) \
+         (HeapAlloc( SegptrHeap, 0, (size) ))
+#define SEGPTR_NEW(type) \
+         ((type *)HeapAlloc( SegptrHeap, 0, sizeof(type) ))
+#define SEGPTR_STRDUP(str) \
+         (HIWORD(str) ? HEAP_strdupA( SegptrHeap, 0, (str) ) : (LPSTR)(str))
+#define SEGPTR_GET(ptr) \
+         (HIWORD(ptr) ? HEAP_GetSegptr( SegptrHeap, 0, (ptr) ) : (SEGPTR)(ptr))
+#define SEGPTR_FREE(ptr) \
+         (HIWORD(ptr) ? HeapFree( SegptrHeap, 0, (ptr) ) : 0)
 
 #endif  /* __WINE_HEAP_H */
diff --git a/include/listbox.h b/include/listbox.h
index ebd9c9e..179badd 100644
--- a/include/listbox.h
+++ b/include/listbox.h
@@ -5,7 +5,7 @@
 typedef struct tagLISTSTRUCT {
         MEASUREITEMSTRUCT mis;
         UINT            itemState;
-        RECT            itemRect;
+        RECT16          itemRect;
 	HANDLE		hData;
 	char            *itemText;
 	struct tagLISTSTRUCT *lpNext;
@@ -60,12 +60,12 @@
 extern int ListBoxSetSel(LPHEADLIST lphl, WORD wIndex, WORD state);
 extern int ListBoxGetSel(LPHEADLIST lphl, WORD wIndex);
 extern LONG ListBoxDirectory(LPHEADLIST lphl, UINT attrib, LPCSTR filespec);
-extern int ListBoxGetItemRect(LPHEADLIST lphl, WORD wIndex, LPRECT rect);
+extern int ListBoxGetItemRect(LPHEADLIST lphl, WORD wIndex, LPRECT16 rect);
 extern int ListBoxSetItemHeight(LPHEADLIST lphl, WORD wIndex, long height);
 extern int ListBoxFindNextMatch(LPHEADLIST lphl, WORD wChar);
 
 extern void ListBoxDrawItem (HWND hwnd, LPHEADLIST lphl, HDC hdc,
-			     LPLISTSTRUCT lpls, RECT *rect, WORD itemAction,
+			     LPLISTSTRUCT lpls, RECT16 *rect, WORD itemAction,
 			     WORD itemState);
 extern int ListBoxFindMouse(LPHEADLIST lphl, int X, int Y);
 extern void ListBoxAskMeasure(LPHEADLIST lphl, LPLISTSTRUCT lpls);
diff --git a/include/mdi.h b/include/mdi.h
index adde0b0..2fac0d8 100644
--- a/include/mdi.h
+++ b/include/mdi.h
@@ -31,17 +31,18 @@
 
 typedef struct 
 {
-    WORD   nActiveChildren;
-    HWND   flagChildMaximized;
-    HWND   hwndActiveChild;
-    HMENU  hWindowMenu;
-    WORD   idFirstChild;
-    HANDLE hFrameTitle;
-    WORD   sbNeedUpdate;
-    WORD   sbRecalc;
-    HBITMAP obmClose;
-    HBITMAP obmRestore;
-    HWND   self;
+    WORD   	nActiveChildren;
+    HWND   	hwndChildMaximized;
+    HWND   	hwndActiveChild;
+    HMENU  	hWindowMenu;
+    WORD   	idFirstChild;
+    WORD	nTotalCreated;
+    HANDLE 	hFrameTitle;
+    WORD   	sbNeedUpdate;
+    WORD   	sbRecalc;
+    HBITMAP 	obmClose;
+    HBITMAP 	obmRestore;
+    HWND   	self;
 } MDICLIENTINFO;
 
 #endif /* MDI_H */
diff --git a/include/menu.h b/include/menu.h
index dabde45..d2e90bf 100644
--- a/include/menu.h
+++ b/include/menu.h
@@ -12,9 +12,9 @@
 extern HMENU MENU_GetDefSysMenu(void);
 extern UINT MENU_GetMenuBarHeight( HWND hwnd, UINT menubarWidth,
 				   int orgX, int orgY );
-extern void MENU_TrackMouseMenuBar( HWND hwnd, POINT pt );
+extern void MENU_TrackMouseMenuBar( HWND hwnd, POINT16 pt );
 extern void MENU_TrackKbdMenuBar( WND*, UINT wParam, INT vkey);
-extern UINT MENU_DrawMenuBar( HDC hDC, LPRECT lprect,
+extern UINT MENU_DrawMenuBar( HDC hDC, LPRECT16 lprect,
 			      HWND hwnd, BOOL suppress_draw );
 extern LRESULT PopupMenuWndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam );
 
@@ -22,7 +22,7 @@
 {
     WORD	item_flags;    /* Item flags */
     UINT	item_id;       /* Item or popup id */
-    RECT	rect;          /* Item area (relative to menu window) */
+    RECT16      rect;          /* Item area (relative to menu window) */
     WORD        xTab;          /* X position of text after Tab */
     HBITMAP	hCheckBit;     /* Bitmap for checked item */
     HBITMAP	hUnCheckBit;   /* Bitmap for unchecked item */
diff --git a/include/metafile.h b/include/metafile.h
index c83afcb..7951832 100644
--- a/include/metafile.h
+++ b/include/metafile.h
@@ -28,10 +28,10 @@
 		   short param6, short param7, short param8);
 BOOL MF_CreateBrushIndirect(DC *dc, HBRUSH hBrush, LOGBRUSH *logbrush);
 BOOL MF_CreatePatternBrush(DC *dc, HBRUSH hBrush, LOGBRUSH *logbrush);
-BOOL MF_CreatePenIndirect(DC *dc, HPEN hPen, LOGPEN *logpen);
+BOOL MF_CreatePenIndirect(DC *dc, HPEN16 hPen, LOGPEN *logpen);
 BOOL MF_CreateFontIndirect(DC *dc, HFONT hFont, LOGFONT *logfont);
-BOOL MF_TextOut(DC *dc, short x, short y, LPSTR str, short count);
-BOOL MF_MetaPoly(DC *dc, short func, LPPOINT pt, short count);
+BOOL MF_TextOut(DC *dc, short x, short y, LPCSTR str, short count);
+BOOL MF_MetaPoly(DC *dc, short func, LPPOINT16 pt, short count);
 BOOL MF_BitBlt(DC *dcDest, short xDest, short yDest, short width,
 	       short height, HDC hdcSrc, short xSrc, short ySrc, DWORD rop);
 BOOL MF_StretchBlt(DC *dcDest, short xDest, short yDest, short widthDest,
diff --git a/include/mmsystem.h b/include/mmsystem.h
index a08d12b..45fb92c 100644
--- a/include/mmsystem.h
+++ b/include/mmsystem.h
@@ -1247,16 +1247,16 @@
 typedef struct {
 	DWORD   dwCallback;
 #ifdef MCI_USE_OFFEXT
-	POINT   ptOffset;
-	POINT   ptExtent;
+	POINT16 ptOffset;
+	POINT16 ptExtent;
 #else   /* ifdef MCI_USE_OFFEXT */
-	RECT    rc;
+	RECT16  rc;
 #endif  /* ifdef MCI_USE_OFFEXT */
 } MCI_ANIM_RECT_PARMS, *LPMCI_ANIM_RECT_PARMS;
 
 typedef struct {
 	DWORD   dwCallback;
-	RECT    rc;
+	RECT16  rc;
 	HDC     hDC;
 } MCI_ANIM_UPDATE_PARMS, *LPMCI_ANIM_UPDATE_PARMS;
 
@@ -1315,23 +1315,23 @@
 typedef struct {
 	DWORD   dwCallback;
 #ifdef MCI_USE_OFFEXT
-	POINT   ptOffset;
-	POINT   ptExtent;
+	POINT16 ptOffset;
+	POINT16 ptExtent;
 #else   /* ifdef MCI_USE_OFFEXT */
-	RECT    rc;
+	RECT16  rc;
 #endif  /* ifdef MCI_USE_OFFEXT */
 } MCI_OVLY_RECT_PARMS, *LPMCI_OVLY_RECT_PARMS;
 
 typedef struct {
 	DWORD   dwCallback;
 	LPCSTR  lpfilename;
-	RECT    rc;
+	RECT16  rc;
 } MCI_OVLY_SAVE_PARMS, *LPMCI_OVLY_SAVE_PARMS;
 
 typedef struct {
 	DWORD   dwCallback;
 	LPCSTR  lpfilename;
-	RECT    rc;
+	RECT16  rc;
 } MCI_OVLY_LOAD_PARMS, *LPMCI_OVLY_LOAD_PARMS;
 
 
diff --git a/include/module.h b/include/module.h
index e6ca763..c867f43 100644
--- a/include/module.h
+++ b/include/module.h
@@ -126,8 +126,8 @@
 extern WORD MODULE_GetOrdinal( HMODULE hModule, const char *name );
 extern SEGPTR MODULE_GetEntryPoint( HMODULE hModule, WORD ordinal );
 extern BOOL MODULE_SetEntryPoint( HMODULE hModule, WORD ordinal, WORD offset );
-extern FARPROC MODULE_GetWndProcEntry16( const char *name );
-extern FARPROC MODULE_GetWndProcEntry32( const char *name );
+extern FARPROC16 MODULE_GetWndProcEntry16( const char *name );
+extern FARPROC32 MODULE_GetWndProcEntry32( const char *name );
 
 /* builtin.c */
 extern BOOL BUILTIN_Init(void);
diff --git a/include/nonclient.h b/include/nonclient.h
index 49fa206..6b4bff1 100644
--- a/include/nonclient.h
+++ b/include/nonclient.h
@@ -9,17 +9,16 @@
 
 #include "win.h"
 
-extern void NC_GetInsideRect( HWND hwnd, RECT *rect );
-extern void NC_GetMinMaxInfo( HWND hwnd, POINT *maxSize, POINT *maxPos,
-                              POINT *minTrack, POINT *maxTrack );
+extern void NC_GetMinMaxInfo( HWND hwnd, POINT16 *maxSize, POINT16 *maxPos,
+                              POINT16 *minTrack, POINT16 *maxTrack );
 extern void NC_DoNCPaint( HWND hwnd, HRGN clip, BOOL suppress_menupaint );
 extern LONG NC_HandleNCPaint( HWND hwnd , HRGN clip);
 extern LONG NC_HandleNCActivate( HWND hwnd, WPARAM wParam );
-extern LONG NC_HandleNCCalcSize( HWND hwnd, NCCALCSIZE_PARAMS *params );
-extern LONG NC_HandleNCHitTest( HWND hwnd, POINT pt );
+extern LONG NC_HandleNCCalcSize( HWND hwnd, NCCALCSIZE_PARAMS16 *params );
+extern LONG NC_HandleNCHitTest( HWND hwnd, POINT16 pt );
 extern LONG NC_HandleNCLButtonDown( HWND hwnd, WPARAM wParam, LPARAM lParam );
 extern LONG NC_HandleNCLButtonDblClk( WND *pWnd, WPARAM wParam, LPARAM lParam);
-extern LONG NC_HandleSysCommand( HWND hwnd, WPARAM wParam, POINT pt );
+extern LONG NC_HandleSysCommand( HWND hwnd, WPARAM wParam, POINT16 pt );
 extern LONG NC_HandleSetCursor( HWND hwnd, WPARAM wParam, LPARAM lParam );
 
 #endif /* __WINE_NONCLIENT_H */
diff --git a/include/ole.h b/include/ole.h
index b920640..9cc310a 100644
--- a/include/ole.h
+++ b/include/ole.h
@@ -159,7 +159,7 @@
 	OLESTATUS	(*Save)(LPOLESERVERDOC);
 	OLESTATUS	(*Close)(LPOLESERVERDOC);
 	OLESTATUS	(*SetHostNames)(LPOLESERVERDOC,OLE_LPCSTR,OLE_LPCSTR);
-	OLESTATUS	(*SetDocDimensions)(LPOLESERVERDOC,LPRECT);
+	OLESTATUS	(*SetDocDimensions)(LPOLESERVERDOC,LPRECT16);
 	OLESTATUS	(*GetObject)(LPOLESERVERDOC,OLE_LPCSTR,LPOLEOBJECT*,LPOLECLIENT);
 	OLESTATUS	(*Release)(LPOLESERVERDOC);
 	OLESTATUS	(*SetColorScheme)(LPOLESERVERDOC,LPLOGPALETTE);
@@ -204,7 +204,7 @@
 	OLESTATUS	(*GetData)(LPOLEOBJECT,OLECLIPFORMAT,HANDLE *);
 	OLESTATUS	(*SetData)(LPOLEOBJECT,OLECLIPFORMAT,HANDLE);
 	OLESTATUS	(*SetTargetDevice)(LPOLEOBJECT,HGLOBAL);
-	OLESTATUS	(*SetBounds)(LPOLEOBJECT,LPRECT);
+	OLESTATUS	(*SetBounds)(LPOLEOBJECT,LPRECT16);
 	OLESTATUS	(*EnumFormats)(LPOLEOBJECT,OLECLIPFORMAT);
 	OLESTATUS	(*SetColorScheme)(LPOLEOBJECT,LPLOGPALETTE);
 	OLESTATUS	(*Delete)(LPOLEOBJECT);
@@ -214,8 +214,8 @@
 	OLESTATUS	(*CopyFromLink)(LPOLEOBJECT,LPOLECLIENT,LHCLIENTDOC,OLE_LPCSTR,LPOLEOBJECT *);
 	OLESTATUS	(*Equal)(LPOLEOBJECT,LPOLEOBJECT);
 	OLESTATUS	(*CopyToClipBoard)(LPOLEOBJECT);
-	OLESTATUS	(*Draw)(LPOLEOBJECT,HDC,LPRECT,LPRECT,HDC);
-	OLESTATUS	(*Activate)(LPOLEOBJECT,UINT,BOOL,BOOL,HWND,LPRECT);
+	OLESTATUS	(*Draw)(LPOLEOBJECT,HDC,LPRECT16,LPRECT16,HDC);
+	OLESTATUS	(*Activate)(LPOLEOBJECT,UINT,BOOL,BOOL,HWND,LPRECT16);
 	OLESTATUS	(*Execute)(LPOLEOBJECT,HGLOBAL,UINT);
 	OLESTATUS	(*Close)(LPOLEOBJECT);
 	OLESTATUS	(*Update)(LPOLEOBJECT);
@@ -226,7 +226,7 @@
 	OLESTATUS	(*Rename)(LPOLEOBJECT,OLE_LPCSTR);
 	OLESTATUS	(*QueryName)(LPOLEOBJECT,LPSTR,LPUINT16);
 	OLESTATUS	(*QueryType)(LPOLEOBJECT,LPLONG);
-	OLESTATUS	(*QueryBounds)(LPOLEOBJECT,LPRECT);
+	OLESTATUS	(*QueryBounds)(LPOLEOBJECT,LPRECT16);
 	OLESTATUS	(*QuerySize)(LPOLEOBJECT,LPDWORD);
 	OLESTATUS	(*QueryOpen)(LPOLEOBJECT);
 	OLESTATUS	(*QueryOutOfDate)(LPOLEOBJECT);
diff --git a/include/pen.h b/include/pen.h
index 1fc160c..7016d24 100644
--- a/include/pen.h
+++ b/include/pen.h
@@ -25,6 +25,6 @@
 #endif
 
 extern int PEN_GetObject( PENOBJ * pen, int count, LPSTR buffer );
-extern HPEN PEN_SelectObject( DC * dc, HPEN hpen, PENOBJ * pen );
+extern HPEN16 PEN_SelectObject( DC * dc, HPEN16 hpen, PENOBJ * pen );
 
 #endif  /* __WINE_PEN_H */
diff --git a/include/regfunc.h b/include/regfunc.h
deleted file mode 100644
index fa91700..0000000
--- a/include/regfunc.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* $Id$
- */
-
-#ifndef REGFUNC_H
-#define REGFUNC_H
-
-#include "wine.h"
-#include "stackframe.h"
-
-#define _CONTEXT ((struct sigcontext_struct *) CURRENT_STACK16->args)
-#define _AX	(_CONTEXT->sc_eax)
-#define _BX	(_CONTEXT->sc_ebx)
-#define _CX	(_CONTEXT->sc_ecx)
-#define _DX	(_CONTEXT->sc_edx)
-#define _SI	(_CONTEXT->sc_esi)
-#define _DI	(_CONTEXT->sc_edi)
-#define _DS	(_CONTEXT->sc_ds)
-#define _ES	(_CONTEXT->sc_es)
-
-extern void ReturnFromRegisterFunc(void);
-
-#endif /* REGFUNC_H */
diff --git a/include/region.h b/include/region.h
index e8f6261..552f5c5 100644
--- a/include/region.h
+++ b/include/region.h
@@ -18,6 +18,6 @@
 
 
 extern BOOL REGION_DeleteObject( HRGN hrgn, RGNOBJ * obj );
-extern BOOL REGION_FrameRgn(HRGN dest,HRGN src,int x,int y);
+extern BOOL REGION_FrameRgn( HRGN dest, HRGN src, INT32 x, INT32 y );
 
 #endif  /* __WINE_REGION_H */
diff --git a/include/relay32.h b/include/relay32.h
deleted file mode 100644
index 1eb2692..0000000
--- a/include/relay32.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Relay32 definitions
- *
- * Copyright 1995 Martin von Loewis
- */
-
-#ifndef __WINE_RELAY32_H
-#define __WINE_RELAY32_H
-
-#include "struct32.h"
-
-typedef struct tagWNDCLASSA{
-	UINT	style;
-	WNDPROC	lpfnWndProc;
-	int		cbClsExtra;
-	int		cbWndExtra;
-	DWORD	hInstance;
-	DWORD	hIcon;
-	DWORD	hCursor;
-	DWORD	hbrBackground;
-	char*	lpszMenuName;
-	char*	lpszClassName;
-}WNDCLASSA;
-
-ATOM USER32_RegisterClassA(WNDCLASSA *);
-LRESULT USER32_DefWindowProcA(DWORD hwnd,DWORD msg,DWORD wParam,DWORD lParam);
-BOOL USER32_GetMessageA(MSG32* lpmsg,DWORD hwnd,DWORD min,DWORD max);
-HDC USER32_BeginPaint(DWORD hwnd,PAINTSTRUCT32 *lpps);
-BOOL USER32_EndPaint(DWORD hwnd,PAINTSTRUCT32 *lpps);
-#endif
-
diff --git a/include/scroll.h b/include/scroll.h
index 681d4d1..8445a97 100644
--- a/include/scroll.h
+++ b/include/scroll.h
@@ -22,6 +22,6 @@
 extern LONG ScrollBarWndProc( HWND hwnd, WORD uMsg, WORD wParam, LONG lParam );
 extern void SCROLL_DrawScrollBar( HWND hwnd, HDC hdc, int nBar );
 extern void SCROLL_HandleScrollEvent( HWND hwnd, int nBar,
-                                      WORD msg, POINT pt);       /* scroll.c */
+                                      WORD msg, POINT16 pt );
 
 #endif  /* SCROLL_H */
diff --git a/include/shell.h b/include/shell.h
index d28caba..045d2a0 100644
--- a/include/shell.h
+++ b/include/shell.h
@@ -26,7 +26,7 @@
 
 typedef struct { 	   /* structure for dropped files */ 
 	WORD		wSize;
-	POINT		ptMousePos;   
+	POINT16		ptMousePos;   
 	BOOL		fInNonClientArea;
 	/* memory block with filenames follows */     
 } DROPFILESTRUCT, *LPDROPFILESTRUCT; 
diff --git a/include/string32.h b/include/string32.h
index eaadefd..1431a59 100644
--- a/include/string32.h
+++ b/include/string32.h
@@ -15,6 +15,7 @@
 void	STRING32_AnsiToUni(LPWSTR dest,LPCSTR src);
 LPSTR	STRING32_DupUniToAnsi(LPCWSTR src);
 LPWSTR	STRING32_DupAnsiToUni(LPCSTR src);
+LPWSTR  STRING32_lstrcpyW(LPWSTR dst, LPCWSTR src);
 int	STRING32_lstrcmpnW(LPCWSTR a,LPCWSTR b,DWORD len);
 int	STRING32_lstrcmpniW(LPCWSTR a,LPCWSTR b,DWORD len);
 DWORD	STRING32_lstrlenW(LPCWSTR);
diff --git a/include/struct32.h b/include/struct32.h
index ea5b75b..a1c1e36 100644
--- a/include/struct32.h
+++ b/include/struct32.h
@@ -7,44 +7,23 @@
 #pragma pack(1)
 #endif
 
-typedef struct tagRECT32
-{
-	LONG left;
-	LONG top;
-	LONG right;
-	LONG bottom;
-} RECT32;
+void STRUCT32_RECT32to16(const RECT32*,RECT16*);
+void STRUCT32_RECT16to32(const RECT16*,RECT32*);
+void STRUCT32_POINT32to16(const POINT32*,POINT16*);
+void STRUCT32_POINT16to32(const POINT16*,POINT32*);
+void STRUCT32_SIZE16to32(const SIZE16*, SIZE32*);
 
-void STRUCT32_RECT32to16(const RECT32*,RECT*);
-void STRUCT32_RECT16to32(const RECT*,RECT32*);
+extern void STRUCT32_MINMAXINFO32to16( const MINMAXINFO32*, MINMAXINFO16* );
+extern void STRUCT32_MINMAXINFO16to32( const MINMAXINFO16*, MINMAXINFO32* );
+extern void STRUCT32_WINDOWPOS32to16( const WINDOWPOS32*, WINDOWPOS16* );
+extern void STRUCT32_WINDOWPOS16to32( const WINDOWPOS16*, WINDOWPOS32* );
+extern void STRUCT32_NCCALCSIZE32to16Flat( const NCCALCSIZE_PARAMS32 *from,
+                                           NCCALCSIZE_PARAMS16 *to,
+                                           int validRects );
+extern void STRUCT32_NCCALCSIZE16to32Flat( const NCCALCSIZE_PARAMS16* from,
+                                           NCCALCSIZE_PARAMS32* to,
+                                           int validRects );
 
-typedef struct tagPOINT32
-{
-	LONG x;
-	LONG y;
-} POINT32;
-
-typedef struct tagSIZE32
-{
-        LONG cx;
-        LONG cy;
-} SIZE32;
-  
-void STRUCT32_POINT32to16(const POINT32*,POINT*);
-void STRUCT32_POINT16to32(const POINT*,POINT32*);
-void STRUCT32_SIZE16to32(const SIZE* p16, SIZE32* p32);
-
-typedef struct tagMINMAXINFO32
-{
-	POINT32 ptReserved;
-	POINT32 ptMaxSize;
-	POINT32 ptMaxPosition;
-	POINT32 ptMinTrackSize;
-	POINT32 ptMaxTrackSize;
-} MINMAXINFO32;
-
-void STRUCT32_MINMAXINFO32to16(const MINMAXINFO32*,MINMAXINFO*);
-void STRUCT32_MINMAXINFO16to32(const MINMAXINFO*,MINMAXINFO32*);
 
 typedef struct {
 	DWORD style;
@@ -79,60 +58,8 @@
 void STRUCT32_MSG16to32(MSG *msg16,MSG32 *msg32);
 void STRUCT32_MSG32to16(MSG32 *msg32,MSG *msg16);
 
-typedef struct tagPAINTSTRUCT32
-{
-	DWORD hdc;
-	DWORD fErase;
-	RECT32 rcPaint;
-	DWORD fRestore;
-	DWORD fIncUpdate;
-	BYTE rgbReserved[32];
-} PAINTSTRUCT32;
-
-typedef struct tagWINDOWPOS32
-{
-	DWORD	hwnd;
-	DWORD	hwndInsertAfter;
-	LONG	x;
-	LONG	y;
-	LONG	cx;
-	LONG	cy;
-	DWORD	flags;
-} WINDOWPOS32;
-
-void STRUCT32_WINDOWPOS32to16(const WINDOWPOS32*,WINDOWPOS*);
-void STRUCT32_WINDOWPOS16to32(const WINDOWPOS*,WINDOWPOS32*);
-
-typedef struct tagNCCALCSIZE_PARAMS32
-{
-	RECT32	rgrc[3];
-	WINDOWPOS32	*lppos;
-} NCCALCSIZE_PARAMS32;
-
-void STRUCT32_NCCALCSIZE32to16Flat(const NCCALCSIZE_PARAMS32*,
-	NCCALCSIZE_PARAMS*);
-void STRUCT32_NCCALCSIZE16to32Flat(const NCCALCSIZE_PARAMS* from,
-	NCCALCSIZE_PARAMS32* to);
-
-typedef struct tagCREATESTRUCT32
-{
-	DWORD	lpCreateParams;
-	DWORD	hInstance;
-	DWORD	hMenu;
-	DWORD	hwndParent;
-	LONG	cy;
-	LONG	cx;
-	LONG	y;
-	LONG	x;
-	LONG	style;
-	LPSTR	lpszName;
-	LPSTR	lpszClass;
-	DWORD	dwExStyle;
-} CREATESTRUCT32;
-typedef CREATESTRUCT32	CREATESTRUCTA;
-
-void STRUCT32_CREATESTRUCT32to16(const CREATESTRUCT32*,CREATESTRUCT*);
-void STRUCT32_CREATESTRUCT16to32(const CREATESTRUCT*,CREATESTRUCT32*);
+void STRUCT32_CREATESTRUCT32Ato16(const CREATESTRUCT32A*,CREATESTRUCT16*);
+void STRUCT32_CREATESTRUCT16to32A(const CREATESTRUCT16*,CREATESTRUCT32A*);
 
 typedef struct {
 	BYTE   bWidth;
diff --git a/include/syscolor.h b/include/syscolor.h
index e5441ce..c1f75c7 100644
--- a/include/syscolor.h
+++ b/include/syscolor.h
@@ -17,9 +17,9 @@
     HBRUSH hbrushInactiveCaption;  /* COLOR_INACTIVECAPTION     */
     HBRUSH hbrushMenu;             /* COLOR_MENU                */
     HBRUSH hbrushWindow;           /* COLOR_WINDOW              */
-    HPEN hpenWindowFrame;          /* COLOR_WINDOWFRAME         */
+    HPEN16 hpenWindowFrame;        /* COLOR_WINDOWFRAME         */
                                    /* COLOR_MENUTEXT            */
-    HPEN hpenWindowText;           /* COLOR_WINDOWTEXT          */
+    HPEN16 hpenWindowText;         /* COLOR_WINDOWTEXT          */
                                    /* COLOR_CAPTIONTEXT         */
     HBRUSH hbrushActiveBorder;     /* COLOR_ACTIVEBORDER        */
     HBRUSH hbrushInactiveBorder;   /* COLOR_INACTIVEBORDER      */
diff --git a/include/win.h b/include/win.h
index 9738880..6e5ec44 100644
--- a/include/win.h
+++ b/include/win.h
@@ -22,7 +22,7 @@
 #define ICONTITLE_CLASS_NAME "#32772"  /* IconTitle */
 
 #define POPUPMENU_CLASS_ATOM MAKEINTATOM(32768)  /* PopupMenu */
-#define DESKTOP_CLASS_ATOM   MAKEINTATOM(32769)  /* Desktop */
+#define DESKTOP_CLASS_ATOM   ((ATOM)32769)       /* Desktop */
 #define DIALOG_CLASS_ATOM    MAKEINTATOM(32770)  /* Dialog */
 #define WINSWITCH_CLASS_ATOM MAKEINTATOM(32771)  /* WinSwitch */
 #define ICONTITLE_CLASS_ATOM MAKEINTATOM(32772)  /* IconTitle */
@@ -35,13 +35,13 @@
     struct tagWND *owner;         /* Window owner */
     CLASS         *class;         /* Window class */
     DWORD          dwMagic;       /* Magic number (must be WND_MAGIC) */
-    HWND           hwndSelf;      /* Handle of this window */
-    HANDLE         hInstance;     /* Window hInstance (from CreateWindow) */
-    RECT           rectClient;    /* Client area rel. to parent client area */
-    RECT           rectWindow;    /* Whole window rel. to parent client area */
-    RECT           rectNormal;    /* Window rect. when in normal state */
-    POINT          ptIconPos;     /* Icon position */
-    POINT          ptMaxPos;      /* Maximized window position */
+    HWND16         hwndSelf;      /* Handle of this window */
+    HINSTANCE16    hInstance;     /* Window hInstance (from CreateWindow) */
+    RECT16         rectClient;    /* Client area rel. to parent client area */
+    RECT16         rectWindow;    /* Whole window rel. to parent client area */
+    RECT16         rectNormal;    /* Window rect. when in normal state */
+    POINT16        ptIconPos;     /* Icon position */
+    POINT16        ptMaxPos;      /* Maximized window position */
     HGLOBAL        hmemTaskQ;     /* Task queue global memory handle */
     HRGN           hrgnUpdate;    /* Update region */
     HWND           hwndLastActive;/* Last active popup hwnd */
@@ -57,7 +57,7 @@
     Window         window;        /* X window (only for top-level windows) */
     HMENU          hSysMenu;      /* window's copy of System Menu */
     HANDLE         hProp;         /* Handle of Properties List */
-    WORD           wExtra[1];     /* Window extra bytes */
+    DWORD          wExtra[1];     /* Window extra bytes */
 } WND;
 
   /* WND flags values */
@@ -67,9 +67,10 @@
 #define WIN_RESTORE_MAX        0x0008 /* Maximize when restoring */
 #define WIN_INTERNAL_PAINT     0x0010 /* Internal WM_PAINT message pending */
 #define WIN_NO_REDRAW          0x0020 /* WM_SETREDRAW called for this window */
-#define WIN_GOT_SIZEMSG        0x0040 /* WM_SIZE has been sent to the window */
+#define WIN_NEED_SIZE          0x0040 /* Internal WM_SIZE is needed */
 #define WIN_NCACTIVATED        0x0080 /* last WM_NCACTIVATE was positive */
 #define WIN_MANAGED            0x0100 /* Window managed by the X wm */
+#define WIN_UNICODE            0x0200 /* Window procedure expects Unicode */
 
   /* Window functions */
 extern WND *WIN_FindWndPtr( HWND hwnd );
diff --git a/include/winbase.h b/include/winbase.h
index 0eb05f5..487eeee 100644
--- a/include/winbase.h
+++ b/include/winbase.h
@@ -119,7 +119,7 @@
 #define GMEM_FIXED          0x0000
 #define GMEM_MOVEABLE 	    0x0002
 
-HACCEL LoadAcceleratorsA(   HINSTANCE, const char *);
+HACCEL32 LoadAcceleratorsA(   HINSTANCE, const char *);
 #define FreeModule(hLibModule) FreeLibrary((hLibModule))
 #define MakeProcInstance(lpProc,hInstance) (lpProc)
 #define FreeProcInstance(lpProc) (lpProc)
diff --git a/include/windows.h b/include/windows.h
index d48cd6b..a078710 100644
--- a/include/windows.h
+++ b/include/windows.h
@@ -10,20 +10,83 @@
 #pragma pack(1)
 #endif
 
-#ifndef WINELIB32
-#define MAKEPOINT(l) (*((POINT *)&(l)))
-#endif
-typedef struct { INT cx,cy; } SIZE, *LPSIZE;
-typedef struct { INT x,y; } POINT, *PPOINT, *NPPOINT, *LPPOINT;
-typedef struct { INT left, top, right, bottom; } RECT, *LPRECT;
+/* The SIZE structure */
 
-#ifdef WINELIB32
-#define MAKEWPARAM(low, high) ((LONG)(((WORD)(low)) | \
-			      (((DWORD)((WORD)(high))) << 16)))
+typedef struct
+{
+    INT16  cx;
+    INT16  cy;
+} SIZE16, *LPSIZE16;
+
+typedef struct
+{
+    INT32  cx;
+    INT32  cy;
+} SIZE32, *LPSIZE32;
+
+DECL_WINELIB_TYPE(SIZE);
+DECL_WINELIB_TYPE(LPSIZE);
+
+#define CONV_SIZE16TO32(s16,s32) \
+            ((s32)->cx = (INT32)(s16)->cx, (s32)->cy = (INT32)(s16)->cy)
+#define CONV_SIZE32TO16(s32,s16) \
+            ((s16)->cx = (INT16)(s32)->cx, (s16)->cy = (INT16)(s32)->cy)
+
+/* The POINT structure */
+
+typedef struct
+{
+    INT16  x;
+    INT16  y;
+} POINT16, *LPPOINT16;
+
+typedef struct
+{
+    INT32  x;
+    INT32  y;
+} POINT32, *LPPOINT32;
+
+DECL_WINELIB_TYPE(POINT);
+DECL_WINELIB_TYPE(LPPOINT);
+
+#define CONV_POINT16TO32(p16,p32) \
+            ((p32)->x = (INT32)(p16)->x, (p32)->y = (INT32)(p16)->y)
+#define CONV_POINT32TO16(p32,p16) \
+            ((p16)->x = (INT16)(p32)->x, (p16)->y = (INT16)(p32)->y)
+
+#define MAKEPOINT16(l) (*((POINT16 *)&(l)))
+#ifdef WINELIB16
+#define MAKEPOINT(l)  MAKEPOINT16(l)
 #endif
 
-#define MAKELPARAM(low, high) ((LONG)(((WORD)(low)) | \
-			      (((DWORD)((WORD)(high))) << 16)))
+/* The RECT structure */
+
+typedef struct
+{
+    INT16  left;
+    INT16  top;
+    INT16  right;
+    INT16  bottom;
+} RECT16, *LPRECT16;
+
+typedef struct
+{
+    INT32  left;
+    INT32  top;
+    INT32  right;
+    INT32  bottom;
+} RECT32, *LPRECT32;
+
+DECL_WINELIB_TYPE(RECT);
+DECL_WINELIB_TYPE(LPRECT);
+
+#define CONV_RECT16TO32(r16,r32) \
+    ((r32)->left  = (INT32)(r16)->left,  (r32)->top    = (INT32)(r16)->top, \
+     (r32)->right = (INT32)(r16)->right, (r32)->bottom = (INT32)(r16)->bottom)
+#define CONV_RECT32TO16(r32,r16) \
+    ((r16)->left  = (INT16)(r32)->left,  (r16)->top    = (INT16)(r32)->top, \
+     (r16)->right = (INT16)(r32)->right, (r16)->bottom = (INT16)(r32)->bottom)
+
 
 typedef struct tagKERNINGPAIR {
         WORD wFirst;
@@ -31,34 +94,82 @@
         INT  iKernAmount;
 } KERNINGPAIR, *LPKERNINGPAIR;
 
-typedef struct {
-	HDC hdc;
-	BOOL	fErase;
-	RECT	rcPaint;
-	BOOL	fRestore, fIncUpdate;
-	BYTE	rgbReserved[16];
-} PAINTSTRUCT;
+typedef struct
+{
+    HDC16   hdc;
+    BOOL16  fErase;
+    RECT16  rcPaint;
+    BOOL16  fRestore;
+    BOOL16  fIncUpdate;
+    BYTE    rgbReserved[16];
+} PAINTSTRUCT16, *LPPAINTSTRUCT16;
 
-typedef PAINTSTRUCT *PPAINTSTRUCT;
-typedef PAINTSTRUCT *NPPAINTSTRUCT;
-typedef PAINTSTRUCT *LPPAINTSTRUCT;
+typedef struct
+{
+    HDC32   hdc;
+    BOOL32  fErase;
+    RECT32  rcPaint;
+    BOOL32  fRestore;
+    BOOL32  fIncUpdate;
+    BYTE    rgbReserved[32];
+} PAINTSTRUCT32, *LPPAINTSTRUCT32;
+
+DECL_WINELIB_TYPE(PAINTSTRUCT);
+DECL_WINELIB_TYPE(LPPAINTSTRUCT);
+
 
   /* Windows */
 
-typedef struct {
-    LPVOID    lpCreateParams;
-    HINSTANCE hInstance;
-    HMENU     hMenu;
-    HWND      hwndParent;
-    INT	      cy;
-    INT       cx;
-    INT       y;
-    INT       x;
-    LONG      style WINE_PACKED;
-    SEGPTR    lpszName WINE_PACKED;
-    SEGPTR    lpszClass WINE_PACKED;
-    DWORD     dwExStyle WINE_PACKED;
-} CREATESTRUCT, *LPCREATESTRUCT;
+typedef struct
+{
+    LPVOID      lpCreateParams;
+    HINSTANCE16 hInstance;
+    HMENU16     hMenu;
+    HWND16      hwndParent;
+    INT16       cy;
+    INT16       cx;
+    INT16       y;
+    INT16       x;
+    LONG        style WINE_PACKED;
+    SEGPTR      lpszName WINE_PACKED;
+    SEGPTR      lpszClass WINE_PACKED;
+    DWORD       dwExStyle WINE_PACKED;
+} CREATESTRUCT16, *LPCREATESTRUCT16;
+
+typedef struct
+{
+    LPVOID      lpCreateParams;
+    HINSTANCE32 hInstance;
+    HMENU32     hMenu;
+    HWND32      hwndParent;
+    INT32       cy;
+    INT32       cx;
+    INT32       y;
+    INT32       x;
+    LONG        style;
+    LPCSTR      lpszName;
+    LPCSTR      lpszClass;
+    DWORD       dwExStyle;
+} CREATESTRUCT32A, *LPCREATESTRUCT32A;
+
+typedef struct
+{
+    LPVOID      lpCreateParams;
+    HINSTANCE32 hInstance;
+    HMENU32     hMenu;
+    HWND32      hwndParent;
+    INT32       cy;
+    INT32       cx;
+    INT32       y;
+    INT32       x;
+    LONG        style;
+    LPCWSTR     lpszName;
+    LPCWSTR     lpszClass;
+    DWORD       dwExStyle;
+} CREATESTRUCT32W, *LPCREATESTRUCT32W;
+
+DECL_WINELIB_TYPE_AW(CREATESTRUCT);
+DECL_WINELIB_TYPE_AW(LPCREATESTRUCT);
 
 typedef struct 
 {
@@ -104,12 +215,23 @@
   /* WM_GETMINMAXINFO struct */
 typedef struct
 {
-    POINT   ptReserved;
-    POINT   ptMaxSize;
-    POINT   ptMaxPosition;
-    POINT   ptMinTrackSize;
-    POINT   ptMaxTrackSize;
-} MINMAXINFO;
+    POINT16   ptReserved;
+    POINT16   ptMaxSize;
+    POINT16   ptMaxPosition;
+    POINT16   ptMinTrackSize;
+    POINT16   ptMaxTrackSize;
+} MINMAXINFO16;
+
+typedef struct
+{
+    POINT32   ptReserved;
+    POINT32   ptMaxSize;
+    POINT32   ptMaxPosition;
+    POINT32   ptMinTrackSize;
+    POINT32   ptMaxTrackSize;
+} MINMAXINFO32;
+
+DECL_WINELIB_TYPE(MINMAXINFO);
 
   /* RedrawWindow() flags */
 #define RDW_INVALIDATE       0x0001
@@ -128,25 +250,51 @@
   /* WM_WINDOWPOSCHANGING/CHANGED struct */
 typedef struct
 {
-    HWND    hwnd;
-    HWND    hwndInsertAfter;
-    INT     x;
-    INT     y;
-    INT     cx;
-    INT     cy;
-    UINT    flags;
-} WINDOWPOS;
+    HWND16  hwnd;
+    HWND16  hwndInsertAfter;
+    INT16   x;
+    INT16   y;
+    INT16   cx;
+    INT16   cy;
+    UINT16  flags;
+} WINDOWPOS16;
+
+typedef struct
+{
+    HWND32  hwnd;
+    HWND32  hwndInsertAfter;
+    INT32   x;
+    INT32   y;
+    INT32   cx;
+    INT32   cy;
+    UINT32  flags;
+} WINDOWPOS32;
+
+DECL_WINELIB_TYPE(WINDOWPOS);
 
   /* SetWindowPlacement() struct */
 typedef struct
 {
-    UINT   length;
-    UINT   flags;
-    UINT   showCmd;
-    POINT  ptMinPosition WINE_PACKED;
-    POINT  ptMaxPosition WINE_PACKED;
-    RECT   rcNormalPosition WINE_PACKED;
-} WINDOWPLACEMENT, *LPWINDOWPLACEMENT;
+    UINT16   length;
+    UINT16   flags;
+    UINT16   showCmd;
+    POINT16  ptMinPosition WINE_PACKED;
+    POINT16  ptMaxPosition WINE_PACKED;
+    RECT16   rcNormalPosition WINE_PACKED;
+} WINDOWPLACEMENT16, *LPWINDOWPLACEMENT16;
+
+typedef struct
+{
+    UINT32   length;
+    UINT32   flags;
+    UINT32   showCmd;
+    POINT32  ptMinPosition WINE_PACKED;
+    POINT32  ptMaxPosition WINE_PACKED;
+    RECT32   rcNormalPosition WINE_PACKED;
+} WINDOWPLACEMENT32, *LPWINDOWPLACEMENT32;
+
+DECL_WINELIB_TYPE(WINDOWPLACEMENT);
+DECL_WINELIB_TYPE(LPWINDOWPLACEMENT);
 
   /* WINDOWPLACEMENT flags */
 #define WPF_SETMINPOSITION      0x0001
@@ -166,9 +314,18 @@
   /* WM_NCCALCSIZE parameter structure */
 typedef struct
 {
-    RECT    rgrc[3];
+    RECT16  rgrc[3];
     SEGPTR  lppos;
-} NCCALCSIZE_PARAMS;
+} NCCALCSIZE_PARAMS16, *LPNCCALCSIZE_PARAMS16;
+
+typedef struct
+{
+    RECT32       rgrc[3];
+    WINDOWPOS32 *lppos;
+} NCCALCSIZE_PARAMS32, *LPNCCALCSIZE_PARAMS32;
+
+DECL_WINELIB_TYPE(NCCALCSIZE_PARAMS);
+DECL_WINELIB_TYPE(LPNCCALCSIZE_PARAMS);
 
   /* WM_NCCALCSIZE return flags */
 #define WVR_ALIGNTOP        0x0010
@@ -275,8 +432,8 @@
   /* Mouse hook structure */
 typedef struct tagMOUSEHOOKSTRUCT
 {
-    POINT   pt;
-    HWND    hwnd;
+    POINT16 pt;
+    HWND16  hwnd;
     WORD    wHitTestCode;
     DWORD   dwExtraInfo;
 } MOUSEHOOKSTRUCT, *LPMOUSEHOOKSTRUCT;
@@ -305,8 +462,8 @@
   /* CBT hook structures */
 typedef struct tagCBT_CREATEWND
 {
-    CREATESTRUCT *lpcs;
-    HWND          hwndInsertAfter;
+    CREATESTRUCT16 *lpcs;
+    HWND            hwndInsertAfter;
 } CBT_CREATEWND, *LPCBT_CREATEWND;
 
 typedef struct tagCBTACTIVATESTRUCT
@@ -375,12 +532,12 @@
 
 typedef struct tagMSG
 {
-  HWND    hwnd;
-  UINT    message;
-  WPARAM  wParam;
-  LPARAM  lParam WINE_PACKED;
-  DWORD   time WINE_PACKED;
-  POINT	  pt WINE_PACKED;
+  HWND16    hwnd;
+  UINT16    message;
+  WPARAM16  wParam;
+  LPARAM    lParam WINE_PACKED;
+  DWORD     time WINE_PACKED;
+  POINT16   pt WINE_PACKED;
 } MSG, *LPMSG;
 	
 #define MAKEINTATOM(i)   ((SEGPTR)MAKELONG((i),0))
@@ -681,7 +838,7 @@
 typedef struct tagLOGPEN
 {
     WORD     lopnStyle; 
-    POINT    lopnWidth WINE_PACKED;
+    POINT16  lopnWidth WINE_PACKED;
     COLORREF lopnColor WINE_PACKED;
 } LOGPEN, *PLOGPEN, *NPLOGPEN, *LPLOGPEN;
 
@@ -979,7 +1136,7 @@
 
 typedef struct
 {
-    POINT   ptHotSpot;
+    POINT16 ptHotSpot;
     WORD    nWidth;
     WORD    nHeight;
     WORD    nWidthBytes;
@@ -1398,7 +1555,7 @@
 	WORD	wFlags;
 	HANDLE  hList;
 	HANDLE  hOfStruct;
-	POINT	pt WINE_PACKED;
+	POINT16 pt WINE_PACKED;
 	LONG	l  WINE_PACKED;
 } DRAGINFO, *LPDRAGINFO;
 
@@ -1853,12 +2010,33 @@
 #define BS_OWNERDRAW           0x0000000BL
 #define BS_LEFTTEXT            0x00000020L
 
-/* Button control messages */
-#define BM_GETCHECK            (WM_USER+0)
-#define BM_SETCHECK            (WM_USER+1)
-#define BM_GETSTATE            (WM_USER+2)
-#define BM_SETSTATE            (WM_USER+3)
-#define BM_SETSTYLE            (WM_USER+4)
+/* Win16 button control messages */
+#define BM_GETCHECK16          (WM_USER+0)
+#define BM_SETCHECK16          (WM_USER+1)
+#define BM_GETSTATE16          (WM_USER+2)
+#define BM_SETSTATE16          (WM_USER+3)
+#define BM_SETSTYLE16          (WM_USER+4)
+#define BM_CLICK16             WM_NULL  /* Does not exist in Win16 */
+#define BM_GETIMAGE16          WM_NULL  /* Does not exist in Win16 */
+#define BM_SETIMAGE16          WM_NULL  /* Does not exist in Win16 */
+/* Win32 button control messages */
+#define BM_GETCHECK32          0x00f0
+#define BM_SETCHECK32          0x00f1
+#define BM_GETSTATE32          0x00f2
+#define BM_SETSTATE32          0x00f3
+#define BM_SETSTYLE32          0x00f4
+#define BM_CLICK32             0x00f5
+#define BM_GETIMAGE32          0x00f6
+#define BM_SETIMAGE32          0x00f7
+/* Winelib button control messages */
+#define BM_GETCHECK            WINELIB_NAME(BM_GETCHECK)
+#define BM_SETCHECK            WINELIB_NAME(BM_SETCHECK)
+#define BM_GETSTATE            WINELIB_NAME(BM_GETSTATE)
+#define BM_SETSTATE            WINELIB_NAME(BM_SETSTATE)
+#define BM_SETSTYLE            WINELIB_NAME(BM_SETSTYLE)
+#define BM_CLICK               WINELIB_NAME(BM_CLICK)
+#define BM_GETIMAGE            WINELIB_NAME(BM_GETIMAGE)
+#define BM_SETIMAGE            WINELIB_NAME(BM_SETIMAGE)
 
 /* Button notification codes */
 #define BN_CLICKED             0
@@ -2143,16 +2321,33 @@
 
 typedef struct
 {
-    UINT        CtlType;
-    UINT        CtlID;
-    UINT        itemID;
-    UINT        itemAction;
-    UINT        itemState;
-    HWND        hwndItem;
-    HDC         hDC;
-    RECT        rcItem WINE_PACKED;
+    UINT16      CtlType;
+    UINT16      CtlID;
+    UINT16      itemID;
+    UINT16      itemAction;
+    UINT16      itemState;
+    HWND16      hwndItem;
+    HDC16       hDC;
+    RECT16      rcItem WINE_PACKED;
     DWORD       itemData WINE_PACKED;
-} DRAWITEMSTRUCT, *PDRAWITEMSTRUCT, *LPDRAWITEMSTRUCT;
+} DRAWITEMSTRUCT16, *PDRAWITEMSTRUCT16, *LPDRAWITEMSTRUCT16;
+
+typedef struct
+{
+    UINT32      CtlType;
+    UINT32      CtlID;
+    UINT32      itemID;
+    UINT32      itemAction;
+    UINT32      itemState;
+    HWND32      hwndItem;
+    HDC32       hDC;
+    RECT32      rcItem WINE_PACKED;
+    DWORD       itemData WINE_PACKED;
+} DRAWITEMSTRUCT32, *PDRAWITEMSTRUCT32, *LPDRAWITEMSTRUCT32;
+
+DECL_WINELIB_TYPE(DRAWITEMSTRUCT);
+DECL_WINELIB_TYPE(PDRAWITEMSTRUCT);
+DECL_WINELIB_TYPE(LPDRAWITEMSTRUCT);
 
 typedef struct
 {
@@ -2600,17 +2795,16 @@
 #pragma pack(4)
 #endif
 
+
 INT        AccessResource(HINSTANCE,HRSRC);
 ATOM       AddAtom(SEGPTR);
 INT        AddFontResource(LPCSTR);
-BOOL       AdjustWindowRect(LPRECT,DWORD,BOOL);
-BOOL       AdjustWindowRectEx(LPRECT,DWORD,BOOL,DWORD);
 WORD       AllocCStoDSAlias(WORD);
 WORD       AllocDStoCSAlias(WORD);
 HGLOBAL    AllocResource(HINSTANCE,HRSRC,DWORD);
 WORD       AllocSelector(WORD);
 WORD       AllocSelectorArray(WORD);
-BOOL       AnimatePalette(HPALETTE,UINT,UINT,LPPALETTEENTRY);
+BOOL       AnimatePalette(HPALETTE16,UINT,UINT,LPPALETTEENTRY);
 LPSTR      AnsiLower(LPSTR);
 UINT       AnsiLowerBuff(LPSTR,UINT);
 SEGPTR     AnsiNext(SEGPTR);
@@ -2623,15 +2817,13 @@
 BOOL       AppendMenu(HMENU,UINT,UINT,SEGPTR);
 BOOL       Arc(HDC,INT,INT,INT,INT,INT,INT,INT,INT);
 UINT       ArrangeIconicWindows(HWND);
-HDWP       BeginDeferWindowPos(INT);
-HDC        BeginPaint(HWND,LPPAINTSTRUCT);
+HDWP16     BeginDeferWindowPos(INT);
 BOOL       BitBlt(HDC,INT,INT,INT,INT,HDC,INT,INT,DWORD);
 BOOL       BringWindowToTop(HWND);
 BOOL       BuildCommDCB(LPCSTR,DCB*);
 void       CalcChildScroll(HWND,WORD);
 BOOL       CallMsgFilter(SEGPTR,INT);
 LRESULT    CallNextHookEx(HHOOK,INT,WPARAM,LPARAM);
-LRESULT    CallWindowProc(WNDPROC,HWND,UINT,WPARAM,LPARAM);
 INT        Catch(LPCATCHBUF);
 BOOL       ChangeClipboardChain(HWND,HWND);
 BOOL       ChangeMenu(HMENU,UINT,SEGPTR,UINT,UINT);
@@ -2639,17 +2831,14 @@
 BOOL       CheckDlgButton(HWND,INT,UINT);
 INT        CheckMenuItem(HMENU,UINT,UINT);
 BOOL       CheckRadioButton(HWND,UINT,UINT,UINT);
-HWND       ChildWindowFromPoint(HWND,POINT);
 BOOL       Chord(HDC,INT,INT,INT,INT,INT,INT,INT,INT);
 int        ClearCommBreak(int);
-BOOL       ClientToScreen(HWND,LPPOINT);
-BOOL       ClipCursor(LPRECT);
 BOOL       CloseClipboard(void);
 int        CloseComm(int);
 HMETAFILE  CloseMetaFile(HDC);
 void       CloseSound(void);
 BOOL       CloseWindow(HWND);
-INT        CombineRgn(HRGN,HRGN,HRGN,INT);
+INT16      CombineRgn(HRGN32,HRGN32,HRGN32,INT32);
 int        ConvertRequest(HWND,LPKANJISTRUCT);
 #ifdef WINELIB32
 HCURSOR    CopyCursor(HCURSOR); /* Win32 */
@@ -2659,7 +2848,6 @@
 HICON      CopyIcon(HINSTANCE,HICON); /* Win16 */
 #endif
 HMETAFILE  CopyMetaFile(HMETAFILE,LPCSTR);
-BOOL       CopyRect(LPRECT,LPRECT);
 INT        CountClipboardFormats(void);
 INT        CountVoiceNotes(INT);
 HBITMAP    CreateBitmap(INT,INT,UINT,UINT,LPVOID);
@@ -2678,8 +2866,7 @@
 HWND       CreateDialogIndirectParam(HINSTANCE,SEGPTR,HWND,DLGPROC,LPARAM);
 HWND       CreateDialogParam(HINSTANCE,SEGPTR,HWND,DLGPROC,LPARAM);
 HBITMAP    CreateDiscardableBitmap(HDC,INT,INT);
-HRGN       CreateEllipticRgn(INT,INT,INT,INT);
-HRGN       CreateEllipticRgnIndirect(LPRECT);
+HRGN       CreateEllipticRgn(INT32,INT32,INT32,INT32);
 HFONT      CreateFont(INT,INT,INT,INT,INT,BYTE,BYTE,BYTE,BYTE,BYTE,BYTE,BYTE,BYTE,LPCSTR);
 HFONT      CreateFontIndirect(const LOGFONT*);
 HBRUSH     CreateHatchBrush(INT,COLORREF);
@@ -2687,30 +2874,26 @@
 HICON      CreateIcon(HINSTANCE,INT,INT,BYTE,BYTE,const BYTE*,const BYTE*);
 HMENU      CreateMenu(void);
 HDC        CreateMetaFile(LPCSTR);
-HPALETTE   CreatePalette(const LOGPALETTE*);
+HPALETTE16 CreatePalette(const LOGPALETTE*);
 HBRUSH     CreatePatternBrush(HBITMAP);
-HPEN       CreatePen(INT,INT,COLORREF);
-HPEN       CreatePenIndirect(const LOGPEN*);
-HRGN       CreatePolyPolygonRgn(const POINT*,const INT16*,INT,INT);
-HRGN       CreatePolygonRgn(const POINT*,INT,INT);
+HPEN16     CreatePen(INT,INT,COLORREF);
+HPEN16     CreatePenIndirect(const LOGPEN*);
 HMENU      CreatePopupMenu(void);
-HRGN       CreateRectRgn(INT,INT,INT,INT);
-HRGN       CreateRectRgnIndirect(const RECT*);
-HRGN       CreateRoundRectRgn(INT,INT,INT,INT,INT,INT);
+HRGN       CreateRectRgn(INT32,INT32,INT32,INT32);
+HRGN       CreateRoundRectRgn(INT32,INT32,INT32,INT32,INT32,INT32);
 HBRUSH     CreateSolidBrush(COLORREF);
-BOOL       DPtoLP(HDC,LPPOINT,INT);
 void       DebugBreak(void);
 LRESULT    DefDlgProc(HWND,UINT,WPARAM,LPARAM);
 LRESULT    DefFrameProc(HWND,HWND,UINT,WPARAM,LPARAM);
 DWORD      DefHookProc(short,WORD,DWORD,HHOOK*);
 LRESULT    DefMDIChildProc(HWND,UINT,WPARAM,LPARAM);
 LRESULT    DefWindowProc(HWND,UINT,WPARAM,LPARAM);
-HDWP       DeferWindowPos(HDWP,HWND,HWND,INT,INT,INT,INT,UINT);
+HDWP16     DeferWindowPos(HDWP16,HWND,HWND,INT,INT,INT,INT,UINT);
 ATOM       DeleteAtom(ATOM);
 BOOL       DeleteDC(HDC);
 BOOL       DeleteMenu(HMENU,UINT,UINT);
 BOOL       DeleteMetaFile(HMETAFILE);
-BOOL       DeleteObject(HGDIOBJ);
+BOOL       DeleteObject(HGDIOBJ16);
 BOOL       DestroyCaret(void);
 BOOL       DestroyCursor(HCURSOR);
 BOOL       DestroyIcon(HICON);
@@ -2727,12 +2910,10 @@
 INT        DlgDirListComboBox(HWND,SEGPTR,INT,INT,UINT);
 BOOL       DlgDirSelect(HWND,LPSTR,INT);
 BOOL       DlgDirSelectComboBox(HWND,LPSTR,INT);
-BOOL       DragDetect(HWND,POINT);
+BOOL16     DragDetect(HWND16,POINT16);
 DWORD      DragObject(HWND, HWND, WORD, HANDLE, WORD, HCURSOR);
-void       DrawFocusRect(HDC,const RECT*);
 BOOL       DrawIcon(HDC,INT,INT,HICON);
 void       DrawMenuBar(HWND);
-INT        DrawText(HDC,LPCSTR,INT,LPRECT,UINT);
 DWORD      DumpIcon(SEGPTR,WORD*,SEGPTR*,SEGPTR*);
 BOOL       Ellipse(HDC,INT,INT,INT,INT);
 BOOL       EmptyClipboard(void);
@@ -2740,9 +2921,8 @@
 BOOL       EnableMenuItem(HMENU,UINT,UINT);
 BOOL       EnableScrollBar(HWND,UINT,UINT);
 BOOL       EnableWindow(HWND,BOOL);
-BOOL       EndDeferWindowPos(HDWP);
+BOOL       EndDeferWindowPos(HDWP16);
 BOOL       EndDialog(HWND,INT);
-BOOL       EndPaint(HWND,const PAINTSTRUCT*);
 BOOL       EnumChildWindows(HWND,WNDENUMPROC,LPARAM);
 UINT       EnumClipboardFormats(UINT);
 INT        EnumFontFamilies(HDC,LPCSTR,FONTENUMPROC,LPARAM);
@@ -2752,33 +2932,25 @@
 INT        EnumProps(HWND,PROPENUMPROC);
 BOOL       EnumTaskWindows(HTASK,WNDENUMPROC,LPARAM);
 BOOL       EnumWindows(WNDENUMPROC,LPARAM);
-BOOL       EqualRect(const RECT*,const RECT*);
-BOOL       EqualRgn(HRGN,HRGN);
+BOOL       EqualRgn(HRGN32,HRGN32);
 INT        Escape(HDC,INT,INT,LPCSTR,LPVOID);
 LONG       EscapeCommFunction(int,int);
 int        ExcludeClipRect(HDC,short,short,short,short);
-int        ExcludeUpdateRgn(HDC,HWND);
 int        ExcludeVisRect(HDC,short,short,short,short);
 BOOL       ExitWindows(DWORD,WORD);
 BOOL       ExtFloodFill(HDC,INT,INT,COLORREF,WORD);
-BOOL       ExtTextOut(HDC,short,short,WORD,LPRECT,LPSTR,WORD,LPINT16);
 HICON      ExtractIcon(HINSTANCE,LPCSTR,WORD);
 WORD       FarGetOwner(HANDLE);
 void       FarSetOwner(HANDLE,HANDLE);
 void       FatalAppExit(UINT,LPCSTR);
 void       FatalExit(int);
-int        FillRect(HDC,LPRECT,HBRUSH);
 BOOL       FillRgn(HDC,HRGN,HBRUSH);
-void       FillWindow(HWND,HWND,HDC,HBRUSH);
 ATOM       FindAtom(SEGPTR);
 HINSTANCE  FindExecutable(LPCSTR,LPCSTR,LPSTR);
 HRSRC      FindResource(HINSTANCE,SEGPTR,SEGPTR);
-HWND       FindWindow(SEGPTR,LPSTR);
-HWND       FindWindowEx(HWND,HWND,SEGPTR,LPSTR);
 BOOL       FlashWindow(HWND,BOOL);
 BOOL       FloodFill(HDC,INT,INT,COLORREF);
 int        FlushComm(int,int);
-int        FrameRect(HDC,LPRECT,HBRUSH);
 BOOL       FrameRgn(HDC,HRGN,HBRUSH,int,int);
 void       FreeLibrary(HANDLE);
 BOOL       FreeModule(HANDLE);
@@ -2786,28 +2958,21 @@
 BOOL       FreeResource(HGLOBAL);
 WORD       FreeSelector(WORD);
 UINT       GDIRealizePalette(HDC);
-HPALETTE   GDISelectPalette(HDC,HPALETTE);
+HPALETTE16 GDISelectPalette(HDC,HPALETTE16);
 HWND       GetActiveWindow(void);
 DWORD      GetAspectRatioFilter(HDC);
 int        GetAsyncKeyState(int);
 HANDLE     GetAtomHandle(ATOM);
 WORD       GetAtomName(ATOM,LPSTR,short);
 LONG       GetBitmapBits(HBITMAP,LONG,LPSTR);
-DWORD      GetBitmapDimension(HBITMAP);
-BOOL       GetBitmapDimensionEx(HBITMAP,LPSIZE);
 COLORREF   GetBkColor(HDC);
 WORD       GetBkMode(HDC);
 DWORD      GetBrushOrg(HDC);
-BOOL       GetBrushOrgEx(HDC,LPPOINT);
 HWND       GetCapture(void);
 WORD       GetCaretBlinkTime(void);
-void       GetCaretPos(LPPOINT);
 BOOL       GetCharABCWidths(HDC,UINT,UINT,LPABC);
 BOOL       GetCharWidth(HDC,WORD,WORD,LPINT16);
-WORD       GetClassWord(HWND,short);
-void       GetClientRect(HWND,LPRECT);
-int        GetClipBox(HDC,LPRECT);
-void       GetClipCursor(LPRECT);
+WORD       GetClassWord(HWND,INT32);
 HRGN       GetClipRgn(HDC);
 HANDLE     GetClipboardData(WORD);
 int        GetClipboardFormatName(WORD,LPSTR,short);
@@ -2819,13 +2984,12 @@
 UINT       GetCommEventMask(int,int);
 int        GetCommState(int,DCB*);
 HBRUSH     GetControlBrush(HWND,HDC,WORD);
+UINT32     GetCurrentDirectory(UINT32,LPSTR);
 HANDLE     GetCurrentPDB(void);
 DWORD      GetCurrentPosition(HDC);
-BOOL       GetCurrentPositionEx(HDC,LPPOINT);
 HANDLE     GetCurrentTask(void);
 DWORD      GetCurrentTime(void);
 HCURSOR    GetCursor(void);
-void       GetCursorPos(LPPOINT);
 HDC        GetDC(HWND);
 HDC        GetDCEx(HWND,HRGN,DWORD);
 DWORD      GetDCOrg(HDC);
@@ -2849,7 +3013,6 @@
 DWORD      GetHeapSpaces(HMODULE);
 BOOL       GetInputState(void);
 int        GetInstanceData(HANDLE,WORD,int);
-WORD       GetInternalWindowPos(HWND,LPRECT,LPPOINT);
 int        GetKBCodePage(void);
 int        GetKerningPairs(HDC,int,LPKERNINGPAIR);
 int        GetKeyNameText(LONG,LPSTR,int);
@@ -2876,14 +3039,14 @@
 int        GetModuleUsage(HANDLE);
 FARPROC    GetMouseEventProc(void);
 DWORD      GetNearestColor(HDC,DWORD);
-WORD       GetNearestPaletteIndex(HPALETTE,DWORD);
+WORD       GetNearestPaletteIndex(HPALETTE16,DWORD);
 HWND       GetNextDlgGroupItem(HWND,HWND,BOOL);
 HWND       GetNextDlgTabItem(HWND,HWND,BOOL);
 HWND       GetNextWindow(HWND,WORD);
 WORD       GetNumTasks(void);
 int        GetObject(HANDLE,int,LPSTR);
 HWND       GetOpenClipboardWindow(void);
-WORD       GetPaletteEntries(HPALETTE,WORD,WORD,LPPALETTEENTRY);
+WORD       GetPaletteEntries(HPALETTE16,WORD,WORD,LPPALETTEENTRY);
 HWND       GetParent(HWND);
 DWORD      GetPixel(HDC,short,short);
 WORD       GetPolyFillMode(HDC);
@@ -2898,7 +3061,6 @@
 BOOL       GetRasterizerCaps(LPRASTERIZER_STATUS,UINT);
 WORD       GetROP2(HDC);
 WORD       GetRelAbs(HDC);
-int        GetRgnBox(HRGN,LPRECT);
 int        GetScrollPos(HWND,int);
 void       GetScrollRange(HWND,int,LPINT16,LPINT16);
 DWORD      GetSelectorBase(WORD);
@@ -2923,44 +3085,32 @@
 short      GetTextCharacterExtra(HDC);
 COLORREF   GetTextColor(HDC);
 DWORD      GetTextExtent(HDC,LPCSTR,short);
-BOOL       GetTextExtentPoint(HDC,LPCSTR,short,LPSIZE);
 INT        GetTextFace(HDC,INT,LPSTR);
 BOOL       GetTextMetrics(HDC,LPTEXTMETRIC);
 LPINT16    GetThresholdEvent(void);
 int        GetThresholdStatus(void);
 DWORD      GetTickCount(void);
 HWND       GetTopWindow(HWND);
-BOOL       GetUpdateRect(HWND,LPRECT,BOOL);
-int        GetUpdateRgn(HWND,HRGN,BOOL);
 LONG       GetVersion(void);
 DWORD      GetViewportExt(HDC);
-BOOL       GetViewportExtEx(HDC,LPPOINT);
 DWORD      GetViewportOrg(HDC);
-BOOL       GetViewportOrgEx(HDC,LPPOINT);
 BOOL       GetWinDebugInfo(LPWINDEBUGINFO,UINT);
 LONG       GetWinFlags(void);
 HWND       GetWindow(HWND,WORD);
 HDC        GetWindowDC(HWND);
 DWORD      GetWindowExt(HDC);
-BOOL       GetWindowExtEx(HDC,LPPOINT);
 LONG       GetWindowLong(HWND,short);
 DWORD      GetWindowOrg(HDC);
-BOOL       GetWindowOrgEx(HDC,LPPOINT);
-BOOL       GetWindowPlacement(HWND,LPWINDOWPLACEMENT);
-void       GetWindowRect(HWND,LPRECT);
 HANDLE     GetWindowTask(HWND);
 int        GetWindowText(HWND,LPSTR,int);
 int        GetWindowTextLength(HWND);
 WORD       GetWindowWord(HWND,short);
 UINT       GetWindowsDirectory(LPSTR,UINT);
-ATOM       GlobalAddAtom(SEGPTR);
 DWORD      GlobalDOSAlloc(DWORD);
 WORD       GlobalDOSFree(WORD);
 ATOM       GlobalDeleteAtom(ATOM);
-ATOM       GlobalFindAtom(SEGPTR);
 void       GlobalFix(HGLOBAL16);
 void       GlobalFreeAll(HGLOBAL16);
-WORD       GlobalGetAtomName(ATOM,LPSTR,short);
 HGLOBAL16  GlobalLRUNewest(HGLOBAL16);
 HGLOBAL16  GlobalLRUOldest(HGLOBAL16);
 void       GlobalNotify(FARPROC);
@@ -2973,16 +3123,12 @@
 void       HideCaret(HWND);
 BOOL       HiliteMenuItem(HWND,HMENU,UINT,UINT);
 BOOL       InSendMessage(void);
-void       InflateRect(LPRECT,short,short);
 WORD       InitAtomTable(WORD);
 HRGN       InquireVisRgn(HDC);
 BOOL       InsertMenu(HMENU,UINT,UINT,UINT,SEGPTR);
 int        IntersectClipRect(HDC,short,short,short,short);
-BOOL       IntersectRect(LPRECT,LPRECT,LPRECT);
 int        IntersectVisRect(HDC,short,short,short,short);
-void       InvalidateRect(HWND,LPRECT,BOOL);
-void       InvalidateRgn(HWND,HRGN,BOOL);
-void       InvertRect(HDC,LPRECT);
+void       InvalidateRgn(HWND32,HRGN32,BOOL32);
 BOOL       InvertRgn(HDC,HRGN);
 BOOL       IsBadCodePtr(SEGPTR);
 BOOL       IsBadHugeReadPtr(SEGPTR,DWORD);
@@ -3001,16 +3147,15 @@
 BOOL       IsGDIObject(HANDLE);
 BOOL       IsIconic(HWND);
 BOOL       IsMenu(HMENU);
-BOOL       IsRectEmpty(LPRECT);
 BOOL       IsTask(HTASK);
 HTASK      IsTaskLocked(void);
 BOOL       IsWindow(HWND);
 BOOL       IsWindowEnabled(HWND);
+BOOL       IsWindowUnicode(HWND);
 BOOL       IsWindowVisible(HWND);
 BOOL       IsZoomed(HWND);
 BOOL       KillSystemTimer(HWND,WORD);
 BOOL       KillTimer(HWND,WORD);
-BOOL       LPtoDP(HDC,LPPOINT,int);
 void       LimitEmsPages(DWORD);
 void       LineDDA(short,short,short,short,FARPROC,long);
 BOOL       LineTo(HDC,short,short);
@@ -3030,41 +3175,28 @@
 HGLOBAL    LockSegment(HGLOBAL);
 HMENU      LookupMenuHandle(HMENU,INT);
 FARPROC    MakeProcInstance(FARPROC,HANDLE);
-void       MapDialogRect(HWND,LPRECT);
 WORD       MapVirtualKey(WORD,WORD);
-void       MapWindowPoints(HWND,HWND,LPPOINT,WORD);
 void       MessageBeep(WORD);
 int        MessageBox(HWND,LPCSTR,LPCSTR,WORD);
 BOOL       ModifyMenu(HMENU,UINT,UINT,UINT,SEGPTR);
 DWORD      MoveTo(HDC,short,short);
-BOOL       MoveToEx(HDC,short,short,LPPOINT);
 BOOL       MoveWindow(HWND,short,short,short,short,BOOL);
 DWORD      OemKeyScan(WORD);
 BOOL       OemToAnsi(LPSTR,LPSTR);
 void       OemToAnsiBuff(LPSTR,LPSTR,INT);
 int        OffsetClipRgn(HDC,short,short);
-void       OffsetRect(LPRECT,short,short);
-int        OffsetRgn(HRGN,short,short);
-DWORD      OffsetViewportOrg(HDC,short,short);
-BOOL       OffsetViewportOrgEx(HDC,short,short,LPPOINT);
-DWORD      OffsetWindowOrg(HDC,short,short);
-BOOL       OffsetWindowOrgEx(HDC,short,short,LPPOINT);
 BOOL       OpenClipboard(HWND);
 int        OpenComm(LPCSTR,UINT,UINT);
 HFILE      OpenFile(LPCSTR,OFSTRUCT*,UINT);
 BOOL       OpenIcon(HWND);
 int        OpenSound(void);
 void       OutputDebugString(LPCSTR);
-void       PaintRect(HWND,HWND,HDC,HBRUSH,LPRECT);
 BOOL       PaintRgn(HDC,HRGN);
 BOOL       PatBlt(HDC,short,short,short,short,DWORD);
 BOOL       PeekMessage(LPMSG,HWND,WORD,WORD,WORD);
 BOOL       Pie(HDC,INT,INT,INT,INT,INT,INT,INT,INT);
 BOOL       PlayMetaFile(HDC,HANDLE);
 void       PlayMetaFileRecord(HDC,LPHANDLETABLE,LPMETARECORD,WORD);
-BOOL       PolyPolygon(HDC,LPPOINT,LPINT16,WORD);
-BOOL       Polygon(HDC,LPPOINT,int);
-BOOL       Polyline(HDC,LPPOINT,int);
 BOOL       PostAppMessage(HANDLE,WORD,WORD,LONG);
 BOOL       PostMessage(HWND,WORD,WORD,LONG);
 void       PostQuitMessage(INT);
@@ -3077,67 +3209,13 @@
 void       ProfSetup(int,int);
 void       ProfStart(void);
 void       ProfStop(void);
-BOOL       PtInRect(LPRECT,POINT);
-BOOL       PtInRegion(HRGN,short,short);
+BOOL       PtInRegion(HRGN32,INT32,INT32);
 BOOL       PtVisible(HDC,short,short);
 int        ReadComm(int,LPSTR,int);
 WORD       RealizeDefaultPalette(HDC);
 UINT       RealizePalette(HDC);
-BOOL       RectInRegion(HRGN,LPRECT);
-BOOL       RectVisible(HDC,LPRECT);
 BOOL       Rectangle(HDC,INT,INT,INT,INT);
-BOOL       RedrawWindow(HWND,LPRECT,HRGN,UINT);
-DWORD	   RegOpenKeyExW(HKEY,LPCWSTR,DWORD,REGSAM,LPHKEY);
-DWORD      RegOpenKeyW(HKEY,LPCWSTR,LPHKEY);
-DWORD      RegOpenKeyExA(HKEY,LPCSTR,DWORD,REGSAM,LPHKEY);
-DWORD      RegOpenKeyA(HKEY,LPCSTR,LPHKEY);
-DWORD      RegOpenKey(HKEY,LPCSTR,LPHKEY);
-DWORD      RegCreateKeyExW(HKEY,LPCWSTR,DWORD,LPWSTR,DWORD,REGSAM,
-		LPSECURITY_ATTRIBUTES,LPHKEY,LPDWORD);
-DWORD      RegCreateKeyW(HKEY,LPCWSTR,LPHKEY);
-DWORD      RegCreateKeyExA(HKEY,LPCSTR,DWORD,LPSTR,DWORD,REGSAM,
-		LPSECURITY_ATTRIBUTES,LPHKEY,LPDWORD);
-DWORD      RegCreateKeyA(HKEY,LPCSTR,LPHKEY);
-DWORD      RegCreateKey(HKEY,LPCSTR,LPHKEY);
-DWORD      RegQueryValueExW(HKEY,LPWSTR,LPDWORD,LPDWORD,LPBYTE,LPDWORD);
-DWORD      RegQueryValueW(HKEY,LPWSTR,LPWSTR,LPDWORD);
-DWORD      RegQueryValueExA(HKEY,LPSTR,LPDWORD,LPDWORD,LPBYTE,LPDWORD);
-DWORD      RegQueryValueEx(HKEY,LPSTR,LPDWORD,LPDWORD,LPBYTE,LPDWORD);
-DWORD      RegQueryValueA(HKEY,LPSTR,LPSTR,LPDWORD);
-DWORD      RegQueryValue(HKEY,LPSTR,LPSTR,LPDWORD);
-DWORD      RegSetValueExW(HKEY,LPWSTR,DWORD,DWORD,LPBYTE,DWORD);
-DWORD      RegSetValueExA(HKEY,LPSTR,DWORD,DWORD,LPBYTE,DWORD);
-DWORD      RegSetValueEx(HKEY,LPSTR,DWORD,DWORD,LPBYTE,DWORD);
-DWORD      RegSetValueW(HKEY,LPCWSTR,DWORD,LPCWSTR,DWORD);
-DWORD      RegSetValueA(HKEY,LPCSTR,DWORD,LPCSTR,DWORD);
-DWORD      RegSetValue(HKEY,LPCSTR,DWORD,LPCSTR,DWORD);
-DWORD      RegEnumKeyExW(HKEY,DWORD,LPWSTR,LPDWORD,LPDWORD,LPWSTR,LPDWORD,
-		FILETIME*);
-DWORD      RegEnumKeyW(HKEY,DWORD,LPWSTR,DWORD);
-DWORD      RegEnumKeyExA(HKEY,DWORD,LPSTR,LPDWORD,LPDWORD,LPSTR,LPDWORD,
-		FILETIME*);
-DWORD      RegEnumKeyA(HKEY,DWORD,LPSTR,DWORD);
-DWORD      RegEnumKey(HKEY,DWORD,LPSTR,DWORD);
-DWORD      RegEnumValueW(HKEY,DWORD,LPWSTR,LPDWORD,LPDWORD,LPDWORD,LPBYTE,
-		LPDWORD);
-DWORD      RegEnumValueA(HKEY,DWORD,LPSTR,LPDWORD,LPDWORD,LPDWORD,LPBYTE,
-		LPDWORD);
-DWORD      RegEnumValue(HKEY,DWORD,LPSTR,LPDWORD,LPDWORD,LPDWORD,LPBYTE,
-		LPDWORD);
-DWORD      RegCloseKey(HKEY);
-DWORD      RegDeleteKeyW(HKEY,LPWSTR);
-DWORD      RegDeleteKeyA(HKEY,LPCSTR);
-DWORD      RegDeleteKey(HKEY,LPCSTR);
-DWORD      RegDeleteValueW(HKEY,LPWSTR);
-DWORD      RegDeleteValueA(HKEY,LPSTR);
-DWORD      RegDeleteValue(HKEY,LPSTR);
-DWORD      RegFlushKey(HKEY);
-DWORD      RegQueryInfoKeyW(HKEY,LPWSTR,LPDWORD,LPDWORD,LPDWORD,LPDWORD,
-		LPDWORD,LPDWORD,LPDWORD,LPDWORD,LPDWORD,FILETIME*);
-DWORD      RegQueryInfoKeyA(HKEY,LPSTR,LPDWORD,LPDWORD,LPDWORD,LPDWORD,
-		LPDWORD,LPDWORD,LPDWORD,LPDWORD,LPDWORD,FILETIME*);
 WORD       RegisterClipboardFormat(LPCSTR);
-WORD       RegisterWindowMessage(SEGPTR);
 void       ReleaseCapture(void);
 int        ReleaseDC(HWND,HDC);
 BOOL       RemoveFontResource(LPSTR);
@@ -3145,39 +3223,32 @@
 HANDLE     RemoveProp(HWND,SEGPTR);
 void       ReplyMessage(LONG);
 HDC        ResetDC(HDC,LPVOID);
-BOOL       ResizePalette(HPALETTE,UINT);
+BOOL       ResizePalette(HPALETTE16,UINT);
 BOOL       RestoreDC(HDC,short);
 int        RestoreVisRgn(HDC);
 BOOL       RoundRect(HDC,INT,INT,INT,INT,INT,INT);
 int        SaveDC(HDC);
 HRGN       SaveVisRgn(HDC);
-DWORD      ScaleViewportExt(HDC,short,short,short,short);
-BOOL       ScaleViewportExtEx(HDC,short,short,short,short,LPSIZE);
-DWORD      ScaleWindowExt(HDC,short,short,short,short);
-BOOL       ScaleWindowExtEx(HDC,short,short,short,short,LPSIZE);
-void       ScreenToClient(HWND,LPPOINT);
 void       ScrollChildren(HWND,UINT,WPARAM,LPARAM);
-BOOL       ScrollDC(HDC,short,short,LPRECT,LPRECT,HRGN,LPRECT);
-void       ScrollWindow(HWND,short,short,LPRECT,LPRECT);
-int        ScrollWindowEx(HWND,short,short,LPRECT,LPRECT,HRGN,LPRECT,WORD);
+BOOL       ScrollDC(HDC,short,short,LPRECT16,LPRECT16,HRGN,LPRECT16);
+void       ScrollWindow(HWND,short,short,LPRECT16,LPRECT16);
+int        ScrollWindowEx(HWND,short,short,LPRECT16,LPRECT16,HRGN,LPRECT16,WORD);
 int        SelectClipRgn(HDC,HRGN);
 HANDLE     SelectObject(HDC,HANDLE);
-HPALETTE   SelectPalette(HDC,HPALETTE,BOOL);
+HPALETTE16 SelectPalette(HDC,HPALETTE16,BOOL);
 int        SelectVisRgn(HDC,HRGN);
 WORD       SelectorAccessRights(WORD,WORD,WORD);
 LONG       SendDlgItemMessage(HWND,INT,UINT,WPARAM,LPARAM);
 LRESULT    SendMessage(HWND,UINT,WPARAM,LPARAM);
 HWND       SetActiveWindow(HWND);
 LONG       SetBitmapBits(HBITMAP,LONG,LPSTR);
-DWORD      SetBitmapDimension(HBITMAP,short,short);
-BOOL       SetBitmapDimensionEx(HBITMAP,short,short,LPSIZE);
 DWORD      SetBkColor(HDC,COLORREF);
 WORD       SetBkMode(HDC,WORD);
 DWORD      SetBrushOrg(HDC,short,short);
 HWND       SetCapture(HWND);
 void       SetCaretBlinkTime(WORD);
 void       SetCaretPos(short,short);
-WORD       SetClassWord(HWND,short,WORD);
+WORD       SetClassWord(HWND,INT32,WORD);
 HANDLE     SetClipboardData(WORD,HANDLE);
 HWND       SetClipboardViewer(HWND);
 int        SetCommBreak(int);
@@ -3185,6 +3256,7 @@
 int        SetCommState(DCB*);
 void       SetConvertHook(BOOL);
 BOOL       SetConvertParams(int,int);
+BOOL32     SetCurrentDirectory(LPCSTR);
 HCURSOR    SetCursor(HCURSOR);
 void       SetCursorPos(short,short);
 void       SetDCState(HDC,HDC);
@@ -3199,7 +3271,6 @@
 UINT       SetErrorMode(UINT);
 HWND       SetFocus(HWND);
 WORD       SetHandleCount(WORD);
-void       SetInternalWindowPos(HWND,WORD,LPRECT,LPPOINT);
 void       SetKeyboardState(BYTE*);
 WORD       SetMapMode(HDC,WORD);
 DWORD      SetMapperFlags(HDC,DWORD);
@@ -3207,15 +3278,13 @@
 BOOL       SetMenuItemBitmaps(HMENU,UINT,UINT,HBITMAP,HBITMAP);
 BOOL       SetMessageQueue(int);
 HANDLE     SetMetaFileBits(HANDLE);
-WORD       SetPaletteEntries(HPALETTE,WORD,WORD,LPPALETTEENTRY);
+WORD       SetPaletteEntries(HPALETTE16,WORD,WORD,LPPALETTEENTRY);
 HWND       SetParent(HWND,HWND);
 COLORREF   SetPixel(HDC,short,short,COLORREF);
 WORD       SetPolyFillMode(HDC,WORD);
 BOOL       SetProp(HWND,SEGPTR,HANDLE);
 WORD       SetROP2(HDC,WORD);
-void       SetRect(LPRECT,short,short,short,short);
-void       SetRectEmpty(LPRECT);
-void       SetRectRgn(HRGN,short,short,short,short);
+void       SetRectRgn(HRGN32,INT32,INT32,INT32,INT32);
 WORD       SetRelAbs(HDC,WORD);
 FARPROC    SetResourceHandler(HANDLE,LPSTR,FARPROC);
 int        SetScrollPos(HWND,int,int,BOOL);
@@ -3235,10 +3304,6 @@
 DWORD      SetTextColor(HDC,DWORD);
 short      SetTextJustification(HDC,short,short);
 WORD       SetTimer(HWND,WORD,WORD,FARPROC);
-DWORD      SetViewportExt(HDC,short,short);
-BOOL       SetViewportExtEx(HDC,short,short,LPSIZE);
-DWORD      SetViewportOrg(HDC,short,short);
-BOOL       SetViewportOrgEx(HDC,short,short,LPPOINT);
 int        SetVoiceAccent(int,int,int,int,int);
 int        SetVoiceEnvelope(int,int,int);
 int        SetVoiceNote(int,int,int,int);
@@ -3246,12 +3311,7 @@
 int        SetVoiceSound(int,LONG,int);
 int        SetVoiceThreshold(int,int);
 BOOL       SetWinDebugInfo(LPWINDEBUGINFO);
-DWORD      SetWindowExt(HDC,short,short);
-BOOL       SetWindowExtEx(HDC,short,short,LPSIZE);
 LONG       SetWindowLong(HWND,short,LONG);
-DWORD      SetWindowOrg(HDC,short,short);
-BOOL       SetWindowOrgEx(HDC,short,short,LPPOINT);
-BOOL       SetWindowPlacement(HWND,LPWINDOWPLACEMENT);
 BOOL       SetWindowPos(HWND,HWND,INT,INT,INT,INT,WORD);
 void       SetWindowText(HWND,LPCSTR);
 WORD       SetWindowWord(HWND,short,WORD);
@@ -3269,7 +3329,6 @@
 int        StopSound(void);
 BOOL       StretchBlt(HDC,short,short,short,short,HDC,short,short,short,short,DWORD);
 int        StretchDIBits(HDC,WORD,WORD,WORD,WORD,WORD,WORD,WORD,WORD,LPSTR,LPBITMAPINFO,WORD,DWORD);
-BOOL       SubtractRect(LPRECT,LPRECT,LPRECT);
 BOOL       SwapMouseButton(BOOL);
 void       SwapRecording(WORD);
 void       SwitchStackBack(void);
@@ -3277,10 +3336,8 @@
 int        SyncAllVoices(void);
 BOOL       SystemParametersInfo(UINT,UINT,LPVOID,UINT);
 LONG       TabbedTextOut(HDC,short,short,LPSTR,short,short,LPINT16,short);
-BOOL       TextOut(HDC,short,short,LPSTR,short);
 int        Throw(LPCATCHBUF,int);
 int        ToAscii(WORD,WORD,LPSTR,LPVOID,WORD);
-BOOL       TrackPopupMenu(HMENU,UINT,short,short,short,HWND,LPRECT);
 int        TranslateAccelerator(HWND,HANDLE,LPMSG);
 BOOL       TranslateMDISysAccel(HWND,LPMSG);
 BOOL       TranslateMessage(LPMSG);
@@ -3288,15 +3345,13 @@
 int        UngetCommChar(int,char);
 BOOL       UnhookWindowsHook(short,FARPROC);
 BOOL       UnhookWindowsHookEx(HHOOK);
-BOOL       UnionRect(LPRECT,LPRECT,LPRECT);
 void       UnlockSegment(HGLOBAL);
 BOOL       UnrealizeObject(HBRUSH);
 int        UpdateColors(HDC);
-void       UpdateWindow(HWND);
+void       UpdateWindow(HWND32);
 void       ValidateCodeSegments(void);
 LPSTR      ValidateFreeSpaces(void);
-void       ValidateRect(HWND,LPRECT);
-void       ValidateRgn(HWND,HRGN);
+void       ValidateRgn(HWND32,HRGN32);
 WORD       VkKeyScan(WORD);
 SEGPTR     WIN16_GlobalLock16(HGLOBAL16);
 SEGPTR     WIN16_LockResource(HANDLE);
@@ -3305,7 +3360,6 @@
 int        WaitSoundState(int);
 HANDLE     WinExec(LPSTR,WORD);
 BOOL       WinHelp(HWND,LPSTR,WORD,DWORD);
-HWND       WindowFromPoint(POINT);
 int        WriteComm(int,LPSTR,int);
 void       WriteOutProfiles(void);
 BOOL       WritePrivateProfileString(LPCSTR,LPCSTR,LPCSTR,LPCSTR);
@@ -3330,10 +3384,66 @@
 int        wsprintf(LPSTR,LPSTR,...);
 int        wvsprintf(LPSTR,LPCSTR,LPCSTR);
 
+/* Declarations for functions that are the same in Win16 and Win32 */
 
-/* Declarations for functions that exist both in Win16 and Win32 */
+INT16      ExcludeUpdateRgn(HDC32,HWND32);
+void       FillWindow(HWND16,HWND16,HDC16,HBRUSH16);
+DWORD      GetBitmapDimension(HBITMAP16);
+INT16      GetUpdateRgn(HWND32,HRGN32,BOOL32);
+INT16      OffsetRgn(HRGN32,INT32,INT32);
+DWORD      OffsetViewportOrg(HDC16,INT16,INT16);
+DWORD      OffsetWindowOrg(HDC16,INT16,INT16);
+void       PaintRect(HWND16,HWND16,HDC16,HBRUSH16,const RECT16*);
+DWORD      RegCloseKey(HKEY);
+DWORD      RegFlushKey(HKEY);
+DWORD      ScaleViewportExt(HDC16,INT16,INT16,INT16,INT16);
+DWORD      ScaleWindowExt(HDC16,INT16,INT16,INT16,INT16);
+DWORD      SetBitmapDimension(HBITMAP16,INT16,INT16);
+DWORD      SetViewportExt(HDC16,INT16,INT16);
+DWORD      SetViewportOrg(HDC16,INT16,INT16);
+DWORD      SetWindowExt(HDC16,INT16,INT16);
+DWORD      SetWindowOrg(HDC16,INT16,INT16);
 
-HWND       CreateWindow16(SEGPTR,SEGPTR,DWORD,INT16,INT16,INT16,INT16,HWND,HMENU,HINSTANCE,SEGPTR);
+/* Declarations for functions that change between Win16 and Win32 */
+
+BOOL16     AdjustWindowRect16(LPRECT16,DWORD,BOOL16);
+BOOL32     AdjustWindowRect32(LPRECT32,DWORD,BOOL32);
+#define    AdjustWindowRect WINELIB_NAME(AdjustWindowRect)
+BOOL16     AdjustWindowRectEx16(LPRECT16,DWORD,BOOL16,DWORD);
+BOOL32     AdjustWindowRectEx32(LPRECT32,DWORD,BOOL32,DWORD);
+#define    AdjustWindowRectEx WINELIB_NAME(AdjustWindowRectEx)
+HDC16      BeginPaint16(HWND16,LPPAINTSTRUCT16);
+HDC32      BeginPaint32(HWND32,LPPAINTSTRUCT32);
+#define    BeginPaint WINELIB_NAME(BeginPaint)
+LRESULT    CallWindowProc16(WNDPROC16,HWND16,UINT16,WPARAM16,LPARAM);
+LRESULT    CallWindowProc32A(WNDPROC32,HWND32,UINT32,WPARAM32,LPARAM);
+LRESULT    CallWindowProc32W(WNDPROC32,HWND32,UINT32,WPARAM32,LPARAM);
+#define    CallWindowProc WINELIB_NAME_AW(CallWindowProc)
+HWND16     ChildWindowFromPoint16(HWND16,POINT16);
+HWND32     ChildWindowFromPoint32(HWND32,POINT32);
+#define    ChildWindowFromPoint WINELIB_NAME(ChildWindowFromPoint)
+BOOL16     ClientToScreen16(HWND16,LPPOINT16);
+BOOL32     ClientToScreen32(HWND32,LPPOINT32);
+#define    ClientToScreen WINELIB_NAME(ClientToScreen)
+BOOL16     ClipCursor16(const RECT16*);
+BOOL32     ClipCursor32(const RECT32*);
+#define    ClipCursor WINELIB_NAME(ClipCursor)
+BOOL16     CopyRect16(RECT16*,const RECT16*);
+BOOL32     CopyRect32(RECT32*,const RECT32*);
+#define    CopyRect WINELIB_NAME(CopyRect)
+HRGN16     CreateEllipticRgnIndirect16(const RECT16 *);
+HRGN32     CreateEllipticRgnIndirect32(const RECT32 *);
+#define    CreateEllipticRgnIndirect WINELIB_NAME(CreateEllipticRgnIndirect)
+HRGN16     CreatePolyPolygonRgn16(const POINT16*,const INT16*,INT16,INT16);
+HRGN32     CreatePolyPolygonRgn32(const POINT32*,const INT32*,INT32,INT32);
+#define    CreatePolyPolygonRgn WINELIB_NAME(CreatePolyPolygonRgn)
+HRGN16     CreatePolygonRgn16(const POINT16*,INT16,INT16);
+HRGN32     CreatePolygonRgn32(const POINT32*,INT32,INT32);
+#define    CreatePolygonRgn WINELIB_NAME(CreatePolygonRgn)
+HRGN16     CreateRectRgnIndirect16(const RECT16*);
+HRGN32     CreateRectRgnIndirect32(const RECT32*);
+#define    CreateRectRgnIndirect WINELIB_NAME(CreateRectRgnIndirect)
+HWND16     CreateWindow16(SEGPTR,SEGPTR,DWORD,INT16,INT16,INT16,INT16,HWND16,HMENU16,HINSTANCE16,SEGPTR);
 #define    CreateWindow32A(className,titleName,style,x,y,width,height,\
                            parent,menu,instance,param) \
            CreateWindowEx32A(0,className,titleName,style,x,y,width,height,\
@@ -3343,10 +3453,119 @@
            CreateWindowEx32W(0,className,titleName,style,x,y,width,height,\
                            parent,menu,instance,param)
 #define    CreateWindow WINELIB_NAME_AW(CreateWindow)
-HWND       CreateWindowEx16(DWORD,SEGPTR,SEGPTR,DWORD,INT16,INT16,INT16,INT16,HWND,HMENU,HINSTANCE,SEGPTR);
+HWND16     CreateWindowEx16(DWORD,SEGPTR,SEGPTR,DWORD,INT16,INT16,INT16,INT16,HWND16,HMENU16,HINSTANCE16,SEGPTR);
 HWND32     CreateWindowEx32A(DWORD,LPCSTR,LPCSTR,DWORD,INT32,INT32,INT32,INT32,HWND32,HMENU32,HINSTANCE32,LPVOID);
 HWND32     CreateWindowEx32W(DWORD,LPCWSTR,LPCWSTR,DWORD,INT32,INT32,INT32,INT32,HWND32,HMENU32,HINSTANCE32,LPVOID);
 #define    CreateWindowEx WINELIB_NAME_AW(CreateWindowEx)
+BOOL16     DPtoLP16(HDC16,LPPOINT16,INT16);
+BOOL32     DPtoLP32(HDC32,LPPOINT32,INT32);
+#define    DPtoLP WINELIB_NAME(DPtoLP)
+void       DrawFocusRect16(HDC16,const RECT16*);
+void       DrawFocusRect32(HDC32,const RECT32*);
+#define    DrawFocusRect WINELIB_NAME(DrawFocusRect)
+INT16      DrawText16(HDC16,LPCSTR,INT16,LPRECT16,UINT16);
+INT32      DrawText32A(HDC32,LPCSTR,INT32,LPRECT32,UINT32);
+INT32      DrawText32W(HDC32,LPCWSTR,INT32,LPRECT32,UINT32);
+#define    DrawText WINELIB_NAME_AW(DrawText)
+BOOL16     EndPaint16(HWND16,const PAINTSTRUCT16*);
+BOOL32     EndPaint32(HWND32,const PAINTSTRUCT32*);
+#define    EndPaint WINELIB_NAME(EndPaint)
+BOOL16     EqualRect16(const RECT16*,const RECT16*);
+BOOL32     EqualRect32(const RECT32*,const RECT32*);
+#define    EqualRect WINELIB_NAME(EqualRect)
+BOOL16     ExtTextOut16(HDC16,INT16,INT16,UINT16,const RECT16*,LPCSTR,UINT16,const INT16*);
+BOOL32     ExtTextOut32A(HDC32,INT32,INT32,UINT32,const RECT32*,LPCSTR,UINT32,const INT32*);
+BOOL32     ExtTextOut32W(HDC32,INT32,INT32,UINT32,const RECT32*,LPCWSTR,UINT32,const INT32*);
+#define    ExtTextOut WINELIB_NAME_AW(ExtTextOut)
+INT16      FillRect16(HDC16,const RECT16*,HBRUSH16);
+INT32      FillRect32(HDC32,const RECT32*,HBRUSH32);
+#define    FillRect WINELIB_NAME(FillRect)
+HWND       FindWindow16(SEGPTR,LPCSTR);
+HWND       FindWindow32A(LPCSTR,LPCSTR);
+HWND       FindWindow32W(LPCWSTR,LPCWSTR);
+#define    FindWindow WINELIB_NAME_AW(FindWindow)
+HWND       FindWindowEx16(HWND,HWND,SEGPTR,LPCSTR);
+HWND       FindWindowEx32A(HWND,HWND,LPCSTR,LPCSTR);
+HWND       FindWindowEx32W(HWND,HWND,LPCWSTR,LPCWSTR);
+#define    FindWindowEx WINELIB_NAME_AW(FindWindowEx)
+INT16      FrameRect16(HDC16,const RECT16*,HBRUSH16);
+INT32      FrameRect32(HDC32,const RECT32*,HBRUSH32);
+#define    FrameRect WINELIB_NAME(FrameRect)
+BOOL16     GetBitmapDimensionEx16(HBITMAP16,LPSIZE16);
+BOOL32     GetBitmapDimensionEx32(HBITMAP32,LPSIZE32);
+#define    GetBitmapDimensionEx WINELIB_NAME(GetBitmapDimensionEx)
+BOOL16     GetBrushOrgEx16(HDC16,LPPOINT16);
+BOOL32     GetBrushOrgEx32(HDC32,LPPOINT32);
+#define    GetBrushOrgEx WINELIB_NAME(GetBrushOrgEx)
+void       GetCaretPos16(LPPOINT16);
+void       GetCaretPos32(LPPOINT32);
+#define    GetCaretPos WINELIB_NAME(GetCaretPos)
+BOOL       GetClassInfo16(HINSTANCE16,SEGPTR,WNDCLASS16 *);
+BOOL       GetClassInfo32A(HINSTANCE32,LPCSTR,WNDCLASS32A *);
+BOOL       GetClassInfo32W(HINSTANCE32,LPCWSTR,WNDCLASS32W *);
+#define    GetClassInfo WINELIB_NAME_AW(GetClassInfo)
+BOOL       GetClassInfoEx16(HINSTANCE16,SEGPTR,WNDCLASSEX16 *);
+BOOL       GetClassInfoEx32A(HINSTANCE32,LPCSTR,WNDCLASSEX32A *);
+BOOL       GetClassInfoEx32W(HINSTANCE32,LPCWSTR,WNDCLASSEX32W *);
+#define    GetClassInfoEx WINELIB_NAME_AW(GetClassInfoEx)
+LONG       GetClassLong16(HWND,INT16);
+LONG       GetClassLong32A(HWND,INT32);
+LONG       GetClassLong32W(HWND,INT32);
+#define    GetClassLong WINELIB_NAME_AW(GetClassLong)
+INT16      GetClassName16(HWND,LPSTR,INT16);
+INT32      GetClassName32A(HWND,LPSTR,INT32);
+INT32      GetClassName32W(HWND,LPWSTR,INT32);
+#define    GetClassName WINELIB_NAME_AW(GetClassName)
+void       GetClientRect16(HWND16,LPRECT16);
+void       GetClientRect32(HWND32,LPRECT32);
+#define    GetClientRect WINELIB_NAME(GetClientRect)
+INT16      GetClipBox16(HDC16,LPRECT16);
+INT32      GetClipBox32(HDC32,LPRECT32);
+#define    GetClipBox WINELIB_NAME(GetClipBox)
+void       GetClipCursor16(LPRECT16);
+void       GetClipCursor32(LPRECT32);
+#define    GetClipCursor WINELIB_NAME(GetClipCursor)
+BOOL16     GetCurrentPositionEx16(HDC16,LPPOINT16);
+BOOL32     GetCurrentPositionEx32(HDC32,LPPOINT32);
+#define    GetCurrentPositionEx WINELIB_NAME(GetCurrentPositionEx)
+void       GetCursorPos16(LPPOINT16);
+void       GetCursorPos32(LPPOINT32);
+#define    GetCursorPos WINELIB_NAME(GetCursorPos)
+UINT16     GetInternalWindowPos16(HWND16,LPRECT16,LPPOINT16);
+UINT32     GetInternalWindowPos32(HWND32,LPRECT32,LPPOINT32);
+#define    GetInternalWindowPos WINELIB_NAME(GetInternalWindowPos)
+INT16      GetRgnBox16(HRGN16,LPRECT16);
+INT32      GetRgnBox32(HRGN32,LPRECT32);
+#define    GetRgnBox WINELIB_NAME(GetRgnBox)
+BOOL16     GetTextExtentPoint16(HDC16,LPCSTR,INT16,LPSIZE16);
+BOOL32     GetTextExtentPoint32A(HDC32,LPCSTR,INT32,LPSIZE32);
+BOOL32     GetTextExtentPoint32W(HDC32,LPCWSTR,INT32,LPSIZE32);
+#define    GetTextExtentPoint WINELIB_NAME_AW(GetTextExtentPoint)
+BOOL16     GetUpdateRect16(HWND16,LPRECT16,BOOL16);
+BOOL32     GetUpdateRect32(HWND32,LPRECT32,BOOL32);
+#define    GetUpdateRect WINELIB_NAME(GetUpdateRect)
+BOOL16     GetViewportExtEx16(HDC16,LPPOINT16);
+BOOL32     GetViewportExtEx32(HDC32,LPPOINT32);
+#define    GetViewportExtEx WINELIB_NAME(GetViewportExtEx)
+BOOL16     GetViewportOrgEx16(HDC16,LPPOINT16);
+BOOL32     GetViewportOrgEx32(HDC32,LPPOINT32);
+#define    GetViewportOrgEx WINELIB_NAME(GetViewportOrgEx)
+BOOL16     GetWindowExtEx16(HDC16,LPPOINT16);
+BOOL32     GetWindowExtEx32(HDC32,LPPOINT32);
+#define    GetWindowExtEx WINELIB_NAME(GetWindowExtEx)
+BOOL16     GetWindowOrgEx16(HDC16,LPPOINT16);
+BOOL32     GetWindowOrgEx32(HDC32,LPPOINT32);
+#define    GetWindowOrgEx WINELIB_NAME(GetWindowOrgEx)
+BOOL16     GetWindowPlacement16(HWND16,LPWINDOWPLACEMENT16);
+BOOL32     GetWindowPlacement32(HWND32,LPWINDOWPLACEMENT32);
+#define    GetWindowPlacement WINELIB_NAME(GetWindowPlacement)
+void       GetWindowRect16(HWND16,LPRECT16);
+void       GetWindowRect32(HWND32,LPRECT32);
+#define    GetWindowRect WINELIB_NAME(GetWindowRect)
+ATOM       GlobalAddAtom16(SEGPTR);
+ATOM       GlobalAddAtom32A(LPCSTR);
+ATOM       GlobalAddAtom32W(LPCWSTR);
+#define    GlobalAddAtom WINELIB_NAME_AW(GlobalAddAtom)
 HGLOBAL16  GlobalAlloc16(UINT16,DWORD);
 HGLOBAL32  GlobalAlloc32(UINT32,DWORD);
 #define    GlobalAlloc WINELIB_NAME(GlobalAlloc)
@@ -3356,9 +3575,17 @@
 UINT16     GlobalFlags16(HGLOBAL16);
 UINT32     GlobalFlags32(HGLOBAL32);
 #define    GlobalFlags WINELIB_NAME(GlobalFlags)
+ATOM       GlobalFindAtom16(SEGPTR);
+ATOM       GlobalFindAtom32A(LPCSTR);
+ATOM       GlobalFindAtom32W(LPCWSTR);
+#define    GlobalFindAtom WINELIB_NAME_AW(GlobalFindAtom)
 HGLOBAL16  GlobalFree16(HGLOBAL16);
 HGLOBAL32  GlobalFree32(HGLOBAL32);
 #define    GlobalFree WINELIB_NAME(GlobalFree)
+UINT16     GlobalGetAtomName16(ATOM,LPSTR,INT16);
+UINT32     GlobalGetAtomName32A(ATOM,LPSTR,INT32);
+UINT32     GlobalGetAtomName32W(ATOM,LPWSTR,INT32);
+#define    GlobalGetAtomName WINELIB_NAME_AW(GlobalGetAtomName)
 DWORD      GlobalHandle16(WORD);
 HGLOBAL32  GlobalHandle32(LPCVOID);
 #define    GlobalHandle WINELIB_NAME(GlobalHandle)
@@ -3371,9 +3598,24 @@
 DWORD      GlobalSize16(HGLOBAL16);
 DWORD      GlobalSize32(HGLOBAL32);
 #define    GlobalSize WINELIB_NAME(GlobalSize)
-BOOL       GlobalUnlock16(HGLOBAL16);
-BOOL       GlobalUnlock32(HGLOBAL32);
+BOOL16     GlobalUnlock16(HGLOBAL16);
+BOOL32     GlobalUnlock32(HGLOBAL32);
 #define    GlobalUnlock WINELIB_NAME(GlobalUnlock)
+void       InflateRect16(LPRECT16,INT16,INT16);
+void       InflateRect32(LPRECT32,INT32,INT32);
+#define    InflateRect WINELIB_NAME(InflateRect)
+BOOL16     IntersectRect16(LPRECT16,const RECT16*,const RECT16*);
+BOOL32     IntersectRect32(LPRECT32,const RECT32*,const RECT32*);
+#define    IntersectRect WINELIB_NAME(IntersectRect)
+void       InvalidateRect16(HWND16,const RECT16*,BOOL16);
+void       InvalidateRect32(HWND32,const RECT32*,BOOL32);
+#define    InvalidateRect WINELIB_NAME(InvalidateRect)
+void       InvertRect16(HDC16,const RECT16*);
+void       InvertRect32(HDC32,const RECT32*);
+#define    InvertRect WINELIB_NAME(InvertRect)
+BOOL16     IsRectEmpty16(const RECT16*);
+BOOL32     IsRectEmpty32(const RECT32*);
+#define    IsRectEmpty WINELIB_NAME(IsRectEmpty)
 HLOCAL16   LocalAlloc16(UINT16,WORD);
 HLOCAL32   LocalAlloc32(UINT32,DWORD);
 #define    LocalAlloc WINELIB_NAME(LocalAlloc)
@@ -3401,12 +3643,189 @@
 UINT16     LocalSize16(HLOCAL16);
 UINT32     LocalSize32(HLOCAL32);
 #define    LocalSize WINELIB_NAME(LocalSize)
-BOOL       LocalUnlock16(HLOCAL16);
-BOOL       LocalUnlock32(HLOCAL32);
+BOOL16     LocalUnlock16(HLOCAL16);
+BOOL32     LocalUnlock32(HLOCAL32);
 #define    LocalUnlock WINELIB_NAME(LocalUnlock)
+BOOL16     LPtoDP16(HDC16,LPPOINT16,INT16);
+BOOL32     LPtoDP32(HDC32,LPPOINT32,INT32);
+#define    LPtoDP WINELIB_NAME(LPtoDP)
+void       MapDialogRect16(HWND16,LPRECT16);
+void       MapDialogRect32(HWND32,LPRECT32);
+#define    MapDialogRect WINELIB_NAME(MapDialogRect)
+void       MapWindowPoints16(HWND16,HWND16,LPPOINT16,UINT16);
+void       MapWindowPoints32(HWND32,HWND32,LPPOINT32,UINT32);
+#define    MapWindowPoints WINELIB_NAME(MapWindowPoints)
+BOOL16     MoveToEx16(HDC16,INT16,INT16,LPPOINT16);
+BOOL32     MoveToEx32(HDC32,INT32,INT32,LPPOINT32);
+#define    MoveToEx WINELIB_NAME(MoveToEx)
 INT16      MulDiv16(INT16,INT16,INT16);
 INT32      MulDiv32(INT32,INT32,INT32);
 #define    MulDiv WINELIB_NAME(MulDiv)
+void       OffsetRect16(LPRECT16,INT16,INT16);
+void       OffsetRect32(LPRECT32,INT32,INT32);
+#define    OffsetRect WINELIB_NAME(OffsetRect)
+BOOL16     OffsetViewportOrgEx16(HDC16,INT16,INT16,LPPOINT16);
+BOOL32     OffsetViewportOrgEx32(HDC32,INT32,INT32,LPPOINT32);
+#define    OffsetViewportOrgEx WINELIB_NAME(OffsetViewportOrgEx)
+BOOL16     OffsetWindowOrgEx16(HDC16,INT16,INT16,LPPOINT16);
+BOOL32     OffsetWindowOrgEx32(HDC32,INT32,INT32,LPPOINT32);
+#define    OffsetWindowOrgEx WINELIB_NAME(OffsetWindowOrgEx)
+BOOL16     PolyPolygon16(HDC16,LPPOINT16,LPINT16,UINT16);
+BOOL32     PolyPolygon32(HDC32,LPPOINT32,LPINT32,UINT32);
+#define    PolyPolygon WINELIB_NAME(PolyPolygon)
+BOOL16     Polygon16(HDC16,LPPOINT16,INT16);
+BOOL32     Polygon32(HDC32,LPPOINT32,INT32);
+#define    Polygon WINELIB_NAME(Polygon)
+BOOL16     Polyline16(HDC16,LPPOINT16,INT16);
+BOOL32     Polyline32(HDC32,LPPOINT32,INT32);
+#define    Polyline WINELIB_NAME(Polyline)
+BOOL16     PtInRect16(const RECT16*,POINT16);
+BOOL32     PtInRect32(const RECT32*,POINT32);
+#define    PtInRect WINELIB_NAME(PtInRect)
+BOOL16     RectInRegion16(HRGN16,const RECT16 *);
+BOOL32     RectInRegion32(HRGN32,const RECT32 *);
+#define    RectInRegion WINELIB_NAME(RectInRegion)
+BOOL16     RectVisible16(HDC16,LPRECT16);
+BOOL32     RectVisible32(HDC32,LPRECT32);
+#define    RectVisible WINELIB_NAME(RectVisible)
+BOOL16     RedrawWindow16(HWND16,const RECT16*,HRGN16,UINT16);
+BOOL32     RedrawWindow32(HWND32,const RECT32*,HRGN32,UINT32);
+#define    RedrawWindow WINELIB_NAME(RedrawWindow)
+DWORD      RegCreateKey16(HKEY,LPCSTR,LPHKEY);
+DWORD      RegCreateKey32A(HKEY,LPCSTR,LPHKEY);
+DWORD      RegCreateKey32W(HKEY,LPCWSTR,LPHKEY);
+#define    RegCreateKey WINELIB_NAME_AW(RegCreateKey)
+DWORD      RegCreateKeyEx32A(HKEY,LPCSTR,DWORD,LPSTR,DWORD,REGSAM,
+                             LPSECURITY_ATTRIBUTES,LPHKEY,LPDWORD);
+DWORD      RegCreateKeyEx32W(HKEY,LPCWSTR,DWORD,LPWSTR,DWORD,REGSAM,
+                             LPSECURITY_ATTRIBUTES,LPHKEY,LPDWORD);
+/* there is no RegCreateKeyEx16 */
+#define    RegCreateKeyEx WINELIB_NAME_AW(RegCreateKeyEx)
+DWORD      RegDeleteKey16(HKEY,LPCSTR);
+DWORD      RegDeleteKey32A(HKEY,LPCSTR);
+DWORD      RegDeleteKey32W(HKEY,LPWSTR);
+#define    RegDeleteKey WINELIB_NAME_AW(RegDeleteKey)
+DWORD      RegDeleteValue16(HKEY,LPSTR);
+DWORD      RegDeleteValue32A(HKEY,LPSTR);
+DWORD      RegDeleteValue32W(HKEY,LPWSTR);
+#define    RegDeleteValue WINELIB_NAME_AW(RegDeleteValue)
+DWORD      RegEnumKey16(HKEY,DWORD,LPSTR,DWORD);
+DWORD      RegEnumKey32A(HKEY,DWORD,LPSTR,DWORD);
+DWORD      RegEnumKey32W(HKEY,DWORD,LPWSTR,DWORD);
+#define    RegEnumKey WINELIB_NAME_AW(RegEnumKey)
+DWORD      RegEnumKeyEx32A(HKEY,DWORD,LPSTR,LPDWORD,LPDWORD,LPSTR,LPDWORD,FILETIME*);
+DWORD      RegEnumKeyEx32W(HKEY,DWORD,LPWSTR,LPDWORD,LPDWORD,LPWSTR,LPDWORD,FILETIME*);
+/* there is no RegEnumKeyEx16 */
+#define    RegEnumKeyEx WINELIB_NAME_AW(RegEnumKeyEx)
+DWORD      RegEnumValue16(HKEY,DWORD,LPSTR,LPDWORD,LPDWORD,LPDWORD,LPBYTE,LPDWORD);
+DWORD      RegEnumValue32A(HKEY,DWORD,LPSTR,LPDWORD,LPDWORD,LPDWORD,LPBYTE,LPDWORD);
+DWORD      RegEnumValue32W(HKEY,DWORD,LPWSTR,LPDWORD,LPDWORD,LPDWORD,LPBYTE,LPDWORD);
+#define    RegEnumValue WINELIB_NAME_AW(RegEnumValue)
+ATOM       RegisterClass16(const WNDCLASS16*);
+ATOM       RegisterClass32A(const WNDCLASS32A *);
+ATOM       RegisterClass32W(const WNDCLASS32W *);
+#define    RegisterClass WINELIB_NAME_AW(RegisterClass)
+ATOM       RegisterClassEx16(const WNDCLASSEX16*);
+ATOM       RegisterClassEx32A(const WNDCLASSEX32A *);
+ATOM       RegisterClassEx32W(const WNDCLASSEX32W *);
+#define    RegisterClassEx WINELIB_NAME_AW(RegisterClassEx)
+WORD       RegisterWindowMessage16(SEGPTR);
+WORD       RegisterWindowMessage32A(LPCSTR);
+WORD       RegisterWindowMessage32W(LPCWSTR);
+#define    RegisterWindowMessage WINELIB_NAME_AW(RegisterWindowMessage)
+DWORD      RegOpenKey16(HKEY,LPCSTR,LPHKEY);
+DWORD      RegOpenKey32A(HKEY,LPCSTR,LPHKEY);
+DWORD      RegOpenKey32W(HKEY,LPCWSTR,LPHKEY);
+#define    RegOpenKey WINELIB_NAME_AW(RegOpenKey)
+DWORD      RegOpenKeyEx32W(HKEY,LPCWSTR,DWORD,REGSAM,LPHKEY);
+DWORD      RegOpenKeyEx32A(HKEY,LPCSTR,DWORD,REGSAM,LPHKEY);
+/* there is no RegOpenKeyEx16 */
+#define    RegOpenKeyEx WINELIB_NAME_AW(RegOpenKeyEx)
+DWORD      RegQueryInfoKey32W(HKEY,LPWSTR,LPDWORD,LPDWORD,LPDWORD,LPDWORD,
+                            LPDWORD,LPDWORD,LPDWORD,LPDWORD,LPDWORD,FILETIME*);
+DWORD      RegQueryInfoKey32A(HKEY,LPSTR,LPDWORD,LPDWORD,LPDWORD,LPDWORD,
+                            LPDWORD,LPDWORD,LPDWORD,LPDWORD,LPDWORD,FILETIME*);
+/* there is no RegQueryInfoKey16 */
+#define    RegQueryInfoKey WINELIB_NAME_AW(RegQueryInfoKey)
+DWORD      RegQueryValue16(HKEY,LPSTR,LPSTR,LPDWORD);
+DWORD      RegQueryValue32A(HKEY,LPSTR,LPSTR,LPDWORD);
+DWORD      RegQueryValue32W(HKEY,LPWSTR,LPWSTR,LPDWORD);
+#define    RegQueryValue WINELIB_NAME_AW(RegQueryValue)
+DWORD      RegQueryValueEx16(HKEY,LPSTR,LPDWORD,LPDWORD,LPBYTE,LPDWORD);
+DWORD      RegQueryValueEx32A(HKEY,LPSTR,LPDWORD,LPDWORD,LPBYTE,LPDWORD);
+DWORD      RegQueryValueEx32W(HKEY,LPWSTR,LPDWORD,LPDWORD,LPBYTE,LPDWORD);
+#define    RegQueryValueEx WINELIB_NAME_AW(RegQueryValueEx)
+DWORD      RegSetValue16(HKEY,LPCSTR,DWORD,LPCSTR,DWORD);
+DWORD      RegSetValue32A(HKEY,LPCSTR,DWORD,LPCSTR,DWORD);
+DWORD      RegSetValue32W(HKEY,LPCWSTR,DWORD,LPCWSTR,DWORD);
+#define    RegSetValue WINELIB_NAME_AW(RegSetValue)
+DWORD      RegSetValueEx16(HKEY,LPSTR,DWORD,DWORD,LPBYTE,DWORD);
+DWORD      RegSetValueEx32A(HKEY,LPSTR,DWORD,DWORD,LPBYTE,DWORD);
+DWORD      RegSetValueEx32W(HKEY,LPWSTR,DWORD,DWORD,LPBYTE,DWORD);
+#define    RegSetValueEx WINELIB_NAME_AW(RegSetValueEx)
+BOOL16     ScaleViewportExtEx16(HDC16,INT16,INT16,INT16,INT16,LPSIZE16);
+BOOL32     ScaleViewportExtEx32(HDC32,INT32,INT32,INT32,INT32,LPSIZE32);
+#define    ScaleViewportExtEx WINELIB_NAME(ScaleViewportExtEx)
+BOOL16     ScaleWindowExtEx16(HDC16,INT16,INT16,INT16,INT16,LPSIZE16);
+BOOL32     ScaleWindowExtEx32(HDC32,INT32,INT32,INT32,INT32,LPSIZE32);
+#define    ScaleWindowExtEx WINELIB_NAME(ScaleWindowExtEx)
+void       ScreenToClient16(HWND16,LPPOINT16);
+void       ScreenToClient32(HWND32,LPPOINT32);
+#define    ScreenToClient WINELIB_NAME(ScreenToClient)
+BOOL16     SetBitmapDimensionEx16(HBITMAP16,INT16,INT16,LPSIZE16);
+BOOL32     SetBitmapDimensionEx32(HBITMAP32,INT32,INT32,LPSIZE32);
+#define    SetBitmapDimensionEx WINELIB_NAME(SetBitmapDimensionEx)
+LONG       SetClassLong16(HWND,INT16,LONG);
+LONG       SetClassLong32A(HWND,INT32,LONG);
+LONG       SetClassLong32W(HWND,INT32,LONG);
+#define    SetClassLong WINELIB_NAME_AW(SetClassLong)
+void       SetInternalWindowPos16(HWND16,UINT16,LPRECT16,LPPOINT16);
+void       SetInternalWindowPos32(HWND32,UINT32,LPRECT32,LPPOINT32);
+#define    SetInternalWindowPos WINELIB_NAME(SetInternalWindowPos)
+void       SetRect16(LPRECT16,INT16,INT16,INT16,INT16);
+void       SetRect32(LPRECT32,INT32,INT32,INT32,INT32);
+#define    SetRect WINELIB_NAME(SetRect)
+void       SetRectEmpty16(LPRECT16);
+void       SetRectEmpty32(LPRECT32);
+#define    SetRectEmpty WINELIB_NAME(SetRectEmpty)
+BOOL16     SetViewportExtEx16(HDC16,INT16,INT16,LPSIZE16);
+BOOL32     SetViewportExtEx32(HDC32,INT32,INT32,LPSIZE32);
+#define    SetViewportExtEx WINELIB_NAME(SetViewportExtEx)
+BOOL16     SetViewportOrgEx16(HDC16,INT16,INT16,LPPOINT16);
+BOOL32     SetViewportOrgEx32(HDC32,INT32,INT32,LPPOINT32);
+#define    SetViewportOrgEx WINELIB_NAME(SetViewportOrgEx)
+BOOL16     SetWindowExtEx16(HDC16,INT16,INT16,LPSIZE16);
+BOOL32     SetWindowExtEx32(HDC32,INT32,INT32,LPSIZE32);
+#define    SetWindowExtEx WINELIB_NAME(SetWindowExtEx)
+BOOL16     SetWindowOrgEx16(HDC16,INT16,INT16,LPPOINT16);
+BOOL32     SetWindowOrgEx32(HDC32,INT32,INT32,LPPOINT32);
+#define    SetWindowOrgEx WINELIB_NAME(SetWindowOrgEx)
+BOOL16     SetWindowPlacement16(HWND16,const WINDOWPLACEMENT16*);
+BOOL32     SetWindowPlacement32(HWND32,const WINDOWPLACEMENT32*);
+#define    SetWindowPlacement WINELIB_NAME(SetWindowPlacement)
+BOOL16     SubtractRect16(LPRECT16,const RECT16*,const RECT16*);
+BOOL32     SubtractRect32(LPRECT32,const RECT32*,const RECT32*);
+#define    SubtractRect WINELIB_NAME(SubtractRect)
+BOOL16     TextOut16(HDC16,INT16,INT16,LPCSTR,INT16);
+BOOL32     TextOut32A(HDC32,INT32,INT32,LPCSTR,INT32);
+BOOL32     TextOut32W(HDC32,INT32,INT32,LPCWSTR,INT32);
+#define    TextOut WINELIB_NAME_AW(TextOut)
+BOOL16     TrackPopupMenu16(HMENU16,UINT16,INT16,INT16,INT16,HWND16,const RECT16*);
+BOOL32     TrackPopupMenu32(HMENU32,UINT32,INT32,INT32,INT32,HWND32,const RECT32*);
+#define    TrackPopupMenu WINELIB_NAME(TrackPopupMenu)
+BOOL16     UnionRect16(LPRECT16,const RECT16*,const RECT16*);
+BOOL32     UnionRect32(LPRECT32,const RECT32*,const RECT32*);
+#define    UnionRect WINELIB_NAME(UnionRect)
+BOOL16     UnregisterClass16(SEGPTR,HINSTANCE16);
+BOOL32     UnregisterClass32A(LPCSTR,HINSTANCE32);
+BOOL32     UnregisterClass32W(LPCWSTR,HINSTANCE32);
+#define    UnregisterClass WINELIB_NAME_AW(UnregisterClass)
+void       ValidateRect16(HWND16,const RECT16*);
+void       ValidateRect32(HWND32,const RECT32*);
+#define    ValidateRect WINELIB_NAME(ValidateRect)
+HWND16     WindowFromPoint16(POINT16);
+HWND32     WindowFromPoint32(POINT32);
+#define    WindowFromPoint WINELIB_NAME(WindowFromPoint)
 
 #ifdef WINELIB
 #define WINELIB_UNIMP(x) fprintf (stderr, "WineLib: Unimplemented %s\n", x)
diff --git a/include/winnt.h b/include/winnt.h
index b72a44d..4a5d3bf 100644
--- a/include/winnt.h
+++ b/include/winnt.h
@@ -18,6 +18,7 @@
 #define HEAP_DISABLE_COALESCE_ON_FREE   0x00000080
 #define HEAP_CREATE_ALIGN_16            0x00010000
 #define HEAP_CREATE_ENABLE_TRACING      0x00020000
-
+#define HEAP_WINE_SEGPTR                0x01000000  /* Not a Win32 flag */
+#define HEAP_WINE_CODESEG               0x02000000  /* Not a Win32 flag */
 
 #endif  /* __WINE_WINNT_H */
diff --git a/include/winpos.h b/include/winpos.h
index 94d2dc5..654bf12 100644
--- a/include/winpos.h
+++ b/include/winpos.h
@@ -22,7 +22,7 @@
     WORD        valid;
     WORD        wMagic;
     HWND        hwndParent;
-    WINDOWPOS   winPos[1];
+    WINDOWPOS16 winPos[1];
 } DWP;
 
 typedef struct
@@ -36,10 +36,10 @@
 extern BOOL WINPOS_SetActiveWindow( HWND hWnd, BOOL fMouse, BOOL fChangeFocus);
 extern BOOL WINPOS_ChangeActiveWindow( HWND hwnd, BOOL mouseMsg );
 extern LONG WINPOS_SendNCCalcSize( HWND hwnd, BOOL calcValidRect,
-				   RECT *newWindowRect, RECT *oldWindowRect,
-				   RECT *oldClientRect, SEGPTR winpos,
-				   RECT *newClientRect );
-extern LONG WINPOS_HandleWindowPosChanging( WINDOWPOS *winpos );
-extern INT WINPOS_WindowFromPoint( POINT pt, WND **ppWnd );
+                                  RECT16 *newWindowRect, RECT16 *oldWindowRect,
+				  RECT16 *oldClientRect, SEGPTR winpos,
+				  RECT16 *newClientRect );
+extern LONG WINPOS_HandleWindowPosChanging( WINDOWPOS16 *winpos );
+extern INT16 WINPOS_WindowFromPoint( POINT16 pt, WND **ppWnd );
 
 #endif  /* __WINE_WINPOS_H */
diff --git a/include/winreg.h b/include/winreg.h
index d8e23b0..62c4529 100644
--- a/include/winreg.h
+++ b/include/winreg.h
@@ -59,6 +59,7 @@
 #define	REG_OPTION_NON_VOLATILE	0x00000000
 #define	REG_OPTION_VOLATILE	0x00000001
 #define	REG_OPTION_CREATE_LINK	0x00000002
+#define REG_OPTION_TAINTED	0x80000000
 
 #define REG_CREATED_NEW_KEY	0x00000001
 #define REG_OPENED_EXISTING_KEY	0x00000002
diff --git a/include/wintypes.h b/include/wintypes.h
index a9bbe79..0ed35af 100644
--- a/include/wintypes.h
+++ b/include/wintypes.h
@@ -41,8 +41,8 @@
 #  define WINELIB_NAME_AW(func)  func##16
 # endif  /* WINELIB32 */
 #else   /* WINELIB */
-# define WINELIB_NAME(func)      /* nothing */
-# define WINELIB_NAME_AW(func)   /* nothing */
+# define WINELIB_NAME(func)      this is a syntax error
+# define WINELIB_NAME_AW(func)   this is a syntax error
 #endif  /* WINELIB */
 
 #ifdef WINELIB
@@ -62,12 +62,13 @@
 typedef unsigned int    UINT32;
 typedef unsigned short  WORD;
 typedef unsigned long   DWORD;
-typedef unsigned short  BOOL;
 typedef unsigned char   BYTE;
 typedef long            LONG;
 typedef char            CHAR;
 /* Some systems might have wchar_t, but we really need 16 bit characters */
 typedef unsigned short  WCHAR;
+typedef unsigned short  BOOL16;
+typedef int             BOOL32;
 
 /* Handles types. These are the same for emulator and library. */
 
@@ -186,6 +187,7 @@
 DECL_WINELIB_TYPE(LPINT);
 DECL_WINELIB_TYPE(LPUINT);
 DECL_WINELIB_TYPE(UINT);
+DECL_WINELIB_TYPE(BOOL);
 DECL_WINELIB_TYPE(WPARAM);
 
 DECL_WINELIB_TYPE(HACCEL);
@@ -232,18 +234,15 @@
 #ifndef WINELIB
 typedef INT16 INT;
 typedef UINT16 UINT;
+typedef BOOL16 BOOL;
 typedef WPARAM16 WPARAM;
-typedef HANDLE16 HACCEL;
 typedef HANDLE16 HANDLE;
 typedef HANDLE16 HBITMAP;
 typedef HANDLE16 HBRUSH;
 typedef HANDLE16 HCURSOR;
 typedef HANDLE16 HDC;
-typedef HANDLE16 HDROP;
 typedef HANDLE16 HDRVR;
-typedef HANDLE16 HDWP;
 typedef HANDLE16 HFONT;
-typedef HANDLE16 HGDIOBJ;
 typedef HANDLE16 HGLOBAL;
 typedef HANDLE16 HICON;
 typedef HANDLE16 HINSTANCE;
@@ -254,8 +253,6 @@
 typedef HANDLE16 HMIDIOUT;
 typedef HANDLE16 HMMIO;
 typedef HANDLE16 HMODULE;
-typedef HANDLE16 HPALETTE;
-typedef HANDLE16 HPEN;
 typedef HANDLE16 HQUEUE;
 typedef HANDLE16 HRGN;
 typedef HANDLE16 HRSRC;
@@ -335,17 +332,19 @@
 
 /* Macros to split words and longs. */
 
-#define LOBYTE(w)           ((BYTE)(WORD)(w))
-#define HIBYTE(w)           ((BYTE)((WORD)(w) >> 8))
+#define LOBYTE(w)              ((BYTE)(WORD)(w))
+#define HIBYTE(w)              ((BYTE)((WORD)(w) >> 8))
 
-#define LOWORD(l)           ((WORD)(DWORD)(l))
-#define HIWORD(l)           ((WORD)((DWORD)(l) >> 16))
+#define LOWORD(l)              ((WORD)(DWORD)(l))
+#define HIWORD(l)              ((WORD)((DWORD)(l) >> 16))
 
-#define SLOWORD(l)           ((INT16)(LONG)(l))
-#define SHIWORD(l)           ((INT16)((LONG)(l) >> 16))
+#define SLOWORD(l)             ((INT16)(LONG)(l))
+#define SHIWORD(l)             ((INT16)((LONG)(l) >> 16))
 
-#define MAKELONG(low, high) ((LONG)(((WORD)(low)) | \
-				    (((DWORD)((WORD)(high))) << 16)))
+#define MAKELONG(low,high)     ((LONG)(((WORD)(low)) | \
+                                       (((DWORD)((WORD)(high))) << 16)))
+#define MAKELPARAM(low,high)   ((LPARAM)MAKELONG(low,high))
+#define MAKEWPARAM(low,high)   ((WPARAM32)MAKELONG(low,high))
 
 #define SELECTOROF(ptr)     (HIWORD(ptr))
 #define OFFSETOF(ptr)       (LOWORD(ptr))
diff --git a/include/winuser.h b/include/winuser.h
index b8dcdb9..4cba875 100644
--- a/include/winuser.h
+++ b/include/winuser.h
@@ -86,7 +86,21 @@
     HICON32     hIconSm;
 } WNDCLASSEX32W, *LPWNDCLASSEX32W;
 
-typedef void WNDCLASSEX16;  /* There's no WNDCLASSEX in Win16 */
+typedef struct
+{
+    UINT32      cbSize;
+    UINT32      style;
+    WNDPROC16   lpfnWndProc;
+    INT16       cbClsExtra;
+    INT16       cbWndExtra;
+    HANDLE16    hInstance;
+    HICON16     hIcon;
+    HCURSOR16   hCursor;
+    HBRUSH16    hbrBackground;
+    SEGPTR      lpszMenuName;
+    SEGPTR      lpszClassName;
+    HICON16     hIconSm;
+} WNDCLASSEX16, *LPWNDCLASSEX16;
 
 DECL_WINELIB_TYPE_AW(WNDCLASS);
 DECL_WINELIB_TYPE_AW(LPWNDCLASS);
@@ -125,23 +139,7 @@
 #define GCW_STYLE           (-26)
 #define GCL_STYLE           GCW_STYLE
 #define GCW_ATOM            (-32)
-#define GCL_HICONSM         (-34)
-
-ATOM       RegisterClass16(const WNDCLASS16*);
-ATOM       RegisterClass32A(const WNDCLASS32A *);
-ATOM       RegisterClass32W(const WNDCLASS32W *);
-#define RegisterClass WINELIB_NAME_AW(RegisterClass)
-ATOM       RegisterClassEx32A(const WNDCLASSEX32A *);
-ATOM       RegisterClassEx32W(const WNDCLASSEX32W *);
-#define RegisterClassEx WINELIB_NAME_AW(RegisterClassEx)
-BOOL       UnregisterClass16(SEGPTR,HINSTANCE16);
-BOOL       UnregisterClass32A(LPCSTR,HINSTANCE32);
-BOOL       UnregisterClass32W(LPCWSTR,HINSTANCE32);
-#define UnregisterClass WINELIB_NAME_AW(UnregisterClass)
-
-BOOL       GetClassInfo(HANDLE,SEGPTR,WNDCLASS16 *);
-LONG       GetClassLong(HWND,short);
-int        GetClassName(HWND,LPSTR,short);
-LONG       SetClassLong(HWND,short,LONG);
+#define GCW_HICONSM         (-34)
+#define GCL_HICONSM         GCW_HICONSM
 
 #endif  /* __WINE_WINUSER_H */