Release 940505

May 1, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte)

	* [loader/signal.c]
	Add XUngrabPointer() & XUngrabServer() in wine_fault().

Fri Apr 22 19:30:08 1994  Erik Bos (erik@trashcan.hacktic.nl)

	* [objects/bitblt.c]
	color_stretch() rewritten to use ints only. *fast!*
	BLACKONWHITE & WHITEONBLACK stretchmodes redirected to
	use color_stretch().

Mon May  2 21:39:43 1994  Erik Bos (erik@trashcan.hacktic.nl)

	* [controls/menu.c]
	SetSysMenu() added.

	* [misc/cursor.c]
	GetCursor() added.

	* [misc/main.c]
	SwapMouseButton() added, (NOP).

	* [windows/win.c]
	GetDesktopHwnd() added.

	* [if1632/*spec]
	Added not implemented functions defs as comment.

	* [misc/winsocket.c]
	Change WSAGetXbyY() functions to non-blocking ones,
	Added WSAAsyncSelect(). 
	(WSA functions can't be canceled yet).

Wed Apr 20 23:58:58 1994  Scott A. Laird  (scott@curly)

	* misc/profile.c: Fixed bug with GetIniFileName returning wrong
	path when given a simple file name.  Fixed GetSetProfile to allow
	enumerating all key names when KeyName is null.

Apr 25, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte)

	* [objects/bitblt.c]
	Add protection to BitBlt() & StretchBlt() for width or height = 0.

	* [windows/nonclient.c]
	Avoid painting in NC_DoNCPaint() if IsWindowVisible().
	Simplify NC_TrackMouseMenuBar() because code moved to MenuFocusLoop().

	* [windows/win.c]
	CreateWindowEx() & DestroyWindow() now call respectively
		AddWindowToTask() & RemoveWindowFromTask().
	New empty stub for function AnyPopup().

	* [loader/library.c]
	Bug Fix : GetModuleFileName() now return full path filename.

	* [include/menu.h] [controls/menu.c]
	Add hText handle and remove obsolete MENUITEM struct members.
	Add a ReleaseCapture() in SetMenu() when menubar changed while captured.
	Add MenuMouseMove() MenuButtonUp() in function MenuFocusLoop().

	* [misc/file.c]
	GetTempFilename() now create a file.
	_lcreate() use unix open (name, mode, perm), with perm=O666.

	* [if1632/relay.c]
	Remove temporarly builtin SHELL.DLL, Add MMSYSTEM.DLL in builtin list.

	* New file [misc/mmsystem.c]
	* New file [include/mmsystem.h]
	* New file [if1632/mmsystem.spec]
	Many, many empty stubs ... :-)
diff --git a/ChangeLog b/ChangeLog
index d446171..87a97a5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,45 @@
+----------------------------------------------------------------------
+May 1, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte)
+
+	* [loader/signal.c]
+	Add XUngrabPointer() & XUngrabServer() in wine_fault().
+
+Fri Apr 22 19:30:08 1994  Erik Bos (erik@trashcan.hacktic.nl)
+
+	* [objects/bitblt.c]
+	color_stretch() rewritten to use ints only. *fast!*
+	BLACKONWHITE & WHITEONBLACK stretchmodes redirected to
+	use color_stretch().
+
+Mon May  2 21:39:43 1994  Erik Bos (erik@trashcan.hacktic.nl)
+
+	* [controls/menu.c]
+	SetSysMenu() added.
+
+	* [misc/cursor.c]
+	GetCursor() added.
+
+	* [misc/main.c]
+	SwapMouseButton() added, (NOP).
+
+	* [windows/win.c]
+	GetDesktopHwnd() added.
+
+	* [if1632/*spec]
+	Added not implemented functions defs as comment.
+
+	* [misc/winsocket.c]
+	Change WSAGetXbyY() functions to non-blocking ones,
+	Added WSAAsyncSelect(). 
+	(WSA functions can't be canceled yet).
+
+Wed Apr 20 23:58:58 1994  Scott A. Laird  (scott@curly)
+
+	* misc/profile.c: Fixed bug with GetIniFileName returning wrong
+	path when given a simple file name.  Fixed GetSetProfile to allow
+	enumerating all key names when KeyName is null.
+
+----------------------------------------------------------------------
 Wed Apr 20 14:53:35 1994  Bob Amstadt  (bob@pooh)
 
 	* [tools/build.c] [if1632/call.S] [if1632/Imakefile]
diff --git a/README b/README
index 4e3c6a3..668a0c6 100644
--- a/README
+++ b/README
@@ -171,6 +171,12 @@
 
 7. WHAT'S NEW
 
+WHAT'S NEW with Wine-940505: (see ChangeLog for details)
+	- faster color_stretch()
+	- SetSysMenu(), GetCursor(), GetDesktopWindow()
+	- WSAGetXbyY() now non-blocking	
+	- and many many bug fixes!
+
 WHAT'S NEW with Wine-940420: (see ChangeLog for details)
 	- new property functions
 	- new listbox and combo box functions
diff --git a/autoconf.h b/autoconf.h
index e6e34a8..223fbc1 100644
--- a/autoconf.h
+++ b/autoconf.h
@@ -1,6 +1,2 @@
 /* autoconf.h generated automatically.  Run Configure. */
-
-
-
-#define WINE_INI_GLOBAL "/home/alex/wine/wine.conf"
-#define AutoDefines  
+#error You must run Configure before you can build the makefiles.
diff --git a/controls/menu.c b/controls/menu.c
index 7a79e9f..00cc095 100644
--- a/controls/menu.c
+++ b/controls/menu.c
@@ -1924,6 +1924,17 @@
 	return wndPtr->hSysMenu;
 }
 
+/**********************************************************************
+ *			SetSystemMenu		[USER.280]
+ */
+BOOL SetSystemMenu(HWND hWnd, HMENU newHmenu)
+{
+	WND	*wndPtr;
+
+	if ((wndPtr = WIN_FindWndPtr(hWnd)) != NULL)
+		wndPtr->hSysMenu = newHmenu;
+}
+
 
 /**********************************************************************
  *			GetMenu		[USER.157]
diff --git a/if1632/gdi.spec b/if1632/gdi.spec
index 027100e..9a87ccc 100644
--- a/if1632/gdi.spec
+++ b/if1632/gdi.spec
@@ -50,11 +50,15 @@
            StretchBlt(1 2 3 4 5 6 7 8 9 10 11)
 36  pascal Polygon (word ptr word) Polygon (1 2 3)
 37  pascal Polyline (word ptr word) Polyline (1 2 3)
+#38  pascal Escape
 39  pascal RestoreDC(word s_word) RestoreDC(1 2)
 40  pascal FillRgn(word word word) FillRgn(1 2 3)
+#41  pascal FrameRgn
+#42  pascal InvertRgn
 43  pascal PaintRgn(word word) PaintRgn(1 2)
 44  pascal SelectClipRgn(word word) SelectClipRgn(1 2)
 45  pascal SelectObject(word word) SelectObject(1 2)
+#46  pascal __GP?
 47  pascal CombineRgn(word word word word) CombineRgn(1 2 3 4)
 48  pascal CreateBitmap(word word word word ptr) CreateBitmap(1 2 3 4 5)
 49  pascal CreateBitmapIndirect(ptr) CreateBitmapIndirect(1)
@@ -81,6 +85,7 @@
 68  pascal DeleteDC(word) DeleteDC(1)
 69  pascal DeleteObject(word) DeleteObject(1)
 70  pascal EnumFonts(word ptr ptr ptr) EnumFonts(1 2 3 4)
+#71  pascal EnumObjects
 72  pascal EqualRgn(word word) EqualRgn(1 2)
 73  pascal ExcludeVisRect(word s_word s_word s_word s_word)
 	   ExcludeVisRect(1 2 3 4 5)
@@ -102,6 +107,7 @@
 89  pascal GetTextCharacterExtra(word) GetTextCharacterExtra(1)
 90  pascal GetTextColor(word) GetTextColor(1)
 91  pascal GetTextExtent(word ptr s_word) GetTextExtent(1 2 3)
+#92  pascal GetTextFace
 93  pascal GetTextMetrics(word ptr) GetTextMetrics(1 2)
 94  pascal GetViewportExt(word) GetViewportExt(1)
 95  pascal GetViewportOrg(word) GetViewportOrg(1)
@@ -119,41 +125,141 @@
 105 pascal SelectVisRgn(word word) SelectVisRgn(1 2)
 106 pascal SetBitmapBits(word long ptr) SetBitmapBits(1 2 3)
 117 pascal SetDCOrg(word s_word s_word) SetDCOrg(1 2 3)
+#121 pascal Death
+#122 pascal ReSurRection
+#123 pascal PlayMetaFile
+#124 pascal GetMetaFile
+#125 pascal CreateMetaFile
+#126 pascal CloseMetaFile
+#127 pascal DeleteMetaFile
 128 pascal MulDiv(s_word s_word s_word) MulDiv(1 2 3)
 129 pascal SaveVisRgn(word) SaveVisRgn(1)
 130 pascal RestoreVisRgn(word) RestoreVisRgn(1)
 131 pascal InquireVisRgn(word) InquireVisRgn(1)
+#132 pascal SetEnvironment
+#133 pascal GetEnvironment
 134 pascal GetRgnBox(word ptr) GetRgnBox(1 2)
+#135 pascal ScanLr
+#136 pascal RemoveFontResource
 148 pascal SetBrushOrg(word s_word s_word) SetBrushOrg(1 2 3)
 149 pascal GetBrushOrg(word) GetBrushOrg(1)
 150 pascal UnrealizeObject(word) UnrealizeObject(1)
+#151 pascal CopyMetaFile
 153 pascal CreateIC(ptr ptr ptr ptr) CreateIC(1 2 3 4)
 154 pascal GetNearestColor(word long) GetNearestColor(1 2)
+#155 pascal QueryAbort
+#156 pascal CreateDiscardableBitmap
+#159 pascal GetMetaFileBits
+#160 pascal SetMetaFileBits
 161 pascal PtInRegion(word s_word s_word) PtInRegion(1 2 3)
 162 pascal GetBitmapDimension(word) GetBitmapDimension(1)
 163 pascal SetBitmapDimension(word s_word s_word) SetBitmapDimension(1 2 3)
+#169 pascal IsDCDirty
+#170 pascal SetDCStatus
 172 pascal SetRectRgn(word s_word s_word s_word s_word) SetRectRgn(1 2 3 4 5)
 173 pascal GetClipRgn(word) GetClipRgn(1)
+#175 pascal EnumMetaFile
 179 pascal GetDCState(word) GetDCState(1)
 180 pascal SetDCState(word word) SetDCState(1 2)
 181 pascal RectInRegionOld(word ptr) RectInRegion(1 2)
+#190 pascal SetDCHook
+#191 pascal GetDCHook
+#192 pascal SetHookFlags
+#193 pascal SetBoundsRect
+#194 pascal GetBoundsRect
+#195 pascal SelectBitmap
+#196 pascal SetMetaFileBitsBetter
+#201 pascal DMBITBLT
+#202 pascal DMCOLORINFO
+#206 pascal DMENUMDFONTS
+#207 pascal DMENUMOBJ
+#208 pascal DMOUTPUT
+#209 pascal DMPIXEL
+#210 pascal DMREALIZEOBJECT
+#211 pascal DMSTRBLT
+#212 pascal DMSCANLR
+#213 pascal BRUTE
+#214 pascal DMEXTTEXTOUT
+#215 pascal DMGETCHARWIDTH
+#216 pascal DMSTRETCHBLT
+#217 pascal DMDIBBITS
+#218 pascal DMSTRETCHDIBITS
+#219 pascal DMSETDIBTODEV
+#220 pascal DMTRANSPOSE
+#230 pascal CREATEPQ
+#231 pascal MINPQ
+#232 pascal EXTRACTPQ
+#233 pascal INSERTPQ
+#234 pascal SIZEPQ
+#235 pascal DELETEPQ
+#240 pascal OPENJOB
+#241 pascal WRITESPOOL
+#242 pascal WRITEDIALOG
+#243 pascal CLOSEJOB
+#244 pascal DELETEJOB
+#245 pascal GETSPOOLJOB
+#246 pascal STARTSPOOLPAGE
+#247 pascal ENDSPOOLPAGE
+#248 pascal QUERYJOB
 250 pascal Copy(ptr ptr word) Copy(1 2 3)
+#253 pascal DeleteSpoolPage
+#254 pascal SpoolFile
+#300 pascal ENGINEENUMERATEFONT
+#301 pascal ENGINEDELETEFONT
+#302 pascal ENGINEREALIZEFONT
+#303 pascal ENGINEGETCHARWIDTH
+#304 pascal ENGINESETFONTCONTEXT
+#305 pascal ENGINEGETGLYPHBMP
+#306 pascal ENGINEMAKEFONTDIR
+#307 pascal GETCHARABCWIDTHS
+#308 pascal GETOUTLINETEXTMETRICS
+#309 pascal GETGLYPHOUTLINE
+#310 pascal CREATESCALABLEFONTRESOURCE
+#311 pascal GETFONTDATA
+#312 pascal CONVERTOUTLINEFONTFILE
+#313 pascal GETRASTERIZERCAPS
+#314 pascal ENGINEEXTTEXTOUT
+#330 pascal ENUMFONTFAMILIES
+#332 pascal GETKERNINGPAIRS
 345 pascal GetTextAlign(word) GetTextAlign(1)
 346 pascal SetTextAlign(word word) SetTextAlign(1 2)
 348 pascal Chord(word s_word s_word s_word s_word s_word s_word s_word s_word)
 	   Chord(1 2 3 4 5 6 7 8 9)
 349 pascal SetMapperFlags(word word) SetMapperFlags(1 2)
 350 pascal GetCharWidth(word word word ptr) GetCharWidth(1 2 3 4)
+#351 pascal EXTTEXTOUT
+#352 pascal GETPHYSICALFONTHANDLE
+#353 pascal GETASPECTRATIOFILTER
+#354 pascal SHRINKGDIHEAP
 360 pascal CreatePalette(ptr) CreatePalette(1)
 361 pascal GDISelectPalette(word word) GDISelectPalette(1 2)
 362 pascal GDIRealizePalette(word) GDIRealizePalette(1)
 363 pascal GetPaletteEntries(word word word ptr) GetPaletteEntries(1 2 3 4)
 364 pascal SetPaletteEntries(word word word ptr) SetPaletteEntries(1 2 3 4)
 365 pascal RealizeDefaultPalette(word) RealizeDefaultPalette(1)
+#366 pascal UPDATECOLORS
+#367 pascal ANIMATEPALETTE
+#368 pascal RESIZEPALETTE
 370 pascal GetNearestPaletteIndex(word long) GetNearestPaletteIndex(1 2)
 375 pascal GetSystemPaletteEntries(word word word ptr)
 	   GetSystemPaletteEntries(1 2 3 4)
+#376 pascal RESETDC
+#377 pascal STARTDOC
+#378 pascal ENDDOC
+#379 pascal STARTPAGE
+#380 pascal ENDPAGE
+#381 pascal SETABORTPROC
+#382 pascal ABORTDOC
+#400 pascal FASTWINDOWFRAME
+#401 pascal GDIMOVEBITMAP
+#403 pascal GDIINIT2
+#405 pascal FINALGDIINIT
+#407 pascal CREATEUSERBITMAP
+#409 pascal CREATEUSERDISCARDABLEBITMAP
+#410 pascal ISVALIDMETAFILE
 411 pascal GetCurLogFont(word) GetCurLogFont(1)
+#412 pascal ISDCCURRENTPALETTE
+#439 pascal STRETCHDIBITS
 440 pascal SetDIBits(word word word word ptr ptr word) SetDIBits(1 2 3 4 5 6 7)
 441 pascal GetDIBits(word word word word ptr ptr word) GetDIBits(1 2 3 4 5 6 7)
 442 pascal CreateDIBitmap(word ptr long ptr ptr word)
@@ -163,10 +269,19 @@
 444 pascal CreateRoundRectRgn(s_word s_word s_word s_word s_word s_word)
 	   CreateRoundRectRgn(1 2 3 4 5 6)
 445 pascal CreateDIBPatternBrush(word word) CreateDIBPatternBrush(1 2)
+#449 pascal DEVICECOLORMATCH
+#450 pascal POLYPOLYGON
 451 pascal CreatePolyPolygonRgn(ptr ptr word word)
 	   CreatePolyPolygonRgn(1 2 3 4)
+#452 pascal GDISEEGDIDO
+#460 pascal GDITASKTERMINATION
+#461 pascal SETOBJECTOWNER
+#462 pascal ISGDIOBJECT
+#463 pascal MAKEOBJECTPRIVATE
+#464 pascal FIXUPBOGUSPUBLISHERMETAFILE
 465 pascal RectVisible(word ptr) RectVisible(1 2)
 466 pascal RectInRegion(word ptr) RectInRegion(1 2)
+#467 pascal UNICODETOANSI
 468 pascal GetBitmapDimensionEx(word ptr) GetBitmapDimensionEx(1 2)
 469 pascal GetBrushOrgEx(word ptr) GetBrushOrgEx(1 2)
 470 pascal GetCurrentPositionEx(word ptr) GetCurrentPositionEx(1 2)
@@ -189,3 +304,4 @@
 	   ScaleViewportExtEx(1 2 3 4 5 6)
 485 pascal ScaleWindowExtEx(word s_word s_word s_word s_word ptr)
 	   ScaleWindowExtEx(1 2 3 4 5 6)
+#486 pascal GETASPECTRATIOFILEREX
diff --git a/if1632/kernel.spec b/if1632/kernel.spec
index d21f57c..327e37c 100644
--- a/if1632/kernel.spec
+++ b/if1632/kernel.spec
@@ -4,6 +4,8 @@
 id	1
 length	415
 
+#1 FATALEXIT
+#2 EXITKERNEL
 3   pascal GetVersion() GetVersion()
 4   pascal LocalInit(word word word) WIN16_LocalInit(1 2 3)
 5   pascal LocalAlloc(word word) WIN16_LocalAlloc(1 2)
@@ -27,26 +29,43 @@
 23  pascal LockSegment(s_word) KERNEL_LockSegment(1)
 24  pascal UnlockSegment(s_word) KERNEL_UnlockSegment(1)
 25  pascal GlobalCompact(long) GlobalCompact(1)
-#29  pascal Yield() Yield()
+#26 GLOBALFREEALL
+#28 GLOBALMASTERHANDLE
+29  pascal Yield() Yield()
 30  pascal WaitEvent(word) KERNEL_WaitEvent(1)
+#31 POSTEVENT
+#32 SETPRIORITY
+#33 LOCKCURRENTTASK
 34  pascal SetTaskQueue(word word) SetTaskQueue(1 2)
 35  pascal GetTaskQueue(word) GetTaskQueue(1)
 36  pascal GetCurrentTask() GetCurrentTask()
+#37 GETCURRENTPDB
+#38 SETTASKSIGNALPROC
+#41 ENABLEDOS
+#42 DISABLEDOS
 45  pascal LoadModule(ptr ptr) LoadModule(1 2)
+#46 FREEMODULE
 47  pascal GetModuleHandle(ptr) GetModuleHandle(1)
 48  pascal GetModuleUsage(word) GetModuleUsage(1)
 49  pascal GetModuleFileName(word ptr s_word) GetModuleFileName(1 2 3)
 50  pascal GetProcAddress(word ptr) GetProcAddress(1 2)
 51  pascal MakeProcInstance(ptr word) CALLBACK_MakeProcInstance(1 2)
 52  pascal FreeProcInstance(ptr) FreeProcInstance(1)
+#53 CALLPROCINSTANCE
+#54 GETINSTANCEDATA
 55  pascal Catch(ptr) Catch (1)
 56  pascal Throw(ptr word) Throw(1 2)
+57  pascal GetProfileInt(ptr ptr word) GetProfileInt(1 2 3)
+58  pascal GetProfileString(ptr ptr ptr ptr word) GetProfileString(1 2 3 4 5)
 59  pascal WriteProfileString(ptr ptr ptr) WriteProfileString(1 2 3)
 60  pascal FindResource(word ptr ptr) FindResource(1 2 3)
 61  pascal LoadResource(word word) LoadResource(1 2)
 62  pascal LockResource(word) LockResource(1)
 63  pascal FreeResource(word) FreeResource(1)
 64  pascal AccessResource(word word) AccessResource(1 2)
+#65 SIZEOFRESOURCE
+#66 ALLOCRESOURCE
+#67 SETRESOURCEHANDLER
 68  pascal InitAtomTable(word) InitAtomTable(1)
 69  pascal FindAtom(ptr) FindAtom(1)
 70  pascal AddAtom(ptr) AddAtom(1)
@@ -54,12 +73,19 @@
 72  pascal GetAtomName(word ptr word) GetAtomName(1 2 3)
 73  pascal GetAtomHandle(word) GetAtomHandle(1)
 74  pascal OpenFile(ptr ptr word) OpenFile(1 2 3)
+#75 OPENPATHNAME
+#76 DELETEPATHNAME
+#77 RESERVED1
+#78 RESERVED2
+#79 RESERVED3
+#80 RESERVED4
 81  pascal _lclose(word) _lclose(1)
 82  pascal _lread(word ptr word) _lread(1 2 3)
 83  pascal _lcreate(ptr word) _lcreate(1 2)
 84  pascal _llseek(word long word) _llseek(1 2 3)
 85  pascal _lopen(ptr word) _lopen(1 2)
 86  pascal _lwrite(word ptr word) _lwrite(1 2 3)
+#87 RESERVED5
 88  pascal lstrcpy(ptr ptr) lstrcpy(1 2)
 89  pascal lstrcat(ptr ptr) lstrcat(1 2)
 90  pascal lstrlen(ptr) lstrlen(1)
@@ -67,56 +93,154 @@
 		      word word word word word) 
 	     KERNEL_InitTask()
 92  pascal GetTempDrive(byte) GetTempDrive(1)
+#93 GETCODEHANDLE
+#94 DEFINEHANDLETABLE
 95  pascal LoadLibrary(ptr) LoadLibrary(1)
 96  pascal FreeLibrary(word) FreeLibrary(1)
 97  pascal GetTempFileName(byte ptr word ptr) GetTempFileName(1 2 3 4)
+#98 GETLASTDISKCHANGE
+#99 GETLPERRMODE
+#100 VALIDATECODESEGMENTS
+#101 NOHOOKDOSCALL
 102 register DOS3Call(word word word word word
 		      word word word word word) 
 	     DOS3Call()
+#103 NETBIOSCALL
+#104 GETCODEINFO
+#105 GETEXEVERSION
+#106 SETSWAPAREASIZE
 107 pascal SetErrorMode(word) SetErrorMode(1)
+#108 SWITCHSTACKTO
+#109 SWITCHSTACKBACK
+#110 PATCHCODEHANDLE
 111 pascal GlobalWire(word) GlobalLock(1)
 112 pascal GlobalUnWire(word) GlobalUnlock(1)
+#113 __AHSHIFT
+#114 __AHINCR
 115 pascal OutputDebugString(ptr) OutputDebugString(1)
+#116 INITLIB
+117 pascal OldYield() Yield()
+#118 GETTASKQUEUEDS
+#119 GETTASKQUEUEES
+#120 UNDEFDYNLINK
 121 return LocalShrink 4 0
+#122 ISTASKLOCKED
+#123 KBDRST
+#124 ENABLEKERNEL
+#125 DISABLEKERNEL
+#126 MEMORYFREED
 127 pascal GetPrivateProfileInt(ptr ptr s_word ptr)
 	   GetPrivateProfileInt(1 2 3 4)
 128 pascal GetPrivateProfileString(ptr ptr ptr ptr s_word ptr)
 	   GetPrivateProfileString(1 2 3 4 5 6)
 129 pascal WritePrivateProfileString(ptr ptr ptr ptr)
 	   WritePrivateProfileString(1 2 3 4)
+#130 FILECBR
 131 pascal GetDOSEnvironment() GetDOSEnvironment()
 132 pascal GetWinFlags() GetWinFlags()
-#132 return GetWinFlags 0 0x413
+#133 GETEXEPTR
 134 pascal GetWindowsDirectory(ptr word) GetWindowsDirectory(1 2)
 135 pascal GetSystemDirectory(ptr word) GetSystemDirectory(1 2)
 136 pascal GetDriveType(byte) GetDriveType(1)
 137 pascal FatalAppExit(word ptr) FatalAppExit(1 2)
+#138 GETHEAPSPACES
+#139 DOSIGNAL
+#140 SETSIGHANDLER
+#141 INITTASK1
+150 pascal DirectedYield() Yield()
+#151 WINOLDAPCALL
 152 pascal GetNumTasks() GetNumTasks()
 154 return GlobalNotify 4 0
+#155 GETTASKDS
+#156 LIMITEMSPAGES
+#157 GETCURPID
+#158 ISWINOLDAPTASK
+#159 GLOBALHANDLENORIP
+#160 EMSCOPY
+#161 LOCALCOUNTFREE
+#162 LOCALHEAPSIZE
 163 pascal GlobalLRUOldest(word) ReturnArg(1)
 164 pascal GlobalLRUNewest(word) ReturnArg(1)
+#165 A20PROC
 166 pascal WinExec(ptr word) WinExec(1 2)
+#167 GETEXPWINVER
+#168 DIRECTRESALLOC
 169 pascal GetFreeSpace(word) GetFreeSpace(1)
 170 pascal AllocCStoDSAlias(word) AllocDStoCSAlias(1)
 171 pascal AllocDStoCSAlias(word) AllocDStoCSAlias(1)
+#172 ALLOCALIAS
+#173 __ROMBIOS
+#174 __A000H
 175 pascal AllocSelector(word) AllocSelector(1)
 176 pascal FreeSelector(word) FreeSelector(1)
 177 pascal PrestoChangoSelector(word word) PrestoChangoSelector(1 2)
 178 equate __WINFLAGS 0x413
+#179 __D000H
+#180 LONGPTRADD
+#181 __B000H
+#182 __B800H
+#183 __0000H
 184 return GlobalDOSAlloc 4 0
 185 return GlobalDOSFree 2 0
+#186 GETSELECTORBASE
+#187 SETSELECTORBASE
+#188 GETSELECTORLIMIT
+#189 SETSELECTORLIMIT
+#190 __E000H
 191 pascal GlobalPageLock(word) GlobalLock(1)
 192 pascal GlobalPageUnlock(word) GlobalUnlock(1)
+#193 __0040H
+#194 __F000H
+#195 __C000H
+#196 SELECTORACCESSRIGHTS
 197 pascal GlobalFix(word) GlobalLock(1)
 198 pascal GlobalUnfix(word) GlobalUnlock(1)
-57  pascal GetProfileInt(ptr ptr word) GetProfileInt(1 2 3)
-58  pascal GetProfileString(ptr ptr ptr ptr word) GetProfileString(1 2 3 4 5)
 199 pascal SetHandleCount(word) SetHandleCount(1)
-68  pascal InitAtomTable(word) InitAtomTable(1)
-69  pascal FindAtom(ptr) FindAtom(1)
-70  pascal AddAtom(ptr) AddAtom(1)
-71  pascal DeleteAtom(word) DeleteAtom(1)
-72  pascal GetAtomName(word ptr s_word) GetAtomName(1 2 3)
-73  pascal GetAtomHandle(word) GetAtomHandle(1)
+#200 VALIDATEFREESPACES
+#201 REPLACEINST
+#202 REGISTERPTRACE
+#203 DEBUGBREAK
+#204 SWAPRECORDING
+#205 CVWBREAK
+#206 ALLOCSELECTORARRAY
+#207 ISDBCSLEADBYTE
+#310 LOCALHANDLEDELTA
+#311 GETSETKERNELDOSPROC
+#314 DEBUGDEFINESEGMENT
+315 pascal WriteOutProfiles() sync_profiles()
+#316 GETFREEMEMINFO
+#318 FATALEXITHOOK
+#319 FLUSHCACHEDFILEHANDLE
+#320 ISTASK
+#323 ISROMMODULE
+#324 LOGERROR
+#325 LOGPARAMERROR
+#326 ISROMFILE
+#327 K327
+#328 _DEBUGOUTPUT
+#329 K329
+#332 THHOOK
+#334 ISBADREADPTR
+#335 ISBADWRITEPTR
+#336 ISBADCODEPTR
+#337 ISBADSTRINGPTR
+#338 HASGPHANDLER
+#339 DIAGQUERY
+#340 DIAGOUTPUT
+#341 TOOLHELPHOOK
+#342 __GP
+#343 REGISTERWINOLDAPHOOK
+#344 GETWINOLDAPHOOKS
+#345 ISSHAREDSELECTOR
+#346 ISBADHUGEREADPTR
+#347 ISBADHUGEWRITEPTR
+348 pascal hmemcpy(ptr ptr long) hmemcpy(1 2 3)
+349 pascal _hread(word ptr long) _hread(1 2 3)
+350 pascal _hwrite(word ptr long) _hwrite(1 2 3)
+#351 BUNNY_351
 353 pascal lstrcpyn(ptr ptr word) lstrcpyn(1 2 3)
-
+#354 GETAPPCOMPATFLAGS
+#355 GETWINDEBUGINFO
+#356 SETWINDEBUGINFO
+#403 K403
+#404 K404
diff --git a/if1632/shell.spec b/if1632/shell.spec
index 16d2a9e..062a9f6 100644
--- a/if1632/shell.spec
+++ b/if1632/shell.spec
@@ -2,7 +2,7 @@
 #
 name	shell
 id	6
-length	256
+length	103
 
 #
 # WARNING ! These functions are not documented, so I didn't look for
diff --git a/if1632/user.spec b/if1632/user.spec
index 2b6ea2f..1c4129d 100644
--- a/if1632/user.spec
+++ b/if1632/user.spec
@@ -5,6 +5,9 @@
 length	540
 
 1   pascal MessageBox(word ptr ptr word) MessageBox(1 2 3 4)
+#2 OLDEXITWINDOWS
+#3 ENABLEOEMLAYER
+#4 DISABLEOEMLAYER
 5   pascal InitApp(word) USER_InitApp(1)
 6   pascal PostQuitMessage(word) PostQuitMessage(1)
 7   pascal ExitWindows(long word) ExitWindows(1 2)
@@ -50,6 +53,8 @@
 48  pascal IsChild(word word) IsChild(1 2)
 49  pascal IsWindowVisible(word) IsWindowVisible(1)
 50  pascal FindWindow(ptr ptr) FindWindow(1 2)
+#51 BEAR51
+#52 ANYPOPUP
 53  pascal DestroyWindow(word) DestroyWindow(1)
 54  pascal EnumWindows(ptr long) EnumWindows(1 2)
 55  pascal EnumChildWindows(word ptr long) EnumChildWindows(1 2 3)
@@ -109,8 +114,11 @@
 109 pascal PeekMessage(ptr word word word word) PeekMessage(1 2 3 4 5)
 110 pascal PostMessage(word word word long) PostMessage(1 2 3 4)
 111 pascal SendMessage(word word word long) SendMessage(1 2 3 4)
+#112 WAITMESSAGE
 113 pascal TranslateMessage(ptr) TranslateMessage(1)
 114 pascal DispatchMessage(ptr) DispatchMessage(1)
+#115 REPLYMESSAGE
+#116 POSTAPPMESSAGE
 118 pascal RegisterWindowMessage(ptr) RegisterWindowMessage(1)
 119 pascal GetMessagePos() GetMessagePos()
 120 pascal GetMessageTime() GetMessageTime()
@@ -154,6 +162,8 @@
 158 pascal SetMenu(word word) SetMenu(1 2)
 159 pascal GetSubMenu(word word) GetSubMenu(1 2)
 160 pascal DrawMenuBar(word) DrawMenuBar(1)
+#161 GETMENUSTRING
+#162 HILITEMENUITEM
 163 pascal CreateCaret(word word word word) CreateCaret(1 2 3 4)
 164 pascal DestroyCaret() DestroyCaret()
 165 pascal SetCaretPos(word word) SetCaretPos(1 2)
@@ -161,7 +171,9 @@
 167 pascal ShowCaret(word) ShowCaret(1)
 168 pascal SetCaretBlinkTime(word) SetCaretBlinkTime(1)
 169 pascal GetCaretBlinkTime() GetCaretBlinkTime()
+#170 ARRANGEICONICWINDOWS
 171 pascal WinHelp(word ptr word long) WinHelp(1 2 3 4)
+#172 SWITCHTOTHISWINDOW
 173 pascal LoadCursor(word ptr) LoadCursor(1 2)
 174 pascal LoadIcon(word ptr) LoadIcon(1 2)
 175 pascal LoadBitmap(word ptr) LoadBitmap(1 2)
@@ -173,14 +185,23 @@
 181 pascal SetSysColors(word ptr ptr) SetSysColors(1 2 3)
 182 pascal KillSystemTimer(word word) KillSystemTimer(1 2)
 183 pascal GetCaretPos(ptr) GetCaretPos(1)
+#184 QUERYSENDMESSAGE
 185 pascal GrayString(word word ptr ptr word word word word word)
 	   GrayString(1 2 3 4 5 6 7 8 9)
+186 pascal SwapMouseButton(word) SwapMouseButton(1)
+#187 ENDMENU
 188 pascal SetSysModalWindow(word) SetSysModalWindow(1)
+189 pascal GetSysModalWindow() GetSysModalWindow()
 190 pascal GetUpdateRect(word ptr word) GetUpdateRect(1 2 3)
 191 pascal ChildWindowFromPoint(word long) ChildWindowFromPoint(1 2)
+#192 INSENDMESSAGE
 193 pascal IsClipboardFormatAvailable(word) IsClipboardFormatAvailable(1)
 194  pascal DlgDirSelectComboBox(word ptr word) DlgDirSelectComboBox(1 2 3)
 195 pascal DlgDirListComboBox(word ptr word word word) DlgDirListComboBox(1 2 3 4 5)
+#196 TABBEDTEXTOUT
+#197 GETTABBEDTEXTEXTENT
+#198 CASCADECHILDWINDOWS
+#199 TILECHILDWINDOWS
 200 pascal OpenComm(ptr word word) OpenComm(1 2 3)
 201 pascal SetCommState(ptr) SetCommState(1)
 202 pascal GetCommState(word ptr) GetCommState(1 2)
@@ -197,20 +218,27 @@
 213 pascal BuildCommDCB(ptr ptr) BuildCommDCB(1 2)
 214 pascal EscapeCommFunction(word word) EscapeCommFunction(1 2)
 215 pascal FlushComm(word word) FlushComm(1 2)
+#216 USERSEEUSERDO
+#217 LOOKUPMENUHANDLE
 218 pascal DialogBoxIndirect(word word word ptr) DialogBoxIndirect(1 2 3 4)
 219 pascal CreateDialogIndirect(word ptr word ptr)
 	   CreateDialogIndirect(1 2 3 4)
 220 pascal LoadMenuIndirect(ptr) LoadMenuIndirect(1)
 221 pascal ScrollDC(word s_word s_word ptr ptr word ptr) 
 	   ScrollDC(1 2 3 4 5 6 7)
+#222 GETKEYBOARDSTATE
+#223 SETKEYBOARDSTATE
 224 pascal GetWindowTask(word) GetWindowTask(1)
 225 pascal EnumTaskWindows(word ptr long) EnumTaskWindows(1 2 3)
+#226 LOCKINPUT
 227 pascal GetNextDlgGroupItem(word word word) GetNextDlgGroupItem(1 2 3)
 228 pascal GetNextDlgTabItem(word word word) GetNextDlgTabItem(1 2 3)
 229 pascal GetTopWindow(word) GetTopWindow(1)
 230 pascal GetNextWindow(word word) GetNextWindow(1 2)
+#231 GETSYSTEMDEBUGSTATE
 232 pascal SetWindowPos(word word word word word word word) 
            SetWindowPos(1 2 3 4 5 6 7)
+#233 SETPARENT
 234 pascal UnhookWindowsHook(s_word ptr) UnhookWindowsHook(1 2)
 235 pascal DefHookProc(s_word word long ptr) DefHookProc(1 2 3 4)
 236 pascal GetCapture() GetCapture()
@@ -225,9 +253,27 @@
 	   CreateDialogIndirectParam(1 2 3 4 5)
 243 pascal GetDialogBaseUnits() GetDialogBaseUnits()
 244 pascal EqualRect(ptr ptr) EqualRect(1 2)
+#245 ENABLECOMMNOTIFICATION
+#246 EXITWINDOWSEXEC
+247 pascal GetCursor() GetCursor()
 248 pascal GetOpenClipboardWindow() GetOpenClipboardWindow()
+#249 GETASYNCKEYSTATE
+#250 GETMENUSTATE
+#251 SENDDRIVERMESSAGE
+#252 OPENDRIVER
+#253 CLOSEDRIVER
+#254 GETDRIVERMODULEHANDLE
+#255 DEFDRIVERPROC
+#256 GETDRIVERINFO
+#257 GETNEXTDRIVER
 258 pascal MapWindowPoints(word word ptr word) MapWindowPoints(1 2 3 4)
+#259 BEGINDEFERWINDOWPOS
+#260 DEFERWINDOWPOS
+#261 ENDDEFERWINDOWPOS
 262 pascal GetWindow(word word) GetWindow(1 2)
+#263 GETMENUITEMCOUNT
+#264 GETMENUITEMID
+#265 SHOWOWNEDPOPUPS
 266 pascal SetMessageQueue(word) SetMessageQueue(1)
 267 pascal ShowScrollBar(word word word) ShowScrollBar(1 2 3)
 268 pascal GlobalAddAtom(ptr) GlobalAddAtom(1)
@@ -235,27 +281,62 @@
 270 pascal GlobalFindAtom(ptr) GlobalFindAtom(1)
 271 pascal GlobalGetAtomName(word ptr s_word) GlobalGetAtomName(1 2 3)
 272 pascal IsZoomed(word) IsZoomed(1)
+#273 CONTROLPANELINFO
+#274 GETNEXTQUEUEWINDOW
+#275 REPAINTSCREEN
+#276 LOCKMYTASK
 277 pascal GetDlgCtrlID(word) GetDlgCtrlID(1)
+278 pascal GetDeskTopHwnd() GetDesktopWindow()
+#279 OLDSETDESKPATTERN
+#280 SETSYSTEMMENU
 282 pascal SelectPalette(word word word) SelectPalette(1 2 3)
 283 pascal RealizePalette(word) RealizePalette(1)
 284 pascal GetFreeSystemResources(word) GetFreeSystemResources(1)
+#285 BEAR285
 286 pascal GetDesktopWindow() GetDesktopWindow()
+#287 GETLASTACTIVEPOPUP
 288 pascal GetMessageExtraInfo() GetMessageExtraInfo()
+#289 KEYB_EVENT
 290 pascal RedrawWindow(word ptr word word) RedrawWindow(1 2 3 4)
 291 pascal SetWindowsHookEx(s_word ptr word word) SetWindowsHookEx(1 2 3 4)
 292 pascal UnhookWindowsHookEx(ptr) UnhookWindowsHookEx(1)
 293 pascal CallNextHookEx(ptr s_word word long) CallNextHookEx(1 2 3 4)
+#294 LOCKWINDOWUPDATE
+#299 MOUSE_EVENT
+#301 BOZOSLIVEHERE :-))
+#306 BEAR306
 308 pascal DefDlgProc(word word word long) DefDlgProc(1 2 3 4)
+#314 SIGNALPROC
 319 pascal ScrollWindowEx(word s_word s_word ptr ptr word ptr word) 
 	   ScrollWindowEx(1 2 3 4 5 6 7 8)
+#320 SYSERRORBOX
+#321 SETEVENTHOOK
+#322 WINOLDAPPHACKOMATIC
+#323 GETMESSAGE2
 324 pascal FillWindow(word word word word) FillWindow(1 2 3 4)
 325 pascal PaintRect(word word word word ptr) PaintRect(1 2 3 4 5)
+#326 GETCONTROLBRUSH
+#331 ENABLEHARDWAREINPUT
+332 pascal UserYield() Yield()
+#333 ISUSERIDLE
 334 pascal GetQueueStatus(word) GetQueueStatus(1)
 335 pascal GetInputState() GetInputState()
+#336 LOADCURSORICONHANDLER
+#337 GETMOUSEEVENTPROC
+#341 _FFFE_FARFRAME
+#343 GETFILEPORTNAME
+#356 LOADDIBCURSORHANDLER
+#357 LOADDIBICONHANDLER
+#358 ISMENU
 359 pascal GetDCEx(word word long) GetDCEx(1 2 3)
+#362 DCHOOK
+#368 COPYICON
+#369 COPYCURSOR
 370 pascal GetWindowPlacement(word ptr) GetWindowPlacement(1 2)
 371 pascal SetWindowPlacement(word ptr) SetWindowPlacement(1 2)
+#372 GETINTERNALICONHEADER
 373 pascal SubtractRect(ptr ptr ptr) SubtractRect(1 2 3)
+#400 FINALUSERINIT
 402 pascal GetPriorityClipboardFormat(word ptr s_word) 
 	GetPriorityClipboardFormat(1 2 3)
 403 pascal UnregisterClass(ptr word) UnregisterClass(1 2)
@@ -264,6 +345,7 @@
 	CreateCursor(1 2 3 4 5 6 7)
 407 pascal CreateIcon(word word word byte byte ptr ptr)
            CreateIcon(1 2 3 4 5 6 7)
+#408 CREATECURSORICONINDIRECT
 410 pascal InsertMenu(word word word word ptr) InsertMenu(1 2 3 4 5)
 411 pascal AppendMenu(word word word ptr) AppendMenu(1 2 3 4)
 412 pascal RemoveMenu(word word word) RemoveMenu(1 2 3)
@@ -277,6 +359,8 @@
 	   SetMenuItemBitmaps(1 2 3 4 5)
 420 pascal wsprintf(ptr ptr) wsprintf(1 2)
 421 pascal wvsprintf(ptr ptr ptr) wvsprintf(1 2 3)
+#422 DLGDIRSELECTEX
+#423 DLGDIRSELECTCOMBOBOXEX
 430 pascal lstrcmp(ptr ptr) lstrcmp(1 2)
 431 pascal AnsiUpper(ptr) AnsiUpper(1)
 432 pascal AnsiLower(ptr) AnsiLower(1)
@@ -293,12 +377,57 @@
 	                  word word word ptr) 
 	   CreateWindowEx(1 2 3 4 5 6 7 8 9 10 11 12)
 454 pascal AdjustWindowRectEx(ptr long word long) AdjustWindowRectEx(1 2 3 4)
+#455 GETICONID
+#456 LOADICONHANDLER
 457 pascal DestroyIcon(word) DestroyIcon(1)
 458 pascal DestroyCursor(word) DestroyCursor(1)
+#459 DUMPICON
 460 pascal GetInternalWindowPos(word ptr ptr) GetInternalWindowPos(1 2 3)
 461 pascal SetInternalWindowPos(word word ptr ptr) SetInternalWindowPos(1 2 3 4)
+#462 CALCCHILDSCROLL
+#463 SCROLLCHILDREN
+#464 DRAGOBJECT
+#465 DRAGDETECT
 466 pascal DrawFocusRect(word ptr) DrawFocusRect(1 2)
+#470 STRINGFUNC
 471 pascal lstrcmpi(ptr ptr) lstrcmpi(1 2)
 472 pascal AnsiNext(ptr) AnsiNext(1 )
 473 pascal AnsiPrev(ptr ptr) AnsiPrev(1 2)
+#480 GETUSERLOCALOBJTYPE
+#481 HARDWARE_EVENT
+#482 ENABLESCROLLBAR
 483 pascal SystemParametersInfo(word word ptr word) SystemParametersInfo(1 2 3 4)
+#484 __GP
+#499 WNETERRORTEXT
+#501 WNETOPENJOB
+#502 WNETCLOSEJOB
+#503 WNETABORTJOB
+#504 WNETHOLDJOB
+#505 WNETRELEASEJOB
+#506 WNETCANCELJOB
+#507 WNETSETJOBCOPIES
+#508 WNETWATCHQUEUE
+#509 WNETUNWATCHQUEUE
+#510 WNETLOCKQUEUEDATA
+#511 WNETUNLOCKQUEUEDATA
+#512 WNETGETCONNECTION
+#513 WNETGETCAPS
+#514 WNETDEVICEMODE
+#515 WNETBROWSEDIALOG
+#516 WNETGETUSER
+#517 WNETADDCONNECTION
+#518 WNETCANCELCONNECTION
+#519 WNETGETERROR
+#520 WNETGETERRORTEXT
+#521 WNETENABLE
+#522 WNETDISABLE
+#523 WNETRESTORECONNECTION
+#524 WNETWRITEJOB
+#525 WNETCONNECTDIALOG
+#526 WNETDISCONNECTDIALOG
+#527 WNETCONNECTIONDIALOG
+#528 WNETVIEWQUEUEDIALOG
+#529 WNETPROPERTYDIALOG
+#530 WNETGETDIRECTORYTYPE
+#531 WNETDIRECTORYNOTIFY
+#532 WNETGETPROPERTYTEXT
diff --git a/include/winsock.h b/include/winsock.h
index 3429f4a..2a2674b 100644
--- a/include/winsock.h
+++ b/include/winsock.h
@@ -80,8 +80,9 @@
  */
 #define SOMAXCONN       5
 
