CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2007
    Posts
    22

    Reading a Process Memory

    Hi folks,

    I'm attempting to read memory of a specific Process. This works fine but the problem I'm having is that I would like to speed up the read and the main issue is that I'm doing a *massive* loop to read all the process memory and then keeping the information I require.

    So, for example:

    Code:
                for (uint i = 0x00400000; i < 0x7FFFFFFF; i += buffer_count) {
                    memory = pReader.ReadProcessMemory((IntPtr)i, buffer_count, out bytesRead);
                    ....... }
    I think I can get the base address of the process using:

    Code:
    IntPtr startAddr = myProcess.MainModule.BaseAddress;
    So I will replace 0x00400000 with startAddr but is there a way to tell where the Process memory ends? This would allow me to stop at a specific address rather than looping to 0x7FFFFFFF all the time.

    Thanks all.
    sb

  2. #2
    Join Date
    Oct 2007
    Posts
    22

    Re: Reading a Process Memory

    I've had a look for any info on this with little success. Any thoughts would be appreciated.
    Thanks.

  3. #3
    Join Date
    May 2007
    Posts
    1,546

    Re: Reading a Process Memory

    Why do you want to do this?
    www.monotorrent.com For all your .NET bittorrent needs

    NOTE: My code snippets are just snippets. They demonstrate an idea which can be adapted by you to solve your problem. They are not 100% complete and fully functional solutions equipped with error handling.

  4. #4
    Join Date
    Oct 2007
    Posts
    22

    Re: Reading a Process Memory

    I am attempting to write a trainer for a game. Basically change the process memory to have more "money" at the start of the game. I have found the memory location but it seems to change everytime a new game is started so I thought i could iterate through memory looking for the associated string and, once found, change the value.

    This takes some time and I'm looking to reduce the area of memory I am searching if possible.

  5. #5
    Join Date
    Nov 2008
    Posts
    15

    Re: Reading a Process Memory

    There's no need to do a "massive iteration", the reason the value changes is because its using a pointer to point to it, once you figure out the pointer its easy to write into the memory, you might want to check out this site, there's an entire tutorials section.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured