Article View: comp.os.msdos.programmer
Article #2734Re: Number of drives on system, how do you find out the ...
From: Richard Brittain - VOS hacker
Date: Sat, 20 Oct 1990 02:17
Date: Sat, 20 Oct 1990 02:17
23 lines
1926 bytes
1926 bytes
In article <1085@duteca4.UUCP> kooijman@duteca (Richard Kooijman) writes:
>How do you find out what the actual number of drives is on a MS-DOS computer?
>I have programmed a utility like NCD. It searches all disks on the computer
>to build a database of directories. Later this database can be used to switch
>quickly to another directory.
The setdisk() function returns the number corresponding to the LASTDRIVE=
line in config.sys, which defaults to 5 (A-E) if not given. If your
definition of "drive" means any logical/physical/virtual/networked/subst/joined
entity that can legally be addressed as a block device, then I recommend
you test all the drives up to the LASTDRIVE= using the ioctl call for
"test for fixed or removable media". This gives an error code for
drives which are bogus, and a valid return for all other (real, networked,
virtual, RAM, subst, etc.). Best of all though, it makes no disc access
to do this, so it is very fast and never trips the critical error interrupt.
I don't have my references handy, but it should be listed in any of the
standard books - it's even documented!.
--
Richard Brittain, School of Elect. Eng., Upson Hall
Cornell University, Ithaca, NY 14853
ARPA: richard@calvin.spp.cornell.edu
UUCP: {uunet,uw-beaver,rochester,cmcl2}!cornell!calvin!richard
Technical Details
Message-ID:
<1990Oct20.021736.11447@calvin.spp.cornell.edu>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!samsung!usc!wuarchive!udel!rochester!cornell!calvin.spp.cornell.edu!richardReferences:
<1085@duteca4.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!samsung!usc!wuarchive!udel!rochester!cornell!calvin.spp.cornell.edu!richard From: richard@calvin.spp.cornell.edu (Richard Brittain - VOS hacker) Newsgroups: comp.os.msdos.programmer Subject: Re: Number of drives on system, how do you find out the ... Summary: Use the ioctl for fixed/removable media Keywords: MS-DOS, drives Message-ID: <1990Oct20.021736.11447@calvin.spp.cornell.edu> Date: 20 Oct 90 02:17:36 GMT References: <1085@duteca4.UUCP> Organization: Cornell Space Plasma Physics Lines: 23