'I'm trying to export the contents of a process after dynamic linking in order to make a static version of the PE. Can it be done this way?

Let's say I have a PE that leverages dynamically linked libs and I want to statically link everything. And I don't have the source code, so using compiler flags isn't an option. I've been trying to figure out how to do this.

It seems like you could most easily accomplish this by letting the dynamic linker do its thing at runtime so that all of the necessary libraries are loaded into the process memory, then basically export that memory and store it statically within the PE, perhaps in the .text section?

Am I completely wrong, or is this a viable approach?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source