using System;
using Microsoft.Win32;
using System.Security.AccessControl;
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{
RegistryKey LocalMachine = Registry.LocalMachine;
RegistryKey rkey = LocalMachine.OpenSubKey(@"SOFTWARE\Classes\*\shellex\ContextMenuHandlers\Symantec.Norton.Antivirus.IEContextMenu", RegistryKeyPermissionCheck.ReadWriteSubTree, RegistryRights.ChangePermissions | RegistryRights.ReadKey);
if (rkey == null)
throw new Exception("Not Open");
RegistrySecurity _registrySecurity = new RegistrySecurity();
RegistryAccessRule _accessRule = new RegistryAccessRule("Administrators",
RegistryRights.FullControl,
InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit,
PropagationFlags.InheritOnly,
AccessControlType.Allow
);
_registrySecurity.AddAccessRule(_accessRule);
rkey.SetAccessControl(_registrySecurity); <---- Háže chybu. Co s tím?
}
}
}