News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

DeviceIoControl Vendor name

Started by ragdog, February 27, 2010, 01:42:28 AM

Previous topic - Next topic

ragdog

Hi

How can get via DeviceIoControl the vendor name or other information drive letter etc...

with
STORAGE_DEVICE_DESCRIPTOR?

Thanks in forward

Siekmanski

Hi Ragdog

You allready have the solution to this question, it's in the CDTEXT reading sources I send you not so long ago.

Look at "SCSI_INQUIRY" it's in this proc.

CDROM_Name proc
   invoke   InitSCSIcommand,6,addr SCSI_Buffer,100,SENSE_LEN_SPTI,SCSI_IOCTL_DATA_IN

   mov      eax,CommandDescriptor
   mov      byte ptr [eax+0],012h    ; SCSI_INQUIRY
   mov      byte ptr [eax+4],100

   invoke   SendSCSIcommand
   ret
CDROM_Name endp

And the driveletter in this proc.

Find_cdroms proc
local DriveNumber:dword

   mov      DRIVE_Count,0

   lea      edi,DRIVE_Info
   lea      ebx,DriveNumber
   mov      dword ptr [ebx],05C3A43h   ; "C:\",0

   .while   byte ptr [ebx] <= "Z"
      invoke GetDriveType,ebx
      .if   eax == DRIVE_CDROM                                                  ; Here the drivetype you want ( cdrom harddisk cardreader etc.)
         invoke   RtlZeroMemory,edi,sizeof DRIVE_INFORMATION
         mov   eax,[ebx]
         mov   byte ptr [edi].DRIVE_INFORMATION.SCSI_Drive,al
         inc   DRIVE_Count
         add   edi,sizeof DRIVE_INFORMATION
                                .endif
      inc byte ptr [ebx]
   .endw

   etc.....
   ret
Find_cdroms endp



ragdog

Yes i study your source

I think it gives a other way with IOCTL_STORAGE_QUERY_PROPERTY

Or is this wrong?

Siekmanski

No, but then you still don't know the drivenumber (C:/ etc.....) in combination with the device.

With "SCSI_INQUIRY_DATA" and "GetDriveType" you have it all

Look at: http://www.t10.org/drafts.htm and search for spc2r20.pdf at page 82 you can find all the info for INQUIRY data format.


fearless

ƒearless

Siekmanski

Hi

Let me show you guys how I did it some years ago when I wanted to read CDTEXT from an AUDIOCD with CDTEXT.
I use SPTI here..



Here is the info you get from this proggy of an AUDIOCD with CDTEXT:

Siekmanski's SPTI CD-reader test 2006

CD-Roms found: 4

Aspi manager: SIEKMANSKI SPTI32
Adapter type: SCSI adapter

SCSI-INFO   : Ha:0 Id:0 Lun:0
CD/DVD-INFO : F:\ TSSTcorp DVD-ROM SH-D162D SB00           ;  DriveLetter , Vendor_ID , Product_Id , Product_Revision

DeviceCapabilities: 3fH

Track Total: 19

Track: 1 LBA:     0  4:31:12  Audio: YES Copy permitted: YES Qsub-chan: 1
Track: 2 LBA: 20337  3:09:65  Audio: YES Copy permitted: YES Qsub-chan: 1
Track: 3 LBA: 34577  5:05:00  Audio: YES Copy permitted: YES Qsub-chan: 1
Track: 4 LBA: 57452  3:03:65  Audio: YES Copy permitted: YES Qsub-chan: 1
Track: 5 LBA: 71242  4:04:35  Audio: YES Copy permitted: YES Qsub-chan: 1
Track: 6 LBA: 89577  5:31:42  Audio: YES Copy permitted: YES Qsub-chan: 1
Track: 7 LBA:114444  1:44:28  Audio: YES Copy permitted: YES Qsub-chan: 1
Track: 8 LBA:122272  4:22:17  Audio: YES Copy permitted: YES Qsub-chan: 1
Track: 9 LBA:141939  5:09:13  Audio: YES Copy permitted: YES Qsub-chan: 1
Track:10 LBA:165127  4:57:50  Audio: YES Copy permitted: YES Qsub-chan: 1
Track:11 LBA:187452  3:44:32  Audio: YES Copy permitted: YES Qsub-chan: 1
Track:12 LBA:204284  3:28:00  Audio: YES Copy permitted: YES Qsub-chan: 1
Track:13 LBA:219884  5:35:53  Audio: YES Copy permitted: YES Qsub-chan: 1
Track:14 LBA:245062  4:55:70  Audio: YES Copy permitted: YES Qsub-chan: 1
Track:15 LBA:267257  3:49:50  Audio: YES Copy permitted: YES Qsub-chan: 1
Track:16 LBA:284482  4:05:00  Audio: YES Copy permitted: YES Qsub-chan: 1
Track:17 LBA:302857  4:01:45  Audio: YES Copy permitted: YES Qsub-chan: 1
Track:18 LBA:320977  3:46:70  Audio: YES Copy permitted: YES Qsub-chan: 1
Track:19 LBA:337997  3:44:05  Audio: YES Copy permitted: YES Qsub-chan: 1

