ntdll: Use syscall thunks for process functions.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2020-07-16 10:36:17 +02:00
parent 00e7d50f8b
commit 635e914bde
4 changed files with 19 additions and 183 deletions

View File

@ -186,7 +186,7 @@
@ stdcall -syscall NtCreateThreadEx(ptr long ptr long ptr ptr long long long long ptr)
@ stdcall -syscall NtCreateTimer(ptr long ptr long)
@ stub NtCreateToken
@ stdcall NtCreateUserProcess(ptr ptr long long ptr ptr long long ptr ptr ptr)
@ stdcall -syscall NtCreateUserProcess(ptr ptr long long ptr ptr long long ptr ptr ptr)
# @ stub NtCreateWaitablePort
@ stdcall -arch=win32,arm64 NtCurrentTeb()
# @ stub NtDebugActiveProcess
@ -211,9 +211,9 @@
# @ stub NtFilterToken
@ stdcall NtFindAtom(ptr long ptr)
@ stdcall NtFlushBuffersFile(long ptr)
@ stdcall NtFlushInstructionCache(long ptr long)
@ stdcall -syscall NtFlushInstructionCache(long ptr long)
@ stdcall NtFlushKey(long)
@ stdcall NtFlushProcessWriteBuffers()
@ stdcall -syscall NtFlushProcessWriteBuffers()
@ stdcall NtFlushVirtualMemory(long ptr ptr long)
@ stub NtFlushWriteBuffer
# @ stub NtFreeUserPhysicalPages
@ -263,7 +263,7 @@
@ stdcall -syscall NtOpenKeyedEvent(ptr long ptr)
@ stdcall -syscall NtOpenMutant(ptr long ptr)
@ stub NtOpenObjectAuditAlarm
@ stdcall NtOpenProcess(ptr long ptr ptr)
@ stdcall -syscall NtOpenProcess(ptr long ptr ptr)
@ stdcall NtOpenProcessToken(long long ptr)
@ stdcall NtOpenProcessTokenEx(long long long ptr)
@ stdcall NtOpenSection(ptr long ptr)
@ -295,7 +295,7 @@
@ stdcall NtQueryInformationFile(long ptr ptr long long)
@ stdcall -syscall NtQueryInformationJobObject(long long ptr long ptr)
@ stub NtQueryInformationPort
@ stdcall NtQueryInformationProcess(long long ptr long ptr)
@ stdcall -syscall NtQueryInformationProcess(long long ptr long ptr)
@ stdcall -syscall NtQueryInformationThread(long long ptr long ptr)
@ stdcall NtQueryInformationToken(long long ptr long ptr)
@ stdcall NtQueryInstallUILanguage(ptr)
@ -353,7 +353,7 @@
@ stdcall -syscall NtResetEvent(long ptr)
@ stdcall NtResetWriteWatch(long ptr long)
@ stdcall NtRestoreKey(long long long)
@ stdcall NtResumeProcess(long)
@ stdcall -syscall NtResumeProcess(long)
@ stdcall -syscall NtResumeThread(long ptr)
@ stdcall NtSaveKey(long long)
# @ stub NtSaveKeyEx
@ -377,7 +377,7 @@
@ stdcall -syscall NtSetInformationJobObject(long long ptr long)
@ stdcall NtSetInformationKey(long long ptr long)
@ stdcall NtSetInformationObject(long long ptr long)
@ stdcall NtSetInformationProcess(long long ptr long)
@ stdcall -syscall NtSetInformationProcess(long long ptr long)
@ stdcall -syscall NtSetInformationThread(long long ptr long)
@ stdcall NtSetInformationToken(long long ptr long)
@ stdcall NtSetIntervalProfile(long long)
@ -404,11 +404,11 @@
@ stdcall -syscall NtSignalAndWaitForSingleObject(long long long ptr)
@ stub NtStartProfile
@ stub NtStopProfile
@ stdcall NtSuspendProcess(long)
@ stdcall -syscall NtSuspendProcess(long)
@ stdcall -syscall NtSuspendThread(long ptr)
@ stdcall NtSystemDebugControl(long ptr long ptr long ptr)
@ stdcall -syscall NtTerminateJobObject(long long)
@ stdcall NtTerminateProcess(long long)
@ stdcall -syscall NtTerminateProcess(long long)
@ stdcall -syscall NtTerminateThread(long long)
@ stub NtTestAlert
# @ stub NtTraceEvent
@ -1174,6 +1174,7 @@
@ stdcall -private -syscall ZwCreateThreadEx(ptr long ptr long ptr ptr long long long long ptr) NtCreateThreadEx
@ stdcall -private -syscall ZwCreateTimer(ptr long ptr long) NtCreateTimer
@ stub ZwCreateToken
@ stdcall -private -syscall ZwCreateUserProcess(ptr ptr long long ptr ptr long long ptr ptr ptr) NtCreateUserProcess
# @ stub ZwCreateWaitablePort
# @ stub ZwDebugActiveProcess
# @ stub ZwDebugContinue
@ -1197,8 +1198,9 @@
# @ stub ZwFilterToken
@ stdcall -private ZwFindAtom(ptr long ptr) NtFindAtom
@ stdcall -private ZwFlushBuffersFile(long ptr) NtFlushBuffersFile
@ stdcall -private ZwFlushInstructionCache(long ptr long) NtFlushInstructionCache
@ stdcall -private -syscall ZwFlushInstructionCache(long ptr long) NtFlushInstructionCache
@ stdcall -private ZwFlushKey(long) NtFlushKey
@ stdcall -private -syscall ZwFlushProcessWriteBuffers() NtFlushProcessWriteBuffers
@ stdcall -private ZwFlushVirtualMemory(long ptr ptr long) NtFlushVirtualMemory
@ stub ZwFlushWriteBuffer
# @ stub ZwFreeUserPhysicalPages
@ -1248,7 +1250,7 @@
@ stdcall -private -syscall ZwOpenKeyedEvent(ptr long ptr) NtOpenKeyedEvent
@ stdcall -private -syscall ZwOpenMutant(ptr long ptr) NtOpenMutant
@ stub ZwOpenObjectAuditAlarm
@ stdcall -private ZwOpenProcess(ptr long ptr ptr) NtOpenProcess
@ stdcall -private -syscall ZwOpenProcess(ptr long ptr ptr) NtOpenProcess
@ stdcall -private ZwOpenProcessToken(long long ptr) NtOpenProcessToken
@ stdcall -private ZwOpenProcessTokenEx(long long long ptr) NtOpenProcessTokenEx
@ stdcall -private ZwOpenSection(ptr long ptr) NtOpenSection
@ -1280,7 +1282,7 @@
@ stdcall -private ZwQueryInformationFile(long ptr ptr long long) NtQueryInformationFile
@ stdcall -private -syscall ZwQueryInformationJobObject(long long ptr long ptr) NtQueryInformationJobObject
@ stub ZwQueryInformationPort
@ stdcall -private ZwQueryInformationProcess(long long ptr long ptr) NtQueryInformationProcess
@ stdcall -private -syscall ZwQueryInformationProcess(long long ptr long ptr) NtQueryInformationProcess
@ stdcall -private -syscall ZwQueryInformationThread(long long ptr long ptr) NtQueryInformationThread
@ stdcall -private ZwQueryInformationToken(long long ptr long ptr) NtQueryInformationToken
@ stdcall -private ZwQueryInstallUILanguage(ptr) NtQueryInstallUILanguage
@ -1338,7 +1340,7 @@
@ stdcall -private -syscall ZwResetEvent(long ptr) NtResetEvent
@ stdcall -private ZwResetWriteWatch(long ptr long) NtResetWriteWatch
@ stdcall -private ZwRestoreKey(long long long) NtRestoreKey
@ stdcall -private ZwResumeProcess(long) NtResumeProcess
@ stdcall -private -syscall ZwResumeProcess(long) NtResumeProcess
@ stdcall -private -syscall ZwResumeThread(long ptr) NtResumeThread
@ stdcall -private ZwSaveKey(long long) NtSaveKey
# @ stub ZwSaveKeyEx
@ -1362,7 +1364,7 @@
@ stdcall -private -syscall ZwSetInformationJobObject(long long ptr long) NtSetInformationJobObject
@ stdcall -private ZwSetInformationKey(long long ptr long) NtSetInformationKey
@ stdcall -private ZwSetInformationObject(long long ptr long) NtSetInformationObject
@ stdcall -private ZwSetInformationProcess(long long ptr long) NtSetInformationProcess
@ stdcall -private -syscall ZwSetInformationProcess(long long ptr long) NtSetInformationProcess
@ stdcall -private -syscall ZwSetInformationThread(long long ptr long) NtSetInformationThread
@ stdcall -private ZwSetInformationToken(long long ptr long) NtSetInformationToken
@ stdcall -private ZwSetIntervalProfile(long long) NtSetIntervalProfile
@ -1389,11 +1391,11 @@
@ stdcall -private -syscall ZwSignalAndWaitForSingleObject(long long long ptr) NtSignalAndWaitForSingleObject
@ stub ZwStartProfile
@ stub ZwStopProfile
@ stdcall -private ZwSuspendProcess(long) NtSuspendProcess
@ stdcall -private -syscall ZwSuspendProcess(long) NtSuspendProcess
@ stdcall -private -syscall ZwSuspendThread(long ptr) NtSuspendThread
@ stdcall -private ZwSystemDebugControl(long ptr long ptr long ptr) NtSystemDebugControl
@ stdcall -private -syscall ZwTerminateJobObject(long long) NtTerminateJobObject
@ stdcall -private ZwTerminateProcess(long long) NtTerminateProcess
@ stdcall -private -syscall ZwTerminateProcess(long long) NtTerminateProcess
@ stdcall -private -syscall ZwTerminateThread(long long) NtTerminateThread
@ stub ZwTestAlert
# @ stub ZwTraceEvent

