Search code examples
windowsmanifestextractside-by-sidedll

Programmatically grabbing DLL manifest information with Python or other common scripting language / tool


I am having a problem like this one:

http://svn.haxx.se/tsvnusers/archive-2008-07/1051.shtml

Except that the app is our own (sorry, won't give you confidential details). Although, it is not our fault that SideBySide is so flawed.

Anyhow, version X works and version Y bombs right at the start. I am facing the task of walking through a bunch of directories and up to 100 dll files to figure out what the difference may be.

It looks like there is a conflict between two dll files which load two different versions of another dll file.

I would appreciate your help with a Python / other snippet for extracting a manifest from a given file. Thanks!

EDIT: By the way, I did find a way: I can run the following command (mt.exe is part of Visual Studio 2008 Tools): mt.exe -inputresource:MyFile.dll;#2 -out:MyFile.dll.extracted_manifest.txt.

This is a good start, but there are two problems with it:

  1. There can be multiple manifests embedded (In my understanding): #1, #2, #3, ... - I do not know which ones and how many ahead of time. What is the maximum?
  2. If I take a guess and run mt.exe with that parameter, I get a failure. Dealing with these errors would make the script longer.

Could someone shed some light on this please?

ANOTHER EDIT: Ah, never mind! 1 is for .exe, 2 is fo dll and that is it. I guess I know what to do now. However, if you have a solution which beats mine, or if you have automated calls to mt.exe from a Python / other script, then feel free to share it.


Solution

  • A manual brute-force (clicking) approach worked faster. Took only a few hours.