Module: wine Branch: master Commit: 92b6ab2d6e2af1f70966fa4631cae2789d052730 URL: https://gitlab.winehq.org/wine/wine/-/commit/92b6ab2d6e2af1f70966fa4631cae27...
Author: Alexandre Julliard julliard@winehq.org Date: Fri Nov 17 09:57:56 2023 +0100
win32u: Store the service table entry directly into the ntdll variable.
---
dlls/ntdll/unix/loader.c | 31 ------------------------------- dlls/win32u/main.c | 2 +- dlls/win32u/syscall.c | 7 ++++--- include/wine/unixlib.h | 2 +- 4 files changed, 6 insertions(+), 36 deletions(-)
diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index fa38cea0615..aa120ae38ec 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -919,37 +919,6 @@ static NTSTATUS dlopen_dll( const char *so_name, UNICODE_STRING *nt_name, void * }
-/*********************************************************************** - * ntdll_init_syscalls - */ -NTSTATUS ntdll_init_syscalls( SYSTEM_SERVICE_TABLE *table, void **dispatcher ) -{ - struct syscall_info - { - void *dispatcher; - UINT version; - USHORT id; - USHORT limit; - /* USHORT names[limit]; */ - /* BYTE args[limit]; */ - } *info = (struct syscall_info *)dispatcher; - - if (info->version != 0xca110001) - { - ERR( "invalid syscall table version %x\n", info->version ); - NtTerminateProcess( GetCurrentProcess(), STATUS_INVALID_PARAMETER ); - } - if (info->limit != table->ServiceLimit) - { - ERR( "syscall count mismatch %u / %lu\n", info->limit, table->ServiceLimit ); - NtTerminateProcess( GetCurrentProcess(), STATUS_INVALID_PARAMETER ); - } - info->dispatcher = __wine_syscall_dispatcher; - KeServiceDescriptorTable[info->id] = *table; - return STATUS_SUCCESS; -} - - /*********************************************************************** * load_so_dll */ diff --git a/dlls/win32u/main.c b/dlls/win32u/main.c index fa75ad4f5c5..e074186cd90 100644 --- a/dlls/win32u/main.c +++ b/dlls/win32u/main.c @@ -61,7 +61,7 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, void *reserved ) __wine_syscall_dispatcher = *dispatcher_ptr; if (!NtQueryVirtualMemory( GetCurrentProcess(), inst, MemoryWineUnixFuncs, &win32u_handle, sizeof(win32u_handle), NULL )) - __wine_unix_call( win32u_handle, 0, &__wine_syscall_dispatcher ); + __wine_unix_call( win32u_handle, 0, NULL ); break; } return TRUE; diff --git a/dlls/win32u/syscall.c b/dlls/win32u/syscall.c index b741df91c66..2320ac18744 100644 --- a/dlls/win32u/syscall.c +++ b/dlls/win32u/syscall.c @@ -58,7 +58,7 @@ static BYTE arguments[ARRAY_SIZE(syscalls)] = #undef SYSCALL_ENTRY };
-static SYSTEM_SERVICE_TABLE syscall_table = +static const SYSTEM_SERVICE_TABLE syscall_table = { (ULONG_PTR *)syscalls, 0, @@ -66,7 +66,7 @@ static SYSTEM_SERVICE_TABLE syscall_table = arguments };
-static NTSTATUS init( void *dispatcher ) +static NTSTATUS init( void *args ) { #ifdef _WIN64 if (NtCurrentTeb()->WowTebOffset) @@ -78,7 +78,8 @@ static NTSTATUS init( void *dispatcher ) } #endif
- return ntdll_init_syscalls( &syscall_table, dispatcher ); + KeServiceDescriptorTable[1] = syscall_table; + return STATUS_SUCCESS; }
const unixlib_entry_t __wine_unix_call_funcs[] = diff --git a/include/wine/unixlib.h b/include/wine/unixlib.h index 81c59e732ba..2a615179e64 100644 --- a/include/wine/unixlib.h +++ b/include/wine/unixlib.h @@ -31,6 +31,7 @@ typedef NTSTATUS (*unixlib_entry_t)( void *args );
extern DECLSPEC_EXPORT const unixlib_entry_t __wine_unix_call_funcs[]; extern DECLSPEC_EXPORT const unixlib_entry_t __wine_unix_call_wow64_funcs[]; +extern DECLSPEC_EXPORT SYSTEM_SERVICE_TABLE KeServiceDescriptorTable[4];
/* some useful helpers from ntdll */ NTSYSAPI const char *ntdll_get_build_dir(void); @@ -39,7 +40,6 @@ NTSYSAPI DWORD ntdll_umbstowcs( const char *src, DWORD srclen, WCHAR *dst, DWORD NTSYSAPI int ntdll_wcstoumbs( const WCHAR *src, DWORD srclen, char *dst, DWORD dstlen, BOOL strict ); NTSYSAPI int ntdll_wcsicmp( const WCHAR *str1, const WCHAR *str2 ); NTSYSAPI int ntdll_wcsnicmp( const WCHAR *str1, const WCHAR *str2, int n ); -NTSYSAPI NTSTATUS ntdll_init_syscalls( SYSTEM_SERVICE_TABLE *table, void **dispatcher );
/* exception handling */