View File

@ -46,16 +46,6 @@ static const BOOL is_win64 = (sizeof(void *) > sizeof(int));
* Process object
*/
/******************************************************************************
* NtTerminateProcess [NTDLL.@]
*
* Native applications must kill themselves when done
*/
NTSTATUS WINAPI NtTerminateProcess( HANDLE handle, LONG exit_code )
{
return unix_funcs->NtTerminateProcess( handle, exit_code );
}
/******************************************************************************
* RtlGetCurrentPeb [NTDLL.@]
*
@ -82,118 +72,6 @@ HANDLE CDECL __wine_make_process_system(void)
return ret;
}
/******************************************************************************
* NtQueryInformationProcess [NTDLL.@]
* ZwQueryInformationProcess [NTDLL.@]
*
*/
NTSTATUS WINAPI NtQueryInformationProcess( HANDLE handle, PROCESSINFOCLASS class, void *info,
ULONG size, ULONG *ret_len )
{
return unix_funcs->NtQueryInformationProcess( handle, class, info, size, ret_len );
}
/******************************************************************************
* NtSetInformationProcess [NTDLL.@]
* ZwSetInformationProcess [NTDLL.@]
*/
NTSTATUS WINAPI NtSetInformationProcess( HANDLE handle, PROCESSINFOCLASS class, void *info, ULONG size )
{
return unix_funcs->NtSetInformationProcess( handle, class, info, size );
}
/******************************************************************************
* NtFlushInstructionCache [NTDLL.@]
* ZwFlushInstructionCache [NTDLL.@]
*/
NTSTATUS WINAPI NtFlushInstructionCache( HANDLE handle, const void *addr, SIZE_T size )
{
#if defined(__x86_64__) || defined(__i386__)
/* no-op */
#elif defined(HAVE___CLEAR_CACHE)
if (handle == GetCurrentProcess())
{
__clear_cache( (char *)addr, (char *)addr + size );
}
else
{
static int once;
if (!once++) FIXME( "%p %p %ld other process not supported\n", handle, addr, size );
}
#else
static int once;
if (!once++) FIXME( "%p %p %ld\n", handle, addr, size );
#endif
return STATUS_SUCCESS;
}
/**********************************************************************
* NtFlushProcessWriteBuffers [NTDLL.@]
*/
void WINAPI NtFlushProcessWriteBuffers(void)
{
static int once = 0;
if (!once++) FIXME( "stub\n" );
}
/******************************************************************
* NtOpenProcess [NTDLL.@]
* ZwOpenProcess [NTDLL.@]
*/
NTSTATUS WINAPI NtOpenProcess(PHANDLE handle, ACCESS_MASK access,
const OBJECT_ATTRIBUTES* attr, const CLIENT_ID* cid)
{
NTSTATUS status;
SERVER_START_REQ( open_process )
{
req->pid = HandleToULong(cid->UniqueProcess);
req->access = access;
req->attributes = attr ? attr->Attributes : 0;
status = wine_server_call( req );
if (!status) *handle = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
return status;
}
/******************************************************************************
* NtResumeProcess
* ZwResumeProcess
*/
NTSTATUS WINAPI NtResumeProcess( HANDLE handle )
{
NTSTATUS ret;
SERVER_START_REQ( resume_process )
{
req->handle = wine_server_obj_handle( handle );
ret = wine_server_call( req );
}
SERVER_END_REQ;
return ret;
}
/******************************************************************************
* NtSuspendProcess
* ZwSuspendProcess
*/
NTSTATUS WINAPI NtSuspendProcess( HANDLE handle )
{
NTSTATUS ret;
SERVER_START_REQ( suspend_process )
{
req->handle = wine_server_obj_handle( handle );
ret = wine_server_call( req );
}
SERVER_END_REQ;
return ret;
}
/***********************************************************************
* restart_process
*/
@ -242,24 +120,6 @@ NTSTATUS restart_process( RTL_USER_PROCESS_PARAMETERS *params, NTSTATUS status )
}
/**********************************************************************
* NtCreateUserProcess (NTDLL.@)
*/
NTSTATUS WINAPI NtCreateUserProcess( HANDLE *process_handle_ptr, HANDLE *thread_handle_ptr,
ACCESS_MASK process_access, ACCESS_MASK thread_access,
OBJECT_ATTRIBUTES *process_attr, OBJECT_ATTRIBUTES *thread_attr,
ULONG process_flags, ULONG thread_flags,
RTL_USER_PROCESS_PARAMETERS *params, PS_CREATE_INFO *info,
PS_ATTRIBUTE_LIST *attr )
{
return unix_funcs->NtCreateUserProcess( process_handle_ptr, thread_handle_ptr,
process_access, thread_access,
process_attr, thread_attr,
process_flags, thread_flags,
params, info, attr );
}
/**********************************************************************
* RtlCreateUserProcess (NTDLL.@)
*/

