Sla*_*shy 3 c# windows registry
我想检查某个程序是否在计算机启动时运行,我 win32 RegistryKey为此访问了该类:
private void Form1_Load(object sender, EventArgs e)
{
bool ok = isOnRegistryStartup("iFilter");
MessageBox.Show(ok.ToString());
}
private bool isOnRegistryStartup(string key)
{
RegistryKey RegistryKey = Registry.CurrentUser.OpenSubKey
("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
if (registryKey.GetValue(key)!=null)
{
return true;
}
return false;
}
Run Code Online (Sandbox Code Playgroud)
输出True确实是,因为该程序实际上在 Windows 启动时运行,但是当我通过Task manager(并且它的状态变为disabled)禁用该程序启动时,下次我运行上面的代码时,结果仍然是True,即使该程序不是一部分不再有启动程序了。
这让我得出一个简单的结论,当Windows任务管理器禁用启动程序时,它不会删除它在注册表项中的键,但它会更改它的另一个值..但我无法找出那是什么改变了值。
我希望有人能帮帮忙。
谢谢。
因为在 taskmgr 上将其设置为禁用并不会删除其条目
CurrentUser\SOFTWARE\Microsoft\Windows\CurrentVersion\Run而是在CurrentUser\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Runfrom 0200 0000000...to中设置相应的值0300 0000 xxxxx....
| 归档时间: |
|
| 查看次数: |
2317 次 |
| 最近记录: |