The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Ian_B on January 31, 2006, 12:47:02 AM

Title: API to test for CD/DVD drive?
Post by: Ian_B on January 31, 2006, 12:47:02 AM
Can anyone point me in the direction of an API that will test a volume and return if it's a CD or DVD drive, ie. read-only media? Or a strategy for determining this from a path or drive letter?

IanB
Title: Re: API to test for CD/DVD drive?
Post by: zooba on January 31, 2006, 12:52:57 AM
GetDriveType (http://msdn.microsoft.com/library/en-us/fileio/fs/getdrivetype.asp?frame=true)

UINT GetDriveType(
  LPCTSTR lpRootPathName
);


Return values:

DRIVE_UNKNOWN The drive type cannot be determined.
DRIVE_NO_ROOT_DIR The root path is invalid. For example, no volume is mounted at the path.
DRIVE_REMOVABLE The disk can be removed from the drive.
DRIVE_FIXED The disk cannot be removed from the drive.
DRIVE_REMOTE The drive is a remote (network) drive.
DRIVE_CDROM The drive is a CD-ROM drive.
DRIVE_RAMDISK The drive is a RAM disk.


I'm not 100% sure how it responds when there is no disk in the drive. The description seems to indicate that it will work, but the possibility of a DRIVE_NO_ROOT_DIR response makes me uncertain.

Cheers,

Zooba :U