int21 move a4

György 'Nog' Jeney nog at sdf.lonestar.org
Sat Nov 9 07:25:44 CST 2002


ChangeLog:
 * dlls/winedos/int21.c
 * msdos/int21.c
   Move Get Extended error information to winedos.

nog.

-------------- next part --------------
--- msdos/int21.c.a3	2002-11-09 07:53:21.000000000 +0200
+++ msdos/int21.c	2002-11-09 08:12:11.000000000 +0200
@@ -980,121 +980,6 @@
 }
 
 /***********************************************************************
- *           INT21_GetExtendedError
- */
-static void INT21_GetExtendedError( CONTEXT86 *context )
-{
-    BYTE class, action, locus;
-    WORD error = GetLastError();
-
-    switch(error)
-    {
-    case ERROR_SUCCESS:
-        class = action = locus = 0;
-        break;
-    case ERROR_DIR_NOT_EMPTY:
-        class  = EC_Exists;
-        action = SA_Ignore;
-        locus  = EL_Disk;
-        break;
-    case ERROR_ACCESS_DENIED:
-        class  = EC_AccessDenied;
-        action = SA_Abort;
-        locus  = EL_Disk;
-        break;
-    case ERROR_CANNOT_MAKE:
-        class  = EC_AccessDenied;
-        action = SA_Abort;
-        locus  = EL_Unknown;
-        break;
-    case ERROR_DISK_FULL:
-    case ERROR_HANDLE_DISK_FULL:
-        class  = EC_MediaError;
-        action = SA_Abort;
-        locus  = EL_Disk;
-        break;
-    case ERROR_FILE_EXISTS:
-    case ERROR_ALREADY_EXISTS:
-        class  = EC_Exists;
-        action = SA_Abort;
-        locus  = EL_Disk;
-        break;
-    case ERROR_FILE_NOT_FOUND:
-        class  = EC_NotFound;
-        action = SA_Abort;
-        locus  = EL_Disk;
-        break;
-    case ER_GeneralFailure:
-        class  = EC_SystemFailure;
-        action = SA_Abort;
-        locus  = EL_Unknown;
-        break;
-    case ERROR_INVALID_DRIVE:
-        class  = EC_MediaError;
-        action = SA_Abort;
-        locus  = EL_Disk;
-        break;
-    case ERROR_INVALID_HANDLE:
-        class  = EC_ProgramError;
-        action = SA_Abort;
-        locus  = EL_Disk;
-        break;
-    case ERROR_LOCK_VIOLATION:
-        class  = EC_AccessDenied;
-        action = SA_Abort;
-        locus  = EL_Disk;
-        break;
-    case ERROR_NO_MORE_FILES:
-        class  = EC_MediaError;
-        action = SA_Abort;
-        locus  = EL_Disk;
-        break;
-    case ER_NoNetwork:
-        class  = EC_NotFound;
-        action = SA_Abort;
-        locus  = EL_Network;
-        break;
-    case ERROR_NOT_ENOUGH_MEMORY:
-        class  = EC_OutOfResource;
-        action = SA_Abort;
-        locus  = EL_Memory;
-        break;
-    case ERROR_PATH_NOT_FOUND:
-        class  = EC_NotFound;
-        action = SA_Abort;
-        locus  = EL_Disk;
-        break;
-    case ERROR_SEEK:
-        class  = EC_NotFound;
-        action = SA_Ignore;
-        locus  = EL_Disk;
-        break;
-    case ERROR_SHARING_VIOLATION:
-        class  = EC_Temporary;
-        action = SA_Retry;
-        locus  = EL_Disk;
-        break;
-    case ERROR_TOO_MANY_OPEN_FILES:
-        class  = EC_ProgramError;
-        action = SA_Abort;
-        locus  = EL_Disk;
-        break;
-    default:
-        FIXME("Unknown error %d\n", error );
-        class  = EC_SystemFailure;
-        action = SA_Abort;
-        locus  = EL_Unknown;
-        break;
-    }
-    TRACE("GET EXTENDED ERROR code 0x%02x class 0x%02x action 0x%02x locus %02x\n",
-           error, class, action, locus );
-    SET_AX( context, error );
-    SET_BH( context, class );
-    SET_BL( context, action );
-    SET_CH( context, locus );
-}
-
-/***********************************************************************
  *           DOS3Call         (KERNEL.102)
  *           INT_Int21Handler (WPROCS.133)
  */
@@ -1110,13 +995,6 @@
 	  (WORD)context->SegDs, (WORD)context->SegEs,
 	  context->EFlags );
 
