Can't take ownership of registry key with C#

  • Thread starter Thread starter ASI Tech
  • Start date Start date
A

ASI Tech

Guest
My codes AddAccessRule below does everything but give ownership to the "Everyone" group. I get no errors. What else could I be missing? Thanks.

static void Main(string[] args)
{
RegistrySecurity rs = new RegistrySecurity();
string user = "Everyone";

RegistryKey rk = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Wow6432Node\123Test", true);

rs.AddAccessRule(new RegistryAccessRule(user,
RegistryRights.FullControl | RegistryRights.TakeOwnership,
InheritanceFlags.ContainerInherit,
PropagationFlags.None,
AccessControlType.Allow));

rk.SetAccessControl(rs);
}

Continue reading...
 
Back
Top