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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 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,
84 static const char * const DefSysColors[] =
86 "Scrollbar", "192 192 192", /* COLOR_SCROLLBAR */
87 "Background", "0 128 128", /* COLOR_BACKGROUND */
88 "ActiveTitle", "0 0 128", /* COLOR_ACTIVECAPTION */
89 "InactiveTitle", "128 128 128", /* COLOR_INACTIVECAPTION */
90 "Menu", "192 192 192", /* COLOR_MENU */
91 "Window", "255 255 255", /* COLOR_WINDOW */
92 "WindowFrame", "0 0 0", /* COLOR_WINDOWFRAME */
93 "MenuText", "0 0 0", /* COLOR_MENUTEXT */
94 "WindowText", "0 0 0", /* COLOR_WINDOWTEXT */
95 "TitleText", "255 255 255", /* COLOR_CAPTIONTEXT */
96 "ActiveBorder", "192 192 192", /* COLOR_ACTIVEBORDER */
97 "InactiveBorder", "192 192 192", /* COLOR_INACTIVEBORDER */
98 "AppWorkSpace", "128 128 128", /* COLOR_APPWORKSPACE */
99 "Hilight", "0 0 128", /* COLOR_HIGHLIGHT */
100 "HilightText", "255 255 255", /* COLOR_HIGHLIGHTTEXT */
101 "ButtonFace", "192 192 192", /* COLOR_BTNFACE */
102 "ButtonShadow", "128 128 128", /* COLOR_BTNSHADOW */
103 "GrayText", "128 128 128", /* COLOR_GRAYTEXT */
104 "ButtonText", "0 0 0", /* COLOR_BTNTEXT */
105 "InactiveTitleText", "192 192 192", /* COLOR_INACTIVECAPTIONTEXT */
106 "ButtonHilight", "255 255 255", /* COLOR_BTNHIGHLIGHT */
107 "ButtonDkShadow", "0 0 0", /* COLOR_3DDKSHADOW */
108 "ButtonLight", "224 224 224", /* COLOR_3DLIGHT */
109 "InfoText", "0 0 0", /* COLOR_INFOTEXT */
110 "InfoWindow", "255 255 225", /* COLOR_INFOBK */
111 "ButtonAlternateFace", "180 180 180", /* COLOR_ALTERNATEBTNFACE */
112 "HotTrackingColor", "0 0 255", /* COLOR_HOTLIGHT */
113 "GradientActiveTitle", "16 132 208", /* COLOR_GRADIENTACTIVECAPTION */
114 "GradientInactiveTitle", "181 181 181", /* COLOR_GRADIENTINACTIVECAPTION */
115 "MenuHilight", "0 0 0", /* COLOR_MENUHILIGHT */
116 "MenuBar", "192 192 192" /* COLOR_MENUBAR */
120 * Names of the registry subkeys of HKEY_CURRENT_USER key and value names
121 * for the system parameters.
122 * Names of the keys are created by adding string "_REGKEY" to
123 * "SET" action names, value names are created by adding "_REG_NAME"
124 * to the "SET" action name.
126 static const WCHAR SPI_SETBEEP_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','S','o','u','n','d',0};
127 static const WCHAR SPI_SETBEEP_VALNAME[]= {'B','e','e','p',0};
128 static const WCHAR SPI_SETMOUSE_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
129 static const WCHAR SPI_SETMOUSE_VALNAME1[]= {'M','o','u','s','e','T','h','r','e','s','h','o','l','d','1',0};
130 static const WCHAR SPI_SETMOUSE_VALNAME2[]= {'M','o','u','s','e','T','h','r','e','s','h','o','l','d','2',0};
131 static const WCHAR SPI_SETMOUSE_VALNAME3[]= {'M','o','u','s','e','S','p','e','e','d',0};
132 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','\\',
133 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
134 static const WCHAR SPI_SETBORDER_VALNAME[]= {'B','o','r','d','e','r','W','i','d','t','h',0};
135 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};
136 static const WCHAR SPI_SETKEYBOARDSPEED_VALNAME[]= {'K','e','y','b','o','a','r','d','S','p','e','e','d',0};
137 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','\\',
138 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
139 static const WCHAR SPI_ICONHORIZONTALSPACING_VALNAME[]= {'I','c','o','n','S','p','a','c','i','n','g',0};
140 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};
141 static const WCHAR SPI_SETSCREENSAVETIMEOUT_VALNAME[]= {'S','c','r','e','e','n','S','a','v','e','T','i','m','e','O','u','t',0};
142 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};
143 static const WCHAR SPI_SETSCREENSAVEACTIVE_VALNAME[]= {'S','c','r','e','e','n','S','a','v','e','A','c','t','i','v','e',0};
144 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};
145 static const WCHAR SPI_SETGRIDGRANULARITY_VALNAME[]= {'G','r','i','d','G','r','a','n','u','l','a','r','i','t','y',0};
146 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};
147 static const WCHAR SPI_SETKEYBOARDDELAY_VALNAME[]= {'K','e','y','b','o','a','r','d','D','e','l','a','y',0};
148 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','\\',
149 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
150 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};
151 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','\\',
152 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
153 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};
154 static const WCHAR SPI_SETICONTITLEWRAP_VALNAME[]= {'I','c','o','n','T','i','t','l','e','W','r','a','p',0};
155 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','\\',
156 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
157 static const WCHAR SPI_SETICONTITLELOGFONT_VALNAME[]= {'I','c','o','n','F','o','n','t',0};
158 static const WCHAR SPI_SETMENUDROPALIGNMENT_REGKEY1[]= {'S','o','f','t','w','a','r','e','\\',
159 'M','i','c','r','o','s','o','f','t','\\',
160 'W','i','n','d','o','w','s',' ','N','T','\\',
161 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
162 'W','i','n','d','o','w','s',0};
163 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};
164 static const WCHAR SPI_SETMENUDROPALIGNMENT_VALNAME[]= {'M','e','n','u','D','r','o','p','A','l','i','g','n','m','e','n','t',0};
165 static const WCHAR SPI_SETDOUBLECLKWIDTH_REGKEY1[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
166 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};
167 static const WCHAR SPI_SETDOUBLECLKWIDTH_VALNAME[]= {'D','o','u','b','l','e','C','l','i','c','k','W','i','d','t','h',0};
168 static const WCHAR SPI_SETDOUBLECLKHEIGHT_REGKEY1[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
169 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};
170 static const WCHAR SPI_SETDOUBLECLKHEIGHT_VALNAME[]= {'D','o','u','b','l','e','C','l','i','c','k','H','e','i','g','h','t',0};
171 static const WCHAR SPI_SETDOUBLECLICKTIME_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
172 static const WCHAR SPI_SETDOUBLECLICKTIME_VALNAME[]= {'D','o','u','b','l','e','C','l','i','c','k','S','p','e','e','d',0};
173 static const WCHAR SPI_SETMOUSEBUTTONSWAP_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
174 static const WCHAR SPI_SETMOUSEBUTTONSWAP_VALNAME[]= {'S','w','a','p','M','o','u','s','e','B','u','t','t','o','n','s',0};
175 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};
176 static const WCHAR SPI_SETDRAGFULLWINDOWS_VALNAME[]= {'D','r','a','g','F','u','l','l','W','i','n','d','o','w','s',0};
177 static const WCHAR SPI_SETSHOWSOUNDS_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\',
178 'A','c','c','e','s','s','i','b','i','l','i','t','y','\\',
179 'S','h','o','w','S','o','u','n','d','s',0};
180 static const WCHAR SPI_SETSHOWSOUNDS_VALNAME[]= {'O','n',0};
181 static const WCHAR SPI_SETKEYBOARDPREF_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\',
182 'A','c','c','e','s','s','i','b','i','l','i','t','y','\\',
183 'K','e','y','b','o','a','r','d',' ','P','r','e','f','e','r','e','n','c','e',0};
184 static const WCHAR SPI_SETKEYBOARDPREF_VALNAME[]= {'O','n',0};
185 static const WCHAR SPI_SETSCREENREADER_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\',
186 'A','c','c','e','s','s','i','b','i','l','i','t','y','\\',
187 'B','l','i','n','d',' ','A','c','c','e','s','s',0};
188 static const WCHAR SPI_SETSCREENREADER_VALNAME[]= {'O','n',0};
189 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};
190 static const WCHAR SPI_SETDESKWALLPAPER_VALNAME[]= {'W','a','l','l','p','a','p','e','r',0};
191 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};
192 static const WCHAR SPI_SETFONTSMOOTHING_VALNAME[]= {'F','o','n','t','S','m','o','o','t','h','i','n','g',0};
193 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};
194 static const WCHAR SPI_SETLOWPOWERACTIVE_VALNAME[]= {'L','o','w','P','o','w','e','r','A','c','t','i','v','e',0};
195 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};
196 static const WCHAR SPI_SETPOWEROFFACTIVE_VALNAME[]= {'P','o','w','e','r','O','f','f','A','c','t','i','v','e',0};
197 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};
198 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};
199 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};
200 static const WCHAR SPI_SETLISTBOXSMOOTHSCROLLING_VALNAME[]= {'S','m','o','o','t','h','S','c','r','o','l','l',0};
201 static const WCHAR SPI_SETMOUSEHOVERWIDTH_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
202 static const WCHAR SPI_SETMOUSEHOVERWIDTH_VALNAME[]= {'M','o','u','s','e','H','o','v','e','r','W','i','d','t','h',0};
203 static const WCHAR SPI_SETMOUSEHOVERHEIGHT_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
204 static const WCHAR SPI_SETMOUSEHOVERHEIGHT_VALNAME[]= {'M','o','u','s','e','H','o','v','e','r','H','e','i','g','h','t',0};
205 static const WCHAR SPI_SETMOUSEHOVERTIME_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
206 static const WCHAR SPI_SETMOUSEHOVERTIME_VALNAME[]= {'M','o','u','s','e','H','o','v','e','r','T','i','m','e',0};
207 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};
208 static const WCHAR SPI_SETMOUSESCROLLLINES_VALNAME[]= {'W','h','e','e','l','S','c','r','o','l','l','L','i','n','e','s',0};
209 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};
210 static const WCHAR SPI_SETMENUSHOWDELAY_VALNAME[]= {'M','e','n','u','S','h','o','w','D','e','l','a','y',0};
211 static const WCHAR SPI_CARETWIDTH_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
212 static const WCHAR SPI_CARETWIDTH_VALNAME[]= {'C','a','r','e','t','W','i','d','t','h',0};
214 /* FIXME - real values */
215 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};
216 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};
218 static const WCHAR METRICS_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p','\\',
219 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
220 static const WCHAR METRICS_SCROLLWIDTH_VALNAME[]= {'S','c','r','o','l','l','W','i','d','t','h',0};
221 static const WCHAR METRICS_SCROLLHEIGHT_VALNAME[]= {'S','c','r','o','l','l','H','e','i','g','h','t',0};
222 static const WCHAR METRICS_CAPTIONWIDTH_VALNAME[]= {'C','a','p','t','i','o','n','W','i','d','t','h',0};
223 static const WCHAR METRICS_CAPTIONHEIGHT_VALNAME[]= {'C','a','p','t','i','o','n','H','e','i','g','h','t',0};
224 static const WCHAR METRICS_SMCAPTIONWIDTH_VALNAME[]= {'S','m','C','a','p','t','i','o','n','W','i','d','t','h',0};
225 static const WCHAR METRICS_SMCAPTIONHEIGHT_VALNAME[]= {'S','m','C','a','p','t','i','o','n','H','e','i','g','h','t',0};
226 static const WCHAR METRICS_MENUWIDTH_VALNAME[]= {'M','e','n','u','W','i','d','t','h',0};
227 static const WCHAR METRICS_MENUHEIGHT_VALNAME[]= {'M','e','n','u','H','e','i','g','h','t',0};
228 static const WCHAR METRICS_ICONSIZE_VALNAME[]= {'S','h','e','l','l',' ','I','c','o','n',' ','S','i','z','e',0};
229 static const WCHAR METRICS_BORDERWIDTH_VALNAME[]= {'B','o','r','d','e','r','W','i','d','t','h',0};
230 static const WCHAR METRICS_CAPTIONLOGFONT_VALNAME[]= {'C','a','p','t','i','o','n','F','o','n','t',0};
231 static const WCHAR METRICS_SMCAPTIONLOGFONT_VALNAME[]={'S','m','C','a','p','t','i','o','n','F','o','n','t',0};
232 static const WCHAR METRICS_MENULOGFONT_VALNAME[]= {'M','e','n','u','F','o','n','t',0};
233 static const WCHAR METRICS_MESSAGELOGFONT_VALNAME[]= {'M','e','s','s','a','g','e','F','o','n','t',0};
234 static const WCHAR METRICS_STATUSLOGFONT_VALNAME[]= {'S','t','a','t','u','s','F','o','n','t',0};
235 /* minimized metrics */
236 static const WCHAR METRICS_MINWIDTH_VALNAME[] = {'M','i','n','W','i','d','t','h','\0'};
237 static const WCHAR METRICS_MINHORZGAP_VALNAME[] = {'M','i','n','H','o','r','z','G','a','p','\0'};
238 static const WCHAR METRICS_MINVERTGAP_VALNAME[] = {'M','i','n','V','e','r','t','G','a','p','\0'};
239 static const WCHAR METRICS_MINARRANGE_VALNAME[] = {'M','i','n','A','r','r','a','n','g','e','\0'};
241 static const WCHAR WINE_CURRENT_USER_REGKEY[] = {'S','o','f','t','w','a','r','e','\\',
244 /* volatile registry branch under WINE_CURRENT_USER_REGKEY for temporary values storage */
245 static const WCHAR WINE_CURRENT_USER_REGKEY_TEMP_PARAMS[] = {'T','e','m','p','o','r','a','r','y',' ',
246 'S','y','s','t','e','m',' ',
247 'P','a','r','a','m','e','t','e','r','s',0};
249 static const WCHAR Yes[]= {'Y','e','s',0};
250 static const WCHAR No[]= {'N','o',0};
251 static const WCHAR Desktop[]= {'D','e','s','k','t','o','p',0};
252 static const WCHAR Pattern[]= {'P','a','t','t','e','r','n',0};
253 static const WCHAR MenuFont[]= {'M','e','n','u','F','o','n','t',0};
254 static const WCHAR MenuFontSize[]= {'M','e','n','u','F','o','n','t','S','i','z','e',0};
255 static const WCHAR StatusFont[]= {'S','t','a','t','u','s','F','o','n','t',0};
256 static const WCHAR StatusFontSize[]= {'S','t','a','t','u','s','F','o','n','t','S','i','z','e',0};
257 static const WCHAR MessageFont[]= {'M','e','s','s','a','g','e','F','o','n','t',0};
258 static const WCHAR MessageFontSize[]= {'M','e','s','s','a','g','e','F','o','n','t','S','i','z','e',0};
259 static const WCHAR System[]= {'S','y','s','t','e','m',0};
260 static const WCHAR IconTitleSize[]= {'I','c','o','n','T','i','t','l','e','S','i','z','e',0};
261 static const WCHAR IconTitleFaceName[]= {'I','c','o','n','T','i','t','l','e','F','a','c','e','N','a','m','e',0};
262 static const WCHAR defPattern[]= {'1','7','0',' ','8','5',' ','1','7','0',' ','8','5',' ','1','7','0',' ','8','5',
263 ' ','1','7','0',' ','8','5',0};
264 static const WCHAR CSu[]= {'%','u',0};
265 static const WCHAR CSd[]= {'%','d',0};
267 /* Indicators whether system parameter value is loaded */
268 static char spi_loaded[SPI_INDEX_COUNT];
270 static BOOL notify_change = TRUE;
272 /* System parameters storage */
273 static BOOL beep_active = TRUE;
274 static int mouse_threshold1 = 6;
275 static int mouse_threshold2 = 10;
276 static int mouse_speed = 1;
277 static UINT border = 1;
278 static UINT keyboard_speed = 31;
279 static UINT screensave_timeout = 300;
280 static UINT grid_granularity = 0;
281 static UINT keyboard_delay = 1;
282 static UINT double_click_width = 4;
283 static UINT double_click_height = 4;
284 static UINT double_click_time = 500;
285 static BOOL drag_full_windows = FALSE;
286 static RECT work_area;
287 static BOOL keyboard_pref = TRUE;
288 static BOOL screen_reader = FALSE;
289 static UINT mouse_hover_width = 4;
290 static UINT mouse_hover_height = 4;
291 static UINT mouse_hover_time = 400;
292 static UINT mouse_scroll_lines = 3;
293 static UINT menu_show_delay = 400;
294 static UINT menu_drop_alignment = 0;
295 static BOOL screensaver_running = FALSE;
296 static UINT font_smoothing = 0; /* 0x01 for 95/98/NT, 0x02 for 98/ME/2k/XP */
297 static BOOL lowpoweractive = FALSE;
298 static BOOL poweroffactive = FALSE;
299 static BOOL show_sounds = FALSE;
300 static BOOL swap_buttons = FALSE;
301 static UINT caret_width = 1;
302 static BYTE user_prefs[4];
304 static MINIMIZEDMETRICS minimized_metrics =
306 sizeof(MINIMIZEDMETRICS),
310 ARW_HIDE /* iArrange */
313 static ICONMETRICSW icon_metrics =
315 sizeof(ICONMETRICSW),
316 75, /* iHorzSpacing */
317 75, /* iVertSpacing */
318 TRUE, /* iTitleWrap */
319 { -11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
320 OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH } /* lfFont */
323 static NONCLIENTMETRICSW nonclient_metrics =
325 sizeof(NONCLIENTMETRICSW),
326 1, /* iBorderWidth */
327 16, /* iScrollWidth */
328 16, /* iScrollHeight */
329 18, /* iCaptionWidth */
330 18, /* iCaptionHeight */
331 { 0 }, /* lfCaptionFont */
332 13, /* iSmCaptionWidth */
333 15, /* iSmCaptionHeight */
334 { 0 }, /* lfSmCaptionFont */
336 18, /* iMenuHeight */
337 { 0 }, /* lfMenuFont */
338 { 0 }, /* lfStatusFont */
339 { 0 } /* lfMessageFont */
342 /* some additional non client metric info */
343 static TEXTMETRICW tmMenuFont;
344 static UINT CaptionFontAvCharWidth;
346 static SIZE icon_size = { 32, 32 };
348 #define NUM_SYS_COLORS (COLOR_MENUBAR+1)
350 static COLORREF SysColors[NUM_SYS_COLORS];
351 static HBRUSH SysColorBrushes[NUM_SYS_COLORS];
352 static HPEN SysColorPens[NUM_SYS_COLORS];
354 static const WORD wPattern55AA[] = { 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa };
356 HBRUSH SYSCOLOR_55AABrush = 0;
358 extern void __wine_make_gdi_object_system( HGDIOBJ handle, BOOL set );
361 /* This function is a copy of the one in objects/font.c */
362 static void SYSPARAMS_LogFont32ATo16( const LOGFONTA* font32, LPLOGFONT16 font16 )
364 font16->lfHeight = font32->lfHeight;
365 font16->lfWidth = font32->lfWidth;
366 font16->lfEscapement = font32->lfEscapement;
367 font16->lfOrientation = font32->lfOrientation;
368 font16->lfWeight = font32->lfWeight;
369 font16->lfItalic = font32->lfItalic;
370 font16->lfUnderline = font32->lfUnderline;
371 font16->lfStrikeOut = font32->lfStrikeOut;
372 font16->lfCharSet = font32->lfCharSet;
373 font16->lfOutPrecision = font32->lfOutPrecision;
374 font16->lfClipPrecision = font32->lfClipPrecision;
375 font16->lfQuality = font32->lfQuality;
376 font16->lfPitchAndFamily = font32->lfPitchAndFamily;
377 lstrcpynA( font16->lfFaceName, font32->lfFaceName, LF_FACESIZE );
380 static void SYSPARAMS_LogFont16To32W( const LOGFONT16 *font16, LPLOGFONTW font32 )
382 font32->lfHeight = font16->lfHeight;
383 font32->lfWidth = font16->lfWidth;
384 font32->lfEscapement = font16->lfEscapement;
385 font32->lfOrientation = font16->lfOrientation;
386 font32->lfWeight = font16->lfWeight;
387 font32->lfItalic = font16->lfItalic;
388 font32->lfUnderline = font16->lfUnderline;
389 font32->lfStrikeOut = font16->lfStrikeOut;
390 font32->lfCharSet = font16->lfCharSet;
391 font32->lfOutPrecision = font16->lfOutPrecision;
392 font32->lfClipPrecision = font16->lfClipPrecision;
393 font32->lfQuality = font16->lfQuality;
394 font32->lfPitchAndFamily = font16->lfPitchAndFamily;
395 MultiByteToWideChar( CP_ACP, 0, font16->lfFaceName, -1, font32->lfFaceName, LF_FACESIZE );
396 font32->lfFaceName[LF_FACESIZE-1] = 0;
399 static void SYSPARAMS_LogFont32WTo32A( const LOGFONTW* font32W, LPLOGFONTA font32A )
401 font32A->lfHeight = font32W->lfHeight;
402 font32A->lfWidth = font32W->lfWidth;
403 font32A->lfEscapement = font32W->lfEscapement;
404 font32A->lfOrientation = font32W->lfOrientation;
405 font32A->lfWeight = font32W->lfWeight;
406 font32A->lfItalic = font32W->lfItalic;
407 font32A->lfUnderline = font32W->lfUnderline;
408 font32A->lfStrikeOut = font32W->lfStrikeOut;
409 font32A->lfCharSet = font32W->lfCharSet;
410 font32A->lfOutPrecision = font32W->lfOutPrecision;
411 font32A->lfClipPrecision = font32W->lfClipPrecision;
412 font32A->lfQuality = font32W->lfQuality;
413 font32A->lfPitchAndFamily = font32W->lfPitchAndFamily;
414 WideCharToMultiByte( CP_ACP, 0, font32W->lfFaceName, -1, font32A->lfFaceName, LF_FACESIZE, NULL, NULL );
415 font32A->lfFaceName[LF_FACESIZE-1] = 0;
418 static void SYSPARAMS_LogFont32ATo32W( const LOGFONTA* font32A, LPLOGFONTW font32W )
420 font32W->lfHeight = font32A->lfHeight;
421 font32W->lfWidth = font32A->lfWidth;
422 font32W->lfEscapement = font32A->lfEscapement;
423 font32W->lfOrientation = font32A->lfOrientation;
424 font32W->lfWeight = font32A->lfWeight;
425 font32W->lfItalic = font32A->lfItalic;
426 font32W->lfUnderline = font32A->lfUnderline;
427 font32W->lfStrikeOut = font32A->lfStrikeOut;
428 font32W->lfCharSet = font32A->lfCharSet;
429 font32W->lfOutPrecision = font32A->lfOutPrecision;
430 font32W->lfClipPrecision = font32A->lfClipPrecision;
431 font32W->lfQuality = font32A->lfQuality;
432 font32W->lfPitchAndFamily = font32A->lfPitchAndFamily;
433 MultiByteToWideChar( CP_ACP, 0, font32A->lfFaceName, -1, font32W->lfFaceName, LF_FACESIZE );
434 font32W->lfFaceName[LF_FACESIZE-1] = 0;
437 static void SYSPARAMS_NonClientMetrics32ATo16( const NONCLIENTMETRICSA* lpnm32, LPNONCLIENTMETRICS16 lpnm16 )
439 lpnm16->iBorderWidth = lpnm32->iBorderWidth;
440 lpnm16->iScrollWidth = lpnm32->iScrollWidth;
441 lpnm16->iScrollHeight = lpnm32->iScrollHeight;
442 lpnm16->iCaptionWidth = lpnm32->iCaptionWidth;
443 lpnm16->iCaptionHeight = lpnm32->iCaptionHeight;
444 SYSPARAMS_LogFont32ATo16( &lpnm32->lfCaptionFont, &lpnm16->lfCaptionFont );
445 lpnm16->iSmCaptionWidth = lpnm32->iSmCaptionWidth;
446 lpnm16->iSmCaptionHeight = lpnm32->iSmCaptionHeight;
447 SYSPARAMS_LogFont32ATo16( &lpnm32->lfSmCaptionFont, &lpnm16->lfSmCaptionFont );
448 lpnm16->iMenuWidth = lpnm32->iMenuWidth;
449 lpnm16->iMenuHeight = lpnm32->iMenuHeight;
450 SYSPARAMS_LogFont32ATo16( &lpnm32->lfMenuFont, &lpnm16->lfMenuFont );
451 SYSPARAMS_LogFont32ATo16( &lpnm32->lfStatusFont, &lpnm16->lfStatusFont );
452 SYSPARAMS_LogFont32ATo16( &lpnm32->lfMessageFont, &lpnm16->lfMessageFont );
455 static void SYSPARAMS_NonClientMetrics32WTo32A( const NONCLIENTMETRICSW* lpnm32W, LPNONCLIENTMETRICSA lpnm32A )
457 lpnm32A->iBorderWidth = lpnm32W->iBorderWidth;
458 lpnm32A->iScrollWidth = lpnm32W->iScrollWidth;
459 lpnm32A->iScrollHeight = lpnm32W->iScrollHeight;
460 lpnm32A->iCaptionWidth = lpnm32W->iCaptionWidth;
461 lpnm32A->iCaptionHeight = lpnm32W->iCaptionHeight;
462 SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfCaptionFont, &lpnm32A->lfCaptionFont );
463 lpnm32A->iSmCaptionWidth = lpnm32W->iSmCaptionWidth;
464 lpnm32A->iSmCaptionHeight = lpnm32W->iSmCaptionHeight;
465 SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfSmCaptionFont, &lpnm32A->lfSmCaptionFont );
466 lpnm32A->iMenuWidth = lpnm32W->iMenuWidth;
467 lpnm32A->iMenuHeight = lpnm32W->iMenuHeight;
468 SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfMenuFont, &lpnm32A->lfMenuFont );
469 SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfStatusFont, &lpnm32A->lfStatusFont );
470 SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfMessageFont, &lpnm32A->lfMessageFont );
473 static void SYSPARAMS_NonClientMetrics32ATo32W( const NONCLIENTMETRICSA* lpnm32A, LPNONCLIENTMETRICSW lpnm32W )
475 lpnm32W->iBorderWidth = lpnm32A->iBorderWidth;
476 lpnm32W->iScrollWidth = lpnm32A->iScrollWidth;
477 lpnm32W->iScrollHeight = lpnm32A->iScrollHeight;
478 lpnm32W->iCaptionWidth = lpnm32A->iCaptionWidth;
479 lpnm32W->iCaptionHeight = lpnm32A->iCaptionHeight;
480 SYSPARAMS_LogFont32ATo32W( &lpnm32A->lfCaptionFont, &lpnm32W->lfCaptionFont );
481 lpnm32W->iSmCaptionWidth = lpnm32A->iSmCaptionWidth;
482 lpnm32W->iSmCaptionHeight = lpnm32A->iSmCaptionHeight;
483 SYSPARAMS_LogFont32ATo32W( &lpnm32A->lfSmCaptionFont, &lpnm32W->lfSmCaptionFont );
484 lpnm32W->iMenuWidth = lpnm32A->iMenuWidth;
485 lpnm32W->iMenuHeight = lpnm32A->iMenuHeight;
486 SYSPARAMS_LogFont32ATo32W( &lpnm32A->lfMenuFont, &lpnm32W->lfMenuFont );
487 SYSPARAMS_LogFont32ATo32W( &lpnm32A->lfStatusFont, &lpnm32W->lfStatusFont );
488 SYSPARAMS_LogFont32ATo32W( &lpnm32A->lfMessageFont, &lpnm32W->lfMessageFont );
491 /* get text metrics and/or "average" char width of the specified logfont
492 * for the specified dc */
493 static void get_text_metr_size( HDC hdc, LOGFONTW *plf, TEXTMETRICW * ptm, UINT *psz)
495 HFONT hfont, hfontsav;
498 hfont = CreateFontIndirectW( plf);
499 if( !hfont || ( hfontsav = SelectObject( hdc, hfont)) == NULL ) {
502 if( hfont) DeleteObject( hfont);
505 GetTextMetricsW( hdc, ptm);
507 if( !(*psz = GdiGetCharDimensions( hdc, ptm, NULL)))
509 SelectObject( hdc, hfontsav);
510 DeleteObject( hfont);
513 /***********************************************************************
514 * get_volatile_regkey
516 * Return a handle to the volatile registry key used to store
517 * non-permanently modified parameters.
519 static HKEY get_volatile_regkey(void)
521 static HKEY volatile_key;
526 /* This must be non-volatile! */
527 if (RegCreateKeyExW( HKEY_CURRENT_USER, WINE_CURRENT_USER_REGKEY,
528 0, 0, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 0,
529 &key, 0 ) != ERROR_SUCCESS)
531 ERR("Can't create wine registry branch\n");
535 /* @@ Wine registry key: HKCU\Software\Wine\Temporary System Parameters */
536 if (RegCreateKeyExW( key, WINE_CURRENT_USER_REGKEY_TEMP_PARAMS,
537 0, 0, REG_OPTION_VOLATILE, KEY_ALL_ACCESS, 0,
538 &volatile_key, 0 ) != ERROR_SUCCESS)
539 ERR("Can't create non-permanent wine registry branch\n");
547 /***********************************************************************
548 * SYSPARAMS_NotifyChange
550 * Sends notification about system parameter update.
552 static void SYSPARAMS_NotifyChange( UINT uiAction, UINT fWinIni )
554 static const WCHAR emptyW[1];
558 if (fWinIni & SPIF_UPDATEINIFILE)
560 if (fWinIni & (SPIF_SENDWININICHANGE | SPIF_SENDCHANGE))
561 SendMessageTimeoutW(HWND_BROADCAST, WM_SETTINGCHANGE,
562 uiAction, (LPARAM) emptyW,
563 SMTO_ABORTIFHUNG, 2000, NULL );
567 /* FIXME notify other wine processes with internal message */
573 /***********************************************************************
574 * Loads system parameter from user profile.
576 static BOOL SYSPARAMS_LoadRaw( LPCWSTR lpRegKey, LPCWSTR lpValName, LPBYTE lpBuf, DWORD count )
582 memset( lpBuf, 0, count );
583 if ((RegOpenKeyW( get_volatile_regkey(), lpRegKey, &hKey ) == ERROR_SUCCESS) ||
584 (RegOpenKeyW( HKEY_CURRENT_USER, lpRegKey, &hKey ) == ERROR_SUCCESS))
586 ret = !RegQueryValueExW( hKey, lpValName, NULL, &type, (LPBYTE)lpBuf, &count);
592 static BOOL SYSPARAMS_Load( LPCWSTR lpRegKey, LPCWSTR lpValName, LPWSTR lpBuf, DWORD count )
594 return SYSPARAMS_LoadRaw( lpRegKey, lpValName, (LPBYTE)lpBuf, count );
597 /***********************************************************************
598 * Saves system parameter to user profile.
601 /* Save data as-is */
602 static BOOL SYSPARAMS_SaveRaw( LPCWSTR lpRegKey, LPCWSTR lpValName,
603 const BYTE* lpValue, DWORD valueSize,
604 DWORD type, UINT fWinIni )
611 if (fWinIni & SPIF_UPDATEINIFILE)
613 hBaseKey = HKEY_CURRENT_USER;
618 hBaseKey = get_volatile_regkey();
619 dwOptions = REG_OPTION_VOLATILE;
622 if (RegCreateKeyExW( hBaseKey, lpRegKey,
623 0, 0, dwOptions, KEY_ALL_ACCESS,
624 0, &hKey, 0 ) == ERROR_SUCCESS)
626 if (RegSetValueExW( hKey, lpValName, 0, type,
627 lpValue, valueSize) == ERROR_SUCCESS)
630 if (hBaseKey == HKEY_CURRENT_USER)
631 RegDeleteKeyW( get_volatile_regkey(), lpRegKey );
638 /* Convenience function to save strings */
639 static BOOL SYSPARAMS_Save( LPCWSTR lpRegKey, LPCWSTR lpValName, LPCWSTR lpValue,
642 return SYSPARAMS_SaveRaw( lpRegKey, lpValName, (const BYTE*)lpValue,
643 (strlenW(lpValue) + 1)*sizeof(WCHAR), REG_SZ, fWinIni );
646 /* Convenience function to save logical fonts */
647 static BOOL SYSPARAMS_SaveLogFont( LPCWSTR lpRegKey, LPCWSTR lpValName,
648 LPLOGFONTW plf, UINT fWinIni )
650 return SYSPARAMS_SaveRaw( lpRegKey, lpValName, (const BYTE*)plf,
651 sizeof( LOGFONTW), REG_BINARY, fWinIni );
655 static inline HDC get_display_dc(void)
657 static const WCHAR DISPLAY[] = {'D','I','S','P','L','A','Y',0};
658 static HDC display_dc;
659 if (!display_dc) display_dc = CreateICW( DISPLAY, NULL, NULL, NULL );
663 static inline int get_display_dpi(void)
665 static int display_dpi;
666 if (!display_dpi) display_dpi = GetDeviceCaps( get_display_dc(), LOGPIXELSY );
670 /***********************************************************************
671 * SYSPARAMS_Twips2Pixels
673 * Convert a dimension value that was obtained from the registry. These are
674 * quoted as being "twips" values if negative and pixels if positive.
675 * One inch is 1440 twips. So to convert, divide by 1440 to get inches and
676 * multiply that by the dots-per-inch to get the size in pixels.
678 * MSDN Library - April 2001 -> Resource Kits ->
679 * Windows 2000 Resource Kit Reference ->
680 * Technical Reference to the Windows 2000 Registry ->
681 * HKEY_CURRENT_USER -> Control Panel -> Desktop -> WindowMetrics
683 inline static int SYSPARAMS_Twips2Pixels(int x)
686 x = (-x * get_display_dpi() + 720) / 1440;
690 /***********************************************************************
693 * Get a registry entry from the already open key. This allows us to open the
694 * section once and read several values.
696 * Of course this function belongs somewhere more usable but here will do
699 static int get_reg_metric( HKEY hkey, LPCWSTR lpValName, int default_value )
701 int value = default_value;
705 DWORD type, count = sizeof(buffer);
706 if(!RegQueryValueExW( hkey, lpValName, NULL, &type, (LPBYTE)buffer, &count) )
710 /* Are there any utilities for converting registry entries
713 /* FIXME_(reg)("We need reg format converter\n"); */
716 value = atoiW(buffer);
719 return SYSPARAMS_Twips2Pixels(value);
723 /*************************************************************************
724 * SYSPARAMS_SetSysColor
726 static void SYSPARAMS_SetSysColor( int index, COLORREF color )
728 if (index < 0 || index >= NUM_SYS_COLORS) return;
729 SysColors[index] = color;
730 if (SysColorBrushes[index])
732 __wine_make_gdi_object_system( SysColorBrushes[index], FALSE);
733 DeleteObject( SysColorBrushes[index] );
735 SysColorBrushes[index] = CreateSolidBrush( color );
736 __wine_make_gdi_object_system( SysColorBrushes[index], TRUE);
738 if (SysColorPens[index])
740 __wine_make_gdi_object_system( SysColorPens[index], FALSE);
741 DeleteObject( SysColorPens[index] );
743 SysColorPens[index] = CreatePen( PS_SOLID, 1, color );
744 __wine_make_gdi_object_system( SysColorPens[index], TRUE);
747 /* load a uint parameter from the registry */
748 static BOOL get_uint_param( unsigned int idx, LPCWSTR regkey, LPCWSTR value,
749 UINT *value_ptr, UINT *ret_ptr )
751 if (!ret_ptr) return FALSE;
752 if (!spi_loaded[idx])
756 if (SYSPARAMS_Load( regkey, value, buf, sizeof(buf) )) *value_ptr = atoiW( buf );
757 spi_loaded[idx] = TRUE;
759 *ret_ptr = *value_ptr;
763 /* load a twips parameter from the registry */
764 static BOOL get_twips_param( unsigned int idx, LPCWSTR regkey, LPCWSTR value,
765 UINT *value_ptr, UINT *ret_ptr )
767 if (!ret_ptr) return FALSE;
768 if (!spi_loaded[idx])
772 if (SYSPARAMS_Load( regkey, value, buf, sizeof(buf) ))
773 *value_ptr = SYSPARAMS_Twips2Pixels( atoiW(buf) );
774 spi_loaded[idx] = TRUE;
776 *ret_ptr = *value_ptr;
780 /* load a boolean parameter from the registry */
781 static inline BOOL get_bool_param( unsigned int idx, LPCWSTR regkey, LPCWSTR value,
782 BOOL *value_ptr, BOOL *ret_ptr )
784 return get_uint_param( idx, regkey, value, (UINT *)value_ptr, (UINT *)ret_ptr );
787 /* set a uint parameter that is mirrored in two different registry locations */
788 static BOOL set_uint_param_mirrored( unsigned int idx, LPCWSTR regkey, LPCWSTR regkey_mirror,
789 LPCWSTR value, UINT *value_ptr, UINT new_val, UINT fWinIni )
793 wsprintfW(buf, CSu, new_val);
794 if (!SYSPARAMS_Save( regkey, value, buf, fWinIni )) return FALSE;
795 if (regkey_mirror) SYSPARAMS_Save( regkey_mirror, value, buf, fWinIni );
796 *value_ptr = new_val;
797 spi_loaded[idx] = TRUE;
801 /* save an int parameter in registry */
802 static BOOL save_int_param( LPCWSTR regkey, LPCWSTR value, INT *value_ptr,
803 INT new_val, UINT fWinIni )
807 wsprintfW(buf, CSd, new_val);
808 if (!SYSPARAMS_Save( regkey, value, buf, fWinIni )) return FALSE;
809 if( value_ptr) *value_ptr = new_val;
813 /* set an int parameter in the registry */
814 static inline BOOL set_int_param( unsigned int idx, LPCWSTR regkey, LPCWSTR value,
815 INT *value_ptr, INT new_val, UINT fWinIni )
817 BOOL ret = save_int_param( regkey, value, value_ptr, new_val, fWinIni );
818 if (ret) spi_loaded[idx] = TRUE;
822 /* set a uint parameter in the registry */
823 static inline BOOL set_uint_param( unsigned int idx, LPCWSTR regkey, LPCWSTR value,
824 UINT *value_ptr, UINT new_val, UINT fWinIni )
826 return set_uint_param_mirrored( idx, regkey, NULL, value, value_ptr, new_val, fWinIni );
829 /* set a boolean parameter that is mirrored in two different registry locations */
830 static inline BOOL set_bool_param_mirrored( unsigned int idx, LPCWSTR regkey, LPCWSTR regkey_mirror,
831 LPCWSTR value, BOOL *value_ptr, BOOL new_val, UINT fWinIni )
833 return set_uint_param_mirrored( idx, regkey, regkey_mirror, value,
834 (UINT *)value_ptr, new_val, fWinIni );
837 /* set a boolean parameter in the registry */
838 static inline BOOL set_bool_param( unsigned int idx, LPCWSTR regkey, LPCWSTR value,
839 BOOL *value_ptr, BOOL new_val, UINT fWinIni )
841 return set_uint_param( idx, regkey, value, (UINT *)value_ptr, new_val, fWinIni );
844 /* load a boolean parameter from the user preference key */
845 static BOOL get_user_pref_param( UINT offset, UINT mask, BOOL *ret_ptr )
847 if (!ret_ptr) return FALSE;
849 if (!spi_loaded[SPI_USERPREFERENCEMASK_IDX])
851 SYSPARAMS_LoadRaw( SPI_USERPREFERENCEMASK_REGKEY,
852 SPI_USERPREFERENCEMASK_VALNAME,
853 user_prefs, sizeof(user_prefs) );
854 spi_loaded[SPI_USERPREFERENCEMASK_IDX] = TRUE;
856 *ret_ptr = (user_prefs[offset] & mask) != 0;
860 /* set a boolean parameter in the user preference key */
861 static BOOL set_user_pref_param( UINT offset, UINT mask, BOOL value, BOOL fWinIni )
863 SYSPARAMS_LoadRaw( SPI_USERPREFERENCEMASK_REGKEY,
864 SPI_USERPREFERENCEMASK_VALNAME,
865 user_prefs, sizeof(user_prefs) );
866 spi_loaded[SPI_USERPREFERENCEMASK_IDX] = TRUE;
868 if (value) user_prefs[offset] |= mask;
869 else user_prefs[offset] &= ~mask;
871 SYSPARAMS_SaveRaw( SPI_USERPREFERENCEMASK_REGKEY,
872 SPI_USERPREFERENCEMASK_VALNAME,
873 user_prefs, sizeof(user_prefs), REG_BINARY, fWinIni );
877 /***********************************************************************
880 * Initialisation of the system metrics array.
882 void SYSPARAMS_Init(void)
884 HKEY hkey; /* key to the window metrics area of the registry */
889 /* initialize system colors */
891 if (RegCreateKeyExA(HKEY_CURRENT_USER, "Control Panel\\Colors", 0, 0, 0, KEY_ALL_ACCESS, 0, &hkey, 0))
893 for (i = 0; i < NUM_SYS_COLORS; i++)
897 /* first try, registry */
900 DWORD dwDataSize = sizeof(buffer);
901 if (!(RegQueryValueExA(hkey,DefSysColors[i*2], 0, 0, (LPBYTE) buffer, &dwDataSize)))
902 if (sscanf( buffer, "%d %d %d", &r, &g, &b ) == 3) bOk = TRUE;
905 /* second try, win.ini */
908 GetProfileStringA( "colors", DefSysColors[i*2], DefSysColors[i*2+1], buffer, 100 );
909 if (sscanf( buffer, " %d %d %d", &r, &g, &b ) == 3) bOk = TRUE;
912 /* last chance, take the default */
915 int iNumColors = sscanf( DefSysColors[i*2+1], " %d %d %d", &r, &g, &b );
916 assert (iNumColors==3);
919 SYSPARAMS_SetSysColor( i, RGB(r,g,b) );
921 if (hkey) RegCloseKey( hkey );
923 /* create 55AA bitmap */
925 h55AABitmap = CreateBitmap( 8, 8, 1, 1, wPattern55AA );
926 SYSCOLOR_55AABrush = CreatePatternBrush( h55AABitmap );
927 __wine_make_gdi_object_system( SYSCOLOR_55AABrush, TRUE );
931 /***********************************************************************
934 * Tries to retrieve logfont info from the specified key and value
936 static BOOL reg_get_logfont(LPCWSTR key, LPCWSTR value, LOGFONTW *lf)
945 base_keys[0] = get_volatile_regkey();
946 base_keys[1] = HKEY_CURRENT_USER;
948 for(i = 0; i < 2 && !found; i++)
950 if(RegOpenKeyW(base_keys[i], key, &hkey) == ERROR_SUCCESS)
952 size = sizeof(lfbuf);
953 if(RegQueryValueExW(hkey, value, NULL, &type, (LPBYTE)&lfbuf, &size) == ERROR_SUCCESS &&
956 if( size == sizeof(lfbuf))
959 memcpy(lf, &lfbuf, size);
960 } else if( size == sizeof( LOGFONT16))
961 { /* win9x-winME format */
963 SYSPARAMS_LogFont16To32W( (LOGFONT16*) &lfbuf, lf);
965 WARN("Unknown format in key %s value %s, size is %ld\n",
966 debugstr_w( key), debugstr_w( value), size);
971 if( found && lf->lfHeight > 0) {
972 /* positive height value means points ( inch/72 ) */
973 lf->lfHeight = -MulDiv( lf->lfHeight, get_display_dpi(), 72);
978 /* load all the minimized metrics */
979 static void load_minimized_metrics(void)
982 if (RegOpenKeyExW (HKEY_CURRENT_USER, METRICS_REGKEY,
983 0, KEY_QUERY_VALUE, &hkey) != ERROR_SUCCESS) hkey = 0;
985 minimized_metrics.iWidth = max( get_reg_metric(hkey,
986 METRICS_MINWIDTH_VALNAME, minimized_metrics.iWidth), 0);
987 minimized_metrics.iHorzGap = max( get_reg_metric(hkey,
988 METRICS_MINHORZGAP_VALNAME, minimized_metrics.iHorzGap), 0);
989 minimized_metrics.iVertGap = max( get_reg_metric(hkey,
990 METRICS_MINVERTGAP_VALNAME, minimized_metrics.iVertGap), 0);
991 minimized_metrics.iArrange = 0x0f & get_reg_metric(hkey,
992 METRICS_MINARRANGE_VALNAME, minimized_metrics.iArrange);
994 if (hkey) RegCloseKey( hkey );
995 spi_loaded[SPI_MINIMIZEDMETRICS_IDX] = TRUE;
998 /* adjust some of the raw values found in the registry */
999 static void normalize_nonclientmetrics( NONCLIENTMETRICSW *pncm)
1002 if( pncm->iBorderWidth < 1) pncm->iBorderWidth = 1;
1003 if( pncm->iCaptionWidth < 8) pncm->iCaptionWidth = 8;
1004 if( pncm->iScrollWidth < 8) pncm->iScrollWidth = 8;
1005 if( pncm->iScrollHeight < 8) pncm->iScrollHeight = 8;
1007 /* get some extra metrics */
1008 get_text_metr_size( get_display_dc(), &pncm->lfMenuFont,
1010 get_text_metr_size( get_display_dc(), &pncm->lfCaptionFont,
1011 NULL, &CaptionFontAvCharWidth);
1013 /* adjust some heights to the corresponding font */
1014 pncm->iMenuHeight = max( pncm->iMenuHeight,
1015 2 + tmMenuFont.tmHeight + tmMenuFont.tmExternalLeading);
1016 get_text_metr_size( get_display_dc(), &pncm->lfCaptionFont, &tm, NULL);
1017 pncm->iCaptionHeight = max( pncm->iCaptionHeight, 2 + tm.tmHeight);
1018 get_text_metr_size( get_display_dc(), &pncm->lfSmCaptionFont, &tm, NULL);
1019 pncm->iSmCaptionHeight = max( pncm->iSmCaptionHeight, 2 + tm.tmHeight);
1022 /* load all the non-client metrics */
1023 static void load_nonclient_metrics(void)
1026 NONCLIENTMETRICSW ncm;
1029 if (RegOpenKeyExW (HKEY_CURRENT_USER, METRICS_REGKEY,
1030 0, KEY_QUERY_VALUE, &hkey) != ERROR_SUCCESS) hkey = 0;
1032 /* initialize geometry entries */
1033 ncm.iBorderWidth = get_reg_metric(hkey, METRICS_BORDERWIDTH_VALNAME, 1);
1034 ncm.iScrollWidth = get_reg_metric(hkey, METRICS_SCROLLWIDTH_VALNAME, 16);
1035 ncm.iScrollHeight = get_reg_metric(hkey, METRICS_SCROLLHEIGHT_VALNAME, 16);
1037 /* size of the normal caption buttons */
1038 ncm.iCaptionHeight = get_reg_metric(hkey, METRICS_CAPTIONHEIGHT_VALNAME, 18);
1039 ncm.iCaptionWidth = get_reg_metric(hkey, METRICS_CAPTIONWIDTH_VALNAME, ncm.iCaptionHeight);
1041 /* caption font metrics */
1042 if (!reg_get_logfont(METRICS_REGKEY, METRICS_CAPTIONLOGFONT_VALNAME, &ncm.lfCaptionFont))
1044 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &ncm.lfCaptionFont, 0 );
1045 ncm.lfCaptionFont.lfWeight = FW_BOLD;
1048 /* size of the small caption buttons */
1049 ncm.iSmCaptionWidth = get_reg_metric(hkey, METRICS_SMCAPTIONWIDTH_VALNAME, 13);
1050 ncm.iSmCaptionHeight = get_reg_metric(hkey, METRICS_SMCAPTIONHEIGHT_VALNAME, 15);
1052 /* small caption font metrics */
1053 if (!reg_get_logfont(METRICS_REGKEY, METRICS_SMCAPTIONLOGFONT_VALNAME, &ncm.lfSmCaptionFont))
1054 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &ncm.lfSmCaptionFont, 0 );
1056 /* menus, FIXME: names of wine.conf entries are bogus */
1058 /* size of the menu (MDI) buttons */
1059 ncm.iMenuHeight = get_reg_metric(hkey, METRICS_MENUHEIGHT_VALNAME, 18);
1060 ncm.iMenuWidth = get_reg_metric(hkey, METRICS_MENUWIDTH_VALNAME, ncm.iMenuHeight);
1062 /* menu font metrics */
1063 if (!reg_get_logfont(METRICS_REGKEY, METRICS_MENULOGFONT_VALNAME, &ncm.lfMenuFont))
1065 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &ncm.lfMenuFont, 0 );
1066 GetProfileStringW( Desktop, MenuFont, ncm.lfCaptionFont.lfFaceName,
1067 ncm.lfMenuFont.lfFaceName, LF_FACESIZE );
1068 r = GetProfileIntW( Desktop, MenuFontSize, 0 );
1070 ncm.lfMenuFont.lfHeight = -r;
1071 ncm.lfMenuFont.lfWeight = FW_NORMAL;
1074 /* status bar font metrics */
1075 if (!reg_get_logfont(METRICS_REGKEY, METRICS_STATUSLOGFONT_VALNAME, &ncm.lfStatusFont))
1077 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &ncm.lfStatusFont, 0 );
1078 GetProfileStringW( Desktop, StatusFont, ncm.lfCaptionFont.lfFaceName,
1079 ncm.lfStatusFont.lfFaceName, LF_FACESIZE );
1080 r = GetProfileIntW( Desktop, StatusFontSize, 0 );
1082 ncm.lfStatusFont.lfHeight = -r;
1083 ncm.lfStatusFont.lfWeight = FW_NORMAL;
1086 /* message font metrics */
1087 if (!reg_get_logfont(METRICS_REGKEY, METRICS_MESSAGELOGFONT_VALNAME, &ncm.lfMessageFont))
1089 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &ncm.lfMessageFont, 0 );
1090 GetProfileStringW( Desktop, MessageFont, ncm.lfCaptionFont.lfFaceName,
1091 ncm.lfMessageFont.lfFaceName, LF_FACESIZE );
1092 r = GetProfileIntW( Desktop, MessageFontSize, 0 );
1094 ncm.lfMessageFont.lfHeight = -r;
1095 ncm.lfMessageFont.lfWeight = FW_NORMAL;
1098 /* some extra fields not in the nonclient structure */
1099 icon_size.cx = icon_size.cy = get_reg_metric( hkey, METRICS_ICONSIZE_VALNAME, 32 );
1101 if (hkey) RegCloseKey( hkey );
1102 normalize_nonclientmetrics( &ncm);
1103 memcpy( &nonclient_metrics, &ncm, sizeof(nonclient_metrics) );
1104 spi_loaded[SPI_NONCLIENTMETRICS_IDX] = TRUE;
1108 /***********************************************************************
1109 * SystemParametersInfoW (USER32.@)
1111 * Each system parameter has flag which shows whether the parameter
1112 * is loaded or not. Parameters, stored directly in SysParametersInfo are
1113 * loaded from registry only when they are requested and the flag is
1114 * "false", after the loading the flag is set to "true". On interprocess
1115 * notification of the parameter change the corresponding parameter flag is
1116 * set to "false". The parameter value will be reloaded when it is requested
1118 * Parameters, backed by or depend on GetSystemMetrics are processed
1119 * differently. These parameters are always loaded. They are reloaded right
1120 * away on interprocess change notification. We can't do lazy loading because
1121 * we don't want to complicate GetSystemMetrics.
1122 * Parameters, backed by X settings are read from corresponding setting.
1123 * On the parameter change request the setting is changed. Interprocess change
1124 * notifications are ignored.
1125 * When parameter value is updated the changed value is stored in permanent
1126 * registry branch if saving is requested. Otherwise it is stored
1127 * in temporary branch
1129 * Some SPI values can also be stored as Twips values in the registry,
1130 * don't forget the conversion!
1132 BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
1133 PVOID pvParam, UINT fWinIni )
1135 #define WINE_SPI_FIXME(x) \
1137 FIXME( "Unimplemented action: %u (%s)\n", x, #x ); \
1138 SetLastError( ERROR_INVALID_SPI_VALUE ); \
1141 #define WINE_SPI_WARN(x) \
1143 WARN( "Ignored action: %u (%s)\n", x, #x ); \
1147 unsigned spi_idx = 0;
1151 case SPI_GETBEEP: /* 1 */
1152 if (!pvParam) return FALSE;
1154 spi_idx = SPI_SETBEEP_IDX;
1155 if (!spi_loaded[spi_idx])
1159 if (SYSPARAMS_Load( SPI_SETBEEP_REGKEY, SPI_SETBEEP_VALNAME, buf, sizeof(buf) ))
1160 beep_active = !lstrcmpiW( Yes, buf );
1161 spi_loaded[spi_idx] = TRUE;
1164 *(BOOL *)pvParam = beep_active;
1167 case SPI_SETBEEP: /* 2 */
1168 spi_idx = SPI_SETBEEP_IDX;
1169 if (SYSPARAMS_Save( SPI_SETBEEP_REGKEY, SPI_SETBEEP_VALNAME,
1170 (uiParam ? Yes : No), fWinIni ))
1172 beep_active = uiParam;
1173 spi_loaded[spi_idx] = TRUE;
1179 case SPI_GETMOUSE: /* 3 */
1180 if (!pvParam) return FALSE;
1182 spi_idx = SPI_SETMOUSE_IDX;
1183 if (!spi_loaded[spi_idx])
1187 if (SYSPARAMS_Load( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME1,
1189 mouse_threshold1 = atoiW( buf );
1190 if (SYSPARAMS_Load( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME2,
1192 mouse_threshold2 = atoiW( buf );
1193 if (SYSPARAMS_Load( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME3,
1195 mouse_speed = atoiW( buf );
1196 spi_loaded[spi_idx] = TRUE;
1198 ((INT *)pvParam)[0] = mouse_threshold1;
1199 ((INT *)pvParam)[1] = mouse_threshold2;
1200 ((INT *)pvParam)[2] = mouse_speed;
1203 case SPI_SETMOUSE: /* 4 */
1205 if (!pvParam) return FALSE;
1206 ret = set_int_param( SPI_SETMOUSE_IDX, SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME1,
1207 &mouse_threshold1, ((INT *)pvParam)[0], fWinIni);
1209 save_int_param( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME2,
1210 &mouse_threshold2, ((INT *)pvParam)[1], fWinIni);
1211 save_int_param( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME3,
1212 &mouse_speed, ((INT *)pvParam)[2], fWinIni);
1218 ret = get_twips_param( SPI_SETBORDER_IDX,
1219 SPI_SETBORDER_REGKEY,
1220 SPI_SETBORDER_VALNAME,
1222 if( *(INT*)pvParam < 1) *(INT*)pvParam = 1;
1226 nonclient_metrics.iBorderWidth = uiParam > 0 ? uiParam : 1;
1227 /* raw value goes to registry */
1228 ret = set_uint_param( SPI_SETBORDER_IDX,
1229 SPI_SETBORDER_REGKEY,
1230 SPI_SETBORDER_VALNAME,
1231 &border, uiParam, fWinIni );
1234 case SPI_GETKEYBOARDSPEED:
1235 ret = get_uint_param( SPI_SETKEYBOARDSPEED_IDX,
1236 SPI_SETKEYBOARDSPEED_REGKEY,
1237 SPI_SETKEYBOARDSPEED_VALNAME,
1238 &keyboard_speed, pvParam );
1241 case SPI_SETKEYBOARDSPEED:
1242 if (uiParam > 31) uiParam = 31;
1243 ret = set_uint_param( SPI_SETKEYBOARDSPEED_IDX,
1244 SPI_SETKEYBOARDSPEED_REGKEY,
1245 SPI_SETKEYBOARDSPEED_VALNAME,
1246 &keyboard_speed, uiParam, fWinIni );
1249 /* not implemented in Windows */
1250 WINE_SPI_WARN(SPI_LANGDRIVER); /* 12 */
1252 case SPI_ICONHORIZONTALSPACING:
1253 if (pvParam != NULL)
1255 ret = get_twips_param( SPI_ICONHORIZONTALSPACING_IDX,
1256 SPI_ICONHORIZONTALSPACING_REGKEY,
1257 SPI_ICONHORIZONTALSPACING_VALNAME,
1258 (UINT*)&icon_metrics.iHorzSpacing, pvParam );
1262 if (uiParam < 32) uiParam = 32;
1263 ret = set_uint_param( SPI_ICONHORIZONTALSPACING_IDX,
1264 SPI_ICONHORIZONTALSPACING_REGKEY,
1265 SPI_ICONHORIZONTALSPACING_VALNAME,
1266 (UINT*)&icon_metrics.iHorzSpacing, uiParam, fWinIni );
1270 case SPI_GETSCREENSAVETIMEOUT:
1271 ret = get_uint_param( SPI_SETSCREENSAVETIMEOUT_IDX,
1272 SPI_SETSCREENSAVETIMEOUT_REGKEY,
1273 SPI_SETSCREENSAVETIMEOUT_VALNAME,
1274 &screensave_timeout, pvParam );
1277 case SPI_SETSCREENSAVETIMEOUT:
1278 ret = set_uint_param( SPI_SETSCREENSAVETIMEOUT_IDX,
1279 SPI_SETSCREENSAVETIMEOUT_REGKEY,
1280 SPI_SETSCREENSAVETIMEOUT_VALNAME,
1281 &screensave_timeout, uiParam, fWinIni );
1284 case SPI_GETSCREENSAVEACTIVE: /* 16 */
1285 if (!pvParam) return FALSE;
1286 *(BOOL *)pvParam = USER_Driver->pGetScreenSaveActive();
1289 case SPI_SETSCREENSAVEACTIVE: /* 17 */
1293 wsprintfW(buf, CSu, uiParam);
1294 USER_Driver->pSetScreenSaveActive( uiParam );
1295 /* saved value does not affect Wine */
1296 SYSPARAMS_Save( SPI_SETSCREENSAVEACTIVE_REGKEY,
1297 SPI_SETSCREENSAVEACTIVE_VALNAME,
1302 case SPI_GETGRIDGRANULARITY:
1303 ret = get_uint_param( SPI_SETGRIDGRANULARITY_IDX,
1304 SPI_SETGRIDGRANULARITY_REGKEY,
1305 SPI_SETGRIDGRANULARITY_VALNAME,
1306 &grid_granularity, pvParam );
1309 case SPI_SETGRIDGRANULARITY:
1310 ret = set_uint_param( SPI_SETGRIDGRANULARITY_IDX,
1311 SPI_SETGRIDGRANULARITY_REGKEY,
1312 SPI_SETGRIDGRANULARITY_VALNAME,
1313 &grid_granularity, uiParam, fWinIni );
1316 case SPI_SETDESKWALLPAPER: /* 20 */
1317 if (!pvParam || !SetDeskWallPaper( (LPSTR)pvParam )) return FALSE;
1318 SYSPARAMS_Save(SPI_SETDESKWALLPAPER_REGKEY, SPI_SETDESKWALLPAPER_VALNAME, pvParam, fWinIni);
1321 case SPI_SETDESKPATTERN: /* 21 */
1322 /* FIXME: the ability to specify a pattern in pvParam
1323 doesn't seem to be documented for Win32 */
1324 if ((INT16)uiParam == -1)
1327 GetProfileStringW( Desktop, Pattern,
1329 buf, sizeof(buf)/sizeof(WCHAR) );
1330 ret = DESKTOP_SetPattern( buf );
1332 ret = DESKTOP_SetPattern( (LPWSTR)pvParam );
1335 case SPI_GETKEYBOARDDELAY:
1336 ret = get_uint_param( SPI_SETKEYBOARDDELAY_IDX,
1337 SPI_SETKEYBOARDDELAY_REGKEY,
1338 SPI_SETKEYBOARDDELAY_VALNAME,
1339 &keyboard_delay, pvParam );
1342 case SPI_SETKEYBOARDDELAY:
1343 ret = set_uint_param( SPI_SETKEYBOARDDELAY_IDX,
1344 SPI_SETKEYBOARDDELAY_REGKEY,
1345 SPI_SETKEYBOARDDELAY_VALNAME,
1346 &keyboard_delay, uiParam, fWinIni );
1349 case SPI_ICONVERTICALSPACING:
1350 if (pvParam != NULL)
1352 ret = get_twips_param( SPI_ICONVERTICALSPACING_IDX,
1353 SPI_ICONVERTICALSPACING_REGKEY,
1354 SPI_ICONVERTICALSPACING_VALNAME,
1355 (UINT*)&icon_metrics.iVertSpacing, pvParam );
1356 if( icon_metrics.iVertSpacing < 32)
1357 icon_metrics.iVertSpacing = 32;
1361 if (uiParam < 32) uiParam = 32;
1362 ret = set_uint_param( SPI_ICONVERTICALSPACING_IDX,
1363 SPI_ICONVERTICALSPACING_REGKEY,
1364 SPI_ICONVERTICALSPACING_VALNAME,
1365 (UINT*)&icon_metrics.iVertSpacing, uiParam, fWinIni );
1369 case SPI_GETICONTITLEWRAP:
1370 ret = get_bool_param( SPI_SETICONTITLEWRAP_IDX,
1371 SPI_SETICONTITLEWRAP_REGKEY1,
1372 SPI_SETICONTITLEWRAP_VALNAME,
1373 &icon_metrics.iTitleWrap, pvParam );
1376 case SPI_SETICONTITLEWRAP:
1377 ret = set_bool_param_mirrored( SPI_SETICONTITLEWRAP_IDX,
1378 SPI_SETICONTITLEWRAP_REGKEY1,
1379 SPI_SETICONTITLEWRAP_REGKEY2,
1380 SPI_SETICONTITLEWRAP_VALNAME,
1381 &icon_metrics.iTitleWrap, uiParam, fWinIni );
1384 case SPI_GETMENUDROPALIGNMENT:
1385 ret = get_uint_param( SPI_SETMENUDROPALIGNMENT_IDX,
1386 SPI_SETMENUDROPALIGNMENT_REGKEY1,
1387 SPI_SETMENUDROPALIGNMENT_VALNAME,
1388 &menu_drop_alignment, pvParam );
1391 case SPI_SETMENUDROPALIGNMENT:
1392 ret = set_uint_param_mirrored( SPI_SETMENUDROPALIGNMENT_IDX,
1393 SPI_SETMENUDROPALIGNMENT_REGKEY1,
1394 SPI_SETMENUDROPALIGNMENT_REGKEY2,
1395 SPI_SETMENUDROPALIGNMENT_VALNAME,
1396 &menu_drop_alignment, uiParam, fWinIni );
1399 case SPI_SETDOUBLECLKWIDTH:
1400 ret = set_uint_param_mirrored( SPI_SETDOUBLECLKWIDTH_IDX,
1401 SPI_SETDOUBLECLKWIDTH_REGKEY1,
1402 SPI_SETDOUBLECLKWIDTH_REGKEY2,
1403 SPI_SETDOUBLECLKWIDTH_VALNAME,
1404 &double_click_width, uiParam, fWinIni );
1407 case SPI_SETDOUBLECLKHEIGHT:
1408 ret = set_uint_param_mirrored( SPI_SETDOUBLECLKHEIGHT_IDX,
1409 SPI_SETDOUBLECLKHEIGHT_REGKEY1,
1410 SPI_SETDOUBLECLKHEIGHT_REGKEY2,
1411 SPI_SETDOUBLECLKHEIGHT_VALNAME,
1412 &double_click_height, uiParam, fWinIni );
1415 case SPI_GETICONTITLELOGFONT:
1419 if (!pvParam) return FALSE;
1421 spi_idx = SPI_SETICONTITLELOGFONT_IDX;
1422 if (!spi_loaded[spi_idx])
1424 if (!reg_get_logfont( SPI_SETICONTITLELOGFONT_REGKEY,
1425 SPI_SETICONTITLELOGFONT_VALNAME, &icon_metrics.lfFont ))
1430 * The 'default GDI fonts' seems to be returned.
1431 * If a returned font is not a correct font in your environment,
1432 * please try to fix objects/gdiobj.c at first.
1434 GetObjectW( GetStockObject( DEFAULT_GUI_FONT ), sizeof(LOGFONTW), &lfDefault );
1436 GetProfileStringW( Desktop, IconTitleFaceName,
1437 lfDefault.lfFaceName,
1438 icon_metrics.lfFont.lfFaceName,
1441 r = GetProfileIntW( Desktop, IconTitleSize, 0 );
1443 icon_metrics.lfFont.lfHeight = -r;
1445 icon_metrics.lfFont.lfHeight = lfDefault.lfHeight;
1447 icon_metrics.lfFont.lfWidth = 0;
1448 icon_metrics.lfFont.lfEscapement = icon_metrics.lfFont.lfOrientation = 0;
1449 icon_metrics.lfFont.lfWeight = FW_NORMAL;
1450 icon_metrics.lfFont.lfItalic = FALSE;
1451 icon_metrics.lfFont.lfStrikeOut = FALSE;
1452 icon_metrics.lfFont.lfUnderline = FALSE;
1453 icon_metrics.lfFont.lfCharSet = lfDefault.lfCharSet; /* at least 'charset' should not be hard-coded */
1454 icon_metrics.lfFont.lfOutPrecision = OUT_DEFAULT_PRECIS;
1455 icon_metrics.lfFont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
1456 icon_metrics.lfFont.lfQuality = DEFAULT_QUALITY;
1457 icon_metrics.lfFont.lfPitchAndFamily = DEFAULT_PITCH;
1458 spi_loaded[spi_idx] = TRUE;
1461 *(LOGFONTW *)pvParam = icon_metrics.lfFont;
1465 case SPI_SETDOUBLECLICKTIME:
1466 ret = set_uint_param( SPI_SETDOUBLECLICKTIME_IDX,
1467 SPI_SETDOUBLECLICKTIME_REGKEY,
1468 SPI_SETDOUBLECLICKTIME_VALNAME,
1469 &double_click_time, uiParam, fWinIni );
1472 case SPI_SETMOUSEBUTTONSWAP:
1473 ret = set_bool_param( SPI_SETMOUSEBUTTONSWAP_IDX,
1474 SPI_SETMOUSEBUTTONSWAP_REGKEY,
1475 SPI_SETMOUSEBUTTONSWAP_VALNAME,
1476 &swap_buttons, uiParam, fWinIni );
1479 case SPI_SETICONTITLELOGFONT: /* 34 */
1480 if( uiParam == sizeof( ICONMETRICSW)) {
1481 ret = SYSPARAMS_SaveLogFont( SPI_SETICONTITLELOGFONT_REGKEY,
1482 SPI_SETICONTITLELOGFONT_VALNAME, (LOGFONTW *)pvParam, fWinIni);
1484 icon_metrics.lfFont = *(LOGFONTW *)pvParam;
1485 spi_loaded[SPI_SETICONTITLELOGFONT_IDX] = TRUE;
1491 case SPI_GETFASTTASKSWITCH: /* 35 */
1492 if (!pvParam) return FALSE;
1493 *(BOOL *)pvParam = 1;
1496 case SPI_SETFASTTASKSWITCH: /* 36 */
1497 /* the action is disabled */
1501 case SPI_SETDRAGFULLWINDOWS:
1502 ret = set_bool_param( SPI_SETDRAGFULLWINDOWS_IDX,
1503 SPI_SETDRAGFULLWINDOWS_REGKEY,
1504 SPI_SETDRAGFULLWINDOWS_VALNAME,
1505 &drag_full_windows, uiParam, fWinIni );
1508 case SPI_GETDRAGFULLWINDOWS:
1509 ret = get_bool_param( SPI_SETDRAGFULLWINDOWS_IDX,
1510 SPI_SETDRAGFULLWINDOWS_REGKEY,
1511 SPI_SETDRAGFULLWINDOWS_VALNAME,
1512 &drag_full_windows, pvParam );
1515 case SPI_GETNONCLIENTMETRICS:
1517 LPNONCLIENTMETRICSW lpnm = pvParam;
1519 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
1521 if (lpnm && lpnm->cbSize == sizeof(NONCLIENTMETRICSW))
1522 memcpy( lpnm, &nonclient_metrics, sizeof(*lpnm) );
1528 case SPI_SETNONCLIENTMETRICS:
1530 LPNONCLIENTMETRICSW lpnm = pvParam;
1532 if (lpnm && lpnm->cbSize == sizeof(NONCLIENTMETRICSW))
1534 NONCLIENTMETRICSW ncm;
1535 ret = set_uint_param( SPI_SETBORDER_IDX,
1536 SPI_SETBORDER_REGKEY, SPI_SETBORDER_VALNAME,
1537 &border, lpnm->iBorderWidth, fWinIni );
1538 if( ret) ret = save_int_param( METRICS_REGKEY,
1539 METRICS_SCROLLWIDTH_VALNAME, NULL,
1540 lpnm->iScrollWidth, fWinIni );
1541 if( ret) ret = save_int_param( METRICS_REGKEY,
1542 METRICS_SCROLLHEIGHT_VALNAME, NULL,
1543 lpnm->iScrollHeight, fWinIni );
1544 if( ret) ret = save_int_param( METRICS_REGKEY,
1545 METRICS_CAPTIONWIDTH_VALNAME, NULL,
1546 lpnm->iCaptionWidth, fWinIni );
1547 if( ret) ret = save_int_param( METRICS_REGKEY,
1548 METRICS_CAPTIONHEIGHT_VALNAME, NULL,
1549 lpnm->iCaptionHeight, fWinIni );
1550 if( ret) ret = save_int_param( METRICS_REGKEY,
1551 METRICS_SMCAPTIONWIDTH_VALNAME, NULL,
1552 lpnm->iSmCaptionWidth, fWinIni );
1553 if( ret) ret = save_int_param( METRICS_REGKEY,
1554 METRICS_SMCAPTIONHEIGHT_VALNAME, NULL,
1555 lpnm->iSmCaptionHeight, fWinIni );
1556 if( ret) ret = save_int_param( METRICS_REGKEY,
1557 METRICS_MENUWIDTH_VALNAME, NULL,
1558 lpnm->iMenuWidth, fWinIni );
1559 if( ret) ret = save_int_param( METRICS_REGKEY,
1560 METRICS_MENUHEIGHT_VALNAME, NULL,
1561 lpnm->iMenuHeight, fWinIni );
1562 if( ret) ret = SYSPARAMS_SaveLogFont(
1563 METRICS_REGKEY, METRICS_MENULOGFONT_VALNAME,
1564 &lpnm->lfMenuFont, fWinIni);
1565 if( ret) ret = SYSPARAMS_SaveLogFont(
1566 METRICS_REGKEY, METRICS_CAPTIONLOGFONT_VALNAME,
1567 &lpnm->lfCaptionFont, fWinIni);
1568 if( ret) ret = SYSPARAMS_SaveLogFont(
1569 METRICS_REGKEY, METRICS_SMCAPTIONLOGFONT_VALNAME,
1570 &lpnm->lfSmCaptionFont, fWinIni);
1571 if( ret) ret = SYSPARAMS_SaveLogFont(
1572 METRICS_REGKEY, METRICS_STATUSLOGFONT_VALNAME,
1573 &lpnm->lfStatusFont, fWinIni);
1574 if( ret) ret = SYSPARAMS_SaveLogFont(
1575 METRICS_REGKEY, METRICS_MESSAGELOGFONT_VALNAME,
1576 &lpnm->lfMessageFont, fWinIni);
1578 memcpy( &ncm, lpnm, sizeof(nonclient_metrics) );
1579 normalize_nonclientmetrics( &ncm);
1580 memcpy( &nonclient_metrics, &ncm, sizeof(nonclient_metrics) );
1581 spi_loaded[SPI_NONCLIENTMETRICS_IDX] = TRUE;
1587 case SPI_GETMINIMIZEDMETRICS:
1589 MINIMIZEDMETRICS * lpMm = pvParam;
1590 if (lpMm && lpMm->cbSize == sizeof(*lpMm)) {
1591 if( spi_loaded[SPI_MINIMIZEDMETRICS_IDX]) load_minimized_metrics();
1592 memcpy( lpMm, &minimized_metrics, sizeof(*lpMm) );
1598 case SPI_SETMINIMIZEDMETRICS:
1600 MINIMIZEDMETRICS * lpMm = pvParam;
1601 if (lpMm && lpMm->cbSize == sizeof(*lpMm)) {
1602 ret = save_int_param( METRICS_REGKEY, METRICS_MINWIDTH_VALNAME,
1603 &minimized_metrics.iWidth, max( lpMm->iWidth, 0), fWinIni);
1604 if( ret) ret = save_int_param( METRICS_REGKEY,
1605 METRICS_MINHORZGAP_VALNAME, &minimized_metrics.iHorzGap,
1606 max( lpMm->iHorzGap, 0), fWinIni);
1607 if( ret) ret = save_int_param( METRICS_REGKEY,
1608 METRICS_MINVERTGAP_VALNAME, &minimized_metrics.iVertGap,
1609 max( lpMm->iVertGap, 0), fWinIni);
1610 if( ret) ret = save_int_param( METRICS_REGKEY,
1611 METRICS_MINARRANGE_VALNAME, &minimized_metrics.iArrange,
1612 0x0f & lpMm->iArrange, fWinIni);
1613 if( ret) spi_loaded[SPI_MINIMIZEDMETRICS_IDX] = TRUE;
1619 case SPI_GETICONMETRICS:
1621 LPICONMETRICSW lpIcon = pvParam;
1622 if(lpIcon && lpIcon->cbSize == sizeof(*lpIcon))
1624 SystemParametersInfoW( SPI_ICONHORIZONTALSPACING, 0,
1625 &lpIcon->iHorzSpacing, FALSE );
1626 SystemParametersInfoW( SPI_ICONVERTICALSPACING, 0,
1627 &lpIcon->iVertSpacing, FALSE );
1628 SystemParametersInfoW( SPI_GETICONTITLEWRAP, 0,
1629 &lpIcon->iTitleWrap, FALSE );
1630 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0,
1631 &lpIcon->lfFont, FALSE );
1640 case SPI_SETICONMETRICS:
1642 LPICONMETRICSW lpIcon = pvParam;
1643 if (lpIcon && lpIcon->cbSize == sizeof(*lpIcon)) {
1644 ret = set_int_param( SPI_ICONVERTICALSPACING_IDX,
1645 SPI_ICONVERTICALSPACING_REGKEY,
1646 SPI_ICONVERTICALSPACING_VALNAME,
1647 &icon_metrics.iVertSpacing,
1648 lpIcon->iVertSpacing, fWinIni);
1650 ret = set_int_param( SPI_ICONHORIZONTALSPACING_IDX,
1651 SPI_ICONHORIZONTALSPACING_REGKEY,
1652 SPI_ICONHORIZONTALSPACING_VALNAME,
1653 &icon_metrics.iHorzSpacing,
1654 lpIcon->iHorzSpacing, fWinIni );
1657 ret = set_bool_param_mirrored( SPI_SETICONTITLEWRAP_IDX,
1658 SPI_SETICONTITLEWRAP_REGKEY1, SPI_SETICONTITLEWRAP_REGKEY2,
1659 SPI_SETICONTITLEWRAP_VALNAME, &icon_metrics.iTitleWrap,
1660 lpIcon->iTitleWrap, fWinIni );
1662 if( ret) ret = SYSPARAMS_SaveLogFont( SPI_SETICONTITLELOGFONT_REGKEY,
1663 SPI_SETICONTITLELOGFONT_VALNAME, &lpIcon->lfFont, fWinIni);
1665 icon_metrics.lfFont = lpIcon->lfFont;
1666 spi_loaded[SPI_SETICONTITLELOGFONT_IDX] = TRUE;
1673 case SPI_SETWORKAREA: /* 47 WINVER >= 0x400 */
1675 if (!pvParam) return FALSE;
1677 spi_idx = SPI_SETWORKAREA_IDX;
1678 CopyRect( &work_area, (RECT *)pvParam );
1679 spi_loaded[spi_idx] = TRUE;
1683 case SPI_GETWORKAREA: /* 48 WINVER >= 0x400 */
1685 if (!pvParam) return FALSE;
1687 spi_idx = SPI_SETWORKAREA_IDX;
1688 if (!spi_loaded[spi_idx])
1690 SetRect( &work_area, 0, 0,
1691 GetSystemMetrics( SM_CXSCREEN ),
1692 GetSystemMetrics( SM_CYSCREEN ) );
1693 spi_loaded[spi_idx] = TRUE;
1695 CopyRect( (RECT *)pvParam, &work_area );
1700 WINE_SPI_FIXME(SPI_SETPENWINDOWS); /* 49 WINVER >= 0x400 */
1702 case SPI_GETFILTERKEYS: /* 50 */
1704 LPFILTERKEYS lpFilterKeys = (LPFILTERKEYS)pvParam;
1705 WARN("SPI_GETFILTERKEYS not fully implemented\n");
1706 if (lpFilterKeys && lpFilterKeys->cbSize == sizeof(FILTERKEYS))
1708 /* Indicate that no FilterKeys feature available */
1709 lpFilterKeys->dwFlags = 0;
1710 lpFilterKeys->iWaitMSec = 0;
1711 lpFilterKeys->iDelayMSec = 0;
1712 lpFilterKeys->iRepeatMSec = 0;
1713 lpFilterKeys->iBounceMSec = 0;
1721 WINE_SPI_FIXME(SPI_SETFILTERKEYS); /* 51 */
1723 case SPI_GETTOGGLEKEYS: /* 52 */
1725 LPTOGGLEKEYS lpToggleKeys = (LPTOGGLEKEYS)pvParam;
1726 WARN("SPI_GETTOGGLEKEYS not fully implemented\n");
1727 if (lpToggleKeys && lpToggleKeys->cbSize == sizeof(TOGGLEKEYS))
1729 /* Indicate that no ToggleKeys feature available */
1730 lpToggleKeys->dwFlags = 0;
1738 WINE_SPI_FIXME(SPI_SETTOGGLEKEYS); /* 53 */
1740 case SPI_GETMOUSEKEYS: /* 54 */
1742 LPMOUSEKEYS lpMouseKeys = (LPMOUSEKEYS)pvParam;
1743 WARN("SPI_GETMOUSEKEYS not fully implemented\n");
1744 if (lpMouseKeys && lpMouseKeys->cbSize == sizeof(MOUSEKEYS))
1746 /* Indicate that no MouseKeys feature available */
1747 lpMouseKeys->dwFlags = 0;
1748 lpMouseKeys->iMaxSpeed = 360;
1749 lpMouseKeys->iTimeToMaxSpeed = 1000;
1750 lpMouseKeys->iCtrlSpeed = 0;
1751 lpMouseKeys->dwReserved1 = 0;
1752 lpMouseKeys->dwReserved2 = 0;
1760 WINE_SPI_FIXME(SPI_SETMOUSEKEYS); /* 55 */
1762 case SPI_GETSHOWSOUNDS:
1763 ret = get_bool_param( SPI_SETSHOWSOUNDS_IDX,
1764 SPI_SETSHOWSOUNDS_REGKEY,
1765 SPI_SETSHOWSOUNDS_VALNAME,
1766 &show_sounds, pvParam );
1769 case SPI_SETSHOWSOUNDS:
1770 ret = set_bool_param( SPI_SETSHOWSOUNDS_IDX,
1771 SPI_SETSHOWSOUNDS_REGKEY,
1772 SPI_SETSHOWSOUNDS_VALNAME,
1773 &show_sounds, uiParam, fWinIni );
1776 case SPI_GETSTICKYKEYS: /* 58 */
1778 LPSTICKYKEYS lpStickyKeys = (LPSTICKYKEYS)pvParam;
1779 WARN("SPI_GETSTICKYKEYS not fully implemented\n");
1780 if (lpStickyKeys && lpStickyKeys->cbSize == sizeof(STICKYKEYS))
1782 /* Indicate that no StickyKeys feature available */
1783 lpStickyKeys->dwFlags = 0;
1791 WINE_SPI_FIXME(SPI_SETSTICKYKEYS); /* 59 */
1793 case SPI_GETACCESSTIMEOUT: /* 60 */
1795 LPACCESSTIMEOUT lpAccessTimeout = (LPACCESSTIMEOUT)pvParam;
1796 WARN("SPI_GETACCESSTIMEOUT not fully implemented\n");
1797 if (lpAccessTimeout && lpAccessTimeout->cbSize == sizeof(ACCESSTIMEOUT))
1799 /* Indicate that no accessibility features timeout is available */
1800 lpAccessTimeout->dwFlags = 0;
1801 lpAccessTimeout->iTimeOutMSec = 0;
1809 WINE_SPI_FIXME(SPI_SETACCESSTIMEOUT); /* 61 */
1811 case SPI_GETSERIALKEYS: /* 62 WINVER >= 0x400 */
1813 LPSERIALKEYSW lpSerialKeysW = (LPSERIALKEYSW)pvParam;
1814 WARN("SPI_GETSERIALKEYS not fully implemented\n");
1815 if (lpSerialKeysW && lpSerialKeysW->cbSize == sizeof(SERIALKEYSW))
1817 /* Indicate that no SerialKeys feature available */
1818 lpSerialKeysW->dwFlags = 0;
1819 lpSerialKeysW->lpszActivePort = NULL;
1820 lpSerialKeysW->lpszPort = NULL;
1821 lpSerialKeysW->iBaudRate = 0;
1822 lpSerialKeysW->iPortState = 0;
1830 WINE_SPI_FIXME(SPI_SETSERIALKEYS); /* 63 WINVER >= 0x400 */
1832 case SPI_GETSOUNDSENTRY: /* 64 */
1834 LPSOUNDSENTRYW lpSoundSentryW = (LPSOUNDSENTRYW)pvParam;
1835 WARN("SPI_GETSOUNDSENTRY not fully implemented\n");
1836 if (lpSoundSentryW && lpSoundSentryW->cbSize == sizeof(SOUNDSENTRYW))
1838 /* Indicate that no SoundSentry feature available */
1839 lpSoundSentryW->dwFlags = 0;
1840 lpSoundSentryW->iFSTextEffect = 0;
1841 lpSoundSentryW->iFSTextEffectMSec = 0;
1842 lpSoundSentryW->iFSTextEffectColorBits = 0;
1843 lpSoundSentryW->iFSGrafEffect = 0;
1844 lpSoundSentryW->iFSGrafEffectMSec = 0;
1845 lpSoundSentryW->iFSGrafEffectColor = 0;
1846 lpSoundSentryW->iWindowsEffect = 0;
1847 lpSoundSentryW->iWindowsEffectMSec = 0;
1848 lpSoundSentryW->lpszWindowsEffectDLL = 0;
1849 lpSoundSentryW->iWindowsEffectOrdinal = 0;
1857 WINE_SPI_FIXME(SPI_SETSOUNDSENTRY); /* 65 */
1859 case SPI_GETHIGHCONTRAST: /* 66 WINVER >= 0x400 */
1861 LPHIGHCONTRASTW lpHighContrastW = (LPHIGHCONTRASTW)pvParam;
1862 WARN("SPI_GETHIGHCONTRAST not fully implemented\n");
1863 if (lpHighContrastW && lpHighContrastW->cbSize == sizeof(HIGHCONTRASTW))
1865 /* Indicate that no high contrast feature available */
1866 lpHighContrastW->dwFlags = 0;
1867 lpHighContrastW->lpszDefaultScheme = NULL;
1875 WINE_SPI_FIXME(SPI_SETHIGHCONTRAST); /* 67 WINVER >= 0x400 */
1877 case SPI_GETKEYBOARDPREF:
1878 ret = get_bool_param( SPI_SETKEYBOARDPREF_IDX,
1879 SPI_SETKEYBOARDPREF_REGKEY,
1880 SPI_SETKEYBOARDPREF_VALNAME,
1881 &keyboard_pref, pvParam );
1884 case SPI_SETKEYBOARDPREF:
1885 ret = set_bool_param( SPI_SETKEYBOARDPREF_IDX,
1886 SPI_SETKEYBOARDPREF_REGKEY,
1887 SPI_SETKEYBOARDPREF_VALNAME,
1888 &keyboard_pref, uiParam, fWinIni );
1891 case SPI_GETSCREENREADER:
1892 ret = get_bool_param( SPI_SETSCREENREADER_IDX,
1893 SPI_SETSCREENREADER_REGKEY,
1894 SPI_SETSCREENREADER_VALNAME,
1895 &screen_reader, pvParam );
1898 case SPI_SETSCREENREADER:
1899 ret = set_bool_param( SPI_SETSCREENREADER_IDX,
1900 SPI_SETSCREENREADER_REGKEY,
1901 SPI_SETSCREENREADER_VALNAME,
1902 &screen_reader, uiParam, fWinIni );
1905 case SPI_GETANIMATION: /* 72 WINVER >= 0x400 */
1907 LPANIMATIONINFO lpAnimInfo = (LPANIMATIONINFO)pvParam;
1909 /* Tell it "disabled" */
1910 if (lpAnimInfo && lpAnimInfo->cbSize == sizeof(ANIMATIONINFO))
1911 lpAnimInfo->iMinAnimate = 0; /* Minimise and restore animation is disabled (nonzero == enabled) */
1916 WINE_SPI_WARN(SPI_SETANIMATION); /* 73 WINVER >= 0x400 */
1918 case SPI_GETFONTSMOOTHING:
1921 ret = get_uint_param( SPI_SETFONTSMOOTHING_IDX,
1922 SPI_SETFONTSMOOTHING_REGKEY,
1923 SPI_SETFONTSMOOTHING_VALNAME,
1924 &font_smoothing, &tmpval );
1925 *(UINT *) pvParam = ( tmpval != 0);
1928 case SPI_SETFONTSMOOTHING:
1929 uiParam = uiParam ? 2 : 0; /* Win NT4/2k/XP behavior */
1930 ret = set_uint_param( SPI_SETFONTSMOOTHING_IDX,
1931 SPI_SETFONTSMOOTHING_REGKEY,
1932 SPI_SETFONTSMOOTHING_VALNAME,
1933 &font_smoothing, uiParam, fWinIni );
1936 WINE_SPI_FIXME(SPI_SETDRAGWIDTH); /* 76 WINVER >= 0x400 */
1937 WINE_SPI_FIXME(SPI_SETDRAGHEIGHT); /* 77 WINVER >= 0x400 */
1939 WINE_SPI_FIXME(SPI_SETHANDHELD); /* 78 WINVER >= 0x400 */
1941 WINE_SPI_FIXME(SPI_GETLOWPOWERTIMEOUT); /* 79 WINVER >= 0x400 */
1942 WINE_SPI_FIXME(SPI_GETPOWEROFFTIMEOUT); /* 80 WINVER >= 0x400 */
1943 WINE_SPI_FIXME(SPI_SETLOWPOWERTIMEOUT); /* 81 WINVER >= 0x400 */
1944 WINE_SPI_FIXME(SPI_SETPOWEROFFTIMEOUT); /* 82 WINVER >= 0x400 */
1946 case SPI_GETLOWPOWERACTIVE:
1947 ret = get_bool_param( SPI_SETLOWPOWERACTIVE_IDX,
1948 SPI_SETLOWPOWERACTIVE_REGKEY,
1949 SPI_SETLOWPOWERACTIVE_VALNAME,
1950 &lowpoweractive, pvParam );
1953 case SPI_GETPOWEROFFACTIVE:
1954 ret = get_bool_param( SPI_SETPOWEROFFACTIVE_IDX,
1955 SPI_SETPOWEROFFACTIVE_REGKEY,
1956 SPI_SETPOWEROFFACTIVE_VALNAME,
1957 &poweroffactive, pvParam );
1960 case SPI_SETLOWPOWERACTIVE:
1961 ret = set_bool_param( SPI_SETLOWPOWERACTIVE_IDX,
1962 SPI_SETLOWPOWERACTIVE_REGKEY,
1963 SPI_SETLOWPOWERACTIVE_VALNAME,
1964 &lowpoweractive, uiParam, fWinIni );
1967 case SPI_SETPOWEROFFACTIVE:
1968 ret = set_bool_param( SPI_SETPOWEROFFACTIVE_IDX,
1969 SPI_SETPOWEROFFACTIVE_REGKEY,
1970 SPI_SETPOWEROFFACTIVE_VALNAME,
1971 &poweroffactive, uiParam, fWinIni );
1974 WINE_SPI_FIXME(SPI_SETCURSORS); /* 87 WINVER >= 0x400 */
1975 WINE_SPI_FIXME(SPI_SETICONS); /* 88 WINVER >= 0x400 */
1977 case SPI_GETDEFAULTINPUTLANG: /* 89 WINVER >= 0x400 */
1978 ret = GetKeyboardLayout(0) ? TRUE : FALSE;
1981 WINE_SPI_FIXME(SPI_SETDEFAULTINPUTLANG); /* 90 WINVER >= 0x400 */
1983 WINE_SPI_FIXME(SPI_SETLANGTOGGLE); /* 91 WINVER >= 0x400 */
1985 case SPI_GETWINDOWSEXTENSION: /* 92 WINVER >= 0x400 */
1986 WARN("pretend no support for Win9x Plus! for now.\n");
1987 ret = FALSE; /* yes, this is the result value */
1990 WINE_SPI_FIXME(SPI_SETMOUSETRAILS); /* 93 WINVER >= 0x400 */
1991 WINE_SPI_FIXME(SPI_GETMOUSETRAILS); /* 94 WINVER >= 0x400 */
1992 WINE_SPI_FIXME(SPI_GETSNAPTODEFBUTTON); /* 95 WINVER >= 0x400 */
1993 WINE_SPI_FIXME(SPI_SETSNAPTODEFBUTTON); /* 96 WINVER >= 0x400 */
1995 case SPI_SETSCREENSAVERRUNNING:
1996 ret = set_bool_param( SPI_SETSCREENSAVERRUNNING_IDX,
1997 SPI_SETSCREENSAVERRUNNING_REGKEY,
1998 SPI_SETSCREENSAVERRUNNING_VALNAME,
1999 &screensaver_running, uiParam, fWinIni );
2002 case SPI_GETMOUSEHOVERWIDTH:
2003 ret = get_uint_param( SPI_SETMOUSEHOVERWIDTH_IDX,
2004 SPI_SETMOUSEHOVERWIDTH_REGKEY,
2005 SPI_SETMOUSEHOVERWIDTH_VALNAME,
2006 &mouse_hover_width, pvParam );
2009 case SPI_SETMOUSEHOVERWIDTH:
2010 ret = set_uint_param( SPI_SETMOUSEHOVERWIDTH_IDX,
2011 SPI_SETMOUSEHOVERWIDTH_REGKEY,
2012 SPI_SETMOUSEHOVERWIDTH_VALNAME,
2013 &mouse_hover_width, uiParam, fWinIni );
2016 case SPI_GETMOUSEHOVERHEIGHT:
2017 ret = get_uint_param( SPI_SETMOUSEHOVERHEIGHT_IDX,
2018 SPI_SETMOUSEHOVERHEIGHT_REGKEY,
2019 SPI_SETMOUSEHOVERHEIGHT_VALNAME,
2020 &mouse_hover_height, pvParam );
2023 case SPI_SETMOUSEHOVERHEIGHT:
2024 ret = set_uint_param( SPI_SETMOUSEHOVERHEIGHT_IDX,
2025 SPI_SETMOUSEHOVERHEIGHT_REGKEY,
2026 SPI_SETMOUSEHOVERHEIGHT_VALNAME,
2027 &mouse_hover_height, uiParam, fWinIni );
2030 case SPI_GETMOUSEHOVERTIME:
2031 ret = get_uint_param( SPI_SETMOUSEHOVERTIME_IDX,
2032 SPI_SETMOUSEHOVERTIME_REGKEY,
2033 SPI_SETMOUSEHOVERTIME_VALNAME,
2034 &mouse_hover_time, pvParam );
2037 case SPI_SETMOUSEHOVERTIME:
2038 ret = set_uint_param( SPI_SETMOUSEHOVERTIME_IDX,
2039 SPI_SETMOUSEHOVERTIME_REGKEY,
2040 SPI_SETMOUSEHOVERTIME_VALNAME,
2041 &mouse_hover_time, uiParam, fWinIni );
2044 case SPI_GETWHEELSCROLLLINES:
2045 ret = get_uint_param( SPI_SETMOUSESCROLLLINES_IDX,
2046 SPI_SETMOUSESCROLLLINES_REGKEY,
2047 SPI_SETMOUSESCROLLLINES_VALNAME,
2048 &mouse_scroll_lines, pvParam );
2051 case SPI_SETWHEELSCROLLLINES:
2052 ret = set_uint_param( SPI_SETMOUSESCROLLLINES_IDX,
2053 SPI_SETMOUSESCROLLLINES_REGKEY,
2054 SPI_SETMOUSESCROLLLINES_VALNAME,
2055 &mouse_scroll_lines, uiParam, fWinIni );
2058 case SPI_GETMENUSHOWDELAY:
2059 ret = get_uint_param( SPI_SETMENUSHOWDELAY_IDX,
2060 SPI_SETMENUSHOWDELAY_REGKEY,
2061 SPI_SETMENUSHOWDELAY_VALNAME,
2062 &menu_show_delay, pvParam );
2065 case SPI_SETMENUSHOWDELAY:
2066 ret = set_uint_param( SPI_SETMENUSHOWDELAY_IDX,
2067 SPI_SETMENUSHOWDELAY_REGKEY,
2068 SPI_SETMENUSHOWDELAY_VALNAME,
2069 &menu_show_delay, uiParam, fWinIni );
2072 WINE_SPI_FIXME(SPI_GETSHOWIMEUI); /* 110 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2073 WINE_SPI_FIXME(SPI_SETSHOWIMEUI); /* 111 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2074 WINE_SPI_FIXME(SPI_GETMOUSESPEED); /* 112 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2075 WINE_SPI_FIXME(SPI_SETMOUSESPEED); /* 113 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2077 case SPI_GETSCREENSAVERRUNNING:
2078 ret = get_bool_param( SPI_SETSCREENSAVERRUNNING_IDX,
2079 SPI_SETSCREENSAVERRUNNING_REGKEY,
2080 SPI_SETSCREENSAVERRUNNING_VALNAME,
2081 &screensaver_running, pvParam );
2084 case SPI_GETDESKWALLPAPER: /* 115 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2086 WCHAR buf[MAX_PATH];
2088 if (!pvParam) return FALSE;
2090 if (uiParam > MAX_PATH)
2095 if (SYSPARAMS_Load(SPI_SETDESKWALLPAPER_REGKEY, SPI_SETDESKWALLPAPER_VALNAME, buf, sizeof(buf)))
2097 lstrcpynW((WCHAR*)pvParam, buf, uiParam);
2101 /* Return an empty string */
2102 memset((WCHAR*)pvParam, 0, uiParam);
2108 WINE_SPI_FIXME(SPI_GETACTIVEWINDOWTRACKING);/* 0x1000 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2109 WINE_SPI_FIXME(SPI_SETACTIVEWINDOWTRACKING);/* 0x1001 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2110 case SPI_GETMENUANIMATION: /* 0x1002 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2111 ret = get_user_pref_param( 0, 0x02, pvParam );
2114 case SPI_SETMENUANIMATION: /* 0x1003 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2115 ret = set_user_pref_param( 0, 0x02, (BOOL)pvParam, fWinIni );
2118 case SPI_GETCOMBOBOXANIMATION: /* 0x1004 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2119 ret = get_user_pref_param( 0, 0x04, pvParam );
2122 case SPI_SETCOMBOBOXANIMATION: /* 0x1005 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2123 ret = set_user_pref_param( 0, 0x04, (BOOL)pvParam, fWinIni );
2126 case SPI_GETLISTBOXSMOOTHSCROLLING: /* 0x1006 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2127 ret = get_user_pref_param( 0, 0x08, pvParam );
2130 case SPI_SETLISTBOXSMOOTHSCROLLING: /* 0x1007 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2131 ret = set_user_pref_param( 0, 0x08, (BOOL)pvParam, fWinIni );
2134 case SPI_GETGRADIENTCAPTIONS:
2135 ret = get_user_pref_param( 0, 0x10, pvParam );
2138 case SPI_SETGRADIENTCAPTIONS:
2139 ret = set_user_pref_param( 0, 0x10, (BOOL)pvParam, fWinIni );
2142 case SPI_GETKEYBOARDCUES:
2143 ret = get_user_pref_param( 0, 0x20, pvParam );
2146 case SPI_SETKEYBOARDCUES:
2147 ret = set_user_pref_param( 0, 0x20, (BOOL)pvParam, fWinIni );
2150 WINE_SPI_FIXME(SPI_GETACTIVEWNDTRKZORDER); /* 0x100C _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2151 WINE_SPI_FIXME(SPI_SETACTIVEWNDTRKZORDER); /* 0x100D _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2152 case SPI_GETHOTTRACKING:
2153 ret = get_user_pref_param( 0, 0x80, pvParam );
2156 case SPI_SETHOTTRACKING:
2157 ret = set_user_pref_param( 0, 0x80, (BOOL)pvParam, fWinIni );
2160 WINE_SPI_FIXME(SPI_GETMENUFADE); /* 0x1012 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2161 WINE_SPI_FIXME(SPI_SETMENUFADE); /* 0x1013 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2162 case SPI_GETSELECTIONFADE: /* 0x1014 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2163 ret = get_user_pref_param( 1, 0x04, pvParam );
2166 case SPI_SETSELECTIONFADE: /* 0x1015 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2167 ret = set_user_pref_param( 1, 0x04, (BOOL)pvParam, fWinIni );
2170 case SPI_GETTOOLTIPANIMATION: /* 0x1016 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2171 ret = get_user_pref_param( 1, 0x08, pvParam );
2174 case SPI_SETTOOLTIPANIMATION: /* 0x1017 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2175 ret = set_user_pref_param( 1, 0x08, (BOOL)pvParam, fWinIni );
2178 case SPI_GETTOOLTIPFADE: /* 0x1018 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2179 ret = get_user_pref_param( 1, 0x10, pvParam );
2182 case SPI_SETTOOLTIPFADE: /* 0x1019 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2183 ret = set_user_pref_param( 1, 0x10, (BOOL)pvParam, fWinIni );
2186 case SPI_GETCURSORSHADOW: /* 0x101A _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2187 ret = get_user_pref_param( 1, 0x20, pvParam );
2190 case SPI_SETCURSORSHADOW: /* 0x101B _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2191 ret = set_user_pref_param( 1, 0x20, (BOOL)pvParam, fWinIni );
2194 WINE_SPI_FIXME(SPI_GETMOUSESONAR); /* 0x101C _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2195 WINE_SPI_FIXME(SPI_SETMOUSESONAR); /* 0x101D _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2196 WINE_SPI_FIXME(SPI_GETMOUSECLICKLOCK); /* 0x101E _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2197 WINE_SPI_FIXME(SPI_SETMOUSECLICKLOCK); /* 0x101F _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2198 WINE_SPI_FIXME(SPI_GETMOUSEVANISH); /* 0x1020 _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2199 WINE_SPI_FIXME(SPI_SETMOUSEVANISH); /* 0x1021 _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2200 case SPI_GETFLATMENU:
2201 ret = get_user_pref_param( 2, 0x02, pvParam );
2204 case SPI_SETFLATMENU:
2205 ret = set_user_pref_param( 2, 0x02, (BOOL)pvParam, fWinIni );
2208 WINE_SPI_FIXME(SPI_GETDROPSHADOW); /* 0x1024 _WIN32_WINNT >= 0x510 */
2209 WINE_SPI_FIXME(SPI_SETDROPSHADOW); /* 0x1025 _WIN32_WINNT >= 0x510 */
2210 WINE_SPI_FIXME(SPI_GETBLOCKSENDINPUTRESETS);
2211 WINE_SPI_FIXME(SPI_SETBLOCKSENDINPUTRESETS);
2212 case SPI_GETUIEFFECTS:
2213 ret = get_user_pref_param( 3, 0x80, pvParam );
2216 case SPI_SETUIEFFECTS:
2217 /* FIXME: this probably should mask other UI effect values when unset */
2218 ret = set_user_pref_param( 3, 0x80, (BOOL)pvParam, fWinIni );
2221 WINE_SPI_FIXME(SPI_GETFOREGROUNDLOCKTIMEOUT);/* 0x2000 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2222 WINE_SPI_FIXME(SPI_SETFOREGROUNDLOCKTIMEOUT);/* 0x2001 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2223 WINE_SPI_FIXME(SPI_GETACTIVEWNDTRKTIMEOUT); /* 0x2002 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2224 WINE_SPI_FIXME(SPI_SETACTIVEWNDTRKTIMEOUT); /* 0x2003 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2225 WINE_SPI_FIXME(SPI_GETFOREGROUNDFLASHCOUNT);/* 0x2004 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2226 WINE_SPI_FIXME(SPI_SETFOREGROUNDFLASHCOUNT);/* 0x2005 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2227 case SPI_GETCARETWIDTH: /* 0x2006 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2228 ret = get_uint_param( SPI_CARETWIDTH_IDX,
2229 SPI_CARETWIDTH_REGKEY,
2230 SPI_CARETWIDTH_VALNAME,
2231 &caret_width, pvParam );
2234 case SPI_SETCARETWIDTH: /* 0x2007 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2235 ret = set_uint_param( SPI_CARETWIDTH_IDX,
2236 SPI_CARETWIDTH_REGKEY,
2237 SPI_CARETWIDTH_VALNAME,
2238 &caret_width, uiParam, fWinIni );
2241 WINE_SPI_FIXME(SPI_GETMOUSECLICKLOCKTIME); /* 0x2008 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2242 WINE_SPI_FIXME(SPI_SETMOUSECLICKLOCKTIME); /* 0x2009 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2243 WINE_SPI_FIXME(SPI_GETFONTSMOOTHINGTYPE); /* 0x200A _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2244 WINE_SPI_FIXME(SPI_SETFONTSMOOTHINGTYPE); /* 0x200B _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2245 WINE_SPI_FIXME(SPI_GETFONTSMOOTHINGCONTRAST);/* 0x200C _WIN32_WINNT >= 0x510 */
2246 WINE_SPI_FIXME(SPI_SETFONTSMOOTHINGCONTRAST);/* 0x200D _WIN32_WINNT >= 0x510 */
2247 WINE_SPI_FIXME(SPI_GETFOCUSBORDERWIDTH); /* 0x200E _WIN32_WINNT >= 0x510 */
2248 WINE_SPI_FIXME(SPI_SETFOCUSBORDERWIDTH); /* 0x200F _WIN32_WINNT >= 0x510 */
2249 WINE_SPI_FIXME(SPI_GETFOCUSBORDERHEIGHT); /* 0x2010 _WIN32_WINNT >= 0x510 */
2250 WINE_SPI_FIXME(SPI_SETFOCUSBORDERHEIGHT); /* 0x2011 _WIN32_WINNT >= 0x510 */
2253 FIXME( "Unknown action: %u\n", uiAction );
2254 SetLastError( ERROR_INVALID_SPI_VALUE );
2260 SYSPARAMS_NotifyChange( uiAction, fWinIni );
2261 TRACE("(%u, %u, %p, %u) ret %d\n",
2262 uiAction, uiParam, pvParam, fWinIni, ret);
2265 #undef WINE_SPI_FIXME
2266 #undef WINE_SPI_WARN
2270 /***********************************************************************
2271 * SystemParametersInfo (USER.483)
2273 BOOL16 WINAPI SystemParametersInfo16( UINT16 uAction, UINT16 uParam,
2274 LPVOID lpvParam, UINT16 fuWinIni )
2278 TRACE("(%u, %u, %p, %u)\n", uAction, uParam, lpvParam, fuWinIni);
2282 case SPI_GETBEEP: /* 1 */
2283 case SPI_GETSCREENSAVEACTIVE: /* 16 */
2284 case SPI_GETICONTITLEWRAP: /* 25 */
2285 case SPI_GETMENUDROPALIGNMENT: /* 27 */
2286 case SPI_GETFASTTASKSWITCH: /* 35 */
2287 case SPI_GETDRAGFULLWINDOWS: /* 38 WINVER >= 0x0400 */
2290 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2291 if (ret && lpvParam)
2292 *(BOOL16 *)lpvParam = tmp;
2296 case SPI_GETBORDER: /* 5 */
2297 case SPI_ICONHORIZONTALSPACING: /* 13 */
2298 case SPI_GETSCREENSAVETIMEOUT: /* 14 */
2299 case SPI_GETGRIDGRANULARITY: /* 18 */
2300 case SPI_GETKEYBOARDDELAY: /* 22 */
2301 case SPI_ICONVERTICALSPACING: /* 24 */
2304 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2305 if (ret && lpvParam)
2306 *(INT16 *)lpvParam = tmp;
2310 case SPI_GETKEYBOARDSPEED: /* 10 */
2313 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2314 if (ret && lpvParam)
2315 *(WORD *)lpvParam = tmp;
2319 case SPI_GETICONTITLELOGFONT: /* 31 */
2322 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2323 if (ret && lpvParam)
2324 SYSPARAMS_LogFont32ATo16( &tmp, (LPLOGFONT16)lpvParam );
2328 case SPI_GETNONCLIENTMETRICS: /* 41 WINVER >= 0x400 */
2330 NONCLIENTMETRICSA tmp;
2331 LPNONCLIENTMETRICS16 lpnm16 = (LPNONCLIENTMETRICS16)lpvParam;
2332 if (lpnm16 && lpnm16->cbSize == sizeof(NONCLIENTMETRICS16))
2334 tmp.cbSize = sizeof(NONCLIENTMETRICSA);
2335 ret = SystemParametersInfoA( uAction, uParam, &tmp, fuWinIni );
2337 SYSPARAMS_NonClientMetrics32ATo16( &tmp, lpnm16 );
2339 else /* winfile 95 sets cbSize to 340 */
2340 ret = SystemParametersInfoA( uAction, uParam, lpvParam, fuWinIni );
2344 case SPI_GETWORKAREA: /* 48 WINVER >= 0x400 */
2347 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2348 if (ret && lpvParam)
2350 RECT16 *r16 = (RECT16 *)lpvParam;
2351 r16->left = tmp.left;
2353 r16->right = tmp.right;
2354 r16->bottom = tmp.bottom;
2359 case SPI_GETMOUSEHOVERWIDTH: /* 98 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2360 case SPI_GETMOUSEHOVERHEIGHT: /* 100 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2361 case SPI_GETMOUSEHOVERTIME: /* 102 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2364 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2365 if (ret && lpvParam)
2366 *(UINT16 *)lpvParam = tmp;
2371 ret = SystemParametersInfoA( uAction, uParam, lpvParam, fuWinIni );
2377 /***********************************************************************
2378 * SystemParametersInfoA (USER32.@)
2380 BOOL WINAPI SystemParametersInfoA( UINT uiAction, UINT uiParam,
2381 PVOID pvParam, UINT fuWinIni )
2385 TRACE("(%u, %u, %p, %u)\n", uiAction, uiParam, pvParam, fuWinIni);
2389 case SPI_SETDESKWALLPAPER: /* 20 */
2390 case SPI_SETDESKPATTERN: /* 21 */
2394 if (!MultiByteToWideChar( CP_ACP, 0, (LPSTR)pvParam, -1,
2395 buffer, sizeof(buffer)/sizeof(WCHAR) ))
2396 buffer[sizeof(buffer)/sizeof(WCHAR)-1] = 0;
2397 ret = SystemParametersInfoW( uiAction, uiParam, pvParam ? buffer : NULL, fuWinIni );
2401 case SPI_GETICONTITLELOGFONT: /* 31 */
2404 ret = SystemParametersInfoW( uiAction, uiParam, pvParam ? &tmp : NULL, fuWinIni );
2406 SYSPARAMS_LogFont32WTo32A( &tmp, (LPLOGFONTA)pvParam );
2410 case SPI_GETNONCLIENTMETRICS: /* 41 WINVER >= 0x400 */
2412 NONCLIENTMETRICSW tmp;
2413 LPNONCLIENTMETRICSA lpnmA = (LPNONCLIENTMETRICSA)pvParam;
2414 if (lpnmA && lpnmA->cbSize == sizeof(NONCLIENTMETRICSA))
2416 tmp.cbSize = sizeof(NONCLIENTMETRICSW);
2417 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2419 SYSPARAMS_NonClientMetrics32WTo32A( &tmp, lpnmA );
2426 case SPI_SETNONCLIENTMETRICS: /* 42 WINVER >= 0x400 */
2428 NONCLIENTMETRICSW tmp;
2429 LPNONCLIENTMETRICSA lpnmA = (LPNONCLIENTMETRICSA)pvParam;
2430 if (lpnmA && lpnmA->cbSize == sizeof(NONCLIENTMETRICSA))
2432 tmp.cbSize = sizeof(NONCLIENTMETRICSW);
2433 SYSPARAMS_NonClientMetrics32ATo32W( lpnmA, &tmp );
2434 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2441 case SPI_GETICONMETRICS: /* 45 WINVER >= 0x400 */
2444 LPICONMETRICSA lpimA = (LPICONMETRICSA)pvParam;
2445 if (lpimA && lpimA->cbSize == sizeof(ICONMETRICSA))
2447 tmp.cbSize = sizeof(ICONMETRICSW);
2448 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2451 lpimA->iHorzSpacing = tmp.iHorzSpacing;
2452 lpimA->iVertSpacing = tmp.iVertSpacing;
2453 lpimA->iTitleWrap = tmp.iTitleWrap;
2454 SYSPARAMS_LogFont32WTo32A( &tmp.lfFont, &lpimA->lfFont );
2462 case SPI_SETICONMETRICS: /* 46 WINVER >= 0x400 */
2465 LPICONMETRICSA lpimA = (LPICONMETRICSA)pvParam;
2466 if (lpimA && lpimA->cbSize == sizeof(ICONMETRICSA))
2468 tmp.cbSize = sizeof(ICONMETRICSW);
2469 tmp.iHorzSpacing = lpimA->iHorzSpacing;
2470 tmp.iVertSpacing = lpimA->iVertSpacing;
2471 tmp.iTitleWrap = lpimA->iTitleWrap;
2472 SYSPARAMS_LogFont32ATo32W( &lpimA->lfFont, &tmp.lfFont);
2473 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2480 case SPI_GETHIGHCONTRAST: /* 66 WINVER >= 0x400 */
2483 LPHIGHCONTRASTA lphcA = (LPHIGHCONTRASTA)pvParam;
2484 if (lphcA && lphcA->cbSize == sizeof(HIGHCONTRASTA))
2486 tmp.cbSize = sizeof(HIGHCONTRASTW);
2487 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2490 lphcA->dwFlags = tmp.dwFlags;
2491 lphcA->lpszDefaultScheme = NULL; /* FIXME? */
2499 case SPI_GETDESKWALLPAPER: /* 115 */
2501 WCHAR buffer[MAX_PATH];
2502 ret = (SystemParametersInfoW( SPI_GETDESKWALLPAPER, uiParam, buffer, fuWinIni ) &&
2503 WideCharToMultiByte(CP_ACP, 0, buffer, -1, pvParam, uiParam, NULL, NULL));
2508 ret = SystemParametersInfoW( uiAction, uiParam, pvParam, fuWinIni );
2515 /***********************************************************************
2516 * GetSystemMetrics (USER32.@)
2518 INT WINAPI GetSystemMetrics( INT index )
2522 /* some metrics are dynamic */
2526 return GetDeviceCaps( get_display_dc(), HORZRES );
2528 return GetDeviceCaps( get_display_dc(), VERTRES );
2530 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2531 return nonclient_metrics.iScrollWidth;
2533 return GetSystemMetrics(SM_CXVSCROLL);
2535 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2536 return nonclient_metrics.iCaptionHeight + 1;
2539 /* SM_C{X,Y}BORDER always returns 1 regardless of 'BorderWidth' value in registry */
2545 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2546 return nonclient_metrics.iScrollHeight;
2548 return GetSystemMetrics(SM_CYVTHUMB);
2550 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2551 return icon_size.cx;
2553 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2554 return icon_size.cy;
2559 return GetSystemMetrics(SM_CYMENUSIZE) + 1;
2560 case SM_CXFULLSCREEN:
2561 /* see the remark for SM_CXMAXIMIZED, at least this formulation is
2563 return GetSystemMetrics( SM_CXMAXIMIZED) - 2 * GetSystemMetrics( SM_CXFRAME);
2564 case SM_CYFULLSCREEN:
2565 /* see the remark for SM_CYMAXIMIZED, at least this formulation is
2567 return GetSystemMetrics( SM_CYMAXIMIZED) - GetSystemMetrics( SM_CYMIN);
2568 case SM_CYKANJIWINDOW:
2570 case SM_MOUSEPRESENT:
2573 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2574 return nonclient_metrics.iScrollHeight;
2576 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2577 return nonclient_metrics.iScrollHeight;
2581 get_bool_param( SPI_SETMOUSEBUTTONSWAP_IDX, SPI_SETMOUSEBUTTONSWAP_REGKEY,
2582 SPI_SETMOUSEBUTTONSWAP_VALNAME, &swap_buttons, (BOOL*)&ret );
2590 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2591 return 3 * nonclient_metrics.iCaptionWidth + GetSystemMetrics( SM_CYSIZE) +
2592 4 * CaptionFontAvCharWidth + 2 * GetSystemMetrics( SM_CXFRAME) + 4;
2594 return GetSystemMetrics( SM_CYCAPTION) + 2 * GetSystemMetrics( SM_CYFRAME);
2596 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2597 return nonclient_metrics.iCaptionWidth;
2599 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2600 return nonclient_metrics.iCaptionHeight;
2602 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2603 return GetSystemMetrics(SM_CXDLGFRAME) + nonclient_metrics.iBorderWidth;
2605 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2606 return GetSystemMetrics(SM_CYDLGFRAME) + nonclient_metrics.iBorderWidth;
2608 return GetSystemMetrics(SM_CXMIN);
2610 return GetSystemMetrics(SM_CYMIN);
2611 case SM_CXDOUBLECLK:
2612 get_uint_param( SPI_SETDOUBLECLKWIDTH_IDX, SPI_SETDOUBLECLKWIDTH_REGKEY1,
2613 SPI_SETDOUBLECLKWIDTH_VALNAME, &double_click_width, &ret );
2615 case SM_CYDOUBLECLK:
2616 get_uint_param( SPI_SETDOUBLECLKHEIGHT_IDX, SPI_SETDOUBLECLKHEIGHT_REGKEY1,
2617 SPI_SETDOUBLECLKHEIGHT_VALNAME, &double_click_height, &ret );
2619 case SM_CXICONSPACING:
2620 SystemParametersInfoW( SPI_ICONHORIZONTALSPACING, 0, &ret, 0 );
2622 case SM_CYICONSPACING:
2623 SystemParametersInfoW( SPI_ICONVERTICALSPACING, 0, &ret, 0 );
2625 case SM_MENUDROPALIGNMENT:
2626 SystemParametersInfoW( SPI_GETMENUDROPALIGNMENT, 0, &ret, 0 );
2630 case SM_DBCSENABLED:
2633 GetCPInfo( CP_ACP, &cpinfo );
2634 return (cpinfo.MaxCharSize > 1);
2636 case SM_CMOUSEBUTTONS:
2641 return GetSystemMetrics(SM_CXBORDER) + 1;
2643 return GetSystemMetrics(SM_CYBORDER) + 1;
2644 case SM_CXMINSPACING:
2645 if( spi_loaded[SPI_MINIMIZEDMETRICS_IDX]) load_minimized_metrics();
2646 return GetSystemMetrics(SM_CXMINIMIZED) + minimized_metrics.iHorzGap;
2647 case SM_CYMINSPACING:
2648 if( spi_loaded[SPI_MINIMIZEDMETRICS_IDX]) load_minimized_metrics();
2649 return GetSystemMetrics(SM_CYMINIMIZED) + minimized_metrics.iVertGap;
2653 case SM_CYSMCAPTION:
2654 return GetSystemMetrics(SM_CYSMSIZE) + 1;
2656 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2657 return nonclient_metrics.iSmCaptionWidth;
2659 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2660 return nonclient_metrics.iSmCaptionHeight;
2662 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2663 return nonclient_metrics.iMenuWidth;
2665 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2666 return nonclient_metrics.iMenuHeight;
2668 if( spi_loaded[SPI_MINIMIZEDMETRICS_IDX]) load_minimized_metrics();
2669 return minimized_metrics.iArrange;
2670 case SM_CXMINIMIZED:
2671 if( spi_loaded[SPI_MINIMIZEDMETRICS_IDX]) load_minimized_metrics();
2672 return minimized_metrics.iWidth + 6;
2673 case SM_CYMINIMIZED:
2674 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2675 return nonclient_metrics.iCaptionHeight + 6;
2677 return GetSystemMetrics(SM_CXSCREEN) + 4 + 2 * GetSystemMetrics(SM_CXFRAME);
2679 return GetSystemMetrics(SM_CYSCREEN) + 4 + 2 * GetSystemMetrics(SM_CYFRAME);
2680 case SM_CXMAXIMIZED:
2681 /* FIXME: subtract the width of any vertical application toolbars*/
2682 return GetSystemMetrics(SM_CXSCREEN) + 2 * GetSystemMetrics(SM_CXFRAME);
2683 case SM_CYMAXIMIZED:
2684 /* FIXME: subtract the width of any horizontal application toolbars*/
2685 return GetSystemMetrics(SM_CYSCREEN) + 2 * GetSystemMetrics(SM_CYCAPTION);
2687 return 3; /* FIXME */
2689 return 0; /* 0 = ok, 1 = failsafe, 2 = failsafe + network */
2694 SystemParametersInfoW( SPI_GETSHOWSOUNDS, 0, &ret, 0 );
2696 case SM_CXMENUCHECK:
2697 case SM_CYMENUCHECK:
2698 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2699 return tmMenuFont.tmHeight <= 0 ? 13 :
2700 ((tmMenuFont.tmHeight + tmMenuFont.tmExternalLeading + 1) / 2) * 2 - 1;
2701 case SM_SLOWMACHINE:
2702 return 0; /* FIXME: Should check the type of processor */
2703 case SM_MIDEASTENABLED:
2704 return 0; /* FIXME */
2705 case SM_MOUSEWHEELPRESENT:
2707 case SM_XVIRTUALSCREEN:
2708 case SM_YVIRTUALSCREEN:
2710 case SM_CXVIRTUALSCREEN:
2711 return GetSystemMetrics(SM_CXSCREEN);
2712 case SM_CYVIRTUALSCREEN:
2713 return GetSystemMetrics(SM_CYSCREEN);
2716 case SM_SAMEDISPLAYFORMAT:
2719 return 0; /* FIXME */
2720 case SM_CXFOCUSBORDER:
2721 case SM_CYFOCUSBORDER:
2724 case SM_MEDIACENTER:
2734 /***********************************************************************
2735 * SwapMouseButton (USER32.@)
2736 * Reverse or restore the meaning of the left and right mouse buttons
2737 * fSwap [I ] TRUE - reverse, FALSE - original
2741 BOOL WINAPI SwapMouseButton( BOOL fSwap )
2743 BOOL prev = GetSystemMetrics(SM_SWAPBUTTON);
2744 SystemParametersInfoW(SPI_SETMOUSEBUTTONSWAP, fSwap, 0, 0);
2749 /**********************************************************************
2750 * SetDoubleClickTime (USER32.@)
2752 BOOL WINAPI SetDoubleClickTime( UINT interval )
2754 return SystemParametersInfoW(SPI_SETDOUBLECLICKTIME, interval, 0, 0);
2758 /**********************************************************************
2759 * GetDoubleClickTime (USER32.@)
2761 UINT WINAPI GetDoubleClickTime(void)
2765 get_uint_param( SPI_SETDOUBLECLICKTIME_IDX,
2766 SPI_SETDOUBLECLICKTIME_REGKEY,
2767 SPI_SETDOUBLECLICKTIME_VALNAME,
2768 &double_click_time, &time );
2769 if (!time) time = 500;
2774 /*************************************************************************
2775 * GetSysColor (USER32.@)
2777 COLORREF WINAPI GetSysColor( INT nIndex )
2779 if (nIndex >= 0 && nIndex < NUM_SYS_COLORS)
2780 return SysColors[nIndex];
2786 /*************************************************************************
2787 * SetSysColors (USER32.@)
2789 BOOL WINAPI SetSysColors( INT nChanges, const INT *lpSysColor,
2790 const COLORREF *lpColorValues )
2794 for (i = 0; i < nChanges; i++) SYSPARAMS_SetSysColor( lpSysColor[i], lpColorValues[i] );
2796 /* Send WM_SYSCOLORCHANGE message to all windows */
2798 SendMessageTimeoutW( HWND_BROADCAST, WM_SYSCOLORCHANGE, 0, 0, SMTO_ABORTIFHUNG, 2000, NULL );
2800 /* Repaint affected portions of all visible windows */
2802 RedrawWindow( GetDesktopWindow(), NULL, 0,
2803 RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN );
2808 /*************************************************************************
2809 * SetSysColorsTemp (USER32.@)
2813 * Called by W98SE desk.cpl Control Panel Applet:
2814 * handle = SetSysColorsTemp(ptr, ptr, nCount); ("set" call)
2815 * result = SetSysColorsTemp(NULL, NULL, handle); ("restore" call)
2817 * pPens is an array of COLORREF values, which seems to be used
2818 * to indicate the color values to create new pens with.
2820 * pBrushes is an array of solid brush handles (returned by a previous
2821 * CreateSolidBrush), which seems to contain the brush handles to set
2822 * for the system colors.
2824 * n seems to be used for
2825 * a) indicating the number of entries to operate on (length of pPens,
2827 * b) passing the handle that points to the previously used color settings.
2828 * I couldn't figure out in hell what kind of handle this is on
2829 * Windows. I just use a heap handle instead. Shouldn't matter anyway.
2832 * heap handle of our own copy of the current syscolors in case of
2833 * "set" call, i.e. pPens, pBrushes != NULL.
2834 * TRUE (unconditionally !) in case of "restore" call,
2835 * i.e. pPens, pBrushes == NULL.
2836 * FALSE in case of either pPens != NULL and pBrushes == NULL
2837 * or pPens == NULL and pBrushes != NULL.
2839 * I'm not sure whether this implementation is 100% correct. [AM]
2841 DWORD WINAPI SetSysColorsTemp( const COLORREF *pPens, const HBRUSH *pBrushes, DWORD n)
2845 if (pPens && pBrushes) /* "set" call */
2847 /* allocate our structure to remember old colors */
2848 LPVOID pOldCol = HeapAlloc(GetProcessHeap(), 0, sizeof(DWORD)+n*sizeof(HPEN)+n*sizeof(HBRUSH));
2850 *(DWORD *)p = n; p = (char*)p + sizeof(DWORD);
2851 memcpy(p, SysColorPens, n*sizeof(HPEN)); p = (char*)p + n*sizeof(HPEN);
2852 memcpy(p, SysColorBrushes, n*sizeof(HBRUSH)); p = (char*)p + n*sizeof(HBRUSH);
2854 for (i=0; i < n; i++)
2856 SysColorPens[i] = CreatePen( PS_SOLID, 1, pPens[i] );
2857 SysColorBrushes[i] = pBrushes[i];
2860 return (DWORD)pOldCol;
2862 if (!pPens && !pBrushes) /* "restore" call */
2864 LPVOID pOldCol = (LPVOID)n;
2866 DWORD nCount = *(DWORD *)p;
2867 p = (char*)p + sizeof(DWORD);
2869 for (i=0; i < nCount; i++)
2871 DeleteObject(SysColorPens[i]);
2872 SysColorPens[i] = *(HPEN *)p; p = (char*)p + sizeof(HPEN);
2874 for (i=0; i < nCount; i++)
2876 SysColorBrushes[i] = *(HBRUSH *)p; p = (char*)p + sizeof(HBRUSH);
2878 /* get rid of storage structure */
2879 HeapFree(GetProcessHeap(), 0, pOldCol);
2887 /***********************************************************************
2888 * GetSysColorBrush (USER32.@)
2890 HBRUSH WINAPI GetSysColorBrush( INT index )
2892 if (0 <= index && index < NUM_SYS_COLORS) return SysColorBrushes[index];
2893 WARN("Unknown index(%d)\n", index );
2894 return GetStockObject(LTGRAY_BRUSH);
2898 /***********************************************************************
2901 HPEN SYSCOLOR_GetPen( INT index )
2903 /* We can assert here, because this function is internal to Wine */
2904 assert (0 <= index && index < NUM_SYS_COLORS);
2905 return SysColorPens[index];
2909 /***********************************************************************
2910 * ChangeDisplaySettingsA (USER32.@)
2912 LONG WINAPI ChangeDisplaySettingsA( LPDEVMODEA devmode, DWORD flags )
2914 return ChangeDisplaySettingsExA(NULL,devmode,NULL,flags,NULL);
2918 /***********************************************************************
2919 * ChangeDisplaySettingsW (USER32.@)
2921 LONG WINAPI ChangeDisplaySettingsW( LPDEVMODEW devmode, DWORD flags )
2923 return ChangeDisplaySettingsExW(NULL,devmode,NULL,flags,NULL);
2927 /***********************************************************************
2928 * ChangeDisplaySettingsExA (USER32.@)
2930 LONG WINAPI ChangeDisplaySettingsExA( LPCSTR devname, LPDEVMODEA devmode, HWND hwnd,
2931 DWORD flags, LPVOID lparam )
2935 UNICODE_STRING nameW;
2937 if (devname) RtlCreateUnicodeStringFromAsciiz(&nameW, devname);
2938 else nameW.Buffer = NULL;
2942 devmodeW.dmBitsPerPel = devmode->dmBitsPerPel;
2943 devmodeW.dmPelsHeight = devmode->dmPelsHeight;
2944 devmodeW.dmPelsWidth = devmode->dmPelsWidth;
2945 devmodeW.dmDisplayFlags = devmode->dmDisplayFlags;
2946 devmodeW.dmDisplayFrequency = devmode->dmDisplayFrequency;
2947 devmodeW.dmFields = devmode->dmFields;
2948 ret = ChangeDisplaySettingsExW(nameW.Buffer, &devmodeW, hwnd, flags, lparam);
2952 ret = ChangeDisplaySettingsExW(nameW.Buffer, NULL, hwnd, flags, lparam);
2955 if (devname) RtlFreeUnicodeString(&nameW);
2960 /***********************************************************************
2961 * ChangeDisplaySettingsExW (USER32.@)
2963 LONG WINAPI ChangeDisplaySettingsExW( LPCWSTR devname, LPDEVMODEW devmode, HWND hwnd,
2964 DWORD flags, LPVOID lparam )
2966 return USER_Driver->pChangeDisplaySettingsEx( devname, devmode, hwnd, flags, lparam );
2970 /***********************************************************************
2971 * EnumDisplaySettingsW (USER32.@)
2974 * TRUE if nth setting exists found (described in the LPDEVMODEW struct)
2975 * FALSE if we do not have the nth setting
2977 BOOL WINAPI EnumDisplaySettingsW( LPCWSTR name, DWORD n, LPDEVMODEW devmode )
2979 return EnumDisplaySettingsExW(name, n, devmode, 0);
2983 /***********************************************************************
2984 * EnumDisplaySettingsA (USER32.@)
2986 BOOL WINAPI EnumDisplaySettingsA(LPCSTR name,DWORD n,LPDEVMODEA devmode)
2988 return EnumDisplaySettingsExA(name, n, devmode, 0);
2992 /***********************************************************************
2993 * EnumDisplaySettingsExA (USER32.@)
2995 BOOL WINAPI EnumDisplaySettingsExA(LPCSTR lpszDeviceName, DWORD iModeNum,
2996 LPDEVMODEA lpDevMode, DWORD dwFlags)
3000 UNICODE_STRING nameW;
3002 if (lpszDeviceName) RtlCreateUnicodeStringFromAsciiz(&nameW, lpszDeviceName);
3003 else nameW.Buffer = NULL;
3005 ret = EnumDisplaySettingsExW(nameW.Buffer,iModeNum,&devmodeW,dwFlags);
3008 lpDevMode->dmBitsPerPel = devmodeW.dmBitsPerPel;
3009 lpDevMode->dmPelsHeight = devmodeW.dmPelsHeight;
3010 lpDevMode->dmPelsWidth = devmodeW.dmPelsWidth;
3011 lpDevMode->dmDisplayFlags = devmodeW.dmDisplayFlags;
3012 lpDevMode->dmDisplayFrequency = devmodeW.dmDisplayFrequency;
3013 lpDevMode->dmFields = devmodeW.dmFields;
3015 if (lpszDeviceName) RtlFreeUnicodeString(&nameW);
3020 /***********************************************************************
3021 * EnumDisplaySettingsExW (USER32.@)
3023 BOOL WINAPI EnumDisplaySettingsExW(LPCWSTR lpszDeviceName, DWORD iModeNum,
3024 LPDEVMODEW lpDevMode, DWORD dwFlags)
3026 return USER_Driver->pEnumDisplaySettingsEx(lpszDeviceName, iModeNum, lpDevMode, dwFlags);