我有此代码来检查注册表代码是否可用,否则请创建一个新的代码并保存。
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;
}
}
现在我的问题是,如果我找不到密钥,则会保存一个新密钥,但是您只能在“ C:\ Windows \ SysWOW64 \ regedit.exe” like here explained上看到它。
但是知道我是否想再次读取密钥。
如何读写适用于32位和64位Windows系统的条目?