Cleaned up local heap initialisation.
[wine/multimedia.git] / dlls / user / user_main.c
bloba3a91d333a1e0db025412f049277a8748135c69e
1 /*
2 * USER initialization code
3 */
5 #include "windef.h"
6 #include "wingdi.h"
7 #include "winuser.h"
8 #include "wine/winbase16.h"
10 #include "dce.h"
11 #include "dialog.h"
12 #include "display.h"
13 #include "global.h"
14 #include "input.h"
15 #include "keyboard.h"
16 #include "menu.h"
17 #include "message.h"
18 #include "mouse.h"
19 #include "queue.h"
20 #include "spy.h"
21 #include "sysmetrics.h"
22 #include "user.h"
23 #include "win.h"
26 /***********************************************************************
27 * USER initialisation routine
29 BOOL WINAPI USER_Init(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
31 HINSTANCE16 instance;
32 int queueSize;
34 if ( USER_HeapSel ) return TRUE;
36 /* Create USER heap */
37 if ((instance = LoadLibrary16( "USER.EXE" )) < 32) return FALSE;
38 USER_HeapSel = GlobalHandleToSel16( instance );
40 /* Global atom table initialisation */
41 if (!ATOM_Init( USER_HeapSel )) return FALSE;
43 /* Initialize window handling (critical section) */
44 WIN_Init();
46 /* Initialize system colors and metrics*/
47 SYSMETRICS_Init();
48 SYSCOLOR_Init();
50 /* Create the DCEs */
51 DCE_Init();
53 /* Initialize window procedures */
54 if (!WINPROC_Init()) return FALSE;
56 /* Initialize built-in window classes */
57 if (!WIDGETS_Init()) return FALSE;
59 /* Initialize dialog manager */
60 if (!DIALOG_Init()) return FALSE;
62 /* Initialize menus */
63 if (!MENU_Init()) return FALSE;
65 /* Initialize message spying */
66 if (!SPY_Init()) return FALSE;
68 /* Create system message queue */
69 queueSize = GetProfileIntA( "windows", "TypeAhead", 120 );
70 if (!QUEUE_CreateSysMsgQueue( queueSize )) return FALSE;
72 /* Set double click time */
73 SetDoubleClickTime( GetProfileIntA("windows","DoubleClickSpeed",452) );
75 /* Create message queue of initial thread */
76 InitThreadInput16( 0, 0 );
78 /* Create desktop window */
79 if (!WIN_CreateDesktopWindow()) return FALSE;
81 /* Initialize keyboard driver */
82 KEYBOARD_Enable( keybd_event, InputKeyStateTable );
84 /* Initialize mouse driver */
85 MOUSE_Enable( mouse_event );
87 /* Start processing X events */
88 UserRepaintDisable16( FALSE );
90 return TRUE;