----------------------------------------------------------------------------
Here's the IsCDROM function from the FileCtrls unit (D1):
{ Check whether drive is a CD-ROM. Returns True if MSCDEX is installed
and the drive is using a CD driver }
function IsCDROM(DriveNum: Integer): Boolean; assembler;
asm
MOV AX,1500h { look for MSCDEX }
XOR BX,BX
INT 2fh
OR BX,BX
JZ @Finish
MOV AX,150Bh { check for using CD driver }
MOV CX,DriveNum
INT 2fh
OR AX,AX
@Finish:
end;
----------------------------------------------------------------------------
the Win16 GetDriveType function reports CD-ROM drives as network drives,
you have to ask MSCDEX directly for the drives.
Here is some code to do that:
{************************************************************
* Function DriveIsCDROM
*
* Parameters:
* n: the drive number to check, 1= A:, 2=B: etc.
* Returns:
* True, if the drive is a CD-ROM, False otherwise.
* Description:
* Uses the MSCDEX Int $2F interface, function $0B.
* It is not necessary to check for the presence of
* MSCDEX first.
*
*Created: 02/26/95 21:57:06 by P. Below
************************************************************}
Function DriveIsCDROM( n: Byte ): Boolean; assembler;
Asm
mov ax, $150B (* MSCDEX check drive Function *)
mov cl, n
xor ch, ch
dec cx (* 0 = A: etc.*)
xor bx, bx
int $2F
cmp bx, $ADAD (* is MSCDEX present? *)
jne @no_cdrom
or ax, ax
jz @no_cdrom
mov ax, True
jmp @done
@no_cdrom:
mov ax, False
@done:
End;
If you are interested in more stuff for drives, like detecting RAM-drives,
shared and redirected drives, volume serial numbers etc. in Delphi 1 try to
find the file DRIVED.ZIP on ftp://ftp.dbdinc.com, pub/delphi directory.
Should be in a subdirectory starting with 7. |
|