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
29 #define NONAMELESSUNION
30 #define NONAMELESSSTRUCT
37 #include "wine/wingdi16.h"
41 #include "user_private.h"
42 #include "wine/unicode.h"
43 #include "wine/debug.h"
45 WINE_DEFAULT_DEBUG_CHANNEL(system);
47 /* System parameter indexes */
53 SPI_SETKEYBOARDSPEED_IDX,
54 SPI_ICONHORIZONTALSPACING_IDX,
55 SPI_SETSCREENSAVETIMEOUT_IDX,
56 SPI_SETGRIDGRANULARITY_IDX,
57 SPI_SETKEYBOARDDELAY_IDX,
58 SPI_ICONVERTICALSPACING_IDX,
59 SPI_SETICONTITLEWRAP_IDX,
60 SPI_SETMENUDROPALIGNMENT_IDX,
61 SPI_SETDOUBLECLKWIDTH_IDX,
62 SPI_SETDOUBLECLKHEIGHT_IDX,
63 SPI_SETDOUBLECLICKTIME_IDX,
64 SPI_SETMOUSEBUTTONSWAP_IDX,
65 SPI_SETDRAGFULLWINDOWS_IDX,
67 SPI_SETSHOWSOUNDS_IDX,
68 SPI_SETKEYBOARDPREF_IDX,
69 SPI_SETSCREENREADER_IDX,
70 SPI_SETSCREENSAVERRUNNING_IDX,
71 SPI_SETFONTSMOOTHING_IDX,
72 SPI_SETLISTBOXSMOOTHSCROLLING_IDX,
73 SPI_SETMOUSEHOVERWIDTH_IDX,
74 SPI_SETMOUSEHOVERHEIGHT_IDX,
75 SPI_SETMOUSEHOVERTIME_IDX,
76 SPI_SETMOUSESCROLLCHARS_IDX,
77 SPI_SETMOUSESCROLLLINES_IDX,
78 SPI_SETMENUSHOWDELAY_IDX,
79 SPI_SETICONTITLELOGFONT_IDX,
80 SPI_SETLOWPOWERACTIVE_IDX,
81 SPI_SETSNAPTODEFBUTTON_IDX,
82 SPI_SETPOWEROFFACTIVE_IDX,
83 SPI_USERPREFERENCEMASK_IDX,
84 SPI_NONCLIENTMETRICS_IDX,
85 SPI_MINIMIZEDMETRICS_IDX,
86 SPI_SETFOREGROUNDLOCKTIMEOUT_IDX,
88 SPI_SETMOUSESPEED_IDX,
89 SPI_SETFONTSMOOTHINGTYPE_IDX,
90 SPI_SETFONTSMOOTHINGCONTRAST_IDX,
91 SPI_SETFONTSMOOTHINGORIENTATION_IDX,
101 {"Scrollbar", RGB(212, 208, 200)}, /* COLOR_SCROLLBAR */
102 {"Background", RGB(58, 110, 165)}, /* COLOR_BACKGROUND */
103 {"ActiveTitle", RGB(10, 36, 106)}, /* COLOR_ACTIVECAPTION */
104 {"InactiveTitle", RGB(128, 128, 128)}, /* COLOR_INACTIVECAPTION */
105 {"Menu", RGB(212, 208, 200)}, /* COLOR_MENU */
106 {"Window", RGB(255, 255, 255)}, /* COLOR_WINDOW */
107 {"WindowFrame", RGB(0, 0, 0)}, /* COLOR_WINDOWFRAME */
108 {"MenuText", RGB(0, 0, 0)}, /* COLOR_MENUTEXT */
109 {"WindowText", RGB(0, 0, 0)}, /* COLOR_WINDOWTEXT */
110 {"TitleText", RGB(255, 255, 255)}, /* COLOR_CAPTIONTEXT */
111 {"ActiveBorder", RGB(212, 208, 200)}, /* COLOR_ACTIVEBORDER */
112 {"InactiveBorder", RGB(212, 208, 200)}, /* COLOR_INACTIVEBORDER */
113 {"AppWorkSpace", RGB(128, 128, 128)}, /* COLOR_APPWORKSPACE */
114 {"Hilight", RGB(10, 36, 106)}, /* COLOR_HIGHLIGHT */
115 {"HilightText", RGB(255, 255, 255)}, /* COLOR_HIGHLIGHTTEXT */
116 {"ButtonFace", RGB(212, 208, 200)}, /* COLOR_BTNFACE */
117 {"ButtonShadow", RGB(128, 128, 128)}, /* COLOR_BTNSHADOW */
118 {"GrayText", RGB(128, 128, 128)}, /* COLOR_GRAYTEXT */
119 {"ButtonText", RGB(0, 0, 0)}, /* COLOR_BTNTEXT */
120 {"InactiveTitleText", RGB(212, 208, 200)}, /* COLOR_INACTIVECAPTIONTEXT */
121 {"ButtonHilight", RGB(255, 255, 255)}, /* COLOR_BTNHIGHLIGHT */
122 {"ButtonDkShadow", RGB(64, 64, 64)}, /* COLOR_3DDKSHADOW */
123 {"ButtonLight", RGB(212, 208, 200)}, /* COLOR_3DLIGHT */
124 {"InfoText", RGB(0, 0, 0)}, /* COLOR_INFOTEXT */
125 {"InfoWindow", RGB(255, 255, 225)}, /* COLOR_INFOBK */
126 {"ButtonAlternateFace", RGB(181, 181, 181)}, /* COLOR_ALTERNATEBTNFACE */
127 {"HotTrackingColor", RGB(0, 0, 200)}, /* COLOR_HOTLIGHT */
128 {"GradientActiveTitle", RGB(166, 202, 240)}, /* COLOR_GRADIENTACTIVECAPTION */
129 {"GradientInactiveTitle", RGB(192, 192, 192)}, /* COLOR_GRADIENTINACTIVECAPTION */
130 {"MenuHilight", RGB(10, 36, 106)}, /* COLOR_MENUHILIGHT */
131 {"MenuBar", RGB(212, 208, 200)} /* COLOR_MENUBAR */
135 * Names of the registry subkeys of HKEY_CURRENT_USER key and value names
136 * for the system parameters.
137 * Names of the keys are created by adding string "_REGKEY" to
138 * "SET" action names, value names are created by adding "_REG_NAME"
139 * to the "SET" action name.
141 static const WCHAR SPI_SETBEEP_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','S','o','u','n','d',0};
142 static const WCHAR SPI_SETBEEP_VALNAME[]= {'B','e','e','p',0};
143 static const WCHAR SPI_SETMOUSE_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
144 static const WCHAR SPI_SETMOUSE_VALNAME1[]= {'M','o','u','s','e','T','h','r','e','s','h','o','l','d','1',0};
145 static const WCHAR SPI_SETMOUSE_VALNAME2[]= {'M','o','u','s','e','T','h','r','e','s','h','o','l','d','2',0};
146 static const WCHAR SPI_SETMOUSE_VALNAME3[]= {'M','o','u','s','e','S','p','e','e','d',0};
147 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','\\',
148 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
149 static const WCHAR SPI_SETBORDER_VALNAME[]= {'B','o','r','d','e','r','W','i','d','t','h',0};
150 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};
151 static const WCHAR SPI_SETKEYBOARDSPEED_VALNAME[]= {'K','e','y','b','o','a','r','d','S','p','e','e','d',0};
152 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','\\',
153 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
154 static const WCHAR SPI_ICONHORIZONTALSPACING_VALNAME[]= {'I','c','o','n','S','p','a','c','i','n','g',0};
155 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};
156 static const WCHAR SPI_SETSCREENSAVETIMEOUT_VALNAME[]= {'S','c','r','e','e','n','S','a','v','e','T','i','m','e','O','u','t',0};
157 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};
158 static const WCHAR SPI_SETSCREENSAVEACTIVE_VALNAME[]= {'S','c','r','e','e','n','S','a','v','e','A','c','t','i','v','e',0};
159 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};
160 static const WCHAR SPI_SETGRIDGRANULARITY_VALNAME[]= {'G','r','i','d','G','r','a','n','u','l','a','r','i','t','y',0};
161 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};
162 static const WCHAR SPI_SETKEYBOARDDELAY_VALNAME[]= {'K','e','y','b','o','a','r','d','D','e','l','a','y',0};
163 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','\\',
164 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
165 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};
166 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','\\',
167 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
168 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};
169 static const WCHAR SPI_SETICONTITLEWRAP_VALNAME[]= {'I','c','o','n','T','i','t','l','e','W','r','a','p',0};
170 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','\\',
171 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
172 static const WCHAR SPI_SETICONTITLELOGFONT_VALNAME[]= {'I','c','o','n','F','o','n','t',0};
173 static const WCHAR SPI_SETMENUDROPALIGNMENT_REGKEY1[]= {'S','o','f','t','w','a','r','e','\\',
174 'M','i','c','r','o','s','o','f','t','\\',
175 'W','i','n','d','o','w','s',' ','N','T','\\',
176 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
177 'W','i','n','d','o','w','s',0};
178 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};
179 static const WCHAR SPI_SETMENUDROPALIGNMENT_VALNAME[]= {'M','e','n','u','D','r','o','p','A','l','i','g','n','m','e','n','t',0};
180 static const WCHAR SPI_SETSNAPTODEFBUTTON_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
181 static const WCHAR SPI_SETSNAPTODEFBUTTON_VALNAME[]= {'S','n','a','p','T','o','D','e','f','a','u','l','t','B','u','t','t','o','n',0};
182 static const WCHAR SPI_SETDOUBLECLKWIDTH_REGKEY1[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
183 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};
184 static const WCHAR SPI_SETDOUBLECLKWIDTH_VALNAME[]= {'D','o','u','b','l','e','C','l','i','c','k','W','i','d','t','h',0};
185 static const WCHAR SPI_SETDOUBLECLKHEIGHT_REGKEY1[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
186 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};
187 static const WCHAR SPI_SETDOUBLECLKHEIGHT_VALNAME[]= {'D','o','u','b','l','e','C','l','i','c','k','H','e','i','g','h','t',0};
188 static const WCHAR SPI_SETDOUBLECLICKTIME_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
189 static const WCHAR SPI_SETDOUBLECLICKTIME_VALNAME[]= {'D','o','u','b','l','e','C','l','i','c','k','S','p','e','e','d',0};
190 static const WCHAR SPI_SETMOUSEBUTTONSWAP_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
191 static const WCHAR SPI_SETMOUSEBUTTONSWAP_VALNAME[]= {'S','w','a','p','M','o','u','s','e','B','u','t','t','o','n','s',0};
192 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};
193 static const WCHAR SPI_SETDRAGFULLWINDOWS_VALNAME[]= {'D','r','a','g','F','u','l','l','W','i','n','d','o','w','s',0};
194 static const WCHAR SPI_SETSHOWSOUNDS_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\',
195 'A','c','c','e','s','s','i','b','i','l','i','t','y','\\',
196 'S','h','o','w','S','o','u','n','d','s',0};
197 static const WCHAR SPI_SETSHOWSOUNDS_VALNAME[]= {'O','n',0};
198 static const WCHAR SPI_SETKEYBOARDPREF_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\',
199 'A','c','c','e','s','s','i','b','i','l','i','t','y','\\',
200 'K','e','y','b','o','a','r','d',' ','P','r','e','f','e','r','e','n','c','e',0};
201 static const WCHAR SPI_SETKEYBOARDPREF_VALNAME[]= {'O','n',0};
202 static const WCHAR SPI_SETSCREENREADER_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\',
203 'A','c','c','e','s','s','i','b','i','l','i','t','y','\\',
204 'B','l','i','n','d',' ','A','c','c','e','s','s',0};
205 static const WCHAR SPI_SETSCREENREADER_VALNAME[]= {'O','n',0};
206 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};
207 static const WCHAR SPI_SETDESKWALLPAPER_VALNAME[]= {'W','a','l','l','p','a','p','e','r',0};
208 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};
209 static const WCHAR SPI_SETFONTSMOOTHING_VALNAME[]= {'F','o','n','t','S','m','o','o','t','h','i','n','g',0};
210 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};
211 static const WCHAR SPI_SETLOWPOWERACTIVE_VALNAME[]= {'L','o','w','P','o','w','e','r','A','c','t','i','v','e',0};
212 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};
213 static const WCHAR SPI_SETPOWEROFFACTIVE_VALNAME[]= {'P','o','w','e','r','O','f','f','A','c','t','i','v','e',0};
214 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};
215 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};
216 static const WCHAR SPI_SETMOUSEHOVERWIDTH_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
217 static const WCHAR SPI_SETMOUSEHOVERWIDTH_VALNAME[]= {'M','o','u','s','e','H','o','v','e','r','W','i','d','t','h',0};
218 static const WCHAR SPI_SETMOUSEHOVERHEIGHT_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
219 static const WCHAR SPI_SETMOUSEHOVERHEIGHT_VALNAME[]= {'M','o','u','s','e','H','o','v','e','r','H','e','i','g','h','t',0};
220 static const WCHAR SPI_SETMOUSEHOVERTIME_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
221 static const WCHAR SPI_SETMOUSEHOVERTIME_VALNAME[]= {'M','o','u','s','e','H','o','v','e','r','T','i','m','e',0};
222 static const WCHAR SPI_SETMOUSESCROLLCHARS_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
223 static const WCHAR SPI_SETMOUSESCROLLCHARS_VALNAME[]= {'W','h','e','e','l','S','c','r','o','l','l','C','h','a','r','s',0};
224 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};
225 static const WCHAR SPI_SETMOUSESCROLLLINES_VALNAME[]= {'W','h','e','e','l','S','c','r','o','l','l','L','i','n','e','s',0};
226 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};
227 static const WCHAR SPI_SETMENUSHOWDELAY_VALNAME[]= {'M','e','n','u','S','h','o','w','D','e','l','a','y',0};
228 static const WCHAR SPI_SETFOREGROUNDLOCKTIMEOUT_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
229 static const WCHAR SPI_SETFOREGROUNDLOCKTIMEOUT_VALNAME[]= {'F','o','r','e','g','r','o','u','n','d','L','o','c','k','T','i','m','e','o','u','t',0};
230 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};
231 static const WCHAR SPI_CARETWIDTH_VALNAME[]= {'C','a','r','e','t','W','i','d','t','h',0};
232 static const WCHAR SPI_SETMOUSESPEED_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
233 static const WCHAR SPI_SETMOUSESPEED_VALNAME[]= {'M','o','u','s','e','S','e','n','s','i','t','i','v','i','t','y',0};
234 static const WCHAR SPI_SETFONTSMOOTHINGTYPE_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
235 static const WCHAR SPI_SETFONTSMOOTHINGTYPE_VALNAME[]= {'F','o','n','t','S','m','o','o','t','h','i','n','g','T','y','p','e',0};
236 static const WCHAR SPI_SETFONTSMOOTHINGCONTRAST_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
237 static const WCHAR SPI_SETFONTSMOOTHINGCONTRAST_VALNAME[]= {'F','o','n','t','S','m','o','o','t','h','i','n','g','G','a','m','m','a',0};
238 static const WCHAR SPI_SETFONTSMOOTHINGORIENTATION_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
239 static const WCHAR SPI_SETFONTSMOOTHINGORIENTATION_VALNAME[]= {'F','o','n','t','S','m','o','o','t','h','i','n','g','O','r','i','e','n','t','a','t','i','o','n',0};
241 /* FIXME - real values */
242 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};
243 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};
245 static const WCHAR METRICS_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p','\\',
246 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
247 static const WCHAR METRICS_SCROLLWIDTH_VALNAME[]= {'S','c','r','o','l','l','W','i','d','t','h',0};
248 static const WCHAR METRICS_SCROLLHEIGHT_VALNAME[]= {'S','c','r','o','l','l','H','e','i','g','h','t',0};
249 static const WCHAR METRICS_CAPTIONWIDTH_VALNAME[]= {'C','a','p','t','i','o','n','W','i','d','t','h',0};
250 static const WCHAR METRICS_CAPTIONHEIGHT_VALNAME[]= {'C','a','p','t','i','o','n','H','e','i','g','h','t',0};
251 static const WCHAR METRICS_SMCAPTIONWIDTH_VALNAME[]= {'S','m','C','a','p','t','i','o','n','W','i','d','t','h',0};
252 static const WCHAR METRICS_SMCAPTIONHEIGHT_VALNAME[]= {'S','m','C','a','p','t','i','o','n','H','e','i','g','h','t',0};
253 static const WCHAR METRICS_MENUWIDTH_VALNAME[]= {'M','e','n','u','W','i','d','t','h',0};
254 static const WCHAR METRICS_MENUHEIGHT_VALNAME[]= {'M','e','n','u','H','e','i','g','h','t',0};
255 static const WCHAR METRICS_ICONSIZE_VALNAME[]= {'S','h','e','l','l',' ','I','c','o','n',' ','S','i','z','e',0};
256 static const WCHAR METRICS_BORDERWIDTH_VALNAME[]= {'B','o','r','d','e','r','W','i','d','t','h',0};
257 static const WCHAR METRICS_PADDEDBORDERWIDTH_VALNAME[]={'P','a','d','d','e','d','B','o','r','d','e','r','W','i','d','t','h',0};
258 static const WCHAR METRICS_CAPTIONLOGFONT_VALNAME[]= {'C','a','p','t','i','o','n','F','o','n','t',0};
259 static const WCHAR METRICS_SMCAPTIONLOGFONT_VALNAME[]={'S','m','C','a','p','t','i','o','n','F','o','n','t',0};
260 static const WCHAR METRICS_MENULOGFONT_VALNAME[]= {'M','e','n','u','F','o','n','t',0};
261 static const WCHAR METRICS_MESSAGELOGFONT_VALNAME[]= {'M','e','s','s','a','g','e','F','o','n','t',0};
262 static const WCHAR METRICS_STATUSLOGFONT_VALNAME[]= {'S','t','a','t','u','s','F','o','n','t',0};
263 /* minimized metrics */
264 static const WCHAR METRICS_MINWIDTH_VALNAME[] = {'M','i','n','W','i','d','t','h','\0'};
265 static const WCHAR METRICS_MINHORZGAP_VALNAME[] = {'M','i','n','H','o','r','z','G','a','p','\0'};
266 static const WCHAR METRICS_MINVERTGAP_VALNAME[] = {'M','i','n','V','e','r','t','G','a','p','\0'};
267 static const WCHAR METRICS_MINARRANGE_VALNAME[] = {'M','i','n','A','r','r','a','n','g','e','\0'};
269 static const WCHAR WINE_CURRENT_USER_REGKEY[] = {'S','o','f','t','w','a','r','e','\\',
272 /* volatile registry branch under WINE_CURRENT_USER_REGKEY for temporary values storage */
273 static const WCHAR WINE_CURRENT_USER_REGKEY_TEMP_PARAMS[] = {'T','e','m','p','o','r','a','r','y',' ',
274 'S','y','s','t','e','m',' ',
275 'P','a','r','a','m','e','t','e','r','s',0};
277 static const WCHAR Yes[]= {'Y','e','s',0};
278 static const WCHAR No[]= {'N','o',0};
279 static const WCHAR Desktop[]= {'D','e','s','k','t','o','p',0};
280 static const WCHAR Pattern[]= {'P','a','t','t','e','r','n',0};
281 static const WCHAR MenuFont[]= {'M','e','n','u','F','o','n','t',0};
282 static const WCHAR MenuFontSize[]= {'M','e','n','u','F','o','n','t','S','i','z','e',0};
283 static const WCHAR StatusFont[]= {'S','t','a','t','u','s','F','o','n','t',0};
284 static const WCHAR StatusFontSize[]= {'S','t','a','t','u','s','F','o','n','t','S','i','z','e',0};
285 static const WCHAR MessageFont[]= {'M','e','s','s','a','g','e','F','o','n','t',0};
286 static const WCHAR MessageFontSize[]= {'M','e','s','s','a','g','e','F','o','n','t','S','i','z','e',0};
287 static const WCHAR System[]= {'S','y','s','t','e','m',0};
288 static const WCHAR IconTitleSize[]= {'I','c','o','n','T','i','t','l','e','S','i','z','e',0};
289 static const WCHAR IconTitleFaceName[]= {'I','c','o','n','T','i','t','l','e','F','a','c','e','N','a','m','e',0};
290 static const WCHAR defPattern[]= {'0',' ','0',' ','0',' ','0',' ','0',' ','0',' ','0',' ','0',0};
291 static const WCHAR CSu[]= {'%','u',0};
292 static const WCHAR CSd[]= {'%','d',0};
294 /* Indicators whether system parameter value is loaded */
295 static char spi_loaded[SPI_INDEX_COUNT];
297 static BOOL notify_change = TRUE;
299 /* System parameters storage */
300 static BOOL beep_active = TRUE;
301 static int mouse_threshold1 = 6;
302 static int mouse_threshold2 = 10;
303 static int mouse_speed = 1;
304 static UINT border = 1;
305 static UINT keyboard_speed = 31;
306 static UINT screensave_timeout = 300;
307 static UINT grid_granularity = 0;
308 static UINT keyboard_delay = 1;
309 static UINT double_click_width = 4;
310 static UINT double_click_height = 4;
311 static UINT double_click_time = 500;
312 static BOOL drag_full_windows = FALSE;
313 static RECT work_area;
314 static BOOL keyboard_pref = TRUE;
315 static BOOL screen_reader = FALSE;
316 static UINT mouse_hover_width = 4;
317 static UINT mouse_hover_height = 4;
318 static UINT mouse_hover_time = 400;
319 static UINT mouse_scroll_chars = 3;
320 static UINT mouse_scroll_lines = 3;
321 static UINT menu_show_delay = 400;
322 static UINT menu_drop_alignment = 0;
323 static BOOL screensaver_running = FALSE;
324 static UINT font_smoothing = 0; /* 0x01 for 95/98/NT, 0x02 for 98/ME/2k/XP */
325 static BOOL lowpoweractive = FALSE;
326 static BOOL poweroffactive = FALSE;
327 static BOOL show_sounds = FALSE;
328 static BOOL snap_to_default_button = FALSE;
329 static BOOL swap_buttons = FALSE;
330 static UINT foreground_lock_timeout = 0;
331 static UINT caret_width = 1;
332 static UINT mouse_sensitivity = 10;
333 static UINT font_smoothing_type = 0;
334 static UINT font_smoothing_contrast = 0;
335 static UINT font_smoothing_orientation = 0;
336 static BYTE user_prefs[4];
338 static MINIMIZEDMETRICS minimized_metrics =
340 sizeof(MINIMIZEDMETRICS),
344 ARW_HIDE /* iArrange */
347 static ICONMETRICSW icon_metrics =
349 sizeof(ICONMETRICSW),
350 75, /* iHorzSpacing */
351 75, /* iVertSpacing */
352 TRUE, /* iTitleWrap */
353 { -11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET,
354 OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH } /* lfFont */
357 static NONCLIENTMETRICSW nonclient_metrics =
359 sizeof(NONCLIENTMETRICSW),
360 1, /* iBorderWidth */
361 16, /* iScrollWidth */
362 16, /* iScrollHeight */
363 18, /* iCaptionWidth */
364 18, /* iCaptionHeight */
365 { 0 }, /* lfCaptionFont */
366 13, /* iSmCaptionWidth */
367 15, /* iSmCaptionHeight */
368 { 0 }, /* lfSmCaptionFont */
370 18, /* iMenuHeight */
371 { 0 }, /* lfMenuFont */
372 { 0 }, /* lfStatusFont */
373 { 0 }, /* lfMessageFont */
374 0 /* iPaddedBorderWidth */
377 /* some additional non client metric info */
378 static TEXTMETRICW tmMenuFont;
379 static UINT CaptionFontAvCharWidth;
381 static SIZE icon_size = { 32, 32 };
383 #define NUM_SYS_COLORS (COLOR_MENUBAR+1)
385 static COLORREF SysColors[NUM_SYS_COLORS];
386 static HBRUSH SysColorBrushes[NUM_SYS_COLORS];
387 static HPEN SysColorPens[NUM_SYS_COLORS];
389 static const WORD wPattern55AA[] = { 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa };
391 HBRUSH SYSCOLOR_55AABrush = 0;
394 static void SYSPARAMS_LogFont16To32W( const LOGFONT16 *font16, LPLOGFONTW font32 )
396 font32->lfHeight = font16->lfHeight;
397 font32->lfWidth = font16->lfWidth;
398 font32->lfEscapement = font16->lfEscapement;
399 font32->lfOrientation = font16->lfOrientation;
400 font32->lfWeight = font16->lfWeight;
401 font32->lfItalic = font16->lfItalic;
402 font32->lfUnderline = font16->lfUnderline;
403 font32->lfStrikeOut = font16->lfStrikeOut;
404 font32->lfCharSet = font16->lfCharSet;
405 font32->lfOutPrecision = font16->lfOutPrecision;
406 font32->lfClipPrecision = font16->lfClipPrecision;
407 font32->lfQuality = font16->lfQuality;
408 font32->lfPitchAndFamily = font16->lfPitchAndFamily;
409 MultiByteToWideChar( CP_ACP, 0, font16->lfFaceName, -1, font32->lfFaceName, LF_FACESIZE );
410 font32->lfFaceName[LF_FACESIZE-1] = 0;
413 static void SYSPARAMS_LogFont32WTo32A( const LOGFONTW* font32W, LPLOGFONTA font32A )
415 font32A->lfHeight = font32W->lfHeight;
416 font32A->lfWidth = font32W->lfWidth;
417 font32A->lfEscapement = font32W->lfEscapement;
418 font32A->lfOrientation = font32W->lfOrientation;
419 font32A->lfWeight = font32W->lfWeight;
420 font32A->lfItalic = font32W->lfItalic;
421 font32A->lfUnderline = font32W->lfUnderline;
422 font32A->lfStrikeOut = font32W->lfStrikeOut;
423 font32A->lfCharSet = font32W->lfCharSet;
424 font32A->lfOutPrecision = font32W->lfOutPrecision;
425 font32A->lfClipPrecision = font32W->lfClipPrecision;
426 font32A->lfQuality = font32W->lfQuality;
427 font32A->lfPitchAndFamily = font32W->lfPitchAndFamily;
428 WideCharToMultiByte( CP_ACP, 0, font32W->lfFaceName, -1, font32A->lfFaceName, LF_FACESIZE, NULL, NULL );
429 font32A->lfFaceName[LF_FACESIZE-1] = 0;
432 static void SYSPARAMS_LogFont32ATo32W( const LOGFONTA* font32A, LPLOGFONTW font32W )
434 font32W->lfHeight = font32A->lfHeight;
435 font32W->lfWidth = font32A->lfWidth;
436 font32W->lfEscapement = font32A->lfEscapement;
437 font32W->lfOrientation = font32A->lfOrientation;
438 font32W->lfWeight = font32A->lfWeight;
439 font32W->lfItalic = font32A->lfItalic;
440 font32W->lfUnderline = font32A->lfUnderline;
441 font32W->lfStrikeOut = font32A->lfStrikeOut;
442 font32W->lfCharSet = font32A->lfCharSet;
443 font32W->lfOutPrecision = font32A->lfOutPrecision;
444 font32W->lfClipPrecision = font32A->lfClipPrecision;
445 font32W->lfQuality = font32A->lfQuality;
446 font32W->lfPitchAndFamily = font32A->lfPitchAndFamily;
447 MultiByteToWideChar( CP_ACP, 0, font32A->lfFaceName, -1, font32W->lfFaceName, LF_FACESIZE );
448 font32W->lfFaceName[LF_FACESIZE-1] = 0;
451 static void SYSPARAMS_NonClientMetrics32WTo32A( const NONCLIENTMETRICSW* lpnm32W, LPNONCLIENTMETRICSA lpnm32A )
453 lpnm32A->iBorderWidth = lpnm32W->iBorderWidth;
454 lpnm32A->iScrollWidth = lpnm32W->iScrollWidth;
455 lpnm32A->iScrollHeight = lpnm32W->iScrollHeight;
456 lpnm32A->iCaptionWidth = lpnm32W->iCaptionWidth;
457 lpnm32A->iCaptionHeight = lpnm32W->iCaptionHeight;
458 SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfCaptionFont, &lpnm32A->lfCaptionFont );
459 lpnm32A->iSmCaptionWidth = lpnm32W->iSmCaptionWidth;
460 lpnm32A->iSmCaptionHeight = lpnm32W->iSmCaptionHeight;
461 SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfSmCaptionFont, &lpnm32A->lfSmCaptionFont );
462 lpnm32A->iMenuWidth = lpnm32W->iMenuWidth;
463 lpnm32A->iMenuHeight = lpnm32W->iMenuHeight;
464 SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfMenuFont, &lpnm32A->lfMenuFont );
465 SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfStatusFont, &lpnm32A->lfStatusFont );
466 SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfMessageFont, &lpnm32A->lfMessageFont );
467 if (lpnm32A->cbSize > FIELD_OFFSET(NONCLIENTMETRICSA, iPaddedBorderWidth))
469 if (lpnm32W->cbSize > FIELD_OFFSET(NONCLIENTMETRICSW, iPaddedBorderWidth))
470 lpnm32A->iPaddedBorderWidth = lpnm32W->iPaddedBorderWidth;
472 lpnm32A->iPaddedBorderWidth = 0;
476 static void SYSPARAMS_NonClientMetrics32ATo32W( const NONCLIENTMETRICSA* lpnm32A, LPNONCLIENTMETRICSW lpnm32W )
478 lpnm32W->iBorderWidth = lpnm32A->iBorderWidth;
479 lpnm32W->iScrollWidth = lpnm32A->iScrollWidth;
480 lpnm32W->iScrollHeight = lpnm32A->iScrollHeight;
481 lpnm32W->iCaptionWidth = lpnm32A->iCaptionWidth;
482 lpnm32W->iCaptionHeight = lpnm32A->iCaptionHeight;
483 SYSPARAMS_LogFont32ATo32W( &lpnm32A->lfCaptionFont, &lpnm32W->lfCaptionFont );
484 lpnm32W->iSmCaptionWidth = lpnm32A->iSmCaptionWidth;
485 lpnm32W->iSmCaptionHeight = lpnm32A->iSmCaptionHeight;
486 SYSPARAMS_LogFont32ATo32W( &lpnm32A->lfSmCaptionFont, &lpnm32W->lfSmCaptionFont );
487 lpnm32W->iMenuWidth = lpnm32A->iMenuWidth;
488 lpnm32W->iMenuHeight = lpnm32A->iMenuHeight;
489 SYSPARAMS_LogFont32ATo32W( &lpnm32A->lfMenuFont, &lpnm32W->lfMenuFont );
490 SYSPARAMS_LogFont32ATo32W( &lpnm32A->lfStatusFont, &lpnm32W->lfStatusFont );
491 SYSPARAMS_LogFont32ATo32W( &lpnm32A->lfMessageFont, &lpnm32W->lfMessageFont );
492 if (lpnm32W->cbSize > FIELD_OFFSET(NONCLIENTMETRICSW, iPaddedBorderWidth))
494 if (lpnm32A->cbSize > FIELD_OFFSET(NONCLIENTMETRICSA, iPaddedBorderWidth))
495 lpnm32W->iPaddedBorderWidth = lpnm32A->iPaddedBorderWidth;
497 lpnm32W->iPaddedBorderWidth = 0;
502 /* Helper functions to retrieve monitors info */
510 static BOOL CALLBACK monitor_info_proc( HMONITOR monitor, HDC hdc, LPRECT rect, LPARAM lp )
512 struct monitor_info *info = (struct monitor_info *)lp;
514 UnionRect( &info->virtual_rect, &info->virtual_rect, rect );
518 static void get_monitors_info( struct monitor_info *info )
521 SetRectEmpty( &info->virtual_rect );
522 EnumDisplayMonitors( 0, NULL, monitor_info_proc, (LPARAM)info );
526 /* get text metrics and/or "average" char width of the specified logfont
527 * for the specified dc */
528 static void get_text_metr_size( HDC hdc, LOGFONTW *plf, TEXTMETRICW * ptm, UINT *psz)
530 HFONT hfont, hfontsav;
533 hfont = CreateFontIndirectW( plf);
534 if( !hfont || ( hfontsav = SelectObject( hdc, hfont)) == NULL ) {
537 if( hfont) DeleteObject( hfont);
540 GetTextMetricsW( hdc, ptm);
542 if( !(*psz = GdiGetCharDimensions( hdc, ptm, NULL)))
544 SelectObject( hdc, hfontsav);
545 DeleteObject( hfont);
548 /***********************************************************************
549 * get_volatile_regkey
551 * Return a handle to the volatile registry key used to store
552 * non-permanently modified parameters.
554 static HKEY get_volatile_regkey(void)
556 static HKEY volatile_key;
561 /* This must be non-volatile! */
562 if (RegCreateKeyExW( HKEY_CURRENT_USER, WINE_CURRENT_USER_REGKEY,
563 0, 0, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 0,
564 &key, 0 ) != ERROR_SUCCESS)
566 ERR("Can't create wine registry branch\n");
570 /* @@ Wine registry key: HKCU\Software\Wine\Temporary System Parameters */
571 if (RegCreateKeyExW( key, WINE_CURRENT_USER_REGKEY_TEMP_PARAMS,
572 0, 0, REG_OPTION_VOLATILE, KEY_ALL_ACCESS, 0,
573 &volatile_key, 0 ) != ERROR_SUCCESS)
574 ERR("Can't create non-permanent wine registry branch\n");
582 /***********************************************************************
583 * SYSPARAMS_NotifyChange
585 * Sends notification about system parameter update.
587 static void SYSPARAMS_NotifyChange( UINT uiAction, UINT fWinIni )
589 static const WCHAR emptyW[1];
593 if (fWinIni & SPIF_UPDATEINIFILE)
595 if (fWinIni & (SPIF_SENDWININICHANGE | SPIF_SENDCHANGE))
596 SendMessageTimeoutW(HWND_BROADCAST, WM_SETTINGCHANGE,
597 uiAction, (LPARAM) emptyW,
598 SMTO_ABORTIFHUNG, 2000, NULL );
602 /* FIXME notify other wine processes with internal message */
608 /***********************************************************************
609 * Loads system parameter from user profile.
611 static BOOL SYSPARAMS_LoadRaw( LPCWSTR lpRegKey, LPCWSTR lpValName, LPBYTE lpBuf, DWORD count )
617 memset( lpBuf, 0, count );
618 if ((RegOpenKeyW( get_volatile_regkey(), lpRegKey, &hKey ) == ERROR_SUCCESS) ||
619 (RegOpenKeyW( HKEY_CURRENT_USER, lpRegKey, &hKey ) == ERROR_SUCCESS))
621 ret = !RegQueryValueExW( hKey, lpValName, NULL, &type, lpBuf, &count);
627 static BOOL SYSPARAMS_Load( LPCWSTR lpRegKey, LPCWSTR lpValName, LPWSTR lpBuf, DWORD count )
629 return SYSPARAMS_LoadRaw( lpRegKey, lpValName, (LPBYTE)lpBuf, count );
632 /***********************************************************************
633 * Saves system parameter to user profile.
636 /* Save data as-is */
637 static BOOL SYSPARAMS_SaveRaw( LPCWSTR lpRegKey, LPCWSTR lpValName,
638 const BYTE* lpValue, DWORD valueSize,
639 DWORD type, UINT fWinIni )
646 if (fWinIni & SPIF_UPDATEINIFILE)
648 hBaseKey = HKEY_CURRENT_USER;
653 hBaseKey = get_volatile_regkey();
654 dwOptions = REG_OPTION_VOLATILE;
657 if (RegCreateKeyExW( hBaseKey, lpRegKey,
658 0, 0, dwOptions, KEY_ALL_ACCESS,
659 0, &hKey, 0 ) == ERROR_SUCCESS)
661 if (RegSetValueExW( hKey, lpValName, 0, type,
662 lpValue, valueSize) == ERROR_SUCCESS)
665 if (hBaseKey == HKEY_CURRENT_USER)
666 RegDeleteKeyW( get_volatile_regkey(), lpRegKey );
673 /* Convenience function to save strings */
674 static BOOL SYSPARAMS_Save( LPCWSTR lpRegKey, LPCWSTR lpValName, LPCWSTR lpValue,
677 return SYSPARAMS_SaveRaw( lpRegKey, lpValName, (const BYTE*)lpValue,
678 (strlenW(lpValue) + 1)*sizeof(WCHAR), REG_SZ, fWinIni );
681 /* Convenience function to save logical fonts */
682 static BOOL SYSPARAMS_SaveLogFont( LPCWSTR lpRegKey, LPCWSTR lpValName,
683 const LOGFONTW *plf, UINT fWinIni )
688 /* Zero pad the end of lfFaceName so we don't write uninitialised
689 data to the registry */
690 lf.lfFaceName[LF_FACESIZE-1] = 0;
691 len = strlenW(lf.lfFaceName);
692 if(len < LF_FACESIZE-1)
693 memset(lf.lfFaceName + len, 0, (LF_FACESIZE - 1 - len) * sizeof(WCHAR));
695 return SYSPARAMS_SaveRaw( lpRegKey, lpValName, (const BYTE*)&lf,
696 sizeof(LOGFONTW), REG_BINARY, fWinIni );
700 static inline HDC get_display_dc(void)
702 static const WCHAR DISPLAY[] = {'D','I','S','P','L','A','Y',0};
703 static HDC display_dc;
706 display_dc = CreateICW( DISPLAY, NULL, NULL, NULL );
707 __wine_make_gdi_object_system( display_dc, TRUE );
712 static inline int get_display_dpi(void)
714 static int display_dpi;
715 if (!display_dpi) display_dpi = GetDeviceCaps( get_display_dc(), LOGPIXELSY );
719 /***********************************************************************
720 * SYSPARAMS_Twips2Pixels
722 * Convert a dimension value that was obtained from the registry. These are
723 * quoted as being "twips" values if negative and pixels if positive.
724 * One inch is 1440 twips. So to convert, divide by 1440 to get inches and
725 * multiply that by the dots-per-inch to get the size in pixels.
727 * MSDN Library - April 2001 -> Resource Kits ->
728 * Windows 2000 Resource Kit Reference ->
729 * Technical Reference to the Windows 2000 Registry ->
730 * HKEY_CURRENT_USER -> Control Panel -> Desktop -> WindowMetrics
732 static inline int SYSPARAMS_Twips2Pixels(int x)
735 x = (-x * get_display_dpi() + 720) / 1440;
739 /***********************************************************************
742 * Get a registry entry from the already open key. This allows us to open the
743 * section once and read several values.
745 * Of course this function belongs somewhere more usable but here will do
748 static int get_reg_metric( HKEY hkey, LPCWSTR lpValName, int default_value )
750 int value = default_value;
754 DWORD type, count = sizeof(buffer);
755 if(!RegQueryValueExW( hkey, lpValName, NULL, &type, (LPBYTE)buffer, &count) )
759 /* Are there any utilities for converting registry entries
762 /* FIXME_(reg)("We need reg format converter\n"); */
765 value = atoiW(buffer);
768 return SYSPARAMS_Twips2Pixels(value);
772 /*************************************************************************
773 * SYSPARAMS_SetSysColor
775 static void SYSPARAMS_SetSysColor( int index, COLORREF color )
777 if (index < 0 || index >= NUM_SYS_COLORS) return;
778 SysColors[index] = color;
779 if (SysColorBrushes[index])
781 __wine_make_gdi_object_system( SysColorBrushes[index], FALSE);
782 DeleteObject( SysColorBrushes[index] );
784 SysColorBrushes[index] = CreateSolidBrush( color );
785 __wine_make_gdi_object_system( SysColorBrushes[index], TRUE);
787 if (SysColorPens[index])
789 __wine_make_gdi_object_system( SysColorPens[index], FALSE);
790 DeleteObject( SysColorPens[index] );
792 SysColorPens[index] = CreatePen( PS_SOLID, 1, color );
793 __wine_make_gdi_object_system( SysColorPens[index], TRUE);
796 /* load a uint parameter from the registry */
797 static BOOL get_uint_param( unsigned int idx, LPCWSTR regkey, LPCWSTR value,
798 UINT *value_ptr, UINT *ret_ptr )
800 if (!ret_ptr) return FALSE;
801 if (!spi_loaded[idx])
805 if (SYSPARAMS_Load( regkey, value, buf, sizeof(buf) )) *value_ptr = atoiW( buf );
806 spi_loaded[idx] = TRUE;
808 *ret_ptr = *value_ptr;
812 /* load a twips parameter from the registry */
813 static BOOL get_twips_param( unsigned int idx, LPCWSTR regkey, LPCWSTR value,
814 UINT *value_ptr, UINT *ret_ptr )
816 if (!ret_ptr) return FALSE;
817 if (!spi_loaded[idx])
821 if (SYSPARAMS_Load( regkey, value, buf, sizeof(buf) ))
822 *value_ptr = SYSPARAMS_Twips2Pixels( atoiW(buf) );
823 spi_loaded[idx] = TRUE;
825 *ret_ptr = *value_ptr;
829 /* load a boolean parameter from the registry */
830 static inline BOOL get_bool_param( unsigned int idx, LPCWSTR regkey, LPCWSTR value,
831 BOOL *value_ptr, BOOL *ret_ptr )
833 return get_uint_param( idx, regkey, value, (UINT *)value_ptr, (UINT *)ret_ptr );
836 /* set a uint parameter that is mirrored in two different registry locations */
837 static BOOL set_uint_param_mirrored( unsigned int idx, LPCWSTR regkey, LPCWSTR regkey_mirror,
838 LPCWSTR value, UINT *value_ptr, UINT new_val, UINT fWinIni )
842 wsprintfW(buf, CSu, new_val);
843 if (!SYSPARAMS_Save( regkey, value, buf, fWinIni )) return FALSE;
844 if (regkey_mirror) SYSPARAMS_Save( regkey_mirror, value, buf, fWinIni );
845 *value_ptr = new_val;
846 spi_loaded[idx] = TRUE;
850 /* save an int parameter in registry */
851 static BOOL save_int_param( LPCWSTR regkey, LPCWSTR value, INT *value_ptr,
852 INT new_val, UINT fWinIni )
856 wsprintfW(buf, CSd, new_val);
857 if (!SYSPARAMS_Save( regkey, value, buf, fWinIni )) return FALSE;
858 if( value_ptr) *value_ptr = new_val;
862 /* set an int parameter in the registry */
863 static inline BOOL set_int_param( unsigned int idx, LPCWSTR regkey, LPCWSTR value,
864 INT *value_ptr, INT new_val, UINT fWinIni )
866 BOOL ret = save_int_param( regkey, value, value_ptr, new_val, fWinIni );
867 if (ret) spi_loaded[idx] = TRUE;
871 /* set a uint parameter in the registry */
872 static inline BOOL set_uint_param( unsigned int idx, LPCWSTR regkey, LPCWSTR value,
873 UINT *value_ptr, UINT new_val, UINT fWinIni )
875 return set_uint_param_mirrored( idx, regkey, NULL, value, value_ptr, new_val, fWinIni );
878 /* set a boolean parameter that is mirrored in two different registry locations */
879 static inline BOOL set_bool_param_mirrored( unsigned int idx, LPCWSTR regkey, LPCWSTR regkey_mirror,
880 LPCWSTR value, BOOL *value_ptr, BOOL new_val, UINT fWinIni )
882 return set_uint_param_mirrored( idx, regkey, regkey_mirror, value,
883 (UINT *)value_ptr, new_val, fWinIni );
886 /* set a boolean parameter in the registry */
887 static inline BOOL set_bool_param( unsigned int idx, LPCWSTR regkey, LPCWSTR value,
888 BOOL *value_ptr, BOOL new_val, UINT fWinIni )
890 return set_uint_param( idx, regkey, value, (UINT *)value_ptr, new_val, fWinIni );
893 /* load a boolean parameter from the user preference key */
894 static BOOL get_user_pref_param( UINT offset, UINT mask, BOOL *ret_ptr )
896 if (!ret_ptr) return FALSE;
898 if (!spi_loaded[SPI_USERPREFERENCEMASK_IDX])
900 SYSPARAMS_LoadRaw( SPI_USERPREFERENCEMASK_REGKEY,
901 SPI_USERPREFERENCEMASK_VALNAME,
902 user_prefs, sizeof(user_prefs) );
903 spi_loaded[SPI_USERPREFERENCEMASK_IDX] = TRUE;
905 *ret_ptr = (user_prefs[offset] & mask) != 0;
909 /* set a boolean parameter in the user preference key */
910 static BOOL set_user_pref_param( UINT offset, UINT mask, BOOL value, BOOL fWinIni )
912 SYSPARAMS_LoadRaw( SPI_USERPREFERENCEMASK_REGKEY,
913 SPI_USERPREFERENCEMASK_VALNAME,
914 user_prefs, sizeof(user_prefs) );
915 spi_loaded[SPI_USERPREFERENCEMASK_IDX] = TRUE;
917 if (value) user_prefs[offset] |= mask;
918 else user_prefs[offset] &= ~mask;
920 SYSPARAMS_SaveRaw( SPI_USERPREFERENCEMASK_REGKEY,
921 SPI_USERPREFERENCEMASK_VALNAME,
922 user_prefs, sizeof(user_prefs), REG_BINARY, fWinIni );
926 /***********************************************************************
929 * Initialisation of the system metrics array.
931 void SYSPARAMS_Init(void)
933 HKEY hkey; /* key to the window metrics area of the registry */
938 /* initialize system colors */
940 if (RegCreateKeyExA(HKEY_CURRENT_USER, "Control Panel\\Colors", 0, 0, 0, KEY_ALL_ACCESS, 0, &hkey, 0))
942 for (i = 0; i < NUM_SYS_COLORS; i++)
946 /* first try, registry */
949 DWORD dwDataSize = sizeof(buffer);
950 if (!(RegQueryValueExA(hkey,DefSysColors[i].name, 0, 0, (LPBYTE) buffer, &dwDataSize)))
951 if (sscanf( buffer, "%d %d %d", &r, &g, &b ) == 3) bOk = TRUE;
954 /* second try, win.ini */
957 GetProfileStringA( "colors", DefSysColors[i].name, NULL, buffer, 100 );
958 if (sscanf( buffer, " %d %d %d", &r, &g, &b ) == 3) bOk = TRUE;
961 /* else, take the default */
963 SYSPARAMS_SetSysColor( i, DefSysColors[i].rgb );
965 SYSPARAMS_SetSysColor( i, RGB(r,g,b) );
967 if (hkey) RegCloseKey( hkey );
969 /* create 55AA bitmap */
971 h55AABitmap = CreateBitmap( 8, 8, 1, 1, wPattern55AA );
972 SYSCOLOR_55AABrush = CreatePatternBrush( h55AABitmap );
973 __wine_make_gdi_object_system( SYSCOLOR_55AABrush, TRUE );
977 /***********************************************************************
980 * Tries to retrieve logfont info from the specified key and value
982 static BOOL reg_get_logfont(LPCWSTR key, LPCWSTR value, LOGFONTW *lf)
991 base_keys[0] = get_volatile_regkey();
992 base_keys[1] = HKEY_CURRENT_USER;
994 for(i = 0; i < 2 && !found; i++)
996 if(RegOpenKeyW(base_keys[i], key, &hkey) == ERROR_SUCCESS)
998 size = sizeof(lfbuf);
999 if(RegQueryValueExW(hkey, value, NULL, &type, (LPBYTE)&lfbuf, &size) == ERROR_SUCCESS &&
1002 if( size == sizeof(lfbuf))
1005 memcpy(lf, &lfbuf, size);
1006 } else if( size == sizeof( LOGFONT16))
1007 { /* win9x-winME format */
1009 SYSPARAMS_LogFont16To32W( (LOGFONT16*) &lfbuf, lf);
1011 WARN("Unknown format in key %s value %s, size is %d\n",
1012 debugstr_w( key), debugstr_w( value), size);
1017 if( found && lf->lfHeight > 0) {
1018 /* positive height value means points ( inch/72 ) */
1019 lf->lfHeight = -MulDiv( lf->lfHeight, get_display_dpi(), 72);
1024 /* load all the minimized metrics */
1025 static void load_minimized_metrics(void)
1028 if (RegOpenKeyExW (HKEY_CURRENT_USER, METRICS_REGKEY,
1029 0, KEY_QUERY_VALUE, &hkey) != ERROR_SUCCESS) hkey = 0;
1031 minimized_metrics.iWidth = max( get_reg_metric(hkey,
1032 METRICS_MINWIDTH_VALNAME, minimized_metrics.iWidth), 0);
1033 minimized_metrics.iHorzGap = max( get_reg_metric(hkey,
1034 METRICS_MINHORZGAP_VALNAME, minimized_metrics.iHorzGap), 0);
1035 minimized_metrics.iVertGap = max( get_reg_metric(hkey,
1036 METRICS_MINVERTGAP_VALNAME, minimized_metrics.iVertGap), 0);
1037 minimized_metrics.iArrange = 0x0f & get_reg_metric(hkey,
1038 METRICS_MINARRANGE_VALNAME, minimized_metrics.iArrange);
1040 if (hkey) RegCloseKey( hkey );
1041 spi_loaded[SPI_MINIMIZEDMETRICS_IDX] = TRUE;
1044 /* adjust some of the raw values found in the registry */
1045 static void normalize_nonclientmetrics( NONCLIENTMETRICSW *pncm)
1048 if( pncm->iBorderWidth < 1) pncm->iBorderWidth = 1;
1049 if( pncm->iCaptionWidth < 8) pncm->iCaptionWidth = 8;
1050 if( pncm->iScrollWidth < 8) pncm->iScrollWidth = 8;
1051 if( pncm->iScrollHeight < 8) pncm->iScrollHeight = 8;
1053 /* get some extra metrics */
1054 get_text_metr_size( get_display_dc(), &pncm->lfMenuFont,
1056 get_text_metr_size( get_display_dc(), &pncm->lfCaptionFont,
1057 NULL, &CaptionFontAvCharWidth);
1059 /* adjust some heights to the corresponding font */
1060 pncm->iMenuHeight = max( pncm->iMenuHeight,
1061 2 + tmMenuFont.tmHeight + tmMenuFont.tmExternalLeading);
1062 get_text_metr_size( get_display_dc(), &pncm->lfCaptionFont, &tm, NULL);
1063 pncm->iCaptionHeight = max( pncm->iCaptionHeight, 2 + tm.tmHeight);
1064 get_text_metr_size( get_display_dc(), &pncm->lfSmCaptionFont, &tm, NULL);
1065 pncm->iSmCaptionHeight = max( pncm->iSmCaptionHeight, 2 + tm.tmHeight);
1068 /* load all the non-client metrics */
1069 static void load_nonclient_metrics(void)
1072 NONCLIENTMETRICSW ncm;
1075 ncm.cbSize = sizeof (ncm);
1076 if (RegOpenKeyExW (HKEY_CURRENT_USER, METRICS_REGKEY,
1077 0, KEY_QUERY_VALUE, &hkey) != ERROR_SUCCESS) hkey = 0;
1079 /* initialize geometry entries */
1080 ncm.iBorderWidth = get_reg_metric(hkey, METRICS_BORDERWIDTH_VALNAME, 1);
1081 ncm.iScrollWidth = get_reg_metric(hkey, METRICS_SCROLLWIDTH_VALNAME, 16);
1082 ncm.iScrollHeight = get_reg_metric(hkey, METRICS_SCROLLHEIGHT_VALNAME, 16);
1083 ncm.iPaddedBorderWidth = get_reg_metric(hkey, METRICS_PADDEDBORDERWIDTH_VALNAME, 0);
1085 /* size of the normal caption buttons */
1086 ncm.iCaptionHeight = get_reg_metric(hkey, METRICS_CAPTIONHEIGHT_VALNAME, 18);
1087 ncm.iCaptionWidth = get_reg_metric(hkey, METRICS_CAPTIONWIDTH_VALNAME, ncm.iCaptionHeight);
1089 /* caption font metrics */
1090 if (!reg_get_logfont(METRICS_REGKEY, METRICS_CAPTIONLOGFONT_VALNAME, &ncm.lfCaptionFont))
1092 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &ncm.lfCaptionFont, 0 );
1093 ncm.lfCaptionFont.lfWeight = FW_BOLD;
1096 /* size of the small caption buttons */
1097 ncm.iSmCaptionWidth = get_reg_metric(hkey, METRICS_SMCAPTIONWIDTH_VALNAME, 13);
1098 ncm.iSmCaptionHeight = get_reg_metric(hkey, METRICS_SMCAPTIONHEIGHT_VALNAME, 15);
1100 /* small caption font metrics */
1101 if (!reg_get_logfont(METRICS_REGKEY, METRICS_SMCAPTIONLOGFONT_VALNAME, &ncm.lfSmCaptionFont))
1102 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &ncm.lfSmCaptionFont, 0 );
1104 /* menus, FIXME: names of registry entries are bogus */
1106 /* size of the menu (MDI) buttons */
1107 ncm.iMenuHeight = get_reg_metric(hkey, METRICS_MENUHEIGHT_VALNAME, 18);
1108 ncm.iMenuWidth = get_reg_metric(hkey, METRICS_MENUWIDTH_VALNAME, ncm.iMenuHeight);
1110 /* menu font metrics */
1111 if (!reg_get_logfont(METRICS_REGKEY, METRICS_MENULOGFONT_VALNAME, &ncm.lfMenuFont))
1113 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &ncm.lfMenuFont, 0 );
1114 GetProfileStringW( Desktop, MenuFont, ncm.lfCaptionFont.lfFaceName,
1115 ncm.lfMenuFont.lfFaceName, LF_FACESIZE );
1116 r = GetProfileIntW( Desktop, MenuFontSize, 0 );
1118 ncm.lfMenuFont.lfHeight = -r;
1119 ncm.lfMenuFont.lfWeight = FW_NORMAL;
1122 /* status bar font metrics */
1123 if (!reg_get_logfont(METRICS_REGKEY, METRICS_STATUSLOGFONT_VALNAME, &ncm.lfStatusFont))
1125 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &ncm.lfStatusFont, 0 );
1126 GetProfileStringW( Desktop, StatusFont, ncm.lfCaptionFont.lfFaceName,
1127 ncm.lfStatusFont.lfFaceName, LF_FACESIZE );
1128 r = GetProfileIntW( Desktop, StatusFontSize, 0 );
1130 ncm.lfStatusFont.lfHeight = -r;
1131 ncm.lfStatusFont.lfWeight = FW_NORMAL;
1134 /* message font metrics */
1135 if (!reg_get_logfont(METRICS_REGKEY, METRICS_MESSAGELOGFONT_VALNAME, &ncm.lfMessageFont))
1137 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &ncm.lfMessageFont, 0 );
1138 GetProfileStringW( Desktop, MessageFont, ncm.lfCaptionFont.lfFaceName,
1139 ncm.lfMessageFont.lfFaceName, LF_FACESIZE );
1140 r = GetProfileIntW( Desktop, MessageFontSize, 0 );
1142 ncm.lfMessageFont.lfHeight = -r;
1143 ncm.lfMessageFont.lfWeight = FW_NORMAL;
1146 /* some extra fields not in the nonclient structure */
1147 icon_size.cx = icon_size.cy = get_reg_metric( hkey, METRICS_ICONSIZE_VALNAME, 32 );
1149 if (hkey) RegCloseKey( hkey );
1150 normalize_nonclientmetrics( &ncm);
1151 nonclient_metrics = ncm;
1152 spi_loaded[SPI_NONCLIENTMETRICS_IDX] = TRUE;
1155 static BOOL CALLBACK enum_monitors( HMONITOR monitor, HDC hdc, LPRECT rect, LPARAM lp )
1159 mi.cbSize = sizeof(mi);
1160 if (GetMonitorInfoW( monitor, &mi ) && (mi.dwFlags & MONITORINFOF_PRIMARY))
1162 LPRECT work = (LPRECT)lp;
1169 /***********************************************************************
1170 * SystemParametersInfoW (USER32.@)
1172 * Each system parameter has flag which shows whether the parameter
1173 * is loaded or not. Parameters, stored directly in SysParametersInfo are
1174 * loaded from registry only when they are requested and the flag is
1175 * "false", after the loading the flag is set to "true". On interprocess
1176 * notification of the parameter change the corresponding parameter flag is
1177 * set to "false". The parameter value will be reloaded when it is requested
1179 * Parameters, backed by or depend on GetSystemMetrics are processed
1180 * differently. These parameters are always loaded. They are reloaded right
1181 * away on interprocess change notification. We can't do lazy loading because
1182 * we don't want to complicate GetSystemMetrics.
1183 * Parameters, backed by X settings are read from corresponding setting.
1184 * On the parameter change request the setting is changed. Interprocess change
1185 * notifications are ignored.
1186 * When parameter value is updated the changed value is stored in permanent
1187 * registry branch if saving is requested. Otherwise it is stored
1188 * in temporary branch
1190 * Some SPI values can also be stored as Twips values in the registry,
1191 * don't forget the conversion!
1193 BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
1194 PVOID pvParam, UINT fWinIni )
1196 #define WINE_SPI_FIXME(x) \
1199 static BOOL warn = TRUE; \
1203 FIXME( "Unimplemented action: %u (%s)\n", x, #x ); \
1206 SetLastError( ERROR_INVALID_SPI_VALUE ); \
1209 #define WINE_SPI_WARN(x) \
1211 WARN( "Ignored action: %u (%s)\n", x, #x ); \
1215 unsigned spi_idx = 0;
1219 case SPI_GETBEEP: /* 1 */
1220 if (!pvParam) return FALSE;
1222 spi_idx = SPI_SETBEEP_IDX;
1223 if (!spi_loaded[spi_idx])
1227 if (SYSPARAMS_Load( SPI_SETBEEP_REGKEY, SPI_SETBEEP_VALNAME, buf, sizeof(buf) ))
1228 beep_active = !lstrcmpiW( Yes, buf );
1229 spi_loaded[spi_idx] = TRUE;
1232 *(BOOL *)pvParam = beep_active;
1235 case SPI_SETBEEP: /* 2 */
1236 spi_idx = SPI_SETBEEP_IDX;
1237 if (SYSPARAMS_Save( SPI_SETBEEP_REGKEY, SPI_SETBEEP_VALNAME,
1238 (uiParam ? Yes : No), fWinIni ))
1240 beep_active = uiParam;
1241 spi_loaded[spi_idx] = TRUE;
1247 case SPI_GETMOUSE: /* 3 */
1248 if (!pvParam) return FALSE;
1250 spi_idx = SPI_SETMOUSE_IDX;
1251 if (!spi_loaded[spi_idx])
1255 if (SYSPARAMS_Load( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME1,
1257 mouse_threshold1 = atoiW( buf );
1258 if (SYSPARAMS_Load( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME2,
1260 mouse_threshold2 = atoiW( buf );
1261 if (SYSPARAMS_Load( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME3,
1263 mouse_speed = atoiW( buf );
1264 spi_loaded[spi_idx] = TRUE;
1266 ((INT *)pvParam)[0] = mouse_threshold1;
1267 ((INT *)pvParam)[1] = mouse_threshold2;
1268 ((INT *)pvParam)[2] = mouse_speed;
1271 case SPI_SETMOUSE: /* 4 */
1273 if (!pvParam) return FALSE;
1274 ret = set_int_param( SPI_SETMOUSE_IDX, SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME1,
1275 &mouse_threshold1, ((INT *)pvParam)[0], fWinIni);
1277 save_int_param( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME2,
1278 &mouse_threshold2, ((INT *)pvParam)[1], fWinIni);
1279 save_int_param( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME3,
1280 &mouse_speed, ((INT *)pvParam)[2], fWinIni);
1286 ret = get_twips_param( SPI_SETBORDER_IDX,
1287 SPI_SETBORDER_REGKEY,
1288 SPI_SETBORDER_VALNAME,
1290 if( *(INT*)pvParam < 1) *(INT*)pvParam = 1;
1294 nonclient_metrics.iBorderWidth = uiParam > 0 ? uiParam : 1;
1295 /* raw value goes to registry */
1296 ret = set_uint_param( SPI_SETBORDER_IDX,
1297 SPI_SETBORDER_REGKEY,
1298 SPI_SETBORDER_VALNAME,
1299 &border, uiParam, fWinIni );
1302 case SPI_GETKEYBOARDSPEED:
1303 ret = get_uint_param( SPI_SETKEYBOARDSPEED_IDX,
1304 SPI_SETKEYBOARDSPEED_REGKEY,
1305 SPI_SETKEYBOARDSPEED_VALNAME,
1306 &keyboard_speed, pvParam );
1309 case SPI_SETKEYBOARDSPEED:
1310 if (uiParam > 31) uiParam = 31;
1311 ret = set_uint_param( SPI_SETKEYBOARDSPEED_IDX,
1312 SPI_SETKEYBOARDSPEED_REGKEY,
1313 SPI_SETKEYBOARDSPEED_VALNAME,
1314 &keyboard_speed, uiParam, fWinIni );
1317 /* not implemented in Windows */
1318 WINE_SPI_WARN(SPI_LANGDRIVER); /* 12 */
1320 case SPI_ICONHORIZONTALSPACING:
1321 if (pvParam != NULL)
1323 ret = get_twips_param( SPI_ICONHORIZONTALSPACING_IDX,
1324 SPI_ICONHORIZONTALSPACING_REGKEY,
1325 SPI_ICONHORIZONTALSPACING_VALNAME,
1326 (UINT*)&icon_metrics.iHorzSpacing, pvParam );
1330 if (uiParam < 32) uiParam = 32;
1331 ret = set_uint_param( SPI_ICONHORIZONTALSPACING_IDX,
1332 SPI_ICONHORIZONTALSPACING_REGKEY,
1333 SPI_ICONHORIZONTALSPACING_VALNAME,
1334 (UINT*)&icon_metrics.iHorzSpacing, uiParam, fWinIni );
1338 case SPI_GETSCREENSAVETIMEOUT:
1339 ret = get_uint_param( SPI_SETSCREENSAVETIMEOUT_IDX,
1340 SPI_SETSCREENSAVETIMEOUT_REGKEY,
1341 SPI_SETSCREENSAVETIMEOUT_VALNAME,
1342 &screensave_timeout, pvParam );
1345 case SPI_SETSCREENSAVETIMEOUT:
1346 ret = set_uint_param( SPI_SETSCREENSAVETIMEOUT_IDX,
1347 SPI_SETSCREENSAVETIMEOUT_REGKEY,
1348 SPI_SETSCREENSAVETIMEOUT_VALNAME,
1349 &screensave_timeout, uiParam, fWinIni );
1352 case SPI_GETSCREENSAVEACTIVE: /* 16 */
1353 if (!pvParam) return FALSE;
1354 *(BOOL *)pvParam = USER_Driver->pGetScreenSaveActive();
1357 case SPI_SETSCREENSAVEACTIVE: /* 17 */
1361 wsprintfW(buf, CSu, uiParam);
1362 USER_Driver->pSetScreenSaveActive( uiParam );
1363 /* saved value does not affect Wine */
1364 SYSPARAMS_Save( SPI_SETSCREENSAVEACTIVE_REGKEY,
1365 SPI_SETSCREENSAVEACTIVE_VALNAME,
1370 case SPI_GETGRIDGRANULARITY:
1371 ret = get_uint_param( SPI_SETGRIDGRANULARITY_IDX,
1372 SPI_SETGRIDGRANULARITY_REGKEY,
1373 SPI_SETGRIDGRANULARITY_VALNAME,
1374 &grid_granularity, pvParam );
1377 case SPI_SETGRIDGRANULARITY:
1378 ret = set_uint_param( SPI_SETGRIDGRANULARITY_IDX,
1379 SPI_SETGRIDGRANULARITY_REGKEY,
1380 SPI_SETGRIDGRANULARITY_VALNAME,
1381 &grid_granularity, uiParam, fWinIni );
1384 case SPI_SETDESKWALLPAPER: /* 20 */
1385 if (!pvParam || !SetDeskWallPaper( pvParam )) return FALSE;
1386 SYSPARAMS_Save(SPI_SETDESKWALLPAPER_REGKEY, SPI_SETDESKWALLPAPER_VALNAME, pvParam, fWinIni);
1389 case SPI_SETDESKPATTERN: /* 21 */
1390 /* FIXME: the ability to specify a pattern in pvParam
1391 doesn't seem to be documented for Win32 */
1392 if ((INT16)uiParam == -1)
1395 GetProfileStringW( Desktop, Pattern,
1397 buf, sizeof(buf)/sizeof(WCHAR) );
1398 ret = DESKTOP_SetPattern( buf );
1400 ret = DESKTOP_SetPattern( pvParam );
1403 case SPI_GETKEYBOARDDELAY:
1404 ret = get_uint_param( SPI_SETKEYBOARDDELAY_IDX,
1405 SPI_SETKEYBOARDDELAY_REGKEY,
1406 SPI_SETKEYBOARDDELAY_VALNAME,
1407 &keyboard_delay, pvParam );
1410 case SPI_SETKEYBOARDDELAY:
1411 ret = set_uint_param( SPI_SETKEYBOARDDELAY_IDX,
1412 SPI_SETKEYBOARDDELAY_REGKEY,
1413 SPI_SETKEYBOARDDELAY_VALNAME,
1414 &keyboard_delay, uiParam, fWinIni );
1417 case SPI_ICONVERTICALSPACING:
1418 if (pvParam != NULL)
1420 ret = get_twips_param( SPI_ICONVERTICALSPACING_IDX,
1421 SPI_ICONVERTICALSPACING_REGKEY,
1422 SPI_ICONVERTICALSPACING_VALNAME,
1423 (UINT*)&icon_metrics.iVertSpacing, pvParam );
1424 if( icon_metrics.iVertSpacing < 32)
1425 icon_metrics.iVertSpacing = 32;
1429 if (uiParam < 32) uiParam = 32;
1430 ret = set_uint_param( SPI_ICONVERTICALSPACING_IDX,
1431 SPI_ICONVERTICALSPACING_REGKEY,
1432 SPI_ICONVERTICALSPACING_VALNAME,
1433 (UINT*)&icon_metrics.iVertSpacing, uiParam, fWinIni );
1437 case SPI_GETICONTITLEWRAP:
1438 ret = get_bool_param( SPI_SETICONTITLEWRAP_IDX,
1439 SPI_SETICONTITLEWRAP_REGKEY1,
1440 SPI_SETICONTITLEWRAP_VALNAME,
1441 &icon_metrics.iTitleWrap, pvParam );
1444 case SPI_SETICONTITLEWRAP:
1445 ret = set_bool_param_mirrored( SPI_SETICONTITLEWRAP_IDX,
1446 SPI_SETICONTITLEWRAP_REGKEY1,
1447 SPI_SETICONTITLEWRAP_REGKEY2,
1448 SPI_SETICONTITLEWRAP_VALNAME,
1449 &icon_metrics.iTitleWrap, uiParam, fWinIni );
1452 case SPI_GETMENUDROPALIGNMENT:
1453 ret = get_uint_param( SPI_SETMENUDROPALIGNMENT_IDX,
1454 SPI_SETMENUDROPALIGNMENT_REGKEY1,
1455 SPI_SETMENUDROPALIGNMENT_VALNAME,
1456 &menu_drop_alignment, pvParam );
1459 case SPI_SETMENUDROPALIGNMENT:
1460 ret = set_uint_param_mirrored( SPI_SETMENUDROPALIGNMENT_IDX,
1461 SPI_SETMENUDROPALIGNMENT_REGKEY1,
1462 SPI_SETMENUDROPALIGNMENT_REGKEY2,
1463 SPI_SETMENUDROPALIGNMENT_VALNAME,
1464 &menu_drop_alignment, uiParam, fWinIni );
1467 case SPI_SETDOUBLECLKWIDTH:
1468 ret = set_uint_param_mirrored( SPI_SETDOUBLECLKWIDTH_IDX,
1469 SPI_SETDOUBLECLKWIDTH_REGKEY1,
1470 SPI_SETDOUBLECLKWIDTH_REGKEY2,
1471 SPI_SETDOUBLECLKWIDTH_VALNAME,
1472 &double_click_width, uiParam, fWinIni );
1475 case SPI_SETDOUBLECLKHEIGHT:
1476 ret = set_uint_param_mirrored( SPI_SETDOUBLECLKHEIGHT_IDX,
1477 SPI_SETDOUBLECLKHEIGHT_REGKEY1,
1478 SPI_SETDOUBLECLKHEIGHT_REGKEY2,
1479 SPI_SETDOUBLECLKHEIGHT_VALNAME,
1480 &double_click_height, uiParam, fWinIni );
1483 case SPI_GETICONTITLELOGFONT:
1487 if (!pvParam) return FALSE;
1489 spi_idx = SPI_SETICONTITLELOGFONT_IDX;
1490 if (!spi_loaded[spi_idx])
1492 if (!reg_get_logfont( SPI_SETICONTITLELOGFONT_REGKEY,
1493 SPI_SETICONTITLELOGFONT_VALNAME, &icon_metrics.lfFont ))
1498 * The 'default GDI fonts' seems to be returned.
1499 * If a returned font is not a correct font in your environment,
1500 * please try to fix objects/gdiobj.c at first.
1502 GetObjectW( GetStockObject( DEFAULT_GUI_FONT ), sizeof(LOGFONTW), &lfDefault );
1504 GetProfileStringW( Desktop, IconTitleFaceName,
1505 lfDefault.lfFaceName,
1506 icon_metrics.lfFont.lfFaceName,
1509 r = GetProfileIntW( Desktop, IconTitleSize, 0 );
1511 icon_metrics.lfFont.lfHeight = -r;
1513 icon_metrics.lfFont.lfHeight = lfDefault.lfHeight;
1515 icon_metrics.lfFont.lfWidth = 0;
1516 icon_metrics.lfFont.lfEscapement = icon_metrics.lfFont.lfOrientation = 0;
1517 icon_metrics.lfFont.lfWeight = FW_NORMAL;
1518 icon_metrics.lfFont.lfItalic = FALSE;
1519 icon_metrics.lfFont.lfStrikeOut = FALSE;
1520 icon_metrics.lfFont.lfUnderline = FALSE;
1521 icon_metrics.lfFont.lfCharSet = lfDefault.lfCharSet; /* at least 'charset' should not be hard-coded */
1522 icon_metrics.lfFont.lfOutPrecision = OUT_DEFAULT_PRECIS;
1523 icon_metrics.lfFont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
1524 icon_metrics.lfFont.lfQuality = DEFAULT_QUALITY;
1525 icon_metrics.lfFont.lfPitchAndFamily = DEFAULT_PITCH;
1526 spi_loaded[spi_idx] = TRUE;
1529 *(LOGFONTW *)pvParam = icon_metrics.lfFont;
1533 case SPI_SETDOUBLECLICKTIME:
1534 ret = set_uint_param( SPI_SETDOUBLECLICKTIME_IDX,
1535 SPI_SETDOUBLECLICKTIME_REGKEY,
1536 SPI_SETDOUBLECLICKTIME_VALNAME,
1537 &double_click_time, uiParam, fWinIni );
1540 case SPI_SETMOUSEBUTTONSWAP:
1541 ret = set_bool_param( SPI_SETMOUSEBUTTONSWAP_IDX,
1542 SPI_SETMOUSEBUTTONSWAP_REGKEY,
1543 SPI_SETMOUSEBUTTONSWAP_VALNAME,
1544 &swap_buttons, uiParam, fWinIni );
1547 case SPI_SETICONTITLELOGFONT: /* 34 */
1548 if( uiParam == sizeof(LOGFONTW)) {
1549 ret = SYSPARAMS_SaveLogFont( SPI_SETICONTITLELOGFONT_REGKEY,
1550 SPI_SETICONTITLELOGFONT_VALNAME, pvParam, fWinIni);
1552 icon_metrics.lfFont = *(LOGFONTW *)pvParam;
1553 spi_loaded[SPI_SETICONTITLELOGFONT_IDX] = TRUE;
1559 case SPI_GETFASTTASKSWITCH: /* 35 */
1560 if (!pvParam) return FALSE;
1561 *(BOOL *)pvParam = 1;
1564 case SPI_SETFASTTASKSWITCH: /* 36 */
1565 /* the action is disabled */
1569 case SPI_SETDRAGFULLWINDOWS:
1570 ret = set_bool_param( SPI_SETDRAGFULLWINDOWS_IDX,
1571 SPI_SETDRAGFULLWINDOWS_REGKEY,
1572 SPI_SETDRAGFULLWINDOWS_VALNAME,
1573 &drag_full_windows, uiParam, fWinIni );
1576 case SPI_GETDRAGFULLWINDOWS:
1577 ret = get_bool_param( SPI_SETDRAGFULLWINDOWS_IDX,
1578 SPI_SETDRAGFULLWINDOWS_REGKEY,
1579 SPI_SETDRAGFULLWINDOWS_VALNAME,
1580 &drag_full_windows, pvParam );
1583 case SPI_GETNONCLIENTMETRICS:
1585 LPNONCLIENTMETRICSW lpnm = pvParam;
1593 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
1595 if (lpnm->cbSize == sizeof(NONCLIENTMETRICSW))
1596 *lpnm = nonclient_metrics;
1597 else if (lpnm->cbSize == FIELD_OFFSET(NONCLIENTMETRICSW, iPaddedBorderWidth))
1599 memcpy(lpnm, &nonclient_metrics, FIELD_OFFSET(NONCLIENTMETRICSW, iPaddedBorderWidth));
1600 lpnm->cbSize = FIELD_OFFSET(NONCLIENTMETRICSW, iPaddedBorderWidth);
1607 case SPI_SETNONCLIENTMETRICS:
1609 LPNONCLIENTMETRICSW lpnm = pvParam;
1611 if (lpnm && (lpnm->cbSize == sizeof(NONCLIENTMETRICSW) ||
1612 lpnm->cbSize == FIELD_OFFSET(NONCLIENTMETRICSW, iPaddedBorderWidth)))
1614 NONCLIENTMETRICSW ncm;
1615 ret = set_uint_param( SPI_SETBORDER_IDX,
1616 SPI_SETBORDER_REGKEY, SPI_SETBORDER_VALNAME,
1617 &border, lpnm->iBorderWidth, fWinIni );
1618 if( ret) ret = save_int_param( METRICS_REGKEY,
1619 METRICS_SCROLLWIDTH_VALNAME, NULL,
1620 lpnm->iScrollWidth, fWinIni );
1621 if( ret) ret = save_int_param( METRICS_REGKEY,
1622 METRICS_SCROLLHEIGHT_VALNAME, NULL,
1623 lpnm->iScrollHeight, fWinIni );
1624 if( ret) ret = save_int_param( METRICS_REGKEY,
1625 METRICS_CAPTIONWIDTH_VALNAME, NULL,
1626 lpnm->iCaptionWidth, fWinIni );
1627 if( ret) ret = save_int_param( METRICS_REGKEY,
1628 METRICS_CAPTIONHEIGHT_VALNAME, NULL,
1629 lpnm->iCaptionHeight, fWinIni );
1630 if( ret) ret = save_int_param( METRICS_REGKEY,
1631 METRICS_SMCAPTIONWIDTH_VALNAME, NULL,
1632 lpnm->iSmCaptionWidth, fWinIni );
1633 if( ret) ret = save_int_param( METRICS_REGKEY,
1634 METRICS_SMCAPTIONHEIGHT_VALNAME, NULL,
1635 lpnm->iSmCaptionHeight, fWinIni );
1636 if( ret) ret = save_int_param( METRICS_REGKEY,
1637 METRICS_MENUWIDTH_VALNAME, NULL,
1638 lpnm->iMenuWidth, fWinIni );
1639 if( ret) ret = save_int_param( METRICS_REGKEY,
1640 METRICS_MENUHEIGHT_VALNAME, NULL,
1641 lpnm->iMenuHeight, fWinIni );
1642 if( ret) ret = SYSPARAMS_SaveLogFont(
1643 METRICS_REGKEY, METRICS_MENULOGFONT_VALNAME,
1644 &lpnm->lfMenuFont, fWinIni);
1645 if( ret) ret = SYSPARAMS_SaveLogFont(
1646 METRICS_REGKEY, METRICS_CAPTIONLOGFONT_VALNAME,
1647 &lpnm->lfCaptionFont, fWinIni);
1648 if( ret) ret = SYSPARAMS_SaveLogFont(
1649 METRICS_REGKEY, METRICS_SMCAPTIONLOGFONT_VALNAME,
1650 &lpnm->lfSmCaptionFont, fWinIni);
1651 if( ret) ret = SYSPARAMS_SaveLogFont(
1652 METRICS_REGKEY, METRICS_STATUSLOGFONT_VALNAME,
1653 &lpnm->lfStatusFont, fWinIni);
1654 if( ret) ret = SYSPARAMS_SaveLogFont(
1655 METRICS_REGKEY, METRICS_MESSAGELOGFONT_VALNAME,
1656 &lpnm->lfMessageFont, fWinIni);
1658 memcpy(&ncm, lpnm, FIELD_OFFSET(NONCLIENTMETRICSW, iPaddedBorderWidth));
1659 ncm.cbSize = sizeof(ncm);
1660 ncm.iPaddedBorderWidth = (lpnm->cbSize == sizeof(NONCLIENTMETRICSW)) ?
1661 lpnm->iPaddedBorderWidth : 0;
1662 normalize_nonclientmetrics( &ncm);
1663 nonclient_metrics = ncm;
1664 spi_loaded[SPI_NONCLIENTMETRICS_IDX] = TRUE;
1670 case SPI_GETMINIMIZEDMETRICS:
1672 MINIMIZEDMETRICS * lpMm = pvParam;
1673 if (lpMm && lpMm->cbSize == sizeof(*lpMm)) {
1674 if( spi_loaded[SPI_MINIMIZEDMETRICS_IDX]) load_minimized_metrics();
1675 *lpMm = minimized_metrics;
1681 case SPI_SETMINIMIZEDMETRICS:
1683 MINIMIZEDMETRICS * lpMm = pvParam;
1684 if (lpMm && lpMm->cbSize == sizeof(*lpMm)) {
1685 ret = save_int_param( METRICS_REGKEY, METRICS_MINWIDTH_VALNAME,
1686 &minimized_metrics.iWidth, max( lpMm->iWidth, 0), fWinIni);
1687 if( ret) ret = save_int_param( METRICS_REGKEY,
1688 METRICS_MINHORZGAP_VALNAME, &minimized_metrics.iHorzGap,
1689 max( lpMm->iHorzGap, 0), fWinIni);
1690 if( ret) ret = save_int_param( METRICS_REGKEY,
1691 METRICS_MINVERTGAP_VALNAME, &minimized_metrics.iVertGap,
1692 max( lpMm->iVertGap, 0), fWinIni);
1693 if( ret) ret = save_int_param( METRICS_REGKEY,
1694 METRICS_MINARRANGE_VALNAME, &minimized_metrics.iArrange,
1695 0x0f & lpMm->iArrange, fWinIni);
1696 if( ret) spi_loaded[SPI_MINIMIZEDMETRICS_IDX] = TRUE;
1702 case SPI_GETICONMETRICS:
1704 LPICONMETRICSW lpIcon = pvParam;
1705 if(lpIcon && lpIcon->cbSize == sizeof(*lpIcon))
1707 SystemParametersInfoW( SPI_ICONHORIZONTALSPACING, 0,
1708 &lpIcon->iHorzSpacing, FALSE );
1709 SystemParametersInfoW( SPI_ICONVERTICALSPACING, 0,
1710 &lpIcon->iVertSpacing, FALSE );
1711 SystemParametersInfoW( SPI_GETICONTITLEWRAP, 0,
1712 &lpIcon->iTitleWrap, FALSE );
1713 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0,
1714 &lpIcon->lfFont, FALSE );
1723 case SPI_SETICONMETRICS:
1725 LPICONMETRICSW lpIcon = pvParam;
1726 if (lpIcon && lpIcon->cbSize == sizeof(*lpIcon)) {
1727 ret = set_int_param( SPI_ICONVERTICALSPACING_IDX,
1728 SPI_ICONVERTICALSPACING_REGKEY,
1729 SPI_ICONVERTICALSPACING_VALNAME,
1730 &icon_metrics.iVertSpacing,
1731 lpIcon->iVertSpacing, fWinIni);
1733 ret = set_int_param( SPI_ICONHORIZONTALSPACING_IDX,
1734 SPI_ICONHORIZONTALSPACING_REGKEY,
1735 SPI_ICONHORIZONTALSPACING_VALNAME,
1736 &icon_metrics.iHorzSpacing,
1737 lpIcon->iHorzSpacing, fWinIni );
1740 ret = set_bool_param_mirrored( SPI_SETICONTITLEWRAP_IDX,
1741 SPI_SETICONTITLEWRAP_REGKEY1, SPI_SETICONTITLEWRAP_REGKEY2,
1742 SPI_SETICONTITLEWRAP_VALNAME, &icon_metrics.iTitleWrap,
1743 lpIcon->iTitleWrap, fWinIni );
1745 if( ret) ret = SYSPARAMS_SaveLogFont( SPI_SETICONTITLELOGFONT_REGKEY,
1746 SPI_SETICONTITLELOGFONT_VALNAME, &lpIcon->lfFont, fWinIni);
1748 icon_metrics.lfFont = lpIcon->lfFont;
1749 spi_loaded[SPI_SETICONTITLELOGFONT_IDX] = TRUE;
1756 case SPI_SETWORKAREA: /* 47 WINVER >= 0x400 */
1758 if (!pvParam) return FALSE;
1760 spi_idx = SPI_SETWORKAREA_IDX;
1761 CopyRect( &work_area, pvParam );
1762 spi_loaded[spi_idx] = TRUE;
1766 case SPI_GETWORKAREA: /* 48 WINVER >= 0x400 */
1768 if (!pvParam) return FALSE;
1770 spi_idx = SPI_SETWORKAREA_IDX;
1771 if (!spi_loaded[spi_idx])
1773 SetRect( &work_area, 0, 0,
1774 GetSystemMetrics( SM_CXSCREEN ),
1775 GetSystemMetrics( SM_CYSCREEN ) );
1776 EnumDisplayMonitors( 0, NULL, enum_monitors, (LPARAM)&work_area );
1777 spi_loaded[spi_idx] = TRUE;
1779 CopyRect( pvParam, &work_area );
1780 TRACE("work area %s\n", wine_dbgstr_rect( &work_area ));
1784 WINE_SPI_FIXME(SPI_SETPENWINDOWS); /* 49 WINVER >= 0x400 */
1786 case SPI_GETFILTERKEYS: /* 50 */
1788 LPFILTERKEYS lpFilterKeys = pvParam;
1789 WARN("SPI_GETFILTERKEYS not fully implemented\n");
1790 if (lpFilterKeys && lpFilterKeys->cbSize == sizeof(FILTERKEYS))
1792 /* Indicate that no FilterKeys feature available */
1793 lpFilterKeys->dwFlags = 0;
1794 lpFilterKeys->iWaitMSec = 0;
1795 lpFilterKeys->iDelayMSec = 0;
1796 lpFilterKeys->iRepeatMSec = 0;
1797 lpFilterKeys->iBounceMSec = 0;
1805 WINE_SPI_FIXME(SPI_SETFILTERKEYS); /* 51 */
1807 case SPI_GETTOGGLEKEYS: /* 52 */
1809 LPTOGGLEKEYS lpToggleKeys = pvParam;
1810 WARN("SPI_GETTOGGLEKEYS not fully implemented\n");
1811 if (lpToggleKeys && lpToggleKeys->cbSize == sizeof(TOGGLEKEYS))
1813 /* Indicate that no ToggleKeys feature available */
1814 lpToggleKeys->dwFlags = 0;
1822 WINE_SPI_FIXME(SPI_SETTOGGLEKEYS); /* 53 */
1824 case SPI_GETMOUSEKEYS: /* 54 */
1826 LPMOUSEKEYS lpMouseKeys = pvParam;
1827 WARN("SPI_GETMOUSEKEYS not fully implemented\n");
1828 if (lpMouseKeys && lpMouseKeys->cbSize == sizeof(MOUSEKEYS))
1830 /* Indicate that no MouseKeys feature available */
1831 lpMouseKeys->dwFlags = 0;
1832 lpMouseKeys->iMaxSpeed = 360;
1833 lpMouseKeys->iTimeToMaxSpeed = 1000;
1834 lpMouseKeys->iCtrlSpeed = 0;
1835 lpMouseKeys->dwReserved1 = 0;
1836 lpMouseKeys->dwReserved2 = 0;
1844 WINE_SPI_FIXME(SPI_SETMOUSEKEYS); /* 55 */
1846 case SPI_GETSHOWSOUNDS:
1847 ret = get_bool_param( SPI_SETSHOWSOUNDS_IDX,
1848 SPI_SETSHOWSOUNDS_REGKEY,
1849 SPI_SETSHOWSOUNDS_VALNAME,
1850 &show_sounds, pvParam );
1853 case SPI_SETSHOWSOUNDS:
1854 ret = set_bool_param( SPI_SETSHOWSOUNDS_IDX,
1855 SPI_SETSHOWSOUNDS_REGKEY,
1856 SPI_SETSHOWSOUNDS_VALNAME,
1857 &show_sounds, uiParam, fWinIni );
1860 case SPI_GETSTICKYKEYS: /* 58 */
1862 LPSTICKYKEYS lpStickyKeys = pvParam;
1863 WARN("SPI_GETSTICKYKEYS not fully implemented\n");
1864 if (lpStickyKeys && lpStickyKeys->cbSize == sizeof(STICKYKEYS))
1866 /* Indicate that no StickyKeys feature available */
1867 lpStickyKeys->dwFlags = 0;
1875 WINE_SPI_FIXME(SPI_SETSTICKYKEYS); /* 59 */
1877 case SPI_GETACCESSTIMEOUT: /* 60 */
1879 LPACCESSTIMEOUT lpAccessTimeout = pvParam;
1880 WARN("SPI_GETACCESSTIMEOUT not fully implemented\n");
1881 if (lpAccessTimeout && lpAccessTimeout->cbSize == sizeof(ACCESSTIMEOUT))
1883 /* Indicate that no accessibility features timeout is available */
1884 lpAccessTimeout->dwFlags = 0;
1885 lpAccessTimeout->iTimeOutMSec = 0;
1893 WINE_SPI_FIXME(SPI_SETACCESSTIMEOUT); /* 61 */
1895 case SPI_GETSERIALKEYS: /* 62 WINVER >= 0x400 */
1897 LPSERIALKEYSW lpSerialKeysW = pvParam;
1898 WARN("SPI_GETSERIALKEYS not fully implemented\n");
1899 if (lpSerialKeysW && lpSerialKeysW->cbSize == sizeof(SERIALKEYSW))
1901 /* Indicate that no SerialKeys feature available */
1902 lpSerialKeysW->dwFlags = 0;
1903 lpSerialKeysW->lpszActivePort = NULL;
1904 lpSerialKeysW->lpszPort = NULL;
1905 lpSerialKeysW->iBaudRate = 0;
1906 lpSerialKeysW->iPortState = 0;
1914 WINE_SPI_FIXME(SPI_SETSERIALKEYS); /* 63 WINVER >= 0x400 */
1916 case SPI_GETSOUNDSENTRY: /* 64 */
1918 LPSOUNDSENTRYW lpSoundSentryW = pvParam;
1919 WARN("SPI_GETSOUNDSENTRY not fully implemented\n");
1920 if (lpSoundSentryW && lpSoundSentryW->cbSize == sizeof(SOUNDSENTRYW))
1922 /* Indicate that no SoundSentry feature available */
1923 lpSoundSentryW->dwFlags = 0;
1924 lpSoundSentryW->iFSTextEffect = 0;
1925 lpSoundSentryW->iFSTextEffectMSec = 0;
1926 lpSoundSentryW->iFSTextEffectColorBits = 0;
1927 lpSoundSentryW->iFSGrafEffect = 0;
1928 lpSoundSentryW->iFSGrafEffectMSec = 0;
1929 lpSoundSentryW->iFSGrafEffectColor = 0;
1930 lpSoundSentryW->iWindowsEffect = 0;
1931 lpSoundSentryW->iWindowsEffectMSec = 0;
1932 lpSoundSentryW->lpszWindowsEffectDLL = 0;
1933 lpSoundSentryW->iWindowsEffectOrdinal = 0;
1941 WINE_SPI_FIXME(SPI_SETSOUNDSENTRY); /* 65 */
1943 case SPI_GETHIGHCONTRAST: /* 66 WINVER >= 0x400 */
1945 LPHIGHCONTRASTW lpHighContrastW = pvParam;
1946 WARN("SPI_GETHIGHCONTRAST not fully implemented\n");
1947 if (lpHighContrastW && lpHighContrastW->cbSize == sizeof(HIGHCONTRASTW))
1949 /* Indicate that no high contrast feature available */
1950 lpHighContrastW->dwFlags = 0;
1951 lpHighContrastW->lpszDefaultScheme = NULL;
1959 WINE_SPI_FIXME(SPI_SETHIGHCONTRAST); /* 67 WINVER >= 0x400 */
1961 case SPI_GETKEYBOARDPREF:
1962 ret = get_bool_param( SPI_SETKEYBOARDPREF_IDX,
1963 SPI_SETKEYBOARDPREF_REGKEY,
1964 SPI_SETKEYBOARDPREF_VALNAME,
1965 &keyboard_pref, pvParam );
1968 case SPI_SETKEYBOARDPREF:
1969 ret = set_bool_param( SPI_SETKEYBOARDPREF_IDX,
1970 SPI_SETKEYBOARDPREF_REGKEY,
1971 SPI_SETKEYBOARDPREF_VALNAME,
1972 &keyboard_pref, uiParam, fWinIni );
1975 case SPI_GETSCREENREADER:
1976 ret = get_bool_param( SPI_SETSCREENREADER_IDX,
1977 SPI_SETSCREENREADER_REGKEY,
1978 SPI_SETSCREENREADER_VALNAME,
1979 &screen_reader, pvParam );
1982 case SPI_SETSCREENREADER:
1983 ret = set_bool_param( SPI_SETSCREENREADER_IDX,
1984 SPI_SETSCREENREADER_REGKEY,
1985 SPI_SETSCREENREADER_VALNAME,
1986 &screen_reader, uiParam, fWinIni );
1989 case SPI_GETANIMATION: /* 72 WINVER >= 0x400 */
1991 LPANIMATIONINFO lpAnimInfo = pvParam;
1993 /* Tell it "disabled" */
1994 if (lpAnimInfo && lpAnimInfo->cbSize == sizeof(ANIMATIONINFO))
1995 lpAnimInfo->iMinAnimate = 0; /* Minimise and restore animation is disabled (nonzero == enabled) */
2000 WINE_SPI_WARN(SPI_SETANIMATION); /* 73 WINVER >= 0x400 */
2002 case SPI_GETFONTSMOOTHING:
2005 ret = get_uint_param( SPI_SETFONTSMOOTHING_IDX,
2006 SPI_SETFONTSMOOTHING_REGKEY,
2007 SPI_SETFONTSMOOTHING_VALNAME,
2008 &font_smoothing, &tmpval );
2009 if (!pvParam) ret = FALSE;
2012 *(UINT *) pvParam = ( tmpval != 0);
2015 case SPI_SETFONTSMOOTHING:
2016 uiParam = uiParam ? 2 : 0; /* Win NT4/2k/XP behavior */
2017 ret = set_uint_param( SPI_SETFONTSMOOTHING_IDX,
2018 SPI_SETFONTSMOOTHING_REGKEY,
2019 SPI_SETFONTSMOOTHING_VALNAME,
2020 &font_smoothing, uiParam, fWinIni );
2023 WINE_SPI_FIXME(SPI_SETDRAGWIDTH); /* 76 WINVER >= 0x400 */
2024 WINE_SPI_FIXME(SPI_SETDRAGHEIGHT); /* 77 WINVER >= 0x400 */
2026 WINE_SPI_FIXME(SPI_SETHANDHELD); /* 78 WINVER >= 0x400 */
2028 WINE_SPI_FIXME(SPI_GETLOWPOWERTIMEOUT); /* 79 WINVER >= 0x400 */
2029 WINE_SPI_FIXME(SPI_GETPOWEROFFTIMEOUT); /* 80 WINVER >= 0x400 */
2030 WINE_SPI_FIXME(SPI_SETLOWPOWERTIMEOUT); /* 81 WINVER >= 0x400 */
2031 WINE_SPI_FIXME(SPI_SETPOWEROFFTIMEOUT); /* 82 WINVER >= 0x400 */
2033 case SPI_GETLOWPOWERACTIVE:
2034 ret = get_bool_param( SPI_SETLOWPOWERACTIVE_IDX,
2035 SPI_SETLOWPOWERACTIVE_REGKEY,
2036 SPI_SETLOWPOWERACTIVE_VALNAME,
2037 &lowpoweractive, pvParam );
2040 case SPI_GETPOWEROFFACTIVE:
2041 ret = get_bool_param( SPI_SETPOWEROFFACTIVE_IDX,
2042 SPI_SETPOWEROFFACTIVE_REGKEY,
2043 SPI_SETPOWEROFFACTIVE_VALNAME,
2044 &poweroffactive, pvParam );
2047 case SPI_SETLOWPOWERACTIVE:
2048 ret = set_bool_param( SPI_SETLOWPOWERACTIVE_IDX,
2049 SPI_SETLOWPOWERACTIVE_REGKEY,
2050 SPI_SETLOWPOWERACTIVE_VALNAME,
2051 &lowpoweractive, uiParam, fWinIni );
2054 case SPI_SETPOWEROFFACTIVE:
2055 ret = set_bool_param( SPI_SETPOWEROFFACTIVE_IDX,
2056 SPI_SETPOWEROFFACTIVE_REGKEY,
2057 SPI_SETPOWEROFFACTIVE_VALNAME,
2058 &poweroffactive, uiParam, fWinIni );
2061 WINE_SPI_FIXME(SPI_SETCURSORS); /* 87 WINVER >= 0x400 */
2062 WINE_SPI_FIXME(SPI_SETICONS); /* 88 WINVER >= 0x400 */
2064 case SPI_GETDEFAULTINPUTLANG: /* 89 WINVER >= 0x400 */
2065 ret = GetKeyboardLayout(0) ? TRUE : FALSE;
2068 WINE_SPI_FIXME(SPI_SETDEFAULTINPUTLANG); /* 90 WINVER >= 0x400 */
2070 WINE_SPI_FIXME(SPI_SETLANGTOGGLE); /* 91 WINVER >= 0x400 */
2072 case SPI_GETWINDOWSEXTENSION: /* 92 WINVER >= 0x400 */
2073 WARN("pretend no support for Win9x Plus! for now.\n");
2074 ret = FALSE; /* yes, this is the result value */
2077 WINE_SPI_FIXME(SPI_SETMOUSETRAILS); /* 93 WINVER >= 0x400 */
2078 WINE_SPI_FIXME(SPI_GETMOUSETRAILS); /* 94 WINVER >= 0x400 */
2080 case SPI_GETSNAPTODEFBUTTON: /* 95 WINVER >= 0x400 */
2081 ret = get_bool_param( SPI_SETSNAPTODEFBUTTON_IDX,
2082 SPI_SETSNAPTODEFBUTTON_REGKEY,
2083 SPI_SETSNAPTODEFBUTTON_VALNAME,
2084 &snap_to_default_button, pvParam );
2087 case SPI_SETSNAPTODEFBUTTON: /* 96 WINVER >= 0x400 */
2088 ret = set_bool_param( SPI_SETSNAPTODEFBUTTON_IDX,
2089 SPI_SETSNAPTODEFBUTTON_REGKEY,
2090 SPI_SETSNAPTODEFBUTTON_VALNAME,
2091 &snap_to_default_button, uiParam, fWinIni );
2094 case SPI_SETSCREENSAVERRUNNING:
2095 ret = set_bool_param( SPI_SETSCREENSAVERRUNNING_IDX,
2096 SPI_SETSCREENSAVERRUNNING_REGKEY,
2097 SPI_SETSCREENSAVERRUNNING_VALNAME,
2098 &screensaver_running, uiParam, fWinIni );
2101 case SPI_GETMOUSEHOVERWIDTH:
2102 ret = get_uint_param( SPI_SETMOUSEHOVERWIDTH_IDX,
2103 SPI_SETMOUSEHOVERWIDTH_REGKEY,
2104 SPI_SETMOUSEHOVERWIDTH_VALNAME,
2105 &mouse_hover_width, pvParam );
2108 case SPI_SETMOUSEHOVERWIDTH:
2109 ret = set_uint_param( SPI_SETMOUSEHOVERWIDTH_IDX,
2110 SPI_SETMOUSEHOVERWIDTH_REGKEY,
2111 SPI_SETMOUSEHOVERWIDTH_VALNAME,
2112 &mouse_hover_width, uiParam, fWinIni );
2115 case SPI_GETMOUSEHOVERHEIGHT:
2116 ret = get_uint_param( SPI_SETMOUSEHOVERHEIGHT_IDX,
2117 SPI_SETMOUSEHOVERHEIGHT_REGKEY,
2118 SPI_SETMOUSEHOVERHEIGHT_VALNAME,
2119 &mouse_hover_height, pvParam );
2122 case SPI_SETMOUSEHOVERHEIGHT:
2123 ret = set_uint_param( SPI_SETMOUSEHOVERHEIGHT_IDX,
2124 SPI_SETMOUSEHOVERHEIGHT_REGKEY,
2125 SPI_SETMOUSEHOVERHEIGHT_VALNAME,
2126 &mouse_hover_height, uiParam, fWinIni );
2129 case SPI_GETMOUSEHOVERTIME:
2130 ret = get_uint_param( SPI_SETMOUSEHOVERTIME_IDX,
2131 SPI_SETMOUSEHOVERTIME_REGKEY,
2132 SPI_SETMOUSEHOVERTIME_VALNAME,
2133 &mouse_hover_time, pvParam );
2136 case SPI_SETMOUSEHOVERTIME:
2137 ret = set_uint_param( SPI_SETMOUSEHOVERTIME_IDX,
2138 SPI_SETMOUSEHOVERTIME_REGKEY,
2139 SPI_SETMOUSEHOVERTIME_VALNAME,
2140 &mouse_hover_time, uiParam, fWinIni );
2143 case SPI_GETWHEELSCROLLLINES:
2144 ret = get_uint_param( SPI_SETMOUSESCROLLLINES_IDX,
2145 SPI_SETMOUSESCROLLLINES_REGKEY,
2146 SPI_SETMOUSESCROLLLINES_VALNAME,
2147 &mouse_scroll_lines, pvParam );
2150 case SPI_SETWHEELSCROLLLINES:
2151 ret = set_uint_param( SPI_SETMOUSESCROLLLINES_IDX,
2152 SPI_SETMOUSESCROLLLINES_REGKEY,
2153 SPI_SETMOUSESCROLLLINES_VALNAME,
2154 &mouse_scroll_lines, uiParam, fWinIni );
2157 case SPI_GETMENUSHOWDELAY:
2158 ret = get_uint_param( SPI_SETMENUSHOWDELAY_IDX,
2159 SPI_SETMENUSHOWDELAY_REGKEY,
2160 SPI_SETMENUSHOWDELAY_VALNAME,
2161 &menu_show_delay, pvParam );
2164 case SPI_SETMENUSHOWDELAY:
2165 ret = set_uint_param( SPI_SETMENUSHOWDELAY_IDX,
2166 SPI_SETMENUSHOWDELAY_REGKEY,
2167 SPI_SETMENUSHOWDELAY_VALNAME,
2168 &menu_show_delay, uiParam, fWinIni );
2171 case SPI_GETWHEELSCROLLCHARS: /* 108 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2172 ret = get_uint_param( SPI_SETMOUSESCROLLCHARS_IDX,
2173 SPI_SETMOUSESCROLLCHARS_REGKEY,
2174 SPI_SETMOUSESCROLLCHARS_VALNAME,
2175 &mouse_scroll_chars, pvParam );
2178 case SPI_SETWHEELSCROLLCHARS: /* 109 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2179 ret = set_uint_param( SPI_SETMOUSESCROLLCHARS_IDX,
2180 SPI_SETMOUSESCROLLCHARS_REGKEY,
2181 SPI_SETMOUSESCROLLCHARS_VALNAME,
2182 &mouse_scroll_chars, uiParam, fWinIni );
2185 WINE_SPI_FIXME(SPI_GETSHOWIMEUI); /* 110 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2186 WINE_SPI_FIXME(SPI_SETSHOWIMEUI); /* 111 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2188 case SPI_GETMOUSESPEED: /* 112 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2189 ret = get_uint_param( SPI_SETMOUSESPEED_IDX,
2190 SPI_SETMOUSESPEED_REGKEY,
2191 SPI_SETMOUSESPEED_VALNAME,
2192 &mouse_sensitivity, pvParam );
2195 case SPI_SETMOUSESPEED: /* 113 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2196 ret = set_uint_param( SPI_SETMOUSESPEED_IDX,
2197 SPI_SETMOUSESPEED_REGKEY,
2198 SPI_SETMOUSESPEED_VALNAME,
2199 &mouse_sensitivity, PtrToInt(pvParam), fWinIni );
2203 case SPI_GETSCREENSAVERRUNNING:
2204 ret = get_bool_param( SPI_SETSCREENSAVERRUNNING_IDX,
2205 SPI_SETSCREENSAVERRUNNING_REGKEY,
2206 SPI_SETSCREENSAVERRUNNING_VALNAME,
2207 &screensaver_running, pvParam );
2210 case SPI_GETDESKWALLPAPER: /* 115 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2212 WCHAR buf[MAX_PATH];
2214 if (!pvParam) return FALSE;
2216 if (uiParam > MAX_PATH)
2221 if (SYSPARAMS_Load(SPI_SETDESKWALLPAPER_REGKEY, SPI_SETDESKWALLPAPER_VALNAME, buf, sizeof(buf)))
2223 lstrcpynW(pvParam, buf, uiParam);
2227 /* Return an empty string */
2228 memset(pvParam, 0, uiParam);
2234 WINE_SPI_FIXME(SPI_GETACTIVEWINDOWTRACKING);/* 0x1000 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2235 WINE_SPI_FIXME(SPI_SETACTIVEWINDOWTRACKING);/* 0x1001 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2236 case SPI_GETMENUANIMATION: /* 0x1002 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2237 ret = get_user_pref_param( 0, 0x02, pvParam );
2240 case SPI_SETMENUANIMATION: /* 0x1003 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2241 ret = set_user_pref_param( 0, 0x02, PtrToUlong(pvParam), fWinIni );
2244 case SPI_GETCOMBOBOXANIMATION: /* 0x1004 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2245 ret = get_user_pref_param( 0, 0x04, pvParam );
2248 case SPI_SETCOMBOBOXANIMATION: /* 0x1005 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2249 ret = set_user_pref_param( 0, 0x04, PtrToUlong(pvParam), fWinIni );
2252 case SPI_GETLISTBOXSMOOTHSCROLLING: /* 0x1006 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2253 ret = get_user_pref_param( 0, 0x08, pvParam );
2256 case SPI_SETLISTBOXSMOOTHSCROLLING: /* 0x1007 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2257 ret = set_user_pref_param( 0, 0x08, PtrToUlong(pvParam), fWinIni );
2260 case SPI_GETGRADIENTCAPTIONS:
2261 ret = get_user_pref_param( 0, 0x10, pvParam );
2264 case SPI_SETGRADIENTCAPTIONS:
2265 ret = set_user_pref_param( 0, 0x10, PtrToUlong(pvParam), fWinIni );
2268 case SPI_GETKEYBOARDCUES:
2269 ret = get_user_pref_param( 0, 0x20, pvParam );
2272 case SPI_SETKEYBOARDCUES:
2273 ret = set_user_pref_param( 0, 0x20, PtrToUlong(pvParam), fWinIni );
2276 WINE_SPI_FIXME(SPI_GETACTIVEWNDTRKZORDER); /* 0x100C _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2277 WINE_SPI_FIXME(SPI_SETACTIVEWNDTRKZORDER); /* 0x100D _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2278 case SPI_GETHOTTRACKING:
2279 ret = get_user_pref_param( 0, 0x80, pvParam );
2282 case SPI_SETHOTTRACKING:
2283 ret = set_user_pref_param( 0, 0x80, PtrToUlong(pvParam), fWinIni );
2286 WINE_SPI_FIXME(SPI_GETMENUFADE); /* 0x1012 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2287 WINE_SPI_FIXME(SPI_SETMENUFADE); /* 0x1013 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2288 case SPI_GETSELECTIONFADE: /* 0x1014 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2289 ret = get_user_pref_param( 1, 0x04, pvParam );
2292 case SPI_SETSELECTIONFADE: /* 0x1015 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2293 ret = set_user_pref_param( 1, 0x04, PtrToUlong(pvParam), fWinIni );
2296 case SPI_GETTOOLTIPANIMATION: /* 0x1016 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2297 ret = get_user_pref_param( 1, 0x08, pvParam );
2300 case SPI_SETTOOLTIPANIMATION: /* 0x1017 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2301 ret = set_user_pref_param( 1, 0x08, PtrToUlong(pvParam), fWinIni );
2304 case SPI_GETTOOLTIPFADE: /* 0x1018 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2305 ret = get_user_pref_param( 1, 0x10, pvParam );
2308 case SPI_SETTOOLTIPFADE: /* 0x1019 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2309 ret = set_user_pref_param( 1, 0x10, PtrToUlong(pvParam), fWinIni );
2312 case SPI_GETCURSORSHADOW: /* 0x101A _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2313 ret = get_user_pref_param( 1, 0x20, pvParam );
2316 case SPI_SETCURSORSHADOW: /* 0x101B _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2317 ret = set_user_pref_param( 1, 0x20, PtrToUlong(pvParam), fWinIni );
2320 WINE_SPI_FIXME(SPI_GETMOUSESONAR); /* 0x101C _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2321 WINE_SPI_FIXME(SPI_SETMOUSESONAR); /* 0x101D _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2322 WINE_SPI_FIXME(SPI_GETMOUSECLICKLOCK); /* 0x101E _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2323 WINE_SPI_FIXME(SPI_SETMOUSECLICKLOCK); /* 0x101F _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2325 case SPI_GETMOUSEVANISH:
2326 ret = get_user_pref_param( 2, 0x01, pvParam );
2329 case SPI_SETMOUSEVANISH:
2330 ret = set_user_pref_param( 2, 0x01, PtrToUlong(pvParam), fWinIni );
2333 case SPI_GETFLATMENU:
2334 ret = get_user_pref_param( 2, 0x02, pvParam );
2337 case SPI_SETFLATMENU:
2338 ret = set_user_pref_param( 2, 0x02, PtrToUlong(pvParam), fWinIni );
2341 case SPI_GETDROPSHADOW:
2342 ret = get_user_pref_param( 2, 0x04, pvParam );
2345 case SPI_SETDROPSHADOW:
2346 ret = set_user_pref_param( 2, 0x04, PtrToUlong(pvParam), fWinIni );
2349 WINE_SPI_FIXME(SPI_GETBLOCKSENDINPUTRESETS);
2350 WINE_SPI_FIXME(SPI_SETBLOCKSENDINPUTRESETS);
2351 case SPI_GETUIEFFECTS:
2352 ret = get_user_pref_param( 3, 0x80, pvParam );
2355 case SPI_SETUIEFFECTS:
2356 /* FIXME: this probably should mask other UI effect values when unset */
2357 ret = set_user_pref_param( 3, 0x80, PtrToUlong(pvParam), fWinIni );
2360 /* _WIN32_WINNT >= 0x600 */
2361 WINE_SPI_FIXME(SPI_GETDISABLEOVERLAPPEDCONTENT);
2362 WINE_SPI_FIXME(SPI_SETDISABLEOVERLAPPEDCONTENT);
2363 WINE_SPI_FIXME(SPI_GETCLIENTAREAANIMATION);
2364 WINE_SPI_FIXME(SPI_SETCLIENTAREAANIMATION);
2365 WINE_SPI_FIXME(SPI_GETCLEARTYPE);
2366 WINE_SPI_FIXME(SPI_SETCLEARTYPE);
2367 WINE_SPI_FIXME(SPI_GETSPEECHRECOGNITION);
2368 WINE_SPI_FIXME(SPI_SETSPEECHRECOGNITION);
2370 case SPI_GETFOREGROUNDLOCKTIMEOUT: /* 0x2000 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2371 ret = get_uint_param( SPI_SETFOREGROUNDLOCKTIMEOUT_IDX,
2372 SPI_SETFOREGROUNDLOCKTIMEOUT_REGKEY,
2373 SPI_SETFOREGROUNDLOCKTIMEOUT_VALNAME,
2374 &foreground_lock_timeout, pvParam );
2377 case SPI_SETFOREGROUNDLOCKTIMEOUT: /* 0x2001 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2378 /* FIXME: this should check that the calling thread
2379 * is able to change the foreground window */
2380 ret = set_uint_param( SPI_SETFOREGROUNDLOCKTIMEOUT_IDX,
2381 SPI_SETFOREGROUNDLOCKTIMEOUT_REGKEY,
2382 SPI_SETFOREGROUNDLOCKTIMEOUT_VALNAME,
2383 &foreground_lock_timeout, PtrToUlong(pvParam), fWinIni );
2386 WINE_SPI_FIXME(SPI_GETACTIVEWNDTRKTIMEOUT); /* 0x2002 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2387 WINE_SPI_FIXME(SPI_SETACTIVEWNDTRKTIMEOUT); /* 0x2003 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2388 WINE_SPI_FIXME(SPI_GETFOREGROUNDFLASHCOUNT);/* 0x2004 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2389 WINE_SPI_FIXME(SPI_SETFOREGROUNDFLASHCOUNT);/* 0x2005 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2390 case SPI_GETCARETWIDTH: /* 0x2006 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2391 ret = get_uint_param( SPI_CARETWIDTH_IDX,
2392 SPI_CARETWIDTH_REGKEY,
2393 SPI_CARETWIDTH_VALNAME,
2394 &caret_width, pvParam );
2397 case SPI_SETCARETWIDTH: /* 0x2007 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2398 ret = set_uint_param( SPI_CARETWIDTH_IDX,
2399 SPI_CARETWIDTH_REGKEY,
2400 SPI_CARETWIDTH_VALNAME,
2401 &caret_width, uiParam, fWinIni );
2404 WINE_SPI_FIXME(SPI_GETMOUSECLICKLOCKTIME); /* 0x2008 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2405 WINE_SPI_FIXME(SPI_SETMOUSECLICKLOCKTIME); /* 0x2009 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2406 case SPI_GETFONTSMOOTHINGTYPE: /* 0x200A _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2407 spi_idx = SPI_SETFONTSMOOTHINGTYPE_IDX;
2408 if (!spi_loaded[spi_idx])
2410 ret = SYSPARAMS_Load( SPI_SETFONTSMOOTHINGTYPE_REGKEY,
2411 SPI_SETFONTSMOOTHINGTYPE_VALNAME,
2412 (LPWSTR)&font_smoothing_type,
2413 sizeof(font_smoothing_type) );
2414 if ( ret) spi_loaded[spi_idx] = TRUE;
2416 if (!pvParam) ret = FALSE;
2419 *(UINT *)pvParam = font_smoothing_type;
2422 case SPI_SETFONTSMOOTHINGTYPE: /* 0x200B _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2423 spi_idx = SPI_SETFONTSMOOTHINGTYPE_IDX;
2424 if (SYSPARAMS_SaveRaw( SPI_SETFONTSMOOTHINGTYPE_REGKEY,
2425 SPI_SETFONTSMOOTHINGTYPE_VALNAME,
2426 (LPBYTE)&pvParam, sizeof(UINT), REG_DWORD, fWinIni ))
2428 font_smoothing_type = PtrToUlong(pvParam);
2429 spi_loaded[spi_idx] = TRUE;
2435 case SPI_GETFONTSMOOTHINGCONTRAST: /* 0x200C _WIN32_WINNT >= 0x510 */
2436 spi_idx = SPI_SETFONTSMOOTHINGCONTRAST_IDX;
2437 if (!spi_loaded[spi_idx])
2439 ret = SYSPARAMS_Load( SPI_SETFONTSMOOTHINGCONTRAST_REGKEY,
2440 SPI_SETFONTSMOOTHINGCONTRAST_VALNAME,
2441 (LPWSTR)&font_smoothing_contrast,
2442 sizeof(font_smoothing_contrast) );
2444 spi_loaded[spi_idx] = TRUE;
2446 if (!pvParam) ret = FALSE;
2449 *(UINT *)pvParam = font_smoothing_contrast;
2452 case SPI_SETFONTSMOOTHINGCONTRAST: /* 0x200D _WIN32_WINNT >= 0x510 */
2453 spi_idx = SPI_SETFONTSMOOTHINGCONTRAST_IDX;
2454 if (SYSPARAMS_SaveRaw( SPI_SETFONTSMOOTHINGCONTRAST_REGKEY,
2455 SPI_SETFONTSMOOTHINGCONTRAST_VALNAME,
2456 (LPBYTE)&pvParam, sizeof(UINT), REG_DWORD, fWinIni ))
2458 font_smoothing_contrast = PtrToUlong(pvParam);
2459 spi_loaded[spi_idx] = TRUE;
2465 case SPI_GETFOCUSBORDERWIDTH: /* 0x200E _WIN32_WINNT >= 0x510 */
2466 case SPI_GETFOCUSBORDERHEIGHT: /* 0x200F _WIN32_WINNT >= 0x510 */
2470 *(UINT *)pvParam = 1;
2473 WINE_SPI_FIXME(SPI_SETFOCUSBORDERWIDTH); /* 0x2010 _WIN32_WINNT >= 0x510 */
2474 WINE_SPI_FIXME(SPI_SETFOCUSBORDERHEIGHT); /* 0x2011 _WIN32_WINNT >= 0x510 */
2476 case SPI_GETFONTSMOOTHINGORIENTATION: /* 0x2012 */
2477 spi_idx = SPI_SETFONTSMOOTHINGORIENTATION_IDX;
2478 if (!spi_loaded[spi_idx])
2480 ret = SYSPARAMS_Load( SPI_SETFONTSMOOTHINGORIENTATION_REGKEY,
2481 SPI_SETFONTSMOOTHINGORIENTATION_VALNAME,
2482 (LPWSTR)&font_smoothing_orientation,
2483 sizeof(font_smoothing_orientation) );
2485 spi_loaded[spi_idx] = TRUE;
2487 if (!pvParam) ret = FALSE;
2490 *(UINT *)pvParam = font_smoothing_orientation;
2493 case SPI_SETFONTSMOOTHINGORIENTATION: /* 0x2013 */
2494 spi_idx = SPI_SETFONTSMOOTHINGORIENTATION_IDX;
2495 if (SYSPARAMS_SaveRaw( SPI_SETFONTSMOOTHINGORIENTATION_REGKEY,
2496 SPI_SETFONTSMOOTHINGORIENTATION_VALNAME,
2497 (LPBYTE)&pvParam, sizeof(UINT), REG_DWORD, fWinIni ))
2499 font_smoothing_orientation = PtrToUlong(pvParam);
2500 spi_loaded[spi_idx] = TRUE;
2507 FIXME( "Unknown action: %u\n", uiAction );
2508 SetLastError( ERROR_INVALID_SPI_VALUE );
2514 SYSPARAMS_NotifyChange( uiAction, fWinIni );
2515 TRACE("(%u, %u, %p, %u) ret %d\n",
2516 uiAction, uiParam, pvParam, fWinIni, ret);
2519 #undef WINE_SPI_FIXME
2520 #undef WINE_SPI_WARN
2524 /***********************************************************************
2525 * SystemParametersInfoA (USER32.@)
2527 BOOL WINAPI SystemParametersInfoA( UINT uiAction, UINT uiParam,
2528 PVOID pvParam, UINT fuWinIni )
2532 TRACE("(%u, %u, %p, %u)\n", uiAction, uiParam, pvParam, fuWinIni);
2536 case SPI_SETDESKWALLPAPER: /* 20 */
2537 case SPI_SETDESKPATTERN: /* 21 */
2541 if (!MultiByteToWideChar( CP_ACP, 0, pvParam, -1, buffer,
2542 sizeof(buffer)/sizeof(WCHAR) ))
2543 buffer[sizeof(buffer)/sizeof(WCHAR)-1] = 0;
2544 ret = SystemParametersInfoW( uiAction, uiParam, pvParam ? buffer : NULL, fuWinIni );
2548 case SPI_GETICONTITLELOGFONT: /* 31 */
2551 ret = SystemParametersInfoW( uiAction, uiParam, pvParam ? &tmp : NULL, fuWinIni );
2553 SYSPARAMS_LogFont32WTo32A( &tmp, pvParam );
2557 case SPI_GETNONCLIENTMETRICS: /* 41 WINVER >= 0x400 */
2559 NONCLIENTMETRICSW tmp;
2560 LPNONCLIENTMETRICSA lpnmA = pvParam;
2561 if (lpnmA && (lpnmA->cbSize == sizeof(NONCLIENTMETRICSA) ||
2562 lpnmA->cbSize == FIELD_OFFSET(NONCLIENTMETRICSA, iPaddedBorderWidth)))
2564 tmp.cbSize = sizeof(NONCLIENTMETRICSW);
2565 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2567 SYSPARAMS_NonClientMetrics32WTo32A( &tmp, lpnmA );
2574 case SPI_SETNONCLIENTMETRICS: /* 42 WINVER >= 0x400 */
2576 NONCLIENTMETRICSW tmp;
2577 LPNONCLIENTMETRICSA lpnmA = pvParam;
2578 if (lpnmA && (lpnmA->cbSize == sizeof(NONCLIENTMETRICSA) ||
2579 lpnmA->cbSize == FIELD_OFFSET(NONCLIENTMETRICSA, iPaddedBorderWidth)))
2581 tmp.cbSize = sizeof(NONCLIENTMETRICSW);
2582 SYSPARAMS_NonClientMetrics32ATo32W( lpnmA, &tmp );
2583 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2590 case SPI_GETICONMETRICS: /* 45 WINVER >= 0x400 */
2593 LPICONMETRICSA lpimA = pvParam;
2594 if (lpimA && lpimA->cbSize == sizeof(ICONMETRICSA))
2596 tmp.cbSize = sizeof(ICONMETRICSW);
2597 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2600 lpimA->iHorzSpacing = tmp.iHorzSpacing;
2601 lpimA->iVertSpacing = tmp.iVertSpacing;
2602 lpimA->iTitleWrap = tmp.iTitleWrap;
2603 SYSPARAMS_LogFont32WTo32A( &tmp.lfFont, &lpimA->lfFont );
2611 case SPI_SETICONMETRICS: /* 46 WINVER >= 0x400 */
2614 LPICONMETRICSA lpimA = pvParam;
2615 if (lpimA && lpimA->cbSize == sizeof(ICONMETRICSA))
2617 tmp.cbSize = sizeof(ICONMETRICSW);
2618 tmp.iHorzSpacing = lpimA->iHorzSpacing;
2619 tmp.iVertSpacing = lpimA->iVertSpacing;
2620 tmp.iTitleWrap = lpimA->iTitleWrap;
2621 SYSPARAMS_LogFont32ATo32W( &lpimA->lfFont, &tmp.lfFont);
2622 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2629 case SPI_GETHIGHCONTRAST: /* 66 WINVER >= 0x400 */
2632 LPHIGHCONTRASTA lphcA = pvParam;
2633 if (lphcA && lphcA->cbSize == sizeof(HIGHCONTRASTA))
2635 tmp.cbSize = sizeof(HIGHCONTRASTW);
2636 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2639 lphcA->dwFlags = tmp.dwFlags;
2640 lphcA->lpszDefaultScheme = NULL; /* FIXME? */
2648 case SPI_GETDESKWALLPAPER: /* 115 */
2650 WCHAR buffer[MAX_PATH];
2651 ret = (SystemParametersInfoW( SPI_GETDESKWALLPAPER, uiParam, buffer, fuWinIni ) &&
2652 WideCharToMultiByte(CP_ACP, 0, buffer, -1, pvParam, uiParam, NULL, NULL));
2657 ret = SystemParametersInfoW( uiAction, uiParam, pvParam, fuWinIni );
2664 /***********************************************************************
2665 * GetSystemMetrics (USER32.@)
2667 INT WINAPI GetSystemMetrics( INT index )
2671 /* some metrics are dynamic */
2675 return GetDeviceCaps( get_display_dc(), HORZRES );
2677 return GetDeviceCaps( get_display_dc(), VERTRES );
2679 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2680 return nonclient_metrics.iScrollWidth;
2682 return GetSystemMetrics(SM_CXVSCROLL);
2684 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2685 return nonclient_metrics.iCaptionHeight + 1;
2688 /* SM_C{X,Y}BORDER always returns 1 regardless of 'BorderWidth' value in registry */
2694 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2695 return nonclient_metrics.iScrollHeight;
2697 return GetSystemMetrics(SM_CYVTHUMB);
2699 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2700 return icon_size.cx;
2702 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2703 return icon_size.cy;
2708 return GetSystemMetrics(SM_CYMENUSIZE) + 1;
2709 case SM_CXFULLSCREEN:
2710 /* see the remark for SM_CXMAXIMIZED, at least this formulation is
2712 return GetSystemMetrics( SM_CXMAXIMIZED) - 2 * GetSystemMetrics( SM_CXFRAME);
2713 case SM_CYFULLSCREEN:
2714 /* see the remark for SM_CYMAXIMIZED, at least this formulation is
2716 return GetSystemMetrics( SM_CYMAXIMIZED) - GetSystemMetrics( SM_CYMIN);
2717 case SM_CYKANJIWINDOW:
2719 case SM_MOUSEPRESENT:
2722 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2723 return nonclient_metrics.iScrollHeight;
2725 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2726 return nonclient_metrics.iScrollHeight;
2730 get_bool_param( SPI_SETMOUSEBUTTONSWAP_IDX, SPI_SETMOUSEBUTTONSWAP_REGKEY,
2731 SPI_SETMOUSEBUTTONSWAP_VALNAME, &swap_buttons, (BOOL*)&ret );
2739 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2740 return 3 * nonclient_metrics.iCaptionWidth + GetSystemMetrics( SM_CYSIZE) +
2741 4 * CaptionFontAvCharWidth + 2 * GetSystemMetrics( SM_CXFRAME) + 4;
2743 return GetSystemMetrics( SM_CYCAPTION) + 2 * GetSystemMetrics( SM_CYFRAME);
2745 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2746 return nonclient_metrics.iCaptionWidth;
2748 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2749 return nonclient_metrics.iCaptionHeight;
2751 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2752 return GetSystemMetrics(SM_CXDLGFRAME) + nonclient_metrics.iBorderWidth;
2754 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2755 return GetSystemMetrics(SM_CYDLGFRAME) + nonclient_metrics.iBorderWidth;
2757 return GetSystemMetrics(SM_CXMIN);
2759 return GetSystemMetrics(SM_CYMIN);
2760 case SM_CXDOUBLECLK:
2761 get_uint_param( SPI_SETDOUBLECLKWIDTH_IDX, SPI_SETDOUBLECLKWIDTH_REGKEY1,
2762 SPI_SETDOUBLECLKWIDTH_VALNAME, &double_click_width, &ret );
2764 case SM_CYDOUBLECLK:
2765 get_uint_param( SPI_SETDOUBLECLKHEIGHT_IDX, SPI_SETDOUBLECLKHEIGHT_REGKEY1,
2766 SPI_SETDOUBLECLKHEIGHT_VALNAME, &double_click_height, &ret );
2768 case SM_CXICONSPACING:
2769 SystemParametersInfoW( SPI_ICONHORIZONTALSPACING, 0, &ret, 0 );
2771 case SM_CYICONSPACING:
2772 SystemParametersInfoW( SPI_ICONVERTICALSPACING, 0, &ret, 0 );
2774 case SM_MENUDROPALIGNMENT:
2775 SystemParametersInfoW( SPI_GETMENUDROPALIGNMENT, 0, &ret, 0 );
2779 case SM_DBCSENABLED:
2782 GetCPInfo( CP_ACP, &cpinfo );
2783 return (cpinfo.MaxCharSize > 1);
2785 case SM_CMOUSEBUTTONS:
2790 return GetSystemMetrics(SM_CXBORDER) + 1;
2792 return GetSystemMetrics(SM_CYBORDER) + 1;
2793 case SM_CXMINSPACING:
2794 if( spi_loaded[SPI_MINIMIZEDMETRICS_IDX]) load_minimized_metrics();
2795 return GetSystemMetrics(SM_CXMINIMIZED) + minimized_metrics.iHorzGap;
2796 case SM_CYMINSPACING:
2797 if( spi_loaded[SPI_MINIMIZEDMETRICS_IDX]) load_minimized_metrics();
2798 return GetSystemMetrics(SM_CYMINIMIZED) + minimized_metrics.iVertGap;
2802 case SM_CYSMCAPTION:
2803 return GetSystemMetrics(SM_CYSMSIZE) + 1;
2805 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2806 return nonclient_metrics.iSmCaptionWidth;
2808 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2809 return nonclient_metrics.iSmCaptionHeight;
2811 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2812 return nonclient_metrics.iMenuWidth;
2814 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2815 return nonclient_metrics.iMenuHeight;
2817 if( spi_loaded[SPI_MINIMIZEDMETRICS_IDX]) load_minimized_metrics();
2818 return minimized_metrics.iArrange;
2819 case SM_CXMINIMIZED:
2820 if( spi_loaded[SPI_MINIMIZEDMETRICS_IDX]) load_minimized_metrics();
2821 return minimized_metrics.iWidth + 6;
2822 case SM_CYMINIMIZED:
2823 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2824 return nonclient_metrics.iCaptionHeight + 6;
2826 return GetSystemMetrics(SM_CXVIRTUALSCREEN) + 4 + 2 * GetSystemMetrics(SM_CXFRAME);
2828 return GetSystemMetrics(SM_CYVIRTUALSCREEN) + 4 + 2 * GetSystemMetrics(SM_CYFRAME);
2829 case SM_CXMAXIMIZED:
2830 /* FIXME: subtract the width of any vertical application toolbars*/
2831 return GetSystemMetrics(SM_CXSCREEN) + 2 * GetSystemMetrics(SM_CXFRAME);
2832 case SM_CYMAXIMIZED:
2833 /* FIXME: subtract the width of any horizontal application toolbars*/
2834 return GetSystemMetrics(SM_CYSCREEN) + 2 * GetSystemMetrics(SM_CYCAPTION);
2836 return 3; /* FIXME */
2838 return 0; /* 0 = ok, 1 = failsafe, 2 = failsafe + network */
2843 SystemParametersInfoW( SPI_GETSHOWSOUNDS, 0, &ret, 0 );
2845 case SM_CXMENUCHECK:
2846 case SM_CYMENUCHECK:
2847 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2848 return tmMenuFont.tmHeight <= 0 ? 13 :
2849 ((tmMenuFont.tmHeight + tmMenuFont.tmExternalLeading + 1) / 2) * 2 - 1;
2850 case SM_SLOWMACHINE:
2851 return 0; /* Never true */
2852 case SM_MIDEASTENABLED:
2853 return 0; /* FIXME */
2854 case SM_MOUSEWHEELPRESENT:
2856 case SM_XVIRTUALSCREEN:
2858 struct monitor_info info;
2859 get_monitors_info( &info );
2860 return info.virtual_rect.left;
2862 case SM_YVIRTUALSCREEN:
2864 struct monitor_info info;
2865 get_monitors_info( &info );
2866 return info.virtual_rect.top;
2868 case SM_CXVIRTUALSCREEN:
2870 struct monitor_info info;
2871 get_monitors_info( &info );
2872 return info.virtual_rect.right - info.virtual_rect.left;
2874 case SM_CYVIRTUALSCREEN:
2876 struct monitor_info info;
2877 get_monitors_info( &info );
2878 return info.virtual_rect.bottom - info.virtual_rect.top;
2882 struct monitor_info info;
2883 get_monitors_info( &info );
2886 case SM_SAMEDISPLAYFORMAT:
2889 return 0; /* FIXME */
2890 case SM_CXFOCUSBORDER:
2891 case SM_CYFOCUSBORDER:
2894 case SM_MEDIACENTER:
2904 /***********************************************************************
2905 * SwapMouseButton (USER32.@)
2906 * Reverse or restore the meaning of the left and right mouse buttons
2907 * fSwap [I ] TRUE - reverse, FALSE - original
2911 BOOL WINAPI SwapMouseButton( BOOL fSwap )
2913 BOOL prev = GetSystemMetrics(SM_SWAPBUTTON);
2914 SystemParametersInfoW(SPI_SETMOUSEBUTTONSWAP, fSwap, 0, 0);
2919 /**********************************************************************
2920 * SetDoubleClickTime (USER32.@)
2922 BOOL WINAPI SetDoubleClickTime( UINT interval )
2924 return SystemParametersInfoW(SPI_SETDOUBLECLICKTIME, interval, 0, 0);
2928 /**********************************************************************
2929 * GetDoubleClickTime (USER32.@)
2931 UINT WINAPI GetDoubleClickTime(void)
2935 get_uint_param( SPI_SETDOUBLECLICKTIME_IDX,
2936 SPI_SETDOUBLECLICKTIME_REGKEY,
2937 SPI_SETDOUBLECLICKTIME_VALNAME,
2938 &double_click_time, &time );
2939 if (!time) time = 500;
2944 /*************************************************************************
2945 * GetSysColor (USER32.@)
2947 COLORREF WINAPI DECLSPEC_HOTPATCH GetSysColor( INT nIndex )
2949 if (nIndex >= 0 && nIndex < NUM_SYS_COLORS)
2950 return SysColors[nIndex];
2956 /*************************************************************************
2957 * SetSysColors (USER32.@)
2959 BOOL WINAPI SetSysColors( INT nChanges, const INT *lpSysColor,
2960 const COLORREF *lpColorValues )
2964 if (IS_INTRESOURCE(lpSysColor)) return FALSE; /* stupid app passes a color instead of an array */
2966 for (i = 0; i < nChanges; i++) SYSPARAMS_SetSysColor( lpSysColor[i], lpColorValues[i] );
2968 /* Send WM_SYSCOLORCHANGE message to all windows */
2970 SendMessageTimeoutW( HWND_BROADCAST, WM_SYSCOLORCHANGE, 0, 0, SMTO_ABORTIFHUNG, 2000, NULL );
2972 /* Repaint affected portions of all visible windows */
2974 RedrawWindow( GetDesktopWindow(), NULL, 0,
2975 RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN );
2980 /*************************************************************************
2981 * SetSysColorsTemp (USER32.@)
2985 * Called by W98SE desk.cpl Control Panel Applet:
2986 * handle = SetSysColorsTemp(ptr, ptr, nCount); ("set" call)
2987 * result = SetSysColorsTemp(NULL, NULL, handle); ("restore" call)
2989 * pPens is an array of COLORREF values, which seems to be used
2990 * to indicate the color values to create new pens with.
2992 * pBrushes is an array of solid brush handles (returned by a previous
2993 * CreateSolidBrush), which seems to contain the brush handles to set
2994 * for the system colors.
2996 * n seems to be used for
2997 * a) indicating the number of entries to operate on (length of pPens,
2999 * b) passing the handle that points to the previously used color settings.
3000 * I couldn't figure out in hell what kind of handle this is on
3001 * Windows. I just use a heap handle instead. Shouldn't matter anyway.
3004 * heap handle of our own copy of the current syscolors in case of
3005 * "set" call, i.e. pPens, pBrushes != NULL.
3006 * TRUE (unconditionally !) in case of "restore" call,
3007 * i.e. pPens, pBrushes == NULL.
3008 * FALSE in case of either pPens != NULL and pBrushes == NULL
3009 * or pPens == NULL and pBrushes != NULL.
3011 * I'm not sure whether this implementation is 100% correct. [AM]
3013 DWORD_PTR WINAPI SetSysColorsTemp( const COLORREF *pPens, const HBRUSH *pBrushes, DWORD_PTR n)
3017 if (pPens && pBrushes) /* "set" call */
3019 /* allocate our structure to remember old colors */
3020 LPVOID pOldCol = HeapAlloc(GetProcessHeap(), 0, sizeof(DWORD)+n*sizeof(HPEN)+n*sizeof(HBRUSH));
3022 *(DWORD *)p = n; p = (char*)p + sizeof(DWORD);
3023 memcpy(p, SysColorPens, n*sizeof(HPEN)); p = (char*)p + n*sizeof(HPEN);
3024 memcpy(p, SysColorBrushes, n*sizeof(HBRUSH));
3026 for (i=0; i < n; i++)
3028 SysColorPens[i] = CreatePen( PS_SOLID, 1, pPens[i] );
3029 SysColorBrushes[i] = pBrushes[i];
3032 return (DWORD_PTR)pOldCol;
3034 if (!pPens && !pBrushes) /* "restore" call */
3036 LPVOID pOldCol = (LPVOID)n; /* FIXME: not 64-bit safe */
3038 DWORD nCount = *(DWORD *)p;
3039 p = (char*)p + sizeof(DWORD);
3041 for (i=0; i < nCount; i++)
3043 DeleteObject(SysColorPens[i]);
3044 SysColorPens[i] = *(HPEN *)p; p = (char*)p + sizeof(HPEN);
3046 for (i=0; i < nCount; i++)
3048 SysColorBrushes[i] = *(HBRUSH *)p; p = (char*)p + sizeof(HBRUSH);
3050 /* get rid of storage structure */
3051 HeapFree(GetProcessHeap(), 0, pOldCol);
3059 /***********************************************************************
3060 * GetSysColorBrush (USER32.@)
3062 HBRUSH WINAPI DECLSPEC_HOTPATCH GetSysColorBrush( INT index )
3064 if (0 <= index && index < NUM_SYS_COLORS) return SysColorBrushes[index];
3065 WARN("Unknown index(%d)\n", index );
3070 /***********************************************************************
3073 HPEN SYSCOLOR_GetPen( INT index )
3075 /* We can assert here, because this function is internal to Wine */
3076 assert (0 <= index && index < NUM_SYS_COLORS);
3077 return SysColorPens[index];
3081 /***********************************************************************
3082 * ChangeDisplaySettingsA (USER32.@)
3084 LONG WINAPI ChangeDisplaySettingsA( LPDEVMODEA devmode, DWORD flags )
3086 if (devmode) devmode->dmDriverExtra = 0;
3088 return ChangeDisplaySettingsExA(NULL,devmode,NULL,flags,NULL);
3092 /***********************************************************************
3093 * ChangeDisplaySettingsW (USER32.@)
3095 LONG WINAPI ChangeDisplaySettingsW( LPDEVMODEW devmode, DWORD flags )
3097 if (devmode) devmode->dmDriverExtra = 0;
3099 return ChangeDisplaySettingsExW(NULL,devmode,NULL,flags,NULL);
3103 /***********************************************************************
3104 * ChangeDisplaySettingsExA (USER32.@)
3106 LONG WINAPI ChangeDisplaySettingsExA( LPCSTR devname, LPDEVMODEA devmode, HWND hwnd,
3107 DWORD flags, LPVOID lparam )
3110 UNICODE_STRING nameW;
3112 if (devname) RtlCreateUnicodeStringFromAsciiz(&nameW, devname);
3113 else nameW.Buffer = NULL;
3119 devmodeW = GdiConvertToDevmodeW(devmode);
3122 ret = ChangeDisplaySettingsExW(nameW.Buffer, devmodeW, hwnd, flags, lparam);
3123 HeapFree(GetProcessHeap(), 0, devmodeW);
3126 ret = DISP_CHANGE_SUCCESSFUL;
3130 ret = ChangeDisplaySettingsExW(nameW.Buffer, NULL, hwnd, flags, lparam);
3133 if (devname) RtlFreeUnicodeString(&nameW);
3138 /***********************************************************************
3139 * ChangeDisplaySettingsExW (USER32.@)
3141 LONG WINAPI ChangeDisplaySettingsExW( LPCWSTR devname, LPDEVMODEW devmode, HWND hwnd,
3142 DWORD flags, LPVOID lparam )
3144 /* make sure the desktop window is created before mode changing */
3147 return USER_Driver->pChangeDisplaySettingsEx( devname, devmode, hwnd, flags, lparam );
3151 /***********************************************************************
3152 * EnumDisplaySettingsW (USER32.@)
3155 * TRUE if nth setting exists found (described in the LPDEVMODEW struct)
3156 * FALSE if we do not have the nth setting
3158 BOOL WINAPI EnumDisplaySettingsW( LPCWSTR name, DWORD n, LPDEVMODEW devmode )
3160 return EnumDisplaySettingsExW(name, n, devmode, 0);
3164 /***********************************************************************
3165 * EnumDisplaySettingsA (USER32.@)
3167 BOOL WINAPI EnumDisplaySettingsA(LPCSTR name,DWORD n,LPDEVMODEA devmode)
3169 return EnumDisplaySettingsExA(name, n, devmode, 0);
3173 /***********************************************************************
3174 * EnumDisplaySettingsExA (USER32.@)
3176 BOOL WINAPI EnumDisplaySettingsExA(LPCSTR lpszDeviceName, DWORD iModeNum,
3177 LPDEVMODEA lpDevMode, DWORD dwFlags)
3181 UNICODE_STRING nameW;
3183 if (lpszDeviceName) RtlCreateUnicodeStringFromAsciiz(&nameW, lpszDeviceName);
3184 else nameW.Buffer = NULL;
3186 ret = EnumDisplaySettingsExW(nameW.Buffer,iModeNum,&devmodeW,dwFlags);
3189 lpDevMode->dmSize = FIELD_OFFSET(DEVMODEA, dmICMMethod);
3190 lpDevMode->dmSpecVersion = devmodeW.dmSpecVersion;
3191 lpDevMode->dmDriverVersion = devmodeW.dmDriverVersion;
3192 WideCharToMultiByte(CP_ACP, 0, devmodeW.dmDeviceName, -1,
3193 (LPSTR)lpDevMode->dmDeviceName, CCHDEVICENAME, NULL, NULL);
3194 lpDevMode->dmDriverExtra = 0; /* FIXME */
3195 lpDevMode->dmBitsPerPel = devmodeW.dmBitsPerPel;
3196 lpDevMode->dmPelsHeight = devmodeW.dmPelsHeight;
3197 lpDevMode->dmPelsWidth = devmodeW.dmPelsWidth;
3198 lpDevMode->u2.dmDisplayFlags = devmodeW.u2.dmDisplayFlags;
3199 lpDevMode->dmDisplayFrequency = devmodeW.dmDisplayFrequency;
3200 lpDevMode->dmFields = devmodeW.dmFields;
3202 lpDevMode->u1.s2.dmPosition.x = devmodeW.u1.s2.dmPosition.x;
3203 lpDevMode->u1.s2.dmPosition.y = devmodeW.u1.s2.dmPosition.y;
3204 lpDevMode->u1.s2.dmDisplayOrientation = devmodeW.u1.s2.dmDisplayOrientation;
3205 lpDevMode->u1.s2.dmDisplayFixedOutput = devmodeW.u1.s2.dmDisplayFixedOutput;
3207 if (lpszDeviceName) RtlFreeUnicodeString(&nameW);
3212 /***********************************************************************
3213 * EnumDisplaySettingsExW (USER32.@)
3215 BOOL WINAPI EnumDisplaySettingsExW(LPCWSTR lpszDeviceName, DWORD iModeNum,
3216 LPDEVMODEW lpDevMode, DWORD dwFlags)
3218 /* make sure the desktop window is created before mode enumeration */
3221 return USER_Driver->pEnumDisplaySettingsEx(lpszDeviceName, iModeNum, lpDevMode, dwFlags);
3224 /***********************************************************************
3225 * SetProcessDPIAware (USER32.@)
3227 BOOL WINAPI SetProcessDPIAware( VOID )