Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


pointer offset as a compare before writing the same pointer?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
PinPoint
Expert Cheater
Reputation: 10

Joined: 07 Apr 2016
Posts: 223
Location: Scotland

PostPosted: Wed May 04, 2016 3:25 pm    Post subject: pointer offset as a compare before writing the same pointer? Reply with quote

Im using CREATETHREAD to constantly write to a pointer. The only thing is that the game crashes when I go through a map change/check/loadpoint and it updates the address.
The base of the pointer and its first offset value is the same every game and changes for 3-4 seconds when a checkpoint is reached before going back to normal.
So i want to compare the value stored within this offset and if it is not what it should be (i.e not in normal game) then dont write.

I came up with this code which doesn't write the value or crash the game. (If i remove the check: part and cont: line, it works fine but obv crashes on checkpoints) Can someone help me understand why this isnt working and point out what I might be missing?
I tried using call and ret but wasnt sure exactly how to use them so went with labels and jumps


Code:
[ENABLE]
globalalloc(inf_health,1000)
CREATETHREAD(inf_health)
registersymbol(end)
label(end)
label(check)
label(cont)

inf_health:

mov eax,[Engine.dll+00617388]
mov eax,[eax+C4]
jmp check

cont:
mov eax,[eax+688]
mov eax,[eax+58]
mov word ptr [eax+2FC],#1000


push #500
call sleep
cmp [end],01
jne inf_health
ret

end:
dd 0

check:
cmp [eax],26612C
jne check
jmp cont


[DISABLE]
end:
dd 01



I have done this in the past fine but with using a different address altogether for the compare.

Thanks
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Wed May 04, 2016 6:05 pm    Post subject: Reply with quote

Code:
mov eax,[Engine.dll+00617388]
test eax,eax
je skip
mov eax,[eax+C4]
test eax,eax
je skip
mov eax,[eax+688]
test eax,eax
je skip
mov eax,[eax+58]
test eax,eax
je skip
mov word ptr [eax+2FC],#1000
skip:
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4300

PostPosted: Wed May 04, 2016 6:19 pm    Post subject: Reply with quote

Code:
check:
cmp [eax],26612C
jne check

I'd guess the thread eventually gets caught in this infinite loop. I don't know why you're jumping to this anyways; you could simplify it by putting that block where the jump to it is.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
PinPoint
Expert Cheater
Reputation: 10

Joined: 07 Apr 2016
Posts: 223
Location: Scotland

PostPosted: Thu May 05, 2016 12:53 am    Post subject: Reply with quote

Zanzer wrote:
Code:
mov eax,[Engine.dll+00617388]
test eax,eax
je skip
mov eax,[eax+C4]
test eax,eax
je skip
mov eax,[eax+688]
test eax,eax
je skip
mov eax,[eax+58]
test eax,eax
je skip
mov word ptr [eax+2FC],#1000
skip:

This still crashes the game. I can activate it at the main menu fine though and when i go into game its working until chekpoint/map change etc.



ParkourPenguin wrote:
I'd guess the thread eventually gets caught in this infinite loop. I don't know why you're jumping to this anyways; you could simplify it by putting that block where the jump to it is.

I had tried having the compare where the jump was initially but it still crashed.
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Thu May 05, 2016 7:10 am    Post subject: Reply with quote

PinPoint wrote:
ParkourPenguin wrote:
I'd guess the thread eventually gets caught in this infinite loop. I don't know why you're jumping to this anyways; you could simplify it by putting that block where the jump to it is.

I had tried having the compare where the jump was initially but it still crashed.
-Moving the compare is not the issue, ParkourPenguin was just pointing out that it isn't necessary to have your compare in a separate block of code (i.e. you don't need to jump to it, you can just include it at the beginning).

The issue is with the compare. As ParkourPenguin suggests, you are potentially trapping unwanted code inside of a loop, hoping that it's going to change when it never will. Just let it exit.

Also, another issue that could be causing the crash is that you're not checking if your pointer data is valid...this is what Zanzer was suggesting. However, it doesn't look like Zanzer included your compare, which I assume is needed to avoid changing unwanted code.
Back to top
View user's profile Send private message
Cake-san
Grandmaster Cheater
Reputation: 8

Joined: 18 Dec 2014
Posts: 541
Location: Semenanjung

PostPosted: Sun May 08, 2016 5:39 am    Post subject: Reply with quote

Confused
Code:

[ENABLE]
globalalloc(inf_health,1000)
CREATETHREAD(inf_health)
registersymbol(end)
label(end)
label(_exit)

inf_health:

mov eax,[Engine.dll+00617388]
cmp eax,0
je _exit
mov eax,[eax+C4]
cmp eax,0
je exit
cmp [eax],26612C
jne exit
mov eax,[eax+688]
cmp eax,0
je _exit
mov eax,[eax+58]
cmp eax,0
je _exit
mov word ptr [eax+2FC],#1000

_exit:
push #500
call sleep
cmp [end],01
jne inf_health
ret

end:
dd 0

[DISABLE]
end:
dd 01

_________________
...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites