- Indicate that StrRetToStrN{A|W} and StrRetToBuf{A|W} are identical
[wine] / loader / main.c
1 /*
2  * Main initialization code
3  */
4
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 "module.h"
22 #include "debugtools.h"
23 #include "wine/server.h"
24
25 DEFAULT_DEBUG_CHANNEL(server);
26
27 extern void SHELL_LoadRegistry(void);
28
29 /***********************************************************************
30  *           Main initialisation routine
31  */
32 BOOL MAIN_MainInit(void)
33 {
34 #ifdef MALLOC_DEBUGGING
35     char *trace;
36
37     mcheck(NULL);
38     if (!(trace = getenv("MALLOC_TRACE")))
39         MESSAGE( "MALLOC_TRACE not set. No trace generated\n" );
40     else
41     {
42         MESSAGE( "malloc trace goes to %s\n", trace );
43         mtrace();
44     }
45 #endif
46     setbuf(stdout,NULL);
47     setbuf(stderr,NULL);
48     setlocale(LC_CTYPE,"");
49
50     /* Load the configuration file */
51     if (!PROFILE_LoadWineIni()) return FALSE;
52
53     /* Initialise DOS drives */
54     if (!DRIVE_Init()) return FALSE;
55
56     /* Initialise DOS directories */
57     if (!DIR_Init()) return FALSE;
58
59     /* Registry initialisation */
60     SHELL_LoadRegistry();
61
62     /* Initialize module loadorder */
63     if (CLIENT_IsBootThread()) MODULE_InitLoadOrder();
64
65     /* Global boot finished, the rest is process-local */
66     CLIENT_BootDone( TRACE_ON(server) );
67
68     return TRUE;
69 }
70
71
72 /***********************************************************************
73  *           ExitKernel (KERNEL.2)
74  *
75  * Clean-up everything and exit the Wine process.
76  *
77  */
78 void WINAPI ExitKernel16( void )
79 {
80     /* Do the clean-up stuff */
81
82     WriteOutProfiles16();
83     TerminateProcess( GetCurrentProcess(), 0 );
84 }
85