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 */
49 SPI_SETKEYBOARDSPEED_IDX,
50 SPI_ICONHORIZONTALSPACING_IDX,
51 SPI_SETSCREENSAVETIMEOUT_IDX,
52 SPI_SETGRIDGRANULARITY_IDX,
53 SPI_SETKEYBOARDDELAY_IDX,
54 SPI_ICONVERTICALSPACING_IDX,
55 SPI_SETICONTITLEWRAP_IDX,
56 SPI_SETMENUDROPALIGNMENT_IDX,
57 SPI_SETDOUBLECLKWIDTH_IDX,
58 SPI_SETDOUBLECLKHEIGHT_IDX,
59 SPI_SETDOUBLECLICKTIME_IDX,
60 SPI_SETMOUSEBUTTONSWAP_IDX,
61 SPI_SETDRAGFULLWINDOWS_IDX,
63 SPI_SETSHOWSOUNDS_IDX,
64 SPI_SETKEYBOARDPREF_IDX,
65 SPI_SETSCREENREADER_IDX,
66 SPI_SETSCREENSAVERRUNNING_IDX,
67 SPI_SETFONTSMOOTHING_IDX,
68 SPI_SETLISTBOXSMOOTHSCROLLING_IDX,
69 SPI_SETMOUSEHOVERWIDTH_IDX,
70 SPI_SETMOUSEHOVERHEIGHT_IDX,
71 SPI_SETMOUSEHOVERTIME_IDX,
72 SPI_SETMOUSESCROLLLINES_IDX,
73 SPI_SETMENUSHOWDELAY_IDX,
74 SPI_SETICONTITLELOGFONT_IDX,
75 SPI_SETLOWPOWERACTIVE_IDX,
76 SPI_SETPOWEROFFACTIVE_IDX,
77 SPI_USERPREFERENCEMASK_IDX,
78 SPI_NONCLIENTMETRICS_IDX,
79 SPI_MINIMIZEDMETRICS_IDX,
83 static const char * const DefSysColors[] =
85 "Scrollbar", "192 192 192", /* COLOR_SCROLLBAR */
86 "Background", "0 128 128", /* COLOR_BACKGROUND */
87 "ActiveTitle", "0 0 128", /* COLOR_ACTIVECAPTION */
88 "InactiveTitle", "128 128 128", /* COLOR_INACTIVECAPTION */
89 "Menu", "192 192 192", /* COLOR_MENU */
90 "Window", "255 255 255", /* COLOR_WINDOW */
91 "WindowFrame", "0 0 0", /* COLOR_WINDOWFRAME */
92 "MenuText", "0 0 0", /* COLOR_MENUTEXT */
93 "WindowText", "0 0 0", /* COLOR_WINDOWTEXT */
94 "TitleText", "255 255 255", /* COLOR_CAPTIONTEXT */
95 "ActiveBorder", "192 192 192", /* COLOR_ACTIVEBORDER */
96 "InactiveBorder", "192 192 192", /* COLOR_INACTIVEBORDER */
97 "AppWorkSpace", "128 128 128", /* COLOR_APPWORKSPACE */
98 "Hilight", "0 0 128", /* COLOR_HIGHLIGHT */
99 "HilightText", "255 255 255", /* COLOR_HIGHLIGHTTEXT */
100 "ButtonFace", "192 192 192", /* COLOR_BTNFACE */
101 "ButtonShadow", "128 128 128", /* COLOR_BTNSHADOW */
102 "GrayText", "128 128 128", /* COLOR_GRAYTEXT */
103 "ButtonText", "0 0 0", /* COLOR_BTNTEXT */
104 "InactiveTitleText", "192 192 192", /* COLOR_INACTIVECAPTIONTEXT */
105 "ButtonHilight", "255 255 255", /* COLOR_BTNHIGHLIGHT */
106 "ButtonDkShadow", "0 0 0", /* COLOR_3DDKSHADOW */
107 "ButtonLight", "224 224 224", /* COLOR_3DLIGHT */
108 "InfoText", "0 0 0", /* COLOR_INFOTEXT */
109 "InfoWindow", "255 255 225", /* COLOR_INFOBK */
110 "ButtonAlternateFace", "180 180 180", /* COLOR_ALTERNATEBTNFACE */
111 "HotTrackingColor", "0 0 255", /* COLOR_HOTLIGHT */
112 "GradientActiveTitle", "16 132 208", /* COLOR_GRADIENTACTIVECAPTION */
113 "GradientInactiveTitle", "181 181 181", /* COLOR_GRADIENTINACTIVECAPTION */
114 "MenuHilight", "0 0 0", /* COLOR_MENUHILIGHT */
115 "MenuBar", "192 192 192" /* COLOR_MENUBAR */
119 * Names of the registry subkeys of HKEY_CURRENT_USER key and value names
120 * for the system parameters.
121 * Names of the keys are created by adding string "_REGKEY" to
122 * "SET" action names, value names are created by adding "_REG_NAME"
123 * to the "SET" action name.
125 static const WCHAR SPI_SETBEEP_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','S','o','u','n','d',0};
126 static const WCHAR SPI_SETBEEP_VALNAME[]= {'B','e','e','p',0};
127 static const WCHAR SPI_SETMOUSE_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
128 static const WCHAR SPI_SETMOUSE_VALNAME1[]= {'M','o','u','s','e','T','h','r','e','s','h','o','l','d','1',0};
129 static const WCHAR SPI_SETMOUSE_VALNAME2[]= {'M','o','u','s','e','T','h','r','e','s','h','o','l','d','2',0};
130 static const WCHAR SPI_SETMOUSE_VALNAME3[]= {'M','o','u','s','e','S','p','e','e','d',0};
131 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','\\',
132 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
133 static const WCHAR SPI_SETBORDER_VALNAME[]= {'B','o','r','d','e','r','W','i','d','t','h',0};
134 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};
135 static const WCHAR SPI_SETKEYBOARDSPEED_VALNAME[]= {'K','e','y','b','o','a','r','d','S','p','e','e','d',0};
136 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','\\',
137 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
138 static const WCHAR SPI_ICONHORIZONTALSPACING_VALNAME[]= {'I','c','o','n','S','p','a','c','i','n','g',0};
139 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};
140 static const WCHAR SPI_SETSCREENSAVETIMEOUT_VALNAME[]= {'S','c','r','e','e','n','S','a','v','e','T','i','m','e','O','u','t',0};
141 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};
142 static const WCHAR SPI_SETSCREENSAVEACTIVE_VALNAME[]= {'S','c','r','e','e','n','S','a','v','e','A','c','t','i','v','e',0};
143 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};
144 static const WCHAR SPI_SETGRIDGRANULARITY_VALNAME[]= {'G','r','i','d','G','r','a','n','u','l','a','r','i','t','y',0};
145 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};
146 static const WCHAR SPI_SETKEYBOARDDELAY_VALNAME[]= {'K','e','y','b','o','a','r','d','D','e','l','a','y',0};
147 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','\\',
148 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
149 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};
150 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','\\',
151 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
152 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};
153 static const WCHAR SPI_SETICONTITLEWRAP_VALNAME[]= {'I','c','o','n','T','i','t','l','e','W','r','a','p',0};
154 static const WCHAR SPI_SETICONTITLELOGFONT_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p','\\',
155 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
156 static const WCHAR SPI_SETICONTITLELOGFONT_VALNAME[]= {'I','c','o','n','F','o','n','t',0};
157 static const WCHAR SPI_SETMENUDROPALIGNMENT_REGKEY1[]= {'S','o','f','t','w','a','r','e','\\',
158 'M','i','c','r','o','s','o','f','t','\\',
159 'W','i','n','d','o','w','s',' ','N','T','\\',
160 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
161 'W','i','n','d','o','w','s',0};
162 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};
163 static const WCHAR SPI_SETMENUDROPALIGNMENT_VALNAME[]= {'M','e','n','u','D','r','o','p','A','l','i','g','n','m','e','n','t',0};
164 static const WCHAR SPI_SETDOUBLECLKWIDTH_REGKEY1[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
165 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};
166 static const WCHAR SPI_SETDOUBLECLKWIDTH_VALNAME[]= {'D','o','u','b','l','e','C','l','i','c','k','W','i','d','t','h',0};
167 static const WCHAR SPI_SETDOUBLECLKHEIGHT_REGKEY1[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
168 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};
169 static const WCHAR SPI_SETDOUBLECLKHEIGHT_VALNAME[]= {'D','o','u','b','l','e','C','l','i','c','k','H','e','i','g','h','t',0};
170 static const WCHAR SPI_SETDOUBLECLICKTIME_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
171 static const WCHAR SPI_SETDOUBLECLICKTIME_VALNAME[]= {'D','o','u','b','l','e','C','l','i','c','k','S','p','e','e','d',0};
172 static const WCHAR SPI_SETMOUSEBUTTONSWAP_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
173 static const WCHAR SPI_SETMOUSEBUTTONSWAP_VALNAME[]= {'S','w','a','p','M','o','u','s','e','B','u','t','t','o','n','s',0};
174 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};
175 static const WCHAR SPI_SETDRAGFULLWINDOWS_VALNAME[]= {'D','r','a','g','F','u','l','l','W','i','n','d','o','w','s',0};
176 static const WCHAR SPI_SETSHOWSOUNDS_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\',
177 'A','c','c','e','s','s','i','b','i','l','i','t','y','\\',
178 'S','h','o','w','S','o','u','n','d','s',0};
179 static const WCHAR SPI_SETSHOWSOUNDS_VALNAME[]= {'O','n',0};
180 static const WCHAR SPI_SETKEYBOARDPREF_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\',
181 'A','c','c','e','s','s','i','b','i','l','i','t','y','\\',
182 'K','e','y','b','o','a','r','d',' ','P','r','e','f','e','r','e','n','c','e',0};
183 static const WCHAR SPI_SETKEYBOARDPREF_VALNAME[]= {'O','n',0};
184 static const WCHAR SPI_SETSCREENREADER_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\',
185 'A','c','c','e','s','s','i','b','i','l','i','t','y','\\',
186 'B','l','i','n','d',' ','A','c','c','e','s','s',0};
187 static const WCHAR SPI_SETSCREENREADER_VALNAME[]= {'O','n',0};
188 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};
189 static const WCHAR SPI_SETDESKWALLPAPER_VALNAME[]= {'W','a','l','l','p','a','p','e','r',0};
190 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};
191 static const WCHAR SPI_SETFONTSMOOTHING_VALNAME[]= {'F','o','n','t','S','m','o','o','t','h','i','n','g',0};
192 static const WCHAR SPI_SETLOWPOWERACTIVE_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
193 static const WCHAR SPI_SETLOWPOWERACTIVE_VALNAME[]= {'L','o','w','P','o','w','e','r','A','c','t','i','v','e',0};
194 static const WCHAR SPI_SETPOWEROFFACTIVE_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
195 static const WCHAR SPI_SETPOWEROFFACTIVE_VALNAME[]= {'P','o','w','e','r','O','f','f','A','c','t','i','v','e',0};
196 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};
197 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};
198 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};
199 static const WCHAR SPI_SETLISTBOXSMOOTHSCROLLING_VALNAME[]= {'S','m','o','o','t','h','S','c','r','o','l','l',0};
200 static const WCHAR SPI_SETMOUSEHOVERWIDTH_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
201 static const WCHAR SPI_SETMOUSEHOVERWIDTH_VALNAME[]= {'M','o','u','s','e','H','o','v','e','r','W','i','d','t','h',0};
202 static const WCHAR SPI_SETMOUSEHOVERHEIGHT_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
203 static const WCHAR SPI_SETMOUSEHOVERHEIGHT_VALNAME[]= {'M','o','u','s','e','H','o','v','e','r','H','e','i','g','h','t',0};
204 static const WCHAR SPI_SETMOUSEHOVERTIME_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
205 static const WCHAR SPI_SETMOUSEHOVERTIME_VALNAME[]= {'M','o','u','s','e','H','o','v','e','r','T','i','m','e',0};
206 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};
207 static const WCHAR SPI_SETMOUSESCROLLLINES_VALNAME[]= {'W','h','e','e','l','S','c','r','o','l','l','L','i','n','e','s',0};
208 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};
209 static const WCHAR SPI_SETMENUSHOWDELAY_VALNAME[]= {'M','e','n','u','S','h','o','w','D','e','l','a','y',0};
211 /* FIXME - real values */
212 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};
213 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};
215 static const WCHAR METRICS_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p','\\',
216 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
217 static const WCHAR METRICS_SCROLLWIDTH_VALNAME[]= {'S','c','r','o','l','l','W','i','d','t','h',0};
218 static const WCHAR METRICS_SCROLLHEIGHT_VALNAME[]= {'S','c','r','o','l','l','H','e','i','g','h','t',0};
219 static const WCHAR METRICS_CAPTIONWIDTH_VALNAME[]= {'C','a','p','t','i','o','n','W','i','d','t','h',0};
220 static const WCHAR METRICS_CAPTIONHEIGHT_VALNAME[]= {'C','a','p','t','i','o','n','H','e','i','g','h','t',0};
221 static const WCHAR METRICS_SMCAPTIONWIDTH_VALNAME[]= {'S','m','C','a','p','t','i','o','n','W','i','d','t','h',0};
222 static const WCHAR METRICS_SMCAPTIONHEIGHT_VALNAME[]= {'S','m','C','a','p','t','i','o','n','H','e','i','g','h','t',0};
223 static const WCHAR METRICS_MENUWIDTH_VALNAME[]= {'M','e','n','u','W','i','d','t','h',0};
224 static const WCHAR METRICS_MENUHEIGHT_VALNAME[]= {'M','e','n','u','H','e','i','g','h','t',0};
225 static const WCHAR METRICS_ICONSIZE_VALNAME[]= {'S','h','e','l','l',' ','I','c','o','n',' ','S','i','z','e',0};
226 static const WCHAR METRICS_BORDERWIDTH_VALNAME[]= {'B','o','r','d','e','r','W','i','d','t','h',0};
227 static const WCHAR METRICS_CAPTIONLOGFONT_VALNAME[]= {'C','a','p','t','i','o','n','F','o','n','t',0};
228 static const WCHAR METRICS_SMCAPTIONLOGFONT_VALNAME[]={'S','m','C','a','p','t','i','o','n','F','o','n','t',0};
229 static const WCHAR METRICS_MENULOGFONT_VALNAME[]= {'M','e','n','u','F','o','n','t',0};
230 static const WCHAR METRICS_MESSAGELOGFONT_VALNAME[]= {'M','e','s','s','a','g','e','F','o','n','t',0};
231 static const WCHAR METRICS_STATUSLOGFONT_VALNAME[]= {'S','t','a','t','u','s','F','o','n','t',0};
232 /* minimized metrics */
233 static const WCHAR METRICS_MINWIDTH_VALNAME[] = {'M','i','n','W','i','d','t','h','\0'};
234 static const WCHAR METRICS_MINHORZGAP_VALNAME[] = {'M','i','n','H','o','r','z','G','a','p','\0'};
235 static const WCHAR METRICS_MINVERTGAP_VALNAME[] = {'M','i','n','V','e','r','t','G','a','p','\0'};
236 static const WCHAR METRICS_MINARRANGE_VALNAME[] = {'M','i','n','A','r','r','a','n','g','e','\0'};
238 static const WCHAR WINE_CURRENT_USER_REGKEY[] = {'S','o','f','t','w','a','r','e','\\',
241 /* volatile registry branch under WINE_CURRENT_USER_REGKEY for temporary values storage */
242 static const WCHAR WINE_CURRENT_USER_REGKEY_TEMP_PARAMS[] = {'T','e','m','p','o','r','a','r','y',' ',
243 'S','y','s','t','e','m',' ',
244 'P','a','r','a','m','e','t','e','r','s',0};
246 static const WCHAR Yes[]= {'Y','e','s',0};
247 static const WCHAR No[]= {'N','o',0};
248 static const WCHAR Desktop[]= {'D','e','s','k','t','o','p',0};
249 static const WCHAR Pattern[]= {'P','a','t','t','e','r','n',0};
250 static const WCHAR MenuFont[]= {'M','e','n','u','F','o','n','t',0};
251 static const WCHAR MenuFontSize[]= {'M','e','n','u','F','o','n','t','S','i','z','e',0};
252 static const WCHAR StatusFont[]= {'S','t','a','t','u','s','F','o','n','t',0};
253 static const WCHAR StatusFontSize[]= {'S','t','a','t','u','s','F','o','n','t','S','i','z','e',0};
254 static const WCHAR MessageFont[]= {'M','e','s','s','a','g','e','F','o','n','t',0};
255 static const WCHAR MessageFontSize[]= {'M','e','s','s','a','g','e','F','o','n','t','S','i','z','e',0};
256 static const WCHAR System[]= {'S','y','s','t','e','m',0};
257 static const WCHAR IconTitleSize[]= {'I','c','o','n','T','i','t','l','e','S','i','z','e',0};
258 static const WCHAR IconTitleFaceName[]= {'I','c','o','n','T','i','t','l','e','F','a','c','e','N','a','m','e',0};
259 static const WCHAR defPattern[]= {'1','7','0',' ','8','5',' ','1','7','0',' ','8','5',' ','1','7','0',' ','8','5',
260 ' ','1','7','0',' ','8','5',0};
261 static const WCHAR CSu[]= {'%','u',0};
262 static const WCHAR CSd[]= {'%','d',0};
264 /* Indicators whether system parameter value is loaded */
265 static char spi_loaded[SPI_INDEX_COUNT];
267 static BOOL notify_change = TRUE;
269 /* System parameters storage */
270 static BOOL beep_active = TRUE;
271 static int mouse_threshold1 = 6;
272 static int mouse_threshold2 = 10;
273 static int mouse_speed = 1;
274 static UINT border = 1;
275 static UINT keyboard_speed = 31;
276 static UINT screensave_timeout = 300;
277 static UINT grid_granularity = 0;
278 static UINT keyboard_delay = 1;
279 static UINT double_click_width = 4;
280 static UINT double_click_height = 4;
281 static UINT double_click_time = 500;
282 static BOOL drag_full_windows = FALSE;
283 static RECT work_area;
284 static BOOL keyboard_pref = TRUE;
285 static BOOL screen_reader = FALSE;
286 static UINT mouse_hover_width = 4;
287 static UINT mouse_hover_height = 4;
288 static UINT mouse_hover_time = 400;
289 static UINT mouse_scroll_lines = 3;
290 static UINT menu_show_delay = 400;
291 static UINT menu_drop_alignment = 0;
292 static BOOL screensaver_running = FALSE;
293 static UINT font_smoothing = 0; /* 0x01 for 95/98/NT, 0x02 for 98/ME/2k/XP */
294 static BOOL lowpoweractive = FALSE;
295 static BOOL poweroffactive = FALSE;
296 static BOOL show_sounds = FALSE;
297 static BOOL swap_buttons = FALSE;
298 static BOOL listbox_smoothscrolling = FALSE;
299 static BYTE user_prefs[4];
301 static MINIMIZEDMETRICS minimized_metrics =
303 sizeof(MINIMIZEDMETRICS),
307 ARW_HIDE /* iArrange */
310 static ICONMETRICSW icon_metrics =
312 sizeof(ICONMETRICSW),
313 75, /* iHorzSpacing */
314 75, /* iVertSpacing */
315 TRUE, /* iTitleWrap */
316 { -11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
317 OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH } /* lfFont */
320 static NONCLIENTMETRICSW nonclient_metrics =
322 sizeof(NONCLIENTMETRICSW),
323 1, /* iBorderWidth */
324 16, /* iScrollWidth */
325 16, /* iScrollHeight */
326 18, /* iCaptionWidth */
327 18, /* iCaptionHeight */
328 { 0 }, /* lfCaptionFont */
329 13, /* iSmCaptionWidth */
330 15, /* iSmCaptionHeight */
331 { 0 }, /* lfSmCaptionFont */
333 18, /* iMenuHeight */
334 { 0 }, /* lfMenuFont */
335 { 0 }, /* lfStatusFont */
336 { 0 } /* lfMessageFont */
339 /* some additional non client metric info */
340 static TEXTMETRICW tmMenuFont;
341 static UINT CaptionFontAvCharWidth;
343 static SIZE icon_size = { 32, 32 };
345 #define NUM_SYS_COLORS (COLOR_MENUBAR+1)
347 static COLORREF SysColors[NUM_SYS_COLORS];
348 static HBRUSH SysColorBrushes[NUM_SYS_COLORS];
349 static HPEN SysColorPens[NUM_SYS_COLORS];
351 static const WORD wPattern55AA[] = { 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa };
353 HBRUSH SYSCOLOR_55AABrush = 0;
355 extern void __wine_make_gdi_object_system( HGDIOBJ handle, BOOL set );
358 /* This function is a copy of the one in objects/font.c */
359 static void SYSPARAMS_LogFont32ATo16( const LOGFONTA* font32, LPLOGFONT16 font16 )
361 font16->lfHeight = font32->lfHeight;
362 font16->lfWidth = font32->lfWidth;
363 font16->lfEscapement = font32->lfEscapement;
364 font16->lfOrientation = font32->lfOrientation;
365 font16->lfWeight = font32->lfWeight;
366 font16->lfItalic = font32->lfItalic;
367 font16->lfUnderline = font32->lfUnderline;
368 font16->lfStrikeOut = font32->lfStrikeOut;
369 font16->lfCharSet = font32->lfCharSet;
370 font16->lfOutPrecision = font32->lfOutPrecision;
371 font16->lfClipPrecision = font32->lfClipPrecision;
372 font16->lfQuality = font32->lfQuality;
373 font16->lfPitchAndFamily = font32->lfPitchAndFamily;
374 lstrcpynA( font16->lfFaceName, font32->lfFaceName, LF_FACESIZE );
377 static void SYSPARAMS_LogFont16To32W( const LOGFONT16 *font16, LPLOGFONTW font32 )
379 font32->lfHeight = font16->lfHeight;
380 font32->lfWidth = font16->lfWidth;
381 font32->lfEscapement = font16->lfEscapement;
382 font32->lfOrientation = font16->lfOrientation;
383 font32->lfWeight = font16->lfWeight;
384 font32->lfItalic = font16->lfItalic;
385 font32->lfUnderline = font16->lfUnderline;
386 font32->lfStrikeOut = font16->lfStrikeOut;
387 font32->lfCharSet = font16->lfCharSet;
388 font32->lfOutPrecision = font16->lfOutPrecision;
389 font32->lfClipPrecision = font16->lfClipPrecision;
390 font32->lfQuality = font16->lfQuality;
391 font32->lfPitchAndFamily = font16->lfPitchAndFamily;
392 MultiByteToWideChar( CP_ACP, 0, font16->lfFaceName, -1, font32->lfFaceName, LF_FACESIZE );
393 font32->lfFaceName[LF_FACESIZE-1] = 0;
396 static void SYSPARAMS_LogFont32WTo32A( const LOGFONTW* font32W, LPLOGFONTA font32A )
398 font32A->lfHeight = font32W->lfHeight;
399 font32A->lfWidth = font32W->lfWidth;
400 font32A->lfEscapement = font32W->lfEscapement;
401 font32A->lfOrientation = font32W->lfOrientation;
402 font32A->lfWeight = font32W->lfWeight;
403 font32A->lfItalic = font32W->lfItalic;
404 font32A->lfUnderline = font32W->lfUnderline;
405 font32A->lfStrikeOut = font32W->lfStrikeOut;
406 font32A->lfCharSet = font32W->lfCharSet;
407 font32A->lfOutPrecision = font32W->lfOutPrecision;
408 font32A->lfClipPrecision = font32W->lfClipPrecision;
409 font32A->lfQuality = font32W->lfQuality;
410 font32A->lfPitchAndFamily = font32W->lfPitchAndFamily;
411 WideCharToMultiByte( CP_ACP, 0, font32W->lfFaceName, -1, font32A->lfFaceName, LF_FACESIZE, NULL, NULL );
412 font32A->lfFaceName[LF_FACESIZE-1] = 0;
415 static void SYSPARAMS_LogFont32ATo32W( const LOGFONTA* font32A, LPLOGFONTW font32W )
417 font32W->lfHeight = font32A->lfHeight;
418 font32W->lfWidth = font32A->lfWidth;
419 font32W->lfEscapement = font32A->lfEscapement;
420 font32W->lfOrientation = font32A->lfOrientation;
421 font32W->lfWeight = font32A->lfWeight;
422 font32W->lfItalic = font32A->lfItalic;
423 font32W->lfUnderline = font32A->lfUnderline;
424 font32W->lfStrikeOut = font32A->lfStrikeOut;
425 font32W->lfCharSet = font32A->lfCharSet;
426 font32W->lfOutPrecision = font32A->lfOutPrecision;
427 font32W->lfClipPrecision = font32A->lfClipPrecision;
428 font32W->lfQuality = font32A->lfQuality;
429 font32W->lfPitchAndFamily = font32A->lfPitchAndFamily;
430 MultiByteToWideChar( CP_ACP, 0, font32A->lfFaceName, -1, font32W->lfFaceName, LF_FACESIZE );
431 font32W->lfFaceName[LF_FACESIZE-1] = 0;
434 static void SYSPARAMS_NonClientMetrics32ATo16( const NONCLIENTMETRICSA* lpnm32, LPNONCLIENTMETRICS16 lpnm16 )
436 lpnm16->iBorderWidth = lpnm32->iBorderWidth;
437 lpnm16->iScrollWidth = lpnm32->iScrollWidth;
438 lpnm16->iScrollHeight = lpnm32->iScrollHeight;
439 lpnm16->iCaptionWidth = lpnm32->iCaptionWidth;
440 lpnm16->iCaptionHeight = lpnm32->iCaptionHeight;
441 SYSPARAMS_LogFont32ATo16( &lpnm32->lfCaptionFont, &lpnm16->lfCaptionFont );
442 lpnm16->iSmCaptionWidth = lpnm32->iSmCaptionWidth;
443 lpnm16->iSmCaptionHeight = lpnm32->iSmCaptionHeight;
444 SYSPARAMS_LogFont32ATo16( &lpnm32->lfSmCaptionFont, &lpnm16->lfSmCaptionFont );
445 lpnm16->iMenuWidth = lpnm32->iMenuWidth;
446 lpnm16->iMenuHeight = lpnm32->iMenuHeight;
447 SYSPARAMS_LogFont32ATo16( &lpnm32->lfMenuFont, &lpnm16->lfMenuFont );
448 SYSPARAMS_LogFont32ATo16( &lpnm32->lfStatusFont, &lpnm16->lfStatusFont );
449 SYSPARAMS_LogFont32ATo16( &lpnm32->lfMessageFont, &lpnm16->lfMessageFont );
452 static void SYSPARAMS_NonClientMetrics32WTo32A( const NONCLIENTMETRICSW* lpnm32W, LPNONCLIENTMETRICSA lpnm32A )
454 lpnm32A->iBorderWidth = lpnm32W->iBorderWidth;
455 lpnm32A->iScrollWidth = lpnm32W->iScrollWidth;
456 lpnm32A->iScrollHeight = lpnm32W->iScrollHeight;
457 lpnm32A->iCaptionWidth = lpnm32W->iCaptionWidth;
458 lpnm32A->iCaptionHeight = lpnm32W->iCaptionHeight;
459 SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfCaptionFont, &lpnm32A->lfCaptionFont );
460 lpnm32A->iSmCaptionWidth = lpnm32W->iSmCaptionWidth;
461 lpnm32A->iSmCaptionHeight = lpnm32W->iSmCaptionHeight;
462 SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfSmCaptionFont, &lpnm32A->lfSmCaptionFont );
463 lpnm32A->iMenuWidth = lpnm32W->iMenuWidth;
464 lpnm32A->iMenuHeight = lpnm32W->iMenuHeight;
465 SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfMenuFont, &lpnm32A->lfMenuFont );
466 SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfStatusFont, &lpnm32A->lfStatusFont );
467 SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfMessageFont, &lpnm32A->lfMessageFont );
470 static void SYSPARAMS_NonClientMetrics32ATo32W( const NONCLIENTMETRICSA* lpnm32A, LPNONCLIENTMETRICSW lpnm32W )
472 lpnm32W->iBorderWidth = lpnm32A->iBorderWidth;
473 lpnm32W->iScrollWidth = lpnm32A->iScrollWidth;
474 lpnm32W->iScrollHeight = lpnm32A->iScrollHeight;
475 lpnm32W->iCaptionWidth = lpnm32A->iCaptionWidth;
476 lpnm32W->iCaptionHeight = lpnm32A->iCaptionHeight;
477 SYSPARAMS_LogFont32ATo32W( &lpnm32A->lfCaptionFont, &lpnm32W->lfCaptionFont );
478 lpnm32W->iSmCaptionWidth = lpnm32A->iSmCaptionWidth;
479 lpnm32W->iSmCaptionHeight = lpnm32A->iSmCaptionHeight;
480 SYSPARAMS_LogFont32ATo32W( &lpnm32A->lfSmCaptionFont, &lpnm32W->lfSmCaptionFont );
481 lpnm32W->iMenuWidth = lpnm32A->iMenuWidth;
482 lpnm32W->iMenuHeight = lpnm32A->iMenuHeight;
483 SYSPARAMS_LogFont32ATo32W( &lpnm32A->lfMenuFont, &lpnm32W->lfMenuFont );
484 SYSPARAMS_LogFont32ATo32W( &lpnm32A->lfStatusFont, &lpnm32W->lfStatusFont );
485 SYSPARAMS_LogFont32ATo32W( &lpnm32A->lfMessageFont, &lpnm32W->lfMessageFont );
488 /* get text metrics and/or "average" char width of the specified logfont
489 * for the specified dc */
490 static void get_text_metr_size( HDC hdc, LOGFONTW *plf, TEXTMETRICW * ptm, UINT *psz)
492 HFONT hfont, hfontsav;
495 hfont = CreateFontIndirectW( plf);
496 if( !hfont || ( hfontsav = SelectObject( hdc, hfont)) == NULL ) {
499 if( hfont) DeleteObject( hfont);
502 GetTextMetricsW( hdc, ptm);
504 if( !(*psz = GdiGetCharDimensions( hdc, ptm, NULL)))
506 SelectObject( hdc, hfontsav);
507 DeleteObject( hfont);
510 /***********************************************************************
511 * get_volatile_regkey
513 * Return a handle to the volatile registry key used to store
514 * non-permanently modified parameters.
516 static HKEY get_volatile_regkey(void)
518 static HKEY volatile_key;
523 /* This must be non-volatile! */
524 if (RegCreateKeyExW( HKEY_CURRENT_USER, WINE_CURRENT_USER_REGKEY,
525 0, 0, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 0,
526 &key, 0 ) != ERROR_SUCCESS)
528 ERR("Can't create wine registry branch\n");
532 /* @@ Wine registry key: HKCU\Software\Wine\Temporary System Parameters */
533 if (RegCreateKeyExW( key, WINE_CURRENT_USER_REGKEY_TEMP_PARAMS,
534 0, 0, REG_OPTION_VOLATILE, KEY_ALL_ACCESS, 0,
535 &volatile_key, 0 ) != ERROR_SUCCESS)
536 ERR("Can't create non-permanent wine registry branch\n");
544 /***********************************************************************
545 * SYSPARAMS_NotifyChange
547 * Sends notification about system parameter update.
549 static void SYSPARAMS_NotifyChange( UINT uiAction, UINT fWinIni )
551 static const WCHAR emptyW[1];
555 if (fWinIni & SPIF_UPDATEINIFILE)
557 if (fWinIni & (SPIF_SENDWININICHANGE | SPIF_SENDCHANGE))
558 SendMessageTimeoutW(HWND_BROADCAST, WM_SETTINGCHANGE,
559 uiAction, (LPARAM) emptyW,
560 SMTO_ABORTIFHUNG, 2000, NULL );
564 /* FIXME notify other wine processes with internal message */
570 /***********************************************************************
571 * Loads system parameter from user profile.
573 static BOOL SYSPARAMS_LoadRaw( LPCWSTR lpRegKey, LPCWSTR lpValName, LPBYTE lpBuf, DWORD count )
579 memset( lpBuf, 0, count );
580 if ((RegOpenKeyW( get_volatile_regkey(), lpRegKey, &hKey ) == ERROR_SUCCESS) ||
581 (RegOpenKeyW( HKEY_CURRENT_USER, lpRegKey, &hKey ) == ERROR_SUCCESS))
583 ret = !RegQueryValueExW( hKey, lpValName, NULL, &type, (LPBYTE)lpBuf, &count);
589 static BOOL SYSPARAMS_Load( LPCWSTR lpRegKey, LPCWSTR lpValName, LPWSTR lpBuf, DWORD count )
591 return SYSPARAMS_LoadRaw( lpRegKey, lpValName, (LPBYTE)lpBuf, count );
594 /***********************************************************************
595 * Saves system parameter to user profile.
598 /* Save data as-is */
599 static BOOL SYSPARAMS_SaveRaw( LPCWSTR lpRegKey, LPCWSTR lpValName,
600 const BYTE* lpValue, DWORD valueSize,
601 DWORD type, UINT fWinIni )
608 if (fWinIni & SPIF_UPDATEINIFILE)
610 hBaseKey = HKEY_CURRENT_USER;
615 hBaseKey = get_volatile_regkey();
616 dwOptions = REG_OPTION_VOLATILE;
619 if (RegCreateKeyExW( hBaseKey, lpRegKey,
620 0, 0, dwOptions, KEY_ALL_ACCESS,
621 0, &hKey, 0 ) == ERROR_SUCCESS)
623 if (RegSetValueExW( hKey, lpValName, 0, type,
624 lpValue, valueSize) == ERROR_SUCCESS)
627 if (hBaseKey == HKEY_CURRENT_USER)
628 RegDeleteKeyW( get_volatile_regkey(), lpRegKey );
635 /* Convenience function to save strings */
636 static BOOL SYSPARAMS_Save( LPCWSTR lpRegKey, LPCWSTR lpValName, LPCWSTR lpValue,
639 return SYSPARAMS_SaveRaw( lpRegKey, lpValName, (const BYTE*)lpValue,
640 (strlenW(lpValue) + 1)*sizeof(WCHAR), REG_SZ, fWinIni );
643 /* Convenience function to save logical fonts */
644 static BOOL SYSPARAMS_SaveLogFont( LPCWSTR lpRegKey, LPCWSTR lpValName,
645 LPLOGFONTW plf, UINT fWinIni )
647 return SYSPARAMS_SaveRaw( lpRegKey, lpValName, (const BYTE*)plf,
648 sizeof( LOGFONTW), REG_BINARY, fWinIni );
652 static inline HDC get_display_dc(void)
654 static const WCHAR DISPLAY[] = {'D','I','S','P','L','A','Y',0};
655 static HDC display_dc;
656 if (!display_dc) display_dc = CreateICW( DISPLAY, NULL, NULL, NULL );
660 static inline int get_display_dpi(void)
662 static int display_dpi;
663 if (!display_dpi) display_dpi = GetDeviceCaps( get_display_dc(), LOGPIXELSY );
667 /***********************************************************************
668 * SYSPARAMS_Twips2Pixels
670 * Convert a dimension value that was obtained from the registry. These are
671 * quoted as being "twips" values if negative and pixels if positive.
672 * One inch is 1440 twips. So to convert, divide by 1440 to get inches and
673 * multiply that by the dots-per-inch to get the size in pixels.
675 * MSDN Library - April 2001 -> Resource Kits ->
676 * Windows 2000 Resource Kit Reference ->
677 * Technical Reference to the Windows 2000 Registry ->
678 * HKEY_CURRENT_USER -> Control Panel -> Desktop -> WindowMetrics
680 inline static int SYSPARAMS_Twips2Pixels(int x)
683 x = (-x * get_display_dpi() + 720) / 1440;
687 /***********************************************************************
690 * Get a registry entry from the already open key. This allows us to open the
691 * section once and read several values.
693 * Of course this function belongs somewhere more usable but here will do
696 static int get_reg_metric( HKEY hkey, LPCWSTR lpValName, int default_value )
698 int value = default_value;
702 DWORD type, count = sizeof(buffer);
703 if(!RegQueryValueExW( hkey, lpValName, NULL, &type, (LPBYTE)buffer, &count) )
707 /* Are there any utilities for converting registry entries
710 /* FIXME_(reg)("We need reg format converter\n"); */
713 value = atoiW(buffer);
716 return SYSPARAMS_Twips2Pixels(value);
720 /*************************************************************************
721 * SYSPARAMS_SetSysColor
723 static void SYSPARAMS_SetSysColor( int index, COLORREF color )
725 if (index < 0 || index >= NUM_SYS_COLORS) return;
726 SysColors[index] = color;
727 if (SysColorBrushes[index])
729 __wine_make_gdi_object_system( SysColorBrushes[index], FALSE);
730 DeleteObject( SysColorBrushes[index] );
732 SysColorBrushes[index] = CreateSolidBrush( color );
733 __wine_make_gdi_object_system( SysColorBrushes[index], TRUE);
735 if (SysColorPens[index])
737 __wine_make_gdi_object_system( SysColorPens[index], FALSE);
738 DeleteObject( SysColorPens[index] );
740 SysColorPens[index] = CreatePen( PS_SOLID, 1, color );
741 __wine_make_gdi_object_system( SysColorPens[index], TRUE);
744 /* load a uint parameter from the registry */
745 static BOOL get_uint_param( unsigned int idx, LPCWSTR regkey, LPCWSTR value,
746 UINT *value_ptr, UINT *ret_ptr )
748 if (!ret_ptr) return FALSE;
749 if (!spi_loaded[idx])
753 if (SYSPARAMS_Load( regkey, value, buf, sizeof(buf) )) *value_ptr = atoiW( buf );
754 spi_loaded[idx] = TRUE;
756 *ret_ptr = *value_ptr;
760 /* load a twips parameter from the registry */
761 static BOOL get_twips_param( unsigned int idx, LPCWSTR regkey, LPCWSTR value,
762 UINT *value_ptr, UINT *ret_ptr )
764 if (!ret_ptr) return FALSE;
765 if (!spi_loaded[idx])
769 if (SYSPARAMS_Load( regkey, value, buf, sizeof(buf) ))
770 *value_ptr = SYSPARAMS_Twips2Pixels( atoiW(buf) );
771 spi_loaded[idx] = TRUE;
773 *ret_ptr = *value_ptr;
777 /* load a boolean parameter from the registry */
778 static inline BOOL get_bool_param( unsigned int idx, LPCWSTR regkey, LPCWSTR value,
779 BOOL *value_ptr, BOOL *ret_ptr )
781 return get_uint_param( idx, regkey, value, (UINT *)value_ptr, (UINT *)ret_ptr );
784 /* set a uint parameter that is mirrored in two different registry locations */
785 static BOOL set_uint_param_mirrored( unsigned int idx, LPCWSTR regkey, LPCWSTR regkey_mirror,
786 LPCWSTR value, UINT *value_ptr, UINT new_val, UINT fWinIni )
790 wsprintfW(buf, CSu, new_val);
791 if (!SYSPARAMS_Save( regkey, value, buf, fWinIni )) return FALSE;
792 if (regkey_mirror) SYSPARAMS_Save( regkey_mirror, value, buf, fWinIni );
793 *value_ptr = new_val;
794 spi_loaded[idx] = TRUE;
798 /* save an int parameter in registry */
799 static BOOL save_int_param( LPCWSTR regkey, LPCWSTR value, INT *value_ptr,
800 INT new_val, UINT fWinIni )
804 wsprintfW(buf, CSd, new_val);
805 if (!SYSPARAMS_Save( regkey, value, buf, fWinIni )) return FALSE;
806 if( value_ptr) *value_ptr = new_val;
810 /* set an int parameter in the registry */
811 static inline BOOL set_int_param( unsigned int idx, LPCWSTR regkey, LPCWSTR value,
812 INT *value_ptr, INT new_val, UINT fWinIni )
814 BOOL ret = save_int_param( regkey, value, value_ptr, new_val, fWinIni );
815 if (ret) spi_loaded[idx] = TRUE;
819 /* set a uint parameter in the registry */
820 static inline BOOL set_uint_param( unsigned int idx, LPCWSTR regkey, LPCWSTR value,
821 UINT *value_ptr, UINT new_val, UINT fWinIni )
823 return set_uint_param_mirrored( idx, regkey, NULL, value, value_ptr, new_val, fWinIni );
826 /* set a boolean parameter that is mirrored in two different registry locations */
827 static inline BOOL set_bool_param_mirrored( unsigned int idx, LPCWSTR regkey, LPCWSTR regkey_mirror,
828 LPCWSTR value, BOOL *value_ptr, BOOL new_val, UINT fWinIni )
830 return set_uint_param_mirrored( idx, regkey, regkey_mirror, value,
831 (UINT *)value_ptr, new_val, fWinIni );
834 /* set a boolean parameter in the registry */
835 static inline BOOL set_bool_param( unsigned int idx, LPCWSTR regkey, LPCWSTR value,
836 BOOL *value_ptr, BOOL new_val, UINT fWinIni )
838 return set_uint_param( idx, regkey, value, (UINT *)value_ptr, new_val, fWinIni );
841 /* load a boolean parameter from the user preference key */
842 static BOOL get_user_pref_param( UINT offset, UINT mask, BOOL *ret_ptr )
844 if (!ret_ptr) return FALSE;
846 if (!spi_loaded[SPI_USERPREFERENCEMASK_IDX])
848 SYSPARAMS_LoadRaw( SPI_USERPREFERENCEMASK_REGKEY,
849 SPI_USERPREFERENCEMASK_VALNAME,
850 user_prefs, sizeof(user_prefs) );
851 spi_loaded[SPI_USERPREFERENCEMASK_IDX] = TRUE;
853 *ret_ptr = (user_prefs[offset] & mask) != 0;
857 /* set a boolean parameter in the user preference key */
858 static BOOL set_user_pref_param( UINT offset, UINT mask, BOOL value, BOOL fWinIni )
860 SYSPARAMS_LoadRaw( SPI_USERPREFERENCEMASK_REGKEY,
861 SPI_USERPREFERENCEMASK_VALNAME,
862 user_prefs, sizeof(user_prefs) );
863 spi_loaded[SPI_USERPREFERENCEMASK_IDX] = TRUE;
865 if (value) user_prefs[offset] |= mask;
866 else user_prefs[offset] &= ~mask;
868 SYSPARAMS_SaveRaw( SPI_USERPREFERENCEMASK_REGKEY,
869 SPI_USERPREFERENCEMASK_VALNAME,
870 user_prefs, sizeof(user_prefs), REG_BINARY, fWinIni );
874 /***********************************************************************
877 * Initialisation of the system metrics array.
879 void SYSPARAMS_Init(void)
881 HKEY hkey; /* key to the window metrics area of the registry */
886 /* initialize system colors */
888 if (RegCreateKeyExA(HKEY_CURRENT_USER, "Control Panel\\Colors", 0, 0, 0, KEY_ALL_ACCESS, 0, &hkey, 0))
890 for (i = 0; i < NUM_SYS_COLORS; i++)
894 /* first try, registry */
897 DWORD dwDataSize = sizeof(buffer);
898 if (!(RegQueryValueExA(hkey,DefSysColors[i*2], 0, 0, (LPBYTE) buffer, &dwDataSize)))
899 if (sscanf( buffer, "%d %d %d", &r, &g, &b ) == 3) bOk = TRUE;
902 /* second try, win.ini */
905 GetProfileStringA( "colors", DefSysColors[i*2], DefSysColors[i*2+1], buffer, 100 );
906 if (sscanf( buffer, " %d %d %d", &r, &g, &b ) == 3) bOk = TRUE;
909 /* last chance, take the default */
912 int iNumColors = sscanf( DefSysColors[i*2+1], " %d %d %d", &r, &g, &b );
913 assert (iNumColors==3);
916 SYSPARAMS_SetSysColor( i, RGB(r,g,b) );
918 if (hkey) RegCloseKey( hkey );
920 /* create 55AA bitmap */
922 h55AABitmap = CreateBitmap( 8, 8, 1, 1, wPattern55AA );
923 SYSCOLOR_55AABrush = CreatePatternBrush( h55AABitmap );
924 __wine_make_gdi_object_system( SYSCOLOR_55AABrush, TRUE );
928 /***********************************************************************
931 * Tries to retrieve logfont info from the specified key and value
933 static BOOL reg_get_logfont(LPCWSTR key, LPCWSTR value, LOGFONTW *lf)
942 base_keys[0] = get_volatile_regkey();
943 base_keys[1] = HKEY_CURRENT_USER;
945 for(i = 0; i < 2 && !found; i++)
947 if(RegOpenKeyW(base_keys[i], key, &hkey) == ERROR_SUCCESS)
949 size = sizeof(lfbuf);
950 if(RegQueryValueExW(hkey, value, NULL, &type, (LPBYTE)&lfbuf, &size) == ERROR_SUCCESS &&
953 if( size == sizeof(lfbuf))
956 memcpy(lf, &lfbuf, size);
957 } else if( size == sizeof( LOGFONT16))
958 { /* win9x-winME format */
960 SYSPARAMS_LogFont16To32W( (LOGFONT16*) &lfbuf, lf);
962 WARN("Unknown format in key %s value %s, size is %ld\n",
963 debugstr_w( key), debugstr_w( value), size);
968 if( found && lf->lfHeight > 0) {
969 /* positive height value means points ( inch/72 ) */
970 lf->lfHeight = -MulDiv( lf->lfHeight, get_display_dpi(), 72);
975 /* load all the minimized metrics */
976 static void load_minimized_metrics(void)
979 if (RegOpenKeyExW (HKEY_CURRENT_USER, METRICS_REGKEY,
980 0, KEY_QUERY_VALUE, &hkey) != ERROR_SUCCESS) hkey = 0;
982 minimized_metrics.iWidth = max( get_reg_metric(hkey,
983 METRICS_MINWIDTH_VALNAME, minimized_metrics.iWidth), 0);
984 minimized_metrics.iHorzGap = max( get_reg_metric(hkey,
985 METRICS_MINHORZGAP_VALNAME, minimized_metrics.iHorzGap), 0);
986 minimized_metrics.iVertGap = max( get_reg_metric(hkey,
987 METRICS_MINVERTGAP_VALNAME, minimized_metrics.iVertGap), 0);
988 minimized_metrics.iArrange = 0x0f & get_reg_metric(hkey,
989 METRICS_MINARRANGE_VALNAME, minimized_metrics.iArrange);
991 if (hkey) RegCloseKey( hkey );
992 spi_loaded[SPI_MINIMIZEDMETRICS_IDX] = TRUE;
995 /* adjust some of the raw values found in the registry */
996 static void normalize_nonclientmetrics( NONCLIENTMETRICSW *pncm)
999 if( pncm->iBorderWidth < 1) pncm->iBorderWidth = 1;
1000 if( pncm->iCaptionWidth < 8) pncm->iCaptionWidth = 8;
1001 if( pncm->iScrollWidth < 8) pncm->iScrollWidth = 8;
1002 if( pncm->iScrollHeight < 8) pncm->iScrollHeight = 8;
1004 /* get some extra metrics */
1005 get_text_metr_size( get_display_dc(), &pncm->lfMenuFont,
1007 get_text_metr_size( get_display_dc(), &pncm->lfCaptionFont,
1008 NULL, &CaptionFontAvCharWidth);
1010 /* adjust some heights to the corresponding font */
1011 pncm->iMenuHeight = max( pncm->iMenuHeight,
1012 2 + tmMenuFont.tmHeight + tmMenuFont.tmExternalLeading);
1013 get_text_metr_size( get_display_dc(), &pncm->lfCaptionFont, &tm, NULL);
1014 pncm->iCaptionHeight = max( pncm->iCaptionHeight, 2 + tm.tmHeight);
1015 get_text_metr_size( get_display_dc(), &pncm->lfSmCaptionFont, &tm, NULL);
1016 pncm->iSmCaptionHeight = max( pncm->iSmCaptionHeight, 2 + tm.tmHeight);
1019 /* load all the non-client metrics */
1020 static void load_nonclient_metrics(void)
1023 NONCLIENTMETRICSW ncm;
1025 if (RegOpenKeyExW (HKEY_CURRENT_USER, METRICS_REGKEY,
1026 0, KEY_QUERY_VALUE, &hkey) != ERROR_SUCCESS) hkey = 0;
1028 /* initialize geometry entries */
1029 ncm.iBorderWidth = get_reg_metric(hkey, METRICS_BORDERWIDTH_VALNAME, 1);
1030 ncm.iScrollWidth = get_reg_metric(hkey, METRICS_SCROLLWIDTH_VALNAME, 16);
1031 ncm.iScrollHeight = get_reg_metric(hkey, METRICS_SCROLLHEIGHT_VALNAME, 16);
1033 /* size of the normal caption buttons */
1034 ncm.iCaptionHeight = get_reg_metric(hkey, METRICS_CAPTIONHEIGHT_VALNAME, 18);
1035 ncm.iCaptionWidth = get_reg_metric(hkey, METRICS_CAPTIONWIDTH_VALNAME, ncm.iCaptionHeight);
1037 /* caption font metrics */
1038 if (!reg_get_logfont(METRICS_REGKEY, METRICS_CAPTIONLOGFONT_VALNAME, &ncm.lfCaptionFont))
1040 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &ncm.lfCaptionFont, 0 );
1041 ncm.lfCaptionFont.lfWeight = FW_BOLD;
1044 /* size of the small caption buttons */
1045 ncm.iSmCaptionWidth = get_reg_metric(hkey, METRICS_SMCAPTIONWIDTH_VALNAME, 13);
1046 ncm.iSmCaptionHeight = get_reg_metric(hkey, METRICS_SMCAPTIONHEIGHT_VALNAME, 15);
1048 /* small caption font metrics */
1049 if (!reg_get_logfont(METRICS_REGKEY, METRICS_SMCAPTIONLOGFONT_VALNAME, &ncm.lfSmCaptionFont))
1050 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &ncm.lfSmCaptionFont, 0 );
1052 /* menus, FIXME: names of wine.conf entries are bogus */
1054 /* size of the menu (MDI) buttons */
1055 ncm.iMenuHeight = get_reg_metric(hkey, METRICS_MENUHEIGHT_VALNAME, 18);
1056 ncm.iMenuWidth = get_reg_metric(hkey, METRICS_MENUWIDTH_VALNAME, ncm.iMenuHeight);
1058 /* menu font metrics */
1059 if (!reg_get_logfont(METRICS_REGKEY, METRICS_MENULOGFONT_VALNAME, &ncm.lfMenuFont))
1061 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &ncm.lfMenuFont, 0 );
1062 GetProfileStringW( Desktop, MenuFont, ncm.lfCaptionFont.lfFaceName,
1063 ncm.lfMenuFont.lfFaceName, LF_FACESIZE );
1064 ncm.lfMenuFont.lfHeight = -GetProfileIntW( Desktop, MenuFontSize, 11 );
1065 ncm.lfMenuFont.lfWeight = FW_NORMAL;
1068 /* status bar font metrics */
1069 if (!reg_get_logfont(METRICS_REGKEY, METRICS_STATUSLOGFONT_VALNAME, &ncm.lfStatusFont))
1071 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &ncm.lfStatusFont, 0 );
1072 GetProfileStringW( Desktop, StatusFont, ncm.lfCaptionFont.lfFaceName,
1073 ncm.lfStatusFont.lfFaceName, LF_FACESIZE );
1074 ncm.lfStatusFont.lfHeight = -GetProfileIntW( Desktop, StatusFontSize, 11 );
1075 ncm.lfStatusFont.lfWeight = FW_NORMAL;
1078 /* message font metrics */
1079 if (!reg_get_logfont(METRICS_REGKEY, METRICS_MESSAGELOGFONT_VALNAME, &ncm.lfMessageFont))
1081 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &ncm.lfMessageFont, 0 );
1082 GetProfileStringW( Desktop, MessageFont, ncm.lfCaptionFont.lfFaceName,
1083 ncm.lfMessageFont.lfFaceName, LF_FACESIZE );
1084 ncm.lfMessageFont.lfHeight = -GetProfileIntW( Desktop, MessageFontSize, 11 );
1085 ncm.lfMessageFont.lfWeight = FW_NORMAL;
1088 /* some extra fields not in the nonclient structure */
1089 icon_size.cx = icon_size.cy = get_reg_metric( hkey, METRICS_ICONSIZE_VALNAME, 32 );
1091 if (hkey) RegCloseKey( hkey );
1092 normalize_nonclientmetrics( &ncm);
1093 memcpy( &nonclient_metrics, &ncm, sizeof(nonclient_metrics) );
1094 spi_loaded[SPI_NONCLIENTMETRICS_IDX] = TRUE;
1098 /***********************************************************************
1099 * SystemParametersInfoW (USER32.@)
1101 * Each system parameter has flag which shows whether the parameter
1102 * is loaded or not. Parameters, stored directly in SysParametersInfo are
1103 * loaded from registry only when they are requested and the flag is
1104 * "false", after the loading the flag is set to "true". On interprocess
1105 * notification of the parameter change the corresponding parameter flag is
1106 * set to "false". The parameter value will be reloaded when it is requested
1108 * Parameters, backed by or depend on GetSystemMetrics are processed
1109 * differently. These parameters are always loaded. They are reloaded right
1110 * away on interprocess change notification. We can't do lazy loading because
1111 * we don't want to complicate GetSystemMetrics.
1112 * Parameters, backed by X settings are read from corresponding setting.
1113 * On the parameter change request the setting is changed. Interprocess change
1114 * notifications are ignored.
1115 * When parameter value is updated the changed value is stored in permanent
1116 * registry branch if saving is requested. Otherwise it is stored
1117 * in temporary branch
1119 * Some SPI values can also be stored as Twips values in the registry,
1120 * don't forget the conversion!
1122 BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
1123 PVOID pvParam, UINT fWinIni )
1125 #define WINE_SPI_FIXME(x) \
1127 FIXME( "Unimplemented action: %u (%s)\n", x, #x ); \
1128 SetLastError( ERROR_INVALID_SPI_VALUE ); \
1131 #define WINE_SPI_WARN(x) \
1133 WARN( "Ignored action: %u (%s)\n", x, #x ); \
1137 unsigned spi_idx = 0;
1141 case SPI_GETBEEP: /* 1 */
1142 if (!pvParam) return FALSE;
1144 spi_idx = SPI_SETBEEP_IDX;
1145 if (!spi_loaded[spi_idx])
1149 if (SYSPARAMS_Load( SPI_SETBEEP_REGKEY, SPI_SETBEEP_VALNAME, buf, sizeof(buf) ))
1150 beep_active = !lstrcmpiW( Yes, buf );
1151 spi_loaded[spi_idx] = TRUE;
1154 *(BOOL *)pvParam = beep_active;
1157 case SPI_SETBEEP: /* 2 */
1158 spi_idx = SPI_SETBEEP_IDX;
1159 if (SYSPARAMS_Save( SPI_SETBEEP_REGKEY, SPI_SETBEEP_VALNAME,
1160 (uiParam ? Yes : No), fWinIni ))
1162 beep_active = uiParam;
1163 spi_loaded[spi_idx] = TRUE;
1169 case SPI_GETMOUSE: /* 3 */
1170 if (!pvParam) return FALSE;
1172 spi_idx = SPI_SETMOUSE_IDX;
1173 if (!spi_loaded[spi_idx])
1177 if (SYSPARAMS_Load( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME1,
1179 mouse_threshold1 = atoiW( buf );
1180 if (SYSPARAMS_Load( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME2,
1182 mouse_threshold2 = atoiW( buf );
1183 if (SYSPARAMS_Load( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME3,
1185 mouse_speed = atoiW( buf );
1186 spi_loaded[spi_idx] = TRUE;
1188 ((INT *)pvParam)[0] = mouse_threshold1;
1189 ((INT *)pvParam)[1] = mouse_threshold2;
1190 ((INT *)pvParam)[2] = mouse_speed;
1193 case SPI_SETMOUSE: /* 4 */
1195 if (!pvParam) return FALSE;
1196 ret = set_int_param( SPI_SETMOUSE_IDX, SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME1,
1197 &mouse_threshold1, ((INT *)pvParam)[0], fWinIni);
1199 save_int_param( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME2,
1200 &mouse_threshold2, ((INT *)pvParam)[1], fWinIni);
1201 save_int_param( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME3,
1202 &mouse_speed, ((INT *)pvParam)[2], fWinIni);
1208 ret = get_twips_param( SPI_SETBORDER_IDX,
1209 SPI_SETBORDER_REGKEY,
1210 SPI_SETBORDER_VALNAME,
1212 if( *(INT*)pvParam < 1) *(INT*)pvParam = 1;
1216 nonclient_metrics.iBorderWidth = uiParam > 0 ? uiParam : 1;
1217 /* raw value goes to registry */
1218 ret = set_uint_param( SPI_SETBORDER_IDX,
1219 SPI_SETBORDER_REGKEY,
1220 SPI_SETBORDER_VALNAME,
1221 &border, uiParam, fWinIni );
1224 case SPI_GETKEYBOARDSPEED:
1225 ret = get_uint_param( SPI_SETKEYBOARDSPEED_IDX,
1226 SPI_SETKEYBOARDSPEED_REGKEY,
1227 SPI_SETKEYBOARDSPEED_VALNAME,
1228 &keyboard_speed, pvParam );
1231 case SPI_SETKEYBOARDSPEED:
1232 if (uiParam > 31) uiParam = 31;
1233 ret = set_uint_param( SPI_SETKEYBOARDSPEED_IDX,
1234 SPI_SETKEYBOARDSPEED_REGKEY,
1235 SPI_SETKEYBOARDSPEED_VALNAME,
1236 &keyboard_speed, uiParam, fWinIni );
1239 /* not implemented in Windows */
1240 WINE_SPI_WARN(SPI_LANGDRIVER); /* 12 */
1242 case SPI_ICONHORIZONTALSPACING:
1243 if (pvParam != NULL)
1245 ret = get_twips_param( SPI_ICONHORIZONTALSPACING_IDX,
1246 SPI_ICONHORIZONTALSPACING_REGKEY,
1247 SPI_ICONHORIZONTALSPACING_VALNAME,
1248 (UINT*)&icon_metrics.iHorzSpacing, pvParam );
1252 if (uiParam < 32) uiParam = 32;
1253 ret = set_uint_param( SPI_ICONHORIZONTALSPACING_IDX,
1254 SPI_ICONHORIZONTALSPACING_REGKEY,
1255 SPI_ICONHORIZONTALSPACING_VALNAME,
1256 (UINT*)&icon_metrics.iHorzSpacing, uiParam, fWinIni );
1260 case SPI_GETSCREENSAVETIMEOUT:
1261 ret = get_uint_param( SPI_SETSCREENSAVETIMEOUT_IDX,
1262 SPI_SETSCREENSAVETIMEOUT_REGKEY,
1263 SPI_SETSCREENSAVETIMEOUT_VALNAME,
1264 &screensave_timeout, pvParam );
1267 case SPI_SETSCREENSAVETIMEOUT:
1268 ret = set_uint_param( SPI_SETSCREENSAVETIMEOUT_IDX,
1269 SPI_SETSCREENSAVETIMEOUT_REGKEY,
1270 SPI_SETSCREENSAVETIMEOUT_VALNAME,
1271 &screensave_timeout, uiParam, fWinIni );
1274 case SPI_GETSCREENSAVEACTIVE: /* 16 */
1275 if (!pvParam) return FALSE;
1276 *(BOOL *)pvParam = USER_Driver->pGetScreenSaveActive();
1279 case SPI_SETSCREENSAVEACTIVE: /* 17 */
1283 wsprintfW(buf, CSu, uiParam);
1284 USER_Driver->pSetScreenSaveActive( uiParam );
1285 /* saved value does not affect Wine */
1286 SYSPARAMS_Save( SPI_SETSCREENSAVEACTIVE_REGKEY,
1287 SPI_SETSCREENSAVEACTIVE_VALNAME,
1292 case SPI_GETGRIDGRANULARITY:
1293 ret = get_uint_param( SPI_SETGRIDGRANULARITY_IDX,
1294 SPI_SETGRIDGRANULARITY_REGKEY,
1295 SPI_SETGRIDGRANULARITY_VALNAME,
1296 &grid_granularity, pvParam );
1299 case SPI_SETGRIDGRANULARITY:
1300 ret = set_uint_param( SPI_SETGRIDGRANULARITY_IDX,
1301 SPI_SETGRIDGRANULARITY_REGKEY,
1302 SPI_SETGRIDGRANULARITY_VALNAME,
1303 &grid_granularity, uiParam, fWinIni );
1306 case SPI_SETDESKWALLPAPER: /* 20 */
1307 if (!pvParam || !SetDeskWallPaper( (LPSTR)pvParam )) return FALSE;
1308 SYSPARAMS_Save(SPI_SETDESKWALLPAPER_REGKEY, SPI_SETDESKWALLPAPER_VALNAME, pvParam, fWinIni);
1311 case SPI_SETDESKPATTERN: /* 21 */
1312 /* FIXME: the ability to specify a pattern in pvParam
1313 doesn't seem to be documented for Win32 */
1314 if ((INT16)uiParam == -1)
1317 GetProfileStringW( Desktop, Pattern,
1319 buf, sizeof(buf)/sizeof(WCHAR) );
1320 ret = DESKTOP_SetPattern( buf );
1322 ret = DESKTOP_SetPattern( (LPWSTR)pvParam );
1325 case SPI_GETKEYBOARDDELAY:
1326 ret = get_uint_param( SPI_SETKEYBOARDDELAY_IDX,
1327 SPI_SETKEYBOARDDELAY_REGKEY,
1328 SPI_SETKEYBOARDDELAY_VALNAME,
1329 &keyboard_delay, pvParam );
1332 case SPI_SETKEYBOARDDELAY:
1333 ret = set_uint_param( SPI_SETKEYBOARDDELAY_IDX,
1334 SPI_SETKEYBOARDDELAY_REGKEY,
1335 SPI_SETKEYBOARDDELAY_VALNAME,
1336 &keyboard_delay, uiParam, fWinIni );
1339 case SPI_ICONVERTICALSPACING:
1340 if (pvParam != NULL)
1342 ret = get_twips_param( SPI_ICONVERTICALSPACING_IDX,
1343 SPI_ICONVERTICALSPACING_REGKEY,
1344 SPI_ICONVERTICALSPACING_VALNAME,
1345 (UINT*)&icon_metrics.iVertSpacing, pvParam );
1346 if( icon_metrics.iVertSpacing < 32)
1347 icon_metrics.iVertSpacing = 32;
1351 if (uiParam < 32) uiParam = 32;
1352 ret = set_uint_param( SPI_ICONVERTICALSPACING_IDX,
1353 SPI_ICONVERTICALSPACING_REGKEY,
1354 SPI_ICONVERTICALSPACING_VALNAME,
1355 (UINT*)&icon_metrics.iVertSpacing, uiParam, fWinIni );
1359 case SPI_GETICONTITLEWRAP:
1360 ret = get_bool_param( SPI_SETICONTITLEWRAP_IDX,
1361 SPI_SETICONTITLEWRAP_REGKEY1,
1362 SPI_SETICONTITLEWRAP_VALNAME,
1363 &icon_metrics.iTitleWrap, pvParam );
1366 case SPI_SETICONTITLEWRAP:
1367 ret = set_bool_param_mirrored( SPI_SETICONTITLEWRAP_IDX,
1368 SPI_SETICONTITLEWRAP_REGKEY1,
1369 SPI_SETICONTITLEWRAP_REGKEY2,
1370 SPI_SETICONTITLEWRAP_VALNAME,
1371 &icon_metrics.iTitleWrap, uiParam, fWinIni );
1374 case SPI_GETMENUDROPALIGNMENT:
1375 ret = get_uint_param( SPI_SETMENUDROPALIGNMENT_IDX,
1376 SPI_SETMENUDROPALIGNMENT_REGKEY1,
1377 SPI_SETMENUDROPALIGNMENT_VALNAME,
1378 &menu_drop_alignment, pvParam );
1381 case SPI_SETMENUDROPALIGNMENT:
1382 ret = set_uint_param_mirrored( SPI_SETMENUDROPALIGNMENT_IDX,
1383 SPI_SETMENUDROPALIGNMENT_REGKEY1,
1384 SPI_SETMENUDROPALIGNMENT_REGKEY2,
1385 SPI_SETMENUDROPALIGNMENT_VALNAME,
1386 &menu_drop_alignment, uiParam, fWinIni );
1389 case SPI_SETDOUBLECLKWIDTH:
1390 ret = set_uint_param_mirrored( SPI_SETDOUBLECLKWIDTH_IDX,
1391 SPI_SETDOUBLECLKWIDTH_REGKEY1,
1392 SPI_SETDOUBLECLKWIDTH_REGKEY2,
1393 SPI_SETDOUBLECLKWIDTH_VALNAME,
1394 &double_click_width, uiParam, fWinIni );
1397 case SPI_SETDOUBLECLKHEIGHT:
1398 ret = set_uint_param_mirrored( SPI_SETDOUBLECLKHEIGHT_IDX,
1399 SPI_SETDOUBLECLKHEIGHT_REGKEY1,
1400 SPI_SETDOUBLECLKHEIGHT_REGKEY2,
1401 SPI_SETDOUBLECLKHEIGHT_VALNAME,
1402 &double_click_height, uiParam, fWinIni );
1405 case SPI_GETICONTITLELOGFONT:
1409 if (!pvParam) return FALSE;
1411 spi_idx = SPI_SETICONTITLELOGFONT_IDX;
1412 if (!spi_loaded[spi_idx])
1414 if (!reg_get_logfont( SPI_SETICONTITLELOGFONT_REGKEY,
1415 SPI_SETICONTITLELOGFONT_VALNAME, &icon_metrics.lfFont ))
1418 * The 'default GDI fonts' seems to be returned.
1419 * If a returned font is not a correct font in your environment,
1420 * please try to fix objects/gdiobj.c at first.
1422 GetObjectW( GetStockObject( DEFAULT_GUI_FONT ), sizeof(LOGFONTW), &lfDefault );
1424 GetProfileStringW( Desktop, IconTitleFaceName,
1425 lfDefault.lfFaceName,
1426 icon_metrics.lfFont.lfFaceName,
1428 icon_metrics.lfFont.lfHeight = -GetProfileIntW( Desktop, IconTitleSize, 11 );
1429 icon_metrics.lfFont.lfWidth = 0;
1430 icon_metrics.lfFont.lfEscapement = icon_metrics.lfFont.lfOrientation = 0;
1431 icon_metrics.lfFont.lfWeight = FW_NORMAL;
1432 icon_metrics.lfFont.lfItalic = FALSE;
1433 icon_metrics.lfFont.lfStrikeOut = FALSE;
1434 icon_metrics.lfFont.lfUnderline = FALSE;
1435 icon_metrics.lfFont.lfCharSet = lfDefault.lfCharSet; /* at least 'charset' should not be hard-coded */
1436 icon_metrics.lfFont.lfOutPrecision = OUT_DEFAULT_PRECIS;
1437 icon_metrics.lfFont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
1438 icon_metrics.lfFont.lfQuality = DEFAULT_QUALITY;
1439 icon_metrics.lfFont.lfPitchAndFamily = DEFAULT_PITCH;
1440 spi_loaded[spi_idx] = TRUE;
1443 *(LOGFONTW *)pvParam = icon_metrics.lfFont;
1447 case SPI_SETDOUBLECLICKTIME:
1448 ret = set_uint_param( SPI_SETDOUBLECLICKTIME_IDX,
1449 SPI_SETDOUBLECLICKTIME_REGKEY,
1450 SPI_SETDOUBLECLICKTIME_VALNAME,
1451 &double_click_time, uiParam, fWinIni );
1454 case SPI_SETMOUSEBUTTONSWAP:
1455 ret = set_bool_param( SPI_SETMOUSEBUTTONSWAP_IDX,
1456 SPI_SETMOUSEBUTTONSWAP_REGKEY,
1457 SPI_SETMOUSEBUTTONSWAP_VALNAME,
1458 &swap_buttons, uiParam, fWinIni );
1461 case SPI_SETICONTITLELOGFONT: /* 34 */
1462 if( uiParam == sizeof( ICONMETRICSW)) {
1463 ret = SYSPARAMS_SaveLogFont( SPI_SETICONTITLELOGFONT_REGKEY,
1464 SPI_SETICONTITLELOGFONT_VALNAME, (LOGFONTW *)pvParam, fWinIni);
1466 icon_metrics.lfFont = *(LOGFONTW *)pvParam;
1467 spi_loaded[SPI_SETICONTITLELOGFONT_IDX] = TRUE;
1473 case SPI_GETFASTTASKSWITCH: /* 35 */
1474 if (!pvParam) return FALSE;
1475 *(BOOL *)pvParam = 1;
1478 case SPI_SETFASTTASKSWITCH: /* 36 */
1479 /* the action is disabled */
1483 case SPI_SETDRAGFULLWINDOWS:
1484 ret = set_bool_param( SPI_SETDRAGFULLWINDOWS_IDX,
1485 SPI_SETDRAGFULLWINDOWS_REGKEY,
1486 SPI_SETDRAGFULLWINDOWS_VALNAME,
1487 &drag_full_windows, uiParam, fWinIni );
1490 case SPI_GETDRAGFULLWINDOWS:
1491 ret = get_bool_param( SPI_SETDRAGFULLWINDOWS_IDX,
1492 SPI_SETDRAGFULLWINDOWS_REGKEY,
1493 SPI_SETDRAGFULLWINDOWS_VALNAME,
1494 &drag_full_windows, pvParam );
1497 case SPI_GETNONCLIENTMETRICS:
1499 LPNONCLIENTMETRICSW lpnm = pvParam;
1501 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
1503 if (lpnm && lpnm->cbSize == sizeof(NONCLIENTMETRICSW))
1504 memcpy( lpnm, &nonclient_metrics, sizeof(*lpnm) );
1510 case SPI_SETNONCLIENTMETRICS:
1512 LPNONCLIENTMETRICSW lpnm = pvParam;
1514 if (lpnm && lpnm->cbSize == sizeof(NONCLIENTMETRICSW))
1516 NONCLIENTMETRICSW ncm;
1517 ret = set_uint_param( SPI_SETBORDER_IDX,
1518 SPI_SETBORDER_REGKEY, SPI_SETBORDER_VALNAME,
1519 &border, lpnm->iBorderWidth, fWinIni );
1520 if( ret) ret = save_int_param( METRICS_REGKEY,
1521 METRICS_SCROLLWIDTH_VALNAME, NULL,
1522 lpnm->iScrollWidth, fWinIni );
1523 if( ret) ret = save_int_param( METRICS_REGKEY,
1524 METRICS_SCROLLHEIGHT_VALNAME, NULL,
1525 lpnm->iScrollHeight, fWinIni );
1526 if( ret) ret = save_int_param( METRICS_REGKEY,
1527 METRICS_CAPTIONWIDTH_VALNAME, NULL,
1528 lpnm->iCaptionWidth, fWinIni );
1529 if( ret) ret = save_int_param( METRICS_REGKEY,
1530 METRICS_CAPTIONHEIGHT_VALNAME, NULL,
1531 lpnm->iCaptionHeight, fWinIni );
1532 if( ret) ret = save_int_param( METRICS_REGKEY,
1533 METRICS_SMCAPTIONWIDTH_VALNAME, NULL,
1534 lpnm->iSmCaptionWidth, fWinIni );
1535 if( ret) ret = save_int_param( METRICS_REGKEY,
1536 METRICS_SMCAPTIONHEIGHT_VALNAME, NULL,
1537 lpnm->iSmCaptionHeight, fWinIni );
1538 if( ret) ret = save_int_param( METRICS_REGKEY,
1539 METRICS_MENUWIDTH_VALNAME, NULL,
1540 lpnm->iMenuWidth, fWinIni );
1541 if( ret) ret = save_int_param( METRICS_REGKEY,
1542 METRICS_MENUHEIGHT_VALNAME, NULL,
1543 lpnm->iMenuHeight, fWinIni );
1544 if( ret) ret = SYSPARAMS_SaveLogFont(
1545 METRICS_REGKEY, METRICS_MENULOGFONT_VALNAME,
1546 &lpnm->lfMenuFont, fWinIni);
1547 if( ret) ret = SYSPARAMS_SaveLogFont(
1548 METRICS_REGKEY, METRICS_CAPTIONLOGFONT_VALNAME,
1549 &lpnm->lfCaptionFont, fWinIni);
1550 if( ret) ret = SYSPARAMS_SaveLogFont(
1551 METRICS_REGKEY, METRICS_SMCAPTIONLOGFONT_VALNAME,
1552 &lpnm->lfSmCaptionFont, fWinIni);
1553 if( ret) ret = SYSPARAMS_SaveLogFont(
1554 METRICS_REGKEY, METRICS_STATUSLOGFONT_VALNAME,
1555 &lpnm->lfStatusFont, fWinIni);
1556 if( ret) ret = SYSPARAMS_SaveLogFont(
1557 METRICS_REGKEY, METRICS_MESSAGELOGFONT_VALNAME,
1558 &lpnm->lfMessageFont, fWinIni);
1560 memcpy( &ncm, lpnm, sizeof(nonclient_metrics) );
1561 normalize_nonclientmetrics( &ncm);
1562 memcpy( &nonclient_metrics, &ncm, sizeof(nonclient_metrics) );
1563 spi_loaded[SPI_NONCLIENTMETRICS_IDX] = TRUE;
1569 case SPI_GETMINIMIZEDMETRICS:
1571 MINIMIZEDMETRICS * lpMm = pvParam;
1572 if (lpMm && lpMm->cbSize == sizeof(*lpMm)) {
1573 if( spi_loaded[SPI_MINIMIZEDMETRICS_IDX]) load_minimized_metrics();
1574 memcpy( lpMm, &minimized_metrics, sizeof(*lpMm) );
1580 case SPI_SETMINIMIZEDMETRICS:
1582 MINIMIZEDMETRICS * lpMm = pvParam;
1583 if (lpMm && lpMm->cbSize == sizeof(*lpMm)) {
1584 ret = save_int_param( METRICS_REGKEY, METRICS_MINWIDTH_VALNAME,
1585 &minimized_metrics.iWidth, max( lpMm->iWidth, 0), fWinIni);
1586 if( ret) ret = save_int_param( METRICS_REGKEY,
1587 METRICS_MINHORZGAP_VALNAME, &minimized_metrics.iHorzGap,
1588 max( lpMm->iHorzGap, 0), fWinIni);
1589 if( ret) ret = save_int_param( METRICS_REGKEY,
1590 METRICS_MINVERTGAP_VALNAME, &minimized_metrics.iVertGap,
1591 max( lpMm->iVertGap, 0), fWinIni);
1592 if( ret) ret = save_int_param( METRICS_REGKEY,
1593 METRICS_MINARRANGE_VALNAME, &minimized_metrics.iArrange,
1594 0x0f & lpMm->iArrange, fWinIni);
1595 if( ret) spi_loaded[SPI_MINIMIZEDMETRICS_IDX] = TRUE;
1601 case SPI_GETICONMETRICS:
1603 LPICONMETRICSW lpIcon = pvParam;
1604 if(lpIcon && lpIcon->cbSize == sizeof(*lpIcon))
1606 SystemParametersInfoW( SPI_ICONHORIZONTALSPACING, 0,
1607 &lpIcon->iHorzSpacing, FALSE );
1608 SystemParametersInfoW( SPI_ICONVERTICALSPACING, 0,
1609 &lpIcon->iVertSpacing, FALSE );
1610 SystemParametersInfoW( SPI_GETICONTITLEWRAP, 0,
1611 &lpIcon->iTitleWrap, FALSE );
1612 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0,
1613 &lpIcon->lfFont, FALSE );
1622 case SPI_SETICONMETRICS:
1624 LPICONMETRICSW lpIcon = pvParam;
1625 if (lpIcon && lpIcon->cbSize == sizeof(*lpIcon)) {
1626 ret = set_int_param( SPI_ICONVERTICALSPACING_IDX,
1627 SPI_ICONVERTICALSPACING_REGKEY,
1628 SPI_ICONVERTICALSPACING_VALNAME,
1629 &icon_metrics.iVertSpacing,
1630 lpIcon->iVertSpacing, fWinIni);
1632 ret = set_int_param( SPI_ICONHORIZONTALSPACING_IDX,
1633 SPI_ICONHORIZONTALSPACING_REGKEY,
1634 SPI_ICONHORIZONTALSPACING_VALNAME,
1635 &icon_metrics.iHorzSpacing,
1636 lpIcon->iHorzSpacing, fWinIni );
1639 ret = set_bool_param_mirrored( SPI_SETICONTITLEWRAP_IDX,
1640 SPI_SETICONTITLEWRAP_REGKEY1, SPI_SETICONTITLEWRAP_REGKEY2,
1641 SPI_SETICONTITLEWRAP_VALNAME, &icon_metrics.iTitleWrap,
1642 lpIcon->iTitleWrap, fWinIni );
1644 if( ret) ret = SYSPARAMS_SaveLogFont( SPI_SETICONTITLELOGFONT_REGKEY,
1645 SPI_SETICONTITLELOGFONT_VALNAME, &lpIcon->lfFont, fWinIni);
1647 icon_metrics.lfFont = lpIcon->lfFont;
1648 spi_loaded[SPI_SETICONTITLELOGFONT_IDX] = TRUE;
1655 case SPI_SETWORKAREA: /* 47 WINVER >= 0x400 */
1657 if (!pvParam) return FALSE;
1659 spi_idx = SPI_SETWORKAREA_IDX;
1660 CopyRect( &work_area, (RECT *)pvParam );
1661 spi_loaded[spi_idx] = TRUE;
1665 case SPI_GETWORKAREA: /* 48 WINVER >= 0x400 */
1667 if (!pvParam) return FALSE;
1669 spi_idx = SPI_SETWORKAREA_IDX;
1670 if (!spi_loaded[spi_idx])
1672 SetRect( &work_area, 0, 0,
1673 GetSystemMetrics( SM_CXSCREEN ),
1674 GetSystemMetrics( SM_CYSCREEN ) );
1675 spi_loaded[spi_idx] = TRUE;
1677 CopyRect( (RECT *)pvParam, &work_area );
1682 WINE_SPI_FIXME(SPI_SETPENWINDOWS); /* 49 WINVER >= 0x400 */
1684 case SPI_GETFILTERKEYS: /* 50 */
1686 LPFILTERKEYS lpFilterKeys = (LPFILTERKEYS)pvParam;
1687 WARN("SPI_GETFILTERKEYS not fully implemented\n");
1688 if (lpFilterKeys && lpFilterKeys->cbSize == sizeof(FILTERKEYS))
1690 /* Indicate that no FilterKeys feature available */
1691 lpFilterKeys->dwFlags = 0;
1692 lpFilterKeys->iWaitMSec = 0;
1693 lpFilterKeys->iDelayMSec = 0;
1694 lpFilterKeys->iRepeatMSec = 0;
1695 lpFilterKeys->iBounceMSec = 0;
1703 WINE_SPI_FIXME(SPI_SETFILTERKEYS); /* 51 */
1705 case SPI_GETTOGGLEKEYS: /* 52 */
1707 LPTOGGLEKEYS lpToggleKeys = (LPTOGGLEKEYS)pvParam;
1708 WARN("SPI_GETTOGGLEKEYS not fully implemented\n");
1709 if (lpToggleKeys && lpToggleKeys->cbSize == sizeof(TOGGLEKEYS))
1711 /* Indicate that no ToggleKeys feature available */
1712 lpToggleKeys->dwFlags = 0;
1720 WINE_SPI_FIXME(SPI_SETTOGGLEKEYS); /* 53 */
1722 case SPI_GETMOUSEKEYS: /* 54 */
1724 LPMOUSEKEYS lpMouseKeys = (LPMOUSEKEYS)pvParam;
1725 WARN("SPI_GETMOUSEKEYS not fully implemented\n");
1726 if (lpMouseKeys && lpMouseKeys->cbSize == sizeof(MOUSEKEYS))
1728 /* Indicate that no MouseKeys feature available */
1729 lpMouseKeys->dwFlags = 0;
1730 lpMouseKeys->iMaxSpeed = 360;
1731 lpMouseKeys->iTimeToMaxSpeed = 1000;
1732 lpMouseKeys->iCtrlSpeed = 0;
1733 lpMouseKeys->dwReserved1 = 0;
1734 lpMouseKeys->dwReserved2 = 0;
1742 WINE_SPI_FIXME(SPI_SETMOUSEKEYS); /* 55 */
1744 case SPI_GETSHOWSOUNDS:
1745 ret = get_bool_param( SPI_SETSHOWSOUNDS_IDX,
1746 SPI_SETSHOWSOUNDS_REGKEY,
1747 SPI_SETSHOWSOUNDS_VALNAME,
1748 &show_sounds, pvParam );
1751 case SPI_SETSHOWSOUNDS:
1752 ret = set_bool_param( SPI_SETSHOWSOUNDS_IDX,
1753 SPI_SETSHOWSOUNDS_REGKEY,
1754 SPI_SETSHOWSOUNDS_VALNAME,
1755 &show_sounds, uiParam, fWinIni );
1758 case SPI_GETSTICKYKEYS: /* 58 */
1760 LPSTICKYKEYS lpStickyKeys = (LPSTICKYKEYS)pvParam;
1761 WARN("SPI_GETSTICKYKEYS not fully implemented\n");
1762 if (lpStickyKeys && lpStickyKeys->cbSize == sizeof(STICKYKEYS))
1764 /* Indicate that no StickyKeys feature available */
1765 lpStickyKeys->dwFlags = 0;
1773 WINE_SPI_FIXME(SPI_SETSTICKYKEYS); /* 59 */
1775 case SPI_GETACCESSTIMEOUT: /* 60 */
1777 LPACCESSTIMEOUT lpAccessTimeout = (LPACCESSTIMEOUT)pvParam;
1778 WARN("SPI_GETACCESSTIMEOUT not fully implemented\n");
1779 if (lpAccessTimeout && lpAccessTimeout->cbSize == sizeof(ACCESSTIMEOUT))
1781 /* Indicate that no accessibility features timeout is available */
1782 lpAccessTimeout->dwFlags = 0;
1783 lpAccessTimeout->iTimeOutMSec = 0;
1791 WINE_SPI_FIXME(SPI_SETACCESSTIMEOUT); /* 61 */
1793 case SPI_GETSERIALKEYS: /* 62 WINVER >= 0x400 */
1795 LPSERIALKEYSW lpSerialKeysW = (LPSERIALKEYSW)pvParam;
1796 WARN("SPI_GETSERIALKEYS not fully implemented\n");
1797 if (lpSerialKeysW && lpSerialKeysW->cbSize == sizeof(SERIALKEYSW))
1799 /* Indicate that no SerialKeys feature available */
1800 lpSerialKeysW->dwFlags = 0;
1801 lpSerialKeysW->lpszActivePort = NULL;
1802 lpSerialKeysW->lpszPort = NULL;
1803 lpSerialKeysW->iBaudRate = 0;
1804 lpSerialKeysW->iPortState = 0;
1812 WINE_SPI_FIXME(SPI_SETSERIALKEYS); /* 63 WINVER >= 0x400 */
1814 case SPI_GETSOUNDSENTRY: /* 64 */
1816 LPSOUNDSENTRYW lpSoundSentryW = (LPSOUNDSENTRYW)pvParam;
1817 WARN("SPI_GETSOUNDSENTRY not fully implemented\n");
1818 if (lpSoundSentryW && lpSoundSentryW->cbSize == sizeof(SOUNDSENTRYW))
1820 /* Indicate that no SoundSentry feature available */
1821 lpSoundSentryW->dwFlags = 0;
1822 lpSoundSentryW->iFSTextEffect = 0;
1823 lpSoundSentryW->iFSTextEffectMSec = 0;
1824 lpSoundSentryW->iFSTextEffectColorBits = 0;
1825 lpSoundSentryW->iFSGrafEffect = 0;
1826 lpSoundSentryW->iFSGrafEffectMSec = 0;
1827 lpSoundSentryW->iFSGrafEffectColor = 0;
1828 lpSoundSentryW->iWindowsEffect = 0;
1829 lpSoundSentryW->iWindowsEffectMSec = 0;
1830 lpSoundSentryW->lpszWindowsEffectDLL = 0;
1831 lpSoundSentryW->iWindowsEffectOrdinal = 0;
1839 WINE_SPI_FIXME(SPI_SETSOUNDSENTRY); /* 65 */
1841 case SPI_GETHIGHCONTRAST: /* 66 WINVER >= 0x400 */
1843 LPHIGHCONTRASTW lpHighContrastW = (LPHIGHCONTRASTW)pvParam;
1844 WARN("SPI_GETHIGHCONTRAST not fully implemented\n");
1845 if (lpHighContrastW && lpHighContrastW->cbSize == sizeof(HIGHCONTRASTW))
1847 /* Indicate that no high contrast feature available */
1848 lpHighContrastW->dwFlags = 0;
1849 lpHighContrastW->lpszDefaultScheme = NULL;
1857 WINE_SPI_FIXME(SPI_SETHIGHCONTRAST); /* 67 WINVER >= 0x400 */
1859 case SPI_GETKEYBOARDPREF:
1860 ret = get_bool_param( SPI_SETKEYBOARDPREF_IDX,
1861 SPI_SETKEYBOARDPREF_REGKEY,
1862 SPI_SETKEYBOARDPREF_VALNAME,
1863 &keyboard_pref, pvParam );
1866 case SPI_SETKEYBOARDPREF:
1867 ret = set_bool_param( SPI_SETKEYBOARDPREF_IDX,
1868 SPI_SETKEYBOARDPREF_REGKEY,
1869 SPI_SETKEYBOARDPREF_VALNAME,
1870 &keyboard_pref, uiParam, fWinIni );
1873 case SPI_GETSCREENREADER:
1874 ret = get_bool_param( SPI_SETSCREENREADER_IDX,
1875 SPI_SETSCREENREADER_REGKEY,
1876 SPI_SETSCREENREADER_VALNAME,
1877 &screen_reader, pvParam );
1880 case SPI_SETSCREENREADER:
1881 ret = set_bool_param( SPI_SETSCREENREADER_IDX,
1882 SPI_SETSCREENREADER_REGKEY,
1883 SPI_SETSCREENREADER_VALNAME,
1884 &screen_reader, uiParam, fWinIni );
1887 case SPI_GETANIMATION: /* 72 WINVER >= 0x400 */
1889 LPANIMATIONINFO lpAnimInfo = (LPANIMATIONINFO)pvParam;
1891 /* Tell it "disabled" */
1892 if (lpAnimInfo && lpAnimInfo->cbSize == sizeof(ANIMATIONINFO))
1893 lpAnimInfo->iMinAnimate = 0; /* Minimise and restore animation is disabled (nonzero == enabled) */
1898 WINE_SPI_WARN(SPI_SETANIMATION); /* 73 WINVER >= 0x400 */
1900 case SPI_GETFONTSMOOTHING:
1901 ret = get_uint_param( SPI_SETFONTSMOOTHING_IDX,
1902 SPI_SETFONTSMOOTHING_REGKEY,
1903 SPI_SETFONTSMOOTHING_VALNAME,
1904 &font_smoothing, pvParam );
1907 case SPI_SETFONTSMOOTHING:
1908 ret = set_uint_param( SPI_SETFONTSMOOTHING_IDX,
1909 SPI_SETFONTSMOOTHING_REGKEY,
1910 SPI_SETFONTSMOOTHING_VALNAME,
1911 &font_smoothing, uiParam, fWinIni );
1914 WINE_SPI_FIXME(SPI_SETDRAGWIDTH); /* 76 WINVER >= 0x400 */
1915 WINE_SPI_FIXME(SPI_SETDRAGHEIGHT); /* 77 WINVER >= 0x400 */
1917 WINE_SPI_FIXME(SPI_SETHANDHELD); /* 78 WINVER >= 0x400 */
1919 WINE_SPI_FIXME(SPI_GETLOWPOWERTIMEOUT); /* 79 WINVER >= 0x400 */
1920 WINE_SPI_FIXME(SPI_GETPOWEROFFTIMEOUT); /* 80 WINVER >= 0x400 */
1921 WINE_SPI_FIXME(SPI_SETLOWPOWERTIMEOUT); /* 81 WINVER >= 0x400 */
1922 WINE_SPI_FIXME(SPI_SETPOWEROFFTIMEOUT); /* 82 WINVER >= 0x400 */
1924 case SPI_GETLOWPOWERACTIVE:
1925 ret = get_bool_param( SPI_SETLOWPOWERACTIVE_IDX,
1926 SPI_SETLOWPOWERACTIVE_REGKEY,
1927 SPI_SETLOWPOWERACTIVE_VALNAME,
1928 &lowpoweractive, pvParam );
1931 case SPI_GETPOWEROFFACTIVE:
1932 ret = get_bool_param( SPI_SETPOWEROFFACTIVE_IDX,
1933 SPI_SETPOWEROFFACTIVE_REGKEY,
1934 SPI_SETPOWEROFFACTIVE_VALNAME,
1935 &poweroffactive, pvParam );
1938 case SPI_SETLOWPOWERACTIVE:
1939 ret = set_bool_param( SPI_SETLOWPOWERACTIVE_IDX,
1940 SPI_SETLOWPOWERACTIVE_REGKEY,
1941 SPI_SETLOWPOWERACTIVE_VALNAME,
1942 &lowpoweractive, uiParam, fWinIni );
1945 case SPI_SETPOWEROFFACTIVE:
1946 ret = set_bool_param( SPI_SETPOWEROFFACTIVE_IDX,
1947 SPI_SETPOWEROFFACTIVE_REGKEY,
1948 SPI_SETPOWEROFFACTIVE_VALNAME,
1949 &poweroffactive, uiParam, fWinIni );
1952 WINE_SPI_FIXME(SPI_SETCURSORS); /* 87 WINVER >= 0x400 */
1953 WINE_SPI_FIXME(SPI_SETICONS); /* 88 WINVER >= 0x400 */
1955 case SPI_GETDEFAULTINPUTLANG: /* 89 WINVER >= 0x400 */
1956 ret = GetKeyboardLayout(0) ? TRUE : FALSE;
1959 WINE_SPI_FIXME(SPI_SETDEFAULTINPUTLANG); /* 90 WINVER >= 0x400 */
1961 WINE_SPI_FIXME(SPI_SETLANGTOGGLE); /* 91 WINVER >= 0x400 */
1963 case SPI_GETWINDOWSEXTENSION: /* 92 WINVER >= 0x400 */
1964 WARN("pretend no support for Win9x Plus! for now.\n");
1965 ret = FALSE; /* yes, this is the result value */
1968 WINE_SPI_FIXME(SPI_SETMOUSETRAILS); /* 93 WINVER >= 0x400 */
1969 WINE_SPI_FIXME(SPI_GETMOUSETRAILS); /* 94 WINVER >= 0x400 */
1970 WINE_SPI_FIXME(SPI_GETSNAPTODEFBUTTON); /* 95 WINVER >= 0x400 */
1971 WINE_SPI_FIXME(SPI_SETSNAPTODEFBUTTON); /* 96 WINVER >= 0x400 */
1973 case SPI_SETSCREENSAVERRUNNING:
1974 ret = set_bool_param( SPI_SETSCREENSAVERRUNNING_IDX,
1975 SPI_SETSCREENSAVERRUNNING_REGKEY,
1976 SPI_SETSCREENSAVERRUNNING_VALNAME,
1977 &screensaver_running, uiParam, fWinIni );
1980 case SPI_GETMOUSEHOVERWIDTH:
1981 ret = get_uint_param( SPI_SETMOUSEHOVERWIDTH_IDX,
1982 SPI_SETMOUSEHOVERWIDTH_REGKEY,
1983 SPI_SETMOUSEHOVERWIDTH_VALNAME,
1984 &mouse_hover_width, pvParam );
1987 case SPI_SETMOUSEHOVERWIDTH:
1988 ret = set_uint_param( SPI_SETMOUSEHOVERWIDTH_IDX,
1989 SPI_SETMOUSEHOVERWIDTH_REGKEY,
1990 SPI_SETMOUSEHOVERWIDTH_VALNAME,
1991 &mouse_hover_width, uiParam, fWinIni );
1994 case SPI_GETMOUSEHOVERHEIGHT:
1995 ret = get_uint_param( SPI_SETMOUSEHOVERHEIGHT_IDX,
1996 SPI_SETMOUSEHOVERHEIGHT_REGKEY,
1997 SPI_SETMOUSEHOVERHEIGHT_VALNAME,
1998 &mouse_hover_height, pvParam );
2001 case SPI_SETMOUSEHOVERHEIGHT:
2002 ret = set_uint_param( SPI_SETMOUSEHOVERHEIGHT_IDX,
2003 SPI_SETMOUSEHOVERHEIGHT_REGKEY,
2004 SPI_SETMOUSEHOVERHEIGHT_VALNAME,
2005 &mouse_hover_height, uiParam, fWinIni );
2008 case SPI_GETMOUSEHOVERTIME:
2009 ret = get_uint_param( SPI_SETMOUSEHOVERTIME_IDX,
2010 SPI_SETMOUSEHOVERTIME_REGKEY,
2011 SPI_SETMOUSEHOVERTIME_VALNAME,
2012 &mouse_hover_time, pvParam );
2015 case SPI_SETMOUSEHOVERTIME:
2016 ret = set_uint_param( SPI_SETMOUSEHOVERTIME_IDX,
2017 SPI_SETMOUSEHOVERTIME_REGKEY,
2018 SPI_SETMOUSEHOVERTIME_VALNAME,
2019 &mouse_hover_time, uiParam, fWinIni );
2022 case SPI_GETWHEELSCROLLLINES:
2023 ret = get_uint_param( SPI_SETMOUSESCROLLLINES_IDX,
2024 SPI_SETMOUSESCROLLLINES_REGKEY,
2025 SPI_SETMOUSESCROLLLINES_VALNAME,
2026 &mouse_scroll_lines, pvParam );
2029 case SPI_SETWHEELSCROLLLINES:
2030 ret = set_uint_param( SPI_SETMOUSESCROLLLINES_IDX,
2031 SPI_SETMOUSESCROLLLINES_REGKEY,
2032 SPI_SETMOUSESCROLLLINES_VALNAME,
2033 &mouse_scroll_lines, uiParam, fWinIni );
2036 case SPI_GETMENUSHOWDELAY:
2037 ret = get_uint_param( SPI_SETMENUSHOWDELAY_IDX,
2038 SPI_SETMENUSHOWDELAY_REGKEY,
2039 SPI_SETMENUSHOWDELAY_VALNAME,
2040 &menu_show_delay, pvParam );
2043 case SPI_SETMENUSHOWDELAY:
2044 ret = set_uint_param( SPI_SETMENUSHOWDELAY_IDX,
2045 SPI_SETMENUSHOWDELAY_REGKEY,
2046 SPI_SETMENUSHOWDELAY_VALNAME,
2047 &menu_show_delay, uiParam, fWinIni );
2050 WINE_SPI_FIXME(SPI_GETSHOWIMEUI); /* 110 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2051 WINE_SPI_FIXME(SPI_SETSHOWIMEUI); /* 111 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2052 WINE_SPI_FIXME(SPI_GETMOUSESPEED); /* 112 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2053 WINE_SPI_FIXME(SPI_SETMOUSESPEED); /* 113 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2055 case SPI_GETSCREENSAVERRUNNING:
2056 ret = get_bool_param( SPI_SETSCREENSAVERRUNNING_IDX,
2057 SPI_SETSCREENSAVERRUNNING_REGKEY,
2058 SPI_SETSCREENSAVERRUNNING_VALNAME,
2059 &screensaver_running, pvParam );
2062 case SPI_GETDESKWALLPAPER: /* 115 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2064 WCHAR buf[MAX_PATH];
2066 if (!pvParam) return FALSE;
2068 if (uiParam > MAX_PATH)
2073 if (SYSPARAMS_Load(SPI_SETDESKWALLPAPER_REGKEY, SPI_SETDESKWALLPAPER_VALNAME, buf, sizeof(buf)))
2075 lstrcpynW((WCHAR*)pvParam, buf, uiParam);
2079 /* Return an empty string */
2080 memset((WCHAR*)pvParam, 0, uiParam);
2086 WINE_SPI_FIXME(SPI_GETACTIVEWINDOWTRACKING);/* 0x1000 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2087 WINE_SPI_FIXME(SPI_SETACTIVEWINDOWTRACKING);/* 0x1001 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2088 WINE_SPI_FIXME(SPI_GETMENUANIMATION); /* 0x1002 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2089 WINE_SPI_FIXME(SPI_SETMENUANIMATION); /* 0x1003 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2090 WINE_SPI_FIXME(SPI_GETCOMBOBOXANIMATION); /* 0x1004 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2091 WINE_SPI_FIXME(SPI_SETCOMBOBOXANIMATION); /* 0x1005 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2093 case SPI_GETLISTBOXSMOOTHSCROLLING: /* 0x1006 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2094 if (!pvParam) return FALSE;
2096 spi_idx = SPI_SETLISTBOXSMOOTHSCROLLING_IDX;
2097 if (!spi_loaded[spi_idx])
2101 if (SYSPARAMS_Load( SPI_SETLISTBOXSMOOTHSCROLLING_REGKEY,
2102 SPI_SETLISTBOXSMOOTHSCROLLING_VALNAME, buf, sizeof(buf) ))
2104 if ((buf[0]&0x01) == 0x01)
2106 listbox_smoothscrolling = TRUE;
2109 spi_loaded[spi_idx] = TRUE;
2112 *(BOOL *)pvParam = listbox_smoothscrolling;
2116 WINE_SPI_FIXME(SPI_SETLISTBOXSMOOTHSCROLLING);/* 0x1007 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2118 case SPI_GETGRADIENTCAPTIONS:
2119 ret = get_user_pref_param( 0, 0x10, pvParam );
2122 case SPI_SETGRADIENTCAPTIONS:
2123 ret = set_user_pref_param( 0, 0x10, (BOOL)pvParam, fWinIni );
2126 case SPI_GETKEYBOARDCUES:
2127 ret = get_user_pref_param( 0, 0x20, pvParam );
2130 case SPI_SETKEYBOARDCUES:
2131 ret = set_user_pref_param( 0, 0x20, (BOOL)pvParam, fWinIni );
2134 WINE_SPI_FIXME(SPI_GETACTIVEWNDTRKZORDER); /* 0x100C _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2135 WINE_SPI_FIXME(SPI_SETACTIVEWNDTRKZORDER); /* 0x100D _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2136 case SPI_GETHOTTRACKING:
2137 ret = get_user_pref_param( 0, 0x80, pvParam );
2140 case SPI_SETHOTTRACKING:
2141 ret = set_user_pref_param( 0, 0x80, (BOOL)pvParam, fWinIni );
2144 WINE_SPI_FIXME(SPI_GETMENUFADE); /* 0x1012 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2145 WINE_SPI_FIXME(SPI_SETMENUFADE); /* 0x1013 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2146 WINE_SPI_FIXME(SPI_GETSELECTIONFADE); /* 0x1014 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2147 WINE_SPI_FIXME(SPI_SETSELECTIONFADE); /* 0x1015 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2148 WINE_SPI_FIXME(SPI_GETTOOLTIPANIMATION); /* 0x1016 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2149 WINE_SPI_FIXME(SPI_SETTOOLTIPANIMATION); /* 0x1017 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2150 WINE_SPI_FIXME(SPI_GETTOOLTIPFADE); /* 0x1018 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2151 WINE_SPI_FIXME(SPI_SETTOOLTIPFADE); /* 0x1019 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2152 WINE_SPI_FIXME(SPI_GETCURSORSHADOW); /* 0x101A _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2153 WINE_SPI_FIXME(SPI_SETCURSORSHADOW); /* 0x101B _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2154 WINE_SPI_FIXME(SPI_GETMOUSESONAR); /* 0x101C _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2155 WINE_SPI_FIXME(SPI_SETMOUSESONAR); /* 0x101D _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2156 WINE_SPI_FIXME(SPI_GETMOUSECLICKLOCK); /* 0x101E _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2157 WINE_SPI_FIXME(SPI_SETMOUSECLICKLOCK); /* 0x101F _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2158 WINE_SPI_FIXME(SPI_GETMOUSEVANISH); /* 0x1020 _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2159 WINE_SPI_FIXME(SPI_SETMOUSEVANISH); /* 0x1021 _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2160 case SPI_GETFLATMENU:
2161 ret = get_user_pref_param( 2, 0x02, pvParam );
2164 case SPI_SETFLATMENU:
2165 ret = set_user_pref_param( 2, 0x02, (BOOL)pvParam, fWinIni );
2168 WINE_SPI_FIXME(SPI_GETDROPSHADOW); /* 0x1024 _WIN32_WINNT >= 0x510 */
2169 WINE_SPI_FIXME(SPI_SETDROPSHADOW); /* 0x1025 _WIN32_WINNT >= 0x510 */
2170 WINE_SPI_FIXME(SPI_GETBLOCKSENDINPUTRESETS);
2171 WINE_SPI_FIXME(SPI_SETBLOCKSENDINPUTRESETS);
2172 WINE_SPI_FIXME(SPI_GETUIEFFECTS);
2173 WINE_SPI_FIXME(SPI_SETUIEFFECTS);
2174 WINE_SPI_FIXME(SPI_GETFOREGROUNDLOCKTIMEOUT);/* 0x2000 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2175 WINE_SPI_FIXME(SPI_SETFOREGROUNDLOCKTIMEOUT);/* 0x2001 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2176 WINE_SPI_FIXME(SPI_GETACTIVEWNDTRKTIMEOUT); /* 0x2002 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2177 WINE_SPI_FIXME(SPI_SETACTIVEWNDTRKTIMEOUT); /* 0x2003 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2178 WINE_SPI_FIXME(SPI_GETFOREGROUNDFLASHCOUNT);/* 0x2004 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2179 WINE_SPI_FIXME(SPI_SETFOREGROUNDFLASHCOUNT);/* 0x2005 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2180 WINE_SPI_FIXME(SPI_GETCARETWIDTH); /* 0x2006 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2181 WINE_SPI_FIXME(SPI_SETCARETWIDTH); /* 0x2007 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2182 WINE_SPI_FIXME(SPI_GETMOUSECLICKLOCKTIME); /* 0x2008 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2183 WINE_SPI_FIXME(SPI_SETMOUSECLICKLOCKTIME); /* 0x2009 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2184 WINE_SPI_FIXME(SPI_GETFONTSMOOTHINGTYPE); /* 0x200A _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2185 WINE_SPI_FIXME(SPI_SETFONTSMOOTHINGTYPE); /* 0x200B _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2186 WINE_SPI_FIXME(SPI_GETFONTSMOOTHINGCONTRAST);/* 0x200C _WIN32_WINNT >= 0x510 */
2187 WINE_SPI_FIXME(SPI_SETFONTSMOOTHINGCONTRAST);/* 0x200D _WIN32_WINNT >= 0x510 */
2188 WINE_SPI_FIXME(SPI_GETFOCUSBORDERWIDTH); /* 0x200E _WIN32_WINNT >= 0x510 */
2189 WINE_SPI_FIXME(SPI_SETFOCUSBORDERWIDTH); /* 0x200F _WIN32_WINNT >= 0x510 */
2190 WINE_SPI_FIXME(SPI_GETFOCUSBORDERHEIGHT); /* 0x2010 _WIN32_WINNT >= 0x510 */
2191 WINE_SPI_FIXME(SPI_SETFOCUSBORDERHEIGHT); /* 0x2011 _WIN32_WINNT >= 0x510 */
2194 FIXME( "Unknown action: %u\n", uiAction );
2195 SetLastError( ERROR_INVALID_SPI_VALUE );
2201 SYSPARAMS_NotifyChange( uiAction, fWinIni );
2202 TRACE("(%u, %u, %p, %u) ret %d\n",
2203 uiAction, uiParam, pvParam, fWinIni, ret);
2206 #undef WINE_SPI_FIXME
2207 #undef WINE_SPI_WARN
2211 /***********************************************************************
2212 * SystemParametersInfo (USER.483)
2214 BOOL16 WINAPI SystemParametersInfo16( UINT16 uAction, UINT16 uParam,
2215 LPVOID lpvParam, UINT16 fuWinIni )
2219 TRACE("(%u, %u, %p, %u)\n", uAction, uParam, lpvParam, fuWinIni);
2223 case SPI_GETBEEP: /* 1 */
2224 case SPI_GETSCREENSAVEACTIVE: /* 16 */
2225 case SPI_GETICONTITLEWRAP: /* 25 */
2226 case SPI_GETMENUDROPALIGNMENT: /* 27 */
2227 case SPI_GETFASTTASKSWITCH: /* 35 */
2228 case SPI_GETDRAGFULLWINDOWS: /* 38 WINVER >= 0x0400 */
2231 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2232 if (ret && lpvParam)
2233 *(BOOL16 *)lpvParam = tmp;
2237 case SPI_GETBORDER: /* 5 */
2238 case SPI_ICONHORIZONTALSPACING: /* 13 */
2239 case SPI_GETSCREENSAVETIMEOUT: /* 14 */
2240 case SPI_GETGRIDGRANULARITY: /* 18 */
2241 case SPI_GETKEYBOARDDELAY: /* 22 */
2242 case SPI_ICONVERTICALSPACING: /* 24 */
2245 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2246 if (ret && lpvParam)
2247 *(INT16 *)lpvParam = tmp;
2251 case SPI_GETKEYBOARDSPEED: /* 10 */
2254 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2255 if (ret && lpvParam)
2256 *(WORD *)lpvParam = tmp;
2260 case SPI_GETICONTITLELOGFONT: /* 31 */
2263 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2264 if (ret && lpvParam)
2265 SYSPARAMS_LogFont32ATo16( &tmp, (LPLOGFONT16)lpvParam );
2269 case SPI_GETNONCLIENTMETRICS: /* 41 WINVER >= 0x400 */
2271 NONCLIENTMETRICSA tmp;
2272 LPNONCLIENTMETRICS16 lpnm16 = (LPNONCLIENTMETRICS16)lpvParam;
2273 if (lpnm16 && lpnm16->cbSize == sizeof(NONCLIENTMETRICS16))
2275 tmp.cbSize = sizeof(NONCLIENTMETRICSA);
2276 ret = SystemParametersInfoA( uAction, uParam, &tmp, fuWinIni );
2278 SYSPARAMS_NonClientMetrics32ATo16( &tmp, lpnm16 );
2280 else /* winfile 95 sets cbSize to 340 */
2281 ret = SystemParametersInfoA( uAction, uParam, lpvParam, fuWinIni );
2285 case SPI_GETWORKAREA: /* 48 WINVER >= 0x400 */
2288 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2289 if (ret && lpvParam)
2291 RECT16 *r16 = (RECT16 *)lpvParam;
2292 r16->left = tmp.left;
2294 r16->right = tmp.right;
2295 r16->bottom = tmp.bottom;
2300 case SPI_GETMOUSEHOVERWIDTH: /* 98 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2301 case SPI_GETMOUSEHOVERHEIGHT: /* 100 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2302 case SPI_GETMOUSEHOVERTIME: /* 102 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2305 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2306 if (ret && lpvParam)
2307 *(UINT16 *)lpvParam = tmp;
2312 ret = SystemParametersInfoA( uAction, uParam, lpvParam, fuWinIni );
2318 /***********************************************************************
2319 * SystemParametersInfoA (USER32.@)
2321 BOOL WINAPI SystemParametersInfoA( UINT uiAction, UINT uiParam,
2322 PVOID pvParam, UINT fuWinIni )
2326 TRACE("(%u, %u, %p, %u)\n", uiAction, uiParam, pvParam, fuWinIni);
2330 case SPI_SETDESKWALLPAPER: /* 20 */
2331 case SPI_SETDESKPATTERN: /* 21 */
2335 if (!MultiByteToWideChar( CP_ACP, 0, (LPSTR)pvParam, -1,
2336 buffer, sizeof(buffer)/sizeof(WCHAR) ))
2337 buffer[sizeof(buffer)/sizeof(WCHAR)-1] = 0;
2338 ret = SystemParametersInfoW( uiAction, uiParam, pvParam ? buffer : NULL, fuWinIni );
2342 case SPI_GETICONTITLELOGFONT: /* 31 */
2345 ret = SystemParametersInfoW( uiAction, uiParam, pvParam ? &tmp : NULL, fuWinIni );
2347 SYSPARAMS_LogFont32WTo32A( &tmp, (LPLOGFONTA)pvParam );
2351 case SPI_GETNONCLIENTMETRICS: /* 41 WINVER >= 0x400 */
2353 NONCLIENTMETRICSW tmp;
2354 LPNONCLIENTMETRICSA lpnmA = (LPNONCLIENTMETRICSA)pvParam;
2355 if (lpnmA && lpnmA->cbSize == sizeof(NONCLIENTMETRICSA))
2357 tmp.cbSize = sizeof(NONCLIENTMETRICSW);
2358 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2360 SYSPARAMS_NonClientMetrics32WTo32A( &tmp, lpnmA );
2367 case SPI_SETNONCLIENTMETRICS: /* 42 WINVER >= 0x400 */
2369 NONCLIENTMETRICSW tmp;
2370 LPNONCLIENTMETRICSA lpnmA = (LPNONCLIENTMETRICSA)pvParam;
2371 if (lpnmA && lpnmA->cbSize == sizeof(NONCLIENTMETRICSA))
2373 tmp.cbSize = sizeof(NONCLIENTMETRICSW);
2374 SYSPARAMS_NonClientMetrics32ATo32W( lpnmA, &tmp );
2375 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2382 case SPI_GETICONMETRICS: /* 45 WINVER >= 0x400 */
2385 LPICONMETRICSA lpimA = (LPICONMETRICSA)pvParam;
2386 if (lpimA && lpimA->cbSize == sizeof(ICONMETRICSA))
2388 tmp.cbSize = sizeof(ICONMETRICSW);
2389 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2392 lpimA->iHorzSpacing = tmp.iHorzSpacing;
2393 lpimA->iVertSpacing = tmp.iVertSpacing;
2394 lpimA->iTitleWrap = tmp.iTitleWrap;
2395 SYSPARAMS_LogFont32WTo32A( &tmp.lfFont, &lpimA->lfFont );
2403 case SPI_SETICONMETRICS: /* 46 WINVER >= 0x400 */
2406 LPICONMETRICSA lpimA = (LPICONMETRICSA)pvParam;
2407 if (lpimA && lpimA->cbSize == sizeof(ICONMETRICSA))
2409 tmp.cbSize = sizeof(ICONMETRICSW);
2410 tmp.iHorzSpacing = lpimA->iHorzSpacing;
2411 tmp.iVertSpacing = lpimA->iVertSpacing;
2412 tmp.iTitleWrap = lpimA->iTitleWrap;
2413 SYSPARAMS_LogFont32ATo32W( &lpimA->lfFont, &tmp.lfFont);
2414 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2421 case SPI_GETHIGHCONTRAST: /* 66 WINVER >= 0x400 */
2424 LPHIGHCONTRASTA lphcA = (LPHIGHCONTRASTA)pvParam;
2425 if (lphcA && lphcA->cbSize == sizeof(HIGHCONTRASTA))
2427 tmp.cbSize = sizeof(HIGHCONTRASTW);
2428 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2431 lphcA->dwFlags = tmp.dwFlags;
2432 lphcA->lpszDefaultScheme = NULL; /* FIXME? */
2441 ret = SystemParametersInfoW( uiAction, uiParam, pvParam, fuWinIni );
2448 /***********************************************************************
2449 * GetSystemMetrics (USER32.@)
2451 INT WINAPI GetSystemMetrics( INT index )
2455 /* some metrics are dynamic */
2459 return GetDeviceCaps( get_display_dc(), HORZRES );
2461 return GetDeviceCaps( get_display_dc(), VERTRES );
2463 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2464 return nonclient_metrics.iScrollWidth;
2466 return GetSystemMetrics(SM_CXVSCROLL);
2468 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2469 return nonclient_metrics.iCaptionHeight + 1;
2472 /* SM_C{X,Y}BORDER always returns 1 regardless of 'BorderWidth' value in registry */
2478 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2479 return nonclient_metrics.iScrollHeight;
2481 return GetSystemMetrics(SM_CYVTHUMB);
2483 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2484 return icon_size.cx;
2486 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2487 return icon_size.cy;
2492 return GetSystemMetrics(SM_CYMENUSIZE) + 1;
2493 case SM_CXFULLSCREEN:
2494 /* see the remark for SM_CXMAXIMIZED, at least this formulation is
2496 return GetSystemMetrics( SM_CXMAXIMIZED) - 2 * GetSystemMetrics( SM_CXFRAME);
2497 case SM_CYFULLSCREEN:
2498 /* see the remark for SM_CYMAXIMIZED, at least this formulation is
2500 return GetSystemMetrics( SM_CYMAXIMIZED) - GetSystemMetrics( SM_CYMIN);
2501 case SM_CYKANJIWINDOW:
2503 case SM_MOUSEPRESENT:
2506 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2507 return nonclient_metrics.iScrollHeight;
2509 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2510 return nonclient_metrics.iScrollHeight;
2514 get_bool_param( SPI_SETMOUSEBUTTONSWAP_IDX, SPI_SETMOUSEBUTTONSWAP_REGKEY,
2515 SPI_SETMOUSEBUTTONSWAP_VALNAME, &swap_buttons, (BOOL*)&ret );
2523 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2524 return 3 * nonclient_metrics.iCaptionWidth + GetSystemMetrics( SM_CYSIZE) +
2525 4 * CaptionFontAvCharWidth + 2 * GetSystemMetrics( SM_CXFRAME) + 4;
2527 return GetSystemMetrics( SM_CYCAPTION) + 2 * GetSystemMetrics( SM_CYFRAME);
2529 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2530 return nonclient_metrics.iCaptionWidth;
2532 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2533 return nonclient_metrics.iCaptionHeight;
2535 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2536 return GetSystemMetrics(SM_CXDLGFRAME) + nonclient_metrics.iBorderWidth;
2538 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2539 return GetSystemMetrics(SM_CYDLGFRAME) + nonclient_metrics.iBorderWidth;
2541 return GetSystemMetrics(SM_CXMIN);
2543 return GetSystemMetrics(SM_CYMIN);
2544 case SM_CXDOUBLECLK:
2545 get_uint_param( SPI_SETDOUBLECLKWIDTH_IDX, SPI_SETDOUBLECLKWIDTH_REGKEY1,
2546 SPI_SETDOUBLECLKWIDTH_VALNAME, &double_click_width, &ret );
2548 case SM_CYDOUBLECLK:
2549 get_uint_param( SPI_SETDOUBLECLKHEIGHT_IDX, SPI_SETDOUBLECLKHEIGHT_REGKEY1,
2550 SPI_SETDOUBLECLKHEIGHT_VALNAME, &double_click_height, &ret );
2552 case SM_CXICONSPACING:
2553 SystemParametersInfoW( SPI_ICONHORIZONTALSPACING, 0, &ret, 0 );
2555 case SM_CYICONSPACING:
2556 SystemParametersInfoW( SPI_ICONVERTICALSPACING, 0, &ret, 0 );
2558 case SM_MENUDROPALIGNMENT:
2559 SystemParametersInfoW( SPI_GETMENUDROPALIGNMENT, 0, &ret, 0 );
2563 case SM_DBCSENABLED:
2566 GetCPInfo( CP_ACP, &cpinfo );
2567 return (cpinfo.MaxCharSize > 1);
2569 case SM_CMOUSEBUTTONS:
2574 return GetSystemMetrics(SM_CXBORDER) + 1;
2576 return GetSystemMetrics(SM_CYBORDER) + 1;
2577 case SM_CXMINSPACING:
2578 if( spi_loaded[SPI_MINIMIZEDMETRICS_IDX]) load_minimized_metrics();
2579 return GetSystemMetrics(SM_CXMINIMIZED) + minimized_metrics.iHorzGap;
2580 case SM_CYMINSPACING:
2581 if( spi_loaded[SPI_MINIMIZEDMETRICS_IDX]) load_minimized_metrics();
2582 return GetSystemMetrics(SM_CYMINIMIZED) + minimized_metrics.iVertGap;
2586 case SM_CYSMCAPTION:
2587 return GetSystemMetrics(SM_CYSMSIZE) + 1;
2589 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2590 return nonclient_metrics.iSmCaptionWidth;
2592 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2593 return nonclient_metrics.iSmCaptionHeight;
2595 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2596 return nonclient_metrics.iMenuWidth;
2598 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2599 return nonclient_metrics.iMenuHeight;
2601 if( spi_loaded[SPI_MINIMIZEDMETRICS_IDX]) load_minimized_metrics();
2602 return minimized_metrics.iArrange;
2603 case SM_CXMINIMIZED:
2604 if( spi_loaded[SPI_MINIMIZEDMETRICS_IDX]) load_minimized_metrics();
2605 return minimized_metrics.iWidth + 6;
2606 case SM_CYMINIMIZED:
2607 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2608 return nonclient_metrics.iCaptionHeight + 6;
2610 return GetSystemMetrics(SM_CXSCREEN) + 4 + 2 * GetSystemMetrics(SM_CXFRAME);
2612 return GetSystemMetrics(SM_CYSCREEN) + 4 + 2 * GetSystemMetrics(SM_CYFRAME);
2613 case SM_CXMAXIMIZED:
2614 /* FIXME: subtract the width of any vertical application toolbars*/
2615 return GetSystemMetrics(SM_CXSCREEN) + 2 * GetSystemMetrics(SM_CXFRAME);
2616 case SM_CYMAXIMIZED:
2617 /* FIXME: subtract the width of any horizontal application toolbars*/
2618 return GetSystemMetrics(SM_CYSCREEN) + 2 * GetSystemMetrics(SM_CYCAPTION);
2620 return 3; /* FIXME */
2622 return 0; /* 0 = ok, 1 = failsafe, 2 = failsafe + network */
2627 SystemParametersInfoW( SPI_GETSHOWSOUNDS, 0, &ret, 0 );
2629 case SM_CXMENUCHECK:
2630 case SM_CYMENUCHECK:
2631 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2632 return tmMenuFont.tmHeight <= 0 ? 13 :
2633 ((tmMenuFont.tmHeight + tmMenuFont.tmExternalLeading + 1) / 2) * 2 - 1;
2634 case SM_SLOWMACHINE:
2635 return 0; /* FIXME: Should check the type of processor */
2636 case SM_MIDEASTENABLED:
2637 return 0; /* FIXME */
2638 case SM_MOUSEWHEELPRESENT:
2640 case SM_XVIRTUALSCREEN:
2641 case SM_YVIRTUALSCREEN:
2643 case SM_CXVIRTUALSCREEN:
2644 return GetSystemMetrics(SM_CXSCREEN);
2645 case SM_CYVIRTUALSCREEN:
2646 return GetSystemMetrics(SM_CYSCREEN);
2649 case SM_SAMEDISPLAYFORMAT:
2652 return 0; /* FIXME */
2653 case SM_CXFOCUSBORDER:
2654 case SM_CYFOCUSBORDER:
2657 case SM_MEDIACENTER:
2667 /***********************************************************************
2668 * SwapMouseButton (USER32.@)
2669 * Reverse or restore the meaning of the left and right mouse buttons
2670 * fSwap [I ] TRUE - reverse, FALSE - original
2674 BOOL WINAPI SwapMouseButton( BOOL fSwap )
2676 BOOL prev = GetSystemMetrics(SM_SWAPBUTTON);
2677 SystemParametersInfoW(SPI_SETMOUSEBUTTONSWAP, fSwap, 0, 0);
2682 /**********************************************************************
2683 * SetDoubleClickTime (USER32.@)
2685 BOOL WINAPI SetDoubleClickTime( UINT interval )
2687 return SystemParametersInfoW(SPI_SETDOUBLECLICKTIME, interval, 0, 0);
2691 /**********************************************************************
2692 * GetDoubleClickTime (USER32.@)
2694 UINT WINAPI GetDoubleClickTime(void)
2698 get_uint_param( SPI_SETDOUBLECLICKTIME_IDX,
2699 SPI_SETDOUBLECLICKTIME_REGKEY,
2700 SPI_SETDOUBLECLICKTIME_VALNAME,
2701 &double_click_time, &time );
2702 if (!time) time = 500;
2707 /*************************************************************************
2708 * GetSysColor (USER32.@)
2710 COLORREF WINAPI GetSysColor( INT nIndex )
2712 if (nIndex >= 0 && nIndex < NUM_SYS_COLORS)
2713 return SysColors[nIndex];
2719 /*************************************************************************
2720 * SetSysColors (USER32.@)
2722 BOOL WINAPI SetSysColors( INT nChanges, const INT *lpSysColor,
2723 const COLORREF *lpColorValues )
2727 for (i = 0; i < nChanges; i++) SYSPARAMS_SetSysColor( lpSysColor[i], lpColorValues[i] );
2729 /* Send WM_SYSCOLORCHANGE message to all windows */
2731 SendMessageTimeoutW( HWND_BROADCAST, WM_SYSCOLORCHANGE, 0, 0, SMTO_ABORTIFHUNG, 2000, NULL );
2733 /* Repaint affected portions of all visible windows */
2735 RedrawWindow( GetDesktopWindow(), NULL, 0,
2736 RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN );
2741 /*************************************************************************
2742 * SetSysColorsTemp (USER32.@)
2746 * Called by W98SE desk.cpl Control Panel Applet:
2747 * handle = SetSysColorsTemp(ptr, ptr, nCount); ("set" call)
2748 * result = SetSysColorsTemp(NULL, NULL, handle); ("restore" call)
2750 * pPens is an array of COLORREF values, which seems to be used
2751 * to indicate the color values to create new pens with.
2753 * pBrushes is an array of solid brush handles (returned by a previous
2754 * CreateSolidBrush), which seems to contain the brush handles to set
2755 * for the system colors.
2757 * n seems to be used for
2758 * a) indicating the number of entries to operate on (length of pPens,
2760 * b) passing the handle that points to the previously used color settings.
2761 * I couldn't figure out in hell what kind of handle this is on
2762 * Windows. I just use a heap handle instead. Shouldn't matter anyway.
2765 * heap handle of our own copy of the current syscolors in case of
2766 * "set" call, i.e. pPens, pBrushes != NULL.
2767 * TRUE (unconditionally !) in case of "restore" call,
2768 * i.e. pPens, pBrushes == NULL.
2769 * FALSE in case of either pPens != NULL and pBrushes == NULL
2770 * or pPens == NULL and pBrushes != NULL.
2772 * I'm not sure whether this implementation is 100% correct. [AM]
2774 DWORD WINAPI SetSysColorsTemp( const COLORREF *pPens, const HBRUSH *pBrushes, DWORD n)
2778 if (pPens && pBrushes) /* "set" call */
2780 /* allocate our structure to remember old colors */
2781 LPVOID pOldCol = HeapAlloc(GetProcessHeap(), 0, sizeof(DWORD)+n*sizeof(HPEN)+n*sizeof(HBRUSH));
2783 *(DWORD *)p = n; p = (char*)p + sizeof(DWORD);
2784 memcpy(p, SysColorPens, n*sizeof(HPEN)); p = (char*)p + n*sizeof(HPEN);
2785 memcpy(p, SysColorBrushes, n*sizeof(HBRUSH)); p = (char*)p + n*sizeof(HBRUSH);
2787 for (i=0; i < n; i++)
2789 SysColorPens[i] = CreatePen( PS_SOLID, 1, pPens[i] );
2790 SysColorBrushes[i] = pBrushes[i];
2793 return (DWORD)pOldCol;
2795 if (!pPens && !pBrushes) /* "restore" call */
2797 LPVOID pOldCol = (LPVOID)n;
2799 DWORD nCount = *(DWORD *)p;
2800 p = (char*)p + sizeof(DWORD);
2802 for (i=0; i < nCount; i++)
2804 DeleteObject(SysColorPens[i]);
2805 SysColorPens[i] = *(HPEN *)p; p = (char*)p + sizeof(HPEN);
2807 for (i=0; i < nCount; i++)
2809 SysColorBrushes[i] = *(HBRUSH *)p; p = (char*)p + sizeof(HBRUSH);
2811 /* get rid of storage structure */
2812 HeapFree(GetProcessHeap(), 0, pOldCol);
2820 /***********************************************************************
2821 * GetSysColorBrush (USER32.@)
2823 HBRUSH WINAPI GetSysColorBrush( INT index )
2825 if (0 <= index && index < NUM_SYS_COLORS) return SysColorBrushes[index];
2826 WARN("Unknown index(%d)\n", index );
2827 return GetStockObject(LTGRAY_BRUSH);
2831 /***********************************************************************
2834 HPEN SYSCOLOR_GetPen( INT index )
2836 /* We can assert here, because this function is internal to Wine */
2837 assert (0 <= index && index < NUM_SYS_COLORS);
2838 return SysColorPens[index];
2842 /***********************************************************************
2843 * ChangeDisplaySettingsA (USER32.@)
2845 LONG WINAPI ChangeDisplaySettingsA( LPDEVMODEA devmode, DWORD flags )
2847 return ChangeDisplaySettingsExA(NULL,devmode,NULL,flags,NULL);
2851 /***********************************************************************
2852 * ChangeDisplaySettingsW (USER32.@)
2854 LONG WINAPI ChangeDisplaySettingsW( LPDEVMODEW devmode, DWORD flags )
2856 return ChangeDisplaySettingsExW(NULL,devmode,NULL,flags,NULL);
2860 /***********************************************************************
2861 * ChangeDisplaySettingsExA (USER32.@)
2863 LONG WINAPI ChangeDisplaySettingsExA( LPCSTR devname, LPDEVMODEA devmode, HWND hwnd,
2864 DWORD flags, LPVOID lparam )
2868 UNICODE_STRING nameW;
2870 if (devname) RtlCreateUnicodeStringFromAsciiz(&nameW, devname);
2871 else nameW.Buffer = NULL;
2875 devmodeW.dmBitsPerPel = devmode->dmBitsPerPel;
2876 devmodeW.dmPelsHeight = devmode->dmPelsHeight;
2877 devmodeW.dmPelsWidth = devmode->dmPelsWidth;
2878 devmodeW.dmDisplayFlags = devmode->dmDisplayFlags;
2879 devmodeW.dmDisplayFrequency = devmode->dmDisplayFrequency;
2880 devmodeW.dmFields = devmode->dmFields;
2881 ret = ChangeDisplaySettingsExW(nameW.Buffer, &devmodeW, hwnd, flags, lparam);
2885 ret = ChangeDisplaySettingsExW(nameW.Buffer, NULL, hwnd, flags, lparam);
2888 if (devname) RtlFreeUnicodeString(&nameW);
2893 /***********************************************************************
2894 * ChangeDisplaySettingsExW (USER32.@)
2896 LONG WINAPI ChangeDisplaySettingsExW( LPCWSTR devname, LPDEVMODEW devmode, HWND hwnd,
2897 DWORD flags, LPVOID lparam )
2899 return USER_Driver->pChangeDisplaySettingsEx( devname, devmode, hwnd, flags, lparam );
2903 /***********************************************************************
2904 * EnumDisplaySettingsW (USER32.@)
2907 * TRUE if nth setting exists found (described in the LPDEVMODEW struct)
2908 * FALSE if we do not have the nth setting
2910 BOOL WINAPI EnumDisplaySettingsW( LPCWSTR name, DWORD n, LPDEVMODEW devmode )
2912 return EnumDisplaySettingsExW(name, n, devmode, 0);
2916 /***********************************************************************
2917 * EnumDisplaySettingsA (USER32.@)
2919 BOOL WINAPI EnumDisplaySettingsA(LPCSTR name,DWORD n,LPDEVMODEA devmode)
2921 return EnumDisplaySettingsExA(name, n, devmode, 0);
2925 /***********************************************************************
2926 * EnumDisplaySettingsExA (USER32.@)
2928 BOOL WINAPI EnumDisplaySettingsExA(LPCSTR lpszDeviceName, DWORD iModeNum,
2929 LPDEVMODEA lpDevMode, DWORD dwFlags)
2933 UNICODE_STRING nameW;
2935 if (lpszDeviceName) RtlCreateUnicodeStringFromAsciiz(&nameW, lpszDeviceName);
2936 else nameW.Buffer = NULL;
2938 ret = EnumDisplaySettingsExW(nameW.Buffer,iModeNum,&devmodeW,dwFlags);
2941 lpDevMode->dmBitsPerPel = devmodeW.dmBitsPerPel;
2942 lpDevMode->dmPelsHeight = devmodeW.dmPelsHeight;
2943 lpDevMode->dmPelsWidth = devmodeW.dmPelsWidth;
2944 lpDevMode->dmDisplayFlags = devmodeW.dmDisplayFlags;
2945 lpDevMode->dmDisplayFrequency = devmodeW.dmDisplayFrequency;
2946 lpDevMode->dmFields = devmodeW.dmFields;
2948 if (lpszDeviceName) RtlFreeUnicodeString(&nameW);
2953 /***********************************************************************
2954 * EnumDisplaySettingsExW (USER32.@)
2956 BOOL WINAPI EnumDisplaySettingsExW(LPCWSTR lpszDeviceName, DWORD iModeNum,
2957 LPDEVMODEW lpDevMode, DWORD dwFlags)
2959 return USER_Driver->pEnumDisplaySettingsEx(lpszDeviceName, iModeNum, lpDevMode, dwFlags);