int21 file error fix

Andreas Mohr andi at rhlx01.fht-esslingen.de
Wed Nov 27 15:05:28 CST 2002


Hi all,

this one fixes some stupid int21 file function error return bugs
that caused IDA/DOS to quit with "Can't close file: error 0".
(We checked SET_AX return value to decide whether an error occurred
or not - unfortunately the *HIWORD* of EAX was non-NULL ;-\)

Index: msdos/int21.c
===================================================================
RCS file: /home/wine/wine/msdos/int21.c,v
retrieving revision 1.77
diff -u -r1.77 int21.c
--- msdos/int21.c	21 Nov 2002 00:02:10 -0000	1.77
+++ msdos/int21.c	27 Nov 2002 21:03:45 -0000
@@ -1505,7 +1505,8 @@
 
     case 0x3e: /* "CLOSE" - CLOSE FILE */
         TRACE("CLOSE handle %d\n",BX_reg(context));
-        bSetDOSExtendedError = ((SET_AX( context, _lclose16( BX_reg(context) )) != 0) );
+	SET_AX( context, _lclose16( BX_reg(context) ));
+        bSetDOSExtendedError = ((AX_reg(context) & 0xffff) != 0);
         break;
 
     case 0x3f: /* "READ" - READ FROM FILE OR DEVICE */
@@ -1930,9 +1931,10 @@
     case 0x5b: /* CREATE NEW FILE */
         TRACE("CREATE NEW FILE 0x%02x for %s\n", CX_reg(context),
 	      (LPCSTR)CTX_SEG_OFF_TO_LIN(context,  context->SegDs, context->Edx));
-        bSetDOSExtendedError = ((SET_AX( context,
+        SET_AX( context,
                _lcreat16_uniq( CTX_SEG_OFF_TO_LIN(context, context->SegDs,context->Edx),
-                               CX_reg(context) ))) == (WORD)HFILE_ERROR16);
+                               CX_reg(context) ));
+        bSetDOSExtendedError = ((AX_reg(context) & 0xffff) != 0);
         break;
 
     case 0x5d: /* NETWORK */

-- 
Andreas Mohr                        Stauferstr. 6, D-71272 Renningen, Germany



More information about the wine-patches mailing list