Release 980301

Sun Mar  1 10:45:23 1998  Andreas Mohr <100.30936@germany.net>

	* [loader/ne_image.c]
	Fixed problem with weird DLLs (NE_FFLAGS_SINGLEDATA && DGROUP = 0).

	* [msdos/dosmem.c]
	Export address for __0000H, too.

	* [msdos/dpmi.c]
	Changed MemAlloc functions to return less fragmented addresses.

Sat Feb 28 18:50:12 1998  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [scheduler/process.c] [scheduler/sysdeps.c]
	Don't use %fs register before threading initialization.

Sat Feb 28 14:04:56 1998  Kristian Nielsen  <kristian.nielsen@risoe.dk>

	* [configure.in] [include/acconfig.h]
	Autoconf macro to check for non-reentrant X libraries.

	* [windows/winpos.c]
	In SetWindowPos32(), do not cause WM_SIZE messages when the
	SWP_NOSIZE flag is specified. This fixes the division-by-zero in
	Borland C++ 4.0 "Open Project" menu item.

Sat Feb 28 13:11:26 1998  James Moody  <013263m@dragon.acadiau.ca>

	* [ole/ole2nls.c]
	Changed "English" values from German to English.

	* [files/dos_fs.c]
	Fixed off-by-one month bug.

Fri Feb 27 22:12:01 1998  Douglas Ridgway  <ridgway@winehq.com>

	* [windows/win.c]
	Fix winelib class menu loading bug.

	* [include/module.h] [loader/module.c]
	LoadModule32 should be implemented in terms of CreateProcess.

	* [programs/view/*]
	Metafile viewer sample program.

	* [documentation/wine.texinfo] [documentation/Makefile.in]
	Improvements and additions, HTML target.

Fri Feb 27 04:27:48 1998  Dimitrie O. Paun <dimi@cs.toronto.edu>

	* [*/*]
	Switched to the new debug messages interface. For more information
	please refer to documentation/debug-msgs. Because the new scheme
	introduces a new semantic level, I had to manually do through
	about 530 dprintf_xxx!  The rest of about 2400 where transformed
	via a script.  Because of the large number of changes that I had
	to do, some may have not come out as nicely as I wanted them.  If
	this is the case, please let me know. There is a lot of work left
	to do: -- a few hundred printf's to be converted -- about 2300
	fprintf's to be converted -- about 600 FIXME's to be transformed
	The problem is that in the above mentioned cases, a lot of manual
	intervention is required because a lot of the information is
	missing.  There are also a lot of other things to be done to the
	interface and so forth. I have now ideas for a at least a month
	worth of full time work :) I will proceed with many changes in the
	next few releases, so please do not start modifing things because
	there will be a hell of a lot of conflicts. If you have ideas that
	you want to integrate or you want to work on different things,
	please coordinate with me.

Thu Feb 26 13:04:29 1998  David Lee Lambert <lamber45@egr.msu.edu>

	* [ole/ole2nls.c] [include/windows.h]
	First try at OLE date- and time-formatting functions.

