病毒扫描程序锁定和删除临时文件 - 应付他们最好的方式? [英] Virus scanners locking and deleting temporary files - best way to cope with them?

查看:187
本文介绍了病毒扫描程序锁定和删除临时文件 - 应付他们最好的方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序处理来自不同来源,例如未来Outlook和IMAP邮箱。解析它们之前,我把它们写入到临时目录中(保持在内存中不是一个选项)。在解析,我可能会写附件的临时目录(例如,如果它们太大而保存在内存或全文提取)。

My application deals with e-mails coming from different sources, e.g. Outlook and IMAP mailboxes. Before parsing them, I write them to the temporary directory (keeping them in memory is not an option). While parsing, I might be writing attachments to the temp directory (for example, if they are too large to keep in memory or for full-text extraction).

但在野外,发生两件事情,似乎摆在首位很奇怪,但也都可以追溯到病毒扫描程序的行为:

But in the wild, two things happen that seemed very strange in the first place but could all be traced back to virus scanner behaviour:


  • 我有时无法打开,我已经写了自己的几毫秒前的文件。他们显然是由病毒扫描程序锁定,以确保它们是干净的。我得到一个异常。

  • I'm sometimes unable to open files which I've written myself a few milliseconds ago. They are obviously locked by virus scanners to ensure that they are clean. I get an Exception.

如果文件被认为是由病毒扫描危险的,它会删除它们在一定的时间点。

If files are considered dangerous by the virus scanner, it deletes them at some point of time.

要应付这种行为,我已经写了再试一次,如果打开失败,或者如果存在的文件做一些检查的一些方法,但我无法在应用每个部分使用它们(第三方代码,例如过滤器),让事情变得更好,但不是100%完美的,我的源代码看起来因为这个部位难看。

To cope with this behaviour, I've written a few methods that try again if open fails or do some checks if files exist, but I'm unable to use them in every part of the application (3rd party code, for example filters), so things got better, but not 100% perfect and my source code looks ugly in parts because of this.

你怎么和病毒扫描程序应对?

How do you cope with virus scanners?

推荐答案

写您的文件进行加密。我想你不会需要什么太棘手或参与。同时加密或裂伤文件名的病毒扫描程序可能是由也被触发。

Write your files with encryption. I would think you wouldn't need anything too tricky or involved. Also encrypt or mangle the filenames as the virus scanner might be triggered by that as well.

这篇关于病毒扫描程序锁定和删除临时文件 - 应付他们最好的方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