Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uwm.edu!csd4.csd.uwm.edu!bionet!agate!shelby!helens!relgyro!mike From: mike@relgyro.stanford.edu (Mike Macgirvin) Newsgroups: comp.sys.ibm.pc Subject: Re: How can I poll a drive? Message-ID: <331@helens.Stanford.EDU> Date: 12 Sep 89 23:16:10 GMT References: <342@castle.ed.ac.uk> <45855611.15768@bladder.UUCP> Sender: news@helens.STANFORD.EDU Reply-To: mike@relgyro.STANFORD.EDU (Mike Macgirvin) Organization: Stanford Relativity Gyro Experiment (GP-B) Lines: 30 In article <45855611.15768@bladder.UUCP> wagnere@bladder.UUCP (Eric Wagner) writes: >In article <342@castle.ed.ac.uk>, erck12@castle.ed.ac.uk (Gnome) writes: >> Here is one for the hackers among you! I want to poll a given (i.e. >> not necasarily physical) drive, given a drive letter supplied by the user. I >> want to find out if it is present, and functional without generating any DOS >> "retry, abort or ..." or "insert diskette for drive X" type messages. I am >> working in MSC 5.1. How would I go about it? > >Also, how would one go about detecting when the drive door has been >closed, like FASTBAK does? > Take a look at the _harderr() and _hardresume() functions. They will do what you ask. The only problem I had with them was figuring out the specific error from the error codes. I ended up running a dummy program, and created the hard errors that *I* wanted to catch, while printing out the error numbers. Any other errors should be left to DOS. (i.e. you probably don't want to leave your prgram running with a major keyboard failure...). /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + I only speak for myself, and MY brain has been turned to MUSH! + + Mike Macgirvin + + - Systems Administrator Stanford Relativity Gyroscope Experiment (GP-B) + + - Internet: mike@relgyro.stanford.edu (36.64.0.50) + + - Bitnet: mike%relgyro.stanford.edu@stanford + + - Uucp: uunet!relgyro.stanford.edu!mike + + "'Scuse me, while I kiss the sky" - Robert James Marshall (Jimi) Hendrix + +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/