// ntddstor.h
// CTL_CODE(0x002d, 0x500, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_STORAGE_QUERY_PROPERTY 0x002D1400
View the official Windows Driver Kit DDI reference
// winioctl.h
// CTL_CODE(0x002d, 0x500, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_STORAGE_QUERY_PROPERTY 0x002D1400
View the official Win32 API reference
// winioctl.h
// CTL_CODE(0x002d, 0x500, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_STORAGE_QUERY_PROPERTY 0x002D1400
View the official Win32 API reference
No description available.
A driver can use IOCTL_STORAGE_QUERY_PROPERTY to return properties of a storage device or adapter. The request indicates the kind of information to retrieve, such as inquiry data for a device or 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.
Parameters.DeviceIoControl.InputBufferLength indicates the size, in bytes, of the parameter buffer at Irp->AssociatedIrp.SystemBuffer, which must be >= sizeof(STORAGE_PROPERTY_QUERY).
Irp->AssociatedIrp.SystemBuffer contains STORAGE_PROPERTY_QUERY data that specifies whether to query the device or the adapter, the type of query to perform, and any additional parameters required for the query, such as the page code for a particular SCSI mode sense page. Device properties must be retrieved only from a device; attempting to retrieve device properties from an adapter will cause an error.
Parameters.DeviceIoControl.OutputBufferLength indicates the number of bytes that can be written to Irp->AssociatedIrp.SystemBuffer. OutputBufferLength can be zero to determine whether a property exists without retrieving its data.
Parameters.DeviceIoControl.InputBufferLength indicates the size, in bytes, of the parameter buffer at Irp->AssociatedIrp.SystemBuffer, which must be >= sizeof(STORAGE_PROPERTY_QUERY).
The driver returns query data to the buffer at Irp->AssociatedIrp.SystemBuffer. Varying amounts of bus-specific data can be appended to the structure.
Cast the structure returned to a STORAGE_DESCRIPTOR_HEADER and check its Size member to determine the number of bytes the structure actually requires.
The Information field is set to the number of bytes returned. The Status field is set to STATUS_SUCCESS, or possibly to STATUS_INVALID_DEVICE_REQUEST, STATUS_INVALID_PARAMETER, or STATUS_NOT_SUPPORTED.
Windows applications can use IOCTL_STORAGE_PROTOCOL_COMMAND to conduct pass-through of protocol specific commands to the storage device or adapter. The request indicates the bus specific command which is further sent to a specific type of device to process. For more information, see the page on working with NVMe drives.
To perform this operation, call the DeviceIoControl function with the following parameters.
BOOL DeviceIoControl(
(HANDLE) hDevice, // handle to device
IOCTL_STORAGE_PROTOCOL_COMMAND, // dwIoControlCode
(LPDWORD) lpInBuffer, // input buffer
(DWORD) nInBufferSize, // size of input buffer
(LPDWORD) lpOutBuffer, // output buffer
(DWORD) nOutBufferSize, // size of output buffer
(LPDWORD) lpBytesReturned, // number of bytes returned
(LPOVERLAPPED) lpOverlapped // OVERLAPPED structure
);
Irp->IoStatus.Status is set to STATUS_SUCCESS if the request is successful.
Otherwise, Status to the appropriate error condition as a NTSTATUS code.
For more information, see NTSTATUS Values.
Windows applications can use this control code to return 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.
BOOL DeviceIoControl(
_In_ (HANDLE) hDevice, // handle to a partition
_In_ (DWORD) IOCTL_STORAGE_QUERY_PROPERTY, // dwIoControlCode
_In_ (LPVOID) lpInBuffer, // input buffer - STORAGE_PROPERTY_QUERY structure
_In_ (DWORD) nInBufferSize, // size of input buffer
_Out_opt_ (LPVOID) lpOutBuffer, // output buffer - see Remarks
_In_ (DWORD) nOutBufferSize, // size of output buffer
_Out_opt_ (LPDWORD) lpBytesReturned, // number of bytes returned
_Inout_opt_ (LPOVERLAPPED) lpOverlapped // OVERLAPPED structure
);
Irp->IoStatus.Status is set to STATUS_SUCCESS if the request is successful.
Otherwise, Status to the appropriate error condition as a NTSTATUS code.
For more information, see NTSTATUS Values.
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.