Release 970720
[wine/gsoc-2012-control.git] / misc / main.c
blob01cc321de3a5ca174a66757f243de88df117b02d
1 /*
2 * Main function.
4 * Copyright 1994 Alexandre Julliard
5 */
7 #include <stdio.h>
8 #include <stdlib.h>
9 #include <string.h>
10 #include <unistd.h>
11 #include <ctype.h>
12 /* #include <locale.h> */
13 #ifdef MALLOC_DEBUGGING
14 #include <malloc.h>
15 #endif
16 #include <X11/Xlib.h>
17 #include <X11/Xresource.h>
18 #include <X11/Xutil.h>
19 #include <X11/Xlocale.h>
20 #include <X11/cursorfont.h>
21 #include "heap.h"
22 #include "message.h"
23 #include "module.h"
24 #include "msdos.h"
25 #include "windows.h"
26 #include "color.h"
27 #include "winsock.h"
28 #include "options.h"
29 #include "desktop.h"
30 #include "shell.h"
31 #include "winbase.h"
32 #define DEBUG_DEFINE_VARIABLES
33 #include "stddebug.h"
34 #include "debug.h"
35 #include "xmalloc.h"
37 const char people[] = "Wine is available thanks to the work of "
38 "Bob Amstadt, Dag Asheim, Martin Ayotte, Peter Bajusz, Ross Biro, "
39 "Uwe Bonnes, Erik Bos, Fons Botman, John Brezak, Andrew Bulhak, "
40 "John Burton, Niels de Carpentier, Jimen Ching, Huw D. M. Davies, "
41 "Roman Dolejsi, Frans van Dorsselaer, Paul Falstad, David Faure, "
42 "Olaf Flebbe, Peter Galbavy, Ramon Garcia, Matthew Ghio, "
43 "Hans de Graaff, Charles M. Hannum, John Harvey, Cameron Heide, "
44 "Jochen Hoenicke, Onno Hovers, Jeffrey Hsu, Miguel de Icaza, "
45 "Jukka Iivonen, Lee Jaekil, Alexandre Julliard, Bang Jun-Young, "
46 "Pavel Kankovsky, Jochen Karrer, Andreas Kirschbaum, Albrecht Kleine, "
47 "Jon Konrath, Alex Korobka, Greg Kreider, Anand Kumria, Scott A. Laird, "
48 "Andrew Lewycky, Martin von Loewis, Kenneth MacDonald, Peter MacDonald, "
49 "William Magro, Juergen Marquardt, Ricardo Massaro, Marcus Meissner, "
50 "Graham Menhennitt, David Metcalfe, Bruce Milner, Steffen Moeller, "
51 "Andreas Mohr, Philippe De Muyter, Itai Nahshon, Michael Patra, "
52 "Jim Peterson, Robert Pouliot, Keith Reynolds, Slaven Rezic, "
53 "John Richardson, Johannes Ruscheinski, Thomas Sandford, "
54 "Constantine Sapuntzakis, Pablo Saratxaga, Daniel Schepler, "
55 "Ulrich Schmid, Bernd Schmidt, Yngvi Sigurjonsson, Stephen Simmons, "
56 "Rick Sladkey, William Smith, Dominik Strasser, Vadim Strizhevsky, "
57 "Erik Svendsen, Tristan Tarrant, Andrew Taylor, Duncan C Thomson, "
58 "Goran Thyni, Jimmy Tirtawangsa, Jon Tombs, Linus Torvalds, "
59 "Gregory Trubetskoy, Petri Tuomola, Michael Veksler, Sven Verdoolaege, "
60 "Ronan Waide, Eric Warnke, Manfred Weichel, Morten Welinder, "
61 "Jan Willamowius, Carl Williams, Karl Guenter Wuensch, Eric Youngdale, "
62 "James Youngman, Mikolaj Zalewski, and John Zero.";
64 const WINE_LANGUAGE_DEF Languages[] =
66 {"En",0x0409}, /* LANG_En */
67 {"Es",0x040A}, /* LANG_Es */
68 {"De",0x0407}, /* LANG_De */
69 {"No",0x0414}, /* LANG_No */
70 {"Fr",0x0400}, /* LANG_Fr */
71 {"Fi",0x040B}, /* LANG_Fi */
72 {"Da",0x0406}, /* LANG_Da */
73 {"Cz",0x0405}, /* LANG_Cz */
74 {"Eo", 0}, /* LANG_Eo */ /* FIXME languageid */
75 {"It",0x0410}, /* LANG_It */
76 {"Ko",0x0412}, /* LANG_Ko */
77 {"Hu",0x0436}, /* LANG_Hu */
78 {"Pl",0x0415}, /* LANG_Pl */
79 {"Po",0x0416}, /* LANG_Po */
80 {NULL,0}
83 WORD WINE_LanguageId = 0;
85 #define WINE_CLASS "Wine" /* Class name for resources */
87 #define WINE_APP_DEFAULTS "/usr/lib/X11/app-defaults/Wine"
89 typedef struct tagENVENTRY {
90 LPSTR Name;
91 LPSTR Value;
92 WORD wSize;
93 struct tagENVENTRY *Prev;
94 struct tagENVENTRY *Next;
95 } ENVENTRY, *LPENVENTRY;
97 LPENVENTRY lpEnvList = NULL;
99 Display *display;
100 Screen *screen;
101 Window rootWindow;
102 int screenWidth = 0, screenHeight = 0; /* Desktop window dimensions */
103 int screenDepth = 0; /* Screen depth to use */
104 int desktopX = 0, desktopY = 0; /* Desktop window position (if any) */
105 int getVersion16 = 0;
106 int getVersion32 = 0;
107 OSVERSIONINFO32A getVersionEx;
109 struct options Options =
110 { /* default options */
111 NULL, /* desktopGeometry */
112 NULL, /* programName */
113 FALSE, /* usePrivateMap */
114 FALSE, /* useFixedMap */
115 FALSE, /* synchronous */
116 FALSE, /* backing store */
117 SW_SHOWNORMAL, /* cmdShow */
118 FALSE,
119 FALSE, /* failReadOnly */
120 MODE_ENHANCED, /* Enhanced mode */
121 FALSE, /* IPC enabled */
122 #ifdef DEFAULT_LANG
123 DEFAULT_LANG, /* Default language */
124 #else
125 LANG_En,
126 #endif
127 FALSE, /* Managed windows */
128 FALSE /* Perfect graphics */
132 static XrmOptionDescRec optionsTable[] =
134 { "-backingstore", ".backingstore", XrmoptionNoArg, (caddr_t)"on" },
135 { "-desktop", ".desktop", XrmoptionSepArg, (caddr_t)NULL },
136 { "-depth", ".depth", XrmoptionSepArg, (caddr_t)NULL },
137 { "-display", ".display", XrmoptionSepArg, (caddr_t)NULL },
138 { "-iconic", ".iconic", XrmoptionNoArg, (caddr_t)"on" },
139 { "-ipc", ".ipc", XrmoptionNoArg, (caddr_t)"off"},
140 { "-language", ".language", XrmoptionSepArg, (caddr_t)"En" },
141 { "-name", ".name", XrmoptionSepArg, (caddr_t)NULL },
142 { "-perfect", ".perfect", XrmoptionNoArg, (caddr_t)"on" },
143 { "-privatemap", ".privatemap", XrmoptionNoArg, (caddr_t)"on" },
144 { "-fixedmap", ".fixedmap", XrmoptionNoArg, (caddr_t)"on" },
145 { "-synchronous", ".synchronous", XrmoptionNoArg, (caddr_t)"on" },
146 { "-debug", ".debug", XrmoptionNoArg, (caddr_t)"on" },
147 { "-debugmsg", ".debugmsg", XrmoptionSepArg, (caddr_t)NULL },
148 { "-dll", ".dll", XrmoptionSepArg, (caddr_t)NULL },
149 { "-failreadonly", ".failreadonly", XrmoptionNoArg, (caddr_t)"on" },
150 { "-mode", ".mode", XrmoptionSepArg, (caddr_t)NULL },
151 { "-managed", ".managed", XrmoptionNoArg, (caddr_t)"off"},
152 { "-winver", ".winver", XrmoptionSepArg, (caddr_t)NULL }
155 #define NB_OPTIONS (sizeof(optionsTable) / sizeof(optionsTable[0]))
157 #define USAGE \
158 "Usage: %s [options] program_name [arguments]\n" \
159 "\n" \
160 "Options:\n" \
161 " -backingstore Turn on backing store\n" \
162 " -debug Enter debugger before starting application\n" \
163 " -debugmsg name Turn debugging-messages on or off\n" \
164 " -depth n Change the depth to use for multiple-depth screens\n" \
165 " -desktop geom Use a desktop window of the given geometry\n" \
166 " -display name Use the specified display\n" \
167 " -dll name Enable or disable built-in DLLs\n" \
168 " -failreadonly Read only files may not be opened in write mode\n" \
169 " -fixedmap Use a \"standard\" color map\n" \
170 " -iconic Start as an icon\n" \
171 " -ipc Enable IPC facilities\n" \
172 " -language xx Set the language (one of En,Es,De,No,Fr,Fi,Da,Cz,Eo,It,Ko,\n Hu,Pl,Po)\n" \
173 " -managed Allow the window manager to manage created windows\n" \
174 " -mode mode Start Wine in a particular mode (standard or enhanced)\n" \
175 " -name name Set the application name\n" \
176 " -perfect Favor correctness over speed for graphical operations\n" \
177 " -privatemap Use a private color map\n" \
178 " -synchronous Turn on synchronous display mode\n" \
179 " -winver Version to imitate (one of win31,win95,nt351)\n"
183 /***********************************************************************
184 * MAIN_Usage
186 #ifndef WINELIB32
187 void MAIN_Usage( char *name )
189 fprintf( stderr, USAGE, name );
190 exit(1);
192 #endif
195 /***********************************************************************
196 * MAIN_GetProgramName
198 * Get the program name. The name is specified by (in order of precedence):
199 * - the option '-name'.
200 * - the environment variable 'WINE_NAME'.
201 * - the last component of argv[0].
203 static char *MAIN_GetProgramName( int argc, char *argv[] )
205 int i;
206 char *p;
208 for (i = 1; i < argc-1; i++)
209 if (!strcmp( argv[i], "-name" )) return argv[i+1];
210 if ((p = getenv( "WINE_NAME" )) != NULL) return p;
211 if ((p = strrchr( argv[0], '/' )) != NULL) return p+1;
212 return argv[0];
216 /***********************************************************************
217 * MAIN_GetResource
219 * Fetch the value of resource 'name' using the correct instance name.
220 * 'name' must begin with '.' or '*'
222 static int MAIN_GetResource( XrmDatabase db, char *name, XrmValue *value )
224 char *buff_instance, *buff_class;
225 char *dummy;
226 int retval;
228 buff_instance = (char *)xmalloc(strlen(Options.programName)+strlen(name)+1);
229 buff_class = (char *)xmalloc( strlen(WINE_CLASS) + strlen(name) + 1 );
231 strcpy( buff_instance, Options.programName );
232 strcat( buff_instance, name );
233 strcpy( buff_class, WINE_CLASS );
234 strcat( buff_class, name );
235 retval = XrmGetResource( db, buff_instance, buff_class, &dummy, value );
236 free( buff_instance );
237 free( buff_class );
238 return retval;
242 /***********************************************************************
243 * ParseDebugOptions
245 * Turns specific debug messages on or off, according to "options".
246 * Returns TRUE if parsing was successful
248 #ifdef DEBUG_RUNTIME
250 BOOL32 ParseDebugOptions(char *options)
252 int l;
253 if (strlen(options)<3)
254 return FALSE;
257 if ((*options!='+')&&(*options!='-'))
258 return FALSE;
259 if (strchr(options,','))
260 l=strchr(options,',')-options;
261 else
262 l=strlen(options);
263 if (!lstrncmpi32A(options+1,"all",l-1))
265 int i;
266 for (i=0;i<sizeof(debug_msg_enabled)/sizeof(short);i++)
267 debug_msg_enabled[i]=(*options=='+');
269 else
271 int i;
272 for (i=0;i<sizeof(debug_msg_enabled)/sizeof(short);i++)
273 if (debug_msg_name && (!lstrncmpi32A(options+1,debug_msg_name[i],l-1)))
275 debug_msg_enabled[i]=(*options=='+');
276 break;
278 if (i==sizeof(debug_msg_enabled)/sizeof(short))
279 return FALSE;
281 options+=l;
283 while((*options==',')&&(*(++options)));
284 if (*options)
285 return FALSE;
286 else
287 return TRUE;
290 #endif
293 /***********************************************************************
294 * MAIN_ParseLanguageOption
296 * Parse -language option.
298 static void MAIN_ParseLanguageOption( char *arg )
300 const WINE_LANGUAGE_DEF *p = Languages;
302 Options.language = LANG_En; /* First language */
303 for (;p->name;p++)
305 if (!lstrcmpi32A( p->name, arg ))
307 WINE_LanguageId = p->langid;
308 return;
310 Options.language++;
312 fprintf( stderr, "Invalid language specified '%s'. Supported languages are: ", arg );
313 for (p = Languages; p->name; p++) fprintf( stderr, "%s ", p->name );
314 fprintf( stderr, "\n" );
315 exit(1);
319 /***********************************************************************
320 * MAIN_ParseModeOption
322 * Parse -mode option.
324 static void MAIN_ParseModeOption( char *arg )
326 if (!lstrcmpi32A("enhanced", arg)) Options.mode = MODE_ENHANCED;
327 else if (!lstrcmpi32A("standard", arg)) Options.mode = MODE_STANDARD;
328 else
330 fprintf(stderr, "Invalid mode '%s' specified.\n", arg);
331 fprintf(stderr, "Valid modes are: 'standard', 'enhanced' (default).\n");
332 exit(1);
336 /**********************************************************************
337 * MAIN_ParseVersion
339 static void MAIN_ParseVersion( char *arg )
341 /* If you add any other options,
342 verify the values you return on the real thing */
343 if(strcmp(arg,"win31")==0)
345 getVersion16 = 0x06160A03;
346 /* FIXME: My Win32s installation failed to execute the
347 MSVC 4 test program. So check these values */
348 getVersion32 = 0x80000A03;
349 getVersionEx.dwMajorVersion=3;
350 getVersionEx.dwMinorVersion=10;
351 getVersionEx.dwBuildNumber=0;
352 getVersionEx.dwPlatformId=VER_PLATFORM_WIN32s;
353 strcpy(getVersionEx.szCSDVersion,"Win32s 1.3");
355 else if(strcmp(arg, "win95")==0)
357 getVersion16 = 0x07005F03;
358 getVersion32 = 0xC0000004;
359 getVersionEx.dwMajorVersion=4;
360 getVersionEx.dwMinorVersion=0;
361 getVersionEx.dwBuildNumber=0x40003B6;
362 getVersionEx.dwPlatformId=VER_PLATFORM_WIN32_WINDOWS;
363 strcpy(getVersionEx.szCSDVersion,"");
365 else if(strcmp(arg, "nt351")==0)
367 getVersion16 = 0x05000A03;
368 getVersion32 = 0x04213303;
369 getVersionEx.dwMajorVersion=3;
370 getVersionEx.dwMinorVersion=51;
371 getVersionEx.dwBuildNumber=0x421;
372 getVersionEx.dwPlatformId=VER_PLATFORM_WIN32_NT;
373 strcpy(getVersionEx.szCSDVersion,"Service Pack 2");
375 else fprintf(stderr, "Unknown winver system code - ignored\n");
378 /***********************************************************************
379 * MAIN_ParseOptions
381 * Parse command line options and open display.
383 static void MAIN_ParseOptions( int *argc, char *argv[] )
385 char *display_name = NULL;
386 XrmValue value;
387 XrmDatabase db = XrmGetFileDatabase(WINE_APP_DEFAULTS);
388 int i;
389 char *xrm_string;
391 Options.programName = MAIN_GetProgramName( *argc, argv );
393 /* Get display name from command line */
394 for (i = 1; i < *argc - 1; i++)
395 if (!strcmp( argv[i], "-display" ))
397 display_name = argv[i+1];
398 break;
401 #ifdef WINELIB
402 /* Need to assemble command line and pass it to WinMain */
403 #else
404 if (*argc < 2 || lstrcmpi32A(argv[1], "-h") == 0)
405 MAIN_Usage( argv[0] );
406 #endif
408 /* Open display */
410 if (display_name == NULL &&
411 MAIN_GetResource( db, ".display", &value )) display_name = value.addr;
413 if (!(display = XOpenDisplay( display_name )))
415 fprintf( stderr, "%s: Can't open display: %s\n",
416 argv[0], display_name ? display_name : "(none specified)" );
417 exit(1);
420 /* Merge file and screen databases */
421 if ((xrm_string = XResourceManagerString( display )) != NULL)
423 XrmDatabase display_db = XrmGetStringDatabase( xrm_string );
424 XrmMergeDatabases( display_db, &db );
427 /* Parse command line */
428 XrmParseCommand( &db, optionsTable, NB_OPTIONS,
429 Options.programName, argc, argv );
431 /* Get all options */
432 if (MAIN_GetResource( db, ".iconic", &value ))
433 Options.cmdShow = SW_SHOWMINIMIZED;
434 if (MAIN_GetResource( db, ".privatemap", &value ))
435 Options.usePrivateMap = TRUE;
436 if (MAIN_GetResource( db, ".fixedmap", &value ))
437 Options.useFixedMap = TRUE;
438 if (MAIN_GetResource( db, ".synchronous", &value ))
439 Options.synchronous = TRUE;
440 if (MAIN_GetResource( db, ".backingstore", &value ))
441 Options.backingstore = TRUE;
442 if (MAIN_GetResource( db, ".debug", &value ))
443 Options.debug = TRUE;
444 if (MAIN_GetResource( db, ".failreadonly", &value ))
445 Options.failReadOnly = TRUE;
446 if (MAIN_GetResource( db, ".ipc", &value ))
447 Options.ipc = TRUE;
448 if (MAIN_GetResource( db, ".perfect", &value ))
449 Options.perfectGraphics = TRUE;
450 if (MAIN_GetResource( db, ".depth", &value))
451 screenDepth = atoi( value.addr );
452 if (MAIN_GetResource( db, ".desktop", &value))
453 Options.desktopGeometry = value.addr;
454 if (MAIN_GetResource( db, ".language", &value))
455 MAIN_ParseLanguageOption( (char *)value.addr );
456 if (MAIN_GetResource( db, ".managed", &value))
457 Options.managed = TRUE;
458 if (MAIN_GetResource( db, ".mode", &value))
459 MAIN_ParseModeOption( (char *)value.addr );
461 #ifdef DEBUG_RUNTIME
462 if (MAIN_GetResource( db, ".debugoptions", &value))
463 ParseDebugOptions((char*)value.addr);
464 #endif
465 if (MAIN_GetResource( db, ".debugmsg", &value))
467 #ifndef DEBUG_RUNTIME
468 fprintf(stderr,"%s: Option \"-debugmsg\" not implemented.\n" \
469 " Recompile with DEBUG_RUNTIME in include/stddebug.h defined.\n",
470 argv[0]);
471 exit(1);
472 #else
473 if (ParseDebugOptions((char*)value.addr)==FALSE)
475 int i;
476 fprintf(stderr,"%s: Syntax: -debugmsg +xxx,... or -debugmsg -xxx,...\n",argv[0]);
477 fprintf(stderr,"Example: -debugmsg +all,-heap turn on all messages except heap messages\n");
478 fprintf(stderr,"Available message types:\n");
479 fprintf(stderr,"%-9s ","all");
480 for(i=0;i<sizeof(debug_msg_enabled)/sizeof(short);i++)
481 if(debug_msg_name[i])
482 fprintf(stderr,"%-9s%c",debug_msg_name[i],
483 (((i+2)%8==0)?'\n':' '));
484 fprintf(stderr,"\n\n");
485 exit(1);
487 #endif
490 if(MAIN_GetResource( db, ".dll", &value))
492 #ifndef WINELIB
493 if (!BUILTIN_ParseDLLOptions( (char*)value.addr ))
495 fprintf(stderr,"%s: Syntax: -dll +xxx,... or -dll -xxx,...\n",argv[0]);
496 fprintf(stderr,"Example: -dll -ole2 Do not use emulated OLE2.DLL\n");
497 fprintf(stderr,"Available DLLs:\n");
498 BUILTIN_PrintDLLs();
499 exit(1);
501 #else
502 fprintf(stderr,"-dll not supported in libwine\n");
503 #endif
506 if(MAIN_GetResource( db, ".winver", &value))
507 MAIN_ParseVersion( (char*)value.addr );
511 /***********************************************************************
512 * MAIN_CreateDesktop
514 static void MAIN_CreateDesktop( int argc, char *argv[] )
516 int flags;
517 unsigned int width = 640, height = 480; /* Default size = 640x480 */
518 char *name = "Wine desktop";
519 XSizeHints *size_hints;
520 XWMHints *wm_hints;
521 XClassHint *class_hints;
522 XSetWindowAttributes win_attr;
523 XTextProperty window_name;
524 Atom XA_WM_DELETE_WINDOW;
526 flags = XParseGeometry( Options.desktopGeometry,
527 &desktopX, &desktopY, &width, &height );
528 screenWidth = width;
529 screenHeight = height;
531 /* Create window */
533 win_attr.event_mask = ExposureMask | KeyPressMask | KeyReleaseMask |
534 PointerMotionMask | ButtonPressMask |
535 ButtonReleaseMask | EnterWindowMask |
536 StructureNotifyMask;
537 win_attr.cursor = XCreateFontCursor( display, XC_top_left_arrow );
539 rootWindow = XCreateWindow( display, DefaultRootWindow(display),
540 desktopX, desktopY, width, height, 0,
541 CopyFromParent, InputOutput, CopyFromParent,
542 CWEventMask | CWCursor, &win_attr );
544 /* Set window manager properties */
546 size_hints = XAllocSizeHints();
547 wm_hints = XAllocWMHints();
548 class_hints = XAllocClassHint();
549 if (!size_hints || !wm_hints || !class_hints)
551 fprintf( stderr, "Not enough memory for window manager hints.\n" );
552 exit(1);
554 size_hints->min_width = size_hints->max_width = width;
555 size_hints->min_height = size_hints->max_height = height;
556 size_hints->flags = PMinSize | PMaxSize;
557 if (flags & (XValue | YValue)) size_hints->flags |= USPosition;
558 if (flags & (WidthValue | HeightValue)) size_hints->flags |= USSize;
559 else size_hints->flags |= PSize;
561 wm_hints->flags = InputHint | StateHint;
562 wm_hints->input = True;
563 wm_hints->initial_state = NormalState;
564 class_hints->res_name = argv[0];
565 class_hints->res_class = "Wine";
567 XStringListToTextProperty( &name, 1, &window_name );
568 XSetWMProperties( display, rootWindow, &window_name, &window_name,
569 argv, argc, size_hints, wm_hints, class_hints );
570 XA_WM_DELETE_WINDOW = XInternAtom( display, "WM_DELETE_WINDOW", False );
571 XSetWMProtocols( display, rootWindow, &XA_WM_DELETE_WINDOW, 1 );
572 XFree( size_hints );
573 XFree( wm_hints );
574 XFree( class_hints );
576 /* Map window */
578 XMapWindow( display, rootWindow );
582 XKeyboardState keyboard_state;
584 /***********************************************************************
585 * MAIN_SaveSetup
587 static void MAIN_SaveSetup(void)
589 XGetKeyboardControl(display, &keyboard_state);
592 /***********************************************************************
593 * MAIN_RestoreSetup
595 static void MAIN_RestoreSetup(void)
597 XKeyboardControl keyboard_value;
599 keyboard_value.key_click_percent = keyboard_state.key_click_percent;
600 keyboard_value.bell_percent = keyboard_state.bell_percent;
601 keyboard_value.bell_pitch = keyboard_state.bell_pitch;
602 keyboard_value.bell_duration = keyboard_state.bell_duration;
603 keyboard_value.auto_repeat_mode = keyboard_state.global_auto_repeat;
605 XChangeKeyboardControl(display, KBKeyClickPercent | KBBellPercent |
606 KBBellPitch | KBBellDuration | KBAutoRepeatMode, &keyboard_value);
610 static void called_at_exit(void)
612 MAIN_RestoreSetup();
613 COLOR_Cleanup();
614 WINSOCK_Shutdown();
617 /***********************************************************************
618 * MAIN_WineInit
620 * Wine initialisation and command-line parsing
622 BOOL32 MAIN_WineInit( int *argc, char *argv[] )
624 int depth_count, i;
625 int *depth_list;
626 struct timeval tv;
628 extern int _WinMain(int argc, char **argv);
630 #ifdef MALLOC_DEBUGGING
631 char *trace;
633 mcheck(NULL);
634 if (!(trace = getenv("MALLOC_TRACE")))
636 fprintf( stderr, "MALLOC_TRACE not set. No trace generated\n" );
638 else
640 fprintf( stderr, "malloc trace goes to %s\n", trace );
641 mtrace();
643 #endif
645 setbuf(stdout,NULL);
646 setbuf(stderr,NULL);
648 setlocale(LC_CTYPE,"");
649 gettimeofday( &tv, NULL);
650 MSG_WineStartTicks = (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
652 XrmInitialize();
654 putenv("XKB_DISABLE="); /* Disable XKB extension if present. */
656 MAIN_ParseOptions( argc, argv );
658 if (Options.desktopGeometry && Options.managed)
660 fprintf( stderr, "%s: -managed and -desktop options cannot be used together\n",
661 Options.programName );
662 exit(1);
665 screen = DefaultScreenOfDisplay( display );
666 screenWidth = WidthOfScreen( screen );
667 screenHeight = HeightOfScreen( screen );
668 if (screenDepth) /* -depth option specified */
670 depth_list = XListDepths(display,DefaultScreen(display),&depth_count);
671 for (i = 0; i < depth_count; i++)
672 if (depth_list[i] == screenDepth) break;
673 XFree( depth_list );
674 if (i >= depth_count)
676 fprintf( stderr, "%s: Depth %d not supported on this screen.\n",
677 Options.programName, screenDepth );
678 exit(1);
681 else screenDepth = DefaultDepthOfScreen( screen );
682 if (Options.synchronous) XSynchronize( display, True );
683 if (Options.desktopGeometry) MAIN_CreateDesktop( *argc, argv );
684 else rootWindow = DefaultRootWindow( display );
686 MAIN_SaveSetup();
687 atexit(called_at_exit);
688 return TRUE;
692 /***********************************************************************
693 * MessageBeep16 (USER.104)
695 void MessageBeep16( UINT16 i )
697 MessageBeep32( i );
701 /***********************************************************************
702 * MessageBeep32 (USER32.389)
704 BOOL32 MessageBeep32( UINT32 i )
706 XBell( display, 100 );
707 return TRUE;
711 /***********************************************************************
712 * Beep (KERNEL32.11)
714 BOOL32 Beep( DWORD dwFreq, DWORD dwDur )
716 /* dwFreq and dwDur are ignored by Win95 */
717 XBell(display, 100);
718 return TRUE;
722 /***********************************************************************
723 * GetVersion16 (KERNEL.3)
725 LONG GetVersion16(void)
727 if (getVersion16) return getVersion16;
728 return MAKELONG( WINVERSION, WINDOSVER );
732 /***********************************************************************
733 * GetVersion32
735 LONG GetVersion32(void)
737 if (getVersion32) return getVersion32;
738 return MAKELONG( 4, DOSVERSION);
742 /***********************************************************************
743 * GetVersionExA
745 BOOL32 GetVersionEx32A(OSVERSIONINFO32A *v)
747 if(v->dwOSVersionInfoSize!=sizeof(OSVERSIONINFO32A))
749 fprintf(stddeb,"wrong OSVERSIONINFO size from app");
750 return FALSE;
752 if(!getVersion32)
754 /* Return something like NT 3.5 */
755 v->dwMajorVersion = 3;
756 v->dwMinorVersion = 5;
757 v->dwBuildNumber = 42;
758 v->dwPlatformId = VER_PLATFORM_WIN32_NT;
759 strcpy(v->szCSDVersion, "Wine is not an emulator");
760 return TRUE;
762 v->dwMajorVersion = getVersionEx.dwMajorVersion;
763 v->dwMinorVersion = getVersionEx.dwMinorVersion;
764 v->dwBuildNumber = getVersionEx.dwBuildNumber;
765 v->dwPlatformId = getVersionEx.dwPlatformId;
766 strcpy(v->szCSDVersion, getVersionEx.szCSDVersion);
767 return TRUE;
771 /***********************************************************************
772 * GetVersionExW
774 BOOL32 GetVersionEx32W(OSVERSIONINFO32W *v)
776 OSVERSIONINFO32A v1;
777 if(v->dwOSVersionInfoSize!=sizeof(OSVERSIONINFO32W))
779 fprintf(stddeb,"wrong OSVERSIONINFO size from app");
780 return FALSE;
782 v1.dwOSVersionInfoSize=sizeof(v1);
783 GetVersionEx32A(&v1);
784 v->dwMajorVersion = v1.dwMajorVersion;
785 v->dwMinorVersion = v1.dwMinorVersion;
786 v->dwBuildNumber = v1.dwBuildNumber;
787 v->dwPlatformId = v1.dwPlatformId;
788 lstrcpyAtoW( v->szCSDVersion, v1.szCSDVersion );
789 return TRUE;
792 /***********************************************************************
793 * GetWinFlags (KERNEL.132)
795 DWORD GetWinFlags(void)
797 static const long cpuflags[5] =
798 { WF_CPU086, WF_CPU186, WF_CPU286, WF_CPU386, WF_CPU486 };
799 SYSTEM_INFO si;
800 long result = 0,cpuflag;
802 GetSystemInfo(&si);
804 /* There doesn't seem to be any Pentium flag. */
805 cpuflag = cpuflags[MIN (si.wProcessorLevel, 4)];
807 switch(Options.mode) {
808 case MODE_STANDARD:
809 result = (WF_STANDARD | cpuflag | WF_PMODE | WF_80x87);
810 break;
812 case MODE_ENHANCED:
813 result = (WF_ENHANCED | cpuflag | WF_PMODE | WF_80x87 | WF_PAGING);
814 break;
816 default:
817 fprintf(stderr, "Unknown mode set? This shouldn't happen. Check GetWinFlags()!\n");
818 break;
820 if (si.wProcessorLevel>=4)
821 result |= WF_HASCPUID;
822 if( getVersionEx.dwPlatformId == VER_PLATFORM_WIN32_NT )
823 result |= WF_WIN32WOW; /* undocumented WF_WINNT */
824 return result;
827 /***********************************************************************
828 * SetEnvironment (GDI.132)
830 INT16 SetEnvironment( LPCSTR lpPortName, LPCSTR lpEnviron, UINT16 nCount )
832 LPENVENTRY lpNewEnv;
833 LPENVENTRY lpEnv = lpEnvList;
834 dprintf_env(stddeb, "SetEnvironment('%s', '%s', %d) !\n",
835 lpPortName, lpEnviron, nCount);
836 if (lpPortName == NULL) return -1;
837 while (lpEnv != NULL) {
838 if (lpEnv->Name != NULL && strcmp(lpEnv->Name, lpPortName) == 0) {
839 if (nCount == 0 || lpEnviron == NULL) {
840 if (lpEnv->Prev != NULL) lpEnv->Prev->Next = lpEnv->Next;
841 if (lpEnv->Next != NULL) lpEnv->Next->Prev = lpEnv->Prev;
842 free(lpEnv->Value);
843 free(lpEnv->Name);
844 free(lpEnv);
845 dprintf_env(stddeb, "SetEnvironment() // entry deleted !\n");
846 return -1;
848 free(lpEnv->Value);
849 lpEnv->Value = malloc(nCount);
850 if (lpEnv->Value == NULL) {
851 dprintf_env(stddeb, "SetEnvironment() // Error allocating entry value !\n");
852 return 0;
854 memcpy(lpEnv->Value, lpEnviron, nCount);
855 lpEnv->wSize = nCount;
856 dprintf_env(stddeb, "SetEnvironment() // entry modified !\n");
857 return nCount;
859 if (lpEnv->Next == NULL) break;
860 lpEnv = lpEnv->Next;
862 if (nCount == 0 || lpEnviron == NULL) return -1;
863 dprintf_env(stddeb, "SetEnvironment() // new entry !\n");
864 lpNewEnv = malloc(sizeof(ENVENTRY));
865 if (lpNewEnv == NULL) {
866 dprintf_env(stddeb, "SetEnvironment() // Error allocating new entry !\n");
867 return 0;
869 if (lpEnvList == NULL) {
870 lpEnvList = lpNewEnv;
871 lpNewEnv->Prev = NULL;
873 else
875 lpEnv->Next = lpNewEnv;
876 lpNewEnv->Prev = lpEnv;
878 lpNewEnv->Next = NULL;
879 lpNewEnv->Name = malloc(strlen(lpPortName) + 1);
880 if (lpNewEnv->Name == NULL) {
881 dprintf_env(stddeb, "SetEnvironment() // Error allocating entry name !\n");
882 return 0;
884 strcpy(lpNewEnv->Name, lpPortName);
885 lpNewEnv->Value = malloc(nCount);
886 if (lpNewEnv->Value == NULL) {
887 dprintf_env(stddeb, "SetEnvironment() // Error allocating entry value !\n");
888 return 0;
890 memcpy(lpNewEnv->Value, lpEnviron, nCount);
891 lpNewEnv->wSize = nCount;
892 return nCount;
896 /***********************************************************************
897 * GetEnvironment (GDI.134)
899 INT16 GetEnvironment( LPCSTR lpPortName, LPSTR lpEnviron, UINT16 nMaxSiz )
901 WORD nCount;
902 LPENVENTRY lpEnv = lpEnvList;
904 dprintf_env(stddeb, "GetEnvironment('%s', '%s', %d) !\n",
905 lpPortName, lpEnviron, nMaxSiz);
906 while (lpEnv != NULL) {
907 if (lpEnv->Name != NULL && strcmp(lpEnv->Name, lpPortName) == 0) {
908 if( lpEnviron == NULL ) return lpEnv->wSize;
909 nCount = MIN(nMaxSiz, lpEnv->wSize);
910 memcpy(lpEnviron, lpEnv->Value, nCount);
911 dprintf_env(stddeb, "GetEnvironment() // found '%s' !\n", lpEnv->Value);
912 return nCount;
914 lpEnv = lpEnv->Next;
916 dprintf_env(stddeb, "GetEnvironment() // not found !\n");
917 return 0;
921 /***********************************************************************
922 * GetTimerResolution (USER.14)
924 LONG GetTimerResolution(void)
926 return (1000);
929 /***********************************************************************
930 * SystemParametersInfo32A (USER32.539)
932 BOOL32 SystemParametersInfo32A( UINT32 uAction, UINT32 uParam,
933 LPVOID lpvParam, UINT32 fuWinIni )
935 int timeout, temp;
936 XKeyboardState keyboard_state;
938 switch (uAction) {
939 case SPI_GETBEEP:
940 XGetKeyboardControl(display, &keyboard_state);
941 if (keyboard_state.bell_percent == 0)
942 *(BOOL32 *) lpvParam = FALSE;
943 else
944 *(BOOL32 *) lpvParam = TRUE;
945 break;
947 case SPI_GETBORDER:
948 *(INT32 *)lpvParam = GetSystemMetrics32( SM_CXFRAME );
949 break;
951 case SPI_GETFASTTASKSWITCH:
952 if ( GetProfileInt32A( "windows", "CoolSwitch", 1 ) == 1 )
953 *(BOOL32 *) lpvParam = TRUE;
954 else
955 *(BOOL32 *) lpvParam = FALSE;
956 break;
958 case SPI_GETGRIDGRANULARITY:
959 *(INT32*)lpvParam=GetProfileInt32A("desktop","GridGranularity",1);
960 break;
962 case SPI_GETICONTITLEWRAP:
963 *(BOOL32*)lpvParam=GetProfileInt32A("desktop","IconTitleWrap",TRUE);
964 break;
966 case SPI_GETKEYBOARDDELAY:
967 *(INT32*)lpvParam=GetProfileInt32A("keyboard","KeyboardDelay",1);
968 break;
970 case SPI_GETKEYBOARDSPEED:
971 *(DWORD*)lpvParam=GetProfileInt32A("keyboard","KeyboardSpeed",30);
972 break;
974 case SPI_GETMENUDROPALIGNMENT:
975 *(BOOL32*)lpvParam=GetSystemMetrics32(SM_MENUDROPALIGNMENT); /* XXX check this */
976 break;
978 case SPI_GETSCREENSAVEACTIVE:
979 if ( GetProfileInt32A( "windows", "ScreenSaveActive", 1 ) == 1 )
980 *(BOOL32*)lpvParam = TRUE;
981 else
982 *(BOOL32*)lpvParam = FALSE;
983 break;
985 case SPI_GETSCREENSAVETIMEOUT:
986 /* FIXME GetProfileInt( "windows", "ScreenSaveTimeout", 300 ); */
987 XGetScreenSaver(display, &timeout, &temp,&temp,&temp);
988 *(INT32 *) lpvParam = timeout * 1000;
989 break;
991 case SPI_ICONHORIZONTALSPACING:
992 /* FIXME Get/SetProfileInt */
993 if (lpvParam == NULL)
994 /*SetSystemMetrics( SM_CXICONSPACING, uParam )*/ ;
995 else
996 *(INT32*)lpvParam=GetSystemMetrics32(SM_CXICONSPACING);
997 break;
999 case SPI_ICONVERTICALSPACING:
1000 /* FIXME Get/SetProfileInt */
1001 if (lpvParam == NULL)
1002 /*SetSystemMetrics( SM_CYICONSPACING, uParam )*/ ;
1003 else
1004 *(INT32*)lpvParam=GetSystemMetrics32(SM_CYICONSPACING);
1005 break;
1007 case SPI_GETICONTITLELOGFONT: {
1008 LPLOGFONT32A lpLogFont = (LPLOGFONT32A)lpvParam;
1010 GetProfileString32A("Desktop", "IconTitleFaceName", "Helvetica",
1011 lpLogFont->lfFaceName, LF_FACESIZE );
1012 lpLogFont->lfHeight = -GetProfileInt32A("Desktop","IconTitleSize", 8);
1014 lpLogFont->lfWidth = 0;
1015 lpLogFont->lfEscapement = lpLogFont->lfOrientation = 0;
1016 lpLogFont->lfWeight = FW_NORMAL;
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;
1024 break;
1026 case SPI_GETWORKAREA:
1027 SetRect32( (RECT32 *)lpvParam, 0, 0,
1028 GetSystemMetrics32( SM_CXSCREEN ),
1029 GetSystemMetrics32( SM_CYSCREEN )
1031 break;
1032 case SPI_GETNONCLIENTMETRICS: {
1033 /* FIXME: implement correctly */
1034 LPNONCLIENTMETRICS32A lpnm=(LPNONCLIENTMETRICS32A)lpvParam;
1036 SystemParametersInfo32A(SPI_GETICONTITLELOGFONT,0,(LPVOID)&(lpnm->lfCaptionFont),0);
1037 SystemParametersInfo32A(SPI_GETICONTITLELOGFONT,0,(LPVOID)&(lpnm->lfMenuFont),0);
1038 SystemParametersInfo32A(SPI_GETICONTITLELOGFONT,0,(LPVOID)&(lpnm->lfStatusFont),0);
1039 SystemParametersInfo32A(SPI_GETICONTITLELOGFONT,0,(LPVOID)&(lpnm->lfMessageFont),0);
1040 break;
1042 default:
1043 return SystemParametersInfo16(uAction,uParam,lpvParam,fuWinIni);
1045 return TRUE;
1049 /***********************************************************************
1050 * SystemParametersInfo16 (USER.483)
1052 BOOL16 SystemParametersInfo16( UINT16 uAction, UINT16 uParam,
1053 LPVOID lpvParam, UINT16 fuWinIni )
1055 int timeout, temp;
1056 char buffer[256];
1057 XKeyboardState keyboard_state;
1058 XKeyboardControl keyboard_value;
1061 switch (uAction)
1063 case SPI_GETBEEP:
1064 XGetKeyboardControl(display, &keyboard_state);
1065 if (keyboard_state.bell_percent == 0)
1066 *(BOOL16 *) lpvParam = FALSE;
1067 else
1068 *(BOOL16 *) lpvParam = TRUE;
1069 break;
1071 case SPI_GETBORDER:
1072 *(INT16 *)lpvParam = GetSystemMetrics16( SM_CXFRAME );
1073 break;
1075 case SPI_GETFASTTASKSWITCH:
1076 if ( GetProfileInt32A( "windows", "CoolSwitch", 1 ) == 1 )
1077 *(BOOL16 *) lpvParam = TRUE;
1078 else
1079 *(BOOL16 *) lpvParam = FALSE;
1080 break;
1082 case SPI_GETGRIDGRANULARITY:
1083 *(INT16 *) lpvParam = GetProfileInt32A( "desktop",
1084 "GridGranularity",
1085 1 );
1086 break;
1088 case SPI_GETICONTITLEWRAP:
1089 *(BOOL16 *) lpvParam = GetProfileInt32A( "desktop",
1090 "IconTitleWrap",
1091 TRUE );
1092 break;
1094 case SPI_GETKEYBOARDDELAY:
1095 *(INT16 *) lpvParam = GetProfileInt32A( "keyboard",
1096 "KeyboardDelay", 1 );
1097 break;
1099 case SPI_GETKEYBOARDSPEED:
1100 *(WORD *) lpvParam = GetProfileInt32A( "keyboard",
1101 "KeyboardSpeed",
1102 30 );
1103 break;
1105 case SPI_GETMENUDROPALIGNMENT:
1106 *(BOOL16 *) lpvParam = GetSystemMetrics16( SM_MENUDROPALIGNMENT ); /* XXX check this */
1107 break;
1109 case SPI_GETSCREENSAVEACTIVE:
1110 if ( GetProfileInt32A( "windows", "ScreenSaveActive", 1 ) == 1 )
1111 *(BOOL16 *) lpvParam = TRUE;
1112 else
1113 *(BOOL16 *) lpvParam = FALSE;
1114 break;
1116 case SPI_GETSCREENSAVETIMEOUT:
1117 /* FIXME GetProfileInt( "windows", "ScreenSaveTimeout", 300 ); */
1118 XGetScreenSaver(display, &timeout, &temp,&temp,&temp);
1119 *(INT16 *) lpvParam = timeout * 1000;
1120 break;
1122 case SPI_ICONHORIZONTALSPACING:
1123 /* FIXME Get/SetProfileInt */
1124 if (lpvParam == NULL)
1125 /*SetSystemMetrics( SM_CXICONSPACING, uParam )*/ ;
1126 else
1127 *(INT16 *)lpvParam = GetSystemMetrics16( SM_CXICONSPACING );
1128 break;
1130 case SPI_ICONVERTICALSPACING:
1131 /* FIXME Get/SetProfileInt */
1132 if (lpvParam == NULL)
1133 /*SetSystemMetrics( SM_CYICONSPACING, uParam )*/ ;
1134 else
1135 *(INT16 *)lpvParam = GetSystemMetrics16(SM_CYICONSPACING);
1136 break;
1138 case SPI_SETBEEP:
1139 if (uParam == TRUE)
1140 keyboard_value.bell_percent = -1;
1141 else
1142 keyboard_value.bell_percent = 0;
1143 XChangeKeyboardControl(display, KBBellPercent,
1144 &keyboard_value);
1145 break;
1147 case SPI_SETSCREENSAVEACTIVE:
1148 if (uParam == TRUE)
1149 XActivateScreenSaver(display);
1150 else
1151 XResetScreenSaver(display);
1152 break;
1154 case SPI_SETSCREENSAVETIMEOUT:
1155 XSetScreenSaver(display, uParam, 60, DefaultBlanking,
1156 DefaultExposures);
1157 break;
1159 case SPI_SETDESKWALLPAPER:
1160 return (SetDeskWallPaper32((LPSTR) lpvParam));
1161 break;
1163 case SPI_SETDESKPATTERN:
1164 if ((INT16)uParam == -1) {
1165 GetProfileString32A("Desktop", "Pattern",
1166 "170 85 170 85 170 85 170 85",
1167 buffer, sizeof(buffer) );
1168 return (DESKTOP_SetPattern((LPSTR) buffer));
1169 } else
1170 return (DESKTOP_SetPattern((LPSTR) lpvParam));
1171 break;
1173 case SPI_GETICONTITLELOGFONT:
1175 LPLOGFONT16 lpLogFont = (LPLOGFONT16)lpvParam;
1177 GetProfileString32A("Desktop", "IconTitleFaceName", "Helvetica",
1178 lpLogFont->lfFaceName, LF_FACESIZE );
1179 lpLogFont->lfHeight = -GetProfileInt32A("Desktop","IconTitleSize", 8);
1181 lpLogFont->lfWidth = 0;
1182 lpLogFont->lfEscapement = lpLogFont->lfOrientation = 0;
1183 lpLogFont->lfWeight = FW_NORMAL;
1184 lpLogFont->lfItalic = FALSE;
1185 lpLogFont->lfStrikeOut = FALSE;
1186 lpLogFont->lfUnderline = FALSE;
1187 lpLogFont->lfCharSet = ANSI_CHARSET;
1188 lpLogFont->lfOutPrecision = OUT_DEFAULT_PRECIS;
1189 lpLogFont->lfClipPrecision = CLIP_DEFAULT_PRECIS;
1190 lpLogFont->lfPitchAndFamily = DEFAULT_PITCH | FF_SWISS;
1191 break;
1193 case SPI_GETNONCLIENTMETRICS: {
1194 /* FIXME: implement correctly */
1195 LPNONCLIENTMETRICS16 lpnm=(LPNONCLIENTMETRICS16)lpvParam;
1197 SystemParametersInfo16(SPI_GETICONTITLELOGFONT,0,(LPVOID)&(lpnm->lfCaptionFont),0);
1198 SystemParametersInfo16(SPI_GETICONTITLELOGFONT,0,(LPVOID)&(lpnm->lfMenuFont),0);
1199 SystemParametersInfo16(SPI_GETICONTITLELOGFONT,0,(LPVOID)&(lpnm->lfStatusFont),0);
1200 SystemParametersInfo16(SPI_GETICONTITLELOGFONT,0,(LPVOID)&(lpnm->lfMessageFont),0);
1201 break;
1204 case SPI_LANGDRIVER:
1205 case SPI_SETBORDER:
1206 case SPI_SETDOUBLECLKHEIGHT:
1207 case SPI_SETDOUBLECLICKTIME:
1208 case SPI_SETDOUBLECLKWIDTH:
1209 case SPI_SETFASTTASKSWITCH:
1210 case SPI_SETKEYBOARDDELAY:
1211 case SPI_SETKEYBOARDSPEED:
1212 fprintf(stderr, "SystemParametersInfo: option %d ignored.\n", uAction);
1213 break;
1215 case SPI_GETWORKAREA:
1216 SetRect16( (RECT16 *)lpvParam, 0, 0,
1217 GetSystemMetrics16( SM_CXSCREEN ),
1218 GetSystemMetrics16( SM_CYSCREEN ) );
1219 break;
1221 default:
1222 fprintf(stderr, "SystemParametersInfo: unknown option %d.\n", uAction);
1223 break;
1225 return 1;
1228 /***********************************************************************
1229 * SystemParametersInfo32W (USER32.540)
1231 BOOL32 SystemParametersInfo32W( UINT32 uAction, UINT32 uParam,
1232 LPVOID lpvParam, UINT32 fuWinIni )
1234 char buffer[256];
1236 switch (uAction)
1238 case SPI_SETDESKWALLPAPER:
1239 if (lpvParam)
1241 lstrcpynWtoA(buffer,(LPWSTR)lpvParam,sizeof(buffer));
1242 return SetDeskWallPaper32(buffer);
1244 return SetDeskWallPaper32(NULL);
1246 case SPI_SETDESKPATTERN:
1247 if ((INT32) uParam == -1)
1249 GetProfileString32A("Desktop", "Pattern",
1250 "170 85 170 85 170 85 170 85",
1251 buffer, sizeof(buffer) );
1252 return (DESKTOP_SetPattern((LPSTR) buffer));
1254 if (lpvParam)
1256 lstrcpynWtoA(buffer,(LPWSTR)lpvParam,sizeof(buffer));
1257 return DESKTOP_SetPattern(buffer);
1259 return DESKTOP_SetPattern(NULL);
1261 case SPI_GETICONTITLELOGFONT:
1263 /* FIXME GetProfileString32A( "?", "?", "?" ) */
1264 LPLOGFONT32W lpLogFont = (LPLOGFONT32W)lpvParam;
1265 lpLogFont->lfHeight = 10;
1266 lpLogFont->lfWidth = 0;
1267 lpLogFont->lfEscapement = lpLogFont->lfOrientation = 0;
1268 lpLogFont->lfWeight = FW_NORMAL;
1269 lpLogFont->lfItalic = lpLogFont->lfStrikeOut = lpLogFont->lfUnderline = FALSE;
1270 lpLogFont->lfCharSet = ANSI_CHARSET;
1271 lpLogFont->lfOutPrecision = OUT_DEFAULT_PRECIS;
1272 lpLogFont->lfClipPrecision = CLIP_DEFAULT_PRECIS;
1273 lpLogFont->lfPitchAndFamily = DEFAULT_PITCH | FF_SWISS;
1275 break;
1276 case SPI_GETNONCLIENTMETRICS: {
1277 /* FIXME: implement correctly */
1278 LPNONCLIENTMETRICS32W lpnm=(LPNONCLIENTMETRICS32W)lpvParam;
1280 SystemParametersInfo32W(SPI_GETICONTITLELOGFONT,0,(LPVOID)&(lpnm->lfCaptionFont),0);
1281 SystemParametersInfo32W(SPI_GETICONTITLELOGFONT,0,(LPVOID)&(lpnm->lfMenuFont),0);
1282 SystemParametersInfo32W(SPI_GETICONTITLELOGFONT,0,(LPVOID)&(lpnm->lfStatusFont),0);
1283 SystemParametersInfo32W(SPI_GETICONTITLELOGFONT,0,(LPVOID)&(lpnm->lfMessageFont),0);
1284 break;
1287 default:
1288 return SystemParametersInfo32A(uAction,uParam,lpvParam,fuWinIni);
1291 return TRUE;
1295 /***********************************************************************
1296 * FileCDR (KERNEL.130)
1298 void FileCDR(FARPROC16 x)
1300 printf("FileCDR(%8x)\n", (int) x);
1303 /***********************************************************************
1304 * GetWinDebugInfo (KERNEL.355)
1306 BOOL16 GetWinDebugInfo(WINDEBUGINFO *lpwdi, UINT16 flags)
1308 printf("GetWinDebugInfo(%8lx,%d) stub returning 0\n", (unsigned long)lpwdi, flags);
1309 /* 0 means not in debugging mode/version */
1310 /* Can this type of debugging be used in wine ? */
1311 /* Constants: WDI_OPTIONS WDI_FILTER WDI_ALLOCBREAK */
1312 return 0;
1315 /***********************************************************************
1316 * GetWinDebugInfo (KERNEL.355)
1318 BOOL16 SetWinDebugInfo(WINDEBUGINFO *lpwdi)
1320 printf("SetWinDebugInfo(%8lx) stub returning 0\n", (unsigned long)lpwdi);
1321 /* 0 means not in debugging mode/version */
1322 /* Can this type of debugging be used in wine ? */
1323 /* Constants: WDI_OPTIONS WDI_FILTER WDI_ALLOCBREAK */
1324 return 0;