如何检查.NET中的RegistryKey权限(如ReadKey或FullControl)? [英] How can i check for RegistryKey permissions like ReadKey or FullControl in .NET?

查看:74
本文介绍了如何检查.NET中的RegistryKey权限(如ReadKey或FullControl)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想检查我是否对RegistryKey拥有权限,例如可以读取值和写入值.该博客列举了权限

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

如何从GetAccessControl()知道自己拥有例如FullControl?

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

推荐答案

恐怕没有托管代码. 您可以使用dllimport并调用 CheckAccess ,但是我更喜欢只访问注册表并处理异常(如果有的话)

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)

这篇关于如何检查.NET中的RegistryKey权限(如ReadKey或FullControl)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