+#ifndef MSG_DONTROUTE
 #define MSG_DONTROUTE   0x4             /* send without using routing tables */
-
+#endif
 #define MSG_MAXIOVLEN   16
 
 /*
diff --git a/loader/signal.c b/loader/signal.c
index d788cc0..f00a348 100644
--- a/loader/signal.c
+++ b/loader/signal.c
@@ -18,6 +18,7 @@
 #include "wine.h"
 #include "segmem.h"
 #include "prototypes.h"
+#include "win.h"
  
 char * cstack[4096];
 struct sigaction segv_act;
@@ -162,6 +163,9 @@
     return;
 
   oops:
+    XUngrabPointer(display, CurrentTime);
+	XUngrabServer(display);
+	XFlush(display);
     fprintf(stderr,"In win_fault %x:%x\n", scp->sc_cs, scp->sc_eip);
 #ifdef linux
     wine_debug(scp);  /* Enter our debugger */
diff --git a/loader/wine.c b/loader/wine.c
index 8236853..fc26d71 100644
--- a/loader/wine.c
+++ b/loader/wine.c
@@ -306,7 +306,7 @@
 
 	hSysRes = LoadImage(filename, DLL);
 	if (hSysRes == (HINSTANCE)NULL)
-		fprintf(stderr, "wine: can't find %s!.\n", filename);
+		fprintf(stderr, "wine: can't find %s!\n", filename);
  	else
  	    printf("System Resources Loaded // hSysRes='%04X'\n", hSysRes);
 	
