wine/dlls/wow64win/syscall.c

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(id,name,args) wow64_ ## name,
ALL_SYSCALLS32
#undef SYSCALL_ENTRY
};
static BYTE arguments[ARRAY_SIZE(win32_syscalls)] =
{
#define SYSCALL_ENTRY(id,name,args) args,
ALL_SYSCALLS32
#undef SYSCALL_ENTRY
};
const SYSTEM_SERVICE_TABLE sdwhwin32 =
{
(ULONG_PTR *)win32_syscalls,
NULL,
ARRAY_SIZE(win32_syscalls),
arguments
};
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;
}