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 


crash on disabling create thread

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
reverser69
Expert Cheater
Reputation: 0

Joined: 03 Sep 2014
Posts: 112

PostPosted: Sun Jul 11, 2021 5:46 pm    Post subject: crash on disabling create thread Reply with quote

hi guys

this is a piece of code. it works like intended (infinite loop and calling that func constantly) but when I disable the script, it crashes the game.
Code:
[ENABLE]

alloc( CheatHandlerThread, 0x1000, $process )
registersymbol( CheatHandlerThread )
CreateThread( CheatHandlerThread )
registersymbol(bnuke)



CheatHandlerThread:


  //push C8
  //call kernel32.Sleep

cmp [bnuke],1
je @f
ret

@@:

mov rcx,#48
call GetAsyncKeyState

test ax,8001

//jz CheatHandlerThread

mov r8,C94BA74A
mov rcx,1
mov rdx,1
call 141EA6F20

call 143257F00


jmp CheatHandlerThread

bnuke:
db 01

141EA6F62:
db 90 90 90 90 90

[DISABLE]
bnuke:
db 00

dealloc( CheatHandlerThread )
unregistersymbol( CheatHandlerThread )
unregistersymbol(bnuke)
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25805
Location: The netherlands

PostPosted: Sun Jul 11, 2021 6:12 pm    Post subject: Reply with quote

try this:

Code:

[ENABLE]

alloc( CheatHandlerThread, 0x1000, $process )
registersymbol( CheatHandlerThread )
CreateThread( CheatHandlerThread )
registersymbol(bnuke,bdone)


CheatHandlerThread:


  //push C8
  //call kernel32.Sleep

cmp [bnuke],1
je @f

mov [bdone],1
ret

@@:

mov rcx,#48
call GetAsyncKeyState

test ax,8001

//jz CheatHandlerThread

mov r8,C94BA74A
mov rcx,1
mov rdx,1
call 141EA6F20

call 143257F00


jmp CheatHandlerThread

bnuke:
dd 01

bdone:
dd 00

141EA6F62:
db 90 90 90 90 90

[DISABLE]
{$lua}
if syntaxcheck then return end
writeInteger("bnuke",1)
while readInteger("bdone")==0 do sleep(10) end
sleep(1)
{$asm}

dealloc(*)
unregistersymbol(*)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
reverser69
Expert Cheater
Reputation: 0

Joined: 03 Sep 2014
Posts: 112

PostPosted: Sun Jul 11, 2021 9:34 pm    Post subject: Reply with quote

when i disable the script, CE freezes!!!
btw i was using "bnuke" for ending the loop, just like "done" so you can remove it.

to clarify, this is what I want:
create a thread that constantly executes this:

mov r8,C94BA74A
mov rcx,1
mov rdx,1
call 141EA6F20


*******************************
update:
tried your snippet with "writeInteger("bnuke",0)" and the game crashes upon disabling.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25805
Location: The netherlands

PostPosted: Sun Jul 11, 2021 11:14 pm    Post subject: Reply with quote

you didn't remove the while loop?

because if you free the memory before the thread is done it'll crash

in case a taskswitch happens between setting bdone to 1 and ret, try setting sleep(1) to sleep(1000)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
reverser69
Expert Cheater
Reputation: 0

Joined: 03 Sep 2014
Posts: 112

PostPosted: Mon Jul 12, 2021 12:45 am    Post subject: Reply with quote

I'm really sorry.
it was the fault of that function I was calling. it affected the stack and the "ret" was messed up.
with a "sub rsp,XXX" and "add rsp,XXX" it is fixed now.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking 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