HELP Required! C# & Process Memory reading.

11/08/2010 13:44 |NeoX#1
Thanks for looking into my thread!

I want to learn more every day, today its how i can use C# to read the charname from a adress (i got the memory adress and the Process ID)

Please provide me a code snipped wich i can just copy for now and see how that works.

Im pretty sure with that little help, i can sort out the other shit i wanna do.

[Project] (Do not help me on that, thats my task! :D)

I want to make a tool wich checks the HP/MP and sends them using NamedPipes to an Webserver

Webserver will be coded in c# by me too. (Pointless but i wanna improve my skills so its alrighty :P)
11/08/2010 16:04 IAmHawtness#2
Code:
[DllImport("Kernel32.dll")]
static extern bool ReadProcessMemory(ntPtr hProcess, IntPtr lpBaseAddress, byte[] lpBuffer, UInt32 nSize, ref UInt32 lpNumberOfBytesRead);

[DllImport("kernel32.dll")]
static extern IntPtr OpenProcess(ProcessAccessFlags dwDesiredAccess, [MarshalAs(UnmanagedType.Bool)] bool bInheritHandle, int dwProcessId);

IntPtr pHandle;
byte[15] buffer;
string CharName;

pHandle = OpenProcess(0x001F0FFF, False, ProcessID);
ReadProcessMemory(pHandle, Address, buffer, 16, 0);
CharName = System.Text.ASCIIEncoding.Default.GetString(buffer);

CloseHandle(pHandle);
I don't really know C#, but I think it's something like that
11/08/2010 16:13 |NeoX#3
thank you alot that should help me^^
11/12/2010 01:15 vDrag0n#4
Can't you use System.Diagnostic to start a process and get its handle?
11/12/2010 06:32 IAmHawtness#5
Quote:
Originally Posted by vDrag0n View Post
Can't you use System.Diagnostic to start a process and get its handle?
Depends on whether he's using the .NET framework or not
11/12/2010 21:20 InfamousNoone#6
C# only works on the .NET framework (unlike how there's VB, and VB.NET). One could argue about Mono... but, my point still stands.

So yar to the System.Diagnostics question.