Alexandre Julliard : ntdll: Declare the syscall functions array explicitly.
Alexandre Julliard
julliard at winehq.org
Mon Aug 30 15:53:52 CDT 2021
Module: wine
Branch: master
Commit: ea6308e364b669adfcb8b1e448c8b08d715bcf6d
URL: https://source.winehq.org/git/wine.git/?a=commit;h=ea6308e364b669adfcb8b1e448c8b08d715bcf6d
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Aug 30 12:38:31 2021 +0200
ntdll: Declare the syscall functions array explicitly.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/unix/loader.c | 244 ++++++++++++++++++++++++++++++++++++++++++++++-
include/winternl.h | 1 +
tools/winebuild/import.c | 14 +--
3 files changed, 242 insertions(+), 17 deletions(-)
diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c
index 266d53f0eca..b15824346b7 100644
--- a/dlls/ntdll/unix/loader.c
+++ b/dlls/ntdll/unix/loader.c
@@ -116,13 +116,248 @@ SYSTEM_DLL_INIT_BLOCK *pLdrSystemDllInitBlock = NULL;
static NTSTATUS (CDECL *p__wine_set_unix_funcs)( int version, const struct unix_funcs *funcs );
static void *p__wine_syscall_dispatcher;
-extern SYSTEM_SERVICE_TABLE __wine_syscall_table DECLSPEC_HIDDEN;
+static void * const syscalls[] =
+{
+ NtAcceptConnectPort,
+ NtAccessCheck,
+ NtAccessCheckAndAuditAlarm,
+ NtAddAtom,
+ NtAdjustGroupsToken,
+ NtAdjustPrivilegesToken,
+ NtAlertResumeThread,
+ NtAlertThread,
+ NtAllocateLocallyUniqueId,
+ NtAllocateUuids,
+ NtAllocateVirtualMemory,
+ NtAllocateVirtualMemoryEx,
+ NtAreMappedFilesTheSame,
+ NtAssignProcessToJobObject,
+ NtCallbackReturn,
+ NtCancelIoFile,
+ NtCancelIoFileEx,
+ NtCancelTimer,
+ NtClearEvent,
+ NtClearPowerRequest,
+ NtClose,
+ NtCompleteConnectPort,
+ NtConnectPort,
+ NtContinue,
+ NtCreateDebugObject,
+ NtCreateDirectoryObject,
+ NtCreateEvent,
+ NtCreateFile,
+ NtCreateIoCompletion,
+ NtCreateJobObject,
+ NtCreateKey,
+ NtCreateKeyTransacted,
+ NtCreateKeyedEvent,
+ NtCreateLowBoxToken,
+ NtCreateMailslotFile,
+ NtCreateMutant,
+ NtCreateNamedPipeFile,
+ NtCreatePagingFile,
+ NtCreatePort,
+ NtCreatePowerRequest,
+ NtCreateSection,
+ NtCreateSemaphore,
+ NtCreateSymbolicLinkObject,
+ NtCreateThread,
+ NtCreateThreadEx,
+ NtCreateTimer,
+ NtCreateUserProcess,
+ NtDebugActiveProcess,
+ NtDebugContinue,
+ NtDelayExecution,
+ NtDeleteAtom,
+ NtDeleteFile,
+ NtDeleteKey,
+ NtDeleteValueKey,
+ NtDeviceIoControlFile,
+ NtDisplayString,
+ NtDuplicateObject,
+ NtDuplicateToken,
+ NtEnumerateKey,
+ NtEnumerateValueKey,
+ NtFilterToken,
+ NtFindAtom,
+ NtFlushBuffersFile,
+ NtFlushInstructionCache,
+ NtFlushKey,
+ NtFlushProcessWriteBuffers,
+ NtFlushVirtualMemory,
+ NtFreeVirtualMemory,
+ NtFsControlFile,
+ NtGetContextThread,
+ NtGetCurrentProcessorNumber,
+ NtGetNextThread,
+ NtGetNlsSectionPtr,
+ NtGetWriteWatch,
+ NtImpersonateAnonymousToken,
+ NtInitiatePowerAction ,
+ NtIsProcessInJob,
+ NtListenPort,
+ NtLoadDriver,
+ NtLoadKey,
+ NtLoadKey2,
+ NtLockFile,
+ NtLockVirtualMemory,
+ NtMakeTemporaryObject,
+ NtMapViewOfSection,
+ NtNotifyChangeDirectoryFile,
+ NtNotifyChangeKey,
+ NtNotifyChangeMultipleKeys,
+ NtOpenDirectoryObject,
+ NtOpenEvent,
+ NtOpenFile,
+ NtOpenIoCompletion,
+ NtOpenJobObject,
+ NtOpenKey,
+ NtOpenKeyEx,
+ NtOpenKeyTransacted,
+ NtOpenKeyTransactedEx,
+ NtOpenKeyedEvent,
+ NtOpenMutant,
+ NtOpenProcess,
+ NtOpenProcessToken,
+ NtOpenProcessTokenEx,
+ NtOpenSection,
+ NtOpenSemaphore,
+ NtOpenSymbolicLinkObject ,
+ NtOpenThread,
+ NtOpenThreadToken,
+ NtOpenThreadTokenEx,
+ NtOpenTimer,
+ NtPowerInformation,
+ NtPrivilegeCheck,
+ NtProtectVirtualMemory,
+ NtPulseEvent,
+ NtQueryAttributesFile,
+ NtQueryDefaultLocale,
+ NtQueryDefaultUILanguage,
+ NtQueryDirectoryFile,
+ NtQueryDirectoryObject,
+ NtQueryEaFile,
+ NtQueryEvent,
+ NtQueryFullAttributesFile,
+ NtQueryInformationAtom,
+ NtQueryInformationFile,
+ NtQueryInformationJobObject,
+ NtQueryInformationProcess,
+ NtQueryInformationThread,
+ NtQueryInformationToken,
+ NtQueryInstallUILanguage,
+ NtQueryIoCompletion,
+ NtQueryKey,
+ NtQueryLicenseValue,
+ NtQueryMultipleValueKey,
+ NtQueryMutant,
+ NtQueryObject,
+ NtQueryPerformanceCounter,
+ NtQuerySection,
+ NtQuerySecurityObject,
+ NtQuerySemaphore ,
+ NtQuerySymbolicLinkObject,
+ NtQuerySystemEnvironmentValue,
+ NtQuerySystemEnvironmentValueEx,
+ NtQuerySystemInformation,
+ NtQuerySystemInformationEx,
+ NtQuerySystemTime,
+ NtQueryTimer,
+ NtQueryTimerResolution,
+ NtQueryValueKey,
+ NtQueryVirtualMemory,
+ NtQueryVolumeInformationFile,
+ NtQueueApcThread,
+ NtRaiseException,
+ NtRaiseHardError,
+ NtReadFile,
+ NtReadFileScatter,
+ NtReadVirtualMemory,
+ NtRegisterThreadTerminatePort,
+ NtReleaseKeyedEvent,
+ NtReleaseMutant,
+ NtReleaseSemaphore,
+ NtRemoveIoCompletion,
+ NtRemoveIoCompletionEx,
+ NtRemoveProcessDebug,
+ NtRenameKey,
+ NtReplaceKey,
+ NtReplyWaitReceivePort,
+ NtRequestWaitReplyPort,
+ NtResetEvent,
+ NtResetWriteWatch,
+ NtRestoreKey,
+ NtResumeProcess,
+ NtResumeThread,
+ NtSaveKey,
+ NtSecureConnectPort,
+ NtSetContextThread,
+ NtSetDefaultLocale,
+ NtSetDefaultUILanguage,
+ NtSetEaFile,
+ NtSetEvent,
+ NtSetInformationDebugObject,
+ NtSetInformationFile,
+ NtSetInformationJobObject,
+ NtSetInformationKey,
+ NtSetInformationObject,
+ NtSetInformationProcess,
+ NtSetInformationThread,
+ NtSetInformationToken,
+ NtSetIntervalProfile,
+ NtSetIoCompletion,
+ NtSetLdtEntries,
+ NtSetPowerRequest,
+ NtSetSecurityObject,
+ NtSetSystemInformation,
+ NtSetSystemTime,
+ NtSetThreadExecutionState,
+ NtSetTimer,
+ NtSetTimerResolution,
+ NtSetValueKey,
+ NtSetVolumeInformationFile,
+ NtShutdownSystem,
+ NtSignalAndWaitForSingleObject,
+ NtSuspendProcess,
+ NtSuspendThread,
+ NtSystemDebugControl,
+ NtTerminateJobObject,
+ NtTerminateProcess,
+ NtTerminateThread,
+ NtTestAlert,
+ NtTraceControl,
+ NtUnloadDriver,
+ NtUnloadKey,
+ NtUnlockFile,
+ NtUnlockVirtualMemory,
+ NtUnmapViewOfSection,
+ NtWaitForDebugEvent,
+ NtWaitForKeyedEvent,
+ NtWaitForMultipleObjects,
+ NtWaitForSingleObject,
+#ifndef _WIN64
+ NtWow64AllocateVirtualMemory64,
+ NtWow64GetNativeSystemInformation,
+ NtWow64ReadVirtualMemory64,
+ NtWow64WriteVirtualMemory64,
+#endif
+ NtWriteFile,
+ NtWriteFileGather,
+ NtWriteVirtualMemory,
+ NtYieldExecution,
+ __wine_dbg_write,
+ __wine_unix_call,
+ wine_nt_to_unix_file_name,
+ wine_server_call,
+ wine_server_fd_to_handle,
+ wine_server_handle_to_fd,
+ wine_unix_to_nt_file_name,
+};
-static BYTE syscall_args[4096];
+static BYTE syscall_args[ARRAY_SIZE(syscalls)];
SYSTEM_SERVICE_TABLE KeServiceDescriptorTable[4];
-
#ifdef __GNUC__
static void fatal_error( const char *err, ... ) __attribute__((noreturn, format(printf,1,2)));
#endif
@@ -1947,7 +2182,7 @@ static struct unix_funcs unix_funcs =
*/
static void start_main_thread(void)
{
- SYSTEM_SERVICE_TABLE syscall_table = __wine_syscall_table;
+ SYSTEM_SERVICE_TABLE syscall_table = { (ULONG_PTR *)syscalls, NULL, ARRAY_SIZE(syscalls), syscall_args };
NTSTATUS status;
TEB *teb = virtual_alloc_first_teb();
@@ -1970,7 +2205,6 @@ static void start_main_thread(void)
NtCreateKeyedEvent( &keyed_event, GENERIC_READ | GENERIC_WRITE, NULL, 0 );
load_ntdll();
if (main_image_info.Machine != current_machine) load_wow64_ntdll( main_image_info.Machine );
- syscall_table.ArgumentTable = syscall_args;
ntdll_init_syscalls( 0, &syscall_table, p__wine_syscall_dispatcher );
status = p__wine_set_unix_funcs( NTDLL_UNIXLIB_VERSION, &unix_funcs );
if (status == STATUS_REVISION_MISMATCH)
diff --git a/include/winternl.h b/include/winternl.h
index ec2c95e99bc..fea9e9df117 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -3847,6 +3847,7 @@ NTSYSAPI NTSTATUS WINAPI NtCreateJobObject(PHANDLE,ACCESS_MASK,const OBJECT_ATT
NTSYSAPI NTSTATUS WINAPI NtCreateKey(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*,ULONG,const UNICODE_STRING*,ULONG,PULONG);
NTSYSAPI NTSTATUS WINAPI NtCreateKeyTransacted(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*,ULONG,const UNICODE_STRING*,ULONG,HANDLE,ULONG*);
NTSYSAPI NTSTATUS WINAPI NtCreateKeyedEvent(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*,ULONG);
+NTSYSAPI NTSTATUS WINAPI NtCreateLowBoxToken(HANDLE*,HANDLE,ACCESS_MASK,OBJECT_ATTRIBUTES*,SID*,ULONG,SID_AND_ATTRIBUTES*,ULONG,HANDLE*);
NTSYSAPI NTSTATUS WINAPI NtCreateMailslotFile(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES,PIO_STATUS_BLOCK,ULONG,ULONG,ULONG,PLARGE_INTEGER);
NTSYSAPI NTSTATUS WINAPI NtCreateMutant(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*,BOOLEAN);
NTSYSAPI NTSTATUS WINAPI NtCreateNamedPipeFile(PHANDLE,ULONG,POBJECT_ATTRIBUTES,PIO_STATUS_BLOCK,ULONG,ULONG,ULONG,ULONG,ULONG,ULONG,ULONG,ULONG,ULONG,PLARGE_INTEGER);
diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c
index d9d6fcae0c6..fcd27117780 100644
--- a/tools/winebuild/import.c
+++ b/tools/winebuild/import.c
@@ -1426,6 +1426,8 @@ void output_syscalls( DLLSPEC *spec )
int i, count;
ORDDEF **syscalls = NULL;
+ if (unix_lib) return;
+
for (i = count = 0; i < spec->nb_entry_points; i++)
{
ORDDEF *odp = &spec->entry_points[i];
@@ -1439,18 +1441,6 @@ void output_syscalls( DLLSPEC *spec )
output( "\n/* system calls */\n\n" );
output( "\t.text\n" );
- if (unix_lib)
- {
- output( "\t.data\n" );
- output( "\t.align %d\n", get_alignment( get_ptr_size() ) );
- output( "%s\n", asm_globl("__wine_syscall_table") );
- output( "\t%s .Lsyscall_table, 0, %u, 0\n", get_asm_ptr_keyword(), count );
- output( ".Lsyscall_table:\n" );
- for (i = 0; i < count; i++)
- output( "\t%s %s\n", get_asm_ptr_keyword(), asm_name( get_link_name( syscalls[i] )));
- return;
- }
-
for (i = 0; i < count; i++)
{
ORDDEF *odp = syscalls[i];
More information about the wine-cvs
mailing list