5

I wrote an small app to transfer files using the indy components, now i want start the antivirus program when the transfer is finished to check the files.

how i can execute the antivirus program installed in the client side, when the download finish?

UPDATE I need implement something similar to firefox when download a file and then execute the antivirus installed in the machine.

thanks in advance.

Warren P
  • 65,725
  • 40
  • 181
  • 316
Salvador
  • 16,132
  • 33
  • 143
  • 245
  • 2
    Don't most antivirus programs hook into the file system and detect new files anyway? – Rob Kennedy Jul 20 '10 at 16:57
  • Are you asking how to make an application start automatically on the other user's computer (not yours)? Are you trying to make a service? You wrote an anti-virus program or you want to make the anti-virus program scan your program which is not an anti-virus program? I am confused. – Warren P Jul 20 '10 at 20:23
  • @Warren P, i updated my question. just i need scan a file using the installed antivirus when my client app finished the download. – Salvador Jul 20 '10 at 20:31
  • 2
    Don't do it. Let the antivirus engine and the OS handle it. Stick to one thing for your application and let the other applications do their thing. – Marcus Adams Jul 20 '10 at 20:45
  • I have asked this in a more general way over here: http://stackoverflow.com/questions/3295478/how-does-firefox-version-3-invoke-the-anti-virus-feature-on-windows-to-scan-a-dow – Warren P Jul 21 '10 at 00:40

3 Answers3

7

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.

Community
  • 1
  • 1
Warren P
  • 65,725
  • 40
  • 181
  • 316
  • 1
    The C++ source showing how Firefox does it is at http://mxr.mozilla.org/mozilla1.9.1/source/toolkit/components/downloads/src/nsDownloadScanner.cpp – glob Jul 21 '10 at 02:21
2

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.

The_Fox
  • 6,992
  • 2
  • 43
  • 69
0

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) ; 
Omair Iqbal
  • 1,820
  • 1
  • 28
  • 41
  • I'm not the one, but probably because it doesn't do anything to make the AV to check a file. – Sertac Akyuz Jul 20 '10 at 17:22
  • 1
    That only depends on the command line options of the antivirus program. -1 seems harsh. – Tobiasopdenbrouw Jul 20 '10 at 20:23
  • 2
    I think this question is just about unanswerable. It leaves too much out. Mason's answer is one possible understanding of a very confusing and full-of-holes question. – Warren P Jul 20 '10 at 20:24