Random value for disk Signature [closed]

烂漫一生 提交于 2019-12-08 05:46:22

问题


As part of a machine identification system, I'm looking for the Signature of the Win32_DiskDrive. On two customer's machines now, I've seen this field have a random value. I assume that is due to not having checked the HRESULT in the shipped code.

What would cause a machine to not have a valid signature?

WQL query: SELECT Caption, DeviceID, Signature, TotalSectors FROM Win32_DiskDrive

Update:

This has now been seen on 3 machines, one in China, one in Eastern Europe, and one in Canada. When I say it returns a random value, I mean it returns a different random value every time it is queried. Waiting on a customer to try diskpart and see what it says when the uniqueid is requested.


回答1:


I couldn't find a way to determine that the Signature was null.

My solution was to iterate through the partitions for the disk drive

wstring partionquery= L"ASSOCIATORS of {Win32_DiskDrive.DeviceID='";
partionquery += disk_deviceid;
partionquery += L"'} WHERE AssocClass = Win32_DiskDriveToDiskPartition";

Retrieve the Type value and see if it starts with "GPT" and if so, call DeviceIoControl with IOCTL_DISK_GET_PARTITION_INFO_EX. This provides the GUID signature of the GPT partition.

In my testing, each partition gives the same signature on a disk, and it matches the signature shown as the uniqueid in diskpart.



来源:https://stackoverflow.com/questions/13612067/random-value-for-disk-signature

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!