take a lok at the following code
HKEY hKey = 0;
int code = RegOpenKey(HKEY_CURRENT_USER, subkey, &hKey); //code is ERROR_SUCCESS
char aBuf[255] = {0};
char bBuf[255] = {0};
DWORD dwType = REG_SZ;
DWORD dwBufSize = sizeof(bBuf);
int aCode = RegQueryValueEx(hKey, L"a", 0, &dwType, (BYTE*)aBuf, &dwBufSize);
int bCode = RegQueryValueEx(hKey, L"b", 0, &dwType, (BYTE*)bBuf, &dwBufSize);
//(*) here I have a breakpoint
At the breakpoint aBuf (as well as bBuf) is something like 'a' '\0' 'v' '\0' 'a' '\0' 'l' '\0' 'u' '\0' 'e' '\0'. What am I doing wrong?
Thank you in advance!
Your code is compiled UNICODE (as evidenced by your use of L”a”), so the result will be a wchar_t array, not a char array.