PDA

View Full Version : Detecting CD Type In Drive


Nic
11th April 2005, 10:50
I need to detect what type of compact disc (i.e. CD, CD-R, CD-RW) is in the CD Writer drive (on WinXP) and I can't figure out how to do it.

Does anyone know? Or at least know which documentation to look at to know how to do it? Maybe my googling skills aren't working, but I can't find anything.

Thanks for any help/suggestions :)

Cheers,
-Nic

Koepi
11th April 2005, 11:15
I think you need to request such information from the drive via aspi:

ftp://delphi-jedi.org/api/scsi.zip
http://www.hochfeiler.it/alvise/ASPI_1.HTM

A starter would be coding such an app: http://www.grc.com/tip/id.htm (man, i hate that FUD GRC-guy).

Cheers
Koepi

Nic
11th April 2005, 11:56
Looking through the cdrdao code helped. Would appear that command I need is 0x51. Still tricky though...

-Nic

ps
Currently using this link to help me further:
http://www.hochfeiler.it/alvise/ASPI_0.HTM

dragongodz
11th April 2005, 12:36
of course WinXP doesnt come with ASPI but STPI. :)

Nic
11th April 2005, 12:37
Yup, but ASPI support normally just means supplying WNASPI32.dll and maybe a minor registry change. I can deal with that :)

Isn't it relatively easy to convert ASPI commands into DeviceIoControl ones...Hmmm. Think I remember VStrip does it, I'll look and see.

EDIT:
Not, VStrip, but:
http://cvs.sf.net/viewcvs.py/bonkenc/bonkenc/cdrip/NTScsi.cpp?rev=1.2
Is a good starting place.

EDIT2: Ok, all is cool. I can do it with ASPI command 0x51. And if I need to do it without ASPI there is a nice ASPIEMU at Dr Dobbs which is easy to pick apart, rewrite and use.

Koepi
11th April 2005, 16:17
I wonder what kind of application you build now again :-)

"Nic's DVD2SVCD"? With everything included from decss'ing, transcoding and burning to CD-R? ;)

Nic
11th April 2005, 16:55
Sadly no :( This is for work. Still, it's all interesting :)

After a bit of hacking, (that original aspiemu code can't ever have worked?! Didn't even check for NT properly). I've created a nice wrapper DLL replacement for WNASPI32.DLL that if on Win9X will use WNASPI32.DLL (if available) or if on NT uses SPTI.

I'll post it and the code if anyone ever needs it. Handy :)

-Nic

edit:
Useful for command codes:
http://linux.yyz.us/sata/devel.html

dragongodz
11th April 2005, 17:01
you can understand though with all the different projects you start how people shudder when you ask about something new. :D