Results 1 to 2 of 2
  1. #1
    Crtucker718's Avatar
    Join Date
    Oct 2014
    Gender
    male
    Posts
    1
    Reputation
    10
    Thanks
    0

    Reading from a base-address?

    Alright, so I'll be the first to admit I'm not too experienced with C++... in-fact I started it yesterday, but I have already done quite a bit. I've created my own injector and understand how to write to the process memory, I took my old Unity3D Project that was a FPS and had some fun with it, I learned about NOP values and how to write in general using VirtualProtect.

    The only thing I can not for the life of me find information on, anywhere is reading from memory. I have an basic application that I want to write the values of my players Health and mana into. I'm not trying to "hack" the game, or change any values, I'm just trying to grab information from it. I've done quite a bit of research and I've gone through the whole "Cheat-engine" process of getting the dynamic pointers -> offsets over and over again until I come to a static pointer that works after game and computer restart. (Thank god)

    So, I'm going to use this as an example.. Lets say my pointer is 0x302DD0E8 and I have an offset of 0x84C how would I go about getting the value of this from the application. (Granted this is a 4-Byte integer value)

    Ghetto Link to Cheat-Engine Address window: gyazo / 733d50c751119376d3195b6a5b703e9a

    For what it's worth this is a DLL Injection project, so I am injecting this into the application, I don't know if this changes how things are read or not, like I said I can't really find ANY information on reading, but there's SOOOO MUCH on writing.
    Last edited by Crtucker718; 10-05-2014 at 08:29 PM.

  2. #2
    Harava's Avatar
    Join Date
    Sep 2013
    Gender
    male
    Posts
    114
    Reputation
    10
    Thanks
    2,989
    Quote Originally Posted by Crtucker718 View Post
    Alright, so I'll be the first to admit I'm not too experienced with C++... in-fact I started it yesterday, but I have already done quite a bit. I've created my own injector and understand how to write to the process memory, I took my old Unity3D Project that was a FPS and had some fun with it, I learned about NOP values and how to write in general using VirtualProtect.

    The only thing I can not for the life of me find information on, anywhere is reading from memory. I have an basic application that I want to write the values of my players Health and mana into. I'm not trying to "hack" the game, or change any values, I'm just trying to grab information from it. I've done quite a bit of research and I've gone through the whole "Cheat-engine" process of getting the dynamic pointers -> offsets over and over again until I come to a static pointer that works after game and computer restart. (Thank god)

    So, I'm going to use this as an example.. Lets say my pointer is 0x302DD0E8 and I have an offset of 0x84C how would I go about getting the value of this from the application. (Granted this is a 4-Byte integer value)

    Ghetto Link to Cheat-Engine Address window: gyazo / 733d50c751119376d3195b6a5b703e9a

    For what it's worth this is a DLL Injection project, so I am injecting this into the application, I don't know if this changes how things are read or not, like I said I can't really find ANY information on reading, but there's SOOOO MUCH on writing.

    Cheat engine tells you exactly how to read multi level pointers:


    Offsets in brackets are meant to be added to the pointer and then the value the pointer now points to (another pointer) is read. And offsets without brackets are just added to the pointer, wich now points to the value. Since you are doing a dll you can access the processes memory locally, so a few casts should do the trick. Here is how to read the above multi level pointer from a dll:

    Code:
    DWORD ptr1 = BaseAddress + 0x1F10AC;
    DWORD ptr2 = *(DWORD*)(ptr1 + 0x220);
    DWORD ptr3 = *(DWORD*)(ptr2 + 0x5B0);
    DWORD ptrToValue = ptr3 + 0x20e;
    
    BYTE value = *(BYTE*)ptrToValue;
    Recent releases:
    CSPHv3.2




    Code:
    00F38C0E     B8 0610F300    MOV EAX, 00F31006
    00F38C13     C700 208CF300  MOV DWORD PTR DS:[EAX], 00F38C20
    00F38C19     EB FF          JMP SHORT 00F38C1A
    00F38C1B     90             NOP
    00F38C1C     0000           ADD BYTE PTR DS:[EAX],AL
    00F38C1E     0000           ADD BYTE PTR DS:[EAX],AL
    00F38C20     58             POP EAX
    00F38C21    ^EB EB          JMP SHORT 00F38C0E
    Can't see me calling, you hatin'?

Similar Threads

  1. [Help] C++ Address read from CoD Ghosts problem
    By dban0001 in forum C++/C Programming
    Replies: 4
    Last Post: 12-12-2013, 06:50 AM
  2. [Solved] Read Integer From Selected Memory Address
    By vineeee in forum Visual Basic Programming
    Replies: 3
    Last Post: 02-19-2012, 10:04 PM
  3. Reading from a memory address
    By isaacboy in forum Visual Basic Programming
    Replies: 0
    Last Post: 03-26-2009, 03:28 AM
  4. Reading from an INI file
    By Credzis in forum C++/C Programming
    Replies: 0
    Last Post: 11-28-2007, 02:18 PM
  5. [Tutorial] Reading from the CMD line
    By shercipher in forum C++/C Programming
    Replies: 7
    Last Post: 04-04-2006, 12:49 PM