Vik*_*war 5 c# wmi securitycenter winforms
我在过去的几个月里一直使用ClamAV创建一个防病毒应用程序,应用程序运行正常.
我有另一个软件可以检测机器中安装的安全,间谍软件和防火墙.在运行扫描时,它会检测已安装在我的计算机上的ESAT Smart Security 8.0,而我的防病毒软件不在列表中.在进行一些研究时,我发现这一块代码检测到机器中存在防病毒.
ManagementObjectSearcher managementObjectSearcher = new ManagementObjectSearcher(@"\\MyMachineName\root\SecurityCenter2", "SELECT * FROM AntivirusProduct");
ManagementObjectCollection objectCollection = managementObjectSearcher.Get();
string DisplayName = String.Empty;
if (managementObjectSearcher.Get().Count > 0)
{
foreach (ManagementObject managementObject in managementObjectSearcher.Get())
{
DisplayName = managementObject["displayName"].ToString();
}
}
Run Code Online (Sandbox Code Playgroud)
现在我确实相信,为了使我的应用程序看起来像一个防病毒软件,我必须在SecurityCenter2或WMI中输入一些条目.我尝试了以下代码来实现它
public static void RegisterAsAntivirus()
{
string computer = Environment.MachineName;
string wmipath = @"\\" + computer + @"\root\SecurityCenter2";
ManagementScope oScope = new ManagementScope(wmipath);
oScope.Connect();
ManagementPath oPath = new ManagementPath("AntivirusProduct");
ObjectGetOptions oGetOp = new ObjectGetOptions();
ManagementClass oProcess = new ManagementClass(oScope, oPath, oGetOp);
PropertyDataCollection p = oProcess.Properties;
// Obtain in-parameters for the method
oProcess.SetPropertyValue("displayName", "antivirusname");
oProcess.SetPropertyValue("instanceGuid", "guid");
oProcess.SetPropertyValue("pathToSignedProductExe", @"path");
oProcess.SetPropertyValue("pathToSignedReportingExe", "");
oProcess.SetPropertyValue("productState", 266240);
oProcess.Put();
}
Run Code Online (Sandbox Code Playgroud)
但即使上面的代码行也不适用于我.我仍处于同一水平.在这方面的任何帮助将非常感激.
我的机器在Windows 7上运行,而c#是我的编程语言.
| 归档时间: |
|
| 查看次数: |
66 次 |
| 最近记录: |