Arjen has asked for the wisdom of the Perl Monks concerning the following question:

Hi guys and gals, Anyone know how to get the TOC and ENTRY information on a windows box?

On linux you use:
my $CDROMREADTOCHDR=0x5305; my $CDROMREADTOCENTRY=0x5306; my $CDROM_MSF=0x02; sysopen (CD,$device, O_RDONLY | O_NONBLOCK); ioctl(CD, $CDROMREADTOCHDR, $tochdr);
But I can't get it to work on windows... any idea?

Tia

Arjen

Replies are listed 'Best First'.
RE: Windows CDROM TOC
by Corion (Patriarch) on Jul 12, 2000 at 12:12 UTC

    Windows also has ioctl(), but I guess that the magic values there are different. There is a CPAN module for CDDB queries which only works on the Macintosh, but maybe the author of it also uses "specialized" ioctl().

    There are definitive differences between Windows 9x and Windows NT regarding the driver model. If you want to talk to a device under Windows NT (and you have the correct set of rights), you have to use the full device name (like the one for the boot device) for it. Under Windows 9x, there are the "special" names of devices/device drivers. This is documented in the two DDKs, but I'm not aware of a side-by-side comparision of the differences.

    If you are looking for Win32 documentation, you might want to search for DeviceIoControl(), as that is how the Win32 API names this system call.

(jcwren) Re: Windows CDROM TOC
by jcwren (Prior) on Jul 12, 2000 at 16:50 UTC
    Alas, under Windows, ioctl() nor DeviceIoControl() are the calls your looking for (although DeviceIoControl() would be useful for loading and unloading the tray). The area to look at is mciSendCommand(), using MCI_STATUS_PARMS, and some of it's cousins. Here's a link to an article on Microsofts MSDN site about retrieving such information.

    I did some searching last night on the web and under MSDN about doing this, and have come to the conclusion that a Win32::CDROM module needs to be written. Since I'd like to take a shot at writing an XSUB module, this may be the perfect playground for it. If this doesn't turn into a GUP (Great Unfinished Project), I'll post the results here on PM.

    --Chris

    e-mail jcwren