In WSAStartup() don't touch the lpVendorInfo field of the WSADATA
[wine.git] / miscemu / main.c
blobe21685937a9d19a51e959999afcbf44fc6a62010
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 PROCESS_InitWine( int argc, char *argv[], LPSTR win16_exe_name,
39 HANDLE *win16_exe_file ) WINE_NORETURN;
40 extern HINSTANCE16 NE_StartMain( LPCSTR name, HANDLE file );
42 /***********************************************************************
43 * Main loop of initial task
45 int WINAPI wine_initial_task( HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, INT show )
47 MSG msg;
48 HINSTANCE16 instance;
49 HMODULE user32;
51 /* some programs assume mmsystem is always present */
52 LoadLibrary16( "mmsystem.dll" );
54 if ((instance = NE_StartMain( main_exe_name, main_exe_file )) < 32)
56 if (instance == 11) /* try DOS format */
58 if (DPMI_LoadDosSystem())
59 Dosvm.LoadDosExe( main_exe_name, main_exe_file );
60 /* if we get back here it failed */
61 instance = GetLastError();
64 MESSAGE( "%s: can't exec '%s': ", argv0, GetCommandLineA() );
65 switch (instance)
67 case 2: MESSAGE("file not found\n" ); break;
68 case 11: MESSAGE("invalid exe file\n" ); break;
69 default: MESSAGE("error=%d\n", instance ); break;
71 ExitProcess(instance);
73 CloseHandle( main_exe_file ); /* avoid file sharing problems */
75 /* Start message loop for desktop window */
77 if (!(user32 = LoadLibraryA( "user32.dll" )))
79 MESSAGE( "Cannot load user32.dll\n" );
80 ExitProcess( GetLastError() );
82 pGetMessageA = (void *)GetProcAddress( user32, "GetMessageA" );
83 pTranslateMessage = (void *)GetProcAddress( user32, "TranslateMessage" );
84 pDispatchMessageA = (void *)GetProcAddress( user32, "DispatchMessageA" );
86 while ( GetNumTasks16() > 1 && pGetMessageA( &msg, 0, 0, 0 ) )
88 pTranslateMessage( &msg );
89 pDispatchMessageA( &msg );
92 ExitProcess( 0 );
96 /**********************************************************************
97 * main
99 int main( int argc, char *argv[] )
101 PROCESS_InitWine( argc, argv, main_exe_name, &main_exe_file );
102 return 1; /* not reached */