2 * Emulator initialisation code
15 /***********************************************************************
16 * Emulator initialisation
18 BOOL32 MAIN_EmulatorInit(void)
20 extern BOOL32 MAIN_KernelInit(void);
21 extern BOOL32 MAIN_UserInit(void);
22 extern BOOL32 WIN16DRV_Init(void);
23 extern BOOL32 RELAY_Init(void);
25 /* Initialize the kernel */
26 if (!MAIN_KernelInit()) return FALSE;
28 /* Initialize relay code */
29 if (!RELAY_Init()) return FALSE;
31 /* Initialize signal handling */
32 if (!SIGNAL_InitEmulator()) return FALSE;
34 /* Create the Win16 printer driver */
35 if (!WIN16DRV_Init()) return FALSE;
37 /* Initialize all the USER stuff */
38 return MAIN_UserInit();
42 /**********************************************************************
45 int main( int argc, char *argv[] )
47 extern BOOL32 MAIN_WineInit( int *argc, char *argv[] );
48 extern void *CALL32_Init(void);
49 extern char * DEBUG_argv0;
54 __winelib = 0; /* First of all, clear the Winelib flag */
57 * Save this so that the internal debugger can get a hold of it if
60 DEBUG_argv0 = argv[0];
62 if (!MAIN_WineInit( &argc, argv )) return 1;
64 /* Handle -dll option (hack) */
68 if (!BUILTIN_ParseDLLOptions( Options.dllFlags ))
70 fprintf( stderr, "%s: Syntax: -dll +xxx,... or -dll -xxx,...\n",
77 /* Initialize everything */
79 if (!MAIN_EmulatorInit()) return 1;
81 /* Initialize CALL32 routines */
82 /* This needs to be done just before task-switching starts */
83 IF1632_CallLargeStack = (int (*)(int (*func)(), void *arg))CALL32_Init();
86 for (i = 1; i < argc; i++)
88 if ((handle = WinExec32( argv[i], SW_SHOWNORMAL )) < 32)
90 fprintf(stderr, "wine: can't exec '%s': ", argv[i]);
93 case 2: fprintf( stderr, "file not found\n" ); break;
94 case 11: fprintf( stderr, "invalid exe file\n" ); break;
95 case 21: fprintf( stderr, "win32 executable\n" ); break;
96 default: fprintf( stderr, "error=%d\n", handle ); break;
103 if (!loaded) { /* nothing loaded */
104 extern void MAIN_Usage(char*);
111 fprintf( stderr, "wine: no executable file found.\n" );
115 if (Options.debug) DEBUG_AddModuleBreakpoints();
117 Yield16(); /* Start the first task */
118 fprintf( stderr, "WinMain: Should never happen: returned from Yield()\n" );