c++ - How to retrieve the HD vendor/serial using Windows API -
I'm talking about the physical disk drive, no volume / segmentation / logical drive . That's because - GetVolumeInformation
function is not applicable in my case.
To be precise: I am working directly with the disk which has not yet split. I open it a handle via CreateFile
function:
hDisk = CreateFile (_T ("\\\. \ ... PHYSICALDRIVE0"), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ I FILE_SHARE_WRITE, NOUL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED | FILE_FLAG_NO_BUFFERING, NULL);
I can read / write directly to disk using this handle. There is also the possibility of querying different disk properties using the DeviceIoControl
function. Although I can not find a way to query disc vendor / serial properties, which are visible in Device Manager.
Take a look at the source code DFP_RECEIVE_DRIVE_DATA
to DeviceIoControl < / Code>.
Comments
Post a Comment