Skip to main content

Exchange 2000 / 2003 PIA Patches for Windows SDK 7.0 and 7.1

· 3 min read
Exchange 2010 logo

Now, there are no official binary PIAs for Exchange Server 2000 / 2003. However, Microsoft does provide such PIAs in "source" form (not really source code as such... but we'll get to that) that you can download and compile yourself. There is an MSDN article that explains how to use the Exchange Server PIA wrappers, however I strongly recommend you download the code and read the included "Writing Managed Sinks for SMTP and Transport Events.doc" file instead - it is far more up to date than the MSDN article in areas that are quite significant (such as the actual build process).

The PIA build process is defined by an nmake-based Makefile, which performs the following:

  1. generate a COM type library from an included MIDL file via the MIDL compiler.
  2. convert the COM type definitions into an equivalent CLR assembly via tblimp.exe.
  3. disassemble the CLR assembly via ildasm.exe.
  4. apply a patch to the disassembled intermediate language file (using an old GNU patch binary included in the download).
  5. recompile the CLR assembly via ilasm.exe.

Just as an aside, although the Makefile is written for nmake, which (as far as I know) is only available with Visual Studio, the build process itself only uses utilities that are available with the Windows SDK and/or .NET Framework, both of which a freely available from Microsoft. So with a very small bit of work, the nmake dependency can be removed by creating an equivalent Makefile for another make utility, or simply writing a batch/command script to use instead.

Anyway, the point of this post is all about step 4 above - applying a patch. The patch file is, so far as I can tell, intended to fix a number of compile-time errors that occur when compiling managed code against the final CLR assembly. The errors themselves are all basic function/method signature errors, and are quite easy, but laborious, to fix, and the fixes are different for each version of the Windows SDK you choose to build against.

The download from Microsoft includes patches for Visual Studio 2003 and Visual Studio 2005 only. However, while working on MailGuard's email archiving service recently, I had need to compile the Exchange Server PIA assemblies with Windows SDK 7.0 and 7.1, so I went ahead a created the required patch files myself, and MailGuard has graciously allowed me to publish them here :)

So, without any further ado, here they are:

It's worth noting that Visual Studio 2010 uses Windows SDK 7.0a internally, which is essentially identical to Windows SDK 7.0 (the "a" suffix is mostly just to allow side-by-side installation), so the patch I created for Windows SDK 7.0 should work (untested) with Visual Studio 2010. Please let me know how it goes if you happen to try it.

Enjoy :)

Attachments