diff --git a/misc/cursor.c b/misc/cursor.c
index fa2d0ec..874ff92 100644
--- a/misc/cursor.c
+++ b/misc/cursor.c
@@ -359,6 +359,13 @@
     return hOldCursor;
 }
 
+/**********************************************************************
+ *			GetCursor [USER.247]
+ */
+HCURSOR GetCursor(void)
+{
+	return hActiveCursor;
+}
 
 /**********************************************************************
  *                        SetCursorPos [USER.70]
diff --git a/misc/main.c b/misc/main.c
index 59106ca..6efa211 100644
--- a/misc/main.c
+++ b/misc/main.c
@@ -317,7 +317,7 @@
     DOS_InitFS();
     Comm_Init();
     
-#ifndef sun
+#ifndef sunos
     atexit(called_at_exit);
 #endif
 
@@ -504,3 +504,20 @@
 {
 	memcpy(lpDest, lpSource, nBytes);
 }
+
+/***********************************************************************
+*	YIELD (KERNEL.29)
+*/
+void Yield(void)
+{
+	;
+}
+
+/***********************************************************************
+*	SWAPMOUSEBUTTON (USER.186)
+*/
+BOOL SwapMouseButton(BOOL fSwap)
+{
+	return 0;	/* don't swap */
+}
+
diff --git a/misc/profile.c b/misc/profile.c
index 84cf8f5..3fac219 100644
--- a/misc/profile.c
+++ b/misc/profile.c
@@ -9,6 +9,11 @@
  *            of the KeyNames (as documented in the MS-SDK).
  *
  *       o if KeyValue == NULL now clears the value in Get*ProfileString
