From af542075e7015ff151f5cd84937a072c6aac2faf Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 7 Jan 2004 04:50:11 +0000 Subject: [PATCH] Don't use constructors for ntdll and kernel32 initialization. --- dlls/kernel/kernel_private.h | 1 + dlls/kernel/process.c | 2 ++ dlls/kernel/pthread.c | 9 +++++---- dlls/ntdll/debugtools.c | 2 +- dlls/ntdll/ntdll_misc.h | 2 ++ dlls/ntdll/thread.c | 8 +++++--- dlls/ntdll/virtual.c | 8 ++++---- 7 files changed, 20 insertions(+), 12 deletions(-) diff --git a/dlls/kernel/kernel_private.h b/dlls/kernel/kernel_private.h index d2afc0bba55..21985b6856d 100644 --- a/dlls/kernel/kernel_private.h +++ b/dlls/kernel/kernel_private.h @@ -49,6 +49,7 @@ static inline HANDLE console_handle_unmap(HANDLE h) extern HANDLE dos_handles[DOS_TABLE_SIZE]; void FILE_ConvertOFMode( INT mode, DWORD *access, DWORD *sharing ); +extern void PTHREAD_Init(void); extern BOOL WOWTHUNK_Init(void); extern VOID SYSLEVEL_CheckNotLevel( INT level ); diff --git a/dlls/kernel/process.c b/dlls/kernel/process.c index 23e51c94e6d..20111626f20 100644 --- a/dlls/kernel/process.c +++ b/dlls/kernel/process.c @@ -619,6 +619,8 @@ static BOOL process_init( char *argv[], char **environ ) PEB *peb = NtCurrentTeb()->Peb; HANDLE hstdin, hstdout, hstderr; + PTHREAD_Init(); + setbuf(stdout,NULL); setbuf(stderr,NULL); setlocale(LC_CTYPE,""); diff --git a/dlls/kernel/pthread.c b/dlls/kernel/pthread.c index ef3b7beefbb..1bf8e5da9e5 100644 --- a/dlls/kernel/pthread.c +++ b/dlls/kernel/pthread.c @@ -51,10 +51,6 @@ #define P_OUTPUT(stuff) write(2,stuff,strlen(stuff)) -static const struct wine_pthread_functions functions; - -DECL_GLOBAL_CONSTRUCTOR(pthread_init) { wine_pthread_init_process( &functions ); } - /* NOTE: This is a truly extremely incredibly ugly hack! * But it does seem to work... */ @@ -575,4 +571,9 @@ static const struct wine_pthread_functions functions = wine_pthread_cond_timedwait /* ptr_pthread_cond_timedwait */ }; +void PTHREAD_Init(void) +{ + wine_pthread_init_process( &functions ); +} + #endif /* HAVE_PTHREAD_H */ diff --git a/dlls/ntdll/debugtools.c b/dlls/ntdll/debugtools.c index 1b227c57f47..63cb8ffe39d 100644 --- a/dlls/ntdll/debugtools.c +++ b/dlls/ntdll/debugtools.c @@ -305,7 +305,7 @@ static int NTDLL_dbg_vlog( unsigned int cls, const char *channel, /*********************************************************************** * debug_init */ -DECL_GLOBAL_CONSTRUCTOR(debug_init) +void debug_init(void) { __wine_dbgstr_an = NTDLL_dbgstr_an; __wine_dbgstr_wn = NTDLL_dbgstr_wn; diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h index d81cc1364ad..c6d944e4d7b 100644 --- a/dlls/ntdll/ntdll_misc.h +++ b/dlls/ntdll/ntdll_misc.h @@ -47,7 +47,9 @@ extern NTSTATUS NTDLL_wait_for_multiple_objects( UINT count, const HANDLE *handl /* init routines */ extern BOOL SIGNAL_Init(void); +extern void debug_init(void); extern void thread_init(void); +extern void virtual_init(void); /* server support */ extern void server_init_process(void); diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c index c029f70f29d..8a0fcca8d62 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c @@ -106,9 +106,6 @@ void thread_init(void) struct wine_pthread_thread_info thread_info; static struct debug_info debug_info; /* debug info for initial thread */ - debug_info.str_pos = debug_info.strings; - debug_info.out_pos = debug_info.output; - peb.ProcessParameters = ¶ms; peb.TlsBitmap = &tls_bitmap; peb.LdrData = &ldr; @@ -134,6 +131,11 @@ void thread_init(void) thread_info.teb_sel = teb->teb_sel; wine_pthread_init_thread( &thread_info ); + debug_info.str_pos = debug_info.strings; + debug_info.out_pos = debug_info.output; + debug_init(); + virtual_init(); + /* setup the server connection */ server_init_process(); server_init_thread( thread_info.pid, thread_info.tid, NULL ); diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c index 967d8061ee9..3245854c842 100644 --- a/dlls/ntdll/virtual.c +++ b/dlls/ntdll/virtual.c @@ -785,19 +785,19 @@ static BOOL is_current_process( HANDLE handle ) /*********************************************************************** - * VIRTUAL_Init + * virtual_init */ -#ifndef page_mask -DECL_GLOBAL_CONSTRUCTOR(VIRTUAL_Init) +void virtual_init(void) { +#ifndef page_mask page_size = getpagesize(); page_mask = page_size - 1; /* Make sure we have a power of 2 */ assert( !(page_size & page_mask) ); page_shift = 0; while ((1 << page_shift) != page_size) page_shift++; -} #endif /* page_mask */ +} /*********************************************************************** -- 2.11.4.GIT