peterc@stpl.UUCP (Peter CAMILLERI) (05/19/89)
Hello Netland! I am in the process of writing a "friendly" DOS shell program. One of the things that I need to know is how many drives are present. Refering to my copy of Advanced MSDOS I saw that the simple procedure was to 1) Get the Default Drive using DOS FN 25 2) Set the Default Drive to the number obtained above using DOS FN 14, which as a side effect returns the number of Drives! Neat Huh? Too bad it does'nt work, { In spite of the fact that the manual says it should :-} It always returns 5 (Five) as the number of drives despite the fact that I have only 3 (Three) A & B are floppies, and C a hard disk. { I am running Compaq DOS 3.2 if it matters. } My current kludge is to use the equipmnet list to compute the number of floppies, and get the allocation info on each potential hard drive until I find one that does'nt exist. Problem here == SLOW SLOW SLOW !!!! So what I ned is a FAST, RELIABLE way to find out how many drives a system has. P.S. I it makes any difference, I think you should know that I intend to present the reults of my work, source code and all, in a manner similar to the GNU stuff being done at the FSF. IE: free access only. -- Peter Camilleri peter@stpl.UUCP Elan Data Technology Inc. 836 Yonge St., Toronto, Ontario, uunet!mnetor!yunexus!stpl!peter CANADA M4W 2H1 (416) 968-6668
ts@chyde.uwasa.fi (Timo Salmi LASK) (05/20/89)
In article <188@stpl.UUCP> peterc@stpl.UUCP (Peter CAMILLERI) writes: >Hello Netland! > >I am in the process of writing a "friendly" DOS shell program. One of the >things that I need to know is how many drives are present. Refering to Look at the documentation of interrupt 21hex service 52hex in the recently posted inter189.arc. It provides both the number of drives and the lastdrive in config.sys for msdos version 3 onwards. ................................................................... Prof. Timo Salmi School of Business Studies, University of Vaasa, SF-65101, Finland Internet: ts@chyde.uwasa.fi Funet: vakk::salmi Bitnet: salmi@finfun
trgauchat@rose.waterloo.edu (Terry Gauchat) (05/20/89)
In article <188@stpl.UUCP> peterc@stpl.UUCP (Peter CAMILLERI) writes: >Hello Netland! > > 2) Set the Default Drive to the number obtained above using > DOS FN 14, which as a side effect returns the number of Drives! > >Neat Huh? Too bad it does'nt work, { In spite of the fact that the manual >says it should :-} It always returns 5 (Five) as the number of drives >despite the fact that I have only 3 (Three) A & B are floppies, and C >a hard disk. { I am running Compaq DOS 3.2 if it matters. } I believe that you are getting "5" because the environment variable LASTDRIVE is set to "e" (I believe this is the default). Try putting LASTDRIVE=C in your CONFIG.SYS . I know this isn't the best solution, but it may explain the bug. ...Terry MicroCosmic Computer Services
stephen@ziebmef.uucp (Stephen M. Dunn) (05/28/89)
Yes, if you ask DOS how many drives it has, it will always report 5 or more if you have a hard drive (or at least, in my experience ... maybe this is only with some versions of DOS). Here's a solution (I'm not sure where I picked it up from): 1. Do as Norton says and find out how many drives DOS reports. 2. If DOS says 2, you know you have a floppy-only system (although I'm not sure whether DOS says 2 even if you have 1 floppy or not ... if you don't need to detect whether B is real or virtual, then you don't need to bother looking any further). 3. If DOS says more than 2, then try setting the default drive to C, then D, etc. until DOS tells you the drive doesn't exist. If you're working on a networked system, you'll have to check every possible drive number, since the lettering of network drives is not always straight- forward (at my university, we have a network where A and B are your floppies, C is only available while booting and then becomes unavailabe, and the network drives are I, J and K. Drives C through H are unavailable). -- ------------------------------------------------------------------------------- ! Stephen M. Dunn stephen@ziebmef.UUCP ! DISCLAIMER: Who'd ever ! ! Take off to the Great White North eh, ya hosehead ! claim such dumb ideas? ! -------------------------------------------------------------------------------