【问题标题】:Execute antivirus program programmatically using delphi使用 delphi 以编程方式执行防病毒程序
【发布时间】:2010-07-20 16:33:46
【问题描述】:

我写了一个小应用程序来使用 indy 组件传输文件,现在我想在传输完成后启动防病毒程序来检查文件。

下载完成后如何执行安装在客户端的杀毒程序?

更新 我需要在下载文件时实现类似于 firefox 的功能,然后执行机器中安装的防病毒软件。

提前致谢。

【问题讨论】:

  • 难道大多数防病毒程序都不会挂接到文件系统并检测新文件吗?
  • 您是否在询问如何使应用程序在其他用户的计算机(不是您的计算机)上自动启动?您是否正在尝试提供服务?你写了一个杀毒程序,或者你想让杀毒程序扫描你的不是杀毒程序的程序?我很困惑。
  • @Warren P,我更新了我的问题。只是当我的客户端应用程序完成下载后,我需要使用已安装的防病毒软件扫描文件。
  • 不要这样做。让防病毒引擎和操作系统处理它。为您的应用程序坚持一件事,让其他应用程序做他们的事。
  • 我在这里以更一般的方式问过这个问题:stackoverflow.com/questions/3295478/…

标签: delphi delphi-7 antivirus-integration windows-xp-sp2


【解决方案1】:

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

看起来您应该获取两个 COM 接口,其中一个记录在此处:

IAttachmentExecute

此接口是 windows shell 接口的一部分。

这是原文中的注释

/**
 * 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.

【讨论】:

【解决方案2】:

检查其他程序是如何做到的,例如 Winrar。很可能它只是使用您要扫描的文件或文件夹作为命令行参数启动防病毒程序。您可以查看您的防病毒程序手册以了解它是如何完成的。

【讨论】:

    【解决方案3】:

    您可以使用 shellexecute 或 createprocess, 我使用 shellexecute 但我听说 createprocess 更好 如果您想使用 shellapi 执行名为 say antivvv 的防病毒软件,请这样做:

    uses ShellApi;
     ...
     ShellExecute(Handle, 'open', 'c:\program files\antivvv.exe', nil, nil, SW_SHOWNORMAL) ; 
    

    【讨论】:

    • 我不是那个,但可能是因为它没有做任何事情来让 AV 检查文件。
    • 这仅取决于防病毒程序的命令行选项。 -1 似乎很苛刻。
    • 我认为这个问题几乎无法回答。它留下了太多东西。梅森的回答是对一个非常混乱且漏洞百出的问题的一种可能理解。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-11-26
    • 2010-10-13
    • 1970-01-01
    • 2011-03-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多