DOSFS_ToDosFCBFormat: fail if extension longer than 3 characters.
[wine/gsoc-2012-control.git] / dlls / user / user_main.c
blob83b154c04e42542d66750c6976c1d4ee26a80e15
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 "cursoricon.h"
11 #include "dce.h"
12 #include "dialog.h"
13 #include "display.h"
14 #include "global.h"
15 #include "input.h"
16 #include "keyboard.h"
17 #include "menu.h"
18 #include "message.h"
19 #include "module.h"
20 #include "mouse.h"
21 #include "queue.h"
22 #include "spy.h"
23 #include "sysmetrics.h"
24 #include "user.h"
25 #include "win.h"
28 /***********************************************************************
29 * USER initialisation routine
31 BOOL WINAPI USER_Init(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
33 NE_MODULE *pModule;
34 int queueSize;
36 if ( USER_HeapSel ) return TRUE;
38 /* Create USER heap */
39 pModule = NE_GetPtr( GetModuleHandle16( "USER" ) );
40 if ( pModule )
42 USER_HeapSel = GlobalHandleToSel16( (NE_SEG_TABLE( pModule ) +
43 pModule->dgroup - 1)->hSeg );
45 else
47 USER_HeapSel = GlobalAlloc16( GMEM_FIXED, 0x10000 );
48 LocalInit16( USER_HeapSel, 0, 0xffff );
51 /* Global atom table initialisation */
52 if (!ATOM_Init( USER_HeapSel )) return FALSE;
54 /* Initialize window handling (critical section) */
55 WIN_Init();
57 /* Initialize system colors and metrics*/
58 SYSMETRICS_Init();
59 SYSCOLOR_Init();
61 /* Create the DCEs */
62 DCE_Init();
64 /* Initialize timers */
65 if (!TIMER_Init()) return FALSE;
67 /* Initialize window procedures */
68 if (!WINPROC_Init()) return FALSE;
70 /* Initialize cursor/icons */
71 CURSORICON_Init();
73 /* Initialize built-in window classes */
74 if (!WIDGETS_Init()) return FALSE;
76 /* Initialize dialog manager */
77 if (!DIALOG_Init()) return FALSE;
79 /* Initialize menus */
80 if (!MENU_Init()) return FALSE;
82 /* Initialize message spying */
83 if (!SPY_Init()) return FALSE;
85 /* Create system message queue */
86 queueSize = GetProfileIntA( "windows", "TypeAhead", 120 );
87 if (!QUEUE_CreateSysMsgQueue( queueSize )) return FALSE;
89 /* Set double click time */
90 SetDoubleClickTime( GetProfileIntA("windows","DoubleClickSpeed",452) );
92 /* Create message queue of initial thread */
93 InitThreadInput16( 0, 0 );
95 /* Create desktop window */
96 if (!WIN_CreateDesktopWindow()) return FALSE;
98 /* Initialize keyboard driver */
99 KEYBOARD_Enable( keybd_event, InputKeyStateTable );
101 /* Initialize mouse driver */
102 MOUSE_Enable( mouse_event );
104 /* Start processing X events */
105 UserRepaintDisable16( FALSE );
107 return TRUE;