Wed Feb 25 11:20:35 1998 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>

	* [files/*.c]
	Changed dos device handling, added 'CON' devicehandling.

	* [graphics/ddraw.c]
	Bug fixes, some additions.

	* [if1632/builtin.c][loader/module.c][library/winestub.c]
	Small hack so we don't need a dummy BUILTIN_LoadModule
	in winestub.c.

	* [ole/*][relay32/ole32.spec][if1632/storage.spec]
	storage.dll started. winword loads documents (saving
	doesn't work yet, dunno why).
	Several ole additions, some cleanups and bugfixes.
	IMalloc16 implemented.

	* [loader/pe_image.c]
	Added some comments, fixed circular dll references,
	fixed modref ordering, fixed tls allocation.

	* [memory/global.c]
	Added validity checks before every GET_ARENA_PTR.
	(several functions rely on Global* return values
	 on invalid handles, like IsTask).
	Implemented GlobalUnlockFree16.

	* [memory/virtual.c]
	Replaced dprintf_virtual by fprintf, so we can
	do 'info map' again in the debugger. Increase read
	linesize for Linux2.1 cases.

	* [misc/cpu.c][misc/registry.c]
	Moved cpu registry initialization to misc/cpu.c.

	* [multimedia/dsound.c]
	Enhanced, replaced GETOSPACE bufferingcheck by SETFRAGMENT.

	* [relay32/crtdll.spec][relay32/ntdll.spec]
	Replaced some ptr by respective 'str' and 'wstr' arguments
	for libc functions.

	* [scheduler/thread.c]
	Added some sanity checks to stackallocation, tlshandling fixed.

	* [tools/build.c]
	Fixed cdecl argumenttype order (was reversed).

	* [win32/ordinals.c]
	Implemented KERNEL_449.

	* [windows/dinput.c]
	Some fixes, needs much more work. Tomb Raider2 works with keyboard ;)

Tue Feb 24 20:46:37 1998  James Juran   <jrj120@psu.edu>

	* [windows/win.c]
	Fixed USER32 ordinal numbers in documentation.

Sat Feb 21 12:30:38 1998  John Richardson <jrichard@zko.dec.com>

	* [files/file.c] [include/k32obj.h] [memory/virtual.c]
	[scheduler/critsection.c] [scheduler/event.c] [scheduler/handle.c]
	[scheduler/k32obj.c] [scheduler/mutex.c] [scheduler/process.c]
	[scheduler/semaphore.c] [scheduler/thread.c]
	Added generic k32obj read and write routines for k32objs that
	support I/O.

	* [documentation/console]
	Updated console docs.

	* [win32/console.c]
	Make console work like a k32obj that supports I/O.

	* [include/windows.h]
	Make WriteFile and ReadFile take HANDLE32 for handle.

Sun Feb 15 14:07:07 1998  Dimitrie O. Paun  <dimi@mail.cs.toronto.edu>

	* [controls/menu.c] [misc/ver.c] [multimedia/dsound.c]
	  [multimedia/joystick.c] [windows/dialog.c]
	Modified some dprintf_xxx's to prepare them for a new
	dprintf_ scheme. Basically, I changed the dprintf's that
	outputed a line with many dprintf calls to do just one
	dprintf call.
diff --git a/files/dos_fs.c b/files/dos_fs.c
index 5cd8e76..416c5c0 100644
--- a/files/dos_fs.c
+++ b/files/dos_fs.c
@@ -27,7 +27,6 @@
 #include "file.h"
 #include "heap.h"
 #include "msdos.h"
-#include "stddebug.h"
 #include "debug.h"
 
 /* Define the VFAT ioctl to get both short and long file names */
@@ -50,20 +49,8 @@
 /* Chars we don't want to see in DOS file names */
 #define INVALID_DOS_CHARS  "*?<>|\"+=,;[] \345"
 
-static const char *DOSFS_Devices[][2] =
-{
-    { "CON",  "" },
-    { "PRN",  "" },
-    { "NUL",  "/dev/null" },
-    { "AUX",  "" },
-    { "LPT1", "" },
-    { "LPT2", "" },
-    { "LPT3", "" },
-    { "LPT4", "" },
-    { "COM1", "" },
-    { "COM2", "" },
-    { "COM3", "" },
-    { "COM4", "" }
+static const char *DOSFS_Devices[] = {
+"CON","PRN","NUL","AUX","LPT1","LPT2","LPT3","LPT4","COM1","COM2","COM3","COM4",
 };
 
 
@@ -513,13 +500,13 @@
     if ((p = strchr( name, '\\' ))) len = MIN( (int)(p - name), len );
     if (long_len < len + 1) return FALSE;
 
-    dprintf_dosfs( stddeb, "DOSFS_FindUnixName: %s,%s\n", path, name );
+    dprintf_info(dosfs, "DOSFS_FindUnixName: %s,%s\n", path, name );
 
     if (!DOSFS_ToDosFCBFormat( name, dos_name )) dos_name[0] = '\0';
 
     if (!(dir = DOSFS_OpenDir( path )))
     {
-        dprintf_dosfs( stddeb, "DOSFS_FindUnixName(%s,%s): can't open dir: %s\n",
+        dprintf_warn(dosfs, "DOSFS_FindUnixName(%s,%s): can't open dir: %s\n",
                        path, name, strerror(errno) );
         return FALSE;
     }
@@ -559,12 +546,11 @@
             else
                 DOSFS_Hash( long_name, short_buf, FALSE, ignore_case );
         }
-        dprintf_dosfs( stddeb, "DOSFS_FindUnixName(%s,%s) -> %s (%s)\n",
-                       path, name, long_name, short_buf ? short_buf : "***");
+        dprintf_info(dosfs, "(%s,%s) -> %s (%s)\n",
+		     path, name, long_name, short_buf ? short_buf : "***");
     }
     else
-        dprintf_dosfs(stddeb,"DOSFS_FindUnixName(%s,%s) -> ** Not found **\n",
-                      path, name );
+        dprintf_warn(dosfs, "file: '%s' NOT FOUND in dir: '%s'\n", name, path);
     DOSFS_CloseDir( dir );
     return ret;
 }
