There are many ways to do this, since DVDs have several interfaces for this, due to issues with past and backward compatibility.
You can send the IOCTL_SCSI_PASSTHROUGH_DIRECT command to the DVD drive (for it, this will be a handle to the physical device). With it, you issue SCSI commands to which the disk will respond. You can read session information, disk drive information, and more. I believe dvd + rw-mediainfo.exe is causing these problems.
Unfortunately, the interface is a bit complicated and unclear, as this is a team within a team. Th Passthrough has a byte buffer, you will need to fill in the command structure.
Or you can call IOCTL_CDROM_READ_TOC_EX: http://www.osronline.com/ddkx/storage/k306_2cs2.htm
I also believe that the exact set of IOCTL / commands that will work depends on the disk and its strength.
Old disks will not support new interfaces, and some of the new disks will not support obsolete interfaces.
Thus, some libraries and tools can use one or more of these interfaces.
The coincidence of the old sessons is all pretty dirty, indeed, since most OSs don't care about them, only the very latest.
Dominik weber
source share