-
-    if (AH_reg(context) == 0x59)  /* Get extended error info */
-    {
-        INT21_GetExtendedError( context );
-        return;
-    }
-
     if (AH_reg(context)>=0x2f) {
         /* extended error is used by (at least) functions 0x2f to 0x62 */
         SetLastError(0);
--- dlls/winedos/int21.c.a3	2002-11-09 07:54:11.000000000 +0200
+++ dlls/winedos/int21.c	2002-11-09 08:34:04.000000000 +0200
@@ -26,6 +26,7 @@
 
 #include "windef.h"
 #include "winbase.h"
+#include "winerror.h"
 #include "winternl.h"
 #include "wine/winbase16.h"
 #include "dosexe.h"
@@ -39,6 +40,121 @@
 
 WORD CodePage = 437;
 
+/***********************************************************************
+ *           INT21_GetExtendedError
+ */
+static void INT21_GetExtendedError( CONTEXT86 *context )
+{
+    BYTE class, action, locus;
+    WORD error = GetLastError();
+
+    switch(error)
+    {
+    case ERROR_SUCCESS:
+        class = action = locus = 0;
+        break;
+    case ERROR_DIR_NOT_EMPTY:
+        class  = EC_Exists;
+        action = SA_Ignore;
+        locus  = EL_Disk;
+        break;
+    case ERROR_ACCESS_DENIED:
+        class  = EC_AccessDenied;
+        action = SA_Abort;
+        locus  = EL_Disk;
+        break;
+    case ERROR_CANNOT_MAKE:
+        class  = EC_AccessDenied;
+        action = SA_Abort;
+        locus  = EL_Unknown;
+        break;
+    case ERROR_DISK_FULL:
+    case ERROR_HANDLE_DISK_FULL:
+        class  = EC_MediaError;
+        action = SA_Abort;
+        locus  = EL_Disk;
+        break;
+    case ERROR_FILE_EXISTS:
+    case ERROR_ALREADY_EXISTS:
+        class  = EC_Exists;
+        action = SA_Abort;
+        locus  = EL_Disk;
+        break;
+    case ERROR_FILE_NOT_FOUND:
+        class  = EC_NotFound;
+        action = SA_Abort;
+        locus  = EL_Disk;
+        break;
+    case ER_GeneralFailure:
+        class  = EC_SystemFailure;
+        action = SA_Abort;
+        locus  = EL_Unknown;
+        break;
+    case ERROR_INVALID_DRIVE:
+        class  = EC_MediaError;
+        action = SA_Abort;
+        locus  = EL_Disk;
+        break;
+    case ERROR_INVALID_HANDLE:
+        class  = EC_ProgramError;
+        action = SA_Abort;
+        locus  = EL_Disk;
+        break;
+    case ERROR_LOCK_VIOLATION:
+        class  = EC_AccessDenied;
+        action = SA_Abort;
+        locus  = EL_Disk;
+        break;
+    case ERROR_NO_MORE_FILES:
+        class  = EC_MediaError;
+        action = SA_Abort;
+        locus  = EL_Disk;
+        break;
+    case ER_NoNetwork:
+        class  = EC_NotFound;
+        action = SA_Abort;
+        locus  = EL_Network;
+        break;
+    case ERROR_NOT_ENOUGH_MEMORY:
+        class  = EC_OutOfResource;
+        action = SA_Abort;
+        locus  = EL_Memory;
+        break;
+    case ERROR_PATH_NOT_FOUND:
+        class  = EC_NotFound;
+        action = SA_Abort;
+        locus  = EL_Disk;
+        break;
+    case ERROR_SEEK:
+        class  = EC_NotFound;
+        action = SA_Ignore;
+        locus  = EL_Disk;
+        break;
+    case ERROR_SHARING_VIOLATION:
+        class  = EC_Temporary;
+        action = SA_Retry;
+        locus  = EL_Disk;
+        break;
+    case ERROR_TOO_MANY_OPEN_FILES:
+        class  = EC_ProgramError;
+        action = SA_Abort;
+        locus  = EL_Disk;
+        break;
+    default:
+        FIXME("Unknown error %d\n", error );
+        class  = EC_SystemFailure;
+        action = SA_Abort;
+        locus  = EL_Unknown;
+        break;
+    }
+    TRACE("GET EXTENDED ERROR code 0x%02x class 0x%02x action 0x%02x locus %02x\n",
+           error, class, action, locus );
+    SET_AX( context, error );
+    SET_BH( context, class );
+    SET_BL( context, action );
+    SET_CH( context, locus );
+}
+
 void WINAPI DOSVM_Int21Handler_Ioctl( CONTEXT86 *context )
 {
   static const WCHAR emmxxxx0W[] = {'E','M','M','X','X','X','X','0',0};
@@ -83,6 +199,11 @@
 
     RESET_CFLAG(context);  /* Not sure if this is a good idea */
 
+    if (AH_reg(context)>=0x2f) {
+        /* extended error is used by (at least) functions 0x2f to 0x62 */
+        SetLastError(0);
+    }
+
     switch(AH_reg(context))
     {
     case 0x00: /* TERMINATE PROGRAM */
@@ -489,6 +610,10 @@
         RESET_CFLAG(context);
         break;
 
+    case 0x59: /* Get extended error info */
+        INT21_GetExtendedError(context);
+        break;
+
     case 0x5d: /* NETWORK */
         FIXME("Function 0x%04x not implemented.\n", AX_reg (context));
         /* Fix the following while you're at it.  */
@@ -612,4 +737,10 @@
     default:
         DOS3Call( context );
     }
+
+    if( bSetDOSExtendedError )          /* set general error condition */
+    {
+        SET_AX( context, GetLastError() );
+        SET_CFLAG(context);
+    }
 }



More information about the wine-patches mailing list