C # add key to registry in LocalMachine fails

I am trying to add a key to LocalMachine

the registry. I am using this code:

    System.Diagnostics.Debugger.Launch();
    RegistryKey key = Registry.LocalMachine.OpenSubKey("SOFTWARE", true);
    RegistryKey newkey = key.CreateSubKey("1asdasds", RegistryKeyPermissionCheck.ReadWriteSubTree);
    newkey.SetValue("ads", "ddsds");
    newkey.Close();

      

I ran it in an administrator account. Event I fire it with "run as administrator", but nothing is added to the registry :(. When I change LocalMachine

to CurrentUser

, it is actually added to the key CurrentUser

. But how to get it to add to LocalMachine?

+3


source to share


1 answer


Got it. It was actually added, but with my x64 system, I couldn't see it in simple C: \ Windows \ regedit.exe. Go to C: \ Windows \ SysWOW64 \ regedit.exe to see it in x64



+9


source







All Articles