Archive: EnumCDs with Adapter and ID


EnumCDs with Adapter and ID
  Making an installation for another program I found the need of knowing how many cd drives are in the system, and which Adapter and ID use. Can this be known in some way?

Thanks


This one enumerates all CDs on the system:
http://nsis.sourceforge.net/archive/....php?pageid=82

I know how to get the serial number of the drive but have no idea how to get the adapater. If you find something about it in the internet I can help you write the plug-in.


ok, I'll search a bit.

Thanks


In a ASPI document I found this example.

This example scans the system for all CD-ROM drives (all targets must be at LUN #0). Please note that MAX_HA_ID and MAX_TARGET_ID should be replaced with a host adapter count returned by etASPI32SupportInfo and a target count retrieved from a SC_HA_INQUIRY SRB performed within the host adapter loop.
I also found that I could check all host/adapter pairs with the command SC_GET_DEV_TYPE and check if the device type is DTYPE_CDROM.

I asked kichik and he doesn't know how to deal with ASPI, can anybody else help me?

Thanks

Check this site:

http://www.hochfeiler.it/alvise/ASPI_1.HTM

If you need help with programming, PM me

good luck
Ramon


Dear n0On3,

Check attachment application I made and let me know if you think it is what you need,

If yes I can make the plugin using the code code, to return how many CD-ROMs found, which SCSI IDs and adapters Numbers

bye
Ramon


Thanks for your help.

I need the "100" string in the stack when the Adapter is 1 and the ID 0. I don't know what the last zero means.

I have the idea to pop in a loop until "NoMoreCDRoms" is found.

so the stack would be:

100
010
020
NoMoreCDRoms
...
...
[whatever there was in the stack before the plugin]

I attach a snapshot that shows differences with your program numbers and what I need.

I don't know how this program writes a cdrom in the ID = 200. But if the dll works with low numbers it's enough for me. At least, I always seen CDRoms in low numbers.


Hi,

you can forget the "lun X" numbers, this was just for debug, coze it was my first tests with ASPI.

My idea was the following:

you call something like:

ASPIInfo::GetCDRoms /CDROM

then the stack would be (eg: for 3 CDRoms):

"3" -> number of CDRoms found
"1" -> 1º CDRom Adapter ID
"0" -> 1º CDRom ID
"1" -> 2º CDRom Adapter ID
"1" -> 2º CDRom ID
"1" -> 3º CDRom Adapter ID
"2" -> 3º CDRom ID

what do you think?


PS: What do you mean by : "...writes a cdrom in the ID = 200..."

cyas
Ramon


yes, this format is ok. But I suggest adding some dummy string to know when there are no more cdroms numbers in the stack.

PS: What do you mean by : "...writes a cdrom in the ID = 200..." <- You asked me in a pm which limits has that ID number. And I wanted that I don't know. Just do what you think is ok, because all IDs I've seen are one digit.


Thanks for you help


Hi,

You must detect if there are more CDRoms or no using the top of stack, this way

...

push $2
push$1
push$0
ASPIInfo
::GetCDRoms /CDROM
pop$0 ; -> retrieve how many CDRoms
DO_LOOP:
IntCmp $0 0 END_LOOP
pop$1 ; -> retrieve Adapter
pop$2 ; -> retrieve ID
DetailPrint "Adapter = $1, ID = $2"
IntOp $0 $0 - 1
goto DO_LOOP
END_LOOP:
pop $0
pop$1
pop$2
>...
btw, do you need the CDRom/Hardware String Identifier (eg. my DVD combo string is : "TOSHIBA DVD-ROM SD-C2402")?

br,
Ramon:p

Ok, this format is ok.

I don't particularly need the String Identifier as much as I need the adapter/host, but it would be nice to have it :)


Hi,

So the new code in your script with support for "CDRom/Hardware String Identifier" would be:

...

push $3
push$2
push$1
push$0
ASPIInfo
::GetCDRoms /CDROM
pop$0 ; -> retrieve how many CDRoms
DO_LOOP:
IntCmp $0 0 END_LOOP
pop$1 ; -> retrieve Adapter
pop$2 ; -> retrieve ID
pop$3 ; -> retrieve CDRom/Hardware String
DetailPrint "Adapter = $1, ID = $2, CD-ROM Name = $3"
IntOp $0 $0 - 1
goto DO_LOOP
END_LOOP:
pop $0
pop$1
pop$2
pop$3
>...
When I have this completed I will reply again,

Good bye
Ramon

ok, I'll be waiting ;)


Hi,

I found some problems under win9X, you have to wait a little more, sorry

WinNT/2000/XP is working good :)

cyas
Ramon


Don't worry, I can wait. It's great seeing that your are testing with win9x aswell:up: