From 04018008d5ca9c25a5d5e9c6eed7c6c1a8938a5c Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 16 Oct 2015 05:31:11 +0200
Subject: ntdll: Syscalls should not call Nt*Ex thunk wrappers.

---
 dlls/ntdll/nt.c         | 4 ++--
 dlls/ntdll/ntdll_misc.h | 2 ++
 dlls/ntdll/reg.c        | 4 ++--
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c
index 19d5b6e..a0d8909 100644
--- a/dlls/ntdll/nt.c
+++ b/dlls/ntdll/nt.c
@@ -124,7 +124,7 @@ NTSTATUS WINAPI SYSCALL(NtOpenProcessToken)(
 	DWORD DesiredAccess,
 	HANDLE *TokenHandle)
 {
-    return NtOpenProcessTokenEx( ProcessHandle, DesiredAccess, 0, TokenHandle );
+    return SYSCALL(NtOpenProcessTokenEx)( ProcessHandle, DesiredAccess, 0, TokenHandle );
 }
 
 /******************************************************************************
@@ -163,7 +163,7 @@ NTSTATUS WINAPI SYSCALL(NtOpenThreadToken)(
 	BOOLEAN OpenAsSelf,
 	HANDLE *TokenHandle)
 {
-    return NtOpenThreadTokenEx( ThreadHandle, DesiredAccess, OpenAsSelf, 0, TokenHandle );
+    return SYSCALL(NtOpenThreadTokenEx)( ThreadHandle, DesiredAccess, OpenAsSelf, 0, TokenHandle );
 }
 
 /******************************************************************************
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index 5566080..ee94382 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -280,6 +280,8 @@ DECLARE_SYSCALL_ENTRYPOINT( NtFlushVirtualMemory );
 DECLARE_SYSCALL_ENTRYPOINT( NtFreeVirtualMemory );
 DECLARE_SYSCALL_ENTRYPOINT( NtLockVirtualMemory );
 DECLARE_SYSCALL_ENTRYPOINT( NtMapViewOfSection );
+DECLARE_SYSCALL_ENTRYPOINT( NtOpenProcessTokenEx );
+DECLARE_SYSCALL_ENTRYPOINT( NtOpenThreadTokenEx );
 DECLARE_SYSCALL_ENTRYPOINT( NtProtectVirtualMemory );
 DECLARE_SYSCALL_ENTRYPOINT( NtQueryVirtualMemory );
 DECLARE_SYSCALL_ENTRYPOINT( NtUnlockVirtualMemory );
diff --git a/dlls/ntdll/reg.c b/dlls/ntdll/reg.c
index b74c464..406d72f 100644
--- a/dlls/ntdll/reg.c
+++ b/dlls/ntdll/reg.c
@@ -183,7 +183,7 @@ DEFINE_SYSCALL_ENTRYPOINT( NtOpenKeyTransacted, 4 );
 NTSTATUS WINAPI SYSCALL(NtOpenKeyTransacted)( PHANDLE retkey, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr,
                                      HANDLE transaction )
 {
-    return NtOpenKeyTransactedEx( retkey, access, attr, 0, transaction );
+    return SYSCALL(NtOpenKeyTransactedEx)( retkey, access, attr, 0, transaction );
 }
 
 /******************************************************************************
@@ -749,7 +749,7 @@ NTSTATUS WINAPI SYSCALL(NtNotifyChangeKey)(
 	IN ULONG Length,
 	IN BOOLEAN Asynchronous)
 {
-    return NtNotifyChangeMultipleKeys(KeyHandle, 0, NULL, Event, ApcRoutine, ApcContext,
+    return SYSCALL(NtNotifyChangeMultipleKeys)(KeyHandle, 0, NULL, Event, ApcRoutine, ApcContext,
                                       IoStatusBlock, CompletionFilter, WatchSubtree,
                                       ChangeBuffer, Length, Asynchronous);
 }
-- 
2.6.2

