Commit c9d85dd5 authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Route the process startup through the platform-specific thread startup code.

parent 8824deb6
......@@ -47,7 +47,6 @@
#include "wine/winuser16.h"
#include "winternl.h"
#include "kernel_private.h"
#include "wine/exception.h"
#include "wine/server.h"
#include "wine/unicode.h"
#include "wine/debug.h"
......@@ -930,11 +929,8 @@ static void start_wineboot( HANDLE handles[2] )
*
* Startup routine of a new process. Runs on the new process stack.
*/
static void start_process( void *arg )
static DWORD WINAPI start_process( PEB *peb )
{
__TRY
{
PEB *peb = NtCurrentTeb()->Peb;
IMAGE_NT_HEADERS *nt;
LPTHREAD_START_ROUTINE entry;
......@@ -955,13 +951,7 @@ static void start_process( void *arg )
SetLastError( 0 ); /* clear error code */
if (peb->BeingDebugged) DbgBreakPoint();
ExitThread( entry( peb ) );
}
__EXCEPT(UnhandledExceptionFilter)
{
TerminateThread( GetCurrentThread(), GetExceptionCode() );
}
__ENDTRY
return entry( peb );
}
......@@ -1125,9 +1115,7 @@ void CDECL __wine_kernel_init(void)
ExitProcess( error );
}
LdrInitializeThunk( 0, 0, 0, 0 );
/* switch to the new stack */
wine_switch_to_stack( start_process, NULL, NtCurrentTeb()->Tib.StackBase );
LdrInitializeThunk( start_process, 0, 0, 0 );
error:
ExitProcess( GetLastError() );
......
......@@ -2444,11 +2444,20 @@ static NTSTATUS attach_process_dlls( void *wm )
}
/***********************************************************************
* start_process
*/
static void start_process( void *kernel_start )
{
call_thread_entry_point( kernel_start, NtCurrentTeb()->Peb );
}
/******************************************************************
* LdrInitializeThunk (NTDLL.@)
*
*/
void WINAPI LdrInitializeThunk( ULONG unknown1, ULONG unknown2, ULONG unknown3, ULONG unknown4 )
void WINAPI LdrInitializeThunk( void *kernel_start, ULONG_PTR unknown2,
ULONG_PTR unknown3, ULONG_PTR unknown4 )
{
NTSTATUS status;
WINE_MODREF *wm;
......@@ -2489,7 +2498,7 @@ void WINAPI LdrInitializeThunk( ULONG unknown1, ULONG unknown2, ULONG unknown3,
virtual_release_address_space( nt->FileHeader.Characteristics & IMAGE_FILE_LARGE_ADDRESS_AWARE );
virtual_clear_thread_stack();
return;
wine_switch_to_stack( start_process, kernel_start, NtCurrentTeb()->Tib.StackBase );
error:
ERR( "Main exe initialization for %s failed, status %x\n",
......
......@@ -1980,7 +1980,7 @@ NTSYSAPI NTSTATUS WINAPI LdrDisableThreadCalloutsForDll(HMODULE);
NTSYSAPI NTSTATUS WINAPI LdrFindEntryForAddress(const void*, PLDR_MODULE*);
NTSYSAPI NTSTATUS WINAPI LdrGetDllHandle(LPCWSTR, ULONG, const UNICODE_STRING*, HMODULE*);
NTSYSAPI NTSTATUS WINAPI LdrGetProcedureAddress(HMODULE, const ANSI_STRING*, ULONG, void**);
NTSYSAPI void WINAPI LdrInitializeThunk(ULONG,ULONG,ULONG,ULONG);
NTSYSAPI void WINAPI LdrInitializeThunk(void*,ULONG_PTR,ULONG_PTR,ULONG_PTR);
NTSYSAPI NTSTATUS WINAPI LdrLoadDll(LPCWSTR, DWORD, const UNICODE_STRING*, HMODULE*);
NTSYSAPI NTSTATUS WINAPI LdrLockLoaderLock(ULONG,ULONG*,ULONG*);
IMAGE_BASE_RELOCATION * WINAPI LdrProcessRelocationBlock(void*,UINT,USHORT*,INT_PTR);
......
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