views:

504

answers:

1

I created a simple Win32 application to demonstrate UXtheme on XP by including a manifest dependency on the ver 6 commctl32.dll I then created a simple Win32 dll, built it with ISOLATION_AWARE_ENABLED, and tested it with an embedded manifest specifying both version 5 and 6 of Comctl32.dll

I successfully got the exe and dll to use different versions of comctl32.dll using this method. Both with the exe using 5 and the dll version 6, and the other way around.

Then, I reset the app AND the dll to have a comctl ver 5 manifest dependency. And introduced an application configuration file:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration>
  <windows>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" processorArchitecture="amd64" publicKeyToken="6595b64144ccf1df"/>
        <bindingRedirect oldVersion="5.82.7100.0" newVersion="6.0.0.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </windows>
</configuration>

Now, when I run my application, the applications is clearly being redirected to commctl v6 - dialogs are clearly displayed using the XP UXTheme enabled. However, the dll is not being redirected and is using the non themed ver 5 of commctl.

There is no mention of per-dll config files for doing bindingRedirects in the documentation. And trying to create one does not do anything.

I do also know that doing a bindingRedirect from one major version of an assembly to another is not a supported scenario, but Im really just using commctl32 as an obvious easy way to test the mechanics.

How do I redirect the version of a dependent assembly of a dll?

+1  A: 

So, this question has been answered.

  • I used Process Monitor to track file access,
  • After realizing that accesses to .manifest and .config files come from the csrss.exe NOT my own process,
  • And Windows Vista won't even access .manifest or .config files that are added later as it caches their existence along with a date-time stamp for the exe.

After all that I discovered that LoadLibrary does probe for a .config file when loading dlls:

full_path_to_dll\dllname.dll.2.config

Binding redirects in this file will be processed.

Chris Becke