The drive name of a CD drive can be anything from A-Z, not just D,E,F or G, moreover there can be more than one cd drive in a machine. If the installer program is started from the CD or DVD then you should determine the full path of your the installer executable and you get the answer immediately. If your installer is started from a different location than the packages (but why would someone do it like this???) for example from the hard drive then you have to search through all CD/DVD drivers for the installer packages. However I wouldn't restrict installation just from CD/DVD drives, sometimes it comes handy if you can install something from local packages.
To get the list of drives in the system use
GetLogicalDriveStrings()[
^] or
GetLogicalDrives()[
^].
To get the type of a drive use
GetDriveType()[
^].