I want to reserve space for my codecave in application. I use VirtualAlloc function to reserve this space. I have X questions.
What parameters (sllocation type and protection) should I use to allocate memory for code-cave?
As return value I get address of my codecave. In other part of the program I want to JMP to that codecave. How to do it? I know (correct me if I'm wrong) that JMP takes as agument nuber that is offset from current location. But I want to JMP to ma codecave. How to calculate this offset.
Subtracting the address of your jump target from the address of the instruction after the jump will give you the jump offset.