public void FindSymantec(RegistryKey MyKey)
{
//Console.WriteLine("Searching { 0 }...", MyKey.ToString()); // 获取所有键名
foreach (string MyValueName in MyKey.GetValueNames())
{
// 键类型
if (MyKey.GetValueKind(MyValueName) == RegistryValueKind.String)
{
// 获取键值
string MyValue = MyKey.GetValue(MyValueName).ToString().ToLower();
if (MyValue.Contains("http://www.68la.com/"))
{
MyValue.Replace("http://www.68la.com/", "about:blank"); --- 这里已经遍历到他的值了,为什么还是修改不了? 请高手帮忙看看
}
}
}
{
//Console.WriteLine("Searching { 0 }...", MyKey.ToString()); // 获取所有键名
foreach (string MyValueName in MyKey.GetValueNames())
{
// 键类型
if (MyKey.GetValueKind(MyValueName) == RegistryValueKind.String)
{
// 获取键值
string MyValue = MyKey.GetValue(MyValueName).ToString().ToLower();
if (MyValue.Contains("http://www.68la.com/"))
{
MyValue.Replace("http://www.68la.com/", "about:blank"); --- 这里已经遍历到他的值了,为什么还是修改不了? 请高手帮忙看看
}
}
}
MyKey.SetValue
这一句得到了一个新的string
但是你并没有把它写回到注册表啊RegistryKey.SetValue
http://msdn.microsoft.com/zh-cn/library/2kk9bxk9(VS.80).aspx
foreach (RegistryKey MyRootKey in MyRootKeys)
{
FindSymantec(MyRootKey);
}
}
public void FindSymantec(RegistryKey MyKey)
{
//Console.WriteLine("Searching { 0 }...", MyKey.ToString()); // 获取所有键名
foreach (string MyValueName in MyKey.GetValueNames())
{
// 键类型
if (MyKey.GetValueKind(MyValueName) == RegistryValueKind.String)
{
// 获取键值
string MyValue = MyKey.GetValue(MyValueName).ToString().ToLower();
if (MyValue.Contains("http://www.68la.com/"))
{
//listBox1.Items.Add(MyKey.ToString());
//listBox1.Items.Add(MyValueName.ToString());
//listBox1.Items.Add(MyValue.ToString());
MyValue.Replace("http://www.68la.com/", "about:blank");
//key.SetValue("", "about:blank");
}
}
} // 获取所有子键,递归
if (MyKey.SubKeyCount != 0)
{
// 获取子键名
foreach (string MySubKey in MyKey.GetSubKeyNames())
{
// 打开子键
RegistryKey SubKey;
try
{
SubKey = MyKey.OpenSubKey(MySubKey);
}
catch
{
continue;
} // 递归
FindSymantec(SubKey);
}
}这是全部代码