NTAccount account_demo = sid.Translate(typeof(NTAccount)) as NTAccount ; (> Option)
NTAccount account = new NTAccount(Environment.UserName);
using (RegistryKey rk = Registry.LocalMachine.OpenSubKey(key))
{
RegistrySecurity rs = new RegistrySecurity();
RegistryAccessRule rar = new RegistryAccessRule(
account.ToString(), RegistryRights.FullControl, InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit,
PropagationFlags.None,AccessControlType.Allow);
rs.AddAccessRule(rar);
rk.SetAccessControl(rs);
}