| View previous topic :: View next topic |
| Author |
Message |
lylcheat Cheater
Reputation: 0
Joined: 14 Feb 2009 Posts: 30 Location: Planet 3 Solar System Orion Arm Spiral Galaxy Milky Way
|
Posted: Sun Mar 29, 2026 3:16 pm Post subject: Thread Local Storage of the Thread Hitting a Break Point |
|
|
Target game is storing some info in the Thread Local Storage instead of static memory, presumably as a way to hinder debugger analysis.
Is it possible to read the Thread Local Storage or better get a pointer to the TEB of the thread hitting a break point inside debugger_onBreakpoint()?
I can get the TEB from cheat engine menu command. But is it possible to do it purely inside a lua script.
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 473
Joined: 09 May 2003 Posts: 25902 Location: The netherlands
|
Posted: Sun Mar 29, 2026 3:57 pm Post subject: |
|
|
| Code: |
function getTEB(tid)
local result
local th=executeCodeLocalEx('OpenThread',64 | 8, 0, tid)
if th~=0 then
local tbims=createMemoryStream()
tbims.size=48
local nresult=createMemoryStream()
nresult.size=8 --4 should be enough, but lets be safe
local hr=ExecuteCodeLocalEx('NtQueryInformationThread', th, 0, tbims.Memory, tbims.size, nresult.Memory)
if hr==0 then
tbims.Position=8
result=tbims.readQword()
end
tbims.destroy()
nresult.destroy()
executeCodeLocalEx('CloseHandle',th)
end
return result
end
|
during debugger_onBreakpoint the variable THREADID will contain the threadid of the thread
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
lylcheat Cheater
Reputation: 0
Joined: 14 Feb 2009 Posts: 30 Location: Planet 3 Solar System Orion Arm Spiral Galaxy Milky Way
|
Posted: Mon Mar 30, 2026 7:19 am Post subject: |
|
|
| Wouldn't the whole thing a lot simpler if the FS/GS registers are exposed to script too?
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 473
Joined: 09 May 2003 Posts: 25902 Location: The netherlands
|
Posted: Mon Mar 30, 2026 5:51 pm Post subject: |
|
|
Internally you'd still end up executing the above script for each breakpoint as the fs/gs base is not part of the windows context record
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
|