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# Read/WriteProcessMemory class.

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

Joined: 12 Mar 2005
Posts: 24

PostPosted: Tue Feb 19, 2008 5:18 am    Post subject: C# Read/WriteProcessMemory class. Reply with quote

Hi,

I've made a C# Class that will make reading and writing memory simple.

The source is in the attachment, it comes with a minesweeper example. Its just made quickly to show what its capable of.
The class currently has the following features:

Selecting the process by three ways: Process name, Existing process class and handle.


Code:
public MemoryEdit(Process process)
public MemoryEdit(IntPtr handle)
public MemoryEdit(string processName)


Simple read memory, just give the address and length and it will read.

Code:

public byte[] readMemory(IntPtr Address, uint bytesToRead)



3 overloads of writeprocessmemory, that will accept byte, int and (thanks to samuri25404) string.


Code:
public bool writeMemory(IntPtr Address, byte [] bytesToWrite)
public bool writeMemory(IntPtr Address, int intToWrite)
public bool writeMemory(IntPtr Address, string opCode)



It also has an event, which fires when the process you hooked on closes. I've made it in Visual Studio 2005.

Credits too samuri25404 for the Opcode class, DarkByte for cheatengine Smile



The Extension 'rar' was deactivated by an board admin, therefore this Attachment is not displayed.



Last edited by CyClonenl on Tue Feb 19, 2008 4:16 pm; edited 1 time in total
Back to top
View user's profile Send private message
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Tue Feb 19, 2008 9:16 am    Post subject: Reply with quote

Where's those credits that you spoke so much of?
_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
Back to top
View user's profile Send private message
CyClonenl
Newbie cheater
Reputation: 0

Joined: 12 Mar 2005
Posts: 24

PostPosted: Tue Feb 19, 2008 4:17 pm    Post subject: Reply with quote

Code:
...pt byte, int and (thanks to samuri25404) string...


But i added a footnote. Sorry.


I'm currently trying to add a CreateCave method, that'll create a code cave automatically.

Code:
CreateCave(IntPtr baseAddress, byte[] bytesToWrite)


But i'm having some trouble turning opcodes to bytes.

Code:
byte[] jmpAdd = Opcode.Converter.GetBytes("JMP [" + baseAddress + "]", "");

Wont work xD And when i try a manual address, it also gives the not found error.
Back to top
View user's profile Send private message
sponge
I'm a spammer
Reputation: 1

Joined: 07 Nov 2006
Posts: 6009

PostPosted: Tue Feb 19, 2008 4:22 pm    Post subject: Reply with quote

opcodes = bytes.
Human interpretation = mnemonic.

_________________
Back to top
View user's profile Send private message
CyClonenl
Newbie cheater
Reputation: 0

Joined: 12 Mar 2005
Posts: 24

PostPosted: Wed Feb 20, 2008 9:35 am    Post subject: Reply with quote

Ok,

So i have trouble converting Opcodes from String to Bytes...
Gonna mess with marshal a bit.
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