+ *
+ * 20/Apr  SL - I'm not sure where these definitions came from, but my SDK
+ *         has a NULL KeyValue returning a list of KeyNames, and a NULL
+ *         AppName undefined.  I changed GetSetProfile to match.  This makes
+ *         PROGMAN.EXE do the right thing.
  */
 
 static char Copyright [] = "Copyright (C) 1993 Miguel de Icaza";
@@ -78,7 +83,7 @@
 	strcat(temp, "\\");
 	strcat(temp, name);
 	
-	return GetUnixFileName(name);
+	return GetUnixFileName(temp);
 }
 
 static TSecHeader *load (char *filename)
@@ -230,7 +235,7 @@
 	    continue;
 
 	/* If no key value given, then list all the keys */
-	if ((!AppName) && (!set)){
+	if ((!KeyName) && (!set)){
 	    char *p = ReturnedString;
 	    int left = Size - 1;
 	    int slen;
diff --git a/misc/winsocket.c b/misc/winsocket.c
index ea56ca8..cc361f6 100644
--- a/misc/winsocket.c
+++ b/misc/winsocket.c
@@ -7,7 +7,9 @@
  
 #include <stdio.h>
 #include <string.h>
+#include <signal.h>
 #include <sys/types.h>
+#include <sys/ipc.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
@@ -22,12 +24,20 @@
 
 static WORD wsa_errno;
 static int wsa_initted;
+static key_t wine_key = 0;
+static FARPROC BlockFunction;
+static fd_set fd_in_use;
 
-#define dump_sockaddr(a) \
-	fprintf(stderr, "sockaddr_in: family %d, address %s, port %d\n", \
-			((struct sockaddr_in *)a)->sin_family, \
-			inet_ntoa(((struct sockaddr_in *)a)->sin_addr), \
-			ntohs(((struct sockaddr_in *)a)->sin_port))
+struct ipc_packet {
+	long	mtype;
+	HANDLE	handle;
+	HWND	hWnd;
+	WORD	wMsg;
+	LONG	lParam;
+};
+#define IPC_PACKET_SIZE (sizeof(struct ipc_packet) - sizeof(long))
+
+#define MTYPE 0xb0b0eb05
 
 struct WinSockHeap {
 	char	ntoa_buffer[32];
@@ -46,9 +56,14 @@
 	struct	servent WSAservent_name;
 	struct	servent WSAservent_port;
 };
-
 static struct WinSockHeap *heap;
 
+#define dump_sockaddr(a) \
+	fprintf(stderr, "sockaddr_in: family %d, address %s, port %d\n", \
+			((struct sockaddr_in *)a)->sin_family, \
+			inet_ntoa(((struct sockaddr_in *)a)->sin_addr), \
+			ntohs(((struct sockaddr_in *)a)->sin_port))
+
 static WORD wsaerrno(void)
 {
 #ifdef DEBUG_WINSOCK
@@ -112,7 +127,7 @@
 	case EREMOTE:		return WSAEREMOTE;
 
         default:
-		fprintf(stderr, "winsock: unknown error!\n");
+		fprintf(stderr, "winsock: unknown errorno %d!\n", errno);
 		return WSAEOPNOTSUPP;
 	}
 }
@@ -157,6 +172,8 @@
 	fprintf(stderr, "WSA_closesocket: socket %d\n", s);
 #endif
 
+	FD_CLR(s, &fd_in_use);
+
 	if (close(s) < 0) {
         	errno_to_wsaerrno();
         	return SOCKET_ERROR;
@@ -399,11 +416,14 @@
 #endif
             return INVALID_SOCKET;
     }
+    
     if (sock > 0xffff) {
 	wsa_errno = WSAEMFILE;
 	return INVALID_SOCKET;
     }
 
+    FD_SET(sock, &fd_in_use);
+
 #ifdef DEBUG_WINSOCK
     fprintf(stderr, "WSA_socket: fd %d\n", sock);
 #endif
@@ -526,114 +546,224 @@
 	return (struct servent *) &heap->servent_port;
 }
 
