2 * Emulator initialisation code
19 /***********************************************************************
20 * Emulator initialisation
22 BOOL32
MAIN_EmulatorInit(void)
24 /* Initialize the kernel */
25 if (!MAIN_KernelInit()) return FALSE
;
27 /* Initialize relay code */
28 if (!RELAY_Init()) return FALSE
;
30 /* Initialize signal handling */
31 if (!SIGNAL_InitEmulator()) return FALSE
;
33 /* Create the Win16 printer driver */
34 if (!WIN16DRV_Init()) return FALSE
;
36 /* Create the Postscript printer driver (FIXME: should be in Winelib) */
37 if (!PSDRV_Init()) return FALSE
;
39 /* Initialize all the USER stuff */
40 return MAIN_UserInit();
44 /**********************************************************************
47 int main( int argc
, char *argv
[] )
49 extern char * DEBUG_argv0
;
50 char startProg
[256], defProg
[256];
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 /* Create the initial process */
63 if (!PROCESS_Init()) return FALSE
;
65 /* Parse command-line */
66 if (!MAIN_WineInit( &argc
, argv
)) return 1;
68 /* Handle -dll option (hack) */
72 if (!BUILTIN_ParseDLLOptions( Options
.dllFlags
))
74 MSG("%s: Syntax: -dll +xxx,... or -dll -xxx,...\n",
81 /* Initialize everything */
83 if (!MAIN_EmulatorInit()) return 1;
85 /* Initialize CALL32 routines */
86 /* This needs to be done just before task-switching starts */
90 /* Add the Default Program if no program on the command line */
93 PROFILE_GetWineIniString( "programs", "Default", "",
94 defProg
, sizeof(defProg
) );
95 if (defProg
[0]) argv
[argc
++] = defProg
;
98 /* Add the Startup Program to the run list */
99 PROFILE_GetWineIniString( "programs", "Startup", "",
100 startProg
, sizeof(startProg
) );
101 if (startProg
[0]) argv
[argc
++] = startProg
;
103 for (i
= 1; i
< argc
; i
++)
105 if ((handle
= WinExec32( argv
[i
], SW_SHOWNORMAL
)) < 32)
107 MSG("wine: can't exec '%s': ", argv
[i
]);
110 case 2: MSG("file not found\n" ); break;
111 case 11: MSG("invalid exe file\n" ); break;
112 case 21: MSG("win32 executable\n" ); break; /* FIXME: Obsolete? */
113 default: MSG("error=%d\n", handle
); break;
120 if (!loaded
) { /* nothing loaded */
127 MSG("wine: no executable file found.\n" );
131 if (Options
.debug
) DEBUG_AddModuleBreakpoints();
133 ctx_debug_call
= ctx_debug
;
134 IF1632_CallLargeStack
= (int (*)(int (*func
)(), void *arg
))CALL32_Init();
135 Yield16(); /* Start the first task */
136 MSG("WinMain: Should never happen: returned from Yield16()\n" );