2021年2月5日星期五

Why is my branch instruction not jumping to the given address?

I'm currently learning reverse engineering and therefore I need to learn assembly. The code is running well, but I got an error on JE and JNE instructions. To be more specific: I'm doing a detour hook as a practice and the program crashes, because it jumps to the false address.

I wanted to write this, but the compiler gave me an error (LNK2016):

JE 0x123 (0x123 example address)  

I fixed that problem by writing:

JE short 0x123  

Full function code:

my_hook:      push rbp              mov rbp, rsp        mov dword [rcx + 0x18], 99           test rcx, rcx      je 0x7FF7847902EE      lock dec dword [rcx + 0x08]      jne 0x7FF7847902EE      mov rcx, [rsp + 0x30]        leave         ret  

But the problem now is, that it is jumping to the beginning of the function instead of 0x123 in our case.

https://stackoverflow.com/questions/66071606/why-is-my-branch-instruction-not-jumping-to-the-given-address February 06, 2021 at 06:46AM

没有评论:

发表评论