LBA:354802 Total time 78:50:52

CD-TEXT:

CDTEXT Data length: 704 bytes

Album Artist: Talking Heads
Album Title : The Name Of This Band Is Talking Heads CD1

Track  1 : Heaven
Track  2 : New Feeling
Track  3 : A Clean Break (Let's Work)
Track  4 : Don't Worry About The Government
Track  5 : Pulled Up
Track  6 : Psycho Killer
Track  7 : Who Is It
Track  8 : The Book I Read
Track  9 : The Big Country
Track 10 : I'm Not In Love
Track 11 : The Girls Want To Be With The Girls
Track 12 : Electricity (Drugs)
Track 13 : Found a Job
Track 14 : Mind
Track 15 : Artists Only
Track 16 : Stay Hungry
Track 17 : Air
Track 18 : Love -] Building On Fire
Track 19 : Memories (Can't Wait)

CD-TEXT Raw dump:

80000000H 54686520H 4e616d65H 204f6620H b9a6H
8000010cH 54686973H 2042616eH 64204973H 2795H
8000020fH 2054616cH 6b696e67H 20486561H ee1eH
8000030fH 64732043H 44310048H 65617665H 5197H
80010405H 6e004e65H 77204665H 656c696eH 70b7H
8002050aH 67004120H 436c6561H 6e204272H 8472H
8003060aH 65616b20H 284c6574H 27732057H abfbH
8003070fH 6f726b29H 00446f6eH 27742057H d574H
80040807H 6f727279H 2041626fH 75742054H ce86H
8004090fH 68652047H 6f766572H 6e6d656eH 4ad5H
80040a0fH 74005075H 6c6c6564H 20557000H 78acH
80060b00H 50737963H 686f204bH 696c6c65H 155eH
80060c0cH 72005768H 6f204973H 20497400H 0befH
80080d00H 54686520H 426f6f6bH 20492052H df84H
80080e0cH 65616400H 54686520H 42696720H 9377H
80090f08H 436f756eH 74727900H 49276d20H 54d4H
800a1004H 4e6f7420H 496e204cH 6f766500H b101H
800b1100H 54686520H 4769726cH 73205761H 4af3H
800b120cH 6e742054H 6f204265H 20576974H 6facH
800b130fH 68205468H 65204769H 726c7300H 85a5H
800c1400H 456c6563H 74726963H 69747920H 6173H
800c150cH 28447275H 67732900H 466f756eH 5709H
800d1604H 64206120H 4a6f6200H 4d696e64H 66b8H
800e1704H 00417274H 69737473H 204f6e6cH a4b9H
800f180bH 79005374H 61792048H 756e6772H 4c9cH
8010190aH 79004169H 72004c6fH 7665202dH 118cH
80121a06H 5d204275H 696c6469H 6e67204fH 026bH
80121b0fH 6e204669H 7265004dH 656d6f72H 1b89H
80131c05H 69657320H 2843616eH 27742057H 2db7H
80131d0fH 61697429H 00000000H 00000000H 0342H
81001e00H 54616c6bH 696e6720H 48656164H bdb7H
81001f0cH 73003139H 00303100H 30320030H fb36H
81042001H 33003034H 00303500H 30360030H dd12H
81082101H 37003038H 00303900H 31300031H 7d96H
810c2201H 31003132H 00313300H 31340031H 02c7H
81102301H 35003136H 00313700H 31380000H 4f52H
8f002400H 00011300H 1e060000H 00000000H 116eH
8f012500H 00000000H 00000003H 26000000H c566H
8f022600H 00000000H 09000000H 00000000H 0cecH
CD-TEXT dump written...


CD/DVD at drive F: Closed...

CD/DVD at drive G: Closed...

CD/DVD at drive L: Closed...

CD/DVD at drive M: Closed...