Update the modemn status bit that indicates whether the RLSD line is
[wine.git] / loader / main.c
blobd859bfd5fe6b221420edaf39d7915064fab67151
1 /*
2 * Main initialization code
3 */
5 #include <stdlib.h>
6 #include <sys/types.h>
7 #include <sys/stat.h>
8 #include <fcntl.h>
9 #include <unistd.h>
10 #include <string.h>
11 #include <errno.h>
12 #include "windows.h"
13 #include "bitmap.h"
14 #include "comm.h"
15 #include "win.h"
16 #include "main.h"
17 #include "menu.h"
18 #include "message.h"
19 #include "multimedia.h"
20 #include "atom.h"
21 #include "dialog.h"
22 #include "drive.h"
23 #include "queue.h"
24 #include "sysmetrics.h"
25 #include "file.h"
26 #include "gdi.h"
27 #include "heap.h"
28 #include "keyboard.h"
29 #include "miscemu.h"
30 #include "options.h"
31 #include "process.h"
32 #include "spy.h"
33 #include "tweak.h"
34 #include "user.h"
35 #include "dce.h"
36 #include "shell.h"
37 #include "winproc.h"
38 #include "syslevel.h"
39 #include "debug.h"
42 int __winelib = 1; /* Winelib run-time flag */
44 /***********************************************************************
45 * Kernel initialisation routine
47 BOOL32 MAIN_KernelInit(void)
49 /* Initialize syslevel handling */
50 SYSLEVEL_Init();
52 /* Initialize signal handling */
53 if (!SIGNAL_Init()) return FALSE;
55 /* Load the configuration file */
56 if (!PROFILE_LoadWineIni()) return FALSE;
58 /* Initialize DOS memory */
59 if (!DOSMEM_Init(0)) return FALSE;
61 /* Initialise DOS drives */
62 if (!DRIVE_Init()) return FALSE;
64 /* Initialise DOS directories */
65 if (!DIR_Init()) return FALSE;
67 /* Initialize event handling */
68 if (!EVENT_Init()) return FALSE;
70 /* Initialize communications */
71 COMM_Init();
73 /* Initialize IO-port permissions */
74 IO_port_init();
76 return TRUE;
80 /***********************************************************************
81 * USER (and GDI) initialisation routine
83 BOOL32 MAIN_UserInit(void)
85 int queueSize;
87 /* Create USER and GDI heap */
88 if (!USER_HeapSel)
90 USER_HeapSel = GlobalAlloc16( GMEM_FIXED, 0x10000 );
91 LocalInit( USER_HeapSel, 0, 0xffff );
93 if (!GDI_HeapSel)
95 GDI_HeapSel = GlobalAlloc16( GMEM_FIXED, GDI_HEAP_SIZE );
96 LocalInit( GDI_HeapSel, 0, GDI_HEAP_SIZE-1 );
99 /* Initialize Wine tweaks */
100 if (!TWEAK_Init()) return FALSE;
102 /* Initialize OEM Bitmaps */
103 if (!OBM_Init()) return FALSE;
105 /* registry initialisation */
106 SHELL_LoadRegistry();
108 /* Global atom table initialisation */
109 if (!ATOM_Init()) return FALSE;
111 /* GDI initialisation */
112 if (!GDI_Init()) return FALSE;
114 /* Initialize system colors and metrics*/
115 SYSMETRICS_Init();
116 SYSCOLOR_Init();
118 /* Create the DCEs */
119 DCE_Init();
121 /* Initialize keyboard */
122 if (!KEYBOARD_Init()) return FALSE;
124 /* Initialize window procedures */
125 if (!WINPROC_Init()) return FALSE;
127 /* Initialize built-in window classes */
128 if (!WIDGETS_Init()) return FALSE;
130 /* Initialize dialog manager */
131 if (!DIALOG_Init()) return FALSE;
133 /* Initialize menus */
134 if (!MENU_Init()) return FALSE;
136 /* Initialize multimedia */
137 if (!MULTIMEDIA_Init()) return FALSE;
139 /* Create desktop window */
140 if (!WIN_CreateDesktopWindow()) return FALSE;
142 /* Initialize message spying */
143 if (!SPY_Init()) return FALSE;
145 /* Check wine.conf for old/bad entries */
146 if (!TWEAK_CheckConfiguration()) return FALSE;
148 /* Create system message queue */
149 queueSize = GetProfileInt32A( "windows", "TypeAhead", 120 );
150 if (!QUEUE_CreateSysMsgQueue( queueSize )) return FALSE;
152 /* Set double click time */
153 SetDoubleClickTime32( GetProfileInt32A("windows","DoubleClickSpeed",452) );
155 return TRUE;
159 /***********************************************************************
160 * Winelib initialisation routine
162 BOOL32 MAIN_WinelibInit( int *argc, char *argv[] )
164 /* Create the initial process */
165 if (!PROCESS_Init()) return FALSE;
167 /* Parse command line arguments */
168 MAIN_WineInit( argc, argv );
170 /* Initialize the kernel */
171 if (!MAIN_KernelInit()) return FALSE;
173 /* Initialize all the USER stuff */
174 if (!MAIN_UserInit()) return FALSE;
176 return TRUE;