2 * USER initialization code
8 #include "wine/winbase16.h"
10 #include "cursoricon.h"
23 #include "sysmetrics.h"
28 /***********************************************************************
29 * USER initialisation routine
31 BOOL WINAPI
USER_Init(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID lpvReserved
)
36 if ( USER_HeapSel
) return TRUE
;
38 /* Create USER heap */
39 pModule
= NE_GetPtr( GetModuleHandle16( "USER" ) );
42 USER_HeapSel
= GlobalHandleToSel16( (NE_SEG_TABLE( pModule
) +
43 pModule
->dgroup
- 1)->hSeg
);
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) */
57 /* Initialize system colors and metrics*/
64 /* Initialize timers */
65 if (!TIMER_Init()) return FALSE
;
67 /* Initialize window procedures */
68 if (!WINPROC_Init()) return FALSE
;
70 /* Initialize cursor/icons */
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
);