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 


Creating a program to read memory and do x if active

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
Damein
Newbie cheater
Reputation: 0

Joined: 29 Sep 2010
Posts: 12

PostPosted: Thu Sep 30, 2010 2:15 pm    Post subject: Creating a program to read memory and do x if active Reply with quote

Alright, so I want to make a program that reads the memory of a game, and if the memory has a value of anything other then 0 I want to be able to close the game. But I don't know how to approach this, any help would be nice, thanks Smile
Back to top
View user's profile Send private message
AhMunRa
Grandmaster Cheater Supreme
Reputation: 27

Joined: 06 Aug 2010
Posts: 1117

PostPosted: Thu Sep 30, 2010 3:59 pm    Post subject: Reply with quote

If you know a specific address it would be easier, assuming your game is not using dynamic memory allocation. Otherwise with the known address something like.

This is psuedo code
C# method
Code:

using System.Diagnostics;

do(

}while( 0xADDRESS == 0 )

if( 0xADDRESS != 0 )
{
      if (clsProcess.ProcessName.StartsWith(name))
      {
           clsProcess.Kill();
      }
}

_________________
<Wiccaan> Bah that was supposed to say 'not saying its dead' lol. Fixing >.>
Back to top
View user's profile Send private message
Geri
Moderator
Reputation: 112

Joined: 05 Feb 2010
Posts: 5627

PostPosted: Thu Sep 30, 2010 4:26 pm    Post subject: Reply with quote

In a CE script, it would look like this:

Code:
cmp [address],0
je forward
pushad
pushfd
popad
popfd


Now that will cause a crash for sure. Smile
(Was joking, but it would really work...)

_________________
My trainers can be found here: http://www.szemelyesintegracio.hu/cheats

If you are interested in any of my crappy articles/tutorials about CE and game hacking, you can find them here:
http://www.szemelyesintegracio.hu/cheats/41-game-hacking-articles

Don't request cheats or updates.
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Thu Sep 30, 2010 4:32 pm    Post subject: Reply with quote

Obtain the main thread of the application and kill it (TerminateThread). You can use CreateToolhelp32Snapshot with Thread32First/Thread32Next to loop the applications thread list and such.

A better / more proper way of closing the application would be to find the function inside the application responsible for properly closing the game normally and calling that, if you are able to find it.

Forcing the app to close can cause leaks / data loss depending on how the game / application is designed. So find which method works for your instance.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Damein
Newbie cheater
Reputation: 0

Joined: 29 Sep 2010
Posts: 12

PostPosted: Thu Sep 30, 2010 7:56 pm    Post subject: Reply with quote

I do have the address, and it doesn't change.

Question: Are these scripts I can send to someone without CE and they can still run it?

I will look into CE scripts ASAP
Back to top
View user's profile Send private message
Geri
Moderator
Reputation: 112

Joined: 05 Feb 2010
Posts: 5627

PostPosted: Thu Sep 30, 2010 8:03 pm    Post subject: Reply with quote

If You write a script in CE, You can create a trainer from it with CE's built-in trainer maker. But seriously don't use the method that I have posted. It will really work and it will probaly really cause a giant crash but not a proper process termination. It is just a way to mess up register values which accidently happens if someone doesn't careful but shouldn't be used on purpose.
_________________
My trainers can be found here: http://www.szemelyesintegracio.hu/cheats

If you are interested in any of my crappy articles/tutorials about CE and game hacking, you can find them here:
http://www.szemelyesintegracio.hu/cheats/41-game-hacking-articles

Don't request cheats or updates.
Back to top
View user's profile Send private message
Damein
Newbie cheater
Reputation: 0

Joined: 29 Sep 2010
Posts: 12

PostPosted: Sat Oct 02, 2010 10:04 pm    Post subject: Reply with quote

AhMunRa's script looks simple and effect.. but I don't know the commands of CE scripts.

Here is what I want to happen, just to test and then when I know how to create a trainer and make sure its working I'll focus on it doing exactly what I want to do.

Code:

using System.Diagnostics;

do(
; Maybe force the user to type something so Know it works.
}while( 0xADDRESS == 0 )

if( 0xADDRESS != 0 )
{
      if (clsProcess.ProcessName.StartsWith(name))
      {
           clsProcess.Kill();
      }
}


Basically, all I want at the moment is a test script so I can test different addresses and make sure I can do this.

Thanks Smile
Back to top
View user's profile Send private message
justa_dude
Grandmaster Cheater
Reputation: 23

Joined: 29 Jun 2010
Posts: 893

PostPosted: Sun Oct 03, 2010 1:15 am    Post subject: Reply with quote

You won't be able to access the memory in the fashion you're prototyping. Polling it constantly is also a mistake - it's going to consume huge CPU.

-cheers
Back to top
View user's profile Send private message
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Sun Oct 03, 2010 3:21 am    Post subject: Reply with quote

Hook some the code accessing the value and do eg.
Code:
cmp eax,0x12345678
je 0
...else return...

Or if you need to poll it somewhere else:
Code:
cmp [address],0x12345678
je 0
...else continue the flow...
Back to top
View user's profile Send private message
AhMunRa
Grandmaster Cheater Supreme
Reputation: 27

Joined: 06 Aug 2010
Posts: 1117

PostPosted: Sun Oct 03, 2010 10:50 am    Post subject: Reply with quote

That code I posted is just one way of attempting to do this. This code would not run from CE it would be a stand alone exe build in C#. There would be a ton of other stuff you would have to learn to get it to work properly. For instance, accessing memory of another process for the actual monitoring part. C# should handle proper shut down of the app to prevent memory leaks, but I wouldn't count on it.

Wiccan is a much better coder than I am. What he says you can pretty much take as code gospel.

_________________
<Wiccaan> Bah that was supposed to say 'not saying its dead' lol. Fixing >.>
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