Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using IFilter from a 32bit app on a x64 system

I need to use an IFilter interface from a 32bit app on Windows x64 systems. This is easy for .doc files as offfilt.dll supports both build types. However, I need to also get the plain text from .docx and other files types. The solution at first is to install Microsoft Filter Packs. However, only the x64 version will install ... which means my 32bit app can't use them. They work great under 32bit Windows.

Has anyone found a way around this?

like image 516
pcunite Avatar asked Feb 07 '12 23:02

pcunite


3 Answers

I found a way to install docx Filter Pack 32bits in a 64bits OS. To other file formats is similar.

  1. Install Filter Pack 32 bits in a 32bits OS;
  2. Copy ifilters files in directory “C:\Program Files\Common Files\Microsoft Shared\Filters” from 32 bits OS to the a directory “C:\Program Files (x86)\Common Files\Microsoft Shared\Filters” in 64bits OS.
  3. Copy the following lines to a file “ifilter.reg” and execute the file:

File's content:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.docx\PersistentHandler]
@="{D3B41FA1-01E3-49AF-AA25-1D0D824275AE}"

[HKEY_CLASSES_ROOT\.docm\PersistentHandler]
@="{D3B41FA1-01E3-49AF-AA25-1D0D824275AE}"

[HKEY_CLASSES_ROOT\.dotx\PersistentHandler]
@="{D3B41FA1-01E3-49AF-AA25-1D0D824275AE}"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.docm\PersistentHandler]
@="{D3B41FA1-01E3-49AF-AA25-1D0D824275AE}"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.docx\PersistentHandler]
@="{D3B41FA1-01E3-49AF-AA25-1D0D824275AE}"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.dotx\PersistentHandler]
@="{D3B41FA1-01E3-49AF-AA25-1D0D824275AE}"

[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{D3B41FA1-01E3-49AF-AA25-1D0D824275AE}]
@="Office Open XML Format Word Persistent Handler"

[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{D3B41FA1-01E3-49AF-AA25-1D0D824275AE}\PersistentAddinsRegistered]

[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{D3B41FA1-01E3-49AF-AA25-1D0D824275AE}\PersistentAddinsRegistered\{89BCB740-6119-101A-BCB7-00DD010655AF}]
@="{5A98B233-3C59-4B31-944C-0E560D85E6C3}"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\CLSID\{D3B41FA1-01E3-49AF-AA25-1D0D824275AE}]
@="Office Open XML Format Word Persistent Handler"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\CLSID\{D3B41FA1-01E3-49AF-AA25-1D0D824275AE}\PersistentAddinsRegistered]

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\CLSID\{D3B41FA1-01E3-49AF-AA25-1D0D824275AE}\PersistentAddinsRegistered\{89BCB740-6119-101A-BCB7-00DD010655AF}]
@="{5A98B233-3C59-4B31-944C-0E560D85E6C3}"

[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{5A98B233-3C59-4B31-944C-0E560D85E6C3}\InprocServer32]
@="C:\\Program Files (x86)\\Common Files\\microsoft shared\\Filters\\offfiltx.dll"
"ThreadingModel"="Both"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\CLSID\{5A98B233-3C59-4B31-944C-0E560D85E6C3}\InprocServer32]
@="C:\\Program Files (x86)\\Common Files\\microsoft shared\\Filters\\offfiltx.dll"
"ThreadingModel"="Both"


[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\CLSID\{D3B41FA1-01E3-49AF-AA25-1D0D824275AE}\PersistentAddinsRegistered\{89BCB740-6119-101A-BCB7-00DD010655AF}]
@="{5A98B233-3C59-4B31-944C-0E560D85E6C3}"
like image 103
Rui Oliveira Avatar answered Oct 15 '22 01:10

Rui Oliveira


