Arg 3 of CoGetClassObject is COSERVERINFO*, added some more debug.
[wine.git] / miscemu / main.c
blob1b9e740ef6fd37981d1c983057f3e4dc4b0fdc3f
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 static char main_exe_name[MAX_PATH];
18 static HANDLE main_exe_file;
20 static BOOL (WINAPI *pGetMessageA)(LPMSG,HWND,UINT,UINT);
21 static BOOL (WINAPI *pTranslateMessage)(const MSG*);
22 static LONG (WINAPI *pDispatchMessageA)(const MSG*);
24 extern void PROCESS_InitWine( int argc, char *argv[], LPSTR win16_exe_name,
25 HANDLE *win16_exe_file ) WINE_NORETURN;
26 extern HINSTANCE16 NE_StartMain( LPCSTR name, HANDLE file );
28 /***********************************************************************
29 * Main loop of initial task
31 int WINAPI wine_initial_task( HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, INT show )
33 MSG msg;
34 HINSTANCE16 instance;
35 HMODULE user32;
37 if ((instance = NE_StartMain( main_exe_name, main_exe_file )) < 32)
39 if (instance == 11) /* try DOS format */
41 if (DPMI_LoadDosSystem())
42 Dosvm.LoadDosExe( main_exe_name, main_exe_file );
43 /* if we get back here it failed */
44 instance = GetLastError();
47 MESSAGE( "%s: can't exec '%s': ", argv0, GetCommandLineA() );
48 switch (instance)
50 case 2: MESSAGE("file not found\n" ); break;
51 case 11: MESSAGE("invalid exe file\n" ); break;
52 default: MESSAGE("error=%d\n", instance ); break;
54 ExitProcess(instance);
56 CloseHandle( main_exe_file ); /* avoid file sharing problems */
58 /* Start message loop for desktop window */
60 if (!(user32 = LoadLibraryA( "user32.dll" )))
62 MESSAGE( "Cannot load user32.dll\n" );
63 ExitProcess( GetLastError() );
65 pGetMessageA = (void *)GetProcAddress( user32, "GetMessageA" );
66 pTranslateMessage = (void *)GetProcAddress( user32, "TranslateMessage" );
67 pDispatchMessageA = (void *)GetProcAddress( user32, "DispatchMessageA" );
69 while ( GetNumTasks16() > 1 && pGetMessageA( &msg, 0, 0, 0 ) )
71 pTranslateMessage( &msg );
72 pDispatchMessageA( &msg );
75 ExitProcess( 0 );
79 /**********************************************************************
80 * main
82 int main( int argc, char *argv[] )
84 PROCESS_InitWine( argc, argv, main_exe_name, &main_exe_file );
85 return 1; /* not reached */