Moved all process initialisation code to process.c and removed

loader/main.c.
This commit is contained in:
Alexandre Julliard 2003-05-20 19:21:43 +00:00
parent b350438074
commit 81e72d8f2d
4 changed files with 31 additions and 102 deletions

View File

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

View File

@ -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 <locale.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <stdio.h>
#include <string.h>
#ifdef MALLOC_DEBUGGING
# include <malloc.h>
#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 );
}

View File

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

View File

@ -23,6 +23,7 @@
#include <assert.h>
#include <ctype.h>
#include <locale.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
@ -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';
/* </hack: to be changed later on> */
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;
}