winepulse: Use GetModuleFileName() instead of hardcoded module filename for registry...
[wine.git] / dlls / win32u / main.c
blob3d6a9c2d038309fe9e0ce0d1037d54b80d58c9aa
1 /*
2 * Win32u kernel interface
4 * Copyright 2021 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <stdarg.h>
23 #include "ntstatus.h"
24 #define WIN32_NO_STATUS
25 #include "windef.h"
26 #include "winbase.h"
27 #include "ntgdi.h"
28 #include "win32u_private.h"
29 #include "wine/unixlib.h"
31 extern void *__wine_syscall_dispatcher DECLSPEC_HIDDEN;
33 static unixlib_handle_t win32u_handle;
35 void __cdecl __wine_spec_unimplemented_stub( const char *module, const char *function )
37 EXCEPTION_RECORD record;
39 record.ExceptionCode = EXCEPTION_WINE_STUB;
40 record.ExceptionFlags = EH_NONCONTINUABLE;
41 record.ExceptionRecord = NULL;
42 record.ExceptionAddress = __wine_spec_unimplemented_stub;
43 record.NumberParameters = 2;
44 record.ExceptionInformation[0] = (ULONG_PTR)module;
45 record.ExceptionInformation[1] = (ULONG_PTR)function;
46 for (;;) RtlRaiseException( &record );
49 BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, void *reserved )
51 switch (reason)
53 case DLL_PROCESS_ATTACH:
54 LdrDisableThreadCalloutsForDll( inst );
55 if (__wine_syscall_dispatcher) break; /* already set through Wow64Transition */
56 if (!NtQueryVirtualMemory( GetCurrentProcess(), inst, MemoryWineUnixFuncs,
57 &win32u_handle, sizeof(win32u_handle), NULL ))
59 __wine_unix_call( win32u_handle, 0, &__wine_syscall_dispatcher );
60 wrappers_init( win32u_handle );
62 break;
64 return TRUE;