Programmatically determine which iFilters are installed

I have a problem where Adobe PDF iFilter does not work consistently for us. So we would like to use one of Foxit . The problem is that if we install Foxit iFilter and then the client decides to reinstall Adobe Reader, it can overwrite Foxit iFilter.

We can use tools like IFilter Explorer to view this, but I would like to do this in the application and alert the user / client who changed iFilter.

Is there a way to check iFilters from code (C #)? Or other potential solutions to this problem?

+4
c # pdf ifilter
source share
4 answers

Since foxit IFilter implements the IPersistStream interface, I think you can try to get this interface from IFilter and request its CLSID to find out if it is one of foxit. Foxit IFilter has a CLSID {987f8d1a-26e6-4554-b007-6b20e2680632} , which is the "Persistent Handlers Addins Registered" column in IFilter Explorer.

Adobe IFilter does not seem to implement this interface.

+3
source share

I would suggest that IFilters are stored in the registry, so you can use Process Monitor to find out which keys IFilter Explorer checks.

Then check the MSDN that this is consistent with the documentation.

Then do the same using the .NET registry types in your application.

Based on the search for this answer, registration can exist both at the system level and at the user level, so you probably need to list several registry keys.

+1
source share

A bit strange answer;) but as an alternative way, you can use the external console application Filtreg.exe from the Windows 7 SDK to delegate this task.

0
source share

I use this little function to produce a list. It just uses the extension NOT a document type! In most cases, this is normal and can be easily changed here.

 /// <summary> /// Implements a Function to get all available IFilters currently registered in this system /// </summary> public string GetFilterList() { //Our resulting string. We give back a ';' seperated list of extensions. string result = @""; string persistentHandlerClass; RegistryKey rk = Registry.LocalMachine.OpenSubKey(@"Software\Classes"); if (rk == null) return null; using (rk) { foreach(string subKeyName in rk.GetSubKeyNames()) { if (subKeyName[0] == '.') //possible Extension { RegistryKey sk = Registry.LocalMachine.OpenSubKey(@"Software\Classes\" + subKeyName + @"\PersistentHandler"); if (sk == null) continue; using (sk) { persistentHandlerClass = (string)sk.GetValue(null); } if (persistentHandlerClass != null) { string filterPersistClass = ReadStrFromHKLM(@"Software\Classes\CLSID\" + persistentHandlerClass + @"\PersistentAddinsRegistered\{89BCB740-6119-101A-BCB7-00DD010655AF}"); string dllName = ReadStrFromHKLM(@"Software\Classes\CLSID\" + filterPersistClass + @"\InprocServer32"); // skip query.dll results, cause it not an IFilter itself if (dllName != null && filterPersistClass != null && (dllName.IndexOf("query.dll") < 0)) { //result = result + subKeyName + @"[" + dllName + @"] - persistentHandlerClassAddin: " + persistentHandlerClass + "\r\n"; //[C:\Windows\system32\query.dll] //result = result + subKeyName + @"[" + dllName + @"];"; //[C:\Windows\system32\query.dll] result = result + subKeyName.ToLower() + @";"; } } } } return result; } } 
-one
source share

All Articles