@@ -573,10 +559,34 @@
 /***********************************************************************
  *           DOSFS_IsDevice
  *
- * Check if a DOS file name represents a DOS device. Returns the name
- * of the associated Unix device, or NULL if not found.
+ * Check if a DOS file name represents a DOS device.
  */
-const char *DOSFS_IsDevice( const char *name )
+BOOL32 DOSFS_IsDevice( const char *name )
+{
+    int	i;
+    const char *p;
+
+    if (name[0] && (name[1] == ':')) name += 2;
+    if ((p = strrchr( name, '/' ))) name = p + 1;
+    if ((p = strrchr( name, '\\' ))) name = p + 1;
+    for (i = 0; i < sizeof(DOSFS_Devices)/sizeof(DOSFS_Devices[0]); i++)
+    {
+        const char *dev = DOSFS_Devices[i];
+        if (!lstrncmpi32A( dev, name, strlen(dev) ))
+        {
+            p = name + strlen( dev );
+            if (!*p || (*p == '.')) return TRUE;
+        }
+    }
+    return FALSE;
+}
+
+/***********************************************************************
+ *           DOSFS_OpenDevice
+ *
+ * Open a DOS device. This might not map 1:1 into the UNIX device concept.
+ */
+HFILE32 DOSFS_OpenDevice( const char *name, int unixmode )
 {
     int i;
     const char *p;
@@ -586,16 +596,37 @@
     if ((p = strrchr( name, '\\' ))) name = p + 1;
     for (i = 0; i < sizeof(DOSFS_Devices)/sizeof(DOSFS_Devices[0]); i++)
     {
-        const char *dev = DOSFS_Devices[i][0];
+        const char *dev = DOSFS_Devices[i];
         if (!lstrncmpi32A( dev, name, strlen(dev) ))
         {
             p = name + strlen( dev );
-            if (!*p || (*p == '.')) return DOSFS_Devices[i][1];
+            if (!*p || (*p == '.')) {
+	    	/* got it */
+		if (!strcmp(DOSFS_Devices[i],"NUL"))
+			return FILE_OpenUnixFile("/dev/null",unixmode);
+		if (!strcmp(DOSFS_Devices[i],"CON")) {
+			switch (unixmode) {
+			case O_RDONLY:
+				return GetStdHandle( STD_INPUT_HANDLE );
+				break;
+			case O_WRONLY:
+				return GetStdHandle( STD_OUTPUT_HANDLE );
+				break;
+			default:
+				fprintf(stderr,"DOSFS_OpenDevice: CON cannot be opened read/write currently, FIXME.\n");
+				return HFILE_ERROR32;
+				break;
+			}
+		}
+		/* FIXME: the rest of the devices ... lptX, comX et.al. */
+    		return HFILE_ERROR32;
+	    }
         }
     }
-    return NULL;
+    return HFILE_ERROR32;
 }
 
