Added a few forwards.
[wine/multimedia.git] / miscemu / main.c
blobda547d941483e066093a0c6ad9b8d70c04551141
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 "process.h"
15 #include "debugtools.h"
17 /***********************************************************************
18 * Main loop of initial task
20 void wine_initial_task(void)
22 MSG msg;
23 HINSTANCE16 instance;
24 STARTUPINFOA info;
26 if (!LoadLibraryA( "user32.dll" ))
28 MESSAGE( "Cannot load user32.dll\n" );
29 ExitProcess( GetLastError() );
31 THUNK_InitCallout();
33 GetStartupInfoA( &info );
34 if (!(info.dwFlags & STARTF_USESHOWWINDOW)) info.wShowWindow = SW_SHOWNORMAL;
36 if ((instance = WinExec16( GetCommandLineA(), info.wShowWindow )) < 32)
38 if (instance == 11) /* try DOS format */
40 MZ_LoadImage( GetCommandLineA() );
41 /* if we get back here it failed */
42 instance = GetLastError();
45 MESSAGE( "%s: can't exec '%s': ", argv0, GetCommandLineA() );
46 switch (instance)
48 case 2: MESSAGE("file not found\n" ); break;
49 case 11: MESSAGE("invalid exe file\n" ); break;
50 default: MESSAGE("error=%d\n", instance ); break;
52 ExitProcess(instance);
55 /* Start message loop for desktop window */
57 while ( GetNumTasks16() > 1 && Callout.GetMessageA( &msg, 0, 0, 0 ) )
59 Callout.TranslateMessage( &msg );
60 Callout.DispatchMessageA( &msg );
63 ExitProcess( 0 );
67 /**********************************************************************
68 * main
70 int main( int argc, char *argv[] )
72 PROCESS_InitWine( argc, argv );
73 return 1; /* not reached */