We help IT Professionals succeed at work.

IOCTL_STORAGE_QUERY_PROPERTY

Hello,
anybody here who has experience with  IOCTL_STORAGE_QUERY_PROPERTY? I tried a call with _STORAGE_ADAPTER_DESCRIPTOR to get PIO mode. But this always return FALSE, even if I disable DMA in Device Manager.
On XP  it works well but on Windows 7 always FALSE. Any idea, suggestion?

Ingo
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2012
Commented:
Take a look at the following snippet:
/********************************************************
*
* FUNCTION: GetDisksProperty(HANDLE hDevice, 
* PSTORAGE_DEVICE_DESCRIPTOR pDevDesc)
*
* PURPOSE: get the info of specified device
*
******************************************************/
BOOL GetDisksProperty(HANDLE hDevice, 
  PSTORAGE_DEVICE_DESCRIPTOR pDevDesc)
{
 STORAGE_PROPERTY_QUERY Query; // input param for query

 DWORD dwOutBytes; // IOCTL output length
 BOOL bResult; // IOCTL return val

 // specify the query type

 Query.PropertyId = StorageDeviceProperty;
 Query.QueryType = PropertyStandardQuery;

 // Query using IOCTL_STORAGE_QUERY_PROPERTY 

 bResult = ::DeviceIoControl(hDevice, // device handle
 IOCTL_STORAGE_QUERY_PROPERTY, // info of device property
  &Query, sizeof(STORAGE_PROPERTY_QUERY), // input data buffer
  pDevDesc, pDevDesc->Size, // output data buffer
  &dwOutBytes, // out's length
  (LPOVERLAPPED)NULL); 

 return bResult;
}

Open in new window


The code is from http://www.codeproject.com/KB/winsdk/usbdisks.aspx ("How To get the usbdisk's drive letter properly"), the rest of the source code might be helpful as well.

Commented:
Only Plug and Play drivers can issue IOCTL_STORAGE_QUERY_PROPERTY requests. Legacy drivers should use IOCTL_SCSI_GET_INQUIRY_DATA and IOCTL_SCSI_GET_CAPABILITIES to get inquiry and capabilities data.

From http://msdn.microsoft.com/en-us/library/windows/hardware/ff560590%28v=vs.85%29.aspx