[Tutorial] Memory editing C# menu

User Tag List

Results 1 to 2 of 2
  1. #1
    Lynie's Avatar Contributor
    Reputation
    87
    Join Date
    Mar 2008
    Posts
    74
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Tutorial] Memory editing C#

    Note: I'm not an experienced C# programmer
    Note: I found how to do this on another site and tough it would be usefull so i'm now going to explain the basic memory editing.

    Let's get started then

    I'm going to take freecell as an example.

    1.
    First step is downloading
    Code:
    http://www.codeproject.com/KB/trace/freecellreader/freecellreader_demo.zip
    and compiling ProcessMemoryReaderLib inside it.

    So now we have ProcessMemoryReaderLib.dll inside the bin\Debug.

    Create a new C# project and go to Project > Add reference... and click on the browse tab and navigate to the ProcessMemoryReaderLib. Now you're ready to get to the programming part! ^^



    2.
    Code:
    using System;
    using System.Diagnostics //allows to use the class Process fast
    using ProcessMemoryReadingLib; //allows to use ProcessMemoryReadingLib fast
    Now we handle the main function
    Code:
    namespace FreeCell_Hack
    {
        class Program
        {
            static void Main(string[] args)
            {
                ProcessMemoryReader pReader = new ProcessMemoryReader(); //create a new writer - reader
                
                Process[] hProcessSnap; //create an array containing all running processes
                Process hProcess = null; 
                hProcessSnap = Process.GetProcesses(); //Load all processes in the array
    Now the adress. This is what I found when looking for the score adress in freecell.
    Code:
                IntPtr score_addr = (IntPtr)0x1007800;
    Now we also need something to write. Since we need the second arg to be a byte[] in WriteProcessMemory we need to declare a byte[] ^^
    Code:
                byte[] write = new byte[4];
    Let's say we want our score to be 0 so we win , then we need to make an int.
    So we need to convert an int to a byte[]. No problem.
    Code:
                write = BitConverter.GetBytes(0);
    We need to find the place of our process in the process array
    Code:
                for (int n = 0; n < hProcessSnap.Length; n++)
                {
                    if (hProcessSnap[n].ProcessName == "freecell")
                        hProcess = hProcessSnap[n];
                }
    Now we're going to hook the hack with the app.
    Code:
                pReader.ReadProcess = hProcess;
                pReader.OpenProcess();
                pReader.WriteProcessMemory(score_addr, write, out store);
            }
        }
    }
    And we also need the store int, so put this in the beginning of the Main function.
    Code:
                int store = 0;

    the complete code:
    Code:
    using System;
    using System.Diagnostics;
    using ProcessMemoryReaderLib;
    
    namespace FreeCell_Hack
    {
        class Program
        {
            static void Main(string[] args)
            {
                int store = 0;
    
                ProcessMemoryReader pReader = new ProcessMemoryReader();
    
                Process[] hProcessSnap;
                Process hProcess;
    
                hProcess = null;
    
                hProcessSnap = Process.GetProcesses();
    
                IntPtr score_addr = (IntPtr)0x1007800;
    
                byte[] write = new byte[4];
    
                write = BitConverter.GetBytes(0);
    
                for (int n = 0; n < hProcessSnap.Length; n++)
                {
                    if (hProcessSnap[n].ProcessName == "freecell")
                        hProcess = hProcessSnap[n];
                }
                pReader.ReadProcess = hProcess;
                pReader.OpenProcess();
                pReader.WriteProcessMemory(score_addr, write, out store);
            }
        }
    }
    So that's it. You probably noticed this is my first tutorial .
    If you need anything further explained, let me know.

    Hope you like it.

    Enjoy
    Last edited by Lynie; 07-09-2008 at 11:03 AM.

    [Tutorial] Memory editing C#
  2. #2
    wakamesoup's Avatar Private
    Reputation
    1
    Join Date
    Feb 2010
    Posts
    1
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Works great, but how do I find out the process' starting and ending address? I don't want to scan the machines entire memory when searching for a certain value

    thanks

    Dominik

Similar Threads

  1. Diablo III Memory Editing Tutorial?
    By Jackalhead in forum Diablo 3 Memory Editing
    Replies: 6
    Last Post: 05-19-2012, 08:44 AM
  2. Simple Memory Editing Tutorial in C++ Using WinAPI
    By krylonClear in forum WoW Memory Editing
    Replies: 2
    Last Post: 04-27-2011, 04:57 AM
  3. [Guide]Basic Memory Editing
    By Dragon[Sky] in forum World of Warcraft Bots and Programs
    Replies: 25
    Last Post: 11-27-2007, 11:47 AM
  4. Memory editing, messing around
    By Froogle in forum Screenshot & Video Showoff
    Replies: 12
    Last Post: 11-18-2007, 11:43 AM
  5. Screenshots been made by memory editing
    By tttommeke in forum Screenshot & Video Showoff
    Replies: 12
    Last Post: 11-06-2007, 03:45 PM
All times are GMT -5. The time now is 08:23 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search