-1

I have the following code: enter image description here

I am using IDA PRO. I am trying to patch this code and change the line mov eax, [rax+10h] to mov eax, 3. mov eax, 3 is B8 03 00.

I do this in the hex editor and when I change the code from

8B 40 10 8D 48 01 41 89 4B 10 EB 05 B8 01 00 00

to

B8 03 00 8D 48 01 41 89 4B 10 EB 05 B8 01 00 00

I get B8 03 00 8D 48 in the same line which is a different command than what i intended.

what am i doing wrong? how can i make this change?

enter image description here

dandan
  • 509
  • 3
  • 8
  • 21

1 Answers1

4

These are the machine codes for mov *a*, 3 in 64-bit mode:

mov eax, 3:  b8 03 00 00 00
mov  ax, 3:  66 b8 03 00
mov  al, 3:  b0 03

As you can see mov eax, 3 needs 5 bytes. You can try:

6a 03    push 3
58       pop rax

But you'll get trouble with the following instruction lea ecx, [rax+1]!

rkhb
  • 14,159
  • 7
  • 32
  • 60