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
PROCESS_Init(void);
48 extern BOOL32
MAIN_WineInit( int *argc
, char *argv
[] );
49 extern void *CALL32_Init(void);
50 extern char * DEBUG_argv0
;
55 __winelib
= 0; /* First of all, clear the Winelib flag */
58 * Save this so that the internal debugger can get a hold of it if
61 DEBUG_argv0
= argv
[0];
63 /* Create the initial process */
64 if (!PROCESS_Init()) return FALSE
;
66 /* Parse command-line */
67 if (!MAIN_WineInit( &argc
, argv
)) return 1;
69 /* Handle -dll option (hack) */
73 if (!BUILTIN_ParseDLLOptions( Options
.dllFlags
))
75 fprintf( stderr
, "%s: Syntax: -dll +xxx,... or -dll -xxx,...\n",
82 /* Initialize everything */
84 if (!MAIN_EmulatorInit()) return 1;
86 /* Initialize CALL32 routines */
87 /* This needs to be done just before task-switching starts */
88 IF1632_CallLargeStack
= (int (*)(int (*func
)(), void *arg
))CALL32_Init();
91 for (i
= 1; i
< argc
; i
++)
93 if ((handle
= WinExec32( argv
[i
], SW_SHOWNORMAL
)) < 32)
95 fprintf(stderr
, "wine: can't exec '%s': ", argv
[i
]);
98 case 2: fprintf( stderr
, "file not found\n" ); break;
99 case 11: fprintf( stderr
, "invalid exe file\n" ); break;
100 case 21: fprintf( stderr
, "win32 executable\n" ); break;
101 default: fprintf( stderr
, "error=%d\n", handle
); break;
108 if (!loaded
) { /* nothing loaded */
109 extern void MAIN_Usage(char*);
116 fprintf( stderr
, "wine: no executable file found.\n" );
120 if (Options
.debug
) DEBUG_AddModuleBreakpoints();
122 Yield16(); /* Start the first task */
123 fprintf( stderr
, "WinMain: Should never happen: returned from Yield()\n" );