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