Detectar si un antivirus está instalado con Delphi Prism

uses
System,
System.Management,
System.Text;

type
ConsoleApp = class
private
class method AntivirusInstalled() : Boolean;
public
class method Main;
end;

implementation

class method ConsoleApp.Main;
begin
var returnCode : Boolean := AntivirusInstalled();
Console.WriteLine("Antivirus Installed " + returnCode.ToString());
Console.WriteLine();
Console.Read();
end;
class method ConsoleApp.AntivirusInstalled() : Boolean;
begin
var wmipathstr :string := "\\" + Environment.MachineName +"\root\SecurityCenter";
try
var searcher : ManagementObjectSearcher := New ManagementObjectSearcher(wmipathstr, "SELECT * FROM AntivirusProduct");
var instances : ManagementObjectCollection := searcher.Get();
result:=(instances.Count > 0);
except on E: Exception do
begin
Console.WriteLine(e.Message);
Result:=False;
end;
end;
end;

Fuente:
http://theroadtodelphi.wordpress.com


Relacionados
Calcular el md5 con Delphi

No hay comentarios:

Publicar un comentario