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 


[C#]Reading and Writing Values

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

Joined: 18 Jul 2014
Posts: 8

PostPosted: Sun Jul 27, 2014 3:55 am    Post subject: [C#]Reading and Writing Values Reply with quote

Hey guys i've been working on a quake3 trainer by getting help by a class that was made by "Cless" Link to the topic :
forum(dot)cheatengine(dot)org/viewtopic(dot)php?p=5347687

My question is, i can read addresses but when i try to add offsets it gets messy. I'm making a mistake obviously. Here is my pointer scan result(it works in CE) :

i60(dot)tinypic(dot)com/ddyyjr.png

and here is the line that i couldn't make it work !

Code:
label2.Text = Trainer.ReadPointerByte("quake3", 0x0026CD40, new int[1] { 0x5e0 }).ToString();


Thanks in advance
Back to top
View user's profile Send private message
661089799107
Expert Cheater
Reputation: 3

Joined: 25 Jan 2009
Posts: 186

PostPosted: Sun Jul 27, 2014 4:02 am    Post subject: Reply with quote

Should probably use ReadPointerInteger instead of ReadPointerByte since the type of your health is 4 bytes.

Also should "quake3" be "quake3.exe"?
Back to top
View user's profile Send private message
Sharkdeed
How do I cheat?
Reputation: 0

Joined: 18 Jul 2014
Posts: 8

PostPosted: Sun Jul 27, 2014 4:08 am    Post subject: Reply with quote

661089799107 wrote:
Should probably use ReadPointerInteger instead of ReadPointerByte since the type of your health is 4 bytes.
Also should "quake3" be "quake3.exe"?


Thank you for your quick help ! However, when i try to use that method, result always returns as 0

Here how i used it :

Code:
label2.Text = Trainer.ReadPointerInteger("quake3", 0x0026CD40, new int[1] { 0x5e0 }).ToString();


Also, it adds ".exe" by itself and gets the id of the process and works on it i think. Thats why when i type .exe there it fails.

Thanks
Back to top
View user's profile Send private message
661089799107
Expert Cheater
Reputation: 3

Joined: 25 Jan 2009
Posts: 186

PostPosted: Sun Jul 27, 2014 4:20 am    Post subject: Reply with quote

The memory class that you are using doesn't appear to get the base address of the exe (quake3.exe), and add it to the pointer offset (0x0026CD40).

This is what you want: (though make sure you cache the base address instead of calling it every time)
Code:

label2.Text = Trainer.ReadPointerInteger("quake3", getBaseAddress("quake3")+0x0026CD40, new int[1] { 0x5e0 }).ToString();


As for implementing getBaseAddress you would use Createtoolhelp32snapshot and Module32First. There are also plenty of examples on the forum/google for doing so.
Back to top
View user's profile Send private message
Sharkdeed
How do I cheat?
Reputation: 0

Joined: 18 Jul 2014
Posts: 8

PostPosted: Sun Jul 27, 2014 4:55 am    Post subject: Reply with quote

661089799107 wrote:
The memory class that you are using doesn't appear to get the base address of the exe (quake3.exe), and add it to the pointer offset (0x0026CD40).

This is what you want: (though make sure you cache the base address instead of calling it every time)
Code:

label2.Text = Trainer.ReadPointerInteger("quake3", getBaseAddress("quake3")+0x0026CD40, new int[1] { 0x5e0 }).ToString();


As for implementing getBaseAddress you would use Createtoolhelp32snapshot and Module32First. There are also plenty of examples on the forum/google for doing so.


Thank you for your help now i understand it very clearly !!
Topic can be closed now.
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8517
Location: 127.0.0.1

PostPosted: Sun Jul 27, 2014 9:26 pm    Post subject: Reply with quote

In C# you can make use of the Process class instead of invoking the API yourself manually:
http://msdn.microsoft.com/en-us/library/system.diagnostics.process(v=vs.110).aspx

You can use this to get information on processes, their base addresses, their module / thread information etc.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
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