If you have linked against query.dll (e.g. to use the LoadIFilter API), your app may throw an access violation during ExitProcess when your process is finishing.
A workaround for this (rather nasty) access violation is to call the undocumented CIShutdown method in the shutdown code of your app, e.g. right before CoUnitialize.
typedefvoid (__stdcall CIShutdownFn)();
HMODULE hModule = LoadLibrary(_T("query.dll"));
if (NULL != hModule)
CIShutdownFn *fn = (CIShutdownFn*)GetProcAddress(hModule, _T("?CIShutdown@@YGXXZ"));
if (NULL != fn)
This rather indirect call is necessary because CIShutdown is not defined in ntqery.h/ntquery.lib.
The IFilter test utility filtdump.exe seems to do the very same thing, at least from looking at the output of Dependency Walker (Depends.exe).
Please note: Code provided AS IS without warranties of any kind. Use at your own risk. Your mileage may vary. May break with any version of Windows, Index Server or MS Search based application.
As a side note, LoadIFilter already calls IPersistFile::Load on the selected filter, so you don’t need to.