I made a function SetRegistry() to write a string in the registry like this:
void SetRegistry()
{
HKEY hKey;
RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Run"),0,KEY_SET_VALUE,&hKey);
RegSetValueEx(hKey, TEXT("filenamehere"),0,REG_SZ,(LPBYTE) "C:\\Windows\\filenamehere.exe",sizeof("C:\\Windows\\filenamehere.exe");
RegCloseKey(hKey);
}
NOTE: C:\\Windows\\ is the path where the .exe file I want to add is.
it sets the string with the filename and type correctly but the data that should be C:\\Windows\\filenamehere.exe appears like some chinese weird characters.
I want to know why it writes weird characters and how can I solve it so it saves the right path...
EXAMPLE HOW IT APPEARS:
Name | Type | Data
filenamehere | REG_SZ | chinese characters <-- WHY?