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/directory.c b/files/directory.c
index f740f3e..dafec96 100644
--- a/files/directory.c
+++ b/files/directory.c
@@ -18,7 +18,6 @@
 #include "heap.h"
 #include "msdos.h"
 #include "options.h"
-#include "stddebug.h"
 #include "debug.h"
 
 #define MAX_PATH_ELEMENTS 20
@@ -97,10 +96,10 @@
         DIR_PathElements++;
     }
 
-    if (debugging_dosfs)
+    if (debugging_info(dosfs))
         for (i = 0; i < DIR_PathElements; i++)
         {
-            dprintf_dosfs( stddeb, "Path[%d]: %s = %s\n",
+            dprintf_info(dosfs, "Path[%d]: %s = %s\n",
                            i, DIR_DosPath[i], DIR_UnixPath[i] );
         }
 }
@@ -156,9 +155,9 @@
                              path, sizeof(path) );
     DIR_ParseWindowsPath( path );
 
-    dprintf_dosfs( stddeb, "WindowsDir = %s\nSystemDir  = %s\n",
+    dprintf_info(dosfs, "WindowsDir = %s\nSystemDir  = %s\n",
                    DIR_WindowsDosDir, DIR_SystemDosDir );
-    dprintf_dosfs( stddeb, "TempDir    = %s\nCwd        = %c:\\%s\n",
+    dprintf_info(dosfs, "TempDir    = %s\nCwd        = %c:\\%s\n",
                    DIR_TempDosDir, 'A' + drive, DRIVE_GetDosCwd( drive ) );
 
     /* Put the temp and Windows and system directories into the environment */
@@ -328,7 +327,7 @@
  */
 BOOL16 WINAPI CreateDirectory16( LPCSTR path, LPVOID dummy )
 {
-    dprintf_file( stddeb,"CreateDirectory16(%s,%p)\n", path, dummy );
+    dprintf_info(file,"CreateDirectory16(%s,%p)\n", path, dummy );
     return (BOOL16)CreateDirectory32A( path, NULL );
 }
 
@@ -340,12 +339,11 @@
                                   LPSECURITY_ATTRIBUTES lpsecattribs )
 {
     DOS_FULL_NAME full_name;
-    LPCSTR unixName;
 
-    dprintf_file( stddeb, "CreateDirectory32A(%s,%p)\n", path, lpsecattribs );
-    if ((unixName = DOSFS_IsDevice( path )) != NULL)
+    dprintf_info(file, "CreateDirectory32A(%s,%p)\n", path, lpsecattribs );
+    if (DOSFS_IsDevice( path ))
     {
-        dprintf_file(stddeb, "CreateDirectory: device '%s'!\n", unixName);
+        dprintf_info(file, "CreateDirectory: cannot use device '%s'!\n",path);
         DOS_ERROR( ER_AccessDenied, EC_AccessDenied, SA_Abort, EL_Disk );
         return FALSE;
     }
@@ -407,13 +405,12 @@
 BOOL32 WINAPI RemoveDirectory32A( LPCSTR path )
 {
     DOS_FULL_NAME full_name;
-    LPCSTR unixName;
 
-    dprintf_file(stddeb, "RemoveDirectory: '%s'\n", path );
+    dprintf_info(file, "RemoveDirectory: '%s'\n", path );
 
-    if ((unixName = DOSFS_IsDevice( path )) != NULL)
+    if (DOSFS_IsDevice( path ))
     {
-        dprintf_file(stddeb, "RemoveDirectory: device '%s'!\n", unixName);
+        dprintf_info(file, "RemoveDirectory: cannot remove device '%s'!\n", path);
         DOS_ERROR( ER_FileNotFound, EC_NotFound, SA_Abort, EL_Disk );
         return FALSE;
     }
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;
diff --git a/files/drive.c b/files/drive.c
index cdb7d9c..35266cd 100644
--- a/files/drive.c
+++ b/files/drive.c
@@ -33,7 +33,6 @@
 #include "msdos.h"
 #include "options.h"
 #include "task.h"
-#include "stddebug.h"
 #include "debug.h"
 
 typedef struct
@@ -194,12 +193,12 @@
                 DRIVE_CurDrive = i;
 
             count++;
-            dprintf_dosfs( stddeb, "%s: path=%s type=%s label='%s' serial=%08lx flags=%08x dev=%x ino=%x\n",
+            dprintf_info(dosfs, "%s: path=%s type=%s label='%s' serial=%08lx flags=%08x dev=%x ino=%x\n",
                            name, path, DRIVE_Types[drive->type],
                            drive->label, drive->serial, drive->flags,
                            (int)drive->dev, (int)drive->ino );
         }
-        else dprintf_dosfs( stddeb, "%s: not defined\n", name );
+        else dprintf_warn(dosfs, "%s: not defined\n", name );
     }
 
     if (!count) 
@@ -266,7 +265,7 @@
         DOS_ERROR( ER_InvalidDrive, EC_MediaError, SA_Abort, EL_Disk );
         return 0;
     }
-    dprintf_dosfs( stddeb, "DRIVE_SetCurrentDrive: %c:\n", 'A' + drive );
+    dprintf_info(dosfs, "DRIVE_SetCurrentDrive: %c:\n", 'A' + drive );
     DRIVE_CurDrive = drive;
     if (pTask) pTask->curdrive = drive | 0x80;
     return 1;
@@ -326,7 +325,7 @@
     *next = 0;
 
     if (rootdrive != -1)
-        dprintf_dosfs( stddeb, "DRIVE_FindDriveRoot: %s -> drive %c:, root='%s', name='%s'\n",
+        dprintf_info(dosfs, "DRIVE_FindDriveRoot: %s -> drive %c:, root='%s', name='%s'\n",
                        buffer, 'A' + rootdrive,
                        DOSDrives[rootdrive].root, *path );
     return rootdrive;
@@ -447,7 +446,7 @@
     BY_HANDLE_FILE_INFORMATION info;
     TDB *pTask = (TDB *)GlobalLock16( GetCurrentTask() );
 
-    dprintf_dosfs( stddeb, "DRIVE_Chdir(%c:,%s)\n", 'A' + drive, path );
+    dprintf_info(dosfs, "DRIVE_Chdir(%c:,%s)\n", 'A' + drive, path );
     strcpy( buffer, "A:" );
     buffer[0] += drive;
     lstrcpyn32A( buffer + 2, path, sizeof(buffer) - 2 );
@@ -462,7 +461,7 @@
     unix_cwd = full_name.long_name + strlen( DOSDrives[drive].root );
     while (*unix_cwd == '/') unix_cwd++;
 
-    dprintf_dosfs( stddeb, "DRIVE_Chdir(%c:): unix_cwd=%s dos_cwd=%s\n",
+    dprintf_info(dosfs, "DRIVE_Chdir(%c:): unix_cwd=%s dos_cwd=%s\n",
                    'A' + drive, unix_cwd, full_name.short_name + 3 );
 
     HeapFree( SystemHeap, 0, DOSDrives[drive].dos_cwd );
@@ -535,7 +534,7 @@
 
     if ( new->root )
     {
-        dprintf_dosfs ( stddeb, "Can\'t map drive %c to drive %c - "
+        dprintf_info(dosfs, "Can\'t map drive %c to drive %c - "
 	                        "drive %c already exists\n",
 			'A' + existing_drive, 'A' + new_drive,
 			'A' + new_drive );
@@ -552,7 +551,7 @@
     new->dev = old->dev;
     new->ino = old->ino;
 
-    dprintf_dosfs ( stddeb, "Drive %c is now equal to drive %c\n",
+    dprintf_info(dosfs, "Drive %c is now equal to drive %c\n",
                     'A' + new_drive, 'A' + existing_drive );
 
     return 1;
@@ -566,7 +565,7 @@
  */
 int DRIVE_OpenDevice( int drive, int flags )
 {
-    if (!DRIVE_IsValid( drive )) return NULL;
+    if (!DRIVE_IsValid( drive )) return -1;
     return open( DOSDrives[drive].device, flags );
 }
 
@@ -735,7 +734,7 @@
  */
 UINT16 WINAPI GetDriveType16( UINT16 drive )
 {
-    dprintf_dosfs( stddeb, "GetDriveType16(%c:)\n", 'A' + drive );
+    dprintf_info(dosfs, "GetDriveType16(%c:)\n", 'A' + drive );
     switch(DRIVE_GetType(drive))
     {
     case TYPE_FLOPPY:  return DRIVE_REMOVABLE;
@@ -753,7 +752,7 @@
  */
 UINT32 WINAPI GetDriveType32A( LPCSTR root )
 {
-    dprintf_dosfs( stddeb, "GetDriveType32A(%s)\n", root );
+    dprintf_info(dosfs, "GetDriveType32A(%s)\n", root );
     if ((root[1]) && (root[1] != ':'))
     {
         fprintf( stderr, "GetDriveType32A: invalid root '%s'\n", root );
diff --git a/files/file.c b/files/file.c
index 29f9abf..e1de218 100644
--- a/files/file.c
+++ b/files/file.c
@@ -31,13 +31,16 @@
 #include "ldt.h"
 #include "process.h"
 #include "task.h"
-#include "stddebug.h"
 #include "debug.h"
 
 #if defined(MAP_ANONYMOUS) && !defined(MAP_ANON)
 #define MAP_ANON MAP_ANONYMOUS
 #endif
 
+static BOOL32 FILE_Read(K32OBJ *ptr, LPVOID lpBuffer, DWORD nNumberOfChars,
+			LPDWORD lpNumberOfChars, LPOVERLAPPED lpOverlapped);
+static BOOL32 FILE_Write(K32OBJ *ptr, LPCVOID lpBuffer, DWORD nNumberOfChars,
+			 LPDWORD lpNumberOfChars, LPOVERLAPPED lpOverlapped);
 static void FILE_Destroy( K32OBJ *obj );
 
 const K32OBJ_OPS FILE_Ops =
@@ -47,6 +50,8 @@
     NULL,              /* satisfied */
     NULL,              /* add_wait */
     NULL,              /* remove_wait */
+    FILE_Read,	        /* read */
+    FILE_Write,        /* write */
     FILE_Destroy       /* destroy */
 };
 
@@ -92,6 +97,70 @@
 }
 
 
+/* FIXME: lpOverlapped is ignored */
+static BOOL32 FILE_Read(K32OBJ *ptr, LPVOID lpBuffer, DWORD nNumberOfChars,
+			LPDWORD lpNumberOfChars, LPOVERLAPPED lpOverlapped)
+{
+	FILE_OBJECT *file = (FILE_OBJECT *)ptr;
+	int result;
+
+	dprintf_info(file, "FILE_Read: %p %p %ld\n", ptr, lpBuffer,
+                     nNumberOfChars);
+
+	if (nNumberOfChars == 0) {
+		*lpNumberOfChars = 0;  /* FIXME: does this change */
+		return TRUE;
+	}
+
+	if ((result = read(file->unix_handle, lpBuffer, nNumberOfChars)) == -1)
+        {
+            FILE_SetDosError();
+            return FALSE;
+	}
+	*lpNumberOfChars = result;
+	return TRUE;
+}
+
+/**
+ *  experimentation yields that WriteFile:
+ *	o does not truncate on write of 0
+ *	o always changes the *lpNumberOfChars to actual number of
+ *	  characters written
+ *	o write of 0 nNumberOfChars returns TRUE
+ */
+static BOOL32 FILE_Write(K32OBJ *ptr, LPCVOID lpBuffer, DWORD nNumberOfChars,
+			 LPDWORD lpNumberOfChars, LPOVERLAPPED lpOverlapped)
+{
+	FILE_OBJECT *file = (FILE_OBJECT *)ptr;
+	int result;
+
+	dprintf_info(file, "FILE_Write: %p %p %ld\n", ptr, lpBuffer,
+		      nNumberOfChars);
+
+	*lpNumberOfChars = 0; 
+
+	/* FIXME: there was a loop here before that 
+	 * retried writes after EAGAIN, why??? -- I assume
+	 * it is because win32 doesn't have interrupted
+	 * system calls 
+	 */
+
+	for (;;)
+        {
+		result = write(file->unix_handle, lpBuffer, nNumberOfChars);
+		if (result != -1) {
+			*lpNumberOfChars = result;
+                        return TRUE;
+		}
+		if (errno != EINTR) {
+			FILE_SetDosError();
+			return FALSE;
+		}
+        }
+}
+
+
+
 /***********************************************************************
  *           FILE_Destroy
  *
@@ -160,8 +229,7 @@
 {
     int save_errno = errno; /* errno gets overwritten by printf */
 
-    dprintf_file(stddeb, "FILE_SetDosError: errno = %d %s\n", errno,
-		 strerror(errno) );
+    dprintf_info(file, "FILE_SetDosError: errno = %d %s\n", errno, strerror(errno));
     switch (save_errno)
     {
     case EAGAIN:
@@ -235,7 +303,7 @@
 /***********************************************************************
  *           FILE_OpenUnixFile
  */
-static HFILE32 FILE_OpenUnixFile( const char *name, int mode )
+HFILE32 FILE_OpenUnixFile( const char *name, int mode )
 {
     HFILE32 handle;
     FILE_OBJECT *file;
@@ -277,19 +345,24 @@
     DOS_FULL_NAME full_name;
     const char *unixName;
 
-    dprintf_file(stddeb, "FILE_Open: '%s' %04x\n", path, mode );
+    dprintf_info(file, "FILE_Open: '%s' %04x\n", path, mode );
 
     if (!path) return HFILE_ERROR32;
 
-    if ((unixName = DOSFS_IsDevice( path )) != NULL)
+    if (DOSFS_IsDevice( path ))
     {
-        dprintf_file( stddeb, "FILE_Open: opening device '%s'\n", unixName );
-        if (!unixName[0])  /* Non-existing device */
-        {
-            dprintf_file(stddeb, "FILE_Open: Non-existing device\n");
-            DOS_ERROR( ER_FileNotFound, EC_NotFound, SA_Abort, EL_Disk );
-            return HFILE_ERROR32;
-        }
+    	HFILE32	ret;
+
+        dprintf_info(file, "FILE_Open: opening device '%s'\n", path );
+
+	if (HFILE_ERROR32!=(ret=DOSFS_OpenDevice( path, mode )))
+		return ret;
+
+	/* Do not silence this please. It is a critical error. -MM */
+        fprintf(stderr, "FILE_Open: Couldn't open device '%s'!\n",path);
+        DOS_ERROR( ER_FileNotFound, EC_NotFound, SA_Abort, EL_Disk );
+        return HFILE_ERROR32;
+	
     }
     else /* check for filename, don't check for last entry if creating */
     {
@@ -308,16 +381,15 @@
 {
     HFILE32 handle;
     FILE_OBJECT *file;
-    const char *unixName;
     DOS_FULL_NAME full_name;
 
-    dprintf_file(stddeb, "FILE_Create: '%s' %04x %d\n", path, mode, unique );
+    dprintf_info(file, "FILE_Create: '%s' %04x %d\n", path, mode, unique );
 
     if (!path) return INVALID_HANDLE_VALUE32;
 
-    if ((unixName = DOSFS_IsDevice( path )) != NULL)
+    if (DOSFS_IsDevice( path ))
     {
-        dprintf_file(stddeb, "FILE_Create: creating device '%s'!\n", unixName);
+        fprintf(stderr, "FILE_Create: cannot create DOS device '%s'!\n", path);
         DOS_ERROR( ER_AccessDenied, EC_NotFound, SA_Abort, EL_Disk );
         return INVALID_HANDLE_VALUE32;
     }
@@ -510,11 +582,11 @@
     FILE_OBJECT *file;
     HFILE32 handle;
 
-    dprintf_file( stddeb, "FILE_Dup for handle %d\n", hFile );
+    dprintf_info(file, "FILE_Dup for handle %d\n", hFile );
     if (!(file = FILE_GetFile( hFile ))) return HFILE_ERROR32;
     handle = HANDLE_Alloc( &file->header, FILE_ALL_ACCESS /*FIXME*/, FALSE );
     FILE_ReleaseFile( file );
-    dprintf_file( stddeb, "FILE_Dup return handle %d\n", handle );
+    dprintf_info(file, "FILE_Dup return handle %d\n", handle );
     return handle;
 }
 
@@ -528,7 +600,7 @@
 {
     FILE_OBJECT *file;
 
-    dprintf_file( stddeb, "FILE_Dup2 for handle %d\n", hFile1 );
+    dprintf_info(file, "FILE_Dup2 for handle %d\n", hFile1 );
     /* FIXME: should use DuplicateHandle */
     if (!(file = FILE_GetFile( hFile1 ))) return HFILE_ERROR32;
     if (!HANDLE_SetObjPtr( hFile2, &file->header, 0 )) hFile2 = HFILE_ERROR32;
@@ -600,7 +672,7 @@
             HFILE32 handle = FILE_Create( buffer, 0666, TRUE );
             if (handle != INVALID_HANDLE_VALUE32)
             {  /* We created it */
-                dprintf_file( stddeb, "GetTempFileName32A: created %s\n",
+                dprintf_info(file, "GetTempFileName32A: created %s\n",
 			      buffer);
                 CloseHandle( handle );
                 break;
@@ -624,7 +696,7 @@
                      "Please check your configuration file if this generates a failure.\n",
                      buffer);
     }
-    dprintf_file( stddeb, "GetTempFileName32A: returning %s\n", buffer );
+    dprintf_info(file, "GetTempFileName32A: returning %s\n", buffer );
     return unique ? unique : num;
 }
 
@@ -678,7 +750,7 @@
 	return HFILE_ERROR32;
     }
 
-    dprintf_file( stddeb, "OpenFile: %s %04x\n", name, mode );
+    dprintf_info(file, "OpenFile: %s %04x\n", name, mode );
 
     /* the watcom 10.6 IDE relies on a valid path returned in ofs->szPathName
        Are there any cases where getting the path here is wrong? 
@@ -692,7 +764,7 @@
     {
         ofs->fFixedDisk = (GetDriveType16( ofs->szPathName[0]-'A' )
                            != DRIVE_REMOVABLE);
-        dprintf_file( stddeb, "OpenFile(%s): OF_PARSE, res = '%s'\n",
+        dprintf_info(file, "OpenFile(%s): OF_PARSE, res = '%s'\n",
                       name, ofs->szPathName );
         return 0;
     }
@@ -725,7 +797,7 @@
     if (!DIR_SearchPath( NULL, name, NULL, &full_name, win32 )) goto not_found;
 
 found:
-    dprintf_file( stddeb, "OpenFile: found %s = %s\n",
+    dprintf_info(file, "OpenFile: found %s = %s\n",
                   full_name.long_name, full_name.short_name );
     lstrcpyn32A( ofs->szPathName, full_name.short_name,
                  sizeof(ofs->szPathName) );
@@ -733,7 +805,7 @@
     if (mode & OF_DELETE)
     {
         if (unlink( full_name.long_name ) == -1) goto not_found;
-        dprintf_file( stddeb, "OpenFile(%s): OF_DELETE return = OK\n", name);
+        dprintf_info(file, "OpenFile(%s): OF_DELETE return = OK\n", name);
         return 1;
     }
 
@@ -757,7 +829,7 @@
         if (memcmp( ofs->reserved, filedatetime, sizeof(ofs->reserved) ))
         {
             CloseHandle( hFileRet );
-            dprintf_file( stddeb, "OpenFile(%s): OF_VERIFY failed\n", name );
+            dprintf_warn(file, "OpenFile(%s): OF_VERIFY failed\n", name );
             /* FIXME: what error here? */
             DOS_ERROR( ER_FileNotFound, EC_NotFound, SA_Abort, EL_Disk );
             goto error;
@@ -766,19 +838,19 @@
     memcpy( ofs->reserved, filedatetime, sizeof(ofs->reserved) );
 
 success:  /* We get here if the open was successful */
-    dprintf_file( stddeb, "OpenFile(%s): OK, return = %d\n", name, hFileRet );
+    dprintf_info(file, "OpenFile(%s): OK, return = %d\n", name, hFileRet );
     if (mode & OF_EXIST) /* Return the handle, but close it first */
         CloseHandle( hFileRet );
     return hFileRet;
 
 not_found:  /* We get here if the file does not exist */
-    dprintf_file( stddeb, "OpenFile: '%s' not found\n", name );
+    dprintf_warn(file, "OpenFile: '%s' not found\n", name );
     DOS_ERROR( ER_FileNotFound, EC_NotFound, SA_Abort, EL_Disk );
     /* fall through */
 
 error:  /* We get here if there was an error opening the file */
     ofs->nErrCode = DOS_ExtendedError;
-    dprintf_file( stddeb, "OpenFile(%s): return = HFILE_ERROR error= %d\n", 
+    dprintf_warn(file, "OpenFile(%s): return = HFILE_ERROR error= %d\n", 
 		  name,ofs->nErrCode );
     return HFILE_ERROR32;
 }
@@ -807,7 +879,7 @@
  */
 HFILE16 WINAPI _lclose16( HFILE16 hFile )
 {
-    dprintf_file( stddeb, "_lclose16: handle %d\n", hFile );
+    dprintf_info(file, "_lclose16: handle %d\n", hFile );
     return CloseHandle( hFile ) ? 0 : HFILE_ERROR16;
 }
 
@@ -817,7 +889,7 @@
  */
 HFILE32 WINAPI _lclose32( HFILE32 hFile )
 {
-    dprintf_file( stddeb, "_lclose32: handle %d\n", hFile );
+    dprintf_info(file, "_lclose32: handle %d\n", hFile );
     return CloseHandle( hFile ) ? 0 : HFILE_ERROR32;
 }
 
@@ -829,7 +901,7 @@
 {
     LONG maxlen;
 
-    dprintf_file( stddeb, "WIN16_hread: %d %08lx %ld\n",
+    dprintf_info(file, "WIN16_hread: %d %08lx %ld\n",
                   hFile, (DWORD)buffer, count );
 
     /* Some programs pass a count larger than the allocated buffer */
@@ -851,18 +923,19 @@
 /***********************************************************************
  *           _lread32   (KERNEL32.596)
  */
-UINT32 WINAPI _lread32( HFILE32 hFile, LPVOID buffer, UINT32 count )
+UINT32 WINAPI _lread32( HFILE32 handle, LPVOID buffer, UINT32 count )
 {
-    FILE_OBJECT *file;
-    UINT32 result;
+    K32OBJ *ptr;
+    DWORD numWritten;
+    BOOL32 result = FALSE;
 
-    dprintf_file( stddeb, "_lread32: %d %p %d\n", hFile, buffer, count );
-    if (!(file = FILE_GetFile( hFile ))) return -1;
-    if (!count) result = 0;
-    else if ((result = read( file->unix_handle, buffer, count )) == -1)
-        FILE_SetDosError();
-    FILE_ReleaseFile( file );
-    return result;
+    dprintf_info( file, "_lread32: %d %p %d\n", handle, buffer, count);
+    if (!(ptr = HANDLE_GetObjPtr( handle, K32OBJ_UNKNOWN, 0))) return -1;
+    if (K32OBJ_OPS(ptr)->read)
+        result = K32OBJ_OPS(ptr)->read(ptr, buffer, count, &numWritten, NULL);
+    K32OBJ_DecCount( ptr );
+    if (!result) return -1;
+    return (UINT32)numWritten;
 }
 
 
@@ -881,7 +954,7 @@
 HFILE16 WINAPI _lcreat16( LPCSTR path, INT16 attr )
 {
     int mode = (attr & 1) ? 0444 : 0666;
-    dprintf_file( stddeb, "_lcreat16: %s %02x\n", path, attr );
+    dprintf_info(file, "_lcreat16: %s %02x\n", path, attr );
     return (HFILE16)FILE_Create( path, mode, FALSE );
 }
 
@@ -892,7 +965,7 @@
 HFILE32 WINAPI _lcreat32( LPCSTR path, INT32 attr )
 {
     int mode = (attr & 1) ? 0444 : 0666;
-    dprintf_file( stddeb, "_lcreat32: %s %02x\n", path, attr );
+    dprintf_info(file, "_lcreat32: %s %02x\n", path, attr );
     return FILE_Create( path, mode, FALSE );
 }
 
@@ -903,7 +976,7 @@
 HFILE32 _lcreat_uniq( LPCSTR path, INT32 attr )
 {
     int mode = (attr & 1) ? 0444 : 0666;
-    dprintf_file( stddeb, "_lcreat_uniq: %s %02x\n", path, attr );
+    dprintf_info(file, "_lcreat_uniq: %s %02x\n", path, attr );
     return FILE_Create( path, mode, TRUE );
 }
 
@@ -923,7 +996,7 @@
         SetLastError( ERROR_INVALID_PARAMETER );
         return 0xffffffff;
     }
-    dprintf_file( stddeb, "SetFilePointer: handle %d offset %ld origin %ld\n",
+    dprintf_info(file, "SetFilePointer: handle %d offset %ld origin %ld\n",
                   hFile, distance, method );
 
     if (!(file = FILE_GetFile( hFile ))) return 0xffffffff;
@@ -975,7 +1048,7 @@
 {
     INT32 unixMode;
 
-    dprintf_file(stddeb, "_lopen32('%s',%04x)\n", path, mode );
+    dprintf_info(file, "_lopen32('%s',%04x)\n", path, mode );
 
     switch(mode & 3)
     {
@@ -1040,31 +1113,43 @@
 
 /***********************************************************************
  *           _hwrite32   (KERNEL32.591)
+ *
+ *	experimenation yields that _lwrite:
+ *		o truncates the file at the current position with 
+ *		  a 0 len write
+ *		o returns 0 on a 0 length write
+ *		o works with console handles
+ *		
  */
-LONG WINAPI _hwrite32( HFILE32 hFile, LPCSTR buffer, LONG count )
+LONG WINAPI _hwrite32( HFILE32 handle, LPCSTR buffer, LONG count )
 {
-    FILE_OBJECT *file;
-    LONG result;
+	K32OBJ *ioptr;
+	DWORD result;
+	BOOL32 status = FALSE;
+	
+	dprintf_info(file, "_hwrite32: %d %p %ld\n", handle, buffer, count );
 
-    dprintf_file( stddeb, "_hwrite32: %d %p %ld\n", hFile, buffer, count );
+	if (count == 0) {       /* Expand or truncate at current position */
+		FILE_OBJECT *file = FILE_GetFile(handle);
 
-    if (!(file = FILE_GetFile( hFile ))) return HFILE_ERROR32;
-    if (count == 0)  /* Expand or truncate at current position */
-        result = ftruncate( file->unix_handle,
-                            lseek( file->unix_handle, 0, SEEK_CUR ) );
-    else for (;;)
-    {
-        result = write( file->unix_handle, buffer, count );
-        if (result != -1) break;
-        if (errno != EINTR)
-        {
-            FILE_SetDosError();
-            break;
-        }
-    }
-
-    FILE_ReleaseFile( file );
-    return result;
+		if ( ftruncate(file->unix_handle,
+			       lseek( file->unix_handle, 0, SEEK_CUR)) == 0 ) {
+			FILE_ReleaseFile(file);
+			return 0;
+		} else {
+			FILE_SetDosError();
+			FILE_ReleaseFile(file);
+			return HFILE_ERROR32;
+		}
+	}
+	
+	if (!(ioptr = HANDLE_GetObjPtr( handle, K32OBJ_UNKNOWN, 0 )))
+            return HFILE_ERROR32;
+        if (K32OBJ_OPS(ioptr)->write)
+            status = K32OBJ_OPS(ioptr)->write(ioptr, buffer, count, &result, NULL);
+	K32OBJ_DecCount( ioptr );
+	if (!status) result = HFILE_ERROR32;
+	return result;
 }
 
 
@@ -1077,7 +1162,7 @@
     PDB *pdb = (PDB *)GlobalLock16( hPDB );
     BYTE *files = PTR_SEG_TO_LIN( pdb->fileHandlesPtr );
 
-    dprintf_file( stddeb, "SetHandleCount16(%d)\n", count );
+    dprintf_info(file, "SetHandleCount16(%d)\n", count );
 
     if (count < 20) count = 20;  /* No point in going below 20 */
     else if (count > 254) count = 254;
@@ -1137,7 +1222,7 @@
     FILE_OBJECT *file;
     BOOL32 ret;
 
-    dprintf_file( stddeb, "FlushFileBuffers(%d)\n", hFile );
+    dprintf_info(file, "FlushFileBuffers(%d)\n", hFile );
     if (!(file = FILE_GetFile( hFile ))) return FALSE;
     if (fsync( file->unix_handle ) != -1) ret = TRUE;
     else
@@ -1158,7 +1243,7 @@
     FILE_OBJECT *file;
     BOOL32 ret = TRUE;
 
-    dprintf_file( stddeb, "SetEndOfFile(%d)\n", hFile );
+    dprintf_info(file, "SetEndOfFile(%d)\n", hFile );
     if (!(file = FILE_GetFile( hFile ))) return FALSE;
     if (ftruncate( file->unix_handle,
                    lseek( file->unix_handle, 0, SEEK_CUR ) ))
@@ -1186,13 +1271,12 @@
 BOOL32 WINAPI DeleteFile32A( LPCSTR path )
 {
     DOS_FULL_NAME full_name;
-    const char *unixName;
 
-    dprintf_file(stddeb, "DeleteFile: '%s'\n", path );
+    dprintf_info(file, "DeleteFile: '%s'\n", path );
 
-    if ((unixName = DOSFS_IsDevice( path )) != NULL)
+    if (DOSFS_IsDevice( path ))
     {
-        dprintf_file(stddeb, "DeleteFile: removing device '%s'!\n", unixName);
+        fprintf(stderr, "DeleteFile: cannot remove DOS device '%s'!\n", path);
         DOS_ERROR( ER_FileNotFound, EC_NotFound, SA_Abort, EL_Disk );
         return FALSE;
     }
@@ -1361,7 +1445,7 @@
     DOS_FULL_NAME full_name1, full_name2;
     int mode=0; /* mode == 1: use copy */
 
-    dprintf_file( stddeb, "MoveFileEx32A(%s,%s,%04lx)\n", fn1, fn2, flag);
+    dprintf_info(file, "MoveFileEx32A(%s,%s,%04lx)\n", fn1, fn2, flag);
 
     if (!DOSFS_GetFullName( fn1, TRUE, &full_name1 )) return FALSE;
     if (fn2) { /* !fn2 means delete fn1 */
@@ -1461,7 +1545,7 @@
     DOS_FULL_NAME full_name1, full_name2;
     struct stat fstat;
 
-    dprintf_file( stddeb, "MoveFile32A(%s,%s)\n", fn1, fn2 );
+    dprintf_info(file, "MoveFile32A(%s,%s)\n", fn1, fn2 );
 
     if (!DOSFS_GetFullName( fn1, TRUE, &full_name1 )) return FALSE;
     if (DOSFS_GetFullName( fn2, TRUE, &full_name2 )) 
@@ -1479,7 +1563,7 @@
     else /*copy */ {
       if (stat(  full_name1.long_name, &fstat ))
 	{
-	  dprintf_file( stddeb, "Invalid source file %s\n",
+	  dprintf_warn(file, "Invalid source file %s\n",
 			full_name1.long_name);
 	  FILE_SetDosError();
 	  return FALSE;
@@ -1580,7 +1664,7 @@
     struct utimbuf utimbuf;
     
     if (!file) return FILE_TYPE_UNKNOWN; /* FIXME: correct? */
-    dprintf_file(stddeb,"SetFileTime(%s,%p,%p,%p)\n",
+    dprintf_info(file,"SetFileTime(%s,%p,%p,%p)\n",
 	file->unix_name,
 	lpCreationTime,
 	lpLastAccessTime,
@@ -1697,12 +1781,12 @@
   struct flock f;
   FILE_OBJECT *file;
 
-  dprintf_file(stddeb, "LockFile32: handle %d offsetlow=%ld offsethigh=%ld nbyteslow=%ld nbyteshigh=%ld\n",
+  dprintf_info(file, "LockFile32: handle %d offsetlow=%ld offsethigh=%ld nbyteslow=%ld nbyteshigh=%ld\n",
 	       hFile, dwFileOffsetLow, dwFileOffsetHigh,
 	       nNumberOfBytesToLockLow, nNumberOfBytesToLockHigh);
 
   if (dwFileOffsetHigh || nNumberOfBytesToLockHigh) {
-    dprintf_file(stddeb, "LockFile32: Unimplemented bytes > 32bits\n");
+    dprintf_fixme(file, "LockFile32: Unimplemented bytes > 32bits\n");
     return FALSE;
   }
 
@@ -1748,12 +1832,12 @@
   FILE_OBJECT *file;
   struct flock f;
 
-  dprintf_file(stddeb, "UnlockFile32: handle %d offsetlow=%ld offsethigh=%ld nbyteslow=%ld nbyteshigh=%ld\n",
+  dprintf_info(file, "UnlockFile32: handle %d offsetlow=%ld offsethigh=%ld nbyteslow=%ld nbyteshigh=%ld\n",
 	       hFile, dwFileOffsetLow, dwFileOffsetHigh,
 	       nNumberOfBytesToUnlockLow, nNumberOfBytesToUnlockHigh);
 
   if (dwFileOffsetHigh || nNumberOfBytesToUnlockHigh) {
-    dprintf_file(stddeb, "UnlockFile32: Unimplemented bytes > 32bits\n");
+    dprintf_warn(file, "UnlockFile32: Unimplemented bytes > 32bits\n");
     return FALSE;
   }
 
diff --git a/files/profile.c b/files/profile.c
index 545049d..2b6f7eb 100644
--- a/files/profile.c
+++ b/files/profile.c
@@ -13,7 +13,6 @@
 #include "windows.h"
 #include "file.h"
 #include "heap.h"
-#include "stddebug.h"
 #include "debug.h"
 
 typedef struct tagPROFILEKEY
@@ -216,11 +215,12 @@
         *prev_key  = key;
         prev_key = &key->next;
     }
-    if (debugging_profile)
+    if (debugging_info(profile))
     {
-        fprintf( stddeb, "PROFILE_Load:\n" );
-        PROFILE_Save( stddeb, first_section );
-        fprintf( stddeb, "PROFILE_Load finished.\n" );
+        dprintf_info(profile, "PROFILE_Load:\n" );
+	/* FIXME: improper use of stddeb! */
+        PROFILE_Save(stddeb, first_section );
+        dprintf_info(profile, "PROFILE_Load finished.\n" );
     }
     return first_section;
 }
@@ -357,7 +357,7 @@
         return FALSE;
     }
 
-    dprintf_profile( stddeb, "Saving '%s' into '%s'\n",
+    dprintf_info(profile, "Saving '%s' into '%s'\n",
                      CurProfile.dos_name, unix_name );
     PROFILE_Save( file, CurProfile.section );
     fclose( file );
@@ -380,7 +380,7 @@
 
     if (CurProfile.filename && !strcmp( filename, CurProfile.filename ))
     {
-        dprintf_profile( stddeb, "PROFILE_Open(%s): already opened\n",
+        dprintf_info(profile, "PROFILE_Open(%s): already opened\n",
                          filename );
         return TRUE;
     }
@@ -400,7 +400,7 @@
     if (CurProfile.dos_name &&
         !strcmp( full_name.short_name, CurProfile.dos_name ))
     {
-        dprintf_profile( stddeb, "PROFILE_Open(%s): already opened\n",
+        dprintf_info(profile, "PROFILE_Open(%s): already opened\n",
                          filename );
         return TRUE;
     }
@@ -429,7 +429,7 @@
         CharLower32A( p );
         if ((file = fopen( buffer, "r" )))
         {
-            dprintf_profile( stddeb, "PROFILE_Open(%s): found it in %s\n",
+            dprintf_info(profile, "PROFILE_Open(%s): found it in %s\n",
                              filename, buffer );
             CurProfile.unix_name = HEAP_strdupA( SystemHeap, 0, buffer );
         }
@@ -440,7 +440,7 @@
         CurProfile.unix_name = HEAP_strdupA( SystemHeap, 0,
                                              full_name.long_name );
         if ((file = fopen( full_name.long_name, "r" )))
-            dprintf_profile( stddeb, "PROFILE_Open(%s): found it in %s\n",
+            dprintf_info(profile, "PROFILE_Open(%s): found it in %s\n",
                              filename, full_name.long_name );
     }
 
@@ -506,7 +506,7 @@
         key = PROFILE_Find( &CurProfile.section, section, key_name, FALSE );
         PROFILE_CopyEntry( buffer, (key && key->value) ? key->value : def_val,
                            len, FALSE );
-        dprintf_profile( stddeb, "PROFILE_GetString('%s','%s','%s'): returning '%s'\n",
+        dprintf_info(profile, "PROFILE_GetString('%s','%s','%s'): returning '%s'\n",
                          section, key_name, def_val, buffer );
         return strlen( buffer );
     }
@@ -524,7 +524,7 @@
 {
     if (!key_name)  /* Delete a whole section */
     {
-        dprintf_profile(stddeb, "PROFILE_DeleteSection('%s')\n", section_name);
+        dprintf_info(profile, "PROFILE_DeleteSection('%s')\n", section_name);
         CurProfile.changed |= PROFILE_DeleteSection( &CurProfile.section,
                                                      section_name );
         return TRUE;         /* Even if PROFILE_DeleteSection() has failed,
@@ -532,7 +532,7 @@
     }
     else if (!value)  /* Delete a key */
     {
-        dprintf_profile( stddeb, "PROFILE_DeleteKey('%s','%s')\n",
+        dprintf_info(profile, "PROFILE_DeleteKey('%s','%s')\n",
                          section_name, key_name );
         CurProfile.changed |= PROFILE_DeleteKey( &CurProfile.section,
                                                  section_name, key_name );
@@ -542,20 +542,20 @@
     {
         PROFILEKEY *key = PROFILE_Find( &CurProfile.section, section_name,
                                         key_name, TRUE );
-        dprintf_profile( stddeb, "PROFILE_SetString('%s','%s','%s'): ",
+        dprintf_info(profile, "PROFILE_SetString('%s','%s','%s'): \n",
                          section_name, key_name, value );
         if (!key) return FALSE;
         if (key->value)
         {
             if (!strcmp( key->value, value ))
             {
-                dprintf_profile( stddeb, "no change needed\n" );
+                dprintf_info(profile, "  no change needed\n" );
                 return TRUE;  /* No change needed */
             }
-            dprintf_profile( stddeb, "replacing '%s'\n", key->value );
+            dprintf_info(profile, "  replacing '%s'\n", key->value );
             HeapFree( SystemHeap, 0, key->value );
         }
-        else dprintf_profile( stddeb, "creating key\n" );
+        else dprintf_info(profile, "  creating key\n" );
         key->value = HEAP_strdupA( SystemHeap, 0, value );
         CurProfile.changed = TRUE;
     }
@@ -576,7 +576,7 @@
         PROFILEKEY *key = PROFILE_Find(&WineProfile, section, key_name, FALSE);
         PROFILE_CopyEntry( buffer, (key && key->value) ? key->value : def,
                            len, TRUE );
-        dprintf_profile( stddeb, "PROFILE_GetWineIniString('%s','%s','%s'): returning '%s'\n",
+        dprintf_info(profile, "PROFILE_GetWineIniString('%s','%s','%s'): returning '%s'\n",
                          section, key_name, def, buffer );
         return strlen( buffer );
     }
@@ -707,7 +707,7 @@
 	retval = def;
     }
 
-    dprintf_profile(stddeb, "PROFILE_GetWineIniBool(\"%s\", \"%s\", %s), "
+    dprintf_info(profile, "PROFILE_GetWineIniBool(\"%s\", \"%s\", %s), "
 		    "[%c], ret %s.\n", section, key_name,
 		    def ? "TRUE" : "FALSE", key_value[0],
 		    retval ? "TRUE" : "FALSE");
@@ -1031,11 +1031,11 @@
 {
     char *p =(char*)string;
 
-    fprintf( stdnimp,"WritePrivateProfileSection32A empty stup\n");
-    if (debugging_profile) {
-      fprintf(stddeb,"file(%s) => [%s]\n", filename,section);
+    dprintf_fixme(profile, "WritePrivateProfileSection32A empty stup\n");
+    if (debugging_info(profile)) {
+      dprintf_info(profile, "file(%s) => [%s]\n", filename, section);
       while (*(p+1)) {
-	fprintf(stddeb,"%s\n",p);
+	dprintf_info(profile, "%s\n", p);
         p += strlen(p);
 	p += 1;
       }