X11DRV_DrawArc: Don't overwrite the ENDCAP style.
[wine/multimedia.git] / miscemu / main.c
blobf4c722c372d052944da3cdbc50867eec0cb4b03a
1 /*
2 * Emulator initialisation code
4 * Copyright 2000 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include "winbase.h"
22 #include "wine/winbase16.h"
23 #include "wingdi.h"
24 #include "winuser.h"
26 #include "miscemu.h"
27 #include "callback.h"
28 #include "options.h"
29 #include "wine/debug.h"
31 static char main_exe_name[MAX_PATH];
32 static HANDLE main_exe_file;
34 static BOOL (WINAPI *pGetMessageA)(LPMSG,HWND,UINT,UINT);
35 static BOOL (WINAPI *pTranslateMessage)(const MSG*);
36 static LONG (WINAPI *pDispatchMessageA)(const MSG*);
38 extern void DECLSPEC_NORETURN PROCESS_InitWine(
39 int argc, char *argv[], LPSTR win16_exe_name,
40 HANDLE *win16_exe_file );
41 extern HINSTANCE16 NE_StartMain( LPCSTR name, HANDLE file );
43 /***********************************************************************
44 * Main loop of initial task
46 int WINAPI wine_initial_task( HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, INT show )
48 MSG msg;
49 HINSTANCE16 instance;
50 HMODULE user32;
52 /* some programs assume mmsystem is always present */
53 LoadLibrary16( "mmsystem.dll" );
55 if ((instance = NE_StartMain( main_exe_name, main_exe_file )) < 32)
57 if (instance == 11) /* try DOS format */
59 if (DPMI_LoadDosSystem())
60 Dosvm.LoadDosExe( main_exe_name, main_exe_file );
61 /* if we get back here it failed */
62 instance = GetLastError();
65 MESSAGE( "%s: can't exec '%s': ", argv0, GetCommandLineA() );
66 switch (instance)
68 case 2: MESSAGE("file not found\n" ); break;
69 case 11: MESSAGE("invalid exe file\n" ); break;
70 default: MESSAGE("error=%d\n", instance ); break;
72 ExitProcess(instance);
74 CloseHandle( main_exe_file ); /* avoid file sharing problems */
76 /* Start message loop for desktop window */
78 if (!(user32 = LoadLibraryA( "user32.dll" )))
80 MESSAGE( "Cannot load user32.dll\n" );
81 ExitProcess( GetLastError() );
83 pGetMessageA = (void *)GetProcAddress( user32, "GetMessageA" );
84 pTranslateMessage = (void *)GetProcAddress( user32, "TranslateMessage" );
85 pDispatchMessageA = (void *)GetProcAddress( user32, "DispatchMessageA" );
87 while ( GetNumTasks16() > 1 && pGetMessageA( &msg, 0, 0, 0 ) )
89 pTranslateMessage( &msg );
90 pDispatchMessageA( &msg );
93 ExitProcess( 0 );
97 /**********************************************************************
98 * main
100 int main( int argc, char *argv[] )
102 PROCESS_InitWine( argc, argv, main_exe_name, &main_exe_file );
103 return 1; /* not reached */