Module: wine Branch: master Commit: 127650c293b5716c6a1f2028185c3f3fe8c6598c URL: https://gitlab.winehq.org/wine/wine/-/commit/127650c293b5716c6a1f2028185c3f3...
Author: Alexandre Julliard julliard@winehq.org Date: Thu May 23 11:54:55 2024 +0200
ntdll: Make __wine_unix_call() an inline function.
---
dlls/ntdll/loader.c | 11 +---------- dlls/ntdll/ntdll.spec | 1 - dlls/win32u/main.c | 8 +++----- include/wine/unixlib.h | 8 ++++++-- 4 files changed, 10 insertions(+), 18 deletions(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 6e3f67ef593..31bfe60d121 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -70,7 +70,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; +NTSTATUS (WINAPI *__wine_unix_call_dispatcher)( unixlib_handle_t, unsigned int, void * ) = NULL;
static DWORD (WINAPI *pCtrlRoutine)(void *);
@@ -3314,15 +3314,6 @@ NTSTATUS WINAPI __wine_ctrl_routine( void *arg ) }
-/*********************************************************************** - * __wine_unix_call - */ -NTSTATUS WINAPI __wine_unix_call( unixlib_handle_t handle, unsigned int code, void *args ) -{ - return __wine_unix_call_dispatcher( handle, code, args ); -} - - /*********************************************************************** * __wine_unix_spawnvp */ diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index 13043130cf6..d32c95c49ad 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -1719,7 +1719,6 @@ @ cdecl wine_server_handle_to_fd(long long ptr ptr)
# Unix interface -@ stdcall __wine_unix_call(int64 long ptr) @ stdcall __wine_unix_spawnvp(long ptr) @ stdcall __wine_ctrl_routine(ptr) @ extern -private __wine_syscall_dispatcher diff --git a/dlls/win32u/main.c b/dlls/win32u/main.c index 28383161b6f..8e32fc63556 100644 --- a/dlls/win32u/main.c +++ b/dlls/win32u/main.c @@ -33,8 +33,6 @@
void *__wine_syscall_dispatcher = NULL;
-static unixlib_handle_t win32u_handle; - /******************************************************************* * syscalls */ @@ -2192,6 +2190,8 @@ void __cdecl __wine_spec_unimplemented_stub( const char *module, const char *fun for (;;) RtlRaiseException( &record ); }
+void *dummy = NtQueryVirtualMemory; /* forced import to avoid link error with winecrt0 */ + BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, void *reserved ) { HMODULE ntdll; @@ -2206,9 +2206,7 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, void *reserved ) LdrGetDllHandle( NULL, 0, &ntdll_name, &ntdll ); dispatcher_ptr = RtlFindExportedRoutineByName( ntdll, "__wine_syscall_dispatcher" ); __wine_syscall_dispatcher = *dispatcher_ptr; - if (!NtQueryVirtualMemory( GetCurrentProcess(), inst, MemoryWineUnixFuncs, - &win32u_handle, sizeof(win32u_handle), NULL )) - __wine_unix_call( win32u_handle, 0, NULL ); + if (!__wine_init_unix_call()) WINE_UNIX_CALL( 0, NULL ); break; } return TRUE; diff --git a/include/wine/unixlib.h b/include/wine/unixlib.h index 95ff406d968..17ec93110f2 100644 --- a/include/wine/unixlib.h +++ b/include/wine/unixlib.h @@ -258,12 +258,16 @@ static inline ULONG ntdll_wcstoul( const WCHAR *s, WCHAR **end, int base )
#else /* WINE_UNIX_LIB */
-NTSYSAPI NTSTATUS WINAPI __wine_unix_call( unixlib_handle_t handle, unsigned int code, void *args ); extern unixlib_handle_t __wine_unixlib_handle; extern NTSTATUS (WINAPI *__wine_unix_call_dispatcher)( unixlib_handle_t, unsigned int, void * ); extern NTSTATUS WINAPI __wine_init_unix_call(void);
-#define WINE_UNIX_CALL(code,args) __wine_unix_call_dispatcher( __wine_unixlib_handle, (code), (args) ) +static inline NTSTATUS __wine_unix_call( unixlib_handle_t handle, unsigned int code, void *args ) +{ + return __wine_unix_call_dispatcher( handle, code, args ); +} + +#define WINE_UNIX_CALL(code,args) __wine_unix_call( __wine_unixlib_handle, (code), (args) )
#endif /* WINE_UNIX_LIB */