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 %d\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 ncm.cbSize = sizeof (ncm);
1030 if (RegOpenKeyExW (HKEY_CURRENT_USER, METRICS_REGKEY,
1031 0, KEY_QUERY_VALUE, &hkey) != ERROR_SUCCESS) hkey = 0;
1033 /* initialize geometry entries */
1034 ncm.iBorderWidth = get_reg_metric(hkey, METRICS_BORDERWIDTH_VALNAME, 1);
1035 ncm.iScrollWidth = get_reg_metric(hkey, METRICS_SCROLLWIDTH_VALNAME, 16);
1036 ncm.iScrollHeight = get_reg_metric(hkey, METRICS_SCROLLHEIGHT_VALNAME, 16);
1038 /* size of the normal caption buttons */
1039 ncm.iCaptionHeight = get_reg_metric(hkey, METRICS_CAPTIONHEIGHT_VALNAME, 18);
1040 ncm.iCaptionWidth = get_reg_metric(hkey, METRICS_CAPTIONWIDTH_VALNAME, ncm.iCaptionHeight);
1042 /* caption font metrics */
1043 if (!reg_get_logfont(METRICS_REGKEY, METRICS_CAPTIONLOGFONT_VALNAME, &ncm.lfCaptionFont))
1045 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &ncm.lfCaptionFont, 0 );
1046 ncm.lfCaptionFont.lfWeight = FW_BOLD;
1049 /* size of the small caption buttons */
1050 ncm.iSmCaptionWidth = get_reg_metric(hkey, METRICS_SMCAPTIONWIDTH_VALNAME, 13);
1051 ncm.iSmCaptionHeight = get_reg_metric(hkey, METRICS_SMCAPTIONHEIGHT_VALNAME, 15);
1053 /* small caption font metrics */
1054 if (!reg_get_logfont(METRICS_REGKEY, METRICS_SMCAPTIONLOGFONT_VALNAME, &ncm.lfSmCaptionFont))
1055 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &ncm.lfSmCaptionFont, 0 );
1057 /* menus, FIXME: names of wine.conf entries are bogus */
1059 /* size of the menu (MDI) buttons */
1060 ncm.iMenuHeight = get_reg_metric(hkey, METRICS_MENUHEIGHT_VALNAME, 18);
1061 ncm.iMenuWidth = get_reg_metric(hkey, METRICS_MENUWIDTH_VALNAME, ncm.iMenuHeight);
1063 /* menu font metrics */
1064 if (!reg_get_logfont(METRICS_REGKEY, METRICS_MENULOGFONT_VALNAME, &ncm.lfMenuFont))
1066 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &ncm.lfMenuFont, 0 );
1067 GetProfileStringW( Desktop, MenuFont, ncm.lfCaptionFont.lfFaceName,
1068 ncm.lfMenuFont.lfFaceName, LF_FACESIZE );
1069 r = GetProfileIntW( Desktop, MenuFontSize, 0 );
1071 ncm.lfMenuFont.lfHeight = -r;
1072 ncm.lfMenuFont.lfWeight = FW_NORMAL;
1075 /* status bar font metrics */
1076 if (!reg_get_logfont(METRICS_REGKEY, METRICS_STATUSLOGFONT_VALNAME, &ncm.lfStatusFont))
1078 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &ncm.lfStatusFont, 0 );
1079 GetProfileStringW( Desktop, StatusFont, ncm.lfCaptionFont.lfFaceName,
1080 ncm.lfStatusFont.lfFaceName, LF_FACESIZE );
1081 r = GetProfileIntW( Desktop, StatusFontSize, 0 );
1083 ncm.lfStatusFont.lfHeight = -r;
1084 ncm.lfStatusFont.lfWeight = FW_NORMAL;
1087 /* message font metrics */
1088 if (!reg_get_logfont(METRICS_REGKEY, METRICS_MESSAGELOGFONT_VALNAME, &ncm.lfMessageFont))
1090 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &ncm.lfMessageFont, 0 );
1091 GetProfileStringW( Desktop, MessageFont, ncm.lfCaptionFont.lfFaceName,
1092 ncm.lfMessageFont.lfFaceName, LF_FACESIZE );
1093 r = GetProfileIntW( Desktop, MessageFontSize, 0 );
1095 ncm.lfMessageFont.lfHeight = -r;
1096 ncm.lfMessageFont.lfWeight = FW_NORMAL;
1099 /* some extra fields not in the nonclient structure */
1100 icon_size.cx = icon_size.cy = get_reg_metric( hkey, METRICS_ICONSIZE_VALNAME, 32 );
1102 if (hkey) RegCloseKey( hkey );
1103 normalize_nonclientmetrics( &ncm);
1104 memcpy( &nonclient_metrics, &ncm, sizeof(nonclient_metrics) );
1105 spi_loaded[SPI_NONCLIENTMETRICS_IDX] = TRUE;
1109 /***********************************************************************
1110 * SystemParametersInfoW (USER32.@)
1112 * Each system parameter has flag which shows whether the parameter
1113 * is loaded or not. Parameters, stored directly in SysParametersInfo are
1114 * loaded from registry only when they are requested and the flag is
1115 * "false", after the loading the flag is set to "true". On interprocess
1116 * notification of the parameter change the corresponding parameter flag is
1117 * set to "false". The parameter value will be reloaded when it is requested
1119 * Parameters, backed by or depend on GetSystemMetrics are processed
1120 * differently. These parameters are always loaded. They are reloaded right
1121 * away on interprocess change notification. We can't do lazy loading because
1122 * we don't want to complicate GetSystemMetrics.
1123 * Parameters, backed by X settings are read from corresponding setting.
1124 * On the parameter change request the setting is changed. Interprocess change
1125 * notifications are ignored.
1126 * When parameter value is updated the changed value is stored in permanent
1127 * registry branch if saving is requested. Otherwise it is stored
1128 * in temporary branch
1130 * Some SPI values can also be stored as Twips values in the registry,
1131 * don't forget the conversion!
1133 BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
1134 PVOID pvParam, UINT fWinIni )
1136 #define WINE_SPI_FIXME(x) \
1138 FIXME( "Unimplemented action: %u (%s)\n", x, #x ); \
1139 SetLastError( ERROR_INVALID_SPI_VALUE ); \
1142 #define WINE_SPI_WARN(x) \
1144 WARN( "Ignored action: %u (%s)\n", x, #x ); \
1148 unsigned spi_idx = 0;
1152 case SPI_GETBEEP: /* 1 */
1153 if (!pvParam) return FALSE;
1155 spi_idx = SPI_SETBEEP_IDX;
1156 if (!spi_loaded[spi_idx])
1160 if (SYSPARAMS_Load( SPI_SETBEEP_REGKEY, SPI_SETBEEP_VALNAME, buf, sizeof(buf) ))
1161 beep_active = !lstrcmpiW( Yes, buf );
1162 spi_loaded[spi_idx] = TRUE;
1165 *(BOOL *)pvParam = beep_active;
1168 case SPI_SETBEEP: /* 2 */
1169 spi_idx = SPI_SETBEEP_IDX;
1170 if (SYSPARAMS_Save( SPI_SETBEEP_REGKEY, SPI_SETBEEP_VALNAME,
1171 (uiParam ? Yes : No), fWinIni ))
1173 beep_active = uiParam;
1174 spi_loaded[spi_idx] = TRUE;
1180 case SPI_GETMOUSE: /* 3 */
1181 if (!pvParam) return FALSE;
1183 spi_idx = SPI_SETMOUSE_IDX;
1184 if (!spi_loaded[spi_idx])
1188 if (SYSPARAMS_Load( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME1,
1190 mouse_threshold1 = atoiW( buf );
1191 if (SYSPARAMS_Load( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME2,
1193 mouse_threshold2 = atoiW( buf );
1194 if (SYSPARAMS_Load( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME3,
1196 mouse_speed = atoiW( buf );
1197 spi_loaded[spi_idx] = TRUE;
1199 ((INT *)pvParam)[0] = mouse_threshold1;
1200 ((INT *)pvParam)[1] = mouse_threshold2;
1201 ((INT *)pvParam)[2] = mouse_speed;
1204 case SPI_SETMOUSE: /* 4 */
1206 if (!pvParam) return FALSE;
1207 ret = set_int_param( SPI_SETMOUSE_IDX, SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME1,
1208 &mouse_threshold1, ((INT *)pvParam)[0], fWinIni);
1210 save_int_param( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME2,
1211 &mouse_threshold2, ((INT *)pvParam)[1], fWinIni);
1212 save_int_param( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME3,
1213 &mouse_speed, ((INT *)pvParam)[2], fWinIni);
1219 ret = get_twips_param( SPI_SETBORDER_IDX,
1220 SPI_SETBORDER_REGKEY,
1221 SPI_SETBORDER_VALNAME,
1223 if( *(INT*)pvParam < 1) *(INT*)pvParam = 1;
1227 nonclient_metrics.iBorderWidth = uiParam > 0 ? uiParam : 1;
1228 /* raw value goes to registry */
1229 ret = set_uint_param( SPI_SETBORDER_IDX,
1230 SPI_SETBORDER_REGKEY,
1231 SPI_SETBORDER_VALNAME,
1232 &border, uiParam, fWinIni );
1235 case SPI_GETKEYBOARDSPEED:
1236 ret = get_uint_param( SPI_SETKEYBOARDSPEED_IDX,
1237 SPI_SETKEYBOARDSPEED_REGKEY,
1238 SPI_SETKEYBOARDSPEED_VALNAME,
1239 &keyboard_speed, pvParam );
1242 case SPI_SETKEYBOARDSPEED:
1243 if (uiParam > 31) uiParam = 31;
1244 ret = set_uint_param( SPI_SETKEYBOARDSPEED_IDX,
1245 SPI_SETKEYBOARDSPEED_REGKEY,
1246 SPI_SETKEYBOARDSPEED_VALNAME,
1247 &keyboard_speed, uiParam, fWinIni );
1250 /* not implemented in Windows */
1251 WINE_SPI_WARN(SPI_LANGDRIVER); /* 12 */
1253 case SPI_ICONHORIZONTALSPACING:
1254 if (pvParam != NULL)
1256 ret = get_twips_param( SPI_ICONHORIZONTALSPACING_IDX,
1257 SPI_ICONHORIZONTALSPACING_REGKEY,
1258 SPI_ICONHORIZONTALSPACING_VALNAME,
1259 (UINT*)&icon_metrics.iHorzSpacing, pvParam );
1263 if (uiParam < 32) uiParam = 32;
1264 ret = set_uint_param( SPI_ICONHORIZONTALSPACING_IDX,
1265 SPI_ICONHORIZONTALSPACING_REGKEY,
1266 SPI_ICONHORIZONTALSPACING_VALNAME,
1267 (UINT*)&icon_metrics.iHorzSpacing, uiParam, fWinIni );
1271 case SPI_GETSCREENSAVETIMEOUT:
1272 ret = get_uint_param( SPI_SETSCREENSAVETIMEOUT_IDX,
1273 SPI_SETSCREENSAVETIMEOUT_REGKEY,
1274 SPI_SETSCREENSAVETIMEOUT_VALNAME,
1275 &screensave_timeout, pvParam );
1278 case SPI_SETSCREENSAVETIMEOUT:
1279 ret = set_uint_param( SPI_SETSCREENSAVETIMEOUT_IDX,
1280 SPI_SETSCREENSAVETIMEOUT_REGKEY,
1281 SPI_SETSCREENSAVETIMEOUT_VALNAME,
1282 &screensave_timeout, uiParam, fWinIni );
1285 case SPI_GETSCREENSAVEACTIVE: /* 16 */
1286 if (!pvParam) return FALSE;
1287 *(BOOL *)pvParam = USER_Driver->pGetScreenSaveActive();
1290 case SPI_SETSCREENSAVEACTIVE: /* 17 */
1294 wsprintfW(buf, CSu, uiParam);
1295 USER_Driver->pSetScreenSaveActive( uiParam );
1296 /* saved value does not affect Wine */
1297 SYSPARAMS_Save( SPI_SETSCREENSAVEACTIVE_REGKEY,
1298 SPI_SETSCREENSAVEACTIVE_VALNAME,
1303 case SPI_GETGRIDGRANULARITY:
1304 ret = get_uint_param( SPI_SETGRIDGRANULARITY_IDX,
1305 SPI_SETGRIDGRANULARITY_REGKEY,
1306 SPI_SETGRIDGRANULARITY_VALNAME,
1307 &grid_granularity, pvParam );
1310 case SPI_SETGRIDGRANULARITY:
1311 ret = set_uint_param( SPI_SETGRIDGRANULARITY_IDX,
1312 SPI_SETGRIDGRANULARITY_REGKEY,
1313 SPI_SETGRIDGRANULARITY_VALNAME,
1314 &grid_granularity, uiParam, fWinIni );
1317 case SPI_SETDESKWALLPAPER: /* 20 */
1318 if (!pvParam || !SetDeskWallPaper( (LPSTR)pvParam )) return FALSE;
1319 SYSPARAMS_Save(SPI_SETDESKWALLPAPER_REGKEY, SPI_SETDESKWALLPAPER_VALNAME, pvParam, fWinIni);
1322 case SPI_SETDESKPATTERN: /* 21 */
1323 /* FIXME: the ability to specify a pattern in pvParam
1324 doesn't seem to be documented for Win32 */
1325 if ((INT16)uiParam == -1)
1328 GetProfileStringW( Desktop, Pattern,
1330 buf, sizeof(buf)/sizeof(WCHAR) );
1331 ret = DESKTOP_SetPattern( buf );
1333 ret = DESKTOP_SetPattern( (LPWSTR)pvParam );
1336 case SPI_GETKEYBOARDDELAY:
1337 ret = get_uint_param( SPI_SETKEYBOARDDELAY_IDX,
1338 SPI_SETKEYBOARDDELAY_REGKEY,
1339 SPI_SETKEYBOARDDELAY_VALNAME,
1340 &keyboard_delay, pvParam );
1343 case SPI_SETKEYBOARDDELAY:
1344 ret = set_uint_param( SPI_SETKEYBOARDDELAY_IDX,
1345 SPI_SETKEYBOARDDELAY_REGKEY,
1346 SPI_SETKEYBOARDDELAY_VALNAME,
1347 &keyboard_delay, uiParam, fWinIni );
1350 case SPI_ICONVERTICALSPACING:
1351 if (pvParam != NULL)
1353 ret = get_twips_param( SPI_ICONVERTICALSPACING_IDX,
1354 SPI_ICONVERTICALSPACING_REGKEY,
1355 SPI_ICONVERTICALSPACING_VALNAME,
1356 (UINT*)&icon_metrics.iVertSpacing, pvParam );
1357 if( icon_metrics.iVertSpacing < 32)
1358 icon_metrics.iVertSpacing = 32;
1362 if (uiParam < 32) uiParam = 32;
1363 ret = set_uint_param( SPI_ICONVERTICALSPACING_IDX,
1364 SPI_ICONVERTICALSPACING_REGKEY,
1365 SPI_ICONVERTICALSPACING_VALNAME,
1366 (UINT*)&icon_metrics.iVertSpacing, uiParam, fWinIni );
1370 case SPI_GETICONTITLEWRAP:
1371 ret = get_bool_param( SPI_SETICONTITLEWRAP_IDX,
1372 SPI_SETICONTITLEWRAP_REGKEY1,
1373 SPI_SETICONTITLEWRAP_VALNAME,
1374 &icon_metrics.iTitleWrap, pvParam );
1377 case SPI_SETICONTITLEWRAP:
1378 ret = set_bool_param_mirrored( SPI_SETICONTITLEWRAP_IDX,
1379 SPI_SETICONTITLEWRAP_REGKEY1,
1380 SPI_SETICONTITLEWRAP_REGKEY2,
1381 SPI_SETICONTITLEWRAP_VALNAME,
1382 &icon_metrics.iTitleWrap, uiParam, fWinIni );
1385 case SPI_GETMENUDROPALIGNMENT:
1386 ret = get_uint_param( SPI_SETMENUDROPALIGNMENT_IDX,
1387 SPI_SETMENUDROPALIGNMENT_REGKEY1,
1388 SPI_SETMENUDROPALIGNMENT_VALNAME,
1389 &menu_drop_alignment, pvParam );
1392 case SPI_SETMENUDROPALIGNMENT:
1393 ret = set_uint_param_mirrored( SPI_SETMENUDROPALIGNMENT_IDX,
1394 SPI_SETMENUDROPALIGNMENT_REGKEY1,
1395 SPI_SETMENUDROPALIGNMENT_REGKEY2,
1396 SPI_SETMENUDROPALIGNMENT_VALNAME,
1397 &menu_drop_alignment, uiParam, fWinIni );
1400 case SPI_SETDOUBLECLKWIDTH:
1401 ret = set_uint_param_mirrored( SPI_SETDOUBLECLKWIDTH_IDX,
1402 SPI_SETDOUBLECLKWIDTH_REGKEY1,
1403 SPI_SETDOUBLECLKWIDTH_REGKEY2,
1404 SPI_SETDOUBLECLKWIDTH_VALNAME,
1405 &double_click_width, uiParam, fWinIni );
1408 case SPI_SETDOUBLECLKHEIGHT:
1409 ret = set_uint_param_mirrored( SPI_SETDOUBLECLKHEIGHT_IDX,
1410 SPI_SETDOUBLECLKHEIGHT_REGKEY1,
1411 SPI_SETDOUBLECLKHEIGHT_REGKEY2,
1412 SPI_SETDOUBLECLKHEIGHT_VALNAME,
1413 &double_click_height, uiParam, fWinIni );
1416 case SPI_GETICONTITLELOGFONT:
1420 if (!pvParam) return FALSE;
1422 spi_idx = SPI_SETICONTITLELOGFONT_IDX;
1423 if (!spi_loaded[spi_idx])
1425 if (!reg_get_logfont( SPI_SETICONTITLELOGFONT_REGKEY,
1426 SPI_SETICONTITLELOGFONT_VALNAME, &icon_metrics.lfFont ))
1431 * The 'default GDI fonts' seems to be returned.
1432 * If a returned font is not a correct font in your environment,
1433 * please try to fix objects/gdiobj.c at first.
1435 GetObjectW( GetStockObject( DEFAULT_GUI_FONT ), sizeof(LOGFONTW), &lfDefault );
1437 GetProfileStringW( Desktop, IconTitleFaceName,
1438 lfDefault.lfFaceName,
1439 icon_metrics.lfFont.lfFaceName,
1442 r = GetProfileIntW( Desktop, IconTitleSize, 0 );
1444 icon_metrics.lfFont.lfHeight = -r;
1446 icon_metrics.lfFont.lfHeight = lfDefault.lfHeight;
1448 icon_metrics.lfFont.lfWidth = 0;
1449 icon_metrics.lfFont.lfEscapement = icon_metrics.lfFont.lfOrientation = 0;
1450 icon_metrics.lfFont.lfWeight = FW_NORMAL;
1451 icon_metrics.lfFont.lfItalic = FALSE;
1452 icon_metrics.lfFont.lfStrikeOut = FALSE;
1453 icon_metrics.lfFont.lfUnderline = FALSE;
1454 icon_metrics.lfFont.lfCharSet = lfDefault.lfCharSet; /* at least 'charset' should not be hard-coded */
1455 icon_metrics.lfFont.lfOutPrecision = OUT_DEFAULT_PRECIS;
1456 icon_metrics.lfFont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
1457 icon_metrics.lfFont.lfQuality = DEFAULT_QUALITY;
1458 icon_metrics.lfFont.lfPitchAndFamily = DEFAULT_PITCH;
1459 spi_loaded[spi_idx] = TRUE;
1462 *(LOGFONTW *)pvParam = icon_metrics.lfFont;
1466 case SPI_SETDOUBLECLICKTIME:
1467 ret = set_uint_param( SPI_SETDOUBLECLICKTIME_IDX,
1468 SPI_SETDOUBLECLICKTIME_REGKEY,
1469 SPI_SETDOUBLECLICKTIME_VALNAME,
1470 &double_click_time, uiParam, fWinIni );
1473 case SPI_SETMOUSEBUTTONSWAP:
1474 ret = set_bool_param( SPI_SETMOUSEBUTTONSWAP_IDX,
1475 SPI_SETMOUSEBUTTONSWAP_REGKEY,
1476 SPI_SETMOUSEBUTTONSWAP_VALNAME,
1477 &swap_buttons, uiParam, fWinIni );
1480 case SPI_SETICONTITLELOGFONT: /* 34 */
1481 if( uiParam == sizeof(LOGFONTW)) {
1482 ret = SYSPARAMS_SaveLogFont( SPI_SETICONTITLELOGFONT_REGKEY,
1483 SPI_SETICONTITLELOGFONT_VALNAME, (LOGFONTW *)pvParam, fWinIni);
1485 icon_metrics.lfFont = *(LOGFONTW *)pvParam;
1486 spi_loaded[SPI_SETICONTITLELOGFONT_IDX] = TRUE;
1492 case SPI_GETFASTTASKSWITCH: /* 35 */
1493 if (!pvParam) return FALSE;
1494 *(BOOL *)pvParam = 1;
1497 case SPI_SETFASTTASKSWITCH: /* 36 */
1498 /* the action is disabled */
1502 case SPI_SETDRAGFULLWINDOWS:
1503 ret = set_bool_param( SPI_SETDRAGFULLWINDOWS_IDX,
1504 SPI_SETDRAGFULLWINDOWS_REGKEY,
1505 SPI_SETDRAGFULLWINDOWS_VALNAME,
1506 &drag_full_windows, uiParam, fWinIni );
1509 case SPI_GETDRAGFULLWINDOWS:
1510 ret = get_bool_param( SPI_SETDRAGFULLWINDOWS_IDX,
1511 SPI_SETDRAGFULLWINDOWS_REGKEY,
1512 SPI_SETDRAGFULLWINDOWS_VALNAME,
1513 &drag_full_windows, pvParam );
1516 case SPI_GETNONCLIENTMETRICS:
1518 LPNONCLIENTMETRICSW lpnm = pvParam;
1520 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
1522 if (lpnm && lpnm->cbSize == sizeof(NONCLIENTMETRICSW))
1523 memcpy( lpnm, &nonclient_metrics, sizeof(*lpnm) );
1529 case SPI_SETNONCLIENTMETRICS:
1531 LPNONCLIENTMETRICSW lpnm = pvParam;
1533 if (lpnm && lpnm->cbSize == sizeof(NONCLIENTMETRICSW))
1535 NONCLIENTMETRICSW ncm;
1536 ret = set_uint_param( SPI_SETBORDER_IDX,
1537 SPI_SETBORDER_REGKEY, SPI_SETBORDER_VALNAME,
1538 &border, lpnm->iBorderWidth, fWinIni );
1539 if( ret) ret = save_int_param( METRICS_REGKEY,
1540 METRICS_SCROLLWIDTH_VALNAME, NULL,
1541 lpnm->iScrollWidth, fWinIni );
1542 if( ret) ret = save_int_param( METRICS_REGKEY,
1543 METRICS_SCROLLHEIGHT_VALNAME, NULL,
1544 lpnm->iScrollHeight, fWinIni );
1545 if( ret) ret = save_int_param( METRICS_REGKEY,
1546 METRICS_CAPTIONWIDTH_VALNAME, NULL,
1547 lpnm->iCaptionWidth, fWinIni );
1548 if( ret) ret = save_int_param( METRICS_REGKEY,
1549 METRICS_CAPTIONHEIGHT_VALNAME, NULL,
1550 lpnm->iCaptionHeight, fWinIni );
1551 if( ret) ret = save_int_param( METRICS_REGKEY,
1552 METRICS_SMCAPTIONWIDTH_VALNAME, NULL,
1553 lpnm->iSmCaptionWidth, fWinIni );
1554 if( ret) ret = save_int_param( METRICS_REGKEY,
1555 METRICS_SMCAPTIONHEIGHT_VALNAME, NULL,
1556 lpnm->iSmCaptionHeight, fWinIni );
1557 if( ret) ret = save_int_param( METRICS_REGKEY,
1558 METRICS_MENUWIDTH_VALNAME, NULL,
1559 lpnm->iMenuWidth, fWinIni );
1560 if( ret) ret = save_int_param( METRICS_REGKEY,
1561 METRICS_MENUHEIGHT_VALNAME, NULL,
1562 lpnm->iMenuHeight, fWinIni );
1563 if( ret) ret = SYSPARAMS_SaveLogFont(
1564 METRICS_REGKEY, METRICS_MENULOGFONT_VALNAME,
1565 &lpnm->lfMenuFont, fWinIni);
1566 if( ret) ret = SYSPARAMS_SaveLogFont(
1567 METRICS_REGKEY, METRICS_CAPTIONLOGFONT_VALNAME,
1568 &lpnm->lfCaptionFont, fWinIni);
1569 if( ret) ret = SYSPARAMS_SaveLogFont(
1570 METRICS_REGKEY, METRICS_SMCAPTIONLOGFONT_VALNAME,
1571 &lpnm->lfSmCaptionFont, fWinIni);
1572 if( ret) ret = SYSPARAMS_SaveLogFont(
1573 METRICS_REGKEY, METRICS_STATUSLOGFONT_VALNAME,
1574 &lpnm->lfStatusFont, fWinIni);
1575 if( ret) ret = SYSPARAMS_SaveLogFont(
1576 METRICS_REGKEY, METRICS_MESSAGELOGFONT_VALNAME,
1577 &lpnm->lfMessageFont, fWinIni);
1579 memcpy( &ncm, lpnm, sizeof(nonclient_metrics) );
1580 normalize_nonclientmetrics( &ncm);
1581 memcpy( &nonclient_metrics, &ncm, sizeof(nonclient_metrics) );
1582 spi_loaded[SPI_NONCLIENTMETRICS_IDX] = TRUE;
1588 case SPI_GETMINIMIZEDMETRICS:
1590 MINIMIZEDMETRICS * lpMm = pvParam;
1591 if (lpMm && lpMm->cbSize == sizeof(*lpMm)) {
1592 if( spi_loaded[SPI_MINIMIZEDMETRICS_IDX]) load_minimized_metrics();
1593 memcpy( lpMm, &minimized_metrics, sizeof(*lpMm) );
1599 case SPI_SETMINIMIZEDMETRICS:
1601 MINIMIZEDMETRICS * lpMm = pvParam;
1602 if (lpMm && lpMm->cbSize == sizeof(*lpMm)) {
1603 ret = save_int_param( METRICS_REGKEY, METRICS_MINWIDTH_VALNAME,
1604 &minimized_metrics.iWidth, max( lpMm->iWidth, 0), fWinIni);
1605 if( ret) ret = save_int_param( METRICS_REGKEY,
1606 METRICS_MINHORZGAP_VALNAME, &minimized_metrics.iHorzGap,
1607 max( lpMm->iHorzGap, 0), fWinIni);
1608 if( ret) ret = save_int_param( METRICS_REGKEY,
1609 METRICS_MINVERTGAP_VALNAME, &minimized_metrics.iVertGap,
1610 max( lpMm->iVertGap, 0), fWinIni);
1611 if( ret) ret = save_int_param( METRICS_REGKEY,
1612 METRICS_MINARRANGE_VALNAME, &minimized_metrics.iArrange,
1613 0x0f & lpMm->iArrange, fWinIni);
1614 if( ret) spi_loaded[SPI_MINIMIZEDMETRICS_IDX] = TRUE;
1620 case SPI_GETICONMETRICS:
1622 LPICONMETRICSW lpIcon = pvParam;
1623 if(lpIcon && lpIcon->cbSize == sizeof(*lpIcon))
1625 SystemParametersInfoW( SPI_ICONHORIZONTALSPACING, 0,
1626 &lpIcon->iHorzSpacing, FALSE );
1627 SystemParametersInfoW( SPI_ICONVERTICALSPACING, 0,
1628 &lpIcon->iVertSpacing, FALSE );
1629 SystemParametersInfoW( SPI_GETICONTITLEWRAP, 0,
1630 &lpIcon->iTitleWrap, FALSE );
1631 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0,
1632 &lpIcon->lfFont, FALSE );
1641 case SPI_SETICONMETRICS:
1643 LPICONMETRICSW lpIcon = pvParam;
1644 if (lpIcon && lpIcon->cbSize == sizeof(*lpIcon)) {
1645 ret = set_int_param( SPI_ICONVERTICALSPACING_IDX,
1646 SPI_ICONVERTICALSPACING_REGKEY,
1647 SPI_ICONVERTICALSPACING_VALNAME,
1648 &icon_metrics.iVertSpacing,
1649 lpIcon->iVertSpacing, fWinIni);
1651 ret = set_int_param( SPI_ICONHORIZONTALSPACING_IDX,
1652 SPI_ICONHORIZONTALSPACING_REGKEY,
1653 SPI_ICONHORIZONTALSPACING_VALNAME,
1654 &icon_metrics.iHorzSpacing,
1655 lpIcon->iHorzSpacing, fWinIni );
1658 ret = set_bool_param_mirrored( SPI_SETICONTITLEWRAP_IDX,
1659 SPI_SETICONTITLEWRAP_REGKEY1, SPI_SETICONTITLEWRAP_REGKEY2,
1660 SPI_SETICONTITLEWRAP_VALNAME, &icon_metrics.iTitleWrap,
1661 lpIcon->iTitleWrap, fWinIni );
1663 if( ret) ret = SYSPARAMS_SaveLogFont( SPI_SETICONTITLELOGFONT_REGKEY,
1664 SPI_SETICONTITLELOGFONT_VALNAME, &lpIcon->lfFont, fWinIni);
1666 icon_metrics.lfFont = lpIcon->lfFont;
1667 spi_loaded[SPI_SETICONTITLELOGFONT_IDX] = TRUE;
1674 case SPI_SETWORKAREA: /* 47 WINVER >= 0x400 */
1676 if (!pvParam) return FALSE;
1678 spi_idx = SPI_SETWORKAREA_IDX;
1679 CopyRect( &work_area, (RECT *)pvParam );
1680 spi_loaded[spi_idx] = TRUE;
1684 case SPI_GETWORKAREA: /* 48 WINVER >= 0x400 */
1686 if (!pvParam) return FALSE;
1688 spi_idx = SPI_SETWORKAREA_IDX;
1689 if (!spi_loaded[spi_idx])
1691 SetRect( &work_area, 0, 0,
1692 GetSystemMetrics( SM_CXSCREEN ),
1693 GetSystemMetrics( SM_CYSCREEN ) );
1694 spi_loaded[spi_idx] = TRUE;
1696 CopyRect( (RECT *)pvParam, &work_area );
1701 WINE_SPI_FIXME(SPI_SETPENWINDOWS); /* 49 WINVER >= 0x400 */
1703 case SPI_GETFILTERKEYS: /* 50 */
1705 LPFILTERKEYS lpFilterKeys = (LPFILTERKEYS)pvParam;
1706 WARN("SPI_GETFILTERKEYS not fully implemented\n");
1707 if (lpFilterKeys && lpFilterKeys->cbSize == sizeof(FILTERKEYS))
1709 /* Indicate that no FilterKeys feature available */
1710 lpFilterKeys->dwFlags = 0;
1711 lpFilterKeys->iWaitMSec = 0;
1712 lpFilterKeys->iDelayMSec = 0;
1713 lpFilterKeys->iRepeatMSec = 0;
1714 lpFilterKeys->iBounceMSec = 0;
1722 WINE_SPI_FIXME(SPI_SETFILTERKEYS); /* 51 */
1724 case SPI_GETTOGGLEKEYS: /* 52 */
1726 LPTOGGLEKEYS lpToggleKeys = (LPTOGGLEKEYS)pvParam;
1727 WARN("SPI_GETTOGGLEKEYS not fully implemented\n");
1728 if (lpToggleKeys && lpToggleKeys->cbSize == sizeof(TOGGLEKEYS))
1730 /* Indicate that no ToggleKeys feature available */
1731 lpToggleKeys->dwFlags = 0;
1739 WINE_SPI_FIXME(SPI_SETTOGGLEKEYS); /* 53 */
1741 case SPI_GETMOUSEKEYS: /* 54 */
1743 LPMOUSEKEYS lpMouseKeys = (LPMOUSEKEYS)pvParam;
1744 WARN("SPI_GETMOUSEKEYS not fully implemented\n");
1745 if (lpMouseKeys && lpMouseKeys->cbSize == sizeof(MOUSEKEYS))
1747 /* Indicate that no MouseKeys feature available */
1748 lpMouseKeys->dwFlags = 0;
1749 lpMouseKeys->iMaxSpeed = 360;
1750 lpMouseKeys->iTimeToMaxSpeed = 1000;
1751 lpMouseKeys->iCtrlSpeed = 0;
1752 lpMouseKeys->dwReserved1 = 0;
1753 lpMouseKeys->dwReserved2 = 0;
1761 WINE_SPI_FIXME(SPI_SETMOUSEKEYS); /* 55 */
1763 case SPI_GETSHOWSOUNDS:
1764 ret = get_bool_param( SPI_SETSHOWSOUNDS_IDX,
1765 SPI_SETSHOWSOUNDS_REGKEY,
1766 SPI_SETSHOWSOUNDS_VALNAME,
1767 &show_sounds, pvParam );
1770 case SPI_SETSHOWSOUNDS:
1771 ret = set_bool_param( SPI_SETSHOWSOUNDS_IDX,
1772 SPI_SETSHOWSOUNDS_REGKEY,
1773 SPI_SETSHOWSOUNDS_VALNAME,
1774 &show_sounds, uiParam, fWinIni );
1777 case SPI_GETSTICKYKEYS: /* 58 */
1779 LPSTICKYKEYS lpStickyKeys = (LPSTICKYKEYS)pvParam;
1780 WARN("SPI_GETSTICKYKEYS not fully implemented\n");
1781 if (lpStickyKeys && lpStickyKeys->cbSize == sizeof(STICKYKEYS))
1783 /* Indicate that no StickyKeys feature available */
1784 lpStickyKeys->dwFlags = 0;
1792 WINE_SPI_FIXME(SPI_SETSTICKYKEYS); /* 59 */
1794 case SPI_GETACCESSTIMEOUT: /* 60 */
1796 LPACCESSTIMEOUT lpAccessTimeout = (LPACCESSTIMEOUT)pvParam;
1797 WARN("SPI_GETACCESSTIMEOUT not fully implemented\n");
1798 if (lpAccessTimeout && lpAccessTimeout->cbSize == sizeof(ACCESSTIMEOUT))
1800 /* Indicate that no accessibility features timeout is available */
1801 lpAccessTimeout->dwFlags = 0;
1802 lpAccessTimeout->iTimeOutMSec = 0;
1810 WINE_SPI_FIXME(SPI_SETACCESSTIMEOUT); /* 61 */
1812 case SPI_GETSERIALKEYS: /* 62 WINVER >= 0x400 */
1814 LPSERIALKEYSW lpSerialKeysW = (LPSERIALKEYSW)pvParam;
1815 WARN("SPI_GETSERIALKEYS not fully implemented\n");
1816 if (lpSerialKeysW && lpSerialKeysW->cbSize == sizeof(SERIALKEYSW))
1818 /* Indicate that no SerialKeys feature available */
1819 lpSerialKeysW->dwFlags = 0;
1820 lpSerialKeysW->lpszActivePort = NULL;
1821 lpSerialKeysW->lpszPort = NULL;
1822 lpSerialKeysW->iBaudRate = 0;
1823 lpSerialKeysW->iPortState = 0;
1831 WINE_SPI_FIXME(SPI_SETSERIALKEYS); /* 63 WINVER >= 0x400 */
1833 case SPI_GETSOUNDSENTRY: /* 64 */
1835 LPSOUNDSENTRYW lpSoundSentryW = (LPSOUNDSENTRYW)pvParam;
1836 WARN("SPI_GETSOUNDSENTRY not fully implemented\n");
1837 if (lpSoundSentryW && lpSoundSentryW->cbSize == sizeof(SOUNDSENTRYW))
1839 /* Indicate that no SoundSentry feature available */
1840 lpSoundSentryW->dwFlags = 0;
1841 lpSoundSentryW->iFSTextEffect = 0;
1842 lpSoundSentryW->iFSTextEffectMSec = 0;
1843 lpSoundSentryW->iFSTextEffectColorBits = 0;
1844 lpSoundSentryW->iFSGrafEffect = 0;
1845 lpSoundSentryW->iFSGrafEffectMSec = 0;
1846 lpSoundSentryW->iFSGrafEffectColor = 0;
1847 lpSoundSentryW->iWindowsEffect = 0;
1848 lpSoundSentryW->iWindowsEffectMSec = 0;
1849 lpSoundSentryW->lpszWindowsEffectDLL = 0;
1850 lpSoundSentryW->iWindowsEffectOrdinal = 0;
1858 WINE_SPI_FIXME(SPI_SETSOUNDSENTRY); /* 65 */
1860 case SPI_GETHIGHCONTRAST: /* 66 WINVER >= 0x400 */
1862 LPHIGHCONTRASTW lpHighContrastW = (LPHIGHCONTRASTW)pvParam;
1863 WARN("SPI_GETHIGHCONTRAST not fully implemented\n");
1864 if (lpHighContrastW && lpHighContrastW->cbSize == sizeof(HIGHCONTRASTW))
1866 /* Indicate that no high contrast feature available */
1867 lpHighContrastW->dwFlags = 0;
1868 lpHighContrastW->lpszDefaultScheme = NULL;
1876 WINE_SPI_FIXME(SPI_SETHIGHCONTRAST); /* 67 WINVER >= 0x400 */
1878 case SPI_GETKEYBOARDPREF:
1879 ret = get_bool_param( SPI_SETKEYBOARDPREF_IDX,
1880 SPI_SETKEYBOARDPREF_REGKEY,
1881 SPI_SETKEYBOARDPREF_VALNAME,
1882 &keyboard_pref, pvParam );
1885 case SPI_SETKEYBOARDPREF:
1886 ret = set_bool_param( SPI_SETKEYBOARDPREF_IDX,
1887 SPI_SETKEYBOARDPREF_REGKEY,
1888 SPI_SETKEYBOARDPREF_VALNAME,
1889 &keyboard_pref, uiParam, fWinIni );
1892 case SPI_GETSCREENREADER:
1893 ret = get_bool_param( SPI_SETSCREENREADER_IDX,
1894 SPI_SETSCREENREADER_REGKEY,
1895 SPI_SETSCREENREADER_VALNAME,
1896 &screen_reader, pvParam );
1899 case SPI_SETSCREENREADER:
1900 ret = set_bool_param( SPI_SETSCREENREADER_IDX,
1901 SPI_SETSCREENREADER_REGKEY,
1902 SPI_SETSCREENREADER_VALNAME,
1903 &screen_reader, uiParam, fWinIni );
1906 case SPI_GETANIMATION: /* 72 WINVER >= 0x400 */
1908 LPANIMATIONINFO lpAnimInfo = (LPANIMATIONINFO)pvParam;
1910 /* Tell it "disabled" */
1911 if (lpAnimInfo && lpAnimInfo->cbSize == sizeof(ANIMATIONINFO))
1912 lpAnimInfo->iMinAnimate = 0; /* Minimise and restore animation is disabled (nonzero == enabled) */
1917 WINE_SPI_WARN(SPI_SETANIMATION); /* 73 WINVER >= 0x400 */
1919 case SPI_GETFONTSMOOTHING:
1922 ret = get_uint_param( SPI_SETFONTSMOOTHING_IDX,
1923 SPI_SETFONTSMOOTHING_REGKEY,
1924 SPI_SETFONTSMOOTHING_VALNAME,
1925 &font_smoothing, &tmpval );
1926 *(UINT *) pvParam = ( tmpval != 0);
1929 case SPI_SETFONTSMOOTHING:
1930 uiParam = uiParam ? 2 : 0; /* Win NT4/2k/XP behavior */
1931 ret = set_uint_param( SPI_SETFONTSMOOTHING_IDX,
1932 SPI_SETFONTSMOOTHING_REGKEY,
1933 SPI_SETFONTSMOOTHING_VALNAME,
1934 &font_smoothing, uiParam, fWinIni );
1937 WINE_SPI_FIXME(SPI_SETDRAGWIDTH); /* 76 WINVER >= 0x400 */
1938 WINE_SPI_FIXME(SPI_SETDRAGHEIGHT); /* 77 WINVER >= 0x400 */
1940 WINE_SPI_FIXME(SPI_SETHANDHELD); /* 78 WINVER >= 0x400 */
1942 WINE_SPI_FIXME(SPI_GETLOWPOWERTIMEOUT); /* 79 WINVER >= 0x400 */
1943 WINE_SPI_FIXME(SPI_GETPOWEROFFTIMEOUT); /* 80 WINVER >= 0x400 */
1944 WINE_SPI_FIXME(SPI_SETLOWPOWERTIMEOUT); /* 81 WINVER >= 0x400 */
1945 WINE_SPI_FIXME(SPI_SETPOWEROFFTIMEOUT); /* 82 WINVER >= 0x400 */
1947 case SPI_GETLOWPOWERACTIVE:
1948 ret = get_bool_param( SPI_SETLOWPOWERACTIVE_IDX,
1949 SPI_SETLOWPOWERACTIVE_REGKEY,
1950 SPI_SETLOWPOWERACTIVE_VALNAME,
1951 &lowpoweractive, pvParam );
1954 case SPI_GETPOWEROFFACTIVE:
1955 ret = get_bool_param( SPI_SETPOWEROFFACTIVE_IDX,
1956 SPI_SETPOWEROFFACTIVE_REGKEY,
1957 SPI_SETPOWEROFFACTIVE_VALNAME,
1958 &poweroffactive, pvParam );
1961 case SPI_SETLOWPOWERACTIVE:
1962 ret = set_bool_param( SPI_SETLOWPOWERACTIVE_IDX,
1963 SPI_SETLOWPOWERACTIVE_REGKEY,
1964 SPI_SETLOWPOWERACTIVE_VALNAME,
1965 &lowpoweractive, uiParam, fWinIni );
1968 case SPI_SETPOWEROFFACTIVE:
1969 ret = set_bool_param( SPI_SETPOWEROFFACTIVE_IDX,
1970 SPI_SETPOWEROFFACTIVE_REGKEY,
1971 SPI_SETPOWEROFFACTIVE_VALNAME,
1972 &poweroffactive, uiParam, fWinIni );
1975 WINE_SPI_FIXME(SPI_SETCURSORS); /* 87 WINVER >= 0x400 */
1976 WINE_SPI_FIXME(SPI_SETICONS); /* 88 WINVER >= 0x400 */
1978 case SPI_GETDEFAULTINPUTLANG: /* 89 WINVER >= 0x400 */
1979 ret = GetKeyboardLayout(0) ? TRUE : FALSE;
1982 WINE_SPI_FIXME(SPI_SETDEFAULTINPUTLANG); /* 90 WINVER >= 0x400 */
1984 WINE_SPI_FIXME(SPI_SETLANGTOGGLE); /* 91 WINVER >= 0x400 */
1986 case SPI_GETWINDOWSEXTENSION: /* 92 WINVER >= 0x400 */
1987 WARN("pretend no support for Win9x Plus! for now.\n");
1988 ret = FALSE; /* yes, this is the result value */
1991 WINE_SPI_FIXME(SPI_SETMOUSETRAILS); /* 93 WINVER >= 0x400 */
1992 WINE_SPI_FIXME(SPI_GETMOUSETRAILS); /* 94 WINVER >= 0x400 */
1993 WINE_SPI_FIXME(SPI_GETSNAPTODEFBUTTON); /* 95 WINVER >= 0x400 */
1994 WINE_SPI_FIXME(SPI_SETSNAPTODEFBUTTON); /* 96 WINVER >= 0x400 */
1996 case SPI_SETSCREENSAVERRUNNING:
1997 ret = set_bool_param( SPI_SETSCREENSAVERRUNNING_IDX,
1998 SPI_SETSCREENSAVERRUNNING_REGKEY,
1999 SPI_SETSCREENSAVERRUNNING_VALNAME,
2000 &screensaver_running, uiParam, fWinIni );
2003 case SPI_GETMOUSEHOVERWIDTH:
2004 ret = get_uint_param( SPI_SETMOUSEHOVERWIDTH_IDX,
2005 SPI_SETMOUSEHOVERWIDTH_REGKEY,
2006 SPI_SETMOUSEHOVERWIDTH_VALNAME,
2007 &mouse_hover_width, pvParam );
2010 case SPI_SETMOUSEHOVERWIDTH:
2011 ret = set_uint_param( SPI_SETMOUSEHOVERWIDTH_IDX,
2012 SPI_SETMOUSEHOVERWIDTH_REGKEY,
2013 SPI_SETMOUSEHOVERWIDTH_VALNAME,
2014 &mouse_hover_width, uiParam, fWinIni );
2017 case SPI_GETMOUSEHOVERHEIGHT:
2018 ret = get_uint_param( SPI_SETMOUSEHOVERHEIGHT_IDX,
2019 SPI_SETMOUSEHOVERHEIGHT_REGKEY,
2020 SPI_SETMOUSEHOVERHEIGHT_VALNAME,
2021 &mouse_hover_height, pvParam );
2024 case SPI_SETMOUSEHOVERHEIGHT:
2025 ret = set_uint_param( SPI_SETMOUSEHOVERHEIGHT_IDX,
2026 SPI_SETMOUSEHOVERHEIGHT_REGKEY,
2027 SPI_SETMOUSEHOVERHEIGHT_VALNAME,
2028 &mouse_hover_height, uiParam, fWinIni );
2031 case SPI_GETMOUSEHOVERTIME:
2032 ret = get_uint_param( SPI_SETMOUSEHOVERTIME_IDX,
2033 SPI_SETMOUSEHOVERTIME_REGKEY,
2034 SPI_SETMOUSEHOVERTIME_VALNAME,
2035 &mouse_hover_time, pvParam );
2038 case SPI_SETMOUSEHOVERTIME:
2039 ret = set_uint_param( SPI_SETMOUSEHOVERTIME_IDX,
2040 SPI_SETMOUSEHOVERTIME_REGKEY,
2041 SPI_SETMOUSEHOVERTIME_VALNAME,
2042 &mouse_hover_time, uiParam, fWinIni );
2045 case SPI_GETWHEELSCROLLLINES:
2046 ret = get_uint_param( SPI_SETMOUSESCROLLLINES_IDX,
2047 SPI_SETMOUSESCROLLLINES_REGKEY,
2048 SPI_SETMOUSESCROLLLINES_VALNAME,
2049 &mouse_scroll_lines, pvParam );
2052 case SPI_SETWHEELSCROLLLINES:
2053 ret = set_uint_param( SPI_SETMOUSESCROLLLINES_IDX,
2054 SPI_SETMOUSESCROLLLINES_REGKEY,
2055 SPI_SETMOUSESCROLLLINES_VALNAME,
2056 &mouse_scroll_lines, uiParam, fWinIni );
2059 case SPI_GETMENUSHOWDELAY:
2060 ret = get_uint_param( SPI_SETMENUSHOWDELAY_IDX,
2061 SPI_SETMENUSHOWDELAY_REGKEY,
2062 SPI_SETMENUSHOWDELAY_VALNAME,
2063 &menu_show_delay, pvParam );
2066 case SPI_SETMENUSHOWDELAY:
2067 ret = set_uint_param( SPI_SETMENUSHOWDELAY_IDX,
2068 SPI_SETMENUSHOWDELAY_REGKEY,
2069 SPI_SETMENUSHOWDELAY_VALNAME,
2070 &menu_show_delay, uiParam, fWinIni );
2073 WINE_SPI_FIXME(SPI_GETSHOWIMEUI); /* 110 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2074 WINE_SPI_FIXME(SPI_SETSHOWIMEUI); /* 111 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2075 WINE_SPI_FIXME(SPI_GETMOUSESPEED); /* 112 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2076 WINE_SPI_FIXME(SPI_SETMOUSESPEED); /* 113 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2078 case SPI_GETSCREENSAVERRUNNING:
2079 ret = get_bool_param( SPI_SETSCREENSAVERRUNNING_IDX,
2080 SPI_SETSCREENSAVERRUNNING_REGKEY,
2081 SPI_SETSCREENSAVERRUNNING_VALNAME,
2082 &screensaver_running, pvParam );
2085 case SPI_GETDESKWALLPAPER: /* 115 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2087 WCHAR buf[MAX_PATH];
2089 if (!pvParam) return FALSE;
2091 if (uiParam > MAX_PATH)
2096 if (SYSPARAMS_Load(SPI_SETDESKWALLPAPER_REGKEY, SPI_SETDESKWALLPAPER_VALNAME, buf, sizeof(buf)))
2098 lstrcpynW((WCHAR*)pvParam, buf, uiParam);
2102 /* Return an empty string */
2103 memset((WCHAR*)pvParam, 0, uiParam);
2109 WINE_SPI_FIXME(SPI_GETACTIVEWINDOWTRACKING);/* 0x1000 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2110 WINE_SPI_FIXME(SPI_SETACTIVEWINDOWTRACKING);/* 0x1001 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2111 case SPI_GETMENUANIMATION: /* 0x1002 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2112 ret = get_user_pref_param( 0, 0x02, pvParam );
2115 case SPI_SETMENUANIMATION: /* 0x1003 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2116 ret = set_user_pref_param( 0, 0x02, (BOOL)pvParam, fWinIni );
2119 case SPI_GETCOMBOBOXANIMATION: /* 0x1004 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2120 ret = get_user_pref_param( 0, 0x04, pvParam );
2123 case SPI_SETCOMBOBOXANIMATION: /* 0x1005 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2124 ret = set_user_pref_param( 0, 0x04, (BOOL)pvParam, fWinIni );
2127 case SPI_GETLISTBOXSMOOTHSCROLLING: /* 0x1006 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2128 ret = get_user_pref_param( 0, 0x08, pvParam );
2131 case SPI_SETLISTBOXSMOOTHSCROLLING: /* 0x1007 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2132 ret = set_user_pref_param( 0, 0x08, (BOOL)pvParam, fWinIni );
2135 case SPI_GETGRADIENTCAPTIONS:
2136 ret = get_user_pref_param( 0, 0x10, pvParam );
2139 case SPI_SETGRADIENTCAPTIONS:
2140 ret = set_user_pref_param( 0, 0x10, (BOOL)pvParam, fWinIni );
2143 case SPI_GETKEYBOARDCUES:
2144 ret = get_user_pref_param( 0, 0x20, pvParam );
2147 case SPI_SETKEYBOARDCUES:
2148 ret = set_user_pref_param( 0, 0x20, (BOOL)pvParam, fWinIni );
2151 WINE_SPI_FIXME(SPI_GETACTIVEWNDTRKZORDER); /* 0x100C _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2152 WINE_SPI_FIXME(SPI_SETACTIVEWNDTRKZORDER); /* 0x100D _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2153 case SPI_GETHOTTRACKING:
2154 ret = get_user_pref_param( 0, 0x80, pvParam );
2157 case SPI_SETHOTTRACKING:
2158 ret = set_user_pref_param( 0, 0x80, (BOOL)pvParam, fWinIni );
2161 WINE_SPI_FIXME(SPI_GETMENUFADE); /* 0x1012 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2162 WINE_SPI_FIXME(SPI_SETMENUFADE); /* 0x1013 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2163 case SPI_GETSELECTIONFADE: /* 0x1014 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2164 ret = get_user_pref_param( 1, 0x04, pvParam );
2167 case SPI_SETSELECTIONFADE: /* 0x1015 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2168 ret = set_user_pref_param( 1, 0x04, (BOOL)pvParam, fWinIni );
2171 case SPI_GETTOOLTIPANIMATION: /* 0x1016 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2172 ret = get_user_pref_param( 1, 0x08, pvParam );
2175 case SPI_SETTOOLTIPANIMATION: /* 0x1017 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2176 ret = set_user_pref_param( 1, 0x08, (BOOL)pvParam, fWinIni );
2179 case SPI_GETTOOLTIPFADE: /* 0x1018 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2180 ret = get_user_pref_param( 1, 0x10, pvParam );
2183 case SPI_SETTOOLTIPFADE: /* 0x1019 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2184 ret = set_user_pref_param( 1, 0x10, (BOOL)pvParam, fWinIni );
2187 case SPI_GETCURSORSHADOW: /* 0x101A _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2188 ret = get_user_pref_param( 1, 0x20, pvParam );
2191 case SPI_SETCURSORSHADOW: /* 0x101B _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2192 ret = set_user_pref_param( 1, 0x20, (BOOL)pvParam, fWinIni );
2195 WINE_SPI_FIXME(SPI_GETMOUSESONAR); /* 0x101C _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2196 WINE_SPI_FIXME(SPI_SETMOUSESONAR); /* 0x101D _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2197 WINE_SPI_FIXME(SPI_GETMOUSECLICKLOCK); /* 0x101E _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2198 WINE_SPI_FIXME(SPI_SETMOUSECLICKLOCK); /* 0x101F _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2199 WINE_SPI_FIXME(SPI_GETMOUSEVANISH); /* 0x1020 _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2200 WINE_SPI_FIXME(SPI_SETMOUSEVANISH); /* 0x1021 _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2201 case SPI_GETFLATMENU:
2202 ret = get_user_pref_param( 2, 0x02, pvParam );
2205 case SPI_SETFLATMENU:
2206 ret = set_user_pref_param( 2, 0x02, (BOOL)pvParam, fWinIni );
2209 WINE_SPI_FIXME(SPI_GETDROPSHADOW); /* 0x1024 _WIN32_WINNT >= 0x510 */
2210 WINE_SPI_FIXME(SPI_SETDROPSHADOW); /* 0x1025 _WIN32_WINNT >= 0x510 */
2211 WINE_SPI_FIXME(SPI_GETBLOCKSENDINPUTRESETS);
2212 WINE_SPI_FIXME(SPI_SETBLOCKSENDINPUTRESETS);
2213 case SPI_GETUIEFFECTS:
2214 ret = get_user_pref_param( 3, 0x80, pvParam );
2217 case SPI_SETUIEFFECTS:
2218 /* FIXME: this probably should mask other UI effect values when unset */
2219 ret = set_user_pref_param( 3, 0x80, (BOOL)pvParam, fWinIni );
2222 WINE_SPI_FIXME(SPI_GETFOREGROUNDLOCKTIMEOUT);/* 0x2000 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2223 WINE_SPI_FIXME(SPI_SETFOREGROUNDLOCKTIMEOUT);/* 0x2001 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2224 WINE_SPI_FIXME(SPI_GETACTIVEWNDTRKTIMEOUT); /* 0x2002 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2225 WINE_SPI_FIXME(SPI_SETACTIVEWNDTRKTIMEOUT); /* 0x2003 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2226 WINE_SPI_FIXME(SPI_GETFOREGROUNDFLASHCOUNT);/* 0x2004 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2227 WINE_SPI_FIXME(SPI_SETFOREGROUNDFLASHCOUNT);/* 0x2005 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2228 case SPI_GETCARETWIDTH: /* 0x2006 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2229 ret = get_uint_param( SPI_CARETWIDTH_IDX,
2230 SPI_CARETWIDTH_REGKEY,
2231 SPI_CARETWIDTH_VALNAME,
2232 &caret_width, pvParam );
2235 case SPI_SETCARETWIDTH: /* 0x2007 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2236 ret = set_uint_param( SPI_CARETWIDTH_IDX,
2237 SPI_CARETWIDTH_REGKEY,
2238 SPI_CARETWIDTH_VALNAME,
2239 &caret_width, uiParam, fWinIni );
2242 WINE_SPI_FIXME(SPI_GETMOUSECLICKLOCKTIME); /* 0x2008 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2243 WINE_SPI_FIXME(SPI_SETMOUSECLICKLOCKTIME); /* 0x2009 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2244 WINE_SPI_FIXME(SPI_GETFONTSMOOTHINGTYPE); /* 0x200A _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2245 WINE_SPI_FIXME(SPI_SETFONTSMOOTHINGTYPE); /* 0x200B _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2246 WINE_SPI_FIXME(SPI_GETFONTSMOOTHINGCONTRAST);/* 0x200C _WIN32_WINNT >= 0x510 */
2247 WINE_SPI_FIXME(SPI_SETFONTSMOOTHINGCONTRAST);/* 0x200D _WIN32_WINNT >= 0x510 */
2248 WINE_SPI_FIXME(SPI_GETFOCUSBORDERWIDTH); /* 0x200E _WIN32_WINNT >= 0x510 */
2249 WINE_SPI_FIXME(SPI_SETFOCUSBORDERWIDTH); /* 0x200F _WIN32_WINNT >= 0x510 */
2250 WINE_SPI_FIXME(SPI_GETFOCUSBORDERHEIGHT); /* 0x2010 _WIN32_WINNT >= 0x510 */
2251 WINE_SPI_FIXME(SPI_SETFOCUSBORDERHEIGHT); /* 0x2011 _WIN32_WINNT >= 0x510 */
2254 FIXME( "Unknown action: %u\n", uiAction );
2255 SetLastError( ERROR_INVALID_SPI_VALUE );
2261 SYSPARAMS_NotifyChange( uiAction, fWinIni );
2262 TRACE("(%u, %u, %p, %u) ret %d\n",
2263 uiAction, uiParam, pvParam, fWinIni, ret);
2266 #undef WINE_SPI_FIXME
2267 #undef WINE_SPI_WARN
2271 /***********************************************************************
2272 * SystemParametersInfo (USER.483)
2274 BOOL16 WINAPI SystemParametersInfo16( UINT16 uAction, UINT16 uParam,
2275 LPVOID lpvParam, UINT16 fuWinIni )
2279 TRACE("(%u, %u, %p, %u)\n", uAction, uParam, lpvParam, fuWinIni);
2283 case SPI_GETBEEP: /* 1 */
2284 case SPI_GETSCREENSAVEACTIVE: /* 16 */
2285 case SPI_GETICONTITLEWRAP: /* 25 */
2286 case SPI_GETMENUDROPALIGNMENT: /* 27 */
2287 case SPI_GETFASTTASKSWITCH: /* 35 */
2288 case SPI_GETDRAGFULLWINDOWS: /* 38 WINVER >= 0x0400 */
2291 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2292 if (ret && lpvParam)
2293 *(BOOL16 *)lpvParam = tmp;
2297 case SPI_GETBORDER: /* 5 */
2298 case SPI_ICONHORIZONTALSPACING: /* 13 */
2299 case SPI_GETSCREENSAVETIMEOUT: /* 14 */
2300 case SPI_GETGRIDGRANULARITY: /* 18 */
2301 case SPI_GETKEYBOARDDELAY: /* 22 */
2302 case SPI_ICONVERTICALSPACING: /* 24 */
2305 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2306 if (ret && lpvParam)
2307 *(INT16 *)lpvParam = tmp;
2311 case SPI_GETKEYBOARDSPEED: /* 10 */
2314 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2315 if (ret && lpvParam)
2316 *(WORD *)lpvParam = tmp;
2320 case SPI_GETICONTITLELOGFONT: /* 31 */
2323 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2324 if (ret && lpvParam)
2325 SYSPARAMS_LogFont32ATo16( &tmp, (LPLOGFONT16)lpvParam );
2329 case SPI_GETNONCLIENTMETRICS: /* 41 WINVER >= 0x400 */
2331 NONCLIENTMETRICSA tmp;
2332 LPNONCLIENTMETRICS16 lpnm16 = (LPNONCLIENTMETRICS16)lpvParam;
2333 if (lpnm16 && lpnm16->cbSize == sizeof(NONCLIENTMETRICS16))
2335 tmp.cbSize = sizeof(NONCLIENTMETRICSA);
2336 ret = SystemParametersInfoA( uAction, uParam, &tmp, fuWinIni );
2338 SYSPARAMS_NonClientMetrics32ATo16( &tmp, lpnm16 );
2340 else /* winfile 95 sets cbSize to 340 */
2341 ret = SystemParametersInfoA( uAction, uParam, lpvParam, fuWinIni );
2345 case SPI_GETWORKAREA: /* 48 WINVER >= 0x400 */
2348 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2349 if (ret && lpvParam)
2351 RECT16 *r16 = (RECT16 *)lpvParam;
2352 r16->left = tmp.left;
2354 r16->right = tmp.right;
2355 r16->bottom = tmp.bottom;
2360 case SPI_GETMOUSEHOVERWIDTH: /* 98 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2361 case SPI_GETMOUSEHOVERHEIGHT: /* 100 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2362 case SPI_GETMOUSEHOVERTIME: /* 102 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2365 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2366 if (ret && lpvParam)
2367 *(UINT16 *)lpvParam = tmp;
2372 ret = SystemParametersInfoA( uAction, uParam, lpvParam, fuWinIni );
2378 /***********************************************************************
2379 * SystemParametersInfoA (USER32.@)
2381 BOOL WINAPI SystemParametersInfoA( UINT uiAction, UINT uiParam,
2382 PVOID pvParam, UINT fuWinIni )
2386 TRACE("(%u, %u, %p, %u)\n", uiAction, uiParam, pvParam, fuWinIni);
2390 case SPI_SETDESKWALLPAPER: /* 20 */
2391 case SPI_SETDESKPATTERN: /* 21 */
2395 if (!MultiByteToWideChar( CP_ACP, 0, (LPSTR)pvParam, -1,
2396 buffer, sizeof(buffer)/sizeof(WCHAR) ))
2397 buffer[sizeof(buffer)/sizeof(WCHAR)-1] = 0;
2398 ret = SystemParametersInfoW( uiAction, uiParam, pvParam ? buffer : NULL, fuWinIni );
2402 case SPI_GETICONTITLELOGFONT: /* 31 */
2405 ret = SystemParametersInfoW( uiAction, uiParam, pvParam ? &tmp : NULL, fuWinIni );
2407 SYSPARAMS_LogFont32WTo32A( &tmp, (LPLOGFONTA)pvParam );
2411 case SPI_GETNONCLIENTMETRICS: /* 41 WINVER >= 0x400 */
2413 NONCLIENTMETRICSW tmp;
2414 LPNONCLIENTMETRICSA lpnmA = (LPNONCLIENTMETRICSA)pvParam;
2415 if (lpnmA && lpnmA->cbSize == sizeof(NONCLIENTMETRICSA))
2417 tmp.cbSize = sizeof(NONCLIENTMETRICSW);
2418 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2420 SYSPARAMS_NonClientMetrics32WTo32A( &tmp, lpnmA );
2427 case SPI_SETNONCLIENTMETRICS: /* 42 WINVER >= 0x400 */
2429 NONCLIENTMETRICSW tmp;
2430 LPNONCLIENTMETRICSA lpnmA = (LPNONCLIENTMETRICSA)pvParam;
2431 if (lpnmA && lpnmA->cbSize == sizeof(NONCLIENTMETRICSA))
2433 tmp.cbSize = sizeof(NONCLIENTMETRICSW);
2434 SYSPARAMS_NonClientMetrics32ATo32W( lpnmA, &tmp );
2435 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2442 case SPI_GETICONMETRICS: /* 45 WINVER >= 0x400 */
2445 LPICONMETRICSA lpimA = (LPICONMETRICSA)pvParam;
2446 if (lpimA && lpimA->cbSize == sizeof(ICONMETRICSA))
2448 tmp.cbSize = sizeof(ICONMETRICSW);
2449 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2452 lpimA->iHorzSpacing = tmp.iHorzSpacing;
2453 lpimA->iVertSpacing = tmp.iVertSpacing;
2454 lpimA->iTitleWrap = tmp.iTitleWrap;
2455 SYSPARAMS_LogFont32WTo32A( &tmp.lfFont, &lpimA->lfFont );
2463 case SPI_SETICONMETRICS: /* 46 WINVER >= 0x400 */
2466 LPICONMETRICSA lpimA = (LPICONMETRICSA)pvParam;
2467 if (lpimA && lpimA->cbSize == sizeof(ICONMETRICSA))
2469 tmp.cbSize = sizeof(ICONMETRICSW);
2470 tmp.iHorzSpacing = lpimA->iHorzSpacing;
2471 tmp.iVertSpacing = lpimA->iVertSpacing;
2472 tmp.iTitleWrap = lpimA->iTitleWrap;
2473 SYSPARAMS_LogFont32ATo32W( &lpimA->lfFont, &tmp.lfFont);
2474 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2481 case SPI_GETHIGHCONTRAST: /* 66 WINVER >= 0x400 */
2484 LPHIGHCONTRASTA lphcA = (LPHIGHCONTRASTA)pvParam;
2485 if (lphcA && lphcA->cbSize == sizeof(HIGHCONTRASTA))
2487 tmp.cbSize = sizeof(HIGHCONTRASTW);
2488 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2491 lphcA->dwFlags = tmp.dwFlags;
2492 lphcA->lpszDefaultScheme = NULL; /* FIXME? */
2500 case SPI_GETDESKWALLPAPER: /* 115 */
2502 WCHAR buffer[MAX_PATH];
2503 ret = (SystemParametersInfoW( SPI_GETDESKWALLPAPER, uiParam, buffer, fuWinIni ) &&
2504 WideCharToMultiByte(CP_ACP, 0, buffer, -1, pvParam, uiParam, NULL, NULL));
2509 ret = SystemParametersInfoW( uiAction, uiParam, pvParam, fuWinIni );
2516 /***********************************************************************
2517 * GetSystemMetrics (USER32.@)
2519 INT WINAPI GetSystemMetrics( INT index )
2523 /* some metrics are dynamic */
2527 return GetDeviceCaps( get_display_dc(), HORZRES );
2529 return GetDeviceCaps( get_display_dc(), VERTRES );
2531 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2532 return nonclient_metrics.iScrollWidth;
2534 return GetSystemMetrics(SM_CXVSCROLL);
2536 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2537 return nonclient_metrics.iCaptionHeight + 1;
2540 /* SM_C{X,Y}BORDER always returns 1 regardless of 'BorderWidth' value in registry */
2546 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2547 return nonclient_metrics.iScrollHeight;
2549 return GetSystemMetrics(SM_CYVTHUMB);
2551 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2552 return icon_size.cx;
2554 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2555 return icon_size.cy;
2560 return GetSystemMetrics(SM_CYMENUSIZE) + 1;
2561 case SM_CXFULLSCREEN:
2562 /* see the remark for SM_CXMAXIMIZED, at least this formulation is
2564 return GetSystemMetrics( SM_CXMAXIMIZED) - 2 * GetSystemMetrics( SM_CXFRAME);
2565 case SM_CYFULLSCREEN:
2566 /* see the remark for SM_CYMAXIMIZED, at least this formulation is
2568 return GetSystemMetrics( SM_CYMAXIMIZED) - GetSystemMetrics( SM_CYMIN);
2569 case SM_CYKANJIWINDOW:
2571 case SM_MOUSEPRESENT:
2574 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2575 return nonclient_metrics.iScrollHeight;
2577 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2578 return nonclient_metrics.iScrollHeight;
2582 get_bool_param( SPI_SETMOUSEBUTTONSWAP_IDX, SPI_SETMOUSEBUTTONSWAP_REGKEY,
2583 SPI_SETMOUSEBUTTONSWAP_VALNAME, &swap_buttons, (BOOL*)&ret );
2591 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2592 return 3 * nonclient_metrics.iCaptionWidth + GetSystemMetrics( SM_CYSIZE) +
2593 4 * CaptionFontAvCharWidth + 2 * GetSystemMetrics( SM_CXFRAME) + 4;
2595 return GetSystemMetrics( SM_CYCAPTION) + 2 * GetSystemMetrics( SM_CYFRAME);
2597 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2598 return nonclient_metrics.iCaptionWidth;
2600 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2601 return nonclient_metrics.iCaptionHeight;
2603 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2604 return GetSystemMetrics(SM_CXDLGFRAME) + nonclient_metrics.iBorderWidth;
2606 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2607 return GetSystemMetrics(SM_CYDLGFRAME) + nonclient_metrics.iBorderWidth;
2609 return GetSystemMetrics(SM_CXMIN);
2611 return GetSystemMetrics(SM_CYMIN);
2612 case SM_CXDOUBLECLK:
2613 get_uint_param( SPI_SETDOUBLECLKWIDTH_IDX, SPI_SETDOUBLECLKWIDTH_REGKEY1,
2614 SPI_SETDOUBLECLKWIDTH_VALNAME, &double_click_width, &ret );
2616 case SM_CYDOUBLECLK:
2617 get_uint_param( SPI_SETDOUBLECLKHEIGHT_IDX, SPI_SETDOUBLECLKHEIGHT_REGKEY1,
2618 SPI_SETDOUBLECLKHEIGHT_VALNAME, &double_click_height, &ret );
2620 case SM_CXICONSPACING:
2621 SystemParametersInfoW( SPI_ICONHORIZONTALSPACING, 0, &ret, 0 );
2623 case SM_CYICONSPACING:
2624 SystemParametersInfoW( SPI_ICONVERTICALSPACING, 0, &ret, 0 );
2626 case SM_MENUDROPALIGNMENT:
2627 SystemParametersInfoW( SPI_GETMENUDROPALIGNMENT, 0, &ret, 0 );
2631 case SM_DBCSENABLED:
2634 GetCPInfo( CP_ACP, &cpinfo );
2635 return (cpinfo.MaxCharSize > 1);
2637 case SM_CMOUSEBUTTONS:
2642 return GetSystemMetrics(SM_CXBORDER) + 1;
2644 return GetSystemMetrics(SM_CYBORDER) + 1;
2645 case SM_CXMINSPACING:
2646 if( spi_loaded[SPI_MINIMIZEDMETRICS_IDX]) load_minimized_metrics();
2647 return GetSystemMetrics(SM_CXMINIMIZED) + minimized_metrics.iHorzGap;
2648 case SM_CYMINSPACING:
2649 if( spi_loaded[SPI_MINIMIZEDMETRICS_IDX]) load_minimized_metrics();
2650 return GetSystemMetrics(SM_CYMINIMIZED) + minimized_metrics.iVertGap;
2654 case SM_CYSMCAPTION:
2655 return GetSystemMetrics(SM_CYSMSIZE) + 1;
2657 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2658 return nonclient_metrics.iSmCaptionWidth;
2660 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2661 return nonclient_metrics.iSmCaptionHeight;
2663 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2664 return nonclient_metrics.iMenuWidth;
2666 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2667 return nonclient_metrics.iMenuHeight;
2669 if( spi_loaded[SPI_MINIMIZEDMETRICS_IDX]) load_minimized_metrics();
2670 return minimized_metrics.iArrange;
2671 case SM_CXMINIMIZED:
2672 if( spi_loaded[SPI_MINIMIZEDMETRICS_IDX]) load_minimized_metrics();
2673 return minimized_metrics.iWidth + 6;
2674 case SM_CYMINIMIZED:
2675 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2676 return nonclient_metrics.iCaptionHeight + 6;
2678 return GetSystemMetrics(SM_CXSCREEN) + 4 + 2 * GetSystemMetrics(SM_CXFRAME);
2680 return GetSystemMetrics(SM_CYSCREEN) + 4 + 2 * GetSystemMetrics(SM_CYFRAME);
2681 case SM_CXMAXIMIZED:
2682 /* FIXME: subtract the width of any vertical application toolbars*/
2683 return GetSystemMetrics(SM_CXSCREEN) + 2 * GetSystemMetrics(SM_CXFRAME);
2684 case SM_CYMAXIMIZED:
2685 /* FIXME: subtract the width of any horizontal application toolbars*/
2686 return GetSystemMetrics(SM_CYSCREEN) + 2 * GetSystemMetrics(SM_CYCAPTION);
2688 return 3; /* FIXME */
2690 return 0; /* 0 = ok, 1 = failsafe, 2 = failsafe + network */
2695 SystemParametersInfoW( SPI_GETSHOWSOUNDS, 0, &ret, 0 );
2697 case SM_CXMENUCHECK:
2698 case SM_CYMENUCHECK:
2699 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2700 return tmMenuFont.tmHeight <= 0 ? 13 :
2701 ((tmMenuFont.tmHeight + tmMenuFont.tmExternalLeading + 1) / 2) * 2 - 1;
2702 case SM_SLOWMACHINE:
2703 return 0; /* FIXME: Should check the type of processor */
2704 case SM_MIDEASTENABLED:
2705 return 0; /* FIXME */
2706 case SM_MOUSEWHEELPRESENT:
2708 case SM_XVIRTUALSCREEN:
2709 case SM_YVIRTUALSCREEN:
2711 case SM_CXVIRTUALSCREEN:
2712 return GetSystemMetrics(SM_CXSCREEN);
2713 case SM_CYVIRTUALSCREEN:
2714 return GetSystemMetrics(SM_CYSCREEN);
2717 case SM_SAMEDISPLAYFORMAT:
2720 return 0; /* FIXME */
2721 case SM_CXFOCUSBORDER:
2722 case SM_CYFOCUSBORDER:
2725 case SM_MEDIACENTER:
2735 /***********************************************************************
2736 * SwapMouseButton (USER32.@)
2737 * Reverse or restore the meaning of the left and right mouse buttons
2738 * fSwap [I ] TRUE - reverse, FALSE - original
2742 BOOL WINAPI SwapMouseButton( BOOL fSwap )
2744 BOOL prev = GetSystemMetrics(SM_SWAPBUTTON);
2745 SystemParametersInfoW(SPI_SETMOUSEBUTTONSWAP, fSwap, 0, 0);
2750 /**********************************************************************
2751 * SetDoubleClickTime (USER32.@)
2753 BOOL WINAPI SetDoubleClickTime( UINT interval )
2755 return SystemParametersInfoW(SPI_SETDOUBLECLICKTIME, interval, 0, 0);
2759 /**********************************************************************
2760 * GetDoubleClickTime (USER32.@)
2762 UINT WINAPI GetDoubleClickTime(void)
2766 get_uint_param( SPI_SETDOUBLECLICKTIME_IDX,
2767 SPI_SETDOUBLECLICKTIME_REGKEY,
2768 SPI_SETDOUBLECLICKTIME_VALNAME,
2769 &double_click_time, &time );
2770 if (!time) time = 500;
2775 /*************************************************************************
2776 * GetSysColor (USER32.@)
2778 COLORREF WINAPI GetSysColor( INT nIndex )
2780 if (nIndex >= 0 && nIndex < NUM_SYS_COLORS)
2781 return SysColors[nIndex];
2787 /*************************************************************************
2788 * SetSysColors (USER32.@)
2790 BOOL WINAPI SetSysColors( INT nChanges, const INT *lpSysColor,
2791 const COLORREF *lpColorValues )
2795 for (i = 0; i < nChanges; i++) SYSPARAMS_SetSysColor( lpSysColor[i], lpColorValues[i] );
2797 /* Send WM_SYSCOLORCHANGE message to all windows */
2799 SendMessageTimeoutW( HWND_BROADCAST, WM_SYSCOLORCHANGE, 0, 0, SMTO_ABORTIFHUNG, 2000, NULL );
2801 /* Repaint affected portions of all visible windows */
2803 RedrawWindow( GetDesktopWindow(), NULL, 0,
2804 RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN );
2809 /*************************************************************************
2810 * SetSysColorsTemp (USER32.@)
2814 * Called by W98SE desk.cpl Control Panel Applet:
2815 * handle = SetSysColorsTemp(ptr, ptr, nCount); ("set" call)
2816 * result = SetSysColorsTemp(NULL, NULL, handle); ("restore" call)
2818 * pPens is an array of COLORREF values, which seems to be used
2819 * to indicate the color values to create new pens with.
2821 * pBrushes is an array of solid brush handles (returned by a previous
2822 * CreateSolidBrush), which seems to contain the brush handles to set
2823 * for the system colors.
2825 * n seems to be used for
2826 * a) indicating the number of entries to operate on (length of pPens,
2828 * b) passing the handle that points to the previously used color settings.
2829 * I couldn't figure out in hell what kind of handle this is on
2830 * Windows. I just use a heap handle instead. Shouldn't matter anyway.
2833 * heap handle of our own copy of the current syscolors in case of
2834 * "set" call, i.e. pPens, pBrushes != NULL.
2835 * TRUE (unconditionally !) in case of "restore" call,
2836 * i.e. pPens, pBrushes == NULL.
2837 * FALSE in case of either pPens != NULL and pBrushes == NULL
2838 * or pPens == NULL and pBrushes != NULL.
2840 * I'm not sure whether this implementation is 100% correct. [AM]
2842 DWORD WINAPI SetSysColorsTemp( const COLORREF *pPens, const HBRUSH *pBrushes, DWORD n)
2846 if (pPens && pBrushes) /* "set" call */
2848 /* allocate our structure to remember old colors */
2849 LPVOID pOldCol = HeapAlloc(GetProcessHeap(), 0, sizeof(DWORD)+n*sizeof(HPEN)+n*sizeof(HBRUSH));
2851 *(DWORD *)p = n; p = (char*)p + sizeof(DWORD);
2852 memcpy(p, SysColorPens, n*sizeof(HPEN)); p = (char*)p + n*sizeof(HPEN);
2853 memcpy(p, SysColorBrushes, n*sizeof(HBRUSH)); p = (char*)p + n*sizeof(HBRUSH);
2855 for (i=0; i < n; i++)
2857 SysColorPens[i] = CreatePen( PS_SOLID, 1, pPens[i] );
2858 SysColorBrushes[i] = pBrushes[i];
2861 return (DWORD)pOldCol;
2863 if (!pPens && !pBrushes) /* "restore" call */
2865 LPVOID pOldCol = (LPVOID)n;
2867 DWORD nCount = *(DWORD *)p;
2868 p = (char*)p + sizeof(DWORD);
2870 for (i=0; i < nCount; i++)
2872 DeleteObject(SysColorPens[i]);
2873 SysColorPens[i] = *(HPEN *)p; p = (char*)p + sizeof(HPEN);
2875 for (i=0; i < nCount; i++)
2877 SysColorBrushes[i] = *(HBRUSH *)p; p = (char*)p + sizeof(HBRUSH);
2879 /* get rid of storage structure */
2880 HeapFree(GetProcessHeap(), 0, pOldCol);
2888 /***********************************************************************
2889 * GetSysColorBrush (USER32.@)
2891 HBRUSH WINAPI GetSysColorBrush( INT index )
2893 if (0 <= index && index < NUM_SYS_COLORS) return SysColorBrushes[index];
2894 WARN("Unknown index(%d)\n", index );
2895 return GetStockObject(LTGRAY_BRUSH);
2899 /***********************************************************************
2902 HPEN SYSCOLOR_GetPen( INT index )
2904 /* We can assert here, because this function is internal to Wine */
2905 assert (0 <= index && index < NUM_SYS_COLORS);
2906 return SysColorPens[index];
2910 /***********************************************************************
2911 * ChangeDisplaySettingsA (USER32.@)
2913 LONG WINAPI ChangeDisplaySettingsA( LPDEVMODEA devmode, DWORD flags )
2915 return ChangeDisplaySettingsExA(NULL,devmode,NULL,flags,NULL);
2919 /***********************************************************************
2920 * ChangeDisplaySettingsW (USER32.@)
2922 LONG WINAPI ChangeDisplaySettingsW( LPDEVMODEW devmode, DWORD flags )
2924 return ChangeDisplaySettingsExW(NULL,devmode,NULL,flags,NULL);
2928 /***********************************************************************
2929 * ChangeDisplaySettingsExA (USER32.@)
2931 LONG WINAPI ChangeDisplaySettingsExA( LPCSTR devname, LPDEVMODEA devmode, HWND hwnd,
2932 DWORD flags, LPVOID lparam )
2936 UNICODE_STRING nameW;
2938 if (devname) RtlCreateUnicodeStringFromAsciiz(&nameW, devname);
2939 else nameW.Buffer = NULL;
2943 devmodeW.dmBitsPerPel = devmode->dmBitsPerPel;
2944 devmodeW.dmPelsHeight = devmode->dmPelsHeight;
2945 devmodeW.dmPelsWidth = devmode->dmPelsWidth;
2946 devmodeW.dmDisplayFlags = devmode->dmDisplayFlags;
2947 devmodeW.dmDisplayFrequency = devmode->dmDisplayFrequency;
2948 devmodeW.dmFields = devmode->dmFields;
2949 ret = ChangeDisplaySettingsExW(nameW.Buffer, &devmodeW, hwnd, flags, lparam);
2953 ret = ChangeDisplaySettingsExW(nameW.Buffer, NULL, hwnd, flags, lparam);
2956 if (devname) RtlFreeUnicodeString(&nameW);
2961 /***********************************************************************
2962 * ChangeDisplaySettingsExW (USER32.@)
2964 LONG WINAPI ChangeDisplaySettingsExW( LPCWSTR devname, LPDEVMODEW devmode, HWND hwnd,
2965 DWORD flags, LPVOID lparam )
2967 /* make sure the desktop window is created before mode changing */
2970 return USER_Driver->pChangeDisplaySettingsEx( devname, devmode, hwnd, flags, lparam );
2974 /***********************************************************************
2975 * EnumDisplaySettingsW (USER32.@)
2978 * TRUE if nth setting exists found (described in the LPDEVMODEW struct)
2979 * FALSE if we do not have the nth setting
2981 BOOL WINAPI EnumDisplaySettingsW( LPCWSTR name, DWORD n, LPDEVMODEW devmode )
2983 return EnumDisplaySettingsExW(name, n, devmode, 0);
2987 /***********************************************************************
2988 * EnumDisplaySettingsA (USER32.@)
2990 BOOL WINAPI EnumDisplaySettingsA(LPCSTR name,DWORD n,LPDEVMODEA devmode)
2992 return EnumDisplaySettingsExA(name, n, devmode, 0);
2996 /***********************************************************************
2997 * EnumDisplaySettingsExA (USER32.@)
2999 BOOL WINAPI EnumDisplaySettingsExA(LPCSTR lpszDeviceName, DWORD iModeNum,
3000 LPDEVMODEA lpDevMode, DWORD dwFlags)
3004 UNICODE_STRING nameW;
3006 if (lpszDeviceName) RtlCreateUnicodeStringFromAsciiz(&nameW, lpszDeviceName);
3007 else nameW.Buffer = NULL;
3009 ret = EnumDisplaySettingsExW(nameW.Buffer,iModeNum,&devmodeW,dwFlags);
3012 lpDevMode->dmBitsPerPel = devmodeW.dmBitsPerPel;
3013 lpDevMode->dmPelsHeight = devmodeW.dmPelsHeight;
3014 lpDevMode->dmPelsWidth = devmodeW.dmPelsWidth;
3015 lpDevMode->dmDisplayFlags = devmodeW.dmDisplayFlags;
3016 lpDevMode->dmDisplayFrequency = devmodeW.dmDisplayFrequency;
3017 lpDevMode->dmFields = devmodeW.dmFields;
3019 if (lpszDeviceName) RtlFreeUnicodeString(&nameW);
3024 /***********************************************************************
3025 * EnumDisplaySettingsExW (USER32.@)
3027 BOOL WINAPI EnumDisplaySettingsExW(LPCWSTR lpszDeviceName, DWORD iModeNum,
3028 LPDEVMODEW lpDevMode, DWORD dwFlags)
3030 return USER_Driver->pEnumDisplaySettingsEx(lpszDeviceName, iModeNum, lpDevMode, dwFlags);