/* * Win32u kernel interface * * Copyright 2021 Alexandre Julliard * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #include #include "ntstatus.h" #define WIN32_NO_STATUS #include "windef.h" #include "winbase.h" #include "winnt.h" #include "winternl.h" #include "wine/exception.h" #include "wine/unixlib.h" extern void *__wine_syscall_dispatcher DECLSPEC_HIDDEN; static unixlib_handle_t win32u_handle; void __cdecl __wine_spec_unimplemented_stub( const char *module, const char *function ) { EXCEPTION_RECORD record; record.ExceptionCode = EXCEPTION_WINE_STUB; record.ExceptionFlags = EH_NONCONTINUABLE; record.ExceptionRecord = NULL; record.ExceptionAddress = __wine_spec_unimplemented_stub; record.NumberParameters = 2; record.ExceptionInformation[0] = (ULONG_PTR)module; record.ExceptionInformation[1] = (ULONG_PTR)function; for (;;) RtlRaiseException( &record ); } BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, void *reserved ) { switch (reason) { case DLL_PROCESS_ATTACH: LdrDisableThreadCalloutsForDll( inst ); if (__wine_syscall_dispatcher) break; /* already set through Wow64Transition */ if (!NtQueryVirtualMemory( GetCurrentProcess(), inst, MemoryWineUnixFuncs, &win32u_handle, sizeof(win32u_handle), NULL )) { __wine_unix_call( win32u_handle, 0, &__wine_syscall_dispatcher ); } break; } return TRUE; }