Using EasyHook I have successfully hooked both exported functions and known vtable functions for various C++ classes. In all these cases target programs have used DLLs.
Provided I know the address of a function’s entry point, is it possible to do the same when a library has been linked into the target program as opposed to being a separate library?
It appears with EasyHook you can hook any subroutine whose address is calculable.
In my case hooking static linked SSL_read and SSL_write in OpenSSL was as simple as identifying the offsets with my favourite debugger and then installing the hooks.
Now all that’s left is to install the hook:
I should mention that in this example you’ll need libeay32.dll and ssleay32.dll as the latter depends on the former.
Happy hooking!