Returns the properties of a storage device or adapter. The request indicates the kind of information to retrieve, such as the inquiry data for a device or the capabilities and limitations of an adapter. IOCTL_STORAGE_QUERY_PROPERTY can also be used to determine whether the port driver supports a particular property or which fields in the property descriptor can be modified with a subsequent change-property request.
A handle to the disk device from which partition information is retrieved. To retrieve a device handle, call the CreateFile function.
dwIoControlCode
The control code for the operation. Use IOCTL_STORAGE_QUERY_PROPERTY for this operation.
lpInBuffer
A pointer to a buffer that contains a STORAGE_PROPERTY_QUERY data structure that specifies the details about the query. Device properties must be retrieved only from a device; attempting to retrieve device properties from an adapter will cause an error.
nInBufferSize
The size of the input buffer, in bytes. It must be large enough to contain a STORAGE_PROPERTY_QUERY data structure.
lpOutBuffer
An optional pointer to a buffer that receives a structure that starts with the same fields as a STORAGE_DESCRIPTOR_HEADER data structure. For more information on the specific structures returned see the Remarks section.
nOutBufferSize
The size of the output buffer, in bytes. It can be zero to determine whether a property exists without retrieving its data. To do that, set this parameter to zero (0) and the QueryType member of the STORAGE_PROPERTY_QUERY input structure to PropertyExistsQuery (1). If the call to DeviceIoControl returns a nonzero value then the property exists.
lpBytesReturned
A pointer to a variable that receives the size of the data stored in the output buffer, in bytes.
If the output buffer is too small, the call fails, GetLastError returns ERROR_INSUFFICIENT_BUFFER, and lpBytesReturned is zero.
If lpOverlapped is NULL, lpBytesReturned cannot be NULL. Even when an operation returns no output data and lpOutBuffer is NULL, DeviceIoControl makes use of lpBytesReturned. After such an operation, the value of lpBytesReturned is meaningless.
If lpOverlapped is not NULL, lpBytesReturned can be NULL. If this parameter is not NULL and the operation returns data, lpBytesReturned is meaningless until the overlapped operation has completed. To retrieve the number of bytes returned, call GetOverlappedResult. If hDevice is associated with an I/O completion port, you can retrieve the number of bytes returned by calling GetQueuedCompletionStatus.
lpOverlapped
A pointer to an OVERLAPPED structure.
If hDevice was opened without specifying FILE_FLAG_OVERLAPPED, lpOverlapped is ignored.
If hDevice was opened with the FILE_FLAG_OVERLAPPED flag, the operation is performed as an overlapped (asynchronous) operation. In this case, lpOverlapped must point to a valid OVERLAPPED structure that contains a handle to an event object. Otherwise, the function fails in unpredictable ways.
For overlapped operations, DeviceIoControl returns immediately, and the event object is signaled when the operation is complete. Otherwise, the function does not return until the operation is complete or an error occurs.
Return Value
If the operation completes successfully, DeviceIoControl returns a nonzero value.
If the operation fails or is pending, DeviceIoControl returns zero. To get extended error information, call GetLastError.
Remarks
The optional output buffer returned through the lpOutBuffer parameter can be one of several structures depending on the value of the PropertyId member of the STORAGE_PROPERTY_QUERY structure pointed to by the lpInBuffer parameter. These values are enumerated by the STORAGE_PROPERTY_ID enumeration. If the QueryType member of the STORAGE_PROPERTY_QUERY is set to PropertyExistsQuery then no structure is returned.
Indicates whether the caller is requesting a device descriptor, an adapter descriptor, a write cache property, a device unique ID (DUID), or the device identifiers provided in the device's SCSI vital product data (VPD) page. For a list of the property IDs that can be assigned to this member, see STORAGE_PROPERTY_ID.
Value Meaning
StorageDeviceProperty
0
Indicates that the caller is querying for the device descriptor.
StorageAdapterProperty
1
Indicates that the caller is querying for the adapter descriptor.
StorageDeviceIdProperty
2
Indicates that the caller is querying for the device identifiers provided with the SCSI vital product data pages.
StorageDeviceUniqueIdProperty
3
Indicates that the caller is querying for the unique device identifiers.
StorageDeviceWriteCacheProperty
4
Indicates that the caller is querying for the write cache property.
StorageMiniportProperty
5
Indicates that the caller is querying for the miniport driver descriptor.
StorageAccessAlignmentProperty
6
Indicates that the caller is querying for the access alignment descriptor.
StorageDeviceSeekPenaltyProperty
7
Indicates that the caller is querying for the seek penalty descriptor.
StorageDeviceTrimProperty
8
Indicates that the caller is querying for the trim descriptor.
QueryType
Contains flags indicating the type of query to be performed as enumerated by the STORAGE_QUERY_TYPE enumeration.
Value Meaning
PropertyStandardQuery
0
Instructs the port driver to report a device descriptor, an adapter descriptor or a unique hardware device ID (DUID).
PropertyExistsQuery
1
Instructs the port driver to report whether the descriptor is supported.
AdditionalParameters
Contains an array of bytes that can be used to retrieve additional parameters for specific queries.
Remarks
The optional output buffer returned through the lpOutBuffer parameter of the IOCTL_STORAGE_QUERY_PROPERTY control code can be one of several structures depending on the value of the PropertyId member. If the QueryType member is set to PropertyExistsQuery, then no structure is returned.
Contains the size of this structure, in bytes. The value of this member will change as members are added to the structure.
Size
Specifies the total size of the descriptor, in bytes, which may include vendor ID, product ID, product revision, device serial number strings and bus-specific data which are appended to the structure.
DeviceType
Specifies the device type as defined by the Small Computer Systems Interface (SCSI) specification.
DeviceTypeModifier
Specifies the device type modifier, if any, as defined by the SCSI specification. If no device type modifier exists, this member is zero.
RemovableMedia
Indicates when TRUE that the device's media (if any) is removable. If the device has no media, this member should be ignored. When FALSE the device's media is not removable.
CommandQueueing
Indicates when TRUE that the device supports multiple outstanding commands (SCSI tagged queuing or equivalent). When FALSE, the device does not support SCSI-tagged queuing or the equivalent.
VendorIdOffset
Specifies the byte offset from the beginning of the structure to a null-terminated ASCII string that contains the device's vendor ID. If the device has no vendor ID, this member is zero.
ProductIdOffset
Specifies the byte offset from the beginning of the structure to a null-terminated ASCII string that contains the device's product ID. If the device has no product ID, this member is zero.
ProductRevisionOffset
Specifies the byte offset from the beginning of the structure to a null-terminated ASCII string that contains the device's product revision string. If the device has no product revision string, this member is zero.
SerialNumberOffset
Specifies the byte offset from the beginning of the structure to a null-terminated ASCII string that contains the device's serial number. If the device has no serial number, this member is 0xffffffff.
BusType
Specifies an enumerator value of type STORAGE_BUS_TYPE that indicates the type of bus to which the device is connected. This should be used to interpret the raw device properties at the end of this structure (if any).
RawPropertiesLength
Indicates the number of bytes of bus-specific data that have been appended to this descriptor.
RawDeviceProperties
Contains an array of length one that serves as a place holder for the first byte of the bus specific property data.
Remarks
An application can determine the required buffer size by issuing a IOCTL_STORAGE_QUERY_PROPERTY control code passing a STORAGE_DESCRIPTOR_HEADER structure for the output buffer, and then using the returned Size member of the STORAGE_DESCRIPTOR_HEADER structure to allocate a buffer of the proper size.
Requirements
Minimum supported client
Windows 2000 Professional
Minimum supported server
Windows 2000 Server
Header
WinIoCtl.h
STORAGE_BUS_TYPE Enumeration
Provides a symbolic means of representing storage bus types.
Syntax
typedef enum _STORAGE_BUS_TYPE {
BusTypeUnknown = 0x00,
BusTypeScsi = 0x1,
BusTypeAtapi = 0x2,
BusTypeAta = 0x3,
BusType1394 = 0x4,
BusTypeSsa = 0x5,
BusTypeFibre = 0x6,
BusTypeUsb = 0x7,
BusTypeRAID = 0x8,
BusTypeiScsi = 0x9,
BusTypeSas = 0xA,
BusTypeSata = 0xB,
BusTypeSd = 0xC,
BusTypeMmc = 0xD,
BusTypeVirtual = 0xE,
BusTypeFileBackedVirtual = 0xF,
BusTypeMax = 0x10,
BusTypeMaxReserved = 0x7F
} STORAGE_BUS_TYPE, *PSTORAGE_BUS_TYPE;
Constants
BusTypeUnknown
Indicates an unknown bus type.
BusTypeScsi
Indicates a SCSI bus type.
BusTypeAtapi
Indicates an ATAPI bus type.
BusTypeAta
Indicates an ATA bus type.
BusType1394
Indicates an IEEE 1394 bus type.
BusTypeSsa
Indicates an SSA bus type.
BusTypeFibre
Indicates a fiber channel bus type.
BusTypeUsb
Indicates a USB bus type.
BusTypeRAID
Indicates a RAID bus type.
BusTypeiScsi
Indicates an iSCSI bus type.
Windows Server 2003, Windows XP, and Windows 2000: This value is not supported.
BusTypeSas
Indicates a serial-attached SCSI (SAS) bus type.
Windows Server 2003, Windows XP, and Windows 2000: This value is not supported.
BusTypeSata
Indicates a SATA bus type.
Windows Server 2003, Windows XP, and Windows 2000: This value is not supported.
BusTypeSd
Indicates a secure digital (SD) bus type.
Windows Server 2003, Windows XP, and Windows 2000: This value is not supported.
BusTypeMmc
Indicates a multimedia card (MMC) bus type.
Windows Server 2003, Windows XP, and Windows 2000: This value is not supported.
BusTypeVirtual
Indicates a virtual bus type.
Windows Vista, Windows Server 2003, Windows XP, and Windows 2000: This value is not supported.
BusTypeFileBackedVirtual
Indicates a file-backed virtual bus type.
Windows Vista, Windows Server 2003, Windows XP, and Windows 2000: This value is not supported.