I want to output the current RIPs and RSPs of all threads of my program in PureBasic like x64dbg does. How do I do that?
Code: Select all
; How to get rip and rsp of each Thread without changing the Thread?
Structure ThreadType
ID.i
RIP.i
RSP.i
EndStructure
NewList ThreadList.ThreadType()
#Anzahl=10
Procedure myThread(*t.ThreadType)
Protected i
Repeat
; *t\RIP=?Label13 : Label13: ; without doing this every code line.
Delay(1)
For i=1 To 1000000
Next
ForEver
EndProcedure
For i=1 To #Anzahl
AddElement(Threadlist())
Threadlist()\ID=CreateThread(@myThread(),@Threadlist())
Next
Window=OpenWindow(#PB_Any,0,0,300,#Anzahl*20,"List Thread RIP, RSP",#PB_Window_SystemMenu)
AddWindowTimer(Window,123,1600)
TextGadget(0,0,0,300,#Anzahl*20,"RIP RSP")
Repeat
Event=WaitWindowEvent(16)
Select Event
Case #PB_Event_Timer
Select EventTimer()
Case 123
s.s="RIP"+#CRLF$
ForEach Threadlist()
Threadlist()\RIP=$13DA111B+Random(50) ; ???
s+RSet(Hex(ThreadList()\RIP,#PB_Quad),16,"0")+#CRLF$
Next
SetGadgetText(0,s)
EndSelect
EndSelect
Until Event=#PB_Event_CloseWindow
CompilerIf #PB_Compiler_Thread=0
CompilerError "Please switch Thread save on."
CompilerEndIf