include/winnt.h: Add support for NtCurrentTeb and PSDK compiler in 64-bit mode.

Dmitry Timoshkov dmitry at baikal.ru
Mon Jul 13 01:17:10 CDT 2015


---
 include/winnt.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/include/winnt.h b/include/winnt.h
index 68a33f3..a1116bd 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
-- 
2.4.5




More information about the wine-patches mailing list