问题
I am trying to write to the registry from my application, but when I do I get access denied. Of course, it works if i run the app as Administrator. However, with my applcation, it is not initiated by the user. It start automatically.
So, the question is, how do i read/write to my own registry key from the C++ app?
Thanks for any help.
回答1:
Write to HKEY_CURRENT_USER
And check out this posts
Vista + VB.NET - Access Denied while writing to HKEY_LOCAL_MACHINE
Writing string (REG_SZ) values to the registry in C++
How to read registry branch HKEY_LOCAL_MACHINE in Vista?
回答2:
If your application starts automatically, could it be rewritten as a service? It would have system-level access to registry.
回答3:
If it's really your key, you control its security. The reason you need Admin rights is probably because you created the key with a DACL that refuses access to "normal" users. The most common way this happens is by inheriting a DACL from a parent key.
来源:https://stackoverflow.com/questions/992760/write-to-registry-in-windows-vista