I disassembled a misbehaving dll with IDA and identified the faulty code. Now I want to go one step further and replace the function with a self-written, hopefully less faulty one. The dll I'm talking about is written in C/C++ and the function in question is not exported.
What would be a practicable way to overwrite/replace this function along with relocation information and all? Everything I found on the net was about rebuilding MSIL dll's.
My guess would be to write a new function in assembler, assemble it, create a new section in the dll, put the code there and somehow introduce a call to the new function at the beginning of the original implementation. But I don't know these steps would exactly look or how to merge the relocation info etc. Or is there a better solution? Are there any primers or tools to help me get such a thing done?
Edit: Meanwhile I found articles about similar topics