Random value for disk Signature

As part of the machine identification system, I am looking for a signature on Win32_DiskDrive. On two client machines, now I saw that this field has a random value. I assume this is because I did not check HRESULT in the submitted code.

What can cause a car to not have a valid signature?

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

Update:

This can now be seen on three cars, one in China, one in Eastern Europe and one in Canada. When I say that it returns a random value, I mean that it returns a different random value each time it is requested. Waiting for the client to try diskpart and see what it says when the identifier is requested.

+1
source share
1 answer

I could not find a way to determine that the signature was null.

My solution was to iterate over partitions for the disk

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

Get the type value and see if it starts with "GPT", and if so, call DeviceIoControl with IOCTL_DISK_GET_PARTITION_INFO_EX. This provides a GUID signature for the GPT section.

In my testing, each partition gives the same signature on the disk and corresponds to the signature specified as uniqueid in diskpart.

+1
source

Source: https://habr.com/ru/post/1306677/


All Articles