You have an array of char
but RegQueryValueEx
requires an array of wchar_t
in a wide-character build. Most programs today will be wide-character applications, but you can use the Microsoft-defined constant TCHAR
instead of char
or wchar_t
if you're unsure.
The reason you only get a single character is because the first character has a value between 1 and 255. The high byte of such a 16-bit character code is zero, so in memory it looks like a string terminator.