Write to registry in Windows Vista

萝らか妹 提交于 2019-12-11 07:49:12

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!