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 


Trying to get a grasp on how to use cheatengine with C#

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

Joined: 13 Jan 2013
Posts: 1

PostPosted: Sun Jan 13, 2013 5:57 pm    Post subject: Trying to get a grasp on how to use cheatengine with C# Reply with quote

Yeah I know probably a thousand questions like this, I have either read or watched numerous tutorials and am still quite confused, I have a program with which i have narrowed down the pointer address to what i am sure is the correct one, question is now how to use it in c#,

With C# i already have the Process

Process[] my = Process.GetProcesByName("MyProcess");
Process TheProcess = my[0];

So now i get the base address of this process
uint Base = Convert.ToUInt32(TheProcess.MainModule.BaseAddress.ToInt32());

This gives me the base of my currently running process, so after hours of annoying tutorials and videos i am 100% sure the base address of the pointer i am looking for is
my.exe+2B9F1E - 6A 70 // Opcodes and bytes

So i went into C# and placed this in it

uint myAddress = 0x2B9F1E;

Then with
public static byte[] ReadBytes(IntPtr Handle, Int64 Address, uint BytesToRead)
{
IntPtr ptrBytesRead;
// Declare a buffer, this is the no mans land in which the information travels to get from the memory address to our programs memory.
byte[] buffer = new byte[BytesToRead];
// Call to the windows function to get the information.
ReadProcessMemory(Handle, new IntPtr(Address), buffer, BytesToRead, out ptrBytesRead);

// The result of this function will be the contents of buffer. Any information which was stored at the memory address passed in, is now in the buffer.
return buffer;
}
I Do
byte[] foundAddress = ReadBytes(TheProcess.Handle, Base+myAddress, 4);

This is supposed to return the value contained inside my pointer, which is another pointer, the value should be
1F44F2D0 but its not, so i can only assume i am doing this all wrong, i know for a fact that the base address is my.exe+2B9F1E - 6A 70 // Opcodes and bytes

As every single time i search this down i get this as a end result, can anyone shed some light on this for me ?
Back to top
View user's profile Send private message
Pingo
Grandmaster Cheater
Reputation: 8

Joined: 12 Jul 2007
Posts: 571

PostPosted: Sun Jan 13, 2013 7:28 pm    Post subject: Reply with quote

What value is it returning?

byte[] foundAddress = ReadBytes(TheProcess.Handle, Base+myAddress, 4);
That should only return the value.

my.exe+2B9F1E - 6A 70 is only 2 bytes but you're reading it as 4.

It should be byte[] foundAddress = ReadBytes(TheProcess.Handle, Base+myAddress, 2);

I might of misunderstood your question, but try that anyway.

_________________
Back to top
View user's profile Send private message
Gastric
How do I cheat?
Reputation: 0

Joined: 13 Jan 2013
Posts: 1

PostPosted: Sun Jan 13, 2013 9:09 pm    Post subject: Reply with quote

Tuna on irc gave me alot of help, but the main problem is i need to find the static pointer, all the tutorials i see online for finding the static pointer, are all for a different cheat engine version, and i am sure are very game specific, so none of them work in my instance, with Tuna's help i learned alot, but still unable to find the static pointer, if i could see it done from start to finish, i am positive i would catch on, but atm my head is so full of all the tutorials and videos i watched, i just cant figure it out, either that or the game i am working with just doesnt have them, i dunno
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 programming 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