4 * Copyright 1994 Alexandre Julliard
9 #ifndef X_DISPLAY_MISSING
11 #else /* !defined(X_DISPLAY_MISSING) */
13 #endif /* !defined(X_DISPLAY_MISSING) */
20 #ifdef MALLOC_DEBUGGING
32 #include "builtin32.h"
33 #include "debugtools.h"
34 #include "debugdefs.h"
46 #include "wine/winuser16.h"
50 /**********************************************************************/
52 USER_DRIVER *USER_Driver = NULL;
54 /* when adding new languages look at ole/ole2nls.c
55 * for proper iso name and Windows code (add 0x0400
56 * to the code listed there)
58 const WINE_LANGUAGE_DEF Languages[] =
60 {"En",0x0409}, /* LANG_En */
61 {"Es",0x040A}, /* LANG_Es */
62 {"De",0x0407}, /* LANG_De */
63 {"No",0x0414}, /* LANG_No */
64 {"Fr",0x040C}, /* LANG_Fr */
65 {"Fi",0x040B}, /* LANG_Fi */
66 {"Da",0x0406}, /* LANG_Da */
67 {"Cs",0x0405}, /* LANG_Cs */
68 {"Eo",0x048f}, /* LANG_Eo */
69 {"It",0x0410}, /* LANG_It */
70 {"Ko",0x0412}, /* LANG_Ko */
71 {"Hu",0x040e}, /* LANG_Hu */
72 {"Pl",0x0415}, /* LANG_Pl */
73 {"Pt",0x0416}, /* LANG_Pt */
74 {"Sk",0x041b}, /* LANG_Sk */
75 {"Sv",0x041d}, /* LANG_Sv */
76 {"Ca",0x0403}, /* LANG_Ca */
77 {"Nl",0x0413}, /* LANG_Nl */
78 {"Ru",0x0419}, /* LANG_Ru */
79 {"Wa",0x0490}, /* LANG_Wa */
80 {"Ga",0x043c}, /* LANG_Ga */
81 {"Gd",0x083c}, /* LANG_Gd */
82 {"Gv",0x0c3c}, /* LANG_Gv */
83 {"Kw",0x0491}, /* LANG_Kw */
84 {"Cy",0x0492}, /* LANG_Cy */
85 {"Br",0x0493}, /* LANG_Br */
86 {"Ja",0x0411}, /* LANG_Ja */
90 WORD WINE_LanguageId = 0x409; /* english as default */
92 struct options Options =
93 { /* default options */
96 NULL, /* desktopGeometry */
97 NULL, /* programName */
99 FALSE, /* usePrivateMap */
100 FALSE, /* synchronous */
102 FALSE, /* failReadOnly */
104 DEFAULT_LANG, /* Default language */
108 FALSE, /* Managed windows */
109 FALSE, /* Perfect graphics */
113 NULL, /* Alternate config file name */
119 static const char szUsage[] =
121 " -config name Specify config file to use\n"
122 " -debug Enter debugger before starting application\n"
123 " -debugmsg name Turn debugging-messages on or off\n"
124 " -depth n Change the depth to use for multiple-depth screens\n"
125 " -desktop geom Use a desktop window of the given geometry\n"
126 " -display name Use the specified display\n"
127 " -dll name Enable or disable built-in DLLs\n"
128 " -failreadonly Read only files may not be opened in write mode\n"
129 " -help Show this help message\n"
130 " -language xx Set the language (one of Br,Ca,Cs,Cy,Da,De,En,Eo,Es,Fi,Fr,Ga,Gd,Gv\n"
131 " Hu,It,Ja,Ko,Kw,Nl,No,Pl,Pt,Sk,Sv,Ru,Wa)\n"
132 " -managed Allow the window manager to manage created windows\n"
133 " -name name Set the application name\n"
134 " -nodga Disable XFree86 DGA extensions\n"
135 " -noxshm Disable XSHM extension\n"
136 " -dxgrab Enable DirectX mouse grab\n"
137 " -perfect Favor correctness over speed for graphical operations\n"
138 " -privatemap Use a private color map\n"
139 " -synchronous Turn on synchronous display mode\n"
140 " -version Display the Wine version\n"
141 " -winver Version to imitate (one of win31,win95,nt351,nt40)\n"
142 " -dosver DOS version to imitate (x.xx, e.g. 6.22). Only valid with -winver win31\n"
145 /***********************************************************************
148 void MAIN_Usage( char *name )
150 MESSAGE( WINE_RELEASE_INFO "\nUsage: %s [options] \"program_name [arguments]\"\n\n", name );
151 write( 2, szUsage, sizeof(szUsage)-1 ); /* too large for MESSAGE() */
155 /***********************************************************************
156 * MAIN_GetProgramName
158 * Get the program name. The name is specified by (in order of precedence):
159 * - the option '-name'.
160 * - the environment variable 'WINE_NAME'.
161 * - the last component of argv[0].
163 static char *MAIN_GetProgramName( int argc, char *argv[] )
168 for (i = 1; i < argc-1; i++)
169 if (!strcmp( argv[i], "-name" )) return argv[i+1];
170 if ((p = getenv( "WINE_NAME" )) != NULL) return p;
171 if ((p = strrchr( argv[0], '/' )) != NULL) return p+1;
175 /***********************************************************************
176 * MAIN_ParseDebugOptions
178 * Turns specific debug messages on or off, according to "options".
181 * TRUE if parsing was successful
183 BOOL MAIN_ParseDebugOptions(char *options)
185 /* defined in relay32/relay386.c */
186 extern char **debug_relay_includelist;
187 extern char **debug_relay_excludelist;
188 /* defined in relay32/snoop.c */
189 extern char **debug_snoop_includelist;
190 extern char **debug_snoop_excludelist;
193 int l, cls, dotracerelay = TRACE_ON(relay);
198 if (options[l-1]=='\n') options[l-1]='\0';
201 if ((*options!='+')&&(*options!='-')){
204 for(j=0; j<DEBUG_CLASS_COUNT; j++)
205 if(!lstrncmpiA(options, debug_cl_name[j], strlen(debug_cl_name[j])))
207 if(j==DEBUG_CLASS_COUNT)
209 options += strlen(debug_cl_name[j]);
210 if ((*options!='+')&&(*options!='-'))
215 cls = -1; /* all classes */
217 if (strchr(options,','))
218 l=strchr(options,',')-options;
222 if (!lstrncmpiA(options+1,"all",l-1))
225 for (i=0; i<DEBUG_CHANNEL_COUNT; i++)
226 for(j=0; j<DEBUG_CLASS_COUNT; j++)
227 if(cls == -1 || cls == j)
228 __SET_DEBUGGING( j, debug_channels[i], (*options=='+') );
230 else if (!lstrncmpiA(options+1, "relay=", 6) ||
231 !lstrncmpiA(options+1, "snoop=", 6))
234 char *s, *s2, ***output, c;
236 for (i=0; i<DEBUG_CHANNEL_COUNT; i++)
237 if (!strncasecmp( debug_channels[i] + 1, options + 1, 5))
239 for(j=0; j<DEBUG_CLASS_COUNT; j++)
240 if(cls == -1 || cls == j)
241 __SET_DEBUGGING( j, debug_channels[i], 1 );
244 /* should never happen, maybe assert(i!=DEBUG_CHANNEL_COUNT)? */
245 if (i==DEBUG_CHANNEL_COUNT)
247 output = (*options == '+') ?
248 ((*(options+1) == 'r') ?
249 &debug_relay_includelist :
250 &debug_snoop_includelist) :
251 ((*(options+1) == 'r') ?
252 &debug_relay_excludelist :
253 &debug_snoop_excludelist);
255 /* if there are n ':', there are n+1 modules, and we need n+2 slots
256 * last one being for the sentinel (NULL) */
258 while((s = strchr(s, ':'))) i++, s++;
259 *output = malloc(sizeof(char **) * i);
262 while((s2 = strchr(s, ':'))) {
265 *((*output)+i) = CharUpperA(strdup(s));
271 *(options + l) = '\0';
272 *((*output)+i) = CharUpperA(strdup(s));
274 *((*output)+i+1) = NULL;
279 for (i=0; i<DEBUG_CHANNEL_COUNT; i++)
280 if (!strncasecmp( debug_channels[i] + 1, options + 1, l - 1) && !debug_channels[i][l])
282 for(j=0; j<DEBUG_CLASS_COUNT; j++)
283 if(cls == -1 || cls == j)
284 __SET_DEBUGGING( j, debug_channels[i], (*options=='+') );
287 if (i==DEBUG_CHANNEL_COUNT)
292 while((*options==',')&&(*(++options)));
294 /* special handling for relay debugging */
295 if (dotracerelay != TRACE_ON(relay))
296 BUILTIN32_SwitchRelayDebug( TRACE_ON(relay) );
302 MESSAGE("%s: Syntax: -debugmsg [class]+xxx,... or "
303 "-debugmsg [class]-xxx,...\n",Options.argv[0]);
304 MESSAGE("Example: -debugmsg +all,warn-heap\n"
305 " turn on all messages except warning heap messages\n");
306 MESSAGE("Special case: -debugmsg +relay=DLL:DLL.###:FuncName\n"
307 " turn on -debugmsg +relay only as specified\n"
308 "Special case: -debugmsg -relay=DLL:DLL.###:FuncName\n"
309 " turn on -debugmsg +relay except as specified\n"
310 "Also permitted, +snoop=..., -snoop=... as with relay.\n\n");
312 MESSAGE("Available message classes:\n");
313 for(i=0;i<DEBUG_CLASS_COUNT;i++)
314 MESSAGE( "%-9s", debug_cl_name[i]);
317 MESSAGE("Available message types:\n");
318 MESSAGE("%-9s ","all");
319 for(i=0;i<DEBUG_CHANNEL_COUNT;i++)
320 MESSAGE("%-9s%c",debug_channels[i] + 1,
321 (((i+2)%8==0)?'\n':' '));
327 /***********************************************************************
331 * Lang: a string whose two first chars are the iso name of a language.
332 * Country: a string whose two first chars are the iso name of country
333 * Charset: a string defining the chossen charset encoding
334 * Dialect: a string defining a variation of the locale
336 * all those values are from the standardized format of locale
337 * name in unix which is: Lang[_Country][.Charset][@Dialect]
340 * the numeric code of the language used by Windows (or 0x00)
342 int MAIN_GetLanguageID(LPCSTR Lang,LPCSTR Country,LPCSTR Charset,LPCSTR Dialect)
344 char lang[3]="??", country[3]={0,0,0};
345 char *charset=NULL, *dialect=NULL;
348 if (Lang==NULL) return 0x00;
349 if (Lang[0]) lang[0]=tolower(Lang[0]);
350 if (Lang[1]) lang[1]=tolower(Lang[1]);
353 if (Country[0]) country[0]=toupper(Country[0]);
354 if (Country[1]) country[1]=toupper(Country[1]);
359 charset=(char*)malloc(j+1);
361 charset[i]=toupper(Charset[i]);
367 dialect=(char*)malloc(j+1);
369 dialect[i]=tolower(Dialect[i]);
376 #define LANG_ENTRY_BEGIN(x,y) if(!strcmp(lang, x )) { \
379 goto end_MAIN_GetLanguageID; \
381 #define LANG_SUB_ENTRY(x,y,z) if (!strcmp(country, x )) \
382 ret = MAKELANGID( LANG_##y , SUBLANG_##z ); \
383 goto end_MAIN_GetLanguageID;
384 #define LANG_DIALECT_ENTRY(x,y) { ret = MAKELANGID(LANG_##x , SUBLANG_##y ); \
385 goto end_MAIN_GetLanguageID; }
386 #define LANG_ENTRY_END(x) ret = MAKELANGID(LANG_##x , SUBLANG_DEFAULT); \
387 goto end_MAIN_GetLanguageID; \
390 /*x01*/ LANG_ENTRY_BEGIN( "ar", ARABIC )
391 LANG_SUB_ENTRY( "SA", ARABIC, ARABIC)
392 LANG_SUB_ENTRY( "IQ", ARABIC, ARABIC_IRAQ )
393 LANG_SUB_ENTRY( "EG", ARABIC, ARABIC_EGYPT )
394 LANG_SUB_ENTRY( "LY", ARABIC, ARABIC_LIBYA )
395 LANG_SUB_ENTRY( "DZ", ARABIC, ARABIC_ALGERIA )
396 LANG_SUB_ENTRY( "MA", ARABIC, ARABIC_MOROCCO )
397 LANG_SUB_ENTRY( "TN", ARABIC, ARABIC_TUNISIA )
398 LANG_SUB_ENTRY( "OM", ARABIC, ARABIC_OMAN )
399 LANG_SUB_ENTRY( "YE", ARABIC, ARABIC_YEMEN )
400 LANG_SUB_ENTRY( "SY", ARABIC, ARABIC_SYRIA )
401 LANG_SUB_ENTRY( "JO", ARABIC, ARABIC_JORDAN )
402 LANG_SUB_ENTRY( "LB", ARABIC, ARABIC_LEBANON )
403 LANG_SUB_ENTRY( "KW", ARABIC, ARABIC_KUWAIT )
404 LANG_SUB_ENTRY( "AE", ARABIC, ARABIC_UAE )
405 LANG_SUB_ENTRY( "BH", ARABIC, ARABIC_BAHRAIN )
406 LANG_SUB_ENTRY( "QA", ARABIC, ARABIC_QATAR )
407 LANG_ENTRY_END( ARABIC )
408 /*x02*/ LANG_ENTRY_BEGIN( "bu", BULGARIAN )
409 LANG_ENTRY_END( BULGARIAN )
410 /*x03*/ LANG_ENTRY_BEGIN( "ca", CATALAN )
411 LANG_ENTRY_END( CATALAN )
412 /*x04*/ LANG_ENTRY_BEGIN( "zh", CHINESE )
413 LANG_SUB_ENTRY( "TW", CHINESE, CHINESE_TRADITIONAL )
414 LANG_SUB_ENTRY( "CN", CHINESE, CHINESE_SIMPLIFIED )
415 LANG_SUB_ENTRY( "HK", CHINESE, CHINESE_HONGKONG )
416 LANG_SUB_ENTRY( "SG", CHINESE, CHINESE_SINGAPORE )
417 LANG_SUB_ENTRY( "MO", CHINESE, CHINESE_MACAU )
418 LANG_ENTRY_END( CHINESE )
419 /*x05*/ LANG_ENTRY_BEGIN( "cs", CZECH )
420 LANG_ENTRY_END( CZECH )
421 /*x06*/ LANG_ENTRY_BEGIN( "da", DANISH )
422 LANG_ENTRY_END( DANISH )
423 /*x07*/ LANG_ENTRY_BEGIN( "de", GERMAN )
424 LANG_SUB_ENTRY( "DE", GERMAN, GERMAN )
425 LANG_SUB_ENTRY( "CH", GERMAN, GERMAN_SWISS )
426 LANG_SUB_ENTRY( "AT", GERMAN, GERMAN_AUSTRIAN )
427 LANG_SUB_ENTRY( "LU", GERMAN, GERMAN_LUXEMBOURG )
428 LANG_SUB_ENTRY( "LI", GERMAN, GERMAN_LIECHTENSTEIN )
429 LANG_ENTRY_END( GERMAN )
430 /*x08*/ LANG_ENTRY_BEGIN( "el", GREEK )
431 LANG_ENTRY_END( GREEK )
432 /*x09*/ LANG_ENTRY_BEGIN( "en", ENGLISH )
433 LANG_SUB_ENTRY( "US", ENGLISH, ENGLISH_US )
434 LANG_SUB_ENTRY( "UK", ENGLISH, ENGLISH_UK )
435 LANG_SUB_ENTRY( "AU", ENGLISH, ENGLISH_AUS )
436 LANG_SUB_ENTRY( "CA", ENGLISH, ENGLISH_CAN )
437 LANG_SUB_ENTRY( "NZ", ENGLISH, ENGLISH_NZ )
438 LANG_SUB_ENTRY( "EI", ENGLISH, ENGLISH_EIRE )
439 LANG_SUB_ENTRY( "ZA", ENGLISH, ENGLISH_SAFRICA )
440 LANG_SUB_ENTRY( "JM", ENGLISH, ENGLISH_JAMAICA )
441 /* LANG_SUB_ENTRY( "AG", ENGLISH, ENGLISH_CARIBBEAN ) */
442 LANG_SUB_ENTRY( "BZ", ENGLISH, ENGLISH_BELIZE )
443 LANG_SUB_ENTRY( "TT", ENGLISH, ENGLISH_TRINIDAD )
444 LANG_SUB_ENTRY( "ZW", ENGLISH, ENGLISH_ZIMBABWE )
445 LANG_SUB_ENTRY( "PH", ENGLISH, ENGLISH_PHILIPPINES )
446 LANG_ENTRY_END( ENGLISH )
447 /*x0a*/ LANG_ENTRY_BEGIN( "es", SPANISH )
448 /* traditional sorting */
449 if (!strcmp(dialect,"tradicional"))
450 LANG_DIALECT_ENTRY( SPANISH, SPANISH )
451 LANG_SUB_ENTRY( "MX", SPANISH, SPANISH_MEXICAN )
452 LANG_SUB_ENTRY( "ES", SPANISH, SPANISH_MODERN )
453 LANG_SUB_ENTRY( "GT", SPANISH, SPANISH_GUATEMALA )
454 LANG_SUB_ENTRY( "CR", SPANISH, SPANISH_COSTARICA )
455 LANG_SUB_ENTRY( "PA", SPANISH, SPANISH_PANAMA )
456 LANG_SUB_ENTRY( "DO", SPANISH, SPANISH_DOMINICAN )
457 LANG_SUB_ENTRY( "VE", SPANISH, SPANISH_VENEZUELA )
458 LANG_SUB_ENTRY( "CO", SPANISH, SPANISH_COLOMBIA )
459 LANG_SUB_ENTRY( "PE", SPANISH, SPANISH_PERU )
460 LANG_SUB_ENTRY( "AR", SPANISH, SPANISH_ARGENTINA )
461 LANG_SUB_ENTRY( "EC", SPANISH, SPANISH_ECUADOR )
462 LANG_SUB_ENTRY( "CL", SPANISH, SPANISH_CHILE )
463 LANG_SUB_ENTRY( "UY", SPANISH, SPANISH_URUGUAY )
464 LANG_SUB_ENTRY( "PY", SPANISH, SPANISH_PARAGUAY )
465 LANG_SUB_ENTRY( "BO", SPANISH, SPANISH_BOLIVIA )
466 LANG_SUB_ENTRY( "HN", SPANISH, SPANISH_HONDURAS )
467 LANG_SUB_ENTRY( "NI", SPANISH, SPANISH_NICARAGUA )
468 LANG_SUB_ENTRY( "PR", SPANISH, SPANISH_PUERTO_RICO )
469 LANG_ENTRY_END( SPANISH )
470 /*x0b*/ LANG_ENTRY_BEGIN( "fi", FINNISH )
471 LANG_ENTRY_END( FINNISH )
472 /*x0c*/ LANG_ENTRY_BEGIN( "fr", FRENCH )
473 LANG_SUB_ENTRY( "FR", FRENCH, FRENCH )
474 LANG_SUB_ENTRY( "BE", FRENCH, FRENCH_BELGIAN )
475 LANG_SUB_ENTRY( "CA", FRENCH, FRENCH_CANADIAN )
476 LANG_SUB_ENTRY( "CH", FRENCH, FRENCH_SWISS )
477 LANG_SUB_ENTRY( "LU", FRENCH, FRENCH_LUXEMBOURG )
478 LANG_SUB_ENTRY( "MC", FRENCH, FRENCH_MONACO )
479 LANG_ENTRY_END( FRENCH )
480 /*x0d*/ LANG_ENTRY_BEGIN( "iw", HEBREW )
481 LANG_ENTRY_END( HEBREW )
482 /*x0e*/ LANG_ENTRY_BEGIN( "hu", HUNGARIAN )
483 LANG_ENTRY_END( HUNGARIAN )
484 /*x0f*/ LANG_ENTRY_BEGIN( "ic", ICELANDIC )
485 LANG_ENTRY_END( ICELANDIC )
486 /*x10*/ LANG_ENTRY_BEGIN( "it", ITALIAN )
487 LANG_SUB_ENTRY( "IT", ITALIAN, ITALIAN )
488 LANG_SUB_ENTRY( "CH", ITALIAN, ITALIAN_SWISS )
489 LANG_ENTRY_END( ITALIAN )
490 /*x11*/ LANG_ENTRY_BEGIN( "ja", JAPANESE )
491 LANG_ENTRY_END( JAPANESE )
492 /*x12*/ LANG_ENTRY_BEGIN( "ko", KOREAN )
494 if (!strcmp(charset,"JOHAB"))
495 LANG_DIALECT_ENTRY( KOREAN, KOREAN_JOHAB )
497 LANG_DIALECT_ENTRY( KOREAN, KOREAN )
498 LANG_ENTRY_END( KOREAN )
499 /*x13*/ LANG_ENTRY_BEGIN( "nl", DUTCH )
500 LANG_SUB_ENTRY( "NL", DUTCH, DUTCH )
501 LANG_SUB_ENTRY( "BE", DUTCH, DUTCH_BELGIAN )
502 LANG_SUB_ENTRY( "SR", DUTCH, DUTCH_SURINAM )
503 LANG_ENTRY_END( DUTCH )
504 /*x14*/ LANG_ENTRY_BEGIN( "no", NORWEGIAN )
506 if (!strcmp(dialect,"nynorsk"))
507 LANG_DIALECT_ENTRY( NORWEGIAN, NORWEGIAN_NYNORSK )
509 LANG_DIALECT_ENTRY( NORWEGIAN, NORWEGIAN_BOKMAL )
510 LANG_ENTRY_END( NORWEGIAN )
511 /*x15*/ LANG_ENTRY_BEGIN( "pl", POLISH )
512 LANG_ENTRY_END( POLISH )
513 /*x16*/ LANG_ENTRY_BEGIN( "pt", PORTUGUESE )
514 LANG_SUB_ENTRY( "BR", PORTUGUESE, PORTUGUESE_BRAZILIAN )
515 LANG_SUB_ENTRY( "PT", PORTUGUESE, PORTUGUESE )
516 LANG_ENTRY_END( PORTUGUESE )
517 /*x17*/ LANG_ENTRY_BEGIN( "rm", RHAETO_ROMANCE )
518 LANG_ENTRY_END( RHAETO_ROMANCE )
519 /*x18*/ LANG_ENTRY_BEGIN( "ro", ROMANIAN )
520 LANG_SUB_ENTRY( "RO", ROMANIAN, ROMANIAN )
521 LANG_SUB_ENTRY( "MD", ROMANIAN, ROMANIAN_MOLDAVIA )
522 LANG_ENTRY_END( ROMANIAN )
523 /*x19*/ LANG_ENTRY_BEGIN( "ru", RUSSIAN )
524 LANG_SUB_ENTRY( "RU", RUSSIAN, RUSSIAN )
525 LANG_SUB_ENTRY( "MD", RUSSIAN, RUSSIAN_MOLDAVIA )
526 LANG_ENTRY_END( RUSSIAN )
527 /*x1a*/ if (!strcmp(lang,"sh") || !strcmp(lang,"hr") || !strcmp(lang,"sr")) {
529 LANG_DIALECT_ENTRY( SERBO_CROATIAN, NEUTRAL)
530 if (!strcmp(charset,"ISO-8859-5"))
531 LANG_DIALECT_ENTRY( SERBO_CROATIAN, SERBIAN )
532 LANG_SUB_ENTRY( "HR", SERBO_CROATIAN, CROATIAN )
533 if (!strcmp(country,"YU") && !strcmp(charset,"ISO-8859-2"))
534 LANG_DIALECT_ENTRY( SERBO_CROATIAN, SERBIAN_LATIN )
535 LANG_SUB_ENTRY( "YU", SERBO_CROATIAN, SERBIAN )
536 LANG_DIALECT_ENTRY( SERBO_CROATIAN, SERBIAN_LATIN )
538 /*x1b*/ LANG_ENTRY_BEGIN( "sk", SLOVAK )
539 LANG_ENTRY_END( SLOVAK )
540 /*x1c*/ LANG_ENTRY_BEGIN( "sq", ALBANIAN )
541 LANG_ENTRY_END( ALBANIAN )
542 /*x1d*/ LANG_ENTRY_BEGIN( "sv", SWEDISH )
543 LANG_SUB_ENTRY( "SE", SWEDISH, SWEDISH )
544 LANG_SUB_ENTRY( "FI", SWEDISH, SWEDISH_FINLAND )
545 LANG_ENTRY_END( SWEDISH )
546 /*x1e*/ LANG_ENTRY_BEGIN( "th", THAI )
547 LANG_ENTRY_END( THAI )
548 /*x1f*/ LANG_ENTRY_BEGIN( "tr", TURKISH )
549 LANG_ENTRY_END( TURKISH )
550 /*x20*/ LANG_ENTRY_BEGIN( "ur", URDU )
551 LANG_ENTRY_END( URDU )
552 /*x21*/ LANG_ENTRY_BEGIN( "in", INDONESIAN )
553 LANG_ENTRY_END( INDONESIAN )
554 /*x22*/ LANG_ENTRY_BEGIN( "uk", UKRAINIAN )
555 LANG_ENTRY_END( UKRAINIAN )
556 /*x23*/ LANG_ENTRY_BEGIN( "be", BYELORUSSIAN )
557 LANG_ENTRY_END( BYELORUSSIAN )
558 /*x24*/ LANG_ENTRY_BEGIN( "sl", SLOVENIAN )
559 LANG_ENTRY_END( SLOVENIAN )
560 /*x25*/ LANG_ENTRY_BEGIN( "et", ESTONIAN )
561 LANG_ENTRY_END( ESTONIAN )
562 /*x26*/ LANG_ENTRY_BEGIN( "lv", LATVIAN )
563 LANG_ENTRY_END( LATVIAN )
564 /*x27*/ LANG_ENTRY_BEGIN( "lt", LITHUANIAN )
565 /* traditional sorting ? */
566 if (!strcmp(dialect,"classic") || !strcmp(dialect,"traditional"))
567 LANG_DIALECT_ENTRY( LITHUANIAN, LITHUANIAN_CLASSIC )
569 LANG_DIALECT_ENTRY( LITHUANIAN, LITHUANIAN )
570 LANG_ENTRY_END( LITHUANIAN )
571 /*x28*/ LANG_ENTRY_BEGIN( "mi", MAORI )
572 LANG_ENTRY_END( MAORI )
573 /*x29*/ LANG_ENTRY_BEGIN( "fa", FARSI )
574 LANG_ENTRY_END( FARSI )
575 /*x2a*/ LANG_ENTRY_BEGIN( "vi", VIETNAMESE )
576 LANG_ENTRY_END( VIETNAMESE )
577 /*x2b*/ LANG_ENTRY_BEGIN( "hy", ARMENIAN )
578 LANG_ENTRY_END( ARMENIAN )
579 /*x2c*/ LANG_ENTRY_BEGIN( "az", AZERI )
581 if (strstr(charset,"KOI8") || !strcmp(charset,"ISO-8859-5"))
582 LANG_DIALECT_ENTRY( AZERI, AZERI_CYRILLIC )
584 LANG_DIALECT_ENTRY( AZERI, AZERI )
585 LANG_ENTRY_END( AZERI )
586 /*x2d*/ LANG_ENTRY_BEGIN( "eu", BASQUE )
587 LANG_ENTRY_END( BASQUE )
588 /*x2e*/ /*LANG_ENTRY_BEGIN( "??", SORBIAN )
589 LANG_ENTRY_END( SORBIAN ) */
590 /*x2f*/ LANG_ENTRY_BEGIN( "mk", MACEDONIAN )
591 LANG_ENTRY_END( MACEDONIAN )
592 /*x30*/ /*LANG_ENTRY_BEGIN( "??", SUTU )
593 LANG_ENTRY_END( SUTU ) */
594 /*x31*/ LANG_ENTRY_BEGIN( "ts", TSONGA )
595 LANG_ENTRY_END( TSONGA )
596 /*x32*/ /*LANG_ENTRY_BEGIN( "??", TSWANA )
597 LANG_ENTRY_END( TSWANA ) */
598 /*x33*/ /*LANG_ENTRY_BEGIN( "??", VENDA )
599 LANG_ENTRY_END( VENDA ) */
600 /*x34*/ LANG_ENTRY_BEGIN( "xh", XHOSA )
601 LANG_ENTRY_END( XHOSA )
602 /*x35*/ LANG_ENTRY_BEGIN( "zu", ZULU )
603 LANG_ENTRY_END( ZULU )
604 /*x36*/ LANG_ENTRY_BEGIN( "af", AFRIKAANS )
605 LANG_ENTRY_END( AFRIKAANS )
606 /*x37*/ LANG_ENTRY_BEGIN( "ka", GEORGIAN )
607 LANG_ENTRY_END( GEORGIAN )
608 /*x38*/ LANG_ENTRY_BEGIN( "fo", FAEROESE )
609 LANG_ENTRY_END( FAEROESE )
610 /*x39*/ LANG_ENTRY_BEGIN( "hi", HINDI )
611 LANG_ENTRY_END( HINDI )
612 /*x3a*/ LANG_ENTRY_BEGIN( "mt", MALTESE )
613 LANG_ENTRY_END( MALTESE )
614 /*x3b*/ /*LANG_ENTRY_BEGIN( "??", SAAMI )
615 LANG_ENTRY_END( SAAMI ) */
616 /*x3c*/ LANG_ENTRY_BEGIN( "ga", GAELIC )
617 LANG_DIALECT_ENTRY( GAELIC, GAELIC )
618 LANG_ENTRY_END( GAELIC )
619 /*x3c*/ LANG_ENTRY_BEGIN( "gd", GAELIC )
620 LANG_DIALECT_ENTRY( GAELIC, GAELIC_SCOTTISH )
621 LANG_ENTRY_END( GAELIC )
623 /*x3e*/ LANG_ENTRY_BEGIN( "ms", MALAY )
624 LANG_SUB_ENTRY( "MY", MALAY, MALAY )
625 LANG_SUB_ENTRY( "BN", MALAY, MALAY_BRUNEI_DARUSSALAM )
626 LANG_ENTRY_END( MALAY )
627 /*x3f*/ LANG_ENTRY_BEGIN( "kk", KAZAKH )
628 LANG_ENTRY_END( KAZAKH )
630 /*x41*/ LANG_ENTRY_BEGIN( "sw", SWAHILI )
631 LANG_ENTRY_END( SWAHILI )
633 /*x43*/ LANG_ENTRY_BEGIN( "uz", UZBEK )
635 if (strstr(charset,"KOI8") || !strcmp(charset,"ISO-8859-5"))
636 LANG_DIALECT_ENTRY( UZBEK, UZBEK_CYRILLIC )
638 LANG_DIALECT_ENTRY( UZBEK, UZBEK )
639 LANG_ENTRY_END( UZBEK )
640 /*x44*/ LANG_ENTRY_BEGIN( "tt", TATAR )
641 LANG_ENTRY_END( TATAR )
642 /*x45*/ LANG_ENTRY_BEGIN( "bn", BENGALI )
643 LANG_ENTRY_END( BENGALI )
644 /*x46*/ LANG_ENTRY_BEGIN( "pa", PUNJABI )
645 LANG_ENTRY_END( PUNJABI )
646 /*x47*/ LANG_ENTRY_BEGIN( "gu", GUJARATI )
647 LANG_ENTRY_END( GUJARATI )
648 /*x48*/ LANG_ENTRY_BEGIN( "or", ORIYA )
649 LANG_ENTRY_END( ORIYA )
650 /*x49*/ LANG_ENTRY_BEGIN( "ta", TAMIL )
651 LANG_ENTRY_END( TAMIL )
652 /*x4a*/ LANG_ENTRY_BEGIN( "te", TELUGU )
653 LANG_ENTRY_END( TELUGU )
654 /*x4b*/ LANG_ENTRY_BEGIN( "kn", KANNADA )
655 LANG_ENTRY_END( KANNADA )
656 /*x4c*/ LANG_ENTRY_BEGIN( "ml", MALAYALAM )
657 LANG_ENTRY_END( MALAYALAM )
658 /*x4d*/ LANG_ENTRY_BEGIN( "as", ASSAMESE )
659 LANG_ENTRY_END( ASSAMESE )
660 /*x4e*/ LANG_ENTRY_BEGIN( "mr", MARATHI )
661 LANG_ENTRY_END( MARATHI )
662 /*x4f*/ LANG_ENTRY_BEGIN( "sa", SANSKRIT )
663 LANG_ENTRY_END( SANSKRIT )
665 /*x57*/ /*LANG_ENTRY_BEGIN( "??", KONKANI )
666 LANG_ENTRY_END( KONKANI ) */
668 LANG_ENTRY_BEGIN( "eo", ESPERANTO ) /* not official */
669 LANG_ENTRY_END( ESPERANTO )
670 LANG_ENTRY_BEGIN( "wa", WALON ) /* not official */
671 LANG_ENTRY_END( WALON )
675 end_MAIN_GetLanguageID:
676 if (Charset) free(charset);
682 /***********************************************************************
683 * MAIN_ParseLanguageOption
685 * Parse -language option.
687 void MAIN_ParseLanguageOption( char *arg )
689 const WINE_LANGUAGE_DEF *p = Languages;
691 /* for compatibility whith non-iso names previously used */
692 if (!strcmp("Sw",arg)) { strcpy(arg,"Sv"); FIXME_(system)("use 'Sv' instead of 'Sw'\n");}
693 if (!strcmp("Cz",arg)) { strcpy(arg,"Cs"); FIXME_(system)("use 'Cs' instead of 'Cz'\n");}
694 if (!strcmp("Po",arg)) { strcpy(arg,"Pt"); FIXME_(system)("use 'Pt' instead of 'Po'\n");}
696 Options.language = LANG_Xx; /* First (dummy) language */
699 if (!lstrcmpiA( p->name, arg ))
701 WINE_LanguageId = p->langid;
706 MESSAGE( "Invalid language specified '%s'. Supported languages are: ", arg );
707 for (p = Languages; p->name; p++) MESSAGE( "%s ", p->name );
713 /***********************************************************************
716 * Parse command line options and open display.
718 static void MAIN_ParseOptions( int *argc, char *argv[] )
725 Options.programName = MAIN_GetProgramName( *argc, argv );
727 /* initialise Options.language to 0 to tell "no language choosen yet" */
728 Options.language = 0;
730 /* make sure there is no "." in Options.programName to confuse the X
731 resource database lookups */
732 if ((pcDot = strchr(Options.programName, '.'))) *pcDot = '\0';
734 for (i = 1; i < *argc; i++)
736 if (!strcmp( argv[i], "-v" ) || !strcmp( argv[i], "-version" ))
738 MESSAGE( "%s\n", WINE_RELEASE_INFO );
741 if (!strcmp( argv[i], "-h" ) || !strcmp( argv[i], "-help" ))
749 /***********************************************************************
752 static void called_at_exit(void)
755 GDI_Driver->pFinalize();
757 USER_Driver->pFinalize();
762 /***********************************************************************
765 * Wine initialisation and command-line parsing
767 BOOL MAIN_WineInit( int *argc, char *argv[] )
771 #ifdef MALLOC_DEBUGGING
775 if (!(trace = getenv("MALLOC_TRACE")))
777 MESSAGE( "MALLOC_TRACE not set. No trace generated\n" );
781 MESSAGE( "malloc trace goes to %s\n", trace );
789 setlocale(LC_CTYPE,"");
790 gettimeofday( &tv, NULL);
791 MSG_WineStartTicks = (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
793 MAIN_ParseOptions(argc, argv);
795 #ifndef X_DISPLAY_MISSING
796 USER_Driver = &X11DRV_USER_Driver;
797 #else /* !defined(X_DISPLAY_MISSING) */
798 USER_Driver = &TTYDRV_USER_Driver;
799 #endif /* !defined(X_DISPLAY_MISSING) */
801 USER_Driver->pInitialize();
803 MONITOR_Initialize(&MONITOR_PrimaryMonitor);
805 atexit(called_at_exit);
809 /***********************************************************************
810 * MessageBeep16 (USER.104)
812 void WINAPI MessageBeep16( UINT16 i )
818 /***********************************************************************
819 * MessageBeep32 (USER32.390)
821 BOOL WINAPI MessageBeep( UINT i )
828 /***********************************************************************
831 BOOL WINAPI Beep( DWORD dwFreq, DWORD dwDur )
833 /* dwFreq and dwDur are ignored by Win95 */
839 /***********************************************************************
840 * GetTimerResolution (USER.14)
842 LONG WINAPI GetTimerResolution16(void)
847 /***********************************************************************
848 * SystemParametersInfo32A (USER32.540)
850 BOOL WINAPI SystemParametersInfoA( UINT uAction, UINT uParam,
851 LPVOID lpvParam, UINT fuWinIni )
857 *(BOOL *) lpvParam = KEYBOARD_GetBeepActive();
860 KEYBOARD_SetBeepActive(uParam);
864 *(INT *)lpvParam = GetSystemMetrics( SM_CXFRAME );
867 case SPI_GETDRAGFULLWINDOWS:
868 *(BOOL *) lpvParam = FALSE;
871 case SPI_SETDRAGFULLWINDOWS:
874 case SPI_GETFASTTASKSWITCH:
875 if ( GetProfileIntA( "windows", "CoolSwitch", 1 ) == 1 )
876 *(BOOL *) lpvParam = TRUE;
878 *(BOOL *) lpvParam = FALSE;
881 case SPI_GETGRIDGRANULARITY:
882 *(INT*)lpvParam=GetProfileIntA("desktop","GridGranularity",1);
885 case SPI_GETICONTITLEWRAP:
886 *(BOOL*)lpvParam=GetProfileIntA("desktop","IconTitleWrap",TRUE);
889 case SPI_GETKEYBOARDDELAY:
890 *(INT*)lpvParam=GetProfileIntA("keyboard","KeyboardDelay",1);
893 case SPI_GETKEYBOARDSPEED:
894 *(DWORD*)lpvParam=GetProfileIntA("keyboard","KeyboardSpeed",30);
897 case SPI_GETMENUDROPALIGNMENT:
898 *(BOOL*)lpvParam=GetSystemMetrics(SM_MENUDROPALIGNMENT); /* XXX check this */
901 case SPI_GETSCREENSAVEACTIVE:
902 if(MONITOR_GetScreenSaveActive(&MONITOR_PrimaryMonitor) ||
903 GetProfileIntA( "windows", "ScreenSaveActive", 1 ) == 1)
904 *(BOOL*)lpvParam = TRUE;
906 *(BOOL*)lpvParam = FALSE;
909 case SPI_GETSCREENSAVETIMEOUT:
910 timeout = MONITOR_GetScreenSaveTimeout(&MONITOR_PrimaryMonitor);
912 timeout = GetProfileIntA( "windows", "ScreenSaveTimeout", 300 );
913 *(INT *) lpvParam = timeout * 1000;
916 case SPI_ICONHORIZONTALSPACING:
917 /* FIXME Get/SetProfileInt */
918 if (lpvParam == NULL)
919 /*SetSystemMetrics( SM_CXICONSPACING, uParam )*/ ;
921 *(INT*)lpvParam=GetSystemMetrics(SM_CXICONSPACING);
924 case SPI_ICONVERTICALSPACING:
925 /* FIXME Get/SetProfileInt */
926 if (lpvParam == NULL)
927 /*SetSystemMetrics( SM_CYICONSPACING, uParam )*/ ;
929 *(INT*)lpvParam=GetSystemMetrics(SM_CYICONSPACING);
932 case SPI_GETICONTITLELOGFONT: {
933 LPLOGFONTA lpLogFont = (LPLOGFONTA)lpvParam;
935 /* from now on we always have an alias for MS Sans Serif */
937 GetProfileStringA("Desktop", "IconTitleFaceName", "MS Sans Serif",
938 lpLogFont->lfFaceName, LF_FACESIZE );
939 lpLogFont->lfHeight = -GetProfileIntA("Desktop","IconTitleSize", 13);
940 lpLogFont->lfWidth = 0;
941 lpLogFont->lfEscapement = lpLogFont->lfOrientation = 0;
942 lpLogFont->lfWeight = FW_NORMAL;
943 lpLogFont->lfItalic = FALSE;
944 lpLogFont->lfStrikeOut = FALSE;
945 lpLogFont->lfUnderline = FALSE;
946 lpLogFont->lfCharSet = ANSI_CHARSET;
947 lpLogFont->lfOutPrecision = OUT_DEFAULT_PRECIS;
948 lpLogFont->lfClipPrecision = CLIP_DEFAULT_PRECIS;
949 lpLogFont->lfPitchAndFamily = DEFAULT_PITCH | FF_SWISS;
953 case SPI_GETICONMETRICS: {
954 LPICONMETRICSA lpIcon = lpvParam;
955 if(!lpIcon || lpIcon->cbSize != sizeof(*lpIcon))
957 SystemParametersInfoA( SPI_ICONHORIZONTALSPACING, 0,
958 &lpIcon->iHorzSpacing, FALSE );
959 SystemParametersInfoA( SPI_ICONVERTICALSPACING, 0,
960 &lpIcon->iVertSpacing, FALSE );
961 SystemParametersInfoA( SPI_GETICONTITLEWRAP, 0,
962 &lpIcon->iTitleWrap, FALSE );
963 SystemParametersInfoA( SPI_GETICONTITLELOGFONT, 0,
964 &lpIcon->lfFont, FALSE );
967 case SPI_GETWORKAREA:
968 SetRect( (RECT *)lpvParam, 0, 0,
969 GetSystemMetrics( SM_CXSCREEN ),
970 GetSystemMetrics( SM_CYSCREEN )
973 case SPI_GETNONCLIENTMETRICS:
975 #define lpnm ((LPNONCLIENTMETRICSA)lpvParam)
977 if( lpnm->cbSize == sizeof(NONCLIENTMETRICSA) )
979 LPLOGFONTA lpLogFont = &(lpnm->lfMenuFont);
981 /* clear the struct, so we have 'sane' members */
983 (char*)lpvParam+sizeof(lpnm->cbSize),
985 lpnm->cbSize-sizeof(lpnm->cbSize)
988 /* FIXME: initialize geometry entries */
989 /* FIXME: As these values are presumably in device units,
990 * we should calculate the defaults based on the screen dpi
993 lpnm->iCaptionWidth = ((TWEAK_WineLook > WIN31_LOOK) ? 32 : 20);
994 lpnm->iCaptionHeight = lpnm->iCaptionWidth;
995 lpnm->lfCaptionFont.lfWeight = FW_BOLD;
996 SystemParametersInfoA(SPI_GETICONTITLELOGFONT, 0, (LPVOID)&(lpnm->lfCaptionFont),0);
999 lpnm->iSmCaptionWidth = ((TWEAK_WineLook > WIN31_LOOK) ? 32 : 17);
1000 lpnm->iSmCaptionHeight = lpnm->iSmCaptionWidth;
1001 SystemParametersInfoA(SPI_GETICONTITLELOGFONT, 0, (LPVOID)&(lpnm->lfSmCaptionFont),0);
1003 /* menus, FIXME: names of wine.conf entrys are bogus */
1005 lpnm->iMenuWidth = GetProfileIntA("Desktop","MenuWidth", 13); /* size of the menu buttons*/
1006 lpnm->iMenuHeight = GetProfileIntA("Desktop","MenuHeight",
1007 (TWEAK_WineLook > WIN31_LOOK) ? 13 : 27);
1009 GetProfileStringA("Desktop", "MenuFont",
1010 (TWEAK_WineLook > WIN31_LOOK) ? "MS Sans Serif": "System",
1011 lpLogFont->lfFaceName, LF_FACESIZE );
1013 lpLogFont->lfHeight = -GetProfileIntA("Desktop","MenuFontSize", 13);
1014 lpLogFont->lfWidth = 0;
1015 lpLogFont->lfEscapement = lpLogFont->lfOrientation = 0;
1016 lpLogFont->lfWeight = (TWEAK_WineLook > WIN31_LOOK) ? FW_NORMAL : FW_BOLD;
1017 lpLogFont->lfItalic = FALSE;
1018 lpLogFont->lfStrikeOut = FALSE;
1019 lpLogFont->lfUnderline = FALSE;
1020 lpLogFont->lfCharSet = ANSI_CHARSET;
1021 lpLogFont->lfOutPrecision = OUT_DEFAULT_PRECIS;
1022 lpLogFont->lfClipPrecision = CLIP_DEFAULT_PRECIS;
1023 lpLogFont->lfPitchAndFamily = DEFAULT_PITCH | FF_SWISS;
1025 SystemParametersInfoA(SPI_GETICONTITLELOGFONT, 0,
1026 (LPVOID)&(lpnm->lfStatusFont),0);
1027 SystemParametersInfoA(SPI_GETICONTITLELOGFONT, 0,
1028 (LPVOID)&(lpnm->lfMessageFont),0);
1033 case SPI_GETANIMATION: {
1034 LPANIMATIONINFO lpAnimInfo = (LPANIMATIONINFO)lpvParam;
1036 /* Tell it "disabled" */
1037 lpAnimInfo->cbSize = sizeof(ANIMATIONINFO);
1038 uParam = sizeof(ANIMATIONINFO);
1039 lpAnimInfo->iMinAnimate = 0; /* Minimise and restore animation is disabled (nonzero == enabled) */
1043 case SPI_SETANIMATION: {
1044 LPANIMATIONINFO lpAnimInfo = (LPANIMATIONINFO)lpvParam;
1047 WARN_(system)("SPI_SETANIMATION ignored.\n");
1048 lpAnimInfo->cbSize = sizeof(ANIMATIONINFO);
1049 uParam = sizeof(ANIMATIONINFO);
1053 case SPI_GETHIGHCONTRAST:
1055 LPHIGHCONTRASTA lpHighContrastA = (LPHIGHCONTRASTA)lpvParam;
1057 FIXME_(system)("SPI_GETHIGHCONTRAST not fully implemented\n");
1059 if ( lpHighContrastA->cbSize == sizeof( HIGHCONTRASTA ) )
1061 /* Indicate that there is no high contrast available */
1062 lpHighContrastA->dwFlags = 0;
1063 lpHighContrastA->lpszDefaultScheme = NULL;
1074 return SystemParametersInfo16(uAction,uParam,lpvParam,fuWinIni);
1080 /***********************************************************************
1081 * SystemParametersInfo16 (USER.483)
1083 BOOL16 WINAPI SystemParametersInfo16( UINT16 uAction, UINT16 uParam,
1084 LPVOID lpvParam, UINT16 fuWinIni )
1092 *(BOOL *) lpvParam = KEYBOARD_GetBeepActive();
1096 *(INT16 *)lpvParam = GetSystemMetrics16( SM_CXFRAME );
1099 case SPI_GETFASTTASKSWITCH:
1100 if ( GetProfileIntA( "windows", "CoolSwitch", 1 ) == 1 )
1101 *(BOOL16 *) lpvParam = TRUE;
1103 *(BOOL16 *) lpvParam = FALSE;
1106 case SPI_GETGRIDGRANULARITY:
1107 *(INT16 *) lpvParam = GetProfileIntA( "desktop",
1112 case SPI_GETICONTITLEWRAP:
1113 *(BOOL16 *) lpvParam = GetProfileIntA( "desktop",
1118 case SPI_GETKEYBOARDDELAY:
1119 *(INT16 *) lpvParam = GetProfileIntA( "keyboard",
1120 "KeyboardDelay", 1 );
1123 case SPI_GETKEYBOARDSPEED:
1124 *(WORD *) lpvParam = GetProfileIntA( "keyboard",
1129 case SPI_GETMENUDROPALIGNMENT:
1130 *(BOOL16 *) lpvParam = GetSystemMetrics16( SM_MENUDROPALIGNMENT ); /* XXX check this */
1133 case SPI_GETSCREENSAVEACTIVE:
1134 if(MONITOR_GetScreenSaveActive(&MONITOR_PrimaryMonitor) ||
1135 GetProfileIntA( "windows", "ScreenSaveActive", 1 ) == 1)
1136 *(BOOL16 *) lpvParam = TRUE;
1138 *(BOOL16 *) lpvParam = FALSE;
1141 case SPI_GETSCREENSAVETIMEOUT:
1142 timeout = MONITOR_GetScreenSaveTimeout(&MONITOR_PrimaryMonitor);
1144 timeout = GetProfileIntA( "windows", "ScreenSaveTimeout", 300 );
1145 *(INT16 *) lpvParam = timeout;
1148 case SPI_ICONHORIZONTALSPACING:
1149 /* FIXME Get/SetProfileInt */
1150 if (lpvParam == NULL)
1151 /*SetSystemMetrics( SM_CXICONSPACING, uParam )*/ ;
1153 *(INT16 *)lpvParam = GetSystemMetrics16( SM_CXICONSPACING );
1156 case SPI_ICONVERTICALSPACING:
1157 /* FIXME Get/SetProfileInt */
1158 if (lpvParam == NULL)
1159 /*SetSystemMetrics( SM_CYICONSPACING, uParam )*/ ;
1161 *(INT16 *)lpvParam = GetSystemMetrics16(SM_CYICONSPACING);
1165 KEYBOARD_SetBeepActive(uParam);
1168 case SPI_SETSCREENSAVEACTIVE:
1169 MONITOR_SetScreenSaveActive(&MONITOR_PrimaryMonitor, uParam);
1172 case SPI_SETSCREENSAVETIMEOUT:
1173 MONITOR_SetScreenSaveTimeout(&MONITOR_PrimaryMonitor, uParam);
1176 case SPI_SETDESKWALLPAPER:
1177 return (SetDeskWallPaper((LPSTR) lpvParam));
1180 case SPI_SETDESKPATTERN:
1181 if ((INT16)uParam == -1) {
1182 GetProfileStringA("Desktop", "Pattern",
1183 "170 85 170 85 170 85 170 85",
1184 buffer, sizeof(buffer) );
1185 return (DESKTOP_SetPattern((LPSTR) buffer));
1187 return (DESKTOP_SetPattern((LPSTR) lpvParam));
1190 case SPI_GETICONTITLELOGFONT:
1192 LPLOGFONT16 lpLogFont = (LPLOGFONT16)lpvParam;
1193 GetProfileStringA("Desktop", "IconTitleFaceName", "MS Sans Serif",
1194 lpLogFont->lfFaceName, LF_FACESIZE );
1195 lpLogFont->lfHeight = -GetProfileIntA("Desktop","IconTitleSize", 13);
1196 lpLogFont->lfWidth = 0;
1197 lpLogFont->lfEscapement = lpLogFont->lfOrientation = 0;
1198 lpLogFont->lfWeight = FW_NORMAL;
1199 lpLogFont->lfItalic = FALSE;
1200 lpLogFont->lfStrikeOut = FALSE;
1201 lpLogFont->lfUnderline = FALSE;
1202 lpLogFont->lfCharSet = ANSI_CHARSET;
1203 lpLogFont->lfOutPrecision = OUT_DEFAULT_PRECIS;
1204 lpLogFont->lfClipPrecision = CLIP_DEFAULT_PRECIS;
1205 lpLogFont->lfPitchAndFamily = DEFAULT_PITCH | FF_SWISS;
1208 case SPI_GETNONCLIENTMETRICS:
1210 #define lpnm ((LPNONCLIENTMETRICS16)lpvParam)
1211 if( lpnm->cbSize == sizeof(NONCLIENTMETRICS16) )
1213 /* clear the struct, so we have 'sane' members */
1215 (char*)lpvParam+sizeof(lpnm->cbSize),
1217 lpnm->cbSize-sizeof(lpnm->cbSize)
1219 /* FIXME: initialize geometry entries */
1220 SystemParametersInfo16( SPI_GETICONTITLELOGFONT, 0,
1221 (LPVOID)&(lpnm->lfCaptionFont),0);
1222 lpnm->lfCaptionFont.lfWeight = FW_BOLD;
1223 SystemParametersInfo16( SPI_GETICONTITLELOGFONT, 0,
1224 (LPVOID)&(lpnm->lfSmCaptionFont),0);
1225 SystemParametersInfo16( SPI_GETICONTITLELOGFONT, 0,
1226 (LPVOID)&(lpnm->lfMenuFont),0);
1227 SystemParametersInfo16( SPI_GETICONTITLELOGFONT, 0,
1228 (LPVOID)&(lpnm->lfStatusFont),0);
1229 SystemParametersInfo16( SPI_GETICONTITLELOGFONT, 0,
1230 (LPVOID)&(lpnm->lfMessageFont),0);
1232 else /* winfile 95 sets sbSize to 340 */
1233 SystemParametersInfoA( uAction, uParam, lpvParam, fuWinIni );
1237 case SPI_LANGDRIVER:
1239 case SPI_SETDOUBLECLKHEIGHT:
1240 case SPI_SETDOUBLECLICKTIME:
1241 case SPI_SETDOUBLECLKWIDTH:
1242 case SPI_SETFASTTASKSWITCH:
1243 case SPI_SETKEYBOARDDELAY:
1244 case SPI_SETKEYBOARDSPEED:
1245 WARN_(system)("Option %d ignored.\n", uAction);
1248 case SPI_GETWORKAREA:
1249 SetRect16( (RECT16 *)lpvParam, 0, 0,
1250 GetSystemMetrics16( SM_CXSCREEN ),
1251 GetSystemMetrics16( SM_CYSCREEN ) );
1255 FIXME_(system)("Unknown option %d.\n", uAction);
1256 SetLastError(ERROR_INVALID_SPI_VALUE);
1262 /***********************************************************************
1263 * SystemParametersInfo32W (USER32.541)
1265 BOOL WINAPI SystemParametersInfoW( UINT uAction, UINT uParam,
1266 LPVOID lpvParam, UINT fuWinIni )
1272 case SPI_SETDESKWALLPAPER:
1275 lstrcpynWtoA(buffer,(LPWSTR)lpvParam,sizeof(buffer));
1276 return SetDeskWallPaper(buffer);
1278 return SetDeskWallPaper(NULL);
1280 case SPI_SETDESKPATTERN:
1281 if ((INT) uParam == -1)
1283 GetProfileStringA("Desktop", "Pattern",
1284 "170 85 170 85 170 85 170 85",
1285 buffer, sizeof(buffer) );
1286 return (DESKTOP_SetPattern((LPSTR) buffer));
1290 lstrcpynWtoA(buffer,(LPWSTR)lpvParam,sizeof(buffer));
1291 return DESKTOP_SetPattern(buffer);
1293 return DESKTOP_SetPattern(NULL);
1295 case SPI_GETICONTITLELOGFONT:
1297 LPLOGFONTW lpLogFont = (LPLOGFONTW)lpvParam;
1299 GetProfileStringA("Desktop", "IconTitleFaceName", "MS Sans Serif",
1300 buffer, sizeof(buffer) );
1301 lstrcpynAtoW(lpLogFont->lfFaceName, buffer, LF_FACESIZE);
1302 lpLogFont->lfHeight = 17;
1303 lpLogFont->lfWidth = 0;
1304 lpLogFont->lfEscapement = lpLogFont->lfOrientation = 0;
1305 lpLogFont->lfWeight = FW_NORMAL;
1306 lpLogFont->lfItalic = lpLogFont->lfStrikeOut = lpLogFont->lfUnderline = FALSE;
1307 lpLogFont->lfCharSet = ANSI_CHARSET;
1308 lpLogFont->lfOutPrecision = OUT_DEFAULT_PRECIS;
1309 lpLogFont->lfClipPrecision = CLIP_DEFAULT_PRECIS;
1310 lpLogFont->lfPitchAndFamily = DEFAULT_PITCH | FF_SWISS;
1313 case SPI_GETICONMETRICS: {
1314 LPICONMETRICSW lpIcon = lpvParam;
1315 if(!lpIcon || lpIcon->cbSize != sizeof(*lpIcon))
1317 SystemParametersInfoW( SPI_ICONHORIZONTALSPACING, 0,
1318 &lpIcon->iHorzSpacing, FALSE );
1319 SystemParametersInfoW( SPI_ICONVERTICALSPACING, 0,
1320 &lpIcon->iVertSpacing, FALSE );
1321 SystemParametersInfoW( SPI_GETICONTITLEWRAP, 0,
1322 &lpIcon->iTitleWrap, FALSE );
1323 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0,
1324 &lpIcon->lfFont, FALSE );
1327 case SPI_GETNONCLIENTMETRICS: {
1328 /* FIXME: implement correctly */
1329 LPNONCLIENTMETRICSW lpnm=(LPNONCLIENTMETRICSW)lpvParam;
1331 /* clear the struct, so we have 'sane' members */
1332 memset((char*)lpvParam+sizeof(lpnm->cbSize),
1334 lpnm->cbSize-sizeof(lpnm->cbSize)
1336 SystemParametersInfoW(SPI_GETICONTITLELOGFONT,0,(LPVOID)&(lpnm->lfCaptionFont),0);
1337 lpnm->lfCaptionFont.lfWeight = FW_BOLD;
1338 SystemParametersInfoW(SPI_GETICONTITLELOGFONT,0,(LPVOID)&(lpnm->lfSmCaptionFont),0);
1339 SystemParametersInfoW(SPI_GETICONTITLELOGFONT,0,(LPVOID)&(lpnm->lfMenuFont),0);
1340 SystemParametersInfoW(SPI_GETICONTITLELOGFONT,0,(LPVOID)&(lpnm->lfStatusFont),0);
1341 SystemParametersInfoW(SPI_GETICONTITLELOGFONT,0,(LPVOID)&(lpnm->lfMessageFont),0);
1345 case SPI_GETHIGHCONTRAST:
1347 LPHIGHCONTRASTW lpHighContrastW = (LPHIGHCONTRASTW)lpvParam;
1349 FIXME_(system)("SPI_GETHIGHCONTRAST not fully implemented\n");
1351 if ( lpHighContrastW->cbSize == sizeof( HIGHCONTRASTW ) )
1353 /* Indicate that there is no high contrast available */
1354 lpHighContrastW->dwFlags = 0;
1355 lpHighContrastW->lpszDefaultScheme = NULL;
1366 return SystemParametersInfoA(uAction,uParam,lpvParam,fuWinIni);
1373 /***********************************************************************
1374 * FileCDR (KERNEL.130)
1376 FARPROC16 WINAPI FileCDR16(FARPROC16 x)
1378 FIXME_(file)("(0x%8x): stub\n", (int) x);
1379 return (FARPROC16)TRUE;