In Windows, it's long been common, if undocumented, knowledge that the Thread Information Block (TIB) of the current thread can be found at FS:0. But that only works on Intel CPUs, where the FS register exists in the first place. Now I wanna get to the TIB on an ARM-based Windows system (Windows Phone and maybe Windows RT). Is there an API for that, please?
EDIT: I want to get the thread stack base for crash reporting purposes.
Information about TIB/TEB: http://www.microsoft.com/msj/archive/S2CE.aspx
Igor nailed it. But FYI, in ARM assembly it goes like this:
To answer your posted question, you can use
NtQueryInformationThread()
to retrieve aTHREAD_BASIC_INFORMATION
structure, which contains a pointer to the thread'sTIB
in itsTebBaseAddress
member.The macro
NtCurrentTeb()
is available inwinnt.h
for all supported architectures, including ARM (Windows RT):