win32u: Build the syscall argument array from the generated syscall list.
[wine.git] / dlls / win32u / syscall.c
blobb741df91c66aad52286d79e46d659de13fed1d36
1 /*
2 * Unix interface for Win32 syscalls
4 * Copyright (C) 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 #if 0
22 #pragma makedep unix
23 #endif
25 #include <stdarg.h>
27 #include "ntstatus.h"
28 #define WIN32_NO_STATUS
29 #include "windef.h"
30 #include "winnt.h"
31 #include "ntgdi_private.h"
32 #include "ntuser_private.h"
33 #include "ntuser.h"
34 #include "wine/unixlib.h"
35 #include "win32syscalls.h"
37 ULONG_PTR zero_bits = 0;
39 static void * const syscalls[] =
41 #define SYSCALL_ENTRY(id,name,args) name,
42 #ifdef _WIN64
43 ALL_SYSCALLS64
44 #else
45 ALL_SYSCALLS32
46 #endif
47 #undef SYSCALL_ENTRY
50 static BYTE arguments[ARRAY_SIZE(syscalls)] =
52 #define SYSCALL_ENTRY(id,name,args) args,
53 #ifdef _WIN64
54 ALL_SYSCALLS64
55 #else
56 ALL_SYSCALLS32
57 #endif
58 #undef SYSCALL_ENTRY
61 static SYSTEM_SERVICE_TABLE syscall_table =
63 (ULONG_PTR *)syscalls,
65 ARRAY_SIZE(syscalls),
66 arguments
69 static NTSTATUS init( void *dispatcher )
71 #ifdef _WIN64
72 if (NtCurrentTeb()->WowTebOffset)
74 SYSTEM_BASIC_INFORMATION info;
76 NtQuerySystemInformation(SystemEmulationBasicInformation, &info, sizeof(info), NULL);
77 zero_bits = (ULONG_PTR)info.HighestUserAddress | 0x7fffffff;
79 #endif
81 return ntdll_init_syscalls( &syscall_table, dispatcher );
84 const unixlib_entry_t __wine_unix_call_funcs[] =
86 init,