I know how to enumerate processes (createtollhelpsnapshot, etc...)
But how can i enumerate threads, and know for a given thread, to which process it is attached?
thank for responses
			
			
									
									
						enumerate threads
...,
Because you found ToolHelp.dll exists you are not stupid !
			
			
									
									Because you found ToolHelp.dll exists you are not stupid !
My avatar is a small copy of the 4x1.8m image I created and exposed at 'Le salon international du meuble à Paris' january 2004 in Matt Sindall's 'Shades' designers exhibition. The original laminated print was designed using a 150 dpi printout.
						thanks for this little recomfort!
I've asked earlier if it was possible to pause a process.
Eventually, it's possible, simply by using suspendthread_ for all threads attached to the process. Works fine. (and resumethread_ too)
(If i don't mistake, even if a process don't explicitly create a thread, there is a primary thread attached to it. Threads are the entities, above processes, with which the system manages for the access to the processor)
			
			
									
									
						I've asked earlier if it was possible to pause a process.
Eventually, it's possible, simply by using suspendthread_ for all threads attached to the process. Works fine. (and resumethread_ too)
(If i don't mistake, even if a process don't explicitly create a thread, there is a primary thread attached to it. Threads are the entities, above processes, with which the system manages for the access to the processor)
Maybe you scattered me with this DLL ...
HELP me in finding the args to throw in this dll ... I can't find the way to access it well ...
Rgrds
			
			
									
									HELP me in finding the args to throw in this dll ... I can't find the way to access it well ...
Rgrds
My avatar is a small copy of the 4x1.8m image I created and exposed at 'Le salon international du meuble à Paris' january 2004 in Matt Sindall's 'Shades' designers exhibition. The original laminated print was designed using a 150 dpi printout.
						Here is a procedure to suspend a process whose id is pid:
and the procedure to resume
for the constants, i use winapi program.
			
			
									
									
						Code: Select all
Structure thread32
size.l
use.l
idth.l
parentid.l
base.l
delta.l
flags.l
EndStructure
openlibrary(0,"kernel32.dll")
Procedure pause(pid)
thread.thread32
snap = CallFunction (0, "CreateToolhelp32Snapshot",4,0)
If snap
thread\size=SizeOf(thread32)
CallFunction(0,"Thread32First",snap,@thread)
If thread\parentid=pid
  h=CallFunction(0,"OpenThread",2,0,thread\idth)
  SuspendThread_(h)
  CloseHandle_(h)
EndIf
While CallFunction(0,"Thread32Next",snap,@thread)
If thread\parentid=pid
  h=CallFunction(0,"OpenThread",2,0,thread\idth)
  SuspendThread_(h)
  CloseHandle_(h)
EndIf
Wend
EndIf
EndProcedure
Code: Select all
Procedure resume(pid)
thread.thread32
snap = CallFunction (0, "CreateToolhelp32Snapshot",4,0)
If snap
thread\size=SizeOf(thread32)
CallFunction(0,"Thread32First",snap,@thread)
If thread\parentid=pid
  h=CallFunction(0,"OpenThread",2,0,thread\idth)
  ResumeThread_(h)
  CloseHandle_(h)
EndIf
While CallFunction(0,"Thread32Next",snap,@thread)
If thread\parentid=pid
  h=CallFunction(0,"OpenThread",2,0,thread\idth)
  ResumeThread_(h)
  CloseHandle_(h)
EndIf
Wend
EndIf
EndProcedure


