Change the callback declarations to a safer format.
[wine.git] / loader / main.c
blob52f19813676dd3eba412ca2acede2823669e55ed
1 /*
2 * Main initialization code
3 */
5 #include <locale.h>
6 #include <stdlib.h>
7 #include <sys/types.h>
8 #include <sys/stat.h>
9 #include <fcntl.h>
10 #include <unistd.h>
11 #include <stdio.h>
12 #include <string.h>
13 #ifdef MALLOC_DEBUGGING
14 # include <malloc.h>
15 #endif
16 #include "windef.h"
17 #include "wine/winbase16.h"
18 #include "drive.h"
19 #include "file.h"
20 #include "options.h"
21 #include "debugtools.h"
22 #include "server.h"
23 #include "loadorder.h"
25 DEFAULT_DEBUG_CHANNEL(server);
27 extern void SHELL_LoadRegistry(void);
29 /***********************************************************************
30 * Main initialisation routine
32 BOOL MAIN_MainInit(void)
34 #ifdef MALLOC_DEBUGGING
35 char *trace;
37 mcheck(NULL);
38 if (!(trace = getenv("MALLOC_TRACE")))
39 MESSAGE( "MALLOC_TRACE not set. No trace generated\n" );
40 else
42 MESSAGE( "malloc trace goes to %s\n", trace );
43 mtrace();
45 #endif
46 setbuf(stdout,NULL);
47 setbuf(stderr,NULL);
48 setlocale(LC_CTYPE,"");
50 /* Load the configuration file */
51 if (!PROFILE_LoadWineIni()) return FALSE;
53 /* Initialise DOS drives */
54 if (!DRIVE_Init()) return FALSE;
56 /* Initialise DOS directories */
57 if (!DIR_Init()) return FALSE;
59 /* Registry initialisation */
60 SHELL_LoadRegistry();
62 /* Global boot finished, the rest is process-local */
63 CLIENT_BootDone( TRACE_ON(server) );
65 /* Initialize module loadorder */
66 if (!MODULE_InitLoadOrder()) return FALSE;
68 return TRUE;
72 /***********************************************************************
73 * ExitKernel16 (KERNEL.2)
75 * Clean-up everything and exit the Wine process.
78 void WINAPI ExitKernel16( void )
80 /* Do the clean-up stuff */
82 WriteOutProfiles16();
83 TerminateProcess( GetCurrentProcess(), 0 );