It also means we have to care if the drive is SATA, IDE, etc. So if we can’t use GetVolumeInformation() and we can’t rely on WMI 100% of the time, what can we do? Well, it involves querying several sources of information on a system directly. The reason is that this property is optionally defined by the manufacturer and must be supplied by the hard disk driver. Interestingly enough, this won’t work 100% of the time. Notice also that it recommends to use the WMI Win32_Physical Media property “SerialNumber” to obtain the manufacturer’s serial. To programmatically obtain the hard disk’s serial number that the manufacturer assigns, use the Windows Management Instrumentation (WMI) Win32_PhysicalMedia property SerialNumber. This function returns the volume serial number that the operating system assigns when a hard disk is formatted. The problem is that this is not the serial number printed on the hard drive and assigned by the manufacturer, but is (according to the MSDN documentation): Some people recommend using the GetVolumeInformation API function. It’s surprisingly a non-trivial issue to retrieve the manufacturer’s information from a hard drive.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |