ntdll: Export the Unix call dispatcher function pointer.

This commit is contained in:
Alexandre Julliard 2022-11-30 17:02:54 +01:00
parent 0f67dbb50e
commit 90adeb125f
5 changed files with 10 additions and 8 deletions

View file

@ -71,6 +71,7 @@ typedef DWORD (CALLBACK *DLLENTRYPROC)(HMODULE,DWORD,LPVOID);
typedef void (CALLBACK *LDRENUMPROC)(LDR_DATA_TABLE_ENTRY *, void *, BOOLEAN *);
void (FASTCALL *pBaseThreadInitThunk)(DWORD,LPTHREAD_START_ROUTINE,void *) = NULL;
NTSTATUS (WINAPI *__wine_unix_call_dispatcher)( unixlib_handle_t, unsigned int, void * ) = __wine_unix_call;
static DWORD (WINAPI *pCtrlRoutine)(void *);

View file

@ -1693,7 +1693,8 @@
@ stdcall -syscall __wine_unix_call(int64 long ptr)
@ stdcall -syscall __wine_unix_spawnvp(long ptr)
@ stdcall __wine_ctrl_routine(ptr)
@ extern __wine_syscall_dispatcher
@ extern -private __wine_syscall_dispatcher
@ extern -private __wine_unix_call_dispatcher
@ extern -arch=arm64 __wine_current_teb
# Debugging

View file

@ -44,17 +44,17 @@ static NTSTATUS WINAPI unix_call_fallback( unixlib_handle_t handle, unsigned int
}
unixlib_handle_t __wine_unixlib_handle = 0;
NTSTATUS (WINAPI *__wine_unix_call_ptr)( unixlib_handle_t, unsigned int, void * ) = unix_call_fallback;
NTSTATUS (WINAPI *__wine_unix_call_dispatcher)( unixlib_handle_t, unsigned int, void * ) = unix_call_fallback;
NTSTATUS WINAPI __wine_init_unix_call(void)
{
NTSTATUS status;
HMODULE module = GetModuleHandleW( L"ntdll.dll" );
void *proc = GetProcAddress( module, "__wine_unix_call" );
void **p__wine_unix_call_dispatcher = (void **)GetProcAddress( module, "__wine_unix_call_dispatcher" );
if (!proc) return STATUS_DLL_NOT_FOUND;
if (!p__wine_unix_call_dispatcher) return STATUS_DLL_NOT_FOUND;
status = NtQueryVirtualMemory( GetCurrentProcess(), image_base(), MemoryWineUnixFuncs,
&__wine_unixlib_handle, sizeof(__wine_unixlib_handle), NULL );
if (!status) __wine_unix_call_ptr = proc;
if (!status) __wine_unix_call_dispatcher = *p__wine_unix_call_dispatcher;
return status;
}

View file

@ -236,7 +236,7 @@ static BOOL WINAPI wine_vk_init(INIT_ONCE *once, void *param, void **context)
{
NTSTATUS status = __wine_init_unix_call();
p_vk_direct_unix_call = __wine_unix_call_ptr;
p_vk_direct_unix_call = __wine_unix_call_dispatcher;
if (status) return FALSE;
return !vk_unix_call(unix_init, &p_vk_direct_unix_call);
}

View file

@ -268,10 +268,10 @@ static inline ULONG ntdll_wcstoul( const WCHAR *s, WCHAR **end, int base )
#else /* WINE_UNIX_LIB */
extern unixlib_handle_t __wine_unixlib_handle DECLSPEC_HIDDEN;
extern NTSTATUS (WINAPI *__wine_unix_call_ptr)( unixlib_handle_t, unsigned int, void * ) DECLSPEC_HIDDEN;
extern NTSTATUS (WINAPI *__wine_unix_call_dispatcher)( unixlib_handle_t, unsigned int, void * ) DECLSPEC_HIDDEN;
extern NTSTATUS WINAPI __wine_init_unix_call(void) DECLSPEC_HIDDEN;
#define WINE_UNIX_CALL(code,args) __wine_unix_call_ptr( __wine_unixlib_handle, (code), (args) )
#define WINE_UNIX_CALL(code,args) __wine_unix_call_dispatcher( __wine_unixlib_handle, (code), (args) )
#endif /* WINE_UNIX_LIB */