8

I'm wondering if anyone knows of an elegant way of determining what BPLs are required by a given (compiled) DLL, EXE or BPL.

I'm not sure if this is even possible shy of simply scanning the binary for text references to .bpl filenames (which would be prone to possible false-positives).

Ideally I'd like to return a TStringList or even a comma-separated String containing the names of all required .bpl files.

LaKraven
  • 5,804
  • 2
  • 23
  • 49
  • http://www.peganza.com/#PAL does this kind of thing on source, but I don't think it reads .exe, etc. You might check though. – RobertFrank Jun 04 '12 at 20:12
  • Not even the IDE does a reliable job of this or we wouldn't get "Unable to load X.BPL" when Y.BPL has already implicitly background-loaded that BPL without the IDE having any clue of that thing loading. I really would like to know this too. – Warren P Jun 04 '12 at 20:13
  • 2
    "DUMPBIN /imports" can do it perfectly reliably, so it is certainly possible. However piping the output back into your program does not meet your criterion of elegance. – frogb Jun 04 '12 at 20:25
  • 1
    You can try reading the `Import address Table`of the PE file, but it only will show the load-time dependencies; AFAIK it is not possible to know every run-time dependency without disassembling or executing the application, if the application is running you can use the `CreateToolhelp32Snapshot` function with the TH32CS_SNAPMODULE flag. – RRUZ Jun 04 '12 at 20:40
  • You could recursively do a dumpbin /imports on every dependant DLL/BPL too, to get a complete recursive list, I guess. – Warren P Jun 04 '12 at 20:53

3 Answers3

2

For packages you can use the requires section of the PACKAGEINFO resource - see TJclPePackageInfo.

Uwe Schuster
  • 863
  • 4
  • 7
  • This works relatively well for compiled BPLs... I was hoping someone would know of a *similar* solution for DLLs and EXEs, but apparently not. – LaKraven Jun 08 '12 at 07:27
  • I'll accept your answer since it gets me at least part-way there. – LaKraven Jun 08 '12 at 07:28
0

I came across this from felix-cobri - its a little rough round the edges but does what I need and that is to list all the DLLS that my exe (or DLL) uses.

http://www.felix-colibri.com/papers/colibri_utilities/exe_dll_pe_explorer/exe_dll_pe_explorer.html

Good luck

Richard Turner
  • 423
  • 4
  • 12
0

GExperts' PE Information tool displays the list of bpls and dlls that are implicit loaded into any .exe, .dll or .bpl

Daniel Santos
  • 1,451
  • 15
  • 38