View File

@ -1364,14 +1364,11 @@ static struct unix_funcs unix_funcs =
NtCreateMailslotFile,
NtCreateNamedPipeFile,
NtCreateSection,
NtCreateUserProcess,
NtCurrentTeb,
NtDeleteFile,
NtDeviceIoControlFile,
NtDuplicateObject,
NtFlushBuffersFile,
NtFlushInstructionCache,
NtFlushProcessWriteBuffers,
NtFlushVirtualMemory,
NtFreeVirtualMemory,
NtFsControlFile,
@ -1380,7 +1377,6 @@ static struct unix_funcs unix_funcs =
NtLockVirtualMemory,
NtMapViewOfSection,
NtNotifyChangeDirectoryFile,
NtOpenProcess,
NtOpenSection,
NtPowerInformation,
NtProtectVirtualMemory,
@ -1388,7 +1384,6 @@ static struct unix_funcs unix_funcs =
NtQueryDirectoryFile,
NtQueryFullAttributesFile,
NtQueryInformationFile,
NtQueryInformationProcess,
NtQueryObject,
NtQueryPerformanceCounter,
NtQuerySection,
@ -1401,14 +1396,10 @@ static struct unix_funcs unix_funcs =
NtReadFileScatter,
NtReadVirtualMemory,
NtResetWriteWatch,
NtResumeProcess,
NtSetInformationFile,
NtSetInformationObject,
NtSetInformationProcess,
NtSetSystemTime,
NtSetVolumeInformationFile,
NtSuspendProcess,
NtTerminateProcess,
NtUnlockVirtualMemory,
NtUnmapViewOfSection,
NtWriteFile,

