• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 256
  • Last Modified:

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?
0
witgrefe
Asked:
witgrefe
  • 2
1 Solution
 
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
 
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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now