Article View: borland.public.cppbuilder.nativeapi
Article #4654Re: Problem with DeviceIoControl() IOCTL_STORAGE_QUERY_PROPERTY
From: Kris
Date: Fri, 16 Dec 2005 20:38
Date: Fri, 16 Dec 2005 20:38
61 lines
3449 bytes
3449 bytes
Thanks to everyone's suggestions I finally got the
IOCTL_STORAGE_QUERY_PROPERTY-call working. However, the results are a
bit disappointing. As mentioned earlier my goal was to determine the
EXACT bus type.
Initially the STORAGE_BUS_TYPE enumerator returned by
IOCTL_STORAGE_QUERY_PROPERTY looked very promising (i.e. it offers a
large variety of bus types) :
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/storage/hh/storage/structs-general_0266117e-e310-4db5-82c5-568b178c03fc.xml.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/storage/hh/storage/structs-general_196c7640-0a2d-4567-8958-1244c46b84a6.xml.asp
typedef enum _STORAGE_BUS_TYPE {
BusTypeUnknown = 0x00,
BusTypeScsi,
BusTypeAtapi,
BusTypeAta,
BusType1394,
BusTypeSsa,
BusTypeFibre,
BusTypeUsb,
BusTypeRAID,
BusTypeiSCSI,
BusTypeSATA,
BusTypeSAS,
BusTypeMaxReserved = 0x7F
} STORAGE_BUS_TYPE, *PSTORAGE_BUS_TYPE;
However, when I execute the code it still isn't e.g. able to
distinguish between SATA and ATA. I wasn't yet able to test it on a
SATA removable storage device but instead I tried it with a hard disc
(I will try a SATA removable storage device later on today, as I
currently don't have one available, but I have no reason to expect the
behaviour will be different).
Anyway, instead of enumerating the GUID_DEVINTERFACE_CDROM devices I
enumerated the GUID_DEVINTERFACE_DISK in order to get hard discs.
For my SATA hard disc I get this :
DEVICE01::DevicePath =
\\?\ide#diskwdc_wd1600jd-22hbb0_____________________08.02d08#4457572d414d384c333138393733_030_0_0_0_0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}
DEVICE01::SptiHandle = 0x00A4
DEVICE01::BusType = ATA (STORAGE_BUS_TYPE=3)
So basically this IOCTL_STORAGE_QUERY_PROPERTY is unable to recognize
SATA and simply reports ATA. Which isn't wrong but it also isn't
detailled enough especially if you consider that a BusTypeSATA does
exist in the enum.
In fact, it has the same accuracy as the method I initially employed.
This method consisted out of interpreting the device path :
DevicePath=\\?\ide#......=> ATA
DevicePath=\\?\spb2#.....=> IEEE
DevicePath=\\?\usbstor#..=> USB
DevicePath=\\?\scsi#.....=> SCSI
I welcome anyone who has any ideas on how to really benefit from the
wealth of bus types that STORAGE_BUS_TYPE has to offer.
Thank you,
Kris
Technical Details
Message-ID:
<ou86q1tiik2rplgfs7gdoo6itfdd6e9c3d@4ax.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newscon06.news.prodigy.com!newscon02.news.prodigy.com!prodigy.net!nx02.iad01.newshosting.com!newshosting.com!news-out.newsfeeds.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<8b04q11n406hs1bonf8n9586mn3of3lqm3@4ax.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,f7af8c8a3ab6155a X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: Kris <no.email@mail.nl> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: Problem with DeviceIoControl() IOCTL_STORAGE_QUERY_PROPERTY Date: Fri, 16 Dec 2005 12:38:42 -0800 Message-ID: <ou86q1tiik2rplgfs7gdoo6itfdd6e9c3d@4ax.com> References: <8b04q11n406hs1bonf8n9586mn3of3lqm3@4ax.com> X-Newsreader: Forte Free Agent 3.1/32.783 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 212.100.176.226 X-Trace: newsgroups.borland.com 1134725846 212.100.176.226 (16 Dec 2005 01:37:26 -0700) Lines: 61 Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newscon06.news.prodigy.com!newscon02.news.prodigy.com!prodigy.net!nx02.iad01.newshosting.com!newshosting.com!news-out.newsfeeds.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail