I was recently troubleshooting an issue with a dll that just would not install, as in “regsvr32”. For the first time in years I had a non .NET dll that had problems during the command line registration. Since my focus is all .NET recently, I would guess that is has been more than six years since dealing with and registering dlls in this fashion, so for a moment I just sat there wondering where to start. Then thankfully I was reminded of the command line tool Dependency Walker, after loading the dll it became clear what dependencies were missing.

 

What is Dependency Walker(I hear you young .NET devs cry)? Dependency Walker will recursively scan all dependent modules required by a particular application. In the following screenshot I show the result of Dependency Walker evaluating the dependencies of DEPENDS.exe. During a scan it perform the following tasks:

  • 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 entrypoints and looking for errors.

Dependency

 

Dependency Walker can also perform a run-time profile of your application to detect dynamically loaded modules and module initialization failures. You can download Dependency Walker here.