How can i check for RegistryKey permissions like ReadKey or FullControl in .NET?

青春壹個敷衍的年華 提交于 2019-12-25 03:42:41

问题


I want to check that I have permissions on a RegistryKey for example can I read values and write values. This blog enumerates permissions

http://blogs.msdn.com/b/bclteam/archive/2006/01/06/509867.aspx

How can I go from GetAccessControl() to knowing that I have for example FullControl?


回答1:


I'm afraid there is no managed code for this. you could use a dllimport and invokeCheckAccess but i prefer just accessing the registry and handling the exception (if any)



来源:https://stackoverflow.com/questions/4947526/how-can-i-check-for-registrykey-permissions-like-readkey-or-fullcontrol-in-net

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