BBS: Inland Empire Archive Date: 04-19-92 (21:52) Number: 195 From: BRENT ASHLEY Refer#: NONE To: ALL Recvd: NO Subj: find valid drives Conf: (2) Quik_Bas
I forget who was asking, but here's a routine I came up
with about a year ago to find all available drives on a
system. It finds network drives, ramdisks - the lot - all
without actually polling the drive, so floppy
considerations are unimportant. It will, however, tell you
there is a b drive even if it's a phantom drive. Equipment
byte in BIOS area should help determine whether b actually
exists.
-----
Brent
-----
'
' Drives.BAS - Checks valid drives without accessing them
'
' by Brent Ashley - do as you wish with it.
'
' $INCLUDE: 'QB.BI'
DEFINT A-Z
DECLARE FUNCTION ValidDrv% (DriveLetter$)
PRINT "Valid Drives are - ";
FOR Drive = 65 TO 90 ' ("A" to "Z")
DrvLtr$ = CHR$(Drive)
IF ValidDrv(DrvLtr$) THEN PRINT DrvLtr$; ": ";
NEXT
FUNCTION ValidDrv (DriveLetter$)
STATIC Letter$, Regs AS RegTypeX, DummyFCB AS STRING * 43
Letter$ = DriveLetter$ + ": "
Regs.ax = &H2906 ; int 21h svc 29h - parse filename
Regs.ds = VARSEG(Letter$) ;
Regs.si = SADD(Letter$) ; use sadd for string
Regs.es = VARSEG(DummyFCB) ;
Regs.di = VARPTR(DummyFCB) + 7 ; extended fcb extends back 7 bytes
InterruptX &H21, Regs, Regs
ValidDrv = -1 ; assume true
IF (Regs.ax AND 255) = 255 THEN ValidDrv = 0 ; parse fails on bad drive
END FUNCTION
--- Maximus 2.00
* Origin: The Programmer's Paradise (416)482-1470 (1:250/801)

Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET