Sometimes normal troubleshooting steps just won’t cut it. We might need to go above and beyond – more like forensic troubleshooting. Today I’ll write about a tool that will help us do that. Dependency Walker is a tool to find DLL dependencies and analyze the dependencies of a Windows application – like functions, modules, etc. It builds a hierarchical tree of all the dependent modules of an exe, dll, sys, etc.
How to find DLL dependencies
Dependency Walker is a free utility that scans any 32-bit or 64-bit Windows module (exe, dll, ocx, sys, etc.) and builds a hierarchical tree diagram of all dependent modules. It can help you in troubleshooting application errors, file registration errors, memory access violations and invalid page faults.
Dependency Walker becomes especially helpful if a specific program of yours is not loading, or a service is failing to start with an error pointing to a specific dll. In such cases you can load that program or dll in Dependency Walker, to see which file is failing to load or what module is causing the problem – and then fix it.
The program does not just load the modules, but it also scans for potential errors. According to the Help file, it performs the following jobs:
- Detects missing files. These are files that are required as a dependency to another module. A symptom of this problem is the “The dynamic link library BAR.DLL could not be found in the specified path…” error.
- Detects invalid Files. This includes files that are not Win32 or Win64 compliant and files that are corrupt. A symptom of this problem is the “The application or DLL BAR.EXE is not a valid Windows image” error.
- Detects import/export mismatches. Verifies that all functions imported by a module are actually exported from the dependent modules. All unresolved import functions are flagged with an error. A symptom of this problem is the “The procedure entry point FOO could not be located in the dynamic link library BAR.DLL” error.
- Detects circular dependency errors. This is a very rare error but can occur with forwarded functions.
- Detects mismatched CPU types of modules. This occurs if a module built for one CPU tries to load a module built for a different CPU.
- Detects checksum inconsistencies by verifying module checksums to see if any modules have been modified after they were built.
- Detects module collisions by highlighting any modules that fail to load at their preferred base address.
- Detects module initialization failures by tracking calls to module entry points and looking for errors.
- Dependency Walker can also perform a run-time profile of your application to detect dynamically loaded modules and module initialization failures. The same error checking from above applies to dynamically loaded modules as well.
For example, I was helping a client the other day – she was loading her browser, but it kept crashing without any specific errors. We had done most of the basic troubleshooting – but still, it kept crashing. This meant that one or more files required were creating a problem. It’s always hard to troubleshoot such cases but with Dependency Walker, we can see if something is wrong with one of the dependent files.
So I loaded the browser’s process in Dependency Walker.
Next, I expanded the list one by one.
Then I went through each of the modules, to see if I could find something suspicious there. I scrolled through the module and was lucky enough to find the problem.
I found that a particular dll file was missing. So I went and replaced the file from the Windows Installation DVD. That solved the problem. Now the browser no longer crashed.
I hope this will tell you how easy it’s to use the tool to discover possible dependency errors.
How to use Dependency Walker on Windows systems
To use Dependency Walker to investigate errors, you can follow these steps:
- Start Dependency Walker
- Click Open on the File menu to load the problem file
- In the View menu, click Start profiling. The Profile Module dialogue box appears
- Type any switches, program arguments, other options you want, and then click OK.
Dependency Walker will inject dwinject.dll before the error occurs and will log the events taking place at the time of the error.
Dependency Walker download
You can download Dependency Walker from here.
This tool has been around since… oh, my… lemmee think…
…hmm… I think at least Win9x, if memory serves. I know I’ve had a copy on every machine I’ve ever owned for YEARS; and it’s on the thumb/flash drive that I carry around so I can work on others’ machines if it need to.
It’s really quite good! Obviously, one needs to learn how to use it, but for what it does, it’s pretty much best-of-breed!
Nice tip for everyone! Thanks!
_______________________________
Gregg L. DesElms
Napa, California USA
gregg at greggdeselms dot com
In windows 7-Home Edition, am unable to start the service ‘Remote Access Connection Manager’ & get error 1068. Please let me know, if Dependency Walker would be able to help me out.
It may help. But I doubt if you can load the svchost.exe with a command switch.
Dependency Walker is a great tool. But remember: current versions of Windows implement features Dependency Walker doesn’t support or isn’t specifically designed for (widespread use of 64-bit operating systems, WinSxS, Folder Redirection and UAC etc.).
For example, this can lead to situations in which certain files (such as the file in this article) might actually be available on the system, but do not show up in Dependency Walker. This limits the use of Dependency Walker as a diagnostic tool for current systems – and leaving the actual issue unresolved.
I have loaded an user generated dll file in dependency walker, no function name is displayed in dependency walker in “PI” and “E” block. After expanding user dll,
dependency walker shows various system dll files and after clicking on them, “PI” and “E” blocks are showing function declaration contained in them.
But why it is not showing any function declaration for user generated dll file?
Do we need to give some flags during creation of dll file? or it works only with system dll ?
Hello, I used Dependecy Walker because I was trying to play a game, and I got that famous annoying error 0xc00007b. It showed me the missing dlls I had to download, and so I did, but still I would get this error. I noticed something – in the Module part, on the box that says CPU, there are tons of dlls that are in red written x64, only few are normal black written x86. I guess there is something like a mismatch going on over here, and I just don’t know how to fix it. Like, I guess the game is trying to use the x86 dlls when it should use the x64 ones. Any idea on how to fix it?
If only MS would stop breaking things that worked fine yesterday… My WIn 10 machine is barely three weeks old and I’ve got two programs that worked when first installed but are now broken. One shows a list of dozens of missing files (.dll’s) in depends.exe. The machine spontaneously went through a restart last night all on its own when I wasn’t looking. This is unacceptable. MS doesn’t own my machine.
There should probably be some mention of the compatibility option for maybe un-breaking things screwed up by MS’s latest “upgrade”.
Win 10 is 10x worse than Win 7.
I’m never buying another machine with Windows on it. TOTAL CRAP!!!!!!!!!