Reputation: 119
I need to validate that an executable's dependencies exist and if possible, the correct version of that dependency. Including the dependency's dependencies. Using dumpbin.exe, I am able to gather an exe or dll's dependencies. For example
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin>dumpbin.exe /dependents "C:\Program Files (x86)\Notepad++\notepad++.exe"
Microsoft (R) COFF/PE Dumper Version 14.00.24215.1
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file C:\Program Files (x86)\Notepad++\notepad++.exe
File Type: EXECUTABLE IMAGE
Image has the following dependencies:
COMCTL32.dll
SHLWAPI.dll
SHELL32.dll
KERNEL32.dll
USER32.dll
GDI32.dll
COMDLG32.dll
ADVAPI32.dll
ole32.dll
Summary
20000 .data
52000 .rdata
13000 .reloc
86000 .rsrc
10F000 .text
I am reading the output of dumpbin.exe via Process.Start() in C# and parsing the return data, no problem. I can also validate if a file exists, easy... However, it is entirely possible that more than one of a dependency's dependencies exist on a system. How would you validate the existence of the correct dependency or version of said dependency?? This becomes important as validating the dependency's dependencies also exist. It would be nice if there was a way to get above as
"C:\Windows\System32\ole32.dll"
Any thoughts to this? Thanks in advance! (PS- if I have this completely wrong in terms of dll locations, like it can only live in the .exe's executing path or system32, please tell me, thanks)
Upvotes: 2
Views: 1950
Reputation: 127
The load order for multiple libraries on the node you are testing affects which library.
Runtime methods are:
Use sysinternals procmon loaded dependencies.
Use windbg by launching the program from windbg to see loader messages.
Upvotes: 1