2 * System parameters functions
4 * Copyright 1994 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
33 #include "wine/winuser16.h"
37 #include "user_private.h"
38 #include "wine/unicode.h"
39 #include "wine/debug.h"
41 WINE_DEFAULT_DEBUG_CHANNEL(system);
43 /* System parameter indexes */
44 #define SPI_SETBEEP_IDX 0
45 #define SPI_SETMOUSE_IDX 1
46 #define SPI_SETBORDER_IDX 2
47 #define SPI_SETKEYBOARDSPEED_IDX 3
48 #define SPI_ICONHORIZONTALSPACING_IDX 4
49 #define SPI_SETSCREENSAVETIMEOUT_IDX 5
50 #define SPI_SETGRIDGRANULARITY_IDX 6
51 #define SPI_SETKEYBOARDDELAY_IDX 7
52 #define SPI_ICONVERTICALSPACING_IDX 8
53 #define SPI_SETICONTITLEWRAP_IDX 9
54 #define SPI_SETMENUDROPALIGNMENT_IDX 10
55 #define SPI_SETDOUBLECLKWIDTH_IDX 11
56 #define SPI_SETDOUBLECLKHEIGHT_IDX 12
57 #define SPI_SETDOUBLECLICKTIME_IDX 13
58 #define SPI_SETMOUSEBUTTONSWAP_IDX 14
59 #define SPI_SETDRAGFULLWINDOWS_IDX 15
60 #define SPI_SETWORKAREA_IDX 16
61 #define SPI_SETSHOWSOUNDS_IDX 17
62 #define SPI_SETKEYBOARDPREF_IDX 18
63 #define SPI_SETSCREENREADER_IDX 19
64 #define SPI_SETSCREENSAVERRUNNING_IDX 20
65 #define SPI_SETFONTSMOOTHING_IDX 21
66 #define SPI_SETKEYBOARDCUES_IDX 22
67 #define SPI_SETGRADIENTCAPTIONS_IDX 23
68 #define SPI_SETHOTTRACKING_IDX 24
69 #define SPI_SETLISTBOXSMOOTHSCROLLING_IDX 25
70 #define SPI_SETMOUSEHOVERWIDTH_IDX 26
71 #define SPI_SETMOUSEHOVERHEIGHT_IDX 27
72 #define SPI_SETMOUSEHOVERTIME_IDX 28
73 #define SPI_SETMOUSESCROLLLINES_IDX 29
74 #define SPI_SETMENUSHOWDELAY_IDX 30
76 #define SPI_WINE_IDX SPI_SETMENUSHOWDELAY_IDX
79 * Names of the registry subkeys of HKEY_CURRENT_USER key and value names
80 * for the system parameters.
81 * Names of the keys are created by adding string "_REGKEY" to
82 * "SET" action names, value names are created by adding "_REG_NAME"
83 * to the "SET" action name.
85 static const WCHAR SPI_SETBEEP_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','S','o','u','n','d',0};
86 static const WCHAR SPI_SETBEEP_VALNAME[]= {'B','e','e','p',0};
87 static const WCHAR SPI_SETMOUSE_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
88 static const WCHAR SPI_SETMOUSE_VALNAME1[]= {'M','o','u','s','e','T','h','r','e','s','h','o','l','d','1',0};
89 static const WCHAR SPI_SETMOUSE_VALNAME2[]= {'M','o','u','s','e','T','h','r','e','s','h','o','l','d','2',0};
90 static const WCHAR SPI_SETMOUSE_VALNAME3[]= {'M','o','u','s','e','S','p','e','e','d',0};
91 static const WCHAR SPI_SETBORDER_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
92 static const WCHAR SPI_SETBORDER_VALNAME[]= {'B','o','r','d','e','r','W','i','d','t','h',0};
93 static const WCHAR SPI_SETKEYBOARDSPEED_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','K','e','y','b','o','a','r','d',0};
94 static const WCHAR SPI_SETKEYBOARDSPEED_VALNAME[]= {'K','e','y','b','o','a','r','d','S','p','e','e','d',0};
95 static const WCHAR SPI_ICONHORIZONTALSPACING_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p','\\',
96 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
97 static const WCHAR SPI_ICONHORIZONTALSPACING_VALNAME[]= {'I','c','o','n','S','p','a','c','i','n','g',0};
98 static const WCHAR SPI_SETSCREENSAVETIMEOUT_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
99 static const WCHAR SPI_SETSCREENSAVETIMEOUT_VALNAME[]= {'S','c','r','e','e','n','S','a','v','e','T','i','m','e','O','u','t',0};
100 static const WCHAR SPI_SETSCREENSAVEACTIVE_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
101 static const WCHAR SPI_SETSCREENSAVEACTIVE_VALNAME[]= {'S','c','r','e','e','n','S','a','v','e','A','c','t','i','v','e',0};
102 static const WCHAR SPI_SETGRIDGRANULARITY_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
103 static const WCHAR SPI_SETGRIDGRANULARITY_VALNAME[]= {'G','r','i','d','G','r','a','n','u','l','a','r','i','t','y',0};
104 static const WCHAR SPI_SETKEYBOARDDELAY_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','K','e','y','b','o','a','r','d',0};
105 static const WCHAR SPI_SETKEYBOARDDELAY_VALNAME[]= {'K','e','y','b','o','a','r','d','D','e','l','a','y',0};
106 static const WCHAR SPI_ICONVERTICALSPACING_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p','\\',
107 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
108 static const WCHAR SPI_ICONVERTICALSPACING_VALNAME[]= {'I','c','o','n','V','e','r','t','i','c','a','l','S','p','a','c','i','n','g',0};
109 static const WCHAR SPI_SETICONTITLEWRAP_REGKEY1[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p','\\',
110 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
111 static const WCHAR SPI_SETICONTITLEWRAP_REGKEY2[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
112 static const WCHAR SPI_SETICONTITLEWRAP_VALNAME[]= {'I','c','o','n','T','i','t','l','e','W','r','a','p',0};
113 static const WCHAR SPI_SETMENUDROPALIGNMENT_REGKEY1[]= {'S','o','f','t','w','a','r','e','\\',
114 'M','i','c','r','o','s','o','f','t','\\',
115 'W','i','n','d','o','w','s',' ','N','T','\\',
116 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
117 'W','i','n','d','o','w','s',0};
118 static const WCHAR SPI_SETMENUDROPALIGNMENT_REGKEY2[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
119 static const WCHAR SPI_SETMENUDROPALIGNMENT_VALNAME[]= {'M','e','n','u','D','r','o','p','A','l','i','g','n','m','e','n','t',0};
120 static const WCHAR SPI_SETDOUBLECLKWIDTH_REGKEY1[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
121 static const WCHAR SPI_SETDOUBLECLKWIDTH_REGKEY2[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
122 static const WCHAR SPI_SETDOUBLECLKWIDTH_VALNAME[]= {'D','o','u','b','l','e','C','l','i','c','k','W','i','d','t','h',0};
123 static const WCHAR SPI_SETDOUBLECLKHEIGHT_REGKEY1[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
124 static const WCHAR SPI_SETDOUBLECLKHEIGHT_REGKEY2[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
125 static const WCHAR SPI_SETDOUBLECLKHEIGHT_VALNAME[]= {'D','o','u','b','l','e','C','l','i','c','k','H','e','i','g','h','t',0};
126 static const WCHAR SPI_SETDOUBLECLICKTIME_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
127 static const WCHAR SPI_SETDOUBLECLICKTIME_VALNAME[]= {'D','o','u','b','l','e','C','l','i','c','k','S','p','e','e','d',0};
128 static const WCHAR SPI_SETMOUSEBUTTONSWAP_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
129 static const WCHAR SPI_SETMOUSEBUTTONSWAP_VALNAME[]= {'S','w','a','p','M','o','u','s','e','B','u','t','t','o','n','s',0};
130 static const WCHAR SPI_SETDRAGFULLWINDOWS_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
131 static const WCHAR SPI_SETDRAGFULLWINDOWS_VALNAME[]= {'D','r','a','g','F','u','l','l','W','i','n','d','o','w','s',0};
132 static const WCHAR SPI_SETWORKAREA_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
133 static const WCHAR SPI_SETWORKAREA_VALNAME[]= {'W','I','N','E','_','W','o','r','k','A','r','e','a',0};
134 static const WCHAR SPI_SETSHOWSOUNDS_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\',
135 'A','c','c','e','s','s','i','b','i','l','i','t','y','\\',
136 'S','h','o','w','S','o','u','n','d','s',0};
137 static const WCHAR SPI_SETSHOWSOUNDS_VALNAME[]= {'O','n',0};
138 static const WCHAR SPI_SETDESKWALLPAPER_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
139 static const WCHAR SPI_SETDESKWALLPAPER_VALNAME[]= {'W','a','l','l','p','a','p','e','r',0};
140 static const WCHAR SPI_SETFONTSMOOTHING_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
141 static const WCHAR SPI_SETFONTSMOOTHING_VALNAME[]= {'F','o','n','t','S','m','o','o','t','h','i','n','g',0};
142 static const WCHAR SPI_GETLOPOWERACTIVE_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
143 static const WCHAR SPI_GETLOPOWERACTIVE_VALNAME[]= {'L','o','w','P','o','w','e','r','A','c','t','i','v','e',0};
144 static const WCHAR SPI_USERPREFERENCEMASK_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
145 static const WCHAR SPI_USERPREFERENCEMASK_VALNAME[]= {'U','s','e','r','P','r','e','f','e','r','e','n','c','e','m','a','s','k',0};
146 static const WCHAR SPI_SETLISTBOXSMOOTHSCROLLING_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
147 static const WCHAR SPI_SETLISTBOXSMOOTHSCROLLING_VALNAME[]= {'S','m','o','o','t','h','S','c','r','o','l','l',0};
148 static const WCHAR SPI_SETMOUSEHOVERWIDTH_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
149 static const WCHAR SPI_SETMOUSEHOVERWIDTH_VALNAME[]= {'M','o','u','s','e','H','o','v','e','r','W','i','d','t','h',0};
150 static const WCHAR SPI_SETMOUSEHOVERHEIGHT_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
151 static const WCHAR SPI_SETMOUSEHOVERHEIGHT_VALNAME[]= {'M','o','u','s','e','H','o','v','e','r','H','e','i','g','h','t',0};
152 static const WCHAR SPI_SETMOUSEHOVERTIME_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
153 static const WCHAR SPI_SETMOUSEHOVERTIME_VALNAME[]= {'M','o','u','s','e','H','o','v','e','r','T','i','m','e',0};
154 static const WCHAR SPI_SETMOUSESCROLLLINES_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
155 static const WCHAR SPI_SETMOUSESCROLLLINES_VALNAME[]= {'W','h','e','e','l','S','c','r','o','l','l','L','i','n','e','s',0};
156 static const WCHAR SPI_SETMENUSHOWDELAY_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
157 static const WCHAR SPI_SETMENUSHOWDELAY_VALNAME[]= {'M','e','n','u','S','h','o','w','D','e','l','a','y',0};
159 /* FIXME - real values */
160 static const WCHAR SPI_SETKEYBOARDPREF_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
161 static const WCHAR SPI_SETKEYBOARDPREF_VALNAME[]= {'W','I','N','E','_','K','e','y','b','o','a','r','d','P','r','e','f',0};
162 static const WCHAR SPI_SETSCREENREADER_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
163 static const WCHAR SPI_SETSCREENREADER_VALNAME[]= {'W','I','N','E','_','S','c','r','e','e','n','R','e','a','d','e','r',0};
164 static const WCHAR SPI_SETSCREENSAVERRUNNING_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
165 static const WCHAR SPI_SETSCREENSAVERRUNNING_VALNAME[]= {'W','I','N','E','_','S','c','r','e','e','n','S','a','v','e','r','R','u','n','n','i','n','g',0};
167 static const WCHAR METRICS_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p','\\',
168 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
169 static const WCHAR METRICS_SCROLLWIDTH_VALNAME[]= {'S','c','r','o','l','l','W','i','d','t','h',0};
170 static const WCHAR METRICS_SCROLLHEIGHT_VALNAME[]= {'S','c','r','o','l','l','H','e','i','g','h','t',0};
171 static const WCHAR METRICS_CAPTIONWIDTH_VALNAME[]= {'C','a','p','t','i','o','n','W','i','d','t','h',0};
172 static const WCHAR METRICS_CAPTIONHEIGHT_VALNAME[]= {'C','a','p','t','i','o','n','H','e','i','g','h','t',0};
173 static const WCHAR METRICS_SMCAPTIONWIDTH_VALNAME[]= {'S','m','C','a','p','t','i','o','n','W','i','d','t','h',0};
174 static const WCHAR METRICS_SMCAPTIONHEIGHT_VALNAME[]= {'S','m','C','a','p','t','i','o','n','H','e','i','g','h','t',0};
175 static const WCHAR METRICS_MENUWIDTH_VALNAME[]= {'M','e','n','u','W','i','d','t','h',0};
176 static const WCHAR METRICS_MENUHEIGHT_VALNAME[]= {'M','e','n','u','H','e','i','g','h','t',0};
177 static const WCHAR METRICS_ICONSIZE_VALNAME[]= {'S','h','e','l','l',' ','I','c','o','n',' ','S','i','z','e',0};
178 static const WCHAR METRICS_BORDERWIDTH_VALNAME[]= {'B','o','r','d','e','r','W','i','d','t','h',0};
180 /* volatile registry branch under CURRENT_USER_REGKEY for temporary values storage */
181 static const WCHAR WINE_CURRENT_USER_REGKEY[] = {'W','i','n','e',0};
184 static const WCHAR Yes[]= {'Y','e','s',0};
185 static const WCHAR No[]= {'N','o',0};
186 static const WCHAR Desktop[]= {'D','e','s','k','t','o','p',0};
187 static const WCHAR Pattern[]= {'P','a','t','t','e','r','n',0};
188 static const WCHAR MenuFont[]= {'M','e','n','u','F','o','n','t',0};
189 static const WCHAR MenuFontSize[]= {'M','e','n','u','F','o','n','t','S','i','z','e',0};
190 static const WCHAR StatusFont[]= {'S','t','a','t','u','s','F','o','n','t',0};
191 static const WCHAR StatusFontSize[]= {'S','t','a','t','u','s','F','o','n','t','S','i','z','e',0};
192 static const WCHAR MessageFont[]= {'M','e','s','s','a','g','e','F','o','n','t',0};
193 static const WCHAR MessageFontSize[]= {'M','e','s','s','a','g','e','F','o','n','t','S','i','z','e',0};
194 static const WCHAR System[]= {'S','y','s','t','e','m',0};
195 static const WCHAR IconTitleSize[]= {'I','c','o','n','T','i','t','l','e','S','i','z','e',0};
196 static const WCHAR IconTitleFaceName[]= {'I','c','o','n','T','i','t','l','e','F','a','c','e','N','a','m','e',0};
197 static const WCHAR defPattern[]= {'1','7','0',' ','8','5',' ','1','7','0',' ','8','5',' ','1','7','0',' ','8','5',
198 ' ','1','7','0',' ','8','5',0};
199 static const WCHAR CSu[]= {'%','u',0};
200 static const WCHAR CSd[]= {'%','d',0};
201 static const WCHAR DISPLAY[]= {'D','I','S','P','L','A','Y',0};
203 /* Indicators whether system parameter value is loaded */
204 static char spi_loaded[SPI_WINE_IDX + 1];
206 static BOOL notify_change = TRUE;
208 /* System parameters storage */
209 static int sysMetrics[SM_CMETRICS+1];
210 static HDC display_dc;
211 static BOOL beep_active = TRUE;
212 static int mouse_threshold1 = 6;
213 static int mouse_threshold2 = 10;
214 static int mouse_speed = 1;
215 static int border = 1;
216 static int keyboard_speed = 31;
217 static int screensave_timeout = 300;
218 static int grid_granularity = 0;
219 static int keyboard_delay = 1;
220 static BOOL icon_title_wrap = TRUE;
221 static int double_click_time = 500;
222 static BOOL drag_full_windows = FALSE;
223 static RECT work_area;
224 static BOOL keyboard_pref = TRUE;
225 static BOOL screen_reader = FALSE;
226 static int mouse_hover_width = 4;
227 static int mouse_hover_height = 4;
228 static int mouse_hover_time = 400;
229 static int mouse_scroll_lines = 3;
230 static int menu_show_delay = 400;
231 static BOOL screensaver_running = FALSE;
232 static BOOL font_smoothing = FALSE;
233 static BOOL lowpoweractive = FALSE;
234 static BOOL keyboard_cues = FALSE;
235 static BOOL gradient_captions = FALSE;
236 static BOOL listbox_smoothscrolling = FALSE;
237 static BOOL hot_tracking = FALSE;
239 /***********************************************************************
240 * GetTimerResolution (USER.14)
242 LONG WINAPI GetTimerResolution16(void)
247 /***********************************************************************
248 * ControlPanelInfo (USER.273)
250 void WINAPI ControlPanelInfo16( INT16 nInfoType, WORD wData, LPSTR lpBuffer )
252 FIXME("(%d, %04x, %p): stub.\n", nInfoType, wData, lpBuffer);
255 /* This function is a copy of the one in objects/font.c */
256 static void SYSPARAMS_LogFont32ATo16( const LOGFONTA* font32, LPLOGFONT16 font16 )
258 font16->lfHeight = font32->lfHeight;
259 font16->lfWidth = font32->lfWidth;
260 font16->lfEscapement = font32->lfEscapement;
261 font16->lfOrientation = font32->lfOrientation;
262 font16->lfWeight = font32->lfWeight;
263 font16->lfItalic = font32->lfItalic;
264 font16->lfUnderline = font32->lfUnderline;
265 font16->lfStrikeOut = font32->lfStrikeOut;
266 font16->lfCharSet = font32->lfCharSet;
267 font16->lfOutPrecision = font32->lfOutPrecision;
268 font16->lfClipPrecision = font32->lfClipPrecision;
269 font16->lfQuality = font32->lfQuality;
270 font16->lfPitchAndFamily = font32->lfPitchAndFamily;
271 lstrcpynA( font16->lfFaceName, font32->lfFaceName, LF_FACESIZE );
274 static void SYSPARAMS_LogFont32WTo32A( const LOGFONTW* font32W, LPLOGFONTA font32A )
276 font32A->lfHeight = font32W->lfHeight;
277 font32A->lfWidth = font32W->lfWidth;
278 font32A->lfEscapement = font32W->lfEscapement;
279 font32A->lfOrientation = font32W->lfOrientation;
280 font32A->lfWeight = font32W->lfWeight;
281 font32A->lfItalic = font32W->lfItalic;
282 font32A->lfUnderline = font32W->lfUnderline;
283 font32A->lfStrikeOut = font32W->lfStrikeOut;
284 font32A->lfCharSet = font32W->lfCharSet;
285 font32A->lfOutPrecision = font32W->lfOutPrecision;
286 font32A->lfClipPrecision = font32W->lfClipPrecision;
287 font32A->lfQuality = font32W->lfQuality;
288 font32A->lfPitchAndFamily = font32W->lfPitchAndFamily;
289 WideCharToMultiByte( CP_ACP, 0, font32W->lfFaceName, -1, font32A->lfFaceName, LF_FACESIZE, NULL, NULL );
290 font32A->lfFaceName[LF_FACESIZE-1] = 0;
293 static void SYSPARAMS_NonClientMetrics32ATo16( const NONCLIENTMETRICSA* lpnm32, LPNONCLIENTMETRICS16 lpnm16 )
295 lpnm16->iBorderWidth = lpnm32->iBorderWidth;
296 lpnm16->iScrollWidth = lpnm32->iScrollWidth;
297 lpnm16->iScrollHeight = lpnm32->iScrollHeight;
298 lpnm16->iCaptionWidth = lpnm32->iCaptionWidth;
299 lpnm16->iCaptionHeight = lpnm32->iCaptionHeight;
300 SYSPARAMS_LogFont32ATo16( &lpnm32->lfCaptionFont, &lpnm16->lfCaptionFont );
301 lpnm16->iSmCaptionWidth = lpnm32->iSmCaptionWidth;
302 lpnm16->iSmCaptionHeight = lpnm32->iSmCaptionHeight;
303 SYSPARAMS_LogFont32ATo16( &lpnm32->lfSmCaptionFont, &lpnm16->lfSmCaptionFont );
304 lpnm16->iMenuWidth = lpnm32->iMenuWidth;
305 lpnm16->iMenuHeight = lpnm32->iMenuHeight;
306 SYSPARAMS_LogFont32ATo16( &lpnm32->lfMenuFont, &lpnm16->lfMenuFont );
307 SYSPARAMS_LogFont32ATo16( &lpnm32->lfStatusFont, &lpnm16->lfStatusFont );
308 SYSPARAMS_LogFont32ATo16( &lpnm32->lfMessageFont, &lpnm16->lfMessageFont );
311 static void SYSPARAMS_NonClientMetrics32WTo32A( const NONCLIENTMETRICSW* lpnm32W, LPNONCLIENTMETRICSA lpnm32A )
313 lpnm32A->iBorderWidth = lpnm32W->iBorderWidth;
314 lpnm32A->iScrollWidth = lpnm32W->iScrollWidth;
315 lpnm32A->iScrollHeight = lpnm32W->iScrollHeight;
316 lpnm32A->iCaptionWidth = lpnm32W->iCaptionWidth;
317 lpnm32A->iCaptionHeight = lpnm32W->iCaptionHeight;
318 SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfCaptionFont, &lpnm32A->lfCaptionFont );
319 lpnm32A->iSmCaptionWidth = lpnm32W->iSmCaptionWidth;
320 lpnm32A->iSmCaptionHeight = lpnm32W->iSmCaptionHeight;
321 SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfSmCaptionFont, &lpnm32A->lfSmCaptionFont );
322 lpnm32A->iMenuWidth = lpnm32W->iMenuWidth;
323 lpnm32A->iMenuHeight = lpnm32W->iMenuHeight;
324 SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfMenuFont, &lpnm32A->lfMenuFont );
325 SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfStatusFont, &lpnm32A->lfStatusFont );
326 SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfMessageFont, &lpnm32A->lfMessageFont );
329 /***********************************************************************
332 * Sets the system parameter which should be always loaded to
333 * current value stored in registry.
334 * Invalidates lazy loaded parameter, so it will be loaded the next time
338 * uiAction - system parameter to reload value for.
339 * Note, only "SET" values can be used for this parameter.
340 * If uiAction is 0 all system parameters are reset.
342 void SYSPARAMS_Reset( UINT uiAction )
344 #define WINE_RELOAD_SPI(x) \
346 spi_loaded[x##_IDX] = FALSE; \
347 SystemParametersInfoA( x, 0, dummy_buf, 0 );\
351 #define WINE_IGNORE_SPI(x) \
356 #define WINE_INVALIDATE_SPI(x) \
358 spi_loaded[x##_IDX] = FALSE; \
361 BOOL not_all_processed = TRUE;
364 /* Execution falls through all the branches for uiAction == 0 */
368 memset( spi_loaded, 0, sizeof(spi_loaded) );
370 WINE_RELOAD_SPI(SPI_SETBORDER);
371 WINE_RELOAD_SPI(SPI_ICONHORIZONTALSPACING);
372 WINE_RELOAD_SPI(SPI_ICONVERTICALSPACING);
373 WINE_IGNORE_SPI(SPI_SETSCREENSAVEACTIVE);
374 WINE_RELOAD_SPI(SPI_SETDOUBLECLKWIDTH);
375 WINE_RELOAD_SPI(SPI_SETDOUBLECLKHEIGHT);
376 WINE_RELOAD_SPI(SPI_SETMOUSEBUTTONSWAP);
377 WINE_RELOAD_SPI(SPI_SETSHOWSOUNDS);
378 WINE_RELOAD_SPI(SPI_SETMENUDROPALIGNMENT);
383 /* lazy loaded parameters */
386 WINE_INVALIDATE_SPI(SPI_SETBEEP);
387 WINE_INVALIDATE_SPI(SPI_SETMOUSE);
388 WINE_INVALIDATE_SPI(SPI_SETKEYBOARDSPEED);
389 WINE_INVALIDATE_SPI(SPI_SETSCREENSAVETIMEOUT);
390 WINE_INVALIDATE_SPI(SPI_SETGRIDGRANULARITY);
391 WINE_INVALIDATE_SPI(SPI_SETKEYBOARDDELAY);
392 WINE_INVALIDATE_SPI(SPI_SETICONTITLEWRAP);
393 WINE_INVALIDATE_SPI(SPI_SETDOUBLECLICKTIME);
394 WINE_INVALIDATE_SPI(SPI_SETDRAGFULLWINDOWS);
395 WINE_INVALIDATE_SPI(SPI_SETWORKAREA);
396 WINE_INVALIDATE_SPI(SPI_SETKEYBOARDPREF);
397 WINE_INVALIDATE_SPI(SPI_SETSCREENREADER);
398 WINE_INVALIDATE_SPI(SPI_SETSCREENSAVERRUNNING);
400 FIXME( "Unknown action reset: %u\n", uiAction );
405 not_all_processed = FALSE;
409 if (!uiAction && not_all_processed)
410 ERR( "Incorrect implementation of SYSPARAMS_Reset. "
411 "Not all params are reloaded.\n" );
412 #undef WINE_INVALIDATE_SPI
413 #undef WINE_IGNORE_SPI
414 #undef WINE_RELOAD_SPI
417 /***********************************************************************
418 * get_volatile_regkey
420 * Return a handle to the volatile registry key used to store
421 * non-permanently modified parameters.
423 static HKEY get_volatile_regkey(void)
425 static HKEY volatile_key;
429 if (RegCreateKeyExW( HKEY_CURRENT_USER, WINE_CURRENT_USER_REGKEY,
430 0, 0, REG_OPTION_VOLATILE, KEY_ALL_ACCESS, 0,
431 &volatile_key, 0 ) != ERROR_SUCCESS)
432 ERR("Can't create wine configuration registry branch\n");
437 /***********************************************************************
438 * SYSPARAMS_NotifyChange
440 * Sends notification about system parameter update.
442 void SYSPARAMS_NotifyChange( UINT uiAction, UINT fWinIni )
444 static const WCHAR emptyW[1];
448 if (fWinIni & SPIF_UPDATEINIFILE)
450 if (fWinIni & (SPIF_SENDWININICHANGE | SPIF_SENDCHANGE))
451 SendMessageTimeoutW(HWND_BROADCAST, WM_SETTINGCHANGE,
452 uiAction, (LPARAM) emptyW,
453 SMTO_ABORTIFHUNG, 2000, NULL );
457 /* FIXME notify other wine processes with internal message */
463 /***********************************************************************
464 * Loads system parameter from user profile.
466 static BOOL SYSPARAMS_Load( LPCWSTR lpRegKey, LPCWSTR lpValName, LPWSTR lpBuf, DWORD count )
472 if ((RegOpenKeyW( get_volatile_regkey(), lpRegKey, &hKey ) == ERROR_SUCCESS) ||
473 (RegOpenKeyW( HKEY_CURRENT_USER, lpRegKey, &hKey ) == ERROR_SUCCESS))
475 ret = !RegQueryValueExW( hKey, lpValName, NULL, &type, (LPBYTE)lpBuf, &count);
481 /***********************************************************************
482 * Saves system parameter to user profile.
484 static BOOL SYSPARAMS_Save( LPCWSTR lpRegKey, LPCWSTR lpValName, LPCWSTR lpValue,
492 if (fWinIni & SPIF_UPDATEINIFILE)
494 hBaseKey = HKEY_CURRENT_USER;
499 hBaseKey = get_volatile_regkey();
500 dwOptions = REG_OPTION_VOLATILE;
503 if (RegCreateKeyExW( hBaseKey, lpRegKey,
504 0, 0, dwOptions, KEY_ALL_ACCESS,
505 0, &hKey, 0 ) == ERROR_SUCCESS)
507 if (RegSetValueExW( hKey, lpValName, 0, REG_SZ,
508 (const BYTE*)lpValue,
509 (strlenW(lpValue) + 1)*sizeof(WCHAR)) == ERROR_SUCCESS)
512 if (hBaseKey == HKEY_CURRENT_USER)
513 RegDeleteKeyW( get_volatile_regkey(), lpRegKey );
521 /***********************************************************************
522 * SYSPARAMS_Twips2Pixels
524 * Convert a dimension value that was obtained from the registry. These are
525 * quoted as being "twips" values if negative and pixels if positive.
527 * MSDN Library - April 2001 -> Resource Kits ->
528 * Windows 2000 Resource Kit Reference ->
529 * Technical Reference to the Windows 2000 Registry ->
530 * HKEY_CURRENT_USER -> Control Panel -> Desktop -> WindowMetrics
532 inline static int SYSPARAMS_Twips2Pixels(int x)
539 /***********************************************************************
540 * SYSPARAMS_GetRegistryMetric
542 * Get a registry entry from the already open key. This allows us to open the
543 * section once and read several values.
545 * Of course this function belongs somewhere more usable but here will do
548 static int SYSPARAMS_GetRegistryMetric( HKEY hkey, LPCWSTR lpValName, int default_value )
550 int value = default_value;
554 DWORD type, count = sizeof(buffer);
555 if(!RegQueryValueExW( hkey, lpValName, NULL, &type, (LPBYTE)buffer, &count) )
559 /* Are there any utilities for converting registry entries
562 /* FIXME_(reg)("We need reg format converter\n"); */
565 value = atoiW(buffer);
568 return SYSPARAMS_Twips2Pixels(value);
572 /***********************************************************************
575 * Initialisation of the system metrics array.
577 * Differences in return values between 3.1 and 95 apps under Win95 (FIXME ?):
578 * SM_CXVSCROLL x+1 x Fixed May 24, 1999 - Ronald B. Cemer
579 * SM_CYHSCROLL x+1 x Fixed May 24, 1999 - Ronald B. Cemer
580 * SM_CXDLGFRAME x-1 x Already fixed
581 * SM_CYDLGFRAME x-1 x Already fixed
582 * SM_CYCAPTION x+1 x Fixed May 24, 1999 - Ronald B. Cemer
583 * SM_CYMENU x-1 x Already fixed
584 * SM_CYFULLSCREEN x-1 x
585 * SM_CXFRAME Fixed July 6, 2001 - Bill Medland
587 * Starting at Win95 there are now a large number or Registry entries in the
588 * [WindowMetrics] section that are probably relevant here.
590 void SYSPARAMS_Init(void)
592 HKEY hkey; /* key to the window metrics area of the registry */
596 display_dc = CreateICW( DISPLAY, NULL, NULL, NULL );
597 assert( display_dc );
599 if (RegOpenKeyExW (HKEY_CURRENT_USER, METRICS_REGKEY,
600 0, KEY_QUERY_VALUE, &hkey) != ERROR_SUCCESS) hkey = 0;
602 sysMetrics[SM_CXVSCROLL] = SYSPARAMS_GetRegistryMetric( hkey, METRICS_SCROLLWIDTH_VALNAME, 16 );
603 sysMetrics[SM_CYHSCROLL] = sysMetrics[SM_CXVSCROLL];
605 /* The Win 2000 resource kit SAYS that this is governed by the ScrollHeight
606 * but on my computer that controls the CYV/CXH values. */
607 sysMetrics[SM_CYCAPTION] = SYSPARAMS_GetRegistryMetric(hkey, METRICS_CAPTIONHEIGHT_VALNAME, 18)
608 + 1; /* for the separator? */
610 sysMetrics[SM_CYMENU] = SYSPARAMS_GetRegistryMetric (hkey, METRICS_MENUHEIGHT_VALNAME, 18) + 1;
613 sysMetrics[SM_CXDLGFRAME] = 3;
614 sysMetrics[SM_CYDLGFRAME] = sysMetrics[SM_CXDLGFRAME];
616 SystemParametersInfoW( SPI_GETBORDER, 0, &border, 0 );
617 sysMetrics[SM_CXFRAME] = sysMetrics[SM_CXDLGFRAME] + border;
618 sysMetrics[SM_CYFRAME] = sysMetrics[SM_CYDLGFRAME] + border;
620 sysMetrics[SM_CXCURSOR] = 32;
621 sysMetrics[SM_CYCURSOR] = 32;
622 sysMetrics[SM_CXBORDER] = SYSPARAMS_GetRegistryMetric( hkey, METRICS_BORDERWIDTH_VALNAME, 1 );
623 sysMetrics[SM_CYBORDER] = sysMetrics[SM_CXBORDER];
624 sysMetrics[SM_CYVTHUMB] = sysMetrics[SM_CXVSCROLL];
625 sysMetrics[SM_CXHTHUMB] = sysMetrics[SM_CYVTHUMB];
626 sysMetrics[SM_CXICON] = SYSPARAMS_GetRegistryMetric( hkey, METRICS_ICONSIZE_VALNAME, 32 );
627 sysMetrics[SM_CYICON] = sysMetrics[SM_CXICON];
628 sysMetrics[SM_CYKANJIWINDOW] = 0;
629 sysMetrics[SM_MOUSEPRESENT] = 1;
630 sysMetrics[SM_CYVSCROLL] = SYSPARAMS_GetRegistryMetric (hkey, METRICS_SCROLLHEIGHT_VALNAME, sysMetrics[SM_CXVSCROLL]);
631 sysMetrics[SM_CXHSCROLL] = SYSPARAMS_GetRegistryMetric (hkey, METRICS_SCROLLHEIGHT_VALNAME, sysMetrics[SM_CYHSCROLL]);
632 sysMetrics[SM_DEBUG] = 0;
634 sysMetrics[SM_SWAPBUTTON] = 0;
635 if (SYSPARAMS_Load( SPI_SETMOUSEBUTTONSWAP_REGKEY, SPI_SETMOUSEBUTTONSWAP_VALNAME, buf, sizeof(buf) ))
636 sysMetrics[SM_SWAPBUTTON] = atoiW( buf );
637 spi_loaded[SPI_SETMOUSEBUTTONSWAP_IDX] = TRUE;
639 sysMetrics[SM_RESERVED1] = 0;
640 sysMetrics[SM_RESERVED2] = 0;
641 sysMetrics[SM_RESERVED3] = 0;
642 sysMetrics[SM_RESERVED4] = 0;
644 /* FIXME: The following two are calculated, but how? */
645 sysMetrics[SM_CXMIN] = 112;
646 sysMetrics[SM_CYMIN] = 27;
648 sysMetrics[SM_CXSIZE] = SYSPARAMS_GetRegistryMetric (hkey, METRICS_CAPTIONWIDTH_VALNAME, sysMetrics[SM_CYCAPTION] - 1);
649 sysMetrics[SM_CYSIZE] = sysMetrics[SM_CYCAPTION] - 1;
650 sysMetrics[SM_CXMINTRACK] = sysMetrics[SM_CXMIN];
651 sysMetrics[SM_CYMINTRACK] = sysMetrics[SM_CYMIN];
653 sysMetrics[SM_CXDOUBLECLK] = 4;
654 sysMetrics[SM_CYDOUBLECLK] = 4;
656 if (SYSPARAMS_Load( SPI_SETDOUBLECLKWIDTH_REGKEY1, SPI_SETDOUBLECLKWIDTH_VALNAME, buf, sizeof(buf) ))
657 sysMetrics[SM_CXDOUBLECLK] = atoiW( buf );
658 spi_loaded[SPI_SETDOUBLECLKWIDTH_IDX] = TRUE;
660 if (SYSPARAMS_Load( SPI_SETDOUBLECLKHEIGHT_REGKEY1, SPI_SETDOUBLECLKHEIGHT_VALNAME, buf, sizeof(buf) ))
661 sysMetrics[SM_CYDOUBLECLK] = atoiW( buf );
662 spi_loaded[SPI_SETDOUBLECLKHEIGHT_IDX] = TRUE;
664 sysMetrics[SM_CXICONSPACING] = 75;
665 SystemParametersInfoW( SPI_ICONHORIZONTALSPACING, 0, &sysMetrics[SM_CXICONSPACING], 0 );
666 sysMetrics[SM_CYICONSPACING] = 75;
667 SystemParametersInfoW( SPI_ICONVERTICALSPACING, 0, &sysMetrics[SM_CYICONSPACING], 0 );
669 SystemParametersInfoW( SPI_GETMENUDROPALIGNMENT, 0, &sysMetrics[SM_MENUDROPALIGNMENT], 0 );
670 sysMetrics[SM_PENWINDOWS] = 0;
671 sysMetrics[SM_DBCSENABLED] = 0;
673 /* FIXME: Need to query X for the following */
674 sysMetrics[SM_CMOUSEBUTTONS] = 3;
676 sysMetrics[SM_SECURE] = 0;
677 sysMetrics[SM_CXEDGE] = sysMetrics[SM_CXBORDER] + 1;
678 sysMetrics[SM_CYEDGE] = sysMetrics[SM_CXEDGE];
679 sysMetrics[SM_CXMINSPACING] = 160;
680 sysMetrics[SM_CYMINSPACING] = 24;
681 sysMetrics[SM_CXSMICON] = 16;
682 sysMetrics[SM_CYSMICON] = 16;
683 sysMetrics[SM_CYSMCAPTION] = SYSPARAMS_GetRegistryMetric(hkey, METRICS_SMCAPTIONHEIGHT_VALNAME, 15) + 1;
684 sysMetrics[SM_CXSMSIZE] = SYSPARAMS_GetRegistryMetric(hkey, METRICS_SMCAPTIONWIDTH_VALNAME, 13);
685 sysMetrics[SM_CYSMSIZE] = sysMetrics[SM_CYSMCAPTION] - 1;
686 sysMetrics[SM_CXMENUSIZE] = SYSPARAMS_GetRegistryMetric(hkey, METRICS_MENUWIDTH_VALNAME, sysMetrics[SM_CYMENU] - 1);
687 sysMetrics[SM_CYMENUSIZE] = sysMetrics[SM_CYMENU] - 1;
689 /* FIXME: What do these mean? */
690 sysMetrics[SM_ARRANGE] = ARW_HIDE;
691 sysMetrics[SM_CXMINIMIZED] = 160;
692 sysMetrics[SM_CYMINIMIZED] = 24;
694 /* FIXME: How do I calculate these? */
695 sysMetrics[SM_NETWORK] = 3;
697 /* For the following: 0 = ok, 1 = failsafe, 2 = failsafe + network */
698 sysMetrics[SM_CLEANBOOT] = 0;
700 sysMetrics[SM_CXDRAG] = 4;
701 sysMetrics[SM_CYDRAG] = 4;
702 sysMetrics[SM_CXMENUCHECK] = 13;
703 sysMetrics[SM_CYMENUCHECK] = 13;
705 /* FIXME: Should check the type of processor for the following */
706 sysMetrics[SM_SLOWMACHINE] = 0;
708 /* FIXME: Should perform a check */
709 sysMetrics[SM_MIDEASTENABLED] = 0;
711 sysMetrics[SM_MOUSEWHEELPRESENT] = 1;
713 sysMetrics[SM_XVIRTUALSCREEN] = 0;
714 sysMetrics[SM_YVIRTUALSCREEN] = 0;
715 sysMetrics[SM_CMONITORS] = 1;
716 sysMetrics[SM_SAMEDISPLAYFORMAT] = 1;
717 sysMetrics[SM_CMETRICS] = SM_CMETRICS;
719 SystemParametersInfoW( SPI_GETSHOWSOUNDS, 0, &sysMetrics[SM_SHOWSOUNDS], 0 );
721 if (hkey) RegCloseKey (hkey);
727 /***********************************************************************
728 * SystemParametersInfoW (USER32.@)
730 * Each system parameter has flag which shows whether the parameter
731 * is loaded or not. Parameters, stored directly in SysParametersInfo are
732 * loaded from registry only when they are requested and the flag is
733 * "false", after the loading the flag is set to "true". On interprocess
734 * notification of the parameter change the corresponding parameter flag is
735 * set to "false". The parameter value will be reloaded when it is requested
737 * Parameters, backed by or depend on GetSystemMetrics are processed
738 * differently. These parameters are always loaded. They are reloaded right
739 * away on interprocess change notification. We can't do lazy loading because
740 * we don't want to complicate GetSystemMetrics.
741 * Parameters, backed by X settings are read from corresponding setting.
742 * On the parameter change request the setting is changed. Interprocess change
743 * notifications are ignored.
744 * When parameter value is updated the changed value is stored in permanent
745 * registry branch if saving is requested. Otherwise it is stored
746 * in temporary branch
748 * Some SPI values can also be stored as Twips values in the registry,
749 * don't forget the conversion!
751 BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
752 PVOID pvParam, UINT fWinIni )
754 #define WINE_SPI_FIXME(x) \
756 FIXME( "Unimplemented action: %u (%s)\n", x, #x ); \
757 SetLastError( ERROR_INVALID_SPI_VALUE ); \
760 #define WINE_SPI_WARN(x) \
762 WARN( "Ignored action: %u (%s)\n", x, #x ); \
766 unsigned spi_idx = 0;
768 TRACE("(%u, %u, %p, %u)\n", uiAction, uiParam, pvParam, fWinIni);
772 case SPI_GETBEEP: /* 1 */
773 if (!pvParam) return FALSE;
775 spi_idx = SPI_SETBEEP_IDX;
776 if (!spi_loaded[spi_idx])
780 if (SYSPARAMS_Load( SPI_SETBEEP_REGKEY, SPI_SETBEEP_VALNAME, buf, sizeof(buf) ))
781 beep_active = !lstrcmpiW( Yes, buf );
782 spi_loaded[spi_idx] = TRUE;
785 *(BOOL *)pvParam = beep_active;
788 case SPI_SETBEEP: /* 2 */
789 spi_idx = SPI_SETBEEP_IDX;
790 if (SYSPARAMS_Save( SPI_SETBEEP_REGKEY, SPI_SETBEEP_VALNAME,
791 (uiParam ? Yes : No), fWinIni ))
793 beep_active = uiParam;
794 spi_loaded[spi_idx] = TRUE;
800 case SPI_GETMOUSE: /* 3 */
801 if (!pvParam) return FALSE;
803 spi_idx = SPI_SETMOUSE_IDX;
804 if (!spi_loaded[spi_idx])
808 if (SYSPARAMS_Load( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME1,
810 mouse_threshold1 = atoiW( buf );
811 if (SYSPARAMS_Load( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME2,
813 mouse_threshold2 = atoiW( buf );
814 if (SYSPARAMS_Load( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME3,
816 mouse_speed = atoiW( buf );
817 spi_loaded[spi_idx] = TRUE;
819 ((INT *)pvParam)[0] = mouse_threshold1;
820 ((INT *)pvParam)[1] = mouse_threshold2;
821 ((INT *)pvParam)[2] = mouse_speed;
824 case SPI_SETMOUSE: /* 4 */
828 if (!pvParam) return FALSE;
830 spi_idx = SPI_SETMOUSE_IDX;
831 wsprintfW(buf, CSd, ((INT *)pvParam)[0]);
833 if (SYSPARAMS_Save( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME1,
836 mouse_threshold1 = ((INT *)pvParam)[0];
837 spi_loaded[spi_idx] = TRUE;
839 wsprintfW(buf, CSd, ((INT *)pvParam)[1]);
840 SYSPARAMS_Save( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME2,
842 mouse_threshold2 = ((INT *)pvParam)[1];
844 wsprintfW(buf, CSd, ((INT *)pvParam)[2]);
845 SYSPARAMS_Save( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME3,
847 mouse_speed = ((INT *)pvParam)[2];
854 case SPI_GETBORDER: /* 5 */
855 if (!pvParam) return FALSE;
857 spi_idx = SPI_SETBORDER_IDX;
858 if (!spi_loaded[spi_idx])
862 if (SYSPARAMS_Load( SPI_SETBORDER_REGKEY, SPI_SETBORDER_VALNAME, buf, sizeof(buf) ))
863 border = SYSPARAMS_Twips2Pixels( atoiW(buf) );
865 spi_loaded[spi_idx] = TRUE;
866 sysMetrics[SM_CXFRAME] = border + sysMetrics[SM_CXDLGFRAME];
867 sysMetrics[SM_CYFRAME] = border + sysMetrics[SM_CYDLGFRAME];
869 *(INT *)pvParam = border;
872 case SPI_SETBORDER: /* 6 */
876 spi_idx = SPI_SETBORDER_IDX;
877 wsprintfW(buf, CSu, uiParam);
879 if (SYSPARAMS_Save( SPI_SETBORDER_REGKEY, SPI_SETBORDER_VALNAME,
885 spi_loaded[spi_idx] = TRUE;
886 sysMetrics[SM_CXFRAME] = border + sysMetrics[SM_CXDLGFRAME];
887 sysMetrics[SM_CYFRAME] = border + sysMetrics[SM_CYDLGFRAME];
895 case SPI_GETKEYBOARDSPEED: /* 10 */
896 if (!pvParam) return FALSE;
898 spi_idx = SPI_SETKEYBOARDSPEED_IDX;
899 if (!spi_loaded[spi_idx])
903 if (SYSPARAMS_Load( SPI_SETKEYBOARDSPEED_REGKEY,
904 SPI_SETKEYBOARDSPEED_VALNAME,
906 keyboard_speed = atoiW( buf );
907 spi_loaded[spi_idx] = TRUE;
909 *(INT *)pvParam = keyboard_speed;
912 case SPI_SETKEYBOARDSPEED: /* 11 */
916 spi_idx = SPI_SETKEYBOARDSPEED_IDX;
919 wsprintfW(buf, CSu, uiParam);
921 if (SYSPARAMS_Save( SPI_SETKEYBOARDSPEED_REGKEY,
922 SPI_SETKEYBOARDSPEED_VALNAME,
925 keyboard_speed = uiParam;
926 spi_loaded[spi_idx] = TRUE;
933 /* not implemented in Windows */
934 WINE_SPI_WARN(SPI_LANGDRIVER); /* 12 */
936 case SPI_ICONHORIZONTALSPACING: /* 13 */
937 spi_idx = SPI_ICONHORIZONTALSPACING_IDX;
940 if (!spi_loaded[spi_idx])
945 if (SYSPARAMS_Load( SPI_ICONHORIZONTALSPACING_REGKEY,
946 SPI_ICONHORIZONTALSPACING_VALNAME, buf, sizeof(buf) ))
948 val = SYSPARAMS_Twips2Pixels( atoiW(buf) );
949 sysMetrics[SM_CXICONSPACING] = val;
951 spi_loaded[spi_idx] = TRUE;
954 *(INT *)pvParam = sysMetrics[SM_CXICONSPACING];
960 if (uiParam < 32) uiParam = 32;
962 wsprintfW(buf, CSu, uiParam);
963 if (SYSPARAMS_Save( SPI_ICONHORIZONTALSPACING_REGKEY,
964 SPI_ICONHORIZONTALSPACING_VALNAME,
967 sysMetrics[SM_CXICONSPACING] = uiParam;
968 spi_loaded[spi_idx] = TRUE;
975 case SPI_GETSCREENSAVETIMEOUT: /* 14 */
976 if (!pvParam) return FALSE;
978 spi_idx = SPI_SETSCREENSAVETIMEOUT_IDX;
979 if (!spi_loaded[spi_idx])
983 if (SYSPARAMS_Load( SPI_SETSCREENSAVETIMEOUT_REGKEY,
984 SPI_SETSCREENSAVETIMEOUT_VALNAME,
986 screensave_timeout = atoiW( buf );
988 spi_loaded[spi_idx] = TRUE;
990 *(INT *)pvParam = screensave_timeout;
993 case SPI_SETSCREENSAVETIMEOUT: /* 15 */
997 spi_idx = SPI_SETSCREENSAVETIMEOUT_IDX;
998 wsprintfW(buf, CSu, uiParam);
1000 if (SYSPARAMS_Save( SPI_SETSCREENSAVETIMEOUT_REGKEY,
1001 SPI_SETSCREENSAVETIMEOUT_VALNAME,
1004 screensave_timeout = uiParam;
1005 spi_loaded[spi_idx] = TRUE;
1012 case SPI_GETSCREENSAVEACTIVE: /* 16 */
1013 if (!pvParam) return FALSE;
1014 if (USER_Driver.pGetScreenSaveActive)
1015 *(BOOL *)pvParam = USER_Driver.pGetScreenSaveActive();
1017 *(BOOL *)pvParam = FALSE;
1020 case SPI_SETSCREENSAVEACTIVE: /* 17 */
1024 wsprintfW(buf, CSu, uiParam);
1025 if (USER_Driver.pSetScreenSaveActive)
1026 USER_Driver.pSetScreenSaveActive( uiParam );
1027 /* saved value does not affect Wine */
1028 SYSPARAMS_Save( SPI_SETSCREENSAVEACTIVE_REGKEY,
1029 SPI_SETSCREENSAVEACTIVE_VALNAME,
1034 case SPI_GETGRIDGRANULARITY: /* 18 */
1035 if (!pvParam) return FALSE;
1037 spi_idx = SPI_SETGRIDGRANULARITY_IDX;
1038 if (!spi_loaded[spi_idx])
1042 if (SYSPARAMS_Load( SPI_SETGRIDGRANULARITY_REGKEY,
1043 SPI_SETGRIDGRANULARITY_VALNAME,
1045 grid_granularity = atoiW( buf );
1047 spi_loaded[spi_idx] = TRUE;
1049 *(INT *)pvParam = grid_granularity;
1052 case SPI_SETGRIDGRANULARITY: /* 19 */
1056 spi_idx = SPI_SETGRIDGRANULARITY_IDX;
1057 wsprintfW(buf, CSu, uiParam);
1059 if (SYSPARAMS_Save( SPI_SETGRIDGRANULARITY_REGKEY,
1060 SPI_SETGRIDGRANULARITY_VALNAME,
1063 grid_granularity = uiParam;
1064 spi_loaded[spi_idx] = TRUE;
1071 case SPI_SETDESKWALLPAPER: /* 20 */
1072 if (!pvParam || !SetDeskWallPaper( (LPSTR)pvParam )) return FALSE;
1073 SYSPARAMS_Save(SPI_SETDESKWALLPAPER_REGKEY, SPI_SETDESKWALLPAPER_VALNAME, pvParam, fWinIni);
1076 case SPI_SETDESKPATTERN: /* 21 */
1077 /* FIXME: the ability to specify a pattern in pvParam
1078 doesn't seem to be documented for Win32 */
1079 if ((INT16)uiParam == -1)
1082 GetProfileStringW( Desktop, Pattern,
1084 buf, sizeof(buf)/sizeof(WCHAR) );
1085 ret = DESKTOP_SetPattern( buf );
1087 ret = DESKTOP_SetPattern( (LPWSTR)pvParam );
1090 case SPI_GETKEYBOARDDELAY: /* 22 */
1091 if (!pvParam) return FALSE;
1093 spi_idx = SPI_SETKEYBOARDDELAY_IDX;
1094 if (!spi_loaded[spi_idx])
1098 if (SYSPARAMS_Load( SPI_SETKEYBOARDDELAY_REGKEY,
1099 SPI_SETKEYBOARDDELAY_VALNAME,
1102 int i = atoiW( buf );
1103 if ( (i >= 0) && (i <= 3)) keyboard_delay = i;
1106 spi_loaded[spi_idx] = TRUE;
1108 *(INT *)pvParam = keyboard_delay;
1111 case SPI_SETKEYBOARDDELAY: /* 23 */
1115 spi_idx = SPI_SETKEYBOARDDELAY_IDX;
1116 wsprintfW(buf, CSu, uiParam);
1118 if (SYSPARAMS_Save( SPI_SETKEYBOARDDELAY_REGKEY,
1119 SPI_SETKEYBOARDDELAY_VALNAME,
1123 keyboard_delay = uiParam;
1124 spi_loaded[spi_idx] = TRUE;
1131 case SPI_ICONVERTICALSPACING: /* 24 */
1132 spi_idx = SPI_ICONVERTICALSPACING_IDX;
1133 if (pvParam != NULL)
1135 if (!spi_loaded[spi_idx])
1140 if (SYSPARAMS_Load( SPI_ICONVERTICALSPACING_REGKEY,
1141 SPI_ICONVERTICALSPACING_VALNAME, buf, sizeof(buf) ))
1143 val = SYSPARAMS_Twips2Pixels( atoiW(buf) );
1144 sysMetrics[SM_CYICONSPACING] = val;
1146 spi_loaded[spi_idx] = TRUE;
1149 *(INT *)pvParam = sysMetrics[SM_CYICONSPACING];
1155 if (uiParam < 32) uiParam = 32;
1157 wsprintfW(buf, CSu, uiParam);
1158 if (SYSPARAMS_Save( SPI_ICONVERTICALSPACING_REGKEY,
1159 SPI_ICONVERTICALSPACING_VALNAME,
1162 sysMetrics[SM_CYICONSPACING] = uiParam;
1163 spi_loaded[spi_idx] = TRUE;
1171 case SPI_GETICONTITLEWRAP: /* 25 */
1172 if (!pvParam) return FALSE;
1174 spi_idx = SPI_SETICONTITLEWRAP_IDX;
1175 if (!spi_loaded[spi_idx])
1179 if (SYSPARAMS_Load( SPI_SETICONTITLEWRAP_REGKEY1,
1180 SPI_SETICONTITLEWRAP_VALNAME, buf, sizeof(buf) ))
1181 icon_title_wrap = atoiW(buf);
1182 spi_loaded[spi_idx] = TRUE;
1185 *(BOOL *)pvParam = icon_title_wrap;
1188 case SPI_SETICONTITLEWRAP: /* 26 */
1192 spi_idx = SPI_SETICONTITLEWRAP_IDX;
1193 wsprintfW(buf, CSu, uiParam);
1194 if (SYSPARAMS_Save( SPI_SETICONTITLEWRAP_REGKEY1,
1195 SPI_SETICONTITLEWRAP_VALNAME,
1198 SYSPARAMS_Save( SPI_SETICONTITLEWRAP_REGKEY2,
1199 SPI_SETICONTITLEWRAP_VALNAME,
1201 icon_title_wrap = uiParam;
1202 spi_loaded[spi_idx] = TRUE;
1209 case SPI_GETMENUDROPALIGNMENT: /* 27 */
1210 if (!pvParam) return FALSE;
1212 spi_idx = SPI_SETMENUDROPALIGNMENT_IDX;
1214 if (!spi_loaded[spi_idx])
1218 if (SYSPARAMS_Load( SPI_SETMENUDROPALIGNMENT_REGKEY1,
1219 SPI_SETMENUDROPALIGNMENT_VALNAME, buf, sizeof(buf) ))
1221 sysMetrics[SM_MENUDROPALIGNMENT] = atoiW( buf );
1223 spi_loaded[spi_idx] = TRUE;
1226 *(BOOL *)pvParam = sysMetrics[SM_MENUDROPALIGNMENT];
1229 case SPI_SETMENUDROPALIGNMENT: /* 28 */
1232 spi_idx = SPI_SETMENUDROPALIGNMENT_IDX;
1234 wsprintfW(buf, CSu, uiParam);
1235 if (SYSPARAMS_Save( SPI_SETMENUDROPALIGNMENT_REGKEY1,
1236 SPI_SETMENUDROPALIGNMENT_VALNAME,
1239 SYSPARAMS_Save( SPI_SETMENUDROPALIGNMENT_REGKEY2,
1240 SPI_SETMENUDROPALIGNMENT_VALNAME,
1242 sysMetrics[SM_MENUDROPALIGNMENT] = uiParam;
1243 spi_loaded[spi_idx] = TRUE;
1250 case SPI_SETDOUBLECLKWIDTH: /* 29 */
1253 spi_idx = SPI_SETDOUBLECLKWIDTH_IDX;
1255 wsprintfW(buf, CSu, uiParam);
1256 if (SYSPARAMS_Save( SPI_SETDOUBLECLKWIDTH_REGKEY1,
1257 SPI_SETDOUBLECLKWIDTH_VALNAME,
1260 SYSPARAMS_Save( SPI_SETDOUBLECLKWIDTH_REGKEY2,
1261 SPI_SETDOUBLECLKWIDTH_VALNAME,
1263 sysMetrics[SM_CXDOUBLECLK] = uiParam;
1264 spi_loaded[spi_idx] = TRUE;
1271 case SPI_SETDOUBLECLKHEIGHT: /* 30 */
1274 spi_idx = SPI_SETDOUBLECLKHEIGHT_IDX;
1276 wsprintfW(buf, CSu, uiParam);
1277 if (SYSPARAMS_Save( SPI_SETDOUBLECLKHEIGHT_REGKEY1,
1278 SPI_SETDOUBLECLKHEIGHT_VALNAME,
1281 SYSPARAMS_Save( SPI_SETDOUBLECLKHEIGHT_REGKEY2,
1282 SPI_SETDOUBLECLKHEIGHT_VALNAME,
1284 sysMetrics[SM_CYDOUBLECLK] = uiParam;
1285 spi_loaded[spi_idx] = TRUE;
1292 case SPI_GETICONTITLELOGFONT: /* 31 */
1294 LPLOGFONTW lpLogFont = (LPLOGFONTW)pvParam;
1297 if (!pvParam) return FALSE;
1300 * The 'default GDI fonts' seems to be returned.
1301 * If a returned font is not a correct font in your environment,
1302 * please try to fix objects/gdiobj.c at first.
1304 GetObjectW( GetStockObject( DEFAULT_GUI_FONT ), sizeof(LOGFONTW), &lfDefault );
1306 GetProfileStringW( Desktop, IconTitleFaceName,
1307 lfDefault.lfFaceName,
1308 lpLogFont->lfFaceName, LF_FACESIZE );
1309 lpLogFont->lfHeight = -GetProfileIntW( Desktop, IconTitleSize, 11 );
1310 lpLogFont->lfWidth = 0;
1311 lpLogFont->lfEscapement = lpLogFont->lfOrientation = 0;
1312 lpLogFont->lfWeight = FW_NORMAL;
1313 lpLogFont->lfItalic = FALSE;
1314 lpLogFont->lfStrikeOut = FALSE;
1315 lpLogFont->lfUnderline = FALSE;
1316 lpLogFont->lfCharSet = lfDefault.lfCharSet; /* at least 'charset' should not be hard-coded */
1317 lpLogFont->lfOutPrecision = OUT_DEFAULT_PRECIS;
1318 lpLogFont->lfClipPrecision = CLIP_DEFAULT_PRECIS;
1319 lpLogFont->lfPitchAndFamily = DEFAULT_PITCH;
1320 lpLogFont->lfQuality = DEFAULT_QUALITY;
1324 case SPI_SETDOUBLECLICKTIME: /* 32 */
1328 spi_idx = SPI_SETDOUBLECLICKTIME_IDX;
1329 wsprintfW(buf, CSu, uiParam);
1331 if (SYSPARAMS_Save( SPI_SETDOUBLECLICKTIME_REGKEY,
1332 SPI_SETDOUBLECLICKTIME_VALNAME,
1337 double_click_time = uiParam;
1338 spi_loaded[spi_idx] = TRUE;
1345 case SPI_SETMOUSEBUTTONSWAP: /* 33 */
1348 spi_idx = SPI_SETMOUSEBUTTONSWAP_IDX;
1350 wsprintfW(buf, CSu, uiParam);
1351 if (SYSPARAMS_Save( SPI_SETMOUSEBUTTONSWAP_REGKEY,
1352 SPI_SETMOUSEBUTTONSWAP_VALNAME,
1355 sysMetrics[SM_SWAPBUTTON] = uiParam;
1356 spi_loaded[spi_idx] = TRUE;
1363 WINE_SPI_FIXME(SPI_SETICONTITLELOGFONT); /* 34 */
1365 case SPI_GETFASTTASKSWITCH: /* 35 */
1366 if (!pvParam) return FALSE;
1367 *(BOOL *)pvParam = 1;
1370 case SPI_SETFASTTASKSWITCH: /* 36 */
1371 /* the action is disabled */
1375 case SPI_SETDRAGFULLWINDOWS: /* 37 WINVER >= 0x0400 */
1379 spi_idx = SPI_SETDRAGFULLWINDOWS_IDX;
1380 wsprintfW(buf, CSu, uiParam);
1381 if (SYSPARAMS_Save( SPI_SETDRAGFULLWINDOWS_REGKEY,
1382 SPI_SETDRAGFULLWINDOWS_VALNAME,
1385 drag_full_windows = uiParam;
1386 spi_loaded[spi_idx] = TRUE;
1393 case SPI_GETDRAGFULLWINDOWS: /* 38 WINVER >= 0x0400 */
1394 if (!pvParam) return FALSE;
1396 spi_idx = SPI_SETDRAGFULLWINDOWS_IDX;
1397 if (!spi_loaded[spi_idx])
1401 if (SYSPARAMS_Load( SPI_SETDRAGFULLWINDOWS_REGKEY,
1402 SPI_SETDRAGFULLWINDOWS_VALNAME, buf, sizeof(buf) ))
1403 drag_full_windows = atoiW(buf);
1404 spi_loaded[spi_idx] = TRUE;
1407 *(BOOL *)pvParam = drag_full_windows;
1410 case SPI_GETNONCLIENTMETRICS: /* 41 WINVER >= 0x400 */
1412 LPNONCLIENTMETRICSW lpnm = (LPNONCLIENTMETRICSW)pvParam;
1414 if (!pvParam) return FALSE;
1416 if (lpnm->cbSize == sizeof(NONCLIENTMETRICSW))
1418 /* clear the struct, so we have 'sane' members */
1420 (char *)pvParam + sizeof(lpnm->cbSize),
1422 lpnm->cbSize - sizeof(lpnm->cbSize)
1425 /* initialize geometry entries */
1426 lpnm->iBorderWidth = 1;
1427 lpnm->iScrollWidth = sysMetrics[SM_CXVSCROLL];
1428 lpnm->iScrollHeight = sysMetrics[SM_CYHSCROLL];
1430 /* size of the normal caption buttons */
1431 lpnm->iCaptionWidth = sysMetrics[SM_CXSIZE];
1432 lpnm->iCaptionHeight = sysMetrics[SM_CYSIZE];
1434 /* caption font metrics */
1435 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, (LPVOID)&(lpnm->lfCaptionFont), 0 );
1436 lpnm->lfCaptionFont.lfWeight = FW_BOLD;
1438 /* size of the small caption buttons */
1439 lpnm->iSmCaptionWidth = sysMetrics[SM_CXSMSIZE];
1440 lpnm->iSmCaptionHeight = sysMetrics[SM_CYSMSIZE];
1442 /* small caption font metrics */
1443 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, (LPVOID)&(lpnm->lfSmCaptionFont), 0 );
1445 /* menus, FIXME: names of wine.conf entries are bogus */
1447 /* size of the menu (MDI) buttons */
1448 lpnm->iMenuWidth = sysMetrics[SM_CXMENUSIZE];
1449 lpnm->iMenuHeight = sysMetrics[SM_CYMENUSIZE];
1451 /* menu font metrics */
1452 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, (LPVOID)&(lpnm->lfMenuFont), 0 );
1453 GetProfileStringW( Desktop, MenuFont, lpnm->lfCaptionFont.lfFaceName,
1454 lpnm->lfMenuFont.lfFaceName, LF_FACESIZE );
1455 lpnm->lfMenuFont.lfHeight = -GetProfileIntW( Desktop, MenuFontSize, 11 );
1456 lpnm->lfMenuFont.lfWeight = FW_NORMAL;
1458 /* status bar font metrics */
1459 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0,
1460 (LPVOID)&(lpnm->lfStatusFont), 0 );
1461 GetProfileStringW( Desktop, StatusFont, lpnm->lfCaptionFont.lfFaceName,
1462 lpnm->lfStatusFont.lfFaceName, LF_FACESIZE );
1463 lpnm->lfStatusFont.lfHeight = -GetProfileIntW( Desktop, StatusFontSize, 11 );
1464 lpnm->lfStatusFont.lfWeight = FW_NORMAL;
1466 /* message font metrics */
1467 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0,
1468 (LPVOID)&(lpnm->lfMessageFont), 0 );
1469 GetProfileStringW( Desktop, MessageFont, lpnm->lfCaptionFont.lfFaceName,
1470 lpnm->lfMessageFont.lfFaceName, LF_FACESIZE );
1471 lpnm->lfMessageFont.lfHeight = -GetProfileIntW( Desktop, MessageFontSize, 11 );
1472 lpnm->lfMessageFont.lfWeight = FW_NORMAL;
1477 WARN("size mismatch !! (is %d; should be %d)\n", lpnm->cbSize, sizeof(NONCLIENTMETRICSW));
1478 /* FIXME: SetLastError? */
1483 WINE_SPI_FIXME(SPI_SETNONCLIENTMETRICS); /* 42 WINVER >= 0x400 */
1485 case SPI_GETMINIMIZEDMETRICS: /* 43 WINVER >= 0x400 */
1487 MINIMIZEDMETRICS * lpMm = pvParam;
1488 if (lpMm && lpMm->cbSize == sizeof(*lpMm))
1490 /* these taken from Win2k SP3 */
1500 WINE_SPI_FIXME(SPI_SETMINIMIZEDMETRICS); /* 44 WINVER >= 0x400 */
1502 case SPI_GETICONMETRICS: /* 45 WINVER >= 0x400 */
1504 LPICONMETRICSW lpIcon = pvParam;
1505 if(lpIcon && lpIcon->cbSize == sizeof(*lpIcon))
1507 SystemParametersInfoW( SPI_ICONHORIZONTALSPACING, 0,
1508 &lpIcon->iHorzSpacing, FALSE );
1509 SystemParametersInfoW( SPI_ICONVERTICALSPACING, 0,
1510 &lpIcon->iVertSpacing, FALSE );
1511 SystemParametersInfoW( SPI_GETICONTITLEWRAP, 0,
1512 &lpIcon->iTitleWrap, FALSE );
1513 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0,
1514 &lpIcon->lfFont, FALSE );
1522 WINE_SPI_FIXME(SPI_SETICONMETRICS); /* 46 WINVER >= 0x400 */
1524 case SPI_SETWORKAREA: /* 47 WINVER >= 0x400 */
1526 static const WCHAR CSld[]={'%','l','d',' ','%','l','d',' ','%','l','d',' ','%','l','d',0};
1528 RECT *pr = (RECT *) pvParam;
1530 if (!pvParam) return FALSE;
1532 spi_idx = SPI_SETWORKAREA_IDX;
1533 wsprintfW(buf, CSld, pr->left, pr->top,
1534 pr->right, pr->bottom );
1536 if (SYSPARAMS_Save( SPI_SETWORKAREA_REGKEY,
1537 SPI_SETWORKAREA_VALNAME,
1540 CopyRect( &work_area, (RECT *)pvParam );
1541 spi_loaded[spi_idx] = TRUE;
1548 case SPI_GETWORKAREA: /* 48 WINVER >= 0x400 */
1549 if (!pvParam) return FALSE;
1551 spi_idx = SPI_SETWORKAREA_IDX;
1552 if (!spi_loaded[spi_idx])
1556 SetRect( &work_area, 0, 0,
1557 GetSystemMetrics( SM_CXSCREEN ),
1558 GetSystemMetrics( SM_CYSCREEN ) );
1560 if (SYSPARAMS_Load( SPI_SETWORKAREA_REGKEY,
1561 SPI_SETWORKAREA_VALNAME,
1565 WideCharToMultiByte( CP_ACP, 0, buf, -1,
1566 tmpbuf, sizeof(tmpbuf), NULL, NULL );
1567 sscanf( tmpbuf, "%ld %ld %ld %ld",
1568 &work_area.left, &work_area.top,
1569 &work_area.right, &work_area.bottom );
1571 spi_loaded[spi_idx] = TRUE;
1573 CopyRect( (RECT *)pvParam, &work_area );
1577 WINE_SPI_FIXME(SPI_SETPENWINDOWS); /* 49 WINVER >= 0x400 */
1579 case SPI_GETFILTERKEYS: /* 50 */
1581 LPFILTERKEYS lpFilterKeys = (LPFILTERKEYS)pvParam;
1582 WARN("SPI_GETFILTERKEYS not fully implemented\n");
1583 if (lpFilterKeys && lpFilterKeys->cbSize == sizeof(FILTERKEYS))
1585 /* Indicate that no FilterKeys feature available */
1586 lpFilterKeys->dwFlags = 0;
1587 lpFilterKeys->iWaitMSec = 0;
1588 lpFilterKeys->iDelayMSec = 0;
1589 lpFilterKeys->iRepeatMSec = 0;
1590 lpFilterKeys->iBounceMSec = 0;
1598 WINE_SPI_FIXME(SPI_SETFILTERKEYS); /* 51 */
1600 case SPI_GETTOGGLEKEYS: /* 52 */
1602 LPTOGGLEKEYS lpToggleKeys = (LPTOGGLEKEYS)pvParam;
1603 WARN("SPI_GETTOGGLEKEYS not fully implemented\n");
1604 if (lpToggleKeys && lpToggleKeys->cbSize == sizeof(TOGGLEKEYS))
1606 /* Indicate that no ToggleKeys feature available */
1607 lpToggleKeys->dwFlags = 0;
1615 WINE_SPI_FIXME(SPI_SETTOGGLEKEYS); /* 53 */
1617 case SPI_GETMOUSEKEYS: /* 54 */
1619 LPMOUSEKEYS lpMouseKeys = (LPMOUSEKEYS)pvParam;
1620 WARN("SPI_GETMOUSEKEYS not fully implemented\n");
1621 if (lpMouseKeys && lpMouseKeys->cbSize == sizeof(MOUSEKEYS))
1623 /* Indicate that no MouseKeys feature available */
1624 lpMouseKeys->dwFlags = 0;
1625 lpMouseKeys->iMaxSpeed = 360;
1626 lpMouseKeys->iTimeToMaxSpeed = 1000;
1627 lpMouseKeys->iCtrlSpeed = 0;
1628 lpMouseKeys->dwReserved1 = 0;
1629 lpMouseKeys->dwReserved2 = 0;
1637 WINE_SPI_FIXME(SPI_SETMOUSEKEYS); /* 55 */
1639 case SPI_GETSHOWSOUNDS: /* 56 */
1640 if (!pvParam) return FALSE;
1642 spi_idx = SPI_SETSHOWSOUNDS_IDX;
1644 if (!spi_loaded[spi_idx])
1648 if (SYSPARAMS_Load( SPI_SETSHOWSOUNDS_REGKEY,
1649 SPI_SETSHOWSOUNDS_VALNAME, buf, sizeof(buf) ))
1651 sysMetrics[SM_SHOWSOUNDS] = atoiW( buf );
1653 spi_loaded[spi_idx] = TRUE;
1656 *(INT *)pvParam = sysMetrics[SM_SHOWSOUNDS];
1659 case SPI_SETSHOWSOUNDS: /* 57 */
1662 spi_idx = SPI_SETSHOWSOUNDS_IDX;
1664 wsprintfW(buf, CSu, uiParam);
1665 if (SYSPARAMS_Save( SPI_SETSHOWSOUNDS_REGKEY,
1666 SPI_SETSHOWSOUNDS_VALNAME,
1669 sysMetrics[SM_SHOWSOUNDS] = uiParam;
1670 spi_loaded[spi_idx] = TRUE;
1677 case SPI_GETSTICKYKEYS: /* 58 */
1679 LPSTICKYKEYS lpStickyKeys = (LPSTICKYKEYS)pvParam;
1680 WARN("SPI_GETSTICKYKEYS not fully implemented\n");
1681 if (lpStickyKeys && lpStickyKeys->cbSize == sizeof(STICKYKEYS))
1683 /* Indicate that no StickyKeys feature available */
1684 lpStickyKeys->dwFlags = 0;
1692 WINE_SPI_FIXME(SPI_SETSTICKYKEYS); /* 59 */
1694 case SPI_GETACCESSTIMEOUT: /* 60 */
1696 LPACCESSTIMEOUT lpAccessTimeout = (LPACCESSTIMEOUT)pvParam;
1697 WARN("SPI_GETACCESSTIMEOUT not fully implemented\n");
1698 if (lpAccessTimeout && lpAccessTimeout->cbSize == sizeof(ACCESSTIMEOUT))
1700 /* Indicate that no accessibility features timeout is available */
1701 lpAccessTimeout->dwFlags = 0;
1702 lpAccessTimeout->iTimeOutMSec = 0;
1710 WINE_SPI_FIXME(SPI_SETACCESSTIMEOUT); /* 61 */
1712 case SPI_GETSERIALKEYS: /* 62 WINVER >= 0x400 */
1714 LPSERIALKEYSW lpSerialKeysW = (LPSERIALKEYSW)pvParam;
1715 WARN("SPI_GETSERIALKEYS not fully implemented\n");
1716 if (lpSerialKeysW && lpSerialKeysW->cbSize == sizeof(SERIALKEYSW))
1718 /* Indicate that no SerialKeys feature available */
1719 lpSerialKeysW->dwFlags = 0;
1720 lpSerialKeysW->lpszActivePort = NULL;
1721 lpSerialKeysW->lpszPort = NULL;
1722 lpSerialKeysW->iBaudRate = 0;
1723 lpSerialKeysW->iPortState = 0;
1731 WINE_SPI_FIXME(SPI_SETSERIALKEYS); /* 63 WINVER >= 0x400 */
1733 case SPI_GETSOUNDSENTRY: /* 64 */
1735 LPSOUNDSENTRYW lpSoundSentryW = (LPSOUNDSENTRYW)pvParam;
1736 WARN("SPI_GETSOUNDSENTRY not fully implemented\n");
1737 if (lpSoundSentryW && lpSoundSentryW->cbSize == sizeof(SOUNDSENTRYW))
1739 /* Indicate that no SoundSentry feature available */
1740 lpSoundSentryW->dwFlags = 0;
1741 lpSoundSentryW->iFSTextEffect = 0;
1742 lpSoundSentryW->iFSTextEffectMSec = 0;
1743 lpSoundSentryW->iFSTextEffectColorBits = 0;
1744 lpSoundSentryW->iFSGrafEffect = 0;
1745 lpSoundSentryW->iFSGrafEffectMSec = 0;
1746 lpSoundSentryW->iFSGrafEffectColor = 0;
1747 lpSoundSentryW->iWindowsEffect = 0;
1748 lpSoundSentryW->iWindowsEffectMSec = 0;
1749 lpSoundSentryW->lpszWindowsEffectDLL = 0;
1750 lpSoundSentryW->iWindowsEffectOrdinal = 0;
1758 WINE_SPI_FIXME(SPI_SETSOUNDSENTRY); /* 65 */
1760 case SPI_GETHIGHCONTRAST: /* 66 WINVER >= 0x400 */
1762 LPHIGHCONTRASTW lpHighContrastW = (LPHIGHCONTRASTW)pvParam;
1763 WARN("SPI_GETHIGHCONTRAST not fully implemented\n");
1764 if (lpHighContrastW && lpHighContrastW->cbSize == sizeof(HIGHCONTRASTW))
1766 /* Indicate that no high contrast feature available */
1767 lpHighContrastW->dwFlags = 0;
1768 lpHighContrastW->lpszDefaultScheme = NULL;
1776 WINE_SPI_FIXME(SPI_SETHIGHCONTRAST); /* 67 WINVER >= 0x400 */
1778 case SPI_GETKEYBOARDPREF: /* 68 WINVER >= 0x400 */
1779 if (!pvParam) return FALSE;
1781 spi_idx = SPI_SETKEYBOARDPREF_IDX;
1782 if (!spi_loaded[spi_idx])
1786 if (SYSPARAMS_Load( SPI_SETKEYBOARDPREF_REGKEY,
1787 SPI_SETKEYBOARDPREF_VALNAME, buf, sizeof(buf) ))
1788 keyboard_pref = atoiW(buf);
1789 spi_loaded[spi_idx] = TRUE;
1792 *(BOOL *)pvParam = keyboard_pref;
1795 case SPI_SETKEYBOARDPREF: /* 69 WINVER >= 0x400 */
1799 spi_idx = SPI_SETKEYBOARDPREF_IDX;
1800 wsprintfW(buf, CSu, uiParam);
1801 if (SYSPARAMS_Save( SPI_SETKEYBOARDPREF_REGKEY,
1802 SPI_SETKEYBOARDPREF_VALNAME,
1805 keyboard_pref = uiParam;
1806 spi_loaded[spi_idx] = TRUE;
1813 case SPI_GETSCREENREADER: /* 70 WINVER >= 0x400 */
1814 if (!pvParam) return FALSE;
1816 spi_idx = SPI_SETSCREENREADER_IDX;
1817 if (!spi_loaded[spi_idx])
1821 if (SYSPARAMS_Load( SPI_SETSCREENREADER_REGKEY,
1822 SPI_SETSCREENREADER_VALNAME, buf, sizeof(buf) ))
1823 screen_reader = atoiW(buf);
1824 spi_loaded[spi_idx] = TRUE;
1827 *(BOOL *)pvParam = screen_reader;
1830 case SPI_SETSCREENREADER: /* 71 WINVER >= 0x400 */
1834 spi_idx = SPI_SETSCREENREADER_IDX;
1835 wsprintfW(buf, CSu, uiParam);
1836 if (SYSPARAMS_Save( SPI_SETSCREENREADER_REGKEY,
1837 SPI_SETSCREENREADER_VALNAME,
1840 screen_reader = uiParam;
1841 spi_loaded[spi_idx] = TRUE;
1848 case SPI_GETANIMATION: /* 72 WINVER >= 0x400 */
1850 LPANIMATIONINFO lpAnimInfo = (LPANIMATIONINFO)pvParam;
1852 /* Tell it "disabled" */
1853 if (lpAnimInfo && lpAnimInfo->cbSize == sizeof(ANIMATIONINFO))
1854 lpAnimInfo->iMinAnimate = 0; /* Minimise and restore animation is disabled (nonzero == enabled) */
1859 WINE_SPI_WARN(SPI_SETANIMATION); /* 73 WINVER >= 0x400 */
1861 case SPI_GETFONTSMOOTHING: /* 74 WINVER >= 0x400 */
1862 if (!pvParam) return FALSE;
1864 spi_idx = SPI_SETFONTSMOOTHING_IDX;
1865 if (!spi_loaded[spi_idx])
1869 if (SYSPARAMS_Load( SPI_SETFONTSMOOTHING_REGKEY,
1870 SPI_SETFONTSMOOTHING_VALNAME, buf, sizeof(buf) ))
1872 spi_loaded[spi_idx] = TRUE;
1873 if (buf[0] == 0x01 || buf[0] == 0x02) /* 0x01 for 95/98/NT, 0x02 for 98/ME/2k/XP */
1875 font_smoothing = TRUE;
1880 *(BOOL *)pvParam = font_smoothing;
1884 WINE_SPI_FIXME(SPI_SETFONTSMOOTHING); /* 75 WINVER >= 0x400 */
1886 WINE_SPI_FIXME(SPI_SETDRAGWIDTH); /* 76 WINVER >= 0x400 */
1887 WINE_SPI_FIXME(SPI_SETDRAGHEIGHT); /* 77 WINVER >= 0x400 */
1889 WINE_SPI_FIXME(SPI_SETHANDHELD); /* 78 WINVER >= 0x400 */
1891 WINE_SPI_FIXME(SPI_GETLOWPOWERTIMEOUT); /* 79 WINVER >= 0x400 */
1892 WINE_SPI_FIXME(SPI_GETPOWEROFFTIMEOUT); /* 80 WINVER >= 0x400 */
1893 WINE_SPI_FIXME(SPI_SETLOWPOWERTIMEOUT); /* 81 WINVER >= 0x400 */
1894 WINE_SPI_FIXME(SPI_SETPOWEROFFTIMEOUT); /* 82 WINVER >= 0x400 */
1896 case SPI_GETLOWPOWERACTIVE: /* 83 WINVER >= 0x400 */
1899 SetLastError(ERROR_INVALID_PARAMETER);
1902 if (!spi_loaded[SPI_GETLOWPOWERACTIVE])
1905 if(SYSPARAMS_Load(SPI_GETLOPOWERACTIVE_REGKEY, SPI_GETLOPOWERACTIVE_VALNAME, buf, sizeof(buf)))
1907 spi_loaded[SPI_GETLOWPOWERACTIVE] = TRUE;
1908 lowpoweractive = atoiW(buf);
1912 *(BOOL *)pvParam = lowpoweractive;
1915 WINE_SPI_FIXME(SPI_GETPOWEROFFACTIVE); /* 84 WINVER >= 0x400 */
1916 WINE_SPI_FIXME(SPI_SETLOWPOWERACTIVE); /* 85 WINVER >= 0x400 */
1917 WINE_SPI_FIXME(SPI_SETPOWEROFFACTIVE); /* 86 WINVER >= 0x400 */
1919 WINE_SPI_FIXME(SPI_SETCURSORS); /* 87 WINVER >= 0x400 */
1920 WINE_SPI_FIXME(SPI_SETICONS); /* 88 WINVER >= 0x400 */
1922 case SPI_GETDEFAULTINPUTLANG: /* 89 WINVER >= 0x400 */
1923 ret = GetKeyboardLayout(0) ? TRUE : FALSE;
1926 WINE_SPI_FIXME(SPI_SETDEFAULTINPUTLANG); /* 90 WINVER >= 0x400 */
1928 WINE_SPI_FIXME(SPI_SETLANGTOGGLE); /* 91 WINVER >= 0x400 */
1930 case SPI_GETWINDOWSEXTENSION: /* 92 WINVER >= 0x400 */
1931 WARN("pretend no support for Win9x Plus! for now.\n");
1932 ret = FALSE; /* yes, this is the result value */
1935 WINE_SPI_FIXME(SPI_SETMOUSETRAILS); /* 93 WINVER >= 0x400 */
1936 WINE_SPI_FIXME(SPI_GETMOUSETRAILS); /* 94 WINVER >= 0x400 */
1938 case SPI_SETSCREENSAVERRUNNING: /* 97 WINVER >= 0x400 */
1940 /* SPI_SCREENSAVERRUNNING is an alias for SPI_SETSCREENSAVERRUNNING */
1943 spi_idx = SPI_SETSCREENSAVERRUNNING_IDX;
1944 wsprintfW(buf, CSu, uiParam);
1946 /* save only temporarily */
1947 if (SYSPARAMS_Save( SPI_SETSCREENSAVERRUNNING_REGKEY,
1948 SPI_SETSCREENSAVERRUNNING_VALNAME,
1951 screensaver_running = uiParam;
1952 spi_loaded[spi_idx] = TRUE;
1959 case SPI_GETMOUSEHOVERWIDTH: /* 98 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
1960 if (!pvParam) return FALSE;
1962 spi_idx = SPI_SETMOUSEHOVERWIDTH_IDX;
1963 if (!spi_loaded[spi_idx])
1967 if (SYSPARAMS_Load( SPI_SETMOUSEHOVERWIDTH_REGKEY,
1968 SPI_SETMOUSEHOVERWIDTH_VALNAME,
1970 mouse_hover_width = atoiW( buf );
1971 spi_loaded[spi_idx] = TRUE;
1973 *(INT *)pvParam = mouse_hover_width;
1976 case SPI_SETMOUSEHOVERWIDTH: /* 99 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
1980 spi_idx = SPI_SETMOUSEHOVERWIDTH_IDX;
1981 wsprintfW(buf, CSu, uiParam);
1983 if (SYSPARAMS_Save( SPI_SETMOUSEHOVERWIDTH_REGKEY,
1984 SPI_SETMOUSEHOVERWIDTH_VALNAME,
1987 mouse_hover_width = uiParam;
1988 spi_loaded[spi_idx] = TRUE;
1995 case SPI_GETMOUSEHOVERHEIGHT: /* 100 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
1996 if (!pvParam) return FALSE;
1998 spi_idx = SPI_SETMOUSEHOVERHEIGHT_IDX;
1999 if (!spi_loaded[spi_idx])
2003 if (SYSPARAMS_Load( SPI_SETMOUSEHOVERHEIGHT_REGKEY,
2004 SPI_SETMOUSEHOVERHEIGHT_VALNAME,
2006 mouse_hover_height = atoiW( buf );
2008 spi_loaded[spi_idx] = TRUE;
2010 *(INT *)pvParam = mouse_hover_height;
2013 case SPI_SETMOUSEHOVERHEIGHT: /* 101 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2017 spi_idx = SPI_SETMOUSEHOVERHEIGHT_IDX;
2018 wsprintfW(buf, CSu, uiParam);
2020 if (SYSPARAMS_Save( SPI_SETMOUSEHOVERHEIGHT_REGKEY,
2021 SPI_SETMOUSEHOVERHEIGHT_VALNAME,
2024 mouse_hover_height = uiParam;
2025 spi_loaded[spi_idx] = TRUE;
2032 case SPI_GETMOUSEHOVERTIME: /* 102 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2033 if (!pvParam) return FALSE;
2035 spi_idx = SPI_SETMOUSEHOVERTIME_IDX;
2036 if (!spi_loaded[spi_idx])
2040 if (SYSPARAMS_Load( SPI_SETMOUSEHOVERTIME_REGKEY,
2041 SPI_SETMOUSEHOVERTIME_VALNAME,
2043 mouse_hover_time = atoiW( buf );
2045 spi_loaded[spi_idx] = TRUE;
2047 *(INT *)pvParam = mouse_hover_time;
2050 case SPI_SETMOUSEHOVERTIME: /* 103 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2054 spi_idx = SPI_SETMOUSEHOVERTIME_IDX;
2055 wsprintfW(buf, CSu, uiParam);
2057 if (SYSPARAMS_Save( SPI_SETMOUSEHOVERTIME_REGKEY,
2058 SPI_SETMOUSEHOVERTIME_VALNAME,
2061 mouse_hover_time = uiParam;
2062 spi_loaded[spi_idx] = TRUE;
2069 case SPI_GETWHEELSCROLLLINES: /* 104 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2070 if (!pvParam) return FALSE;
2072 spi_idx = SPI_SETMOUSESCROLLLINES_IDX;
2073 if (!spi_loaded[spi_idx])
2077 if (SYSPARAMS_Load( SPI_SETMOUSESCROLLLINES_REGKEY,
2078 SPI_SETMOUSESCROLLLINES_VALNAME,
2080 mouse_scroll_lines = atoiW( buf );
2082 spi_loaded[spi_idx] = TRUE;
2084 *(INT *)pvParam = mouse_scroll_lines;
2087 case SPI_SETWHEELSCROLLLINES: /* 105 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2091 spi_idx = SPI_SETMOUSESCROLLLINES_IDX;
2092 wsprintfW(buf, CSu, uiParam);
2094 if (SYSPARAMS_Save( SPI_SETMOUSESCROLLLINES_REGKEY,
2095 SPI_SETMOUSESCROLLLINES_VALNAME,
2098 mouse_scroll_lines = uiParam;
2099 spi_loaded[spi_idx] = TRUE;
2106 case SPI_GETMENUSHOWDELAY: /* 106 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2107 if (!pvParam) return FALSE;
2109 spi_idx = SPI_SETMENUSHOWDELAY_IDX;
2110 if (!spi_loaded[spi_idx])
2114 if (SYSPARAMS_Load( SPI_SETMENUSHOWDELAY_REGKEY,
2115 SPI_SETMENUSHOWDELAY_VALNAME,
2117 menu_show_delay = atoiW( buf );
2119 spi_loaded[spi_idx] = TRUE;
2121 *(INT *)pvParam = menu_show_delay;
2124 case SPI_SETMENUSHOWDELAY: /* 107 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2128 spi_idx = SPI_SETMENUSHOWDELAY_IDX;
2129 wsprintfW(buf, CSu, uiParam);
2131 if (SYSPARAMS_Save( SPI_SETMENUSHOWDELAY_REGKEY,
2132 SPI_SETMENUSHOWDELAY_VALNAME,
2135 menu_show_delay = uiParam;
2136 spi_loaded[spi_idx] = TRUE;
2143 WINE_SPI_FIXME(SPI_GETSHOWIMEUI); /* 110 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2144 WINE_SPI_FIXME(SPI_SETSHOWIMEUI); /* 111 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2145 WINE_SPI_FIXME(SPI_GETMOUSESPEED); /* 112 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2146 WINE_SPI_FIXME(SPI_SETMOUSESPEED); /* 113 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2148 case SPI_GETSCREENSAVERRUNNING: /* 114 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2149 if (!pvParam) return FALSE;
2151 spi_idx = SPI_SETSCREENSAVERRUNNING_IDX;
2152 if (!spi_loaded[spi_idx])
2156 if (SYSPARAMS_Load( SPI_SETSCREENSAVERRUNNING_REGKEY,
2157 SPI_SETSCREENSAVERRUNNING_VALNAME, buf, sizeof(buf) ))
2158 screensaver_running = atoiW( buf );
2159 spi_loaded[spi_idx] = TRUE;
2162 *(BOOL *)pvParam = screensaver_running;
2165 case SPI_GETDESKWALLPAPER: /* 115 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2167 WCHAR buf[MAX_PATH];
2169 if (!pvParam) return FALSE;
2171 if (uiParam > MAX_PATH)
2176 if (SYSPARAMS_Load(SPI_SETDESKWALLPAPER_REGKEY, SPI_SETDESKWALLPAPER_VALNAME, buf, sizeof(buf)))
2178 lstrcpynW((WCHAR*)pvParam, buf, uiParam);
2182 /* Return an empty string */
2183 memset((WCHAR*)pvParam, 0, uiParam);
2189 WINE_SPI_FIXME(SPI_GETACTIVEWINDOWTRACKING);/* 0x1000 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2190 WINE_SPI_FIXME(SPI_SETACTIVEWINDOWTRACKING);/* 0x1001 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2191 WINE_SPI_FIXME(SPI_GETMENUANIMATION); /* 0x1002 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2192 WINE_SPI_FIXME(SPI_SETMENUANIMATION); /* 0x1003 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2193 WINE_SPI_FIXME(SPI_GETCOMBOBOXANIMATION); /* 0x1004 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2194 WINE_SPI_FIXME(SPI_SETCOMBOBOXANIMATION); /* 0x1005 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2196 case SPI_GETLISTBOXSMOOTHSCROLLING: /* 0x1006 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2197 if (!pvParam) return FALSE;
2199 spi_idx = SPI_SETLISTBOXSMOOTHSCROLLING_IDX;
2200 if (!spi_loaded[spi_idx])
2204 if (SYSPARAMS_Load( SPI_SETLISTBOXSMOOTHSCROLLING_REGKEY,
2205 SPI_SETLISTBOXSMOOTHSCROLLING_VALNAME, buf, sizeof(buf) ))
2207 if ((buf[0]&0x01) == 0x01)
2209 listbox_smoothscrolling = TRUE;
2212 spi_loaded[spi_idx] = TRUE;
2215 *(BOOL *)pvParam = listbox_smoothscrolling;
2219 WINE_SPI_FIXME(SPI_SETLISTBOXSMOOTHSCROLLING);/* 0x1007 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2221 case SPI_GETGRADIENTCAPTIONS: /* 0x1008 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2222 if (!pvParam) return FALSE;
2224 spi_idx = SPI_SETGRADIENTCAPTIONS_IDX;
2225 if (!spi_loaded[spi_idx])
2229 if (SYSPARAMS_Load( SPI_USERPREFERENCEMASK_REGKEY,
2230 SPI_USERPREFERENCEMASK_VALNAME, buf, sizeof(buf) ))
2232 if ((buf[0]&0x10) == 0x10)
2234 gradient_captions = TRUE;
2237 spi_loaded[spi_idx] = TRUE;
2240 *(BOOL *)pvParam = gradient_captions;
2244 WINE_SPI_FIXME(SPI_SETGRADIENTCAPTIONS); /* 0x1009 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2246 case SPI_GETKEYBOARDCUES: /* 0x100A _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2247 if (!pvParam) return FALSE;
2249 spi_idx = SPI_SETKEYBOARDCUES_IDX;
2250 if (!spi_loaded[spi_idx])
2254 if (SYSPARAMS_Load( SPI_USERPREFERENCEMASK_REGKEY,
2255 SPI_USERPREFERENCEMASK_VALNAME, buf, sizeof(buf) ))
2257 if ((buf[0]&0x20) == 0x20)
2259 keyboard_cues = TRUE;
2262 spi_loaded[spi_idx] = TRUE;
2265 *(BOOL *)pvParam = keyboard_cues;
2269 WINE_SPI_FIXME(SPI_SETKEYBOARDCUES); /* 0x100B _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2270 WINE_SPI_FIXME(SPI_GETACTIVEWNDTRKZORDER); /* 0x100C _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2271 WINE_SPI_FIXME(SPI_SETACTIVEWNDTRKZORDER); /* 0x100D _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2272 case SPI_GETHOTTRACKING: /* 0x100E _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2273 if (!pvParam) return FALSE;
2275 spi_idx = SPI_SETHOTTRACKING_IDX;
2276 if (!spi_loaded[spi_idx])
2280 if (SYSPARAMS_Load( SPI_USERPREFERENCEMASK_REGKEY,
2281 SPI_USERPREFERENCEMASK_VALNAME, buf, sizeof(buf) ))
2283 if ((buf[0]&0x80) == 0x80)
2285 hot_tracking = TRUE;
2288 spi_loaded[spi_idx] = TRUE;
2291 *(BOOL *)pvParam = hot_tracking;
2295 WINE_SPI_FIXME(SPI_SETHOTTRACKING); /* 0x100F _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2296 WINE_SPI_FIXME(SPI_GETSELECTIONFADE); /* 0x1014 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2297 WINE_SPI_FIXME(SPI_SETSELECTIONFADE); /* 0x1015 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2298 WINE_SPI_FIXME(SPI_GETDROPSHADOW); /* 0x1024 _WIN32_WINNT >= 0x510 */
2299 WINE_SPI_FIXME(SPI_SETDROPSHADOW); /* 0x1025 _WIN32_WINNT >= 0x510 */
2300 WINE_SPI_FIXME(SPI_GETFOREGROUNDLOCKTIMEOUT);/* 0x2000 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2301 WINE_SPI_FIXME(SPI_SETFOREGROUNDLOCKTIMEOUT);/* 0x2001 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2302 WINE_SPI_FIXME(SPI_GETACTIVEWNDTRKTIMEOUT); /* 0x2002 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2303 WINE_SPI_FIXME(SPI_SETACTIVEWNDTRKTIMEOUT); /* 0x2003 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2304 WINE_SPI_FIXME(SPI_GETFOREGROUNDFLASHCOUNT);/* 0x2004 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2305 WINE_SPI_FIXME(SPI_SETFOREGROUNDFLASHCOUNT);/* 0x2005 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2306 WINE_SPI_FIXME(SPI_GETCARETWIDTH); /* 0x2006 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2307 WINE_SPI_FIXME(SPI_SETCARETWIDTH); /* 0x2007 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2308 WINE_SPI_FIXME(SPI_GETMOUSECLICKLOCKTIME); /* 0x2008 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2309 WINE_SPI_FIXME(SPI_SETMOUSECLICKLOCKTIME); /* 0x2009 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2310 WINE_SPI_FIXME(SPI_GETFONTSMOOTHINGTYPE); /* 0x200A _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2311 WINE_SPI_FIXME(SPI_SETFONTSMOOTHINGTYPE); /* 0x200B _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2314 FIXME( "Unknown action: %u\n", uiAction );
2315 SetLastError( ERROR_INVALID_SPI_VALUE );
2321 SYSPARAMS_NotifyChange( uiAction, fWinIni );
2324 #undef WINE_SPI_FIXME
2325 #undef WINE_SPI_WARN
2329 /***********************************************************************
2330 * SystemParametersInfo (USER.483)
2332 BOOL16 WINAPI SystemParametersInfo16( UINT16 uAction, UINT16 uParam,
2333 LPVOID lpvParam, UINT16 fuWinIni )
2337 TRACE("(%u, %u, %p, %u)\n", uAction, uParam, lpvParam, fuWinIni);
2341 case SPI_GETBEEP: /* 1 */
2342 case SPI_GETSCREENSAVEACTIVE: /* 16 */
2343 case SPI_GETICONTITLEWRAP: /* 25 */
2344 case SPI_GETMENUDROPALIGNMENT: /* 27 */
2345 case SPI_GETFASTTASKSWITCH: /* 35 */
2346 case SPI_GETDRAGFULLWINDOWS: /* 38 WINVER >= 0x0400 */
2349 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2350 if (ret && lpvParam)
2351 *(BOOL16 *)lpvParam = tmp;
2355 case SPI_GETBORDER: /* 5 */
2356 case SPI_ICONHORIZONTALSPACING: /* 13 */
2357 case SPI_GETSCREENSAVETIMEOUT: /* 14 */
2358 case SPI_GETGRIDGRANULARITY: /* 18 */
2359 case SPI_GETKEYBOARDDELAY: /* 22 */
2360 case SPI_ICONVERTICALSPACING: /* 24 */
2363 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2364 if (ret && lpvParam)
2365 *(INT16 *)lpvParam = tmp;
2369 case SPI_GETKEYBOARDSPEED: /* 10 */
2372 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2373 if (ret && lpvParam)
2374 *(WORD *)lpvParam = tmp;
2378 case SPI_GETICONTITLELOGFONT: /* 31 */
2381 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2382 if (ret && lpvParam)
2383 SYSPARAMS_LogFont32ATo16( &tmp, (LPLOGFONT16)lpvParam );
2387 case SPI_GETNONCLIENTMETRICS: /* 41 WINVER >= 0x400 */
2389 NONCLIENTMETRICSA tmp;
2390 LPNONCLIENTMETRICS16 lpnm16 = (LPNONCLIENTMETRICS16)lpvParam;
2391 if (lpnm16 && lpnm16->cbSize == sizeof(NONCLIENTMETRICS16))
2393 tmp.cbSize = sizeof(NONCLIENTMETRICSA);
2394 ret = SystemParametersInfoA( uAction, uParam, &tmp, fuWinIni );
2396 SYSPARAMS_NonClientMetrics32ATo16( &tmp, lpnm16 );
2398 else /* winfile 95 sets cbSize to 340 */
2399 ret = SystemParametersInfoA( uAction, uParam, lpvParam, fuWinIni );
2403 case SPI_GETWORKAREA: /* 48 WINVER >= 0x400 */
2406 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2407 if (ret && lpvParam)
2409 RECT16 *r16 = (RECT16 *)lpvParam;
2410 r16->left = tmp.left;
2412 r16->right = tmp.right;
2413 r16->bottom = tmp.bottom;
2418 case SPI_GETMOUSEHOVERWIDTH: /* 98 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2419 case SPI_GETMOUSEHOVERHEIGHT: /* 100 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2420 case SPI_GETMOUSEHOVERTIME: /* 102 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2423 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2424 if (ret && lpvParam)
2425 *(UINT16 *)lpvParam = tmp;
2430 ret = SystemParametersInfoA( uAction, uParam, lpvParam, fuWinIni );
2436 /***********************************************************************
2437 * SystemParametersInfoA (USER32.@)
2439 BOOL WINAPI SystemParametersInfoA( UINT uiAction, UINT uiParam,
2440 PVOID pvParam, UINT fuWinIni )
2444 TRACE("(%u, %u, %p, %u)\n", uiAction, uiParam, pvParam, fuWinIni);
2448 case SPI_SETDESKWALLPAPER: /* 20 */
2449 case SPI_SETDESKPATTERN: /* 21 */
2453 if (!MultiByteToWideChar( CP_ACP, 0, (LPSTR)pvParam, -1,
2454 buffer, sizeof(buffer)/sizeof(WCHAR) ))
2455 buffer[sizeof(buffer)/sizeof(WCHAR)-1] = 0;
2456 ret = SystemParametersInfoW( uiAction, uiParam, pvParam ? buffer : NULL, fuWinIni );
2460 case SPI_GETICONTITLELOGFONT: /* 31 */
2463 ret = SystemParametersInfoW( uiAction, uiParam, pvParam ? &tmp : NULL, fuWinIni );
2465 SYSPARAMS_LogFont32WTo32A( &tmp, (LPLOGFONTA)pvParam );
2469 case SPI_GETNONCLIENTMETRICS: /* 41 WINVER >= 0x400 */
2471 NONCLIENTMETRICSW tmp;
2472 LPNONCLIENTMETRICSA lpnmA = (LPNONCLIENTMETRICSA)pvParam;
2473 if (lpnmA && lpnmA->cbSize == sizeof(NONCLIENTMETRICSA))
2475 tmp.cbSize = sizeof(NONCLIENTMETRICSW);
2476 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2478 SYSPARAMS_NonClientMetrics32WTo32A( &tmp, lpnmA );
2485 case SPI_GETICONMETRICS: /* 45 WINVER >= 0x400 */
2488 LPICONMETRICSA lpimA = (LPICONMETRICSA)pvParam;
2489 if (lpimA && lpimA->cbSize == sizeof(ICONMETRICSA))
2491 tmp.cbSize = sizeof(ICONMETRICSW);
2492 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2495 lpimA->iHorzSpacing = tmp.iHorzSpacing;
2496 lpimA->iVertSpacing = tmp.iVertSpacing;
2497 lpimA->iTitleWrap = tmp.iTitleWrap;
2498 SYSPARAMS_LogFont32WTo32A( &tmp.lfFont, &lpimA->lfFont );
2506 case SPI_GETHIGHCONTRAST: /* 66 WINVER >= 0x400 */
2509 LPHIGHCONTRASTA lphcA = (LPHIGHCONTRASTA)pvParam;
2510 if (lphcA && lphcA->cbSize == sizeof(HIGHCONTRASTA))
2512 tmp.cbSize = sizeof(HIGHCONTRASTW);
2513 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2516 lphcA->dwFlags = tmp.dwFlags;
2517 lphcA->lpszDefaultScheme = NULL; /* FIXME? */
2526 ret = SystemParametersInfoW( uiAction, uiParam, pvParam, fuWinIni );
2533 /***********************************************************************
2534 * GetSystemMetrics (USER32.@)
2536 INT WINAPI GetSystemMetrics( INT index )
2538 /* some metrics are dynamic */
2542 case SM_CXFULLSCREEN:
2543 case SM_CXVIRTUALSCREEN:
2544 return GetDeviceCaps( display_dc, HORZRES );
2546 case SM_CYVIRTUALSCREEN:
2547 return GetDeviceCaps( display_dc, VERTRES );
2548 case SM_CYFULLSCREEN:
2549 return GetDeviceCaps( display_dc, VERTRES ) - sysMetrics[SM_CYCAPTION];
2551 /* FIXME: How do I calculate these? */
2553 return GetDeviceCaps( display_dc, HORZRES ) + 4 + 2 * sysMetrics[SM_CXFRAME];
2555 return GetDeviceCaps( display_dc, VERTRES ) + 4 + 2 * sysMetrics[SM_CYFRAME];
2556 case SM_CXMAXIMIZED:
2557 return GetDeviceCaps( display_dc, HORZRES ) + 2 * sysMetrics[SM_CXFRAME];
2558 case SM_CYMAXIMIZED:
2559 return GetDeviceCaps( display_dc, VERTRES ) + 2 * sysMetrics[SM_CYFRAME];
2562 if ((index < 0) || (index > SM_CMETRICS)) return 0;
2563 return sysMetrics[index];
2568 /**********************************************************************
2569 * SetDoubleClickTime (USER32.@)
2571 BOOL WINAPI SetDoubleClickTime( UINT interval )
2573 return SystemParametersInfoW(SPI_SETDOUBLECLICKTIME, interval, 0, 0);
2577 /**********************************************************************
2578 * GetDoubleClickTime (USER32.@)
2580 UINT WINAPI GetDoubleClickTime(void)
2584 if (!spi_loaded[SPI_SETDOUBLECLICKTIME_IDX])
2586 if (SYSPARAMS_Load( SPI_SETDOUBLECLICKTIME_REGKEY,
2587 SPI_SETDOUBLECLICKTIME_VALNAME,
2590 double_click_time = atoiW( buf );
2591 if (!double_click_time) double_click_time = 500;
2593 spi_loaded[SPI_SETDOUBLECLICKTIME_IDX] = TRUE;
2595 return double_click_time;