Detecting CD-ROM drive

Colin Peters colin@bird.fu.is.saga-u.ac.jp
Thu Oct 30 06:26:00 GMT 1997


Arlindo da Silva[SMTP:arlindo@niteroi.gsfc.nasa.gov] wrote:
>Does anybody know how to determine which drive (d:, e:, ...) is a CDROM? 
>Is there any native function for this? Thanks.


UINT GetDriveType(LPTSTR lpszRootPathName);
  
The GetDriveType function returns the type of drive identified by the lpszRootPathName parameter. Here are the possible return values:


Identifier	Meaning
	
0	Drive type can't be determined.
1	Root directory doesn't exist.
DRIVE_REMOVEABLE	Disk can be removed from the drive. This value is returned for floppy drives.
DRIVE_FIXED	Disk can't be removed from the drive. This value is returned for hard drives.
DRIVE_REMOTE	Drive is a remote drive. This value is returned for network drives.
DRIVE_CDROM	Drive is a CDROM drive.
DRIVE_RAMDISK	Drive is a RAM disk.

Aren't CDROMs wonderful? I highly recommend the Microsoft Press
Programmer's Bookshelf to any serious Win32 programmer. Anyway you
can call GetDriveType with a string like "D:\" to test whether a
drive is a CDROM. You can get the set of drives available to test
from GetLogicalDrives (GetLogicalDriveStrings is nicer, but not
implemented on Win95).

Colin.

-- Colin Peters - Saga Univ. Dept. of Information Science
-- colin@bird.fu.is.saga-u.ac.jp - finger for PGP public key
-- http://www.fu.is.saga-u.ac.jp/~colin/index.html
-- http://www.geocities.com/Tokyo/Towers/6162/

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".



More information about the Cygwin mailing list