Source Code How to Read Multi Level Pointers

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

xkhen0017

Newbie
Full Member
May 31, 2017
21
553
2
Hello everyone,

This is my first post here in GH community, I would like to thank you all for all the good stuffs you have here. Now I want to share my little snippet here for reading multi pointer offsets. I know there are a lot of work for how to read multi pointer addy.

C++:
//1st Param = Base Address or the Static Address
//2nd Param = level of the pointer
//3rd Param = offsets
//See below for example.

ReadPointerAddress(DWORD dwBase, int pLevel, ...) {
  DWORD Address = dwBase; 
  va_list dwPointers; 
  va_start(dwPointers, pLevel);

//Need to put __try/__except to ensure it is now reading a NULL pointer (sometimes it gives me error when I read an invalid pointer, usually when in loading screens )
  __try { 
    for (int nArg = 0; nArg < pLevel; nArg++) {
      ReadProcessMemory(hProcess, (LPCVOID)Address, &Address, 4, NULL);
      Address += va_arg(dwPointers, DWORD);
    }

    va_end(dwPointers);

    return Address;
  }
  __except (EXCEPTION_EXECUTE_HANDLER) {
    return NULL;
  }
}
Usage

C++:
struct tagPLAYERDATA {
	DWORD PlayerUID; //0x00
	char bytechunk[0x38]; //0X04
	float X; //0x3C
	float Y; //0x40
	float Z; //0x44
	char bytechunk2[0x3E8]; //0x48
	WCHAR *PlayerClass; //0x430
	char bytechunk3[0x1C64]; //0x2094
	WCHAR *PlayerName; //0x2098
}PLAYER_DATA;

//Initialize PlayerData;
PLAYER_DATA *PlayerData;

//Base Address = 0x016D1E50;
//number of offsets = 5,
//offsets = {0xE8, 0x638, 0x66C, 0x8, -0xC}
//then you can just read it like this
PlayerData = (PlayerData*)ReadPointerAddress(0x016D1E50, 5, 0xE8, 0x638, 0x66C, 0x8, -0xC);

//this will store the pointer of the return address from ReadPointerAddress to PlayerData giving you data of all the member of the struct.
If you can share faster way or improve my code its better. Positive criticism are welcome.

Thank you,
 

Not2EXceL

The rust BC is trash...wait no im a shit dev
Dank Tier Donator
Nobleman
Jan 20, 2013
130
1,743
3
Nice post, you should however use something like std::vector over ellipsis. Ellipsis aren't typesafe, and as well tend to look worse than just a collection. However that former argument can be attributed to opinion.
 

xkhen0017

Newbie
Full Member
May 31, 2017
21
553
2
I got your point, but I'm using the ellipsis method, which make use of the variable argument.
 
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