Hi!

Bugfixes:

- INT21/42: DE_INVLDHNDL is already negative, so it should be assigned to
  `rc' as is, without negation.
- INT21/5E02-...: removed AX clearing on exit - RBIL doesn't says that AX
  cleared for any function AL=2,3,...
- INT21/5F07,5F08: reversed condition - now error DE_INVLDDRV returned
  when DL >= (not <) lastdrive (and, thus, outside CDS).
- INT21/65: debug printf() includes extra argument.
- INT21/69: now returned error DE_INVLDDRV when get_cds() returns NULL
  (was forgotten "goto error_exit;").
--- Begin Message ---
diff -ruNp old/kernel/inthndlr.c new/kernel/inthndlr.c
--- old/kernel/inthndlr.c       2004-05-11 03:33:34.000000000 +0000
+++ new/kernel/inthndlr.c       2004-05-13 05:42:04.000000000 +0000
@@ -907,17 +907,13 @@ dispatch:
     case 0x42:
       if (lr.AL > 2)
         goto error_invalid;
-      lrc = DosSeek(lr.BX, (LONG)((((ULONG) (lr.CX)) << 16) | lr.DX), lr.AL);
+      lrc = DosSeek(lr.BX, ((ULONG)lr.CX << 16) | lr.DX, lr.AL);
+      rc = DE_INVLDHNDL;
       if (lrc == -1)
-      {
-        lrc = -DE_INVLDHNDL;
-      }
-      else
-      {
-        lr.DX = (UWORD)(lrc >> 16);
-        lrc = (UWORD) lrc;
-      }
-      goto long_check;
+        goto error_exit;
+      lr.DX = (UWORD)(lrc >> 16);
+      lr.AX = (UWORD) lrc;
+      break;
 
       /* Get/Set File Attributes                                      */
     case 0x43:
@@ -1260,7 +1256,6 @@ dispatch:
           rc = (int)network_redirector_mx(REM_PRINTSET, &lr, (void *)Int21AX);
           if (rc != SUCCESS)
             goto error_exit;
-          lr.AX = SUCCESS;
           break;
       }
       break;
@@ -1269,25 +1264,18 @@ dispatch:
       if (lr.AL == 7 || lr.AL == 8)
       {
         struct cds FAR *cdsp;
-        if (lr.DL < lastdrive)
+        if (lr.DL >= lastdrive)
         {
           rc = DE_INVLDDRV;
           goto error_exit;
         }
-        else
-        {
-          cdsp = &CDSp[lr.DL];
+        cdsp = CDSp + lr.DL;
           if (lr.AL == 7)
-          {
             cdsp->cdsFlags |= 0x100;
-          }
           else
-          {
             cdsp->cdsFlags &= ~0x100;
-          }
-        }
+        break;
       }
-      else
       {
         rc = (int)network_redirector_mx(REM_DOREDIRECT, &lr, (void *)Int21AX);
         /* the remote function manipulates *r directly !,
@@ -1300,7 +1288,6 @@ dispatch:
         r->AX = -rc;
         goto real_exit;
       }
-      break;
 
     case 0x60:                 /* TRUENAME */
       rc = DosTruename(MK_FP(lr.DS, lr.SI), adjust_far(FP_ES_DI));
@@ -1377,16 +1364,16 @@ dispatch:
           lr.AX = DosYesNo(lr.DL);
           break;
         default:
+          rc = DosGetData(lr.AL, lr.BX, lr.DX, lr.CX, FP_ES_DI);
 #ifdef NLS_DEBUG
-          if ((rc = DosGetData(lr.AL, lr.BX, lr.DX, lr.CX, FP_ES_DI)) < 0)
+          if (rc < SUCCESS)
           {
             printf("DosGetData() := %d\n", rc);
             goto error_exit;
           }
-          printf("DosGetData() returned successfully\n", rc);
+          printf("DosGetData() returned successfully\n");
           break;
 #else
-          rc = DosGetData(lr.AL, lr.BX, lr.DX, lr.CX, FP_ES_DI);
           goto short_check;
 #endif
       }
@@ -1423,26 +1410,25 @@ dispatch:
 
       /* Get/Set Serial Number */
     case 0x69:
+    {
+      UWORD saveCX;
+      if (lr.AL > 1)
+        goto error_invalid;
       rc = (lr.BL == 0 ? default_drive : lr.BL - 1);
-      if (lr.AL == 0 || lr.AL == 1)
-      {
-        UWORD saveCX = lr.CX;
         if (get_cds(rc) == NULL)
+        {
           rc = DE_INVLDDRV;
-        else if (get_dpb(rc) == NULL)
+          goto error_exit;
+        }
+        if (get_dpb(rc) == NULL)
           goto error_invalid;
-        else
-        {
+        saveCX = lr.CX;
           lr.CX = lr.AL == 0 ? 0x0866 : 0x0846;
           lr.AL = 0x0d;
           rc = DosDevIOctl(&lr);
           lr.CX = saveCX;
           goto short_check;
-        }
-      }
-      else
-        goto error_invalid;
-      break;
+    }
 /*
     case 0x6a: see case 0x68
     case 0x6b: dummy func: return AL=0

--- End Message ---

Reply via email to