Registrations are now open. Join us today!
There is still a lot of work to do on the wiki yet! More information about editing can be found here.
Already have an account?

Microsoft KB Archive/35612

From BetaArchive Wiki

INF: Determining the Number of Drives Available PSS ID Number: Q35612 Article last modified on 08-25-1992

3.x 4.00 4.00a 4.01 4.01a 5.00

MS-DOS

Summary:

The Software/Data Library file DRIVES demonstrates the programming logic needed to determine the number of drives that are on line on a system running MS-DOS. The Microsoft C source code is provided, as well as the executable. Any C compiler that works under MS-DOS and supports the run-time library functions int86() and printf() should work with this code. Included in the archive are: DRIVES.C, DRIVES.EXE, and READ.ME.

The program uses the MS-DOS Get Current Drive service to determine the maximum number of drives that are available. This is the value you configure by setting the LASTDRIVE parameter in the CONFIG.SYS file. The program then loops from the first drive (drive A) to this LASTDRIVE. For each drive in this loop, it tries to change to this drive by using the Set Current Drive service. Then, it calls Get Current Drive. If the drive that it gets is not the same one that it just tried to set, this means that the drive is not available. If it is the same, the drive is on line. The program then determines if it is a fixed or removable drive, and whether it is a local or network drive.

DRIVES can be found in the Software/Data Library by searching on the word DRIVES, the Q number of this article, or S12031. DRIVES was archived using the PKware file-compression utility.

=================================================================

Copyright Microsoft Corporation 1992.