🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #4635

Re: Problem with DeviceIoControl() IOCTL_STORAGE_QUERY_PROPERTY

#4635
From: Kris
Date: Fri, 16 Dec 2005 01:35
56 lines
3019 bytes
Thank you for your response. 

The device path should be just fine. Microsoft's enumcd example
generates a device handle by using exactly the same device path as I
do. Since Microsoft's code perfectly works there's no doubt that
accomplishing this in this manner is indeed possible. It's just that
when porting it to C++ builder something apparently went wrong.

Nevertheless, I  tried your suggestion of using \\?\cdrom0 but this
resulted in the same failure (valid handle, but no
IOCTL_STORAGE_QUERY_PROPERTY success).

Unfortunately I really do require this specific call to be made since
I need to determine the EXACT bustype. An approximation of the bustype
can indeed be accomplished by looking at the devicepath :
e.g. \\?\ide#cdromhl-dt-st_dvd-rom_gdr8163b...
You'll also have entries with scsi or sbp2 (which is IEEE) and so on.
But unfortunately it is not accurate enough. E.g. there no
differentiation made between IDE(PATA) and (SATA).

That's why I need the IOCTL_STORAGE_QUERY_PROPERTY return data. It
contains a BusType field that nicely translates into this :
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;

By the way, here's how the DevicePath is obtained (both in my code and
in Microsoft's code). In turn the returned
InterfaceDetailData->DevicePath is used to create the handle to the
device.

status = SetupDiGetDeviceInterfaceDetail(
            hDevInfo,                 // Interface Device info handle
            &interfaceData,           // Interface data for the event
class
            interfaceDetailData,      // Interface detail data
            interfaceDetailDataSize,  // Interface detail data size
            &reqSize,                 // Buffer size required to get
the detail data
            &infoData                 // Interface device info
            );


Kris
Technical Details
Message-ID: <r764q1lobeoa0ssdsh3bvq26s1vilegtii@4ax.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <8b04q11n406hs1bonf8n9586mn3of3lqm3@4ax.com> <43a17435$1@newsgroups.borland.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: Thu, 15 Dec 2005 17:35:30 -0800
Message-ID: <r764q1lobeoa0ssdsh3bvq26s1vilegtii@4ax.com>
References: <8b04q11n406hs1bonf8n9586mn3of3lqm3@4ax.com> <43a17435$1@newsgroups.borland.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 1134657255 212.100.176.226 (15 Dec 2005 06:34:15 -0700)
Lines: 58
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail