Hulud
Hulud

Reputation: 69

Tweak DLL module name during LoadLibrary

I want to load at runtime a third party binary plug-in (P.dll) in my application (A.exe). This plug-in has been built for another application (B.exe).

The plug-in has implicit dll import on the B.exe module, like :

I have exported the functions func1, func2 and func3 from A.exe but I can't load the dll with LoadLibrary because there is no module named "B.exe".

Is there something better to do than renaming my application "B.exe" or patching P.dll's PE ?

Thanks,

Cyril

Upvotes: 5

Views: 775

Answers (1)

Abyx
Abyx

Reputation: 12918

You can create fake B.exe, (actually it can be DLL), and redirect B.exe exports to A.exe .

Redirecting can be done by forwarding exports, see "Export Forwarding" section here.

Upvotes: 1

Related Questions