From 770e15eef1aee5f9cf0096be92c3d95623b260aa Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Mon, 13 Jul 2015 14:17:10 +0800 Subject: [PATCH] include: Add support for NtCurrentTeb and PSDK compiler in 64-bit mode. --- include/winnt.h | 6 ++++++ 1 file changed, 6 insertions(+) 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