--- Begin Message ---
diff -ruNp old/kernel/inthndlr.c new/kernel/inthndlr.c
--- old/kernel/inthndlr.c 2004-05-13 05:42:04.000000000 +0000
+++ new/kernel/inthndlr.c 2004-05-13 06:33:08.000000000 +0000
@@ -382,7 +382,7 @@ int int21_fat32(lregs *r)
VOID ASMCFUNC int21_service(iregs FAR * r)
{
- COUNT rc = 0;
+ COUNT rc;
long lrc;
lregs lr; /* 8 local registers (ax, bx, cx, dx, si, di, ds, es) */
@@ -765,8 +765,8 @@ dispatch:
if (dpb == NULL)
{
+ CritErrCode = -DE_INVLDDRV;
lr.AL = 0xFF;
- CritErrCode = 0x0f;
break;
}
/* hazard: no error checking! */
@@ -779,8 +779,8 @@ dispatch:
if (media_check(dpb) < 0)
#endif
{
+ CritErrCode = -DE_INVLDDRV;
lr.AL = 0xff;
- CritErrCode = 0x0f;
break;
}
lr.DS = FP_SEG(dpb);
@@ -839,7 +839,7 @@ dispatch:
if (0xffff == lr.DX)
{
/* Set Country Code */
- if ((rc = DosSetCountry(cntry)) < 0)
+ if (DosSetCountry(cntry) < 0)
goto error_invalid;
}
else
@@ -847,7 +847,7 @@ dispatch:
if (cntry == 0)
cntry--;
/* Get Country Information */
- if ((rc = DosGetCountryInformation(cntry, FP_DS_DX)) < 0)
+ if (DosGetCountryInformation(cntry, FP_DS_DX) < 0)
goto error_invalid;
/* HACK FIXME */
if (cntry == (UWORD) - 1)
@@ -927,7 +927,6 @@ dispatch:
case 0x01:
rc = DosSetFattr((BYTE FAR *) FP_DS_DX, lr.CX);
- if (rc >= SUCCESS)
lr.AX = lr.CX;
break;
@@ -939,12 +938,11 @@ dispatch:
/* Device I/O Control */
case 0x44:
rc = DosDevIOctl(&lr); /* can set critical error code! */
-
- if (rc != SUCCESS)
+ if (rc < SUCCESS)
{
lr.AX = -rc;
if (rc != DE_DEVICE && rc != DE_ACCESS)
- CritErrCode = -rc;
+ CritErrCode = lr.AX;
goto error_carry;
}
break;
@@ -962,52 +960,40 @@ dispatch:
/* Get Current Directory */
case 0x47:
rc = DosGetCuDir(lr.DL, MK_FP(lr.DS, lr.SI));
- if (rc >= SUCCESS)
lr.AX = 0x0100; /*jpp: from interrupt list */
goto short_check;
/* Allocate memory */
case 0x48:
- if ((rc =
- DosMemAlloc(lr.BX, mem_access_mode, &(lr.AX), &(lr.BX))) < 0)
+ if ((rc = DosMemAlloc(lr.BX, mem_access_mode, &lr.AX, &lr.BX)) < SUCCESS)
{
- DosMemLargest(&(lr.BX));
- {
+ DosMemLargest(&lr.BX);
if (DosMemCheck() != SUCCESS)
panic("MCB chain corrupted");
- }
goto error_exit;
}
- else
- ++(lr.AX); /* DosMemAlloc() returns seg of MCB rather than data
*/
+ lr.AX++; /* DosMemAlloc() returns seg of MCB rather than data */
break;
/* Free memory */
case 0x49:
- if ((rc = DosMemFree((lr.ES) - 1)) < 0)
- {
+ if ((rc = DosMemFree(lr.ES - 1)) < SUCCESS)
+ {
if (DosMemCheck() != SUCCESS)
panic("MCB chain corrupted");
- goto error_exit;
- }
+ goto error_exit;
+ }
break;
/* Set memory block size */
case 0x4a:
- if (DosMemCheck() != SUCCESS)
- panic("before 4a: MCB chain corrupted");
-
- if ((rc = DosMemChange(lr.ES, lr.BX, &lr.BX)) < 0)
+ if (DosMemCheck() != SUCCESS)
+ panic("before 4a: MCB chain corrupted");
+ if ((rc = DosMemChange(lr.ES, lr.BX, &lr.BX)) < SUCCESS)
{
#if 0
if (cu_psp == lr.ES)
- {
-
- psp FAR *p;
-
- p = MK_FP(cu_psp, 0);
- p->ps_size = lr.BX + cu_psp;
- }
+ ((psp FAR*)MK_FP(cu_psp, 0))->ps_size = lr.BX + cu_psp;
#endif
if (DosMemCheck() != SUCCESS)
panic("after 4a: MCB chain corrupted");
@@ -1031,21 +1017,17 @@ dispatch:
if (((psp FAR *)MK_FP(cu_psp, 0))->ps_parent == cu_psp)
break;
tsr = FALSE;
+ return_code = lr.AL;
if (ErrorMode)
{
ErrorMode = FALSE;
- rc = 2;
+ return_code |= 0x200;
}
else if (break_flg)
{
break_flg = FALSE;
- rc = 1;
+ return_code |= 0x100;
}
- else
- {
- rc = 0;
- }
- return_code = lr.AL | (rc << 8);
if (DosMemCheck() != SUCCESS)
panic("MCB chain corrupted");
#ifdef TSC
@@ -1066,7 +1048,6 @@ dispatch:
/* dta for this call is set on entry. This */
/* needs to be changed for new versions. */
rc = DosFindFirst(lr.CX, FP_DS_DX);
- if (rc >= SUCCESS)
lr.AX = 0;
goto short_check;
@@ -1075,7 +1056,6 @@ dispatch:
/* dta for this call is set on entry. This */
/* needs to be changed for new versions. */
rc = DosFindNext();
- if (rc >= SUCCESS)
lr.AX = 0;
goto short_check;
/*
@@ -1188,10 +1168,8 @@ dispatch:
/* Create Temporary File */
case 0x5a:
- if ((rc = DosMkTmp(FP_DS_DX, lr.CX)) < 0)
- goto error_exit;
- lr.AX = rc;
- break;
+ lr.AX = rc = DosMkTmp(FP_DS_DX, lr.CX);
+ goto short_check;
/* Create New File */
case 0x5b:
@@ -1201,11 +1179,9 @@ dispatch:
/* /// Added for SHARE. - Ron Cemer */
/* Lock/unlock file access */
case 0x5c:
- if ((rc = DosLockUnlock
- (lr.BX,
- (((unsigned long)lr.CX) << 16) | (((unsigned long)lr.DX) ),
- (((unsigned long)lr.SI) << 16) | (((unsigned long)lr.DI) ),
- ((lr.AX & 0xff) != 0))) != 0)
+ rc = DosLockUnlock(lr.BX, ((ULONG)lr.CX << 16) | lr.DX,
+ ((ULONG)lr.SI << 16) | lr.DI, lr.AL ? 1 : 0);
+ if (rc != SUCCESS)
goto error_exit;
break;
/* /// End of additions for SHARE. - Ron Cemer */
@@ -1231,10 +1207,11 @@ dispatch:
case 0x08:
case 0x09:
rc = remote_printredir(lr.DX, Int21AX);
+ CLEAR_CARRY_FLAG();
if (rc != SUCCESS)
goto error_exit;
- CLEAR_CARRY_FLAG();
break;
+
default:
CritErrCode = SUCCESS;
goto error_invalid;
@@ -1496,21 +1473,19 @@ dispatch:
goto error_invalid;
}
lr.AX = rc;
- if (rc < 0) goto error_exit;
- else CLEAR_CARRY_FLAG();
- break;
+ CLEAR_CARRY_FLAG();
+ goto short_check;
}
#endif
}
goto exit_dispatch;
long_check:
- if (lrc < SUCCESS)
+ if (lrc >= SUCCESS)
{
- rc = (int)lrc;
- goto error_exit;
+ lr.AX = (UWORD)lrc;
+ goto exit_dispatch;
}
- lr.AX = (UWORD)lrc;
- goto exit_dispatch;
+ rc = (int)lrc;
short_check:
if (rc < SUCCESS)
goto error_exit;
@@ -1925,9 +1900,3 @@ VOID ASMCFUNC int2F_12_handler(struct in
}
}
}
-
-/*
- * 2000/09/04 Brian Reifsnyder
- * Modified interrupts 0x25 & 0x26 to return more accurate error codes.
- */
-
--- End Message ---