Moved stack switch handling (large stack) to sysdeps.c
[wine.git] / miscemu / main.c
blobb35d94db4a14ded8a59c9536621eeedb947cdb81
1 /*
2 * Emulator initialisation code
4 */
6 #include "winbase.h"
7 #include "wine/winbase16.h"
8 #include "wingdi.h"
9 #include "winuser.h"
11 #include "builtin32.h"
12 #include "callback.h"
13 #include "options.h"
14 #include "process.h"
15 #include "debugtools.h"
17 /***********************************************************************
18 * Main loop of initial task
20 static void initial_task(void)
22 MSG msg;
23 HINSTANCE16 instance;
24 STARTUPINFOA info;
26 GetStartupInfoA( &info );
27 if (!(info.dwFlags & STARTF_USESHOWWINDOW)) info.wShowWindow = SW_SHOWNORMAL;
29 if ((instance = WinExec16( GetCommandLineA(), info.wShowWindow )) < 32)
31 MESSAGE( "%s: can't exec '%s': ", argv0, GetCommandLineA() );
32 switch (instance)
34 case 2: MESSAGE("file not found\n" ); break;
35 case 11: MESSAGE("invalid exe file\n" ); break;
36 default: MESSAGE("error=%d\n", instance ); break;
38 ExitProcess(instance);
41 /* Start message loop for desktop window */
43 while ( GetNumTasks16() > 1 && Callout.GetMessageA( &msg, 0, 0, 0 ) )
45 Callout.TranslateMessage( &msg );
46 Callout.DispatchMessageA( &msg );
49 ExitProcess( 0 );
53 /**********************************************************************
54 * main
56 int main( int argc, char *argv[] )
58 BUILTIN32_DESCRIPTOR descriptor;
60 memset( &descriptor, 0, sizeof(descriptor) );
61 descriptor.filename = argv[0];
62 descriptor.dllentrypoint = initial_task;
63 BUILTIN32_RegisterDLL( &descriptor );
65 PROCESS_InitWine( argc, argv );
66 return 1; /* not reached */