Don't use constructors for ntdll and kernel32 initialization.

This commit is contained in:
Alexandre Julliard 2004-01-07 04:50:11 +00:00
parent 5d267d7372
commit af542075e7
7 changed files with 20 additions and 12 deletions

View File

@ -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 );

View File

@ -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,"");

View File

@ -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 */

View File

@ -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;

View File

@ -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);

View File

@ -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 = &params;
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 );

View File

@ -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 */
}
/***********************************************************************