Release 961215

Sun Dec 15 16:18:15 1996  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [graphics/x11drv/bitblt.c]
	Fixed BITBLT_StretchImage for partially covered or inverted
	bitmaps.

	* [objects/dib.c]
	Fixed the upside-down bitmap problem.

Sat Dec 14 02:49:57 1996  Thomas Sandford <t.d.g.sandford@prds-grn.demon.co.uk>

	* [if1632/user32.spec]
	IsMenu and RemoveMenu added (use existing Win16 functions).

	* [include/windows.h]
	Corrections to BITMAPINFOHEADER structure.

	* [loader/module.c] [if1632/kernel32.spec]
	New function GetModuleFileName32A (heavily based on original
	Win16 version).

	* [loader/pe_image.c]
	Hack to allow files with short PE header to be loaded (e.g.
	COMDLG32.DLL from Win32s).

	* [misc/winsock_async.c]
	#if out EIDRM case (not present in FreeBSD).

	* [tools/build.c]
	Remove trailing comments from .s files generated by build
	as these break assembly when not run through pre-processor.

	* [windows/graphics.c] [if1632/gdi32.spec]
	New function Polyline32 - based on original Polyline. Needs
	metafile support adding still.

Fri Dec 13 13:04:06 1996  Bruce Milner <Bruce.Milner@genetics.utah.edu>

	* [win32/findfile.c] [if1632/kernel.spec]
	FindFirstFile32A(): Use dos current directory for drive prefixes.
	FindNextFile32A(): Fill in file attribute information.
	Implement FindFirstFile16, FindNextFile16, FindClose16.

	* [files/drive.c]
	GetCurrentDirectory32A - Fix problem with null 3rd character in
	string.

Tue Dec 10 14:49:07 1996  Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>

	* [windows/painting.c][windows/message.c]
	Don't use linked lists to call SendMessage(), for it might destroy
 	the current listentry.

	* [misc/registry.c]
	Fixed temporary file saving (rename doesn't work across
	partitions).

	* [files/*.c]
	GetFullPathName*,GetDriveType32A fixed, CreateDirectoryEx*,
	GetVolumeInformation32W fixed.

	* [win32/process.c][if1632/kernel.spec][if1632/kernel32.spec]
	LoadLibrary* updated to new naming std., *32W added.

	* [win32/console.c] [include/wincon.h]
	Additions for NT commandline executables.

	* [if1632/advapi32.spec][if1632/kernel32.spec][win32/init.c]	
	GetUserName32W added, GetComputerName32W added,
	GetStartupInfo32W added, GetSystemInfo updated to NT standard.

	* [windows/msgbox.c][misc/shell.c][windows/graphics.c]
	MessageBox32W, ShellAbout32W, CommandLineToArgvW, Polygon32 added.

	* [misc/crtdll.c][include/crtdll.h][if1632/crtdll.spec][misc/ntdll.c]
	  [if1632/ntdll.spec]
	Lot of new unicode functions added (needed for NT).

	* [loader/pe_image.c]
	NtCurrentTeb added.

Tue Dec 10 22:39:33 1996  Albrecht Kleine  <kleine@ak.sax.de>

	* [windows/keyboard.c]
	Rewrote function TranslateAccelerator().

Mon Dec  9 14:52:13 1996  Slaven Rezic  <eserte@cs.tu-berlin.de>

	* [windows/defwnd.c] 
	DEFWND_SetText(): Set icon name.

Sun Dec  8 23:30:00 1996  Alex Korobka <alex@trantor.pharm.sunysb.edu>

	* [loader/signal.c] [misc/winsock.c] [misc/winsock_async.c]
	  [if1632/winsock.spec]
	IPC resource cleanup, bugfixes.

	* [windows/dialog.c] [windows/defdlg.c]
	More DefDlgProc() fixes.

Sun Dec  8 14:01:42 1996  Vadim Strizhevsky  <striv@ms.com>

	* [misc/clipboard.c] [objects/font.c] [win32/init.c]
 	  [win32/newfns.c] [windows/graphics.c]
	Added a few WIN32 functions which needed to run some win32
	accessories. Clock should now work almost as well as 16 bit version.
	Add: RegisterClipboardFormat32W GetTextExtentExPoint32*
	     GetModuleHandleW, DisableThreadLibraryCalls (empty stub),
	     Polygon32
	Fix: Polygon16 possible memory leak on error return.
diff --git a/include/bitmap.h b/include/bitmap.h
index 45cbad7..a27edc3 100644
--- a/include/bitmap.h
+++ b/include/bitmap.h
@@ -7,8 +7,19 @@
 #ifndef __WINE_BITMAP_H
 #define __WINE_BITMAP_H
 
+#include <X11/extensions/XShm.h>
 #include "gdi.h"
 
+#ifdef PRELIMINARY_WING16_SUPPORT
+
+typedef struct
+{
+  XShmSegmentInfo	si;
+  SEGPTR		bits;
+} __ShmBitmapCtl;
+
+#endif
+
   /* GDI logical bitmap object */
 typedef struct
 {
diff --git a/include/crtdll.h b/include/crtdll.h
new file mode 100644
index 0000000..beb87cc
--- /dev/null
+++ b/include/crtdll.h
@@ -0,0 +1,13 @@
+#ifndef _WINE_CRTDLL_H
+#define _WINE_CRTDLL_H
+
+#define CRTDLL_LC_ALL		0
+#define CRTDLL_LC_COLLATE	1
+#define CRTDLL_LC_CTYPE		2
+#define CRTDLL_LC_MONETARY	3
+#define CRTDLL_LC_NUMERIC	4
+#define CRTDLL_LC_TIME		5
+#define CRTDLL_LC_MIN		LC_ALL
+#define CRTDLL_LC_MAX		LC_TIME
+
+#endif
diff --git a/include/gdi.h b/include/gdi.h
index f4289fd..066bd02 100644
--- a/include/gdi.h
+++ b/include/gdi.h
@@ -148,7 +148,7 @@
     BOOL32     (*pArc)(DC*,INT32,INT32,INT32,INT32,INT32,INT32,INT32,INT32);
     BOOL32     (*pBitBlt)(DC*,INT32,INT32,INT32,INT32,DC*,INT32,INT32,DWORD);
     BOOL32     (*pChord)(DC*,INT32,INT32,INT32,INT32,INT32,INT32,INT32,INT32);
-    BOOL32     (*pCreateDC)(DC*,LPCSTR,LPCSTR,LPCSTR,const DEVMODE*);
+    BOOL32     (*pCreateDC)(DC*,LPCSTR,LPCSTR,LPCSTR,const DEVMODE16*);
     BOOL32     (*pDeleteDC)(DC*);
     BOOL32     (*pDeleteObject)(HGDIOBJ16);
     BOOL32     (*pEllipse)(DC*,INT32,INT32,INT32,INT32);
diff --git a/include/task.h b/include/task.h
index b12250f..04c48ba 100644
--- a/include/task.h
+++ b/include/task.h
@@ -103,7 +103,7 @@
   /* TDB flags */
 #define TDBF_WINOLDAP   0x0001
 #define TDBF_OS2APP     0x0008
-#define TDBF_WIN32S     0x0010
+#define TDBF_WIN32      0x0010
 
 #pragma pack(4)
 
diff --git a/include/wincon.h b/include/wincon.h
index c295bf7..0eb84a9 100644
--- a/include/wincon.h
+++ b/include/wincon.h
@@ -7,11 +7,20 @@
 #define CTRL_LOGOFF_EVENT 5
 #define CTRL_SHUTDOWN_EVENT 6
 
+/* Console Mode flags */
+#define ENABLE_PROCESSED_INPUT	0x01
+#define ENABLE_LINE_INPUT	0x02
+#define ENABLE_ECHO_INPUT	0x04
+#define ENABLE_WINDOW_INPUT	0x08
+#define ENABLE_MOUSE_INPUT	0x10
+
+#define ENABLE_PROCESSED_OUTPUT 0x01
+#define ENABLE_WRAP_AT_EOL_OUTPUT 0x02
+
+
 typedef BOOL32 HANDLER_ROUTINE(WORD);
 
-/*
- * Attributes flags:
- */
+/* Attributes flags: */
 
 #define FOREGROUND_BLUE      0x0001 /* text color contains blue. */
 #define FOREGROUND_GREEN     0x0002 /* text color contains green. */
@@ -47,211 +56,3 @@
 
 
 #endif  /* __WINE_WINCON_H */
-
-#if 0
-#ifndef _WINCON_H_
-#define _WINCON_H_
-
-#ifdef UNICODE
-#define FillConsoleOutputCharacter FillConsoleOutputCharacterW
-#define GetConsoleTitle GetConsoleTitleW
-#define PeekConsoleInput PeekConsoleInputW
-#define ReadConsole ReadConsoleW
-#define ReadConsoleInput ReadConsoleInputW
-#define ReadConsoleOutput ReadConsoleOutputW
-#define ReadConsoleOutputCharacter ReadConsoleOutputCharacterW
-#define ScrollConsoleScreenBuffer ScrollConsoleScreenBufferW
-#define SetConsoleTitle SetConsoleTitleW
-#define WriteConsole WriteConsoleW
-#define WriteConsoleInput WriteConsoleInputW
-#define WriteConsoleOutput WriteConsoleOutputW
-#define WriteConsoleOutputCharacter WriteConsoleOutputCharacterW
-#else
-#define FillConsoleOutputCharacter FillConsoleOutputCharacterA
-#define GetConsoleTitle GetConsoleTitleA
-#define PeekConsoleInput PeekConsoleInputA
-#define ReadConsole ReadConsoleA
-#define ReadConsoleInput ReadConsoleInputA
-#define ReadConsoleOutput ReadConsoleOutputA
-#define ReadConsoleOutputCharacter ReadConsoleOutputCharacterA
-#define ScrollConsoleScreenBuffer ScrollConsoleScreenBufferA
-#define SetConsoleTitle SetConsoleTitleA
-#define WriteConsole WriteConsoleA
-#define WriteConsoleInput WriteConsoleInputA
-#define WriteConsoleOutput WriteConsoleOutputA
-#define WriteConsoleOutputCharacter WriteConsoleOutputCharacterA
-#endif
-
-
-
-#if 0
-
-
-
-#define RIGHT_ALT_PRESSED 0x1
-#define LEFT_ALT_PRESSED 0x2
-#define RIGHT_CTRL_PRESSED 0x4
-#define LEFT_CTRL_PRESSED 0x8
-#define SHIFT_PRESSED 0x10
-#define NUMLOCK_ON 0x20
-#define SCROLLLOCK_ON 0x40
-#define CAPSLOCK_ON 0x80
-#define ENHANCED_KEY 0x100
-
-typedef struct
-  {
-    COORD dwMousePosition;
-    DWORD dwButtonState;
-    DWORD dwControlKeyState;
-    DWORD dwEventFlags;
-  }
-MOUSE_EVENT_RECORD;
-
-#define CONSOLE_TEXTMODE_BUFFER 1
-
-
-#define FROM_LEFT_1ST_BUTTON_PRESSED 0x0001
-#define RIGHTMOST_BUTTON_PRESSED 0x0002
-#define FROM_LEFT_2ND_BUTTON_PRESSED 0x0004
-#define FROM_LEFT_3RD_BUTTON_PRESSED 0x0008
-#define FROM_LEFT_4TH_BUTTON_PRESSED 0x0010
-
-
-
-
-#define MOUSE_MOVED 0x0001
-#define DOUBLE_CLICK 0x0002
-
-typedef struct
-  {
-    COORD size;
-  }
-WINDOW_BUFFER_SIZE_RECORD;
-
-typedef struct
-  {
-    UINT dwCommandId;
-  }
-MENU_EVENT_RECORD;
-
-typedef struct
-  {
-    BOOL bSetFocus;
-  }
-FOCUS_EVENT_RECORD;
-
-typedef struct
-  {
-    WORD EventType;
-    union
-      {
-	KEY_EVENT_RECORD KeyEvent;
-	MOUSE_EVENT_RECORD MouseEvent;
-	WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent;
-	MENU_EVENT_RECORD MenuEvent;
-	FOCUS_EVENT_RECORD FocusEvent;
-      }
-    Event;
-  }
-INPUT_RECORD;
-
-#define KEY_EVENT 0x1
-#define MOUSE_EVENT 0x2
-#define WINDOW_BUFFER_SIZE_EVENT 0x4
-#define MENU_EVENT 0x8
-#define FOCUS_EVENT 0x10
-
-typedef struct
-  {
-    union
-      {
-	WCHAR UnicodeChar;
-	CHAR AsciiChar;
-      }
-    Char;
-    WORD Attributes;
-  }
-CHAR_INFO;
-
-typedef struct
-  {
-    DWORD size;
-    BOOL bVisible;
-  }
-CONSOLE_CURSOR_INFO;
-
-#endif
-
-
-#if 0
-
-#define ENABLE_PROCESSED_INPUT 0x01
-#define ENABLE_LINE_INPUT 0x02
-#define ENABLE_ECHO_INPUT 0x04
-#define ENABLE_WINDOW_INPUT 0x08
-#define ENABLE_MOUSE_INPUT 0x10
-
-#define ENABLE_PROCESSED_OUTPUT 0x01
-#define ENABLE_WRAP_AT_EOL_OUTPUT 0x02
-
-
-BOOL AllocConsole (VOID);
-
-
-HANDLE CreateConsoleScreenBuffer (DWORD access, DWORD mode,
-                                  CONST SECURITY_ATTRIBUTES * lattr,
-                                  DWORD flags, VOID * ptr);
-BOOL FillConsoleOutputAttribute (HANDLE h, WORD attr, DWORD len,
-                                 COORD co, DWORD * done);
-BOOL FillConsoleOutputCharacterA (HANDLE h, CHAR c, DWORD len,
-                                  COORD co, DWORD * done);
-BOOL FlushBuffer (HANDLE h);
-BOOL FreeConsole (VOID);
-BOOL GenerateConsoleCtrlEvent (DWORD  ev,    DWORD group);
-UINT GetConsoleCP (VOID);
-BOOL GetConsoleCursorInfo (HANDLE h, CONSOLE_CURSOR_INFO *info);
-BOOL GetConsoleMode (HANDLE h, DWORD * mode);
-UINT GetConsoleOutputCP (VOID);
-BOOL GetConsoleScreenBufferInfo (HANDLE h, CONSOLE_SCREEN_BUFFER_INFO * ptr);
-DWORD GetConsoleTitleA (LPSTR str, DWORD len);
-COORD GetLargestConsoleWindowSize (HANDLE h);
-BOOL GetNumberOfConsoleInputEvents (HANDLE h, DWORD * n);
-BOOL GetNumberOfConsoleMouseButtons (DWORD * n);
-BOOL PeekConsoleInputA (HANDLE h, INPUT_RECORD * ptr, DWORD len, DWORD * done);
-BOOL ReadConsoleA (HANDLE h, VOID * ptr, DWORD len, DWORD * done, VOID * res);
-BOOL ReadConsoleInputA (HANDLE h, INPUT_RECORD * ptr, DWORD len, DWORD * done);
-BOOL ReadConsoleOutputA (HANDLE h, CHAR_INFO * ptr, COORD size,
-                         COORD fred, SMALL_RECT * reg);
-BOOL ReadConsoleOutputAttribute (HANDLE h, WORD * attr, DWORD len,
-                                 COORD rc, DWORD * done);
-BOOL ReadConsoleOutputCharacterA (HANDLE h, LPSTR c, DWORD len,
-                                  COORD rc, DWORD * done);
-BOOL ScrollConsoleScreenBufferA (HANDLE h, CONST SMALL_RECT * sr,
-                                 CONST SMALL_RECT * cr, COORD cpos,
-                                 CONST CHAR_INFO * i);
-BOOL SetConsoleActiveScreenBuffer (HANDLE h);
-BOOL SetConsoleCP (UINT i);
-BOOL SetConsoleCtrlHandler (HANDLER_ROUTINE * func,  BOOL a);
-BOOL SetConsoleCursorInfo (HANDLE h,  CONST CONSOLE_CURSOR_INFO * info);
-BOOL SetConsoleCursorPosition (HANDLE h, COORD pos);
-BOOL SetConsoleMode (HANDLE h, DWORD mode);
-BOOL SetConsoleOutputCP (UINT i);
-BOOL SetConsoleScreenBufferSize (HANDLE h, COORD size);
-BOOL SetConsoleTextAttribute (HANDLE h, WORD attrs);
-BOOL SetConsoleTitleA (const char * str);
-BOOL SetConsoleWindowInfo (HANDLE h, BOOL abs, CONST SMALL_RECT * wnd);
-BOOL WriteConsoleA (HANDLE h, CONST VOID *   ptr, DWORD slen,
-                    DWORD * done, VOID * res);
-BOOL WriteConsoleInputA (HANDLE	h, CONST INPUT_RECORD * ptr,
-                         DWORD len, DWORD * done);
-BOOL WriteConsoleOutputA (HANDLE  h, CONST CHAR_INFO * ptr,
-                          COORD size, COORD fred, 
-                          SMALL_RECT* where);
-BOOL WriteConsoleOutputAttribute (HANDLE h, CONST WORD *attr, DWORD len,
-                                  COORD co, DWORD * done);
-BOOL WriteConsoleOutputCharacterA (HANDLE h, const char * c, DWORD len,
-                                   COORD co, DWORD * done);
-#endif
-#endif
-
-#endif /* 0 */
diff --git a/include/windows.h b/include/windows.h
index 6571cc0..1bac570 100644
--- a/include/windows.h
+++ b/include/windows.h
@@ -1547,14 +1547,14 @@
 typedef struct
 {
     DWORD 	biSize;
-    DWORD 	biWidth;
-    DWORD 	biHeight;
+    LONG  	biWidth;
+    LONG  	biHeight;
     WORD 	biPlanes;
     WORD 	biBitCount;
     DWORD 	biCompression;
     DWORD 	biSizeImage;
-    DWORD 	biXPelsPerMeter;
-    DWORD 	biYPelsPerMeter;
+    LONG  	biXPelsPerMeter;
+    LONG  	biYPelsPerMeter;
     DWORD 	biClrUsed;
     DWORD 	biClrImportant;
 } BITMAPINFOHEADER, *LPBITMAPINFOHEADER;
@@ -1913,39 +1913,96 @@
 
 /* SystemParametersInfo */
 
-#define	SPI_GETBEEP			1
-#define	SPI_SETBEEP			2
-#define	SPI_GETMOUSE			3
-#define	SPI_SETMOUSE			4
-#define	SPI_GETBORDER			5
-#define	SPI_SETBORDER			6
-#define	SPI_GETKEYBOARDSPEED		10
-#define	SPI_SETKEYBOARDSPEED		11
-#define	SPI_LANGDRIVER			12
-#define SPI_ICONHORIZONTALSPACING	13
-#define SPI_GETSCREENSAVETIMEOUT	14
-#define SPI_SETSCREENSAVETIMEOUT	15
-#define SPI_GETSCREENSAVEACTIVE		16
-#define SPI_SETSCREENSAVEACTIVE		17
-#define SPI_GETGRIDGRANULARITY		18
-#define SPI_SETGRIDGRANULARITY		19
-#define SPI_SETDESKWALLPAPER		20
-#define SPI_SETDESKPATTERN		21
-#define SPI_GETKEYBOARDDELAY		22
-#define SPI_SETKEYBOARDDELAY		23
-#define SPI_ICONVERTICALSPACING		24
-#define SPI_GETICONTITLEWRAP		25
-#define SPI_SETICONTITLEWRAP		26
-#define SPI_GETMENUDROPALIGNMENT	27
-#define SPI_SETMENUDROPALIGNMENT	28
-#define SPI_SETDOUBLECLKWIDTH		29
-#define SPI_SETDOUBLECLKHEIGHT		30
-#define SPI_GETICONTITLELOGFONT		31
-#define SPI_SETDOUBLECLICKTIME		32
-#define SPI_SETMOUSEBUTTONSWAP		33
-#define SPI_SETICONTITLELOGFONT		34
-#define SPI_GETFASTTASKSWITCH		35
-#define SPI_SETFASTTASKSWITCH		36
+#define SPI_GETBEEP               1
+#define SPI_SETBEEP               2
+#define SPI_GETMOUSE              3
+#define SPI_SETMOUSE              4
+#define SPI_GETBORDER             5
+#define SPI_SETBORDER             6
+#define SPI_GETKEYBOARDSPEED      10
+#define SPI_SETKEYBOARDSPEED      11
+#define SPI_LANGDRIVER            12
+#define SPI_ICONHORIZONTALSPACING 13
+#define SPI_GETSCREENSAVETIMEOUT  14
+#define SPI_SETSCREENSAVETIMEOUT  15
+#define SPI_GETSCREENSAVEACTIVE   16
+#define SPI_SETSCREENSAVEACTIVE   17
+#define SPI_GETGRIDGRANULARITY    18
+#define SPI_SETGRIDGRANULARITY    19
+#define SPI_SETDESKWALLPAPER      20
+#define SPI_SETDESKPATTERN        21
+#define SPI_GETKEYBOARDDELAY      22
+#define SPI_SETKEYBOARDDELAY      23
+#define SPI_ICONVERTICALSPACING   24
+#define SPI_GETICONTITLEWRAP      25
+#define SPI_SETICONTITLEWRAP      26
+#define SPI_GETMENUDROPALIGNMENT  27
+#define SPI_SETMENUDROPALIGNMENT  28
+#define SPI_SETDOUBLECLKWIDTH     29
+#define SPI_SETDOUBLECLKHEIGHT    30
+#define SPI_GETICONTITLELOGFONT   31
+#define SPI_SETDOUBLECLICKTIME    32
+#define SPI_SETMOUSEBUTTONSWAP    33
+#define SPI_SETICONTITLELOGFONT   34
+#define SPI_GETFASTTASKSWITCH     35
+#define SPI_SETFASTTASKSWITCH     36
+#define SPI_SETDRAGFULLWINDOWS    37
+#define SPI_GETDRAGFULLWINDOWS    38
+#define SPI_GETNONCLIENTMETRICS   41
+#define SPI_SETNONCLIENTMETRICS   42
+#define SPI_GETMINIMIZEDMETRICS   43
+#define SPI_SETMINIMIZEDMETRICS   44
+#define SPI_GETICONMETRICS        45
+#define SPI_SETICONMETRICS        46
+#define SPI_SETWORKAREA           47
+#define SPI_GETWORKAREA           48
+#define SPI_SETPENWINDOWS         49
+#define SPI_GETFILTERKEYS         50
+#define SPI_SETFILTERKEYS         51
+#define SPI_GETTOGGLEKEYS         52
+#define SPI_SETTOGGLEKEYS         53
+#define SPI_GETMOUSEKEYS          54
+#define SPI_SETMOUSEKEYS          55
+#define SPI_GETSHOWSOUNDS         56
+#define SPI_SETSHOWSOUNDS         57
+#define SPI_GETSTICKYKEYS         58
+#define SPI_SETSTICKYKEYS         59
+#define SPI_GETACCESSTIMEOUT      60
+#define SPI_SETACCESSTIMEOUT      61
+#define SPI_GETSERIALKEYS         62
+#define SPI_SETSERIALKEYS         63
+#define SPI_GETSOUNDSENTRY        64
+#define SPI_SETSOUNDSENTRY        65
+#define SPI_GETHIGHCONTRAST       66
+#define SPI_SETHIGHCONTRAST       67
+#define SPI_GETKEYBOARDPREF       68
+#define SPI_SETKEYBOARDPREF       69
+#define SPI_GETSCREENREADER       70
+#define SPI_SETSCREENREADER       71
+#define SPI_GETANIMATION          72
+#define SPI_SETANIMATION          73
+#define SPI_GETFONTSMOOTHING      74
+#define SPI_SETFONTSMOOTHING      75
+#define SPI_SETDRAGWIDTH          76
+#define SPI_SETDRAGHEIGHT         77
+#define SPI_SETHANDHELD           78
+#define SPI_GETLOWPOWERTIMEOUT    79
+#define SPI_GETPOWEROFFTIMEOUT    80
+#define SPI_SETLOWPOWERTIMEOUT    81
+#define SPI_SETPOWEROFFTIMEOUT    82
+#define SPI_GETLOWPOWERACTIVE     83
+#define SPI_GETPOWEROFFACTIVE     84
+#define SPI_SETLOWPOWERACTIVE     85
+#define SPI_SETPOWEROFFACTIVE     86
+#define SPI_SETCURSORS            87
+#define SPI_SETICONS              88
+#define SPI_GETDEFAULTINPUTLANG   89
+#define SPI_SETDEFAULTINPUTLANG   90
+#define SPI_SETLANGTOGGLE         91
+#define SPI_GETWINDOWSEXTENSION   92
+#define SPI_SETMOUSETRAILS        93
+#define SPI_GETMOUSETRAILS        94
+#define SPI_SCREENSAVERRUNNING    97
 
 /* SystemParametersInfo flags */
 
@@ -2657,7 +2714,7 @@
 #define SS_LEFTNOWORDWRAP   0x0000000CL
 #define SS_NOPREFIX         0x00000080L
 
-/* Static Control Mesages */
+/* Static Control Messages */
 #define STM_SETICON         (WM_USER+0)
 #define STM_GETICON         (WM_USER+1)
 
@@ -3703,7 +3760,38 @@
         HANDLE32 hStdInput;
         HANDLE32 hStdOutput;
         HANDLE32 hStdError;
-} STARTUPINFO, *LPSTARTUPINFO;
+} STARTUPINFO32A, *LPSTARTUPINFO32A;
+
+typedef struct {
+        DWORD cb;
+        LPWSTR lpReserved;
+        LPWSTR lpDesktop;
+        LPWSTR lpTitle;
+        DWORD dwX;
+        DWORD dwY;
+        DWORD dwXSize;
+        DWORD dwYSize;
+        DWORD dwXCountChars;
+        DWORD dwYCountChars;
+        DWORD dwFillAttribute;
+        DWORD dwFlags;
+        WORD wShowWindow;
+        WORD cbReserved2;
+        BYTE *lpReserved2;
+        HANDLE32 hStdInput;
+        HANDLE32 hStdOutput;
+        HANDLE32 hStdError;
+} STARTUPINFO32W, *LPSTARTUPINFO32W;
+
+DECL_WINELIB_TYPE_AW(STARTUPINFO);
+DECL_WINELIB_TYPE_AW(LPSTARTUPINFO);
+
+typedef struct {
+	HANDLE32	hProcess;
+	HANDLE32	hThread;
+	DWORD		dwProcessId;
+	DWORD		dwThreadId;
+} PROCESS_INFORMATION,*LPPROCESS_INFORMATION;
 
 typedef struct {
         LONG Bias;
@@ -3814,34 +3902,113 @@
 #define HELP_MULTIKEY       0x0201
 #define HELP_SETWINPOS      0x0203
 
-typedef struct {
-        CHAR   dmDeviceName[32];
-        WORD   dmSpecVersion;
-        WORD   dmDriverVersion;
-        WORD   dmSize;
-        WORD   dmDriverExtra;
-        DWORD  dmFields;
-        short  dmOrientation;
-        short  dmPaperSize;
-        short  dmPaperLength;
-        short  dmPaperWidth;
-        short  dmScale;
-        short  dmCopies;
-        short  dmDefaultSource;
-        short  dmPrintQuality;
-        short  dmColor;
-        short  dmDuplex;
-        short  dmYResolution;
-        short  dmTTOption;
-        short  dmCollate;
-        CHAR   dmFormName[32];
-        WORD   dmUnusedPadding;
-        WORD   dmBitsPerPel;
-        DWORD  dmPelsWidth;
-        DWORD  dmPelsHeight;
-        DWORD  dmDisplayFlags;
-        DWORD  dmDisplayFrequency;
-} DEVMODE;
+#define CCHDEVICENAME 32
+#define CCHFORMNAME   32
+
+typedef struct
+{
+    BYTE   dmDeviceName[CCHDEVICENAME];
+    WORD   dmSpecVersion;
+    WORD   dmDriverVersion;
+    WORD   dmSize;
+    WORD   dmDriverExtra;
+    DWORD  dmFields;
+    INT16  dmOrientation;
+    INT16  dmPaperSize;
+    INT16  dmPaperLength;
+    INT16  dmPaperWidth;
+    INT16  dmScale;
+    INT16  dmCopies;
+    INT16  dmDefaultSource;
+    INT16  dmPrintQuality;
+    INT16  dmColor;
+    INT16  dmDuplex;
+    INT16  dmYResolution;
+    INT16  dmTTOption;
+    INT16  dmCollate;
+    BYTE   dmFormName[CCHFORMNAME];
+    WORD   dmUnusedPadding;
+    WORD   dmBitsPerPel;
+    DWORD  dmPelsWidth;
+    DWORD  dmPelsHeight;
+    DWORD  dmDisplayFlags;
+    DWORD  dmDisplayFrequency;
+} DEVMODE16, *LPDEVMODE16;
+
+typedef struct
+{
+    BYTE   dmDeviceName[CCHDEVICENAME];
+    WORD   dmSpecVersion;
+    WORD   dmDriverVersion;
+    WORD   dmSize;
+    WORD   dmDriverExtra;
+    DWORD  dmFields;
+    INT16  dmOrientation;
+    INT16  dmPaperSize;
+    INT16  dmPaperLength;
+    INT16  dmPaperWidth;
+    INT16  dmScale;
+    INT16  dmCopies;
+    INT16  dmDefaultSource;
+    INT16  dmPrintQuality;
+    INT16  dmColor;
+    INT16  dmDuplex;
+    INT16  dmYResolution;
+    INT16  dmTTOption;
+    INT16  dmCollate;
+    BYTE   dmFormName[CCHFORMNAME];
+    WORD   dmLogPixels;
+    DWORD  dmBitsPerPel;
+    DWORD  dmPelsWidth;
+    DWORD  dmPelsHeight;
+    DWORD  dmDisplayFlags;
+    DWORD  dmDisplayFrequency;
+    DWORD  dmICMMethod;
+    DWORD  dmICMIntent;
+    DWORD  dmMediaType;
+    DWORD  dmDitherType;
+    DWORD  dmReserved1;
+    DWORD  dmReserved2;
+} DEVMODE32A, *LPDEVMODE32A;
+
+typedef struct
+{
+    WCHAR  dmDeviceName[CCHDEVICENAME];
+    WORD   dmSpecVersion;
+    WORD   dmDriverVersion;
+    WORD   dmSize;
+    WORD   dmDriverExtra;
+    DWORD  dmFields;
+    INT16  dmOrientation;
+    INT16  dmPaperSize;
+    INT16  dmPaperLength;
+    INT16  dmPaperWidth;
+    INT16  dmScale;
+    INT16  dmCopies;
+    INT16  dmDefaultSource;
+    INT16  dmPrintQuality;
+    INT16  dmColor;
+    INT16  dmDuplex;
+    INT16  dmYResolution;
+    INT16  dmTTOption;
+    INT16  dmCollate;
+    WCHAR  dmFormName[CCHFORMNAME];
+    WORD   dmLogPixels;
+    DWORD  dmBitsPerPel;
+    DWORD  dmPelsWidth;
+    DWORD  dmPelsHeight;
+    DWORD  dmDisplayFlags;
+    DWORD  dmDisplayFrequency;
+    DWORD  dmICMMethod;
+    DWORD  dmICMIntent;
+    DWORD  dmMediaType;
+    DWORD  dmDitherType;
+    DWORD  dmReserved1;
+    DWORD  dmReserved2;
+} DEVMODE32W, *LPDEVMODE32W;
+
+DECL_WINELIB_TYPE_AW(DEVMODE);
+DECL_WINELIB_TYPE_AW(LPDEVMODE);
 
 typedef struct _SYSTEM_POWER_STATUS
 {
@@ -3924,17 +4091,98 @@
 
 typedef struct tagSYSTEM_INFO
 {
-    DWORD   dwOemId;
-    DWORD   dwPageSize;
-    LPVOID  lpMinimumApplicationAddress;
-    LPVOID  lpMaximumApplicationAddress;
-    DWORD   dwActiveProcessorMask;
-    DWORD   dwNumberOfProcessors;
-    DWORD   dwProcessorType;
-    DWORD   dwAllocationGranularity;
-    DWORD   dwReserved;
+    union {
+    	DWORD	dwOemId;
+	struct {
+		WORD wProcessorArchitecture;
+		WORD wReserved;
+	} x;
+    } u;
+    DWORD	dwPageSize;
+    LPVOID	lpMinimumApplicationAddress;
+    LPVOID	lpMaximumApplicationAddress;
+    DWORD	dwActiveProcessorMask;
+    DWORD	dwNumberOfProcessors;
+    DWORD	dwProcessorType;
+    DWORD	dwAllocationGranularity;
+    WORD	wProcessorLevel;
+    WORD	wProcessorRevision;
 } SYSTEM_INFO, *LPSYSTEM_INFO;
 
+/* u.x.wProcessorArchitecture (NT) */
+#define	PROCESSOR_ARCHITECTURE_INTEL	0
+#define	PROCESSOR_ARCHITECTURE_MIPS	1
+#define	PROCESSOR_ARCHITECTURE_ALPHA	2
+#define	PROCESSOR_ARCHITECTURE_PPC	3
+#define	PROCESSOR_ARCHITECTURE_UNKNOWN	0xFFFF
+
+/* dwProcessorType */
+#define	PROCESSOR_INTEL_386	386
+#define	PROCESSOR_INTEL_486	486
+#define	PROCESSOR_INTEL_PENTIUM	586
+#define	PROCESSOR_MIPS_R4000	4000
+#define	PROCESSOR_ALPHA_21064	21064
+
+/* service main function prototype */
+typedef VOID (*LPSERVICE_MAIN_FUNCTION32A)(DWORD,LPSTR);
+typedef VOID (*LPSERVICE_MAIN_FUNCTION32W)(DWORD,LPWSTR);
+DECL_WINELIB_TYPE_AW(LPSERVICE_MAIN_FUNCTION);
+
+/* service start table */
+typedef struct
+{
+    LPSTR			lpServiceName;
+    LPSERVICE_MAIN_FUNCTION32A	lpServiceProc;
+} *LPSERVICE_TABLE_ENTRY32A, SERVICE_TABLE_ENTRY32A;
+
+typedef struct
+{
+    LPWSTR			lpServiceName;
+    LPSERVICE_MAIN_FUNCTION32W	lpServiceProc;
+} *LPSERVICE_TABLE_ENTRY32W, SERVICE_TABLE_ENTRY32W;
+
+DECL_WINELIB_TYPE_AW(SERVICE_TABLE_ENTRY);
+DECL_WINELIB_TYPE_AW(LPSERVICE_TABLE_ENTRY);
+
+/* Security Ids of NT */
+
+typedef struct {
+	BYTE	Value[6];
+} SID_IDENTIFIER_AUTHORITY,*LPSID_IDENTIFIER_AUTHORITY;
+
+typedef struct _SID {
+	BYTE	Revision;
+	BYTE	SubAuthorityCount;
+	SID_IDENTIFIER_AUTHORITY	IdentifierAuthority;
+	DWORD	SubAuthority[1];	/* more than one */
+} SID,*LPSID;
+
+#define	SID_REVISION			(1)	/* Current revision */
+#define	SID_MAX_SUB_AUTHORITIES		(15)	/* current max subauths */
+#define	SID_RECOMMENDED_SUB_AUTHORITIES	(1)	/* recommended subauths */
+
+/* NT lowlevel Strings (handled by Rtl* functions in NTDLL)
+ * If they are zero terminated, Length does not include the terminating 0.
+ */
+
+typedef struct _STRING {
+	UINT16	Length;
+	UINT16	MaximumLength;
+	LPSTR	Buffer;
+} STRING,*LPSTRING,ANSI_STRING,*LPANSI_STRING;
+
+typedef struct _CSTRING {
+	UINT16	Length;
+	UINT16	MaximumLength;
+	LPCSTR	Buffer;
+} CSTRING,*LPCSTRING;
+
+typedef struct _UNICODE_STRING {
+	UINT16	Length;		/* bytes ? */
+	UINT16	MaximumLength;	/* bytes ? */
+	LPWSTR	Buffer;
+} UNICODE_STRING,*LPUNICODE_STRING;
+
 #pragma pack(4)
 
 /* Declarations for functions that exist only in Win16 */
@@ -3943,6 +4191,8 @@
 WORD       AllocDStoCSAlias(WORD);
 WORD       AllocSelector(WORD);
 WORD       AllocSelectorArray(WORD);
+LPSTR      AnsiLower(LPSTR);
+LPSTR      AnsiUpper(LPSTR);
 INT16      Catch(LPCATCHBUF);
 WORD       ChangeSelector(WORD,WORD);
 INT16      CloseComm(INT16);
@@ -4107,6 +4357,9 @@
 BOOL32     MoveFile32W(LPCWSTR,LPCWSTR);
 #define    MoveFile WINELIB_NAME_AW(MoveFile)
 BOOL32     QueryPerformanceCounter(LPLARGE_INTEGER);
+BOOL32     ReadConsole32A(HANDLE32,LPVOID,DWORD,LPDWORD,LPVOID);
+BOOL32     ReadConsole32W(HANDLE32,LPVOID,DWORD,LPDWORD,LPVOID);
+#define    ReadConsole WINELIB_NAME_AW(ReadConsole)
 BOOL32     ReadFile(HFILE,LPVOID,DWORD,LPDWORD,LPOVERLAPPED);
 DWORD      RegCreateKeyEx32A(HKEY,LPCSTR,DWORD,LPSTR,DWORD,REGSAM,
                              LPSECURITY_ATTRIBUTES,LPHKEY,LPDWORD);
@@ -4133,6 +4386,9 @@
 BOOL32     SetBrushOrgEx(HDC32,INT32,INT32,LPPOINT32);
 BOOL32     SetCommMask(INT32,DWORD);
 BOOL32     SetCommTimeouts(INT32,LPCOMMTIMEOUTS);
+BOOL32     SetConsoleTitle32A(LPCSTR);
+BOOL32     SetConsoleTitle32W(LPCWSTR);
+#define    SetConsoleTitle WINELIB_NAME_AW(SetConsoleTitle)
 BOOL32     SetEndOfFile(HFILE);
 DWORD      SetFilePointer(HFILE,LONG,LPLONG,DWORD);
 BOOL32     SetFileTime(HFILE,LPFILETIME,LPFILETIME,LPFILETIME);
@@ -4143,6 +4399,9 @@
 BOOL32     SystemTimeToFileTime(LPSYSTEMTIME,LPFILETIME);
 LPVOID     VirtualAlloc(LPVOID,DWORD,DWORD,DWORD);
 BOOL32     VirtualFree(LPVOID,DWORD,DWORD);
+BOOL32     WriteConsole32A(HANDLE32,LPVOID,DWORD,LPDWORD,LPVOID);
+BOOL32     WriteConsole32W(HANDLE32,LPVOID,DWORD,LPDWORD,LPVOID);
+#define    WriteConsole WINELIB_NAME_AW(WriteConsole)
 BOOL32     WriteFile(HFILE,LPVOID,DWORD,LPDWORD,LPOVERLAPPED);
 
 
@@ -4316,6 +4575,10 @@
 HBRUSH16   CreateBrushIndirect16(const LOGBRUSH16*);
 HBRUSH32   CreateBrushIndirect32(const LOGBRUSH32*);
 #define    CreateBrushIndirect WINELIB_NAME(CreateBrushIndirect)
+HDC16      CreateDC16(LPCSTR,LPCSTR,LPCSTR,const DEVMODE16*);
+HDC32      CreateDC32A(LPCSTR,LPCSTR,LPCSTR,const DEVMODE32A*);
+HDC32      CreateDC32W(LPCWSTR,LPCWSTR,LPCWSTR,const DEVMODE32W*);
+#define    CreateDC WINELIB_NAME_AW(CreateDC)
 HWND16     CreateDialog16(HINSTANCE16,SEGPTR,HWND16,DLGPROC16);
 #define    CreateDialog32A(inst,ptr,hwnd,dlg) \
            CreateDialogParam32A(inst,ptr,hwnd,dlg,0)
@@ -4343,6 +4606,9 @@
 BOOL32     CreateDirectory32A(LPCSTR,LPSECURITY_ATTRIBUTES);
 BOOL32     CreateDirectory32W(LPCWSTR,LPSECURITY_ATTRIBUTES);
 #define    CreateDirectory WINELIB_NAME_AW(CreateDirectory)
+BOOL32     CreateDirectoryEx32A(LPCSTR,LPCSTR,LPSECURITY_ATTRIBUTES);
+BOOL32     CreateDirectoryEx32W(LPCWSTR,LPCWSTR,LPSECURITY_ATTRIBUTES);
+#define    CreateDirectoryEx WINELIB_NAME_AW(CreateDirectoryEx)
 HRGN16     CreateEllipticRgn16(INT16,INT16,INT16,INT16);
 HRGN32     CreateEllipticRgn32(INT32,INT32,INT32,INT32);
 #define    CreateEllipticRgn WINELIB_NAME(CreateEllipticRgn)
@@ -4690,9 +4956,17 @@
 UINT16     GetInternalWindowPos16(HWND16,LPRECT16,LPPOINT16);
 UINT32     GetInternalWindowPos32(HWND32,LPRECT32,LPPOINT32);
 #define    GetInternalWindowPos WINELIB_NAME(GetInternalWindowPos)
+INT16      GetKeyNameText16(LONG,LPSTR,INT16);
+INT32      GetKeyNameText32A(LONG,LPSTR,INT32);
+INT32      GetKeyNameText32W(LONG,LPWSTR,INT32);
+#define    GetKeyNameText WINELIB_NAME_AW(GetKeyNameText)
 UINT32     GetLogicalDriveStrings32A(UINT32,LPSTR);
 UINT32     GetLogicalDriveStrings32W(UINT32,LPWSTR);
 #define    GetLogicalDriveStrings WINELIB_NAME_AW(GetLogicalDriveStrings)
+INT16      GetModuleFileName16(HINSTANCE16,LPSTR,INT16);
+DWORD      GetModuleFileName32A(HMODULE32,LPSTR,DWORD);
+DWORD      GetModuleFileName32W(HMODULE32,LPWSTR,DWORD);
+#define    GetModuleFileName WINELIB_NAME_AW(GetModuleFileName)
 HWND16     GetNextDlgGroupItem16(HWND16,HWND16,BOOL16);
 HWND32     GetNextDlgGroupItem32(HWND32,HWND32,BOOL32);
 #define    GetNextDlgGroupItem WINELIB_NAME(GetNextDlgGroupItem)
@@ -4768,6 +5042,10 @@
 BOOL32     GetTextExtentPoint32A(HDC32,LPCSTR,INT32,LPSIZE32);
 BOOL32     GetTextExtentPoint32W(HDC32,LPCWSTR,INT32,LPSIZE32);
 #define    GetTextExtentPoint WINELIB_NAME_AW(GetTextExtentPoint)
+INT16      GetTextFace16(HDC16,INT16,LPSTR);
+INT32      GetTextFace32A(HDC32,INT32,LPSTR);
+INT32      GetTextFace32W(HDC32,INT32,LPWSTR);
+#define    GetTextFace WINELIB_NAME_AW(GetTextFace)
 BOOL16     GetTextMetrics16(HDC16,LPTEXTMETRIC16);
 BOOL32     GetTextMetrics32A(HDC32,LPTEXTMETRIC32A);
 BOOL32     GetTextMetrics32W(HDC32,LPTEXTMETRIC32W);
@@ -4817,6 +5095,10 @@
 INT32      GetWindowText32A(HWND32,LPSTR,INT32);
 INT32      GetWindowText32W(HWND32,LPWSTR,INT32);
 #define    GetWindowText WINELIB_NAME_AW(GetWindowText)
+INT16      GetWindowTextLength16(HWND16);
+INT32      GetWindowTextLength32A(HWND32);
+INT32      GetWindowTextLength32W(HWND32);
+#define    GetWindowTextLength WINELIB_NAME_AW(GetWindowTextLength)
 ATOM       GlobalAddAtom16(SEGPTR);
 ATOM       GlobalAddAtom32A(LPCSTR);
 ATOM       GlobalAddAtom32W(LPCWSTR);
@@ -4951,6 +5233,10 @@
 HICON32    LoadIcon32A(HINSTANCE32,LPCSTR);
 HICON32    LoadIcon32W(HINSTANCE32,LPCWSTR);
 #define    LoadIcon WINELIB_NAME_AW(LoadIcon)
+HINSTANCE16 LoadLibrary16(LPCSTR);
+HINSTANCE32 LoadLibrary32A(LPCSTR);
+HINSTANCE32 LoadLibrary32W(LPCWSTR);
+#define    LoadLibrary WINELIB_NAME_AW(LoadLibrary)
 HMENU16    LoadMenu16(HINSTANCE16,SEGPTR);
 HMENU32    LoadMenu32A(HINSTANCE32,LPCSTR);
 HMENU32    LoadMenu32W(HINSTANCE32,LPCWSTR);
@@ -5014,6 +5300,10 @@
 void       MapWindowPoints16(HWND16,HWND16,LPPOINT16,UINT16);
 void       MapWindowPoints32(HWND32,HWND32,LPPOINT32,UINT32);
 #define    MapWindowPoints WINELIB_NAME(MapWindowPoints)
+INT16      MessageBox16(HWND16,LPCSTR,LPCSTR,UINT16);
+INT32      MessageBox32A(HWND32,LPCSTR,LPCSTR,UINT32);
+INT32      MessageBox32W(HWND32,LPCWSTR,LPCWSTR,UINT32);
+#define    MessageBox WINELIB_NAME_AW(MessageBox)
 BOOL16     ModifyMenu16(HMENU16,UINT16,UINT16,UINT16,SEGPTR);
 BOOL32     ModifyMenu32A(HMENU32,UINT32,UINT32,UINT32,LPCSTR);
 BOOL32     ModifyMenu32W(HMENU32,UINT32,UINT32,UINT32,LPCWSTR);
@@ -5122,6 +5412,10 @@
 ATOM       RegisterClassEx32A(const WNDCLASSEX32A *);
 ATOM       RegisterClassEx32W(const WNDCLASSEX32W *);
 #define    RegisterClassEx WINELIB_NAME_AW(RegisterClassEx)
+UINT16     RegisterClipboardFormat16(LPCSTR);
+UINT32     RegisterClipboardFormat32A(LPCSTR);
+UINT32     RegisterClipboardFormat32W(LPCWSTR);
+#define    RegisterClipboardFormat WINELIB_NAME_AW(RegisterClipboardFormat)
 WORD       RegisterWindowMessage16(SEGPTR);
 WORD       RegisterWindowMessage32A(LPCSTR);
 WORD       RegisterWindowMessage32W(LPCWSTR);
@@ -5314,6 +5608,10 @@
 BOOL16     SubtractRect16(LPRECT16,const RECT16*,const RECT16*);
 BOOL32     SubtractRect32(LPRECT32,const RECT32*,const RECT32*);
 #define    SubtractRect WINELIB_NAME(SubtractRect)
+BOOL16     SystemParametersInfo16(UINT16,UINT16,LPVOID,UINT16);
+BOOL32     SystemParametersInfo32A(UINT32,UINT32,LPVOID,UINT32);
+BOOL32     SystemParametersInfo32W(UINT32,UINT32,LPVOID,UINT32);
+#define    SystemParametersInfo WINELIB_NAME_AW(SystemParametersInfo)
 BOOL16     TextOut16(HDC16,INT16,INT16,LPCSTR,INT16);
 BOOL32     TextOut32A(HDC32,INT32,INT32,LPCSTR,INT32);
 BOOL32     TextOut32W(HDC32,INT32,INT32,LPCWSTR,INT32);
@@ -5471,13 +5769,11 @@
 ATOM       AddAtom(SEGPTR);
 INT        AddFontResource(LPCSTR);
 BOOL       AnimatePalette(HPALETTE16,UINT,UINT,LPPALETTEENTRY);
-LPSTR      AnsiLower(LPSTR);
 UINT       AnsiLowerBuff(LPSTR,UINT);
 SEGPTR     AnsiNext(SEGPTR);
 SEGPTR     AnsiPrev(SEGPTR,SEGPTR);
 INT        AnsiToOem(LPCSTR,LPSTR);
 void       AnsiToOemBuff(LPCSTR,LPSTR,UINT);
-LPSTR      AnsiUpper(LPSTR);
 UINT       AnsiUpperBuff(LPSTR,UINT);
 BOOL       AnyPopup(void);
 UINT       ArrangeIconicWindows(HWND);
@@ -5497,9 +5793,8 @@
 HDC16      CreateCompatibleDC(HDC16);
 HCURSOR16  CreateCursor(HINSTANCE16,INT,INT,INT,INT,const BYTE*,const BYTE*);
 HGLOBAL16  CreateCursorIconIndirect(HINSTANCE16,CURSORICONINFO*,const BYTE*,const BYTE*);
-HDC16      CreateDC(LPCSTR,LPCSTR,LPCSTR,const DEVMODE*);
 HBITMAP16  CreateDIBitmap(HDC16,BITMAPINFOHEADER*,DWORD,LPVOID,BITMAPINFO*,UINT);
-HDC16      CreateIC(LPCSTR,LPCSTR,LPCSTR,const DEVMODE*);
+HDC16      CreateIC(LPCSTR,LPCSTR,LPCSTR,const DEVMODE16*);
 HICON16    CreateIcon(HINSTANCE16,INT,INT,BYTE,BYTE,const BYTE*,const BYTE*);
 HMENU16    CreateMenu(void);
 HPALETTE16 CreatePalette(const LOGPALETTE*);
@@ -5566,7 +5861,6 @@
 BOOL       GetInputState(void);
 int        GetKBCodePage(void);
 int        GetKerningPairs(HDC16,int,LPKERNINGPAIR16);
-int        GetKeyNameText(LONG,LPSTR,int);
 INT        GetKeyState(INT);
 void       GetKeyboardState(BYTE*);
 int        GetKeyboardType(int);
@@ -5584,7 +5878,6 @@
 LONG       GetMessageTime(void);
 HMETAFILE16 GetMetaFile(LPSTR);
 HGLOBAL16  GetMetaFileBits(HMETAFILE16);
-INT16      GetModuleFileName(HINSTANCE16,LPSTR,INT16);
 HMODULE16  GetModuleHandle(LPCSTR);
 INT16      GetModuleUsage(HINSTANCE16);
 DWORD      GetNearestColor(HDC16,DWORD);
@@ -5610,7 +5903,6 @@
 short      GetTextCharacterExtra(HDC16);
 COLORREF   GetTextColor(HDC16);
 DWORD      GetTextExtent(HDC16,LPCSTR,short);
-INT        GetTextFace(HDC16,INT,LPSTR);
 LPINT16    GetThresholdEvent(void);
 int        GetThresholdStatus(void);
 HWND       GetTopWindow(HWND);
@@ -5621,7 +5913,6 @@
 HWND       GetWindow(HWND,WORD);
 DWORD      GetWindowExt(HDC16);
 DWORD      GetWindowOrg(HDC16);
-int        GetWindowTextLength(HWND);
 ATOM       GlobalDeleteAtom(ATOM);
 void       GlobalFix(HGLOBAL16);
 BOOL16     GlobalUnWire(HGLOBAL16);
@@ -5643,13 +5934,11 @@
 BOOL       IsWindowEnabled(HWND);
 BOOL       IsWindowVisible(HWND);
 BOOL       IsZoomed(HWND);
-HINSTANCE16 LoadLibrary(LPCSTR);
 HINSTANCE16 LoadModule(LPCSTR,LPVOID);
 FARPROC16  LocalNotify(FARPROC16);
 HMENU16    LookupMenuHandle(HMENU16,INT);
 WORD       MapVirtualKey(WORD,WORD);
 void       MessageBeep(WORD);
-int        MessageBox(HWND,LPCSTR,LPCSTR,WORD);
 BOOL       MoveWindow(HWND,short,short,short,short,BOOL);
 DWORD      OemKeyScan(WORD);
 BOOL       OemToAnsi(LPCSTR,LPSTR);
@@ -5671,7 +5960,6 @@
 void       ProfStart(void);
 void       ProfStop(void);
 WORD       RealizeDefaultPalette(HDC16);
-WORD       RegisterClipboardFormat(LPCSTR);
 BOOL       RemoveFontResource(LPSTR);
 BOOL       RemoveMenu(HMENU16,UINT,UINT);
 void       ReplyMessage(LRESULT);
@@ -5734,7 +6022,6 @@
 BOOL       SwapMouseButton(BOOL);
 void       SwapRecording(WORD);
 int        SyncAllVoices(void);
-BOOL       SystemParametersInfo(UINT,UINT,LPVOID,UINT);
 LONG       TabbedTextOut(HDC16,short,short,LPSTR,short,short,LPINT16,short);
 int        ToAscii(WORD,WORD,LPSTR,LPVOID,WORD);
 INT16      TranslateAccelerator(HWND,HACCEL16,LPMSG16);
diff --git a/include/winsock.h b/include/winsock.h
index ca7bcaf..0dfe7a3 100644
--- a/include/winsock.h
+++ b/include/winsock.h
@@ -433,7 +433,7 @@
   struct __aop *next, *prev;
   int           fd[2];				/* pipe */
   int   (*aop_control)(struct __aop*, int);	/* SIGIO handler */
-  pid_t         pid;			/* child process pid */
+  pid_t         pid;				/* child process pid */
 
   /* custom data */
 
@@ -443,7 +443,6 @@
   unsigned	flags;
   SEGPTR	buffer_base;
   int           buflen;
-  char*         init;			/* parameter data - length is in the async_ctl */
 } ws_async_op;
 
 #define WSMSG_ASYNC_SELECT      0x0000001
@@ -462,8 +461,8 @@
 {
   long          mtype;          /* WSMSG_... */
 
-  UINT32        lParam;
-  UINT16        wParam;         /* socket handle */
+  UINT32        lParam;		/* WS_FD_... event */
+  UINT16        wParam;         /* socket handle - used only for MTYPE_CLIENT messages */
 } ipc_packet;
 
 #define MTYPE_PARENT_SIZE \
@@ -476,7 +475,7 @@
 {
   int                   fd;
   unsigned              flags;
-  ws_async_op*          p_aop;
+  ws_async_op*          p_aop;	/* AsyncSelect() handler */
 } ws_socket;
 
 typedef struct
@@ -486,6 +485,7 @@
   int           lEvent;
   int           lLength;
   char*		buffer;
+  char*		init;
   ipc_packet    ip;
 } ws_async_ctl;
 
@@ -500,15 +500,17 @@
 
   unsigned		flags;
   int			errno;
-  int			num_startup;
-  int                   num_async_rq;
-  int                   last_free;
-  ws_socket             sock[WS_MAX_SOCKETS_PER_THREAD];
-  int			buflen;
-  char*			buffer;
+  INT16			num_startup;
+  INT16			num_async_rq;
+  INT16			last_free;
+  UINT16		buflen;
+  char*			buffer;			/* allocated from SEGPTR heap */
+  char*			dbuffer;		/* buffer for dummies (32 bytes) */
+
+  ws_socket		sock[WS_MAX_SOCKETS_PER_THREAD];
   FARPROC16		blocking_hook;
-  HTASK16               tid;    /* owning thread id - better switch
-                                 * to TLS when it gets fixed */
+  HTASK16               tid;    		/* owning thread id - better switch
+                                 		 * to TLS when it gets fixed */
 } WSINFO, *LPWSINFO;
 
 int WS_dup_he(LPWSINFO pwsi, struct hostent* p_he, int flag);
@@ -527,6 +529,7 @@
 void WINSOCK_unlink_async_op(ws_async_op* p_aop);
 void WINSOCK_cancel_async_op(HTASK16 tid);
 void WINSOCK_do_async_select(void);
+void WINSOCK_Shutdown(void);
 
 UINT16 wsaErrno(void);
 UINT16 wsaHerrno(void);