Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access denied with default RegKey constructor #4

Closed
WimLeflere opened this issue Aug 9, 2017 · 2 comments
Closed

Access denied with default RegKey constructor #4

WimLeflere opened this issue Aug 9, 2017 · 2 comments

Comments

@WimLeflere
Copy link

The default RegKey constructor tries to open the registry key with read and write access.

REGSAM desiredAccess = KEY_READ | KEY_WRITE

This cause problems for a lot of registry keys as they require elevated permissions to be able to be written.
E.g. 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB'

Maybe better to open the keys with read access only?
Or add the permission level as constructor argument?

@GiovanniDicanio
Copy link
Owner

GiovanniDicanio commented Aug 9, 2017

I like the idea of adding a permission level as constructor argument. Thanks for the suggestion!

@GiovanniDicanio
Copy link
Owner

I've updated the code with this addition. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants