Release 940607

Tue Jun  7 08:41:27 1994  Bob Amstadt  (bob@pooh)

	* loader/selector.c (FixupFunctionPrologs): 
	New function to fixup loaded DLL function prologs.  It replaces the
	do nothing code with code that loads DS with the appropriate data
	segment for the DLL.

	* misc/cursor.c (LoadCursor): 
	Disabled cursor loading from .EXE or .DLL.  The code needs to handle
	the possibility of multiple cursors in a single directory.  Also,
	it should check to see if the cursor is the right size.

	* objects/font.c (EnumFonts): 
	Checked for lpLogFontList[i] == NULL

	* objects/gdiobj.c (SetObjectOwner): 
	Removed stub.  Replaced with simple return in gdi.spec.  This
	function is not defined for the retail version of Windows.

	* memory/heap.c (WIN16_LocalHandleDelta): 
	New function.  This is really a dummy that imitates the proper
	return values.

	* loader/library.c (GetProcAddress): 
	Fixed definition of IS_BUILTIN_DLL() macro.

Mon Jun  6 18:15:40 1994  Bob Amstadt  (bob@pooh)

	* miscemu/int21.c (SeekFile): 
	Needed to return current position in DX:AX.

	* windows/utility.c (windows_wsprintf): 
	Added support for '#' in format, and fixed bug with "ptr" being
	incremented too many times.

	* miscemu/int21.c (OpenExistingFile): 
	Add code to handle opening files read-only and write-only.

	* loader/wine.c:
	Segment fixups now done in LoadImage instead of _WinMain.  This
	is necessary to support LoadLibrary().

Sun Jun  5 17:34:24 1994  Erik Bos (erik@hacktic.nl)

	* [loader/*]
		- fixed: GetModuleHandle() sometimes returned
		  a wrong handle.
		- don't init dlls when cs == 0 (lzexpand, doesn't
		  seem to have a init function)
		- LoadLibrary & LoadImage now return error instead
		  of stopping wine.
		- moved most of NE-functions into one file.
		- LoadLibrary() uses w_files list instead of its
		  own list.
		- NE exectables are now fixed-up and initialised when
		  loaded instead of only once before calling InitTask.

	* [miscemu/int15.c] [miscemu/int31.c]
	Added.	

	* [loader/selector.c]
	Stubs added for {Get|Set}SelectorLimit(), {Get|Set}SelectorBase().

	* [misc/main.c]
	Stub added for IsRomModule().

	* [miscemu/int21.c]
	Some cleanup, added heap for returning data.

Jun 6, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte)

	* [tools/build.c]
	Change MAX_ORDINALS	define to higher value, 1299 entries.
	(MMSYSTEM doesn't have succesive numbers, some are around 1200).

	* [windows/utility.c]
	Bug fix in windows_wsprintf(), (twice increments ...).

	* [windows/winpos.c]
	Bug fix in SetWindowPos(), redraw was done if flag
		was set to SWP_NOREDRAW while SWP_SHOWWINDOW).

	* [misc/message.c] [controls/combo.c]
	Add an InvalidateRect() in WM_SHOWWINDOW to statisfy the new 'saveunder'.

	* [windows/win.c]
	In CreateWindowEx(), do SetMenu() calls after window creation,
		just before sending to WM_NCCALCSIZE.

	* [controls/menu.c]
	In function SetMenu(), now use SetWindowPos() with 
		flags SWP_FRAMECHANGED to readjust menu area.
	Function MenuBarCalcSize() redone.

Sun May 29 11:08:24 1994  David B. Thomas  (dt@yenta.abq.nm.us)

        * [objects/text.c]
        Fixed problems associated with DT_WORDBREAK flag.  String length
        was not being properly decremented when lines were folded, and
        wrapping was not performed when DT_NOCLIP and DT_NOPREFIX were
        both on in addition to DT_WORDBREAK.  Windows does wrapping in
        this case, and now so does wine.

Sun Jun  5 19:17:49 1994  Olaf Flebbe  (olaf@dragon)

        * [edit.c]
        cp1 was uninitialized iff lineno == 0

        *  FindFile tests for existance of file even if a full
           filename was supplied. What about unix file names?

        * [controls/listbox ]
        wndPtr was uninitialized for LB_SETTOPINDEX

        * [misc/property.c]     
        Do not free lpProp. Is it really allocated by malloc?
	{edited by Bob Amstadt: changed free() to GlobalFree()}
diff --git a/misc/Imakefile b/misc/Imakefile
index 6cfa02f..5967031 100644
--- a/misc/Imakefile
+++ b/misc/Imakefile
@@ -11,6 +11,7 @@
 	dos_fs.c \
 	driver.c \
 	exec.c \
+	escape.c \
 	file.c \
 	keyboard.c \
 	lstr.c \
diff --git a/misc/audio.c b/misc/audio.c
index 97a2e60..008029f 100644
--- a/misc/audio.c
+++ b/misc/audio.c
@@ -15,9 +15,9 @@
 
 
 /**************************************************************************
-* 				DriverProc			[sample driver]
+* 				AUDIO_DriverProc		[sample driver]
 */
-LRESULT DriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg, 
+LRESULT AUDIO_DriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg, 
 						DWORD dwParam1, DWORD dwParam2)
 {
 	switch(wMsg) {
diff --git a/misc/cursor.c b/misc/cursor.c
index 15bc145..91e88ef 100644
--- a/misc/cursor.c
+++ b/misc/cursor.c
@@ -127,6 +127,13 @@
 		break;
 	    }
 	}
