diff --git a/include/winnt.h b/include/winnt.h index 68a33f3a8e9..a1116bd87e0 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -2335,6 +2335,12 @@ static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void) __asm__(".byte 0x65\n\tmovq (0x30),%0" : "=r" (teb)); return teb; } +#elif defined(__x86_64__) && defined(_MSC_VER) +#pragma intrinsic(__readgsqword) +static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void) +{ + return (struct _TEB *)__readgsqword(FIELD_OFFSET(NT_TIB, Self)); +} #else extern struct _TEB * WINAPI NtCurrentTeb(void); #endif