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 


Pause process from AA

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Antoshick
Advanced Cheater
Reputation: 0

Joined: 02 Nov 2018
Posts: 56

PostPosted: Wed Nov 25, 2020 2:00 am    Post subject: Pause process from AA Reply with quote

Hi, in celua file there is
Code:

pause() : pauses the current opened process
unpause(): resumes the current opened process

Can i pause process, but from AA script? And then unpause process from lua.

My deal is that, some AA instruction "X" starts execution, sets flag 1 for me and pauses the process, then the Lua timer checks this flag 1 and starts copying data from the hard disk to memory, after that lua resets the flag to 0 and unpause the process, and finally the instruction continues execution and already uses the data that was copied.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Wed Nov 25, 2020 2:28 am    Post subject: Reply with quote

you can also just set that flag in AA and then actively wait in a loop until it is set back to 0 by the lua timer

but yes, you can call ntsuspendprocess and then let lua call unpause()

or call a lua function that calls pause() using luaserver but that may be too big of a workaround

or if performance is important look up events and duplicateHandle

_________________
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
Antoshick
Advanced Cheater
Reputation: 0

Joined: 02 Nov 2018
Posts: 56

PostPosted: Wed Nov 25, 2020 3:46 am    Post subject: Reply with quote

Quote:

but yes, you can call ntsuspendprocess and then let lua call unpause()

I can only use this method. But for some reason, it didn't pause the game.
I get handle of game process by
Code:
print(getOpenedProcessHandle())
- printed 1432
then use AA call
Code:
pushfq
push rax
push rbx
push rcx
push rdx
push rsi
push rdi
push rbp
push rsp
push r8
push r9
push r10
push r11
push r12
push r13
push r14
push r15

mov rcx,00000598 //1432

call ntsuspendprocess
pop r15
pop r14
pop r13
pop r12
pop r11
pop r10
pop r9
pop r8
pop rsp
pop rbp
pop rdi
pop rsi
pop rdx
pop rcx
pop rbx
pop rax
popfq


The game doesn't pause
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Wed Nov 25, 2020 4:47 am    Post subject: Reply with quote

this should work and is stack alignment safe
Code:

pushfq
push rax
push rbx
push rcx
push rdx
push rsi
push rdi
push r8
push r9
push r10
push r11
push r12
push r13
push r14
push r15
push rbp

mov rbp,rsp
sub rsp,20
and rsp,fffffffffffffff0 //align

mov rcx,ffffffffffffffff //-1 = currentprocesshandle
call NtSuspendProcess
mov rsp,rbp
pop rbp

pop r15
pop r14
pop r13
pop r12
pop r11
pop r10
pop r9
pop r8
pop rdi
pop rsi
pop rdx
pop rcx
pop rbx
pop rax
popfq


and to resume you can call (unpause doesn't work as it only work when it does it itself)
Code:

executeCodeLocalEx('NtResumeProcess', getOpenedProcessHandle())

_________________
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
Antoshick
Advanced Cheater
Reputation: 0

Joined: 02 Nov 2018
Posts: 56

PostPosted: Wed Nov 25, 2020 5:09 am    Post subject: Reply with quote

Dark Byte wrote:
this should work and is stack alignment safe
Code:

pushfq
push rax
push rbx
push rcx
push rdx
push rsi
push rdi
push r8
push r9
push r10
push r11
push r12
push r13
push r14
push r15
push rbp

mov rbp,rsp
sub rsp,20
and rsp,fffffffffffffff0 //align

mov rcx,ffffffffffffffff //-1 = currentprocesshandle
call NtSuspendProcess
mov rsp,rbp
pop rbp

pop r15
pop r14
pop r13
pop r12
pop r11
pop r10
pop r9
pop r8
pop rdi
pop rsi
pop rdx
pop rcx
pop rbx
pop rax
popfq


and to resume you can call (unpause doesn't work as it only work when it does it itself)
Code:

executeCodeLocalEx('NtResumeProcess', getOpenedProcessHandle())


Yes, this work fine.
Thank you.
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