创建注册表项的问题

时间:2014-09-20 11:47:21

标签: .net registry

经过一段时间的搜索,我无法解决这个问题。我试图在Windows 7中创建一个注册表项。我关闭了UAC并在注册表中更改了权限和所有者但我仍然得到访问被拒绝错误。我已粘贴下面的代码。我尝试了几种(甚至微软)解决方案无济于事。任何帮助表示赞赏!

 Dim rs As RegistrySecurity = New RegistrySecurity()
    rs.AddAccessRule(New RegistryAccessRule(user, RegistryRights.FullControl, InheritanceFlags.ContainerInherit Or InheritanceFlags.ObjectInherit, PropagationFlags.InheritOnly, AccessControlType.Allow))

    Dim subkey As String = "software\HSC\Extractor 3"
    Dim regkey As RegistryKey = LocalMachine.CreateSubKey(subkey, RegistryKeyPermissionCheck.ReadWriteSubTree, RegistryOptions.Volatile,rs)
    rs.AddAccessRule(New RegistryAccessRule(user, RegistryRights.FullControl, InheritanceFlags.ContainerInherit Or InheritanceFlags.ObjectInherit, PropagationFlags.InheritOnly, AccessControlType.Allow))
    regkey.SetAccessControl(rs)
    regkey = LocalMachine.OpenSubKey(subkey, RegistryKeyPermissionCheck.ReadWriteSubTree, RegistryRights.FullControl)
    rs.SetOwner(New NTAccount(user))

1 个答案:

答案 0 :(得分:0)

`software \ HSC \ Extractor 3'中的软件是否应该用大写字母写成?