Solved calculating pointers with offset

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

ege

Newbie
Nov 30, 2014
3
82
0
how can i calculate a pointer in c++ i tried this but its not working

C++:
	DWORD xpos = (0x400000 + 0x0042BD74 + 0x94 + 0x10C);
also tried like this
C++:
	DWORD * xpos = (DWORD*)(0x400000 + 0x0042BD74 + 0x94 + 0x10C);
 

Rake

Cesspool Admin
Administrator
Jan 21, 2014
12,153
78,998
2,396
https://guidedhacking.com/finddma
https://guidedhacking.com/threads/how-to-hack-any-game-tutorial-c-external-trainer-part-2.10897/


I see you need a little guidance, you're on the right track and we are gonna push you in the right direction.
If you have any similar questions please post them in this thread.

Let's look at this:
C++:
DWORD * xpos = (DWORD*)(0x400000 + 0x0042BD74 + 0x94 + 0x10C);
Unfortunately you cannot dereference a pointer from another process. You have to utilize ReadProcessMemory to read the value held in the pointer. Remember the value held in the pointer is an address.


Let's look at this:
C++:
DWORD xpos = (0x400000 + 0x0042BD74 + 0x94 + 0x10C);
If I make any incorrect assumptions please correct me


0x400000 = base address of yourmodule.exe
yourmodule.exe + 0x0042BD74 : this is what you probably see when you look at your pointer in cheat engine.
0x0042BD74 is the relative virtual address offset of your pointer relative to the virtual location of your module


So let's rewrite some of this for the sake of readability. I recommend using dwGetModuleBaseAddress or a similar function but I am going to avoid using it here so that you understand the concept of what it does.
Here is some code that will put your gathered data to use


C++:
DWORD ModuleBaseAddress = 0x400000;
DWORD OffsetToPointer = 0x0042BD74;
DWORD Pointer = ModuleBaseAddress + OffsetToPointer;
DWORD TempDWORD;
DWORD Offset1 = 0x94;
DWORD Offset2 = 0x10c;
   
DWORD XPositionAddress;
float XPosition;


//you will have to retrieve hProcHandle, if you don't know how then google/ask us
// This reads the value held in your pointer and then stores it in to TempDWORD
ReadProcessMemory(hProcHandle, (LPCVOID)Pointer, &TempDWORD, 4, NULL);


//Read the next level of the pointer by adding the first offset and reading from that address
ReadProcessMemory(hProcHandle, (LPCVOID)(TempDWORD + Offset1), &TempDWORD, 4, NULL);


XPositionAddress = TempDWORD + Offset2;


//This reads the XPosition value from the game and stores it float XPosition
ReadProcessMemory(hProcHandle, (LPCVOID)XPositionAddress, &XPosition, 4, NULL)
Hope that helped!
 
Last edited:

Liduen

Hacker
Dank Tier VIP
May 19, 2013
702
8,478
33
And here it goes again...
The never ending posts about pointer and how to use them properly.

Does someone has a link to a similar thread at hand? I'm too lazy to search right now.
We should make an extra thread about this so we can link the thread instead of giving handwritten answers everytime someone comes up with this question ^^
 

Solaire

Respected Hacker
Dank Tier VIP
Dec 15, 2013
1,051
16,353
62
C++:
DWORD FindDmaAddy(int PointerLevel, HANDLE hProcHandle, DWORD Offsets[], DWORD BaseAddress)
{
    DWORD pointer = BaseAddress;
    DWORD pTemp;
    DWORD pointerAddr;
     
    for (int c = 0; c < PointerLevel; c++)
    {
            if (c == 0)
            {
                    ReadProcessMemory(hProcHandle, (LPCVOID)pointer, &pTemp, sizeof(pTemp), NULL);
            }
            pointerAddr = pTemp + Offsets[c];
            ReadProcessMemory(hProcHandle, (LPCVOID)pointerAddr, &pTemp, sizeof(pTemp), NULL);
    }
    return pointerAddr;
}
Fleep's FindDmaAddy Function

Send in the number of offsets, the handle, an array containing the offsets, and the base address.

If you're using this on a hack for a multiplayer game, or a game with an anti-cheat, rewrite this whole function.
 

GozillaMaster

Newbie
Full Member
Jan 21, 2013
17
428
0
Welcome to GuidedHacking.com ege!
I see you need a little guidance, you're on the right track and we are gonna push you in the right direction.
If you have any similar questions please post them in this thread.

Let's look at this:
C++:
DWORD * xpos = (DWORD*)(0x400000 + 0x0042BD74 + 0x94 + 0x10C);
Unfortunately you cannot dereference a pointer from another process. You have to utilize ReadProcessMemory to read the value held in the pointer. Remember the value held in the pointer is an address.


Let's look at this:
C++:
DWORD xpos = (0x400000 + 0x0042BD74 + 0x94 + 0x10C);
If I make any incorrect assumptions please correct me


0x400000 = base address of yourmodule.exe
yourmodule.exe + 0x0042BD74 : this is what you probably see when you look at your pointer in cheat engine.
0x0042BD74 is the relative virtual address offset of your pointer relative to the virtual location of your module


So let's rewrite some of this for the sake of readability. I recommend using dwGetModuleBaseAddress or a similar function but I am going to avoid using it here so that you understand the concept of what it does.
Here is some code that will put your gathered data to use


C++:
DWORD ModuleBaseAddress = 0x400000;
DWORD OffsetToPointer = 0x0042BD74;
DWORD Pointer = ModuleBaseAddress + OffsetToPointer;
DWORD TempDWORD;
DWORD Offset1 = 0x94;
DWORD Offset2 = 0x10c;
    
DWORD XPositionAddress;
float XPosition;


//you will have to retrieve hProcHandle, if you don't know how then google/ask us
// This reads the value held in your pointer and then stores it in to TempDWORD
ReadProcessMemory(hProcHandle, (LPCVOID)Pointer, &TempDWORD, 4, NULL);


//Read the next level of the pointer by adding the first offset and reading from that address
ReadProcessMemory(hProcHandle, (LPCVOID)(TempDWORD + Offset1), &TempDWORD, 4, NULL);


XPositionAddress = TempDWORD + Offset2;


//This reads the XPosition value from the game and stores it float XPosition
ReadProcessMemory(hProcHandle, (LPCVOID)XPositionAddress, &XPosition, 4, NULL)
Hope that helped!
Thank AnomanderRake you help me a gain with this
 
Last edited:
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods