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"
49 /**********************************************************************/
51 USER_DRIVER *USER_Driver = NULL;
53 /* when adding new languages look at ole/ole2nls.c
54 * for proper iso name and Windows code (add 0x0400
55 * to the code listed there)
57 const WINE_LANGUAGE_DEF Languages[] =
59 {"En",0x0409}, /* LANG_En */
60 {"Es",0x040A}, /* LANG_Es */
61 {"De",0x0407}, /* LANG_De */
62 {"No",0x0414}, /* LANG_No */
63 {"Fr",0x040C}, /* LANG_Fr */
64 {"Fi",0x040B}, /* LANG_Fi */
65 {"Da",0x0406}, /* LANG_Da */
66 {"Cs",0x0405}, /* LANG_Cs */
67 {"Eo",0x048f}, /* LANG_Eo */
68 {"It",0x0410}, /* LANG_It */
69 {"Ko",0x0412}, /* LANG_Ko */
70 {"Hu",0x040e}, /* LANG_Hu */
71 {"Pl",0x0415}, /* LANG_Pl */
72 {"Pt",0x0416}, /* LANG_Pt */
73 {"Sv",0x041d}, /* LANG_Sv */
74 {"Ca",0x0403}, /* LANG_Ca */
75 {"Nl",0x0413}, /* LANG_Nl */
76 {"Ru",0x0419}, /* LANG_Ru */
77 {"Wa",0x0490}, /* LANG_Wa */
81 WORD WINE_LanguageId = 0x409; /* english as default */
83 struct options Options =
84 { /* default options */
87 NULL, /* desktopGeometry */
88 NULL, /* programName */
90 FALSE, /* usePrivateMap */
91 FALSE, /* useFixedMap */
92 FALSE, /* synchronous */
93 FALSE, /* backing store */
94 SW_SHOWNORMAL, /* cmdShow */
96 FALSE, /* failReadOnly */
97 MODE_ENHANCED, /* Enhanced mode */
99 DEFAULT_LANG, /* Default language */
103 FALSE, /* Managed windows */
104 FALSE, /* Perfect graphics */
108 NULL, /* Alternate config file name */
114 static const char szUsage[] =
116 "Usage: %s [options] \"program_name [arguments]\"\n"
119 " -backingstore Turn on backing store\n"
120 " -config name Specify config file to use\n"
121 " -console driver Select which driver(s) to use for the console\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 " -fixedmap Use a \"standard\" color map\n"
130 " -help Show this help message\n"
131 " -iconic Start as an icon\n"
132 " -language xx Set the language (one of Ca,Cs,Da,De,En,Eo,Es,Fi,Fr,Hu,It,\n"
133 " Ko,Nl,No,Pl,Pt,Sv,Ru,Wa)\n"
134 " -managed Allow the window manager to manage created windows\n"
135 " -mode mode Start Wine in a particular mode (standard or enhanced)\n"
136 " -name name Set the application name\n"
137 " -nodga Disable XFree86 DGA extensions\n"
138 " -noxshm Disable XSHM extension\n"
139 " -dxgrab Enable DirectX mouse grab\n"
140 " -perfect Favor correctness over speed for graphical operations\n"
141 " -privatemap Use a private color map\n"
142 " -synchronous Turn on synchronous display mode\n"
143 " -version Display the Wine version\n"
144 " -winver Version to imitate (one of win31,win95,nt351,nt40)\n"
145 " -dosver DOS version to imitate (x.xx, e.g. 6.22). Only valid with -winver win31\n"
148 /***********************************************************************
151 void MAIN_Usage( char *name )
153 MESSAGE( szUsage, WINE_RELEASE_INFO, name );
157 /***********************************************************************
158 * MAIN_GetProgramName
160 * Get the program name. The name is specified by (in order of precedence):
161 * - the option '-name'.
162 * - the environment variable 'WINE_NAME'.
163 * - the last component of argv[0].
165 static char *MAIN_GetProgramName( int argc, char *argv[] )
170 for (i = 1; i < argc-1; i++)
171 if (!strcmp( argv[i], "-name" )) return argv[i+1];
172 if ((p = getenv( "WINE_NAME" )) != NULL) return p;
173 if ((p = strrchr( argv[0], '/' )) != NULL) return p+1;
177 /***********************************************************************
178 * MAIN_ParseDebugOptions
180 * Turns specific debug messages on or off, according to "options".
183 * TRUE if parsing was successful
185 BOOL MAIN_ParseDebugOptions(char *options)
187 /* defined in relay32/relay386.c */
188 extern char **debug_relay_includelist;
189 extern char **debug_relay_excludelist;
190 /* defined in relay32/snoop.c */
191 extern char **debug_snoop_includelist;
192 extern char **debug_snoop_excludelist;
195 int l, cls, dotracerelay = TRACE_ON(relay);
200 if (options[l-1]=='\n') options[l-1]='\0';
203 if ((*options!='+')&&(*options!='-')){
206 for(j=0; j<DEBUG_CLASS_COUNT; j++)
207 if(!lstrncmpiA(options, debug_cl_name[j], strlen(debug_cl_name[j])))
209 if(j==DEBUG_CLASS_COUNT)
211 options += strlen(debug_cl_name[j]);
212 if ((*options!='+')&&(*options!='-'))
217 cls = -1; /* all classes */
219 if (strchr(options,','))
220 l=strchr(options,',')-options;
224 if (!lstrncmpiA(options+1,"all",l-1))
227 for (i=0; i<DEBUG_CHANNEL_COUNT; i++)
228 for(j=0; j<DEBUG_CLASS_COUNT; j++)
229 if(cls == -1 || cls == j)
230 __SET_DEBUGGING( j, debug_channels[i], (*options=='+') );
232 else if (!lstrncmpiA(options+1, "relay=", 6) ||
233 !lstrncmpiA(options+1, "snoop=", 6))
236 char *s, *s2, ***output, c;
238 for (i=0; i<DEBUG_CHANNEL_COUNT; i++)
239 if (!strncasecmp( debug_channels[i] + 1, options + 1, 5))
241 for(j=0; j<DEBUG_CLASS_COUNT; j++)
242 if(cls == -1 || cls == j)
243 __SET_DEBUGGING( j, debug_channels[i], 1 );
246 /* should never happen, maybe assert(i!=DEBUG_CHANNEL_COUNT)? */
247 if (i==DEBUG_CHANNEL_COUNT)
249 output = (*options == '+') ?
250 ((*(options+1) == 'r') ?
251 &debug_relay_includelist :
252 &debug_snoop_includelist) :
253 ((*(options+1) == 'r') ?
254 &debug_relay_excludelist :
255 &debug_snoop_excludelist);
257 /* if there are n ':', there are n+1 modules, and we need n+2 slots
258 * last one being for the sentinel (NULL) */
260 while((s = strchr(s, ':'))) i++, s++;
261 *output = malloc(sizeof(char **) * i);
264 while((s2 = strchr(s, ':'))) {
267 *((*output)+i) = CharUpperA(strdup(s));
273 *(options + l) = '\0';
274 *((*output)+i) = CharUpperA(strdup(s));
276 *((*output)+i+1) = NULL;
281 for (i=0; i<DEBUG_CHANNEL_COUNT; i++)
282 if (!strncasecmp( debug_channels[i] + 1, options + 1, l - 1) && !debug_channels[i][l])
284 for(j=0; j<DEBUG_CLASS_COUNT; j++)
285 if(cls == -1 || cls == j)
286 __SET_DEBUGGING( j, debug_channels[i], (*options=='+') );
289 if (i==DEBUG_CHANNEL_COUNT)
294 while((*options==',')&&(*(++options)));
296 /* special handling for relay debugging */
297 if (dotracerelay != TRACE_ON(relay))
298 BUILTIN32_SwitchRelayDebug( TRACE_ON(relay) );
304 MESSAGE("%s: Syntax: -debugmsg [class]+xxx,... or "
305 "-debugmsg [class]-xxx,...\n",Options.argv[0]);
306 MESSAGE("Example: -debugmsg +all,warn-heap\n"
307 " turn on all messages except warning heap messages\n");
308 MESSAGE("Special case: -debugmsg +relay=DLL:DLL.###:FuncName\n"
309 " turn on -debugmsg +relay only as specified\n"
310 "Special case: -debugmsg -relay=DLL:DLL.###:FuncName\n"
311 " turn on -debugmsg +relay except as specified\n"
312 "Also permitted, +snoop=..., -snoop=... as with relay.\n\n");
314 MESSAGE("Available message classes:\n");
315 for(i=0;i<DEBUG_CLASS_COUNT;i++)
316 MESSAGE( "%-9s", debug_cl_name[i]);
319 MESSAGE("Available message types:\n");
320 MESSAGE("%-9s ","all");
321 for(i=0;i<DEBUG_CHANNEL_COUNT;i++)
322 MESSAGE("%-9s%c",debug_channels[i] + 1,
323 (((i+2)%8==0)?'\n':' '));
329 /***********************************************************************
333 * Lang: a string whose two first chars are the iso name of a language.
334 * Country: a string whose two first chars are the iso name of country
335 * Charset: a string defining the chossen charset encoding
336 * Dialect: a string defining a variation of the locale
338 * all those values are from the standardized format of locale
339 * name in unix which is: Lang[_Country][.Charset][@Dialect]
342 * the numeric code of the language used by Windows (or 0x00)
344 int MAIN_GetLanguageID(LPCSTR Lang,LPCSTR Country,LPCSTR Charset,LPCSTR Dialect)
346 char lang[3]="??", country[3]={0,0,0};
347 char *charset=NULL, *dialect=NULL;
350 if (Lang==NULL) return 0x00;
351 if (Lang[0]) lang[0]=tolower(Lang[0]);
352 if (Lang[1]) lang[1]=tolower(Lang[1]);
355 if (Country[0]) country[0]=toupper(Country[0]);
356 if (Country[1]) country[1]=toupper(Country[1]);
361 charset=(char*)malloc(j+1);
363 charset[i]=toupper(Charset[i]);
369 dialect=(char*)malloc(j+1);
371 dialect[i]=tolower(Dialect[i]);
378 #define LANG_ENTRY_BEGIN(x,y) if(!strcmp(lang, x )) { \
381 goto end_MAIN_GetLanguageID; \
383 #define LANG_SUB_ENTRY(x,y,z) if (!strcmp(country, x )) \
384 ret = MAKELANGID( LANG_##y , SUBLANG_##z ); \
385 goto end_MAIN_GetLanguageID;
386 #define LANG_DIALECT_ENTRY(x,y) { ret = MAKELANGID(LANG_##x , SUBLANG_##y ); \
387 goto end_MAIN_GetLanguageID; }
388 #define LANG_ENTRY_END(x) ret = MAKELANGID(LANG_##x , SUBLANG_DEFAULT); \
389 goto end_MAIN_GetLanguageID; \
392 /*x01*/ LANG_ENTRY_BEGIN( "ar", ARABIC )
393 LANG_SUB_ENTRY( "SA", ARABIC, ARABIC)
394 LANG_SUB_ENTRY( "IQ", ARABIC, ARABIC_IRAQ )
395 LANG_SUB_ENTRY( "EG", ARABIC, ARABIC_EGYPT )
396 LANG_SUB_ENTRY( "LY", ARABIC, ARABIC_LIBYA )
397 LANG_SUB_ENTRY( "DZ", ARABIC, ARABIC_ALGERIA )
398 LANG_SUB_ENTRY( "MA", ARABIC, ARABIC_MOROCCO )
399 LANG_SUB_ENTRY( "TN", ARABIC, ARABIC_TUNISIA )
400 LANG_SUB_ENTRY( "OM", ARABIC, ARABIC_OMAN )
401 LANG_SUB_ENTRY( "YE", ARABIC, ARABIC_YEMEN )
402 LANG_SUB_ENTRY( "SY", ARABIC, ARABIC_SYRIA )
403 LANG_SUB_ENTRY( "JO", ARABIC, ARABIC_JORDAN )
404 LANG_SUB_ENTRY( "LB", ARABIC, ARABIC_LEBANON )
405 LANG_SUB_ENTRY( "KW", ARABIC, ARABIC_KUWAIT )
406 LANG_SUB_ENTRY( "AE", ARABIC, ARABIC_UAE )
407 LANG_SUB_ENTRY( "BH", ARABIC, ARABIC_BAHRAIN )
408 LANG_SUB_ENTRY( "QA", ARABIC, ARABIC_QATAR )
409 LANG_ENTRY_END( ARABIC )
410 /*x02*/ LANG_ENTRY_BEGIN( "bu", BULGARIAN )
411 LANG_ENTRY_END( BULGARIAN )
412 /*x03*/ LANG_ENTRY_BEGIN( "ca", CATALAN )
413 LANG_ENTRY_END( CATALAN )
414 /*x04*/ LANG_ENTRY_BEGIN( "zh", CHINESE )
415 LANG_SUB_ENTRY( "TW", CHINESE, CHINESE_TRADITIONAL )
416 LANG_SUB_ENTRY( "CN", CHINESE, CHINESE_SIMPLIFIED )
417 LANG_SUB_ENTRY( "HK", CHINESE, CHINESE_HONGKONG )
418 LANG_SUB_ENTRY( "SG", CHINESE, CHINESE_SINGAPORE )
419 LANG_SUB_ENTRY( "MO", CHINESE, CHINESE_MACAU )
420 LANG_ENTRY_END( CHINESE )
421 /*x05*/ LANG_ENTRY_BEGIN( "cs", CZECH )
422 LANG_ENTRY_END( CZECH )
423 /*x06*/ LANG_ENTRY_BEGIN( "da", DANISH )
424 LANG_ENTRY_END( DANISH )
425 /*x07*/ LANG_ENTRY_BEGIN( "de", GERMAN )
426 LANG_SUB_ENTRY( "DE", GERMAN, GERMAN )
427 LANG_SUB_ENTRY( "CH", GERMAN, GERMAN_SWISS )
428 LANG_SUB_ENTRY( "AT", GERMAN, GERMAN_AUSTRIAN )
429 LANG_SUB_ENTRY( "LU", GERMAN, GERMAN_LUXEMBOURG )
430 LANG_SUB_ENTRY( "LI", GERMAN, GERMAN_LIECHTENSTEIN )
431 LANG_ENTRY_END( GERMAN )
432 /*x08*/ LANG_ENTRY_BEGIN( "el", GREEK )
433 LANG_ENTRY_END( GREEK )
434 /*x09*/ LANG_ENTRY_BEGIN( "en", ENGLISH )
435 LANG_SUB_ENTRY( "US", ENGLISH, ENGLISH_US )
436 LANG_SUB_ENTRY( "UK", ENGLISH, ENGLISH_UK )
437 LANG_SUB_ENTRY( "AU", ENGLISH, ENGLISH_AUS )
438 LANG_SUB_ENTRY( "CA", ENGLISH, ENGLISH_CAN )
439 LANG_SUB_ENTRY( "NZ", ENGLISH, ENGLISH_NZ )
440 LANG_SUB_ENTRY( "EI", ENGLISH, ENGLISH_EIRE )
441 LANG_SUB_ENTRY( "ZA", ENGLISH, ENGLISH_SAFRICA )
442 LANG_SUB_ENTRY( "JM", ENGLISH, ENGLISH_JAMAICA )
443 /* LANG_SUB_ENTRY( "AG", ENGLISH, ENGLISH_CARIBBEAN ) */
444 LANG_SUB_ENTRY( "BZ", ENGLISH, ENGLISH_BELIZE )
445 LANG_SUB_ENTRY( "TT", ENGLISH, ENGLISH_TRINIDAD )
446 LANG_SUB_ENTRY( "ZW", ENGLISH, ENGLISH_ZIMBABWE )
447 LANG_SUB_ENTRY( "PH", ENGLISH, ENGLISH_PHILIPPINES )
448 LANG_ENTRY_END( ENGLISH )
449 /*x0a*/ LANG_ENTRY_BEGIN( "es", SPANISH )
450 /* traditional sorting */
451 if (!strcmp(dialect,"tradicional"))
452 LANG_DIALECT_ENTRY( SPANISH, SPANISH )
453 LANG_SUB_ENTRY( "MX", SPANISH, SPANISH_MEXICAN )
454 LANG_SUB_ENTRY( "ES", SPANISH, SPANISH_MODERN )
455 LANG_SUB_ENTRY( "GT", SPANISH, SPANISH_GUATEMALA )
456 LANG_SUB_ENTRY( "CR", SPANISH, SPANISH_COSTARICA )
457 LANG_SUB_ENTRY( "PA", SPANISH, SPANISH_PANAMA )
458 LANG_SUB_ENTRY( "DO", SPANISH, SPANISH_DOMINICAN )
459 LANG_SUB_ENTRY( "VE", SPANISH, SPANISH_VENEZUELA )
460 LANG_SUB_ENTRY( "CO", SPANISH, SPANISH_COLOMBIA )
461 LANG_SUB_ENTRY( "PE", SPANISH, SPANISH_PERU )
462 LANG_SUB_ENTRY( "AR", SPANISH, SPANISH_ARGENTINA )
463 LANG_SUB_ENTRY( "EC", SPANISH, SPANISH_ECUADOR )
464 LANG_SUB_ENTRY( "CL", SPANISH, SPANISH_CHILE )
465 LANG_SUB_ENTRY( "UY", SPANISH, SPANISH_URUGUAY )
466 LANG_SUB_ENTRY( "PY", SPANISH, SPANISH_PARAGUAY )
467 LANG_SUB_ENTRY( "BO", SPANISH, SPANISH_BOLIVIA )
468 LANG_SUB_ENTRY( "HN", SPANISH, SPANISH_HONDURAS )
469 LANG_SUB_ENTRY( "NI", SPANISH, SPANISH_NICARAGUA )
470 LANG_SUB_ENTRY( "PR", SPANISH, SPANISH_PUERTO_RICO )
471 LANG_ENTRY_END( SPANISH )
472 /*x0b*/ LANG_ENTRY_BEGIN( "fi", FINNISH )
473 LANG_ENTRY_END( FINNISH )
474 /*x0c*/ LANG_ENTRY_BEGIN( "fr", FRENCH )
475 LANG_SUB_ENTRY( "FR", FRENCH, FRENCH )
476 LANG_SUB_ENTRY( "BE", FRENCH, FRENCH_BELGIAN )
477 LANG_SUB_ENTRY( "CA", FRENCH, FRENCH_CANADIAN )
478 LANG_SUB_ENTRY( "CH", FRENCH, FRENCH_SWISS )
479 LANG_SUB_ENTRY( "LU", FRENCH, FRENCH_LUXEMBOURG )
480 LANG_SUB_ENTRY( "MC", FRENCH, FRENCH_MONACO )
481 LANG_ENTRY_END( FRENCH )
482 /*x0d*/ LANG_ENTRY_BEGIN( "iw", HEBREW )
483 LANG_ENTRY_END( HEBREW )
484 /*x0e*/ LANG_ENTRY_BEGIN( "hu", HUNGARIAN )
485 LANG_ENTRY_END( HUNGARIAN )
486 /*x0f*/ LANG_ENTRY_BEGIN( "ic", ICELANDIC )
487 LANG_ENTRY_END( ICELANDIC )
488 /*x10*/ LANG_ENTRY_BEGIN( "it", ITALIAN )
489 LANG_SUB_ENTRY( "IT", ITALIAN, ITALIAN )
490 LANG_SUB_ENTRY( "CH", ITALIAN, ITALIAN_SWISS )
491 LANG_ENTRY_END( ITALIAN )
492 /*x11*/ LANG_ENTRY_BEGIN( "ja", JAPANESE )
493 LANG_ENTRY_END( JAPANESE )
494 /*x12*/ LANG_ENTRY_BEGIN( "ko", KOREAN )
496 if (!strcmp(charset,"JOHAB"))
497 LANG_DIALECT_ENTRY( KOREAN, KOREAN_JOHAB )
499 LANG_DIALECT_ENTRY( KOREAN, KOREAN )
500 LANG_ENTRY_END( KOREAN )
501 /*x13*/ LANG_ENTRY_BEGIN( "nl", DUTCH )
502 LANG_SUB_ENTRY( "NL", DUTCH, DUTCH )
503 LANG_SUB_ENTRY( "BE", DUTCH, DUTCH_BELGIAN )
504 LANG_SUB_ENTRY( "SR", DUTCH, DUTCH_SURINAM )
505 LANG_ENTRY_END( DUTCH )
506 /*x14*/ LANG_ENTRY_BEGIN( "no", NORWEGIAN )
508 if (!strcmp(dialect,"nynorsk"))
509 LANG_DIALECT_ENTRY( NORWEGIAN, NORWEGIAN_NYNORSK )
511 LANG_DIALECT_ENTRY( NORWEGIAN, NORWEGIAN_BOKMAL )
512 LANG_ENTRY_END( NORWEGIAN )
513 /*x15*/ LANG_ENTRY_BEGIN( "pl", POLISH )
514 LANG_ENTRY_END( POLISH )
515 /*x16*/ LANG_ENTRY_BEGIN( "pt", PORTUGUESE )
516 LANG_SUB_ENTRY( "BR", PORTUGUESE, PORTUGUESE_BRAZILIAN )
517 LANG_SUB_ENTRY( "PT", PORTUGUESE, PORTUGUESE )
518 LANG_ENTRY_END( PORTUGUESE )
519 /*x17*/ LANG_ENTRY_BEGIN( "rm", RHAETO_ROMANCE )
520 LANG_ENTRY_END( RHAETO_ROMANCE )
521 /*x18*/ LANG_ENTRY_BEGIN( "ro", ROMANIAN )
522 LANG_SUB_ENTRY( "RO", ROMANIAN, ROMANIAN )
523 LANG_SUB_ENTRY( "MD", ROMANIAN, ROMANIAN_MOLDAVIA )
524 LANG_ENTRY_END( ROMANIAN )
525 /*x19*/ LANG_ENTRY_BEGIN( "ru", RUSSIAN )
526 LANG_SUB_ENTRY( "RU", RUSSIAN, RUSSIAN )
527 LANG_SUB_ENTRY( "MD", RUSSIAN, RUSSIAN_MOLDAVIA )
528 LANG_ENTRY_END( RUSSIAN )
529 /*x1a*/ if (!strcmp(lang,"sh") || !strcmp(lang,"hr") || !strcmp(lang,"sr")) {
531 LANG_DIALECT_ENTRY( SERBO_CROATIAN, NEUTRAL)
532 if (!strcmp(charset,"ISO-8859-5"))
533 LANG_DIALECT_ENTRY( SERBO_CROATIAN, SERBIAN )
534 LANG_SUB_ENTRY( "HR", SERBO_CROATIAN, CROATIAN )
535 if (!strcmp(country,"YU") && !strcmp(charset,"ISO-8859-2"))
536 LANG_DIALECT_ENTRY( SERBO_CROATIAN, SERBIAN_LATIN )
537 LANG_SUB_ENTRY( "YU", SERBO_CROATIAN, SERBIAN )
538 LANG_DIALECT_ENTRY( SERBO_CROATIAN, SERBIAN_LATIN )
540 /*x1b*/ LANG_ENTRY_BEGIN( "sk", SLOVAK )
541 LANG_ENTRY_END( SLOVAK )
542 /*x1c*/ LANG_ENTRY_BEGIN( "sq", ALBANIAN )
543 LANG_ENTRY_END( ALBANIAN )
544 /*x1d*/ LANG_ENTRY_BEGIN( "sv", SWEDISH )
545 LANG_SUB_ENTRY( "SE", SWEDISH, SWEDISH )
546 LANG_SUB_ENTRY( "FI", SWEDISH, SWEDISH_FINLAND )
547 LANG_ENTRY_END( SWEDISH )
548 /*x1e*/ LANG_ENTRY_BEGIN( "th", THAI )
549 LANG_ENTRY_END( THAI )
550 /*x1f*/ LANG_ENTRY_BEGIN( "tr", TURKISH )
551 LANG_ENTRY_END( TURKISH )
552 /*x20*/ LANG_ENTRY_BEGIN( "ur", URDU )
553 LANG_ENTRY_END( URDU )
554 /*x21*/ LANG_ENTRY_BEGIN( "in", INDONESIAN )
555 LANG_ENTRY_END( INDONESIAN )
556 /*x22*/ LANG_ENTRY_BEGIN( "uk", UKRAINIAN )
557 LANG_ENTRY_END( UKRAINIAN )
558 /*x23*/ LANG_ENTRY_BEGIN( "be", BYELORUSSIAN )
559 LANG_ENTRY_END( BYELORUSSIAN )
560 /*x24*/ LANG_ENTRY_BEGIN( "sl", SLOVENIAN )
561 LANG_ENTRY_END( SLOVENIAN )
562 /*x25*/ LANG_ENTRY_BEGIN( "et", ESTONIAN )
563 LANG_ENTRY_END( ESTONIAN )
564 /*x26*/ LANG_ENTRY_BEGIN( "lv", LATVIAN )
565 LANG_ENTRY_END( LATVIAN )
566 /*x27*/ LANG_ENTRY_BEGIN( "lt", LITHUANIAN )
567 /* traditional sorting ? */
568 if (!strcmp(dialect,"classic") || !strcmp(dialect,"traditional"))
569 LANG_DIALECT_ENTRY( LITHUANIAN, LITHUANIAN_CLASSIC )
571 LANG_DIALECT_ENTRY( LITHUANIAN, LITHUANIAN )
572 LANG_ENTRY_END( LITHUANIAN )
573 /*x28*/ LANG_ENTRY_BEGIN( "mi", MAORI )
574 LANG_ENTRY_END( MAORI )
575 /*x29*/ LANG_ENTRY_BEGIN( "fa", FARSI )
576 LANG_ENTRY_END( FARSI )
577 /*x2a*/ LANG_ENTRY_BEGIN( "vi", VIETNAMESE )
578 LANG_ENTRY_END( VIETNAMESE )
579 /*x2b*/ LANG_ENTRY_BEGIN( "hy", ARMENIAN )
580 LANG_ENTRY_END( ARMENIAN )
581 /*x2c*/ LANG_ENTRY_BEGIN( "az", AZERI )
583 if (strstr(charset,"KOI8") || !strcmp(charset,"ISO-8859-5"))
584 LANG_DIALECT_ENTRY( AZERI, AZERI_CYRILLIC )
586 LANG_DIALECT_ENTRY( AZERI, AZERI )
587 LANG_ENTRY_END( AZERI )
588 /*x2d*/ LANG_ENTRY_BEGIN( "eu", BASQUE )
589 LANG_ENTRY_END( BASQUE )
590 /*x2e*/ /*LANG_ENTRY_BEGIN( "??", SORBIAN )
591 LANG_ENTRY_END( SORBIAN ) */
592 /*x2f*/ LANG_ENTRY_BEGIN( "mk", MACEDONIAN )
593 LANG_ENTRY_END( MACEDONIAN )
594 /*x30*/ /*LANG_ENTRY_BEGIN( "??", SUTU )
595 LANG_ENTRY_END( SUTU ) */
596 /*x31*/ LANG_ENTRY_BEGIN( "ts", TSONGA )
597 LANG_ENTRY_END( TSONGA )
598 /*x32*/ /*LANG_ENTRY_BEGIN( "??", TSWANA )
599 LANG_ENTRY_END( TSWANA ) */
600 /*x33*/ /*LANG_ENTRY_BEGIN( "??", VENDA )
601 LANG_ENTRY_END( VENDA ) */
602 /*x34*/ LANG_ENTRY_BEGIN( "xh", XHOSA )
603 LANG_ENTRY_END( XHOSA )
604 /*x35*/ LANG_ENTRY_BEGIN( "zu", ZULU )
605 LANG_ENTRY_END( ZULU )
606 /*x36*/ LANG_ENTRY_BEGIN( "af", AFRIKAANS )
607 LANG_ENTRY_END( AFRIKAANS )
608 /*x37*/ LANG_ENTRY_BEGIN( "ka", GEORGIAN )
609 LANG_ENTRY_END( GEORGIAN )
610 /*x38*/ LANG_ENTRY_BEGIN( "fo", FAEROESE )
611 LANG_ENTRY_END( FAEROESE )
612 /*x39*/ LANG_ENTRY_BEGIN( "hi", HINDI )
613 LANG_ENTRY_END( HINDI )
614 /*x3a*/ LANG_ENTRY_BEGIN( "mt", MALTESE )
615 LANG_ENTRY_END( MALTESE )
616 /*x3b*/ /*LANG_ENTRY_BEGIN( "??", SAAMI )
617 LANG_ENTRY_END( SAAMI ) */
618 /*x3c*/ LANG_ENTRY_BEGIN( "ga", GAELIC )
619 LANG_DIALECT_ENTRY( GAELIC, GAELIC )
620 LANG_ENTRY_END( GAELIC )
621 /*x3c*/ LANG_ENTRY_BEGIN( "gd", GAELIC )
622 LANG_DIALECT_ENTRY( GAELIC, GAELIC_SCOTTISH )
623 LANG_ENTRY_END( GAELIC )
625 /*x3e*/ LANG_ENTRY_BEGIN( "ms", MALAY )
626 LANG_SUB_ENTRY( "MY", MALAY, MALAY )
627 LANG_SUB_ENTRY( "BN", MALAY, MALAY_BRUNEI_DARUSSALAM )
628 LANG_ENTRY_END( MALAY )
629 /*x3f*/ LANG_ENTRY_BEGIN( "kk", KAZAKH )
630 LANG_ENTRY_END( KAZAKH )
632 /*x41*/ LANG_ENTRY_BEGIN( "sw", SWAHILI )
633 LANG_ENTRY_END( SWAHILI )
635 /*x43*/ LANG_ENTRY_BEGIN( "uz", UZBEK )
637 if (strstr(charset,"KOI8") || !strcmp(charset,"ISO-8859-5"))
638 LANG_DIALECT_ENTRY( UZBEK, UZBEK_CYRILLIC )
640 LANG_DIALECT_ENTRY( UZBEK, UZBEK )
641 LANG_ENTRY_END( UZBEK )
642 /*x44*/ LANG_ENTRY_BEGIN( "tt", TATAR )
643 LANG_ENTRY_END( TATAR )
644 /*x45*/ LANG_ENTRY_BEGIN( "bn", BENGALI )
645 LANG_ENTRY_END( BENGALI )
646 /*x46*/ LANG_ENTRY_BEGIN( "pa", PUNJABI )
647 LANG_ENTRY_END( PUNJABI )
648 /*x47*/ LANG_ENTRY_BEGIN( "gu", GUJARATI )
649 LANG_ENTRY_END( GUJARATI )
650 /*x48*/ LANG_ENTRY_BEGIN( "or", ORIYA )
651 LANG_ENTRY_END( ORIYA )
652 /*x49*/ LANG_ENTRY_BEGIN( "ta", TAMIL )
653 LANG_ENTRY_END( TAMIL )
654 /*x4a*/ LANG_ENTRY_BEGIN( "te", TELUGU )
655 LANG_ENTRY_END( TELUGU )
656 /*x4b*/ LANG_ENTRY_BEGIN( "kn", KANNADA )
657 LANG_ENTRY_END( KANNADA )
658 /*x4c*/ LANG_ENTRY_BEGIN( "ml", MALAYALAM )
659 LANG_ENTRY_END( MALAYALAM )
660 /*x4d*/ LANG_ENTRY_BEGIN( "as", ASSAMESE )
661 LANG_ENTRY_END( ASSAMESE )
662 /*x4e*/ LANG_ENTRY_BEGIN( "mr", MARATHI )
663 LANG_ENTRY_END( MARATHI )
664 /*x4f*/ LANG_ENTRY_BEGIN( "sa", SANSKRIT )
665 LANG_ENTRY_END( SANSKRIT )
667 /*x57*/ /*LANG_ENTRY_BEGIN( "??", KONKANI )
668 LANG_ENTRY_END( KONKANI ) */
670 LANG_ENTRY_BEGIN( "eo", ESPERANTO ) /* not official */
671 LANG_ENTRY_END( ESPERANTO )
672 LANG_ENTRY_BEGIN( "wa", WALON ) /* not official */
673 LANG_ENTRY_END( WALON )
677 end_MAIN_GetLanguageID:
678 if (Charset) free(charset);
684 /***********************************************************************
685 * MAIN_ParseLanguageOption
687 * Parse -language option.
689 void MAIN_ParseLanguageOption( char *arg )
691 const WINE_LANGUAGE_DEF *p = Languages;
693 /* for compatibility whith non-iso names previously used */
694 if (!strcmp("Sw",arg)) { strcpy(arg,"Sv"); FIXME_(system)("use 'Sv' instead of 'Sw'\n");}
695 if (!strcmp("Cz",arg)) { strcpy(arg,"Cs"); FIXME_(system)("use 'Cs' instead of 'Cz'\n");}
696 if (!strcmp("Po",arg)) { strcpy(arg,"Pt"); FIXME_(system)("use 'Pt' instead of 'Po'\n");}
698 Options.language = LANG_Xx; /* First (dummy) language */
701 if (!lstrcmpiA( p->name, arg ))
703 WINE_LanguageId = p->langid;
708 MESSAGE( "Invalid language specified '%s'. Supported languages are: ", arg );
709 for (p = Languages; p->name; p++) MESSAGE( "%s ", p->name );
715 /***********************************************************************
716 * MAIN_ParseModeOption
718 * Parse -mode option.
720 void MAIN_ParseModeOption( char *arg )
722 if (!lstrcmpiA("enhanced", arg)) Options.mode = MODE_ENHANCED;
723 else if (!lstrcmpiA("standard", arg)) Options.mode = MODE_STANDARD;
726 MESSAGE( "Invalid mode '%s' specified.\n", arg);
727 MESSAGE( "Valid modes are: 'standard', 'enhanced' (default).\n");
732 /***********************************************************************
735 * Parse command line options and open display.
737 static void MAIN_ParseOptions( int *argc, char *argv[] )
744 Options.programName = MAIN_GetProgramName( *argc, argv );
746 /* initialise Options.language to 0 to tell "no language choosen yet" */
747 Options.language = 0;
749 /* make sure there is no "." in Options.programName to confuse the X
750 resource database lookups */
751 if ((pcDot = strchr(Options.programName, '.'))) *pcDot = '\0';
753 for (i = 1; i < *argc; i++)
755 if (!strcmp( argv[i], "-v" ) || !strcmp( argv[i], "-version" ))
757 MESSAGE( "%s\n", WINE_RELEASE_INFO );
760 if (!strcmp( argv[i], "-h" ) || !strcmp( argv[i], "-help" ))
768 /***********************************************************************
771 static void called_at_exit(void)
774 GDI_Driver->pFinalize();
776 USER_Driver->pFinalize();
781 /***********************************************************************
784 * Wine initialisation and command-line parsing
786 BOOL MAIN_WineInit( int *argc, char *argv[] )
790 #ifdef MALLOC_DEBUGGING
794 if (!(trace = getenv("MALLOC_TRACE")))
796 MESSAGE( "MALLOC_TRACE not set. No trace generated\n" );
800 MESSAGE( "malloc trace goes to %s\n", trace );
808 setlocale(LC_CTYPE,"");
809 gettimeofday( &tv, NULL);
810 MSG_WineStartTicks = (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
812 MAIN_ParseOptions(argc, argv);
814 #ifndef X_DISPLAY_MISSING
815 USER_Driver = &X11DRV_USER_Driver;
816 #else /* !defined(X_DISPLAY_MISSING) */
817 USER_Driver = &TTYDRV_USER_Driver;
818 #endif /* !defined(X_DISPLAY_MISSING) */
820 USER_Driver->pInitialize();
822 MONITOR_Initialize(&MONITOR_PrimaryMonitor);
824 atexit(called_at_exit);
828 /***********************************************************************
829 * MessageBeep16 (USER.104)
831 void WINAPI MessageBeep16( UINT16 i )
837 /***********************************************************************
838 * MessageBeep32 (USER32.390)
840 BOOL WINAPI MessageBeep( UINT i )
847 /***********************************************************************
850 BOOL WINAPI Beep( DWORD dwFreq, DWORD dwDur )
852 /* dwFreq and dwDur are ignored by Win95 */
858 /***********************************************************************
859 * GetTimerResolution (USER.14)
861 LONG WINAPI GetTimerResolution16(void)
866 /***********************************************************************
867 * SystemParametersInfo32A (USER32.540)
869 BOOL WINAPI SystemParametersInfoA( UINT uAction, UINT uParam,
870 LPVOID lpvParam, UINT fuWinIni )
876 *(BOOL *) lpvParam = KEYBOARD_GetBeepActive();
879 KEYBOARD_SetBeepActive(uParam);
883 *(INT *)lpvParam = GetSystemMetrics( SM_CXFRAME );
886 case SPI_GETDRAGFULLWINDOWS:
887 *(BOOL *) lpvParam = FALSE;
890 case SPI_SETDRAGFULLWINDOWS:
893 case SPI_GETFASTTASKSWITCH:
894 if ( GetProfileIntA( "windows", "CoolSwitch", 1 ) == 1 )
895 *(BOOL *) lpvParam = TRUE;
897 *(BOOL *) lpvParam = FALSE;
900 case SPI_GETGRIDGRANULARITY:
901 *(INT*)lpvParam=GetProfileIntA("desktop","GridGranularity",1);
904 case SPI_GETICONTITLEWRAP:
905 *(BOOL*)lpvParam=GetProfileIntA("desktop","IconTitleWrap",TRUE);
908 case SPI_GETKEYBOARDDELAY:
909 *(INT*)lpvParam=GetProfileIntA("keyboard","KeyboardDelay",1);
912 case SPI_GETKEYBOARDSPEED:
913 *(DWORD*)lpvParam=GetProfileIntA("keyboard","KeyboardSpeed",30);
916 case SPI_GETMENUDROPALIGNMENT:
917 *(BOOL*)lpvParam=GetSystemMetrics(SM_MENUDROPALIGNMENT); /* XXX check this */
920 case SPI_GETSCREENSAVEACTIVE:
921 if(MONITOR_GetScreenSaveActive(&MONITOR_PrimaryMonitor) ||
922 GetProfileIntA( "windows", "ScreenSaveActive", 1 ) == 1)
923 *(BOOL*)lpvParam = TRUE;
925 *(BOOL*)lpvParam = FALSE;
928 case SPI_GETSCREENSAVETIMEOUT:
929 timeout = MONITOR_GetScreenSaveTimeout(&MONITOR_PrimaryMonitor);
931 timeout = GetProfileIntA( "windows", "ScreenSaveTimeout", 300 );
932 *(INT *) lpvParam = timeout * 1000;
935 case SPI_ICONHORIZONTALSPACING:
936 /* FIXME Get/SetProfileInt */
937 if (lpvParam == NULL)
938 /*SetSystemMetrics( SM_CXICONSPACING, uParam )*/ ;
940 *(INT*)lpvParam=GetSystemMetrics(SM_CXICONSPACING);
943 case SPI_ICONVERTICALSPACING:
944 /* FIXME Get/SetProfileInt */
945 if (lpvParam == NULL)
946 /*SetSystemMetrics( SM_CYICONSPACING, uParam )*/ ;
948 *(INT*)lpvParam=GetSystemMetrics(SM_CYICONSPACING);
951 case SPI_GETICONTITLELOGFONT: {
952 LPLOGFONTA lpLogFont = (LPLOGFONTA)lpvParam;
954 /* from now on we always have an alias for MS Sans Serif */
956 GetProfileStringA("Desktop", "IconTitleFaceName", "MS Sans Serif",
957 lpLogFont->lfFaceName, LF_FACESIZE );
958 lpLogFont->lfHeight = -GetProfileIntA("Desktop","IconTitleSize", 13);
959 lpLogFont->lfWidth = 0;
960 lpLogFont->lfEscapement = lpLogFont->lfOrientation = 0;
961 lpLogFont->lfWeight = FW_NORMAL;
962 lpLogFont->lfItalic = FALSE;
963 lpLogFont->lfStrikeOut = FALSE;
964 lpLogFont->lfUnderline = FALSE;
965 lpLogFont->lfCharSet = ANSI_CHARSET;
966 lpLogFont->lfOutPrecision = OUT_DEFAULT_PRECIS;
967 lpLogFont->lfClipPrecision = CLIP_DEFAULT_PRECIS;
968 lpLogFont->lfPitchAndFamily = DEFAULT_PITCH | FF_SWISS;
971 case SPI_GETWORKAREA:
972 SetRect( (RECT *)lpvParam, 0, 0,
973 GetSystemMetrics( SM_CXSCREEN ),
974 GetSystemMetrics( SM_CYSCREEN )
977 case SPI_GETNONCLIENTMETRICS:
979 #define lpnm ((LPNONCLIENTMETRICSA)lpvParam)
981 if( lpnm->cbSize == sizeof(NONCLIENTMETRICSA) )
983 LPLOGFONTA lpLogFont = &(lpnm->lfMenuFont);
985 /* clear the struct, so we have 'sane' members */
987 (char*)lpvParam+sizeof(lpnm->cbSize),
989 lpnm->cbSize-sizeof(lpnm->cbSize)
992 /* FIXME: initialize geometry entries */
993 /* FIXME: As these values are presumably in device units,
994 * we should calculate the defaults based on the screen dpi
997 lpnm->iCaptionWidth = ((TWEAK_WineLook > WIN31_LOOK) ? 32 : 20);
998 lpnm->iCaptionHeight = lpnm->iCaptionWidth;
999 lpnm->lfCaptionFont.lfWeight = FW_BOLD;
1000 SystemParametersInfoA(SPI_GETICONTITLELOGFONT, 0, (LPVOID)&(lpnm->lfCaptionFont),0);
1003 lpnm->iSmCaptionWidth = ((TWEAK_WineLook > WIN31_LOOK) ? 32 : 17);
1004 lpnm->iSmCaptionHeight = lpnm->iSmCaptionWidth;
1005 SystemParametersInfoA(SPI_GETICONTITLELOGFONT, 0, (LPVOID)&(lpnm->lfSmCaptionFont),0);
1007 /* menus, FIXME: names of wine.conf entrys are bogus */
1009 lpnm->iMenuWidth = GetProfileIntA("Desktop","MenuWidth", 13); /* size of the menu buttons*/
1010 lpnm->iMenuHeight = GetProfileIntA("Desktop","MenuHeight",
1011 (TWEAK_WineLook > WIN31_LOOK) ? 13 : 27);
1013 GetProfileStringA("Desktop", "MenuFont",
1014 (TWEAK_WineLook > WIN31_LOOK) ? "MS Sans Serif": "System",
1015 lpLogFont->lfFaceName, LF_FACESIZE );
1017 lpLogFont->lfHeight = -GetProfileIntA("Desktop","MenuFontSize", 13);
1018 lpLogFont->lfWidth = 0;
1019 lpLogFont->lfEscapement = lpLogFont->lfOrientation = 0;
1020 lpLogFont->lfWeight = (TWEAK_WineLook > WIN31_LOOK) ? FW_NORMAL : FW_BOLD;
1021 lpLogFont->lfItalic = FALSE;
1022 lpLogFont->lfStrikeOut = FALSE;
1023 lpLogFont->lfUnderline = FALSE;
1024 lpLogFont->lfCharSet = ANSI_CHARSET;
1025 lpLogFont->lfOutPrecision = OUT_DEFAULT_PRECIS;
1026 lpLogFont->lfClipPrecision = CLIP_DEFAULT_PRECIS;
1027 lpLogFont->lfPitchAndFamily = DEFAULT_PITCH | FF_SWISS;
1029 SystemParametersInfoA(SPI_GETICONTITLELOGFONT, 0,
1030 (LPVOID)&(lpnm->lfStatusFont),0);
1031 SystemParametersInfoA(SPI_GETICONTITLELOGFONT, 0,
1032 (LPVOID)&(lpnm->lfMessageFont),0);
1037 case SPI_GETANIMATION: {
1038 LPANIMATIONINFO lpAnimInfo = (LPANIMATIONINFO)lpvParam;
1040 /* Tell it "disabled" */
1041 lpAnimInfo->cbSize = sizeof(ANIMATIONINFO);
1042 uParam = sizeof(ANIMATIONINFO);
1043 lpAnimInfo->iMinAnimate = 0; /* Minimise and restore animation is disabled (nonzero == enabled) */
1047 case SPI_SETANIMATION: {
1048 LPANIMATIONINFO lpAnimInfo = (LPANIMATIONINFO)lpvParam;
1051 WARN_(system)("SPI_SETANIMATION ignored.\n");
1052 lpAnimInfo->cbSize = sizeof(ANIMATIONINFO);
1053 uParam = sizeof(ANIMATIONINFO);
1057 case SPI_GETHIGHCONTRAST:
1059 LPHIGHCONTRASTA lpHighContrastA = (LPHIGHCONTRASTA)lpvParam;
1061 FIXME_(system)("SPI_GETHIGHCONTRAST not fully implemented\n");
1063 if ( lpHighContrastA->cbSize == sizeof( HIGHCONTRASTA ) )
1065 /* Indicate that there is no high contrast available */
1066 lpHighContrastA->dwFlags = 0;
1067 lpHighContrastA->lpszDefaultScheme = NULL;
1078 return SystemParametersInfo16(uAction,uParam,lpvParam,fuWinIni);
1084 /***********************************************************************
1085 * SystemParametersInfo16 (USER.483)
1087 BOOL16 WINAPI SystemParametersInfo16( UINT16 uAction, UINT16 uParam,
1088 LPVOID lpvParam, UINT16 fuWinIni )
1096 *(BOOL *) lpvParam = KEYBOARD_GetBeepActive();
1100 *(INT16 *)lpvParam = GetSystemMetrics16( SM_CXFRAME );
1103 case SPI_GETFASTTASKSWITCH:
1104 if ( GetProfileIntA( "windows", "CoolSwitch", 1 ) == 1 )
1105 *(BOOL16 *) lpvParam = TRUE;
1107 *(BOOL16 *) lpvParam = FALSE;
1110 case SPI_GETGRIDGRANULARITY:
1111 *(INT16 *) lpvParam = GetProfileIntA( "desktop",
1116 case SPI_GETICONTITLEWRAP:
1117 *(BOOL16 *) lpvParam = GetProfileIntA( "desktop",
1122 case SPI_GETKEYBOARDDELAY:
1123 *(INT16 *) lpvParam = GetProfileIntA( "keyboard",
1124 "KeyboardDelay", 1 );
1127 case SPI_GETKEYBOARDSPEED:
1128 *(WORD *) lpvParam = GetProfileIntA( "keyboard",
1133 case SPI_GETMENUDROPALIGNMENT:
1134 *(BOOL16 *) lpvParam = GetSystemMetrics16( SM_MENUDROPALIGNMENT ); /* XXX check this */
1137 case SPI_GETSCREENSAVEACTIVE:
1138 if(MONITOR_GetScreenSaveActive(&MONITOR_PrimaryMonitor) ||
1139 GetProfileIntA( "windows", "ScreenSaveActive", 1 ) == 1)
1140 *(BOOL16 *) lpvParam = TRUE;
1142 *(BOOL16 *) lpvParam = FALSE;
1145 case SPI_GETSCREENSAVETIMEOUT:
1146 timeout = MONITOR_GetScreenSaveTimeout(&MONITOR_PrimaryMonitor);
1148 timeout = GetProfileIntA( "windows", "ScreenSaveTimeout", 300 );
1149 *(INT16 *) lpvParam = timeout;
1152 case SPI_ICONHORIZONTALSPACING:
1153 /* FIXME Get/SetProfileInt */
1154 if (lpvParam == NULL)
1155 /*SetSystemMetrics( SM_CXICONSPACING, uParam )*/ ;
1157 *(INT16 *)lpvParam = GetSystemMetrics16( SM_CXICONSPACING );
1160 case SPI_ICONVERTICALSPACING:
1161 /* FIXME Get/SetProfileInt */
1162 if (lpvParam == NULL)
1163 /*SetSystemMetrics( SM_CYICONSPACING, uParam )*/ ;
1165 *(INT16 *)lpvParam = GetSystemMetrics16(SM_CYICONSPACING);
1169 KEYBOARD_SetBeepActive(uParam);
1172 case SPI_SETSCREENSAVEACTIVE:
1173 MONITOR_SetScreenSaveActive(&MONITOR_PrimaryMonitor, uParam);
1176 case SPI_SETSCREENSAVETIMEOUT:
1177 MONITOR_SetScreenSaveTimeout(&MONITOR_PrimaryMonitor, uParam);
1180 case SPI_SETDESKWALLPAPER:
1181 return (SetDeskWallPaper((LPSTR) lpvParam));
1184 case SPI_SETDESKPATTERN:
1185 if ((INT16)uParam == -1) {
1186 GetProfileStringA("Desktop", "Pattern",
1187 "170 85 170 85 170 85 170 85",
1188 buffer, sizeof(buffer) );
1189 return (DESKTOP_SetPattern((LPSTR) buffer));
1191 return (DESKTOP_SetPattern((LPSTR) lpvParam));
1194 case SPI_GETICONTITLELOGFONT:
1196 LPLOGFONT16 lpLogFont = (LPLOGFONT16)lpvParam;
1197 GetProfileStringA("Desktop", "IconTitleFaceName", "MS Sans Serif",
1198 lpLogFont->lfFaceName, LF_FACESIZE );
1199 lpLogFont->lfHeight = -GetProfileIntA("Desktop","IconTitleSize", 13);
1200 lpLogFont->lfWidth = 0;
1201 lpLogFont->lfEscapement = lpLogFont->lfOrientation = 0;
1202 lpLogFont->lfWeight = FW_NORMAL;
1203 lpLogFont->lfItalic = FALSE;
1204 lpLogFont->lfStrikeOut = FALSE;
1205 lpLogFont->lfUnderline = FALSE;
1206 lpLogFont->lfCharSet = ANSI_CHARSET;
1207 lpLogFont->lfOutPrecision = OUT_DEFAULT_PRECIS;
1208 lpLogFont->lfClipPrecision = CLIP_DEFAULT_PRECIS;
1209 lpLogFont->lfPitchAndFamily = DEFAULT_PITCH | FF_SWISS;
1212 case SPI_GETNONCLIENTMETRICS:
1214 #define lpnm ((LPNONCLIENTMETRICS16)lpvParam)
1215 if( lpnm->cbSize == sizeof(NONCLIENTMETRICS16) )
1217 /* clear the struct, so we have 'sane' members */
1219 (char*)lpvParam+sizeof(lpnm->cbSize),
1221 lpnm->cbSize-sizeof(lpnm->cbSize)
1223 /* FIXME: initialize geometry entries */
1224 SystemParametersInfo16( SPI_GETICONTITLELOGFONT, 0,
1225 (LPVOID)&(lpnm->lfCaptionFont),0);
1226 lpnm->lfCaptionFont.lfWeight = FW_BOLD;
1227 SystemParametersInfo16( SPI_GETICONTITLELOGFONT, 0,
1228 (LPVOID)&(lpnm->lfSmCaptionFont),0);
1229 SystemParametersInfo16( SPI_GETICONTITLELOGFONT, 0,
1230 (LPVOID)&(lpnm->lfMenuFont),0);
1231 SystemParametersInfo16( SPI_GETICONTITLELOGFONT, 0,
1232 (LPVOID)&(lpnm->lfStatusFont),0);
1233 SystemParametersInfo16( SPI_GETICONTITLELOGFONT, 0,
1234 (LPVOID)&(lpnm->lfMessageFont),0);
1236 else /* winfile 95 sets sbSize to 340 */
1237 SystemParametersInfoA( uAction, uParam, lpvParam, fuWinIni );
1241 case SPI_LANGDRIVER:
1243 case SPI_SETDOUBLECLKHEIGHT:
1244 case SPI_SETDOUBLECLICKTIME:
1245 case SPI_SETDOUBLECLKWIDTH:
1246 case SPI_SETFASTTASKSWITCH:
1247 case SPI_SETKEYBOARDDELAY:
1248 case SPI_SETKEYBOARDSPEED:
1249 WARN_(system)("Option %d ignored.\n", uAction);
1252 case SPI_GETWORKAREA:
1253 SetRect16( (RECT16 *)lpvParam, 0, 0,
1254 GetSystemMetrics16( SM_CXSCREEN ),
1255 GetSystemMetrics16( SM_CYSCREEN ) );
1259 WARN_(system)("Unknown option %d.\n", uAction);
1265 /***********************************************************************
1266 * SystemParametersInfo32W (USER32.541)
1268 BOOL WINAPI SystemParametersInfoW( UINT uAction, UINT uParam,
1269 LPVOID lpvParam, UINT fuWinIni )
1275 case SPI_SETDESKWALLPAPER:
1278 lstrcpynWtoA(buffer,(LPWSTR)lpvParam,sizeof(buffer));
1279 return SetDeskWallPaper(buffer);
1281 return SetDeskWallPaper(NULL);
1283 case SPI_SETDESKPATTERN:
1284 if ((INT) uParam == -1)
1286 GetProfileStringA("Desktop", "Pattern",
1287 "170 85 170 85 170 85 170 85",
1288 buffer, sizeof(buffer) );
1289 return (DESKTOP_SetPattern((LPSTR) buffer));
1293 lstrcpynWtoA(buffer,(LPWSTR)lpvParam,sizeof(buffer));
1294 return DESKTOP_SetPattern(buffer);
1296 return DESKTOP_SetPattern(NULL);
1298 case SPI_GETICONTITLELOGFONT:
1300 LPLOGFONTW lpLogFont = (LPLOGFONTW)lpvParam;
1302 GetProfileStringA("Desktop", "IconTitleFaceName", "MS Sans Serif",
1303 buffer, sizeof(buffer) );
1304 lstrcpynAtoW(lpLogFont->lfFaceName, buffer, LF_FACESIZE);
1305 lpLogFont->lfHeight = 17;
1306 lpLogFont->lfWidth = 0;
1307 lpLogFont->lfEscapement = lpLogFont->lfOrientation = 0;
1308 lpLogFont->lfWeight = FW_NORMAL;
1309 lpLogFont->lfItalic = lpLogFont->lfStrikeOut = lpLogFont->lfUnderline = FALSE;
1310 lpLogFont->lfCharSet = ANSI_CHARSET;
1311 lpLogFont->lfOutPrecision = OUT_DEFAULT_PRECIS;
1312 lpLogFont->lfClipPrecision = CLIP_DEFAULT_PRECIS;
1313 lpLogFont->lfPitchAndFamily = DEFAULT_PITCH | FF_SWISS;
1316 case SPI_GETNONCLIENTMETRICS: {
1317 /* FIXME: implement correctly */
1318 LPNONCLIENTMETRICSW lpnm=(LPNONCLIENTMETRICSW)lpvParam;
1320 /* clear the struct, so we have 'sane' members */
1321 memset((char*)lpvParam+sizeof(lpnm->cbSize),
1323 lpnm->cbSize-sizeof(lpnm->cbSize)
1325 SystemParametersInfoW(SPI_GETICONTITLELOGFONT,0,(LPVOID)&(lpnm->lfCaptionFont),0);
1326 lpnm->lfCaptionFont.lfWeight = FW_BOLD;
1327 SystemParametersInfoW(SPI_GETICONTITLELOGFONT,0,(LPVOID)&(lpnm->lfSmCaptionFont),0);
1328 SystemParametersInfoW(SPI_GETICONTITLELOGFONT,0,(LPVOID)&(lpnm->lfMenuFont),0);
1329 SystemParametersInfoW(SPI_GETICONTITLELOGFONT,0,(LPVOID)&(lpnm->lfStatusFont),0);
1330 SystemParametersInfoW(SPI_GETICONTITLELOGFONT,0,(LPVOID)&(lpnm->lfMessageFont),0);
1334 case SPI_GETHIGHCONTRAST:
1336 LPHIGHCONTRASTW lpHighContrastW = (LPHIGHCONTRASTW)lpvParam;
1338 FIXME_(system)("SPI_GETHIGHCONTRAST not fully implemented\n");
1340 if ( lpHighContrastW->cbSize == sizeof( HIGHCONTRASTW ) )
1342 /* Indicate that there is no high contrast available */
1343 lpHighContrastW->dwFlags = 0;
1344 lpHighContrastW->lpszDefaultScheme = NULL;
1355 return SystemParametersInfoA(uAction,uParam,lpvParam,fuWinIni);
1362 /***********************************************************************
1363 * FileCDR (KERNEL.130)
1365 FARPROC16 WINAPI FileCDR16(FARPROC16 x)
1367 FIXME_(file)("(0x%8x): stub\n", (int) x);
1368 return (FARPROC16)TRUE;