Hi!

- fix: (Lucho) for INT21/5F07 and 5F08, before changing bit CDSPHYSDRV,
  MS-DOS checks if physical device associated with drive letter. Without
  this check MS-FORMAT under FreeDOS was destroys RAMDISK.

--- Begin Message ---
diff -ruNp old/kernel/inthndlr.c new/kernel/inthndlr.c
--- old/kernel/inthndlr.c       2004-05-30 12:31:14.000000000 +0000
+++ new/kernel/inthndlr.c       2004-07-14 23:47:40.000000000 +0000
@@ -1238,34 +1238,33 @@ dispatch:
       break;
 
     case 0x5f:
-      if (lr.AL == 7 || lr.AL == 8)
+      if (inrange(UBYTE, lr.AL, 7, 8))
       {
-        struct cds FAR *cdsp;
-        if (lr.DL >= lastdrive)
+        if (lr.DL < lastdrive)
         {
-          rc = DE_INVLDDRV;
-          goto error_exit;
-        }
-        cdsp = &CDSp[lr.DL];
-        if (lr.AL == 7)
-          cdsp->cdsFlags |= CDSPHYSDRV;
-        else
-          cdsp->cdsFlags &= ~CDSPHYSDRV;
-      }
-      else
-      {
-        rc = (int)network_redirector_mx(REM_DOREDIRECT, &lr, (void *)Int21AX);
-        /* the remote function manipulates *r directly !,
-           so we should not copy lr to r here            */
-        if (rc != SUCCESS)
-        {
-          CritErrCode = -rc;      /* Maybe set */
-          SET_CARRY_FLAG();
+          struct cds FAR *cdsp = CDSp + lr.DL;
+          if (cdsp->cdsDpb)    /* letter of physical drive?    */
+          {
+            cdsp->cdsFlags &= ~CDSPHYSDRV;
+            if (lr.AL == 7)
+              cdsp->cdsFlags |= CDSPHYSDRV;
+            break;
+          }
         }
-        r->AX = -rc;
-        goto real_exit;
+        rc = DE_INVLDDRV;
+        goto error_exit;
       }
-      break;
+
+      rc = -(int)network_redirector_mx(REM_DOREDIRECT, &lr, (void *)Int21AX);
+      /* the remote function manipulates *r directly !,
+         so we should not copy lr to r here */
+      r->AX = rc;
+      if (rc != SUCCESS)
+      {
+        SET_CARRY_FLAG();
+        CritErrCode = rc;      /* Maybe set */
+      }
+      goto real_exit;
 
     case 0x60:                 /* TRUENAME */
       rc = DosTruename(MK_FP(lr.DS, lr.SI), adjust_far(FP_ES_DI));

--- End Message ---

Reply via email to