Displaying all attached SCSI devices

Hi,

I'm writing a program that accesses attached SCSI devices. As part of the program I wish to enumerate all such devices, including HDDs, optical drives and USB drives. I'm currently doing so by calling DeviceIoControl() to return a buffer, and then displaying the details of the drives based on the STORAGE_DEVICE_DESCRIPTOR. This is similar to the diskid32.cpp code which can be found at http://www.winsim.com/diskid32/diskid32.cpp

Anyway, the code only seems to detect USB and fixed HDDs, but not optical drives. I also can't figure out how to extract the details of the STORAGE_DEVICE_DESCRIPTOR structure. The diskid32.cpp only displays vendor/product ID and serial number, but not the rest of the SCSI inquiry return structure, which has additional data such as device type, removable drive, command queueing, etc.

How can I detect optical drives, and how can I extract these data?

Thanks.
[948 byte] By [galapogos] at [2007-11-20 11:37:51]