Hey there!
I'd like to query the current threadID without making a windowsAPI call.
According to this http://en.wikipedia.org/wiki/Win32_Thread_Information_Block wikipedia article it should be possible to access the thread ID directly. I tried this code:
void* tibPtr;
__asm {
mov EAX, FS:[0x18]
mov [tibPtr], EAX
}
int* ptrToThreadID = (int*)(((char*)tibPtr)+0x24);
as i understand it, dereferencing ptrToThreadID should yeld now everytime the current ThreadID.
however, it gives me a different result than the WinAPI function GetCurrentThreadId() and also the value it points to doesn't change.
What am I doing wrong? I'm compiling for Win32, but running Windows Vista 64bit. Do I need to look for the threadID at another location on 64bit systems?