Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Converting a thread ID to a thread handle

223 views
Skip to first unread message

Ron Darziv

unread,
Jan 25, 1999, 3:00:00 AM1/25/99
to
Hi all,

Assume thread T is spawned by process P.
Process Q knows T's ID number, but nothing else.
Is it possible for Q to obtain a valid thread handle to T, using T's
ID only ?
The MSDN documentation specifies an OpenThread function, valid in
NT5+. I would like to do this in Win95/98 NT4.0+

Thanks in advance, Ron.

Jeff Claar

unread,
Jan 25, 1999, 3:00:00 AM1/25/99
to
There is no way to obtain a thread handle from a thread ID through Win32 --
the Knowledge Base states:

"There is no way to get the thread handle from the thread ID. While there is
an OpenProcess() API that takes a PID and returns the handle to the process,
there is no corresponding OpenThread() that takes a thread ID and returns a
thread handle." (Article Q127992)

You can call NtOpenThread directly (in ntdll.dll), but the function isn't
documented -- the parameters, and the implementation of on OpenThread
function can be found at
http://x12.dejanews.com/getdoc.xp?AN=432603633&CONTEXT=917313802.2045247631&
hitnum=3

(Go to DejaNews and search on NtOpenThread.)

Jeff


Ron Darziv wrote in message <36aca4f4...@news.ibm.net.il>...

Jürgen Schmied

unread,
Feb 1, 1999, 3:00:00 AM2/1/99
to
... there is a way but ms doesn't like you to know.

http://x5.dejanews.com/getdoc.xp?AN=209007149&CONTEXT=917866320.180420869&hitnum=30

Ciao

juergen

0 new messages