Log in

View Full Version : Get cd/DVD Rom Device Name ?


Dark-Cracker
21st May 2004, 12:14
hi,

i am trying to get the cd or dvd drive device name (for exemple "Pioneer DVD-ROM DVD-106") like in the system property panel in winXP/Win98.

i have found that under winXP u need use the WMI function, but in fact i search a solution working under win98/XP (of course under win2K and win95 also).

i have try to search in the registry but it's a crap solution.

does someone have an idear on how to get a list of the c/dvd drive letter with the device name/description ?

i develop in vb6 but any suggestions are welcome.

Bye.

Nic
21st May 2004, 12:25
It's tricky AFAIK,

The only time I have ever done it was using the;
DeviceIoControl with the IOCTL_SCSI_GET_INQUIRY_DATA command,

But that will only work on 2K/XP you may need to goto ASPI commands for doing it on Win9x...

It's a pain in the neck really, if you find an easier way, be sure to post it back here...

-Nic

Dark-Cracker
21st May 2004, 16:14
thank u nic :)

i have made some test on the aspi function but unhappily i don't succeded to get the scsi device product/vendor string :(

with the inquiry stuct i can only get the description of the host adaptater (ATAPI and ASPI FOR WIN32).

i have look in some cpp source but without success.

if someone know which struct i need to get the info after i think i just need to use SC_EXEC_SCSI_CMD with a call on the SendASPI32CommandEx api to get the struct completed.

if someone have an idear feel free to post it :)

Bye.

Joe Fenton
21st May 2004, 22:18
DVDDecrypter gives you the model of the drive in its drive selector. Other CD/DVD software (like Nero) also do the same.

But I guess you mean how to get it in your own prgram. :D

That's a little different. Generally, the way most folks do it is via inquiry as mentioned in the other post. I've not seen it done any other way.

Dark-Cracker
22nd May 2004, 00:10
yes i am interested to add a same combo in my software but without resut for the moment :(

i have found an interesting link :

http://cvs.sf.net/viewcvs.py/bonkenc/bonkenc/cdrip/AspiCD.cpp?rev=1.5
and
http://cvs.sf.net/viewcvs.py/bonkenc/bonkenc/cdrip/Aspi.h?rev=1.5

but i have some probem to understand and translate it in vb.

i have try to translate the struct in vb and i have try to all the SendASPI32CommandEx api with this and SRB_ExecuteIO struct using the param :

SRB_ExecuteIO.SRB_BufPointer = my struct SCSI_INQUIRY_RESULT

SRB_ExecuteIO.SRB_Cmd = SCSI_CMD_INQUIRY (= 0x12)

but without result.
if someone have an idear of a better sample source code, feel free to post it :)

Bye.

UMP
23rd May 2004, 23:31
You'll find sample code in FairUse's source. Hope this helps.

jcsston
1st June 2004, 19:41
I tried using ASPI from VB before and found this site
http://www.hochfeiler.it/alvise/aspi_VB.htm
They have a wrapper .dll and sample code. :)

Dark-Cracker
1st June 2004, 21:08
unhappyly i don't succeded to obtain the name of the device :(

with vb and the wrapper i can access at the host adaptater name and all the info but i can't get the device vendor / product name :(

i have try to read the fairuse code but i am not really friendly with cpp.

so if someone (perhaps jcsston) know the vb code needed to get thes infomations, feel free to post them :)

Bye.

Dark-Cracker
29th June 2004, 18:54
humm just an other little question.

how can i find the drive letter once i get the host information.

for exemple i know that i have 2 drives :) E:\ and F:\
i found on the host [2:0:0] the PIONNER and on [2:1:0] the PLEXTOR.
but i can't say that the PIONNER is the E:\ drive and the PLEXTOR the F:\ drive because i could have change the letters order on my WinXP OS.

Bye.

thop
7th July 2004, 21:56
The drive letter is in SC_GET_DISK_INFO.


/***************************************************************************
** SRB - GET DISK INFORMATION - SC_GET_DISK_INFO
***************************************************************************/

typedef struct {
BYTE SRB_Cmd; // ASPI command code = SC_GET_DISK_INFO
BYTE SRB_Status; // ASPI command status byte
BYTE SRB_HaId; // ASPI host adapter number
BYTE SRB_Flags; // Reserved
DWORD SRB_Hdr_Rsvd; // Reserved
BYTE SRB_Target; // Target's SCSI ID
BYTE SRB_Lun; // Target's LUN number
BYTE SRB_DriveFlags; // Driver flags
BYTE SRB_Int13HDriveInfo; // Host Adapter Status <-- DRIVE LETTER
BYTE SRB_Heads; // Preferred number of heads translation
BYTE SRB_Sectors; // Preferred number of sectors translation
BYTE SRB_Rsvd1[10]; // Reserved
}
You will then have a number, and just need to add A to it to get the letter.