为什么我用c#向注册表currentuser里写东西却写到注册表users下面的.default里面去了?
c#向注册表currentuser里写东西却写到注册表users下面的.default里面去了?明明调用的是RegistryKey hklm = Registry.CurrentUser; --------------------编程问答-------------------- 代码看看 --------------------编程问答-------------------- private bool SetRegisterForNetworkDriver()
{
try
{
// @"Software\Policies\Microsoft\Windows\Network Connections";
Microsoft.Win32.RegistryKey rk = null;
Microsoft.Win32.RegistryKey key1 = null;
Microsoft.Win32.RegistryKey key2 = null;
rk = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Policies\Microsoft",true);
if (rk == null)
{
return false;
}
else
{
key1 = rk.CreateSubKey("Windows");
}
if (key1 == null)
{
return false;
}
else
{
key2 = key1.CreateSubKey("Network Connections");
}
if (key2 == null)
{
return false;
}
key2.SetValue("NC_AddRemoveComponents", 0);
key2.SetValue("NC_ChangeBindState", 0);
key2.SetValue("NC_EnableAdminProhibits", 1);
key2.Close();
}
catch (Exception e)
{
Log.Error(Log.CATCH + "SetRegisterForNetworkDriver" + e.ToString());
}
return true;
} --------------------编程问答-------------------- win7调试正常
你是什么环境呢
补充:.NET技术 , C#