From f4c403d1f2100934c24241b0ed8f4e19cb0ff4dd Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 16 Jul 2020 10:25:43 +0200 Subject: [PATCH] ntdll: Use syscall thunks for event functions. Signed-off-by: Alexandre Julliard --- dlls/ntdll/ntdll.spec | 28 ++++++++-------- dlls/ntdll/sync.c | 72 ---------------------------------------- dlls/ntdll/unix/loader.c | 7 ---- dlls/ntdll/unixlib.h | 12 +------ 4 files changed, 15 insertions(+), 104 deletions(-) diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index 4dabe63ca56..8fcaa8789f2 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -148,7 +148,7 @@ @ stdcall NtCancelIoFile(long ptr) @ stdcall NtCancelIoFileEx(long ptr ptr) @ stdcall NtCancelTimer(long ptr) -@ stdcall NtClearEvent(long) +@ stdcall -syscall NtClearEvent(long) @ stdcall NtClearPowerRequest(long long) @ stdcall NtClose(long) @ stub NtCloseObjectAuditAlarm @@ -160,7 +160,7 @@ @ stdcall NtContinue(ptr long) # @ stub NtCreateDebugObject @ stdcall NtCreateDirectoryObject(ptr long ptr) -@ stdcall NtCreateEvent(ptr long ptr long long) +@ stdcall -syscall NtCreateEvent(ptr long ptr long long) @ stub NtCreateEventPair @ stdcall -syscall NtCreateFile(ptr long ptr ptr ptr long long long long ptr long) @ stdcall NtCreateIoCompletion(ptr long ptr long) @@ -251,7 +251,7 @@ @ stdcall NtNotifyChangeKey(long long ptr ptr ptr long long ptr long long) @ stdcall NtNotifyChangeMultipleKeys(long long ptr long ptr ptr ptr long long ptr long long) @ stdcall NtOpenDirectoryObject(ptr long ptr) -@ stdcall NtOpenEvent(ptr long ptr) +@ stdcall -syscall NtOpenEvent(ptr long ptr) @ stub NtOpenEventPair @ stdcall -syscall NtOpenFile(ptr long ptr ptr long long) @ stdcall NtOpenIoCompletion(ptr long ptr) @@ -279,7 +279,7 @@ @ stub NtPrivilegeObjectAuditAlarm @ stub NtPrivilegedServiceAuditAlarm @ stdcall NtProtectVirtualMemory(long ptr ptr long ptr) -@ stdcall NtPulseEvent(long ptr) +@ stdcall -syscall NtPulseEvent(long ptr) @ stdcall NtQueryAttributesFile(ptr ptr) # @ stub NtQueryBootEntryOrder # @ stub NtQueryBootOptions @@ -289,7 +289,7 @@ @ stdcall NtQueryDirectoryFile(long long ptr ptr ptr ptr long long long ptr long) @ stdcall NtQueryDirectoryObject(long ptr long long long ptr ptr) @ stdcall NtQueryEaFile(long ptr ptr long long ptr long ptr long) -@ stdcall NtQueryEvent(long long ptr long ptr) +@ stdcall -syscall NtQueryEvent(long long ptr long ptr) @ stdcall NtQueryFullAttributesFile(ptr ptr) @ stdcall NtQueryInformationAtom(long long ptr long ptr) @ stdcall NtQueryInformationFile(long ptr ptr long long) @@ -350,7 +350,7 @@ @ stub NtRequestPort @ stdcall NtRequestWaitReplyPort(ptr ptr ptr) # @ stub NtRequestWakeupLatency -@ stdcall NtResetEvent(long ptr) +@ stdcall -syscall NtResetEvent(long ptr) @ stdcall NtResetWriteWatch(long ptr long) @ stdcall NtRestoreKey(long long long) @ stdcall NtResumeProcess(long) @@ -367,7 +367,7 @@ @ stdcall NtSetDefaultLocale(long long) @ stdcall NtSetDefaultUILanguage(long) @ stdcall NtSetEaFile(long ptr ptr long) -@ stdcall NtSetEvent(long ptr) +@ stdcall -syscall NtSetEvent(long ptr) # @ stub NtSetEventBoostPriority @ stub NtSetHighEventPair @ stub NtSetHighWaitLowEventPair @@ -1137,7 +1137,7 @@ @ stdcall -private ZwCancelIoFile(long ptr) NtCancelIoFile @ stdcall -private ZwCancelIoFileEx(long ptr ptr) NtCancelIoFileEx @ stdcall -private ZwCancelTimer(long ptr) NtCancelTimer -@ stdcall -private ZwClearEvent(long) NtClearEvent +@ stdcall -private -syscall ZwClearEvent(long) NtClearEvent @ stdcall -private ZwClearPowerRequest(long long) NtClearPowerRequest @ stdcall -private ZwClose(long) NtClose @ stub ZwCloseObjectAuditAlarm @@ -1149,7 +1149,7 @@ @ stdcall -private ZwContinue(ptr long) NtContinue # @ stub ZwCreateDebugObject @ stdcall -private ZwCreateDirectoryObject(ptr long ptr) NtCreateDirectoryObject -@ stdcall -private ZwCreateEvent(ptr long ptr long long) NtCreateEvent +@ stdcall -private -syscall ZwCreateEvent(ptr long ptr long long) NtCreateEvent @ stub ZwCreateEventPair @ stdcall -private -syscall ZwCreateFile(ptr long ptr ptr ptr long long long long ptr long) NtCreateFile @ stdcall -private ZwCreateIoCompletion(ptr long ptr long) NtCreateIoCompletion @@ -1235,7 +1235,7 @@ @ stdcall -private ZwNotifyChangeKey(long long ptr ptr ptr long long ptr long long) NtNotifyChangeKey @ stdcall -private ZwNotifyChangeMultipleKeys(long long ptr long ptr ptr ptr long long ptr long long) NtNotifyChangeMultipleKeys @ stdcall -private ZwOpenDirectoryObject(ptr long ptr) NtOpenDirectoryObject -@ stdcall -private ZwOpenEvent(ptr long ptr) NtOpenEvent +@ stdcall -private -syscall ZwOpenEvent(ptr long ptr) NtOpenEvent @ stub ZwOpenEventPair @ stdcall -private -syscall ZwOpenFile(ptr long ptr ptr long long) NtOpenFile @ stdcall -private ZwOpenIoCompletion(ptr long ptr) NtOpenIoCompletion @@ -1263,7 +1263,7 @@ @ stub ZwPrivilegeObjectAuditAlarm @ stub ZwPrivilegedServiceAuditAlarm @ stdcall -private ZwProtectVirtualMemory(long ptr ptr long ptr) NtProtectVirtualMemory -@ stdcall -private ZwPulseEvent(long ptr) NtPulseEvent +@ stdcall -private -syscall ZwPulseEvent(long ptr) NtPulseEvent @ stdcall -private ZwQueryAttributesFile(ptr ptr) NtQueryAttributesFile # @ stub ZwQueryBootEntryOrder # @ stub ZwQueryBootOptions @@ -1273,7 +1273,7 @@ @ stdcall -private ZwQueryDirectoryFile(long long ptr ptr ptr ptr long long long ptr long) NtQueryDirectoryFile @ stdcall -private ZwQueryDirectoryObject(long ptr long long long ptr ptr) NtQueryDirectoryObject @ stdcall -private ZwQueryEaFile(long ptr ptr long long ptr long ptr long) NtQueryEaFile -@ stdcall -private ZwQueryEvent(long long ptr long ptr) NtQueryEvent +@ stdcall -private -syscall ZwQueryEvent(long long ptr long ptr) NtQueryEvent @ stdcall -private ZwQueryFullAttributesFile(ptr ptr) NtQueryFullAttributesFile @ stdcall -private ZwQueryInformationAtom(long long ptr long ptr) NtQueryInformationAtom @ stdcall -private ZwQueryInformationFile(long ptr ptr long long) NtQueryInformationFile @@ -1334,7 +1334,7 @@ @ stub ZwRequestPort @ stdcall -private ZwRequestWaitReplyPort(ptr ptr ptr) NtRequestWaitReplyPort # @ stub ZwRequestWakeupLatency -@ stdcall -private ZwResetEvent(long ptr) NtResetEvent +@ stdcall -private -syscall ZwResetEvent(long ptr) NtResetEvent @ stdcall -private ZwResetWriteWatch(long ptr long) NtResetWriteWatch @ stdcall -private ZwRestoreKey(long long long) NtRestoreKey @ stdcall -private ZwResumeProcess(long) NtResumeProcess @@ -1351,7 +1351,7 @@ @ stdcall -private ZwSetDefaultLocale(long long) NtSetDefaultLocale @ stdcall -private ZwSetDefaultUILanguage(long) NtSetDefaultUILanguage @ stdcall -private ZwSetEaFile(long ptr ptr long) NtSetEaFile -@ stdcall -private ZwSetEvent(long ptr) NtSetEvent +@ stdcall -private -syscall ZwSetEvent(long ptr) NtSetEvent # @ stub ZwSetEventBoostPriority @ stub ZwSetHighEventPair @ stub ZwSetHighWaitLowEventPair diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c index 56b32d5e6ce..29ee026ed50 100644 --- a/dlls/ntdll/sync.c +++ b/dlls/ntdll/sync.c @@ -135,78 +135,6 @@ NTSTATUS validate_open_object_attributes( const OBJECT_ATTRIBUTES *attr ) return STATUS_SUCCESS; } -/* - * Events - */ - -/************************************************************************** - * NtCreateEvent (NTDLL.@) - * ZwCreateEvent (NTDLL.@) - */ -NTSTATUS WINAPI NtCreateEvent( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, - EVENT_TYPE type, BOOLEAN state ) -{ - return unix_funcs->NtCreateEvent( handle, access, attr, type, state ); -} - -/****************************************************************************** - * NtOpenEvent (NTDLL.@) - * ZwOpenEvent (NTDLL.@) - */ -NTSTATUS WINAPI NtOpenEvent( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr ) -{ - return unix_funcs->NtOpenEvent( handle, access, attr ); -} - - -/****************************************************************************** - * NtSetEvent (NTDLL.@) - * ZwSetEvent (NTDLL.@) - */ -NTSTATUS WINAPI NtSetEvent( HANDLE handle, LONG *prev_state ) -{ - return unix_funcs->NtSetEvent( handle, prev_state ); -} - -/****************************************************************************** - * NtResetEvent (NTDLL.@) - */ -NTSTATUS WINAPI NtResetEvent( HANDLE handle, LONG *prev_state ) -{ - return unix_funcs->NtResetEvent( handle, prev_state ); -} - -/****************************************************************************** - * NtClearEvent (NTDLL.@) - * - * FIXME - * same as NtResetEvent ??? - */ -NTSTATUS WINAPI NtClearEvent ( HANDLE handle ) -{ - return unix_funcs->NtClearEvent( handle ); -} - -/****************************************************************************** - * NtPulseEvent (NTDLL.@) - * - * FIXME - * PulseCount - */ -NTSTATUS WINAPI NtPulseEvent( HANDLE handle, LONG *prev_state ) -{ - return unix_funcs->NtPulseEvent( handle, prev_state ); -} - -/****************************************************************************** - * NtQueryEvent (NTDLL.@) - */ -NTSTATUS WINAPI NtQueryEvent( HANDLE handle, EVENT_INFORMATION_CLASS class, - void *info, ULONG len, ULONG *ret_len ) -{ - return unix_funcs->NtQueryEvent( handle, class, info, len, ret_len ); -} - /* * Mutants (known as Mutexes in Kernel32) */ diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 2e6ed0e43fe..8d245521b38 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -1364,10 +1364,8 @@ static struct unix_funcs unix_funcs = NtAreMappedFilesTheSame, NtAssignProcessToJobObject, NtCancelTimer, - NtClearEvent, NtClose, NtContinue, - NtCreateEvent, NtCreateIoCompletion, NtCreateJobObject, NtCreateKeyedEvent, @@ -1396,7 +1394,6 @@ static struct unix_funcs unix_funcs = NtLockVirtualMemory, NtMapViewOfSection, NtNotifyChangeDirectoryFile, - NtOpenEvent, NtOpenIoCompletion, NtOpenJobObject, NtOpenKeyedEvent, @@ -1407,10 +1404,8 @@ static struct unix_funcs unix_funcs = NtOpenTimer, NtPowerInformation, NtProtectVirtualMemory, - NtPulseEvent, NtQueryAttributesFile, NtQueryDirectoryFile, - NtQueryEvent, NtQueryFullAttributesFile, NtQueryInformationFile, NtQueryInformationJobObject, @@ -1436,12 +1431,10 @@ static struct unix_funcs unix_funcs = NtReleaseMutant, NtRemoveIoCompletion, NtRemoveIoCompletionEx, - NtResetEvent, NtResetWriteWatch, NtResumeProcess, NtResumeThread, NtSetContextThread, - NtSetEvent, NtSetInformationFile, NtSetInformationJobObject, NtSetInformationObject, diff --git a/dlls/ntdll/unixlib.h b/dlls/ntdll/unixlib.h index 82d082ce76d..756c373adf2 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 75 +#define NTDLL_UNIXLIB_VERSION 76 struct unix_funcs { @@ -40,11 +40,8 @@ struct unix_funcs NTSTATUS (WINAPI *NtAreMappedFilesTheSame)(PVOID addr1, PVOID addr2); NTSTATUS (WINAPI *NtAssignProcessToJobObject)( HANDLE job, HANDLE process ); NTSTATUS (WINAPI *NtCancelTimer)( HANDLE handle, BOOLEAN *state ); - NTSTATUS (WINAPI *NtClearEvent)( HANDLE handle ); NTSTATUS (WINAPI *NtClose)( HANDLE handle ); NTSTATUS (WINAPI *NtContinue)( CONTEXT *context, BOOLEAN alertable ); - NTSTATUS (WINAPI *NtCreateEvent)( HANDLE *handle, ACCESS_MASK access, - const OBJECT_ATTRIBUTES *attr, EVENT_TYPE type, BOOLEAN state ); NTSTATUS (WINAPI *NtCreateIoCompletion)( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBUTES *attr, ULONG threads ); NTSTATUS (WINAPI *NtCreateJobObject)( HANDLE *handle, ACCESS_MASK access, @@ -112,8 +109,6 @@ struct unix_funcs void *apc_context, IO_STATUS_BLOCK *iosb, void *buffer, ULONG buffer_size, ULONG filter, BOOLEAN subtree ); - NTSTATUS (WINAPI *NtOpenEvent)( HANDLE *handle, ACCESS_MASK access, - const OBJECT_ATTRIBUTES *attr ); NTSTATUS (WINAPI *NtOpenIoCompletion)( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr ); NTSTATUS (WINAPI *NtOpenJobObject)( HANDLE *handle, ACCESS_MASK access, @@ -133,7 +128,6 @@ struct unix_funcs void *output, ULONG out_size ); NTSTATUS (WINAPI *NtProtectVirtualMemory)( HANDLE process, PVOID *addr_ptr, SIZE_T *size_ptr, ULONG new_prot, ULONG *old_prot ); - NTSTATUS (WINAPI *NtPulseEvent)( HANDLE handle, LONG *prev_state ); NTSTATUS (WINAPI *NtQueryAttributesFile)( const OBJECT_ATTRIBUTES *attr, FILE_BASIC_INFORMATION *info ); NTSTATUS (WINAPI *NtQueryDirectoryFile)( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc_routine, @@ -141,8 +135,6 @@ struct unix_funcs ULONG length, FILE_INFORMATION_CLASS info_class, BOOLEAN single_entry, UNICODE_STRING *mask, BOOLEAN restart_scan ); - NTSTATUS (WINAPI *NtQueryEvent)( HANDLE handle, EVENT_INFORMATION_CLASS class, - void *info, ULONG len, ULONG *ret_len ); NTSTATUS (WINAPI *NtQueryFullAttributesFile)( const OBJECT_ATTRIBUTES *attr, FILE_NETWORK_OPEN_INFORMATION *info ); NTSTATUS (WINAPI *NtQueryInformationFile)( HANDLE hFile, IO_STATUS_BLOCK *io, @@ -196,12 +188,10 @@ struct unix_funcs NTSTATUS (WINAPI *NtRemoveIoCompletionEx)( HANDLE handle, FILE_IO_COMPLETION_INFORMATION *info, ULONG count, ULONG *written, LARGE_INTEGER *timeout, BOOLEAN alertable ); - NTSTATUS (WINAPI *NtResetEvent)( HANDLE handle, LONG *prev_state ); NTSTATUS (WINAPI *NtResetWriteWatch)( HANDLE process, PVOID base, SIZE_T size ); NTSTATUS (WINAPI *NtResumeProcess)( HANDLE handle ); NTSTATUS (WINAPI *NtResumeThread)( HANDLE handle, ULONG *count ); NTSTATUS (WINAPI *NtSetContextThread)( HANDLE handle, const CONTEXT *context ); - NTSTATUS (WINAPI *NtSetEvent)( HANDLE handle, LONG *prev_state ); NTSTATUS (WINAPI *NtSetInformationFile)( HANDLE handle, IO_STATUS_BLOCK *io, void *ptr, ULONG len, FILE_INFORMATION_CLASS class ); NTSTATUS (WINAPI *NtSetInformationJobObject)( HANDLE handle, JOBOBJECTINFOCLASS class,