I need to add code into an assembled program. If I am only changing a jump, I change JE to JNE and that is simple. If I need to add only a couple of instructions, I can find a section with a bunch of NOP's and jump to that section, insert my new code, and then jump back.

What do I do if I need to insert about 10 lines of instructions and I do not have a section of NOP's that is large enough to fit my new code? I know I can not move any of the existing code since that would throw off any calls or jumps. I am trying to update the disassembled code in OLLYDBG since all I have is the executable.

Any suggestion on how to do this would be appreciated.


What you're looking for is a codecave. Take a look at http://www.codeproject.com/Articles/20240/The-Beginners-Guide-to-Codecaves; it has a good intro on how to get started.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.