Index: trunk/src/kernel32/lfile.cpp
===================================================================
--- trunk/src/kernel32/lfile.cpp	(revision 63)
+++ trunk/src/kernel32/lfile.cpp	(revision 64)
@@ -9,7 +9,9 @@
  * 1998/06/12 PH Patrick Haller (haller@zebra.fh-weingarten.de)
  *
- * @(#) LFILE.C         1.0.0	1998/06/12 PH added HandleManager support
+ * @(#) LFILE.C         1.0.0 1998/06/12 PH  added HandleManager support
  *                      1.1.0 1998/08/29 KSO corrected error codes and forwarded
- *                                       to Win32 file api as NT/95 does.
+ *                                           to Win32 file api as NT/95 does.
+ *                      1.1.1 1999/06/09 PH  NOTE: only forard to KERNEL32:FILEIO
+ *                                           calls, never do anything else !
  */
 
@@ -36,10 +38,11 @@
 HFILE WIN32API _lclose(HFILE arg1)
 {
-	dprintf(("KERNEL32: _lclose(%08xh)\n",
-				arg1));
-	if (CloseHandle(arg1))
-		return 0;
-	else
-		return -1;
+   dprintf(("KERNEL32: _lclose(%08xh)\n",
+            arg1));
+
+   if (CloseHandle(arg1))
+      return 0;
+   else
+      return -1;
 }
 
@@ -58,24 +61,27 @@
 
 HFILE WIN32API _lcreat(LPCSTR arg1,
-								  int    arg2)
-{
-	HANDLE hFile;
-	dprintf(("KERNEL32: _lcreat(%s, %08xh)\n",
-				arg1,
-				arg2));
-
-	//if (arg2 & ~(1 | 2 | 4))
-	//   dprintf(("KERNEL32: Warning: _lcreat has unknown flag(s) set - fails.\n"));
-
-	//SetLastError(0); - CreateFileA sets error
-	hFile = CreateFileA(arg1,										 /* filename */
-								  GENERIC_READ | GENERIC_WRITE,		 /* readwrite access */
-								  FILE_SHARE_READ | FILE_SHARE_WRITE,/* share all */
-								  NULL,										 /* ignore scurity */
-								  CREATE_ALWAYS,							 /* create (trunkate don't work) */
-								  arg2 & 0x3fb7,							 /* so M$ does (that is more attributes than I could find in the headers and in the docs!) */
-								  NULL);										 /* no template */
-	dprintf(("KERNEL32: _lcreat returns %d.\n", hFile));
-	return hFile;
+                       int    arg2)
+{
+   HANDLE hFile;
+
+   dprintf(("KERNEL32: _lcreat(%s, %08xh)\n",
+            arg1,
+            arg2));
+
+   //if (arg2 & ~(1 | 2 | 4))
+   //   dprintf(("KERNEL32: Warning: _lcreat has unknown flag(s) set - fails.\n"));
+
+   //SetLastError(0); - CreateFileA sets error
+   hFile = CreateFileA(arg1,                              /* filename */
+                       GENERIC_READ | GENERIC_WRITE,      /* readwrite access */
+                       FILE_SHARE_READ | FILE_SHARE_WRITE,/* share all */
+                       NULL,                              /* ignore scurity */
+                       CREATE_ALWAYS,                     /* create (trunkate don't work) */
+                       arg2 & 0x3fb7,                     /* so M$ does (that is more attributes than I could find in the headers and in the docs!) */
+                       NULL);                             /* no template */
+
+   dprintf(("KERNEL32: _lcreat returns %08xh.\n",
+            hFile));
+   return hFile;
 }
 
@@ -94,50 +100,52 @@
 
 HFILE WIN32API _lopen(LPCSTR pszFileName,
-								 int    arg2)
-{
-	ULONG  ulAccess = 0;
-	ULONG  ulShare;
-	HANDLE hFile;
-
-	dprintf(("KERNEL32: _lopen(%s, %08xh)\n",
-				pszFileName,
-				arg2));
-
-	if (arg2 & ~(OF_READ|OF_READWRITE|OF_WRITE|OF_SHARE_COMPAT|OF_SHARE_DENY_NONE|OF_SHARE_DENY_READ|OF_SHARE_DENY_WRITE|OF_SHARE_EXCLUSIVE))
-		dprintf(("KERNEL32: (warn) _lopen has unknown flag(s) set.\n"));
-
-	/* Access */
-	ulAccess |= arg2 & OF_READ      ? GENERIC_READ                 : 0;
-	ulAccess |= arg2 & OF_WRITE     ? GENERIC_WRITE                : 0;
-	ulAccess |= arg2 & OF_READWRITE ? GENERIC_READ | GENERIC_WRITE : 0;
-
-	/* Share */
-	ulShare = arg2 & (OF_SHARE_COMPAT | OF_SHARE_DENY_NONE | OF_SHARE_DENY_READ | OF_SHARE_DENY_WRITE | OF_SHARE_EXCLUSIVE);
-	if (ulShare == OF_SHARE_DENY_READ)
-		ulShare = FILE_SHARE_WRITE;
-	else if (ulShare == OF_SHARE_DENY_WRITE)
-		ulShare = FILE_SHARE_READ;
-	else if (ulShare == OF_SHARE_DENY_NONE)
-		ulShare = FILE_SHARE_READ | FILE_SHARE_WRITE;
-	else if (ulShare == OF_SHARE_EXCLUSIVE)
-		ulShare = 0; //no share
-	else if (ulShare == OF_SHARE_COMPAT)
-		ulShare = FILE_SHARE_READ | FILE_SHARE_WRITE;
-	else
-	{
-		dprintf(("KERNEL32: _lopen - warning incorrect value for arg2 (or incorrect implementation...)\n"));
-		ulShare = 0;
-	}
-
-	hFile = CreateFileA(pszFileName,				  /* filename */
-								  ulAccess,					  /*  */
-								  ulShare,					  /*  */
-								  NULL,						  /* ignore scurity */
-								  OPEN_EXISTING,			  /* create a _new_ file - fail if exists */
-								  FILE_ATTRIBUTE_NORMAL,  /* normal attribs - no flags */ //m$ sets this to 0
-								  NULL);						  /* no template */
-
-	dprintf(("KERNEL32: _lopen returns %d.\n", hFile));
-	return hFile;
+                      int    arg2)
+{
+   ULONG  ulAccess = 0;
+   ULONG  ulShare;
+   HANDLE hFile;
+
+   dprintf(("KERNEL32: _lopen(%s, %08xh)\n",
+            pszFileName,
+            arg2));
+
+   if (arg2 & ~(OF_READ|OF_READWRITE|OF_WRITE|OF_SHARE_COMPAT|OF_SHARE_DENY_NONE|OF_SHARE_DENY_READ|OF_SHARE_DENY_WRITE|OF_SHARE_EXCLUSIVE))
+      dprintf(("KERNEL32: (warn) _lopen has unknown flag(s) set.\n"));
+
+   /* Access */
+   ulAccess |= arg2 & OF_READ      ? GENERIC_READ                 : 0;
+   ulAccess |= arg2 & OF_WRITE     ? GENERIC_WRITE                : 0;
+   ulAccess |= arg2 & OF_READWRITE ? GENERIC_READ | GENERIC_WRITE : 0;
+
+   /* Share */
+   ulShare = arg2 & (OF_SHARE_COMPAT | OF_SHARE_DENY_NONE | OF_SHARE_DENY_READ | OF_SHARE_DENY_WRITE | OF_SHARE_EXCLUSIVE);
+   if (ulShare == OF_SHARE_DENY_READ)
+      ulShare = FILE_SHARE_WRITE;
+   else if (ulShare == OF_SHARE_DENY_WRITE)
+      ulShare = FILE_SHARE_READ;
+   else if (ulShare == OF_SHARE_DENY_NONE)
+      ulShare = FILE_SHARE_READ | FILE_SHARE_WRITE;
+   else if (ulShare == OF_SHARE_EXCLUSIVE)
+      ulShare = 0; //no share
+   else if (ulShare == OF_SHARE_COMPAT)
+      ulShare = FILE_SHARE_READ | FILE_SHARE_WRITE;
+   else
+   {
+      dprintf(("KERNEL32: _lopen - warning incorrect value for arg2 (or incorrect implementation...)\n"));
+      ulShare = 0;
+   }
+
+   hFile = CreateFileA(pszFileName,                 /* filename */
+                       ulAccess,               /*  */
+                       ulShare,                /*  */
+                       NULL,                   /* ignore scurity */
+                       OPEN_EXISTING,          /* open existing file, fail if new */
+                       FILE_ATTRIBUTE_NORMAL,  /* normal attribs - no flags */ //m$ sets this to 0
+                       NULL);                  /* no template */
+
+   dprintf(("KERNEL32: _lopen returns %08xh.\n",
+            hFile));
+
+   return hFile;
 }
 
@@ -156,19 +164,25 @@
 
 UINT WIN32API _lread(HFILE arg1,
-								PVOID arg2,
-								UINT  arg3)
-{
-	ULONG rc;
-
-	dprintf(("KERNEL32: _lread(%08xh, %08xh, %08xh)\n",
-				arg1,
-				arg2,
-				arg3));
-
-	if (!ReadFile(arg1, arg2, arg3, &rc, NULL))
-		rc = -1;
-	dprintf(("KERNEL32: _lread returns %d.", rc));
-
-	return rc;
+                     PVOID arg2,
+                     UINT  arg3)
+{
+   ULONG rc;
+
+   dprintf(("KERNEL32: _lread(%08xh, %08xh, %08xh)\n",
+            arg1,
+            arg2,
+            arg3));
+
+   if (!ReadFile(arg1,
+                 arg2,
+                 arg3,
+                 &rc,
+                 NULL))
+      rc = -1;
+
+   dprintf(("KERNEL32: _lread returns %08xh.",
+            rc));
+
+   return rc;
 }
 
@@ -187,22 +201,29 @@
 
 LONG WIN32API _llseek(HFILE arg1,
-								 LONG  arg2,
-								 int   arg3)
-{
-	ULONG rc;
-
-	dprintf(("KERNEL32: _llseek(%08xh, %08xh, %08xh)\n",
-				arg1,
-				arg2,
-				arg3));
-	if (!(arg3 == FILE_BEGIN || arg3 == FILE_CURRENT || arg3 == FILE_END))
-	{
-		dprintf(("KERNEL32: _llseek - incorrect origin - fails.\n" ));
-		return -1;
-	}
-
-	rc = SetFilePointer(arg1, arg2, NULL, arg3);	//returns -1 on error (-1 == 0xffffffff)
-	dprintf(("KERNEL32: _llseek returns %d", rc));
-	return rc;
+                      LONG  arg2,
+                      int   arg3)
+{
+   ULONG rc;
+
+   dprintf(("KERNEL32: _llseek(%08xh, %08xh, %08xh)\n",
+            arg1,
+            arg2,
+            arg3));
+   if (!(arg3 == FILE_BEGIN   ||
+         arg3 == FILE_CURRENT ||
+         arg3 == FILE_END))
+   {
+      dprintf(("KERNEL32: _llseek - incorrect origin - fails.\n" ));
+      return -1;
+   }
+
+   rc = SetFilePointer(arg1,
+                       arg2,
+                       NULL,
+                       arg3);   //returns -1 on error (-1 == 0xffffffff)
+
+   dprintf(("KERNEL32: _llseek returns %08xh", rc));
+
+   return rc;
 }
 
@@ -220,18 +241,26 @@
  *****************************************************************************/
 
-UINT WIN32API _lwrite(HFILE arg1, LPCSTR arg2,
-		      UINT  arg3)
-{
-	ULONG rc;
-
-	dprintf(("KERNEL32: _lwrite(%08xh, %08xh, %08xh)\n",
-				arg1,
-				arg2,
-				arg3));
-
-	if (!WriteFile(arg1, (PVOID)arg2, arg3, &rc, NULL))
-		rc = -1;
-	dprintf(("KERNEL32: _lwrite returns %d.\n", rc));
-	return rc;
-}
-
+UINT WIN32API _lwrite(HFILE arg1,
+                      LPCSTR arg2,
+                      UINT  arg3)
+{
+   ULONG rc;
+
+   dprintf(("KERNEL32: _lwrite(%08xh, %08xh, %08xh)\n",
+            arg1,
+            arg2,
+            arg3));
+
+   if (!WriteFile(arg1,
+                  (PVOID)arg2,
+                  arg3,
+                  &rc,
+                  NULL))
+      rc = -1;
+
+   dprintf(("KERNEL32: _lwrite returns %08xh.\n",
+            rc));
+
+   return rc;
+}
+