-/******************** winsock specific functions ************************/
+/******************** winsock specific functions ************************
+ *
+ */
+
+#define AllocWSAHandle() getpid()
+
+static void recv_message(int sig)
+{
+	struct ipc_packet message;
+
+	if (msgrcv(wine_key, &message, IPC_PACKET_SIZE, MTYPE, IPC_NOWAIT) == -1)
+		perror("wine: msgrcv");
+
+	fprintf(stderr, 
+		"WSA: PostMessage (hwnd %d, wMsg %d, wParam %d, lParam %d)\n",
+		message.hWnd,
+		message.wMsg,
+		message.handle,
+		message.lParam);
+
+	PostMessage(message.hWnd, message.wMsg, message.handle, message.lParam);
+		
+	signal(SIGUSR1, recv_message);
+}
+
+
+static void send_message(HANDLE handle, HWND hWnd, u_int wMsg, long lParam)
+{
+	struct ipc_packet message;
+	
+	message.mtype = MTYPE;
+	message.handle = handle;
+	message.hWnd = hWnd;
+	message.wMsg = wMsg;
+	message.lParam = lParam;
+
+	fprintf(stderr, 
+		"WSA: send (hwnd %d, wMsg %d, handle %d, lParam %d)\n",
+		hWnd, wMsg, handle, lParam);
+	
+	if (msgsnd(wine_key, &message,  IPC_PACKET_SIZE, IPC_NOWAIT) == -1)
+		perror("wine: msgsnd");
+		
+	kill(getppid(), SIGUSR1);
+}
+
 
 HANDLE WSAAsyncGetHostByAddr(HWND hWnd, u_int wMsg, const char FAR *addr,
 		 INT len, INT type, char FAR *buf, INT buflen)
 {
+	HANDLE handle;
 	struct hostent *host;
 
-	if ((host = gethostbyaddr(addr, len, type)) == NULL) {
-		PostMessage(hWnd, wMsg, 1, wsaerrno() << 8);
+	handle = AllocWSAHandle();
 
-		return 1;
+	if (fork()) {
+		return handle;
+	} else {
+		if ((host = gethostbyaddr(addr, len, type)) == NULL) {
+			send_message(hWnd, wMsg, handle, wsaerrno() << 16);
+			exit(0);
+		}
+		memcpy(buf, host, buflen);
+		send_message(hWnd, wMsg, handle, 0);
+		exit(0);
 	}
+}
 
-	memcpy(buf, host, buflen);
-	PostMessage(hWnd, wMsg, 1, 0);
-
-	return 1;
-}                    
 
 HANDLE WSAAsyncGetHostByName(HWND hWnd, u_int wMsg, const char FAR *name, 
 			char FAR *buf, INT buflen)
 {
+	HANDLE handle;
 	struct hostent *host;
 
-	if ((host = gethostbyname(name)) == NULL) {
-		PostMessage(hWnd, wMsg, 2, wsaerrno() << 8);
-		return 2;
+	handle = AllocWSAHandle();
+
+	if (fork()) {
+		return handle;
+	} else {
+		if ((host = gethostbyname(name)) == NULL) {
+			send_message(hWnd, wMsg, handle, wsaerrno() << 16);
+			exit(0);
+		}
+		memcpy(buf, host, buflen);
+		send_message(hWnd, wMsg, handle, 0);
+		exit(0);
 	}
-
-	memcpy(buf, host, buflen);
-	PostMessage(hWnd, wMsg, 2, 0);
-
-	return 2;
 }                     
 
+
 HANDLE WSAAsyncGetProtoByName(HWND hWnd, u_int wMsg, const char FAR *name, 
 			char FAR *buf, INT buflen)
 {
+	HANDLE handle;
 	struct protoent *proto;
 
-	if ((proto = getprotobyname(name)) == NULL) {
-		PostMessage(hWnd, wMsg, 3, wsaerrno() << 8);
-		return 3;
+	handle = AllocWSAHandle();
+
+	if (fork()) {
+		return handle;
+	} else {
+		if ((proto = getprotobyname(name)) == NULL) {
+			send_message(hWnd, wMsg, handle, wsaerrno() << 16);
+			exit(0);
+		}
+		memcpy(buf, proto, buflen);
+		send_message(hWnd, wMsg, handle, 0);
+		exit(0);
 	}
-
-	memcpy(buf, proto, buflen);
-	PostMessage(hWnd, wMsg, 3, 0);
-
-	return 3;
 }
 
+
 HANDLE WSAAsyncGetProtoByNumber(HWND hWnd, u_int wMsg, INT number, 
 			char FAR *buf, INT buflen)
 {
+	HANDLE handle;
 	struct protoent *proto;
 
-	if ((proto = getprotobynumber(number)) == NULL) {
-		PostMessage(hWnd, wMsg, 4, wsaerrno() << 8);
-		return 4;
+	handle = AllocWSAHandle();
+
+	if (fork()) {
+		return handle;
+	} else {
+		if ((proto = getprotobynumber(number)) == NULL) {
+			send_message(hWnd, wMsg, handle, wsaerrno() << 16);
+			exit(0);
+		}
+		memcpy(buf, proto, buflen);
+		send_message(hWnd, wMsg, handle, 0);
+		exit(0);
 	}
-
-	memcpy(buf, proto, buflen);
-	PostMessage(hWnd, wMsg, 4, 0);
-
-	return 4;
 }
 
+
 HANDLE WSAAsyncGetServByName(HWND hWnd, u_int wMsg, const char FAR *name, 
 			const char FAR *proto, char FAR *buf, INT buflen)
 {
+	HANDLE handle;
 	struct servent *service;
 
-	if ((service = getservbyname(name, proto)) == NULL) {
-		PostMessage(hWnd, wMsg, 5, wsaerrno() << 8);
-        
-        	return 5;
+	handle = AllocWSAHandle();
+
+	if (fork()) {
+		return handle;
+	} else {
+		if ((service = getservbyname(name, proto)) == NULL) {
+			send_message(hWnd, wMsg, handle, wsaerrno() << 16);
+			exit(0);
+		}
+		memcpy(buf, service, buflen);
+		send_message(hWnd, wMsg, handle, 0);
+		exit(0);
 	}
-	memcpy(buf, service, buflen);
-	PostMessage(hWnd, wMsg, 5, 0);
-	
-	return 5;
 }
 
+
 HANDLE WSAAsyncGetServByPort(HWND hWnd, u_int wMsg, INT port, const char FAR 
 			*proto, char FAR *buf, INT buflen)
 {
+	HANDLE handle;
 	struct servent *service;
 
-	if ((service = getservbyport(port, proto)) == NULL) {
-		PostMessage(hWnd, wMsg, 6, wsaerrno() << 8);
-        
-        	return 6;
+	handle = AllocWSAHandle();
+
+	if (fork()) {
+		return handle;
+	} else {
+		if ((service = getservbyport(port, proto)) == NULL) {
+			send_message(hWnd, wMsg, handle, wsaerrno() << 16);
+			exit(0);
+		}
+		memcpy(buf, service, buflen);
+		send_message(hWnd, wMsg, handle, 0);
+		exit(0);
 	}
-	memcpy(buf, service, buflen);
-	PostMessage(hWnd, wMsg, 6, 0);
-	
-	return 6;
 }
 
 INT WSAAsyncSelect(SOCKET s, HWND hWnd, u_int wMsg, long lEvent)
 {
+	long event;
+	fd_set read_fds, write_fds, except_fds;
+
 #ifdef DEBUG_WINSOCK
 	fprintf(stderr, "WSA_AsyncSelect: socket %d, HWND %d, wMsg %d, event %d\n", s, hWnd, wMsg, lEvent);
 #endif
-	fcntl(s, F_SETFL, O_NONBLOCK);
 
+	/* remove outstanding asyncselect() processes */
+	/* kill */
 
-	return 0;
+	if (wMsg == 0 && lEvent == 0) 
+		return 0;
+
+	if (fork()) {
+		return 0;
+	} else {
+		while (1) {
+			FD_ZERO(&read_fds);
+			FD_ZERO(&write_fds);
+			FD_ZERO(&except_fds);
+
+			if (lEvent & FD_READ)
+				FD_SET(s, &read_fds);
+			if (lEvent & FD_WRITE)
+				FD_SET(s, &write_fds);
+
+			fcntl(s, F_SETFL, O_NONBLOCK);
+			select(s + 1, &read_fds, &write_fds, &except_fds, NULL);
+
+			event = 0;
+			if (FD_ISSET(s, &read_fds))
+				event |= FD_READ;
+			if (FD_ISSET(s, &write_fds))
+				event |= FD_WRITE;
+
+			send_message(hWnd, wMsg, s, (wsaerrno() << 16) | event);
+		}
+	}
 }
 
 INT WSAFDIsSet(INT fd, fd_set *set)
@@ -646,6 +776,7 @@
 #ifdef DEBUG_WINSOCK
 	fprintf(stderr, "WSA_AsyncRequest: handle %d\n", hAsyncTaskHandle);
 #endif
+
 	return 0;
 }
 
@@ -685,8 +816,11 @@
 FARPROC WSASetBlockingHook(FARPROC lpBlockFunc)
 {
 #ifdef DEBUG_WINSOCK
-	fprintf(stderr, "WSA_SetBlockHook\n %8x", lpBlockFunc);
+	fprintf(stderr, "WSA_SetBlockHook %8x, STUB!\n", lpBlockFunc);
 #endif
+	BlockFunction = lpBlockFunc;
+
+	return lpBlockFunc;
 }
 
 INT WSAUnhookBlockingHook(void)
@@ -694,6 +828,9 @@
 #ifdef DEBUG_WINSOCK
 	fprintf(stderr, "WSA_UnhookBlockingHook\n");
 #endif
+	BlockFunction = NULL;
+
+	return 0;
 }
 
 WSADATA Winsock_data = {
@@ -716,8 +853,8 @@
 
 INT WSAStartup(WORD wVersionRequested, LPWSADATA lpWSAData)
 {
-	int HeapHandle;
-	MDESC *MyHeap;
+    int HeapHandle;
+    MDESC *MyHeap;
 
 #ifdef DEBUG_WINSOCK
     fprintf(stderr, "WSAStartup: verReq=%x\n", wVersionRequested);
@@ -731,21 +868,42 @@
     if (!lpWSAData)
         return WSAEINVAL;
 
+	/* alloc winsock heap */
+
     if ((HeapHandle = GlobalAlloc(GMEM_FIXED,sizeof(struct WinSockHeap))) == 0)
 	return WSASYSNOTREADY;
 
     heap = (struct WinSockHeap *) GlobalLock(HeapHandle);
     HEAP_Init(&MyHeap, heap, sizeof(struct WinSockHeap));
-    
     bcopy(&Winsock_data, lpWSAData, sizeof(Winsock_data));
 
-    wsa_initted = 1;
+    /* ipc stuff */
+
+    if ((wine_key = msgget(IPC_PRIVATE, 0600)) == -1)
+	perror("wine: msgget");
+
+    signal(SIGUSR1, recv_message);
+
+    /* clear */
     
+    FD_ZERO(&fd_in_use);
+
+    wsa_initted = 1;
     return(0);
 }
 
 INT WSACleanup(void)
 {
-    wsa_initted = 0;
-    return 0;
+	int fd;
+
+	if (wine_key)
+		if (msgctl(wine_key, IPC_RMID, NULL) == -1)
+			perror("wine: shmctl");
+
+	for (fd = 0; fd != FD_SETSIZE; fd++)
+		if (FD_ISSET(fd, &fd_in_use))
+			close(fd);
+
+	wsa_initted = 0;
+	return 0;
 }
diff --git a/objects/bitblt.c b/objects/bitblt.c
index 992f7ca..24f05e0 100644
--- a/objects/bitblt.c
+++ b/objects/bitblt.c
@@ -226,6 +226,29 @@
     } /* for all x in dest */
 }
 
+/* We use the 32-bit to 64-bit multiply and 64-bit to 32-bit divide of the */
+/* 386 (which gcc doesn't know well enough) to efficiently perform integer */
+/* scaling without having to worry about overflows. */
+
+/* ##### muldiv64() borrowed from svgalib 1.03 ##### */
+static inline int muldiv64( int m1, int m2, int d ) 
+{
+	/* int32 * int32 -> int64 / int32 -> int32 */
+#ifdef i386	
+	int result;
+	__asm__(
+		"imull %%edx\n\t"
+		"idivl %3\n\t"
+		: "=a" (result)			/* out */
+		: "a" (m1), "d" (m2), "g" (d)	/* in */
+		: "ax", "dx"			/* mod */
+	);
+	return result;
+#else
+	return m1 * m2 / d;
+#endif
+}
+
 /***********************************************************************
  *          color stretch -- deletes unused pixels
  * 
@@ -233,16 +256,40 @@
 static void color_stretch(XImage *sxi, XImage *dxi, 
 	short widthSrc, short heightSrc, short widthDest, short heightDest)
 {
-    float deltax, deltay, sourcex, sourcey;
-    register int x, y;
+	register int x, y, sx, sy, xfactor, yfactor;
 
-    deltax = (float)widthSrc/widthDest;
-    deltay = (float)heightSrc/heightDest;
+	xfactor = muldiv64(widthSrc, 65536, widthDest);
+	yfactor = muldiv64(heightSrc, 65536, heightDest);
 
-    for (x=0, sourcex=0.0; x<widthDest; x++, sourcex+=deltax)
-        for (y=0, sourcey=0.0; y<heightDest; y++, sourcey+=deltay)
-            XPutPixel(dxi, x, y, XGetPixel(sxi, (int)sourcex, (int)sourcey));
+	sy = 0;
 
+	for (y = 0; y < heightDest;) 
+	{
+		int sourcey = sy >> 16;
+		sx = 0;
+		for (x = 0; x < widthDest; x++) {
+            		XPutPixel(dxi, x, y, XGetPixel(sxi, sx >> 16, sourcey));
+			sx += xfactor;
+		}
+		y++;
+		while (y < heightDest) {
+			int py;
+
+			sourcey = sy >> 16;
+			sy += yfactor;
+
+			if ((sy >> 16) != sourcey)
+				break;
+
+			/* vertical stretch => copy previous line */
+			
+			py = y - 1;
+
+			for (x = 0; x < widthDest; x++)
+	            		XPutPixel(dxi, x, y, XGetPixel(dxi, x, py));
+        	    	y++;
+		}
+	}
 }
 
 /***********************************************************************
@@ -266,7 +313,7 @@
     WORD stretchmode;
 
 #ifdef DEBUG_GDI     
-    printf( "StretchBlt: %d %d,%d %dx%d %d %d,%d %dx%d %08x\n",
+    fprintf(stderr, "StretchBlt: %d %d,%d %dx%d %d %d,%d %dx%d %08x\n",
            hdcDest, xDest, yDest, widthDest, heightDest, hdcSrc, xSrc, 
            ySrc, widthSrc, heightSrc, rop );
     printf("StretchMode is %x\n", 
@@ -328,13 +375,17 @@
 
     switch (stretchmode) {
 	case BLACKONWHITE:
-		bonw_stretch(sxi, dxi, widthSrc, heightSrc,
+		color_stretch(sxi, dxi, widthSrc, heightSrc, 
 				widthDest, heightDest);
-		break;
+/*		bonw_stretch(sxi, dxi, widthSrc, heightSrc,
+				widthDest, heightDest);
+*/		break;
 	case WHITEONBLACK:
-		wonb_stretch(sxi, dxi, widthSrc, heightSrc, 
+		color_stretch(sxi, dxi, widthSrc, heightSrc, 
 				widthDest, heightDest);
-		break;
+/*		wonb_stretch(sxi, dxi, widthSrc, heightSrc, 
+				widthDest, heightDest);
+*/		break;
 	case COLORONCOLOR:
 		color_stretch(sxi, dxi, widthSrc, heightSrc, 
 				widthDest, heightDest);
diff --git a/windows/win.c b/windows/win.c
index 6889fe6..799cf7e 100644
--- a/windows/win.c
+++ b/windows/win.c
@@ -551,8 +551,9 @@
  
 /**********************************************************************
  *           GetDesktopWindow        (USER.286)
+ *	     GetDeskTopHwnd          (USER.278)
  */
-HWND GetDesktopWindow()
+HWND GetDesktopWindow(void)
 {
     return hwndDesktop;
 }
@@ -960,10 +961,16 @@
  */
 HWND SetSysModalWindow(HWND hWnd)
 {
-	HWND 	hWndOldModal = hWndSysModal;
+	HWND hWndOldModal = hWndSysModal;
 	hWndSysModal = hWnd;
 	printf("EMPTY STUB !! SetSysModalWindow(%04X) !\n", hWnd);
 	return hWndOldModal;
 }
 
-
+/*******************************************************************
+ *			GetSysModalWindow		[USER.189]
+ */
+HWND GetSysModalWindow(void)
+{
+	return hWndSysModal;
+}
diff --git a/wine.ini b/wine.ini
index b1d797f..b791ef8 100644
--- a/wine.ini
+++ b/wine.ini
@@ -11,7 +11,6 @@
 System=c:\windows\system

 Temp=c:\temp

 Path=c:\windows;c:\windows\system;e:\;e:\test;f:\

-SystemResources=sysres.dll

 

 [serialports]

 Com1=/dev/cua0