Store the windows and system directories as long path names.
[wine.git] / windows / sysparams.c
blobe77de8c6f1c73b34fdb06106dd1afd29c8293db3
1 /*
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
21 #include "config.h"
23 #include <stdarg.h>
24 #include <stdio.h>
25 #include <stdlib.h>
26 #include <string.h>
27 #include "windef.h"
28 #include "winbase.h"
29 #include "winnls.h"
30 #include "wingdi.h"
31 #include "winreg.h"
32 #include "wine/winuser16.h"
33 #include "winerror.h"
35 #include "controls.h"
36 #include "user.h"
37 #include "wine/unicode.h"
38 #include "wine/debug.h"
40 WINE_DEFAULT_DEBUG_CHANNEL(system);
42 /* System parameter indexes */
43 #define SPI_SETBEEP_IDX 0
44 #define SPI_SETMOUSE_IDX 1
45 #define SPI_SETBORDER_IDX 2
46 #define SPI_SETKEYBOARDSPEED_IDX 3
47 #define SPI_ICONHORIZONTALSPACING_IDX 4
48 #define SPI_SETSCREENSAVETIMEOUT_IDX 5
49 #define SPI_SETGRIDGRANULARITY_IDX 6
50 #define SPI_SETKEYBOARDDELAY_IDX 7
51 #define SPI_ICONVERTICALSPACING_IDX 8
52 #define SPI_SETICONTITLEWRAP_IDX 9
53 #define SPI_SETMENUDROPALIGNMENT_IDX 10
54 #define SPI_SETDOUBLECLKWIDTH_IDX 11
55 #define SPI_SETDOUBLECLKHEIGHT_IDX 12
56 #define SPI_SETDOUBLECLICKTIME_IDX 13
57 #define SPI_SETMOUSEBUTTONSWAP_IDX 14
58 #define SPI_SETDRAGFULLWINDOWS_IDX 15
59 #define SPI_SETWORKAREA_IDX 16
60 #define SPI_SETSHOWSOUNDS_IDX 17
61 #define SPI_SETKEYBOARDPREF_IDX 18
62 #define SPI_SETSCREENREADER_IDX 19
63 #define SPI_SETSCREENSAVERRUNNING_IDX 20
64 #define SPI_SETFONTSMOOTHING_IDX 21
65 #define SPI_SETKEYBOARDCUES_IDX 22
66 #define SPI_SETGRADIENTCAPTIONS_IDX 23
67 #define SPI_SETHOTTRACKING_IDX 24
68 #define SPI_SETLISTBOXSMOOTHSCROLLING_IDX 25
69 #define SPI_SETMOUSEHOVERWIDTH_IDX 26
70 #define SPI_SETMOUSEHOVERHEIGHT_IDX 27
71 #define SPI_SETMOUSEHOVERTIME_IDX 28
72 #define SPI_SETMOUSESCROLLLINES_IDX 29
73 #define SPI_SETMENUSHOWDELAY_IDX 30
75 #define SPI_WINE_IDX SPI_SETMENUSHOWDELAY_IDX
77 /**
78 * Names of the registry subkeys of HKEY_CURRENT_USER key and value names
79 * for the system parameters.
80 * Names of the keys are created by adding string "_REGKEY" to
81 * "SET" action names, value names are created by adding "_REG_NAME"
82 * to the "SET" action name.
84 static const WCHAR SPI_SETBEEP_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','S','o','u','n','d',0};
85 static const WCHAR SPI_SETBEEP_VALNAME[]= {'B','e','e','p',0};
86 static const WCHAR SPI_SETMOUSE_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
87 static const WCHAR SPI_SETMOUSE_VALNAME1[]= {'M','o','u','s','e','T','h','r','e','s','h','o','l','d','1',0};
88 static const WCHAR SPI_SETMOUSE_VALNAME2[]= {'M','o','u','s','e','T','h','r','e','s','h','o','l','d','2',0};
89 static const WCHAR SPI_SETMOUSE_VALNAME3[]= {'M','o','u','s','e','S','p','e','e','d',0};
90 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};
91 static const WCHAR SPI_SETBORDER_VALNAME[]= {'B','o','r','d','e','r','W','i','d','t','h',0};
92 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};
93 static const WCHAR SPI_SETKEYBOARDSPEED_VALNAME[]= {'K','e','y','b','o','a','r','d','S','p','e','e','d',0};
94 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','\\',
95 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
96 static const WCHAR SPI_ICONHORIZONTALSPACING_VALNAME[]= {'I','c','o','n','S','p','a','c','i','n','g',0};
97 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};
98 static const WCHAR SPI_SETSCREENSAVETIMEOUT_VALNAME[]= {'S','c','r','e','e','n','S','a','v','e','T','i','m','e','O','u','t',0};
99 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};
100 static const WCHAR SPI_SETSCREENSAVEACTIVE_VALNAME[]= {'S','c','r','e','e','n','S','a','v','e','A','c','t','i','v','e',0};
101 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};
102 static const WCHAR SPI_SETGRIDGRANULARITY_VALNAME[]= {'G','r','i','d','G','r','a','n','u','l','a','r','i','t','y',0};
103 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};
104 static const WCHAR SPI_SETKEYBOARDDELAY_VALNAME[]= {'K','e','y','b','o','a','r','d','D','e','l','a','y',0};
105 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','\\',
106 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
107 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};
108 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','\\',
109 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
110 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};
111 static const WCHAR SPI_SETICONTITLEWRAP_VALNAME[]= {'I','c','o','n','T','i','t','l','e','W','r','a','p',0};
112 static const WCHAR SPI_SETMENUDROPALIGNMENT_REGKEY1[]= {'S','o','f','t','w','a','r','e','\\',
113 'M','i','c','r','o','s','o','f','t','\\',
114 'W','i','n','d','o','w','s',' ','N','T','\\',
115 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
116 'W','i','n','d','o','w','s',0};
117 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};
118 static const WCHAR SPI_SETMENUDROPALIGNMENT_VALNAME[]= {'M','e','n','u','D','r','o','p','A','l','i','g','n','m','e','n','t',0};
119 static const WCHAR SPI_SETDOUBLECLKWIDTH_REGKEY1[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
120 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};
121 static const WCHAR SPI_SETDOUBLECLKWIDTH_VALNAME[]= {'D','o','u','b','l','e','C','l','i','c','k','W','i','d','t','h',0};
122 static const WCHAR SPI_SETDOUBLECLKHEIGHT_REGKEY1[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
123 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};
124 static const WCHAR SPI_SETDOUBLECLKHEIGHT_VALNAME[]= {'D','o','u','b','l','e','C','l','i','c','k','H','e','i','g','h','t',0};
125 static const WCHAR SPI_SETDOUBLECLICKTIME_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
126 static const WCHAR SPI_SETDOUBLECLICKTIME_VALNAME[]= {'D','o','u','b','l','e','C','l','i','c','k','S','p','e','e','d',0};
127 static const WCHAR SPI_SETMOUSEBUTTONSWAP_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
128 static const WCHAR SPI_SETMOUSEBUTTONSWAP_VALNAME[]= {'S','w','a','p','M','o','u','s','e','B','u','t','t','o','n','s',0};
129 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};
130 static const WCHAR SPI_SETDRAGFULLWINDOWS_VALNAME[]= {'D','r','a','g','F','u','l','l','W','i','n','d','o','w','s',0};
131 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};
132 static const WCHAR SPI_SETWORKAREA_VALNAME[]= {'W','I','N','E','_','W','o','r','k','A','r','e','a',0};
133 static const WCHAR SPI_SETSHOWSOUNDS_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\',
134 'A','c','c','e','s','s','i','b','i','l','i','t','y','\\',
135 'S','h','o','w','S','o','u','n','d','s',0};
136 static const WCHAR SPI_SETSHOWSOUNDS_VALNAME[]= {'O','n',0};
137 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};
138 static const WCHAR SPI_SETDESKWALLPAPER_VALNAME[]= {'W','a','l','l','p','a','p','e','r',0};
139 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};
140 static const WCHAR SPI_SETFONTSMOOTHING_VALNAME[]= {'F','o','n','t','S','m','o','o','t','h','i','n','g',0};
141 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};
142 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};
143 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};
144 static const WCHAR SPI_SETLISTBOXSMOOTHSCROLLING_VALNAME[]= {'S','m','o','o','t','h','S','c','r','o','l','l',0};
145 static const WCHAR SPI_SETMOUSEHOVERWIDTH_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
146 static const WCHAR SPI_SETMOUSEHOVERWIDTH_VALNAME[]= {'M','o','u','s','e','H','o','v','e','r','W','i','d','t','h',0};
147 static const WCHAR SPI_SETMOUSEHOVERHEIGHT_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
148 static const WCHAR SPI_SETMOUSEHOVERHEIGHT_VALNAME[]= {'M','o','u','s','e','H','o','v','e','r','H','e','i','g','h','t',0};
149 static const WCHAR SPI_SETMOUSEHOVERTIME_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
150 static const WCHAR SPI_SETMOUSEHOVERTIME_VALNAME[]= {'M','o','u','s','e','H','o','v','e','r','T','i','m','e',0};
151 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};
152 static const WCHAR SPI_SETMOUSESCROLLLINES_VALNAME[]= {'W','h','e','e','l','S','c','r','o','l','l','L','i','n','e','s',0};
153 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};
154 static const WCHAR SPI_SETMENUSHOWDELAY_VALNAME[]= {'M','e','n','u','S','h','o','w','D','e','l','a','y',0};
156 /* FIXME - real values */
157 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};
158 static const WCHAR SPI_SETKEYBOARDPREF_VALNAME[]= {'W','I','N','E','_','K','e','y','b','o','a','r','d','P','r','e','f',0};
159 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};
160 static const WCHAR SPI_SETSCREENREADER_VALNAME[]= {'W','I','N','E','_','S','c','r','e','e','n','R','e','a','d','e','r',0};
161 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};
162 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};
164 /* volatile registry branch under CURRENT_USER_REGKEY for temporary values storage */
165 static const WCHAR WINE_CURRENT_USER_REGKEY[] = {'W','i','n','e',0};
168 static const WCHAR Yes[]= {'Y','e','s',0};
169 static const WCHAR No[]= {'N','o',0};
170 static const WCHAR Desktop[]= {'D','e','s','k','t','o','p',0};
171 static const WCHAR Pattern[]= {'P','a','t','t','e','r','n',0};
172 static const WCHAR MenuFont[]= {'M','e','n','u','F','o','n','t',0};
173 static const WCHAR MenuFontSize[]= {'M','e','n','u','F','o','n','t','S','i','z','e',0};
174 static const WCHAR System[]= {'S','y','s','t','e','m',0};
175 static const WCHAR IconTitleSize[]= {'I','c','o','n','T','i','t','l','e','S','i','z','e',0};
176 static const WCHAR IconTitleFaceName[]= {'I','c','o','n','T','i','t','l','e','F','a','c','e','N','a','m','e',0};
177 static const WCHAR defPattern[]= {'1','7','0',' ','8','5',' ','1','7','0',' ','8','5',' ','1','7','0',' ','8','5',
178 ' ','1','7','0',' ','8','5',0};
179 static const WCHAR CSu[]= {'%','u',0};
180 static const WCHAR CSd[]= {'%','d',0};
182 /* Indicators whether system parameter value is loaded */
183 static char spi_loaded[SPI_WINE_IDX + 1];
185 static BOOL notify_change = TRUE;
187 /* System parameters storage */
188 static BOOL beep_active = TRUE;
189 static int mouse_threshold1 = 6;
190 static int mouse_threshold2 = 10;
191 static int mouse_speed = 1;
192 static int border = 1;
193 static int keyboard_speed = 31;
194 static int screensave_timeout = 300;
195 static int grid_granularity = 0;
196 static int keyboard_delay = 1;
197 static BOOL icon_title_wrap = TRUE;
198 static int double_click_time = 500;
199 static BOOL drag_full_windows = FALSE;
200 static RECT work_area;
201 static BOOL keyboard_pref = TRUE;
202 static BOOL screen_reader = FALSE;
203 static int mouse_hover_width = 4;
204 static int mouse_hover_height = 4;
205 static int mouse_hover_time = 400;
206 static int mouse_scroll_lines = 3;
207 static int menu_show_delay = 400;
208 static BOOL screensaver_running = FALSE;
209 static BOOL font_smoothing = FALSE;
210 static BOOL keyboard_cues = FALSE;
211 static BOOL gradient_captions = FALSE;
212 static BOOL listbox_smoothscrolling = FALSE;
213 static BOOL hot_tracking = FALSE;
215 /***********************************************************************
216 * GetTimerResolution (USER.14)
218 LONG WINAPI GetTimerResolution16(void)
220 return (1000);
223 /***********************************************************************
224 * ControlPanelInfo (USER.273)
226 void WINAPI ControlPanelInfo16( INT16 nInfoType, WORD wData, LPSTR lpBuffer )
228 FIXME("(%d, %04x, %p): stub.\n", nInfoType, wData, lpBuffer);
231 /* This function is a copy of the one in objects/font.c */
232 static void SYSPARAMS_LogFont32ATo16( const LOGFONTA* font32, LPLOGFONT16 font16 )
234 font16->lfHeight = font32->lfHeight;
235 font16->lfWidth = font32->lfWidth;
236 font16->lfEscapement = font32->lfEscapement;
237 font16->lfOrientation = font32->lfOrientation;
238 font16->lfWeight = font32->lfWeight;
239 font16->lfItalic = font32->lfItalic;
240 font16->lfUnderline = font32->lfUnderline;
241 font16->lfStrikeOut = font32->lfStrikeOut;
242 font16->lfCharSet = font32->lfCharSet;
243 font16->lfOutPrecision = font32->lfOutPrecision;
244 font16->lfClipPrecision = font32->lfClipPrecision;
245 font16->lfQuality = font32->lfQuality;
246 font16->lfPitchAndFamily = font32->lfPitchAndFamily;
247 lstrcpynA( font16->lfFaceName, font32->lfFaceName, LF_FACESIZE );
250 static void SYSPARAMS_LogFont32WTo32A( const LOGFONTW* font32W, LPLOGFONTA font32A )
252 font32A->lfHeight = font32W->lfHeight;
253 font32A->lfWidth = font32W->lfWidth;
254 font32A->lfEscapement = font32W->lfEscapement;
255 font32A->lfOrientation = font32W->lfOrientation;
256 font32A->lfWeight = font32W->lfWeight;
257 font32A->lfItalic = font32W->lfItalic;
258 font32A->lfUnderline = font32W->lfUnderline;
259 font32A->lfStrikeOut = font32W->lfStrikeOut;
260 font32A->lfCharSet = font32W->lfCharSet;
261 font32A->lfOutPrecision = font32W->lfOutPrecision;
262 font32A->lfClipPrecision = font32W->lfClipPrecision;
263 font32A->lfQuality = font32W->lfQuality;
264 font32A->lfPitchAndFamily = font32W->lfPitchAndFamily;
265 WideCharToMultiByte( CP_ACP, 0, font32W->lfFaceName, -1, font32A->lfFaceName, LF_FACESIZE, NULL, NULL );
266 font32A->lfFaceName[LF_FACESIZE-1] = 0;
269 static void SYSPARAMS_NonClientMetrics32ATo16( const NONCLIENTMETRICSA* lpnm32, LPNONCLIENTMETRICS16 lpnm16 )
271 lpnm16->iBorderWidth = lpnm32->iBorderWidth;
272 lpnm16->iScrollWidth = lpnm32->iScrollWidth;
273 lpnm16->iScrollHeight = lpnm32->iScrollHeight;
274 lpnm16->iCaptionWidth = lpnm32->iCaptionWidth;
275 lpnm16->iCaptionHeight = lpnm32->iCaptionHeight;
276 SYSPARAMS_LogFont32ATo16( &lpnm32->lfCaptionFont, &lpnm16->lfCaptionFont );
277 lpnm16->iSmCaptionWidth = lpnm32->iSmCaptionWidth;
278 lpnm16->iSmCaptionHeight = lpnm32->iSmCaptionHeight;
279 SYSPARAMS_LogFont32ATo16( &lpnm32->lfSmCaptionFont, &lpnm16->lfSmCaptionFont );
280 lpnm16->iMenuWidth = lpnm32->iMenuWidth;
281 lpnm16->iMenuHeight = lpnm32->iMenuHeight;
282 SYSPARAMS_LogFont32ATo16( &lpnm32->lfMenuFont, &lpnm16->lfMenuFont );
283 SYSPARAMS_LogFont32ATo16( &lpnm32->lfStatusFont, &lpnm16->lfStatusFont );
284 SYSPARAMS_LogFont32ATo16( &lpnm32->lfMessageFont, &lpnm16->lfMessageFont );
287 static void SYSPARAMS_NonClientMetrics32WTo32A( const NONCLIENTMETRICSW* lpnm32W, LPNONCLIENTMETRICSA lpnm32A )
289 lpnm32A->iBorderWidth = lpnm32W->iBorderWidth;
290 lpnm32A->iScrollWidth = lpnm32W->iScrollWidth;
291 lpnm32A->iScrollHeight = lpnm32W->iScrollHeight;
292 lpnm32A->iCaptionWidth = lpnm32W->iCaptionWidth;
293 lpnm32A->iCaptionHeight = lpnm32W->iCaptionHeight;
294 SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfCaptionFont, &lpnm32A->lfCaptionFont );
295 lpnm32A->iSmCaptionWidth = lpnm32W->iSmCaptionWidth;
296 lpnm32A->iSmCaptionHeight = lpnm32W->iSmCaptionHeight;
297 SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfSmCaptionFont, &lpnm32A->lfSmCaptionFont );
298 lpnm32A->iMenuWidth = lpnm32W->iMenuWidth;
299 lpnm32A->iMenuHeight = lpnm32W->iMenuHeight;
300 SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfMenuFont, &lpnm32A->lfMenuFont );
301 SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfStatusFont, &lpnm32A->lfStatusFont );
302 SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfMessageFont, &lpnm32A->lfMessageFont );
305 /***********************************************************************
306 * SYSPARAMS_Reset
308 * Sets the system parameter which should be always loaded to
309 * current value stored in registry.
310 * Invalidates lazy loaded parameter, so it will be loaded the next time
311 * it is requested.
313 * Parameters:
314 * uiAction - system parameter to reload value for.
315 * Note, only "SET" values can be used for this parameter.
316 * If uiAction is 0 all system parameters are reset.
318 void SYSPARAMS_Reset( UINT uiAction )
320 #define WINE_RELOAD_SPI(x) \
321 case x: \
322 spi_loaded[x##_IDX] = FALSE; \
323 SystemParametersInfoA( x, 0, dummy_buf, 0 );\
324 if (uiAction) \
325 break
327 #define WINE_IGNORE_SPI(x) \
328 case x: \
329 if (uiAction) \
330 break
332 #define WINE_INVALIDATE_SPI(x) \
333 case x: \
334 spi_loaded[x##_IDX] = FALSE; \
335 break
337 BOOL not_all_processed = TRUE;
338 char dummy_buf[10];
340 /* Execution falls through all the branches for uiAction == 0 */
341 switch (uiAction)
343 case 0:
344 memset( spi_loaded, 0, sizeof(spi_loaded) );
346 WINE_RELOAD_SPI(SPI_SETBORDER);
347 WINE_RELOAD_SPI(SPI_ICONHORIZONTALSPACING);
348 WINE_RELOAD_SPI(SPI_ICONVERTICALSPACING);
349 WINE_IGNORE_SPI(SPI_SETSCREENSAVEACTIVE);
350 WINE_RELOAD_SPI(SPI_SETDOUBLECLKWIDTH);
351 WINE_RELOAD_SPI(SPI_SETDOUBLECLKHEIGHT);
352 WINE_RELOAD_SPI(SPI_SETMOUSEBUTTONSWAP);
353 WINE_RELOAD_SPI(SPI_SETSHOWSOUNDS);
354 WINE_RELOAD_SPI(SPI_SETMENUDROPALIGNMENT);
356 default:
357 if (uiAction)
359 /* lazy loaded parameters */
360 switch (uiAction)
362 WINE_INVALIDATE_SPI(SPI_SETBEEP);
363 WINE_INVALIDATE_SPI(SPI_SETMOUSE);
364 WINE_INVALIDATE_SPI(SPI_SETKEYBOARDSPEED);
365 WINE_INVALIDATE_SPI(SPI_SETSCREENSAVETIMEOUT);
366 WINE_INVALIDATE_SPI(SPI_SETGRIDGRANULARITY);
367 WINE_INVALIDATE_SPI(SPI_SETKEYBOARDDELAY);
368 WINE_INVALIDATE_SPI(SPI_SETICONTITLEWRAP);
369 WINE_INVALIDATE_SPI(SPI_SETDOUBLECLICKTIME);
370 WINE_INVALIDATE_SPI(SPI_SETDRAGFULLWINDOWS);
371 WINE_INVALIDATE_SPI(SPI_SETWORKAREA);
372 WINE_INVALIDATE_SPI(SPI_SETKEYBOARDPREF);
373 WINE_INVALIDATE_SPI(SPI_SETSCREENREADER);
374 WINE_INVALIDATE_SPI(SPI_SETSCREENSAVERRUNNING);
375 default:
376 FIXME( "Unknown action reset: %u\n", uiAction );
377 break;
380 else
381 not_all_processed = FALSE;
382 break;
385 if (!uiAction && not_all_processed)
386 ERR( "Incorrect implementation of SYSPARAMS_Reset. "
387 "Not all params are reloaded.\n" );
388 #undef WINE_INVALIDATE_SPI
389 #undef WINE_IGNORE_SPI
390 #undef WINE_RELOAD_SPI
393 /***********************************************************************
394 * get_volatile_regkey
396 * Return a handle to the volatile registry key used to store
397 * non-permanently modified parameters.
399 static HKEY get_volatile_regkey(void)
401 static HKEY volatile_key;
403 if (!volatile_key)
405 if (RegCreateKeyExW( HKEY_CURRENT_USER, WINE_CURRENT_USER_REGKEY,
406 0, 0, REG_OPTION_VOLATILE, KEY_ALL_ACCESS, 0,
407 &volatile_key, 0 ) != ERROR_SUCCESS)
408 ERR("Can't create wine configuration registry branch\n");
410 return volatile_key;
413 /***********************************************************************
414 * SYSPARAMS_NotifyChange
416 * Sends notification about system parameter update.
418 void SYSPARAMS_NotifyChange( UINT uiAction, UINT fWinIni )
420 static const WCHAR emptyW[1];
422 if (notify_change)
424 if (fWinIni & SPIF_UPDATEINIFILE)
426 if (fWinIni & (SPIF_SENDWININICHANGE | SPIF_SENDCHANGE))
427 SendMessageTimeoutW(HWND_BROADCAST, WM_SETTINGCHANGE,
428 uiAction, (LPARAM) emptyW,
429 SMTO_ABORTIFHUNG, 2000, NULL );
431 else
433 /* FIXME notify other wine processes with internal message */
439 /***********************************************************************
440 * Loads system parameter from user profile.
442 static BOOL SYSPARAMS_Load( LPCWSTR lpRegKey, LPCWSTR lpValName, LPWSTR lpBuf, DWORD count )
444 BOOL ret = FALSE;
445 DWORD type;
446 HKEY hKey;
448 if ((RegOpenKeyW( get_volatile_regkey(), lpRegKey, &hKey ) == ERROR_SUCCESS) ||
449 (RegOpenKeyW( HKEY_CURRENT_USER, lpRegKey, &hKey ) == ERROR_SUCCESS))
451 ret = !RegQueryValueExW( hKey, lpValName, NULL, &type, (LPBYTE)lpBuf, &count);
452 RegCloseKey( hKey );
454 return ret;
457 /***********************************************************************
458 * Saves system parameter to user profile.
460 static BOOL SYSPARAMS_Save( LPCWSTR lpRegKey, LPCWSTR lpValName, LPCWSTR lpValue,
461 UINT fWinIni )
463 HKEY hKey;
464 HKEY hBaseKey;
465 DWORD dwOptions;
466 BOOL ret = FALSE;
468 if (fWinIni & SPIF_UPDATEINIFILE)
470 hBaseKey = HKEY_CURRENT_USER;
471 dwOptions = 0;
473 else
475 hBaseKey = get_volatile_regkey();
476 dwOptions = REG_OPTION_VOLATILE;
479 if (RegCreateKeyExW( hBaseKey, lpRegKey,
480 0, 0, dwOptions, KEY_ALL_ACCESS,
481 0, &hKey, 0 ) == ERROR_SUCCESS)
483 if (RegSetValueExW( hKey, lpValName, 0, REG_SZ,
484 (const BYTE*)lpValue,
485 (strlenW(lpValue) + 1)*sizeof(WCHAR)) == ERROR_SUCCESS)
487 ret = TRUE;
488 if (hBaseKey == HKEY_CURRENT_USER)
489 RegDeleteKeyW( get_volatile_regkey(), lpRegKey );
491 RegCloseKey( hKey );
493 return ret;
497 /***********************************************************************
498 * SYSPARAMS_GetDoubleClickSize
500 * There is no SPI_GETDOUBLECLK* so we export this function instead.
502 void SYSPARAMS_GetDoubleClickSize( INT *width, INT *height )
504 WCHAR buf[10];
506 if (!spi_loaded[SPI_SETDOUBLECLKWIDTH_IDX])
508 if (SYSPARAMS_Load( SPI_SETDOUBLECLKWIDTH_REGKEY1,
509 SPI_SETDOUBLECLKWIDTH_VALNAME, buf, sizeof(buf) ))
511 SYSMETRICS_Set( SM_CXDOUBLECLK, atoiW( buf ) );
513 spi_loaded[SPI_SETDOUBLECLKWIDTH_IDX] = TRUE;
515 if (!spi_loaded[SPI_SETDOUBLECLKHEIGHT_IDX])
517 if (SYSPARAMS_Load( SPI_SETDOUBLECLKHEIGHT_REGKEY1,
518 SPI_SETDOUBLECLKHEIGHT_VALNAME, buf, sizeof(buf) ))
520 SYSMETRICS_Set( SM_CYDOUBLECLK, atoiW( buf ) );
522 spi_loaded[SPI_SETDOUBLECLKHEIGHT_IDX] = TRUE;
524 *width = GetSystemMetrics( SM_CXDOUBLECLK );
525 *height = GetSystemMetrics( SM_CYDOUBLECLK );
529 /***********************************************************************
530 * SYSPARAMS_GetMouseButtonSwap
532 * There is no SPI_GETMOUSEBUTTONSWAP so we export this function instead.
534 INT SYSPARAMS_GetMouseButtonSwap( void )
536 int spi_idx = SPI_SETMOUSEBUTTONSWAP_IDX;
538 if (!spi_loaded[spi_idx])
540 WCHAR buf[5];
542 if (SYSPARAMS_Load( SPI_SETMOUSEBUTTONSWAP_REGKEY,
543 SPI_SETMOUSEBUTTONSWAP_VALNAME, buf, sizeof(buf) ))
545 SYSMETRICS_Set( SM_SWAPBUTTON, atoiW( buf ) );
547 spi_loaded[spi_idx] = TRUE;
550 return GetSystemMetrics( SM_SWAPBUTTON );
553 /***********************************************************************
555 * SYSPARAMS_GetGUIFont
557 * fills LOGFONT with 'default GUI font'.
560 static void SYSPARAMS_GetGUIFont( LOGFONTW* plf )
562 HFONT hf;
564 memset( plf, 0, sizeof(LOGFONTW) );
565 hf = (HFONT)GetStockObject( DEFAULT_GUI_FONT );
566 if ( GetObjectW( hf, sizeof(LOGFONTW), plf ) != sizeof(LOGFONTW) )
569 * GetObjectW() would be succeeded always
570 * since this is a stock object
572 ERR("GetObjectW() failed\n");
576 /* copied from GetSystemMetrics()'s RegistryTwips2Pixels() */
577 inline static int SYSPARAMS_Twips2Pixels(int x)
579 if (x < 0)
580 x = (-x+7)/15;
581 return x;
584 /***********************************************************************
585 * SystemParametersInfoW (USER32.@)
587 * Each system parameter has flag which shows whether the parameter
588 * is loaded or not. Parameters, stored directly in SysParametersInfo are
589 * loaded from registry only when they are requested and the flag is
590 * "false", after the loading the flag is set to "true". On interprocess
591 * notification of the parameter change the corresponding parameter flag is
592 * set to "false". The parameter value will be reloaded when it is requested
593 * the next time.
594 * Parameters, backed by or depend on GetSystemMetrics are processed
595 * differently. These parameters are always loaded. They are reloaded right
596 * away on interprocess change notification. We can't do lazy loading because
597 * we don't want to complicate GetSystemMetrics.
598 * Parameters, backed by X settings are read from corresponding setting.
599 * On the parameter change request the setting is changed. Interprocess change
600 * notifications are ignored.
601 * When parameter value is updated the changed value is stored in permanent
602 * registry branch if saving is requested. Otherwise it is stored
603 * in temporary branch
605 * Some SPI values can also be stored as Twips values in the registry,
606 * don't forget the conversion!
608 BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
609 PVOID pvParam, UINT fWinIni )
611 #define WINE_SPI_FIXME(x) \
612 case x: \
613 FIXME( "Unimplemented action: %u (%s)\n", x, #x ); \
614 SetLastError( ERROR_INVALID_SPI_VALUE ); \
615 ret = FALSE; \
616 break
617 #define WINE_SPI_WARN(x) \
618 case x: \
619 WARN( "Ignored action: %u (%s)\n", x, #x ); \
620 break
622 BOOL ret = TRUE;
623 unsigned spi_idx = 0;
625 TRACE("(%u, %u, %p, %u)\n", uiAction, uiParam, pvParam, fWinIni);
627 switch (uiAction)
629 case SPI_GETBEEP: /* 1 */
630 if (!pvParam) return FALSE;
632 spi_idx = SPI_SETBEEP_IDX;
633 if (!spi_loaded[spi_idx])
635 WCHAR buf[5];
637 if (SYSPARAMS_Load( SPI_SETBEEP_REGKEY, SPI_SETBEEP_VALNAME, buf, sizeof(buf) ))
638 beep_active = !lstrcmpiW( Yes, buf );
639 spi_loaded[spi_idx] = TRUE;
642 *(BOOL *)pvParam = beep_active;
643 break;
645 case SPI_SETBEEP: /* 2 */
646 spi_idx = SPI_SETBEEP_IDX;
647 if (SYSPARAMS_Save( SPI_SETBEEP_REGKEY, SPI_SETBEEP_VALNAME,
648 (uiParam ? Yes : No), fWinIni ))
650 beep_active = uiParam;
651 spi_loaded[spi_idx] = TRUE;
653 else
654 ret = FALSE;
655 break;
657 case SPI_GETMOUSE: /* 3 */
658 if (!pvParam) return FALSE;
660 spi_idx = SPI_SETMOUSE_IDX;
661 if (!spi_loaded[spi_idx])
663 WCHAR buf[10];
665 if (SYSPARAMS_Load( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME1,
666 buf, sizeof(buf) ))
667 mouse_threshold1 = atoiW( buf );
668 if (SYSPARAMS_Load( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME2,
669 buf, sizeof(buf) ))
670 mouse_threshold2 = atoiW( buf );
671 if (SYSPARAMS_Load( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME3,
672 buf, sizeof(buf) ))
673 mouse_speed = atoiW( buf );
674 spi_loaded[spi_idx] = TRUE;
676 ((INT *)pvParam)[0] = mouse_threshold1;
677 ((INT *)pvParam)[1] = mouse_threshold2;
678 ((INT *)pvParam)[2] = mouse_speed;
679 break;
681 case SPI_SETMOUSE: /* 4 */
683 WCHAR buf[10];
685 if (!pvParam) return FALSE;
687 spi_idx = SPI_SETMOUSE_IDX;
688 wsprintfW(buf, CSd, ((INT *)pvParam)[0]);
690 if (SYSPARAMS_Save( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME1,
691 buf, fWinIni ))
693 mouse_threshold1 = ((INT *)pvParam)[0];
694 spi_loaded[spi_idx] = TRUE;
696 wsprintfW(buf, CSd, ((INT *)pvParam)[1]);
697 SYSPARAMS_Save( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME2,
698 buf, fWinIni );
699 mouse_threshold2 = ((INT *)pvParam)[1];
701 wsprintfW(buf, CSd, ((INT *)pvParam)[2]);
702 SYSPARAMS_Save( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME3,
703 buf, fWinIni );
704 mouse_speed = ((INT *)pvParam)[2];
706 else
707 ret = FALSE;
708 break;
711 case SPI_GETBORDER: /* 5 */
712 if (!pvParam) return FALSE;
714 spi_idx = SPI_SETBORDER_IDX;
715 if (!spi_loaded[spi_idx])
717 WCHAR buf[10];
719 if (SYSPARAMS_Load( SPI_SETBORDER_REGKEY, SPI_SETBORDER_VALNAME, buf, sizeof(buf) ))
720 border = SYSPARAMS_Twips2Pixels( atoiW(buf) );
722 spi_loaded[spi_idx] = TRUE;
723 if (TWEAK_WineLook > WIN31_LOOK)
725 SYSMETRICS_Set( SM_CXFRAME, border + GetSystemMetrics( SM_CXDLGFRAME ) );
726 SYSMETRICS_Set( SM_CYFRAME, border + GetSystemMetrics( SM_CXDLGFRAME ) );
729 *(INT *)pvParam = border;
730 break;
732 case SPI_SETBORDER: /* 6 */
734 WCHAR buf[10];
736 spi_idx = SPI_SETBORDER_IDX;
737 wsprintfW(buf, CSu, uiParam);
739 if (SYSPARAMS_Save( SPI_SETBORDER_REGKEY, SPI_SETBORDER_VALNAME,
740 buf, fWinIni ))
742 if (uiParam > 0)
744 border = uiParam;
745 spi_loaded[spi_idx] = TRUE;
746 if (TWEAK_WineLook > WIN31_LOOK)
748 SYSMETRICS_Set( SM_CXFRAME, uiParam + GetSystemMetrics( SM_CXDLGFRAME ) );
749 SYSMETRICS_Set( SM_CYFRAME, uiParam + GetSystemMetrics( SM_CXDLGFRAME ) );
753 else
754 ret = FALSE;
755 break;
758 case SPI_GETKEYBOARDSPEED: /* 10 */
759 if (!pvParam) return FALSE;
761 spi_idx = SPI_SETKEYBOARDSPEED_IDX;
762 if (!spi_loaded[spi_idx])
764 WCHAR buf[10];
766 if (SYSPARAMS_Load( SPI_SETKEYBOARDSPEED_REGKEY,
767 SPI_SETKEYBOARDSPEED_VALNAME,
768 buf, sizeof(buf) ))
769 keyboard_speed = atoiW( buf );
770 spi_loaded[spi_idx] = TRUE;
772 *(INT *)pvParam = keyboard_speed;
773 break;
775 case SPI_SETKEYBOARDSPEED: /* 11 */
777 WCHAR buf[10];
779 spi_idx = SPI_SETKEYBOARDSPEED_IDX;
780 if (uiParam > 31)
781 uiParam = 31;
782 wsprintfW(buf, CSu, uiParam);
784 if (SYSPARAMS_Save( SPI_SETKEYBOARDSPEED_REGKEY,
785 SPI_SETKEYBOARDSPEED_VALNAME,
786 buf, fWinIni ))
788 keyboard_speed = uiParam;
789 spi_loaded[spi_idx] = TRUE;
791 else
792 ret = FALSE;
793 break;
796 /* not implemented in Windows */
797 WINE_SPI_WARN(SPI_LANGDRIVER); /* 12 */
799 case SPI_ICONHORIZONTALSPACING: /* 13 */
800 spi_idx = SPI_ICONHORIZONTALSPACING_IDX;
801 if (pvParam != NULL)
803 if (!spi_loaded[spi_idx])
805 WCHAR buf[10];
806 int val;
808 if (SYSPARAMS_Load( SPI_ICONHORIZONTALSPACING_REGKEY,
809 SPI_ICONHORIZONTALSPACING_VALNAME, buf, sizeof(buf) ))
811 val = SYSPARAMS_Twips2Pixels( atoiW(buf) );
812 SYSMETRICS_Set( SM_CXICONSPACING, val );
814 spi_loaded[spi_idx] = TRUE;
817 *(INT *)pvParam = GetSystemMetrics( SM_CXICONSPACING );
819 else
821 WCHAR buf[10];
823 if (uiParam < 32) uiParam = 32;
825 wsprintfW(buf, CSu, uiParam);
826 if (SYSPARAMS_Save( SPI_ICONHORIZONTALSPACING_REGKEY,
827 SPI_ICONHORIZONTALSPACING_VALNAME,
828 buf, fWinIni ))
830 SYSMETRICS_Set( SM_CXICONSPACING, uiParam );
831 spi_loaded[spi_idx] = TRUE;
833 else
834 ret = FALSE;
836 break;
838 case SPI_GETSCREENSAVETIMEOUT: /* 14 */
839 if (!pvParam) return FALSE;
841 spi_idx = SPI_SETSCREENSAVETIMEOUT_IDX;
842 if (!spi_loaded[spi_idx])
844 WCHAR buf[10];
846 if (SYSPARAMS_Load( SPI_SETSCREENSAVETIMEOUT_REGKEY,
847 SPI_SETSCREENSAVETIMEOUT_VALNAME,
848 buf, sizeof(buf) ))
849 screensave_timeout = atoiW( buf );
851 spi_loaded[spi_idx] = TRUE;
853 *(INT *)pvParam = screensave_timeout;
854 break;
856 case SPI_SETSCREENSAVETIMEOUT: /* 15 */
858 WCHAR buf[10];
860 spi_idx = SPI_SETSCREENSAVETIMEOUT_IDX;
861 wsprintfW(buf, CSu, uiParam);
863 if (SYSPARAMS_Save( SPI_SETSCREENSAVETIMEOUT_REGKEY,
864 SPI_SETSCREENSAVETIMEOUT_VALNAME,
865 buf, fWinIni ))
867 screensave_timeout = uiParam;
868 spi_loaded[spi_idx] = TRUE;
870 else
871 ret = FALSE;
872 break;
875 case SPI_GETSCREENSAVEACTIVE: /* 16 */
876 if (!pvParam) return FALSE;
877 *(BOOL *)pvParam = USER_Driver.pGetScreenSaveActive();
878 break;
880 case SPI_SETSCREENSAVEACTIVE: /* 17 */
882 WCHAR buf[5];
884 wsprintfW(buf, CSu, uiParam);
885 USER_Driver.pSetScreenSaveActive( uiParam );
886 /* saved value does not affect Wine */
887 SYSPARAMS_Save( SPI_SETSCREENSAVEACTIVE_REGKEY,
888 SPI_SETSCREENSAVEACTIVE_VALNAME,
889 buf, fWinIni );
890 break;
893 case SPI_GETGRIDGRANULARITY: /* 18 */
894 if (!pvParam) return FALSE;
896 spi_idx = SPI_SETGRIDGRANULARITY_IDX;
897 if (!spi_loaded[spi_idx])
899 WCHAR buf[10];
901 if (SYSPARAMS_Load( SPI_SETGRIDGRANULARITY_REGKEY,
902 SPI_SETGRIDGRANULARITY_VALNAME,
903 buf, sizeof(buf) ))
904 grid_granularity = atoiW( buf );
906 spi_loaded[spi_idx] = TRUE;
908 *(INT *)pvParam = grid_granularity;
909 break;
911 case SPI_SETGRIDGRANULARITY: /* 19 */
913 WCHAR buf[10];
915 spi_idx = SPI_SETGRIDGRANULARITY_IDX;
916 wsprintfW(buf, CSu, uiParam);
918 if (SYSPARAMS_Save( SPI_SETGRIDGRANULARITY_REGKEY,
919 SPI_SETGRIDGRANULARITY_VALNAME,
920 buf, fWinIni ))
922 grid_granularity = uiParam;
923 spi_loaded[spi_idx] = TRUE;
925 else
926 ret = FALSE;
927 break;
930 case SPI_SETDESKWALLPAPER: /* 20 */
931 if (!pvParam || !SetDeskWallPaper( (LPSTR)pvParam )) return FALSE;
932 SYSPARAMS_Save(SPI_SETDESKWALLPAPER_REGKEY, SPI_SETDESKWALLPAPER_VALNAME, pvParam, fWinIni);
933 break;
935 case SPI_SETDESKPATTERN: /* 21 */
936 /* FIXME: the ability to specify a pattern in pvParam
937 doesn't seem to be documented for Win32 */
938 if ((INT16)uiParam == -1)
940 WCHAR buf[256];
941 GetProfileStringW( Desktop, Pattern,
942 defPattern,
943 buf, sizeof(buf)/sizeof(WCHAR) );
944 ret = DESKTOP_SetPattern( buf );
945 } else
946 ret = DESKTOP_SetPattern( (LPWSTR)pvParam );
947 break;
949 case SPI_GETKEYBOARDDELAY: /* 22 */
950 if (!pvParam) return FALSE;
952 spi_idx = SPI_SETKEYBOARDDELAY_IDX;
953 if (!spi_loaded[spi_idx])
955 WCHAR buf[10];
957 if (SYSPARAMS_Load( SPI_SETKEYBOARDDELAY_REGKEY,
958 SPI_SETKEYBOARDDELAY_VALNAME,
959 buf, sizeof(buf) ))
961 int i = atoiW( buf );
962 if ( (i >= 0) && (i <= 3)) keyboard_delay = i;
965 spi_loaded[spi_idx] = TRUE;
967 *(INT *)pvParam = keyboard_delay;
968 break;
970 case SPI_SETKEYBOARDDELAY: /* 23 */
972 WCHAR buf[10];
974 spi_idx = SPI_SETKEYBOARDDELAY_IDX;
975 wsprintfW(buf, CSu, uiParam);
977 if (SYSPARAMS_Save( SPI_SETKEYBOARDDELAY_REGKEY,
978 SPI_SETKEYBOARDDELAY_VALNAME,
979 buf, fWinIni ))
981 if (uiParam <= 3)
982 keyboard_delay = uiParam;
983 spi_loaded[spi_idx] = TRUE;
985 else
986 ret = FALSE;
987 break;
990 case SPI_ICONVERTICALSPACING: /* 24 */
991 spi_idx = SPI_ICONVERTICALSPACING_IDX;
992 if (pvParam != NULL)
994 if (!spi_loaded[spi_idx])
996 WCHAR buf[10];
997 int val;
999 if (SYSPARAMS_Load( SPI_ICONVERTICALSPACING_REGKEY,
1000 SPI_ICONVERTICALSPACING_VALNAME, buf, sizeof(buf) ))
1002 val = SYSPARAMS_Twips2Pixels( atoiW(buf) );
1003 SYSMETRICS_Set( SM_CYICONSPACING, val );
1005 spi_loaded[spi_idx] = TRUE;
1008 *(INT *)pvParam = GetSystemMetrics( SM_CYICONSPACING );
1010 else
1012 WCHAR buf[10];
1014 if (uiParam < 32) uiParam = 32;
1016 wsprintfW(buf, CSu, uiParam);
1017 if (SYSPARAMS_Save( SPI_ICONVERTICALSPACING_REGKEY,
1018 SPI_ICONVERTICALSPACING_VALNAME,
1019 buf, fWinIni ))
1021 SYSMETRICS_Set( SM_CYICONSPACING, uiParam );
1022 spi_loaded[spi_idx] = TRUE;
1024 else
1025 ret = FALSE;
1028 break;
1030 case SPI_GETICONTITLEWRAP: /* 25 */
1031 if (!pvParam) return FALSE;
1033 spi_idx = SPI_SETICONTITLEWRAP_IDX;
1034 if (!spi_loaded[spi_idx])
1036 WCHAR buf[5];
1038 if (SYSPARAMS_Load( SPI_SETICONTITLEWRAP_REGKEY1,
1039 SPI_SETICONTITLEWRAP_VALNAME, buf, sizeof(buf) ))
1040 icon_title_wrap = atoiW(buf);
1041 spi_loaded[spi_idx] = TRUE;
1044 *(BOOL *)pvParam = icon_title_wrap;
1045 break;
1047 case SPI_SETICONTITLEWRAP: /* 26 */
1049 WCHAR buf[5];
1051 spi_idx = SPI_SETICONTITLEWRAP_IDX;
1052 wsprintfW(buf, CSu, uiParam);
1053 if (SYSPARAMS_Save( SPI_SETICONTITLEWRAP_REGKEY1,
1054 SPI_SETICONTITLEWRAP_VALNAME,
1055 buf, fWinIni ))
1057 SYSPARAMS_Save( SPI_SETICONTITLEWRAP_REGKEY2,
1058 SPI_SETICONTITLEWRAP_VALNAME,
1059 buf, fWinIni );
1060 icon_title_wrap = uiParam;
1061 spi_loaded[spi_idx] = TRUE;
1063 else
1064 ret = FALSE;
1065 break;
1068 case SPI_GETMENUDROPALIGNMENT: /* 27 */
1069 if (!pvParam) return FALSE;
1071 spi_idx = SPI_SETMENUDROPALIGNMENT_IDX;
1073 if (!spi_loaded[spi_idx])
1075 WCHAR buf[5];
1077 if (SYSPARAMS_Load( SPI_SETMENUDROPALIGNMENT_REGKEY1,
1078 SPI_SETMENUDROPALIGNMENT_VALNAME, buf, sizeof(buf) ))
1080 SYSMETRICS_Set( SM_MENUDROPALIGNMENT, atoiW( buf ) );
1082 spi_loaded[spi_idx] = TRUE;
1085 *(BOOL *)pvParam = GetSystemMetrics( SM_MENUDROPALIGNMENT );
1086 break;
1088 case SPI_SETMENUDROPALIGNMENT: /* 28 */
1090 WCHAR buf[5];
1091 spi_idx = SPI_SETMENUDROPALIGNMENT_IDX;
1093 wsprintfW(buf, CSu, uiParam);
1094 if (SYSPARAMS_Save( SPI_SETMENUDROPALIGNMENT_REGKEY1,
1095 SPI_SETMENUDROPALIGNMENT_VALNAME,
1096 buf, fWinIni ))
1098 SYSPARAMS_Save( SPI_SETMENUDROPALIGNMENT_REGKEY2,
1099 SPI_SETMENUDROPALIGNMENT_VALNAME,
1100 buf, fWinIni );
1101 SYSMETRICS_Set( SM_MENUDROPALIGNMENT, uiParam );
1102 spi_loaded[spi_idx] = TRUE;
1104 else
1105 ret = FALSE;
1106 break;
1109 case SPI_SETDOUBLECLKWIDTH: /* 29 */
1111 WCHAR buf[10];
1112 spi_idx = SPI_SETDOUBLECLKWIDTH_IDX;
1114 wsprintfW(buf, CSu, uiParam);
1115 if (SYSPARAMS_Save( SPI_SETDOUBLECLKWIDTH_REGKEY1,
1116 SPI_SETDOUBLECLKWIDTH_VALNAME,
1117 buf, fWinIni ))
1119 SYSPARAMS_Save( SPI_SETDOUBLECLKWIDTH_REGKEY2,
1120 SPI_SETDOUBLECLKWIDTH_VALNAME,
1121 buf, fWinIni );
1122 SYSMETRICS_Set( SM_CXDOUBLECLK, uiParam );
1123 spi_loaded[spi_idx] = TRUE;
1125 else
1126 ret = FALSE;
1127 break;
1130 case SPI_SETDOUBLECLKHEIGHT: /* 30 */
1132 WCHAR buf[10];
1133 spi_idx = SPI_SETDOUBLECLKHEIGHT_IDX;
1135 wsprintfW(buf, CSu, uiParam);
1136 if (SYSPARAMS_Save( SPI_SETDOUBLECLKHEIGHT_REGKEY1,
1137 SPI_SETDOUBLECLKHEIGHT_VALNAME,
1138 buf, fWinIni ))
1140 SYSPARAMS_Save( SPI_SETDOUBLECLKHEIGHT_REGKEY2,
1141 SPI_SETDOUBLECLKHEIGHT_VALNAME,
1142 buf, fWinIni );
1143 SYSMETRICS_Set( SM_CYDOUBLECLK, uiParam );
1144 spi_loaded[spi_idx] = TRUE;
1146 else
1147 ret = FALSE;
1148 break;
1151 case SPI_GETICONTITLELOGFONT: /* 31 */
1153 LPLOGFONTW lpLogFont = (LPLOGFONTW)pvParam;
1154 LOGFONTW lfDefault;
1156 if (!pvParam) return FALSE;
1159 * The 'default GDI fonts' seems to be returned.
1160 * If a returned font is not a correct font in your environment,
1161 * please try to fix objects/gdiobj.c at first.
1163 SYSPARAMS_GetGUIFont( &lfDefault );
1165 GetProfileStringW( Desktop, IconTitleFaceName,
1166 lfDefault.lfFaceName,
1167 lpLogFont->lfFaceName, LF_FACESIZE );
1168 lpLogFont->lfHeight = -GetProfileIntW( Desktop, IconTitleSize, 11 );
1169 lpLogFont->lfWidth = 0;
1170 lpLogFont->lfEscapement = lpLogFont->lfOrientation = 0;
1171 lpLogFont->lfWeight = FW_NORMAL;
1172 lpLogFont->lfItalic = FALSE;
1173 lpLogFont->lfStrikeOut = FALSE;
1174 lpLogFont->lfUnderline = FALSE;
1175 lpLogFont->lfCharSet = lfDefault.lfCharSet; /* at least 'charset' should not be hard-coded */
1176 lpLogFont->lfOutPrecision = OUT_DEFAULT_PRECIS;
1177 lpLogFont->lfClipPrecision = CLIP_DEFAULT_PRECIS;
1178 lpLogFont->lfPitchAndFamily = DEFAULT_PITCH;
1179 lpLogFont->lfQuality = DEFAULT_QUALITY;
1180 break;
1183 case SPI_SETDOUBLECLICKTIME: /* 32 */
1185 WCHAR buf[10];
1187 spi_idx = SPI_SETDOUBLECLICKTIME_IDX;
1188 wsprintfW(buf, CSu, uiParam);
1190 if (SYSPARAMS_Save( SPI_SETDOUBLECLICKTIME_REGKEY,
1191 SPI_SETDOUBLECLICKTIME_VALNAME,
1192 buf, fWinIni ))
1194 if (!uiParam)
1195 uiParam = 500;
1196 double_click_time = uiParam;
1197 spi_loaded[spi_idx] = TRUE;
1199 else
1200 ret = FALSE;
1201 break;
1204 case SPI_SETMOUSEBUTTONSWAP: /* 33 */
1206 WCHAR buf[5];
1207 spi_idx = SPI_SETMOUSEBUTTONSWAP_IDX;
1209 wsprintfW(buf, CSu, uiParam);
1210 if (SYSPARAMS_Save( SPI_SETMOUSEBUTTONSWAP_REGKEY,
1211 SPI_SETMOUSEBUTTONSWAP_VALNAME,
1212 buf, fWinIni ))
1214 SYSMETRICS_Set( SM_SWAPBUTTON, uiParam );
1215 spi_loaded[spi_idx] = TRUE;
1217 else
1218 ret = FALSE;
1219 break;
1222 WINE_SPI_FIXME(SPI_SETICONTITLELOGFONT); /* 34 */
1224 case SPI_GETFASTTASKSWITCH: /* 35 */
1225 if (!pvParam) return FALSE;
1226 *(BOOL *)pvParam = 1;
1227 break;
1229 case SPI_SETFASTTASKSWITCH: /* 36 */
1230 /* the action is disabled */
1231 ret = FALSE;
1232 break;
1234 case SPI_SETDRAGFULLWINDOWS: /* 37 WINVER >= 0x0400 */
1236 WCHAR buf[5];
1238 spi_idx = SPI_SETDRAGFULLWINDOWS_IDX;
1239 wsprintfW(buf, CSu, uiParam);
1240 if (SYSPARAMS_Save( SPI_SETDRAGFULLWINDOWS_REGKEY,
1241 SPI_SETDRAGFULLWINDOWS_VALNAME,
1242 buf, fWinIni ))
1244 drag_full_windows = uiParam;
1245 spi_loaded[spi_idx] = TRUE;
1247 else
1248 ret = FALSE;
1249 break;
1252 case SPI_GETDRAGFULLWINDOWS: /* 38 WINVER >= 0x0400 */
1253 if (!pvParam) return FALSE;
1255 spi_idx = SPI_SETDRAGFULLWINDOWS_IDX;
1256 if (!spi_loaded[spi_idx])
1258 WCHAR buf[5];
1260 if (SYSPARAMS_Load( SPI_SETDRAGFULLWINDOWS_REGKEY,
1261 SPI_SETDRAGFULLWINDOWS_VALNAME, buf, sizeof(buf) ))
1262 drag_full_windows = atoiW(buf);
1263 spi_loaded[spi_idx] = TRUE;
1266 *(BOOL *)pvParam = drag_full_windows;
1267 break;
1269 case SPI_GETNONCLIENTMETRICS: /* 41 WINVER >= 0x400 */
1271 LPNONCLIENTMETRICSW lpnm = (LPNONCLIENTMETRICSW)pvParam;
1273 if (!pvParam) return FALSE;
1275 if (lpnm->cbSize == sizeof(NONCLIENTMETRICSW))
1277 /* clear the struct, so we have 'sane' members */
1278 memset(
1279 (char *)pvParam + sizeof(lpnm->cbSize),
1281 lpnm->cbSize - sizeof(lpnm->cbSize)
1284 /* initialize geometry entries */
1285 lpnm->iBorderWidth = 1;
1286 lpnm->iScrollWidth = GetSystemMetrics(SM_CXVSCROLL);
1287 lpnm->iScrollHeight = GetSystemMetrics(SM_CYHSCROLL);
1289 /* size of the normal caption buttons */
1290 lpnm->iCaptionWidth = GetSystemMetrics(SM_CXSIZE);
1291 lpnm->iCaptionHeight = GetSystemMetrics(SM_CYSIZE);
1293 /* caption font metrics */
1294 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, (LPVOID)&(lpnm->lfCaptionFont), 0 );
1295 lpnm->lfCaptionFont.lfWeight = FW_BOLD;
1297 /* size of the small caption buttons */
1298 lpnm->iSmCaptionWidth = GetSystemMetrics(SM_CXSMSIZE);
1299 lpnm->iSmCaptionHeight = GetSystemMetrics(SM_CYSMSIZE);
1301 /* small caption font metrics */
1302 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, (LPVOID)&(lpnm->lfSmCaptionFont), 0 );
1304 /* menus, FIXME: names of wine.conf entries are bogus */
1306 /* size of the menu (MDI) buttons */
1307 lpnm->iMenuWidth = GetSystemMetrics(SM_CXMENUSIZE);
1308 lpnm->iMenuHeight = GetSystemMetrics(SM_CYMENUSIZE);
1310 /* menu font metrics */
1311 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, (LPVOID)&(lpnm->lfMenuFont), 0 );
1312 GetProfileStringW( Desktop, MenuFont,
1313 (TWEAK_WineLook > WIN31_LOOK) ? lpnm->lfCaptionFont.lfFaceName : System,
1314 lpnm->lfMenuFont.lfFaceName, LF_FACESIZE );
1315 lpnm->lfMenuFont.lfHeight = -GetProfileIntW( Desktop, MenuFontSize, 11 );
1316 lpnm->lfMenuFont.lfWeight = (TWEAK_WineLook > WIN31_LOOK) ? FW_NORMAL : FW_BOLD;
1318 /* status bar font metrics */
1319 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0,
1320 (LPVOID)&(lpnm->lfStatusFont), 0 );
1321 /* message font metrics */
1322 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0,
1323 (LPVOID)&(lpnm->lfMessageFont), 0 );
1325 else
1327 WARN("size mismatch !! (is %d; should be %d)\n", lpnm->cbSize, sizeof(NONCLIENTMETRICSW));
1328 /* FIXME: SetLastError? */
1329 ret = FALSE;
1331 break;
1333 WINE_SPI_FIXME(SPI_SETNONCLIENTMETRICS); /* 42 WINVER >= 0x400 */
1335 case SPI_GETMINIMIZEDMETRICS: /* 43 WINVER >= 0x400 */
1337 MINIMIZEDMETRICS * lpMm = pvParam;
1338 if (lpMm && lpMm->cbSize == sizeof(*lpMm))
1340 /* these taken from Win2k SP3 */
1341 lpMm->iWidth = 154;
1342 lpMm->iHorzGap = 0;
1343 lpMm->iVertGap = 0;
1344 lpMm->iArrange = 8;
1346 else
1347 ret = FALSE;
1348 break;
1350 WINE_SPI_FIXME(SPI_SETMINIMIZEDMETRICS); /* 44 WINVER >= 0x400 */
1352 case SPI_GETICONMETRICS: /* 45 WINVER >= 0x400 */
1354 LPICONMETRICSW lpIcon = pvParam;
1355 if(lpIcon && lpIcon->cbSize == sizeof(*lpIcon))
1357 SystemParametersInfoW( SPI_ICONHORIZONTALSPACING, 0,
1358 &lpIcon->iHorzSpacing, FALSE );
1359 SystemParametersInfoW( SPI_ICONVERTICALSPACING, 0,
1360 &lpIcon->iVertSpacing, FALSE );
1361 SystemParametersInfoW( SPI_GETICONTITLEWRAP, 0,
1362 &lpIcon->iTitleWrap, FALSE );
1363 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0,
1364 &lpIcon->lfFont, FALSE );
1366 else
1368 ret = FALSE;
1370 break;
1372 WINE_SPI_FIXME(SPI_SETICONMETRICS); /* 46 WINVER >= 0x400 */
1374 case SPI_SETWORKAREA: /* 47 WINVER >= 0x400 */
1376 static const WCHAR CSld[]={'%','l','d',' ','%','l','d',' ','%','l','d',' ','%','l','d',0};
1377 WCHAR buf[20];
1378 RECT *pr = (RECT *) pvParam;
1380 if (!pvParam) return FALSE;
1382 spi_idx = SPI_SETWORKAREA_IDX;
1383 wsprintfW(buf, CSld, pr->left, pr->top,
1384 pr->right, pr->bottom );
1386 if (SYSPARAMS_Save( SPI_SETWORKAREA_REGKEY,
1387 SPI_SETWORKAREA_VALNAME,
1388 buf, fWinIni ))
1390 CopyRect( &work_area, (RECT *)pvParam );
1391 spi_loaded[spi_idx] = TRUE;
1393 else
1394 ret = FALSE;
1395 break;
1398 case SPI_GETWORKAREA: /* 48 WINVER >= 0x400 */
1399 if (!pvParam) return FALSE;
1401 spi_idx = SPI_SETWORKAREA_IDX;
1402 if (!spi_loaded[spi_idx])
1404 WCHAR buf[20];
1406 SetRect( &work_area, 0, 0,
1407 GetSystemMetrics( SM_CXSCREEN ),
1408 GetSystemMetrics( SM_CYSCREEN ) );
1410 if (SYSPARAMS_Load( SPI_SETWORKAREA_REGKEY,
1411 SPI_SETWORKAREA_VALNAME,
1412 buf, sizeof(buf) ))
1414 char tmpbuf[20];
1415 WideCharToMultiByte( CP_ACP, 0, buf, -1,
1416 tmpbuf, sizeof(tmpbuf), NULL, NULL );
1417 sscanf( tmpbuf, "%ld %ld %ld %ld",
1418 &work_area.left, &work_area.top,
1419 &work_area.right, &work_area.bottom );
1421 spi_loaded[spi_idx] = TRUE;
1423 CopyRect( (RECT *)pvParam, &work_area );
1425 break;
1427 WINE_SPI_FIXME(SPI_SETPENWINDOWS); /* 49 WINVER >= 0x400 */
1429 case SPI_GETFILTERKEYS: /* 50 */
1431 LPFILTERKEYS lpFilterKeys = (LPFILTERKEYS)pvParam;
1432 WARN("SPI_GETFILTERKEYS not fully implemented\n");
1433 if (lpFilterKeys && lpFilterKeys->cbSize == sizeof(FILTERKEYS))
1435 /* Indicate that no FilterKeys feature available */
1436 lpFilterKeys->dwFlags = 0;
1437 lpFilterKeys->iWaitMSec = 0;
1438 lpFilterKeys->iDelayMSec = 0;
1439 lpFilterKeys->iRepeatMSec = 0;
1440 lpFilterKeys->iBounceMSec = 0;
1442 else
1444 ret = FALSE;
1446 break;
1448 WINE_SPI_FIXME(SPI_SETFILTERKEYS); /* 51 */
1450 case SPI_GETTOGGLEKEYS: /* 52 */
1452 LPTOGGLEKEYS lpToggleKeys = (LPTOGGLEKEYS)pvParam;
1453 WARN("SPI_GETTOGGLEKEYS not fully implemented\n");
1454 if (lpToggleKeys && lpToggleKeys->cbSize == sizeof(TOGGLEKEYS))
1456 /* Indicate that no ToggleKeys feature available */
1457 lpToggleKeys->dwFlags = 0;
1459 else
1461 ret = FALSE;
1463 break;
1465 WINE_SPI_FIXME(SPI_SETTOGGLEKEYS); /* 53 */
1467 case SPI_GETMOUSEKEYS: /* 54 */
1469 LPMOUSEKEYS lpMouseKeys = (LPMOUSEKEYS)pvParam;
1470 WARN("SPI_GETMOUSEKEYS not fully implemented\n");
1471 if (lpMouseKeys && lpMouseKeys->cbSize == sizeof(MOUSEKEYS))
1473 /* Indicate that no MouseKeys feature available */
1474 lpMouseKeys->dwFlags = 0;
1475 lpMouseKeys->iMaxSpeed = 360;
1476 lpMouseKeys->iTimeToMaxSpeed = 1000;
1477 lpMouseKeys->iCtrlSpeed = 0;
1478 lpMouseKeys->dwReserved1 = 0;
1479 lpMouseKeys->dwReserved2 = 0;
1481 else
1483 ret = FALSE;
1485 break;
1487 WINE_SPI_FIXME(SPI_SETMOUSEKEYS); /* 55 */
1489 case SPI_GETSHOWSOUNDS: /* 56 */
1490 if (!pvParam) return FALSE;
1492 spi_idx = SPI_SETSHOWSOUNDS_IDX;
1494 if (!spi_loaded[spi_idx])
1496 WCHAR buf[10];
1498 if (SYSPARAMS_Load( SPI_SETSHOWSOUNDS_REGKEY,
1499 SPI_SETSHOWSOUNDS_VALNAME, buf, sizeof(buf) ))
1501 SYSMETRICS_Set( SM_SHOWSOUNDS, atoiW( buf ) );
1503 spi_loaded[spi_idx] = TRUE;
1506 *(INT *)pvParam = GetSystemMetrics( SM_SHOWSOUNDS );
1507 break;
1509 case SPI_SETSHOWSOUNDS: /* 57 */
1511 WCHAR buf[10];
1512 spi_idx = SPI_SETSHOWSOUNDS_IDX;
1514 wsprintfW(buf, CSu, uiParam);
1515 if (SYSPARAMS_Save( SPI_SETSHOWSOUNDS_REGKEY,
1516 SPI_SETSHOWSOUNDS_VALNAME,
1517 buf, fWinIni ))
1519 SYSMETRICS_Set( SM_SHOWSOUNDS, uiParam );
1520 spi_loaded[spi_idx] = TRUE;
1522 else
1523 ret = FALSE;
1524 break;
1527 case SPI_GETSTICKYKEYS: /* 58 */
1529 LPSTICKYKEYS lpStickyKeys = (LPSTICKYKEYS)pvParam;
1530 WARN("SPI_GETSTICKYKEYS not fully implemented\n");
1531 if (lpStickyKeys && lpStickyKeys->cbSize == sizeof(STICKYKEYS))
1533 /* Indicate that no StickyKeys feature available */
1534 lpStickyKeys->dwFlags = 0;
1536 else
1538 ret = FALSE;
1540 break;
1542 WINE_SPI_FIXME(SPI_SETSTICKYKEYS); /* 59 */
1544 case SPI_GETACCESSTIMEOUT: /* 60 */
1546 LPACCESSTIMEOUT lpAccessTimeout = (LPACCESSTIMEOUT)pvParam;
1547 WARN("SPI_GETACCESSTIMEOUT not fully implemented\n");
1548 if (lpAccessTimeout && lpAccessTimeout->cbSize == sizeof(ACCESSTIMEOUT))
1550 /* Indicate that no accessibility features timeout is available */
1551 lpAccessTimeout->dwFlags = 0;
1552 lpAccessTimeout->iTimeOutMSec = 0;
1554 else
1556 ret = FALSE;
1558 break;
1560 WINE_SPI_FIXME(SPI_SETACCESSTIMEOUT); /* 61 */
1562 case SPI_GETSERIALKEYS: /* 62 WINVER >= 0x400 */
1564 LPSERIALKEYSW lpSerialKeysW = (LPSERIALKEYSW)pvParam;
1565 WARN("SPI_GETSERIALKEYS not fully implemented\n");
1566 if (lpSerialKeysW && lpSerialKeysW->cbSize == sizeof(SERIALKEYSW))
1568 /* Indicate that no SerialKeys feature available */
1569 lpSerialKeysW->dwFlags = 0;
1570 lpSerialKeysW->lpszActivePort = NULL;
1571 lpSerialKeysW->lpszPort = NULL;
1572 lpSerialKeysW->iBaudRate = 0;
1573 lpSerialKeysW->iPortState = 0;
1575 else
1577 ret = FALSE;
1579 break;
1581 WINE_SPI_FIXME(SPI_SETSERIALKEYS); /* 63 WINVER >= 0x400 */
1583 case SPI_GETSOUNDSENTRY: /* 64 */
1585 LPSOUNDSENTRYW lpSoundSentryW = (LPSOUNDSENTRYW)pvParam;
1586 WARN("SPI_GETSOUNDSENTRY not fully implemented\n");
1587 if (lpSoundSentryW && lpSoundSentryW->cbSize == sizeof(SOUNDSENTRYW))
1589 /* Indicate that no SoundSentry feature available */
1590 lpSoundSentryW->dwFlags = 0;
1591 lpSoundSentryW->iFSTextEffect = 0;
1592 lpSoundSentryW->iFSTextEffectMSec = 0;
1593 lpSoundSentryW->iFSTextEffectColorBits = 0;
1594 lpSoundSentryW->iFSGrafEffect = 0;
1595 lpSoundSentryW->iFSGrafEffectMSec = 0;
1596 lpSoundSentryW->iFSGrafEffectColor = 0;
1597 lpSoundSentryW->iWindowsEffect = 0;
1598 lpSoundSentryW->iWindowsEffectMSec = 0;
1599 lpSoundSentryW->lpszWindowsEffectDLL = 0;
1600 lpSoundSentryW->iWindowsEffectOrdinal = 0;
1602 else
1604 ret = FALSE;
1606 break;
1608 WINE_SPI_FIXME(SPI_SETSOUNDSENTRY); /* 65 */
1610 case SPI_GETHIGHCONTRAST: /* 66 WINVER >= 0x400 */
1612 LPHIGHCONTRASTW lpHighContrastW = (LPHIGHCONTRASTW)pvParam;
1613 WARN("SPI_GETHIGHCONTRAST not fully implemented\n");
1614 if (lpHighContrastW && lpHighContrastW->cbSize == sizeof(HIGHCONTRASTW))
1616 /* Indicate that no high contrast feature available */
1617 lpHighContrastW->dwFlags = 0;
1618 lpHighContrastW->lpszDefaultScheme = NULL;
1620 else
1622 ret = FALSE;
1624 break;
1626 WINE_SPI_FIXME(SPI_SETHIGHCONTRAST); /* 67 WINVER >= 0x400 */
1628 case SPI_GETKEYBOARDPREF: /* 68 WINVER >= 0x400 */
1629 if (!pvParam) return FALSE;
1631 spi_idx = SPI_SETKEYBOARDPREF_IDX;
1632 if (!spi_loaded[spi_idx])
1634 WCHAR buf[5];
1636 if (SYSPARAMS_Load( SPI_SETKEYBOARDPREF_REGKEY,
1637 SPI_SETKEYBOARDPREF_VALNAME, buf, sizeof(buf) ))
1638 keyboard_pref = atoiW(buf);
1639 spi_loaded[spi_idx] = TRUE;
1642 *(BOOL *)pvParam = keyboard_pref;
1643 break;
1645 case SPI_SETKEYBOARDPREF: /* 69 WINVER >= 0x400 */
1647 WCHAR buf[5];
1649 spi_idx = SPI_SETKEYBOARDPREF_IDX;
1650 wsprintfW(buf, CSu, uiParam);
1651 if (SYSPARAMS_Save( SPI_SETKEYBOARDPREF_REGKEY,
1652 SPI_SETKEYBOARDPREF_VALNAME,
1653 buf, fWinIni ))
1655 keyboard_pref = uiParam;
1656 spi_loaded[spi_idx] = TRUE;
1658 else
1659 ret = FALSE;
1660 break;
1663 case SPI_GETSCREENREADER: /* 70 WINVER >= 0x400 */
1664 if (!pvParam) return FALSE;
1666 spi_idx = SPI_SETSCREENREADER_IDX;
1667 if (!spi_loaded[spi_idx])
1669 WCHAR buf[5];
1671 if (SYSPARAMS_Load( SPI_SETSCREENREADER_REGKEY,
1672 SPI_SETSCREENREADER_VALNAME, buf, sizeof(buf) ))
1673 screen_reader = atoiW(buf);
1674 spi_loaded[spi_idx] = TRUE;
1677 *(BOOL *)pvParam = screen_reader;
1678 break;
1680 case SPI_SETSCREENREADER: /* 71 WINVER >= 0x400 */
1682 WCHAR buf[5];
1684 spi_idx = SPI_SETSCREENREADER_IDX;
1685 wsprintfW(buf, CSu, uiParam);
1686 if (SYSPARAMS_Save( SPI_SETSCREENREADER_REGKEY,
1687 SPI_SETSCREENREADER_VALNAME,
1688 buf, fWinIni ))
1690 screen_reader = uiParam;
1691 spi_loaded[spi_idx] = TRUE;
1693 else
1694 ret = FALSE;
1695 break;
1698 case SPI_GETANIMATION: /* 72 WINVER >= 0x400 */
1700 LPANIMATIONINFO lpAnimInfo = (LPANIMATIONINFO)pvParam;
1702 /* Tell it "disabled" */
1703 if (lpAnimInfo && lpAnimInfo->cbSize == sizeof(ANIMATIONINFO))
1704 lpAnimInfo->iMinAnimate = 0; /* Minimise and restore animation is disabled (nonzero == enabled) */
1705 else
1706 ret = FALSE;
1707 break;
1709 WINE_SPI_WARN(SPI_SETANIMATION); /* 73 WINVER >= 0x400 */
1711 case SPI_GETFONTSMOOTHING: /* 74 WINVER >= 0x400 */
1712 if (!pvParam) return FALSE;
1714 spi_idx = SPI_SETFONTSMOOTHING_IDX;
1715 if (!spi_loaded[spi_idx])
1717 WCHAR buf[5];
1719 if (SYSPARAMS_Load( SPI_SETFONTSMOOTHING_REGKEY,
1720 SPI_SETFONTSMOOTHING_VALNAME, buf, sizeof(buf) ))
1722 spi_loaded[spi_idx] = TRUE;
1723 if (buf[0] == 0x01 || buf[0] == 0x02) /* 0x01 for 95/98/NT, 0x02 for 98/ME/2k/XP */
1725 font_smoothing = TRUE;
1730 *(BOOL *)pvParam = font_smoothing;
1732 break;
1734 WINE_SPI_FIXME(SPI_SETFONTSMOOTHING); /* 75 WINVER >= 0x400 */
1736 WINE_SPI_FIXME(SPI_SETDRAGWIDTH); /* 76 WINVER >= 0x400 */
1737 WINE_SPI_FIXME(SPI_SETDRAGHEIGHT); /* 77 WINVER >= 0x400 */
1739 WINE_SPI_FIXME(SPI_SETHANDHELD); /* 78 WINVER >= 0x400 */
1741 WINE_SPI_FIXME(SPI_GETLOWPOWERTIMEOUT); /* 79 WINVER >= 0x400 */
1742 WINE_SPI_FIXME(SPI_GETPOWEROFFTIMEOUT); /* 80 WINVER >= 0x400 */
1743 WINE_SPI_FIXME(SPI_SETLOWPOWERTIMEOUT); /* 81 WINVER >= 0x400 */
1744 WINE_SPI_FIXME(SPI_SETPOWEROFFTIMEOUT); /* 82 WINVER >= 0x400 */
1745 WINE_SPI_FIXME(SPI_GETLOWPOWERACTIVE); /* 83 WINVER >= 0x400 */
1746 WINE_SPI_FIXME(SPI_GETPOWEROFFACTIVE); /* 84 WINVER >= 0x400 */
1747 WINE_SPI_FIXME(SPI_SETLOWPOWERACTIVE); /* 85 WINVER >= 0x400 */
1748 WINE_SPI_FIXME(SPI_SETPOWEROFFACTIVE); /* 86 WINVER >= 0x400 */
1750 WINE_SPI_FIXME(SPI_SETCURSORS); /* 87 WINVER >= 0x400 */
1751 WINE_SPI_FIXME(SPI_SETICONS); /* 88 WINVER >= 0x400 */
1753 case SPI_GETDEFAULTINPUTLANG: /* 89 WINVER >= 0x400 */
1754 ret = GetKeyboardLayout(0) ? TRUE : FALSE;
1755 break;
1757 WINE_SPI_FIXME(SPI_SETDEFAULTINPUTLANG); /* 90 WINVER >= 0x400 */
1759 WINE_SPI_FIXME(SPI_SETLANGTOGGLE); /* 91 WINVER >= 0x400 */
1761 case SPI_GETWINDOWSEXTENSION: /* 92 WINVER >= 0x400 */
1762 WARN("pretend no support for Win9x Plus! for now.\n");
1763 ret = FALSE; /* yes, this is the result value */
1764 break;
1766 WINE_SPI_FIXME(SPI_SETMOUSETRAILS); /* 93 WINVER >= 0x400 */
1767 WINE_SPI_FIXME(SPI_GETMOUSETRAILS); /* 94 WINVER >= 0x400 */
1769 case SPI_SETSCREENSAVERRUNNING: /* 97 WINVER >= 0x400 */
1771 /* SPI_SCREENSAVERRUNNING is an alias for SPI_SETSCREENSAVERRUNNING */
1772 WCHAR buf[5];
1774 spi_idx = SPI_SETSCREENSAVERRUNNING_IDX;
1775 wsprintfW(buf, CSu, uiParam);
1777 /* save only temporarily */
1778 if (SYSPARAMS_Save( SPI_SETSCREENSAVERRUNNING_REGKEY,
1779 SPI_SETSCREENSAVERRUNNING_VALNAME,
1780 buf, 0 ))
1782 screensaver_running = uiParam;
1783 spi_loaded[spi_idx] = TRUE;
1785 else
1786 ret = FALSE;
1787 break;
1790 case SPI_GETMOUSEHOVERWIDTH: /* 98 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
1791 if (!pvParam) return FALSE;
1793 spi_idx = SPI_SETMOUSEHOVERWIDTH_IDX;
1794 if (!spi_loaded[spi_idx])
1796 WCHAR buf[10];
1798 if (SYSPARAMS_Load( SPI_SETMOUSEHOVERWIDTH_REGKEY,
1799 SPI_SETMOUSEHOVERWIDTH_VALNAME,
1800 buf, sizeof(buf) ))
1801 mouse_hover_width = atoiW( buf );
1802 spi_loaded[spi_idx] = TRUE;
1804 *(INT *)pvParam = mouse_hover_width;
1805 break;
1807 case SPI_SETMOUSEHOVERWIDTH: /* 99 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
1809 WCHAR buf[10];
1811 spi_idx = SPI_SETMOUSEHOVERWIDTH_IDX;
1812 wsprintfW(buf, CSu, uiParam);
1814 if (SYSPARAMS_Save( SPI_SETMOUSEHOVERWIDTH_REGKEY,
1815 SPI_SETMOUSEHOVERWIDTH_VALNAME,
1816 buf, fWinIni ))
1818 mouse_hover_width = uiParam;
1819 spi_loaded[spi_idx] = TRUE;
1821 else
1822 ret = FALSE;
1823 break;
1826 case SPI_GETMOUSEHOVERHEIGHT: /* 100 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
1827 if (!pvParam) return FALSE;
1829 spi_idx = SPI_SETMOUSEHOVERHEIGHT_IDX;
1830 if (!spi_loaded[spi_idx])
1832 WCHAR buf[10];
1834 if (SYSPARAMS_Load( SPI_SETMOUSEHOVERHEIGHT_REGKEY,
1835 SPI_SETMOUSEHOVERHEIGHT_VALNAME,
1836 buf, sizeof(buf) ))
1837 mouse_hover_height = atoiW( buf );
1839 spi_loaded[spi_idx] = TRUE;
1841 *(INT *)pvParam = mouse_hover_height;
1842 break;
1844 case SPI_SETMOUSEHOVERHEIGHT: /* 101 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
1846 WCHAR buf[10];
1848 spi_idx = SPI_SETMOUSEHOVERHEIGHT_IDX;
1849 wsprintfW(buf, CSu, uiParam);
1851 if (SYSPARAMS_Save( SPI_SETMOUSEHOVERHEIGHT_REGKEY,
1852 SPI_SETMOUSEHOVERHEIGHT_VALNAME,
1853 buf, fWinIni ))
1855 mouse_hover_height = uiParam;
1856 spi_loaded[spi_idx] = TRUE;
1858 else
1859 ret = FALSE;
1860 break;
1863 case SPI_GETMOUSEHOVERTIME: /* 102 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
1864 if (!pvParam) return FALSE;
1866 spi_idx = SPI_SETMOUSEHOVERTIME_IDX;
1867 if (!spi_loaded[spi_idx])
1869 WCHAR buf[10];
1871 if (SYSPARAMS_Load( SPI_SETMOUSEHOVERTIME_REGKEY,
1872 SPI_SETMOUSEHOVERTIME_VALNAME,
1873 buf, sizeof(buf) ))
1874 mouse_hover_time = atoiW( buf );
1876 spi_loaded[spi_idx] = TRUE;
1878 *(INT *)pvParam = mouse_hover_time;
1879 break;
1881 case SPI_SETMOUSEHOVERTIME: /* 103 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
1883 WCHAR buf[10];
1885 spi_idx = SPI_SETMOUSEHOVERTIME_IDX;
1886 wsprintfW(buf, CSu, uiParam);
1888 if (SYSPARAMS_Save( SPI_SETMOUSEHOVERTIME_REGKEY,
1889 SPI_SETMOUSEHOVERTIME_VALNAME,
1890 buf, fWinIni ))
1892 mouse_hover_time = uiParam;
1893 spi_loaded[spi_idx] = TRUE;
1895 else
1896 ret = FALSE;
1897 break;
1900 case SPI_GETWHEELSCROLLLINES: /* 104 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
1901 if (!pvParam) return FALSE;
1903 spi_idx = SPI_SETMOUSESCROLLLINES_IDX;
1904 if (!spi_loaded[spi_idx])
1906 WCHAR buf[10];
1908 if (SYSPARAMS_Load( SPI_SETMOUSESCROLLLINES_REGKEY,
1909 SPI_SETMOUSESCROLLLINES_VALNAME,
1910 buf, sizeof(buf) ))
1911 mouse_scroll_lines = atoiW( buf );
1913 spi_loaded[spi_idx] = TRUE;
1915 *(INT *)pvParam = mouse_scroll_lines;
1916 break;
1918 case SPI_SETWHEELSCROLLLINES: /* 105 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
1920 WCHAR buf[10];
1922 spi_idx = SPI_SETMOUSESCROLLLINES_IDX;
1923 wsprintfW(buf, CSu, uiParam);
1925 if (SYSPARAMS_Save( SPI_SETMOUSESCROLLLINES_REGKEY,
1926 SPI_SETMOUSESCROLLLINES_VALNAME,
1927 buf, fWinIni ))
1929 mouse_scroll_lines = uiParam;
1930 spi_loaded[spi_idx] = TRUE;
1932 else
1933 ret = FALSE;
1934 break;
1937 case SPI_GETMENUSHOWDELAY: /* 106 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
1938 if (!pvParam) return FALSE;
1940 spi_idx = SPI_SETMENUSHOWDELAY_IDX;
1941 if (!spi_loaded[spi_idx])
1943 WCHAR buf[10];
1945 if (SYSPARAMS_Load( SPI_SETMENUSHOWDELAY_REGKEY,
1946 SPI_SETMENUSHOWDELAY_VALNAME,
1947 buf, sizeof(buf) ))
1948 menu_show_delay = atoiW( buf );
1950 spi_loaded[spi_idx] = TRUE;
1952 *(INT *)pvParam = menu_show_delay;
1953 break;
1955 case SPI_SETMENUSHOWDELAY: /* 107 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
1957 WCHAR buf[10];
1959 spi_idx = SPI_SETMENUSHOWDELAY_IDX;
1960 wsprintfW(buf, CSu, uiParam);
1962 if (SYSPARAMS_Save( SPI_SETMENUSHOWDELAY_REGKEY,
1963 SPI_SETMENUSHOWDELAY_VALNAME,
1964 buf, fWinIni ))
1966 menu_show_delay = uiParam;
1967 spi_loaded[spi_idx] = TRUE;
1969 else
1970 ret = FALSE;
1971 break;
1974 WINE_SPI_FIXME(SPI_GETSHOWIMEUI); /* 110 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
1975 WINE_SPI_FIXME(SPI_SETSHOWIMEUI); /* 111 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
1976 WINE_SPI_FIXME(SPI_GETMOUSESPEED); /* 112 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
1977 WINE_SPI_FIXME(SPI_SETMOUSESPEED); /* 113 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
1979 case SPI_GETSCREENSAVERRUNNING: /* 114 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
1980 if (!pvParam) return FALSE;
1982 spi_idx = SPI_SETSCREENSAVERRUNNING_IDX;
1983 if (!spi_loaded[spi_idx])
1985 WCHAR buf[5];
1987 if (SYSPARAMS_Load( SPI_SETSCREENSAVERRUNNING_REGKEY,
1988 SPI_SETSCREENSAVERRUNNING_VALNAME, buf, sizeof(buf) ))
1989 screensaver_running = atoiW( buf );
1990 spi_loaded[spi_idx] = TRUE;
1993 *(BOOL *)pvParam = screensaver_running;
1994 break;
1996 case SPI_GETDESKWALLPAPER: /* 115 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
1998 WCHAR buf[MAX_PATH];
2000 if (!pvParam) return FALSE;
2002 if (uiParam > MAX_PATH)
2004 uiParam = MAX_PATH;
2007 if (SYSPARAMS_Load(SPI_SETDESKWALLPAPER_REGKEY, SPI_SETDESKWALLPAPER_VALNAME, buf, sizeof(buf)))
2009 lstrcpynW((WCHAR*)pvParam, buf, uiParam);
2011 else
2013 /* Return an empty string */
2014 memset((WCHAR*)pvParam, 0, uiParam);
2017 break;
2020 WINE_SPI_FIXME(SPI_GETACTIVEWINDOWTRACKING);/* 0x1000 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2021 WINE_SPI_FIXME(SPI_SETACTIVEWINDOWTRACKING);/* 0x1001 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2022 WINE_SPI_FIXME(SPI_GETMENUANIMATION); /* 0x1002 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2023 WINE_SPI_FIXME(SPI_SETMENUANIMATION); /* 0x1003 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2024 WINE_SPI_FIXME(SPI_GETCOMBOBOXANIMATION); /* 0x1004 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2025 WINE_SPI_FIXME(SPI_SETCOMBOBOXANIMATION); /* 0x1005 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2027 case SPI_GETLISTBOXSMOOTHSCROLLING: /* 0x1006 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2028 if (!pvParam) return FALSE;
2030 spi_idx = SPI_SETLISTBOXSMOOTHSCROLLING_IDX;
2031 if (!spi_loaded[spi_idx])
2033 WCHAR buf[5];
2035 if (SYSPARAMS_Load( SPI_SETLISTBOXSMOOTHSCROLLING_REGKEY,
2036 SPI_SETLISTBOXSMOOTHSCROLLING_VALNAME, buf, sizeof(buf) ))
2038 if ((buf[0]&0x01) == 0x01)
2040 listbox_smoothscrolling = TRUE;
2043 spi_loaded[spi_idx] = TRUE;
2046 *(BOOL *)pvParam = listbox_smoothscrolling;
2048 break;
2050 WINE_SPI_FIXME(SPI_SETLISTBOXSMOOTHSCROLLING);/* 0x1007 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2052 case SPI_GETGRADIENTCAPTIONS: /* 0x1008 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2053 if (!pvParam) return FALSE;
2055 spi_idx = SPI_SETGRADIENTCAPTIONS_IDX;
2056 if (!spi_loaded[spi_idx])
2058 WCHAR buf[5];
2060 if (SYSPARAMS_Load( SPI_USERPREFERENCEMASK_REGKEY,
2061 SPI_USERPREFERENCEMASK_VALNAME, buf, sizeof(buf) ))
2063 if ((buf[0]&0x10) == 0x10)
2065 gradient_captions = TRUE;
2068 spi_loaded[spi_idx] = TRUE;
2071 *(BOOL *)pvParam = gradient_captions;
2073 break;
2075 WINE_SPI_FIXME(SPI_SETGRADIENTCAPTIONS); /* 0x1009 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2077 case SPI_GETKEYBOARDCUES: /* 0x100A _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2078 if (!pvParam) return FALSE;
2080 spi_idx = SPI_SETKEYBOARDCUES_IDX;
2081 if (!spi_loaded[spi_idx])
2083 WCHAR buf[5];
2085 if (SYSPARAMS_Load( SPI_USERPREFERENCEMASK_REGKEY,
2086 SPI_USERPREFERENCEMASK_VALNAME, buf, sizeof(buf) ))
2088 if ((buf[0]&0x20) == 0x20)
2090 keyboard_cues = TRUE;
2093 spi_loaded[spi_idx] = TRUE;
2096 *(BOOL *)pvParam = keyboard_cues;
2098 break;
2100 WINE_SPI_FIXME(SPI_SETKEYBOARDCUES); /* 0x100B _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2101 WINE_SPI_FIXME(SPI_GETACTIVEWNDTRKZORDER); /* 0x100C _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2102 WINE_SPI_FIXME(SPI_SETACTIVEWNDTRKZORDER); /* 0x100D _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2103 case SPI_GETHOTTRACKING: /* 0x100E _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2104 if (!pvParam) return FALSE;
2106 spi_idx = SPI_SETHOTTRACKING_IDX;
2107 if (!spi_loaded[spi_idx])
2109 WCHAR buf[5];
2111 if (SYSPARAMS_Load( SPI_USERPREFERENCEMASK_REGKEY,
2112 SPI_USERPREFERENCEMASK_VALNAME, buf, sizeof(buf) ))
2114 if ((buf[0]&0x80) == 0x80)
2116 hot_tracking = TRUE;
2119 spi_loaded[spi_idx] = TRUE;
2122 *(BOOL *)pvParam = hot_tracking;
2124 break;
2126 WINE_SPI_FIXME(SPI_SETHOTTRACKING); /* 0x100F _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2127 WINE_SPI_FIXME(SPI_GETSELECTIONFADE); /* 0x1014 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2128 WINE_SPI_FIXME(SPI_SETSELECTIONFADE); /* 0x1015 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2129 WINE_SPI_FIXME(SPI_GETDROPSHADOW); /* 0x1024 _WIN32_WINNT >= 0x510 */
2130 WINE_SPI_FIXME(SPI_SETDROPSHADOW); /* 0x1025 _WIN32_WINNT >= 0x510 */
2131 WINE_SPI_FIXME(SPI_GETFOREGROUNDLOCKTIMEOUT);/* 0x2000 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2132 WINE_SPI_FIXME(SPI_SETFOREGROUNDLOCKTIMEOUT);/* 0x2001 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2133 WINE_SPI_FIXME(SPI_GETACTIVEWNDTRKTIMEOUT); /* 0x2002 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2134 WINE_SPI_FIXME(SPI_SETACTIVEWNDTRKTIMEOUT); /* 0x2003 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2135 WINE_SPI_FIXME(SPI_GETFOREGROUNDFLASHCOUNT);/* 0x2004 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2136 WINE_SPI_FIXME(SPI_SETFOREGROUNDFLASHCOUNT);/* 0x2005 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2138 default:
2139 FIXME( "Unknown action: %u\n", uiAction );
2140 SetLastError( ERROR_INVALID_SPI_VALUE );
2141 ret = FALSE;
2142 break;
2145 if (ret)
2146 SYSPARAMS_NotifyChange( uiAction, fWinIni );
2147 return ret;
2149 #undef WINE_SPI_FIXME
2150 #undef WINE_SPI_WARN
2154 /***********************************************************************
2155 * SystemParametersInfo (USER.483)
2157 BOOL16 WINAPI SystemParametersInfo16( UINT16 uAction, UINT16 uParam,
2158 LPVOID lpvParam, UINT16 fuWinIni )
2160 BOOL16 ret;
2162 TRACE("(%u, %u, %p, %u)\n", uAction, uParam, lpvParam, fuWinIni);
2164 switch (uAction)
2166 case SPI_GETBEEP: /* 1 */
2167 case SPI_GETSCREENSAVEACTIVE: /* 16 */
2168 case SPI_GETICONTITLEWRAP: /* 25 */
2169 case SPI_GETMENUDROPALIGNMENT: /* 27 */
2170 case SPI_GETFASTTASKSWITCH: /* 35 */
2171 case SPI_GETDRAGFULLWINDOWS: /* 38 WINVER >= 0x0400 */
2173 BOOL tmp;
2174 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2175 if (ret && lpvParam)
2176 *(BOOL16 *)lpvParam = tmp;
2177 break;
2180 case SPI_GETBORDER: /* 5 */
2181 case SPI_ICONHORIZONTALSPACING: /* 13 */
2182 case SPI_GETSCREENSAVETIMEOUT: /* 14 */
2183 case SPI_GETGRIDGRANULARITY: /* 18 */
2184 case SPI_GETKEYBOARDDELAY: /* 22 */
2185 case SPI_ICONVERTICALSPACING: /* 24 */
2187 INT tmp;
2188 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2189 if (ret && lpvParam)
2190 *(INT16 *)lpvParam = tmp;
2191 break;
2194 case SPI_GETKEYBOARDSPEED: /* 10 */
2196 DWORD tmp;
2197 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2198 if (ret && lpvParam)
2199 *(WORD *)lpvParam = tmp;
2200 break;
2203 case SPI_GETICONTITLELOGFONT: /* 31 */
2205 LOGFONTA tmp;
2206 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2207 if (ret && lpvParam)
2208 SYSPARAMS_LogFont32ATo16( &tmp, (LPLOGFONT16)lpvParam );
2209 break;
2212 case SPI_GETNONCLIENTMETRICS: /* 41 WINVER >= 0x400 */
2214 NONCLIENTMETRICSA tmp;
2215 LPNONCLIENTMETRICS16 lpnm16 = (LPNONCLIENTMETRICS16)lpvParam;
2216 if (lpnm16 && lpnm16->cbSize == sizeof(NONCLIENTMETRICS16))
2218 tmp.cbSize = sizeof(NONCLIENTMETRICSA);
2219 ret = SystemParametersInfoA( uAction, uParam, &tmp, fuWinIni );
2220 if (ret)
2221 SYSPARAMS_NonClientMetrics32ATo16( &tmp, lpnm16 );
2223 else /* winfile 95 sets cbSize to 340 */
2224 ret = SystemParametersInfoA( uAction, uParam, lpvParam, fuWinIni );
2225 break;
2228 case SPI_GETWORKAREA: /* 48 WINVER >= 0x400 */
2230 RECT tmp;
2231 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2232 if (ret && lpvParam)
2233 CONV_RECT32TO16( &tmp, (RECT16 *)lpvParam );
2234 break;
2237 case SPI_GETMOUSEHOVERWIDTH: /* 98 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2238 case SPI_GETMOUSEHOVERHEIGHT: /* 100 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2239 case SPI_GETMOUSEHOVERTIME: /* 102 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2241 UINT tmp;
2242 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2243 if (ret && lpvParam)
2244 *(UINT16 *)lpvParam = tmp;
2245 break;
2248 default:
2249 ret = SystemParametersInfoA( uAction, uParam, lpvParam, fuWinIni );
2252 return ret;
2255 /***********************************************************************
2256 * SystemParametersInfoA (USER32.@)
2258 BOOL WINAPI SystemParametersInfoA( UINT uiAction, UINT uiParam,
2259 PVOID pvParam, UINT fuWinIni )
2261 BOOL ret;
2263 TRACE("(%u, %u, %p, %u)\n", uiAction, uiParam, pvParam, fuWinIni);
2265 switch (uiAction)
2267 case SPI_SETDESKWALLPAPER: /* 20 */
2268 case SPI_SETDESKPATTERN: /* 21 */
2270 WCHAR buffer[256];
2271 if (pvParam)
2272 if (!MultiByteToWideChar( CP_ACP, 0, (LPSTR)pvParam, -1,
2273 buffer, sizeof(buffer)/sizeof(WCHAR) ))
2274 buffer[sizeof(buffer)/sizeof(WCHAR)-1] = 0;
2275 ret = SystemParametersInfoW( uiAction, uiParam, pvParam ? buffer : NULL, fuWinIni );
2276 break;
2279 case SPI_GETICONTITLELOGFONT: /* 31 */
2281 LOGFONTW tmp;
2282 ret = SystemParametersInfoW( uiAction, uiParam, pvParam ? &tmp : NULL, fuWinIni );
2283 if (ret && pvParam)
2284 SYSPARAMS_LogFont32WTo32A( &tmp, (LPLOGFONTA)pvParam );
2285 break;
2288 case SPI_GETNONCLIENTMETRICS: /* 41 WINVER >= 0x400 */
2290 NONCLIENTMETRICSW tmp;
2291 LPNONCLIENTMETRICSA lpnmA = (LPNONCLIENTMETRICSA)pvParam;
2292 if (lpnmA && lpnmA->cbSize == sizeof(NONCLIENTMETRICSA))
2294 tmp.cbSize = sizeof(NONCLIENTMETRICSW);
2295 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2296 if (ret)
2297 SYSPARAMS_NonClientMetrics32WTo32A( &tmp, lpnmA );
2299 else
2300 ret = FALSE;
2301 break;
2304 case SPI_GETICONMETRICS: /* 45 WINVER >= 0x400 */
2306 ICONMETRICSW tmp;
2307 LPICONMETRICSA lpimA = (LPICONMETRICSA)pvParam;
2308 if (lpimA && lpimA->cbSize == sizeof(ICONMETRICSA))
2310 tmp.cbSize = sizeof(ICONMETRICSW);
2311 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2312 if (ret)
2314 lpimA->iHorzSpacing = tmp.iHorzSpacing;
2315 lpimA->iVertSpacing = tmp.iVertSpacing;
2316 lpimA->iTitleWrap = tmp.iTitleWrap;
2317 SYSPARAMS_LogFont32WTo32A( &tmp.lfFont, &lpimA->lfFont );
2320 else
2321 ret = FALSE;
2322 break;
2325 case SPI_GETHIGHCONTRAST: /* 66 WINVER >= 0x400 */
2327 HIGHCONTRASTW tmp;
2328 LPHIGHCONTRASTA lphcA = (LPHIGHCONTRASTA)pvParam;
2329 if (lphcA && lphcA->cbSize == sizeof(HIGHCONTRASTA))
2331 tmp.cbSize = sizeof(HIGHCONTRASTW);
2332 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2333 if (ret)
2335 lphcA->dwFlags = tmp.dwFlags;
2336 lphcA->lpszDefaultScheme = NULL; /* FIXME? */
2339 else
2340 ret = FALSE;
2341 break;
2344 default:
2345 ret = SystemParametersInfoW( uiAction, uiParam, pvParam, fuWinIni );
2346 break;
2348 return ret;
2352 /**********************************************************************
2353 * SetDoubleClickTime (USER32.@)
2355 BOOL WINAPI SetDoubleClickTime( UINT interval )
2357 return SystemParametersInfoW(SPI_SETDOUBLECLICKTIME, interval, 0, 0);
2361 /**********************************************************************
2362 * GetDoubleClickTime (USER32.@)
2364 UINT WINAPI GetDoubleClickTime(void)
2366 WCHAR buf[10];
2368 if (!spi_loaded[SPI_SETDOUBLECLICKTIME_IDX])
2370 if (SYSPARAMS_Load( SPI_SETDOUBLECLICKTIME_REGKEY,
2371 SPI_SETDOUBLECLICKTIME_VALNAME,
2372 buf, sizeof(buf) ))
2374 double_click_time = atoiW( buf );
2375 if (!double_click_time) double_click_time = 500;
2377 spi_loaded[SPI_SETDOUBLECLICKTIME_IDX] = TRUE;
2379 return double_click_time;