<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Soul Of Free Loop &#187; 组策略</title>
	<atom:link href="https://zohead.com/archives/tag/group-policy/feed" rel="self" type="application/rss+xml" />
	<link>https://zohead.com</link>
	<description>Uranus Zhou&#039;s Blog</description>
	<lastBuildDate>Sat, 19 Jul 2025 15:42:46 +0000</lastBuildDate>
	<language>zh-CN</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.8</generator>
	<item>
		<title>Thunderbird（Firefox）病毒扫描原理分析及禁用方法</title>
		<link>https://zohead.com/archives/thunderbird-virus-scan-analyse-disable/</link>
		<comments>https://zohead.com/archives/thunderbird-virus-scan-analyse-disable/#comments</comments>
		<pubDate>Fri, 30 Mar 2012 02:42:23 +0000</pubDate>
		<dc:creator><![CDATA[Uranus Zhou]]></dc:creator>
				<category><![CDATA[代码分析]]></category>
		<category><![CDATA[技术]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[IAttachmentExecute]]></category>
		<category><![CDATA[IOfficeAntiVirus]]></category>
		<category><![CDATA[Thunderbird]]></category>
		<category><![CDATA[扫描]]></category>
		<category><![CDATA[病毒]]></category>
		<category><![CDATA[组策略]]></category>
		<category><![CDATA[附件]]></category>

		<guid isPermaLink="false">http://zohead.com/?p=40</guid>
		<description><![CDATA[本文博客链接：https://zohead.com/archives/thunderbird-virus-scan-analyse-disable/ 笔者现在浏览网页和电子邮件全部都用 Mozilla 系的 Firefox 和 Thunderbird 了，这俩软件算是我的 Windows 系统中启动之后运行时间最长的两个应用程序，都非常好用，Thunderbird 虽然没有 Firefox 那么受欢迎，也算比 Outlook 好用很多（仅仅个人意见 ^_^），同时都支持扩展和附加组件。 最近发现有一点需要吐槽的是 Thunderbird 和 Firefox 默认下载附件或者下载东西完成之后都需 [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>本文博客链接：<a href="https://zohead.com/archives/thunderbird-virus-scan-analyse-disable/" target="_blank">https://zohead.com/archives/thunderbird-virus-scan-analyse-disable/</a></p>
<p>
	笔者现在浏览网页和电子邮件全部都用 Mozilla 系的 Firefox 和 Thunderbird 了，这俩软件算是我的 Windows 系统中启动之后运行时间最长的两个应用程序，都非常好用，Thunderbird 虽然没有 Firefox 那么受欢迎，也算比 Outlook 好用很多（仅仅个人意见 ^_^），同时都支持扩展和附加组件。</p>
<p>
	最近发现有一点需要吐槽的是 Thunderbird 和 Firefox 默认下载附件或者下载东西完成之后都需要运行杀毒软件进行病毒扫描，而且附件比较大时还相当缓慢，对于我这种不想装杀毒软件的人或者受不了速度影响的人会有点感官影响，HOHO，寻办法禁用之。</p>
<p>
	<strong> 1、Firefox</strong></p>
<p>
	先说说比较简单的 Firefox 下禁用病毒扫描的方法（可以直接 百度、GG 到）：</p>
<p>
	地址栏中输入&ldquo;<strong>about:config</strong>&rdquo;，忽略坑爹的 &ldquo;保修提示&rdquo;，在过滤器中中输入&ldquo;<span style="color:#0000cd;"><strong>browser.download.manager.scanWhenDone</strong></span>&rdquo;，通常找到的第一个就是要改的配置，双击将值改为 false，随便下个软件，马上就可以看到效果。</p>
<p>
	<strong>2、老版本 Thunderbird</strong></p>
<p>
	接下来 Thunderbird 的禁用方法就没有直接的了，老版本的 Thunderbird 似乎也可以在 &ldquo;<strong>about:config</strong>&rdquo; 设置同样的值，但新版本的 &ldquo;<strong>about:config</strong>&rdquo; 中已经没有这个配置，注意 Thunderbird 的 &rdquo;<strong>about:config</strong>&ldquo; 不是直接输入了，需要打开首选项，进入 &ldquo;高级&rdquo; 选项卡，点 &rdquo;常规&ldquo;，然后打开 &rdquo;配置编辑器&ldquo; 就是想要的效果。</p>
<p>
	如果直接要新版本的修改方法，直接忽略分析部分直接跳到最后。</p>
<p>
	<strong>3、Thunderbird 扫描原理分析</strong></p>
<p>
	无奈新版本的 Thunderbird 在搜索了 N 次之后找不到解决办法，祭出查源代码大法（一般都比较好使，哈哈），不想下那么大的源码包，直接在 Mozilla 官方网站上找 Thunderbird 的在线版本库，找到了 Mozilla Cross-Reference 做参考：<br />
	<a href="http://mxr.mozilla.org/" target="_blank">http://mxr.mozilla.org/</a></p>
<p>
	进入 Comm. Central 仓库：<br />
	<a href="http://mxr.mozilla.org/comm-central/" target="_blank">http://mxr.mozilla.org/comm-central/</a></p>
<p>
	搜索 virus scan 之类的就能看到下面几个代码段，稍加分析，大略知道 Thunderbird 和 Firefox 的病毒扫描原理，简单分析下。</p>
<p>
	首先在 nsDownloadScanner.cpp 下找到扫描的初始化部分：</p>
<pre class="brush: cpp; highlight: [9]; title: mozilla/toolkit/components/downloads/nsDownloadScanner.cpp; notranslate">
nsresult
nsDownloadScanner::Init()
{
  // This CoInitialize/CoUninitialize pattern seems to be common in the Mozilla
  // codebase. All other COM calls/objects are made on different threads.
  nsresult rv = NS_OK;
  CoInitialize(NULL);

  if (!IsAESAvailable()) {
    CoUninitialize();
    return NS_ERROR_NOT_AVAILABLE;
  }

  mAESExists = true;

  // Initialize scanning
  mWatchdog = new nsDownloadScannerWatchdog();
</pre>
<p>下面是同一文件中的比较重要的 IsAESAvailable 的实现：</p>
<pre class="brush: cpp; highlight: [7,8]; title: mozilla/toolkit/components/downloads/nsDownloadScanner.cpp; notranslate">
bool
nsDownloadScanner::IsAESAvailable()
{
  // Try to instantiate IAE to see if it's available.
  nsRefPtr ae;
  HRESULT hr;
  hr = CoCreateInstance(CLSID_AttachmentServices, NULL, CLSCTX_INPROC,
                        IID_IAttachmentExecute, getter_AddRefs(ae));
  if (FAILED(hr)) {
    NS_WARNING(&quot;Could not instantiate attachment execution service\n&quot;);
    return false;
  }
  return true;
}
</pre>
<p>对是否支持扫描的判断很简单，判断 IAttachmentExecute COM组件是否可用，此组件在 Windows XP SP2 之后的系统中就自带，另外如果在更老的系统中则使用 IOfficeAntiVirus COM组件。</p>
<p>
	下面是下载管理器 nsDownloadManager.cpp 的处理：</p>
<pre class="brush: cpp; highlight: [12]; title: mozilla/toolkit/components/downloads/nsDownloadManager.cpp; notranslate">
nsresult
nsDownloadManager::Init()
{

  ... 中间省略的代码 ...

  rv = bundleService-&gt;CreateBundle(DOWNLOAD_MANAGER_BUNDLE,
                                   getter_AddRefs(mBundle));
  NS_ENSURE_SUCCESS(rv, rv);

#ifdef DOWNLOAD_SCANNER
  mScanner = new nsDownloadScanner();
  if (!mScanner)
    return NS_ERROR_OUT_OF_MEMORY;
  rv = mScanner-&gt;Init();
  if (NS_FAILED(rv)) {
    delete mScanner;
    mScanner = nsnull;
  }
#endif
</pre>
<p>可以看到第12行处会启动 nsDownloadScanner 进行下载附件的扫描处理。</p>
<p>
	<strong>4、组策略处理方法（不完美）</strong></p>
<p>
	经过粗略了解之后便是解决方法咯，首先看能否对 Thunderbird 禁用 IAttachmentExecute COM组件。</p>
<p>
	有关 IAttachmentExecute COM组件的配置见这篇文章通过组策略设置&ldquo;附件管理器&rdquo;，可以参考这篇文章对整个系统的附件扫描机制做设置：<br />
	<a href="http://edu.kafan.cn/html/hips/11386.html" target="_blank">http://edu.kafan.cn/html/hips/11386.html</a></p>
<p>
	简单流程：<br />
	开始 - 运行，输入：gpedit.msc，打开组策略编辑器，定位到 用户配置 - 管理模板 - Windows组件 - 附件管理器，截图如下，看下应该就能明白</p>
<p>
	<a href="http://zohead.com/wp-content/uploads/attachment-execute-gpedit.jpg" target="_blank"><img alt="" height="250" src="http://zohead.com/wp-content/uploads/attachment-execute-gpedit.jpg" width="512" /></a></p>
<p>
	可以看到这个设置是全局，是一种解决方法，但会对其它需要扫描的程序（例如：Outlook）也会造成影响。</p>
<p>
	<strong>5、完美禁用 Thunderbird 病毒扫描</strong></p>
<p>
	再经过搜寻源代码之后终于找到只改变 Thunderbird 扫描病毒配置的方法，原来 Thunderbird 可能出于安全的考虑将 &rdquo;<span style="color:#0000cd;"><strong>browser.download.manager.scanWhenDone</strong></span>&ldquo; 配置从 &rdquo;<strong>about:config</strong>&ldquo; 配置编辑器中移除掉了，但这个配置功能并没有真正去掉，我们还有直接修改 Thunderbird 安装目录的配置脚本的方法，进入 Thunderbird 安装目录的 <strong>defaults\pref</strong> 下，打开 <strong>channel-prefs.js</strong> 文件编辑，增加扫描的配置。</p>
<p>
	例如我的配置脚本的路径为：<strong>C:\Program Files\Mozilla Thunderbird\defaults\pref\channel-prefs.js</strong>，打开该文件，增加一行：<br />
	<span style="color:#0000cd;"><strong>pref(&quot;browser.download.manager.scanWhenDone&quot;, false);</strong></span></p>
<p>
	即可禁用下载附件时的病毒扫描，需要再启用时恢复即可，贴图：</p>
<p>
	<a href="http://zohead.com/wp-content/uploads/thunderbird-prefs-virus-scan.jpg" target="_blank"><img alt="" height="144" src="http://zohead.com/wp-content/uploads/thunderbird-prefs-virus-scan.jpg" width="518" /></a></p>
<p>
	oops，写累了，以上只是粗略的分析，如果有任何错误或者更好的修改方法请PM或评论。 ^_^</p>
]]></content:encoded>
			<wfw:commentRss>https://zohead.com/archives/thunderbird-virus-scan-analyse-disable/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
