Merged msacm and msacm32 dlls.
[wine] / miscemu / main.c
1 /*
2  * Emulator initialisation code
3  *
4  */
5
6 #include "winbase.h"
7 #include "wine/winbase16.h"
8 #include "wingdi.h"
9 #include "winuser.h"
10
11 #include "builtin32.h"
12 #include "callback.h"
13 #include "options.h"
14 #include "process.h"
15 #include "debugtools.h"
16
17 /***********************************************************************
18  *           Main loop of initial task
19  */
20 static void initial_task(void)
21 {
22     MSG msg;
23     HINSTANCE16 instance;
24     STARTUPINFOA info;
25
26     GetStartupInfoA( &info );
27     if (!(info.dwFlags & STARTF_USESHOWWINDOW)) info.wShowWindow = SW_SHOWNORMAL;
28
29     if ((instance = WinExec16( GetCommandLineA(), info.wShowWindow )) < 32)
30     {
31         MESSAGE( "%s: can't exec '%s': ", argv0, GetCommandLineA() );
32         switch (instance) 
33         {
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;
37         }
38         ExitProcess(instance);
39     }
40
41     /* Start message loop for desktop window */
42
43     while ( GetNumTasks16() > 1  && Callout.GetMessageA( &msg, 0, 0, 0 ) )
44     {
45         Callout.TranslateMessage( &msg );
46         Callout.DispatchMessageA( &msg );
47     }
48
49     ExitProcess( 0 );
50 }
51
52
53 /**********************************************************************
54  *           main
55  */
56 int main( int argc, char *argv[] )
57 {
58     BUILTIN32_DESCRIPTOR descriptor;
59
60     memset( &descriptor, 0, sizeof(descriptor) );
61     descriptor.filename = argv[0];
62     descriptor.dllentrypoint = initial_task;
63     BUILTIN32_RegisterDLL( &descriptor );
64
65     PROCESS_InitWine( argc, argv );
66     return 1;  /* not reached */
67 }