2 * Main initialization code
15 #include "selectors.h"
24 #include "sysmetrics.h"
43 int __winelib = 1; /* Winelib run-time flag */
45 /***********************************************************************
46 * Kernel initialisation routine
48 BOOL32 MAIN_KernelInit(void)
50 extern BOOL32 EVENT_Init(void);
51 extern BOOL32 PROCESS_Init(void);
52 extern BOOL32 VIRTUAL_Init(void);
54 /* Initialize virtual memory management */
55 if (!VIRTUAL_Init()) return FALSE;
57 /* Create the system and SEGPTR heaps */
58 if (!(SystemHeap = HeapCreate( HEAP_GROWABLE, 0x10000, 0 ))) return FALSE;
59 if (!(SegptrHeap = HeapCreate( HEAP_WINE_SEGPTR, 0, 0 ))) return FALSE;
61 /* Create the initial process */
62 if (!PROCESS_Init()) return FALSE;
64 /* Initialize signal handling */
65 if (!SIGNAL_Init()) return FALSE;
67 /* Load the configuration file */
68 if (!PROFILE_LoadWineIni()) return FALSE;
70 /* Initialize DOS memory */
71 if (!DOSMEM_Init()) return FALSE;
73 /* Initialise DOS drives */
74 if (!DRIVE_Init()) return FALSE;
76 /* Initialise DOS directories */
77 if (!DIR_Init()) return FALSE;
79 /* Initialize tasks */
80 if (!TASK_Init()) return FALSE;
82 /* Initialize event handling */
83 if (!EVENT_Init()) return FALSE;
85 /* Initialize communications */
88 /* Initialize IO-port permissions */
95 /***********************************************************************
96 * USER (and GDI) initialisation routine
98 BOOL32 MAIN_UserInit(void)
100 extern BOOL32 WIDGETS_Init(void);
104 /* Create USER and GDI heap */
107 USER_HeapSel = GlobalAlloc16( GMEM_FIXED, 0x10000 );
108 LocalInit( USER_HeapSel, 0, 0xffff );
112 GDI_HeapSel = GlobalAlloc16( GMEM_FIXED, GDI_HEAP_SIZE );
113 LocalInit( GDI_HeapSel, 0, GDI_HEAP_SIZE-1 );
116 /* Initialize Wine tweaks */
117 if (!TWEAK_Init()) return FALSE;
119 /* Initialize OEM Bitmaps */
120 if (!OBM_Init()) return FALSE;
122 /* registry initialisation */
123 SHELL_LoadRegistry();
125 /* Global atom table initialisation */
126 if (!ATOM_Init()) return FALSE;
128 /* GDI initialisation */
129 if (!GDI_Init()) return FALSE;
131 /* Initialize system colors and metrics*/
135 /* Create the DCEs */
138 /* Initialize keyboard */
139 if (!KEYBOARD_Init()) return FALSE;
141 /* Initialize window procedures */
142 if (!WINPROC_Init()) return FALSE;
144 /* Initialize built-in window classes */
145 if (!WIDGETS_Init()) return FALSE;
147 /* Initialize dialog manager */
148 if (!DIALOG_Init()) return FALSE;
150 /* Initialize menus */
151 if (!MENU_Init()) return FALSE;
153 /* Create desktop window */
154 if (!WIN_CreateDesktopWindow()) return FALSE;
156 /* Initialize message spying */
157 if (!SPY_Init()) return FALSE;
159 /* Check wine.conf for old/bad entries */
160 if (!TWEAK_CheckConfiguration()) return FALSE;
162 /* Create system message queue */
163 queueSize = GetProfileInt32A( "windows", "TypeAhead", 120 );
164 if (!QUEUE_CreateSysMsgQueue( queueSize )) return FALSE;
166 /* Set double click time */
167 SetDoubleClickTime32( GetProfileInt32A("windows","DoubleClickSpeed",452) );
173 /***********************************************************************
174 * Winelib initialisation routine
176 int MAIN_WinelibInit(void)
178 /* Initialize the kernel */
179 if (!MAIN_KernelInit()) return 0;
181 /* Initialize all the USER stuff */
182 if (!MAIN_UserInit()) return 0;