Added a more truthful message about what really is wrong.
[wine/multimedia.git] / miscemu / main.c
blob1fa6f9254ceb032072959bff001c928954591cd8
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 "miscemu.h"
12 #include "callback.h"
13 #include "options.h"
14 #include "dosexe.h"
15 #include "debugtools.h"
17 extern void PROCESS_InitWine( int argc, char *argv[] ) WINE_NORETURN;
19 /***********************************************************************
20 * Main loop of initial task
22 int WINAPI wine_initial_task( HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, INT show )
24 MSG msg;
25 HINSTANCE16 instance;
27 if (!LoadLibraryA( "user32.dll" ))
29 MESSAGE( "Cannot load user32.dll\n" );
30 ExitProcess( GetLastError() );
32 THUNK_InitCallout();
34 if ((instance = WinExec16( GetCommandLineA(), show )) < 32)
36 if (instance == 11) /* try DOS format */
38 if (DPMI_LoadDosSystem())
39 Dosvm.LoadDosExe( GetCommandLineA() );
40 /* if we get back here it failed */
41 instance = GetLastError();
44 MESSAGE( "%s: can't exec '%s': ", argv0, GetCommandLineA() );
45 switch (instance)
47 case 2: MESSAGE("file not found\n" ); break;
48 case 11: MESSAGE("invalid exe file\n" ); break;
49 default: MESSAGE("error=%d\n", instance ); break;
51 ExitProcess(instance);
54 /* Start message loop for desktop window */
56 while ( GetNumTasks16() > 1 && Callout.GetMessageA( &msg, 0, 0, 0 ) )
58 Callout.TranslateMessage( &msg );
59 Callout.DispatchMessageA( &msg );
62 ExitProcess( 0 );
66 /**********************************************************************
67 * main
69 int main( int argc, char *argv[] )
71 PROCESS_InitWine( argc, argv );
72 return 1; /* not reached */