_rdteb
Microsoft Specific
Reads the thread pointer register (IntR13) and returns its value, which is the base address of the current thread environment block (TEB).
void* _rdteb();
Use NtCurrentTeb() for cross platform source code.
In WinNT.h
#ifdef _M_IA64
#define NtCurrentTeb() ((struct _TEB *)_rdtebex())
#if defined(_M_AMD64) && !defined(__midl)
__forceinline
struct _TEB *
NtCurrentTeb (
VOID
)
{
return (struct _TEB *)__readgsqword(FIELD_OFFSET(NT_TIB, Self));
}
#if defined(_M_IX86) && !defined(MIDL_PASS)
#define PcTeb 0x18
#if (_MSC_FULL_VER >= 13012035)
__inline struct _TEB * NtCurrentTeb( void ) { return (struct _TEB *) (ULONG_PTR) __readfsdword (PcTeb); }
#else
#if _MSC_VER >= 1200
#pragma warning(push)
#endif
#pragma warning (disable:4035) // disable 4035 (function must return something)
__inline struct _TEB * NtCurrentTeb( void ) { __asm mov eax, fs:[PcTeb] }
- 1/24/2011
- GreenCat