2 static char RCSId[] = "$Id: wine.c,v 1.2 1993/07/04 04:04:21 root Exp root $";
3 static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
17 #include "selectors.h"
24 #include "directory.h"
28 #include "sysmetrics.h"
43 void init_wine_signals(void);
45 HANDLE32 SystemHeap
= 0;
47 /***********************************************************************
48 * Main initialisation routine
52 extern BOOL
RELAY_Init(void);
56 /* Create the system heap */
57 if (!(SystemHeap
= HeapCreate( HEAP_GROWABLE
, 0x10000, 0 ))) return 0;
59 /* Load the configuration file */
60 if (!PROFILE_LoadWineIni()) return 0;
62 /* Initialize message spying */
63 if (!SPY_Init()) return 0;
66 /* Create USER and GDI heap */
67 USER_HeapSel
= GlobalAlloc16( GMEM_FIXED
, 0x10000 );
68 LocalInit( USER_HeapSel
, 0, 0xffff );
69 GDI_HeapSel
= GlobalAlloc16( GMEM_FIXED
, GDI_HEAP_SIZE
);
70 LocalInit( GDI_HeapSel
, 0, GDI_HEAP_SIZE
-1 );
72 /* Initialize relay code */
73 if (!RELAY_Init()) return 0;
75 /* Create built-in modules */
76 if (!BUILTIN_Init()) return 0;
79 /* Initialise DOS drives */
80 if (!DRIVE_Init()) return 0;
82 /* Initialise DOS directories */
83 if (!DIR_Init()) return 0;
85 /* Initialize tasks */
86 if (!TASK_Init()) return 0;
88 /* Initialize communications */
92 /* Initialize interrupt vectors */
93 if (!INT_Init()) return 0;
95 /* Initialize DOS memory */
96 if (!DOSMEM_Init()) return 0;
98 /* Initialize signal handling */
101 /* Initialize the DOS memory */
102 if (!INT21_Init()) return 0;
105 /* Global atom table initialisation */
106 if (!ATOM_Init()) return 0;
108 /* GDI initialisation */
109 if (!GDI_Init()) return 0;
111 /* Initialise window procedures aliases */
112 if (!ALIAS_Init()) return 0;
114 /* Initialize system colors and metrics*/
118 /* Create the DCEs */
121 /* Initialize dialog manager */
122 if (!DIALOG_Init()) return 0;
124 /* Initialize menus */
125 if (!MENU_Init()) return 0;
127 /* Initialize Win32 data structures */
128 if (!KERN32_Init()) return 0;
130 /* Create system message queue */
131 queueSize
= GetProfileInt( "windows", "TypeAhead", 120 );
132 if (!QUEUE_CreateSysMsgQueue( queueSize
)) return 0;
134 /* Set double click time */
135 SetDoubleClickTime( GetProfileInt( "windows", "DoubleClickSpeed", 452 ) );
142 /**********************************************************************
145 int _WinMain(int argc
, char **argv
)
150 if (!MAIN_Init()) return 0;
152 for (i
= 1; i
< argc
; i
++)
154 if ((handle
= WinExec( argv
[i
], SW_SHOWNORMAL
)) < 32)
156 fprintf(stderr
, "wine: can't exec '%s': ", argv
[i
]);
159 case 2: fprintf( stderr
, "file not found\n" ); break;
160 case 11: fprintf( stderr
, "invalid exe file\n" ); break;
161 case 21: fprintf( stderr
, "win32 executable\n" ); break;
162 default: fprintf( stderr
, "error=%d\n", handle
); break;
168 if (Options
.debug
) DEBUG_SetBreakpoints( TRUE
); /* Setup breakpoints */
170 Yield(); /* Start the first task */
171 fprintf( stderr
, "WinMain: Should never happen: returned from Yield()\n" );
175 #endif /* #ifndef WINELIB */