I have a file plugin.dll
whose import table links to several symbols in foo.dll
. I want to make a new file plugin-modified.dll
, such that plugin-modified.dll
is identical to plugin.dll
, except that instead of linking to these symbols in foo.dll
, its import table imports those same symbols from bar.dll
. Can anyone suggest a tool that will rewrite PE files in this way? Ideally command-line/scriptable and open-source, but I'm willing to consider alternatives...
(The real use case is that I want to replace the reference to foo.dll
with foo-unique-id-934019384.dll
, so as to be able to ship plugin.dll
and foo.dll
together while avoiding name collisions, just in case someone else also distributes some other plugin that links to its own, different version of foo.dll
.
On Linux this can be done with the patchelf
tool, and on OS X it can be done with install_name_tool
; I'm looking for a Windows equivalent.
I'm aware that SxS assemblies may be able to solve this problem in a different way, but they have their own limitations so I want to explore both approaches before deciding.)
LoadLibarary
?