Module: wine Branch: master Commit: d10410eac2b598699a3619d6e3f908e256af3afb URL: https://source.winehq.org/git/wine.git/?a=commit;h=d10410eac2b598699a3619d6e...
Author: Alexandre Julliard julliard@winehq.org Date: Thu Dec 2 09:59:40 2021 +0100
ntdll: Add fallback implementations for the Unix library functions.
Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/ntdll/loader.c | 40 ++++++++++++++++++++++++++++++++++++++-- dlls/ntdll/unix/loader.c | 8 ++++---- dlls/ntdll/unixlib.h | 15 ++++++--------- 3 files changed, 48 insertions(+), 15 deletions(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 665c4480ad4..c33acd71759 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -76,8 +76,6 @@ static DWORD (WINAPI *pCtrlRoutine)(void *);
SYSTEM_DLL_INIT_BLOCK LdrSystemDllInitBlock = { 0xf0 };
-const struct unix_funcs *unix_funcs = NULL; - /* windows directory */ const WCHAR windows_dir[] = L"C:\windows"; /* system directory with trailing backslash */ @@ -4443,6 +4441,44 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved ) }
+static NTSTATUS CDECL load_so_dll_fallback( UNICODE_STRING *nt_name, void **module ) +{ + return STATUS_INVALID_IMAGE_FORMAT; +} + +static void CDECL init_builtin_dll_fallback( void *module ) +{ +} + +static NTSTATUS CDECL init_unix_lib_fallback( void *module, DWORD reason, const void *ptr_in, void *ptr_out ) +{ + return STATUS_DLL_NOT_FOUND; +} + +static NTSTATUS CDECL unwind_builtin_dll_fallback( ULONG type, struct _DISPATCHER_CONTEXT *dispatch, + CONTEXT *context ) +{ + return STATUS_UNSUCCESSFUL; +} + +static LONGLONG WINAPI RtlGetSystemTimePrecise_fallback(void) +{ + LARGE_INTEGER now; + NtQuerySystemTime( &now ); + return now.QuadPart; +} + +static const struct unix_funcs unix_fallbacks = +{ + load_so_dll_fallback, + init_builtin_dll_fallback, + init_unix_lib_fallback, + unwind_builtin_dll_fallback, + RtlGetSystemTimePrecise_fallback, +}; + +const struct unix_funcs *unix_funcs = &unix_fallbacks; + /*********************************************************************** * __wine_set_unix_funcs */ diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 61041061b32..82d099de3be 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -2156,14 +2156,14 @@ static ULONG_PTR get_image_address(void) */ static struct unix_funcs unix_funcs = { -#ifdef __aarch64__ - NtCurrentTeb, -#endif - RtlGetSystemTimePrecise, load_so_dll, init_builtin_dll, init_unix_lib, unwind_builtin_dll, + RtlGetSystemTimePrecise, +#ifdef __aarch64__ + NtCurrentTeb, +#endif };
diff --git a/dlls/ntdll/unixlib.h b/dlls/ntdll/unixlib.h index 803b6a082bb..d60f8cc50e4 100644 --- a/dlls/ntdll/unixlib.h +++ b/dlls/ntdll/unixlib.h @@ -26,24 +26,21 @@ struct _DISPATCHER_CONTEXT;
/* increment this when you change the function table */ -#define NTDLL_UNIXLIB_VERSION 132 +#define NTDLL_UNIXLIB_VERSION 133
struct unix_funcs { - /* Nt* functions */ -#ifdef __aarch64__ - TEB * (WINAPI *NtCurrentTeb)(void); -#endif - - /* other Win32 API functions */ - LONGLONG (WINAPI *RtlGetSystemTimePrecise)(void); - /* loader functions */ NTSTATUS (CDECL *load_so_dll)( UNICODE_STRING *nt_name, void **module ); void (CDECL *init_builtin_dll)( void *module ); NTSTATUS (CDECL *init_unix_lib)( void *module, DWORD reason, const void *ptr_in, void *ptr_out ); NTSTATUS (CDECL *unwind_builtin_dll)( ULONG type, struct _DISPATCHER_CONTEXT *dispatch, CONTEXT *context ); + /* other Win32 API functions */ + LONGLONG (WINAPI *RtlGetSystemTimePrecise)(void); +#ifdef __aarch64__ + TEB * (WINAPI *NtCurrentTeb)(void); +#endif };
#endif /* __NTDLL_UNIXLIB_H */