Extending Rui answer with windows registry script for 3 file formats (Word, Excel, PowerPoint). Hope, will safe time for somebody as it worked well:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.docx\PersistentHandler]
@="{D3B41FA1-01E3-49AF-AA25-1D0D824275AE}"
[HKEY_CLASSES_ROOT\.pptx\PersistentHandler]
@="{4F46F75F-199F-4C63-8B7D-86D48FE7970C}"
[HKEY_CLASSES_ROOT\.xlsx\PersistentHandler]
@="{4887767F-7ADC-4983-B576-88FB643D6F79}"


[HKEY_CLASSES_ROOT\.docm\PersistentHandler]
@="{D3B41FA1-01E3-49AF-AA25-1D0D824275AE}"
[HKEY_CLASSES_ROOT\.pptm\PersistentHandler]
@="{4F46F75F-199F-4C63-8B7D-86D48FE7970C}"
[HKEY_CLASSES_ROOT\.xlsm\PersistentHandler]
@="{4887767F-7ADC-4983-B576-88FB643D6F79}"

[HKEY_CLASSES_ROOT\.dotx\PersistentHandler]
@="{D3B41FA1-01E3-49AF-AA25-1D0D824275AE}"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.docm\PersistentHandler]
@="{D3B41FA1-01E3-49AF-AA25-1D0D824275AE}"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.docx\PersistentHandler]
@="{D3B41FA1-01E3-49AF-AA25-1D0D824275AE}"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.pptm\PersistentHandler]
@="{4F46F75F-199F-4C63-8B7D-86D48FE7970C}"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.pptx\PersistentHandler]
@="{4F46F75F-199F-4C63-8B7D-86D48FE7970C}"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.xlsm\PersistentHandler]
@="{4887767F-7ADC-4983-B576-88FB643D6F79}"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.xlsx\PersistentHandler]
@="{4887767F-7ADC-4983-B576-88FB643D6F79}"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.dotx\PersistentHandler]
@="{D3B41FA1-01E3-49AF-AA25-1D0D824275AE}"

[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{D3B41FA1-01E3-49AF-AA25-1D0D824275AE}]
@="Office Open XML Format Word Persistent Handler"
[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{4F46F75F-199F-4C63-8B7D-86D48FE7970C}]
@="Office Open XML Format PowerPoint Persistent Handler"
[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{4887767F-7ADC-4983-B576-88FB643D6F79}]
@="Office Open XML Format Excel Persistent Handler"

[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{D3B41FA1-01E3-49AF-AA25-1D0D824275AE}\PersistentAddinsRegistered]
[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{4F46F75F-199F-4C63-8B7D-86D48FE7970C}\PersistentAddinsRegistered]
[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{4887767F-7ADC-4983-B576-88FB643D6F79}\PersistentAddinsRegistered]

[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{D3B41FA1-01E3-49AF-AA25-1D0D824275AE}\PersistentAddinsRegistered\{89BCB740-6119-101A-BCB7-00DD010655AF}]
@="{5A98B233-3C59-4B31-944C-0E560D85E6C3}"
[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{4F46F75F-199F-4C63-8B7D-86D48FE7970C}\PersistentAddinsRegistered\{89BCB740-6119-101A-BCB7-00DD010655AF}]
@="{DDFE337F-4987-4EC8-BDE3-133FA63D5D85}"
[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{4887767F-7ADC-4983-B576-88FB643D6F79}\PersistentAddinsRegistered\{89BCB740-6119-101A-BCB7-00DD010655AF}]
@="{F90DFE0C-CBDF-41FF-8598-EDD8F222A2C8}"


