When anti-virus software is running during the installation of my software certain components do not get installed correctly. I always tell the users to turn it OFF first. But, they forget and then I am racking my brains trying to figure out what went wrong. Is there a Delphi function that anyone knows about that can detect whether AntiVirus software is running, so I can alert the user before installation starts?
Since XPsp2, there is the security center that registers if there is a known antivirus.
Afaik this functions over the WMI api, which can be accessed via Winapi. (and Jedi has headers for it).
I've found some VBScript here: http://blogs.msdn.com/b/alejacma/archive/2008/05/12/how-to-get-antivirus-information-with-wmi-vbscript.aspx
Another tip: try to communicate to your users in any way possible to turn off heuristic scans as much as possible. These are typically the cause of false positives, and it can be an easier message to bring than killing the antivirus all together.
We've had success by checking the running processes for any process that we've determined before-hand is an AV program. (You can enumerate a list of processes using some simple code that you can find by googling something List Running Processes Delphi)
If we find one, we tell the user and refuse to continue...
To build our list of processes that we know are AV, we install trial versions of the AV programs and then look at the list of processes (either in the task manager, or using our enumerate processes code.) It's not to hard to spot them... and you can shut the AV programs down and see if the processes you identify go away. (Process Explorer is helpful: http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx)
For example, some of the processes we currently look for include MCShield (McCaffe), NPROTECT (Norton), PCCNTMON (Trend Micro), etc.
Obviously this won't catch ALL AV programs, but if you do the above with the major vendors (Norton, McCaffe, Trend Micro, ZA, etc.) you'll have a large percentage of the AV programs in the field covered.
One thing that is nice about this is that it's easy to implement and doesn't require any really low level Windows API calls, except to enumerate the currently running processes...
The most reliable way would be to create a file on the disk containing the EICAR signature. If after creating that file it disapears or is locked for reading then you can safely assume another process has jumped on that file (ie an AV program)
More details about EICAR can be found here http://www.eicar.org/anti_virus_test_file.htm
certain components do not get installed correctly
Explain what components you're installing, how you're installing those components, and how their installation is failing, and it will be easier to recommend a solution. Also, are you using an installer product, or your own installation code? If it's your own installer, or if you can automatically run your own code after the installer, you can do your own programmatic check to confirm your install is 100% OK, and if not then report what failed and remind the user to turn off antivirus stuff and retry the install.