• C

Registry Key Question

I am writing a program which loops through the keys in the Registry and
opens them if possible.  Some keys return ERROR_ACCESS_DENIED (error 5) when
the program attempts to open them even though if I go to the Key in Regedit
I can open them.  One such Key is
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum
Why would this be?
witgrefeAsked:
Who is Participating?
 
ZoppoCommented:
ok, simply that's the problem - you can't get i.e. write-access for these registry keys, so you need to open it without - try to use KEY_READ instead of KEY_ALL_ACCESS (you could do it as fallback if KEY_ALL_ACCESS returns error)

regards,

ZOPPO
0
 
ZoppoCommented:
Hi witgrefe,

which access rights do you define in RegOpenKeyEx? I.e. for HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum you can only open it with access right KEY_READ ...

hope that helps,

ZOPPO
0
 
sundaramkumarCommented:
if you can use WMI then it will be easier
0
 
witgrefeAuthor Commented:
I am opening it with KEY_ALL_ACCESS
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.