How do I detect the DLLs required by an application?

后端 未结 7 852
一生所求
一生所求 2020-11-30 11:40

In a nutshell: I want to do the same thing \"Dependency Walker\" does.

Is there any Win32 API function which can enumerate the dependencies of a EXE and/or DLL file?

相关标签:
7条回答
  • 2020-11-30 12:10

    It seems that Dependency Walker source code itself was given by Microsoft via MSJ. Please look at Re: [DUG]: Dependency Walker.

    You need to refer some other site to download since the link given in this mail trail is not working.

    Please check MSJ Source Code Updates: Since I don't have time, I have not checked whether it contains source code or only EXE foæes.

    0 讨论(0)
  • 2020-11-30 12:10

    The following commands dumps the direct dependencies of some.exe :

    dumpbin /imports some.exe
    

    It works on DLLs too.

    This won't list dependencies such as plugins loaded at application launch (via LoadLibrary calls). Same for COM dependencies since they work the same way (as far as I know).

    If you need to know all the DLLs used by a running program, use ProcessExplorer.

    0 讨论(0)
  • 2020-11-30 12:13

    Run up the application, with Process Explorer already running and set to filter for your applications .exe name.

    There is no way to detect all COM dependencies that an executable has without running it.

    0 讨论(0)
  • 2020-11-30 12:16

    You probably need to walk the executable's file structure to work this out programatically. Therefore something like the 'PE Dump' program that's mentioned here: http://msdn.microsoft.com/en-gb/magazine/cc301808.aspx would be a good starting point. The actual code that you need can be found here: http://www.wheaty.net/downloads.htm

    0 讨论(0)
  • 2020-11-30 12:17

    User @blue... eluded to Dependency Walker. When using Dependency Walker, after opening the file you can see the base requirements that are used. Only when executing the program and exercising all of its functions can you find all of the dynamically-loaded DLLs.

    Sometimes the best thing to do if you can is ask the developer what DLLs are required. An application may only load some DLLs when absolutely needed. e.g. Loading faultrep.dll, for custom Windows Error Reporting, when it is about to crash.

    0 讨论(0)
  • 2020-11-30 12:18

    findstr -i .dll exe.exe | more | findstr -i .dll | more

    rem :)

    0 讨论(0)
提交回复
热议问题