2 * USER initialization code
9 #include "wine/winbase16.h"
20 #include "sysmetrics.h"
23 #include "debugtools.h"
26 /* load the graphics driver */
27 static BOOL load_driver(void)
29 char buffer[MAX_PATH];
33 if (RegCreateKeyExA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\Wine", 0, NULL,
34 REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, NULL ))
36 MESSAGE("load_driver: Cannot create config registry key\n" );
39 count = sizeof(buffer);
40 if (RegQueryValueExA( hkey, "GraphicsDriver", 0, &type, buffer, &count ))
41 strcpy( buffer, "x11drv" ); /* default value */
44 if (!LoadLibraryA( buffer ))
46 MESSAGE( "Could not load graphics driver '%s'\n", buffer );
53 /***********************************************************************
54 * USER initialisation routine
56 BOOL WINAPI USER_Init(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
61 if ( USER_HeapSel ) return TRUE;
63 /* Create USER heap */
64 if ((instance = LoadLibrary16( "USER.EXE" )) < 32) return FALSE;
65 USER_HeapSel = GlobalHandleToSel16( instance );
67 /* Global atom table initialisation */
68 if (!ATOM_Init( USER_HeapSel )) return FALSE;
70 /* Load the graphics driver */
71 if (!load_driver()) return FALSE;
73 /* Initialize window handling (critical section) */
76 /* Initialize system colors and metrics*/
83 /* Initialize window procedures */
84 if (!WINPROC_Init()) return FALSE;
86 /* Initialize built-in window classes */
87 if (!WIDGETS_Init()) return FALSE;
89 /* Initialize dialog manager */
90 if (!DIALOG_Init()) return FALSE;
92 /* Initialize menus */
93 if (!MENU_Init()) return FALSE;
95 /* Initialize message spying */
96 if (!SPY_Init()) return FALSE;
98 /* Create system message queue */
99 queueSize = GetProfileIntA( "windows", "TypeAhead", 120 );
100 if (!QUEUE_CreateSysMsgQueue( queueSize )) return FALSE;
102 /* Set double click time */
103 SetDoubleClickTime( GetProfileIntA("windows","DoubleClickSpeed",452) );
105 /* Create message queue of initial thread */
106 InitThreadInput16( 0, 0 );
108 /* Create desktop window */
109 if (!WIN_CreateDesktopWindow()) return FALSE;
111 /* Initialize keyboard driver */
112 KEYBOARD_Enable( keybd_event, InputKeyStateTable );
114 /* Initialize mouse driver */
115 MOUSE_Enable( mouse_event );
117 /* Start processing X events */
118 USER_Driver->pUserRepaintDisable( FALSE );