wine/dlls/wow64win/syscall.c
2022-08-11 16:50:55 +02:00

60 lines
1.6 KiB
C

/*
* WoW64 syscall wrapping
*
* 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 <stdarg.h>
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
#include "winbase.h"
#include "winnt.h"
#include "winternl.h"
#include "wow64win_private.h"
static void * const win32_syscalls[] =
{
#define SYSCALL_ENTRY(func) wow64_ ## func,
ALL_WIN32_SYSCALLS
#undef SYSCALL_ENTRY
};
static const char * const win32_syscall_names[] =
{
#define SYSCALL_ENTRY(func) #func,
ALL_WIN32_SYSCALLS
#undef SYSCALL_ENTRY
};
SYSTEM_SERVICE_TABLE sdwhwin32 =
{
(ULONG_PTR *)win32_syscalls,
(ULONG_PTR *)win32_syscall_names,
ARRAY_SIZE(win32_syscalls),
NULL
};
BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, void *reserved )
{
if (reason != DLL_PROCESS_ATTACH) return TRUE;
LdrDisableThreadCalloutsForDll( inst );
NtCurrentTeb()->Peb->KernelCallbackTable = user_callbacks;
return TRUE;
}