Win32_PhysicalMedia SerialNumber is sometimes in the wrong order

Turning to MSDN , I change the code so that I can recover the serial number of the hard drive

hres = pSvc->ExecQuery(
    bstr_t("WQL"),
    bstr_t("SELECT SerialNumber FROM Win32_PhysicalMedia"),
    WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY, 
    NULL,
    &pEnumerator);
..
..<other code here>
..
hr = pclsObj->Get(L"SerialNumber", 0, &vtProp, 0, 0);

I convert vtProp.bstrVal to std :: wstring and do the return line, so I need to cancel the result from vtProp.bstrVal because I found that some of the computers that I use to extract the serial number are in the wrong order

For example: Computer 1 return serial: W [space] -DXW1M6EC01056 , I need to do the reverse line to make it [space] WD-WXM1E60C0165 , which is correct after comparing with the label on the hard drive

2 : WD-WXM1E60C0165 ( , , ) , W [] -DXW1M6EC01056

, Little-Endian, , Endianness .

-, ? HDD/? Windows XP Pro .

+5

All Articles