Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Read Cheatengines Threadstack0 with c++

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
scorni
How do I cheat?
Reputation: 0

Joined: 18 Nov 2015
Posts: 4

PostPosted: Wed Nov 18, 2015 12:38 pm    Post subject: Read Cheatengines Threadstack0 with c++ Reply with quote

I want to get the address that you get if you add an manual address in cheatengine and type "Threadstack0" as the value. In this example i used the Tutorial-i386.exe wich returns for example 0x165FF8C as Threadstack0.

As first step i am opening the thread in c++ with

Code:
 OpenThread(THREAD_ALL_ACCESS, 0, thread_id );


and obtain thread thread context with

Code:
ctx.ContextFlags = CONTEXT_ALL;
SuspendThread(thandle);
GetThreadContext(thandle, &ctx);
ResumeThread(thandle);


The next step is to get the base address with virtualquery

Code:
_MEMORY_BASIC_INFORMATION buffer;
VirtualQueryEx(phandle, (void*)(ctx.Esp), &buffer, sizeof(buffer));


If i return the address

Code:
ShowMessage(IntToHex((int)buffer.BaseAddress ,8));


It is showing me an adress like 0x0165F000, but i want to get the address 0x165FF8C which is displayed by Cheatengine.

Someone any ideas?
Back to top
View user's profile Send private message
hollow87
Cheater
Reputation: 0

Joined: 07 Feb 2015
Posts: 28

PostPosted: Wed Nov 18, 2015 4:08 pm    Post subject: Reply with quote

I found this post by Dark Byte on what ThreadStack0 is and how CheatEngine obtains it.

http://forum.cheatengine.org/viewtopic.php?p=5487976#5487976

Also the source code for cheat engine might help shed some light

https://github.com/cheat-engine/cheat-engine/blob/master/Cheat%20Engine/CEFuncProc.pas#L3080

Line 3080 (At time of writing) seems to be where that is obtained.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites