ntdll: Move some initializations out of thread_init().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
b7db0b52ce
commit
608d086f1b
|
@ -4234,8 +4234,22 @@ void __wine_process_init(void)
|
|||
UNICODE_STRING nt_name;
|
||||
void * (CDECL *init_func)(void);
|
||||
INITIAL_TEB stack;
|
||||
BOOL suspend;
|
||||
SIZE_T info_size;
|
||||
TEB *teb = thread_init();
|
||||
PEB *peb = teb->Peb;
|
||||
|
||||
thread_init();
|
||||
/* setup the server connection */
|
||||
server_init_process();
|
||||
info_size = server_init_thread( peb, &suspend );
|
||||
|
||||
peb->ProcessHeap = RtlCreateHeap( HEAP_GROWABLE, NULL, 0, 0, NULL, NULL );
|
||||
peb->LoaderLock = &loader_section;
|
||||
|
||||
init_directories();
|
||||
init_user_process_params( info_size );
|
||||
|
||||
NtCreateKeyedEvent( &keyed_event, GENERIC_READ | GENERIC_WRITE, NULL, 0 );
|
||||
|
||||
/* retrieve current umask */
|
||||
FILE_umask = umask(0777);
|
||||
|
@ -4263,7 +4277,7 @@ void __wine_process_init(void)
|
|||
|
||||
kernel32_start_process = init_func();
|
||||
|
||||
wm = get_modref( NtCurrentTeb()->Peb->ImageBaseAddress );
|
||||
wm = get_modref( peb->ImageBaseAddress );
|
||||
assert( wm );
|
||||
if (wm->ldr.Flags & LDR_IMAGE_IS_DLL)
|
||||
{
|
||||
|
@ -4271,24 +4285,18 @@ void __wine_process_init(void)
|
|||
exit(1);
|
||||
}
|
||||
|
||||
NtCurrentTeb()->Peb->LoaderLock = &loader_section;
|
||||
virtual_set_large_address_space();
|
||||
|
||||
/* the main exe needs to be the first in the load order list */
|
||||
RemoveEntryList( &wm->ldr.InLoadOrderModuleList );
|
||||
InsertHeadList( &NtCurrentTeb()->Peb->LdrData->InLoadOrderModuleList, &wm->ldr.InLoadOrderModuleList );
|
||||
InsertHeadList( &peb->LdrData->InLoadOrderModuleList, &wm->ldr.InLoadOrderModuleList );
|
||||
RemoveEntryList( &wm->ldr.InMemoryOrderModuleList );
|
||||
InsertHeadList( &NtCurrentTeb()->Peb->LdrData->InMemoryOrderModuleList, &wm->ldr.InMemoryOrderModuleList );
|
||||
InsertHeadList( &peb->LdrData->InMemoryOrderModuleList, &wm->ldr.InMemoryOrderModuleList );
|
||||
|
||||
if ((status = virtual_alloc_thread_stack( &stack, 0, 0, NULL )) != STATUS_SUCCESS)
|
||||
{
|
||||
ERR( "Main exe initialization for %s failed, status %x\n",
|
||||
debugstr_w(wm->ldr.FullDllName.Buffer), status );
|
||||
NtTerminateProcess( GetCurrentProcess(), status );
|
||||
}
|
||||
NtCurrentTeb()->Tib.StackBase = stack.StackBase;
|
||||
NtCurrentTeb()->Tib.StackLimit = stack.StackLimit;
|
||||
NtCurrentTeb()->DeallocationStack = stack.DeallocationStack;
|
||||
virtual_alloc_thread_stack( &stack, 0, 0, NULL );
|
||||
teb->Tib.StackBase = stack.StackBase;
|
||||
teb->Tib.StackLimit = stack.StackLimit;
|
||||
teb->DeallocationStack = stack.DeallocationStack;
|
||||
|
||||
server_init_process_done();
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ extern void DECLSPEC_NORETURN signal_exit_thread( int status ) DECLSPEC_HIDDEN;
|
|||
extern void DECLSPEC_NORETURN signal_exit_process( int status ) DECLSPEC_HIDDEN;
|
||||
extern void version_init(void) DECLSPEC_HIDDEN;
|
||||
extern void debug_init(void) DECLSPEC_HIDDEN;
|
||||
extern void thread_init(void) DECLSPEC_HIDDEN;
|
||||
extern TEB *thread_init(void) DECLSPEC_HIDDEN;
|
||||
extern void actctx_init(void) DECLSPEC_HIDDEN;
|
||||
extern void virtual_init(void) DECLSPEC_HIDDEN;
|
||||
extern void virtual_init_threading(void) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -220,12 +220,11 @@ static void set_process_name( int argc, char *argv[] )
|
|||
*
|
||||
* NOTES: The first allocated TEB on NT is at 0x7ffde000.
|
||||
*/
|
||||
void thread_init(void)
|
||||
TEB *thread_init(void)
|
||||
{
|
||||
TEB *teb;
|
||||
void *addr;
|
||||
BOOL suspend;
|
||||
SIZE_T size, info_size;
|
||||
SIZE_T size;
|
||||
LARGE_INTEGER now;
|
||||
NTSTATUS status;
|
||||
struct ntdll_thread_data *thread_data;
|
||||
|
@ -299,21 +298,7 @@ void thread_init(void)
|
|||
signal_init_thread( teb );
|
||||
virtual_init_threading();
|
||||
debug_init();
|
||||
|
||||
/* setup the server connection */
|
||||
server_init_process();
|
||||
info_size = server_init_thread( peb, &suspend );
|
||||
|
||||
/* create the process heap */
|
||||
if (!(peb->ProcessHeap = RtlCreateHeap( HEAP_GROWABLE, NULL, 0, 0, NULL, NULL )))
|
||||
{
|
||||
MESSAGE( "wine: failed to create the process heap\n" );
|
||||
exit(1);
|
||||
}
|
||||
|
||||
set_process_name( __wine_main_argc, __wine_main_argv );
|
||||
init_directories();
|
||||
init_user_process_params( info_size );
|
||||
|
||||
/* initialize time values in user_shared_data */
|
||||
NtQuerySystemTime( &now );
|
||||
|
@ -323,10 +308,9 @@ void thread_init(void)
|
|||
user_shared_data->u.TickCount.High2Time = user_shared_data->u.TickCount.High1Time;
|
||||
user_shared_data->TickCountLowDeprecated = user_shared_data->u.TickCount.LowPart;
|
||||
user_shared_data->TickCountMultiplier = 1 << 24;
|
||||
|
||||
fill_cpu_info();
|
||||
|
||||
NtCreateKeyedEvent( &keyed_event, GENERIC_READ | GENERIC_WRITE, NULL, 0 );
|
||||
return teb;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue