2 * System parameters functions
4 * Copyright 1994 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
33 #include "wine/winuser16.h"
37 #include "user_private.h"
38 #include "wine/unicode.h"
39 #include "wine/debug.h"
41 WINE_DEFAULT_DEBUG_CHANNEL(system);
43 /* System parameter indexes */
49 SPI_SETKEYBOARDSPEED_IDX,
50 SPI_ICONHORIZONTALSPACING_IDX,
51 SPI_SETSCREENSAVETIMEOUT_IDX,
52 SPI_SETGRIDGRANULARITY_IDX,
53 SPI_SETKEYBOARDDELAY_IDX,
54 SPI_ICONVERTICALSPACING_IDX,
55 SPI_SETICONTITLEWRAP_IDX,
56 SPI_SETMENUDROPALIGNMENT_IDX,
57 SPI_SETDOUBLECLKWIDTH_IDX,
58 SPI_SETDOUBLECLKHEIGHT_IDX,
59 SPI_SETDOUBLECLICKTIME_IDX,
60 SPI_SETMOUSEBUTTONSWAP_IDX,
61 SPI_SETDRAGFULLWINDOWS_IDX,
63 SPI_SETSHOWSOUNDS_IDX,
64 SPI_SETKEYBOARDPREF_IDX,
65 SPI_SETSCREENREADER_IDX,
66 SPI_SETSCREENSAVERRUNNING_IDX,
67 SPI_SETFONTSMOOTHING_IDX,
68 SPI_SETLISTBOXSMOOTHSCROLLING_IDX,
69 SPI_SETMOUSEHOVERWIDTH_IDX,
70 SPI_SETMOUSEHOVERHEIGHT_IDX,
71 SPI_SETMOUSEHOVERTIME_IDX,
72 SPI_SETMOUSESCROLLLINES_IDX,
73 SPI_SETMENUSHOWDELAY_IDX,
74 SPI_SETICONTITLELOGFONT_IDX,
75 SPI_SETLOWPOWERACTIVE_IDX,
76 SPI_SETPOWEROFFACTIVE_IDX,
77 SPI_USERPREFERENCEMASK_IDX,
78 SPI_NONCLIENTMETRICS_IDX,
82 static const char * const DefSysColors[] =
84 "Scrollbar", "192 192 192", /* COLOR_SCROLLBAR */
85 "Background", "0 128 128", /* COLOR_BACKGROUND */
86 "ActiveTitle", "0 0 128", /* COLOR_ACTIVECAPTION */
87 "InactiveTitle", "128 128 128", /* COLOR_INACTIVECAPTION */
88 "Menu", "192 192 192", /* COLOR_MENU */
89 "Window", "255 255 255", /* COLOR_WINDOW */
90 "WindowFrame", "0 0 0", /* COLOR_WINDOWFRAME */
91 "MenuText", "0 0 0", /* COLOR_MENUTEXT */
92 "WindowText", "0 0 0", /* COLOR_WINDOWTEXT */
93 "TitleText", "255 255 255", /* COLOR_CAPTIONTEXT */
94 "ActiveBorder", "192 192 192", /* COLOR_ACTIVEBORDER */
95 "InactiveBorder", "192 192 192", /* COLOR_INACTIVEBORDER */
96 "AppWorkSpace", "128 128 128", /* COLOR_APPWORKSPACE */
97 "Hilight", "0 0 128", /* COLOR_HIGHLIGHT */
98 "HilightText", "255 255 255", /* COLOR_HIGHLIGHTTEXT */
99 "ButtonFace", "192 192 192", /* COLOR_BTNFACE */
100 "ButtonShadow", "128 128 128", /* COLOR_BTNSHADOW */
101 "GrayText", "128 128 128", /* COLOR_GRAYTEXT */
102 "ButtonText", "0 0 0", /* COLOR_BTNTEXT */
103 "InactiveTitleText", "192 192 192", /* COLOR_INACTIVECAPTIONTEXT */
104 "ButtonHilight", "255 255 255", /* COLOR_BTNHIGHLIGHT */
105 "ButtonDkShadow", "0 0 0", /* COLOR_3DDKSHADOW */
106 "ButtonLight", "224 224 224", /* COLOR_3DLIGHT */
107 "InfoText", "0 0 0", /* COLOR_INFOTEXT */
108 "InfoWindow", "255 255 225", /* COLOR_INFOBK */
109 "ButtonAlternateFace", "180 180 180", /* COLOR_ALTERNATEBTNFACE */
110 "HotTrackingColor", "0 0 255", /* COLOR_HOTLIGHT */
111 "GradientActiveTitle", "16 132 208", /* COLOR_GRADIENTACTIVECAPTION */
112 "GradientInactiveTitle", "181 181 181", /* COLOR_GRADIENTINACTIVECAPTION */
113 "MenuHilight", "0 0 0", /* COLOR_MENUHILIGHT */
114 "MenuBar", "192 192 192" /* COLOR_MENUBAR */
118 * Names of the registry subkeys of HKEY_CURRENT_USER key and value names
119 * for the system parameters.
120 * Names of the keys are created by adding string "_REGKEY" to
121 * "SET" action names, value names are created by adding "_REG_NAME"
122 * to the "SET" action name.
124 static const WCHAR SPI_SETBEEP_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','S','o','u','n','d',0};
125 static const WCHAR SPI_SETBEEP_VALNAME[]= {'B','e','e','p',0};
126 static const WCHAR SPI_SETMOUSE_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
127 static const WCHAR SPI_SETMOUSE_VALNAME1[]= {'M','o','u','s','e','T','h','r','e','s','h','o','l','d','1',0};
128 static const WCHAR SPI_SETMOUSE_VALNAME2[]= {'M','o','u','s','e','T','h','r','e','s','h','o','l','d','2',0};
129 static const WCHAR SPI_SETMOUSE_VALNAME3[]= {'M','o','u','s','e','S','p','e','e','d',0};
130 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','\\',
131 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
132 static const WCHAR SPI_SETBORDER_VALNAME[]= {'B','o','r','d','e','r','W','i','d','t','h',0};
133 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};
134 static const WCHAR SPI_SETKEYBOARDSPEED_VALNAME[]= {'K','e','y','b','o','a','r','d','S','p','e','e','d',0};
135 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','\\',
136 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
137 static const WCHAR SPI_ICONHORIZONTALSPACING_VALNAME[]= {'I','c','o','n','S','p','a','c','i','n','g',0};
138 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};
139 static const WCHAR SPI_SETSCREENSAVETIMEOUT_VALNAME[]= {'S','c','r','e','e','n','S','a','v','e','T','i','m','e','O','u','t',0};
140 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};
141 static const WCHAR SPI_SETSCREENSAVEACTIVE_VALNAME[]= {'S','c','r','e','e','n','S','a','v','e','A','c','t','i','v','e',0};
142 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};
143 static const WCHAR SPI_SETGRIDGRANULARITY_VALNAME[]= {'G','r','i','d','G','r','a','n','u','l','a','r','i','t','y',0};
144 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};
145 static const WCHAR SPI_SETKEYBOARDDELAY_VALNAME[]= {'K','e','y','b','o','a','r','d','D','e','l','a','y',0};
146 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','\\',
147 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
148 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};
149 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','\\',
150 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
151 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};
152 static const WCHAR SPI_SETICONTITLEWRAP_VALNAME[]= {'I','c','o','n','T','i','t','l','e','W','r','a','p',0};
153 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','\\',
154 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
155 static const WCHAR SPI_SETICONTITLELOGFONT_VALNAME[]= {'I','c','o','n','F','o','n','t',0};
156 static const WCHAR SPI_SETMENUDROPALIGNMENT_REGKEY1[]= {'S','o','f','t','w','a','r','e','\\',
157 'M','i','c','r','o','s','o','f','t','\\',
158 'W','i','n','d','o','w','s',' ','N','T','\\',
159 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
160 'W','i','n','d','o','w','s',0};
161 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};
162 static const WCHAR SPI_SETMENUDROPALIGNMENT_VALNAME[]= {'M','e','n','u','D','r','o','p','A','l','i','g','n','m','e','n','t',0};
163 static const WCHAR SPI_SETDOUBLECLKWIDTH_REGKEY1[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
164 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};
165 static const WCHAR SPI_SETDOUBLECLKWIDTH_VALNAME[]= {'D','o','u','b','l','e','C','l','i','c','k','W','i','d','t','h',0};
166 static const WCHAR SPI_SETDOUBLECLKHEIGHT_REGKEY1[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
167 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};
168 static const WCHAR SPI_SETDOUBLECLKHEIGHT_VALNAME[]= {'D','o','u','b','l','e','C','l','i','c','k','H','e','i','g','h','t',0};
169 static const WCHAR SPI_SETDOUBLECLICKTIME_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
170 static const WCHAR SPI_SETDOUBLECLICKTIME_VALNAME[]= {'D','o','u','b','l','e','C','l','i','c','k','S','p','e','e','d',0};
171 static const WCHAR SPI_SETMOUSEBUTTONSWAP_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
172 static const WCHAR SPI_SETMOUSEBUTTONSWAP_VALNAME[]= {'S','w','a','p','M','o','u','s','e','B','u','t','t','o','n','s',0};
173 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};
174 static const WCHAR SPI_SETDRAGFULLWINDOWS_VALNAME[]= {'D','r','a','g','F','u','l','l','W','i','n','d','o','w','s',0};
175 static const WCHAR SPI_SETSHOWSOUNDS_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\',
176 'A','c','c','e','s','s','i','b','i','l','i','t','y','\\',
177 'S','h','o','w','S','o','u','n','d','s',0};
178 static const WCHAR SPI_SETSHOWSOUNDS_VALNAME[]= {'O','n',0};
179 static const WCHAR SPI_SETKEYBOARDPREF_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\',
180 'A','c','c','e','s','s','i','b','i','l','i','t','y','\\',
181 'K','e','y','b','o','a','r','d',' ','P','r','e','f','e','r','e','n','c','e',0};
182 static const WCHAR SPI_SETKEYBOARDPREF_VALNAME[]= {'O','n',0};
183 static const WCHAR SPI_SETSCREENREADER_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\',
184 'A','c','c','e','s','s','i','b','i','l','i','t','y','\\',
185 'B','l','i','n','d',' ','A','c','c','e','s','s',0};
186 static const WCHAR SPI_SETSCREENREADER_VALNAME[]= {'O','n',0};
187 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};
188 static const WCHAR SPI_SETDESKWALLPAPER_VALNAME[]= {'W','a','l','l','p','a','p','e','r',0};
189 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};
190 static const WCHAR SPI_SETFONTSMOOTHING_VALNAME[]= {'F','o','n','t','S','m','o','o','t','h','i','n','g',0};
191 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};
192 static const WCHAR SPI_SETLOWPOWERACTIVE_VALNAME[]= {'L','o','w','P','o','w','e','r','A','c','t','i','v','e',0};
193 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};
194 static const WCHAR SPI_SETPOWEROFFACTIVE_VALNAME[]= {'P','o','w','e','r','O','f','f','A','c','t','i','v','e',0};
195 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};
196 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};
197 static const WCHAR SPI_SETLISTBOXSMOOTHSCROLLING_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
198 static const WCHAR SPI_SETLISTBOXSMOOTHSCROLLING_VALNAME[]= {'S','m','o','o','t','h','S','c','r','o','l','l',0};
199 static const WCHAR SPI_SETMOUSEHOVERWIDTH_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
200 static const WCHAR SPI_SETMOUSEHOVERWIDTH_VALNAME[]= {'M','o','u','s','e','H','o','v','e','r','W','i','d','t','h',0};
201 static const WCHAR SPI_SETMOUSEHOVERHEIGHT_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
202 static const WCHAR SPI_SETMOUSEHOVERHEIGHT_VALNAME[]= {'M','o','u','s','e','H','o','v','e','r','H','e','i','g','h','t',0};
203 static const WCHAR SPI_SETMOUSEHOVERTIME_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
204 static const WCHAR SPI_SETMOUSEHOVERTIME_VALNAME[]= {'M','o','u','s','e','H','o','v','e','r','T','i','m','e',0};
205 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};
206 static const WCHAR SPI_SETMOUSESCROLLLINES_VALNAME[]= {'W','h','e','e','l','S','c','r','o','l','l','L','i','n','e','s',0};
207 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};
208 static const WCHAR SPI_SETMENUSHOWDELAY_VALNAME[]= {'M','e','n','u','S','h','o','w','D','e','l','a','y',0};
210 /* FIXME - real values */
211 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};
212 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};
214 static const WCHAR METRICS_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p','\\',
215 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
216 static const WCHAR METRICS_SCROLLWIDTH_VALNAME[]= {'S','c','r','o','l','l','W','i','d','t','h',0};
217 static const WCHAR METRICS_SCROLLHEIGHT_VALNAME[]= {'S','c','r','o','l','l','H','e','i','g','h','t',0};
218 static const WCHAR METRICS_CAPTIONWIDTH_VALNAME[]= {'C','a','p','t','i','o','n','W','i','d','t','h',0};
219 static const WCHAR METRICS_CAPTIONHEIGHT_VALNAME[]= {'C','a','p','t','i','o','n','H','e','i','g','h','t',0};
220 static const WCHAR METRICS_SMCAPTIONWIDTH_VALNAME[]= {'S','m','C','a','p','t','i','o','n','W','i','d','t','h',0};
221 static const WCHAR METRICS_SMCAPTIONHEIGHT_VALNAME[]= {'S','m','C','a','p','t','i','o','n','H','e','i','g','h','t',0};
222 static const WCHAR METRICS_MENUWIDTH_VALNAME[]= {'M','e','n','u','W','i','d','t','h',0};
223 static const WCHAR METRICS_MENUHEIGHT_VALNAME[]= {'M','e','n','u','H','e','i','g','h','t',0};
224 static const WCHAR METRICS_ICONSIZE_VALNAME[]= {'S','h','e','l','l',' ','I','c','o','n',' ','S','i','z','e',0};
225 static const WCHAR METRICS_BORDERWIDTH_VALNAME[]= {'B','o','r','d','e','r','W','i','d','t','h',0};
226 static const WCHAR METRICS_CAPTIONLOGFONT_VALNAME[]= {'C','a','p','t','i','o','n','F','o','n','t',0};
227 static const WCHAR METRICS_SMCAPTIONLOGFONT_VALNAME[]={'S','m','C','a','p','t','i','o','n','F','o','n','t',0};
228 static const WCHAR METRICS_MENULOGFONT_VALNAME[]= {'M','e','n','u','F','o','n','t',0};
229 static const WCHAR METRICS_MESSAGELOGFONT_VALNAME[]= {'M','e','s','s','a','g','e','F','o','n','t',0};
230 static const WCHAR METRICS_STATUSLOGFONT_VALNAME[]= {'S','t','a','t','u','s','F','o','n','t',0};
232 /* volatile registry branch under CURRENT_USER_REGKEY for temporary values storage */
233 static const WCHAR WINE_CURRENT_USER_REGKEY[] = {'S','o','f','t','w','a','r','e','\\',
234 'W','i','n','e','\\',
235 'T','e','m','p','o','r','a','r','y',' ',
236 'S','y','s','t','e','m',' ',
237 'P','a','r','a','m','e','t','e','r','s',0};
240 static const WCHAR Yes[]= {'Y','e','s',0};
241 static const WCHAR No[]= {'N','o',0};
242 static const WCHAR Desktop[]= {'D','e','s','k','t','o','p',0};
243 static const WCHAR Pattern[]= {'P','a','t','t','e','r','n',0};
244 static const WCHAR MenuFont[]= {'M','e','n','u','F','o','n','t',0};
245 static const WCHAR MenuFontSize[]= {'M','e','n','u','F','o','n','t','S','i','z','e',0};
246 static const WCHAR StatusFont[]= {'S','t','a','t','u','s','F','o','n','t',0};
247 static const WCHAR StatusFontSize[]= {'S','t','a','t','u','s','F','o','n','t','S','i','z','e',0};
248 static const WCHAR MessageFont[]= {'M','e','s','s','a','g','e','F','o','n','t',0};
249 static const WCHAR MessageFontSize[]= {'M','e','s','s','a','g','e','F','o','n','t','S','i','z','e',0};
250 static const WCHAR System[]= {'S','y','s','t','e','m',0};
251 static const WCHAR IconTitleSize[]= {'I','c','o','n','T','i','t','l','e','S','i','z','e',0};
252 static const WCHAR IconTitleFaceName[]= {'I','c','o','n','T','i','t','l','e','F','a','c','e','N','a','m','e',0};
253 static const WCHAR defPattern[]= {'1','7','0',' ','8','5',' ','1','7','0',' ','8','5',' ','1','7','0',' ','8','5',
254 ' ','1','7','0',' ','8','5',0};
255 static const WCHAR CSu[]= {'%','u',0};
256 static const WCHAR CSd[]= {'%','d',0};
258 /* Indicators whether system parameter value is loaded */
259 static char spi_loaded[SPI_INDEX_COUNT];
261 static BOOL notify_change = TRUE;
263 /* System parameters storage */
264 static BOOL beep_active = TRUE;
265 static int mouse_threshold1 = 6;
266 static int mouse_threshold2 = 10;
267 static int mouse_speed = 1;
268 static UINT border = 1;
269 static UINT keyboard_speed = 31;
270 static UINT screensave_timeout = 300;
271 static UINT grid_granularity = 0;
272 static UINT keyboard_delay = 1;
273 static UINT double_click_width = 4;
274 static UINT double_click_height = 4;
275 static UINT double_click_time = 500;
276 static BOOL drag_full_windows = FALSE;
277 static RECT work_area;
278 static BOOL keyboard_pref = TRUE;
279 static BOOL screen_reader = FALSE;
280 static UINT mouse_hover_width = 4;
281 static UINT mouse_hover_height = 4;
282 static UINT mouse_hover_time = 400;
283 static UINT mouse_scroll_lines = 3;
284 static UINT menu_show_delay = 400;
285 static UINT menu_drop_alignment = 0;
286 static BOOL screensaver_running = FALSE;
287 static UINT font_smoothing = 0; /* 0x01 for 95/98/NT, 0x02 for 98/ME/2k/XP */
288 static BOOL lowpoweractive = FALSE;
289 static BOOL poweroffactive = FALSE;
290 static BOOL show_sounds = FALSE;
291 static BOOL swap_buttons = FALSE;
292 static BOOL listbox_smoothscrolling = FALSE;
293 static BYTE user_prefs[4];
295 static MINIMIZEDMETRICS minimized_metrics =
297 sizeof(MINIMIZEDMETRICS),
301 ARW_HIDE /* iArrange */
304 static ICONMETRICSW icon_metrics =
306 sizeof(ICONMETRICSW),
307 75, /* iHorzSpacing */
308 75, /* iVertSpacing */
309 TRUE, /* iTitleWrap */
310 { -11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
311 OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH } /* lfFont */
314 static NONCLIENTMETRICSW nonclient_metrics =
316 sizeof(NONCLIENTMETRICSW),
317 1, /* iBorderWidth */
318 16, /* iScrollWidth */
319 16, /* iScrollHeight */
320 18, /* iCaptionWidth */
321 18, /* iCaptionHeight */
322 { 0 }, /* lfCaptionFont */
323 13, /* iSmCaptionWidth */
324 15, /* iSmCaptionHeight */
325 { 0 }, /* lfSmCaptionFont */
327 18, /* iMenuHeight */
328 { 0 }, /* lfMenuFont */
329 { 0 }, /* lfStatusFont */
330 { 0 } /* lfMessageFont */
333 static SIZE icon_size = { 32, 32 };
334 static SIZE scroll_height = { 16, 16 };
336 #define NUM_SYS_COLORS (COLOR_MENUBAR+1)
338 static COLORREF SysColors[NUM_SYS_COLORS];
339 static HBRUSH SysColorBrushes[NUM_SYS_COLORS];
340 static HPEN SysColorPens[NUM_SYS_COLORS];
342 static const WORD wPattern55AA[] = { 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa };
344 HBRUSH SYSCOLOR_55AABrush = 0;
346 extern void __wine_make_gdi_object_system( HGDIOBJ handle, BOOL set );
349 /* This function is a copy of the one in objects/font.c */
350 static void SYSPARAMS_LogFont32ATo16( const LOGFONTA* font32, LPLOGFONT16 font16 )
352 font16->lfHeight = font32->lfHeight;
353 font16->lfWidth = font32->lfWidth;
354 font16->lfEscapement = font32->lfEscapement;
355 font16->lfOrientation = font32->lfOrientation;
356 font16->lfWeight = font32->lfWeight;
357 font16->lfItalic = font32->lfItalic;
358 font16->lfUnderline = font32->lfUnderline;
359 font16->lfStrikeOut = font32->lfStrikeOut;
360 font16->lfCharSet = font32->lfCharSet;
361 font16->lfOutPrecision = font32->lfOutPrecision;
362 font16->lfClipPrecision = font32->lfClipPrecision;
363 font16->lfQuality = font32->lfQuality;
364 font16->lfPitchAndFamily = font32->lfPitchAndFamily;
365 lstrcpynA( font16->lfFaceName, font32->lfFaceName, LF_FACESIZE );
368 static void SYSPARAMS_LogFont16To32W( const LOGFONT16 *font16, LPLOGFONTW font32 )
370 font32->lfHeight = font16->lfHeight;
371 font32->lfWidth = font16->lfWidth;
372 font32->lfEscapement = font16->lfEscapement;
373 font32->lfOrientation = font16->lfOrientation;
374 font32->lfWeight = font16->lfWeight;
375 font32->lfItalic = font16->lfItalic;
376 font32->lfUnderline = font16->lfUnderline;
377 font32->lfStrikeOut = font16->lfStrikeOut;
378 font32->lfCharSet = font16->lfCharSet;
379 font32->lfOutPrecision = font16->lfOutPrecision;
380 font32->lfClipPrecision = font16->lfClipPrecision;
381 font32->lfQuality = font16->lfQuality;
382 font32->lfPitchAndFamily = font16->lfPitchAndFamily;
383 MultiByteToWideChar( CP_ACP, 0, font16->lfFaceName, -1, font32->lfFaceName, LF_FACESIZE );
384 font32->lfFaceName[LF_FACESIZE-1] = 0;
387 static void SYSPARAMS_LogFont32WTo32A( const LOGFONTW* font32W, LPLOGFONTA font32A )
389 font32A->lfHeight = font32W->lfHeight;
390 font32A->lfWidth = font32W->lfWidth;
391 font32A->lfEscapement = font32W->lfEscapement;
392 font32A->lfOrientation = font32W->lfOrientation;
393 font32A->lfWeight = font32W->lfWeight;
394 font32A->lfItalic = font32W->lfItalic;
395 font32A->lfUnderline = font32W->lfUnderline;
396 font32A->lfStrikeOut = font32W->lfStrikeOut;
397 font32A->lfCharSet = font32W->lfCharSet;
398 font32A->lfOutPrecision = font32W->lfOutPrecision;
399 font32A->lfClipPrecision = font32W->lfClipPrecision;
400 font32A->lfQuality = font32W->lfQuality;
401 font32A->lfPitchAndFamily = font32W->lfPitchAndFamily;
402 WideCharToMultiByte( CP_ACP, 0, font32W->lfFaceName, -1, font32A->lfFaceName, LF_FACESIZE, NULL, NULL );
403 font32A->lfFaceName[LF_FACESIZE-1] = 0;
406 static void SYSPARAMS_NonClientMetrics32ATo16( const NONCLIENTMETRICSA* lpnm32, LPNONCLIENTMETRICS16 lpnm16 )
408 lpnm16->iBorderWidth = lpnm32->iBorderWidth;
409 lpnm16->iScrollWidth = lpnm32->iScrollWidth;
410 lpnm16->iScrollHeight = lpnm32->iScrollHeight;
411 lpnm16->iCaptionWidth = lpnm32->iCaptionWidth;
412 lpnm16->iCaptionHeight = lpnm32->iCaptionHeight;
413 SYSPARAMS_LogFont32ATo16( &lpnm32->lfCaptionFont, &lpnm16->lfCaptionFont );
414 lpnm16->iSmCaptionWidth = lpnm32->iSmCaptionWidth;
415 lpnm16->iSmCaptionHeight = lpnm32->iSmCaptionHeight;
416 SYSPARAMS_LogFont32ATo16( &lpnm32->lfSmCaptionFont, &lpnm16->lfSmCaptionFont );
417 lpnm16->iMenuWidth = lpnm32->iMenuWidth;
418 lpnm16->iMenuHeight = lpnm32->iMenuHeight;
419 SYSPARAMS_LogFont32ATo16( &lpnm32->lfMenuFont, &lpnm16->lfMenuFont );
420 SYSPARAMS_LogFont32ATo16( &lpnm32->lfStatusFont, &lpnm16->lfStatusFont );
421 SYSPARAMS_LogFont32ATo16( &lpnm32->lfMessageFont, &lpnm16->lfMessageFont );
424 static void SYSPARAMS_NonClientMetrics32WTo32A( const NONCLIENTMETRICSW* lpnm32W, LPNONCLIENTMETRICSA lpnm32A )
426 lpnm32A->iBorderWidth = lpnm32W->iBorderWidth;
427 lpnm32A->iScrollWidth = lpnm32W->iScrollWidth;
428 lpnm32A->iScrollHeight = lpnm32W->iScrollHeight;
429 lpnm32A->iCaptionWidth = lpnm32W->iCaptionWidth;
430 lpnm32A->iCaptionHeight = lpnm32W->iCaptionHeight;
431 SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfCaptionFont, &lpnm32A->lfCaptionFont );
432 lpnm32A->iSmCaptionWidth = lpnm32W->iSmCaptionWidth;
433 lpnm32A->iSmCaptionHeight = lpnm32W->iSmCaptionHeight;
434 SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfSmCaptionFont, &lpnm32A->lfSmCaptionFont );
435 lpnm32A->iMenuWidth = lpnm32W->iMenuWidth;
436 lpnm32A->iMenuHeight = lpnm32W->iMenuHeight;
437 SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfMenuFont, &lpnm32A->lfMenuFont );
438 SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfStatusFont, &lpnm32A->lfStatusFont );
439 SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfMessageFont, &lpnm32A->lfMessageFont );
443 /***********************************************************************
444 * get_volatile_regkey
446 * Return a handle to the volatile registry key used to store
447 * non-permanently modified parameters.
449 static HKEY get_volatile_regkey(void)
451 static HKEY volatile_key;
455 /* @@ Wine registry key: HKCU\Software\Wine\Temporary System Parameters */
456 if (RegCreateKeyExW( HKEY_CURRENT_USER, WINE_CURRENT_USER_REGKEY,
457 0, 0, REG_OPTION_VOLATILE, KEY_ALL_ACCESS, 0,
458 &volatile_key, 0 ) != ERROR_SUCCESS)
459 ERR("Can't create wine configuration registry branch\n");
464 /***********************************************************************
465 * SYSPARAMS_NotifyChange
467 * Sends notification about system parameter update.
469 static void SYSPARAMS_NotifyChange( UINT uiAction, UINT fWinIni )
471 static const WCHAR emptyW[1];
475 if (fWinIni & SPIF_UPDATEINIFILE)
477 if (fWinIni & (SPIF_SENDWININICHANGE | SPIF_SENDCHANGE))
478 SendMessageTimeoutW(HWND_BROADCAST, WM_SETTINGCHANGE,
479 uiAction, (LPARAM) emptyW,
480 SMTO_ABORTIFHUNG, 2000, NULL );
484 /* FIXME notify other wine processes with internal message */
490 /***********************************************************************
491 * Loads system parameter from user profile.
493 static BOOL SYSPARAMS_LoadRaw( LPCWSTR lpRegKey, LPCWSTR lpValName, LPBYTE lpBuf, DWORD count )
499 memset( lpBuf, 0, count );
500 if ((RegOpenKeyW( get_volatile_regkey(), lpRegKey, &hKey ) == ERROR_SUCCESS) ||
501 (RegOpenKeyW( HKEY_CURRENT_USER, lpRegKey, &hKey ) == ERROR_SUCCESS))
503 ret = !RegQueryValueExW( hKey, lpValName, NULL, &type, (LPBYTE)lpBuf, &count);
509 static BOOL SYSPARAMS_Load( LPCWSTR lpRegKey, LPCWSTR lpValName, LPWSTR lpBuf, DWORD count )
511 return SYSPARAMS_LoadRaw( lpRegKey, lpValName, (LPBYTE)lpBuf, count );
514 /***********************************************************************
515 * Saves system parameter to user profile.
518 /* Save data as-is */
519 static BOOL SYSPARAMS_SaveRaw( LPCWSTR lpRegKey, LPCWSTR lpValName,
520 const BYTE* lpValue, DWORD valueSize,
521 DWORD type, UINT fWinIni )
528 if (fWinIni & SPIF_UPDATEINIFILE)
530 hBaseKey = HKEY_CURRENT_USER;
535 hBaseKey = get_volatile_regkey();
536 dwOptions = REG_OPTION_VOLATILE;
539 if (RegCreateKeyExW( hBaseKey, lpRegKey,
540 0, 0, dwOptions, KEY_ALL_ACCESS,
541 0, &hKey, 0 ) == ERROR_SUCCESS)
543 if (RegSetValueExW( hKey, lpValName, 0, type,
544 lpValue, valueSize) == ERROR_SUCCESS)
547 if (hBaseKey == HKEY_CURRENT_USER)
548 RegDeleteKeyW( get_volatile_regkey(), lpRegKey );
555 /* Convenience function to save strings */
556 static BOOL SYSPARAMS_Save( LPCWSTR lpRegKey, LPCWSTR lpValName, LPCWSTR lpValue,
559 return SYSPARAMS_SaveRaw( lpRegKey, lpValName, (const BYTE*)lpValue,
560 (strlenW(lpValue) + 1)*sizeof(WCHAR), REG_SZ, fWinIni );
564 static inline HDC get_display_dc(void)
566 static const WCHAR DISPLAY[] = {'D','I','S','P','L','A','Y',0};
567 static HDC display_dc;
568 if (!display_dc) display_dc = CreateICW( DISPLAY, NULL, NULL, NULL );
572 static inline int get_display_dpi(void)
574 static int display_dpi;
575 if (!display_dpi) display_dpi = GetDeviceCaps( get_display_dc(), LOGPIXELSY );
579 /***********************************************************************
580 * SYSPARAMS_Twips2Pixels
582 * Convert a dimension value that was obtained from the registry. These are
583 * quoted as being "twips" values if negative and pixels if positive.
584 * One inch is 1440 twips. So to convert, divide by 1440 to get inches and
585 * multiply that by the dots-per-inch to get the size in pixels.
587 * MSDN Library - April 2001 -> Resource Kits ->
588 * Windows 2000 Resource Kit Reference ->
589 * Technical Reference to the Windows 2000 Registry ->
590 * HKEY_CURRENT_USER -> Control Panel -> Desktop -> WindowMetrics
592 inline static int SYSPARAMS_Twips2Pixels(int x)
595 x = (-x * get_display_dpi() + 720) / 1440;
599 /***********************************************************************
602 * Get a registry entry from the already open key. This allows us to open the
603 * section once and read several values.
605 * Of course this function belongs somewhere more usable but here will do
608 static int get_reg_metric( HKEY hkey, LPCWSTR lpValName, int default_value )
610 int value = default_value;
614 DWORD type, count = sizeof(buffer);
615 if(!RegQueryValueExW( hkey, lpValName, NULL, &type, (LPBYTE)buffer, &count) )
619 /* Are there any utilities for converting registry entries
622 /* FIXME_(reg)("We need reg format converter\n"); */
625 value = atoiW(buffer);
628 return SYSPARAMS_Twips2Pixels(value);
632 /*************************************************************************
633 * SYSPARAMS_SetSysColor
635 static void SYSPARAMS_SetSysColor( int index, COLORREF color )
637 if (index < 0 || index >= NUM_SYS_COLORS) return;
638 SysColors[index] = color;
639 if (SysColorBrushes[index])
641 __wine_make_gdi_object_system( SysColorBrushes[index], FALSE);
642 DeleteObject( SysColorBrushes[index] );
644 SysColorBrushes[index] = CreateSolidBrush( color );
645 __wine_make_gdi_object_system( SysColorBrushes[index], TRUE);
647 if (SysColorPens[index])
649 __wine_make_gdi_object_system( SysColorPens[index], FALSE);
650 DeleteObject( SysColorPens[index] );
652 SysColorPens[index] = CreatePen( PS_SOLID, 1, color );
653 __wine_make_gdi_object_system( SysColorPens[index], TRUE);
656 /* load a uint parameter from the registry */
657 static BOOL get_uint_param( unsigned int idx, LPCWSTR regkey, LPCWSTR value,
658 UINT *value_ptr, UINT *ret_ptr )
660 if (!ret_ptr) return FALSE;
661 if (!spi_loaded[idx])
665 if (SYSPARAMS_Load( regkey, value, buf, sizeof(buf) )) *value_ptr = atoiW( buf );
666 spi_loaded[idx] = TRUE;
668 *ret_ptr = *value_ptr;
672 /* load a twips parameter from the registry */
673 static BOOL get_twips_param( unsigned int idx, LPCWSTR regkey, LPCWSTR value,
674 UINT *value_ptr, UINT *ret_ptr )
676 if (!ret_ptr) return FALSE;
677 if (!spi_loaded[idx])
681 if (SYSPARAMS_Load( regkey, value, buf, sizeof(buf) ))
682 *value_ptr = SYSPARAMS_Twips2Pixels( atoiW(buf) );
683 spi_loaded[idx] = TRUE;
685 *ret_ptr = *value_ptr;
689 /* load a boolean parameter from the registry */
690 static inline BOOL get_bool_param( unsigned int idx, LPCWSTR regkey, LPCWSTR value,
691 BOOL *value_ptr, BOOL *ret_ptr )
693 return get_uint_param( idx, regkey, value, (UINT *)value_ptr, (UINT *)ret_ptr );
696 /* set a uint parameter that is mirrored in two different registry locations */
697 static BOOL set_uint_param_mirrored( unsigned int idx, LPCWSTR regkey, LPCWSTR regkey_mirror,
698 LPCWSTR value, UINT *value_ptr, UINT new_val, UINT fWinIni )
702 wsprintfW(buf, CSu, new_val);
703 if (!SYSPARAMS_Save( regkey, value, buf, fWinIni )) return FALSE;
704 if (regkey_mirror) SYSPARAMS_Save( regkey_mirror, value, buf, fWinIni );
705 *value_ptr = new_val;
706 spi_loaded[idx] = TRUE;
710 /* set a uint parameter in the registry */
711 static inline BOOL set_uint_param( unsigned int idx, LPCWSTR regkey, LPCWSTR value,
712 UINT *value_ptr, UINT new_val, UINT fWinIni )
714 return set_uint_param_mirrored( idx, regkey, NULL, value, value_ptr, new_val, fWinIni );
717 /* set a boolean parameter that is mirrored in two different registry locations */
718 static inline BOOL set_bool_param_mirrored( unsigned int idx, LPCWSTR regkey, LPCWSTR regkey_mirror,
719 LPCWSTR value, BOOL *value_ptr, BOOL new_val, UINT fWinIni )
721 return set_uint_param_mirrored( idx, regkey, regkey_mirror, value,
722 (UINT *)value_ptr, new_val, fWinIni );
725 /* set a boolean parameter in the registry */
726 static inline BOOL set_bool_param( unsigned int idx, LPCWSTR regkey, LPCWSTR value,
727 BOOL *value_ptr, BOOL new_val, UINT fWinIni )
729 return set_uint_param( idx, regkey, value, (UINT *)value_ptr, new_val, fWinIni );
732 /* load a boolean parameter from the user preference key */
733 static BOOL get_user_pref_param( UINT offset, UINT mask, BOOL *ret_ptr )
735 if (!ret_ptr) return FALSE;
737 if (!spi_loaded[SPI_USERPREFERENCEMASK_IDX])
739 SYSPARAMS_LoadRaw( SPI_USERPREFERENCEMASK_REGKEY,
740 SPI_USERPREFERENCEMASK_VALNAME,
741 user_prefs, sizeof(user_prefs) );
742 spi_loaded[SPI_USERPREFERENCEMASK_IDX] = TRUE;
744 *ret_ptr = (user_prefs[offset] & mask) != 0;
748 /* set a boolean parameter in the user preference key */
749 static BOOL set_user_pref_param( UINT offset, UINT mask, BOOL value, BOOL fWinIni )
751 SYSPARAMS_LoadRaw( SPI_USERPREFERENCEMASK_REGKEY,
752 SPI_USERPREFERENCEMASK_VALNAME,
753 user_prefs, sizeof(user_prefs) );
754 spi_loaded[SPI_USERPREFERENCEMASK_IDX] = TRUE;
756 if (value) user_prefs[offset] |= mask;
757 else user_prefs[offset] &= ~mask;
759 SYSPARAMS_SaveRaw( SPI_USERPREFERENCEMASK_REGKEY,
760 SPI_USERPREFERENCEMASK_VALNAME,
761 user_prefs, sizeof(user_prefs), REG_BINARY, fWinIni );
765 /***********************************************************************
768 * Initialisation of the system metrics array.
770 void SYSPARAMS_Init(void)
772 HKEY hkey; /* key to the window metrics area of the registry */
777 /* initialize system colors */
779 if (RegCreateKeyExA(HKEY_CURRENT_USER, "Control Panel\\Colors", 0, 0, 0, KEY_ALL_ACCESS, 0, &hkey, 0))
781 for (i = 0; i < NUM_SYS_COLORS; i++)
785 /* first try, registry */
788 DWORD dwDataSize = sizeof(buffer);
789 if (!(RegQueryValueExA(hkey,DefSysColors[i*2], 0, 0, (LPBYTE) buffer, &dwDataSize)))
790 if (sscanf( buffer, "%d %d %d", &r, &g, &b ) == 3) bOk = TRUE;
793 /* second try, win.ini */
796 GetProfileStringA( "colors", DefSysColors[i*2], DefSysColors[i*2+1], buffer, 100 );
797 if (sscanf( buffer, " %d %d %d", &r, &g, &b ) == 3) bOk = TRUE;
800 /* last chance, take the default */
803 int iNumColors = sscanf( DefSysColors[i*2+1], " %d %d %d", &r, &g, &b );
804 assert (iNumColors==3);
807 SYSPARAMS_SetSysColor( i, RGB(r,g,b) );
809 if (hkey) RegCloseKey( hkey );
811 /* create 55AA bitmap */
813 h55AABitmap = CreateBitmap( 8, 8, 1, 1, wPattern55AA );
814 SYSCOLOR_55AABrush = CreatePatternBrush( h55AABitmap );
815 __wine_make_gdi_object_system( SYSCOLOR_55AABrush, TRUE );
819 /***********************************************************************
822 * Tries to retrieve logfont info from the specified key and value
824 static BOOL reg_get_logfont(LPCWSTR key, LPCWSTR value, LOGFONTW *lf)
833 base_keys[0] = get_volatile_regkey();
834 base_keys[1] = HKEY_CURRENT_USER;
836 for(i = 0; i < 2 && !found; i++)
838 if(RegOpenKeyW(base_keys[i], key, &hkey) == ERROR_SUCCESS)
840 size = sizeof(lfbuf);
841 if(RegQueryValueExW(hkey, value, NULL, &type, (LPBYTE)&lfbuf, &size) == ERROR_SUCCESS &&
844 if( size == sizeof(lfbuf))
847 memcpy(lf, &lfbuf, size);
848 } else if( size == sizeof( LOGFONT16))
849 { /* win9x-winME format */
851 SYSPARAMS_LogFont16To32W( (LOGFONT16*) &lfbuf, lf);
853 WARN("Unknown format in key %s value %s, size is %ld\n",
854 debugstr_w( key), debugstr_w( value), size);
859 if( found && lf->lfHeight > 0) {
860 /* positive height value means points ( inch/72 ) */
861 lf->lfHeight = -MulDiv( lf->lfHeight, get_display_dpi(), 72);
866 /* load all the non-client metrics */
867 static void load_nonclient_metrics(void)
871 if (RegOpenKeyExW (HKEY_CURRENT_USER, METRICS_REGKEY,
872 0, KEY_QUERY_VALUE, &hkey) != ERROR_SUCCESS) hkey = 0;
874 /* initialize geometry entries */
875 nonclient_metrics.iBorderWidth = 1;
876 nonclient_metrics.iScrollWidth = get_reg_metric(hkey, METRICS_SCROLLWIDTH_VALNAME, 16);
877 nonclient_metrics.iScrollHeight = nonclient_metrics.iScrollWidth;
879 /* size of the normal caption buttons */
880 nonclient_metrics.iCaptionHeight = get_reg_metric(hkey, METRICS_CAPTIONHEIGHT_VALNAME, 18);
881 nonclient_metrics.iCaptionWidth = get_reg_metric(hkey, METRICS_CAPTIONWIDTH_VALNAME, nonclient_metrics.iCaptionHeight);
883 /* caption font metrics */
884 if (!reg_get_logfont(METRICS_REGKEY, METRICS_CAPTIONLOGFONT_VALNAME, &nonclient_metrics.lfCaptionFont))
886 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &nonclient_metrics.lfCaptionFont, 0 );
887 nonclient_metrics.lfCaptionFont.lfWeight = FW_BOLD;
890 /* size of the small caption buttons */
891 nonclient_metrics.iSmCaptionWidth = get_reg_metric(hkey, METRICS_SMCAPTIONWIDTH_VALNAME, 13);
892 nonclient_metrics.iSmCaptionHeight = get_reg_metric(hkey, METRICS_SMCAPTIONHEIGHT_VALNAME, 15);
894 /* small caption font metrics */
895 if (!reg_get_logfont(METRICS_REGKEY, METRICS_SMCAPTIONLOGFONT_VALNAME, &nonclient_metrics.lfSmCaptionFont))
896 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &nonclient_metrics.lfSmCaptionFont, 0 );
898 /* menus, FIXME: names of wine.conf entries are bogus */
900 /* size of the menu (MDI) buttons */
901 nonclient_metrics.iMenuHeight = get_reg_metric(hkey, METRICS_MENUHEIGHT_VALNAME, 18);
902 nonclient_metrics.iMenuWidth = get_reg_metric(hkey, METRICS_MENUWIDTH_VALNAME, nonclient_metrics.iMenuHeight);
904 /* menu font metrics */
905 if (!reg_get_logfont(METRICS_REGKEY, METRICS_MENULOGFONT_VALNAME, &nonclient_metrics.lfMenuFont))
907 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &nonclient_metrics.lfMenuFont, 0 );
908 GetProfileStringW( Desktop, MenuFont, nonclient_metrics.lfCaptionFont.lfFaceName,
909 nonclient_metrics.lfMenuFont.lfFaceName, LF_FACESIZE );
910 nonclient_metrics.lfMenuFont.lfHeight = -GetProfileIntW( Desktop, MenuFontSize, 11 );
911 nonclient_metrics.lfMenuFont.lfWeight = FW_NORMAL;
914 /* status bar font metrics */
915 if (!reg_get_logfont(METRICS_REGKEY, METRICS_STATUSLOGFONT_VALNAME, &nonclient_metrics.lfStatusFont))
917 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &nonclient_metrics.lfStatusFont, 0 );
918 GetProfileStringW( Desktop, StatusFont, nonclient_metrics.lfCaptionFont.lfFaceName,
919 nonclient_metrics.lfStatusFont.lfFaceName, LF_FACESIZE );
920 nonclient_metrics.lfStatusFont.lfHeight = -GetProfileIntW( Desktop, StatusFontSize, 11 );
921 nonclient_metrics.lfStatusFont.lfWeight = FW_NORMAL;
924 /* message font metrics */
925 if (!reg_get_logfont(METRICS_REGKEY, METRICS_MESSAGELOGFONT_VALNAME, &nonclient_metrics.lfMessageFont))
927 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &nonclient_metrics.lfMessageFont, 0 );
928 GetProfileStringW( Desktop, MessageFont, nonclient_metrics.lfCaptionFont.lfFaceName,
929 nonclient_metrics.lfMessageFont.lfFaceName, LF_FACESIZE );
930 nonclient_metrics.lfMessageFont.lfHeight = -GetProfileIntW( Desktop, MessageFontSize, 11 );
931 nonclient_metrics.lfMessageFont.lfWeight = FW_NORMAL;
934 /* some extra fields not in the nonclient structure */
935 icon_size.cx = icon_size.cy = get_reg_metric( hkey, METRICS_ICONSIZE_VALNAME, 32 );
937 scroll_height.cx = get_reg_metric (hkey, METRICS_SCROLLHEIGHT_VALNAME, nonclient_metrics.iScrollHeight );
938 scroll_height.cy = get_reg_metric (hkey, METRICS_SCROLLHEIGHT_VALNAME, nonclient_metrics.iScrollWidth );
940 if (hkey) RegCloseKey( hkey );
941 spi_loaded[SPI_NONCLIENTMETRICS_IDX] = TRUE;
945 /***********************************************************************
946 * SystemParametersInfoW (USER32.@)
948 * Each system parameter has flag which shows whether the parameter
949 * is loaded or not. Parameters, stored directly in SysParametersInfo are
950 * loaded from registry only when they are requested and the flag is
951 * "false", after the loading the flag is set to "true". On interprocess
952 * notification of the parameter change the corresponding parameter flag is
953 * set to "false". The parameter value will be reloaded when it is requested
955 * Parameters, backed by or depend on GetSystemMetrics are processed
956 * differently. These parameters are always loaded. They are reloaded right
957 * away on interprocess change notification. We can't do lazy loading because
958 * we don't want to complicate GetSystemMetrics.
959 * Parameters, backed by X settings are read from corresponding setting.
960 * On the parameter change request the setting is changed. Interprocess change
961 * notifications are ignored.
962 * When parameter value is updated the changed value is stored in permanent
963 * registry branch if saving is requested. Otherwise it is stored
964 * in temporary branch
966 * Some SPI values can also be stored as Twips values in the registry,
967 * don't forget the conversion!
969 BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
970 PVOID pvParam, UINT fWinIni )
972 #define WINE_SPI_FIXME(x) \
974 FIXME( "Unimplemented action: %u (%s)\n", x, #x ); \
975 SetLastError( ERROR_INVALID_SPI_VALUE ); \
978 #define WINE_SPI_WARN(x) \
980 WARN( "Ignored action: %u (%s)\n", x, #x ); \
984 unsigned spi_idx = 0;
986 TRACE("(%u, %u, %p, %u)\n", uiAction, uiParam, pvParam, fWinIni);
990 case SPI_GETBEEP: /* 1 */
991 if (!pvParam) return FALSE;
993 spi_idx = SPI_SETBEEP_IDX;
994 if (!spi_loaded[spi_idx])
998 if (SYSPARAMS_Load( SPI_SETBEEP_REGKEY, SPI_SETBEEP_VALNAME, buf, sizeof(buf) ))
999 beep_active = !lstrcmpiW( Yes, buf );
1000 spi_loaded[spi_idx] = TRUE;
1003 *(BOOL *)pvParam = beep_active;
1006 case SPI_SETBEEP: /* 2 */
1007 spi_idx = SPI_SETBEEP_IDX;
1008 if (SYSPARAMS_Save( SPI_SETBEEP_REGKEY, SPI_SETBEEP_VALNAME,
1009 (uiParam ? Yes : No), fWinIni ))
1011 beep_active = uiParam;
1012 spi_loaded[spi_idx] = TRUE;
1018 case SPI_GETMOUSE: /* 3 */
1019 if (!pvParam) return FALSE;
1021 spi_idx = SPI_SETMOUSE_IDX;
1022 if (!spi_loaded[spi_idx])
1026 if (SYSPARAMS_Load( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME1,
1028 mouse_threshold1 = atoiW( buf );
1029 if (SYSPARAMS_Load( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME2,
1031 mouse_threshold2 = atoiW( buf );
1032 if (SYSPARAMS_Load( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME3,
1034 mouse_speed = atoiW( buf );
1035 spi_loaded[spi_idx] = TRUE;
1037 ((INT *)pvParam)[0] = mouse_threshold1;
1038 ((INT *)pvParam)[1] = mouse_threshold2;
1039 ((INT *)pvParam)[2] = mouse_speed;
1042 case SPI_SETMOUSE: /* 4 */
1046 if (!pvParam) return FALSE;
1048 spi_idx = SPI_SETMOUSE_IDX;
1049 wsprintfW(buf, CSd, ((INT *)pvParam)[0]);
1051 if (SYSPARAMS_Save( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME1,
1054 mouse_threshold1 = ((INT *)pvParam)[0];
1055 spi_loaded[spi_idx] = TRUE;
1057 wsprintfW(buf, CSd, ((INT *)pvParam)[1]);
1058 SYSPARAMS_Save( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME2,
1060 mouse_threshold2 = ((INT *)pvParam)[1];
1062 wsprintfW(buf, CSd, ((INT *)pvParam)[2]);
1063 SYSPARAMS_Save( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME3,
1065 mouse_speed = ((INT *)pvParam)[2];
1073 ret = get_twips_param( SPI_SETBORDER_IDX,
1074 SPI_SETBORDER_REGKEY,
1075 SPI_SETBORDER_VALNAME,
1080 ret = set_uint_param( SPI_SETBORDER_IDX,
1081 SPI_SETBORDER_REGKEY,
1082 SPI_SETBORDER_VALNAME,
1083 &border, uiParam, fWinIni );
1086 case SPI_GETKEYBOARDSPEED:
1087 ret = get_uint_param( SPI_SETKEYBOARDSPEED_IDX,
1088 SPI_SETKEYBOARDSPEED_REGKEY,
1089 SPI_SETKEYBOARDSPEED_VALNAME,
1090 &keyboard_speed, pvParam );
1093 case SPI_SETKEYBOARDSPEED:
1094 if (uiParam > 31) uiParam = 31;
1095 ret = set_uint_param( SPI_SETKEYBOARDSPEED_IDX,
1096 SPI_SETKEYBOARDSPEED_REGKEY,
1097 SPI_SETKEYBOARDSPEED_VALNAME,
1098 &keyboard_speed, uiParam, fWinIni );
1101 /* not implemented in Windows */
1102 WINE_SPI_WARN(SPI_LANGDRIVER); /* 12 */
1104 case SPI_ICONHORIZONTALSPACING:
1105 if (pvParam != NULL)
1107 ret = get_twips_param( SPI_ICONHORIZONTALSPACING_IDX,
1108 SPI_ICONHORIZONTALSPACING_REGKEY,
1109 SPI_ICONHORIZONTALSPACING_VALNAME,
1110 &icon_metrics.iHorzSpacing, pvParam );
1114 if (uiParam < 32) uiParam = 32;
1115 ret = set_uint_param( SPI_ICONHORIZONTALSPACING_IDX,
1116 SPI_ICONHORIZONTALSPACING_REGKEY,
1117 SPI_ICONHORIZONTALSPACING_VALNAME,
1118 &icon_metrics.iHorzSpacing, uiParam, fWinIni );
1122 case SPI_GETSCREENSAVETIMEOUT:
1123 ret = get_uint_param( SPI_SETSCREENSAVETIMEOUT_IDX,
1124 SPI_SETSCREENSAVETIMEOUT_REGKEY,
1125 SPI_SETSCREENSAVETIMEOUT_VALNAME,
1126 &screensave_timeout, pvParam );
1129 case SPI_SETSCREENSAVETIMEOUT:
1130 ret = set_uint_param( SPI_SETSCREENSAVETIMEOUT_IDX,
1131 SPI_SETSCREENSAVETIMEOUT_REGKEY,
1132 SPI_SETSCREENSAVETIMEOUT_VALNAME,
1133 &screensave_timeout, uiParam, fWinIni );
1136 case SPI_GETSCREENSAVEACTIVE: /* 16 */
1137 if (!pvParam) return FALSE;
1138 *(BOOL *)pvParam = USER_Driver->pGetScreenSaveActive();
1141 case SPI_SETSCREENSAVEACTIVE: /* 17 */
1145 wsprintfW(buf, CSu, uiParam);
1146 USER_Driver->pSetScreenSaveActive( uiParam );
1147 /* saved value does not affect Wine */
1148 SYSPARAMS_Save( SPI_SETSCREENSAVEACTIVE_REGKEY,
1149 SPI_SETSCREENSAVEACTIVE_VALNAME,
1154 case SPI_GETGRIDGRANULARITY:
1155 ret = get_uint_param( SPI_SETGRIDGRANULARITY_IDX,
1156 SPI_SETGRIDGRANULARITY_REGKEY,
1157 SPI_SETGRIDGRANULARITY_VALNAME,
1158 &grid_granularity, pvParam );
1161 case SPI_SETGRIDGRANULARITY:
1162 ret = set_uint_param( SPI_SETGRIDGRANULARITY_IDX,
1163 SPI_SETGRIDGRANULARITY_REGKEY,
1164 SPI_SETGRIDGRANULARITY_VALNAME,
1165 &grid_granularity, uiParam, fWinIni );
1168 case SPI_SETDESKWALLPAPER: /* 20 */
1169 if (!pvParam || !SetDeskWallPaper( (LPSTR)pvParam )) return FALSE;
1170 SYSPARAMS_Save(SPI_SETDESKWALLPAPER_REGKEY, SPI_SETDESKWALLPAPER_VALNAME, pvParam, fWinIni);
1173 case SPI_SETDESKPATTERN: /* 21 */
1174 /* FIXME: the ability to specify a pattern in pvParam
1175 doesn't seem to be documented for Win32 */
1176 if ((INT16)uiParam == -1)
1179 GetProfileStringW( Desktop, Pattern,
1181 buf, sizeof(buf)/sizeof(WCHAR) );
1182 ret = DESKTOP_SetPattern( buf );
1184 ret = DESKTOP_SetPattern( (LPWSTR)pvParam );
1187 case SPI_GETKEYBOARDDELAY:
1188 ret = get_uint_param( SPI_SETKEYBOARDDELAY_IDX,
1189 SPI_SETKEYBOARDDELAY_REGKEY,
1190 SPI_SETKEYBOARDDELAY_VALNAME,
1191 &keyboard_delay, pvParam );
1194 case SPI_SETKEYBOARDDELAY:
1195 ret = set_uint_param( SPI_SETKEYBOARDDELAY_IDX,
1196 SPI_SETKEYBOARDDELAY_REGKEY,
1197 SPI_SETKEYBOARDDELAY_VALNAME,
1198 &keyboard_delay, uiParam, fWinIni );
1201 case SPI_ICONVERTICALSPACING:
1202 if (pvParam != NULL)
1204 ret = get_twips_param( SPI_ICONVERTICALSPACING_IDX,
1205 SPI_ICONVERTICALSPACING_REGKEY,
1206 SPI_ICONVERTICALSPACING_VALNAME,
1207 &icon_metrics.iVertSpacing, pvParam );
1211 if (uiParam < 32) uiParam = 32;
1212 ret = set_uint_param( SPI_ICONVERTICALSPACING_IDX,
1213 SPI_ICONVERTICALSPACING_REGKEY,
1214 SPI_ICONVERTICALSPACING_VALNAME,
1215 &icon_metrics.iVertSpacing, uiParam, fWinIni );
1219 case SPI_GETICONTITLEWRAP:
1220 ret = get_bool_param( SPI_SETICONTITLEWRAP_IDX,
1221 SPI_SETICONTITLEWRAP_REGKEY1,
1222 SPI_SETICONTITLEWRAP_VALNAME,
1223 &icon_metrics.iTitleWrap, pvParam );
1226 case SPI_SETICONTITLEWRAP:
1227 ret = set_bool_param_mirrored( SPI_SETICONTITLEWRAP_IDX,
1228 SPI_SETICONTITLEWRAP_REGKEY1,
1229 SPI_SETICONTITLEWRAP_REGKEY2,
1230 SPI_SETICONTITLEWRAP_VALNAME,
1231 &icon_metrics.iTitleWrap, uiParam, fWinIni );
1234 case SPI_GETMENUDROPALIGNMENT:
1235 ret = get_uint_param( SPI_SETMENUDROPALIGNMENT_IDX,
1236 SPI_SETMENUDROPALIGNMENT_REGKEY1,
1237 SPI_SETMENUDROPALIGNMENT_VALNAME,
1238 &menu_drop_alignment, pvParam );
1241 case SPI_SETMENUDROPALIGNMENT:
1242 ret = set_uint_param_mirrored( SPI_SETMENUDROPALIGNMENT_IDX,
1243 SPI_SETMENUDROPALIGNMENT_REGKEY1,
1244 SPI_SETMENUDROPALIGNMENT_REGKEY2,
1245 SPI_SETMENUDROPALIGNMENT_VALNAME,
1246 &menu_drop_alignment, uiParam, fWinIni );
1249 case SPI_SETDOUBLECLKWIDTH:
1250 ret = set_uint_param_mirrored( SPI_SETDOUBLECLKWIDTH_IDX,
1251 SPI_SETDOUBLECLKWIDTH_REGKEY1,
1252 SPI_SETDOUBLECLKWIDTH_REGKEY2,
1253 SPI_SETDOUBLECLKWIDTH_VALNAME,
1254 &double_click_width, uiParam, fWinIni );
1257 case SPI_SETDOUBLECLKHEIGHT:
1258 ret = set_uint_param_mirrored( SPI_SETDOUBLECLKHEIGHT_IDX,
1259 SPI_SETDOUBLECLKHEIGHT_REGKEY1,
1260 SPI_SETDOUBLECLKHEIGHT_REGKEY2,
1261 SPI_SETDOUBLECLKHEIGHT_VALNAME,
1262 &double_click_height, uiParam, fWinIni );
1265 case SPI_GETICONTITLELOGFONT:
1269 if (!pvParam) return FALSE;
1271 spi_idx = SPI_SETICONTITLELOGFONT_IDX;
1272 if (!spi_loaded[spi_idx])
1274 if (!reg_get_logfont( SPI_SETICONTITLELOGFONT_REGKEY,
1275 SPI_SETICONTITLELOGFONT_VALNAME, &icon_metrics.lfFont ))
1278 * The 'default GDI fonts' seems to be returned.
1279 * If a returned font is not a correct font in your environment,
1280 * please try to fix objects/gdiobj.c at first.
1282 GetObjectW( GetStockObject( DEFAULT_GUI_FONT ), sizeof(LOGFONTW), &lfDefault );
1284 GetProfileStringW( Desktop, IconTitleFaceName,
1285 lfDefault.lfFaceName,
1286 icon_metrics.lfFont.lfFaceName,
1288 icon_metrics.lfFont.lfHeight = -GetProfileIntW( Desktop, IconTitleSize, 11 );
1289 icon_metrics.lfFont.lfWidth = 0;
1290 icon_metrics.lfFont.lfEscapement = icon_metrics.lfFont.lfOrientation = 0;
1291 icon_metrics.lfFont.lfWeight = FW_NORMAL;
1292 icon_metrics.lfFont.lfItalic = FALSE;
1293 icon_metrics.lfFont.lfStrikeOut = FALSE;
1294 icon_metrics.lfFont.lfUnderline = FALSE;
1295 icon_metrics.lfFont.lfCharSet = lfDefault.lfCharSet; /* at least 'charset' should not be hard-coded */
1296 icon_metrics.lfFont.lfOutPrecision = OUT_DEFAULT_PRECIS;
1297 icon_metrics.lfFont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
1298 icon_metrics.lfFont.lfQuality = DEFAULT_QUALITY;
1299 icon_metrics.lfFont.lfPitchAndFamily = DEFAULT_PITCH;
1300 spi_loaded[spi_idx] = TRUE;
1303 *(LOGFONTW *)pvParam = icon_metrics.lfFont;
1307 case SPI_SETDOUBLECLICKTIME:
1308 ret = set_uint_param( SPI_SETDOUBLECLICKTIME_IDX,
1309 SPI_SETDOUBLECLICKTIME_REGKEY,
1310 SPI_SETDOUBLECLICKTIME_VALNAME,
1311 &double_click_time, uiParam, fWinIni );
1314 case SPI_SETMOUSEBUTTONSWAP:
1315 ret = set_uint_param( SPI_SETMOUSEBUTTONSWAP_IDX,
1316 SPI_SETMOUSEBUTTONSWAP_REGKEY,
1317 SPI_SETMOUSEBUTTONSWAP_VALNAME,
1318 &swap_buttons, uiParam, fWinIni );
1321 WINE_SPI_FIXME(SPI_SETICONTITLELOGFONT); /* 34 */
1323 case SPI_GETFASTTASKSWITCH: /* 35 */
1324 if (!pvParam) return FALSE;
1325 *(BOOL *)pvParam = 1;
1328 case SPI_SETFASTTASKSWITCH: /* 36 */
1329 /* the action is disabled */
1333 case SPI_SETDRAGFULLWINDOWS:
1334 ret = set_bool_param( SPI_SETDRAGFULLWINDOWS_IDX,
1335 SPI_SETDRAGFULLWINDOWS_REGKEY,
1336 SPI_SETDRAGFULLWINDOWS_VALNAME,
1337 &drag_full_windows, uiParam, fWinIni );
1340 case SPI_GETDRAGFULLWINDOWS:
1341 ret = get_bool_param( SPI_SETDRAGFULLWINDOWS_IDX,
1342 SPI_SETDRAGFULLWINDOWS_REGKEY,
1343 SPI_SETDRAGFULLWINDOWS_VALNAME,
1344 &drag_full_windows, pvParam );
1347 case SPI_GETNONCLIENTMETRICS:
1349 LPNONCLIENTMETRICSW lpnm = pvParam;
1351 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
1353 if (lpnm && lpnm->cbSize == sizeof(NONCLIENTMETRICSW))
1354 memcpy( lpnm, &nonclient_metrics, sizeof(*lpnm) );
1360 case SPI_SETNONCLIENTMETRICS:
1362 LPNONCLIENTMETRICSW lpnm = pvParam;
1364 if (lpnm && lpnm->cbSize == sizeof(NONCLIENTMETRICSW))
1366 memcpy( &nonclient_metrics, lpnm, sizeof(nonclient_metrics) );
1367 spi_loaded[SPI_NONCLIENTMETRICS_IDX] = TRUE;
1372 case SPI_GETMINIMIZEDMETRICS:
1374 MINIMIZEDMETRICS * lpMm = pvParam;
1375 if (lpMm && lpMm->cbSize == sizeof(*lpMm))
1376 memcpy( lpMm, &minimized_metrics, sizeof(*lpMm) );
1382 case SPI_SETMINIMIZEDMETRICS:
1384 MINIMIZEDMETRICS * lpMm = pvParam;
1385 if (lpMm && lpMm->cbSize == sizeof(*lpMm))
1386 memcpy( &minimized_metrics, lpMm, sizeof(*lpMm) );
1392 case SPI_GETICONMETRICS:
1394 LPICONMETRICSW lpIcon = pvParam;
1395 if(lpIcon && lpIcon->cbSize == sizeof(*lpIcon))
1397 SystemParametersInfoW( SPI_ICONHORIZONTALSPACING, 0,
1398 &lpIcon->iHorzSpacing, FALSE );
1399 SystemParametersInfoW( SPI_ICONVERTICALSPACING, 0,
1400 &lpIcon->iVertSpacing, FALSE );
1401 SystemParametersInfoW( SPI_GETICONTITLEWRAP, 0,
1402 &lpIcon->iTitleWrap, FALSE );
1403 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0,
1404 &lpIcon->lfFont, FALSE );
1413 case SPI_SETICONMETRICS:
1415 LPICONMETRICSW lpIcon = pvParam;
1416 if (lpIcon && lpIcon->cbSize == sizeof(*lpIcon))
1417 memcpy( &icon_metrics, lpIcon, sizeof(icon_metrics) );
1423 case SPI_SETWORKAREA: /* 47 WINVER >= 0x400 */
1425 if (!pvParam) return FALSE;
1427 spi_idx = SPI_SETWORKAREA_IDX;
1428 CopyRect( &work_area, (RECT *)pvParam );
1429 spi_loaded[spi_idx] = TRUE;
1433 case SPI_GETWORKAREA: /* 48 WINVER >= 0x400 */
1435 if (!pvParam) return FALSE;
1437 spi_idx = SPI_SETWORKAREA_IDX;
1438 if (!spi_loaded[spi_idx])
1440 SetRect( &work_area, 0, 0,
1441 GetSystemMetrics( SM_CXSCREEN ),
1442 GetSystemMetrics( SM_CYSCREEN ) );
1443 spi_loaded[spi_idx] = TRUE;
1445 CopyRect( (RECT *)pvParam, &work_area );
1450 WINE_SPI_FIXME(SPI_SETPENWINDOWS); /* 49 WINVER >= 0x400 */
1452 case SPI_GETFILTERKEYS: /* 50 */
1454 LPFILTERKEYS lpFilterKeys = (LPFILTERKEYS)pvParam;
1455 WARN("SPI_GETFILTERKEYS not fully implemented\n");
1456 if (lpFilterKeys && lpFilterKeys->cbSize == sizeof(FILTERKEYS))
1458 /* Indicate that no FilterKeys feature available */
1459 lpFilterKeys->dwFlags = 0;
1460 lpFilterKeys->iWaitMSec = 0;
1461 lpFilterKeys->iDelayMSec = 0;
1462 lpFilterKeys->iRepeatMSec = 0;
1463 lpFilterKeys->iBounceMSec = 0;
1471 WINE_SPI_FIXME(SPI_SETFILTERKEYS); /* 51 */
1473 case SPI_GETTOGGLEKEYS: /* 52 */
1475 LPTOGGLEKEYS lpToggleKeys = (LPTOGGLEKEYS)pvParam;
1476 WARN("SPI_GETTOGGLEKEYS not fully implemented\n");
1477 if (lpToggleKeys && lpToggleKeys->cbSize == sizeof(TOGGLEKEYS))
1479 /* Indicate that no ToggleKeys feature available */
1480 lpToggleKeys->dwFlags = 0;
1488 WINE_SPI_FIXME(SPI_SETTOGGLEKEYS); /* 53 */
1490 case SPI_GETMOUSEKEYS: /* 54 */
1492 LPMOUSEKEYS lpMouseKeys = (LPMOUSEKEYS)pvParam;
1493 WARN("SPI_GETMOUSEKEYS not fully implemented\n");
1494 if (lpMouseKeys && lpMouseKeys->cbSize == sizeof(MOUSEKEYS))
1496 /* Indicate that no MouseKeys feature available */
1497 lpMouseKeys->dwFlags = 0;
1498 lpMouseKeys->iMaxSpeed = 360;
1499 lpMouseKeys->iTimeToMaxSpeed = 1000;
1500 lpMouseKeys->iCtrlSpeed = 0;
1501 lpMouseKeys->dwReserved1 = 0;
1502 lpMouseKeys->dwReserved2 = 0;
1510 WINE_SPI_FIXME(SPI_SETMOUSEKEYS); /* 55 */
1512 case SPI_GETSHOWSOUNDS:
1513 ret = get_bool_param( SPI_SETSHOWSOUNDS_IDX,
1514 SPI_SETSHOWSOUNDS_REGKEY,
1515 SPI_SETSHOWSOUNDS_VALNAME,
1516 &show_sounds, pvParam );
1519 case SPI_SETSHOWSOUNDS:
1520 ret = set_bool_param( SPI_SETSHOWSOUNDS_IDX,
1521 SPI_SETSHOWSOUNDS_REGKEY,
1522 SPI_SETSHOWSOUNDS_VALNAME,
1523 &show_sounds, uiParam, fWinIni );
1526 case SPI_GETSTICKYKEYS: /* 58 */
1528 LPSTICKYKEYS lpStickyKeys = (LPSTICKYKEYS)pvParam;
1529 WARN("SPI_GETSTICKYKEYS not fully implemented\n");
1530 if (lpStickyKeys && lpStickyKeys->cbSize == sizeof(STICKYKEYS))
1532 /* Indicate that no StickyKeys feature available */
1533 lpStickyKeys->dwFlags = 0;
1541 WINE_SPI_FIXME(SPI_SETSTICKYKEYS); /* 59 */
1543 case SPI_GETACCESSTIMEOUT: /* 60 */
1545 LPACCESSTIMEOUT lpAccessTimeout = (LPACCESSTIMEOUT)pvParam;
1546 WARN("SPI_GETACCESSTIMEOUT not fully implemented\n");
1547 if (lpAccessTimeout && lpAccessTimeout->cbSize == sizeof(ACCESSTIMEOUT))
1549 /* Indicate that no accessibility features timeout is available */
1550 lpAccessTimeout->dwFlags = 0;
1551 lpAccessTimeout->iTimeOutMSec = 0;
1559 WINE_SPI_FIXME(SPI_SETACCESSTIMEOUT); /* 61 */
1561 case SPI_GETSERIALKEYS: /* 62 WINVER >= 0x400 */
1563 LPSERIALKEYSW lpSerialKeysW = (LPSERIALKEYSW)pvParam;
1564 WARN("SPI_GETSERIALKEYS not fully implemented\n");
1565 if (lpSerialKeysW && lpSerialKeysW->cbSize == sizeof(SERIALKEYSW))
1567 /* Indicate that no SerialKeys feature available */
1568 lpSerialKeysW->dwFlags = 0;
1569 lpSerialKeysW->lpszActivePort = NULL;
1570 lpSerialKeysW->lpszPort = NULL;
1571 lpSerialKeysW->iBaudRate = 0;
1572 lpSerialKeysW->iPortState = 0;
1580 WINE_SPI_FIXME(SPI_SETSERIALKEYS); /* 63 WINVER >= 0x400 */
1582 case SPI_GETSOUNDSENTRY: /* 64 */
1584 LPSOUNDSENTRYW lpSoundSentryW = (LPSOUNDSENTRYW)pvParam;
1585 WARN("SPI_GETSOUNDSENTRY not fully implemented\n");
1586 if (lpSoundSentryW && lpSoundSentryW->cbSize == sizeof(SOUNDSENTRYW))
1588 /* Indicate that no SoundSentry feature available */
1589 lpSoundSentryW->dwFlags = 0;
1590 lpSoundSentryW->iFSTextEffect = 0;
1591 lpSoundSentryW->iFSTextEffectMSec = 0;
1592 lpSoundSentryW->iFSTextEffectColorBits = 0;
1593 lpSoundSentryW->iFSGrafEffect = 0;
1594 lpSoundSentryW->iFSGrafEffectMSec = 0;
1595 lpSoundSentryW->iFSGrafEffectColor = 0;
1596 lpSoundSentryW->iWindowsEffect = 0;
1597 lpSoundSentryW->iWindowsEffectMSec = 0;
1598 lpSoundSentryW->lpszWindowsEffectDLL = 0;
1599 lpSoundSentryW->iWindowsEffectOrdinal = 0;
1607 WINE_SPI_FIXME(SPI_SETSOUNDSENTRY); /* 65 */
1609 case SPI_GETHIGHCONTRAST: /* 66 WINVER >= 0x400 */
1611 LPHIGHCONTRASTW lpHighContrastW = (LPHIGHCONTRASTW)pvParam;
1612 WARN("SPI_GETHIGHCONTRAST not fully implemented\n");
1613 if (lpHighContrastW && lpHighContrastW->cbSize == sizeof(HIGHCONTRASTW))
1615 /* Indicate that no high contrast feature available */
1616 lpHighContrastW->dwFlags = 0;
1617 lpHighContrastW->lpszDefaultScheme = NULL;
1625 WINE_SPI_FIXME(SPI_SETHIGHCONTRAST); /* 67 WINVER >= 0x400 */
1627 case SPI_GETKEYBOARDPREF:
1628 ret = get_bool_param( SPI_SETKEYBOARDPREF_IDX,
1629 SPI_SETKEYBOARDPREF_REGKEY,
1630 SPI_SETKEYBOARDPREF_VALNAME,
1631 &keyboard_pref, pvParam );
1634 case SPI_SETKEYBOARDPREF:
1635 ret = set_bool_param( SPI_SETKEYBOARDPREF_IDX,
1636 SPI_SETKEYBOARDPREF_REGKEY,
1637 SPI_SETKEYBOARDPREF_VALNAME,
1638 &keyboard_pref, uiParam, fWinIni );
1641 case SPI_GETSCREENREADER:
1642 ret = get_bool_param( SPI_SETSCREENREADER_IDX,
1643 SPI_SETSCREENREADER_REGKEY,
1644 SPI_SETSCREENREADER_VALNAME,
1645 &screen_reader, pvParam );
1648 case SPI_SETSCREENREADER:
1649 ret = set_bool_param( SPI_SETSCREENREADER_IDX,
1650 SPI_SETSCREENREADER_REGKEY,
1651 SPI_SETSCREENREADER_VALNAME,
1652 &screen_reader, uiParam, fWinIni );
1655 case SPI_GETANIMATION: /* 72 WINVER >= 0x400 */
1657 LPANIMATIONINFO lpAnimInfo = (LPANIMATIONINFO)pvParam;
1659 /* Tell it "disabled" */
1660 if (lpAnimInfo && lpAnimInfo->cbSize == sizeof(ANIMATIONINFO))
1661 lpAnimInfo->iMinAnimate = 0; /* Minimise and restore animation is disabled (nonzero == enabled) */
1666 WINE_SPI_WARN(SPI_SETANIMATION); /* 73 WINVER >= 0x400 */
1668 case SPI_GETFONTSMOOTHING:
1669 ret = get_uint_param( SPI_SETFONTSMOOTHING_IDX,
1670 SPI_SETFONTSMOOTHING_REGKEY,
1671 SPI_SETFONTSMOOTHING_VALNAME,
1672 &font_smoothing, pvParam );
1675 case SPI_SETFONTSMOOTHING:
1676 ret = set_uint_param( SPI_SETFONTSMOOTHING_IDX,
1677 SPI_SETFONTSMOOTHING_REGKEY,
1678 SPI_SETFONTSMOOTHING_VALNAME,
1679 &font_smoothing, uiParam, fWinIni );
1682 WINE_SPI_FIXME(SPI_SETDRAGWIDTH); /* 76 WINVER >= 0x400 */
1683 WINE_SPI_FIXME(SPI_SETDRAGHEIGHT); /* 77 WINVER >= 0x400 */
1685 WINE_SPI_FIXME(SPI_SETHANDHELD); /* 78 WINVER >= 0x400 */
1687 WINE_SPI_FIXME(SPI_GETLOWPOWERTIMEOUT); /* 79 WINVER >= 0x400 */
1688 WINE_SPI_FIXME(SPI_GETPOWEROFFTIMEOUT); /* 80 WINVER >= 0x400 */
1689 WINE_SPI_FIXME(SPI_SETLOWPOWERTIMEOUT); /* 81 WINVER >= 0x400 */
1690 WINE_SPI_FIXME(SPI_SETPOWEROFFTIMEOUT); /* 82 WINVER >= 0x400 */
1692 case SPI_GETLOWPOWERACTIVE:
1693 ret = get_bool_param( SPI_SETLOWPOWERACTIVE_IDX,
1694 SPI_SETLOWPOWERACTIVE_REGKEY,
1695 SPI_SETLOWPOWERACTIVE_VALNAME,
1696 &lowpoweractive, pvParam );
1699 case SPI_GETPOWEROFFACTIVE:
1700 ret = get_bool_param( SPI_SETPOWEROFFACTIVE_IDX,
1701 SPI_SETPOWEROFFACTIVE_REGKEY,
1702 SPI_SETPOWEROFFACTIVE_VALNAME,
1703 &poweroffactive, pvParam );
1706 case SPI_SETLOWPOWERACTIVE:
1707 ret = set_bool_param( SPI_SETLOWPOWERACTIVE_IDX,
1708 SPI_SETLOWPOWERACTIVE_REGKEY,
1709 SPI_SETLOWPOWERACTIVE_VALNAME,
1710 &lowpoweractive, uiParam, fWinIni );
1713 case SPI_SETPOWEROFFACTIVE:
1714 ret = set_bool_param( SPI_SETPOWEROFFACTIVE_IDX,
1715 SPI_SETPOWEROFFACTIVE_REGKEY,
1716 SPI_SETPOWEROFFACTIVE_VALNAME,
1717 &poweroffactive, uiParam, fWinIni );
1720 WINE_SPI_FIXME(SPI_SETCURSORS); /* 87 WINVER >= 0x400 */
1721 WINE_SPI_FIXME(SPI_SETICONS); /* 88 WINVER >= 0x400 */
1723 case SPI_GETDEFAULTINPUTLANG: /* 89 WINVER >= 0x400 */
1724 ret = GetKeyboardLayout(0) ? TRUE : FALSE;
1727 WINE_SPI_FIXME(SPI_SETDEFAULTINPUTLANG); /* 90 WINVER >= 0x400 */
1729 WINE_SPI_FIXME(SPI_SETLANGTOGGLE); /* 91 WINVER >= 0x400 */
1731 case SPI_GETWINDOWSEXTENSION: /* 92 WINVER >= 0x400 */
1732 WARN("pretend no support for Win9x Plus! for now.\n");
1733 ret = FALSE; /* yes, this is the result value */
1736 WINE_SPI_FIXME(SPI_SETMOUSETRAILS); /* 93 WINVER >= 0x400 */
1737 WINE_SPI_FIXME(SPI_GETMOUSETRAILS); /* 94 WINVER >= 0x400 */
1738 WINE_SPI_FIXME(SPI_GETSNAPTODEFBUTTON); /* 95 WINVER >= 0x400 */
1739 WINE_SPI_FIXME(SPI_SETSNAPTODEFBUTTON); /* 96 WINVER >= 0x400 */
1741 case SPI_SETSCREENSAVERRUNNING:
1742 ret = set_bool_param( SPI_SETSCREENSAVERRUNNING_IDX,
1743 SPI_SETSCREENSAVERRUNNING_REGKEY,
1744 SPI_SETSCREENSAVERRUNNING_VALNAME,
1745 &screensaver_running, uiParam, fWinIni );
1748 case SPI_GETMOUSEHOVERWIDTH:
1749 ret = get_uint_param( SPI_SETMOUSEHOVERWIDTH_IDX,
1750 SPI_SETMOUSEHOVERWIDTH_REGKEY,
1751 SPI_SETMOUSEHOVERWIDTH_VALNAME,
1752 &mouse_hover_width, pvParam );
1755 case SPI_SETMOUSEHOVERWIDTH:
1756 ret = set_uint_param( SPI_SETMOUSEHOVERWIDTH_IDX,
1757 SPI_SETMOUSEHOVERWIDTH_REGKEY,
1758 SPI_SETMOUSEHOVERWIDTH_VALNAME,
1759 &mouse_hover_width, uiParam, fWinIni );
1762 case SPI_GETMOUSEHOVERHEIGHT:
1763 ret = get_uint_param( SPI_SETMOUSEHOVERHEIGHT_IDX,
1764 SPI_SETMOUSEHOVERHEIGHT_REGKEY,
1765 SPI_SETMOUSEHOVERHEIGHT_VALNAME,
1766 &mouse_hover_height, pvParam );
1769 case SPI_SETMOUSEHOVERHEIGHT:
1770 ret = set_uint_param( SPI_SETMOUSEHOVERHEIGHT_IDX,
1771 SPI_SETMOUSEHOVERHEIGHT_REGKEY,
1772 SPI_SETMOUSEHOVERHEIGHT_VALNAME,
1773 &mouse_hover_height, uiParam, fWinIni );
1776 case SPI_GETMOUSEHOVERTIME:
1777 ret = get_uint_param( SPI_SETMOUSEHOVERTIME_IDX,
1778 SPI_SETMOUSEHOVERTIME_REGKEY,
1779 SPI_SETMOUSEHOVERTIME_VALNAME,
1780 &mouse_hover_time, pvParam );
1783 case SPI_SETMOUSEHOVERTIME:
1784 ret = set_uint_param( SPI_SETMOUSEHOVERTIME_IDX,
1785 SPI_SETMOUSEHOVERTIME_REGKEY,
1786 SPI_SETMOUSEHOVERTIME_VALNAME,
1787 &mouse_hover_time, uiParam, fWinIni );
1790 case SPI_GETWHEELSCROLLLINES:
1791 ret = get_uint_param( SPI_SETMOUSESCROLLLINES_IDX,
1792 SPI_SETMOUSESCROLLLINES_REGKEY,
1793 SPI_SETMOUSESCROLLLINES_VALNAME,
1794 &mouse_scroll_lines, pvParam );
1797 case SPI_SETWHEELSCROLLLINES:
1798 ret = set_uint_param( SPI_SETMOUSESCROLLLINES_IDX,
1799 SPI_SETMOUSESCROLLLINES_REGKEY,
1800 SPI_SETMOUSESCROLLLINES_VALNAME,
1801 &mouse_scroll_lines, uiParam, fWinIni );
1804 case SPI_GETMENUSHOWDELAY:
1805 ret = get_uint_param( SPI_SETMENUSHOWDELAY_IDX,
1806 SPI_SETMENUSHOWDELAY_REGKEY,
1807 SPI_SETMENUSHOWDELAY_VALNAME,
1808 &menu_show_delay, pvParam );
1811 case SPI_SETMENUSHOWDELAY:
1812 ret = set_uint_param( SPI_SETMENUSHOWDELAY_IDX,
1813 SPI_SETMENUSHOWDELAY_REGKEY,
1814 SPI_SETMENUSHOWDELAY_VALNAME,
1815 &menu_show_delay, uiParam, fWinIni );
1818 WINE_SPI_FIXME(SPI_GETSHOWIMEUI); /* 110 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
1819 WINE_SPI_FIXME(SPI_SETSHOWIMEUI); /* 111 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
1820 WINE_SPI_FIXME(SPI_GETMOUSESPEED); /* 112 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
1821 WINE_SPI_FIXME(SPI_SETMOUSESPEED); /* 113 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
1823 case SPI_GETSCREENSAVERRUNNING:
1824 ret = get_bool_param( SPI_SETSCREENSAVERRUNNING_IDX,
1825 SPI_SETSCREENSAVERRUNNING_REGKEY,
1826 SPI_SETSCREENSAVERRUNNING_VALNAME,
1827 &screensaver_running, pvParam );
1830 case SPI_GETDESKWALLPAPER: /* 115 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
1832 WCHAR buf[MAX_PATH];
1834 if (!pvParam) return FALSE;
1836 if (uiParam > MAX_PATH)
1841 if (SYSPARAMS_Load(SPI_SETDESKWALLPAPER_REGKEY, SPI_SETDESKWALLPAPER_VALNAME, buf, sizeof(buf)))
1843 lstrcpynW((WCHAR*)pvParam, buf, uiParam);
1847 /* Return an empty string */
1848 memset((WCHAR*)pvParam, 0, uiParam);
1854 WINE_SPI_FIXME(SPI_GETACTIVEWINDOWTRACKING);/* 0x1000 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
1855 WINE_SPI_FIXME(SPI_SETACTIVEWINDOWTRACKING);/* 0x1001 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
1856 WINE_SPI_FIXME(SPI_GETMENUANIMATION); /* 0x1002 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
1857 WINE_SPI_FIXME(SPI_SETMENUANIMATION); /* 0x1003 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
1858 WINE_SPI_FIXME(SPI_GETCOMBOBOXANIMATION); /* 0x1004 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
1859 WINE_SPI_FIXME(SPI_SETCOMBOBOXANIMATION); /* 0x1005 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
1861 case SPI_GETLISTBOXSMOOTHSCROLLING: /* 0x1006 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
1862 if (!pvParam) return FALSE;
1864 spi_idx = SPI_SETLISTBOXSMOOTHSCROLLING_IDX;
1865 if (!spi_loaded[spi_idx])
1869 if (SYSPARAMS_Load( SPI_SETLISTBOXSMOOTHSCROLLING_REGKEY,
1870 SPI_SETLISTBOXSMOOTHSCROLLING_VALNAME, buf, sizeof(buf) ))
1872 if ((buf[0]&0x01) == 0x01)
1874 listbox_smoothscrolling = TRUE;
1877 spi_loaded[spi_idx] = TRUE;
1880 *(BOOL *)pvParam = listbox_smoothscrolling;
1884 WINE_SPI_FIXME(SPI_SETLISTBOXSMOOTHSCROLLING);/* 0x1007 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
1886 case SPI_GETGRADIENTCAPTIONS:
1887 ret = get_user_pref_param( 0, 0x10, pvParam );
1890 case SPI_SETGRADIENTCAPTIONS:
1891 ret = set_user_pref_param( 0, 0x10, (BOOL)pvParam, fWinIni );
1894 case SPI_GETKEYBOARDCUES:
1895 ret = get_user_pref_param( 0, 0x20, pvParam );
1898 case SPI_SETKEYBOARDCUES:
1899 ret = set_user_pref_param( 0, 0x20, (BOOL)pvParam, fWinIni );
1902 WINE_SPI_FIXME(SPI_GETACTIVEWNDTRKZORDER); /* 0x100C _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
1903 WINE_SPI_FIXME(SPI_SETACTIVEWNDTRKZORDER); /* 0x100D _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
1904 case SPI_GETHOTTRACKING:
1905 ret = get_user_pref_param( 0, 0x80, pvParam );
1908 case SPI_SETHOTTRACKING:
1909 ret = set_user_pref_param( 0, 0x80, (BOOL)pvParam, fWinIni );
1912 WINE_SPI_FIXME(SPI_GETMENUFADE); /* 0x1012 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
1913 WINE_SPI_FIXME(SPI_SETMENUFADE); /* 0x1013 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
1914 WINE_SPI_FIXME(SPI_GETSELECTIONFADE); /* 0x1014 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
1915 WINE_SPI_FIXME(SPI_SETSELECTIONFADE); /* 0x1015 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
1916 WINE_SPI_FIXME(SPI_GETTOOLTIPANIMATION); /* 0x1016 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
1917 WINE_SPI_FIXME(SPI_SETTOOLTIPANIMATION); /* 0x1017 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
1918 WINE_SPI_FIXME(SPI_GETTOOLTIPFADE); /* 0x1018 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
1919 WINE_SPI_FIXME(SPI_SETTOOLTIPFADE); /* 0x1019 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
1920 WINE_SPI_FIXME(SPI_GETCURSORSHADOW); /* 0x101A _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
1921 WINE_SPI_FIXME(SPI_SETCURSORSHADOW); /* 0x101B _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
1922 WINE_SPI_FIXME(SPI_GETMOUSESONAR); /* 0x101C _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
1923 WINE_SPI_FIXME(SPI_SETMOUSESONAR); /* 0x101D _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
1924 WINE_SPI_FIXME(SPI_GETMOUSECLICKLOCK); /* 0x101E _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
1925 WINE_SPI_FIXME(SPI_SETMOUSECLICKLOCK); /* 0x101F _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
1926 WINE_SPI_FIXME(SPI_GETMOUSEVANISH); /* 0x1020 _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
1927 WINE_SPI_FIXME(SPI_SETMOUSEVANISH); /* 0x1021 _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
1928 case SPI_GETFLATMENU:
1929 ret = get_user_pref_param( 2, 0x02, pvParam );
1932 case SPI_SETFLATMENU:
1933 ret = set_user_pref_param( 2, 0x02, (BOOL)pvParam, fWinIni );
1936 WINE_SPI_FIXME(SPI_GETDROPSHADOW); /* 0x1024 _WIN32_WINNT >= 0x510 */
1937 WINE_SPI_FIXME(SPI_SETDROPSHADOW); /* 0x1025 _WIN32_WINNT >= 0x510 */
1938 WINE_SPI_FIXME(SPI_GETBLOCKSENDINPUTRESETS);
1939 WINE_SPI_FIXME(SPI_SETBLOCKSENDINPUTRESETS);
1940 WINE_SPI_FIXME(SPI_GETUIEFFECTS);
1941 WINE_SPI_FIXME(SPI_SETUIEFFECTS);
1942 WINE_SPI_FIXME(SPI_GETFOREGROUNDLOCKTIMEOUT);/* 0x2000 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
1943 WINE_SPI_FIXME(SPI_SETFOREGROUNDLOCKTIMEOUT);/* 0x2001 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
1944 WINE_SPI_FIXME(SPI_GETACTIVEWNDTRKTIMEOUT); /* 0x2002 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
1945 WINE_SPI_FIXME(SPI_SETACTIVEWNDTRKTIMEOUT); /* 0x2003 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
1946 WINE_SPI_FIXME(SPI_GETFOREGROUNDFLASHCOUNT);/* 0x2004 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
1947 WINE_SPI_FIXME(SPI_SETFOREGROUNDFLASHCOUNT);/* 0x2005 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
1948 WINE_SPI_FIXME(SPI_GETCARETWIDTH); /* 0x2006 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
1949 WINE_SPI_FIXME(SPI_SETCARETWIDTH); /* 0x2007 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
1950 WINE_SPI_FIXME(SPI_GETMOUSECLICKLOCKTIME); /* 0x2008 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
1951 WINE_SPI_FIXME(SPI_SETMOUSECLICKLOCKTIME); /* 0x2009 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
1952 WINE_SPI_FIXME(SPI_GETFONTSMOOTHINGTYPE); /* 0x200A _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
1953 WINE_SPI_FIXME(SPI_SETFONTSMOOTHINGTYPE); /* 0x200B _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
1954 WINE_SPI_FIXME(SPI_GETFONTSMOOTHINGCONTRAST);/* 0x200C _WIN32_WINNT >= 0x510 */
1955 WINE_SPI_FIXME(SPI_SETFONTSMOOTHINGCONTRAST);/* 0x200D _WIN32_WINNT >= 0x510 */
1956 WINE_SPI_FIXME(SPI_GETFOCUSBORDERWIDTH); /* 0x200E _WIN32_WINNT >= 0x510 */
1957 WINE_SPI_FIXME(SPI_SETFOCUSBORDERWIDTH); /* 0x200F _WIN32_WINNT >= 0x510 */
1958 WINE_SPI_FIXME(SPI_GETFOCUSBORDERHEIGHT); /* 0x2010 _WIN32_WINNT >= 0x510 */
1959 WINE_SPI_FIXME(SPI_SETFOCUSBORDERHEIGHT); /* 0x2011 _WIN32_WINNT >= 0x510 */
1962 FIXME( "Unknown action: %u\n", uiAction );
1963 SetLastError( ERROR_INVALID_SPI_VALUE );
1969 SYSPARAMS_NotifyChange( uiAction, fWinIni );
1972 #undef WINE_SPI_FIXME
1973 #undef WINE_SPI_WARN
1977 /***********************************************************************
1978 * SystemParametersInfo (USER.483)
1980 BOOL16 WINAPI SystemParametersInfo16( UINT16 uAction, UINT16 uParam,
1981 LPVOID lpvParam, UINT16 fuWinIni )
1985 TRACE("(%u, %u, %p, %u)\n", uAction, uParam, lpvParam, fuWinIni);
1989 case SPI_GETBEEP: /* 1 */
1990 case SPI_GETSCREENSAVEACTIVE: /* 16 */
1991 case SPI_GETICONTITLEWRAP: /* 25 */
1992 case SPI_GETMENUDROPALIGNMENT: /* 27 */
1993 case SPI_GETFASTTASKSWITCH: /* 35 */
1994 case SPI_GETDRAGFULLWINDOWS: /* 38 WINVER >= 0x0400 */
1997 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
1998 if (ret && lpvParam)
1999 *(BOOL16 *)lpvParam = tmp;
2003 case SPI_GETBORDER: /* 5 */
2004 case SPI_ICONHORIZONTALSPACING: /* 13 */
2005 case SPI_GETSCREENSAVETIMEOUT: /* 14 */
2006 case SPI_GETGRIDGRANULARITY: /* 18 */
2007 case SPI_GETKEYBOARDDELAY: /* 22 */
2008 case SPI_ICONVERTICALSPACING: /* 24 */
2011 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2012 if (ret && lpvParam)
2013 *(INT16 *)lpvParam = tmp;
2017 case SPI_GETKEYBOARDSPEED: /* 10 */
2020 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2021 if (ret && lpvParam)
2022 *(WORD *)lpvParam = tmp;
2026 case SPI_GETICONTITLELOGFONT: /* 31 */
2029 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2030 if (ret && lpvParam)
2031 SYSPARAMS_LogFont32ATo16( &tmp, (LPLOGFONT16)lpvParam );
2035 case SPI_GETNONCLIENTMETRICS: /* 41 WINVER >= 0x400 */
2037 NONCLIENTMETRICSA tmp;
2038 LPNONCLIENTMETRICS16 lpnm16 = (LPNONCLIENTMETRICS16)lpvParam;
2039 if (lpnm16 && lpnm16->cbSize == sizeof(NONCLIENTMETRICS16))
2041 tmp.cbSize = sizeof(NONCLIENTMETRICSA);
2042 ret = SystemParametersInfoA( uAction, uParam, &tmp, fuWinIni );
2044 SYSPARAMS_NonClientMetrics32ATo16( &tmp, lpnm16 );
2046 else /* winfile 95 sets cbSize to 340 */
2047 ret = SystemParametersInfoA( uAction, uParam, lpvParam, fuWinIni );
2051 case SPI_GETWORKAREA: /* 48 WINVER >= 0x400 */
2054 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2055 if (ret && lpvParam)
2057 RECT16 *r16 = (RECT16 *)lpvParam;
2058 r16->left = tmp.left;
2060 r16->right = tmp.right;
2061 r16->bottom = tmp.bottom;
2066 case SPI_GETMOUSEHOVERWIDTH: /* 98 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2067 case SPI_GETMOUSEHOVERHEIGHT: /* 100 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2068 case SPI_GETMOUSEHOVERTIME: /* 102 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2071 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2072 if (ret && lpvParam)
2073 *(UINT16 *)lpvParam = tmp;
2078 ret = SystemParametersInfoA( uAction, uParam, lpvParam, fuWinIni );
2084 /***********************************************************************
2085 * SystemParametersInfoA (USER32.@)
2087 BOOL WINAPI SystemParametersInfoA( UINT uiAction, UINT uiParam,
2088 PVOID pvParam, UINT fuWinIni )
2092 TRACE("(%u, %u, %p, %u)\n", uiAction, uiParam, pvParam, fuWinIni);
2096 case SPI_SETDESKWALLPAPER: /* 20 */
2097 case SPI_SETDESKPATTERN: /* 21 */
2101 if (!MultiByteToWideChar( CP_ACP, 0, (LPSTR)pvParam, -1,
2102 buffer, sizeof(buffer)/sizeof(WCHAR) ))
2103 buffer[sizeof(buffer)/sizeof(WCHAR)-1] = 0;
2104 ret = SystemParametersInfoW( uiAction, uiParam, pvParam ? buffer : NULL, fuWinIni );
2108 case SPI_GETICONTITLELOGFONT: /* 31 */
2111 ret = SystemParametersInfoW( uiAction, uiParam, pvParam ? &tmp : NULL, fuWinIni );
2113 SYSPARAMS_LogFont32WTo32A( &tmp, (LPLOGFONTA)pvParam );
2117 case SPI_GETNONCLIENTMETRICS: /* 41 WINVER >= 0x400 */
2119 NONCLIENTMETRICSW tmp;
2120 LPNONCLIENTMETRICSA lpnmA = (LPNONCLIENTMETRICSA)pvParam;
2121 if (lpnmA && lpnmA->cbSize == sizeof(NONCLIENTMETRICSA))
2123 tmp.cbSize = sizeof(NONCLIENTMETRICSW);
2124 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2126 SYSPARAMS_NonClientMetrics32WTo32A( &tmp, lpnmA );
2133 case SPI_GETICONMETRICS: /* 45 WINVER >= 0x400 */
2136 LPICONMETRICSA lpimA = (LPICONMETRICSA)pvParam;
2137 if (lpimA && lpimA->cbSize == sizeof(ICONMETRICSA))
2139 tmp.cbSize = sizeof(ICONMETRICSW);
2140 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2143 lpimA->iHorzSpacing = tmp.iHorzSpacing;
2144 lpimA->iVertSpacing = tmp.iVertSpacing;
2145 lpimA->iTitleWrap = tmp.iTitleWrap;
2146 SYSPARAMS_LogFont32WTo32A( &tmp.lfFont, &lpimA->lfFont );
2154 case SPI_SETICONMETRICS: /* 46 WINVER >= 0x400 */
2157 LPICONMETRICSA lpimA = (LPICONMETRICSA)pvParam;
2158 if (lpimA && lpimA->cbSize == sizeof(ICONMETRICSA))
2160 tmp.cbSize = sizeof(ICONMETRICSW);
2161 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2164 lpimA->iHorzSpacing = tmp.iHorzSpacing;
2165 lpimA->iVertSpacing = tmp.iVertSpacing;
2166 lpimA->iTitleWrap = tmp.iTitleWrap;
2167 SYSPARAMS_LogFont32WTo32A( &tmp.lfFont, &lpimA->lfFont );
2175 case SPI_GETHIGHCONTRAST: /* 66 WINVER >= 0x400 */
2178 LPHIGHCONTRASTA lphcA = (LPHIGHCONTRASTA)pvParam;
2179 if (lphcA && lphcA->cbSize == sizeof(HIGHCONTRASTA))
2181 tmp.cbSize = sizeof(HIGHCONTRASTW);
2182 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2185 lphcA->dwFlags = tmp.dwFlags;
2186 lphcA->lpszDefaultScheme = NULL; /* FIXME? */
2195 ret = SystemParametersInfoW( uiAction, uiParam, pvParam, fuWinIni );
2202 /***********************************************************************
2203 * GetSystemMetrics (USER32.@)
2205 INT WINAPI GetSystemMetrics( INT index )
2209 /* some metrics are dynamic */
2213 return GetDeviceCaps( get_display_dc(), HORZRES );
2215 return GetDeviceCaps( get_display_dc(), VERTRES );
2217 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2218 return nonclient_metrics.iScrollWidth;
2220 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2221 return nonclient_metrics.iScrollHeight;
2223 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2224 return nonclient_metrics.iCaptionHeight + 1; /* for the separator? */
2227 /* SM_C{X,Y}BORDER always returns 1 regardless of 'BorderWidth' value in registry */
2233 return GetSystemMetrics(SM_CXVSCROLL);
2235 return GetSystemMetrics(SM_CYHSCROLL);
2237 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2238 return icon_size.cx;
2240 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2241 return icon_size.cy;
2246 return GetSystemMetrics(SM_CYMENUSIZE) + 1;
2247 case SM_CXFULLSCREEN:
2248 return GetSystemMetrics(SM_CXSCREEN);
2249 case SM_CYFULLSCREEN:
2250 return GetSystemMetrics(SM_CYSCREEN) - GetSystemMetrics(SM_CYCAPTION);
2251 case SM_CYKANJIWINDOW:
2253 case SM_MOUSEPRESENT:
2256 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2257 return scroll_height.cy;
2259 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2260 return scroll_height.cx;
2264 get_uint_param( SPI_SETMOUSEBUTTONSWAP_IDX, SPI_SETMOUSEBUTTONSWAP_REGKEY,
2265 SPI_SETMOUSEBUTTONSWAP_VALNAME, &swap_buttons, &ret );
2273 return 112; /* FIXME */
2275 return 27; /* FIXME */
2277 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2278 return nonclient_metrics.iCaptionWidth;
2280 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2281 return nonclient_metrics.iCaptionHeight;
2283 SystemParametersInfoW( SPI_GETBORDER, 0, &ret, 0 );
2284 return GetSystemMetrics(SM_CXDLGFRAME) + ret;
2286 SystemParametersInfoW( SPI_GETBORDER, 0, &ret, 0 );
2287 return GetSystemMetrics(SM_CYDLGFRAME) + ret;
2289 return GetSystemMetrics(SM_CXMIN);
2291 return GetSystemMetrics(SM_CYMIN);
2292 case SM_CXDOUBLECLK:
2293 get_uint_param( SPI_SETDOUBLECLKWIDTH_IDX, SPI_SETDOUBLECLKWIDTH_REGKEY1,
2294 SPI_SETDOUBLECLKWIDTH_VALNAME, &double_click_width, &ret );
2296 case SM_CYDOUBLECLK:
2297 get_uint_param( SPI_SETDOUBLECLKHEIGHT_IDX, SPI_SETDOUBLECLKHEIGHT_REGKEY1,
2298 SPI_SETDOUBLECLKHEIGHT_VALNAME, &double_click_height, &ret );
2300 case SM_CXICONSPACING:
2301 SystemParametersInfoW( SPI_ICONHORIZONTALSPACING, 0, &ret, 0 );
2303 case SM_CYICONSPACING:
2304 SystemParametersInfoW( SPI_ICONVERTICALSPACING, 0, &ret, 0 );
2306 case SM_MENUDROPALIGNMENT:
2307 SystemParametersInfoW( SPI_GETMENUDROPALIGNMENT, 0, &ret, 0 );
2311 case SM_DBCSENABLED:
2314 GetCPInfo( CP_ACP, &cpinfo );
2315 return (cpinfo.MaxCharSize > 1);
2317 case SM_CMOUSEBUTTONS:
2322 return GetSystemMetrics(SM_CXBORDER) + 1;
2324 return GetSystemMetrics(SM_CYBORDER) + 1;
2325 case SM_CXMINSPACING:
2326 return GetSystemMetrics(SM_CXMINIMIZED) + minimized_metrics.iHorzGap;
2327 case SM_CYMINSPACING:
2328 return GetSystemMetrics(SM_CYMINIMIZED) + minimized_metrics.iVertGap;
2332 case SM_CYSMCAPTION:
2333 return GetSystemMetrics(SM_CYSMSIZE) + 1;
2335 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2336 return nonclient_metrics.iSmCaptionWidth;
2338 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2339 return nonclient_metrics.iSmCaptionHeight;
2341 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2342 return nonclient_metrics.iMenuWidth;
2344 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2345 return nonclient_metrics.iMenuHeight;
2347 return minimized_metrics.iArrange;
2348 case SM_CXMINIMIZED:
2349 return minimized_metrics.iWidth + 6;
2350 case SM_CYMINIMIZED:
2351 return 24; /* FIXME */
2353 return GetSystemMetrics(SM_CXSCREEN) + 4 + 2 * GetSystemMetrics(SM_CXFRAME);
2355 return GetSystemMetrics(SM_CYSCREEN) + 4 + 2 * GetSystemMetrics(SM_CYFRAME);
2356 case SM_CXMAXIMIZED:
2357 return GetSystemMetrics(SM_CXSCREEN) + 2 * GetSystemMetrics(SM_CXFRAME);
2358 case SM_CYMAXIMIZED:
2359 return GetSystemMetrics(SM_CYSCREEN) + 2 * GetSystemMetrics(SM_CYFRAME);
2361 return 3; /* FIXME */
2363 return 0; /* 0 = ok, 1 = failsafe, 2 = failsafe + network */
2368 SystemParametersInfoW( SPI_GETSHOWSOUNDS, 0, &ret, 0 );
2370 case SM_CXMENUCHECK:
2371 case SM_CYMENUCHECK:
2373 case SM_SLOWMACHINE:
2374 return 0; /* FIXME: Should check the type of processor */
2375 case SM_MIDEASTENABLED:
2376 return 0; /* FIXME */
2377 case SM_MOUSEWHEELPRESENT:
2379 case SM_XVIRTUALSCREEN:
2380 case SM_YVIRTUALSCREEN:
2382 case SM_CXVIRTUALSCREEN:
2383 return GetSystemMetrics(SM_CXSCREEN);
2384 case SM_CYVIRTUALSCREEN:
2385 return GetSystemMetrics(SM_CYSCREEN);
2388 case SM_SAMEDISPLAYFORMAT:
2391 return 0; /* FIXME */
2392 case SM_CXFOCUSBORDER:
2393 case SM_CYFOCUSBORDER:
2396 case SM_MEDIACENTER:
2406 /***********************************************************************
2407 * SwapMouseButton (USER32.@)
2409 BOOL WINAPI SwapMouseButton( BOOL fSwap )
2411 return SystemParametersInfoW(SPI_SETMOUSEBUTTONSWAP, fSwap, 0, 0);
2415 /**********************************************************************
2416 * SetDoubleClickTime (USER32.@)
2418 BOOL WINAPI SetDoubleClickTime( UINT interval )
2420 return SystemParametersInfoW(SPI_SETDOUBLECLICKTIME, interval, 0, 0);
2424 /**********************************************************************
2425 * GetDoubleClickTime (USER32.@)
2427 UINT WINAPI GetDoubleClickTime(void)
2431 get_uint_param( SPI_SETDOUBLECLICKTIME_IDX,
2432 SPI_SETDOUBLECLICKTIME_REGKEY,
2433 SPI_SETDOUBLECLICKTIME_VALNAME,
2434 &double_click_time, &time );
2435 if (!time) time = 500;
2440 /*************************************************************************
2441 * GetSysColor (USER32.@)
2443 COLORREF WINAPI GetSysColor( INT nIndex )
2445 if (nIndex >= 0 && nIndex < NUM_SYS_COLORS)
2446 return SysColors[nIndex];
2452 /*************************************************************************
2453 * SetSysColors (USER32.@)
2455 BOOL WINAPI SetSysColors( INT nChanges, const INT *lpSysColor,
2456 const COLORREF *lpColorValues )
2460 for (i = 0; i < nChanges; i++) SYSPARAMS_SetSysColor( lpSysColor[i], lpColorValues[i] );
2462 /* Send WM_SYSCOLORCHANGE message to all windows */
2464 SendMessageTimeoutW( HWND_BROADCAST, WM_SYSCOLORCHANGE, 0, 0, SMTO_ABORTIFHUNG, 2000, NULL );
2466 /* Repaint affected portions of all visible windows */
2468 RedrawWindow( GetDesktopWindow(), NULL, 0,
2469 RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN );
2474 /*************************************************************************
2475 * SetSysColorsTemp (USER32.@)
2479 * Called by W98SE desk.cpl Control Panel Applet:
2480 * handle = SetSysColorsTemp(ptr, ptr, nCount); ("set" call)
2481 * result = SetSysColorsTemp(NULL, NULL, handle); ("restore" call)
2483 * pPens is an array of COLORREF values, which seems to be used
2484 * to indicate the color values to create new pens with.
2486 * pBrushes is an array of solid brush handles (returned by a previous
2487 * CreateSolidBrush), which seems to contain the brush handles to set
2488 * for the system colors.
2490 * n seems to be used for
2491 * a) indicating the number of entries to operate on (length of pPens,
2493 * b) passing the handle that points to the previously used color settings.
2494 * I couldn't figure out in hell what kind of handle this is on
2495 * Windows. I just use a heap handle instead. Shouldn't matter anyway.
2498 * heap handle of our own copy of the current syscolors in case of
2499 * "set" call, i.e. pPens, pBrushes != NULL.
2500 * TRUE (unconditionally !) in case of "restore" call,
2501 * i.e. pPens, pBrushes == NULL.
2502 * FALSE in case of either pPens != NULL and pBrushes == NULL
2503 * or pPens == NULL and pBrushes != NULL.
2505 * I'm not sure whether this implementation is 100% correct. [AM]
2507 DWORD WINAPI SetSysColorsTemp( const COLORREF *pPens, const HBRUSH *pBrushes, DWORD n)
2511 if (pPens && pBrushes) /* "set" call */
2513 /* allocate our structure to remember old colors */
2514 LPVOID pOldCol = HeapAlloc(GetProcessHeap(), 0, sizeof(DWORD)+n*sizeof(HPEN)+n*sizeof(HBRUSH));
2516 *(DWORD *)p = n; p = (char*)p + sizeof(DWORD);
2517 memcpy(p, SysColorPens, n*sizeof(HPEN)); p = (char*)p + n*sizeof(HPEN);
2518 memcpy(p, SysColorBrushes, n*sizeof(HBRUSH)); p = (char*)p + n*sizeof(HBRUSH);
2520 for (i=0; i < n; i++)
2522 SysColorPens[i] = CreatePen( PS_SOLID, 1, pPens[i] );
2523 SysColorBrushes[i] = pBrushes[i];
2526 return (DWORD)pOldCol;
2528 if (!pPens && !pBrushes) /* "restore" call */
2530 LPVOID pOldCol = (LPVOID)n;
2532 DWORD nCount = *(DWORD *)p;
2533 p = (char*)p + sizeof(DWORD);
2535 for (i=0; i < nCount; i++)
2537 DeleteObject(SysColorPens[i]);
2538 SysColorPens[i] = *(HPEN *)p; p = (char*)p + sizeof(HPEN);
2540 for (i=0; i < nCount; i++)
2542 SysColorBrushes[i] = *(HBRUSH *)p; p = (char*)p + sizeof(HBRUSH);
2544 /* get rid of storage structure */
2545 HeapFree(GetProcessHeap(), 0, pOldCol);
2553 /***********************************************************************
2554 * GetSysColorBrush (USER32.@)
2556 HBRUSH WINAPI GetSysColorBrush( INT index )
2558 if (0 <= index && index < NUM_SYS_COLORS) return SysColorBrushes[index];
2559 WARN("Unknown index(%d)\n", index );
2560 return GetStockObject(LTGRAY_BRUSH);
2564 /***********************************************************************
2567 HPEN SYSCOLOR_GetPen( INT index )
2569 /* We can assert here, because this function is internal to Wine */
2570 assert (0 <= index && index < NUM_SYS_COLORS);
2571 return SysColorPens[index];
2575 /***********************************************************************
2576 * ChangeDisplaySettingsA (USER32.@)
2578 LONG WINAPI ChangeDisplaySettingsA( LPDEVMODEA devmode, DWORD flags )
2580 return ChangeDisplaySettingsExA(NULL,devmode,NULL,flags,NULL);
2584 /***********************************************************************
2585 * ChangeDisplaySettingsW (USER32.@)
2587 LONG WINAPI ChangeDisplaySettingsW( LPDEVMODEW devmode, DWORD flags )
2589 return ChangeDisplaySettingsExW(NULL,devmode,NULL,flags,NULL);
2593 /***********************************************************************
2594 * ChangeDisplaySettingsExA (USER32.@)
2596 LONG WINAPI ChangeDisplaySettingsExA( LPCSTR devname, LPDEVMODEA devmode, HWND hwnd,
2597 DWORD flags, LPVOID lparam )
2601 UNICODE_STRING nameW;
2603 if (devname) RtlCreateUnicodeStringFromAsciiz(&nameW, devname);
2604 else nameW.Buffer = NULL;
2608 devmodeW.dmBitsPerPel = devmode->dmBitsPerPel;
2609 devmodeW.dmPelsHeight = devmode->dmPelsHeight;
2610 devmodeW.dmPelsWidth = devmode->dmPelsWidth;
2611 devmodeW.dmDisplayFlags = devmode->dmDisplayFlags;
2612 devmodeW.dmDisplayFrequency = devmode->dmDisplayFrequency;
2613 devmodeW.dmFields = devmode->dmFields;
2614 ret = ChangeDisplaySettingsExW(nameW.Buffer, &devmodeW, hwnd, flags, lparam);
2618 ret = ChangeDisplaySettingsExW(nameW.Buffer, NULL, hwnd, flags, lparam);
2621 if (devname) RtlFreeUnicodeString(&nameW);
2626 /***********************************************************************
2627 * ChangeDisplaySettingsExW (USER32.@)
2629 LONG WINAPI ChangeDisplaySettingsExW( LPCWSTR devname, LPDEVMODEW devmode, HWND hwnd,
2630 DWORD flags, LPVOID lparam )
2632 return USER_Driver->pChangeDisplaySettingsEx( devname, devmode, hwnd, flags, lparam );
2636 /***********************************************************************
2637 * EnumDisplaySettingsW (USER32.@)
2640 * TRUE if nth setting exists found (described in the LPDEVMODEW struct)
2641 * FALSE if we do not have the nth setting
2643 BOOL WINAPI EnumDisplaySettingsW( LPCWSTR name, DWORD n, LPDEVMODEW devmode )
2645 return EnumDisplaySettingsExW(name, n, devmode, 0);
2649 /***********************************************************************
2650 * EnumDisplaySettingsA (USER32.@)
2652 BOOL WINAPI EnumDisplaySettingsA(LPCSTR name,DWORD n,LPDEVMODEA devmode)
2654 return EnumDisplaySettingsExA(name, n, devmode, 0);
2658 /***********************************************************************
2659 * EnumDisplaySettingsExA (USER32.@)
2661 BOOL WINAPI EnumDisplaySettingsExA(LPCSTR lpszDeviceName, DWORD iModeNum,
2662 LPDEVMODEA lpDevMode, DWORD dwFlags)
2666 UNICODE_STRING nameW;
2668 if (lpszDeviceName) RtlCreateUnicodeStringFromAsciiz(&nameW, lpszDeviceName);
2669 else nameW.Buffer = NULL;
2671 ret = EnumDisplaySettingsExW(nameW.Buffer,iModeNum,&devmodeW,dwFlags);
2674 lpDevMode->dmBitsPerPel = devmodeW.dmBitsPerPel;
2675 lpDevMode->dmPelsHeight = devmodeW.dmPelsHeight;
2676 lpDevMode->dmPelsWidth = devmodeW.dmPelsWidth;
2677 lpDevMode->dmDisplayFlags = devmodeW.dmDisplayFlags;
2678 lpDevMode->dmDisplayFrequency = devmodeW.dmDisplayFrequency;
2679 lpDevMode->dmFields = devmodeW.dmFields;
2681 if (lpszDeviceName) RtlFreeUnicodeString(&nameW);
2686 /***********************************************************************
2687 * EnumDisplaySettingsExW (USER32.@)
2689 BOOL WINAPI EnumDisplaySettingsExW(LPCWSTR lpszDeviceName, DWORD iModeNum,
2690 LPDEVMODEW lpDevMode, DWORD dwFlags)
2692 return USER_Driver->pEnumDisplaySettingsEx(lpszDeviceName, iModeNum, lpDevMode, dwFlags);