Release 950606
[wine/multimedia.git] / loader / main.c
blobe6ad03e50f1e8d24895100577270bc82d71f625f
1 /*
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";
4 */
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <sys/types.h>
8 #include <sys/stat.h>
9 #include <fcntl.h>
10 #include <unistd.h>
11 #include <string.h>
12 #include <errno.h>
13 #include "windows.h"
14 #include "dos_fs.h"
15 #include "dlls.h"
16 #include "miscemu.h"
17 #include "neexe.h"
18 #include "wineopts.h"
19 #include "task.h"
20 #include "options.h"
21 #include "pe_image.h"
22 #include "stddebug.h"
23 #include "debug.h"
26 /***********************************************************************
27 * Main initialisation routine
29 int MAIN_Init(void)
31 extern BOOL RELAY_Init(void);
33 int queueSize;
35 SpyInit();
37 /* Initialize relay code */
38 if (!RELAY_Init()) return 0;
40 /* Initialize Win32 relay code */
41 if (!RELAY32_Init()) return 0;
43 /* Create built-in modules */
44 if (!MODULE_Init()) return 0;
46 /* Initialize tasks */
47 if (!TASK_Init()) return 0;
49 /* Initialize interrupt vectors */
50 if (!INT_Init()) return 0;
52 /* Initialize the DOS file system */
53 DOS_InitFS();
55 /* Create DOS environment */
56 CreateSelectors();
58 /* Initialize signal handling */
59 init_wine_signals();
61 /* Initialize communications */
62 COMM_Init();
64 #ifndef WINELIB
65 /* Initialize the DOS memory */
66 INT21_Init();
68 /* Create USER heap */
69 if (!USER_HeapInit()) return 0;
70 #endif
72 /* Global atom table initialisation */
73 if (!ATOM_Init()) return 0;
75 /* GDI initialisation */
76 if (!GDI_Init()) return 0;
78 /* Initialize system colors and metrics*/
79 SYSMETRICS_Init();
80 SYSCOLOR_Init();
82 /* Create the DCEs */
83 DCE_Init();
85 /* Initialize dialog manager */
86 if (!DIALOG_Init()) return 0;
88 /* Initialize menus */
89 if (!MENU_Init()) return 0;
91 /* Create system message queue */
92 queueSize = GetProfileInt( "windows", "TypeAhead", 120 );
93 if (!MSG_CreateSysMsgQueue( queueSize )) return 0;
95 return 1;
99 #ifndef WINELIB
100 /**********************************************************************
101 * main
103 int _WinMain(int argc, char **argv)
105 int i;
107 if (!MAIN_Init()) return 0;
109 for (i = 1; i < argc; i++)
111 if (WinExec( argv[i], SW_SHOWNORMAL ) < 32)
113 fprintf(stderr, "wine: can't exec '%s'.\n", argv[i]);
114 exit(1);
118 if (Options.debug) wine_debug(0, NULL);
120 Yield(); /* Start the first task */
121 fprintf( stderr, "WinMain: Should never happen: returned from Yield()\n" );
122 return 0;
125 #endif /* #ifndef WINELIB */