WMI Win32_PhysicalMedia SerialNumber is sometimes

2019-05-06 22:04发布

I am using WMI with C++ to get the physical disk serial number.

On Windows 7 64bit, I get a string with the serial number.

While when running the same application on a Windows XP 64bit machine I get a hexadecimal string with each char's values reversed.

I have noticed 3 different behaviours so far:

  1. Windows 7 64bit String in correct order as expect
  2. Windows XP 64bit(Machine 1) Hexadecimal string, reversed byte order
  3. Windows XP 64bit(Machine 2) String in reversed byte order

I have used wbemtest.exe and have confirmed that these results are coming from WMI, not my own code.

When I use DeviceIOControl and get the SMART information I always get the serial number as a hexadecimal string with reversed byte order.

Is this expected behavior and how does one handle this?

0条回答
登录 后发表回答