Commit 92b6ab2d authored by Alexandre Julliard's avatar Alexandre Julliard

win32u: Store the service table entry directly into the ntdll variable.

parent c8ecc359
......@@ -920,37 +920,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
*/
static NTSTATUS load_so_dll( void *args )
......
......@@ -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;
......
......@@ -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[] =
......
......@@ -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 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment