Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/5/84; site teneron.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!vax135!cornell!uw-beaver!tektronix!reed!nsc-pdc!teneron!shanks From: shanks@teneron.UUCP (Dave Shanks) Newsgroups: net.micro.pc Subject: Re: How does a program detect disks on a PC? Message-ID: <217@teneron.UUCP> Date: Thu, 26-Sep-85 14:36:34 EDT Article-I.D.: teneron.217 Posted: Thu Sep 26 14:36:34 1985 Date-Received: Sun, 29-Sep-85 07:54:34 EDT References: <1053@phs.UUCP> Reply-To: shanks@teneron.UUCP (Dave Shanks) Organization: Teneron Corp., Beaverton, OR Lines: 34 Summary: In article <1053@phs.UUCP> lisa@phs.UUCP (Jeffrey William Gillette) writes: > >Does anyone know of a way to check for the presence of block devices without >either asking the user (who in this case will probably not know the answer), >or making calls to DOS that will put strange error messages on the screen. The May 1985 issue of PC Tech Journal (vol. 3, no. 5, pp. 76-87) has an article that describes how to get your hands on the linked list of MS-DOS device drivers. After the system is running this list will have all drivers in it, both those that are loaded by default, and those that are loaded via the config.sys mechanism. Basically you open NUL: (guaranteed to be the first device in the list) using an FCB. One of the reserved fields in the FCB will then contain the address of the device header for NUL:. Each device header has three fields which may be used to count all the block devices. The first is the attribute field which tells (among other things) whether this is a block or character device. The second is the device name field which, for block devices, contains the number of units that this driver controls. The final field needed is the next header field which contains the address of the next device header in the linked list. Warning: As far as I know, the method for finding the address of the first device header is not documented either by Microsoft or by IBM. The article states that this method will work for PC-DOS versions 2.0, 2.1, and 3.0. I have not attempted to use this information with any version of MS-DOS. -- Dave Shanks ..!tektronix!reed!teneron!shanks Teneron Corp. 6700 SW 105th Suite 200 Beaverton, OR 97005 (503) 646-1599