Compare (CMP) register with multiple offset
Compare (CMP) register with multiple offset
is it possible to compare registers with multilevel offsets ?
-
- Table Makers
- Posts: 690
- Joined: Mon Jul 06, 2020 3:19 am
- Reputation: 1262
Re: Compare (CMP) register with multiple offset
Yeah it is. You just have to make sure that each level is guaranteed to be a valid pointer.
Say you have something that has 3 levels at +54, +1AC, and +8 with the base being in rcx, you would need to navigate like so:
The issue with this is if for some cases the +1AC level is not a valid pointer you will crash the game. You can do things like try except blocks or use 'IsBadReadPtr' to get around it but typically it's best to just find another compare.
Say you have something that has 3 levels at +54, +1AC, and +8 with the base being in rcx, you would need to navigate like so:
push rax
mov rax,[rcx+54]
mov rax,[rax+1AC]
cmp [rax+8],1B //Whatever you need to compare with
pop rax
je code //Whatever kind of jump you need to do
The issue with this is if for some cases the +1AC level is not a valid pointer you will crash the game. You can do things like try except blocks or use 'IsBadReadPtr' to get around it but typically it's best to just find another compare.
Re: Compare (CMP) register with multiple offset
thanks for the help .... it worked, i never thought we have to use the STACK function
Who is online
Users browsing this forum: fugue07