View File

@ -28,7 +28,7 @@ struct msghdr;
struct _DISPATCHER_CONTEXT;
/* increment this when you change the function table */
#define NTDLL_UNIXLIB_VERSION 83
#define NTDLL_UNIXLIB_VERSION 84
struct unix_funcs
{
@ -49,12 +49,6 @@ struct unix_funcs
NTSTATUS (WINAPI *NtCreateSection)( HANDLE *handle, ACCESS_MASK access,
const OBJECT_ATTRIBUTES *attr, const LARGE_INTEGER *size,
ULONG protect, ULONG sec_flags, HANDLE file );
NTSTATUS (WINAPI *NtCreateUserProcess)( HANDLE *process_handle_ptr, HANDLE *thread_handle_ptr,
ACCESS_MASK process_access, ACCESS_MASK thread_access,
OBJECT_ATTRIBUTES *process_attr, OBJECT_ATTRIBUTES *thread_attr,
ULONG process_flags, ULONG thread_flags,
RTL_USER_PROCESS_PARAMETERS *params, PS_CREATE_INFO *info,
PS_ATTRIBUTE_LIST *attr );
TEB * (WINAPI *NtCurrentTeb)(void);
NTSTATUS (WINAPI *NtDeleteFile)( OBJECT_ATTRIBUTES *attr );
NTSTATUS (WINAPI *NtDeviceIoControlFile)( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc,
@ -65,8 +59,6 @@ struct unix_funcs
HANDLE dest_process, HANDLE *dest,
ACCESS_MASK access, ULONG attributes, ULONG options );
NTSTATUS (WINAPI *NtFlushBuffersFile)( HANDLE handle, IO_STATUS_BLOCK *io );
NTSTATUS (WINAPI *NtFlushInstructionCache)( HANDLE handle, const void *addr, SIZE_T size );
void (WINAPI *NtFlushProcessWriteBuffers)(void);
NTSTATUS (WINAPI *NtFlushVirtualMemory)( HANDLE process, LPCVOID *addr_ptr,
SIZE_T *size_ptr, ULONG unknown );
NTSTATUS (WINAPI *NtFreeVirtualMemory)( HANDLE process, PVOID *addr_ptr,
@ -87,8 +79,6 @@ struct unix_funcs
void *apc_context, IO_STATUS_BLOCK *iosb,
void *buffer, ULONG buffer_size,
ULONG filter, BOOLEAN subtree );
NTSTATUS (WINAPI *NtOpenProcess)( HANDLE *handle, ACCESS_MASK access,
const OBJECT_ATTRIBUTES *attr, const CLIENT_ID *id );
NTSTATUS (WINAPI *NtOpenSection)( HANDLE *handle, ACCESS_MASK access,
const OBJECT_ATTRIBUTES *attr );
NTSTATUS (WINAPI *NtPowerInformation)( POWER_INFORMATION_LEVEL level, void *input, ULONG in_size,
@ -106,8 +96,6 @@ struct unix_funcs
FILE_NETWORK_OPEN_INFORMATION *info );
NTSTATUS (WINAPI *NtQueryInformationFile)( HANDLE hFile, IO_STATUS_BLOCK *io,
void *ptr, LONG len, FILE_INFORMATION_CLASS class );
NTSTATUS (WINAPI *NtQueryInformationProcess)( HANDLE handle, PROCESSINFOCLASS class, void *info,
ULONG size, ULONG *ret_len );
NTSTATUS (WINAPI *NtQueryObject)( HANDLE handle, OBJECT_INFORMATION_CLASS info_class,
void *ptr, ULONG len, ULONG *used_len );
NTSTATUS (WINAPI *NtQueryPerformanceCounter)( LARGE_INTEGER *counter, LARGE_INTEGER *frequency );
@ -135,18 +123,13 @@ struct unix_funcs
NTSTATUS (WINAPI *NtReadVirtualMemory)( HANDLE process, const void *addr, void *buffer,
SIZE_T size, SIZE_T *bytes_read );
NTSTATUS (WINAPI *NtResetWriteWatch)( HANDLE process, PVOID base, SIZE_T size );
NTSTATUS (WINAPI *NtResumeProcess)( HANDLE handle );
NTSTATUS (WINAPI *NtSetInformationFile)( HANDLE handle, IO_STATUS_BLOCK *io,
void *ptr, ULONG len, FILE_INFORMATION_CLASS class );
NTSTATUS (WINAPI *NtSetInformationObject)( HANDLE handle, OBJECT_INFORMATION_CLASS info_class,
void *ptr, ULONG len );
NTSTATUS (WINAPI *NtSetInformationProcess)( HANDLE handle, PROCESSINFOCLASS class,
void *info, ULONG size );
NTSTATUS (WINAPI *NtSetSystemTime)( const LARGE_INTEGER *new, LARGE_INTEGER *old );
NTSTATUS (WINAPI *NtSetVolumeInformationFile)( HANDLE handle, IO_STATUS_BLOCK *io, void *info,
ULONG length, FS_INFORMATION_CLASS class );
NTSTATUS (WINAPI *NtSuspendProcess)( HANDLE handle );
NTSTATUS (WINAPI *NtTerminateProcess)( HANDLE handle, LONG exit_code );
NTSTATUS (WINAPI *NtUnlockVirtualMemory)( HANDLE process, PVOID *addr,
SIZE_T *size, ULONG unknown );
NTSTATUS (WINAPI *NtUnmapViewOfSection)( HANDLE process, PVOID addr );