/* * Main function. * * Copyright 1994 Alexandre Julliard */ #include "config.h" #include #include #include #include #include #ifdef MALLOC_DEBUGGING # include #endif #include "winbase.h" #include "winsock.h" #include "heap.h" #include "message.h" #include "msdos.h" #include "color.h" #include "options.h" #include "builtin32.h" #include "debugtools.h" #include "debugdefs.h" #include "module.h" #include "version.h" #include "winnls.h" #include "console.h" #include "monitor.h" #include "keyboard.h" #include "gdi.h" #include "user.h" #include "windef.h" #include "wingdi.h" #include "wine/winuser16.h" #include "tweak.h" #include "winerror.h" /**********************************************************************/ USER_DRIVER *USER_Driver = NULL; /* when adding new languages look at ole/ole2nls.c * for proper iso name and Windows code (add 0x0400 * to the code listed there) */ const WINE_LANGUAGE_DEF Languages[] = { {"En",0x0409}, /* LANG_En */ {"Es",0x040A}, /* LANG_Es */ {"De",0x0407}, /* LANG_De */ {"No",0x0414}, /* LANG_No */ {"Fr",0x040C}, /* LANG_Fr */ {"Fi",0x040B}, /* LANG_Fi */ {"Da",0x0406}, /* LANG_Da */ {"Cs",0x0405}, /* LANG_Cs */ {"Eo",0x048f}, /* LANG_Eo */ {"It",0x0410}, /* LANG_It */ {"Ko",0x0412}, /* LANG_Ko */ {"Hu",0x040e}, /* LANG_Hu */ {"Pl",0x0415}, /* LANG_Pl */ {"Pt",0x0416}, /* LANG_Pt */ {"Sk",0x041b}, /* LANG_Sk */ {"Sv",0x041d}, /* LANG_Sv */ {"Ca",0x0403}, /* LANG_Ca */ {"Nl",0x0413}, /* LANG_Nl */ {"Ru",0x0419}, /* LANG_Ru */ {"Wa",0x0490}, /* LANG_Wa */ {"Ga",0x043c}, /* LANG_Ga */ {"Gd",0x083c}, /* LANG_Gd */ {"Gv",0x0c3c}, /* LANG_Gv */ {"Kw",0x0491}, /* LANG_Kw */ {"Cy",0x0492}, /* LANG_Cy */ {"Br",0x0493}, /* LANG_Br */ {"Ja",0x0411}, /* LANG_Ja */ {NULL,0} }; WORD WINE_LanguageId = 0x409; /* english as default */ struct options Options = { /* default options */ 0, /* argc */ NULL, /* argv */ NULL, /* desktopGeometry */ NULL, /* display */ NULL, /* dllFlags */ FALSE, /* synchronous */ FALSE, /* debug */ 0, /* language */ FALSE, /* Managed windows */ NULL /* Alternate config file name */ }; const char *argv0; /*********************************************************************** * MAIN_ParseDebugOptions * * Turns specific debug messages on or off, according to "options". */ void MAIN_ParseDebugOptions( const char *arg ) { /* defined in relay32/relay386.c */ extern char **debug_relay_includelist; extern char **debug_relay_excludelist; /* defined in relay32/snoop.c */ extern char **debug_snoop_includelist; extern char **debug_snoop_excludelist; int i; int l, cls, dotracerelay = TRACE_ON(relay); char *options = strdup(arg); l = strlen(options); if (l<2) goto error; if (options[l-1]=='\n') options[l-1]='\0'; do { if ((*options!='+')&&(*options!='-')){ int j; for(j=0; j 0x56 */ /*x57*/ /*LANG_ENTRY_BEGIN( "??", KONKANI ) LANG_ENTRY_END( KONKANI ) */ /* 0x58 -> ... */ LANG_ENTRY_BEGIN( "eo", ESPERANTO ) /* not official */ LANG_ENTRY_END( ESPERANTO ) LANG_ENTRY_BEGIN( "wa", WALON ) /* not official */ LANG_ENTRY_END( WALON ) ret = LANG_ENGLISH; end_MAIN_GetLanguageID: if (Charset) free(charset); free(dialect); return ret; } /*********************************************************************** * MAIN_ParseLanguageOption * * Parse -language option. */ void MAIN_ParseLanguageOption( const char *arg ) { const WINE_LANGUAGE_DEF *p = Languages; Options.language = LANG_Xx; /* First (dummy) language */ for (;p->name;p++) { if (!lstrcmpiA( p->name, arg )) { WINE_LanguageId = p->langid; return; } Options.language++; } MESSAGE( "Invalid language specified '%s'. Supported languages are: ", arg ); for (p = Languages; p->name; p++) MESSAGE( "%s ", p->name ); MESSAGE( "\n" ); ExitProcess(1); } /*********************************************************************** * called_at_exit */ static void called_at_exit(void) { CONSOLE_Close(); } /*********************************************************************** * MAIN_WineInit * * Wine initialisation and command-line parsing */ BOOL MAIN_WineInit( int argc, char *argv[] ) { struct timeval tv; #ifdef MALLOC_DEBUGGING char *trace; mcheck(NULL); if (!(trace = getenv("MALLOC_TRACE"))) { MESSAGE( "MALLOC_TRACE not set. No trace generated\n" ); } else { MESSAGE( "malloc trace goes to %s\n", trace ); mtrace(); } #endif setbuf(stdout,NULL); setbuf(stderr,NULL); setlocale(LC_CTYPE,""); gettimeofday( &tv, NULL); MSG_WineStartTicks = (tv.tv_sec * 1000) + (tv.tv_usec / 1000); OPTIONS_ParseOptions( argc, argv ); atexit(called_at_exit); return TRUE; } /*********************************************************************** * MessageBeep16 (USER.104) */ void WINAPI MessageBeep16( UINT16 i ) { MessageBeep( i ); } /*********************************************************************** * MessageBeep (USER32.390) */ BOOL WINAPI MessageBeep( UINT i ) { KEYBOARD_Beep(); return TRUE; } /*********************************************************************** * Beep (KERNEL32.11) */ BOOL WINAPI Beep( DWORD dwFreq, DWORD dwDur ) { /* dwFreq and dwDur are ignored by Win95 */ KEYBOARD_Beep(); return TRUE; } /*********************************************************************** * FileCDR (KERNEL.130) */ FARPROC16 WINAPI FileCDR16(FARPROC16 x) { FIXME_(file)("(0x%8x): stub\n", (int) x); return (FARPROC16)TRUE; } /*********************************************************************** * GetTickCount (USER.13) (KERNEL32.299) * * Returns the number of milliseconds, modulo 2^32, since the start * of the current session. */ DWORD WINAPI GetTickCount(void) { struct timeval t; gettimeofday( &t, NULL ); return ((t.tv_sec * 1000) + (t.tv_usec / 1000)) - MSG_WineStartTicks; }