+
 /***********************************************************************
  *           DOSFS_GetPathDrive
  *
@@ -648,7 +679,7 @@
     UINT32 flags;
     char *p_l, *p_s, *root;
 
-    dprintf_dosfs( stddeb, "DOSFS_GetFullName: %s (last=%d)\n",
+    dprintf_info(dosfs, "DOSFS_GetFullName: %s (last=%d)\n",
                    name, check_last );
 
     if ((full->drive = DOSFS_GetPathDrive( &name )) == -1) return FALSE;
@@ -756,7 +787,7 @@
     }
     if (!full->long_name[0]) strcpy( full->long_name, "/" );
     if (!full->short_name[2]) strcpy( full->short_name + 2, "\\" );
-    dprintf_dosfs( stddeb, "DOSFS_GetFullName: returning %s = %s\n",
+    dprintf_info(dosfs, "DOSFS_GetFullName: returning %s = %s\n",
                    full->long_name, full->short_name );
     return TRUE;
 }
@@ -846,7 +877,7 @@
     int drive;
     char *p;
 
-    dprintf_dosfs( stddeb, "GetFullPathName: converting %s\n", name );
+    dprintf_info(dosfs, "GetFullPathName: converting %s\n", name );
 
     if (!name || !result) return 0;
 
@@ -910,7 +941,7 @@
     if (unicode) lstrcpynAtoW( (LPWSTR)result, buffer, len );
     else lstrcpyn32A( result, buffer, len );
 
-    dprintf_dosfs( stddeb, "GetFullPathName: returning %s\n", buffer );
+    dprintf_info(dosfs, "GetFullPathName: returning %s\n", buffer );
     return strlen(buffer);
 }
 
@@ -995,7 +1026,7 @@
     else  /* Not in the cache, open it anew */
     {
         const char *drive_path;
-        dprintf_dosfs( stddeb, "DOSFS_FindNext: cache miss, path=%s skip=%d buf=%s cur=%d\n",
+        dprintf_info(dosfs, "DOSFS_FindNext: cache miss, path=%s skip=%d buf=%s cur=%d\n",
                        path, skip, buffer, cur_pos );
         cur_pos = skip;
         if (dir) DOSFS_CloseDir(dir);
@@ -1004,7 +1035,7 @@
         drive_path = path + strlen(DRIVE_GetRoot(drive));
         while ((*drive_path == '/') || (*drive_path == '\\')) drive_path++;
         drive_root = !*drive_path;
-        dprintf_dosfs(stddeb, "DOSFS_FindNext: drive_root = %d\n", drive_root);
+        dprintf_info(dosfs, "DOSFS_FindNext: drive_root = %d\n", drive_root);
         lstrcpyn32A( buffer, path, sizeof(buffer) - 1 );
     }
     strcat( buffer, "/" );
@@ -1070,7 +1101,7 @@
 
         lstrcpyn32A( entry->cFileName, long_name, sizeof(entry->cFileName) );
         if (!(flags & DRIVE_CASE_PRESERVING)) CharLower32A( entry->cFileName );
-        dprintf_dosfs( stddeb, "DOSFS_FindNext: returning %s (%s) %02lx %ld\n",
+        dprintf_info(dosfs, "DOSFS_FindNext: returning %s (%s) %02lx %ld\n",
                        entry->cFileName, entry->cAlternateFileName,
                        entry->dwFileAttributes, entry->nFileSizeLow );
         cur_pos += count;
@@ -1537,7 +1568,7 @@
     time_t xtime = DOSFS_FileTimeToUnixTime( ft, &remainder );
     xtm = gmtime(&xtime);
     syst->wYear         = xtm->tm_year;
-    syst->wMonth        = xtm->tm_mon;
+    syst->wMonth        = xtm->tm_mon + 1;
     syst->wDayOfWeek    = xtm->tm_wday;
     syst->wDay	        = xtm->tm_mday;
     syst->wHour	        = xtm->tm_hour;
@@ -1557,7 +1588,7 @@
     LPSTR s;
     char  buffer[200];
 
-    dprintf_dosfs(stddeb,"QueryDosDevice(%s,...)\n",devname?devname:"<null>");
+    dprintf_info(dosfs,"QueryDosDevice(%s,...)\n",devname?devname:"<null>");
     if (!devname) {
 	/* return known MSDOS devices */
 	lstrcpy32A(buffer,"CON COM1 COM2 LPT1 NUL ");
@@ -1601,7 +1632,7 @@
     struct tm xtm;
 
     xtm.tm_year	= syst->wYear;
-    xtm.tm_mon	= syst->wMonth;
+    xtm.tm_mon	= syst->wMonth - 1;
     xtm.tm_wday	= syst->wDayOfWeek;
     xtm.tm_mday	= syst->wDay;
     xtm.tm_hour	= syst->wHour;