问题描述
我已将 IFilter 实现为本地 VC++ ATL 进程内 COM 服务器.Windows Search 不会使用它——它会创建我的 IFilter 的一个实例,然后执行一堆 QueryInterface() 调用,具体来说:
I've implemented an IFilter as a native VC++ ATL in-proc COM server. Windows Search wouldn't use it - it creates an instance of my IFilter and then executes a bunch of QueryInterface() calls, specifically:
- 元帅
- IStdMarshalInfo
- 具有 {4C1E39E1-E3E3-4296-AA86-EC938D896E92} 接口 ID 的东西
还有其他几个.由于我的 IFilter 只实现了 IFilter、IPersist 和 IPersistFile,因此大多数调用都返回 E_NOINTERFACE,所以 Windows Search 只是释放我的对象,什么都不做.
and a couple of others. Since my IFilter only implements IFilter, IPersist and IPersistFile most of the calls return E_NOINTERFACE, so Windows Search just releases my object and does nothing.
为什么要查询这些接口,我该如何解决这个问题?
Why is it querying for those interfaces and how do I work the problem around?
推荐答案
Windows 会尝试检查你的接口是否支持自定义封送处理,他能做到的唯一方法是使用 QueryInterface(...)
那些众所周知的接口(嗯,半众所周知的).
COM 层期望某些接口返回 E_NOINTERFACE
并知道如何处理.
Windows tries check if your interface supports custom marshaling, the only way he can do that is using QueryInterface(...)
to those well known interfaces (well, semi well known).
The COM layer expects that some interfaces will return E_NOINTERFACE
and knows how to deal with it.
这篇关于为什么 Windows Search 会向我的 IFilter 查询一堆奇怪的接口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!