Replaced calls to KERNEL.Yield16 by calls to KERNEL32.K32WOWYield from
[wine.git] / miscemu / main.c
blob5bcb2d66b2bb81bdf8747065e0882ccd735e2240
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 "callback.h"
12 #include "options.h"
13 #include "dosexe.h"
14 #include "debugtools.h"
16 extern void PROCESS_InitWine( int argc, char *argv[] ) WINE_NORETURN;
18 /***********************************************************************
19 * Main loop of initial task
21 int WINAPI wine_initial_task( HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, INT show )
23 MSG msg;
24 HINSTANCE16 instance;
26 if (!LoadLibraryA( "user32.dll" ))
28 MESSAGE( "Cannot load user32.dll\n" );
29 ExitProcess( GetLastError() );
31 THUNK_InitCallout();
33 if ((instance = WinExec16( GetCommandLineA(), show )) < 32)
35 if (instance == 11) /* try DOS format */
37 MZ_LoadImage( GetCommandLineA() );
38 /* if we get back here it failed */
39 instance = GetLastError();
42 MESSAGE( "%s: can't exec '%s': ", argv0, GetCommandLineA() );
43 switch (instance)
45 case 2: MESSAGE("file not found\n" ); break;
46 case 11: MESSAGE("invalid exe file\n" ); break;
47 default: MESSAGE("error=%d\n", instance ); break;
49 ExitProcess(instance);
52 /* Start message loop for desktop window */
54 while ( GetNumTasks16() > 1 && Callout.GetMessageA( &msg, 0, 0, 0 ) )
56 Callout.TranslateMessage( &msg );
57 Callout.DispatchMessageA( &msg );
60 ExitProcess( 0 );
64 /**********************************************************************
65 * main
67 int main( int argc, char *argv[] )
69 PROCESS_InitWine( argc, argv );
70 return 1; /* not reached */