Added RtlUnwind in ntdll, and made kernel32 spec entry a forward to
[wine/multimedia.git] / misc / main.c
blob9e83491fa3ba8b24db1bfbaa6de64a2c1c795793
1 /*
2 * Main function.
4 * Copyright 1994 Alexandre Julliard
5 */
7 #include "config.h"
9 #ifndef X_DISPLAY_MISSING
10 #include "x11drv.h"
11 #else /* !defined(X_DISPLAY_MISSING) */
12 #include "ttydrv.h"
13 #endif /* !defined(X_DISPLAY_MISSING) */
15 #include <locale.h>
16 #include <ctype.h>
17 #include <stdlib.h>
18 #include <string.h>
19 #include <unistd.h>
20 #ifdef MALLOC_DEBUGGING
21 # include <malloc.h>
22 #endif
24 #include "winbase.h"
25 #include "winsock.h"
26 #include "heap.h"
27 #include "message.h"
28 #include "msdos.h"
29 #include "color.h"
30 #include "options.h"
31 #include "desktop.h"
32 #include "builtin32.h"
33 #include "debug.h"
34 #include "debugdefs.h"
35 #include "xmalloc.h"
36 #include "module.h"
37 #include "version.h"
38 #include "winnls.h"
39 #include "console.h"
40 #include "monitor.h"
41 #include "keyboard.h"
42 #include "gdi.h"
43 #include "user.h"
44 #include "wine/winuser16.h"
45 #include "tweak.h"
47 /**********************************************************************/
49 USER_DRIVER *USER_Driver = NULL;
51 /* when adding new languages look at ole/ole2nls.c
52 * for proper iso name and Windows code (add 0x0400
53 * to the code listed there)
55 const WINE_LANGUAGE_DEF Languages[] =
57 {"En",0x0409}, /* LANG_En */
58 {"Es",0x040A}, /* LANG_Es */
59 {"De",0x0407}, /* LANG_De */
60 {"No",0x0414}, /* LANG_No */
61 {"Fr",0x040C}, /* LANG_Fr */
62 {"Fi",0x040B}, /* LANG_Fi */
63 {"Da",0x0406}, /* LANG_Da */
64 {"Cs",0x0405}, /* LANG_Cs */
65 {"Eo",0x048f}, /* LANG_Eo */
66 {"It",0x0410}, /* LANG_It */
67 {"Ko",0x0412}, /* LANG_Ko */
68 {"Hu",0x040e}, /* LANG_Hu */
69 {"Pl",0x0415}, /* LANG_Pl */
70 {"Pt",0x0416}, /* LANG_Pt */
71 {"Sv",0x041d}, /* LANG_Sv */
72 {"Ca",0x0403}, /* LANG_Ca */
73 {"Nl",0x0413}, /* LANG_Nl */
74 {"Ru",0x0419}, /* LANG_Ru */
75 {"Wa",0x0490}, /* LANG_Wa */
76 {NULL,0}
79 WORD WINE_LanguageId = 0x409; /* english as default */
81 struct options Options =
82 { /* default options */
83 0, /* argc */
84 NULL, /* argv */
85 NULL, /* desktopGeometry */
86 NULL, /* programName */
87 NULL, /* argv0 */
88 NULL, /* dllFlags */
89 FALSE, /* usePrivateMap */
90 FALSE, /* useFixedMap */
91 FALSE, /* synchronous */
92 FALSE, /* backing store */
93 SW_SHOWNORMAL, /* cmdShow */
94 FALSE,
95 FALSE, /* failReadOnly */
96 MODE_ENHANCED, /* Enhanced mode */
97 #ifdef DEFAULT_LANG
98 DEFAULT_LANG, /* Default language */
99 #else
100 LANG_En,
101 #endif
102 FALSE, /* Managed windows */
103 FALSE, /* Perfect graphics */
104 FALSE, /* No DGA */
105 NULL, /* Alternate config file name */
106 0 /* screenDepth */
109 static char szUsage[] =
110 "%s\n"
111 "Usage: %s [options] \"program_name [arguments]\"\n"
112 "\n"
113 "Options:\n"
114 " -backingstore Turn on backing store\n"
115 " -config name Specify config file to use\n"
116 " -console driver Select which driver(s) to use for the console\n"
117 " -debug Enter debugger before starting application\n"
118 " -debugmsg name Turn debugging-messages on or off\n"
119 " -depth n Change the depth to use for multiple-depth screens\n"
120 " -desktop geom Use a desktop window of the given geometry\n"
121 " -display name Use the specified display\n"
122 " -dll name Enable or disable built-in DLLs\n"
123 " -failreadonly Read only files may not be opened in write mode\n"
124 " -fixedmap Use a \"standard\" color map\n"
125 " -help Show this help message\n"
126 " -iconic Start as an icon\n"
127 " -language xx Set the language (one of Ca,Cs,Da,De,En,Eo,Es,Fi,Fr,Hu,It,\n"
128 " Ko,Nl,No,Pl,Pt,Sv,Ru,Wa)\n"
129 " -managed Allow the window manager to manage created windows\n"
130 " -mode mode Start Wine in a particular mode (standard or enhanced)\n"
131 " -name name Set the application name\n"
132 " -nodga Disable XFree86 DGA extensions\n"
133 " -perfect Favor correctness over speed for graphical operations\n"
134 " -privatemap Use a private color map\n"
135 " -synchronous Turn on synchronous display mode\n"
136 " -version Display the Wine version\n"
137 " -winver Version to imitate (one of win31,win95,nt351,nt40)\n"
138 " -dosver DOS version to imitate (x.xx, e.g. 6.22). Only valid with -winver win31\n"
141 /***********************************************************************
142 * MAIN_Usage
144 void MAIN_Usage( char *name )
146 MSG( szUsage, WINE_RELEASE_INFO, name );
147 exit(1);
150 /***********************************************************************
151 * MAIN_GetProgramName
153 * Get the program name. The name is specified by (in order of precedence):
154 * - the option '-name'.
155 * - the environment variable 'WINE_NAME'.
156 * - the last component of argv[0].
158 static char *MAIN_GetProgramName( int argc, char *argv[] )
160 int i;
161 char *p;
163 for (i = 1; i < argc-1; i++)
164 if (!strcmp( argv[i], "-name" )) return argv[i+1];
165 if ((p = getenv( "WINE_NAME" )) != NULL) return p;
166 if ((p = strrchr( argv[0], '/' )) != NULL) return p+1;
167 return argv[0];
170 /***********************************************************************
171 * MAIN_ParseDebugOptions
173 * Turns specific debug messages on or off, according to "options".
175 * RETURNS
176 * TRUE if parsing was successful
178 BOOL MAIN_ParseDebugOptions(char *options)
180 /* defined in relay32/relay386.c */
181 extern char **debug_relay_includelist;
182 extern char **debug_relay_excludelist;
183 /* defined in relay32/snoop.c */
184 extern char **debug_snoop_includelist;
185 extern char **debug_snoop_excludelist;
187 int i;
188 int l, cls, dotracerelay = TRACE_ON(relay);
190 l = strlen(options);
191 if (l<3)
192 return FALSE;
193 if (options[l-1]=='\n') options[l-1]='\0';
196 if ((*options!='+')&&(*options!='-')){
197 int j;
199 for(j=0; j<DEBUG_CLASS_COUNT; j++)
200 if(!lstrncmpiA(options, debug_cl_name[j], strlen(debug_cl_name[j])))
201 break;
202 if(j==DEBUG_CLASS_COUNT)
203 goto error;
204 options += strlen(debug_cl_name[j]);
205 if ((*options!='+')&&(*options!='-'))
206 goto error;
207 cls = j;
209 else
210 cls = -1; /* all classes */
212 if (strchr(options,','))
213 l=strchr(options,',')-options;
214 else
215 l=strlen(options);
217 if (!lstrncmpiA(options+1,"all",l-1))
219 int i, j;
220 for (i=0; i<DEBUG_CHANNEL_COUNT; i++)
221 for(j=0; j<DEBUG_CLASS_COUNT; j++)
222 if(cls == -1 || cls == j)
223 __SET_DEBUGGING( j, i, (*options=='+') );
225 else if (!lstrncmpiA(options+1, "relay=", 6) ||
226 !lstrncmpiA(options+1, "snoop=", 6))
228 int i, j;
229 char *s, *s2, ***output, c;
231 for (i=0; i<DEBUG_CHANNEL_COUNT; i++)
232 if (debug_ch_name && (!lstrncmpiA(debug_ch_name[i],options+1,5))){
233 for(j=0; j<DEBUG_CLASS_COUNT; j++)
234 if(cls == -1 || cls == j)
235 __SET_DEBUGGING( j, i, 1 );
236 break;
238 /* should never happen, maybe assert(i!=DEBUG_CHANNEL_COUNT)? */
239 if (i==DEBUG_CHANNEL_COUNT)
240 goto error;
241 output = (*options == '+') ?
242 ((*(options+1) == 'r') ?
243 &debug_relay_includelist :
244 &debug_snoop_includelist) :
245 ((*(options+1) == 'r') ?
246 &debug_relay_excludelist :
247 &debug_snoop_excludelist);
248 s = options + 7;
249 i = 1;
250 while((s = strchr(s, ':'))) i++, s++;
251 *output = malloc(sizeof(char **) * i + 1);
252 i = 0;
253 s = options + 7;
254 while((s2 = strchr(s, ':'))) {
255 c = *s2;
256 *s2 = '\0';
257 *((*output)+i) = strdup(s);
258 *s2 = c;
259 s = s2 + 1;
260 i++;
262 c = *(options + l);
263 *(options + l) = '\0';
264 *((*output)+i) = strdup(s);
265 *(options + l) = c;
266 *((*output)+i+1) = NULL;
268 else
270 int i, j;
271 for (i=0; i<DEBUG_CHANNEL_COUNT; i++)
272 if (debug_ch_name && (!lstrncmpiA(options+1,debug_ch_name[i],l-1))){
273 for(j=0; j<DEBUG_CLASS_COUNT; j++)
274 if(cls == -1 || cls == j)
275 __SET_DEBUGGING( j, i, (*options=='+') );
276 break;
278 if (i==DEBUG_CHANNEL_COUNT)
279 goto error;
281 options+=l;
283 while((*options==',')&&(*(++options)));
285 /* special handling for relay debugging */
286 if (dotracerelay != TRACE_ON(relay))
287 BUILTIN32_SwitchRelayDebug( TRACE_ON(relay) );
289 if (!*options)
290 return TRUE;
292 error:
293 MSG("%s: Syntax: -debugmsg [class]+xxx,... or "
294 "-debugmsg [class]-xxx,...\n",Options.argv[0]);
295 MSG("Example: -debugmsg +all,warn-heap\n"
296 " turn on all messages except warning heap messages\n");
297 MSG("Special case: -debugmsg +relay=DLL:DLL.###:FuncName\n"
298 " turn on -debugmsg +relay only as specified\n"
299 "Special case: -debugmsg -relay=DLL:DLL.###:FuncName\n"
300 " turn on -debugmsg +relay except as specified\n"
301 "Also permitted, +snoop=..., -snoop=... as with relay.\n\n");
303 MSG("Available message classes:\n");
304 for(i=0;i<DEBUG_CLASS_COUNT;i++)
305 MSG( "%-9s", debug_cl_name[i]);
306 MSG("\n\n");
308 MSG("Available message types:\n");
309 MSG("%-9s ","all");
310 for(i=0;i<DEBUG_CHANNEL_COUNT;i++)
311 if(debug_ch_name[i])
312 MSG("%-9s%c",debug_ch_name[i],
313 (((i+2)%8==0)?'\n':' '));
314 MSG("\n\n");
315 exit(1);
318 /***********************************************************************
319 * MAIN_GetLanguageID
321 * INPUT:
322 * Lang: a string whose two first chars are the iso name of a language.
323 * Country: a string whose two first chars are the iso name of country
324 * Charset: a string defining the chossen charset encoding
325 * Dialect: a string defining a variation of the locale
327 * all those values are from the standardized format of locale
328 * name in unix which is: Lang[_Country][.Charset][@Dialect]
330 * RETURNS:
331 * the numeric code of the language used by Windows (or 0x00)
333 int MAIN_GetLanguageID(LPCSTR Lang,LPCSTR Country,LPCSTR Charset,LPCSTR Dialect)
335 char lang[3]="??", country[3]={0,0,0};
336 char *charset=NULL, *dialect=NULL;
337 int i,j,ret=0;
339 if (Lang==NULL) return 0x00;
340 if (Lang[0]) lang[0]=tolower(Lang[0]);
341 if (Lang[1]) lang[1]=tolower(Lang[1]);
343 if (Country!=NULL) {
344 if (Country[0]) country[0]=toupper(Country[0]);
345 if (Country[1]) country[1]=toupper(Country[1]);
348 if (Charset!=NULL) {
349 j=strlen(Charset);
350 charset=(char*)malloc(j+1);
351 for (i=0;i<j;i++)
352 charset[i]=toupper(Charset[i]);
353 charset[i]='\0';
356 if (Dialect!=NULL) {
357 j=strlen(Dialect);
358 dialect=(char*)malloc(j+1);
359 for (i=0;i<j;i++)
360 dialect[i]=tolower(Dialect[i]);
361 dialect[i]='\0';
362 } else {
363 dialect = malloc(1);
364 dialect[0] = '\0';
367 #define LANG_ENTRY_BEGIN(x,y) if(!strcmp(lang, x )) { \
368 if (!country[0]) { \
369 ret=LANG_##y ; \
370 goto end_MAIN_GetLanguageID; \
372 #define LANG_SUB_ENTRY(x,y,z) if (!strcmp(country, x )) \
373 ret = MAKELANGID( LANG_##y , SUBLANG_##z ); \
374 goto end_MAIN_GetLanguageID;
375 #define LANG_DIALECT_ENTRY(x,y) { ret = MAKELANGID(LANG_##x , SUBLANG_##y ); \
376 goto end_MAIN_GetLanguageID; }
377 #define LANG_ENTRY_END(x) ret = MAKELANGID(LANG_##x , SUBLANG_DEFAULT); \
378 goto end_MAIN_GetLanguageID; \
381 /*x01*/ LANG_ENTRY_BEGIN( "ar", ARABIC )
382 LANG_SUB_ENTRY( "SA", ARABIC, ARABIC)
383 LANG_SUB_ENTRY( "IQ", ARABIC, ARABIC_IRAQ )
384 LANG_SUB_ENTRY( "EG", ARABIC, ARABIC_EGYPT )
385 LANG_SUB_ENTRY( "LY", ARABIC, ARABIC_LIBYA )
386 LANG_SUB_ENTRY( "DZ", ARABIC, ARABIC_ALGERIA )
387 LANG_SUB_ENTRY( "MA", ARABIC, ARABIC_MOROCCO )
388 LANG_SUB_ENTRY( "TN", ARABIC, ARABIC_TUNISIA )
389 LANG_SUB_ENTRY( "OM", ARABIC, ARABIC_OMAN )
390 LANG_SUB_ENTRY( "YE", ARABIC, ARABIC_YEMEN )
391 LANG_SUB_ENTRY( "SY", ARABIC, ARABIC_SYRIA )
392 LANG_SUB_ENTRY( "JO", ARABIC, ARABIC_JORDAN )
393 LANG_SUB_ENTRY( "LB", ARABIC, ARABIC_LEBANON )
394 LANG_SUB_ENTRY( "KW", ARABIC, ARABIC_KUWAIT )
395 LANG_SUB_ENTRY( "AE", ARABIC, ARABIC_UAE )
396 LANG_SUB_ENTRY( "BH", ARABIC, ARABIC_BAHRAIN )
397 LANG_SUB_ENTRY( "QA", ARABIC, ARABIC_QATAR )
398 LANG_ENTRY_END( ARABIC )
399 /*x02*/ LANG_ENTRY_BEGIN( "bu", BULGARIAN )
400 LANG_ENTRY_END( BULGARIAN )
401 /*x03*/ LANG_ENTRY_BEGIN( "ca", CATALAN )
402 LANG_ENTRY_END( CATALAN )
403 /*x04*/ LANG_ENTRY_BEGIN( "zh", CHINESE )
404 LANG_SUB_ENTRY( "TW", CHINESE, CHINESE_TRADITIONAL )
405 LANG_SUB_ENTRY( "CN", CHINESE, CHINESE_SIMPLIFIED )
406 LANG_SUB_ENTRY( "HK", CHINESE, CHINESE_HONGKONG )
407 LANG_SUB_ENTRY( "SG", CHINESE, CHINESE_SINGAPORE )
408 LANG_SUB_ENTRY( "MO", CHINESE, CHINESE_MACAU )
409 LANG_ENTRY_END( CHINESE )
410 /*x05*/ LANG_ENTRY_BEGIN( "cs", CZECH )
411 LANG_ENTRY_END( CZECH )
412 /*x06*/ LANG_ENTRY_BEGIN( "da", DANISH )
413 LANG_ENTRY_END( DANISH )
414 /*x07*/ LANG_ENTRY_BEGIN( "de", GERMAN )
415 LANG_SUB_ENTRY( "DE", GERMAN, GERMAN )
416 LANG_SUB_ENTRY( "CH", GERMAN, GERMAN_SWISS )
417 LANG_SUB_ENTRY( "AT", GERMAN, GERMAN_AUSTRIAN )
418 LANG_SUB_ENTRY( "LU", GERMAN, GERMAN_LUXEMBOURG )
419 LANG_SUB_ENTRY( "LI", GERMAN, GERMAN_LIECHTENSTEIN )
420 LANG_ENTRY_END( GERMAN )
421 /*x08*/ LANG_ENTRY_BEGIN( "el", GREEK )
422 LANG_ENTRY_END( GREEK )
423 /*x09*/ LANG_ENTRY_BEGIN( "en", ENGLISH )
424 LANG_SUB_ENTRY( "US", ENGLISH, ENGLISH_US )
425 LANG_SUB_ENTRY( "UK", ENGLISH, ENGLISH_UK )
426 LANG_SUB_ENTRY( "AU", ENGLISH, ENGLISH_AUS )
427 LANG_SUB_ENTRY( "CA", ENGLISH, ENGLISH_CAN )
428 LANG_SUB_ENTRY( "NZ", ENGLISH, ENGLISH_NZ )
429 LANG_SUB_ENTRY( "EI", ENGLISH, ENGLISH_EIRE )
430 LANG_SUB_ENTRY( "ZA", ENGLISH, ENGLISH_SAFRICA )
431 LANG_SUB_ENTRY( "JM", ENGLISH, ENGLISH_JAMAICA )
432 /* LANG_SUB_ENTRY( "AG", ENGLISH, ENGLISH_CARIBBEAN ) */
433 LANG_SUB_ENTRY( "BZ", ENGLISH, ENGLISH_BELIZE )
434 LANG_SUB_ENTRY( "TT", ENGLISH, ENGLISH_TRINIDAD )
435 LANG_SUB_ENTRY( "ZW", ENGLISH, ENGLISH_ZIMBABWE )
436 LANG_SUB_ENTRY( "PH", ENGLISH, ENGLISH_PHILIPPINES )
437 LANG_ENTRY_END( ENGLISH )
438 /*x0a*/ LANG_ENTRY_BEGIN( "es", SPANISH )
439 /* traditional sorting */
440 if (!strcmp(dialect,"tradicional"))
441 LANG_DIALECT_ENTRY( SPANISH, SPANISH )
442 LANG_SUB_ENTRY( "MX", SPANISH, SPANISH_MEXICAN )
443 LANG_SUB_ENTRY( "ES", SPANISH, SPANISH_MODERN )
444 LANG_SUB_ENTRY( "GT", SPANISH, SPANISH_GUATEMALA )
445 LANG_SUB_ENTRY( "CR", SPANISH, SPANISH_COSTARICA )
446 LANG_SUB_ENTRY( "PA", SPANISH, SPANISH_PANAMA )
447 LANG_SUB_ENTRY( "DO", SPANISH, SPANISH_DOMINICAN )
448 LANG_SUB_ENTRY( "VE", SPANISH, SPANISH_VENEZUELA )
449 LANG_SUB_ENTRY( "CO", SPANISH, SPANISH_COLOMBIA )
450 LANG_SUB_ENTRY( "PE", SPANISH, SPANISH_PERU )
451 LANG_SUB_ENTRY( "AR", SPANISH, SPANISH_ARGENTINA )
452 LANG_SUB_ENTRY( "EC", SPANISH, SPANISH_ECUADOR )
453 LANG_SUB_ENTRY( "CL", SPANISH, SPANISH_CHILE )
454 LANG_SUB_ENTRY( "UY", SPANISH, SPANISH_URUGUAY )
455 LANG_SUB_ENTRY( "PY", SPANISH, SPANISH_PARAGUAY )
456 LANG_SUB_ENTRY( "BO", SPANISH, SPANISH_BOLIVIA )
457 LANG_SUB_ENTRY( "HN", SPANISH, SPANISH_HONDURAS )
458 LANG_SUB_ENTRY( "NI", SPANISH, SPANISH_NICARAGUA )
459 LANG_SUB_ENTRY( "PR", SPANISH, SPANISH_PUERTO_RICO )
460 LANG_ENTRY_END( SPANISH )
461 /*x0b*/ LANG_ENTRY_BEGIN( "fi", FINNISH )
462 LANG_ENTRY_END( FINNISH )
463 /*x0c*/ LANG_ENTRY_BEGIN( "fr", FRENCH )
464 LANG_SUB_ENTRY( "FR", FRENCH, FRENCH )
465 LANG_SUB_ENTRY( "BE", FRENCH, FRENCH_BELGIAN )
466 LANG_SUB_ENTRY( "CA", FRENCH, FRENCH_CANADIAN )
467 LANG_SUB_ENTRY( "CH", FRENCH, FRENCH_SWISS )
468 LANG_SUB_ENTRY( "LU", FRENCH, FRENCH_LUXEMBOURG )
469 LANG_SUB_ENTRY( "MC", FRENCH, FRENCH_MONACO )
470 LANG_ENTRY_END( FRENCH )
471 /*x0d*/ LANG_ENTRY_BEGIN( "iw", HEBREW )
472 LANG_ENTRY_END( HEBREW )
473 /*x0e*/ LANG_ENTRY_BEGIN( "hu", HUNGARIAN )
474 LANG_ENTRY_END( HUNGARIAN )
475 /*x0f*/ LANG_ENTRY_BEGIN( "ic", ICELANDIC )
476 LANG_ENTRY_END( ICELANDIC )
477 /*x10*/ LANG_ENTRY_BEGIN( "it", ITALIAN )
478 LANG_SUB_ENTRY( "IT", ITALIAN, ITALIAN )
479 LANG_SUB_ENTRY( "CH", ITALIAN, ITALIAN_SWISS )
480 LANG_ENTRY_END( ITALIAN )
481 /*x11*/ LANG_ENTRY_BEGIN( "ja", JAPANESE )
482 LANG_ENTRY_END( JAPANESE )
483 /*x12*/ LANG_ENTRY_BEGIN( "ko", KOREAN )
484 /* JOHAB encoding */
485 if (!strcmp(charset,"JOHAB"))
486 LANG_DIALECT_ENTRY( KOREAN, KOREAN_JOHAB )
487 else
488 LANG_DIALECT_ENTRY( KOREAN, KOREAN )
489 LANG_ENTRY_END( KOREAN )
490 /*x13*/ LANG_ENTRY_BEGIN( "nl", DUTCH )
491 LANG_SUB_ENTRY( "NL", DUTCH, DUTCH )
492 LANG_SUB_ENTRY( "BE", DUTCH, DUTCH_BELGIAN )
493 LANG_SUB_ENTRY( "SR", DUTCH, DUTCH_SURINAM )
494 LANG_ENTRY_END( DUTCH )
495 /*x14*/ LANG_ENTRY_BEGIN( "no", NORWEGIAN )
496 /* nynorsk */
497 if (!strcmp(dialect,"nynorsk"))
498 LANG_DIALECT_ENTRY( NORWEGIAN, NORWEGIAN_NYNORSK )
499 else
500 LANG_DIALECT_ENTRY( NORWEGIAN, NORWEGIAN_BOKMAL )
501 LANG_ENTRY_END( NORWEGIAN )
502 /*x15*/ LANG_ENTRY_BEGIN( "pl", POLISH )
503 LANG_ENTRY_END( POLISH )
504 /*x16*/ LANG_ENTRY_BEGIN( "pt", PORTUGUESE )
505 LANG_SUB_ENTRY( "BR", PORTUGUESE, PORTUGUESE_BRAZILIAN )
506 LANG_SUB_ENTRY( "PT", PORTUGUESE, PORTUGUESE )
507 LANG_ENTRY_END( PORTUGUESE )
508 /*x17*/ LANG_ENTRY_BEGIN( "rm", RHAETO_ROMANCE )
509 LANG_ENTRY_END( RHAETO_ROMANCE )
510 /*x18*/ LANG_ENTRY_BEGIN( "ro", ROMANIAN )
511 LANG_SUB_ENTRY( "RO", ROMANIAN, ROMANIAN )
512 LANG_SUB_ENTRY( "MD", ROMANIAN, ROMANIAN_MOLDAVIA )
513 LANG_ENTRY_END( ROMANIAN )
514 /*x19*/ LANG_ENTRY_BEGIN( "ru", RUSSIAN )
515 LANG_SUB_ENTRY( "RU", RUSSIAN, RUSSIAN )
516 LANG_SUB_ENTRY( "MD", RUSSIAN, RUSSIAN_MOLDAVIA )
517 LANG_ENTRY_END( RUSSIAN )
518 /*x1a*/ if (!strcmp(lang,"sh") || !strcmp(lang,"hr") || !strcmp(lang,"sr")) {
519 if (!country[0])
520 LANG_DIALECT_ENTRY( SERBO_CROATIAN, NEUTRAL)
521 if (!strcmp(charset,"ISO-8859-5"))
522 LANG_DIALECT_ENTRY( SERBO_CROATIAN, SERBIAN )
523 LANG_SUB_ENTRY( "HR", SERBO_CROATIAN, CROATIAN )
524 if (!strcmp(country,"YU") && !strcmp(charset,"ISO-8859-2"))
525 LANG_DIALECT_ENTRY( SERBO_CROATIAN, SERBIAN_LATIN )
526 LANG_SUB_ENTRY( "YU", SERBO_CROATIAN, SERBIAN )
527 LANG_DIALECT_ENTRY( SERBO_CROATIAN, SERBIAN_LATIN )
529 /*x1b*/ LANG_ENTRY_BEGIN( "sk", SLOVAK )
530 LANG_ENTRY_END( SLOVAK )
531 /*x1c*/ LANG_ENTRY_BEGIN( "sq", ALBANIAN )
532 LANG_ENTRY_END( ALBANIAN )
533 /*x1d*/ LANG_ENTRY_BEGIN( "sv", SWEDISH )
534 LANG_SUB_ENTRY( "SE", SWEDISH, SWEDISH )
535 LANG_SUB_ENTRY( "FI", SWEDISH, SWEDISH_FINLAND )
536 LANG_ENTRY_END( SWEDISH )
537 /*x1e*/ LANG_ENTRY_BEGIN( "th", THAI )
538 LANG_ENTRY_END( THAI )
539 /*x1f*/ LANG_ENTRY_BEGIN( "tr", TURKISH )
540 LANG_ENTRY_END( TURKISH )
541 /*x20*/ LANG_ENTRY_BEGIN( "ur", URDU )
542 LANG_ENTRY_END( URDU )
543 /*x21*/ LANG_ENTRY_BEGIN( "in", INDONESIAN )
544 LANG_ENTRY_END( INDONESIAN )
545 /*x22*/ LANG_ENTRY_BEGIN( "uk", UKRAINIAN )
546 LANG_ENTRY_END( UKRAINIAN )
547 /*x23*/ LANG_ENTRY_BEGIN( "be", BYELORUSSIAN )
548 LANG_ENTRY_END( BYELORUSSIAN )
549 /*x24*/ LANG_ENTRY_BEGIN( "sl", SLOVENIAN )
550 LANG_ENTRY_END( SLOVENIAN )
551 /*x25*/ LANG_ENTRY_BEGIN( "et", ESTONIAN )
552 LANG_ENTRY_END( ESTONIAN )
553 /*x26*/ LANG_ENTRY_BEGIN( "lv", LATVIAN )
554 LANG_ENTRY_END( LATVIAN )
555 /*x27*/ LANG_ENTRY_BEGIN( "lt", LITHUANIAN )
556 /* traditional sorting ? */
557 if (!strcmp(dialect,"classic") || !strcmp(dialect,"traditional"))
558 LANG_DIALECT_ENTRY( LITHUANIAN, LITHUANIAN_CLASSIC )
559 else
560 LANG_DIALECT_ENTRY( LITHUANIAN, LITHUANIAN )
561 LANG_ENTRY_END( LITHUANIAN )
562 /*x28*/ LANG_ENTRY_BEGIN( "mi", MAORI )
563 LANG_ENTRY_END( MAORI )
564 /*x29*/ LANG_ENTRY_BEGIN( "fa", FARSI )
565 LANG_ENTRY_END( FARSI )
566 /*x2a*/ LANG_ENTRY_BEGIN( "vi", VIETNAMESE )
567 LANG_ENTRY_END( VIETNAMESE )
568 /*x2b*/ LANG_ENTRY_BEGIN( "hy", ARMENIAN )
569 LANG_ENTRY_END( ARMENIAN )
570 /*x2c*/ LANG_ENTRY_BEGIN( "az", AZERI )
571 /* Cyrillic */
572 if (strstr(charset,"KOI8") || !strcmp(charset,"ISO-8859-5"))
573 LANG_DIALECT_ENTRY( AZERI, AZERI_CYRILLIC )
574 else
575 LANG_DIALECT_ENTRY( AZERI, AZERI )
576 LANG_ENTRY_END( AZERI )
577 /*x2d*/ LANG_ENTRY_BEGIN( "eu", BASQUE )
578 LANG_ENTRY_END( BASQUE )
579 /*x2e*/ /*LANG_ENTRY_BEGIN( "??", SORBIAN )
580 LANG_ENTRY_END( SORBIAN ) */
581 /*x2f*/ LANG_ENTRY_BEGIN( "mk", MACEDONIAN )
582 LANG_ENTRY_END( MACEDONIAN )
583 /*x30*/ /*LANG_ENTRY_BEGIN( "??", SUTU )
584 LANG_ENTRY_END( SUTU ) */
585 /*x31*/ LANG_ENTRY_BEGIN( "ts", TSONGA )
586 LANG_ENTRY_END( TSONGA )
587 /*x32*/ /*LANG_ENTRY_BEGIN( "??", TSWANA )
588 LANG_ENTRY_END( TSWANA ) */
589 /*x33*/ /*LANG_ENTRY_BEGIN( "??", VENDA )
590 LANG_ENTRY_END( VENDA ) */
591 /*x34*/ LANG_ENTRY_BEGIN( "xh", XHOSA )
592 LANG_ENTRY_END( XHOSA )
593 /*x35*/ LANG_ENTRY_BEGIN( "zu", ZULU )
594 LANG_ENTRY_END( ZULU )
595 /*x36*/ LANG_ENTRY_BEGIN( "af", AFRIKAANS )
596 LANG_ENTRY_END( AFRIKAANS )
597 /*x37*/ LANG_ENTRY_BEGIN( "ka", GEORGIAN )
598 LANG_ENTRY_END( GEORGIAN )
599 /*x38*/ LANG_ENTRY_BEGIN( "fo", FAEROESE )
600 LANG_ENTRY_END( FAEROESE )
601 /*x39*/ LANG_ENTRY_BEGIN( "hi", HINDI )
602 LANG_ENTRY_END( HINDI )
603 /*x3a*/ LANG_ENTRY_BEGIN( "mt", MALTESE )
604 LANG_ENTRY_END( MALTESE )
605 /*x3b*/ /*LANG_ENTRY_BEGIN( "??", SAAMI )
606 LANG_ENTRY_END( SAAMI ) */
607 /*x3c*/ LANG_ENTRY_BEGIN( "ga", GAELIC )
608 LANG_DIALECT_ENTRY( GAELIC, GAELIC )
609 LANG_ENTRY_END( GAELIC )
610 /*x3c*/ LANG_ENTRY_BEGIN( "gd", GAELIC )
611 LANG_DIALECT_ENTRY( GAELIC, GAELIC_SCOTTISH )
612 LANG_ENTRY_END( GAELIC )
613 /* 0x3d */
614 /*x3e*/ LANG_ENTRY_BEGIN( "ms", MALAY )
615 LANG_SUB_ENTRY( "MY", MALAY, MALAY )
616 LANG_SUB_ENTRY( "BN", MALAY, MALAY_BRUNEI_DARUSSALAM )
617 LANG_ENTRY_END( MALAY )
618 /*x3f*/ LANG_ENTRY_BEGIN( "kk", KAZAKH )
619 LANG_ENTRY_END( KAZAKH )
620 /* 0x40 */
621 /*x41*/ LANG_ENTRY_BEGIN( "sw", SWAHILI )
622 LANG_ENTRY_END( SWAHILI )
623 /* 0x42 */
624 /*x43*/ LANG_ENTRY_BEGIN( "uz", UZBEK )
625 /* Cyrillic */
626 if (strstr(charset,"KOI8") || !strcmp(charset,"ISO-8859-5"))
627 LANG_DIALECT_ENTRY( UZBEK, UZBEK_CYRILLIC )
628 else
629 LANG_DIALECT_ENTRY( UZBEK, UZBEK )
630 LANG_ENTRY_END( UZBEK )
631 /*x44*/ LANG_ENTRY_BEGIN( "tt", TATAR )
632 LANG_ENTRY_END( TATAR )
633 /*x45*/ LANG_ENTRY_BEGIN( "bn", BENGALI )
634 LANG_ENTRY_END( BENGALI )
635 /*x46*/ LANG_ENTRY_BEGIN( "pa", PUNJABI )
636 LANG_ENTRY_END( PUNJABI )
637 /*x47*/ LANG_ENTRY_BEGIN( "gu", GUJARATI )
638 LANG_ENTRY_END( GUJARATI )
639 /*x48*/ LANG_ENTRY_BEGIN( "or", ORIYA )
640 LANG_ENTRY_END( ORIYA )
641 /*x49*/ LANG_ENTRY_BEGIN( "ta", TAMIL )
642 LANG_ENTRY_END( TAMIL )
643 /*x4a*/ LANG_ENTRY_BEGIN( "te", TELUGU )
644 LANG_ENTRY_END( TELUGU )
645 /*x4b*/ LANG_ENTRY_BEGIN( "kn", KANNADA )
646 LANG_ENTRY_END( KANNADA )
647 /*x4c*/ LANG_ENTRY_BEGIN( "ml", MALAYALAM )
648 LANG_ENTRY_END( MALAYALAM )
649 /*x4d*/ LANG_ENTRY_BEGIN( "as", ASSAMESE )
650 LANG_ENTRY_END( ASSAMESE )
651 /*x4e*/ LANG_ENTRY_BEGIN( "mr", MARATHI )
652 LANG_ENTRY_END( MARATHI )
653 /*x4f*/ LANG_ENTRY_BEGIN( "sa", SANSKRIT )
654 LANG_ENTRY_END( SANSKRIT )
655 /* 0x50 -> 0x56 */
656 /*x57*/ /*LANG_ENTRY_BEGIN( "??", KONKANI )
657 LANG_ENTRY_END( KONKANI ) */
658 /* 0x58 -> ... */
659 LANG_ENTRY_BEGIN( "eo", ESPERANTO ) /* not official */
660 LANG_ENTRY_END( ESPERANTO )
661 LANG_ENTRY_BEGIN( "wa", WALON ) /* not official */
662 LANG_ENTRY_END( WALON )
664 ret = LANG_ENGLISH;
666 end_MAIN_GetLanguageID:
667 if (Charset) free(charset);
668 free(dialect);
670 return ret;
673 /***********************************************************************
674 * MAIN_ParseLanguageOption
676 * Parse -language option.
678 void MAIN_ParseLanguageOption( char *arg )
680 const WINE_LANGUAGE_DEF *p = Languages;
682 /* for compatibility whith non-iso names previously used */
683 if (!strcmp("Sw",arg)) { strcpy(arg,"Sv"); FIXME(system,"use 'Sv' instead of 'Sw'\n");}
684 if (!strcmp("Cz",arg)) { strcpy(arg,"Cs"); FIXME(system,"use 'Cs' instead of 'Cz'\n");}
685 if (!strcmp("Po",arg)) { strcpy(arg,"Pt"); FIXME(system,"use 'Pt' instead of 'Po'\n");}
687 Options.language = LANG_Xx; /* First (dummy) language */
688 for (;p->name;p++)
690 if (!lstrcmpiA( p->name, arg ))
692 WINE_LanguageId = p->langid;
693 return;
695 Options.language++;
697 MSG( "Invalid language specified '%s'. Supported languages are: ", arg );
698 for (p = Languages; p->name; p++) MSG( "%s ", p->name );
699 MSG( "\n" );
700 exit(1);
704 /***********************************************************************
705 * MAIN_ParseModeOption
707 * Parse -mode option.
709 void MAIN_ParseModeOption( char *arg )
711 if (!lstrcmpiA("enhanced", arg)) Options.mode = MODE_ENHANCED;
712 else if (!lstrcmpiA("standard", arg)) Options.mode = MODE_STANDARD;
713 else
715 MSG( "Invalid mode '%s' specified.\n", arg);
716 MSG( "Valid modes are: 'standard', 'enhanced' (default).\n");
717 exit(1);
721 /***********************************************************************
722 * MAIN_ParseOptions
724 * Parse command line options and open display.
726 static void MAIN_ParseOptions( int *argc, char *argv[] )
728 int i;
729 char *pcDot;
731 Options.argc = argc;
732 Options.argv = argv;
733 Options.programName = MAIN_GetProgramName( *argc, argv );
734 Options.argv0 = argv[0];
736 /* initialise Options.language to 0 to tell "no language choosen yet" */
737 Options.language = 0;
739 /* make sure there is no "." in Options.programName to confuse the X
740 resource database lookups */
741 if ((pcDot = strchr(Options.programName, '.'))) *pcDot = '\0';
743 for (i = 1; i < *argc; i++)
745 if (!strcmp( argv[i], "-v" ) || !strcmp( argv[i], "-version" ))
747 MSG( "%s\n", WINE_RELEASE_INFO );
748 exit(0);
750 if (!strcmp( argv[i], "-h" ) || !strcmp( argv[i], "-help" ))
752 MAIN_Usage(argv[0]);
753 exit(0);
758 /***********************************************************************
759 * called_at_exit
761 static void called_at_exit(void)
763 if (GDI_Driver)
764 GDI_Driver->pFinalize();
765 if (USER_Driver)
766 USER_Driver->pFinalize();
768 WINSOCK_Shutdown();
769 CONSOLE_Close();
772 /***********************************************************************
773 * MAIN_WineInit
775 * Wine initialisation and command-line parsing
777 BOOL MAIN_WineInit( int *argc, char *argv[] )
779 struct timeval tv;
781 #ifdef MALLOC_DEBUGGING
782 char *trace;
784 mcheck(NULL);
785 if (!(trace = getenv("MALLOC_TRACE")))
787 MSG( "MALLOC_TRACE not set. No trace generated\n" );
789 else
791 MSG( "malloc trace goes to %s\n", trace );
792 mtrace();
794 #endif
796 setbuf(stdout,NULL);
797 setbuf(stderr,NULL);
799 setlocale(LC_CTYPE,"");
800 gettimeofday( &tv, NULL);
801 MSG_WineStartTicks = (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
803 MAIN_ParseOptions(argc, argv);
805 #ifndef X_DISPLAY_MISSING
806 USER_Driver = &X11DRV_USER_Driver;
807 #else /* !defined(X_DISPLAY_MISSING) */
808 USER_Driver = &TTYDRV_USER_Driver;
809 #endif /* !defined(X_DISPLAY_MISSING) */
811 USER_Driver->pInitialize();
813 MONITOR_Initialize(&MONITOR_PrimaryMonitor);
815 atexit(called_at_exit);
816 return TRUE;
819 /***********************************************************************
820 * MessageBeep16 (USER.104)
822 void WINAPI MessageBeep16( UINT16 i )
824 MessageBeep( i );
828 /***********************************************************************
829 * MessageBeep32 (USER32.390)
831 BOOL WINAPI MessageBeep( UINT i )
833 KEYBOARD_Beep();
834 return TRUE;
838 /***********************************************************************
839 * Beep (KERNEL32.11)
841 BOOL WINAPI Beep( DWORD dwFreq, DWORD dwDur )
843 /* dwFreq and dwDur are ignored by Win95 */
844 KEYBOARD_Beep();
845 return TRUE;
849 /***********************************************************************
850 * GetTimerResolution (USER.14)
852 LONG WINAPI GetTimerResolution16(void)
854 return (1000);
857 /***********************************************************************
858 * SystemParametersInfo32A (USER32.540)
860 BOOL WINAPI SystemParametersInfoA( UINT uAction, UINT uParam,
861 LPVOID lpvParam, UINT fuWinIni )
863 int timeout;
865 switch (uAction) {
866 case SPI_GETBEEP:
867 *(BOOL *) lpvParam = KEYBOARD_GetBeepActive();
868 break;
869 case SPI_SETBEEP:
870 KEYBOARD_SetBeepActive(uParam);
871 break;
873 case SPI_GETBORDER:
874 *(INT *)lpvParam = GetSystemMetrics( SM_CXFRAME );
875 break;
877 case SPI_GETDRAGFULLWINDOWS:
878 *(BOOL *) lpvParam = FALSE;
879 break;
881 case SPI_SETDRAGFULLWINDOWS:
882 break;
884 case SPI_GETFASTTASKSWITCH:
885 if ( GetProfileIntA( "windows", "CoolSwitch", 1 ) == 1 )
886 *(BOOL *) lpvParam = TRUE;
887 else
888 *(BOOL *) lpvParam = FALSE;
889 break;
891 case SPI_GETGRIDGRANULARITY:
892 *(INT*)lpvParam=GetProfileIntA("desktop","GridGranularity",1);
893 break;
895 case SPI_GETICONTITLEWRAP:
896 *(BOOL*)lpvParam=GetProfileIntA("desktop","IconTitleWrap",TRUE);
897 break;
899 case SPI_GETKEYBOARDDELAY:
900 *(INT*)lpvParam=GetProfileIntA("keyboard","KeyboardDelay",1);
901 break;
903 case SPI_GETKEYBOARDSPEED:
904 *(DWORD*)lpvParam=GetProfileIntA("keyboard","KeyboardSpeed",30);
905 break;
907 case SPI_GETMENUDROPALIGNMENT:
908 *(BOOL*)lpvParam=GetSystemMetrics(SM_MENUDROPALIGNMENT); /* XXX check this */
909 break;
911 case SPI_GETSCREENSAVEACTIVE:
912 if(MONITOR_GetScreenSaveActive(&MONITOR_PrimaryMonitor) ||
913 GetProfileIntA( "windows", "ScreenSaveActive", 1 ) == 1)
914 *(BOOL*)lpvParam = TRUE;
915 else
916 *(BOOL*)lpvParam = FALSE;
917 break;
919 case SPI_GETSCREENSAVETIMEOUT:
920 timeout = MONITOR_GetScreenSaveTimeout(&MONITOR_PrimaryMonitor);
921 if(!timeout)
922 timeout = GetProfileIntA( "windows", "ScreenSaveTimeout", 300 );
923 *(INT *) lpvParam = timeout * 1000;
924 break;
926 case SPI_ICONHORIZONTALSPACING:
927 /* FIXME Get/SetProfileInt */
928 if (lpvParam == NULL)
929 /*SetSystemMetrics( SM_CXICONSPACING, uParam )*/ ;
930 else
931 *(INT*)lpvParam=GetSystemMetrics(SM_CXICONSPACING);
932 break;
934 case SPI_ICONVERTICALSPACING:
935 /* FIXME Get/SetProfileInt */
936 if (lpvParam == NULL)
937 /*SetSystemMetrics( SM_CYICONSPACING, uParam )*/ ;
938 else
939 *(INT*)lpvParam=GetSystemMetrics(SM_CYICONSPACING);
940 break;
942 case SPI_GETICONTITLELOGFONT: {
943 LPLOGFONTA lpLogFont = (LPLOGFONTA)lpvParam;
945 /* from now on we always have an alias for MS Sans Serif */
947 GetProfileStringA("Desktop", "IconTitleFaceName", "MS Sans Serif",
948 lpLogFont->lfFaceName, LF_FACESIZE );
949 lpLogFont->lfHeight = -GetProfileIntA("Desktop","IconTitleSize", 8);
950 lpLogFont->lfWidth = 0;
951 lpLogFont->lfEscapement = lpLogFont->lfOrientation = 0;
952 lpLogFont->lfWeight = FW_NORMAL;
953 lpLogFont->lfItalic = FALSE;
954 lpLogFont->lfStrikeOut = FALSE;
955 lpLogFont->lfUnderline = FALSE;
956 lpLogFont->lfCharSet = ANSI_CHARSET;
957 lpLogFont->lfOutPrecision = OUT_DEFAULT_PRECIS;
958 lpLogFont->lfClipPrecision = CLIP_DEFAULT_PRECIS;
959 lpLogFont->lfPitchAndFamily = DEFAULT_PITCH | FF_SWISS;
960 break;
962 case SPI_GETWORKAREA:
963 SetRect( (RECT *)lpvParam, 0, 0,
964 GetSystemMetrics( SM_CXSCREEN ),
965 GetSystemMetrics( SM_CYSCREEN )
967 break;
968 case SPI_GETNONCLIENTMETRICS:
970 #define lpnm ((LPNONCLIENTMETRICSA)lpvParam)
972 if( lpnm->cbSize == sizeof(NONCLIENTMETRICSA) )
973 { LPLOGFONTA lpLogFont = &(lpnm->lfMenuFont);
975 /* FIXME: initialize geometry entries */
977 SystemParametersInfoA(SPI_GETICONTITLELOGFONT, 0,
978 (LPVOID)&(lpnm->lfCaptionFont),0);
980 /* caption */
981 lpnm->iCaptionWidth = (TWEAK_WineLook > WIN31_LOOK) ? 19 : 12;
982 lpnm->iCaptionHeight = (TWEAK_WineLook > WIN31_LOOK) ? 19 : 12;
983 SystemParametersInfoA(SPI_GETICONTITLELOGFONT, 0, (LPVOID)&(lpnm->lfSmCaptionFont),0);
984 lpnm->lfCaptionFont.lfWeight = FW_BOLD;
986 /* small caption */
987 lpnm->iCaptionWidth = (TWEAK_WineLook > WIN31_LOOK) ? 19 : 10;
988 lpnm->iCaptionHeight = (TWEAK_WineLook > WIN31_LOOK) ? 19 : 10;
990 /* menus, FIXME: names of wine.conf entrys are bogus */
992 lpnm->iMenuWidth = GetProfileIntA("Desktop","MenuWidth", 8); /* size of the menu buttons*/
993 lpnm->iMenuHeight = GetProfileIntA("Desktop","MenuHeight",
994 (TWEAK_WineLook > WIN31_LOOK) ? 8 : 16);
996 GetProfileStringA("Desktop", "MenuFont",
997 (TWEAK_WineLook > WIN31_LOOK) ? "MS Sans Serif": "System",
998 lpLogFont->lfFaceName, LF_FACESIZE );
1000 lpLogFont->lfHeight = -GetProfileIntA("Desktop","MenuFontSize", 8);
1001 lpLogFont->lfWidth = 0;
1002 lpLogFont->lfEscapement = lpLogFont->lfOrientation = 0;
1003 lpLogFont->lfWeight = (TWEAK_WineLook > WIN31_LOOK) ? FW_NORMAL : FW_BOLD;
1004 lpLogFont->lfItalic = FALSE;
1005 lpLogFont->lfStrikeOut = FALSE;
1006 lpLogFont->lfUnderline = FALSE;
1007 lpLogFont->lfCharSet = ANSI_CHARSET;
1008 lpLogFont->lfOutPrecision = OUT_DEFAULT_PRECIS;
1009 lpLogFont->lfClipPrecision = CLIP_DEFAULT_PRECIS;
1010 lpLogFont->lfPitchAndFamily = DEFAULT_PITCH | FF_SWISS;
1012 SystemParametersInfoA(SPI_GETICONTITLELOGFONT, 0,
1013 (LPVOID)&(lpnm->lfStatusFont),0);
1014 SystemParametersInfoA(SPI_GETICONTITLELOGFONT, 0,
1015 (LPVOID)&(lpnm->lfMessageFont),0);
1017 #undef lpnm
1018 break;
1020 case SPI_GETANIMATION: {
1021 LPANIMATIONINFO lpAnimInfo = (LPANIMATIONINFO)lpvParam;
1023 /* Tell it "disabled" */
1024 lpAnimInfo->cbSize = sizeof(ANIMATIONINFO);
1025 uParam = sizeof(ANIMATIONINFO);
1026 lpAnimInfo->iMinAnimate = 0; /* Minimise and restore animation is disabled (nonzero == enabled) */
1027 break;
1030 case SPI_SETANIMATION: {
1031 LPANIMATIONINFO lpAnimInfo = (LPANIMATIONINFO)lpvParam;
1033 /* Do nothing */
1034 WARN(system, "SPI_SETANIMATION ignored.\n");
1035 lpAnimInfo->cbSize = sizeof(ANIMATIONINFO);
1036 uParam = sizeof(ANIMATIONINFO);
1037 break;
1040 case SPI_GETHIGHCONTRAST:
1042 LPHIGHCONTRASTA lpHighContrastA = (LPHIGHCONTRASTA)lpvParam;
1044 FIXME(system,"SPI_GETHIGHCONTRAST not fully implemented\n");
1046 if ( lpHighContrastA->cbSize == sizeof( HIGHCONTRASTA ) )
1048 /* Indicate that there is no high contrast available */
1049 lpHighContrastA->dwFlags = 0;
1050 lpHighContrastA->lpszDefaultScheme = NULL;
1052 else
1054 return FALSE;
1057 break;
1060 default:
1061 return SystemParametersInfo16(uAction,uParam,lpvParam,fuWinIni);
1063 return TRUE;
1067 /***********************************************************************
1068 * SystemParametersInfo16 (USER.483)
1070 BOOL16 WINAPI SystemParametersInfo16( UINT16 uAction, UINT16 uParam,
1071 LPVOID lpvParam, UINT16 fuWinIni )
1073 int timeout;
1074 char buffer[256];
1076 switch (uAction)
1078 case SPI_GETBEEP:
1079 *(BOOL *) lpvParam = KEYBOARD_GetBeepActive();
1080 break;
1082 case SPI_GETBORDER:
1083 *(INT16 *)lpvParam = GetSystemMetrics16( SM_CXFRAME );
1084 break;
1086 case SPI_GETFASTTASKSWITCH:
1087 if ( GetProfileIntA( "windows", "CoolSwitch", 1 ) == 1 )
1088 *(BOOL16 *) lpvParam = TRUE;
1089 else
1090 *(BOOL16 *) lpvParam = FALSE;
1091 break;
1093 case SPI_GETGRIDGRANULARITY:
1094 *(INT16 *) lpvParam = GetProfileIntA( "desktop",
1095 "GridGranularity",
1096 1 );
1097 break;
1099 case SPI_GETICONTITLEWRAP:
1100 *(BOOL16 *) lpvParam = GetProfileIntA( "desktop",
1101 "IconTitleWrap",
1102 TRUE );
1103 break;
1105 case SPI_GETKEYBOARDDELAY:
1106 *(INT16 *) lpvParam = GetProfileIntA( "keyboard",
1107 "KeyboardDelay", 1 );
1108 break;
1110 case SPI_GETKEYBOARDSPEED:
1111 *(WORD *) lpvParam = GetProfileIntA( "keyboard",
1112 "KeyboardSpeed",
1113 30 );
1114 break;
1116 case SPI_GETMENUDROPALIGNMENT:
1117 *(BOOL16 *) lpvParam = GetSystemMetrics16( SM_MENUDROPALIGNMENT ); /* XXX check this */
1118 break;
1120 case SPI_GETSCREENSAVEACTIVE:
1121 if(MONITOR_GetScreenSaveActive(&MONITOR_PrimaryMonitor) ||
1122 GetProfileIntA( "windows", "ScreenSaveActive", 1 ) == 1)
1123 *(BOOL16 *) lpvParam = TRUE;
1124 else
1125 *(BOOL16 *) lpvParam = FALSE;
1126 break;
1128 case SPI_GETSCREENSAVETIMEOUT:
1129 timeout = MONITOR_GetScreenSaveTimeout(&MONITOR_PrimaryMonitor);
1130 if(!timeout)
1131 timeout = GetProfileIntA( "windows", "ScreenSaveTimeout", 300 );
1132 *(INT16 *) lpvParam = timeout;
1133 break;
1135 case SPI_ICONHORIZONTALSPACING:
1136 /* FIXME Get/SetProfileInt */
1137 if (lpvParam == NULL)
1138 /*SetSystemMetrics( SM_CXICONSPACING, uParam )*/ ;
1139 else
1140 *(INT16 *)lpvParam = GetSystemMetrics16( SM_CXICONSPACING );
1141 break;
1143 case SPI_ICONVERTICALSPACING:
1144 /* FIXME Get/SetProfileInt */
1145 if (lpvParam == NULL)
1146 /*SetSystemMetrics( SM_CYICONSPACING, uParam )*/ ;
1147 else
1148 *(INT16 *)lpvParam = GetSystemMetrics16(SM_CYICONSPACING);
1149 break;
1151 case SPI_SETBEEP:
1152 KEYBOARD_SetBeepActive(uParam);
1153 break;
1155 case SPI_SETSCREENSAVEACTIVE:
1156 MONITOR_SetScreenSaveActive(&MONITOR_PrimaryMonitor, uParam);
1157 break;
1159 case SPI_SETSCREENSAVETIMEOUT:
1160 MONITOR_SetScreenSaveTimeout(&MONITOR_PrimaryMonitor, uParam);
1161 break;
1163 case SPI_SETDESKWALLPAPER:
1164 return (SetDeskWallPaper((LPSTR) lpvParam));
1165 break;
1167 case SPI_SETDESKPATTERN:
1168 if ((INT16)uParam == -1) {
1169 GetProfileStringA("Desktop", "Pattern",
1170 "170 85 170 85 170 85 170 85",
1171 buffer, sizeof(buffer) );
1172 return (DESKTOP_SetPattern((LPSTR) buffer));
1173 } else
1174 return (DESKTOP_SetPattern((LPSTR) lpvParam));
1175 break;
1177 case SPI_GETICONTITLELOGFONT:
1179 LPLOGFONT16 lpLogFont = (LPLOGFONT16)lpvParam;
1181 GetProfileStringA("Desktop", "IconTitleFaceName", "MS Sans Serif",
1182 lpLogFont->lfFaceName, LF_FACESIZE );
1183 lpLogFont->lfHeight = -GetProfileIntA("Desktop","IconTitleSize", 8);
1184 lpLogFont->lfWidth = 0;
1185 lpLogFont->lfEscapement = lpLogFont->lfOrientation = 0;
1186 lpLogFont->lfWeight = FW_NORMAL;
1187 lpLogFont->lfItalic = FALSE;
1188 lpLogFont->lfStrikeOut = FALSE;
1189 lpLogFont->lfUnderline = FALSE;
1190 lpLogFont->lfCharSet = ANSI_CHARSET;
1191 lpLogFont->lfOutPrecision = OUT_DEFAULT_PRECIS;
1192 lpLogFont->lfClipPrecision = CLIP_DEFAULT_PRECIS;
1193 lpLogFont->lfPitchAndFamily = DEFAULT_PITCH | FF_SWISS;
1194 break;
1196 case SPI_GETNONCLIENTMETRICS:
1198 #define lpnm ((LPNONCLIENTMETRICS16)lpvParam)
1199 if( lpnm->cbSize == sizeof(NONCLIENTMETRICS16) )
1201 /* FIXME: initialize geometry entries */
1202 SystemParametersInfo16( SPI_GETICONTITLELOGFONT, 0,
1203 (LPVOID)&(lpnm->lfCaptionFont),0);
1204 lpnm->lfCaptionFont.lfWeight = FW_BOLD;
1205 SystemParametersInfo16( SPI_GETICONTITLELOGFONT, 0,
1206 (LPVOID)&(lpnm->lfSmCaptionFont),0);
1207 SystemParametersInfo16( SPI_GETICONTITLELOGFONT, 0,
1208 (LPVOID)&(lpnm->lfMenuFont),0);
1209 SystemParametersInfo16( SPI_GETICONTITLELOGFONT, 0,
1210 (LPVOID)&(lpnm->lfStatusFont),0);
1211 SystemParametersInfo16( SPI_GETICONTITLELOGFONT, 0,
1212 (LPVOID)&(lpnm->lfMessageFont),0);
1214 else /* winfile 95 sets sbSize to 340 */
1215 SystemParametersInfoA( uAction, uParam, lpvParam, fuWinIni );
1216 #undef lpnm
1217 break;
1219 case SPI_LANGDRIVER:
1220 case SPI_SETBORDER:
1221 case SPI_SETDOUBLECLKHEIGHT:
1222 case SPI_SETDOUBLECLICKTIME:
1223 case SPI_SETDOUBLECLKWIDTH:
1224 case SPI_SETFASTTASKSWITCH:
1225 case SPI_SETKEYBOARDDELAY:
1226 case SPI_SETKEYBOARDSPEED:
1227 WARN(system, "Option %d ignored.\n", uAction);
1228 break;
1230 case SPI_GETWORKAREA:
1231 SetRect16( (RECT16 *)lpvParam, 0, 0,
1232 GetSystemMetrics16( SM_CXSCREEN ),
1233 GetSystemMetrics16( SM_CYSCREEN ) );
1234 break;
1236 default:
1237 WARN(system, "Unknown option %d.\n", uAction);
1238 break;
1240 return 1;
1243 /***********************************************************************
1244 * SystemParametersInfo32W (USER32.541)
1246 BOOL WINAPI SystemParametersInfoW( UINT uAction, UINT uParam,
1247 LPVOID lpvParam, UINT fuWinIni )
1249 char buffer[256];
1251 switch (uAction)
1253 case SPI_SETDESKWALLPAPER:
1254 if (lpvParam)
1256 lstrcpynWtoA(buffer,(LPWSTR)lpvParam,sizeof(buffer));
1257 return SetDeskWallPaper(buffer);
1259 return SetDeskWallPaper(NULL);
1261 case SPI_SETDESKPATTERN:
1262 if ((INT) uParam == -1)
1264 GetProfileStringA("Desktop", "Pattern",
1265 "170 85 170 85 170 85 170 85",
1266 buffer, sizeof(buffer) );
1267 return (DESKTOP_SetPattern((LPSTR) buffer));
1269 if (lpvParam)
1271 lstrcpynWtoA(buffer,(LPWSTR)lpvParam,sizeof(buffer));
1272 return DESKTOP_SetPattern(buffer);
1274 return DESKTOP_SetPattern(NULL);
1276 case SPI_GETICONTITLELOGFONT:
1278 LPLOGFONTW lpLogFont = (LPLOGFONTW)lpvParam;
1279 GetProfileStringA("Desktop", "IconTitleFaceName", "MS Sans Serif",
1280 buffer, sizeof(buffer) );
1281 lstrcpynAtoW(lpLogFont->lfFaceName, buffer ,LF_FACESIZE);
1282 lpLogFont->lfHeight = 10;
1283 lpLogFont->lfWidth = 0;
1284 lpLogFont->lfEscapement = lpLogFont->lfOrientation = 0;
1285 lpLogFont->lfWeight = FW_NORMAL;
1286 lpLogFont->lfItalic = lpLogFont->lfStrikeOut = lpLogFont->lfUnderline = FALSE;
1287 lpLogFont->lfCharSet = ANSI_CHARSET;
1288 lpLogFont->lfOutPrecision = OUT_DEFAULT_PRECIS;
1289 lpLogFont->lfClipPrecision = CLIP_DEFAULT_PRECIS;
1290 lpLogFont->lfPitchAndFamily = DEFAULT_PITCH | FF_SWISS;
1292 break;
1293 case SPI_GETNONCLIENTMETRICS: {
1294 /* FIXME: implement correctly */
1295 LPNONCLIENTMETRICSW lpnm=(LPNONCLIENTMETRICSW)lpvParam;
1297 SystemParametersInfoW(SPI_GETICONTITLELOGFONT,0,(LPVOID)&(lpnm->lfCaptionFont),0);
1298 lpnm->lfCaptionFont.lfWeight = FW_BOLD;
1299 SystemParametersInfoW(SPI_GETICONTITLELOGFONT,0,(LPVOID)&(lpnm->lfSmCaptionFont),0);
1300 SystemParametersInfoW(SPI_GETICONTITLELOGFONT,0,(LPVOID)&(lpnm->lfMenuFont),0);
1301 SystemParametersInfoW(SPI_GETICONTITLELOGFONT,0,(LPVOID)&(lpnm->lfStatusFont),0);
1302 SystemParametersInfoW(SPI_GETICONTITLELOGFONT,0,(LPVOID)&(lpnm->lfMessageFont),0);
1303 break;
1306 case SPI_GETHIGHCONTRAST:
1308 LPHIGHCONTRASTW lpHighContrastW = (LPHIGHCONTRASTW)lpvParam;
1310 FIXME(system,"SPI_GETHIGHCONTRAST not fully implemented\n");
1312 if ( lpHighContrastW->cbSize == sizeof( HIGHCONTRASTW ) )
1314 /* Indicate that there is no high contrast available */
1315 lpHighContrastW->dwFlags = 0;
1316 lpHighContrastW->lpszDefaultScheme = NULL;
1318 else
1320 return FALSE;
1323 break;
1326 default:
1327 return SystemParametersInfoA(uAction,uParam,lpvParam,fuWinIni);
1330 return TRUE;
1334 /***********************************************************************
1335 * FileCDR (KERNEL.130)
1337 FARPROC16 WINAPI FileCDR16(FARPROC16 x)
1339 FIXME(file,"(0x%8x): stub\n", (int) x);
1340 return (FARPROC16)TRUE;