[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\CLSID\{D3B41FA1-01E3-49AF-AA25-1D0D824275AE}]
@="Office Open XML Format Word Persistent Handler"
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\CLSID\{4F46F75F-199F-4C63-8B7D-86D48FE7970C}]
@="Office Open XML Format PowerPoint Persistent Handler"
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\CLSID\{4887767F-7ADC-4983-B576-88FB643D6F79}]
@="Office Open XML Format Excel Persistent Handler"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\CLSID\{D3B41FA1-01E3-49AF-AA25-1D0D824275AE}\PersistentAddinsRegistered]
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\CLSID\{4F46F75F-199F-4C63-8B7D-86D48FE7970C}\PersistentAddinsRegistered]
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\CLSID\{4887767F-7ADC-4983-B576-88FB643D6F79}\PersistentAddinsRegistered]

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\CLSID\{D3B41FA1-01E3-49AF-AA25-1D0D824275AE}\PersistentAddinsRegistered\{89BCB740-6119-101A-BCB7-00DD010655AF}]
@="{5A98B233-3C59-4B31-944C-0E560D85E6C3}"
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\CLSID\{4F46F75F-199F-4C63-8B7D-86D48FE7970C}\PersistentAddinsRegistered\{89BCB740-6119-101A-BCB7-00DD010655AF}]
@="{DDFE337F-4987-4EC8-BDE3-133FA63D5D85}"
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\CLSID\{4887767F-7ADC-4983-B576-88FB643D6F79}\PersistentAddinsRegistered\{89BCB740-6119-101A-BCB7-00DD010655AF}]
@="{F90DFE0C-CBDF-41FF-8598-EDD8F222A2C8}"

[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{5A98B233-3C59-4B31-944C-0E560D85E6C3}\InprocServer32]
@="C:\\Program Files (x86)\\Common Files\\microsoft shared\\Filters\\offfiltx.dll"
"ThreadingModel"="Both"
[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{DDFE337F-4987-4EC8-BDE3-133FA63D5D85}\InprocServer32]
@="C:\\Program Files (x86)\\Common Files\\microsoft shared\\Filters\\offfiltx.dll"
"ThreadingModel"="Both"
[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{4887767F-7ADC-4983-B576-88FB643D6F79}\InprocServer32]
@="C:\\Program Files (x86)\\Common Files\\microsoft shared\\Filters\\offfiltx.dll"
"ThreadingModel"="Both"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\CLSID\{5A98B233-3C59-4B31-944C-0E560D85E6C3}\InprocServer32]
@="C:\\Program Files (x86)\\Common Files\\microsoft shared\\Filters\\offfiltx.dll"
"ThreadingModel"="Both"
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\CLSID\{DDFE337F-4987-4EC8-BDE3-133FA63D5D85}\InprocServer32]
@="C:\\Program Files (x86)\\Common Files\\microsoft shared\\Filters\\offfiltx.dll"
"ThreadingModel"="Both"
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\CLSID\{F90DFE0C-CBDF-41FF-8598-EDD8F222A2C8}\InprocServer32]
@="C:\\Program Files (x86)\\Common Files\\microsoft shared\\Filters\\offfiltx.dll"
"ThreadingModel"="Both"


[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\CLSID\{D3B41FA1-01E3-49AF-AA25-1D0D824275AE}\PersistentAddinsRegistered\{89BCB740-6119-101A-BCB7-00DD010655AF}]
@="{5A98B233-3C59-4B31-944C-0E560D85E6C3}"
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\CLSID\{4F46F75F-199F-4C63-8B7D-86D48FE7970C}\PersistentAddinsRegistered\{89BCB740-6119-101A-BCB7-00DD010655AF}]
@="{DDFE337F-4987-4EC8-BDE3-133FA63D5D85}"
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\CLSID\{4F46F75F-199F-4C63-8B7D-86D48FE7970C}\PersistentAddinsRegistered\{89BCB740-6119-101A-BCB7-00DD010655AF}]
@="{F90DFE0C-CBDF-41FF-8598-EDD8F222A2C8}"
like image 28
Yury Lapin Avatar answered Oct 15 '22 02:10

Yury Lapin


As you found out, there isn't a supported way to install the 32-bit filters on a 64-bit system, see reply from MSFT near the end of this post: How can I install the 32 bit Office Filter Pack on a 64 bit system?.

The solution suggested there, is to create a helper program to do the filtering and pass the data back to the main application.

There are a number of ways to do IPC in Windows, so pick the one that works for you. I've created a service that uses WCF to easily create a remote proxy that makes the operation very transparent to the main application.

like image 1
jayblank Avatar answered Oct 15 '22 02:10

jayblank