Commit a003f0ae authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Store the kernel32 process entry point in a global variable.

parent 30215311
......@@ -100,12 +100,6 @@ struct builtin_load_info
static struct builtin_load_info default_load_info;
static struct builtin_load_info *builtin_load_info = &default_load_info;
struct start_params
{
void *kernel_start;
LPTHREAD_START_ROUTINE entry;
};
static HANDLE main_exe_file;
static UINT tls_module_count; /* number of modules with TLS directory */
static IMAGE_TLS_DIRECTORY *tls_dirs; /* array of TLS directories */
......@@ -3106,8 +3100,7 @@ static void load_global_options(void)
*/
static void start_process( void *arg )
{
struct start_params *start_params = (struct start_params *)arg;
call_thread_entry_point( start_params->kernel_start, start_params->entry );
call_thread_entry_point( kernel32_start_process, arg );
}
/******************************************************************
......@@ -3122,8 +3115,8 @@ void WINAPI LdrInitializeThunk( void *kernel_start, ULONG_PTR unknown2,
WINE_MODREF *wm;
LPCWSTR load_path;
PEB *peb = NtCurrentTeb()->Peb;
struct start_params start_params;
kernel32_start_process = kernel_start;
if (main_exe_file) NtClose( main_exe_file ); /* at this point the main module is created */
/* allocate the modref for the main exe (if not already done) */
......@@ -3159,16 +3152,12 @@ void WINAPI LdrInitializeThunk( void *kernel_start, ULONG_PTR unknown2,
if ((status = fixup_imports( wm, load_path )) != STATUS_SUCCESS) goto error;
heap_set_debug_flags( GetProcessHeap() );
/* Store original entrypoint (in case it gets corrupted) */
start_params.kernel_start = kernel_start;
start_params.entry = wm->ldr.EntryPoint;
status = wine_call_on_stack( attach_process_dlls, wm, NtCurrentTeb()->Tib.StackBase );
if (status != STATUS_SUCCESS) goto error;
virtual_release_address_space();
virtual_clear_thread_stack();
wine_switch_to_stack( start_process, &start_params, NtCurrentTeb()->Tib.StackBase );
wine_switch_to_stack( start_process, wm->ldr.EntryPoint, NtCurrentTeb()->Tib.StackBase );
error:
ERR( "Main exe initialization for %s failed, status %x\n",
......
......@@ -114,6 +114,7 @@ extern UNICODE_STRING system_dir DECLSPEC_HIDDEN;
typedef LONG (WINAPI *PUNHANDLED_EXCEPTION_FILTER)(PEXCEPTION_POINTERS);
extern PUNHANDLED_EXCEPTION_FILTER unhandled_exception_filter DECLSPEC_HIDDEN;
extern LPTHREAD_START_ROUTINE kernel32_start_process DECLSPEC_HIDDEN;
/* redefine these to make sure we don't reference kernel symbols */
#define GetProcessHeap() (NtCurrentTeb()->Peb->ProcessHeap)
......
......@@ -51,6 +51,7 @@ WINE_DECLARE_DEBUG_CHANNEL(relay);
struct _KUSER_SHARED_DATA *user_shared_data = NULL;
PUNHANDLED_EXCEPTION_FILTER unhandled_exception_filter = NULL;
LPTHREAD_START_ROUTINE kernel32_start_process = NULL;
/* info passed to a starting thread */
struct startup_info
......
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