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 


Is any way to terminate/close process?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
aseed85
How do I cheat?
Reputation: 0

Joined: 26 Jun 2014
Posts: 5

PostPosted: Thu Jun 26, 2014 8:08 pm    Post subject: Is any way to terminate/close process? Reply with quote

Hey, i try to find a way to run and terminate game process with "ToggleBox"
- when ToggleBox is "on" the game was running, but i dont know what to do for terminate this game

Can anyone help?

This is how it looks:

Code:

function CEToggleBox1Enter(sender)
 
    --shellExecute( "Fifa14.exe" )
    --shellExecute( "Fifa14-3dm.exe")
    --openProcess([[Fifa14-3dm.exe]])
  shellExecute( [[Fifa14-3dm.exe]] );

end

function CEToggleBox1Exit(sender)

    --shellEnd( "Fifa14-3dm.exe")
    --endProcess("Fifa14-3dm.exe");
  TerminateProcess("Fifa14-3dm.exe");

end
Back to top
View user's profile Send private message
Redouane
Master Cheater
Reputation: 3

Joined: 05 Sep 2013
Posts: 363
Location: Algeria

PostPosted: Fri Jun 27, 2014 4:39 am    Post subject: Re: Is any way to terminate/close process? Reply with quote

aseed85 wrote:
Hey, i try to find a way to run and terminate game process with "ToggleBox"
- when ToggleBox is "on" the game was running, but i dont know what to do for terminate this game

Can anyone help?

This is how it looks:

Code:

function CEToggleBox1Enter(sender)
 
    --shellExecute( "Fifa14.exe" )
    --shellExecute( "Fifa14-3dm.exe")
    --openProcess([[Fifa14-3dm.exe]])
  shellExecute( [[Fifa14-3dm.exe]] );

end

function CEToggleBox1Exit(sender)

    --shellEnd( "Fifa14-3dm.exe")
    --endProcess("Fifa14-3dm.exe");
  TerminateProcess("Fifa14-3dm.exe");

end


In CEToggleBox1Exit,do this:
Code:
autoAssemble[[
alloc(m,64)
createthread(m)
m:
push 0
call exitProcess
ret]]
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Fri Jun 27, 2014 5:09 am    Post subject: Reply with quote

Best use the OnChange event and check if the button's Checked property is true or false

OnEnter is called when the mouse cursor goes over the object
OnExit is called when the mouse cursor leaves the object

_________________
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
aseed85
How do I cheat?
Reputation: 0

Joined: 26 Jun 2014
Posts: 5

PostPosted: Fri Jun 27, 2014 7:41 am    Post subject: Re: Is any way to terminate/close process? Reply with quote

Quote:

In CEToggleBox1Exit,do this:
Code:

autoAssemble[[
alloc(m,64)
createthread(m)
m:
push 0
call exitProcess
ret]]



Its not working..

Is there should not be a reference to the process that is to be closed??

In your code i see that some thread was allocated on mem, and then was called to exit, but how CE to know which process is concerned to exit?
Sad Sad Sad
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Fri Jun 27, 2014 8:13 am    Post subject: Reply with quote

That code closes the process cheat engine is currently attached to. So first attach to that process
_________________
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
aseed85
How do I cheat?
Reputation: 0

Joined: 26 Jun 2014
Posts: 5

PostPosted: Fri Jun 27, 2014 8:45 am    Post subject: Reply with quote

Quote:

In CEToggleBox1Exit,do this:
Code:

autoAssemble[[
alloc(m,64)
createthread(m)
m:
push 0
call exitProcess
ret]]



its not working for me.. Sad

The process is attached with AutoAttachList, so its logical -> if i push ToggleBox "On" the process was opened and attached, when i push ToggleBox again - "Off" ((with this code on quote)) then do nothing

help m8s, Please
Back to top
View user's profile Send private message
aseed85
How do I cheat?
Reputation: 0

Joined: 26 Jun 2014
Posts: 5

PostPosted: Sat Jun 28, 2014 6:56 am    Post subject: Reply with quote

114 views and no more tips... :/
Back to top
View user's profile Send private message
Redouane
Master Cheater
Reputation: 3

Joined: 05 Sep 2013
Posts: 363
Location: Algeria

PostPosted: Sat Jun 28, 2014 7:40 am    Post subject: Reply with quote

aseed85 wrote:
114 views and no more tips... :/


You have a 32bit os?Get this cheat table,and try it,it does what you want with notepad.exe
Back to top
View user's profile Send private message
aseed85
How do I cheat?
Reputation: 0

Joined: 26 Jun 2014
Posts: 5

PostPosted: Sat Jun 28, 2014 3:24 pm    Post subject: Reply with quote

Redone wrote:
aseed85 wrote:
114 views and no more tips... :/


You have a 32bit os?Get this cheat table,and try it,it does what you want with notepad.exe



Big thx Redone for Your attention Smile

I've got a 64bit os,

your script works but not quite - if checkbox is checked then notepad is running, but when i uncheck then i've gote a system message:

"The program Notepad has stopped working, Windows collects more information about the problem. It may take several minutes"

- or something like that - I have a Polish version of Windows


Is any way to fix this problem?



And one question more

I also have a progress bar that I want to show the progress of attaching the trainer to the game's process, and to then say in the text box above it, "Trainer Attatched to Process".
Its working.
,but
how to reset this progress bar and text box to null when game process was detached?
Back to top
View user's profile Send private message
Redouane
Master Cheater
Reputation: 3

Joined: 05 Sep 2013
Posts: 363
Location: Algeria

PostPosted: Sat Jun 28, 2014 4:44 pm    Post subject: Reply with quote

aseed85 wrote:
Redone wrote:
aseed85 wrote:
114 views and no more tips... :/


You have a 32bit os?Get this cheat table,and try it,it does what you want with notepad.exe



Big thx Redone for Your attention Smile

I've got a 64bit os,

your script works but not quite - if checkbox is checked then notepad is running, but when i uncheck then i've gote a system message:

"The program Notepad has stopped working, Windows collects more information about the problem. It may take several minutes"

- or something like that - I have a Polish version of Windows


Is any way to fix this problem?



And one question more

I also have a progress bar that I want to show the progress of attaching the trainer to the game's process, and to then say in the text box above it, "Trainer Attatched to Process".
Its working.
,but
how to reset this progress bar and text box to null when game process was detached?


Since your os is 64-bit,I can't really help,I know very little in 64bit asm programming (maybe the problem is in the function arguments or the calling mechanisms),but if ExitProcess does not do what you want,you can call MSVCRT.exit or MSVCRT._exit instead (http://msdn.microsoft.com/en-us/library/aa297632%28v=vs.60%29.aspx)

Maybe some other people can help you (make this compatible with 64bit windows).

Of course,the module 'MSVCRT' must be loaded in the target process.

There's an alternate solution:with Lua:
(Made by DaSpammer)
Code:
shellExecute('cmd.exe', '/c taskkill /PID ' .. getOpenedProcessID());
Back to top
View user's profile Send private message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Sat Jun 28, 2014 7:18 pm    Post subject: Reply with quote

Execute this to prevent CMD from popping up.
Code:
shellExecute('cmd.exe', '/c taskkill /PID ' .. getOpenedProcessID(), nil, false);
or
Code:
shellExecute('cmd.exe', '/c taskkill /PID ' .. getOpenedProcessID(), 'C:\\Windows\\System32\\', false);

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
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 Lua Scripting 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