I am trying to get HWID
through the hwProfileInfo
class, but it returns me that i can't convert WCHAR
[39] to String.
string getHWID(){
string hardware_guid
HW_PROFILE_INFO hwProfileInfo;
GetCurrentHwProfile(&hwProfileInfo);
hardware_guid = hwProfileInfo.szHwProfileGuid;
return hardware_guid;
}
Than i tried this way, but it returns me just "{"
hardware_guid = (char*)hwProfileInfo.szHwProfileGuid;
I know there are some more ways in Google, but i didn't find any working variants. May be there are some people, who can say the 100% method?
This is the answer to my question.
string getHWID(){
HW_PROFILE_INFO hwProfileInfo;
GetCurrentHwProfile(&hwProfileInfo);
wstring hwidWString = hwProfileInfo.szHwProfileGuid;
string hwid(hwidWString.begin(), hwidWString.end());
return hwid;
}