Dirve

Comments

: I need a routine to find out how many drives has a pc and which is the drive letter.: : Thank you: : Here is a function, which checks if a drive exists, taken from one of the TP units itself. You can use this function to create a string of valid drive letters. I cannot give you any help on this function itself, bacause I know very little assembly.[code]function DriveValid(Drive: Char): Boolean; near; assembler;asm MOV AH,19H { Save the current drive in BL } INT 21H MOV BL,AL MOV DL,Drive { Select the given drive } SUB DL,'A' MOV AH,0EH INT 21H MOV AH,19H { Retrieve what DOS thinks is current } INT 21H MOV CX,0 { Assume false } CMP AL,DL { Is the current drive the given drive? }@1 MOV CX,1 { It is, so the drive is valid } MOV DL,BL { Restore the old drive } MOV AH,0EH INT 21H@1: XCHG AX,CX { Put the return value into AX }end;[/code]

: I need a routine to find out how many drives has a pc and which is the drive letter.: : Thank you

I've used this one. Not only does it tell you if the drive exists (Size > 0) but it tells you the drive size (up to 2.1 Gigs). Doesn't include CD-ROM drives (I don't know about burners).

Phat Nat

[code]{BO BENDTSEN

Many people don't think about it, but DOS is limited to report more than1 gigabyte. I have a 1.3 and a 1.0 gig, and made these routines for myprograms for knowing if the drive size is more than 1 gig. Using the normalDiskSize and DiskFree could get you strange result, sometimes it could reportmaybe 100MB when it is really 1 gig.

If the size of free space is 1 you can assume that the drive is more than 1gigabyte.}USES Dos;