Execute antivirus program programmatically using delphi

我与影子孤独终老i 提交于 2019-11-30 15:03:21
Warren P

See the nice person's answer to my other question.

Looks like there are two COM interfaces you should be grabbing, one of which is documented here:

IAttachmentExecute

This interface is part of the windows shell interfaces.

here is the commentary in the source

/**
 * Code overview
 *
 * Download scanner attempts to make use of one of two different virus
 * scanning interfaces available on Windows - IOfficeAntiVirus (Windows
 * 95/NT 4 and IE 5) and IAttachmentExecute (XPSP2 and up).  The latter
 * interface supports calling IOfficeAntiVirus internally, while also
 * adding support for XPSP2+ ADS forks which define security related
 * prompting on downloaded content.  
 *
 * Both interfaces are synchronous and can take a while, so it is not a
 * good idea to call either from the main thread. Some antivirus scanners can
 * take a long time to scan or the call might block while the scanner shows
 * its UI so if the user were to download many files that finished around the
 * same time, they would have to wait a while if the scanning were done on
 * exactly one other thread. Since the overhead of creating a thread is
 * relatively small compared to the time it takes to download a file and scan
 * it, a new thread is spawned for each download that is to be scanned. Since
 * most of the mozilla codebase is not threadsafe, all the information needed
 * for the scanner is gathered in the main thread in nsDownloadScanner::Scan::Start.
 * The only function of nsDownloadScanner::Scan which is invoked on another
 * thread is DoScan.

I found some more implementation information here. The feature is called AES.

Check how other programs do it, like Winrar. Most likely it is just starting the anti-virus program with the file or folder you want to scan as a command-line parameter. You can check the manual of your anti-virus program to check how it's done.

you can use shellexecute or createprocess, i use shellexecute but i've heard createprocess is better if you want to execute an antivirus called say antivvv using shellapi do it this way:

uses ShellApi;
 ...
 ShellExecute(Handle, 'open', 'c:\program files\antivvv.exe', nil, nil, SW_SHOWNORMAL) ; 
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!