I am unable to get the RegQueryValueEx function to work properly in
the following code, would someone please tell me what I am doing
wrong (my first Win32 program).
Maybe the problem has something to do with the following error.
When compiled the 'W8079 Mixing pointers to different 'char' types.'
warning is given for RegQueryValueEx.
When I run the code, RegOpenKeyEx returns a 234 (I think this means
ERROR_MORE_DATA) instead of a NULL (ERROR_SUCCESS), buffSize is
set to the correct value (6), szBuff is NULL (supposed to be 'abcde' and
'\0', instead szBuff is all zeros) and dataType is set to 1 (dataType is
supposed to be set to REG_SZ for the key I am reading, I can't find a
table telling me if a 1 is REG_SZ, think this is correct )
lErrorCode = RegOpenKeyEx(
HKEY_LOCAL_MACHINE, // handle of open key
"System\\CurrentControlSet\\Control", // address of name of subkey to open
0, // reserved
KEY_QUERY_VALUE, // security access mask
&hkStdFileEditing);
lErrorCode = RegQueryValueEx(
hkStdFileEditing, // handle of key to query
"Current User", // address of name of value to query
0, // reserved
&dataType, // address of buffer for value type
szBuff, // address of data buffer
&buffSize); // address of data buffer size
I am getting very frustrated and must be overlooking something (I have
no problem writing a registry key).