dependencies of exe or dll

Post your FreeBASIC source, examples, tips and tricks here. Please don’t post code without including an explanation.
Post Reply
srvaldez
Posts: 3379
Joined: Sep 25, 2005 21:54

dependencies of exe or dll

Post by srvaldez »

if you have Visual Studio installed there's a nifty utility called dumpbin.exe, note that there are several versions, for x86, x64 and arm, choose the appropriate one.
example usage
dumpbin.exe /imports somedll.dll or exe
dumpbin.exe /exports somedll.dll or exe
dumpbin.exe /dependents somedll.dll or exe

you can get VS community edition for free.
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: dependencies of exe or dll

Post by MrSwiss »

srvaldez wrote:you can get VS community edition for free.
Well, yes and no.
Yes = it's free (costs: a download of some > 1 GB data)
No = uses plenty HDD/SSD resources

All for a little utility?!? (you must be joking!)
dodicat
Posts: 7983
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: dependencies of exe or dll

Post by dodicat »

I downloaded the file dumpbin.exe.
It needed link.exe, which i got.
then it needed (something).dll forget which.
then it needed (something else).dll forget which.
At that point they all got a free passage into the recycle.
So that was just another failure of many.
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: dependencies of exe or dll

Post by caseih »

I always thought the go to utility was dependency Walker, found at http://www.dependencywalker.com/
srvaldez
Posts: 3379
Joined: Sep 25, 2005 21:54

Re: dependencies of exe or dll

Post by srvaldez »

this tip was primarily meant for someone already having VS installed, it's your choice, take it or leave it.
@caseih
dependency walker shows information in an overwhelming fashion, you can't see the forest through the trees.
dumpbin -dependents shows all the info in an easy to read format.
@dodicat
dumpbin is part of VS and is not meant as a stand-alone utility apart from VS.
here are the dependencies of dumpbin from VS-2017
File Type: EXECUTABLE IMAGE

Image has the following dependencies:

KERNEL32.dll
VCRUNTIME140.dll
api-ms-win-crt-stdio-l1-1-0.dll
api-ms-win-crt-filesystem-l1-1-0.dll
api-ms-win-crt-process-l1-1-0.dll
api-ms-win-crt-runtime-l1-1-0.dll
api-ms-win-crt-math-l1-1-0.dll
api-ms-win-crt-locale-l1-1-0.dll
api-ms-win-crt-heap-l1-1-0.dll
if you want more info then ask for imports.
srvaldez
Posts: 3379
Joined: Sep 25, 2005 21:54

Re: dependencies of exe or dll

Post by srvaldez »

dodicat, since I consider you my friend try dumpbin, let me know if it works.
Last edited by srvaldez on Sep 01, 2017 8:48, edited 4 times in total.
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: dependencies of exe or dll

Post by caseih »

srvaldez wrote:dumpbin is part of VS and is not meant as a stand-alone utility apart from VS.

here are the dependencies of dumpbin from VS-2017
File Type: EXECUTABLE IMAGE

Image has the following dependencies:

KERNEL32.dll
VCRUNTIME140.dll
api-ms-win-crt-stdio-l1-1-0.dll
api-ms-win-crt-filesystem-l1-1-0.dll
api-ms-win-crt-process-l1-1-0.dll
api-ms-win-crt-runtime-l1-1-0.dll
api-ms-win-crt-math-l1-1-0.dll
api-ms-win-crt-locale-l1-1-0.dll
api-ms-win-crt-heap-l1-1-0.dll
Okay so the only dependency that dumpbin has is the MS Universal C runtime, then, which should be on any updated system, though it's also installable separately from MS. This is standard operating procedure on Windows for decades (the MS VC runtime).
srvaldez
Posts: 3379
Joined: Sep 25, 2005 21:54

Re: dependencies of exe or dll

Post by srvaldez »

there were about three more dependencies, link.exe, mspdb140.dll and msvcdis140.dll
srvaldez
Posts: 3379
Joined: Sep 25, 2005 21:54

Re: dependencies of exe or dll

Post by srvaldez »

another dependency, it should be complete now.
St_W
Posts: 1626
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: dependencies of exe or dll

Post by St_W »

It's a useful tool. I've mentioned used it just recently: https://freebasic.net/forum/viewtopic.p ... 55#p234855
And yes, for analyzing the dependencies of EXEs or DLLs I'd first use dependency walker ("depends.exe"). Dumpbin is useful for libraries or when more low-level information is needed.

Personally I've installed the complete Visual Studio in several versions but I can understand that this is too much for only this tool. btw the latest version (VS 2017) allows to selectively install components so that you can define the storage use. Things like the Windows SDK (which can be also installed via the VS installer) can never hurt (if you've enough disk space).
marcov
Posts: 3462
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: dependencies of exe or dll

Post by marcov »

(If FB delivers objdump, afaik objdump -p also can show quite a lot. Not as overviewable though, but if it comes with FB it might be a candidate for IDE integration.

The best IMHO is the heavenware (or something) PE Explorer, which is payware with free trial. In cases of conflict or uncertainly, I download that trial )
srvaldez
Posts: 3379
Joined: Sep 25, 2005 21:54

Re: dependencies of exe or dll

Post by srvaldez »

thank you marcov for the tip on heaventools PE Explorer http://www.heaventools.com/download-pe-explorer.htm, looks like a very useful tool though just a bit hard on the wallet but probably worth it.
regarding objdump, it's included in msys2 and to my surprise it depends only on Windows dll's, so I see no reason why it couldn't be included with FB
St_W
Posts: 1626
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: dependencies of exe or dll

Post by St_W »

objdump is also nice, but it doesn't support other compilers than the GNU compilers very well. If you e.g. want to analyze binaries built with MSVC better use dumpbin.

Instead of PE Explorer I'm using CFF Explorer Suite. It's free and you can download it here: http://www.ntcore.com/exsuite.php
srvaldez
Posts: 3379
Joined: Sep 25, 2005 21:54

Re: dependencies of exe or dll

Post by srvaldez »

thank you St_W for the tip.
[edit] CFF explorer is nice, it's similar to the discontinued eXeScope but with more features and it's 64-bit.
Post Reply