日期:2014-05-18 浏览次数:22142 次
RegistrySecurity rsy = new RegistrySecurity(); RegistryAccessRule rar = new RegistryAccessRule(Environment.UserDomainName + "\\" + Environment.UserName, RegistryRights.ReadKey | RegistryRights.WriteKey | RegistryRights.Delete, InheritanceFlags.ContainerInherit, PropagationFlags.None, AccessControlType.Allow); rsy.AddAccessRule(rar); Microsoft.Win32.RegistryKey rootKey = Microsoft.Win32.Registry.LocalMachine;//本地计算机数据的配置 Microsoft.Win32.RegistryKey runKey = rootKey.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", RegistryKeyPermissionCheck.ReadWriteSubTree,rsy);