Lookout on Office 2007

If you have come here from Google, search no further for I have solved the problem of making Lookout play nicely with Outlook 2007. There are two issues to contend with. One is not such a big deal but may be the cause of numerous Vista users reporting the indexer crashes or exhibits strange behavior while indexing. Additionally it will cause an error message if using date ranges in your query. The problem exists only if you have the .NET 2.0 Framework installed.

Between 1.1 and 2.0 there was a breaking change involving ParseEx.ReplaceDates. If you’re interested in the details, there is a great write-up about it here . The second and more show stopping problem, is getting Lookout to load in Outlook 2007 at all. After installing the application and launching Outlook 2007, you are greeted with some carnation instant failure.

WTH does that mean?? and more importantly, can we get around it?

If you’ve attempted browsing to the link from the error, you’ve discovered it does not work. Additionally it is unavailable via Google page cache or Archive.org. FAIL. But all is not lost.

In short, Lookout was designed to work only with a specific version of the PIA’s (Primary Interop Assemblies). PIA’s are used when developing Office add-on’s and somewhat bring their own version of DLL Hell with them. This problem however, is rooted solely in one of the libraries used in Lookout. Examining the library with Reflector shows a function, CheckOutlookInterop . This function is called by another, Run . The Run function looks like this

public bool Run()
{
  bool flag = true;
  if (flag)
  {
    flag = this.CheckOutlookInterop();
  }
  return flag;
}

So rather than attach CheckOutlookInterop we’ll just go after Run . CheckOutlookInterop returns true if the assembly version is as expected, false otherwise. Taking that, we can just make Run always return true and we’re good to go. You can download the modified at the end of this article. To patch the dll yourself you need one thing, the .NET 2.0 SDK .

Be sure to make a backup before modifying any files in case you make a mistake!

First, you need to disassemble the dll. Via the command line this would be similar to ildasm Inventures_Olk.dll /OUT=source.il. Alternately, you can run ildasm with no parameters to display the GUI from which you can open the dll and dump the contents. If using the GUI leave all options as they are when dumping the source.

Next open the IL dump, and search for “Run()” .

What you will see is the following.

.method public hidebysig instance bool Run() cil managed
{
    .maxstack 1
    .locals init (
        [0] bool flag,
        [1] bool flag2)
    L_0000: ldc.i4.1
    L_0001: stloc.0
    L_0002: ldloc.0
    L_0003: brfalse.s L_000c
    L_0005: ldarg.0
    L_0006: call instance bool
 	   Inventures_Olk.SelfTest::CheckOutlookInterop()
    L_000b: stloc.0
    L_000c: ldloc.0
    L_000d: stloc.1
    L_000e: br.s L_0010
    L_0010: ldloc.1
    L_0011: ret
}

You will want to change it to this.

.method public hidebysig instance bool Run() cil managed
{
    .maxstack 1
    .locals init (
        [0] bool flag)
    L_0000: nop
    L_0001: ldc.i4.1
    L_0002: stloc.0
    L_0003: br.s L_0005
    L_0005: ldloc.0
    L_0006: ret
}

After saving the changes, you must use ilasm to re-compile the IL code back into a dll. The command to do this is ilasm /dll sourcefile.il /output=filename.dll. After executing that last command you have rebuilt the patched library. Now all that is needed is to close Outlook if it is running, copy the patched dll over the existing Inventures_Olk.dll in the Lookout folder, and re-launch Outlook. At this point Lookout should work without a hitch. If you were to load the patched dll into Reflector, the Run function would consist of only one line being return true.

*Note that ildasm and ilasm will likely not be in your path. If you have a Visual Studio Command Prompt on your start menu, that is what you want to run prior to performing the above task.

 

Download patched lookout.dll Fixes .NET 2.0 date issue
Download patched Inventures_Olk.dll Fixes Office 2k7 bug

Leave a Reply