Commit 4c45348f authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Get rid of the exec_process() Unix library callback.

parent f51cd0a1
......@@ -3957,7 +3957,7 @@ static void restart_winevdm( RTL_USER_PROCESS_PARAMETERS *params )
/***********************************************************************
* process_init
*/
static void process_init(void)
static NTSTATUS process_init(void)
{
static const WCHAR ntdllW[] = {'\\','?','?','\\','C',':','\\','w','i','n','d','o','w','s','\\',
's','y','s','t','e','m','3','2','\\',
......@@ -4058,20 +4058,17 @@ static void process_init(void)
restart_winevdm( params );
status = STATUS_INVALID_IMAGE_WIN_16;
}
status = unix_funcs->exec_process( status );
break;
return status;
}
case STATUS_INVALID_IMAGE_WIN_16:
case STATUS_INVALID_IMAGE_NE_FORMAT:
case STATUS_INVALID_IMAGE_PROTECT:
restart_winevdm( params );
status = unix_funcs->exec_process( status );
break;
return status;
case STATUS_CONFLICTING_ADDRESSES:
case STATUS_NO_MEMORY:
case STATUS_INVALID_IMAGE_FORMAT:
status = unix_funcs->exec_process( status );
break;
return status;
case STATUS_INVALID_IMAGE_WIN_64:
ERR( "%s 64-bit application not supported in 32-bit prefix\n",
debugstr_us(&params->ImagePathName) );
......@@ -4109,14 +4106,15 @@ static void process_init(void)
teb->Tib.StackBase = stack.StackBase;
teb->Tib.StackLimit = stack.StackLimit;
teb->DeallocationStack = stack.DeallocationStack;
return STATUS_SUCCESS;
}
/***********************************************************************
* __wine_set_unix_funcs
*/
void CDECL __wine_set_unix_funcs( int version, const struct unix_funcs *funcs )
NTSTATUS CDECL __wine_set_unix_funcs( int version, const struct unix_funcs *funcs )
{
assert( version == NTDLL_UNIXLIB_VERSION );
unix_funcs = funcs;
process_init();
return process_init();
}
......@@ -99,7 +99,7 @@ NTSTATUS (WINAPI *pKiUserExceptionDispatcher)(EXCEPTION_RECORD*,CONTEXT*) = NULL
void (WINAPI *pLdrInitializeThunk)(CONTEXT*,void**,ULONG_PTR,ULONG_PTR) = NULL;
void (WINAPI *pRtlUserThreadStart)( PRTL_THREAD_START_ROUTINE entry, void *arg ) = NULL;
static void (CDECL *p__wine_set_unix_funcs)( int version, const struct unix_funcs *funcs );
static NTSTATUS (CDECL *p__wine_set_unix_funcs)( int version, const struct unix_funcs *funcs );
#ifdef __GNUC__
static void fatal_error( const char *err, ... ) __attribute__((noreturn, format(printf,1,2)));
......@@ -1367,7 +1367,6 @@ static struct unix_funcs unix_funcs =
get_unix_codepage_data,
get_locales,
virtual_release_address_space,
exec_process,
set_show_dot_files,
load_so_dll,
load_builtin_dll,
......@@ -1387,6 +1386,7 @@ static struct unix_funcs unix_funcs =
static void start_main_thread(void)
{
BOOL suspend;
NTSTATUS status;
TEB *teb = virtual_alloc_first_teb();
signal_init_threading();
......@@ -1399,7 +1399,8 @@ static void start_main_thread(void)
init_cpu_info();
init_files();
NtCreateKeyedEvent( &keyed_event, GENERIC_READ | GENERIC_WRITE, NULL, 0 );
p__wine_set_unix_funcs( NTDLL_UNIXLIB_VERSION, &unix_funcs );
status = p__wine_set_unix_funcs( NTDLL_UNIXLIB_VERSION, &unix_funcs );
if (status) exec_process( status );
server_init_process_done();
}
......
......@@ -613,7 +613,7 @@ static NTSTATUS spawn_process( const RTL_USER_PROCESS_PARAMETERS *params, int so
/***********************************************************************
* exec_process
*/
NTSTATUS CDECL exec_process( NTSTATUS status )
void DECLSPEC_NORETURN exec_process( NTSTATUS status )
{
RTL_USER_PROCESS_PARAMETERS *params = NtCurrentTeb()->Peb->ProcessParameters;
pe_image_info_t pe_info;
......@@ -621,7 +621,7 @@ NTSTATUS CDECL exec_process( NTSTATUS status )
char **argv;
HANDLE handle;
if (startup_info_size) return status; /* started from another Win32 process */
if (startup_info_size) goto done; /* started from another Win32 process */
switch (status)
{
......@@ -631,10 +631,10 @@ NTSTATUS CDECL exec_process( NTSTATUS status )
case STATUS_INVALID_IMAGE_NOT_MZ:
{
UNICODE_STRING image;
if (getenv( "WINEPRELOADRESERVE" )) return status;
if (getenv( "WINEPRELOADRESERVE" )) goto done;
image.Buffer = get_nt_pathname( &params->ImagePathName );
image.Length = wcslen( image.Buffer ) * sizeof(WCHAR);
if ((status = get_pe_file_info( &image, &handle, &pe_info ))) return status;
if ((status = get_pe_file_info( &image, &handle, &pe_info ))) goto done;
break;
}
case STATUS_INVALID_IMAGE_WIN_16:
......@@ -645,12 +645,16 @@ NTSTATUS CDECL exec_process( NTSTATUS status )
pe_info.cpu = CPU_x86;
break;
default:
return status;
goto done;
}
unixdir = get_unix_curdir( params );
if (socketpair( PF_UNIX, SOCK_STREAM, 0, socketfd ) == -1) return STATUS_TOO_MANY_OPENED_FILES;
if (socketpair( PF_UNIX, SOCK_STREAM, 0, socketfd ) == -1)
{
status = STATUS_TOO_MANY_OPENED_FILES;
goto done;
}
#ifdef SO_PASSCRED
else
{
......@@ -671,7 +675,11 @@ NTSTATUS CDECL exec_process( NTSTATUS status )
if (!status)
{
if (!(argv = build_argv( &params->CommandLine, 2 ))) return STATUS_NO_MEMORY;
if (!(argv = build_argv( &params->CommandLine, 2 )))
{
status = STATUS_NO_MEMORY;
goto done;
}
fchdir( unixdir );
do
{
......@@ -685,7 +693,19 @@ NTSTATUS CDECL exec_process( NTSTATUS status )
free( argv );
}
close( socketfd[0] );
return status;
done:
switch (status)
{
case STATUS_INVALID_IMAGE_FORMAT:
case STATUS_INVALID_IMAGE_NOT_MZ:
ERR( "%s not supported on this system\n", debugstr_us(&params->ImagePathName) );
break;
default:
ERR( "failed to load %s error %x\n", debugstr_us(&params->ImagePathName), status );
break;
}
for (;;) NtTerminateProcess( GetCurrentProcess(), status );
}
......
......@@ -117,7 +117,6 @@ extern USHORT * CDECL get_unix_codepage_data(void) DECLSPEC_HIDDEN;
extern void CDECL get_locales( WCHAR *sys, WCHAR *user ) DECLSPEC_HIDDEN;
extern void CDECL virtual_release_address_space(void) DECLSPEC_HIDDEN;
extern NTSTATUS CDECL exec_process( NTSTATUS status ) DECLSPEC_HIDDEN;
extern NTSTATUS CDECL unwind_builtin_dll( ULONG type, struct _DISPATCHER_CONTEXT *dispatch,
CONTEXT *context ) DECLSPEC_HIDDEN;
......@@ -220,6 +219,7 @@ extern void signal_init_process(void) DECLSPEC_HIDDEN;
extern void DECLSPEC_NORETURN signal_start_thread( PRTL_THREAD_START_ROUTINE entry, void *arg,
BOOL suspend, void *thunk, TEB *teb ) DECLSPEC_HIDDEN;
extern void DECLSPEC_NORETURN signal_exit_thread( int status, void (*func)(int) ) DECLSPEC_HIDDEN;
extern void DECLSPEC_NORETURN exec_process( NTSTATUS status ) DECLSPEC_HIDDEN;
extern void __wine_syscall_dispatcher(void) DECLSPEC_HIDDEN;
extern void fill_vm_counters( VM_COUNTERS_EX *pvmi, int unix_pid ) DECLSPEC_HIDDEN;
......
......@@ -27,7 +27,7 @@
struct _DISPATCHER_CONTEXT;
/* increment this when you change the function table */
#define NTDLL_UNIXLIB_VERSION 103
#define NTDLL_UNIXLIB_VERSION 104
struct unix_funcs
{
......@@ -81,9 +81,6 @@ struct unix_funcs
/* virtual memory functions */
void (CDECL *virtual_release_address_space)(void);
/* thread/process functions */
NTSTATUS (CDECL *exec_process)( NTSTATUS status );
/* file functions */
void (CDECL *set_show_dot_files)( BOOL enable );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment