dELTA
March 15th, 2003, 13:06
Does anyone know if it's really not possible to get hold of an ID or handle to an arbitrary thread in a running process by way of "normal" win32 API commands (i.e. without using the ToolHelp or PSAPI libraries)?
When you create a process with CreateProcess, you are handed 4 numbers, the ID and handle of the process itself and the ID and handle of the main thread of the process, but when you attach to a running process with OpenProcess, you only get the ID and handle of the process itself, no thread info (which is of course quite understandable, since no thread can be considered "more main" than another in a process once it is running).
But the problem is that I cannot find any combination of "normal" win32 API commands for enumerating threads of a running process or in any other way getting hold of an arbitrary thread of a running process.
So, does anybody know for sure if this is impossible or not?
I don't really have high hopes about it after looking around on the net, but it seems like such a missing piece of the native debug API to me, that's all.
Thanks.
dELTA
When you create a process with CreateProcess, you are handed 4 numbers, the ID and handle of the process itself and the ID and handle of the main thread of the process, but when you attach to a running process with OpenProcess, you only get the ID and handle of the process itself, no thread info (which is of course quite understandable, since no thread can be considered "more main" than another in a process once it is running).
But the problem is that I cannot find any combination of "normal" win32 API commands for enumerating threads of a running process or in any other way getting hold of an arbitrary thread of a running process.
So, does anybody know for sure if this is impossible or not?
I don't really have high hopes about it after looking around on the net, but it seems like such a missing piece of the native debug API to me, that's all.
Thanks.
dELTA