Hello,

The patch below (added to my patch collection at http://linux.tu-varna.acad.bg/~lig/freedos/CVSPATCH.ZIP) fixes a problem with installed drives such as RAM disks (BITDISK, XMSDSK, etc) that don't support IOCTL themselves (the IOCTL it in their device attribute is 0). In MS-DOS, the Lock/Unlock Generic IOCTL commands succeed even on such drives. That's logical, as Lock/Unlock are performed by DOS, not the driver. But in FreeDOS, Lock/Unlock failed on such drives, because the IOCTL support device attribute bit was checked before the Lock/Unlock commands and as it's zero, the commands were failing (see ioctl.c, lines 280-283). This caused utilities like SYS by Datalight and SCANDISK by Microsoft to fail on such drives. The patch below fixes that

Lucho

--- cvs/kernel/kernel/ioctl.c   2004-01-27 14:42:44.000000000 +0200
+++ src/kernel/kernel/ioctl.c   2004-03-03 11:47:04.000000000 +0200
@@ -268,6 +268,11 @@
           {
             return DE_INVLDDRV;
           }
+          if (r->AL == 0x0D && (r->CX & ~(0x486B-0x084A)) == 0x084A)
+          {             /* 084A/484A, 084B/484B, 086A/486A, 086B/486B */
+            r->AX = 0;  /* (lock/unlock logical/physical volume) */
+            break;      /* simulate success for MS-DOS 7+ SCANDISK etc. --LG */
+          }
           if (((r->AL == 0x04) && !(dpbp->dpb_device->dh_attr & ATTR_IOCTL))
               || ((r->AL == 0x05) && !(dpbp->dpb_device->dh_attr & ATTR_IOCTL))
               || ((r->AL == 0x11)
@@ -277,11 +282,6 @@
           {
             return DE_INVLDFUNC;
           }
-          if (r->AL == 0x0D && (r->CX & ~(0x486B-0x084A)) == 0x084A)
-          {             /* 084A/484A, 084B/484B, 086A/486A, 086B/486B */
-            r->AX = 0;  /* (lock/unlock logical/physical volume) */
-            break;      /* simulate success for MS-DOS 7+ SCANDISK etc. --LG */
-          }

           CharReqHdr.r_command = nMode;
           execrh((request FAR *) & CharReqHdr, dpbp->dpb_device);


------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click _______________________________________________ Freedos-kernel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/freedos-kernel

Reply via email to