merrett@ac.dal.ca (02/28/91)
Here's a simple problem that I thought (incorrectly it seemed) would have a simple solution: I'm using Turbo-C 2.0 (also TCXL 5.5 if that helps) and I'm trying to write a simple little routine to scan for the available drives. I got a kludge together which incremented up the DRIVE numbers scanning for getdfree(), checking if it gave an error. Well, it worked ok but on this one floppy/one hard drive 386 it naturally asked me to insert floppy in b:. Is there any way of checking for 'legal' drives on a particular system, in C, without actually having to read from the drive? (i.e. I don't want it plopping that 'insert floppy' message in the middle of my pretty windows) thanks in advance Doug Merrett merrett@ac.dal.ca Dalhousie University Halifax, N.S. Canada \|/ -O- /|\
jnelson@plains.NoDak.edu (Jim Nelson) (03/11/91)
In article <3815@ac.dal.ca> merrett@ac.dal.ca writes: >Is there any way of checking for 'legal' drives on a particular system, in >C, without actually having to read from the drive? (i.e. I don't want it >plopping that 'insert floppy' message in the middle of my pretty windows) About the only way to do it is to check the biosequip word for number of floppies. I don't know it's memory address at the moment, but TC has a function to find it for you, then you do a little bit manipulation to do the rest. -- .sig? What .sig? Ohhhh, *THIS* .sig. Jim, in the Land of the Lost. disclaimer: These are just opinions. If you want 'em, you can have 'em.
bt@eng.auburn.edu (bt garner) (03/12/91)
In article <3815@ac.dal.ca> merrett@ac.dal.ca writes: >Is there any way of checking for 'legal' drives on a particular system, in >C, without actually having to read from the drive? (i.e. I don't want it >plopping that 'insert floppy' message in the middle of my pretty windows) and in article <8795@plains.NoDak.edu> (Jim Nelson) responded: >About the only way to do it is to check the biosequip word for number of >floppies. I don't know it's memory address at the moment, but TC has a >function to find it for you, then you do a little bit manipulation to do the >rest. The equipment list is in [0:410H], if bit 0 is set, then floppies do exist on the system (bits 6 & 7 will tell you the number-1). To check for the presence of hard drives, the best way (that I've found) is to use Int21, Function 36H (Get Free Disk Space) until AX returns FFFF (Invalid Drive Specification). bt garner (bt@rng.auburn.edu) mutant systems programmer, process modeling group chemical engineering department, auburn unversity
Norbert.Zacharias@arbi.informatik.uni-oldenburg.de (Norbert Zacharias) (03/12/91)
bt@eng.auburn.edu (bt garner) writes: >In article <3815@ac.dal.ca> merrett@ac.dal.ca writes: >>Is there any way of checking for 'legal' drives on a particular system, in >>C, without actually having to read from the drive? (i.e. I don't want it >>plopping that 'insert floppy' message in the middle of my pretty windows) >and in article <8795@plains.NoDak.edu> (Jim Nelson) responded: >>About the only way to do it is to check the biosequip word for number of >>floppies. I don't know it's memory address at the moment, but TC has a >>function to find it for you, then you do a little bit manipulation to do the >>rest. >The equipment list is in [0:410H], if bit 0 is set, then floppies do >exist on the system (bits 6 & 7 will tell you the number-1). To check >for the presence of hard drives, the best way (that I've found) is to use >Int21, Function 36H (Get Free Disk Space) until AX returns FFFF (Invalid >Drive Specification). There is an other way. I use the INT 21H 44H Funktion (IOCTL Is Changeable) In the documetation they wrote this Funktion is available only one have loadet networksoftware. But nevertheless it works without any netware The disk is present if CF = 0 If CF = 1 and AX = 15 the disk is not available hope it helps Norbert -- ============================================================================= Norbert Zacharias Norbert.Zacharias@arbi.informatik.uni-oldenburg.de FB Physik 148964@DOLUNI1.bitnet Carl-von-Ossietzky-Universitaet Tel. 0049-441-7983527 Was Du nicht willst das man Dir tu, das will auch nicht was willst denn Du? Heinz Erhard =============================================================================
richardh@hpopd.pwd.hp.com (Richard Hancock) (03/12/91)
/ hpopd:comp.os.msdos.programmer / jnelson@plains.NoDak.edu (Jim Nelson) / 1:47 am Mar 11, 1991 / In article <3815@ac.dal.ca> merrett@ac.dal.ca writes: >>Is there any way of checking for 'legal' drives on a particular system, in >>C, without actually having to read from the drive? (i.e. I don't want it >>plopping that 'insert floppy' message in the middle of my pretty windows) >About the only way to do it is to check the biosequip word for number of >floppies. I don't know it's memory address at the moment, but TC has a >function to find it for you, then you do a little bit manipulation to do the >rest. I can't remeber if the int21h, function 0eh prompts with an "insert floppy" message if you try to select a floppy drive as the current drive. If it does you could trap int24h and instruct DOS to fail the system call. Something along the lines of :- unsigned int DriveID; // trap int24h for ( DriveID = 0; DriveID < 26; DriveID++; ) { // set ah = 0eh ; select disk // set dl = DriveID // int21h // set ah = 19h ; determine currect disk // int21h // if al == DriveID then DriveID is valid } // restore original int24h Richard@tvs