Reputation: 5124
I'm reading the import table of a PE file and I'm able to get the names of the DLLs it imports from the IMAGE_IMPORT_DESCRIPTOR structures but I can't find where the DLLs paths are. How can I read them?
Upvotes: 1
Views: 753
Reputation: 6314
PE Images ONLY contain the names (and extension) of the dependencies NEVER their path.
Upvotes: 1
Reputation: 612954
You have to wait until runtime to be able to get hold of the paths to imported DLLs. This is because the answer depends upon the runtime environment at the point at which the library is loaded.
For example, two different programs could have two different DLL search paths. And so the paths to the imported DLLs could be different for those two programs.
Upvotes: 4
Reputation: 1333
You can't do that, the system will load the corresponding dll from an appropriate location at runtime. it's impossible to figure out the path before that point.
Upvotes: 1