×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Accessing the Registry from a program

Accessing the Registry from a program

Accessing the Registry from a program

(OP)


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).

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close