I have this Code to check if a registry Code is avaible and if not, make a new one and save it.
public static string CheckForRegistryGuid()
{
string id = (string)Registry.LocalMachine.GetValue(@"SOFTWARE\mySoftware", "Guid");
if(id == "Guid")
{
id = Guid.NewGuid().ToString();
RegistryKey key = Registry.LocalMachine.OpenSubKey("Software", true);
key.CreateSubKey("mySoftware");
key = key.OpenSubKey("mySoftware", true);
key.SetValue("Guid", id);
return id;
}
else
{
return id;
}
}
Now my Problem is that If I dont find a key, a new one is saved BUT you can only see it on "C:\Windows\SysWOW64\regedit.exe" like here explained.
But know if I want to read the key again it cant be found.
How can I read and write an entry that works on 32 bit and 64 bit Windows Systems?