Hi, you want to improve DosDevIOctl(), it seems.

...
      dpbp = get_dpb(CharReqHdr.r_unit);
...
        case 0x08:
          if (!dpbp)
          {
            return DE_INVLDDRV;
          }
          if (dpbp->dpb_device->dh_attr & ATTR_EXCALLS)
          {
            nMode = C_REMMEDIA;
            goto IoBlockCommon;
          }
          return DE_INVLDFUNC;
...
        IoBlockCommon:
          if (!dpbp)
          {
            return DE_INVLDDRV;
          }
          if (((r->AL == 0x04) && !(dpbp->dpb_device->dh_attr & ATTR_IOCTL))
              || ((r->AL == 0x05) && !(dpbp->dpb_device->dh_attr & ATTR_IOCTL))
              || ((r->AL == 0x11)
                  && !(dpbp->dpb_device->dh_attr & ATTR_QRYIOCTL))
              || ((r->AL == 0x0d)
                  && !(dpbp->dpb_device->dh_attr & ATTR_GENIOCTL)))
          {
            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);
...


struct dpb FAR *get_dpb(COUNT dsk) itself is a wrapper for get_cds().
struct cds FAR *get_cds(unsigned drive) that is. This accesses the CDSp
pointer-to-array at ListOfLists (struct lol) offset 0x16.
int 21.5f07/5f08 sets/resets cdsFlags 0x100 for drive DL if that matters.
int 2f.1217 could be useful for testing for you:
push drive (2=C:) mov ax,1217 int 2f -> returns DS:SI pointer to CDS for drive.
(Hey! No overflow check here! get_cds(r.callerARG1 & 0xff); ...)
(etc. etc.)
FsConfig() initializes CDSp entries for all drives (up to lastdrive).
STATIC VOID update_dcb(struct dhdr FAR * dhp) seems to be what initializes
the CDSp entries for a new driver!?

...
    dpb->dpb_next = dpb + 1;
    dpb->dpb_unit = LoL->nblkdev;
    dpb->dpb_subunit = Index;
    dpb->dpb_device = dhp;
    dpb->dpb_flags = M_CHANGED;
    if ((LoL->CDSp != 0) && (LoL->nblkdev < LoL->lastdrive))
    {
      LoL->CDSp[LoL->nblkdev].cdsDpb = dpb;
      LoL->CDSp[LoL->nblkdev].cdsFlags = CDSPHYSDRV;
    }
...

Called by init_device() :-).

Probably hot places to look at.

#define ATTR_EXCALLS    0x0800
 *      Command codes
#define C_REMMEDIA      0x0f    /* Removable MEDIA              */

Hm. Shrug. In spite of all the above, everything looks FINE at first
glance. RBIL tells:
Bitfields for device attributes (block device):
Bit(s)  Description     (Table 01648)
...
 11     (DOS 3.0+) OPEN/CLOSE/RemMedia calls supported
...
(Table 02595)
Values for device driver command code:
...
 0Fh (15) (DOS 3.0+) REMOVABLE MEDIA (block devices)
...

I hope those excerpts will help you or somebody else to find out
what went wrong with your somedisk,sys driver and the removable
media check. Does your device driver properly have device attribute
0x0800 set and does it properly respond to device command 0x0f ?
Can you detect any funny values in the CDS entry for that drive?
Does something wrong happen after that
          execrh((request FAR *) & CharReqHdr, dpbp->dpb_device);
or maybe on the other hand way before it?

Good luck for finding out.

Eric.



-------------------------------------------------------
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