Solved C Calculate Multi Offset Pointer

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

NullByte13

Newbie
Nov 16, 2016
4
12
0
Hi guys I'm newbie. First sorry for my bad English.

I have a problem. I'm working to write trainer. I'm find pointer addr from Cheat Engine but I'm not using in C.



0x00400000 + 0x016B4C9C + 0x8C + 0x12C + 0x4 + 0xE + 0x30


WriteProcessMemory

C++:
WriteProcessMemory(hProcess, (LPVOID*)((((((0x00400000 + 0x016B4C9C) + 0x8C) + 0x12C) + 0x4) + 0xE) + 0x30), &Money, sizeof(Money), NULL)
But It's not work. Please help me thanks for everything.
 

NullByte13

Newbie
Nov 16, 2016
4
12
0
Rake;45664 said:
Post your code using our EvaluatePointer function and we will help you. Posts like "it's not work" will make everyone hate you.
I'm really sorry. Yes, yes my code...

Here's my variables and EvaluatePointer function declaration.




EvaluatePointer Function.



And. Call EvaluatePointer and WriteProcessMemory.
 

Traxin

Escobar Tier VIP
Dank Tier Donator
Aug 3, 2015
1,041
25,378
154
I've tried to write to memory and forgotten to call OpenProcess before... Lol... Really took much longer to figure out then it should've.
Make sure it's not something outside of the scope you're currently looking in.

Or post your codenz so we can download it and give the rest of it a look.
 

Amonomen

Resident A$$hole
Dank Tier Donator
May 1, 2016
22
373
1
Your problem appears to reside in your EvaluatePointer function. Line 192 in your EvaluatePointer function is reading memory at pointer+offset. This is not working as you intend because it is adding your offset to the address of your pointer and not actually reading the pointer and then applying the offset.

You need to read the value at the address of the pointer, THEN apply the offset.
 

LongJmp

Newbie
Full Member
Oct 13, 2015
9
82
0
I think the same ,EvaluatePointer will work if u r working inside of tha app ( injected a dll )
If u r working outside u need to do smth like
HANDLE hProcess = OpenProcess(PROCESS_VM_READ | PROCESS_VM_WRITE | PROCESS_VM_OPERATION, FALSE, processID);

and then pass this handle to ReadProcessMemory
 

Broihon

edgy 12 y/o
Escobar Tier VIP
Fleep Tier Donator
Dec 22, 2013
1,745
40,528
316
Your problem appears to reside in your EvaluatePointer function. Line 192 in your EvaluatePointer function is reading memory at pointer+offset. This is not working as you intend because it is adding your offset to the address of your pointer and not actually reading the pointer and then applying the offset.

You need to read the value at the address of the pointer, THEN apply the offset.


Nope, he first reads the value in the base address and then adds the offset, reads again and adds the offset. It's correct that way.
The problem is that the EvaluatePointer function doesn't return the address but the uintptr_t value stored in the address.
NullByte13 do this:
C++:
uintptr_t EvaluatePointer(HANDLE hProc, uintptr_t pointer, size_t numOffsets, uintptr_t offsets[])
{
	if (!ReadProcessMemory(hProc, reinterpret_cast<void*>(pointer), &pointer, sizeof(uintptr_t), nullptr))
		return 0;

	for (auto i = 0; (i < numOffsets - 1) && (pointer != 0); ++i)
		if (!ReadProcessMemory(hProc, reinterpret_cast<void*>(pointer + offsets[i]), &pointer, sizeof(uintptr_t), nullptr))
			return 0;

	if (!pointer)
		return 0;

	return (pointer + offsets[numOffsets - 1]);
}
 

Rake

Cesspool Admin
Administrator
Jan 21, 2014
12,073
78,998
2,371
Вroihon;45827 said:
The problem is that the EvaluatePointer function doesn't return the address but the uintptr_t value stored in the address.
Does the function need to be updated or is it working as intended?
 

Broihon

edgy 12 y/o
Escobar Tier VIP
Fleep Tier Donator
Dec 22, 2013
1,745
40,528
316
Rake;45846 said:
Does the function need to be updated or is it working as intended?
You mean the various functions from this thread?
Yes, they all have the same problem (including the "optimized" ones I posted) that they actually read the final address which makes it more like a ReadDWORDPtr function...

C++:
UINT_PTR EvaluatePointer(HANDLE hProc, UINT_PTR BaseAddress, UINT_PTR * Offsets, UINT PointerLevel)
{
	if (!ReadProcessMemory(hProc, reinterpret_cast<void*>(BaseAddress), &BaseAddress, sizeof(BaseAddress), nullptr))
		return 0;
	
	--PointerLevel;

	for (; PointerLevel; --PointerLevel, ++Offsets)
		if (!ReadProcessMemory(hProc, reinterpret_cast<void*>(BaseAddress + *Offsets), &BaseAddress, sizeof(BaseAddress), nullptr) || !BaseAddress)
			return 0;

	return (BaseAddress + *Offsets);
}
Just use this sick function. Optimized af.
 

Rake

Cesspool Admin
Administrator
Jan 21, 2014
12,073
78,998
2,371
pardon me, but why would you not want the final address? I'm not understanding what the problem is :retard:

Also, sick function bro
 

Broihon

edgy 12 y/o
Escobar Tier VIP
Fleep Tier Donator
Dec 22, 2013
1,745
40,528
316
Rake;45861 said:
pardon me, but why would you not want the final address? I'm not understanding what the problem is :retard:

Also, sick function bro
Bro, it's returning what's stored at the final address but you just want the address for reading/writing.

Green = the actual address which should be returned by the EvaluatePointer function (the function in my previous post does exactly that)
Red = what the functions in the thread return and that's wrong
 

Rake

Cesspool Admin
Administrator
Jan 21, 2014
12,073
78,998
2,371
Вroihon;45863 said:
Bro, it's returning what's stored at the final address but you just want the address for reading/writing.
Well, fuck me. I've been using this same pointer to test this function the whole time and the last offset is 0, which makes the function work as intended. When I tried with a pointer without a 0 last offset, it fails. Thanks for the :spoon: broihon, time to update my function :retard:
 

Traxin

Escobar Tier VIP
Dank Tier Donator
Aug 3, 2015
1,041
25,378
154
Yo Brohoin stay dropping that knowledge bruh with his :bicepleft:op c++ codenz :bicepright:
I've noticed Brohoin ALWAYS has a different way to do something.
 

Traxin

Escobar Tier VIP
Dank Tier Donator
Aug 3, 2015
1,041
25,378
154
Rake;45872 said:
one of the many benefits of fist fucking yourself with a Bjarne Stroustrup voodoo doll
Oh my... QOTM nomination.
 
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