I'm trying to override a specific function in kernel32.dll. Is it somehow possible to redefine that function in a static library and force the executable to use the one in the static library? I guess the different linkage could become a problem.
It would be possible to override it with my own custom DLL. However the problem is that the DLL itself needs to link to kernel32.dll, so it ignores my definition of that function.
EDIT: I got it working with my own DLL. When building it, link time code generation needs to be disabled. What about linking the overridden function statically though?
If I understand you correctly, you want custom behavior for a Windows API function in kernel32.dll. If so, you need to hook into the Windows API. One way to do this is to use Detours. Haven't tried it myself but here's a link to a CodeProject article - http://www.codeproject.com/Articles/30140/API-Hooking-with-MS-Detours.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With