Image Map Image Map
Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

Thread: Finding all valid DOS drive letters (unobtrusively)

  1. #11

    Default

    Quote Originally Posted by Krille View Post
    Sidenote; it's a pity all the old knowledge base articles like this are gone. Does anyone know if they have been saved somewhere.
    I suspect mainly on collections of MSDN / Technet / MSPL CD's now, Have you seen this site

  2. Default

    Quote Originally Posted by BloodyCactus View Post
    Just be sure to test on real hardware :) I made that mistake once, I did a 'stat' on 'con' on all drives, a:\con etc. worked great in dosbox, I got a list of drives that were present or not from a-z... total fail on real hardware!
    Device names seem to be handled differently depending on whether there is a path (including "\") after the drive letter. You can try this on the command line:

    type a:nul
    will not access drive, but print an error message if it doesn't exist

    type a:\nul
    accesses drive, "abort/retry/fail" prompt if no media

    truename a:nul
    truename a:\dev\nul
    both print "A:/NUL" (with forward slash), error if no such drive. The path "\dev\" is still treated as a special case on MS-DOS 6.22!

    truename a:\nul
    accesses drive, prints "A:\NUL" if successful

    Since function 29h doesn't deal with paths, and only parses the filename instead of trying to do anything with it, it should be a safe way to detect if a drive exists.

  3. #13

    Default

    back in the day of heavy(!) Borland Pascal programming I used this code

    Function DriveValid(Drive:Char):Boolean;Assembler;
    ASM
    MOV DL,Drive
    MOV AH,$36
    SUB DL,'A'-1
    INT $21
    INC AX
    JE @Fine
    MOV AL,1
    @Fine:
    END;

    Don't know if it helps...

  4. #14

    Default

    The method I have found to be most compatible with "modern DOS" (including NTVDM) is a combination of Int 21/AX=4409h (IOCTL - Check if block device remote) and Int 2F/AX=150Bh (MSCDEX - Drive check). This should find all drives without accessing them.

  5. #15

    Default

    Appreciate the tips. I had a go at a few of these methods under DOS 6.22, on real hardware (no removable drives) and PCem (with an emulated CD-ROM):

    • Int 21h/AH=29h (DOS 1+ - parse filename into FCB): works fine.
    • Int 21h/AX=4409h (DOS 3.1+ - IOCTL - check if block device remote): works fine as well.
    • Int 21h/AX=4408h (DOS 3.0+ - IOCTL - check if block device removable): weirdly enough that one barfed on the CD-ROM drive; it returned with CF set (error) and AX=01 (which would normally mean "function number invalid").

    That last one doesn't make much sense to me, but the other two seem to do the trick (without any uncalled-for media accesses), so I'm fine with either. Will probably go with the first one for slightly wider support.
    int10h.org :: :: :: blog

  6. #16

    Default

    Quote Originally Posted by Malc View Post
    I suspect mainly on collections of MSDN / Technet / MSPL CD's now, Have you seen this site
    I had not seen that site. Thanks! There's a ton of useful info there.

    Quote Originally Posted by Plasma View Post
    The method I have found to be most compatible with "modern DOS" (including NTVDM) is a combination of Int 21/AX=4409h (IOCTL - Check if block device remote) and Int 2F/AX=150Bh (MSCDEX - Drive check). This should find all drives without accessing them.
    So Int 21h/AX=4409h is not enough? When do you need to use Int 2Fh/AX=150Bh?
    Looking for a cache card for the "ICL ErgoPRO C4/66d V"

  7. #17
    Join Date
    Feb 2010
    Location
    Russia, St.Petersburg
    Posts
    192

    Default

    "Early MSDN CD’s on archive.org"
    https://virtuallyfun.com/wordpress/2...n-archive-org/

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •