A forum for reverse engineering, OS internals and malware analysis 

Ask your beginner questions here.
 #8706  by Tigzy
 Fri Sep 23, 2011 9:32 am
Hello

I'm currently trying to protect some processes by hooks, and I'm trying to forbid the OpenThread API with THREAD_TERMINATE for certain PIDs
Does anyone knows how I can retrieve the PID owner of a Thread (for filtering)?
I only got the TID (in ClientID) or the ETHREAD (with PsLookupThreadbyThreadID : http://msdn.microsoft.com/en-us/library ... 85%29.aspx)

NtOpenThread:
NTSTATUS NtOpenThread(
__out PHANDLE ThreadHandle,
__in ACCESS_MASK DesiredAccess,
__in POBJECT_ATTRIBUTES ObjectAttributes,
__in PCLIENT_ID ClientId
);
 #8707  by EP_X0FF
 Fri Sep 23, 2011 9:36 am
IoThreadToProcess
PsGetProcessId

thread moved