Click to See Complete Forum and Search --> : registry and permission


donquixote
September 16th, 2003, 03:37 PM
I notice there are many postings concerning this. Still I didn't get my problem solved.

Two basic questions: (1) what exactly is the required permission for a program to write to registry, say, something under HKEY_CURRENT_USER?
(2) Is it possible that I have permission to manually change a key while don't have permission do it with a program?

The problem I had is that my calling to RegQueryValueEx alway get ERROR_ACCESS_DENIED. I can change the key with regedit without problem. When I check the permission with REGEDT32, my account has full control of that key. It is under HKEY_CURRENT_USER.

Any comments are appreciated.

sm0kie911
September 16th, 2003, 09:27 PM
to use RegQueryValueEx The key must have been opened with the KEY_QUERY_VALUE access right

HKEY OpenKey;

RegOpenKeyEx(HKEY_CURRENT_USER,"Software\\MySs0fFTWare\\Settings",NULL,KEY_QUERY_VALUE,&OpenKey)

to write i use
RegOpenKeyEx()
RegCreateKey()
RegSetValueEx()

donquixote
September 17th, 2003, 11:25 AM
Thank you very much. You got the exact problem! I just figured out after various wrong paths. Wish my mistake helps others who saw this.

Originally posted by sm0kie911
to use RegQueryValueEx The key must have been opened with the KEY_QUERY_VALUE access right

HKEY OpenKey;

RegOpenKeyEx(HKEY_CURRENT_USER,"Software\\MySs0fFTWare\\Settings",NULL,KEY_QUERY_VALUE,&OpenKey)

to write i use
RegOpenKeyEx()
RegCreateKey()
RegSetValueEx()