Added a spec file for 16bit imm.
[wine/testsucceed.git] / miscemu / main.c
blob666b8f8eb594f0ae1c05b0d564ce76df0cd14a32
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 void wine_initial_task(void)
23 MSG msg;
24 HINSTANCE16 instance;
25 STARTUPINFOA info;
27 if (!LoadLibraryA( "user32.dll" ))
29 MESSAGE( "Cannot load user32.dll\n" );
30 ExitProcess( GetLastError() );
32 THUNK_InitCallout();
34 GetStartupInfoA( &info );
35 if (!(info.dwFlags & STARTF_USESHOWWINDOW)) info.wShowWindow = SW_SHOWNORMAL;
37 if ((instance = WinExec16( GetCommandLineA(), info.wShowWindow )) < 32)
39 if (instance == 11) /* try DOS format */
41 MZ_LoadImage( GetCommandLineA() );
42 /* if we get back here it failed */
43 instance = GetLastError();
46 MESSAGE( "%s: can't exec '%s': ", argv0, GetCommandLineA() );
47 switch (instance)
49 case 2: MESSAGE("file not found\n" ); break;
50 case 11: MESSAGE("invalid exe file\n" ); break;
51 default: MESSAGE("error=%d\n", instance ); break;
53 ExitProcess(instance);
56 /* Start message loop for desktop window */
58 while ( GetNumTasks16() > 1 && Callout.GetMessageA( &msg, 0, 0, 0 ) )
60 Callout.TranslateMessage( &msg );
61 Callout.DispatchMessageA( &msg );
64 ExitProcess( 0 );
68 /**********************************************************************
69 * main
71 int main( int argc, char *argv[] )
73 PROCESS_InitWine( argc, argv );
74 return 1; /* not reached */