View previous topic :: View next topic |
Author |
Message |
Sestain How do I cheat?
Reputation: 0
Joined: 11 Oct 2023 Posts: 4 Location: Finland
|
Posted: Wed Oct 11, 2023 9:25 am Post subject: JE instruction not working with [returnAddress] |
|
|
jmp [returnAddress] works just fine but je [returnAddress] doesn't compile. This doesn't make any sense to me why this wouldn't compile to asm.
"(Error in line 29 (je [ffffffffffffffff]) :This instruction can't be compiled)"
Code: | cmp al,1
je [returnAddress]
jmp [returnAddress] |
|
|
Back to top |
|
 |
LeFiXER Grandmaster Cheater Supreme
Reputation: 20
Joined: 02 Sep 2011 Posts: 1069 Location: 0x90
|
Posted: Wed Oct 11, 2023 9:34 am Post subject: |
|
|
I believe the issue lies with the use of the square brackets.
Code: |
cmp al,1
je returnAddress
jmp returnAddress
|
|
|
Back to top |
|
 |
Sestain How do I cheat?
Reputation: 0
Joined: 11 Oct 2023 Posts: 4 Location: Finland
|
Posted: Wed Oct 11, 2023 9:41 am Post subject: |
|
|
That's not a fix since it will jump to the address where returnAddress is located; I want to jump to the address that returnAddress is holding instead.
Like I said on my first post, jmp [returnAddress] works but je doesn't.
|
|
Back to top |
|
 |
LeFiXER Grandmaster Cheater Supreme
Reputation: 20
Joined: 02 Sep 2011 Posts: 1069 Location: 0x90
|
Posted: Wed Oct 11, 2023 9:52 am Post subject: |
|
|
I'm pretty bad at explaining things, but ASM doesn't work like that.
Code: |
cmp al,1
push rbx
mov rbx,[returnAddress]
je rbx
pop rbx
|
Here we preserve what's held in the RBX register, then we copy what is held in [returnAddress] into RBX, then jump to the address held in RBX if al = 1 then restore the RBX register.
Also, having the compare is negligent in this case because the following instruction means to jump to [returnAddress] anyway so even if al was 0 it would jump.
|
|
Back to top |
|
 |
Sestain How do I cheat?
Reputation: 0
Joined: 11 Oct 2023 Posts: 4 Location: Finland
|
Posted: Wed Oct 11, 2023 10:00 am Post subject: |
|
|
I know that asm code is bad but it was shortened version of original code.
Here's a better example of my code.
Code: |
glowChecks:
cmp byte ptr [rdi+298],5 // Team check
je [returnAddress]
cmp byte ptr [rdi+280],74 // Viewmodel check
je viewModel
jmp [returnAddress]
viewModel:
cmp byte ptr [glowOptions+2],1
je enableGlow
jmp [returnAddress]
glowSet:
push rbx
lea rbx,[glowSet+1C]
mov [returnAddress],rbx
pop rbx
mov byte ptr [glowOptions],0
jmp glowChecks
reassemble(aobGlowSet)
jmp exitGlowSet
aobGlowSet:
jmp glowSet
nop 2
exitGlowSet:
|
|
|
Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4702
|
Posted: Wed Oct 11, 2023 10:07 am Post subject: |
|
|
There is no `jcc r/m32` instruction. `jcc` can only take an immediate operand as a relative displacement.
Use a jcc and two `jmp` instructions instead.
Code: | code:
cmp al,1
je foo
jmp [returnAddress1]
foo:
jmp [returnAddress2] |
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
 |
Sestain How do I cheat?
Reputation: 0
Joined: 11 Oct 2023 Posts: 4 Location: Finland
|
Posted: Wed Oct 11, 2023 10:23 am Post subject: |
|
|
Thanks for replies and help.
|
|
Back to top |
|
 |
|