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.
这里说的plug and play drivers 是什么驱动?即插即用?和storage有关系,是指的usb设备的吗?
还有在IOCTL_SCSI_GET_INQUIRY_DATA 说明里面,提到:
This IOCTL is for use with older host bus adapters. In Windows Server 2003 and later operating systems, the storage stack will reject this IOCTL and return an error.
//
You are tossing an exception because you are walking off the end of your output buffer. You only made it big enough for a STORAGE_DEVICE_DESCRIPTOR, and did not allocate any room (other than the one byte that is contained in the variable length array at RawDeviceProperties ) for the inquiry data such as the serial number.
Typically 1024 is big enough for the output buffer.