msdos/int21 CREAT special cases (revised)

Ferenc Wagner wferi at tba.elte.hu
Thu Jun 5 07:30:23 CDT 2003


Volume label creation should fail, not create a regular file.
Similarly for file names ending in a slash (this is actually
needed for PKSFX Version 2.04g to unpack directory trees).

                                                Feri.

Index: msdos/int21.c
===================================================================
RCS file: /home/wine/wine/msdos/int21.c,v
retrieving revision 1.94
diff -u -r1.94 int21.c
--- msdos/int21.c	4 Jun 2003 20:17:52 -0000	1.94
+++ msdos/int21.c	5 Jun 2003 12:24:35 -0000
@@ -413,9 +413,22 @@
 }
 static BOOL INT21_CreateFile( CONTEXT86 *context )
 {
-    SET_AX( context, _lcreat16( CTX_SEG_OFF_TO_LIN(context, context->SegDs,
-                                                   context->Edx ), CX_reg(context) ) );
-    return (AX_reg(context) == (WORD)HFILE_ERROR16);
+    LPCSTR path=CTX_SEG_OFF_TO_LIN(context, context->SegDs, context->Edx);
+    HFILE16 doshandle;
+
+    if (CX_reg(context) == 0x0008) {
+        SetLastError( ERROR_ACCESS_DENIED );
+        return TRUE;
+    }
+    if (path[strlen(path)-1] == '/')
+    {
+        SetLastError( ERROR_FILE_NOT_FOUND );
+        return TRUE;
+    }
+    doshandle=Win32HandleToDosFileHandle(
+                  (HANDLE)_lcreat( path, CX_reg(context) ) );
+    SET_AX( context, doshandle );
+    return (doshandle == (WORD)HFILE_ERROR16);
 }
 
 static HFILE16 _lcreat16_uniq( LPCSTR path, INT attr )



More information about the wine-patches mailing list