mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-01 14:03:38 +00:00
ntdll: Add a helper function to set a syscall table.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
3513a176fd
commit
d017c704f0
|
@ -114,6 +114,7 @@ void (WINAPI *p__wine_ctrl_routine)(void*);
|
|||
SYSTEM_DLL_INIT_BLOCK *pLdrSystemDllInitBlock = NULL;
|
||||
|
||||
static NTSTATUS (CDECL *p__wine_set_unix_funcs)( int version, const struct unix_funcs *funcs );
|
||||
static void *p__wine_syscall_dispatcher;
|
||||
|
||||
extern SYSTEM_SERVICE_TABLE __wine_syscall_table DECLSPEC_HIDDEN;
|
||||
|
||||
|
@ -825,8 +826,6 @@ static NTSTATUS fixup_ntdll_imports( const char *name, HMODULE module )
|
|||
|
||||
static void load_ntdll_functions( HMODULE module )
|
||||
{
|
||||
void **ptr;
|
||||
|
||||
ntdll_exports = get_module_data_dir( module, IMAGE_FILE_EXPORT_DIRECTORY, NULL );
|
||||
assert( ntdll_exports );
|
||||
|
||||
|
@ -844,16 +843,15 @@ static void load_ntdll_functions( HMODULE module )
|
|||
GET_FUNC( RtlUserThreadStart );
|
||||
GET_FUNC( __wine_ctrl_routine );
|
||||
GET_FUNC( __wine_set_unix_funcs );
|
||||
#undef GET_FUNC
|
||||
#define SET_PTR(name,val) \
|
||||
if ((ptr = (void *)find_named_export( module, ntdll_exports, #name ))) *ptr = val; \
|
||||
else ERR( "%s not found\n", #name )
|
||||
|
||||
SET_PTR( __wine_syscall_dispatcher, __wine_syscall_dispatcher );
|
||||
GET_FUNC( __wine_syscall_dispatcher );
|
||||
#ifdef __i386__
|
||||
SET_PTR( __wine_ldt_copy, &__wine_ldt_copy );
|
||||
{
|
||||
void **p__wine_ldt_copy;
|
||||
GET_FUNC( __wine_ldt_copy );
|
||||
*p__wine_ldt_copy = &__wine_ldt_copy;
|
||||
}
|
||||
#endif
|
||||
#undef SET_PTR
|
||||
#undef GET_FUNC
|
||||
}
|
||||
|
||||
static void load_ntdll_wow64_functions( HMODULE module )
|
||||
|
@ -1145,6 +1143,18 @@ static NTSTATUS CDECL init_unix_lib( void *module, DWORD reason, const void *ptr
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* ntdll_init_syscalls
|
||||
*/
|
||||
NTSTATUS ntdll_init_syscalls( ULONG id, SYSTEM_SERVICE_TABLE *table, void **dispatcher )
|
||||
{
|
||||
if (id > 3) return STATUS_INVALID_PARAMETER;
|
||||
*dispatcher = __wine_syscall_dispatcher;
|
||||
KeServiceDescriptorTable[id] = *table;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* __wine_unix_call
|
||||
*/
|
||||
|
@ -1944,7 +1954,7 @@ static void start_main_thread(void)
|
|||
NtCreateKeyedEvent( &keyed_event, GENERIC_READ | GENERIC_WRITE, NULL, 0 );
|
||||
load_ntdll();
|
||||
if (main_image_info.Machine != current_machine) load_wow64_ntdll( main_image_info.Machine );
|
||||
KeServiceDescriptorTable[0] = __wine_syscall_table;
|
||||
ntdll_init_syscalls( 0, &__wine_syscall_table, p__wine_syscall_dispatcher );
|
||||
status = p__wine_set_unix_funcs( NTDLL_UNIXLIB_VERSION, &unix_funcs );
|
||||
if (status == STATUS_REVISION_MISMATCH)
|
||||
{
|
||||
|
|
|
@ -250,6 +250,7 @@ extern void signal_init_process(void) DECLSPEC_HIDDEN;
|
|||
extern void DECLSPEC_NORETURN signal_start_thread( PRTL_THREAD_START_ROUTINE entry, void *arg,
|
||||
BOOL suspend, TEB *teb ) DECLSPEC_HIDDEN;
|
||||
extern void DECLSPEC_NORETURN signal_exit_thread( int status, void (*func)(int), TEB *teb ) DECLSPEC_HIDDEN;
|
||||
extern SYSTEM_SERVICE_TABLE KeServiceDescriptorTable[4] DECLSPEC_HIDDEN;
|
||||
extern void __wine_syscall_dispatcher(void) DECLSPEC_HIDDEN;
|
||||
extern void WINAPI DECLSPEC_NORETURN __wine_syscall_dispatcher_return( void *frame, ULONG_PTR retval ) DECLSPEC_HIDDEN;
|
||||
extern NTSTATUS signal_set_full_context( CONTEXT *context ) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -26,10 +26,9 @@ typedef UINT64 unixlib_handle_t;
|
|||
|
||||
extern NTSTATUS WINAPI __wine_unix_call( unixlib_handle_t handle, unsigned int code, void *args );
|
||||
|
||||
extern SYSTEM_SERVICE_TABLE KeServiceDescriptorTable[4];
|
||||
|
||||
/* some useful helpers from ntdll */
|
||||
extern DWORD ntdll_umbstowcs( const char *src, DWORD srclen, WCHAR *dst, DWORD dstlen );
|
||||
extern int ntdll_wcstoumbs( const WCHAR *src, DWORD srclen, char *dst, DWORD dstlen, BOOL strict );
|
||||
extern NTSTATUS ntdll_init_syscalls( ULONG id, SYSTEM_SERVICE_TABLE *table, void **dispatcher );
|
||||
|
||||
#endif /* __WINE_WINE_UNIXLIB_H */
|
||||
|
|
Loading…
Reference in a new issue