Module: wine Branch: master Commit: f799f6f47172e5feed9e1541979e6515a0e5d0b9 URL: https://gitlab.winehq.org/wine/wine/-/commit/f799f6f47172e5feed9e1541979e651...
Author: Alexandre Julliard julliard@winehq.org Date: Fri Nov 17 09:56:37 2023 +0100
win32u: Set the syscall dispatcher on the PE side.
---
dlls/win32u/main.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/dlls/win32u/main.c b/dlls/win32u/main.c index d2cd039b701..fa75ad4f5c5 100644 --- a/dlls/win32u/main.c +++ b/dlls/win32u/main.c @@ -47,11 +47,18 @@ void __cdecl __wine_spec_unimplemented_stub( const char *module, const char *fun
BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, void *reserved ) { + HMODULE ntdll; + void **dispatcher_ptr; + const UNICODE_STRING ntdll_name = RTL_CONSTANT_STRING( L"ntdll.dll" ); + switch (reason) { case DLL_PROCESS_ATTACH: LdrDisableThreadCalloutsForDll( inst ); if (__wine_syscall_dispatcher) break; /* already set through Wow64Transition */ + 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, &__wine_syscall_dispatcher );