Release 980315

Sun Mar 15 03:46:50 1998  Dimitrie O. Paun  <dimi@mail.cs.toronto.edu>

	* [*/*]
	Fixed some dprintf_ such that there is one and only one
	new line for each dprintf and that new line occurs at the end.
	Transformed some fprintfs into proper debug statements.
	Removed much redundancy from most of the debug statements. The
	redundancy appeared because now the component and function
	name is output automatically. Most debug statements also used to
	output the name of the function.
	All these changes prepared the source to switch completely to
	the new debugging interface.
	For more info, refer to ./documentation/debug-msg

Sat Mar 14 19:45:23 1997  Andreas Mohr <100.30936@germany.net>

	* [misc/shell.c] [if1632/kernel.spec]
	Changed parameters of FUNC004() to fix a crash.
	Not sure if this fix is correct (doc wanted).

	* [windows/user.c] [if1632/user.spec] [include/user.h]
	Implemented UserSeeUserDo.

	* [msdos/int21.c] [include/msdos.h]
	Added "GET LIST OF LISTS" (INT 21/52h).

Sat Mar 14 15:48:02 1998  Douglas Ridgway <ridgway@gmcl.com>

	* [include/windows.h] [relay32/gdi32.spec] [objects/enhmetafile.c]
	Beginnings of enhanced metafile support.

Fri Mar 13 20:53:09 1998  John Richardson <jrichard@zko.dec.com>

	* [win32/console.c]
	Restart interrupted console writes.

Fri Mar 13 18:59:24 1998  Matthew Becker <mbecker@glasscity.net>

	* [*/*.c]
	Updated documentation for API manpages.

	* [windows/dce.c]
	ReleaseDC16: Fixed cast.

	* [include/windows.h] [memory/virtual.c]
	VirtualQuery{Ex} should return DWORD instead of BOOL32.

Fri Mar 13 13:03:06 1998  Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>

	* [README][documentation/status/]
	README updated, added lzexpand,version and multimedia
	status notes to new documentation/status directory.

	* [ole/*.c][if1632/typelib.spec]
	Added typelib stubs, several small additions and fixes.

	* [loader/pe_image.c]
	Fixed a small bug (fixup_imports got passed the wrong hModule in a
	remapcase).

	* [loader/signal.c][if1632/signal.c][misc/winsock_dns.c]
	  [loader/module.c]
	Fixed some recursive debugger crashes (caused by invalid FS).

	* [misc/registry.c]
	Two bugs fixed.

Fri Mar 13 04:55:01 1998  David Lee Lambert <lamber45@egr.msu.edu>

	* [include/winnt.h] [include/winnls.h]
	Moved LANG_xxx flags to winnls.h

	* [include/winnls.h]
	Added flags for GetDateFormat(); fixed validity of
	LOCALE_SYSTEM_DEFAULT.

	* [include/windows.h] 
	Added GetTimeFormat() prototypes.

	* [ole/ole2nls.c]
	Implemented ASCII date- and time-functions,  using an
	optimized common core;  added stubs for Unicode versions;  
	started work on a Unicode core.

	* [AUTHORS]
	Added my name.

Mon Mar  9 20:10:15 1998  Eric Kohl <ekohl@abo.rhein-zeitung.de>

	* [relay32/comctl32.spec] [include/imagelist.h]
	  [include/commctrl.h] [misc/imagelist.c] [misc/Makefile.in]
	First attempt at implementing ImageLists.

Sun Mar  8 20:19:49 1998  Uwe Bonnes  <bon@elektron.ikp.physik.tu-darmstadt.de>

	* [files/dos_fs.c] [configure.in]
	Try to get FileTimeToLocalFileTime,FileTimeToSystemTime and
	SystemTimeToFileTime right.
	Use timegm() where available.

	* [misc/lstr.c]
	Fix an off by one error in FormatMessage and handle the case 
	when args = NULL (used by programs to get the length of the 
	string).

	* [win32/console.c]
	Actual display a per-process Title string, better working
	attempt for WriteConsole32W and ReadConsole32W.

Fri Mar  6 20:33:45 1998  Slaven Rezic  <eserte@cs.tu-berlin.de>

	* [include/config.h.in][configure.in][multimedia/audio.c]
	  [multimedia/dsound.c]
	Added check for FreeBSD sound system.

Sun Mar  1 17:40:10 1998  Jason Schonberg <schon@mti.sgi.com>

	* [controls/edit.c] [include/ole.h] [include/shlobj.h]
	Removed final commas in enum types.

Mon Feb 23 07:52:18 1998  Luiz Otavio L. Zorzella  <zorzella@nr.conexware.com>

	* [multimedia/time.c]
	Workaround to avoid infinite recursion inside timeGetTime.

	* [multimedia/audio.c]
	WODM_GETNUMDEVS and WIDM_GETNUMDEVS only return 1 now if the
	SOUND_DEV can be opened, or if it's busy.
diff --git a/files/dos_fs.c b/files/dos_fs.c
index 416c5c0..8ca3fb9 100644
--- a/files/dos_fs.c
+++ b/files/dos_fs.c
@@ -500,13 +500,13 @@
     if ((p = strchr( name, '\\' ))) len = MIN( (int)(p - name), len );
     if (long_len < len + 1) return FALSE;
 
-    dprintf_info(dosfs, "DOSFS_FindUnixName: %s,%s\n", path, name );
+    TRACE(dosfs, "%s,%s\n", path, name );
 
     if (!DOSFS_ToDosFCBFormat( name, dos_name )) dos_name[0] = '\0';
 
     if (!(dir = DOSFS_OpenDir( path )))
     {
-        dprintf_warn(dosfs, "DOSFS_FindUnixName(%s,%s): can't open dir: %s\n",
+        WARN(dosfs, "(%s,%s): can't open dir: %s\n",
                        path, name, strerror(errno) );
         return FALSE;
     }
@@ -546,11 +546,11 @@
             else
                 DOSFS_Hash( long_name, short_buf, FALSE, ignore_case );
         }
-        dprintf_info(dosfs, "(%s,%s) -> %s (%s)\n",
+        TRACE(dosfs, "(%s,%s) -> %s (%s)\n",
 		     path, name, long_name, short_buf ? short_buf : "***");
     }
     else
-        dprintf_warn(dosfs, "file: '%s' NOT FOUND in dir: '%s'\n", name, path);
+        WARN(dosfs, "'%s' not found in '%s'\n", name, path);
     DOSFS_CloseDir( dir );
     return ret;
 }
@@ -613,7 +613,7 @@
 				return GetStdHandle( STD_OUTPUT_HANDLE );
 				break;
 			default:
-				fprintf(stderr,"DOSFS_OpenDevice: CON cannot be opened read/write currently, FIXME.\n");
+				FIXME(dosfs,"can't open CON read/write\n");
 				return HFILE_ERROR32;
 				break;
 			}
@@ -679,7 +679,7 @@
     UINT32 flags;
     char *p_l, *p_s, *root;
 
-    dprintf_info(dosfs, "DOSFS_GetFullName: %s (last=%d)\n",
+    TRACE(dosfs, "%s (last=%d)\n",
                    name, check_last );
 
     if ((full->drive = DOSFS_GetPathDrive( &name )) == -1) return FALSE;
@@ -787,7 +787,7 @@
     }
     if (!full->long_name[0]) strcpy( full->long_name, "/" );
     if (!full->short_name[2]) strcpy( full->short_name + 2, "\\" );
-    dprintf_info(dosfs, "DOSFS_GetFullName: returning %s = %s\n",
+    TRACE(dosfs, "returning %s = %s\n",
                    full->long_name, full->short_name );
     return TRUE;
 }
@@ -877,7 +877,7 @@
     int drive;
     char *p;
 
-    dprintf_info(dosfs, "GetFullPathName: converting %s\n", name );
+    TRACE(dosfs, "converting %s\n", name );
 
     if (!name || !result) return 0;
 
@@ -941,7 +941,7 @@
     if (unicode) lstrcpynAtoW( (LPWSTR)result, buffer, len );
     else lstrcpyn32A( result, buffer, len );
 
-    dprintf_info(dosfs, "GetFullPathName: returning %s\n", buffer );
+    TRACE(dosfs, "returning %s\n", buffer );
     return strlen(buffer);
 }
 
@@ -1026,7 +1026,7 @@
     else  /* Not in the cache, open it anew */
     {
         const char *drive_path;
-        dprintf_info(dosfs, "DOSFS_FindNext: cache miss, path=%s skip=%d buf=%s cur=%d\n",
+        TRACE(dosfs, "cache miss, path=%s skip=%d buf=%s cur=%d\n",
                        path, skip, buffer, cur_pos );
         cur_pos = skip;
         if (dir) DOSFS_CloseDir(dir);
@@ -1035,7 +1035,7 @@
         drive_path = path + strlen(DRIVE_GetRoot(drive));
         while ((*drive_path == '/') || (*drive_path == '\\')) drive_path++;
         drive_root = !*drive_path;
-        dprintf_info(dosfs, "DOSFS_FindNext: drive_root = %d\n", drive_root);
+        TRACE(dosfs, "drive_root = %d\n", drive_root);
         lstrcpyn32A( buffer, path, sizeof(buffer) - 1 );
     }
     strcat( buffer, "/" );
@@ -1079,7 +1079,7 @@
         lstrcpyn32A( p, long_name, sizeof(buffer) - (int)(p - buffer) );
         if (!FILE_Stat( buffer, &info ))
         {
-            fprintf( stderr, "DOSFS_FindNext: can't stat %s\n", buffer );
+            WARN(dosfs, "can't stat %s\n", buffer);
             continue;
         }
         if (info.dwFileAttributes & ~attr) continue;
@@ -1101,7 +1101,7 @@
 
         lstrcpyn32A( entry->cFileName, long_name, sizeof(entry->cFileName) );
         if (!(flags & DRIVE_CASE_PRESERVING)) CharLower32A( entry->cFileName );
-        dprintf_info(dosfs, "DOSFS_FindNext: returning %s (%s) %02lx %ld\n",
+        TRACE(dosfs, "returning %s (%s) %02lx %ld\n",
                        entry->cFileName, entry->cAlternateFileName,
                        entry->dwFileAttributes, entry->nFileSizeLow );
         cur_pos += count;
@@ -1547,13 +1547,26 @@
 BOOL32 WINAPI FileTimeToLocalFileTime( const FILETIME *utcft,
                                        LPFILETIME localft )
 {
-    struct tm *xtm;
     DWORD remainder;
-
     /* convert from UTC to local. Perhaps not correct. FIXME */
     time_t unixtime = DOSFS_FileTimeToUnixTime( utcft, &remainder );
+#ifdef HAVE_TIMEGM
+    struct tm *xtm = localtime( &unixtime );
+    time_t localtime;
+
+    localtime = timegm(xtm);
+    DOSFS_UnixTimeToFileTime( localtime, localft, remainder );
+
+#else
+    struct tm *xtm,*gtm;
+    time_t time1,time2;
+
     xtm = localtime( &unixtime );
-    DOSFS_UnixTimeToFileTime( mktime(xtm), localft, remainder );
+    gtm = gmtime( &unixtime );
+    time1 = mktime(xtm);
+    time2 = mktime(gtm);
+    DOSFS_UnixTimeToFileTime( 2*time1-time2, localft, remainder );
+#endif
     return TRUE; 
 }
 
@@ -1567,7 +1580,7 @@
     DWORD remainder;
     time_t xtime = DOSFS_FileTimeToUnixTime( ft, &remainder );
     xtm = gmtime(&xtime);
-    syst->wYear         = xtm->tm_year;
+    syst->wYear         = xtm->tm_year+1900;
     syst->wMonth        = xtm->tm_mon + 1;
     syst->wDayOfWeek    = xtm->tm_wday;
     syst->wDay	        = xtm->tm_mday;
@@ -1588,7 +1601,7 @@
     LPSTR s;
     char  buffer[200];
 
-    dprintf_info(dosfs,"QueryDosDevice(%s,...)\n",devname?devname:"<null>");
+    TRACE(dosfs,"(%s,...)\n",devname?devname:"<null>");
     if (!devname) {
 	/* return known MSDOS devices */
 	lstrcpy32A(buffer,"CON COM1 COM2 LPT1 NUL ");
@@ -1629,15 +1642,33 @@
  */
 BOOL32 WINAPI SystemTimeToFileTime( const SYSTEMTIME *syst, LPFILETIME ft )
 {
+#ifdef HAVE_TIMEGM
     struct tm xtm;
+    time_t utctime;
+#else
+    struct tm xtm,*local_tm,*utc_tm;
+    time_t localtim,utctime;
+#endif
 
-    xtm.tm_year	= syst->wYear;
+    xtm.tm_year	= syst->wYear-1900;
     xtm.tm_mon	= syst->wMonth - 1;
     xtm.tm_wday	= syst->wDayOfWeek;
     xtm.tm_mday	= syst->wDay;
     xtm.tm_hour	= syst->wHour;
     xtm.tm_min	= syst->wMinute;
-    xtm.tm_sec	= syst->wSecond;
-    DOSFS_UnixTimeToFileTime( mktime(&xtm), ft, syst->wMilliseconds * 10000 );
+    xtm.tm_sec	= syst->wSecond; /* this is UTC */
+    xtm.tm_isdst = -1;
+#ifdef HAVE_TIMEGM
+    utctime = timegm(&xtm);
+    DOSFS_UnixTimeToFileTime( utctime, ft, 
+			      syst->wMilliseconds * 10000 );
+#else
+    localtim = mktime(&xtm);    /* now we've got local time */
+    local_tm = localtime(&localtim);
+    utc_tm = gmtime(&localtim);
+    utctime = mktime(utc_tm);
+    DOSFS_UnixTimeToFileTime( 2*localtim -utctime, ft, 
+			      syst->wMilliseconds * 10000 );
+#endif
     return TRUE; 
 }