From bc2164e07487edccc32bff06691d14ab017a3f47 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 16 Jul 2020 10:14:26 +0200 Subject: [PATCH] ntdll: Use syscall thunks for semaphore functions. Signed-off-by: Alexandre Julliard --- dlls/ntdll/ntdll.spec | 16 ++++++++-------- dlls/ntdll/sync.c | 38 -------------------------------------- dlls/ntdll/unix/loader.c | 4 ---- dlls/ntdll/unixlib.h | 9 +-------- 4 files changed, 9 insertions(+), 58 deletions(-) diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index 7e2b6dd12fd..4dabe63ca56 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -180,7 +180,7 @@ # @ stub NtCreateProcessEx @ stub NtCreateProfile @ stdcall NtCreateSection(ptr long ptr ptr long long long) -@ stdcall NtCreateSemaphore(ptr long ptr long long) +@ stdcall -syscall NtCreateSemaphore(ptr long ptr long long) @ stdcall NtCreateSymbolicLinkObject(ptr long ptr ptr) @ stub NtCreateThread @ stdcall NtCreateThreadEx(ptr long ptr long ptr ptr long long long long ptr) @@ -267,7 +267,7 @@ @ stdcall NtOpenProcessToken(long long ptr) @ stdcall NtOpenProcessTokenEx(long long long ptr) @ stdcall NtOpenSection(ptr long ptr) -@ stdcall NtOpenSemaphore(ptr long ptr) +@ stdcall -syscall NtOpenSemaphore(ptr long ptr) @ stdcall NtOpenSymbolicLinkObject (ptr long ptr) @ stdcall NtOpenThread(ptr long ptr ptr) @ stdcall NtOpenThreadToken(long long long ptr) @@ -312,7 +312,7 @@ # @ stub NtQueryQuotaInformationFile @ stdcall NtQuerySection(long long ptr long ptr) @ stdcall NtQuerySecurityObject(long long ptr long ptr) -@ stdcall NtQuerySemaphore (long long ptr long ptr) +@ stdcall -syscall NtQuerySemaphore (long long ptr long ptr) @ stdcall NtQuerySymbolicLinkObject(long ptr ptr) @ stdcall NtQuerySystemEnvironmentValue(ptr ptr long ptr) @ stdcall NtQuerySystemEnvironmentValueEx(ptr ptr ptr ptr ptr) @@ -336,7 +336,7 @@ @ stdcall NtReleaseKeyedEvent(long ptr long ptr) @ stdcall NtReleaseMutant(long ptr) @ stub NtReleaseProcessMutant -@ stdcall NtReleaseSemaphore(long long ptr) +@ stdcall -syscall NtReleaseSemaphore(long long ptr) @ stdcall NtRemoveIoCompletion(ptr ptr ptr ptr ptr) @ stdcall NtRemoveIoCompletionEx(ptr ptr long ptr ptr long) # @ stub NtRemoveProcessDebug @@ -1168,7 +1168,7 @@ # @ stub ZwCreateProcessEx @ stub ZwCreateProfile @ stdcall -private ZwCreateSection(ptr long ptr ptr long long long) NtCreateSection -@ stdcall -private ZwCreateSemaphore(ptr long ptr long long) NtCreateSemaphore +@ stdcall -private -syscall ZwCreateSemaphore(ptr long ptr long long) NtCreateSemaphore @ stdcall -private ZwCreateSymbolicLinkObject(ptr long ptr ptr) NtCreateSymbolicLinkObject @ stub ZwCreateThread @ stdcall -private ZwCreateTimer(ptr long ptr long) NtCreateTimer @@ -1251,7 +1251,7 @@ @ stdcall -private ZwOpenProcessToken(long long ptr) NtOpenProcessToken @ stdcall -private ZwOpenProcessTokenEx(long long long ptr) NtOpenProcessTokenEx @ stdcall -private ZwOpenSection(ptr long ptr) NtOpenSection -@ stdcall -private ZwOpenSemaphore(ptr long ptr) NtOpenSemaphore +@ stdcall -private -syscall ZwOpenSemaphore(ptr long ptr) NtOpenSemaphore @ stdcall -private ZwOpenSymbolicLinkObject (ptr long ptr) NtOpenSymbolicLinkObject @ stdcall -private ZwOpenThread(ptr long ptr ptr) NtOpenThread @ stdcall -private ZwOpenThreadToken(long long long ptr) NtOpenThreadToken @@ -1296,7 +1296,7 @@ # @ stub ZwQueryQuotaInformationFile @ stdcall -private ZwQuerySection(long long ptr long ptr) NtQuerySection @ stdcall -private ZwQuerySecurityObject(long long ptr long ptr) NtQuerySecurityObject -@ stdcall -private ZwQuerySemaphore(long long ptr long ptr) NtQuerySemaphore +@ stdcall -private -syscall ZwQuerySemaphore(long long ptr long ptr) NtQuerySemaphore @ stdcall -private ZwQuerySymbolicLinkObject(long ptr ptr) NtQuerySymbolicLinkObject @ stdcall -private ZwQuerySystemEnvironmentValue(ptr ptr long ptr) NtQuerySystemEnvironmentValue @ stdcall -private ZwQuerySystemEnvironmentValueEx(ptr ptr ptr ptr ptr) NtQuerySystemEnvironmentValueEx @@ -1320,7 +1320,7 @@ @ stdcall -private ZwReleaseKeyedEvent(long ptr long ptr) NtReleaseKeyedEvent @ stdcall -private ZwReleaseMutant(long ptr) NtReleaseMutant @ stub ZwReleaseProcessMutant -@ stdcall -private ZwReleaseSemaphore(long long ptr) NtReleaseSemaphore +@ stdcall -private -syscall ZwReleaseSemaphore(long long ptr) NtReleaseSemaphore @ stdcall -private ZwRemoveIoCompletion(ptr ptr ptr ptr ptr) NtRemoveIoCompletion @ stdcall -private ZwRemoveIoCompletionEx(ptr ptr long ptr ptr long) NtRemoveIoCompletionEx # @ stub ZwRemoveProcessDebug diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c index 4a5ea1f91c2..56b32d5e6ce 100644 --- a/dlls/ntdll/sync.c +++ b/dlls/ntdll/sync.c @@ -135,44 +135,6 @@ NTSTATUS validate_open_object_attributes( const OBJECT_ATTRIBUTES *attr ) return STATUS_SUCCESS; } -/* - * Semaphores - */ - -/****************************************************************************** - * NtCreateSemaphore (NTDLL.@) - */ -NTSTATUS WINAPI NtCreateSemaphore( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, - LONG initial, LONG max ) -{ - return unix_funcs->NtCreateSemaphore( handle, access, attr, initial, max ); -} - -/****************************************************************************** - * NtOpenSemaphore (NTDLL.@) - */ -NTSTATUS WINAPI NtOpenSemaphore( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr ) -{ - return unix_funcs->NtOpenSemaphore( handle, access, attr ); -} - -/****************************************************************************** - * NtQuerySemaphore (NTDLL.@) - */ -NTSTATUS WINAPI NtQuerySemaphore( HANDLE handle, SEMAPHORE_INFORMATION_CLASS class, - void *info, ULONG len, ULONG *ret_len ) -{ - return unix_funcs->NtQuerySemaphore( handle, class, info, len, ret_len ); -} - -/****************************************************************************** - * NtReleaseSemaphore (NTDLL.@) - */ -NTSTATUS WINAPI NtReleaseSemaphore( HANDLE handle, ULONG count, PULONG previous ) -{ - return unix_funcs->NtReleaseSemaphore( handle, count, previous ); -} - /* * Events */ diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index d03f5861d0b..2e6ed0e43fe 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -1375,7 +1375,6 @@ static struct unix_funcs unix_funcs = NtCreateMutant, NtCreateNamedPipeFile, NtCreateSection, - NtCreateSemaphore, NtCreateThreadEx, NtCreateTimer, NtCreateUserProcess, @@ -1404,7 +1403,6 @@ static struct unix_funcs unix_funcs = NtOpenMutant, NtOpenProcess, NtOpenSection, - NtOpenSemaphore, NtOpenThread, NtOpenTimer, NtPowerInformation, @@ -1423,7 +1421,6 @@ static struct unix_funcs unix_funcs = NtQueryObject, NtQueryPerformanceCounter, NtQuerySection, - NtQuerySemaphore, NtQuerySystemInformation, NtQuerySystemInformationEx, NtQuerySystemTime, @@ -1437,7 +1434,6 @@ static struct unix_funcs unix_funcs = NtReadVirtualMemory, NtReleaseKeyedEvent, NtReleaseMutant, - NtReleaseSemaphore, NtRemoveIoCompletion, NtRemoveIoCompletionEx, NtResetEvent, diff --git a/dlls/ntdll/unixlib.h b/dlls/ntdll/unixlib.h index f39dd2d6d8f..82d082ce76d 100644 --- a/dlls/ntdll/unixlib.h +++ b/dlls/ntdll/unixlib.h @@ -28,7 +28,7 @@ struct msghdr; struct _DISPATCHER_CONTEXT; /* increment this when you change the function table */ -#define NTDLL_UNIXLIB_VERSION 74 +#define NTDLL_UNIXLIB_VERSION 75 struct unix_funcs { @@ -65,8 +65,6 @@ struct unix_funcs NTSTATUS (WINAPI *NtCreateSection)( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, const LARGE_INTEGER *size, ULONG protect, ULONG sec_flags, HANDLE file ); - NTSTATUS (WINAPI *NtCreateSemaphore)( HANDLE *handle, ACCESS_MASK access, - const OBJECT_ATTRIBUTES *attr, LONG initial, LONG max ); NTSTATUS (WINAPI *NtCreateThreadEx)( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBUTES *attr, HANDLE process, PRTL_THREAD_START_ROUTINE start, void *param, ULONG flags, SIZE_T zero_bits, SIZE_T stack_commit, @@ -128,8 +126,6 @@ struct unix_funcs const OBJECT_ATTRIBUTES *attr, const CLIENT_ID *id ); NTSTATUS (WINAPI *NtOpenSection)( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr ); - NTSTATUS (WINAPI *NtOpenSemaphore)( HANDLE *handle, ACCESS_MASK access, - const OBJECT_ATTRIBUTES *attr ); NTSTATUS (WINAPI *NtOpenThread)( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, const CLIENT_ID *id ); NTSTATUS (WINAPI *NtOpenTimer)( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr ); @@ -166,8 +162,6 @@ struct unix_funcs NTSTATUS (WINAPI *NtQueryPerformanceCounter)( LARGE_INTEGER *counter, LARGE_INTEGER *frequency ); NTSTATUS (WINAPI *NtQuerySection)( HANDLE handle, SECTION_INFORMATION_CLASS class, void *ptr, SIZE_T size, SIZE_T *ret_size ); - NTSTATUS (WINAPI *NtQuerySemaphore)( HANDLE handle, SEMAPHORE_INFORMATION_CLASS class, - void *info, ULONG len, ULONG *ret_len ); NTSTATUS (WINAPI *NtQuerySystemInformation)( SYSTEM_INFORMATION_CLASS class, void *info, ULONG size, ULONG *ret_size ); NTSTATUS (WINAPI *NtQuerySystemInformationEx)( SYSTEM_INFORMATION_CLASS class, @@ -197,7 +191,6 @@ struct unix_funcs NTSTATUS (WINAPI *NtReleaseKeyedEvent)( HANDLE handle, const void *key, BOOLEAN alertable, const LARGE_INTEGER *timeout ); NTSTATUS (WINAPI *NtReleaseMutant)( HANDLE handle, LONG *prev_count ); - NTSTATUS (WINAPI *NtReleaseSemaphore)( HANDLE handle, ULONG count, ULONG *previous ); NTSTATUS (WINAPI *NtRemoveIoCompletion)( HANDLE handle, ULONG_PTR *key, ULONG_PTR *value, IO_STATUS_BLOCK *io, LARGE_INTEGER *timeout ); NTSTATUS (WINAPI *NtRemoveIoCompletionEx)( HANDLE handle, FILE_IO_COMPLETION_INFORMATION *info,