Board index » delphi » Returning letter of CDROM-drive?

Returning letter of CDROM-drive?

I am wondering if anyone in this world could make me at source-code in
witch the program returns the driveletter of a CDROM-drive.

Plz help....

Sincerely

Janus Kamp Hansen
Vejle - Denmark

 

Re:Returning letter of CDROM-drive?


In article <4krqht$...@news.uni-c.dk>, inf94...@mini01.vejlees.dk (Janus K Hansen) writes:
|>
|> I am wondering if anyone in this world could make me at source-code in
|> witch the program returns the driveletter of a CDROM-drive.
|>
|> Plz help....
|>
|> Sincerely
|>
|> Janus Kamp Hansen
|> Vejle - Denmark

Here's a function that might be of help.... it queries the MSCDEX driver for the
first drive number and the number of CD drives installed.  The function returns
true if it was succesful in retrieving the information, otherwise it returns
false.

The returned value of FirstDrive is an unsigned integer where 0 = 'A', 1 = 'B',
and so on.  So to get the actual drive letter you use:
   FirstDriveLetter := Chr(FirstDrive + Ord('A'));
   LastDriveLetter  := Chr(FirstDrive + NumDrives + Ord('A'));

Function CheckCDROMDrives(Var FirstDrive, NumDrives : Word):Boolean;Assembler;
ASM
   XOR  BX, BX           { zero out BX to check availability of function }
   MOV  AX, 1500h        { get no. of CDROM drive letters                }
   INT  2Fh              { BX = count,  CX = first                       }
   OR   BX, BX           { was BX modified?                              }
   JZ   @Error           { if not, then no MSCDEX driver installed       }
   LES  DI, FirstDrive
   MOV  ES:[DI], CX      { device number of first drive                  }
   LES  DI, NumDrives
   MOV  ES:[DI], BX      { number of CD drives                           }
   MOV  AL, Byte(True)
   JMP  @Exit
@Error:
   XOR  AX, AX
   LES  DI, FirstDrive
   MOV  ES:[DI], AX
   LES  DI, NumDrives
   MOV  ES:[DI], AX
   MOV  AL, Byte(False)  
@Exit:
End;

YO!
Erwin
--
Erwin D. Paguio
http://rh.iist.unu.edu/~ep/ydeeps.htm
Pascal and ASM Enthusiast

Other Threads