我通过deviceiocontrol读取了STORAGE_DEVICE_DESCRIPTOR 这个结构,该如何去取得其序列号呢?(100分)

  • 主题发起人 主题发起人 xy_c
  • 开始时间 开始时间
X

xy_c

Unregistered / Unconfirmed
GUEST, unregistred user!
详细如下:<br>type<br>&nbsp; &nbsp; &nbsp; _STORAGE_DEVICE_DESCRIPTOR &nbsp; = &nbsp; record<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Version: &nbsp; LongInt; &nbsp; // &nbsp; 版本<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Size: &nbsp; LongInt; &nbsp; // &nbsp; 结构大小<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DeviceType: &nbsp; Char; &nbsp; // &nbsp; 设备类型<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DeviceTypeModifier: &nbsp; Char; &nbsp; // &nbsp; SCSI-2额外的设备类型<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RemovableMedia: &nbsp; BOOLEAN; &nbsp; // &nbsp; 是否可移动<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CommandQueueing: &nbsp; BOOLEAN; &nbsp; // &nbsp; 是否支持命令队列<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; VendorIdOffset: &nbsp; LongInt; &nbsp; // &nbsp; 厂家设定值的偏移<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ProductIdOffset: &nbsp; LongInt; &nbsp; // &nbsp; 产品ID的偏移<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ProductRevisionOffset: &nbsp; LongInt; &nbsp; // &nbsp; 产品版本的偏移<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SerialNumberOffset: &nbsp; LongInt; &nbsp; // &nbsp; 序列号的偏移<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BusType: &nbsp; STORAGE_BUS_TYPE; &nbsp; // &nbsp; 总线类型<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RawPropertiesLength: &nbsp; longInt; &nbsp; // &nbsp; 额外的属性数据长度<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RawDeviceProperties: &nbsp; array[1..1] &nbsp; of &nbsp; Char; &nbsp; // &nbsp; 额外的属性数据(仅定义了象征性的1个字节)<br>&nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; STORAGE_DEVICE_DESCRIPTOR &nbsp; = &nbsp; _STORAGE_DEVICE_DESCRIPTOR;<br>&nbsp; &nbsp; &nbsp; PSTORAGE_DEVICE_DESCRIPTOR &nbsp; = &nbsp; ^STORAGE_DEVICE_DESCRIPTOR;<br><br><br>&nbsp;pDevDesc: &nbsp; PSTORAGE_DEVICE_DESCRIPTOR; &nbsp;<br><br>&nbsp; &nbsp; &nbsp; &nbsp; DeviceIoControl(hDevice, &nbsp; // &nbsp; 设备句柄<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IOCTL_STORAGE_QUERY_PROPERTY, &nbsp; // &nbsp; 取设备属性信息<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @Query, &nbsp; sizeof(STORAGE_PROPERTY_QUERY), &nbsp; // &nbsp; 输入数据缓冲区<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pDevDesc, &nbsp; pDevDesc.Size, &nbsp; // &nbsp; 输出数据缓冲区<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dwOutBytes, &nbsp; // &nbsp; 输出数据长度<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nil);<br>上面的代码读取了STORAGE_DEVICE_DESCRIPTOR,也可取得该结构中的DeviceType值,我想问如何取得其serialnumber,因为<br>该结构中定义的是serialnumberoffset。谢谢
 
后退
顶部