Path: utzoo!attcan!uunet!jarthur!bridge2!mips!daver!ditka!nfsun!gchamber From: gchamber@nfsun.UUCP (Glenn Chambers) Newsgroups: comp.os.msdos.programmer Subject: Re: Identifying the max. number of drives. Summary: Nice code, but there's a problem. Keywords: Networks are a problem after all. Message-ID: <692@nfsun.UUCP> Date: 1 Aug 90 13:48:18 GMT References: <3102@murtoa.cs.mu.oz.au> Reply-To: gchamber@nfsun.UUCP (Glenn Chambers) Organization: Intelligent Technology Group, Pittsburgh, PA Lines: 54 In article feit@cs.odu.edu (Mark A. Feit) writes: >A very nice bit of work to determine whether a drive exists or not. > >/* drive_is_valid() > * > * Determine if a drive (named by 'drive') exists or not. If it's A or B, > * go through the BIOS to see if it physically exists (avoiding DOS's "Insert > * dist for drive B" messages). Otherwise, go through DOS. > * > * Return Value: DR_INVALID (0) if the drive is not valid. > * DR_VALID if Valid. > * Result will be ORed with DR_DONTREAD is the drive > * is not able to be read bust exists anyway. > */ >static int drive_is_valid( char drive ) >{ > /* Code omitted for brevity. */ >} The code works quite nicely in a non-networked environment. I don't have access to a Novell net, so the following comments may not apply in that case. In PC-NFS networks (using in my case the software sold by Sun Microsystems) drives between the last physical drive, and drive 'V' are created by the network driver, then 'mounted' from the file server. This mount process assigns remote file systems to any unused device in the list. It is therefore possible to have the following as the 'valid' device list: A: C: D: E: N: O: V: (I.e. a floppy disk, 3-partition hard disk, "new software", "old software", and network printer (pc-nfs uses drives t-v to map lpt1-3)). Attempting to access an allocated but unmounted drive produces the dreaded 'Abort, Retry, Ignore' dialog. The solution involves writing a dummy Critical Error Handler for DOS, that always returns 'fail', instead of prompting the user. I wrote one once, but that project got shelved, and I can't lay my hands on the code at the moment. I'm sure one of the net.msdos.gods can provide details on how to write the beast. I seem to remember that MSC includes some type of support but I can't remember. If it's any consolation, the various WINDOWS versions we've played with over the years don't even try to get it right. They blithely display drive K in the directory window, even though there is nothing mounted on that drive. -------------- Glenn Chambers This is me speaking. Intelligent Technology Group If my company were speaking, Pittsburgh, PA. my lips wouldn't be moving. gchamber@nfsun.UUCP or ...!uunet!nfsun!gchamber