C# Easy Memory Operations menu

User Tag List

Results 1 to 10 of 10
  1. #1
    CbRooT's Avatar Member
    Reputation
    3
    Join Date
    Mar 2009
    Posts
    1
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    C# Easy Memory Operations

    Before code, !! IMPORTANT !!:
    Only get the 'Process HANDLE' when you'll use it.
    'Process.Handle' property gives an handle.
    Process.GetProcess...() is almost equals the 'OpenProcess(...)' api.
    This means, when you request a process instance,
    Windows creates new handle for process and lefts it opened.
    And when you read 'Process.Handle' property on different times/different zones of code, you'll see each Handle will be different. (sometimes Windows returns same open handle but there's no guarantee).

    Whatever... I only want to warn you because I made sick of researching process memory operations and it didn't work because of i requested new handles...
    And I didn't find a good information in google. Is no one knows this?? I got angry


    Here are some methods for 'Write/Read Process Memory':
    And, sorry for my bad English.



    Code:
    using System;
    using System.Text;
    using System.Collections.Generic;
    using System.Diagnostics;
    
    
    
    public class PMemTest {
       #region API Decls.
            [DllImport( "kernel32.dll", EntryPoint = "WriteProcessMemory", SetLastError = true )]
        public static extern int WriteProcessMemory( IntPtr hProcess, IntPtr lpAddr, byte[] lpBuffer, int nSize, ref int lpNumberOfBytesWritten );
            [DllImport( "kernel32.dll", EntryPoint = "ReadProcessMemory", SetLastError = true )]
        public static extern int ReadProcessMemory( IntPtr hProcess, IntPtr lpAddr, byte[] lpBuffer, int nSize, ref int lpNumberOfBytesWritten );
       #endregion
    
        public int getCurrentProcessId() { return Process.GetCurrentProcess().Id; }
    
        public bool writeMemory(int pid, IntPtr lpAddr, byte[] buffer) {
            Process.EnterDebugMode();      // Usally, this isn't needed. Gives the process 'SeDebugPriviledge' (if logged user has 'Administrator' rights - or 'Debug' rigths.
    
            Process[] processArr=Process.GetProcessById(pid);
            if (processArr==null || processArr.Length==0)
               return false;
    
            int len = buffer.Length;
            int bytes = 0;
            Process p=processArr[0];
            IntPtr hProcess = p.Handle;
            WriteProcessMemory( hProcess, lpAddr, buffer, len, ref bytes );
            return (bytes>0);
        }
    
        public bool readMemory(int pid, IntPtr lpAddr, byte[] buffer) {
            Process.EnterDebugMode();      // Usally, this isn't needed. Gives the process 'SeDebugPriviledge' (if logged user has 'Administrator' rights - or 'Debug' rigths.
    
            Process[] processArr=Process.GetProcessById(pid);
            if (processArr==null || processArr.Length==0)
               return false;
    
            int len = buffer.Length;
            int bytes = 0;
            Process p=processArr[0];
            IntPtr hProcess = p.Handle;
            ReadProcessMemory( hProcess, lpAddr, buffer, len, ref bytes );
            return (bytes>0);
        }

    C# Easy Memory Operations
  2. #2
    kakamunsug's Avatar Member
    Reputation
    -2
    Join Date
    Dec 2008
    Posts
    20
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Notice that this will NOT work for games such as WoW which does indeed protect their game a bit. Using VirtualProtect you can simulate wow in another state of which it allows you to read and edit as you please.

    Just a heads up, using "BlackMagic" dll is a very nice thing to do when Shynd put down such great work to it.

  3. #3
    Krillere's Avatar Contributor
    Reputation
    112
    Join Date
    Nov 2007
    Posts
    668
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    kakamunsug, do you have an example of how to edit wow ? Will we need to use Packets or just special code? :-)

  4. #4
    spawnfestis's Avatar Contributor
    Reputation
    85
    Join Date
    May 2009
    Posts
    261
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Krillere View Post
    kakamunsug, do you have an example of how to edit wow ? Will we need to use Packets or just special code? :-)
    Either use VirtualProtect() invoked, or use BlackMagic.dll. :wave:

  5. #5
    visitor's Avatar Contributor
    Reputation
    174
    Join Date
    Mar 2008
    Posts
    307
    Thanks G/R
    16/15
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    im using Visual Studio's C# and it always says (not only at this code):
    Code:
    Error	1	The type or namespace name 'DllImport' could not be found (are you missing a using directive or an assembly reference?)	C:\Users\Viktor\AppData\Local\Temporary Projects\ConsoleApplication1\Program.cs	11	10	ConsoleApplication1
    Please help
    mod: solved
    Code:
    using System.Runtime.InteropServices;
    Last edited by visitor; 05-10-2009 at 12:53 PM.
    Hey I just met you

  6. #6
    Nesox's Avatar ★ Elder ★
    Reputation
    1280
    Join Date
    Mar 2007
    Posts
    1,238
    Thanks G/R
    0/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Lol i must say.. here's a small example using BlackMagic:

    Code:
    Process[] processes = Process.GetProcessByName("Wow");
    BlackMagic wow = new BlackMagic(processes[0].Id);
    
    uint playerBase = wow.ReaUint(wow.ReadUInt(wow.ReadUint(0x010B65F4) + 0x34) + 0x24);
    
    private void Health
    {
        get { return wow.ReadInt(wow.ReadUInt(playerBase + 0x08) + 0x17 * 4); }
    }
    
    private void MaxHealth
    {
        get { return wow.ReadInt(wow.ReadUInt(playerBase + 0x08) + 0x1F * 4); }
    }
    
    while(true)
    {
        Console.WriteLine("Health:{0}/{1}", Health, MaxHealth);  
    }
    the descriptor offsets are from Cypher's descriptor dump.
    the pointer at 0x08 from a object points to the start of the descriptor array.
    And the reason you multiply it with 4 is because it's aligned evry 4 bytes

  7. #7
    Sinorai's Avatar Private
    Reputation
    1
    Join Date
    Apr 2011
    Posts
    4
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    "adUInt(playerBase + 0x08) + 0x17 * 4); }" <- could u explain why 0x08 and 0x17??.. how did u find that offset?? been searching around, cant seem to find a way of locating those values.. :S

  8. #8
    spitfire21's Avatar Member
    Reputation
    2
    Join Date
    Oct 2009
    Posts
    100
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use a memory editor

  9. #9
    Sinorai's Avatar Private
    Reputation
    1
    Join Date
    Apr 2011
    Posts
    4
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by spitfire21 View Post
    Use a memory editor
    could u show/teach me how???

  10. #10
    spitfire21's Avatar Member
    Reputation
    2
    Join Date
    Oct 2009
    Posts
    100
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Look at the cheat engine forum tutorial section I won't show yo ubecause plenty of other people have made some really good tutorials on how to do it. So just check out the cheat engine forums.

Similar Threads

  1. [Buying] Gold | Guild Bank co-operation | Easy & Safe, GOOD PRICES | Skrill / PayPal Payment
    By Nemu5 in forum World of Warcraft Buy Sell Trade
    Replies: 55
    Last Post: 09-11-2014, 06:39 PM
  2. Replies: 8
    Last Post: 10-15-2012, 10:36 AM
  3. Memory Reading Made easy
    By JoeBiden in forum Programming
    Replies: 3
    Last Post: 02-20-2009, 04:03 PM
  4. Guide: Gold (Easy Alchemist Gold)
    By janzi9 in forum World of Warcraft Guides
    Replies: 1
    Last Post: 05-23-2006, 11:48 AM
All times are GMT -5. The time now is 02:38 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search