2 * Emulator initialisation code
16 /***********************************************************************
17 * Emulator initialisation
19 BOOL32
MAIN_EmulatorInit(void)
21 extern BOOL32
MAIN_KernelInit(void);
22 extern BOOL32
MAIN_UserInit(void);
23 extern BOOL32
WIN16DRV_Init(void);
24 extern BOOL32
RELAY_Init(void);
26 /* Initialize the kernel */
27 if (!MAIN_KernelInit()) return FALSE
;
29 /* Initialize relay code */
30 if (!RELAY_Init()) return FALSE
;
32 /* Initialize signal handling */
33 if (!SIGNAL_InitEmulator()) return FALSE
;
35 /* Create the Win16 printer driver */
36 if (!WIN16DRV_Init()) return FALSE
;
38 /* Initialize all the USER stuff */
39 return MAIN_UserInit();
43 /**********************************************************************
46 int main( int argc
, char *argv
[] )
48 extern BOOL32
PROCESS_Init(void);
49 extern BOOL32
MAIN_WineInit( int *argc
, char *argv
[] );
50 extern void *CALL32_Init(void);
51 extern char * DEBUG_argv0
;
56 __winelib
= 0; /* First of all, clear the Winelib flag */
59 * Save this so that the internal debugger can get a hold of it if
62 DEBUG_argv0
= argv
[0];
64 /* Create the initial process */
65 if (!PROCESS_Init()) return FALSE
;
67 /* Parse command-line */
68 if (!MAIN_WineInit( &argc
, argv
)) return 1;
70 /* Handle -dll option (hack) */
74 if (!BUILTIN_ParseDLLOptions( Options
.dllFlags
))
76 MSG("%s: Syntax: -dll +xxx,... or -dll -xxx,...\n",
83 /* Initialize everything */
85 if (!MAIN_EmulatorInit()) return 1;
87 /* Initialize CALL32 routines */
88 /* This needs to be done just before task-switching starts */
89 IF1632_CallLargeStack
= (int (*)(int (*func
)(), void *arg
))CALL32_Init();
92 for (i
= 1; i
< argc
; i
++)
94 if ((handle
= WinExec32( argv
[i
], SW_SHOWNORMAL
)) < 32)
96 MSG("wine: can't exec '%s': ", argv
[i
]);
99 case 2: MSG("file not found\n" ); break;
100 case 11: MSG("invalid exe file\n" ); break;
101 case 21: MSG("win32 executable\n" ); break; /* FIXME: Obsolete? */
102 default: MSG("error=%d\n", handle
); break;
109 if (!loaded
) { /* nothing loaded */
110 extern void MAIN_Usage(char*);
117 MSG("wine: no executable file found.\n" );
121 if (Options
.debug
) DEBUG_AddModuleBreakpoints();
123 Yield16(); /* Start the first task */
124 MSG("WinMain: Should never happen: returned from Yield16()\n" );