OLElsTool - Working with OLE storages
I’m posting here a tool that can be used for viewing and modifying OLE storage.
The syntax is as follows:
Usage: OLElsTool.exe <File_In> <Options>
-L: list
-X <part> <toFile>: extract part
-M <part> <fromFile>: modify part
Sample usage: say we copy an Excel range and paste it into Word using Paste Special, as Link, Microsoft Excel Worksheet Object.
If we now save as DOC, the Excel object will be embedded as an EMF picture. Using this tool, we can view the contents of the OLE container using:
OLElsTool.exe Sample.doc -L > lst.txt
In the output file, we can see the field:
♥EPRINT
To extract it, use:
OLElsTool.exe Sample.doc –X ♥EPRINT picture.emf
Note: ♥EPRINT contains a non-alphanumeric character (0x03) that can be input by copy-pasting from the listing file (lst.txt).
Provided is the whole Visual Studio 2008 solution. It is written in Visual C++ using the Win32 API for working with OLE Storage.