Help

This is a discussion on Help within the C Programming forums, part of the General Programming Boards category; Hello, I would like to read another processes memory.. Is this possible in C? I've searched all over and have ...

  1. #1
    Registered User
    Join Date
    Feb 2005
    Posts
    20

    Help

    Hello, I would like to read another processes memory.. Is this possible in C? I've searched all over and have been getting weird stuff with C#....

    If you could please post some sample code...

    If this is not possible with C, tell me lol.... So I don't waste any more of my time learning it.

    thank you!

    -valt

  2. #2
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,220
    Yes it's possible; platform dependent. Help is not a very good thread title.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,824
    > I would like to read another processes memory
    Are you writing a debugger or a password sniffer?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    Registered User
    Join Date
    Feb 2005
    Posts
    20
    Neither... A very smart macro... That points to memory addresses inside a game and reads the value. See, in this game walking cordinates are saved inside a memory address as possitive integers. So based on what my program will read will determin how my program reacts by moving either one step forward or logs out.

    The only reason why im doing this is because the game has caused my wrist to hurt.. So i figure why not use brain power to create a program that will do it for me.


    any help please?! =)
    Last edited by valt; 02-17-2005 at 10:34 AM.

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,824
    So referring to previous questions like what OS/Compiler, what other details can you share with the rest of us?

    > See, in this game walking cordinates are saved inside a memory address as possitive integers.
    You seem to know a lot about the insides of this game - did you write it?

    > So i figure why not use brain power to create a program that will do it for me.
    Another idea would be to stop playing the game for a while - radical I know, but there it is.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  6. #6
    Registered User
    Join Date
    Feb 2005
    Posts
    20
    XP/Borland C++ Compiler 5.5

    Just need something like


    Read Memory address(From other process)
    save memory address
    store memory address as a variable
    and then do this following code basicly

    Code:
    int main()
    {
    
    int x,memoryadress,y=1;
    
    for(x=1;x<=25;x++)
    {
        do
        {
              if(memoryaddress==1)
             {
                 do the following;
               }
              else
              {
                  ++y;
              }     
         }while(y<=5)
    }
    }
    Last edited by valt; 02-17-2005 at 12:44 PM.

  7. #7
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,824
    List of things wrong here
    1. You can't just point at another process and examine it's memory (this isn't DOS). You could use this windows API call as the basis of further work, but it's bound to be pretty involved and messy.
    For example, maybe the game enumerates its threads and decides that it's being hacked if it suddenly spots another thread.

    2. Simply incrementing the variable 25 times will not result in a smooth walk. While you're doing this, the game isn't running, so when it does eventually run again, it's gonna look like hyperspace.

    3. The values you seek are not likely to be in the same memory location from one run of the game to the next. The player character object is just as likely to be created dynamically as any other object.

    You're better off just finding the window handle of the game and sending it a bunch of key presses (as a macro) than messing around with it's innards like this.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  8. #8
    Registered User
    Join Date
    Feb 2005
    Posts
    20
    1) I will try this... but i've never heard of this before and have no experience working with API's

    2)Could'nt I have a timer or something to prevent that from happening...


    3) yes, the address does change, but that can quickly be fixed by changing a few lines of code every time a run it.

    comment) I can't accept a macro program... It's flawed and imperfect... It cant think for its self...

    example where the program has to think: If the memory address value doesnt change in 5 trys, since the memory address im poking is a cord, then assume that someone is blocking your path, therfore quit out of the game or have your chacter say, "I'm sorry, but I have to go afk... ByeBye"


    Thanks for your brain
    Last edited by valt; 02-17-2005 at 01:39 PM.

  9. #9
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,220
    But there are plenty of UO macro programs already available. Most of them use a winsock hook though I think because the protocol doesn't change unlike the memory layout.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21