+
+#if 1
+    lpcur->xcursor = XCreateFontCursor(XT_display, XC_top_left_arrow);
+    GlobalUnlock(hCursor);
+    return hCursor;
+#endif
+
     if (!(hdc = GetDC(GetDesktopWindow()))) return 0;
     rsc_mem = RSC_LoadResource(instance, cursor_name, NE_RSCTYPE_GROUP_CURSOR, 
 			       &image_size);
diff --git a/misc/dos_fs.c b/misc/dos_fs.c
index 83ed2b5..dc3b1bb 100644
--- a/misc/dos_fs.c
+++ b/misc/dos_fs.c
@@ -128,17 +128,13 @@
 			continue;
 		}
 		ExpandTildeString(temp);
-		if ((ptr = (char *) malloc(strlen(temp)+1)) == NULL) {
-			fprintf(stderr,"DOSFS: can't malloc for drive info!");
-			continue;
-		}
-			ChopOffSlash(temp);
-			DosDrives[x].rootdir = ptr;
-			strcpy(DosDrives[x].rootdir, temp);
-			strcpy(DosDrives[x].cwd, "/windows/");
-			strcpy(DosDrives[x].label, "DRIVE-");
-			strcat(DosDrives[x].label, drive);
-			DosDrives[x].disabled = 0;
+		ChopOffSlash(temp);
+		DosDrives[x].rootdir = strdup(temp);
+		strcpy(DosDrives[x].rootdir, temp);
+		strcpy(DosDrives[x].cwd, "/windows/");
+		strcpy(DosDrives[x].label, "DRIVE-");
+		strcat(DosDrives[x].label, drive);
+		DosDrives[x].disabled = 0;
 	}
 	DOS_SetDefaultDrive(2);
 
@@ -393,19 +389,22 @@
 char *GetDosFileName(char *unixfilename)
 { 
 	int i;
-	static char temp[256];
+	static char temp[256], rootdir[256];
 	/*   /dos/windows/system.ini => c:\windows\system.ini */
 	
 	for (i = 0 ; i != MAX_DOS_DRIVES; i++) {
 		if (DosDrives[i].rootdir != NULL) {
-		   if (strncmp(DosDrives[i].rootdir, unixfilename, strlen(DosDrives[i].rootdir)) == 0) {
-			sprintf(temp, "%c:\\%s", 'A' + i, unixfilename + strlen(DosDrives[i].rootdir) + 1);
-			ToDos(temp);
-			return temp;
-		   }	
+ 			strcpy(rootdir, DosDrives[i].rootdir);
+ 			strcat(rootdir, "/");
+                	ToUnix(rootdir);
+ 			if (strncmp(rootdir, unixfilename, strlen(rootdir)) == 0) {
+ 				sprintf(temp, "%c:\\%s", 'A' + i, unixfilename + strlen(rootdir));
+				ToDos(temp);
+				return temp;
+			}	
 		}
 	}
-	strcpy(temp, unixfilename);
+	sprintf(temp, "UNIX:%s", unixfilename);
 	ToDos(temp);
 	return(temp);
 }
@@ -534,7 +533,11 @@
     {
 	strncpy(buffer, GetUnixFileName(filename), buflen);
 	ToUnix(buffer);
-	return buffer;
+	stat( buffer, &filestat);
+	if (S_ISREG(filestat.st_mode))
+	    return buffer;
+	else
+	    return NULL;
     }
 
     if (strchr(filename, '/') != NULL)
diff --git a/misc/driver.c b/misc/driver.c
index a3e4975..28888b5 100644
--- a/misc/driver.c
+++ b/misc/driver.c
@@ -6,10 +6,11 @@
 
 static char Copyright[] = "Copyright  Martin Ayotte, 1994";
 
-#include "stdio.h"
+#include <stdio.h>
 #include "windows.h"
 #include "win.h"
 #include "user.h"
+#include "dlls.h"
 #include "driver.h"
 
 LPDRIVERITEM lpDrvItemList = NULL;
@@ -47,7 +48,7 @@
 	lpnewdrv = (LPDRIVERITEM) GlobalLock(hDrvr);
 	if (lpnewdrv == NULL) return 0;
 	lpnewdrv->dis.length = sizeof(DRIVERINFOSTRUCT);
-	lpnewdrv->dis.hModule = LoadImage("DrvName", DLL);
+	lpnewdrv->dis.hModule = LoadImage("DrvName", DLL, 0);
 	if (lpnewdrv->dis.hModule == 0) {
 		GlobalUnlock(hDrvr);
 		GlobalFree(hDrvr);
diff --git a/misc/escape.c b/misc/escape.c
new file mode 100644
index 0000000..a4f6a6f
--- /dev/null
+++ b/misc/escape.c
@@ -0,0 +1,18 @@
+/*
+ * Escape() function.
+ *
+ * Copyright 1994  Bob Amstadt
+ */
+
+static char Copyright[] = "Copyright  Bob Amstadt, 1994";
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "windows.h"
+
+int Escape(HDC hdc, int nEscape, int cbInput, 
+	   LPSTR lpszInData, LPSTR lpvOutData)
+{
+    fprintf(stderr, "Escape(nEscape = %04x)\n", nEscape);
+    return 0;
+}
diff --git a/misc/main.c b/misc/main.c
index fca16e6..ab3c2e7 100644
--- a/misc/main.c
+++ b/misc/main.c
@@ -342,6 +342,7 @@
     MAIN_SaveSetup();
     DOS_InitFS();
     Comm_Init();
+    INT21_Init();
     
 #ifndef sunos
     atexit(called_at_exit);
@@ -557,3 +558,13 @@
 	return 0;	/* don't swap */
 }
 
+/***********************************************************************
+*	ISROMMODULE (KERNEL.323)
+*/
+BOOL IsRomModule(HANDLE x)
+{
+	/* I don't know the prototype, I assume that it returns true
+	   if the dll is located in rom */
+	   
+	return FALSE;
+}
diff --git a/misc/message.c b/misc/message.c
index 9d754e3..d9669b6 100644
--- a/misc/message.c
+++ b/misc/message.c
@@ -270,14 +270,21 @@
 			lpmb->rectStr.left += 64;
 			}
 	    break;
+	case WM_SHOWWINDOW:
+		if (!(wParam == 0 && lParam == 0L)) {
+			InvalidateRect(hWnd, NULL, TRUE);
+			}
+	    break;
 	case WM_PAINT:
 #ifdef DEBUG_MSGBOX
-		printf("MessageBox WM_PAINT !\n");
+		printf("MessageBox WM_PAINT hWnd=%04X !\n", hWnd);
 #endif
 		lpmb = MsgBoxGetStorageHeader(hWnd);
 		if (lpmb == NULL) break;
-		CopyRect(&rect, &lpmb->rectStr);
 		hDC = BeginPaint(hWnd, &ps);
+		GetClientRect(hWnd, &rect);
+		FillRect(hDC, &rect, GetStockObject(WHITE_BRUSH));
+		CopyRect(&rect, &lpmb->rectStr);
 		OldTextColor = SetTextColor(hDC, 0x00000000);
 		if (lpmb->hIcon) 
 			DrawIcon(hDC, lpmb->rectIcon.left,
diff --git a/misc/mmsystem.c b/misc/mmsystem.c
index 09304df..6e22c5c 100644
--- a/misc/mmsystem.c
+++ b/misc/mmsystem.c
@@ -8,6 +8,7 @@
 
 #include "stdio.h"
 #include "win.h"
+#include "driver.h"
 #include "mmsystem.h"
 
 static WORD		mciActiveDev = 0;
@@ -17,7 +18,10 @@
 UINT WINAPI waveGetErrorText(UINT uError, LPSTR lpText, UINT uSize);
 
 
-int MCI_LibMain(HANDLE hInstance, WORD wDataSeg,
+/**************************************************************************
+* 				MMSYSTEM_WEP		[MMSYSTEM.1]
+*/
+int MMSYSTEM_WEP(HANDLE hInstance, WORD wDataSeg,
 		 WORD cbHeapSize, LPSTR lpCmdLine)
 {
 	printf("MMSYSTEM DLL INIT ... hInst=%04X \n", hInstance);
@@ -29,7 +33,7 @@
 */
 BOOL WINAPI sndPlaySound(LPCSTR lpszSoundName, UINT uFlags)
 {
-	printf("sndPlaySound // lpszSoundName='%s' uFlags=%04X !\n", 
+	printf("EMPTY STUB !!! sndPlaySound // SoundName='%s' uFlags=%04X !\n", 
 										lpszSoundName, uFlags);
 	return 0;
 }
@@ -44,14 +48,107 @@
 }
 
 /**************************************************************************
+* 				DriverProc	[MMSYSTEM.6]
+*/
+LRESULT DriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg, 
+						DWORD dwParam1, DWORD dwParam2)
+{
+	return DrvDefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
+}
+
+/**************************************************************************
 * 				OutputDebugStr		[MMSYSTEM.30]
 */
 void WINAPI OutputDebugStr(LPCSTR str)
 {
-	printf("OutputDebugStr('%s');\n", str);
+	printf("EMPTY STUB !!! OutputDebugStr('%s');\n", str);
 }
 
 /**************************************************************************
+* 				DriverCallback	[MMSYSTEM.31]
+*/
+BOOL DriverCallback(DWORD dwCallBack, UINT uFlags, HANDLE hDev, 
+		WORD wMsg, DWORD dwUser, DWORD dwParam1, DWORD dwParam2)
+{
+	printf("EMPTY STUB !!! DriverCallback() !\n");
+}
+
+/**************************************************************************
+* 				JoyGetNumDevs		[MMSYSTEM.101]
+*/
+WORD JoyGetNumDevs()
+{
+	printf("EMPTY STUB !!! JoyGetNumDevs();\n");
+	return 0;
+}
+
+/**************************************************************************
+* 				JoyGetDevCaps		[MMSYSTEM.102]
+*/
+WORD JoyGetDevCaps(WORD wID, LPJOYCAPS lpCaps, WORD wSize)
+{
+	printf("EMPTY STUB !!! JoyGetDevCaps(%04X, %08X, %d);\n", 
+										wID, lpCaps, wSize);
+	return MMSYSERR_NODRIVER;
+}
+
+/**************************************************************************
+* 				JoyGetPos			[MMSYSTEM.103]
+*/
+WORD JoyGetPos(WORD wID, LPJOYINFO lpInfo)
+{
+	printf("EMPTY STUB !!! JoyGetPos(%04X, %08X);\n", wID, lpInfo);
+	return MMSYSERR_NODRIVER;
+}
+
+/**************************************************************************
+* 				JoyGetThreshold		[MMSYSTEM.104]
+*/
+WORD JoyGetThreshold(WORD wID, LPWORD lpThreshold)
+{
+	printf("EMPTY STUB !!! JoyGetThreshold(%04X, %08X);\n", wID, lpThreshold);
+	return MMSYSERR_NODRIVER;
+}
+
+/**************************************************************************
+* 				JoyReleaseCapture	[MMSYSTEM.105]
+*/
+WORD JoyReleaseCapture(WORD wID)
+{
+	printf("EMPTY STUB !!! JoyReleaseCapture(%04X);\n", wID);
+	return MMSYSERR_NODRIVER;
+}
+
+/**************************************************************************
+* 				JoySetCapture		[MMSYSTEM.106]
+*/
+WORD JoySetCapture(HWND hWnd, WORD wID, WORD wPeriod, BOOL bChanged)
+{
+	printf("EMPTY STUB !!! JoySetCapture(%04X, %04X, %d, %d);\n", 
+							hWnd, wID, wPeriod, bChanged);
+	return MMSYSERR_NODRIVER;
+}
+
+/**************************************************************************
+* 				JoySetThreshold		[MMSYSTEM.107]
+*/
+WORD JoySetThreshold(WORD wID, WORD wThreshold)
+{
+	printf("EMPTY STUB !!! JoySetThreshold(%04X, %d);\n", wID, wThreshold);
+	return MMSYSERR_NODRIVER;
+}
+
+/**************************************************************************
+* 				JoySetCalibration	[MMSYSTEM.109]
+*/
+WORD JoySetCalibration(WORD wID)
+{
+	printf("EMPTY STUB !!! JoySetCalibration(%04X);\n", wID);
+	return MMSYSERR_NODRIVER;
+}
+
+
+/**************************************************************************
 * 				auxGetNumDevs		[MMSYSTEM.350]
 */
 UINT WINAPI auxGetNumDevs()
@@ -1511,6 +1608,17 @@
 
 
 /**************************************************************************
+* 				mmioRename			[MMSYSTEM.1226]
+*/
+UINT WINAPI mmioRename(LPCSTR szFileName, LPCSTR szNewFileName,
+     MMIOINFO FAR* lpmmioinfo, DWORD dwRenameFlags)
+{
+	printf("mmioRename('%s', '%s', %08X, %08X);\n",
+			szFileName, szNewFileName, lpmmioinfo, dwRenameFlags);
+	return 0;
+}
+
+/**************************************************************************
 * 				DrvOpen				[MMSYSTEM.1100]
 */
 HDRVR DrvOpen(LPSTR lpDriverName, LPSTR lpSectionName, LPARAM lParam)
diff --git a/misc/property.c b/misc/property.c
index 18119c6..92f57a4 100644
--- a/misc/property.c
+++ b/misc/property.c
@@ -62,7 +62,7 @@
 				((LPPROPENTRY)lpProp->lpNextProp)->lpPrevProp = 
 											lpProp->lpPrevProp;
 			if (lpProp->PropName != NULL) free(lpProp->PropName);
-			free(lpProp);
+			GlobalFree(lpProp);
 			GlobalUnlock(wndPtr->hProp);
 			return hOldData;
 			}
diff --git a/misc/shell.c b/misc/shell.c
index 19977ca..d55368d 100644
--- a/misc/shell.c
+++ b/misc/shell.c
@@ -14,7 +14,6 @@
 
 LPKEYSTRUCT	lphRootKey = NULL;
 
-typedef FAR LONG *LPWORD;
 DECLARE_HANDLE(HDROP);
 
 extern HINSTANCE hSysRes;
diff --git a/misc/user.c b/misc/user.c
index ed0045b..cce820e 100644
--- a/misc/user.c
+++ b/misc/user.c
@@ -80,11 +80,9 @@
       /* Create desktop window */
     if (!WIN_CreateDesktopWindow()) return 0;
 
-#if 1
 #ifndef WINELIB
     /* Initialize DLLs */
-    InitializeLoadedDLLs();
-#endif
+    InitializeLoadedDLLs(NULL);
 #endif
         
     return 1;