Controlling a CD/DVD drive

Windows specific questions.
Post Reply
Psyche_Demon
Posts: 46
Joined: Jul 30, 2015 8:07
Location: England
Contact:

Controlling a CD/DVD drive

Post by Psyche_Demon »

Hi there.
I have been working all day on trying to write useful wrappers that will allow me to retrieve information about, and control, system devices. At the moment I'm concentrating on storage.
I have found several topics on MSDN and other sites regarding accessing standard storage devices (fixed and removable media), but very little information about the CD drive. Even for opening and closing the tray I have only found definitive answers in reference to the mciSendString/mciSendCommand functions. Using DeviceIOControl, the internet seems uncertain whether to open a CD tray by accessing it as a standard volume, or using the IOCTL_CDROM definitions from ntddcdrm.h - a file which incidentally seems to exist in earlier Windows Driver Developer Kits (DDK), which is now the Windows Driver Kit, and which seems not to be translated into FB.
It does appear, though, that using the CDROM control codes does offer more flexibility when accessing a CD drive, such as for example setting the speed. I can't seem to find any other reference to that anywhere.
Does anyone here have any ideas as to what the status quo is with these APIs? Also which API would you use for data and audio access, reading from and writing to optical media?
Thanks.
grindstone
Posts: 862
Joined: May 05, 2015 5:35
Location: Germany

Re: Controlling a CD/DVD drive

Post by grindstone »

...and which seems not to be translated into FB.
Of course it is, although maybe only partly.

Go to http://www.freebasic.net/forum/viewtopic.php?t=23622, download and unpack the zip - file and look for "cdrom_ioctl.bi".
Last edited by grindstone on Jan 04, 2017 10:01, edited 1 time in total.
Psyche_Demon
Posts: 46
Joined: Jul 30, 2015 8:07
Location: England
Contact:

Re: Controlling a CD/DVD drive

Post by Psyche_Demon »

Hi there,
I stand corrected - thanks. Do you happen to know whether this is still the official standard method of communicating with CD drives?
grindstone
Posts: 862
Joined: May 05, 2015 5:35
Location: Germany

Re: Controlling a CD/DVD drive

Post by grindstone »

I don't know. The only thing I ever did by myself via FB is to open and close the tray using mciSendString. For any other CD - operations I use a nice little command line program called "cdrdao".

But it seems to me that both the mciSendString and the IOCTL_ method will work fine once you found out how to use it.
Post Reply