From 81e72d8f2db77276dd86c027055f18798086a63a Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 20 May 2003 19:21:43 +0000 Subject: [PATCH] Moved all process initialisation code to process.c and removed loader/main.c. --- dlls/ntdll/Makefile.in | 1 - loader/main.c | 98 ------------------------------------------ loader/task.c | 12 ++++++ scheduler/process.c | 22 ++++++++-- 4 files changed, 31 insertions(+), 102 deletions(-) delete mode 100644 loader/main.c diff --git a/dlls/ntdll/Makefile.in b/dlls/ntdll/Makefile.in index 5c7dcf691ba..22c4769066f 100644 --- a/dlls/ntdll/Makefile.in +++ b/dlls/ntdll/Makefile.in @@ -18,7 +18,6 @@ C_SRCS = \ $(TOPOBJDIR)/if1632/relay.c \ $(TOPOBJDIR)/if1632/snoop.c \ $(TOPOBJDIR)/loader/loadorder.c \ - $(TOPOBJDIR)/loader/main.c \ $(TOPOBJDIR)/loader/module.c \ $(TOPOBJDIR)/loader/pe_image.c \ $(TOPOBJDIR)/loader/task.c \ diff --git a/loader/main.c b/loader/main.c deleted file mode 100644 index 8e238050ec9..00000000000 --- a/loader/main.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Main initialization code - * - * Copyright 1998 Ulrich Weigand - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "config.h" -#include "wine/port.h" - -#include -#include -#include -#include -#include -#ifdef HAVE_UNISTD_H -# include -#endif -#include -#include -#ifdef MALLOC_DEBUGGING -# include -#endif -#include "windef.h" -#include "wine/winbase16.h" -#include "drive.h" -#include "file.h" -#include "options.h" -#include "wine/debug.h" -#include "wine/server.h" - -WINE_DEFAULT_DEBUG_CHANNEL(server); - -extern void SHELL_LoadRegistry(void); - -/*********************************************************************** - * Main initialisation routine - */ -BOOL MAIN_MainInit(void) -{ -#ifdef MALLOC_DEBUGGING - char *trace; - - mcheck(NULL); - if (!(trace = getenv("MALLOC_TRACE"))) - MESSAGE( "MALLOC_TRACE not set. No trace generated\n" ); - else - { - MESSAGE( "malloc trace goes to %s\n", trace ); - mtrace(); - } -#endif - setbuf(stdout,NULL); - setbuf(stderr,NULL); - setlocale(LC_CTYPE,""); - - /* Initialise DOS drives */ - if (!DRIVE_Init()) return FALSE; - - /* Initialise DOS directories */ - if (!DIR_Init()) return FALSE; - - /* Registry initialisation */ - SHELL_LoadRegistry(); - - /* Global boot finished, the rest is process-local */ - CLIENT_BootDone( TRACE_ON(server) ); - - return TRUE; -} - - -/*********************************************************************** - * ExitKernel (KERNEL.2) - * - * Clean-up everything and exit the Wine process. - * - */ -void WINAPI ExitKernel16( void ) -{ - /* Do the clean-up stuff */ - - WriteOutProfiles16(); - TerminateProcess( GetCurrentProcess(), 0 ); -} diff --git a/loader/task.c b/loader/task.c index 034d4b063e4..b7d5b859108 100644 --- a/loader/task.c +++ b/loader/task.c @@ -525,6 +525,18 @@ void TASK_ExitTask(void) } +/*********************************************************************** + * ExitKernel (KERNEL.2) + * + * Clean-up everything and exit the Wine process. + */ +void WINAPI ExitKernel16(void) +{ + WriteOutProfiles16(); + TerminateProcess( GetCurrentProcess(), 0 ); +} + + /*********************************************************************** * InitTask (KERNEL.91) * diff --git a/scheduler/process.c b/scheduler/process.c index 4f54ed211df..c8cc6324066 100644 --- a/scheduler/process.c +++ b/scheduler/process.c @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -49,6 +50,7 @@ #include "ntdll_misc.h" WINE_DEFAULT_DEBUG_CHANNEL(process); +WINE_DECLARE_DEBUG_CHANNEL(server); WINE_DECLARE_DEBUG_CHANNEL(relay); WINE_DECLARE_DEBUG_CHANNEL(snoop); WINE_DECLARE_DEBUG_CHANNEL(win32); @@ -134,7 +136,7 @@ extern STARTUPINFOA current_startupinfo; extern void PTHREAD_init_done(void); extern void RELAY_InitDebugLists(void); -extern BOOL MAIN_MainInit(void); +extern void SHELL_LoadRegistry(void); extern void VERSION_Init( const char *appname ); /*********************************************************************** @@ -292,6 +294,10 @@ static BOOL process_init( char *argv[] ) BOOL ret; size_t info_size = 0; + setbuf(stdout,NULL); + setbuf(stderr,NULL); + setlocale(LC_CTYPE,""); + /* store the program name */ argv0 = argv[0]; @@ -372,10 +378,20 @@ static BOOL process_init( char *argv[] ) process_pmts.CurrentDirectoryName.Buffer[3] = '\0'; /* */ - ret = MAIN_MainInit(); + /* initialise DOS drives */ + if (!DRIVE_Init()) return FALSE; + + /* initialise DOS directories */ + if (!DIR_Init()) return FALSE; + + /* registry initialisation */ + SHELL_LoadRegistry(); + + /* global boot finished, the rest is process-local */ + CLIENT_BootDone( TRACE_ON(server) ); if (TRACE_ON(relay) || TRACE_ON(snoop)) RELAY_InitDebugLists(); - return ret; + return TRUE; }