I need to get HDD serial number to use it as a key for licensing a software. I used diskid32 code in this url: http://www.winsim.com/d
For licensing-checking purposes, you really don't care. All you need to know is that some configurations result in flipping, some don't, and it can change during the lifetime of a license.
So accept both variants:
string serial = get_serial();
if (license_check(serial)) {
licensed = true;
return;
}
serial = swap_bytes(serial);
if (license_check(serial)) {
licensed = true;
return;
}
(I see Raymond suggested this in a comment)
No fragile OS check, no worries about whether it failed to flip right when the user applied for the license. Just happy users.