A Community discussion forum for Halo Custom Edition, Halo 2 Vista, Portal and Halo Machinima

Home  Search Register  Login Member ListRecent Posts
  
 
»Forums Index »Halo Custom Edition (Bungie/Gearbox) »Halo CE General Discussion »How memory does work

Author Topic: How memory does work (4 messages, Page 1 of 1)
Moderators: Dennis

cippozzo
Joined: May 7, 2013

"I... I am a monument to all your sins."


Posted: Oct 25, 2015 11:08 AM    Msg. 1 of 4       
Hello i'm looking to load a cheat using C# hooks, but my code didn't works. It should spawn a warthog
WriteProcessMemory(p, (IntPtr)(0x457970), SpawnBool, 1, out lpNumberOfBytesWritten);//process, mem pointr, bool?, bool?, out

Do you know how I could do that?
Edited by cippozzo on Oct 25, 2015 at 11:09 AM
Edited by cippozzo on Oct 25, 2015 at 11:10 AM


Btcc22
Joined: Dec 17, 2012


Posted: Oct 25, 2015 12:37 PM    Msg. 2 of 4       
You should post more code - ideally enough to allow for somebody else to reproduce the problem and mention what actually happened (did nothing, game crashed, process crashed, etc).


cippozzo
Joined: May 7, 2013

"I... I am a monument to all your sins."


Posted: Oct 25, 2015 01:52 PM    Msg. 3 of 4       

[DllImport("kernel32.dll")]
static extern bool ReadProcessMemory(
IntPtr hProcess,
IntPtr lpBaseAddress,
[Out] byte[] lpBuffer,
int dwSize,
out int lpNumberOfBytesRead
);
[DllImport("kernel32.dll", SetLastError = true)]
static extern bool WriteProcessMemory(
IntPtr hProcess,
IntPtr lpBaseAddress,
byte[] lpBuffer,
int nSize,
out int lpNumberOfBytesWritten);


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

[DllImport("kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool CloseHandle(IntPtr hObject);

static Process[] GameProcess = Process.GetProcessesByName("haloce");
// these are external functions
static void SPAWN_WARTHOG()
{

int lpNumberOfBytesWritten = 0;
IntPtr p = OpenProcess(0x00740916, true, GameProcess[0].Id); //the pointer is the handle, it's not the same I get it from CheatEngine
byte[] SpawnBool = { 0x1 }; //should be a bool?
WriteProcessMemory(p, (IntPtr)(0x45AF30), SpawnBool, 1, out lpNumberOfBytesWritten);//process, mem pointr, System.byte?, bool?, out
//just diagnostic down here
Console.WriteLine(lpNumberOfBytesWritten);
Console.WriteLine(SpawnBool[0]);
Console.WriteLine(p);

}

These are all the functions that I used

Edited by cippozzo on Oct 25, 2015 at 01:53 PM


cippozzo
Joined: May 7, 2013

"I... I am a monument to all your sins."


Posted: Oct 26, 2015 12:22 PM    Msg. 4 of 4       
Quote: --- Original message by: sparky
OpenProcess(int dwDesiredAccess...)

The value you gave does not seem appropriate. Desired Access is a bitmask value meaning read and/or write. Since you are using WriteProcessMemory, you would be using write there.

Consult:

http://www.codeproject.com/Articles/670373/Csharp-Read-Write-another-Process-Memory

And have fun.

I've seen this tutorial before, I'll try it and let you know thanks alot c:

 

 
Previous Older Thread    Next newer Thread







Time: Thu January 19, 2023 7:28 AM 140 ms.
A Halo Maps Website