Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7960765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:50:53+00:00 2026-06-04T04:50:53+00:00

I read some data from a process (address: 0x58F03C) by using the WINAPI function

  • 0

I read some data from a process (address: 0x58F03C) by using the WINAPI function ReadProcessMemory:

DWORD proc_id;
GetWindowThreadProcessId(hwnd, &proc_id);
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, proc_id);
int value=0;

while (1)
{
    ReadProcessMemory(hProcess, (LPVOID)0x58F03C, &value, sizeof(value), 0);
    cout << "val: " << value << endl;
}

Since the address changes every time I restart the process I wondered if there is a way to always get the same address? There must be one because I see a lot of “Trainer-Programs” which are able to do that. How do they obtain the right address value to read from / write to?

Currently I obtain it by scanning for a value with the CheatEngine and perform a next scan for changed value.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T04:50:55+00:00Added an answer on June 4, 2026 at 4:50 am

    You are encountering dynamic memory allocation. In the CheatEngine world, these are called ‘pointers’.

    Consider some data (for example a uint32_t/DWORD) inside memory which was malloc‘d. If you find the address of the data, there is no guarantee that the next time you launch the process, the address will be the same. This is because the memory returned by malloc could be based at a different point in memory.

    The trick used to defeat dynamic memory allocation is to find a static heap address which can lead you to the address of the value you are interested in. The CheatEngine tutorial shows you how this is done. The same applies for multi-level pointers. At a higher level, this corresponds to dynamically allocated memory which holds a pointer to some other dynamically allocated memory, and so on.

    The method used in CheatEngine to get pointers works approximately like this:

    • Set an access hardware breakpoint at the address of the data value you are interested in
    • When code accesses it, the hardware breakpoint will show you what the code looks like

    The code will typically look something like this:

    mov eax, 0x1234ABCD 
    dec dword ptr ds:[eax+0x85]
    

    This might correspond to some code which decrements your HP when hit by an enemy. 0x1234ABCD is the pointer in this case and 0x85 the offset. In C code, this might have happened:

    struct some_struct* blah = malloc(...);
    ...
    blah->HP--;
    

    0x1234ABCD would be the address of blah. The HP value lives somewhere inside the block pointed to by blah. The offset into the memory block is 0x85. Then if you were writing a trainer, you would read the DWORD (QWORD if 64 bit) at 0x1234ABCD and add 0x85 to the value. This would give you the address of the HP value.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to store some binary data obtained from read() in my buffer using
I'm using R to read some data from a MySQL database using the RODBC
I'm using Qt and QProcess to read some data from other tools and printing
I need to read some data from an input file and plot a graph
I am trying to read some data from a python module from a web.
I've recently written a piece of code to read some data from a file,
I use VS2010, C#, ASP.NET; I read some data from SQL server and fill
I want to simply read some JSON data from a URL, then turn that
I have been tasked to read in some data from some weird old system.
I'm trying to read in some sample data from an XML file in a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.