ntdll: Move the remaining process functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
6d1fea9711
commit
44a230937b
|
@ -36,9 +36,6 @@
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(dbgeng);
|
WINE_DEFAULT_DEBUG_CHANNEL(dbgeng);
|
||||||
|
|
||||||
extern NTSTATUS WINAPI NtSuspendProcess(HANDLE handle);
|
|
||||||
extern NTSTATUS WINAPI NtResumeProcess(HANDLE handle);
|
|
||||||
|
|
||||||
struct module_info
|
struct module_info
|
||||||
{
|
{
|
||||||
DEBUG_MODULE_PARAMETERS params;
|
DEBUG_MODULE_PARAMETERS params;
|
||||||
|
|
|
@ -29,26 +29,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#ifdef HAVE_SYS_SOCKET_H
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_SYS_TIME_H
|
|
||||||
# include <sys/time.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_SYS_TIMES_H
|
|
||||||
# include <sys/times.h>
|
|
||||||
#endif
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#ifdef HAVE_SYS_WAIT_H
|
|
||||||
# include <sys/wait.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_UNISTD_H
|
|
||||||
# include <unistd.h>
|
|
||||||
#endif
|
|
||||||
#ifdef __APPLE__
|
|
||||||
#include <CoreFoundation/CoreFoundation.h>
|
|
||||||
#include <pthread.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "ntstatus.h"
|
#include "ntstatus.h"
|
||||||
#define WIN32_NO_STATUS
|
#define WIN32_NO_STATUS
|
||||||
|
@ -59,10 +40,6 @@
|
||||||
#include "wine/exception.h"
|
#include "wine/exception.h"
|
||||||
#include "wine/server.h"
|
#include "wine/server.h"
|
||||||
|
|
||||||
#ifdef HAVE_MACH_MACH_H
|
|
||||||
#include <mach/mach.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(process);
|
WINE_DEFAULT_DEBUG_CHANNEL(process);
|
||||||
|
|
||||||
static const BOOL is_win64 = (sizeof(void *) > sizeof(int));
|
static const BOOL is_win64 = (sizeof(void *) > sizeof(int));
|
||||||
|
@ -227,193 +204,6 @@ NTSTATUS WINAPI NtSuspendProcess( HANDLE handle )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
* is_builtin_path
|
|
||||||
*/
|
|
||||||
static BOOL is_builtin_path( UNICODE_STRING *path, BOOL *is_64bit )
|
|
||||||
{
|
|
||||||
static const WCHAR systemW[] = {'\\','?','?','\\','c',':','\\','w','i','n','d','o','w','s','\\',
|
|
||||||
's','y','s','t','e','m','3','2','\\'};
|
|
||||||
static const WCHAR wow64W[] = {'\\','?','?','\\','c',':','\\','w','i','n','d','o','w','s','\\',
|
|
||||||
's','y','s','w','o','w','6','4'};
|
|
||||||
|
|
||||||
*is_64bit = is_win64;
|
|
||||||
if (path->Length > sizeof(systemW) && !wcsnicmp( path->Buffer, systemW, ARRAY_SIZE(systemW) ))
|
|
||||||
{
|
|
||||||
if (is_wow64 && !ntdll_get_thread_data()->wow64_redir) *is_64bit = TRUE;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
if ((is_win64 || is_wow64) && path->Length > sizeof(wow64W) &&
|
|
||||||
!wcsnicmp( path->Buffer, wow64W, ARRAY_SIZE(wow64W) ))
|
|
||||||
{
|
|
||||||
*is_64bit = FALSE;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* get_so_file_info
|
|
||||||
*/
|
|
||||||
static BOOL get_so_file_info( HANDLE handle, pe_image_info_t *info )
|
|
||||||
{
|
|
||||||
union
|
|
||||||
{
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
unsigned char magic[4];
|
|
||||||
unsigned char class;
|
|
||||||
unsigned char data;
|
|
||||||
unsigned char version;
|
|
||||||
unsigned char ignored1[9];
|
|
||||||
unsigned short type;
|
|
||||||
unsigned short machine;
|
|
||||||
unsigned char ignored2[8];
|
|
||||||
unsigned int phoff;
|
|
||||||
unsigned char ignored3[12];
|
|
||||||
unsigned short phnum;
|
|
||||||
} elf;
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
unsigned char magic[4];
|
|
||||||
unsigned char class;
|
|
||||||
unsigned char data;
|
|
||||||
unsigned char ignored1[10];
|
|
||||||
unsigned short type;
|
|
||||||
unsigned short machine;
|
|
||||||
unsigned char ignored2[12];
|
|
||||||
unsigned __int64 phoff;
|
|
||||||
unsigned char ignored3[16];
|
|
||||||
unsigned short phnum;
|
|
||||||
} elf64;
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
unsigned int magic;
|
|
||||||
unsigned int cputype;
|
|
||||||
unsigned int cpusubtype;
|
|
||||||
unsigned int filetype;
|
|
||||||
} macho;
|
|
||||||
IMAGE_DOS_HEADER mz;
|
|
||||||
} header;
|
|
||||||
|
|
||||||
IO_STATUS_BLOCK io;
|
|
||||||
LARGE_INTEGER offset;
|
|
||||||
|
|
||||||
offset.QuadPart = 0;
|
|
||||||
if (NtReadFile( handle, 0, NULL, NULL, &io, &header, sizeof(header), &offset, 0 )) return FALSE;
|
|
||||||
if (io.Information != sizeof(header)) return FALSE;
|
|
||||||
|
|
||||||
if (!memcmp( header.elf.magic, "\177ELF", 4 ))
|
|
||||||
{
|
|
||||||
unsigned int type;
|
|
||||||
unsigned short phnum;
|
|
||||||
|
|
||||||
if (header.elf.version != 1 /* EV_CURRENT */) return FALSE;
|
|
||||||
#ifdef WORDS_BIGENDIAN
|
|
||||||
if (header.elf.data != 2 /* ELFDATA2MSB */) return FALSE;
|
|
||||||
#else
|
|
||||||
if (header.elf.data != 1 /* ELFDATA2LSB */) return FALSE;
|
|
||||||
#endif
|
|
||||||
switch (header.elf.machine)
|
|
||||||
{
|
|
||||||
case 3: info->cpu = CPU_x86; break;
|
|
||||||
case 40: info->cpu = CPU_ARM; break;
|
|
||||||
case 62: info->cpu = CPU_x86_64; break;
|
|
||||||
case 183: info->cpu = CPU_ARM64; break;
|
|
||||||
}
|
|
||||||
if (header.elf.type != 3 /* ET_DYN */) return FALSE;
|
|
||||||
if (header.elf.class == 2 /* ELFCLASS64 */)
|
|
||||||
{
|
|
||||||
offset.QuadPart = header.elf64.phoff;
|
|
||||||
phnum = header.elf64.phnum;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
offset.QuadPart = header.elf.phoff;
|
|
||||||
phnum = header.elf.phnum;
|
|
||||||
}
|
|
||||||
while (phnum--)
|
|
||||||
{
|
|
||||||
if (NtReadFile( handle, 0, NULL, NULL, &io, &type, sizeof(type), &offset, 0 )) return FALSE;
|
|
||||||
if (io.Information < sizeof(type)) return FALSE;
|
|
||||||
if (type == 3 /* PT_INTERP */) return FALSE;
|
|
||||||
offset.QuadPart += (header.elf.class == 2) ? 56 : 32;
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
else if (header.macho.magic == 0xfeedface || header.macho.magic == 0xfeedfacf)
|
|
||||||
{
|
|
||||||
switch (header.macho.cputype)
|
|
||||||
{
|
|
||||||
case 0x00000007: info->cpu = CPU_x86; break;
|
|
||||||
case 0x01000007: info->cpu = CPU_x86_64; break;
|
|
||||||
case 0x0000000c: info->cpu = CPU_ARM; break;
|
|
||||||
case 0x0100000c: info->cpu = CPU_ARM64; break;
|
|
||||||
}
|
|
||||||
if (header.macho.filetype == 8) return TRUE;
|
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* get_pe_file_info
|
|
||||||
*/
|
|
||||||
static NTSTATUS get_pe_file_info( UNICODE_STRING *path, ULONG attributes,
|
|
||||||
HANDLE *handle, pe_image_info_t *info )
|
|
||||||
{
|
|
||||||
NTSTATUS status;
|
|
||||||
HANDLE mapping;
|
|
||||||
OBJECT_ATTRIBUTES attr;
|
|
||||||
IO_STATUS_BLOCK io;
|
|
||||||
|
|
||||||
memset( info, 0, sizeof(*info) );
|
|
||||||
InitializeObjectAttributes( &attr, path, attributes, 0, 0 );
|
|
||||||
if ((status = NtOpenFile( handle, GENERIC_READ, &attr, &io,
|
|
||||||
FILE_SHARE_READ | FILE_SHARE_DELETE, FILE_SYNCHRONOUS_IO_NONALERT )))
|
|
||||||
{
|
|
||||||
BOOL is_64bit;
|
|
||||||
|
|
||||||
if (is_builtin_path( path, &is_64bit ))
|
|
||||||
{
|
|
||||||
TRACE( "assuming %u-bit builtin for %s\n", is_64bit ? 64 : 32, debugstr_us(path));
|
|
||||||
/* assume current arch */
|
|
||||||
#if defined(__i386__) || defined(__x86_64__)
|
|
||||||
info->cpu = is_64bit ? CPU_x86_64 : CPU_x86;
|
|
||||||
#elif defined(__arm__)
|
|
||||||
info->cpu = CPU_ARM;
|
|
||||||
#elif defined(__aarch64__)
|
|
||||||
info->cpu = CPU_ARM64;
|
|
||||||
#endif
|
|
||||||
*handle = 0;
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(status = NtCreateSection( &mapping, STANDARD_RIGHTS_REQUIRED | SECTION_QUERY |
|
|
||||||
SECTION_MAP_READ | SECTION_MAP_EXECUTE,
|
|
||||||
NULL, NULL, PAGE_EXECUTE_READ, SEC_IMAGE, *handle )))
|
|
||||||
{
|
|
||||||
SERVER_START_REQ( get_mapping_info )
|
|
||||||
{
|
|
||||||
req->handle = wine_server_obj_handle( mapping );
|
|
||||||
req->access = SECTION_QUERY;
|
|
||||||
wine_server_set_reply( req, info, sizeof(*info) );
|
|
||||||
status = wine_server_call( req );
|
|
||||||
}
|
|
||||||
SERVER_END_REQ;
|
|
||||||
NtClose( mapping );
|
|
||||||
}
|
|
||||||
else if (status == STATUS_INVALID_IMAGE_NOT_MZ)
|
|
||||||
{
|
|
||||||
if (get_so_file_info( *handle, info )) return STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* restart_process
|
* restart_process
|
||||||
*/
|
*/
|
||||||
|
@ -425,9 +215,7 @@ NTSTATUS restart_process( RTL_USER_PROCESS_PARAMETERS *params, NTSTATUS status )
|
||||||
static const WCHAR pifW[] = {'.','p','i','f',0};
|
static const WCHAR pifW[] = {'.','p','i','f',0};
|
||||||
|
|
||||||
WCHAR *p, *cmdline;
|
WCHAR *p, *cmdline;
|
||||||
UNICODE_STRING strW;
|
UNICODE_STRING pathW, cmdW;
|
||||||
pe_image_info_t pe_info;
|
|
||||||
HANDLE handle;
|
|
||||||
|
|
||||||
/* check for .com or .pif extension */
|
/* check for .com or .pif extension */
|
||||||
if (status == STATUS_INVALID_IMAGE_NOT_MZ &&
|
if (status == STATUS_INVALID_IMAGE_NOT_MZ &&
|
||||||
|
@ -441,14 +229,9 @@ NTSTATUS restart_process( RTL_USER_PROCESS_PARAMETERS *params, NTSTATUS status )
|
||||||
case STATUS_NO_MEMORY:
|
case STATUS_NO_MEMORY:
|
||||||
case STATUS_INVALID_IMAGE_FORMAT:
|
case STATUS_INVALID_IMAGE_FORMAT:
|
||||||
case STATUS_INVALID_IMAGE_NOT_MZ:
|
case STATUS_INVALID_IMAGE_NOT_MZ:
|
||||||
if (getenv( "WINEPRELOADRESERVE" ))
|
if (!RtlDosPathNameToNtPathName_U( params->ImagePathName.Buffer, &pathW, NULL, NULL ))
|
||||||
return status;
|
return status;
|
||||||
if ((status = RtlDosPathNameToNtPathName_U_WithStatus( params->ImagePathName.Buffer, &strW,
|
status = unix_funcs->exec_process( &pathW, ¶ms->CommandLine, status );
|
||||||
NULL, NULL )))
|
|
||||||
return status;
|
|
||||||
if ((status = get_pe_file_info( &strW, OBJ_CASE_INSENSITIVE, &handle, &pe_info )))
|
|
||||||
return status;
|
|
||||||
strW = params->CommandLine;
|
|
||||||
break;
|
break;
|
||||||
case STATUS_INVALID_IMAGE_WIN_16:
|
case STATUS_INVALID_IMAGE_WIN_16:
|
||||||
case STATUS_INVALID_IMAGE_NE_FORMAT:
|
case STATUS_INVALID_IMAGE_NE_FORMAT:
|
||||||
|
@ -460,15 +243,12 @@ NTSTATUS restart_process( RTL_USER_PROCESS_PARAMETERS *params, NTSTATUS status )
|
||||||
if (!cmdline) return STATUS_NO_MEMORY;
|
if (!cmdline) return STATUS_NO_MEMORY;
|
||||||
NTDLL_swprintf( cmdline, argsW, (is_win64 || is_wow64) ? syswow64_dir : system_dir,
|
NTDLL_swprintf( cmdline, argsW, (is_win64 || is_wow64) ? syswow64_dir : system_dir,
|
||||||
winevdm, params->ImagePathName.Buffer, params->CommandLine.Buffer );
|
winevdm, params->ImagePathName.Buffer, params->CommandLine.Buffer );
|
||||||
RtlInitUnicodeString( &strW, cmdline );
|
RtlInitUnicodeString( &pathW, winevdm );
|
||||||
memset( &pe_info, 0, sizeof(pe_info) );
|
RtlInitUnicodeString( &cmdW, cmdline );
|
||||||
pe_info.cpu = CPU_x86;
|
status = unix_funcs->exec_process( &pathW, &cmdW, status );
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
return status;
|
|
||||||
}
|
}
|
||||||
|
return status;
|
||||||
return unix_funcs->exec_process( &strW, &pe_info );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -862,6 +862,8 @@ static struct unix_funcs unix_funcs =
|
||||||
NtDeviceIoControlFile,
|
NtDeviceIoControlFile,
|
||||||
NtDuplicateObject,
|
NtDuplicateObject,
|
||||||
NtFlushBuffersFile,
|
NtFlushBuffersFile,
|
||||||
|
NtFlushInstructionCache,
|
||||||
|
NtFlushProcessWriteBuffers,
|
||||||
NtFlushVirtualMemory,
|
NtFlushVirtualMemory,
|
||||||
NtFreeVirtualMemory,
|
NtFreeVirtualMemory,
|
||||||
NtFsControlFile,
|
NtFsControlFile,
|
||||||
|
@ -876,6 +878,7 @@ static struct unix_funcs unix_funcs =
|
||||||
NtOpenJobObject,
|
NtOpenJobObject,
|
||||||
NtOpenKeyedEvent,
|
NtOpenKeyedEvent,
|
||||||
NtOpenMutant,
|
NtOpenMutant,
|
||||||
|
NtOpenProcess,
|
||||||
NtOpenSection,
|
NtOpenSection,
|
||||||
NtOpenSemaphore,
|
NtOpenSemaphore,
|
||||||
NtOpenThread,
|
NtOpenThread,
|
||||||
|
@ -909,6 +912,7 @@ static struct unix_funcs unix_funcs =
|
||||||
NtRemoveIoCompletionEx,
|
NtRemoveIoCompletionEx,
|
||||||
NtResetEvent,
|
NtResetEvent,
|
||||||
NtResetWriteWatch,
|
NtResetWriteWatch,
|
||||||
|
NtResumeProcess,
|
||||||
NtResumeThread,
|
NtResumeThread,
|
||||||
NtSetContextThread,
|
NtSetContextThread,
|
||||||
NtSetEvent,
|
NtSetEvent,
|
||||||
|
@ -920,6 +924,7 @@ static struct unix_funcs unix_funcs =
|
||||||
NtSetSystemTime,
|
NtSetSystemTime,
|
||||||
NtSetTimer,
|
NtSetTimer,
|
||||||
NtSignalAndWaitForSingleObject,
|
NtSignalAndWaitForSingleObject,
|
||||||
|
NtSuspendProcess,
|
||||||
NtSuspendThread,
|
NtSuspendThread,
|
||||||
NtTerminateJobObject,
|
NtTerminateJobObject,
|
||||||
NtTerminateProcess,
|
NtTerminateProcess,
|
||||||
|
|
|
@ -397,8 +397,7 @@ static BOOL get_so_file_info( HANDLE handle, pe_image_info_t *info )
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* get_pe_file_info
|
* get_pe_file_info
|
||||||
*/
|
*/
|
||||||
static NTSTATUS get_pe_file_info( UNICODE_STRING *path, ULONG attributes,
|
static NTSTATUS get_pe_file_info( UNICODE_STRING *path, HANDLE *handle, pe_image_info_t *info )
|
||||||
HANDLE *handle, pe_image_info_t *info )
|
|
||||||
{
|
{
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
HANDLE mapping;
|
HANDLE mapping;
|
||||||
|
@ -406,7 +405,7 @@ static NTSTATUS get_pe_file_info( UNICODE_STRING *path, ULONG attributes,
|
||||||
IO_STATUS_BLOCK io;
|
IO_STATUS_BLOCK io;
|
||||||
|
|
||||||
memset( info, 0, sizeof(*info) );
|
memset( info, 0, sizeof(*info) );
|
||||||
InitializeObjectAttributes( &attr, path, attributes, 0, 0 );
|
InitializeObjectAttributes( &attr, path, OBJ_CASE_INSENSITIVE, 0, 0 );
|
||||||
if ((status = NtOpenFile( handle, GENERIC_READ, &attr, &io,
|
if ((status = NtOpenFile( handle, GENERIC_READ, &attr, &io,
|
||||||
FILE_SHARE_READ | FILE_SHARE_DELETE, FILE_SYNCHRONOUS_IO_NONALERT )))
|
FILE_SHARE_READ | FILE_SHARE_DELETE, FILE_SYNCHRONOUS_IO_NONALERT )))
|
||||||
{
|
{
|
||||||
|
@ -586,12 +585,35 @@ static NTSTATUS spawn_process( const RTL_USER_PROCESS_PARAMETERS *params, int so
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* exec_process
|
* exec_process
|
||||||
*/
|
*/
|
||||||
NTSTATUS CDECL exec_process( const UNICODE_STRING *cmdline, const pe_image_info_t *pe_info )
|
NTSTATUS CDECL exec_process( UNICODE_STRING *path, UNICODE_STRING *cmdline, NTSTATUS status )
|
||||||
{
|
{
|
||||||
const int is_child_64bit = (pe_info->cpu == CPU_x86_64 || pe_info->cpu == CPU_ARM64);
|
pe_image_info_t pe_info;
|
||||||
NTSTATUS status;
|
BOOL is_child_64bit;
|
||||||
int socketfd[2];
|
int socketfd[2];
|
||||||
char **argv;
|
char **argv;
|
||||||
|
HANDLE handle;
|
||||||
|
|
||||||
|
switch (status)
|
||||||
|
{
|
||||||
|
case STATUS_CONFLICTING_ADDRESSES:
|
||||||
|
case STATUS_NO_MEMORY:
|
||||||
|
case STATUS_INVALID_IMAGE_FORMAT:
|
||||||
|
case STATUS_INVALID_IMAGE_NOT_MZ:
|
||||||
|
if (getenv( "WINEPRELOADRESERVE" )) return status;
|
||||||
|
if ((status = get_pe_file_info( path, &handle, &pe_info ))) return status;
|
||||||
|
is_child_64bit = (pe_info.cpu == CPU_x86_64 || pe_info.cpu == CPU_ARM64);
|
||||||
|
break;
|
||||||
|
case STATUS_INVALID_IMAGE_WIN_16:
|
||||||
|
case STATUS_INVALID_IMAGE_NE_FORMAT:
|
||||||
|
case STATUS_INVALID_IMAGE_PROTECT:
|
||||||
|
/* we'll start winevdm */
|
||||||
|
memset( &pe_info, 0, sizeof(pe_info) );
|
||||||
|
pe_info.cpu = CPU_x86;
|
||||||
|
is_child_64bit = FALSE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
if (socketpair( PF_UNIX, SOCK_STREAM, 0, socketfd ) == -1) return STATUS_TOO_MANY_OPENED_FILES;
|
if (socketpair( PF_UNIX, SOCK_STREAM, 0, socketfd ) == -1) return STATUS_TOO_MANY_OPENED_FILES;
|
||||||
#ifdef SO_PASSCRED
|
#ifdef SO_PASSCRED
|
||||||
|
@ -607,7 +629,7 @@ NTSTATUS CDECL exec_process( const UNICODE_STRING *cmdline, const pe_image_info_
|
||||||
SERVER_START_REQ( exec_process )
|
SERVER_START_REQ( exec_process )
|
||||||
{
|
{
|
||||||
req->socket_fd = socketfd[1];
|
req->socket_fd = socketfd[1];
|
||||||
req->cpu = pe_info->cpu;
|
req->cpu = pe_info.cpu;
|
||||||
status = wine_server_call( req );
|
status = wine_server_call( req );
|
||||||
}
|
}
|
||||||
SERVER_END_REQ;
|
SERVER_END_REQ;
|
||||||
|
@ -618,7 +640,7 @@ NTSTATUS CDECL exec_process( const UNICODE_STRING *cmdline, const pe_image_info_
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
status = exec_wineloader( argv, socketfd[0], is_child_64bit,
|
status = exec_wineloader( argv, socketfd[0], is_child_64bit,
|
||||||
pe_info->base, pe_info->base + pe_info->map_size );
|
pe_info.base, pe_info.base + pe_info.map_size );
|
||||||
}
|
}
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
while (errno == ENOTSUP && terminate_main_thread());
|
while (errno == ENOTSUP && terminate_main_thread());
|
||||||
|
@ -792,7 +814,7 @@ NTSTATUS WINAPI NtCreateUserProcess( HANDLE *process_handle_ptr, HANDLE *thread_
|
||||||
|
|
||||||
unixdir = get_unix_curdir( params );
|
unixdir = get_unix_curdir( params );
|
||||||
|
|
||||||
if ((status = get_pe_file_info( &path, OBJ_CASE_INSENSITIVE, &file_handle, &pe_info )))
|
if ((status = get_pe_file_info( &path, &file_handle, &pe_info )))
|
||||||
{
|
{
|
||||||
if (status == STATUS_INVALID_IMAGE_NOT_MZ && !fork_and_exec( &path, unixdir, params ))
|
if (status == STATUS_INVALID_IMAGE_NOT_MZ && !fork_and_exec( &path, unixdir, params ))
|
||||||
{
|
{
|
||||||
|
@ -1535,3 +1557,58 @@ NTSTATUS WINAPI NtSetInformationProcess( HANDLE handle, PROCESSINFOCLASS class,
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
* NtOpenProcess (NTDLL.@)
|
||||||
|
*/
|
||||||
|
NTSTATUS WINAPI NtOpenProcess( HANDLE *handle, ACCESS_MASK access,
|
||||||
|
const OBJECT_ATTRIBUTES *attr, const CLIENT_ID *id )
|
||||||
|
{
|
||||||
|
NTSTATUS status;
|
||||||
|
|
||||||
|
SERVER_START_REQ( open_process )
|
||||||
|
{
|
||||||
|
req->pid = HandleToULong( id->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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
* NtSuspendProcess (NTDLL.@)
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
* NtResumeProcess (NTDLL.@)
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
|
@ -114,7 +114,7 @@ extern TEB * CDECL init_threading( int *nb_threads_ptr, struct ldt_copy **ldt_co
|
||||||
extern void CDECL DECLSPEC_NORETURN exit_thread( int status ) DECLSPEC_HIDDEN;
|
extern void CDECL DECLSPEC_NORETURN exit_thread( int status ) DECLSPEC_HIDDEN;
|
||||||
extern void CDECL DECLSPEC_NORETURN exit_process( int status ) DECLSPEC_HIDDEN;
|
extern void CDECL DECLSPEC_NORETURN exit_process( int status ) DECLSPEC_HIDDEN;
|
||||||
extern NTSTATUS CDECL get_thread_ldt_entry( HANDLE handle, void *data, ULONG len, ULONG *ret_len ) DECLSPEC_HIDDEN;
|
extern NTSTATUS CDECL get_thread_ldt_entry( HANDLE handle, void *data, ULONG len, ULONG *ret_len ) DECLSPEC_HIDDEN;
|
||||||
extern NTSTATUS CDECL exec_process( const UNICODE_STRING *cmdline, const pe_image_info_t *pe_info ) DECLSPEC_HIDDEN;
|
extern NTSTATUS CDECL exec_process( UNICODE_STRING *path, UNICODE_STRING *cmdline, NTSTATUS status ) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
extern NTSTATUS CDECL nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRING *unix_name_ret,
|
extern NTSTATUS CDECL nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRING *unix_name_ret,
|
||||||
UINT disposition, BOOLEAN check_case ) DECLSPEC_HIDDEN;
|
UINT disposition, BOOLEAN check_case ) DECLSPEC_HIDDEN;
|
||||||
|
|
|
@ -4337,3 +4337,38 @@ NTSTATUS WINAPI NtAreMappedFilesTheSame(PVOID addr1, PVOID addr2)
|
||||||
server_leave_uninterrupted_section( &csVirtual, &sigset );
|
server_leave_uninterrupted_section( &csVirtual, &sigset );
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
* NtFlushInstructionCache (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" );
|
||||||
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ struct ldt_copy;
|
||||||
struct msghdr;
|
struct msghdr;
|
||||||
|
|
||||||
/* increment this when you change the function table */
|
/* increment this when you change the function table */
|
||||||
#define NTDLL_UNIXLIB_VERSION 52
|
#define NTDLL_UNIXLIB_VERSION 53
|
||||||
|
|
||||||
struct unix_funcs
|
struct unix_funcs
|
||||||
{
|
{
|
||||||
|
@ -94,6 +94,8 @@ struct unix_funcs
|
||||||
HANDLE dest_process, HANDLE *dest,
|
HANDLE dest_process, HANDLE *dest,
|
||||||
ACCESS_MASK access, ULONG attributes, ULONG options );
|
ACCESS_MASK access, ULONG attributes, ULONG options );
|
||||||
NTSTATUS (WINAPI *NtFlushBuffersFile)( HANDLE handle, IO_STATUS_BLOCK *io );
|
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,
|
NTSTATUS (WINAPI *NtFlushVirtualMemory)( HANDLE process, LPCVOID *addr_ptr,
|
||||||
SIZE_T *size_ptr, ULONG unknown );
|
SIZE_T *size_ptr, ULONG unknown );
|
||||||
NTSTATUS (WINAPI *NtFreeVirtualMemory)( HANDLE process, PVOID *addr_ptr,
|
NTSTATUS (WINAPI *NtFreeVirtualMemory)( HANDLE process, PVOID *addr_ptr,
|
||||||
|
@ -123,6 +125,8 @@ struct unix_funcs
|
||||||
const OBJECT_ATTRIBUTES *attr );
|
const OBJECT_ATTRIBUTES *attr );
|
||||||
NTSTATUS (WINAPI *NtOpenMutant)( HANDLE *handle, ACCESS_MASK access,
|
NTSTATUS (WINAPI *NtOpenMutant)( HANDLE *handle, ACCESS_MASK access,
|
||||||
const OBJECT_ATTRIBUTES *attr );
|
const OBJECT_ATTRIBUTES *attr );
|
||||||
|
NTSTATUS (WINAPI *NtOpenProcess)( HANDLE *handle, ACCESS_MASK access,
|
||||||
|
const OBJECT_ATTRIBUTES *attr, const CLIENT_ID *id );
|
||||||
NTSTATUS (WINAPI *NtOpenSection)( HANDLE *handle, ACCESS_MASK access,
|
NTSTATUS (WINAPI *NtOpenSection)( HANDLE *handle, ACCESS_MASK access,
|
||||||
const OBJECT_ATTRIBUTES *attr );
|
const OBJECT_ATTRIBUTES *attr );
|
||||||
NTSTATUS (WINAPI *NtOpenSemaphore)( HANDLE *handle, ACCESS_MASK access,
|
NTSTATUS (WINAPI *NtOpenSemaphore)( HANDLE *handle, ACCESS_MASK access,
|
||||||
|
@ -188,6 +192,7 @@ struct unix_funcs
|
||||||
LARGE_INTEGER *timeout, BOOLEAN alertable );
|
LARGE_INTEGER *timeout, BOOLEAN alertable );
|
||||||
NTSTATUS (WINAPI *NtResetEvent)( HANDLE handle, LONG *prev_state );
|
NTSTATUS (WINAPI *NtResetEvent)( HANDLE handle, LONG *prev_state );
|
||||||
NTSTATUS (WINAPI *NtResetWriteWatch)( HANDLE process, PVOID base, SIZE_T size );
|
NTSTATUS (WINAPI *NtResetWriteWatch)( HANDLE process, PVOID base, SIZE_T size );
|
||||||
|
NTSTATUS (WINAPI *NtResumeProcess)( HANDLE handle );
|
||||||
NTSTATUS (WINAPI *NtResumeThread)( HANDLE handle, ULONG *count );
|
NTSTATUS (WINAPI *NtResumeThread)( HANDLE handle, ULONG *count );
|
||||||
NTSTATUS (WINAPI *NtSetContextThread)( HANDLE handle, const CONTEXT *context );
|
NTSTATUS (WINAPI *NtSetContextThread)( HANDLE handle, const CONTEXT *context );
|
||||||
NTSTATUS (WINAPI *NtSetEvent)( HANDLE handle, LONG *prev_state );
|
NTSTATUS (WINAPI *NtSetEvent)( HANDLE handle, LONG *prev_state );
|
||||||
|
@ -206,6 +211,7 @@ struct unix_funcs
|
||||||
BOOLEAN resume, ULONG period, BOOLEAN *state );
|
BOOLEAN resume, ULONG period, BOOLEAN *state );
|
||||||
NTSTATUS (WINAPI *NtSignalAndWaitForSingleObject)( HANDLE signal, HANDLE wait,
|
NTSTATUS (WINAPI *NtSignalAndWaitForSingleObject)( HANDLE signal, HANDLE wait,
|
||||||
BOOLEAN alertable, const LARGE_INTEGER *timeout );
|
BOOLEAN alertable, const LARGE_INTEGER *timeout );
|
||||||
|
NTSTATUS (WINAPI *NtSuspendProcess)( HANDLE handle );
|
||||||
NTSTATUS (WINAPI *NtSuspendThread)( HANDLE handle, ULONG *count );
|
NTSTATUS (WINAPI *NtSuspendThread)( HANDLE handle, ULONG *count );
|
||||||
NTSTATUS (WINAPI *NtTerminateJobObject)( HANDLE handle, NTSTATUS status );
|
NTSTATUS (WINAPI *NtTerminateJobObject)( HANDLE handle, NTSTATUS status );
|
||||||
NTSTATUS (WINAPI *NtTerminateProcess)( HANDLE handle, LONG exit_code );
|
NTSTATUS (WINAPI *NtTerminateProcess)( HANDLE handle, LONG exit_code );
|
||||||
|
@ -286,7 +292,7 @@ struct unix_funcs
|
||||||
void (CDECL *exit_thread)( int status );
|
void (CDECL *exit_thread)( int status );
|
||||||
void (CDECL *exit_process)( int status );
|
void (CDECL *exit_process)( int status );
|
||||||
NTSTATUS (CDECL *get_thread_ldt_entry)( HANDLE handle, void *data, ULONG len, ULONG *ret_len );
|
NTSTATUS (CDECL *get_thread_ldt_entry)( HANDLE handle, void *data, ULONG len, ULONG *ret_len );
|
||||||
NTSTATUS (CDECL *exec_process)( const UNICODE_STRING *cmdline, const pe_image_info_t *pe_info );
|
NTSTATUS (CDECL *exec_process)( UNICODE_STRING *path, UNICODE_STRING *cmdline, NTSTATUS status );
|
||||||
|
|
||||||
/* server functions */
|
/* server functions */
|
||||||
unsigned int (CDECL *server_call)( void *req_ptr );
|
unsigned int (CDECL *server_call)( void *req_ptr );
|
||||||
|
|
|
@ -2723,6 +2723,7 @@ NTSYSAPI NTSTATUS WINAPI NtFindAtom(const WCHAR*,ULONG,RTL_ATOM*);
|
||||||
NTSYSAPI NTSTATUS WINAPI NtFlushBuffersFile(HANDLE,IO_STATUS_BLOCK*);
|
NTSYSAPI NTSTATUS WINAPI NtFlushBuffersFile(HANDLE,IO_STATUS_BLOCK*);
|
||||||
NTSYSAPI NTSTATUS WINAPI NtFlushInstructionCache(HANDLE,LPCVOID,SIZE_T);
|
NTSYSAPI NTSTATUS WINAPI NtFlushInstructionCache(HANDLE,LPCVOID,SIZE_T);
|
||||||
NTSYSAPI NTSTATUS WINAPI NtFlushKey(HANDLE);
|
NTSYSAPI NTSTATUS WINAPI NtFlushKey(HANDLE);
|
||||||
|
NTSYSAPI void WINAPI NtFlushProcessWriteBuffers(void);
|
||||||
NTSYSAPI NTSTATUS WINAPI NtFlushVirtualMemory(HANDLE,LPCVOID*,SIZE_T*,ULONG);
|
NTSYSAPI NTSTATUS WINAPI NtFlushVirtualMemory(HANDLE,LPCVOID*,SIZE_T*,ULONG);
|
||||||
NTSYSAPI NTSTATUS WINAPI NtFlushWriteBuffer(VOID);
|
NTSYSAPI NTSTATUS WINAPI NtFlushWriteBuffer(VOID);
|
||||||
NTSYSAPI NTSTATUS WINAPI NtFreeVirtualMemory(HANDLE,PVOID*,SIZE_T*,ULONG);
|
NTSYSAPI NTSTATUS WINAPI NtFreeVirtualMemory(HANDLE,PVOID*,SIZE_T*,ULONG);
|
||||||
|
@ -2840,6 +2841,7 @@ NTSYSAPI NTSTATUS WINAPI NtRequestWaitReplyPort(HANDLE,PLPC_MESSAGE,PLPC_MESSAG
|
||||||
NTSYSAPI NTSTATUS WINAPI NtResetEvent(HANDLE,LONG*);
|
NTSYSAPI NTSTATUS WINAPI NtResetEvent(HANDLE,LONG*);
|
||||||
NTSYSAPI NTSTATUS WINAPI NtResetWriteWatch(HANDLE,PVOID,SIZE_T);
|
NTSYSAPI NTSTATUS WINAPI NtResetWriteWatch(HANDLE,PVOID,SIZE_T);
|
||||||
NTSYSAPI NTSTATUS WINAPI NtRestoreKey(HANDLE,HANDLE,ULONG);
|
NTSYSAPI NTSTATUS WINAPI NtRestoreKey(HANDLE,HANDLE,ULONG);
|
||||||
|
NTSYSAPI NTSTATUS WINAPI NtResumeProcess(HANDLE);
|
||||||
NTSYSAPI NTSTATUS WINAPI NtResumeThread(HANDLE,PULONG);
|
NTSYSAPI NTSTATUS WINAPI NtResumeThread(HANDLE,PULONG);
|
||||||
NTSYSAPI NTSTATUS WINAPI NtSaveKey(HANDLE,HANDLE);
|
NTSYSAPI NTSTATUS WINAPI NtSaveKey(HANDLE,HANDLE);
|
||||||
NTSYSAPI NTSTATUS WINAPI NtSecureConnectPort(PHANDLE,PUNICODE_STRING,PSECURITY_QUALITY_OF_SERVICE,PLPC_SECTION_WRITE,PSID,PLPC_SECTION_READ,PULONG,PVOID,PULONG);
|
NTSYSAPI NTSTATUS WINAPI NtSecureConnectPort(PHANDLE,PUNICODE_STRING,PSECURITY_QUALITY_OF_SERVICE,PLPC_SECTION_WRITE,PSID,PLPC_SECTION_READ,PULONG,PVOID,PULONG);
|
||||||
|
@ -2880,6 +2882,7 @@ NTSYSAPI NTSTATUS WINAPI NtSignalAndWaitForSingleObject(HANDLE,HANDLE,BOOLEAN,c
|
||||||
NTSYSAPI NTSTATUS WINAPI NtShutdownSystem(SHUTDOWN_ACTION);
|
NTSYSAPI NTSTATUS WINAPI NtShutdownSystem(SHUTDOWN_ACTION);
|
||||||
NTSYSAPI NTSTATUS WINAPI NtStartProfile(HANDLE);
|
NTSYSAPI NTSTATUS WINAPI NtStartProfile(HANDLE);
|
||||||
NTSYSAPI NTSTATUS WINAPI NtStopProfile(HANDLE);
|
NTSYSAPI NTSTATUS WINAPI NtStopProfile(HANDLE);
|
||||||
|
NTSYSAPI NTSTATUS WINAPI NtSuspendProcess(HANDLE);
|
||||||
NTSYSAPI NTSTATUS WINAPI NtSuspendThread(HANDLE,PULONG);
|
NTSYSAPI NTSTATUS WINAPI NtSuspendThread(HANDLE,PULONG);
|
||||||
NTSYSAPI NTSTATUS WINAPI NtSystemDebugControl(SYSDBG_COMMAND,PVOID,ULONG,PVOID,ULONG,PULONG);
|
NTSYSAPI NTSTATUS WINAPI NtSystemDebugControl(SYSDBG_COMMAND,PVOID,ULONG,PVOID,ULONG,PULONG);
|
||||||
NTSYSAPI NTSTATUS WINAPI NtTerminateJobObject(HANDLE,NTSTATUS);
|
NTSYSAPI NTSTATUS WINAPI NtTerminateJobObject(HANDLE,NTSTATUS);
|
||||||
|
|
Loading…
Reference in New Issue