2 ms·
For a Windows equivalent: https://github.com/Microsoft/Detours/wiki https://github.com/Microsoft/Detours/wiki It's a bit more unwieldy to use, because it does
by int_19h 8y ago
For a Windows equivalent:
https://github.com/Microsoft/Detours/wiki https://github.com/Microsoft/Detours/wiki
It's a bit more unwieldy to use, because it doesn't just replace all matching symbols (it's not how symbol lookup works for DLLs in Win32) - the injected DLL has to be written specifically with Detours in mind, and has to explicitly override what it needs to override. But in the end, you can do all the same stuff with it.
- andrewf 8y agothe injected DLL has to be written specifically with Detours in mind Does it? I've almost (ie: haven't :P) used Detours but https://github.com/Microsoft/Detours/wiki/OverviewInterception https://github.com/Microsoft/Detours/wiki/OverviewIntercepti... reads like it can rewrite standard function prologues.
- int_19h 8y agoI didn't phrase that unambiguously -"injected DLL" in this case means "the DLL with new code that is injected", not "the DLL that the code is being injected into". With LD_PRELOAD, all you need to override a symbol is an .so that exports one with the same name. With Detours, you need to write additional code that actually registers the override as replacing such-and-such function from such-and-such DLL. But yes, the code you're overriding doesn't need to know about any of that.
- andrewf 8y agoAh, I get it. Thanks.