This question already has an answer here:

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.

marked as duplicate by usr2564301, ixje, ebux, peter ferrie, jvoisin Jan 30 '16 at 15:41

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


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.

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