How to use WinSxS manifests to redirect to an older version of a DLL?

2.4k views Asked by At

Let's say I have an application that uses MSHTML. Installing IE9 beta would update MSHTML which breaks my application. I found that copies of IE8 dll is still present in the WinSxS folder, so maybe I can somehow use them without recompiling my program? Can WinSxS do it?

I've searched for a long time but couldn't figure out how to redirect the loader to use the IE8 MSHTML (which is in WinSXS) instead of the IE9 (which is in %SYSTEMROOT%\system32). Any ideas/examples would be appreciated.

2

There are 2 answers

0
kizzx2 On

I've since gone with a different approach to this problem. I'll share what I eventually did -- I hijack LoadLibrary and load whatever DLL I want: DLL file loaded twice with DLL redirection through manifest.

To answer the specific title of the question ("use WinSxS manifests to redirect"), I'll answer with "No, you can't" based on my long time battle with WinSxS (downvote if you disagree, I'll be happy to see how that can be done.)

0
Martyn Lovell On

You definitely can't use WinSxS manifests or policy redirection to force loading different versions of OS components. While os components are also stored in the WinSxS store, they are not bindable as sxs assemblies and so this kind of redirection is not possible.

Grovelling around to redirect LoadLibrary and force loading of an older version of mshtml (or any other OS DLL) is a very bad idea and I strongly recommend against it. Reasons include the fact that the older DLL may not be present on all installs, that you are unlikely to correctly hook all the loading paths (and hence create a strange hybrid), and of course that things like MSHTML are designed for use in a specific way and any other use could lead to problems later - especially in security sensitive stuff like HTML.

Martyn