- -- the actual insn to patch is displaced by two bytes
- let insn_ptr = intPtrToPtr (fromIntegral (eip - 2)) :: Ptr CUChar
- -- call offset is displaced by one byte
- let imm_ptr = intPtrToPtr (fromIntegral (eip - 1)) :: Ptr CPtrdiff
+ -- the actual insn to patch as pointer
+ let insn_ptr = intPtrToPtr (fromIntegral eip) :: Ptr CUChar
+ -- call offset is displaced by one byte (as the first byte is the opcode)
+ let imm_ptr = intPtrToPtr (fromIntegral (eip + 1)) :: Ptr CPtrdiff