I have been creating an antivirus application using ClamAV over the past few months, the application works fine.
I have other software that discovers for security, Spywares and a firewall installed on the computer. When scanning starts, it detects ESAT Smart Security 8.0, which is already installed on my computer, while my antivirus is not on the list. After some research, I found out that this piece of code detects the presence of Anti-Virus in the machine.
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(); } }
Now I believe that in order for my application to look like Anti-Virus, I would have to make some entries in SecurityCenter2 or WMI. I tried the following code to achieve it.
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(); }
But even the lines of code above do not work for me. And I'm still on the same level. Any help in this aspect would be truly appreciated.
My machine runs on Windows 7, and C # is my programming language.
source share