gpt4 book ai didi

c# - 如何检查后台运行的 Microsoft Security Essential?

转载 作者:太空宇宙 更新时间:2023-11-03 15:49:39 24 4
gpt4 key购买 nike

我正在创建一个检测系统威胁的软件,但它需要 Microsoft Security Essentials 来清理该系统。所以我想知道 Microsoft Security Essentials 是否正在系统上运行,以便我可以使用此实用程序来运行我的软件。我已经有了这个解决方案来检查是否安装了 Microsoft Security Essentials,但我需要知道它是否正在运行?提前谢谢你。

为了检查 Microsoft 安全性,我已经实现了以下代码

private static bool DoesMseExist()
{
string location = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
using (RegistryKey localMachineX64View =
RegistryKey.OpenBaseKey(RegistryHive.LocalMachine,
RegistryView.Registry64))
{
using (RegistryKey rk = localMachineX64View.OpenSubKey(location))
{
foreach (string subKey in rk.GetSubKeyNames())
{
using (RegistryKey productKey = rk.OpenSubKey(subKey))
{
if (productKey != null)
{
if (Convert.ToString(productKey.GetValue("DisplayName"))
.Contains("Microsoft Security Client"))
{
return true;
}
}
}
}
}
}
return false;
}

最佳答案

我终于得到了答案,而且效果很好。

Process[] processlist = Process.GetProcessesByName("msseces");;
foreach(Process theprocess in processlist){
Console.WriteLine("Process: {0} ID: {1}", theprocess.ProcessName, theprocess.Id);
}

关于c# - 如何检查后台运行的 Microsoft Security Essential?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26465483/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com