final int21 move (1/11)
György 'Nog' Jeney
nog at sdf.lonestar.org
Wed Nov 27 11:29:43 CST 2002
ChangeLog:
* dlls/winedos/int21.c
* msdos/int21.c
Move get extended error fucntion to winedos.
nog.
-------------- next part --------------
--- msdos/int21.c.0 2002-11-27 15:31:36.000000000 +0200
+++ msdos/int21.c 2002-11-27 15:34:16.000000000 +0200
@@ -1005,121 +1005,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)
*/
@@ -1136,12 +1021,6 @@
context->EFlags );
- if (AH_reg(context) == 0x59) /* Get extended error info */
- {
- INT21_GetExtendedError( context );
- return;
- }
-
if (AH_reg(context) == 0x0C) /* Flush buffer and read standard input */
{
TRACE("FLUSH BUFFER AND READ STANDARD INPUT\n");
--- dlls/winedos/int21.c.0 2002-11-27 15:31:47.000000000 +0200
+++ dlls/winedos/int21.c 2002-11-27 15:34:16.000000000 +0200
@@ -28,6 +28,7 @@
#include "winbase.h"
#include "winternl.h"
#include "winuser.h" /* SW_NORMAL */
+#include "winerror.h"
#include "wine/winbase16.h"
#include "dosexe.h"
#include "miscemu.h"
@@ -71,6 +72,120 @@
}
/***********************************************************************
+ * 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);
+}
+
+/***********************************************************************
* DOSVM_Int21Handler (WINEDOS16.133)
*
* int 21h handler. Most calls are passed directly to DOS3Call.
@@ -82,6 +197,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);
+ }
+
if(AH_reg(context) == 0x0c) /* FLUSH BUFFER AND READ STANDARD INPUT */
{
BYTE al = AL_reg(context); /* Input function to execute after flush. */
@@ -267,6 +387,10 @@
}
break;
+ case 0x59: /* Get extended error info */
+ INT21_GetExtendedError(context);
+ break;
+
case 0x62: /* GET PSP ADDRESS */
TRACE("GET CURRENT PSP ADDRESS\n");
/* FIXME: should we return the original DOS PSP upon */
@@ -275,8 +399,16 @@
else SET_BX(context, DOSVM_psp);
break;
-
default:
DOS3Call( context );
}
+
+ if(bSetDOSExtendedError) /* set general error condition */
+ {
+ SET_AX(context, GetLastError());
+ SET_CFLAG(context);
+ }
+
+ if((context->EFlags & 0x0001))
+ TRACE("failed, error %ld\n", GetLastError());
}
More information about the wine-patches
mailing list