如何检索使用Windows API的HD供应商/串口 [英] How to retrieve the HD vendor/serial using Windows API

查看:169
本文介绍了如何检索使用Windows API的HD供应商/串口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我说的是在物理磁盘驱动器,而不是卷/分区/逻辑驱动器。因此,通常,建议 GetVolumeInformation 的功能并不适用于我的情况。

I'm talking about the physical disk drive, not volume/partition/logical drive. So that usually-suggested GetVolumeInformation function is not applicable in my case.

要确切的说:我直接与尚未分区尚未磁盘工作。
我打开的句柄,它通过的CreateFile 功能:

To be exact: I'm working directly with the disk which has not been partitioned yet. I open a handle to it via CreateFile function:

hDisk = CreateFile(
    _T("\\\\.\\PHYSICALDRIVE0"),
    GENERIC_READ|GENERIC_WRITE,
    FILE_SHARE_READ|FILE_SHARE_WRITE,
    NULL,
    OPEN_EXISTING,
    FILE_FLAG_OVERLAPPED|FILE_FLAG_NO_BUFFERING,
    NULL);

我可以读/直接使用该手柄写到磁盘上。还有使用的DeviceIoControl 函数来查询各种磁盘性能的可能性。不过,我无法找到一个方法来查询磁盘供应商/串行性能,这是在设备管理器中可见。

I can read/write directly on the disk using this handle. There's also a possibility to query various disk properties using DeviceIoControl function. However I couldn't find a way to query the disk vendor/serial properties, which are visible in the device manager.

推荐答案

看看 DiskId32 。来源$ C ​​$ c是有也。我们的想法是使用 DFP_RECEIVE_DRIVE_DATA 的DeviceIoControl

Take a look at DiskId32. Source code is there also. The idea is to use DFP_RECEIVE_DRIVE_DATA with DeviceIoControl.

这篇关于如何检索使用Windows API的HD供应商/串口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