ntdll: Also store syscall id and names following the syscall dispatcher pointer.

This commit is contained in:
Alexandre Julliard 2023-08-25 12:09:12 +02:00
parent 5bc6ab56d0
commit 7ee9c19687
4 changed files with 20 additions and 10 deletions

View file

@ -1233,24 +1233,31 @@ static NTSTATUS dlopen_dll( const char *so_name, UNICODE_STRING *nt_name, void *
/***********************************************************************
* ntdll_init_syscalls
*/
NTSTATUS ntdll_init_syscalls( ULONG id, SYSTEM_SERVICE_TABLE *table, void **dispatcher )
NTSTATUS ntdll_init_syscalls( SYSTEM_SERVICE_TABLE *table, void **dispatcher )
{
struct syscall_info
{
void *dispatcher;
UINT version;
USHORT id;
USHORT limit;
BYTE args[1];
/* USHORT names[limit]; */
/* BYTE args[limit]; */
} *info = (struct syscall_info *)dispatcher;
if (id > 3) return STATUS_INVALID_PARAMETER;
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;
memcpy( table->ArgumentTable, info->args, table->ServiceLimit );
KeServiceDescriptorTable[id] = *table;
memcpy( table->ArgumentTable, (USHORT *)(info + 1) + info->limit, table->ServiceLimit );
KeServiceDescriptorTable[info->id] = *table;
return STATUS_SUCCESS;
}
@ -2093,7 +2100,7 @@ static void start_main_thread(void)
load_ntdll();
if (main_image_info.Machine != current_machine) load_wow64_ntdll( main_image_info.Machine );
load_apiset_dll();
ntdll_init_syscalls( 0, &syscall_table, p__wine_syscall_dispatcher );
ntdll_init_syscalls( &syscall_table, p__wine_syscall_dispatcher );
server_init_process_done();
}

View file

@ -461,7 +461,7 @@ static NTSTATUS init( void *dispatcher )
}
#endif
return ntdll_init_syscalls( 1, &syscall_table, dispatcher );
return ntdll_init_syscalls( &syscall_table, dispatcher );
}
unixlib_entry_t __wine_unix_call_funcs[] =

View file

@ -36,7 +36,7 @@ extern DWORD ntdll_umbstowcs( const char *src, DWORD srclen, WCHAR *dst, DWORD d
extern int ntdll_wcstoumbs( const WCHAR *src, DWORD srclen, char *dst, DWORD dstlen, BOOL strict );
extern int ntdll_wcsicmp( const WCHAR *str1, const WCHAR *str2 );
extern int ntdll_wcsnicmp( const WCHAR *str1, const WCHAR *str2, int n );
extern NTSTATUS ntdll_init_syscalls( ULONG id, SYSTEM_SERVICE_TABLE *table, void **dispatcher );
extern NTSTATUS ntdll_init_syscalls( SYSTEM_SERVICE_TABLE *table, void **dispatcher );
/* exception handling */

View file

@ -1529,8 +1529,11 @@ void output_syscalls( DLLSPEC *spec )
output( "\t.data\n" );
output( "\t.align %d\n", get_alignment( get_ptr_size() ) );
output( "%s\n", asm_globl("__wine_syscall_dispatcher") );
output( "\t%s 0\n", get_asm_ptr_keyword() );
output( "\t.short %u\n", count );
output( "\t%s 0\n", get_asm_ptr_keyword() ); /* dispatcher */
output( "\t.long 0xca110001\n" ); /* version */
output( "\t.short %u\n", spec->syscall_table ); /* id */
output( "\t.short %u\n", count ); /* limit */
for (i = 0; i < count; i++) output( "\t.short %u\n", syscalls[i]->hint );
for (i = 0; i < count; i++) output( "\t.byte %u\n", get_args_size( syscalls[i] ));
}