diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c index 21185117a3b..868cc042ddb 100644 --- a/dlls/kernel32/process.c +++ b/dlls/kernel32/process.c @@ -1022,6 +1022,18 @@ void __wine_kernel_init(void) RtlInitUnicodeString( &NtCurrentTeb()->Peb->ProcessParameters->DllPath, MODULE_get_dll_load_path(main_exe_name) ); + if (boot_event) + { + if (WaitForSingleObject( boot_event, 30000 )) WARN( "boot event wait timed out\n" ); + CloseHandle( boot_event ); + /* if we didn't find environment section, try again now that wineboot has run */ + if (!got_environment) + { + set_registry_environment(); + set_additional_environment(); + } + } + if (!(peb->ImageBaseAddress = LoadLibraryExW( main_exe_name, 0, DONT_RESOLVE_DLL_REFERENCES ))) { char msg[1024]; @@ -1041,18 +1053,6 @@ void __wine_kernel_init(void) ExitProcess( error ); } - if (boot_event) - { - if (WaitForSingleObject( boot_event, 30000 )) WARN( "boot event wait timed out\n" ); - CloseHandle( boot_event ); - /* if we didn't find environment section, try again now that wineboot has run */ - if (!got_environment) - { - set_registry_environment(); - set_additional_environment(); - } - } - LdrInitializeThunk( 0, 0, 0, 0 ); /* switch to the new stack */ wine_switch_to_stack( start_process, NULL, NtCurrentTeb()->Tib.StackBase );