reactos/sdk/include/ndk/inline_ntcurrentteb.h
Hermès Bélusca-Maïto 352b7f6785
[SDK:NDK/XDK] Sync NtCurrentTeb() definitions between NDK and PSDK winnt.h (#6542)
The definitions in the NDK inline_ntcurrentteb.h and psfuncs.h files are
synced togther with those of winnt.h (in the winnt_old.h generator file).

See commits c1929445d (r49627) and 925c587c8 (r56318).

IMPORTANT NOTE: The ARM64 definition does not exist yet in our headers!
2024-03-10 17:10:50 +01:00

32 lines
712 B
C

#ifndef _INLINE_NT_CURRENTTEB_H_
#define _INLINE_NT_CURRENTTEB_H_
#ifdef __cplusplus
extern "C" {
#endif
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
{
#if defined(_M_IX86)
return (struct _TEB *)__readfsdword(0x18);
#elif defined(_M_AMD64)
return (struct _TEB *)__readgsqword(FIELD_OFFSET(NT_TIB, Self));
#elif defined(_M_ARM)
// return (struct _TEB *)KeGetPcr()->Used_Self;
return (struct _TEB *)(ULONG_PTR)_MoveFromCoprocessor(CP15_TPIDRURW);
#elif defined (_M_ARM64)
//UNIMPLEMENTED;
return 0;
// #elif defined(_M_PPC)
// return (struct _TEB *)_read_teb_dword(0x18);
#else
#error Unsupported architecture
#endif
}
#ifdef __cplusplus
}
#endif
#endif // _INLINE_NT_CURRENTTEB_H_