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/winuser16.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,
90 static const char * const DefSysColors[] =
92 "Scrollbar", "212 208 200", /* COLOR_SCROLLBAR */
93 "Background", "58 110 165", /* COLOR_BACKGROUND */
94 "ActiveTitle", "10 36 106", /* COLOR_ACTIVECAPTION */
95 "InactiveTitle", "128 128 128", /* COLOR_INACTIVECAPTION */
96 "Menu", "212 208 200", /* COLOR_MENU */
97 "Window", "255 255 255", /* COLOR_WINDOW */
98 "WindowFrame", "0 0 0", /* COLOR_WINDOWFRAME */
99 "MenuText", "0 0 0", /* COLOR_MENUTEXT */
100 "WindowText", "0 0 0", /* COLOR_WINDOWTEXT */
101 "TitleText", "255 255 255", /* COLOR_CAPTIONTEXT */
102 "ActiveBorder", "212 208 200", /* COLOR_ACTIVEBORDER */
103 "InactiveBorder", "212 208 200", /* COLOR_INACTIVEBORDER */
104 "AppWorkSpace", "128 128 128", /* COLOR_APPWORKSPACE */
105 "Hilight", "10 36 106", /* COLOR_HIGHLIGHT */
106 "HilightText", "255 255 255", /* COLOR_HIGHLIGHTTEXT */
107 "ButtonFace", "212 208 200", /* COLOR_BTNFACE */
108 "ButtonShadow", "128 128 128", /* COLOR_BTNSHADOW */
109 "GrayText", "128 128 128", /* COLOR_GRAYTEXT */
110 "ButtonText", "0 0 0", /* COLOR_BTNTEXT */
111 "InactiveTitleText", "212 208 200", /* COLOR_INACTIVECAPTIONTEXT */
112 "ButtonHilight", "255 255 255", /* COLOR_BTNHIGHLIGHT */
113 "ButtonDkShadow", "64 64 64", /* COLOR_3DDKSHADOW */
114 "ButtonLight", "212 208 200", /* COLOR_3DLIGHT */
115 "InfoText", "0 0 0", /* COLOR_INFOTEXT */
116 "InfoWindow", "255 255 225", /* COLOR_INFOBK */
117 "ButtonAlternateFace", "181 181 181", /* COLOR_ALTERNATEBTNFACE */
118 "HotTrackingColor", "0 0 128", /* COLOR_HOTLIGHT */
119 "GradientActiveTitle", "166 202 240", /* COLOR_GRADIENTACTIVECAPTION */
120 "GradientInactiveTitle", "192 192 192", /* COLOR_GRADIENTINACTIVECAPTION */
121 "MenuHilight", "10 36 106", /* COLOR_MENUHILIGHT */
122 "MenuBar", "212 208 200" /* COLOR_MENUBAR */
126 * Names of the registry subkeys of HKEY_CURRENT_USER key and value names
127 * for the system parameters.
128 * Names of the keys are created by adding string "_REGKEY" to
129 * "SET" action names, value names are created by adding "_REG_NAME"
130 * to the "SET" action name.
132 static const WCHAR SPI_SETBEEP_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','S','o','u','n','d',0};
133 static const WCHAR SPI_SETBEEP_VALNAME[]= {'B','e','e','p',0};
134 static const WCHAR SPI_SETMOUSE_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
135 static const WCHAR SPI_SETMOUSE_VALNAME1[]= {'M','o','u','s','e','T','h','r','e','s','h','o','l','d','1',0};
136 static const WCHAR SPI_SETMOUSE_VALNAME2[]= {'M','o','u','s','e','T','h','r','e','s','h','o','l','d','2',0};
137 static const WCHAR SPI_SETMOUSE_VALNAME3[]= {'M','o','u','s','e','S','p','e','e','d',0};
138 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','\\',
139 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
140 static const WCHAR SPI_SETBORDER_VALNAME[]= {'B','o','r','d','e','r','W','i','d','t','h',0};
141 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};
142 static const WCHAR SPI_SETKEYBOARDSPEED_VALNAME[]= {'K','e','y','b','o','a','r','d','S','p','e','e','d',0};
143 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','\\',
144 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
145 static const WCHAR SPI_ICONHORIZONTALSPACING_VALNAME[]= {'I','c','o','n','S','p','a','c','i','n','g',0};
146 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};
147 static const WCHAR SPI_SETSCREENSAVETIMEOUT_VALNAME[]= {'S','c','r','e','e','n','S','a','v','e','T','i','m','e','O','u','t',0};
148 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};
149 static const WCHAR SPI_SETSCREENSAVEACTIVE_VALNAME[]= {'S','c','r','e','e','n','S','a','v','e','A','c','t','i','v','e',0};
150 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};
151 static const WCHAR SPI_SETGRIDGRANULARITY_VALNAME[]= {'G','r','i','d','G','r','a','n','u','l','a','r','i','t','y',0};
152 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};
153 static const WCHAR SPI_SETKEYBOARDDELAY_VALNAME[]= {'K','e','y','b','o','a','r','d','D','e','l','a','y',0};
154 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','\\',
155 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
156 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};
157 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','\\',
158 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
159 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};
160 static const WCHAR SPI_SETICONTITLEWRAP_VALNAME[]= {'I','c','o','n','T','i','t','l','e','W','r','a','p',0};
161 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','\\',
162 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
163 static const WCHAR SPI_SETICONTITLELOGFONT_VALNAME[]= {'I','c','o','n','F','o','n','t',0};
164 static const WCHAR SPI_SETMENUDROPALIGNMENT_REGKEY1[]= {'S','o','f','t','w','a','r','e','\\',
165 'M','i','c','r','o','s','o','f','t','\\',
166 'W','i','n','d','o','w','s',' ','N','T','\\',
167 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
168 'W','i','n','d','o','w','s',0};
169 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};
170 static const WCHAR SPI_SETMENUDROPALIGNMENT_VALNAME[]= {'M','e','n','u','D','r','o','p','A','l','i','g','n','m','e','n','t',0};
171 static const WCHAR SPI_SETSNAPTODEFBUTTON_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
172 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};
173 static const WCHAR SPI_SETDOUBLECLKWIDTH_REGKEY1[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
174 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};
175 static const WCHAR SPI_SETDOUBLECLKWIDTH_VALNAME[]= {'D','o','u','b','l','e','C','l','i','c','k','W','i','d','t','h',0};
176 static const WCHAR SPI_SETDOUBLECLKHEIGHT_REGKEY1[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
177 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};
178 static const WCHAR SPI_SETDOUBLECLKHEIGHT_VALNAME[]= {'D','o','u','b','l','e','C','l','i','c','k','H','e','i','g','h','t',0};
179 static const WCHAR SPI_SETDOUBLECLICKTIME_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
180 static const WCHAR SPI_SETDOUBLECLICKTIME_VALNAME[]= {'D','o','u','b','l','e','C','l','i','c','k','S','p','e','e','d',0};
181 static const WCHAR SPI_SETMOUSEBUTTONSWAP_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
182 static const WCHAR SPI_SETMOUSEBUTTONSWAP_VALNAME[]= {'S','w','a','p','M','o','u','s','e','B','u','t','t','o','n','s',0};
183 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};
184 static const WCHAR SPI_SETDRAGFULLWINDOWS_VALNAME[]= {'D','r','a','g','F','u','l','l','W','i','n','d','o','w','s',0};
185 static const WCHAR SPI_SETSHOWSOUNDS_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\',
186 'A','c','c','e','s','s','i','b','i','l','i','t','y','\\',
187 'S','h','o','w','S','o','u','n','d','s',0};
188 static const WCHAR SPI_SETSHOWSOUNDS_VALNAME[]= {'O','n',0};
189 static const WCHAR SPI_SETKEYBOARDPREF_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\',
190 'A','c','c','e','s','s','i','b','i','l','i','t','y','\\',
191 'K','e','y','b','o','a','r','d',' ','P','r','e','f','e','r','e','n','c','e',0};
192 static const WCHAR SPI_SETKEYBOARDPREF_VALNAME[]= {'O','n',0};
193 static const WCHAR SPI_SETSCREENREADER_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\',
194 'A','c','c','e','s','s','i','b','i','l','i','t','y','\\',
195 'B','l','i','n','d',' ','A','c','c','e','s','s',0};
196 static const WCHAR SPI_SETSCREENREADER_VALNAME[]= {'O','n',0};
197 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};
198 static const WCHAR SPI_SETDESKWALLPAPER_VALNAME[]= {'W','a','l','l','p','a','p','e','r',0};
199 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};
200 static const WCHAR SPI_SETFONTSMOOTHING_VALNAME[]= {'F','o','n','t','S','m','o','o','t','h','i','n','g',0};
201 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};
202 static const WCHAR SPI_SETLOWPOWERACTIVE_VALNAME[]= {'L','o','w','P','o','w','e','r','A','c','t','i','v','e',0};
203 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};
204 static const WCHAR SPI_SETPOWEROFFACTIVE_VALNAME[]= {'P','o','w','e','r','O','f','f','A','c','t','i','v','e',0};
205 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};
206 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};
207 static const WCHAR SPI_SETMOUSEHOVERWIDTH_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
208 static const WCHAR SPI_SETMOUSEHOVERWIDTH_VALNAME[]= {'M','o','u','s','e','H','o','v','e','r','W','i','d','t','h',0};
209 static const WCHAR SPI_SETMOUSEHOVERHEIGHT_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
210 static const WCHAR SPI_SETMOUSEHOVERHEIGHT_VALNAME[]= {'M','o','u','s','e','H','o','v','e','r','H','e','i','g','h','t',0};
211 static const WCHAR SPI_SETMOUSEHOVERTIME_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
212 static const WCHAR SPI_SETMOUSEHOVERTIME_VALNAME[]= {'M','o','u','s','e','H','o','v','e','r','T','i','m','e',0};
213 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};
214 static const WCHAR SPI_SETMOUSESCROLLCHARS_VALNAME[]= {'W','h','e','e','l','S','c','r','o','l','l','C','h','a','r','s',0};
215 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};
216 static const WCHAR SPI_SETMOUSESCROLLLINES_VALNAME[]= {'W','h','e','e','l','S','c','r','o','l','l','L','i','n','e','s',0};
217 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};
218 static const WCHAR SPI_SETMENUSHOWDELAY_VALNAME[]= {'M','e','n','u','S','h','o','w','D','e','l','a','y',0};
219 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};
220 static const WCHAR SPI_CARETWIDTH_VALNAME[]= {'C','a','r','e','t','W','i','d','t','h',0};
222 /* FIXME - real values */
223 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};
224 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};
226 static const WCHAR METRICS_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p','\\',
227 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
228 static const WCHAR METRICS_SCROLLWIDTH_VALNAME[]= {'S','c','r','o','l','l','W','i','d','t','h',0};
229 static const WCHAR METRICS_SCROLLHEIGHT_VALNAME[]= {'S','c','r','o','l','l','H','e','i','g','h','t',0};
230 static const WCHAR METRICS_CAPTIONWIDTH_VALNAME[]= {'C','a','p','t','i','o','n','W','i','d','t','h',0};
231 static const WCHAR METRICS_CAPTIONHEIGHT_VALNAME[]= {'C','a','p','t','i','o','n','H','e','i','g','h','t',0};
232 static const WCHAR METRICS_SMCAPTIONWIDTH_VALNAME[]= {'S','m','C','a','p','t','i','o','n','W','i','d','t','h',0};
233 static const WCHAR METRICS_SMCAPTIONHEIGHT_VALNAME[]= {'S','m','C','a','p','t','i','o','n','H','e','i','g','h','t',0};
234 static const WCHAR METRICS_MENUWIDTH_VALNAME[]= {'M','e','n','u','W','i','d','t','h',0};
235 static const WCHAR METRICS_MENUHEIGHT_VALNAME[]= {'M','e','n','u','H','e','i','g','h','t',0};
236 static const WCHAR METRICS_ICONSIZE_VALNAME[]= {'S','h','e','l','l',' ','I','c','o','n',' ','S','i','z','e',0};
237 static const WCHAR METRICS_BORDERWIDTH_VALNAME[]= {'B','o','r','d','e','r','W','i','d','t','h',0};
238 static const WCHAR METRICS_CAPTIONLOGFONT_VALNAME[]= {'C','a','p','t','i','o','n','F','o','n','t',0};
239 static const WCHAR METRICS_SMCAPTIONLOGFONT_VALNAME[]={'S','m','C','a','p','t','i','o','n','F','o','n','t',0};
240 static const WCHAR METRICS_MENULOGFONT_VALNAME[]= {'M','e','n','u','F','o','n','t',0};
241 static const WCHAR METRICS_MESSAGELOGFONT_VALNAME[]= {'M','e','s','s','a','g','e','F','o','n','t',0};
242 static const WCHAR METRICS_STATUSLOGFONT_VALNAME[]= {'S','t','a','t','u','s','F','o','n','t',0};
243 /* minimized metrics */
244 static const WCHAR METRICS_MINWIDTH_VALNAME[] = {'M','i','n','W','i','d','t','h','\0'};
245 static const WCHAR METRICS_MINHORZGAP_VALNAME[] = {'M','i','n','H','o','r','z','G','a','p','\0'};
246 static const WCHAR METRICS_MINVERTGAP_VALNAME[] = {'M','i','n','V','e','r','t','G','a','p','\0'};
247 static const WCHAR METRICS_MINARRANGE_VALNAME[] = {'M','i','n','A','r','r','a','n','g','e','\0'};
249 static const WCHAR WINE_CURRENT_USER_REGKEY[] = {'S','o','f','t','w','a','r','e','\\',
252 /* volatile registry branch under WINE_CURRENT_USER_REGKEY for temporary values storage */
253 static const WCHAR WINE_CURRENT_USER_REGKEY_TEMP_PARAMS[] = {'T','e','m','p','o','r','a','r','y',' ',
254 'S','y','s','t','e','m',' ',
255 'P','a','r','a','m','e','t','e','r','s',0};
257 static const WCHAR Yes[]= {'Y','e','s',0};
258 static const WCHAR No[]= {'N','o',0};
259 static const WCHAR Desktop[]= {'D','e','s','k','t','o','p',0};
260 static const WCHAR Pattern[]= {'P','a','t','t','e','r','n',0};
261 static const WCHAR MenuFont[]= {'M','e','n','u','F','o','n','t',0};
262 static const WCHAR MenuFontSize[]= {'M','e','n','u','F','o','n','t','S','i','z','e',0};
263 static const WCHAR StatusFont[]= {'S','t','a','t','u','s','F','o','n','t',0};
264 static const WCHAR StatusFontSize[]= {'S','t','a','t','u','s','F','o','n','t','S','i','z','e',0};
265 static const WCHAR MessageFont[]= {'M','e','s','s','a','g','e','F','o','n','t',0};
266 static const WCHAR MessageFontSize[]= {'M','e','s','s','a','g','e','F','o','n','t','S','i','z','e',0};
267 static const WCHAR System[]= {'S','y','s','t','e','m',0};
268 static const WCHAR IconTitleSize[]= {'I','c','o','n','T','i','t','l','e','S','i','z','e',0};
269 static const WCHAR IconTitleFaceName[]= {'I','c','o','n','T','i','t','l','e','F','a','c','e','N','a','m','e',0};
270 static const WCHAR defPattern[]= {'0',' ','0',' ','0',' ','0',' ','0',' ','0',' ','0',' ','0',0};
271 static const WCHAR CSu[]= {'%','u',0};
272 static const WCHAR CSd[]= {'%','d',0};
274 /* Indicators whether system parameter value is loaded */
275 static char spi_loaded[SPI_INDEX_COUNT];
277 static BOOL notify_change = TRUE;
279 /* System parameters storage */
280 static BOOL beep_active = TRUE;
281 static int mouse_threshold1 = 6;
282 static int mouse_threshold2 = 10;
283 static int mouse_speed = 1;
284 static UINT border = 1;
285 static UINT keyboard_speed = 31;
286 static UINT screensave_timeout = 300;
287 static UINT grid_granularity = 0;
288 static UINT keyboard_delay = 1;
289 static UINT double_click_width = 4;
290 static UINT double_click_height = 4;
291 static UINT double_click_time = 500;
292 static BOOL drag_full_windows = FALSE;
293 static RECT work_area;
294 static BOOL keyboard_pref = TRUE;
295 static BOOL screen_reader = FALSE;
296 static UINT mouse_hover_width = 4;
297 static UINT mouse_hover_height = 4;
298 static UINT mouse_hover_time = 400;
299 static UINT mouse_scroll_chars = 3;
300 static UINT mouse_scroll_lines = 3;
301 static UINT menu_show_delay = 400;
302 static UINT menu_drop_alignment = 0;
303 static BOOL screensaver_running = FALSE;
304 static UINT font_smoothing = 0; /* 0x01 for 95/98/NT, 0x02 for 98/ME/2k/XP */
305 static BOOL lowpoweractive = FALSE;
306 static BOOL poweroffactive = FALSE;
307 static BOOL show_sounds = FALSE;
308 static BOOL snap_to_default_button = FALSE;
309 static BOOL swap_buttons = FALSE;
310 static UINT caret_width = 1;
311 static BYTE user_prefs[4];
313 static MINIMIZEDMETRICS minimized_metrics =
315 sizeof(MINIMIZEDMETRICS),
319 ARW_HIDE /* iArrange */
322 static ICONMETRICSW icon_metrics =
324 sizeof(ICONMETRICSW),
325 75, /* iHorzSpacing */
326 75, /* iVertSpacing */
327 TRUE, /* iTitleWrap */
328 { -11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET,
329 OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH } /* lfFont */
332 static NONCLIENTMETRICSW nonclient_metrics =
334 sizeof(NONCLIENTMETRICSW),
335 1, /* iBorderWidth */
336 16, /* iScrollWidth */
337 16, /* iScrollHeight */
338 18, /* iCaptionWidth */
339 18, /* iCaptionHeight */
340 { 0 }, /* lfCaptionFont */
341 13, /* iSmCaptionWidth */
342 15, /* iSmCaptionHeight */
343 { 0 }, /* lfSmCaptionFont */
345 18, /* iMenuHeight */
346 { 0 }, /* lfMenuFont */
347 { 0 }, /* lfStatusFont */
348 { 0 } /* lfMessageFont */
351 /* some additional non client metric info */
352 static TEXTMETRICW tmMenuFont;
353 static UINT CaptionFontAvCharWidth;
355 static SIZE icon_size = { 32, 32 };
357 #define NUM_SYS_COLORS (COLOR_MENUBAR+1)
359 static COLORREF SysColors[NUM_SYS_COLORS];
360 static HBRUSH SysColorBrushes[NUM_SYS_COLORS];
361 static HPEN SysColorPens[NUM_SYS_COLORS];
363 static const WORD wPattern55AA[] = { 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa };
365 HBRUSH SYSCOLOR_55AABrush = 0;
367 extern void __wine_make_gdi_object_system( HGDIOBJ handle, BOOL set );
370 /* This function is a copy of the one in objects/font.c */
371 static void SYSPARAMS_LogFont32ATo16( const LOGFONTA* font32, LPLOGFONT16 font16 )
373 font16->lfHeight = font32->lfHeight;
374 font16->lfWidth = font32->lfWidth;
375 font16->lfEscapement = font32->lfEscapement;
376 font16->lfOrientation = font32->lfOrientation;
377 font16->lfWeight = font32->lfWeight;
378 font16->lfItalic = font32->lfItalic;
379 font16->lfUnderline = font32->lfUnderline;
380 font16->lfStrikeOut = font32->lfStrikeOut;
381 font16->lfCharSet = font32->lfCharSet;
382 font16->lfOutPrecision = font32->lfOutPrecision;
383 font16->lfClipPrecision = font32->lfClipPrecision;
384 font16->lfQuality = font32->lfQuality;
385 font16->lfPitchAndFamily = font32->lfPitchAndFamily;
386 lstrcpynA( font16->lfFaceName, font32->lfFaceName, LF_FACESIZE );
389 static void SYSPARAMS_LogFont16To32W( const LOGFONT16 *font16, LPLOGFONTW font32 )
391 font32->lfHeight = font16->lfHeight;
392 font32->lfWidth = font16->lfWidth;
393 font32->lfEscapement = font16->lfEscapement;
394 font32->lfOrientation = font16->lfOrientation;
395 font32->lfWeight = font16->lfWeight;
396 font32->lfItalic = font16->lfItalic;
397 font32->lfUnderline = font16->lfUnderline;
398 font32->lfStrikeOut = font16->lfStrikeOut;
399 font32->lfCharSet = font16->lfCharSet;
400 font32->lfOutPrecision = font16->lfOutPrecision;
401 font32->lfClipPrecision = font16->lfClipPrecision;
402 font32->lfQuality = font16->lfQuality;
403 font32->lfPitchAndFamily = font16->lfPitchAndFamily;
404 MultiByteToWideChar( CP_ACP, 0, font16->lfFaceName, -1, font32->lfFaceName, LF_FACESIZE );
405 font32->lfFaceName[LF_FACESIZE-1] = 0;
408 static void SYSPARAMS_LogFont32WTo32A( const LOGFONTW* font32W, LPLOGFONTA font32A )
410 font32A->lfHeight = font32W->lfHeight;
411 font32A->lfWidth = font32W->lfWidth;
412 font32A->lfEscapement = font32W->lfEscapement;
413 font32A->lfOrientation = font32W->lfOrientation;
414 font32A->lfWeight = font32W->lfWeight;
415 font32A->lfItalic = font32W->lfItalic;
416 font32A->lfUnderline = font32W->lfUnderline;
417 font32A->lfStrikeOut = font32W->lfStrikeOut;
418 font32A->lfCharSet = font32W->lfCharSet;
419 font32A->lfOutPrecision = font32W->lfOutPrecision;
420 font32A->lfClipPrecision = font32W->lfClipPrecision;
421 font32A->lfQuality = font32W->lfQuality;
422 font32A->lfPitchAndFamily = font32W->lfPitchAndFamily;
423 WideCharToMultiByte( CP_ACP, 0, font32W->lfFaceName, -1, font32A->lfFaceName, LF_FACESIZE, NULL, NULL );
424 font32A->lfFaceName[LF_FACESIZE-1] = 0;
427 static void SYSPARAMS_LogFont32ATo32W( const LOGFONTA* font32A, LPLOGFONTW font32W )
429 font32W->lfHeight = font32A->lfHeight;
430 font32W->lfWidth = font32A->lfWidth;
431 font32W->lfEscapement = font32A->lfEscapement;
432 font32W->lfOrientation = font32A->lfOrientation;
433 font32W->lfWeight = font32A->lfWeight;
434 font32W->lfItalic = font32A->lfItalic;
435 font32W->lfUnderline = font32A->lfUnderline;
436 font32W->lfStrikeOut = font32A->lfStrikeOut;
437 font32W->lfCharSet = font32A->lfCharSet;
438 font32W->lfOutPrecision = font32A->lfOutPrecision;
439 font32W->lfClipPrecision = font32A->lfClipPrecision;
440 font32W->lfQuality = font32A->lfQuality;
441 font32W->lfPitchAndFamily = font32A->lfPitchAndFamily;
442 MultiByteToWideChar( CP_ACP, 0, font32A->lfFaceName, -1, font32W->lfFaceName, LF_FACESIZE );
443 font32W->lfFaceName[LF_FACESIZE-1] = 0;
446 static void SYSPARAMS_NonClientMetrics32ATo16( const NONCLIENTMETRICSA* lpnm32, LPNONCLIENTMETRICS16 lpnm16 )
448 lpnm16->iBorderWidth = lpnm32->iBorderWidth;
449 lpnm16->iScrollWidth = lpnm32->iScrollWidth;
450 lpnm16->iScrollHeight = lpnm32->iScrollHeight;
451 lpnm16->iCaptionWidth = lpnm32->iCaptionWidth;
452 lpnm16->iCaptionHeight = lpnm32->iCaptionHeight;
453 SYSPARAMS_LogFont32ATo16( &lpnm32->lfCaptionFont, &lpnm16->lfCaptionFont );
454 lpnm16->iSmCaptionWidth = lpnm32->iSmCaptionWidth;
455 lpnm16->iSmCaptionHeight = lpnm32->iSmCaptionHeight;
456 SYSPARAMS_LogFont32ATo16( &lpnm32->lfSmCaptionFont, &lpnm16->lfSmCaptionFont );
457 lpnm16->iMenuWidth = lpnm32->iMenuWidth;
458 lpnm16->iMenuHeight = lpnm32->iMenuHeight;
459 SYSPARAMS_LogFont32ATo16( &lpnm32->lfMenuFont, &lpnm16->lfMenuFont );
460 SYSPARAMS_LogFont32ATo16( &lpnm32->lfStatusFont, &lpnm16->lfStatusFont );
461 SYSPARAMS_LogFont32ATo16( &lpnm32->lfMessageFont, &lpnm16->lfMessageFont );
464 static void SYSPARAMS_NonClientMetrics32WTo32A( const NONCLIENTMETRICSW* lpnm32W, LPNONCLIENTMETRICSA lpnm32A )
466 lpnm32A->iBorderWidth = lpnm32W->iBorderWidth;
467 lpnm32A->iScrollWidth = lpnm32W->iScrollWidth;
468 lpnm32A->iScrollHeight = lpnm32W->iScrollHeight;
469 lpnm32A->iCaptionWidth = lpnm32W->iCaptionWidth;
470 lpnm32A->iCaptionHeight = lpnm32W->iCaptionHeight;
471 SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfCaptionFont, &lpnm32A->lfCaptionFont );
472 lpnm32A->iSmCaptionWidth = lpnm32W->iSmCaptionWidth;
473 lpnm32A->iSmCaptionHeight = lpnm32W->iSmCaptionHeight;
474 SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfSmCaptionFont, &lpnm32A->lfSmCaptionFont );
475 lpnm32A->iMenuWidth = lpnm32W->iMenuWidth;
476 lpnm32A->iMenuHeight = lpnm32W->iMenuHeight;
477 SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfMenuFont, &lpnm32A->lfMenuFont );
478 SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfStatusFont, &lpnm32A->lfStatusFont );
479 SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfMessageFont, &lpnm32A->lfMessageFont );
482 static void SYSPARAMS_NonClientMetrics32ATo32W( const NONCLIENTMETRICSA* lpnm32A, LPNONCLIENTMETRICSW lpnm32W )
484 lpnm32W->iBorderWidth = lpnm32A->iBorderWidth;
485 lpnm32W->iScrollWidth = lpnm32A->iScrollWidth;
486 lpnm32W->iScrollHeight = lpnm32A->iScrollHeight;
487 lpnm32W->iCaptionWidth = lpnm32A->iCaptionWidth;
488 lpnm32W->iCaptionHeight = lpnm32A->iCaptionHeight;
489 SYSPARAMS_LogFont32ATo32W( &lpnm32A->lfCaptionFont, &lpnm32W->lfCaptionFont );
490 lpnm32W->iSmCaptionWidth = lpnm32A->iSmCaptionWidth;
491 lpnm32W->iSmCaptionHeight = lpnm32A->iSmCaptionHeight;
492 SYSPARAMS_LogFont32ATo32W( &lpnm32A->lfSmCaptionFont, &lpnm32W->lfSmCaptionFont );
493 lpnm32W->iMenuWidth = lpnm32A->iMenuWidth;
494 lpnm32W->iMenuHeight = lpnm32A->iMenuHeight;
495 SYSPARAMS_LogFont32ATo32W( &lpnm32A->lfMenuFont, &lpnm32W->lfMenuFont );
496 SYSPARAMS_LogFont32ATo32W( &lpnm32A->lfStatusFont, &lpnm32W->lfStatusFont );
497 SYSPARAMS_LogFont32ATo32W( &lpnm32A->lfMessageFont, &lpnm32W->lfMessageFont );
501 /* Helper functions to retrieve monitors info */
509 static BOOL CALLBACK monitor_info_proc( HMONITOR monitor, HDC hdc, LPRECT rect, LPARAM lp )
511 struct monitor_info *info = (struct monitor_info *)lp;
513 UnionRect( &info->virtual_rect, &info->virtual_rect, rect );
517 static void get_monitors_info( struct monitor_info *info )
520 SetRectEmpty( &info->virtual_rect );
521 EnumDisplayMonitors( 0, NULL, monitor_info_proc, (LPARAM)info );
525 /* get text metrics and/or "average" char width of the specified logfont
526 * for the specified dc */
527 static void get_text_metr_size( HDC hdc, LOGFONTW *plf, TEXTMETRICW * ptm, UINT *psz)
529 HFONT hfont, hfontsav;
532 hfont = CreateFontIndirectW( plf);
533 if( !hfont || ( hfontsav = SelectObject( hdc, hfont)) == NULL ) {
536 if( hfont) DeleteObject( hfont);
539 GetTextMetricsW( hdc, ptm);
541 if( !(*psz = GdiGetCharDimensions( hdc, ptm, NULL)))
543 SelectObject( hdc, hfontsav);
544 DeleteObject( hfont);
547 /***********************************************************************
548 * get_volatile_regkey
550 * Return a handle to the volatile registry key used to store
551 * non-permanently modified parameters.
553 static HKEY get_volatile_regkey(void)
555 static HKEY volatile_key;
560 /* This must be non-volatile! */
561 if (RegCreateKeyExW( HKEY_CURRENT_USER, WINE_CURRENT_USER_REGKEY,
562 0, 0, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 0,
563 &key, 0 ) != ERROR_SUCCESS)
565 ERR("Can't create wine registry branch\n");
569 /* @@ Wine registry key: HKCU\Software\Wine\Temporary System Parameters */
570 if (RegCreateKeyExW( key, WINE_CURRENT_USER_REGKEY_TEMP_PARAMS,
571 0, 0, REG_OPTION_VOLATILE, KEY_ALL_ACCESS, 0,
572 &volatile_key, 0 ) != ERROR_SUCCESS)
573 ERR("Can't create non-permanent wine registry branch\n");
581 /***********************************************************************
582 * SYSPARAMS_NotifyChange
584 * Sends notification about system parameter update.
586 static void SYSPARAMS_NotifyChange( UINT uiAction, UINT fWinIni )
588 static const WCHAR emptyW[1];
592 if (fWinIni & SPIF_UPDATEINIFILE)
594 if (fWinIni & (SPIF_SENDWININICHANGE | SPIF_SENDCHANGE))
595 SendMessageTimeoutW(HWND_BROADCAST, WM_SETTINGCHANGE,
596 uiAction, (LPARAM) emptyW,
597 SMTO_ABORTIFHUNG, 2000, NULL );
601 /* FIXME notify other wine processes with internal message */
607 /***********************************************************************
608 * Loads system parameter from user profile.
610 static BOOL SYSPARAMS_LoadRaw( LPCWSTR lpRegKey, LPCWSTR lpValName, LPBYTE lpBuf, DWORD count )
616 memset( lpBuf, 0, count );
617 if ((RegOpenKeyW( get_volatile_regkey(), lpRegKey, &hKey ) == ERROR_SUCCESS) ||
618 (RegOpenKeyW( HKEY_CURRENT_USER, lpRegKey, &hKey ) == ERROR_SUCCESS))
620 ret = !RegQueryValueExW( hKey, lpValName, NULL, &type, lpBuf, &count);
626 static BOOL SYSPARAMS_Load( LPCWSTR lpRegKey, LPCWSTR lpValName, LPWSTR lpBuf, DWORD count )
628 return SYSPARAMS_LoadRaw( lpRegKey, lpValName, (LPBYTE)lpBuf, count );
631 /***********************************************************************
632 * Saves system parameter to user profile.
635 /* Save data as-is */
636 static BOOL SYSPARAMS_SaveRaw( LPCWSTR lpRegKey, LPCWSTR lpValName,
637 const BYTE* lpValue, DWORD valueSize,
638 DWORD type, UINT fWinIni )
645 if (fWinIni & SPIF_UPDATEINIFILE)
647 hBaseKey = HKEY_CURRENT_USER;
652 hBaseKey = get_volatile_regkey();
653 dwOptions = REG_OPTION_VOLATILE;
656 if (RegCreateKeyExW( hBaseKey, lpRegKey,
657 0, 0, dwOptions, KEY_ALL_ACCESS,
658 0, &hKey, 0 ) == ERROR_SUCCESS)
660 if (RegSetValueExW( hKey, lpValName, 0, type,
661 lpValue, valueSize) == ERROR_SUCCESS)
664 if (hBaseKey == HKEY_CURRENT_USER)
665 RegDeleteKeyW( get_volatile_regkey(), lpRegKey );
672 /* Convenience function to save strings */
673 static BOOL SYSPARAMS_Save( LPCWSTR lpRegKey, LPCWSTR lpValName, LPCWSTR lpValue,
676 return SYSPARAMS_SaveRaw( lpRegKey, lpValName, (const BYTE*)lpValue,
677 (strlenW(lpValue) + 1)*sizeof(WCHAR), REG_SZ, fWinIni );
680 /* Convenience function to save logical fonts */
681 static BOOL SYSPARAMS_SaveLogFont( LPCWSTR lpRegKey, LPCWSTR lpValName,
682 LPLOGFONTW plf, UINT fWinIni )
684 return SYSPARAMS_SaveRaw( lpRegKey, lpValName, (const BYTE*)plf,
685 sizeof( LOGFONTW), REG_BINARY, fWinIni );
689 static inline HDC get_display_dc(void)
691 static const WCHAR DISPLAY[] = {'D','I','S','P','L','A','Y',0};
692 static HDC display_dc;
693 if (!display_dc) display_dc = CreateICW( DISPLAY, NULL, NULL, NULL );
697 static inline int get_display_dpi(void)
699 static int display_dpi;
700 if (!display_dpi) display_dpi = GetDeviceCaps( get_display_dc(), LOGPIXELSY );
704 /***********************************************************************
705 * SYSPARAMS_Twips2Pixels
707 * Convert a dimension value that was obtained from the registry. These are
708 * quoted as being "twips" values if negative and pixels if positive.
709 * One inch is 1440 twips. So to convert, divide by 1440 to get inches and
710 * multiply that by the dots-per-inch to get the size in pixels.
712 * MSDN Library - April 2001 -> Resource Kits ->
713 * Windows 2000 Resource Kit Reference ->
714 * Technical Reference to the Windows 2000 Registry ->
715 * HKEY_CURRENT_USER -> Control Panel -> Desktop -> WindowMetrics
717 static inline int SYSPARAMS_Twips2Pixels(int x)
720 x = (-x * get_display_dpi() + 720) / 1440;
724 /***********************************************************************
727 * Get a registry entry from the already open key. This allows us to open the
728 * section once and read several values.
730 * Of course this function belongs somewhere more usable but here will do
733 static int get_reg_metric( HKEY hkey, LPCWSTR lpValName, int default_value )
735 int value = default_value;
739 DWORD type, count = sizeof(buffer);
740 if(!RegQueryValueExW( hkey, lpValName, NULL, &type, (LPBYTE)buffer, &count) )
744 /* Are there any utilities for converting registry entries
747 /* FIXME_(reg)("We need reg format converter\n"); */
750 value = atoiW(buffer);
753 return SYSPARAMS_Twips2Pixels(value);
757 /*************************************************************************
758 * SYSPARAMS_SetSysColor
760 static void SYSPARAMS_SetSysColor( int index, COLORREF color )
762 if (index < 0 || index >= NUM_SYS_COLORS) return;
763 SysColors[index] = color;
764 if (SysColorBrushes[index])
766 __wine_make_gdi_object_system( SysColorBrushes[index], FALSE);
767 DeleteObject( SysColorBrushes[index] );
769 SysColorBrushes[index] = CreateSolidBrush( color );
770 __wine_make_gdi_object_system( SysColorBrushes[index], TRUE);
772 if (SysColorPens[index])
774 __wine_make_gdi_object_system( SysColorPens[index], FALSE);
775 DeleteObject( SysColorPens[index] );
777 SysColorPens[index] = CreatePen( PS_SOLID, 1, color );
778 __wine_make_gdi_object_system( SysColorPens[index], TRUE);
781 /* load a uint parameter from the registry */
782 static BOOL get_uint_param( unsigned int idx, LPCWSTR regkey, LPCWSTR value,
783 UINT *value_ptr, UINT *ret_ptr )
785 if (!ret_ptr) return FALSE;
786 if (!spi_loaded[idx])
790 if (SYSPARAMS_Load( regkey, value, buf, sizeof(buf) )) *value_ptr = atoiW( buf );
791 spi_loaded[idx] = TRUE;
793 *ret_ptr = *value_ptr;
797 /* load a twips parameter from the registry */
798 static BOOL get_twips_param( unsigned int idx, LPCWSTR regkey, LPCWSTR value,
799 UINT *value_ptr, UINT *ret_ptr )
801 if (!ret_ptr) return FALSE;
802 if (!spi_loaded[idx])
806 if (SYSPARAMS_Load( regkey, value, buf, sizeof(buf) ))
807 *value_ptr = SYSPARAMS_Twips2Pixels( atoiW(buf) );
808 spi_loaded[idx] = TRUE;
810 *ret_ptr = *value_ptr;
814 /* load a boolean parameter from the registry */
815 static inline BOOL get_bool_param( unsigned int idx, LPCWSTR regkey, LPCWSTR value,
816 BOOL *value_ptr, BOOL *ret_ptr )
818 return get_uint_param( idx, regkey, value, (UINT *)value_ptr, (UINT *)ret_ptr );
821 /* set a uint parameter that is mirrored in two different registry locations */
822 static BOOL set_uint_param_mirrored( unsigned int idx, LPCWSTR regkey, LPCWSTR regkey_mirror,
823 LPCWSTR value, UINT *value_ptr, UINT new_val, UINT fWinIni )
827 wsprintfW(buf, CSu, new_val);
828 if (!SYSPARAMS_Save( regkey, value, buf, fWinIni )) return FALSE;
829 if (regkey_mirror) SYSPARAMS_Save( regkey_mirror, value, buf, fWinIni );
830 *value_ptr = new_val;
831 spi_loaded[idx] = TRUE;
835 /* save an int parameter in registry */
836 static BOOL save_int_param( LPCWSTR regkey, LPCWSTR value, INT *value_ptr,
837 INT new_val, UINT fWinIni )
841 wsprintfW(buf, CSd, new_val);
842 if (!SYSPARAMS_Save( regkey, value, buf, fWinIni )) return FALSE;
843 if( value_ptr) *value_ptr = new_val;
847 /* set an int parameter in the registry */
848 static inline BOOL set_int_param( unsigned int idx, LPCWSTR regkey, LPCWSTR value,
849 INT *value_ptr, INT new_val, UINT fWinIni )
851 BOOL ret = save_int_param( regkey, value, value_ptr, new_val, fWinIni );
852 if (ret) spi_loaded[idx] = TRUE;
856 /* set a uint parameter in the registry */
857 static inline BOOL set_uint_param( unsigned int idx, LPCWSTR regkey, LPCWSTR value,
858 UINT *value_ptr, UINT new_val, UINT fWinIni )
860 return set_uint_param_mirrored( idx, regkey, NULL, value, value_ptr, new_val, fWinIni );
863 /* set a boolean parameter that is mirrored in two different registry locations */
864 static inline BOOL set_bool_param_mirrored( unsigned int idx, LPCWSTR regkey, LPCWSTR regkey_mirror,
865 LPCWSTR value, BOOL *value_ptr, BOOL new_val, UINT fWinIni )
867 return set_uint_param_mirrored( idx, regkey, regkey_mirror, value,
868 (UINT *)value_ptr, new_val, fWinIni );
871 /* set a boolean parameter in the registry */
872 static inline BOOL set_bool_param( unsigned int idx, LPCWSTR regkey, LPCWSTR value,
873 BOOL *value_ptr, BOOL new_val, UINT fWinIni )
875 return set_uint_param( idx, regkey, value, (UINT *)value_ptr, new_val, fWinIni );
878 /* load a boolean parameter from the user preference key */
879 static BOOL get_user_pref_param( UINT offset, UINT mask, BOOL *ret_ptr )
881 if (!ret_ptr) return FALSE;
883 if (!spi_loaded[SPI_USERPREFERENCEMASK_IDX])
885 SYSPARAMS_LoadRaw( SPI_USERPREFERENCEMASK_REGKEY,
886 SPI_USERPREFERENCEMASK_VALNAME,
887 user_prefs, sizeof(user_prefs) );
888 spi_loaded[SPI_USERPREFERENCEMASK_IDX] = TRUE;
890 *ret_ptr = (user_prefs[offset] & mask) != 0;
894 /* set a boolean parameter in the user preference key */
895 static BOOL set_user_pref_param( UINT offset, UINT mask, BOOL value, BOOL fWinIni )
897 SYSPARAMS_LoadRaw( SPI_USERPREFERENCEMASK_REGKEY,
898 SPI_USERPREFERENCEMASK_VALNAME,
899 user_prefs, sizeof(user_prefs) );
900 spi_loaded[SPI_USERPREFERENCEMASK_IDX] = TRUE;
902 if (value) user_prefs[offset] |= mask;
903 else user_prefs[offset] &= ~mask;
905 SYSPARAMS_SaveRaw( SPI_USERPREFERENCEMASK_REGKEY,
906 SPI_USERPREFERENCEMASK_VALNAME,
907 user_prefs, sizeof(user_prefs), REG_BINARY, fWinIni );
911 /***********************************************************************
914 * Initialisation of the system metrics array.
916 void SYSPARAMS_Init(void)
918 HKEY hkey; /* key to the window metrics area of the registry */
923 /* initialize system colors */
925 if (RegCreateKeyExA(HKEY_CURRENT_USER, "Control Panel\\Colors", 0, 0, 0, KEY_ALL_ACCESS, 0, &hkey, 0))
927 for (i = 0; i < NUM_SYS_COLORS; i++)
931 /* first try, registry */
934 DWORD dwDataSize = sizeof(buffer);
935 if (!(RegQueryValueExA(hkey,DefSysColors[i*2], 0, 0, (LPBYTE) buffer, &dwDataSize)))
936 if (sscanf( buffer, "%d %d %d", &r, &g, &b ) == 3) bOk = TRUE;
939 /* second try, win.ini */
942 GetProfileStringA( "colors", DefSysColors[i*2], DefSysColors[i*2+1], buffer, 100 );
943 if (sscanf( buffer, " %d %d %d", &r, &g, &b ) == 3) bOk = TRUE;
946 /* last chance, take the default */
949 int iNumColors = sscanf( DefSysColors[i*2+1], " %d %d %d", &r, &g, &b );
950 assert (iNumColors==3);
953 SYSPARAMS_SetSysColor( i, RGB(r,g,b) );
955 if (hkey) RegCloseKey( hkey );
957 /* create 55AA bitmap */
959 h55AABitmap = CreateBitmap( 8, 8, 1, 1, wPattern55AA );
960 SYSCOLOR_55AABrush = CreatePatternBrush( h55AABitmap );
961 __wine_make_gdi_object_system( SYSCOLOR_55AABrush, TRUE );
965 /***********************************************************************
968 * Tries to retrieve logfont info from the specified key and value
970 static BOOL reg_get_logfont(LPCWSTR key, LPCWSTR value, LOGFONTW *lf)
979 base_keys[0] = get_volatile_regkey();
980 base_keys[1] = HKEY_CURRENT_USER;
982 for(i = 0; i < 2 && !found; i++)
984 if(RegOpenKeyW(base_keys[i], key, &hkey) == ERROR_SUCCESS)
986 size = sizeof(lfbuf);
987 if(RegQueryValueExW(hkey, value, NULL, &type, (LPBYTE)&lfbuf, &size) == ERROR_SUCCESS &&
990 if( size == sizeof(lfbuf))
993 memcpy(lf, &lfbuf, size);
994 } else if( size == sizeof( LOGFONT16))
995 { /* win9x-winME format */
997 SYSPARAMS_LogFont16To32W( (LOGFONT16*) &lfbuf, lf);
999 WARN("Unknown format in key %s value %s, size is %d\n",
1000 debugstr_w( key), debugstr_w( value), size);
1005 if( found && lf->lfHeight > 0) {
1006 /* positive height value means points ( inch/72 ) */
1007 lf->lfHeight = -MulDiv( lf->lfHeight, get_display_dpi(), 72);
1012 /* load all the minimized metrics */
1013 static void load_minimized_metrics(void)
1016 if (RegOpenKeyExW (HKEY_CURRENT_USER, METRICS_REGKEY,
1017 0, KEY_QUERY_VALUE, &hkey) != ERROR_SUCCESS) hkey = 0;
1019 minimized_metrics.iWidth = max( get_reg_metric(hkey,
1020 METRICS_MINWIDTH_VALNAME, minimized_metrics.iWidth), 0);
1021 minimized_metrics.iHorzGap = max( get_reg_metric(hkey,
1022 METRICS_MINHORZGAP_VALNAME, minimized_metrics.iHorzGap), 0);
1023 minimized_metrics.iVertGap = max( get_reg_metric(hkey,
1024 METRICS_MINVERTGAP_VALNAME, minimized_metrics.iVertGap), 0);
1025 minimized_metrics.iArrange = 0x0f & get_reg_metric(hkey,
1026 METRICS_MINARRANGE_VALNAME, minimized_metrics.iArrange);
1028 if (hkey) RegCloseKey( hkey );
1029 spi_loaded[SPI_MINIMIZEDMETRICS_IDX] = TRUE;
1032 /* adjust some of the raw values found in the registry */
1033 static void normalize_nonclientmetrics( NONCLIENTMETRICSW *pncm)
1036 if( pncm->iBorderWidth < 1) pncm->iBorderWidth = 1;
1037 if( pncm->iCaptionWidth < 8) pncm->iCaptionWidth = 8;
1038 if( pncm->iScrollWidth < 8) pncm->iScrollWidth = 8;
1039 if( pncm->iScrollHeight < 8) pncm->iScrollHeight = 8;
1041 /* get some extra metrics */
1042 get_text_metr_size( get_display_dc(), &pncm->lfMenuFont,
1044 get_text_metr_size( get_display_dc(), &pncm->lfCaptionFont,
1045 NULL, &CaptionFontAvCharWidth);
1047 /* adjust some heights to the corresponding font */
1048 pncm->iMenuHeight = max( pncm->iMenuHeight,
1049 2 + tmMenuFont.tmHeight + tmMenuFont.tmExternalLeading);
1050 get_text_metr_size( get_display_dc(), &pncm->lfCaptionFont, &tm, NULL);
1051 pncm->iCaptionHeight = max( pncm->iCaptionHeight, 2 + tm.tmHeight);
1052 get_text_metr_size( get_display_dc(), &pncm->lfSmCaptionFont, &tm, NULL);
1053 pncm->iSmCaptionHeight = max( pncm->iSmCaptionHeight, 2 + tm.tmHeight);
1056 /* load all the non-client metrics */
1057 static void load_nonclient_metrics(void)
1060 NONCLIENTMETRICSW ncm;
1063 ncm.cbSize = sizeof (ncm);
1064 if (RegOpenKeyExW (HKEY_CURRENT_USER, METRICS_REGKEY,
1065 0, KEY_QUERY_VALUE, &hkey) != ERROR_SUCCESS) hkey = 0;
1067 /* initialize geometry entries */
1068 ncm.iBorderWidth = get_reg_metric(hkey, METRICS_BORDERWIDTH_VALNAME, 1);
1069 ncm.iScrollWidth = get_reg_metric(hkey, METRICS_SCROLLWIDTH_VALNAME, 16);
1070 ncm.iScrollHeight = get_reg_metric(hkey, METRICS_SCROLLHEIGHT_VALNAME, 16);
1072 /* size of the normal caption buttons */
1073 ncm.iCaptionHeight = get_reg_metric(hkey, METRICS_CAPTIONHEIGHT_VALNAME, 18);
1074 ncm.iCaptionWidth = get_reg_metric(hkey, METRICS_CAPTIONWIDTH_VALNAME, ncm.iCaptionHeight);
1076 /* caption font metrics */
1077 if (!reg_get_logfont(METRICS_REGKEY, METRICS_CAPTIONLOGFONT_VALNAME, &ncm.lfCaptionFont))
1079 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &ncm.lfCaptionFont, 0 );
1080 ncm.lfCaptionFont.lfWeight = FW_BOLD;
1083 /* size of the small caption buttons */
1084 ncm.iSmCaptionWidth = get_reg_metric(hkey, METRICS_SMCAPTIONWIDTH_VALNAME, 13);
1085 ncm.iSmCaptionHeight = get_reg_metric(hkey, METRICS_SMCAPTIONHEIGHT_VALNAME, 15);
1087 /* small caption font metrics */
1088 if (!reg_get_logfont(METRICS_REGKEY, METRICS_SMCAPTIONLOGFONT_VALNAME, &ncm.lfSmCaptionFont))
1089 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &ncm.lfSmCaptionFont, 0 );
1091 /* menus, FIXME: names of wine.conf entries are bogus */
1093 /* size of the menu (MDI) buttons */
1094 ncm.iMenuHeight = get_reg_metric(hkey, METRICS_MENUHEIGHT_VALNAME, 18);
1095 ncm.iMenuWidth = get_reg_metric(hkey, METRICS_MENUWIDTH_VALNAME, ncm.iMenuHeight);
1097 /* menu font metrics */
1098 if (!reg_get_logfont(METRICS_REGKEY, METRICS_MENULOGFONT_VALNAME, &ncm.lfMenuFont))
1100 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &ncm.lfMenuFont, 0 );
1101 GetProfileStringW( Desktop, MenuFont, ncm.lfCaptionFont.lfFaceName,
1102 ncm.lfMenuFont.lfFaceName, LF_FACESIZE );
1103 r = GetProfileIntW( Desktop, MenuFontSize, 0 );
1105 ncm.lfMenuFont.lfHeight = -r;
1106 ncm.lfMenuFont.lfWeight = FW_NORMAL;
1109 /* status bar font metrics */
1110 if (!reg_get_logfont(METRICS_REGKEY, METRICS_STATUSLOGFONT_VALNAME, &ncm.lfStatusFont))
1112 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &ncm.lfStatusFont, 0 );
1113 GetProfileStringW( Desktop, StatusFont, ncm.lfCaptionFont.lfFaceName,
1114 ncm.lfStatusFont.lfFaceName, LF_FACESIZE );
1115 r = GetProfileIntW( Desktop, StatusFontSize, 0 );
1117 ncm.lfStatusFont.lfHeight = -r;
1118 ncm.lfStatusFont.lfWeight = FW_NORMAL;
1121 /* message font metrics */
1122 if (!reg_get_logfont(METRICS_REGKEY, METRICS_MESSAGELOGFONT_VALNAME, &ncm.lfMessageFont))
1124 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0, &ncm.lfMessageFont, 0 );
1125 GetProfileStringW( Desktop, MessageFont, ncm.lfCaptionFont.lfFaceName,
1126 ncm.lfMessageFont.lfFaceName, LF_FACESIZE );
1127 r = GetProfileIntW( Desktop, MessageFontSize, 0 );
1129 ncm.lfMessageFont.lfHeight = -r;
1130 ncm.lfMessageFont.lfWeight = FW_NORMAL;
1133 /* some extra fields not in the nonclient structure */
1134 icon_size.cx = icon_size.cy = get_reg_metric( hkey, METRICS_ICONSIZE_VALNAME, 32 );
1136 if (hkey) RegCloseKey( hkey );
1137 normalize_nonclientmetrics( &ncm);
1138 nonclient_metrics = ncm;
1139 spi_loaded[SPI_NONCLIENTMETRICS_IDX] = TRUE;
1143 /***********************************************************************
1144 * SystemParametersInfoW (USER32.@)
1146 * Each system parameter has flag which shows whether the parameter
1147 * is loaded or not. Parameters, stored directly in SysParametersInfo are
1148 * loaded from registry only when they are requested and the flag is
1149 * "false", after the loading the flag is set to "true". On interprocess
1150 * notification of the parameter change the corresponding parameter flag is
1151 * set to "false". The parameter value will be reloaded when it is requested
1153 * Parameters, backed by or depend on GetSystemMetrics are processed
1154 * differently. These parameters are always loaded. They are reloaded right
1155 * away on interprocess change notification. We can't do lazy loading because
1156 * we don't want to complicate GetSystemMetrics.
1157 * Parameters, backed by X settings are read from corresponding setting.
1158 * On the parameter change request the setting is changed. Interprocess change
1159 * notifications are ignored.
1160 * When parameter value is updated the changed value is stored in permanent
1161 * registry branch if saving is requested. Otherwise it is stored
1162 * in temporary branch
1164 * Some SPI values can also be stored as Twips values in the registry,
1165 * don't forget the conversion!
1167 BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
1168 PVOID pvParam, UINT fWinIni )
1170 #define WINE_SPI_FIXME(x) \
1172 FIXME( "Unimplemented action: %u (%s)\n", x, #x ); \
1173 SetLastError( ERROR_INVALID_SPI_VALUE ); \
1176 #define WINE_SPI_WARN(x) \
1178 WARN( "Ignored action: %u (%s)\n", x, #x ); \
1182 unsigned spi_idx = 0;
1186 case SPI_GETBEEP: /* 1 */
1187 if (!pvParam) return FALSE;
1189 spi_idx = SPI_SETBEEP_IDX;
1190 if (!spi_loaded[spi_idx])
1194 if (SYSPARAMS_Load( SPI_SETBEEP_REGKEY, SPI_SETBEEP_VALNAME, buf, sizeof(buf) ))
1195 beep_active = !lstrcmpiW( Yes, buf );
1196 spi_loaded[spi_idx] = TRUE;
1199 *(BOOL *)pvParam = beep_active;
1202 case SPI_SETBEEP: /* 2 */
1203 spi_idx = SPI_SETBEEP_IDX;
1204 if (SYSPARAMS_Save( SPI_SETBEEP_REGKEY, SPI_SETBEEP_VALNAME,
1205 (uiParam ? Yes : No), fWinIni ))
1207 beep_active = uiParam;
1208 spi_loaded[spi_idx] = TRUE;
1214 case SPI_GETMOUSE: /* 3 */
1215 if (!pvParam) return FALSE;
1217 spi_idx = SPI_SETMOUSE_IDX;
1218 if (!spi_loaded[spi_idx])
1222 if (SYSPARAMS_Load( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME1,
1224 mouse_threshold1 = atoiW( buf );
1225 if (SYSPARAMS_Load( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME2,
1227 mouse_threshold2 = atoiW( buf );
1228 if (SYSPARAMS_Load( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME3,
1230 mouse_speed = atoiW( buf );
1231 spi_loaded[spi_idx] = TRUE;
1233 ((INT *)pvParam)[0] = mouse_threshold1;
1234 ((INT *)pvParam)[1] = mouse_threshold2;
1235 ((INT *)pvParam)[2] = mouse_speed;
1238 case SPI_SETMOUSE: /* 4 */
1240 if (!pvParam) return FALSE;
1241 ret = set_int_param( SPI_SETMOUSE_IDX, SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME1,
1242 &mouse_threshold1, ((INT *)pvParam)[0], fWinIni);
1244 save_int_param( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME2,
1245 &mouse_threshold2, ((INT *)pvParam)[1], fWinIni);
1246 save_int_param( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME3,
1247 &mouse_speed, ((INT *)pvParam)[2], fWinIni);
1253 ret = get_twips_param( SPI_SETBORDER_IDX,
1254 SPI_SETBORDER_REGKEY,
1255 SPI_SETBORDER_VALNAME,
1257 if( *(INT*)pvParam < 1) *(INT*)pvParam = 1;
1261 nonclient_metrics.iBorderWidth = uiParam > 0 ? uiParam : 1;
1262 /* raw value goes to registry */
1263 ret = set_uint_param( SPI_SETBORDER_IDX,
1264 SPI_SETBORDER_REGKEY,
1265 SPI_SETBORDER_VALNAME,
1266 &border, uiParam, fWinIni );
1269 case SPI_GETKEYBOARDSPEED:
1270 ret = get_uint_param( SPI_SETKEYBOARDSPEED_IDX,
1271 SPI_SETKEYBOARDSPEED_REGKEY,
1272 SPI_SETKEYBOARDSPEED_VALNAME,
1273 &keyboard_speed, pvParam );
1276 case SPI_SETKEYBOARDSPEED:
1277 if (uiParam > 31) uiParam = 31;
1278 ret = set_uint_param( SPI_SETKEYBOARDSPEED_IDX,
1279 SPI_SETKEYBOARDSPEED_REGKEY,
1280 SPI_SETKEYBOARDSPEED_VALNAME,
1281 &keyboard_speed, uiParam, fWinIni );
1284 /* not implemented in Windows */
1285 WINE_SPI_WARN(SPI_LANGDRIVER); /* 12 */
1287 case SPI_ICONHORIZONTALSPACING:
1288 if (pvParam != NULL)
1290 ret = get_twips_param( SPI_ICONHORIZONTALSPACING_IDX,
1291 SPI_ICONHORIZONTALSPACING_REGKEY,
1292 SPI_ICONHORIZONTALSPACING_VALNAME,
1293 (UINT*)&icon_metrics.iHorzSpacing, pvParam );
1297 if (uiParam < 32) uiParam = 32;
1298 ret = set_uint_param( SPI_ICONHORIZONTALSPACING_IDX,
1299 SPI_ICONHORIZONTALSPACING_REGKEY,
1300 SPI_ICONHORIZONTALSPACING_VALNAME,
1301 (UINT*)&icon_metrics.iHorzSpacing, uiParam, fWinIni );
1305 case SPI_GETSCREENSAVETIMEOUT:
1306 ret = get_uint_param( SPI_SETSCREENSAVETIMEOUT_IDX,
1307 SPI_SETSCREENSAVETIMEOUT_REGKEY,
1308 SPI_SETSCREENSAVETIMEOUT_VALNAME,
1309 &screensave_timeout, pvParam );
1312 case SPI_SETSCREENSAVETIMEOUT:
1313 ret = set_uint_param( SPI_SETSCREENSAVETIMEOUT_IDX,
1314 SPI_SETSCREENSAVETIMEOUT_REGKEY,
1315 SPI_SETSCREENSAVETIMEOUT_VALNAME,
1316 &screensave_timeout, uiParam, fWinIni );
1319 case SPI_GETSCREENSAVEACTIVE: /* 16 */
1320 if (!pvParam) return FALSE;
1321 *(BOOL *)pvParam = USER_Driver->pGetScreenSaveActive();
1324 case SPI_SETSCREENSAVEACTIVE: /* 17 */
1328 wsprintfW(buf, CSu, uiParam);
1329 USER_Driver->pSetScreenSaveActive( uiParam );
1330 /* saved value does not affect Wine */
1331 SYSPARAMS_Save( SPI_SETSCREENSAVEACTIVE_REGKEY,
1332 SPI_SETSCREENSAVEACTIVE_VALNAME,
1337 case SPI_GETGRIDGRANULARITY:
1338 ret = get_uint_param( SPI_SETGRIDGRANULARITY_IDX,
1339 SPI_SETGRIDGRANULARITY_REGKEY,
1340 SPI_SETGRIDGRANULARITY_VALNAME,
1341 &grid_granularity, pvParam );
1344 case SPI_SETGRIDGRANULARITY:
1345 ret = set_uint_param( SPI_SETGRIDGRANULARITY_IDX,
1346 SPI_SETGRIDGRANULARITY_REGKEY,
1347 SPI_SETGRIDGRANULARITY_VALNAME,
1348 &grid_granularity, uiParam, fWinIni );
1351 case SPI_SETDESKWALLPAPER: /* 20 */
1352 if (!pvParam || !SetDeskWallPaper( (LPSTR)pvParam )) return FALSE;
1353 SYSPARAMS_Save(SPI_SETDESKWALLPAPER_REGKEY, SPI_SETDESKWALLPAPER_VALNAME, pvParam, fWinIni);
1356 case SPI_SETDESKPATTERN: /* 21 */
1357 /* FIXME: the ability to specify a pattern in pvParam
1358 doesn't seem to be documented for Win32 */
1359 if ((INT16)uiParam == -1)
1362 GetProfileStringW( Desktop, Pattern,
1364 buf, sizeof(buf)/sizeof(WCHAR) );
1365 ret = DESKTOP_SetPattern( buf );
1367 ret = DESKTOP_SetPattern( (LPWSTR)pvParam );
1370 case SPI_GETKEYBOARDDELAY:
1371 ret = get_uint_param( SPI_SETKEYBOARDDELAY_IDX,
1372 SPI_SETKEYBOARDDELAY_REGKEY,
1373 SPI_SETKEYBOARDDELAY_VALNAME,
1374 &keyboard_delay, pvParam );
1377 case SPI_SETKEYBOARDDELAY:
1378 ret = set_uint_param( SPI_SETKEYBOARDDELAY_IDX,
1379 SPI_SETKEYBOARDDELAY_REGKEY,
1380 SPI_SETKEYBOARDDELAY_VALNAME,
1381 &keyboard_delay, uiParam, fWinIni );
1384 case SPI_ICONVERTICALSPACING:
1385 if (pvParam != NULL)
1387 ret = get_twips_param( SPI_ICONVERTICALSPACING_IDX,
1388 SPI_ICONVERTICALSPACING_REGKEY,
1389 SPI_ICONVERTICALSPACING_VALNAME,
1390 (UINT*)&icon_metrics.iVertSpacing, pvParam );
1391 if( icon_metrics.iVertSpacing < 32)
1392 icon_metrics.iVertSpacing = 32;
1396 if (uiParam < 32) uiParam = 32;
1397 ret = set_uint_param( SPI_ICONVERTICALSPACING_IDX,
1398 SPI_ICONVERTICALSPACING_REGKEY,
1399 SPI_ICONVERTICALSPACING_VALNAME,
1400 (UINT*)&icon_metrics.iVertSpacing, uiParam, fWinIni );
1404 case SPI_GETICONTITLEWRAP:
1405 ret = get_bool_param( SPI_SETICONTITLEWRAP_IDX,
1406 SPI_SETICONTITLEWRAP_REGKEY1,
1407 SPI_SETICONTITLEWRAP_VALNAME,
1408 &icon_metrics.iTitleWrap, pvParam );
1411 case SPI_SETICONTITLEWRAP:
1412 ret = set_bool_param_mirrored( SPI_SETICONTITLEWRAP_IDX,
1413 SPI_SETICONTITLEWRAP_REGKEY1,
1414 SPI_SETICONTITLEWRAP_REGKEY2,
1415 SPI_SETICONTITLEWRAP_VALNAME,
1416 &icon_metrics.iTitleWrap, uiParam, fWinIni );
1419 case SPI_GETMENUDROPALIGNMENT:
1420 ret = get_uint_param( SPI_SETMENUDROPALIGNMENT_IDX,
1421 SPI_SETMENUDROPALIGNMENT_REGKEY1,
1422 SPI_SETMENUDROPALIGNMENT_VALNAME,
1423 &menu_drop_alignment, pvParam );
1426 case SPI_SETMENUDROPALIGNMENT:
1427 ret = set_uint_param_mirrored( SPI_SETMENUDROPALIGNMENT_IDX,
1428 SPI_SETMENUDROPALIGNMENT_REGKEY1,
1429 SPI_SETMENUDROPALIGNMENT_REGKEY2,
1430 SPI_SETMENUDROPALIGNMENT_VALNAME,
1431 &menu_drop_alignment, uiParam, fWinIni );
1434 case SPI_SETDOUBLECLKWIDTH:
1435 ret = set_uint_param_mirrored( SPI_SETDOUBLECLKWIDTH_IDX,
1436 SPI_SETDOUBLECLKWIDTH_REGKEY1,
1437 SPI_SETDOUBLECLKWIDTH_REGKEY2,
1438 SPI_SETDOUBLECLKWIDTH_VALNAME,
1439 &double_click_width, uiParam, fWinIni );
1442 case SPI_SETDOUBLECLKHEIGHT:
1443 ret = set_uint_param_mirrored( SPI_SETDOUBLECLKHEIGHT_IDX,
1444 SPI_SETDOUBLECLKHEIGHT_REGKEY1,
1445 SPI_SETDOUBLECLKHEIGHT_REGKEY2,
1446 SPI_SETDOUBLECLKHEIGHT_VALNAME,
1447 &double_click_height, uiParam, fWinIni );
1450 case SPI_GETICONTITLELOGFONT:
1454 if (!pvParam) return FALSE;
1456 spi_idx = SPI_SETICONTITLELOGFONT_IDX;
1457 if (!spi_loaded[spi_idx])
1459 if (!reg_get_logfont( SPI_SETICONTITLELOGFONT_REGKEY,
1460 SPI_SETICONTITLELOGFONT_VALNAME, &icon_metrics.lfFont ))
1465 * The 'default GDI fonts' seems to be returned.
1466 * If a returned font is not a correct font in your environment,
1467 * please try to fix objects/gdiobj.c at first.
1469 GetObjectW( GetStockObject( DEFAULT_GUI_FONT ), sizeof(LOGFONTW), &lfDefault );
1471 GetProfileStringW( Desktop, IconTitleFaceName,
1472 lfDefault.lfFaceName,
1473 icon_metrics.lfFont.lfFaceName,
1476 r = GetProfileIntW( Desktop, IconTitleSize, 0 );
1478 icon_metrics.lfFont.lfHeight = -r;
1480 icon_metrics.lfFont.lfHeight = lfDefault.lfHeight;
1482 icon_metrics.lfFont.lfWidth = 0;
1483 icon_metrics.lfFont.lfEscapement = icon_metrics.lfFont.lfOrientation = 0;
1484 icon_metrics.lfFont.lfWeight = FW_NORMAL;
1485 icon_metrics.lfFont.lfItalic = FALSE;
1486 icon_metrics.lfFont.lfStrikeOut = FALSE;
1487 icon_metrics.lfFont.lfUnderline = FALSE;
1488 icon_metrics.lfFont.lfCharSet = lfDefault.lfCharSet; /* at least 'charset' should not be hard-coded */
1489 icon_metrics.lfFont.lfOutPrecision = OUT_DEFAULT_PRECIS;
1490 icon_metrics.lfFont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
1491 icon_metrics.lfFont.lfQuality = DEFAULT_QUALITY;
1492 icon_metrics.lfFont.lfPitchAndFamily = DEFAULT_PITCH;
1493 spi_loaded[spi_idx] = TRUE;
1496 *(LOGFONTW *)pvParam = icon_metrics.lfFont;
1500 case SPI_SETDOUBLECLICKTIME:
1501 ret = set_uint_param( SPI_SETDOUBLECLICKTIME_IDX,
1502 SPI_SETDOUBLECLICKTIME_REGKEY,
1503 SPI_SETDOUBLECLICKTIME_VALNAME,
1504 &double_click_time, uiParam, fWinIni );
1507 case SPI_SETMOUSEBUTTONSWAP:
1508 ret = set_bool_param( SPI_SETMOUSEBUTTONSWAP_IDX,
1509 SPI_SETMOUSEBUTTONSWAP_REGKEY,
1510 SPI_SETMOUSEBUTTONSWAP_VALNAME,
1511 &swap_buttons, uiParam, fWinIni );
1514 case SPI_SETICONTITLELOGFONT: /* 34 */
1515 if( uiParam == sizeof(LOGFONTW)) {
1516 ret = SYSPARAMS_SaveLogFont( SPI_SETICONTITLELOGFONT_REGKEY,
1517 SPI_SETICONTITLELOGFONT_VALNAME, (LOGFONTW *)pvParam, fWinIni);
1519 icon_metrics.lfFont = *(LOGFONTW *)pvParam;
1520 spi_loaded[SPI_SETICONTITLELOGFONT_IDX] = TRUE;
1526 case SPI_GETFASTTASKSWITCH: /* 35 */
1527 if (!pvParam) return FALSE;
1528 *(BOOL *)pvParam = 1;
1531 case SPI_SETFASTTASKSWITCH: /* 36 */
1532 /* the action is disabled */
1536 case SPI_SETDRAGFULLWINDOWS:
1537 ret = set_bool_param( SPI_SETDRAGFULLWINDOWS_IDX,
1538 SPI_SETDRAGFULLWINDOWS_REGKEY,
1539 SPI_SETDRAGFULLWINDOWS_VALNAME,
1540 &drag_full_windows, uiParam, fWinIni );
1543 case SPI_GETDRAGFULLWINDOWS:
1544 ret = get_bool_param( SPI_SETDRAGFULLWINDOWS_IDX,
1545 SPI_SETDRAGFULLWINDOWS_REGKEY,
1546 SPI_SETDRAGFULLWINDOWS_VALNAME,
1547 &drag_full_windows, pvParam );
1550 case SPI_GETNONCLIENTMETRICS:
1552 LPNONCLIENTMETRICSW lpnm = pvParam;
1554 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
1556 if (lpnm && lpnm->cbSize == sizeof(NONCLIENTMETRICSW))
1557 *lpnm = nonclient_metrics;
1563 case SPI_SETNONCLIENTMETRICS:
1565 LPNONCLIENTMETRICSW lpnm = pvParam;
1567 if (lpnm && lpnm->cbSize == sizeof(NONCLIENTMETRICSW))
1569 NONCLIENTMETRICSW ncm;
1570 ret = set_uint_param( SPI_SETBORDER_IDX,
1571 SPI_SETBORDER_REGKEY, SPI_SETBORDER_VALNAME,
1572 &border, lpnm->iBorderWidth, fWinIni );
1573 if( ret) ret = save_int_param( METRICS_REGKEY,
1574 METRICS_SCROLLWIDTH_VALNAME, NULL,
1575 lpnm->iScrollWidth, fWinIni );
1576 if( ret) ret = save_int_param( METRICS_REGKEY,
1577 METRICS_SCROLLHEIGHT_VALNAME, NULL,
1578 lpnm->iScrollHeight, fWinIni );
1579 if( ret) ret = save_int_param( METRICS_REGKEY,
1580 METRICS_CAPTIONWIDTH_VALNAME, NULL,
1581 lpnm->iCaptionWidth, fWinIni );
1582 if( ret) ret = save_int_param( METRICS_REGKEY,
1583 METRICS_CAPTIONHEIGHT_VALNAME, NULL,
1584 lpnm->iCaptionHeight, fWinIni );
1585 if( ret) ret = save_int_param( METRICS_REGKEY,
1586 METRICS_SMCAPTIONWIDTH_VALNAME, NULL,
1587 lpnm->iSmCaptionWidth, fWinIni );
1588 if( ret) ret = save_int_param( METRICS_REGKEY,
1589 METRICS_SMCAPTIONHEIGHT_VALNAME, NULL,
1590 lpnm->iSmCaptionHeight, fWinIni );
1591 if( ret) ret = save_int_param( METRICS_REGKEY,
1592 METRICS_MENUWIDTH_VALNAME, NULL,
1593 lpnm->iMenuWidth, fWinIni );
1594 if( ret) ret = save_int_param( METRICS_REGKEY,
1595 METRICS_MENUHEIGHT_VALNAME, NULL,
1596 lpnm->iMenuHeight, fWinIni );
1597 if( ret) ret = SYSPARAMS_SaveLogFont(
1598 METRICS_REGKEY, METRICS_MENULOGFONT_VALNAME,
1599 &lpnm->lfMenuFont, fWinIni);
1600 if( ret) ret = SYSPARAMS_SaveLogFont(
1601 METRICS_REGKEY, METRICS_CAPTIONLOGFONT_VALNAME,
1602 &lpnm->lfCaptionFont, fWinIni);
1603 if( ret) ret = SYSPARAMS_SaveLogFont(
1604 METRICS_REGKEY, METRICS_SMCAPTIONLOGFONT_VALNAME,
1605 &lpnm->lfSmCaptionFont, fWinIni);
1606 if( ret) ret = SYSPARAMS_SaveLogFont(
1607 METRICS_REGKEY, METRICS_STATUSLOGFONT_VALNAME,
1608 &lpnm->lfStatusFont, fWinIni);
1609 if( ret) ret = SYSPARAMS_SaveLogFont(
1610 METRICS_REGKEY, METRICS_MESSAGELOGFONT_VALNAME,
1611 &lpnm->lfMessageFont, fWinIni);
1614 normalize_nonclientmetrics( &ncm);
1615 nonclient_metrics = ncm;
1616 spi_loaded[SPI_NONCLIENTMETRICS_IDX] = TRUE;
1622 case SPI_GETMINIMIZEDMETRICS:
1624 MINIMIZEDMETRICS * lpMm = pvParam;
1625 if (lpMm && lpMm->cbSize == sizeof(*lpMm)) {
1626 if( spi_loaded[SPI_MINIMIZEDMETRICS_IDX]) load_minimized_metrics();
1627 *lpMm = minimized_metrics;
1633 case SPI_SETMINIMIZEDMETRICS:
1635 MINIMIZEDMETRICS * lpMm = pvParam;
1636 if (lpMm && lpMm->cbSize == sizeof(*lpMm)) {
1637 ret = save_int_param( METRICS_REGKEY, METRICS_MINWIDTH_VALNAME,
1638 &minimized_metrics.iWidth, max( lpMm->iWidth, 0), fWinIni);
1639 if( ret) ret = save_int_param( METRICS_REGKEY,
1640 METRICS_MINHORZGAP_VALNAME, &minimized_metrics.iHorzGap,
1641 max( lpMm->iHorzGap, 0), fWinIni);
1642 if( ret) ret = save_int_param( METRICS_REGKEY,
1643 METRICS_MINVERTGAP_VALNAME, &minimized_metrics.iVertGap,
1644 max( lpMm->iVertGap, 0), fWinIni);
1645 if( ret) ret = save_int_param( METRICS_REGKEY,
1646 METRICS_MINARRANGE_VALNAME, &minimized_metrics.iArrange,
1647 0x0f & lpMm->iArrange, fWinIni);
1648 if( ret) spi_loaded[SPI_MINIMIZEDMETRICS_IDX] = TRUE;
1654 case SPI_GETICONMETRICS:
1656 LPICONMETRICSW lpIcon = pvParam;
1657 if(lpIcon && lpIcon->cbSize == sizeof(*lpIcon))
1659 SystemParametersInfoW( SPI_ICONHORIZONTALSPACING, 0,
1660 &lpIcon->iHorzSpacing, FALSE );
1661 SystemParametersInfoW( SPI_ICONVERTICALSPACING, 0,
1662 &lpIcon->iVertSpacing, FALSE );
1663 SystemParametersInfoW( SPI_GETICONTITLEWRAP, 0,
1664 &lpIcon->iTitleWrap, FALSE );
1665 SystemParametersInfoW( SPI_GETICONTITLELOGFONT, 0,
1666 &lpIcon->lfFont, FALSE );
1675 case SPI_SETICONMETRICS:
1677 LPICONMETRICSW lpIcon = pvParam;
1678 if (lpIcon && lpIcon->cbSize == sizeof(*lpIcon)) {
1679 ret = set_int_param( SPI_ICONVERTICALSPACING_IDX,
1680 SPI_ICONVERTICALSPACING_REGKEY,
1681 SPI_ICONVERTICALSPACING_VALNAME,
1682 &icon_metrics.iVertSpacing,
1683 lpIcon->iVertSpacing, fWinIni);
1685 ret = set_int_param( SPI_ICONHORIZONTALSPACING_IDX,
1686 SPI_ICONHORIZONTALSPACING_REGKEY,
1687 SPI_ICONHORIZONTALSPACING_VALNAME,
1688 &icon_metrics.iHorzSpacing,
1689 lpIcon->iHorzSpacing, fWinIni );
1692 ret = set_bool_param_mirrored( SPI_SETICONTITLEWRAP_IDX,
1693 SPI_SETICONTITLEWRAP_REGKEY1, SPI_SETICONTITLEWRAP_REGKEY2,
1694 SPI_SETICONTITLEWRAP_VALNAME, &icon_metrics.iTitleWrap,
1695 lpIcon->iTitleWrap, fWinIni );
1697 if( ret) ret = SYSPARAMS_SaveLogFont( SPI_SETICONTITLELOGFONT_REGKEY,
1698 SPI_SETICONTITLELOGFONT_VALNAME, &lpIcon->lfFont, fWinIni);
1700 icon_metrics.lfFont = lpIcon->lfFont;
1701 spi_loaded[SPI_SETICONTITLELOGFONT_IDX] = TRUE;
1708 case SPI_SETWORKAREA: /* 47 WINVER >= 0x400 */
1710 if (!pvParam) return FALSE;
1712 spi_idx = SPI_SETWORKAREA_IDX;
1713 CopyRect( &work_area, (RECT *)pvParam );
1714 spi_loaded[spi_idx] = TRUE;
1718 case SPI_GETWORKAREA: /* 48 WINVER >= 0x400 */
1720 if (!pvParam) return FALSE;
1722 spi_idx = SPI_SETWORKAREA_IDX;
1723 if (!spi_loaded[spi_idx])
1725 SetRect( &work_area, 0, 0,
1726 GetSystemMetrics( SM_CXSCREEN ),
1727 GetSystemMetrics( SM_CYSCREEN ) );
1728 spi_loaded[spi_idx] = TRUE;
1730 CopyRect( (RECT *)pvParam, &work_area );
1735 WINE_SPI_FIXME(SPI_SETPENWINDOWS); /* 49 WINVER >= 0x400 */
1737 case SPI_GETFILTERKEYS: /* 50 */
1739 LPFILTERKEYS lpFilterKeys = (LPFILTERKEYS)pvParam;
1740 WARN("SPI_GETFILTERKEYS not fully implemented\n");
1741 if (lpFilterKeys && lpFilterKeys->cbSize == sizeof(FILTERKEYS))
1743 /* Indicate that no FilterKeys feature available */
1744 lpFilterKeys->dwFlags = 0;
1745 lpFilterKeys->iWaitMSec = 0;
1746 lpFilterKeys->iDelayMSec = 0;
1747 lpFilterKeys->iRepeatMSec = 0;
1748 lpFilterKeys->iBounceMSec = 0;
1756 WINE_SPI_FIXME(SPI_SETFILTERKEYS); /* 51 */
1758 case SPI_GETTOGGLEKEYS: /* 52 */
1760 LPTOGGLEKEYS lpToggleKeys = (LPTOGGLEKEYS)pvParam;
1761 WARN("SPI_GETTOGGLEKEYS not fully implemented\n");
1762 if (lpToggleKeys && lpToggleKeys->cbSize == sizeof(TOGGLEKEYS))
1764 /* Indicate that no ToggleKeys feature available */
1765 lpToggleKeys->dwFlags = 0;
1773 WINE_SPI_FIXME(SPI_SETTOGGLEKEYS); /* 53 */
1775 case SPI_GETMOUSEKEYS: /* 54 */
1777 LPMOUSEKEYS lpMouseKeys = (LPMOUSEKEYS)pvParam;
1778 WARN("SPI_GETMOUSEKEYS not fully implemented\n");
1779 if (lpMouseKeys && lpMouseKeys->cbSize == sizeof(MOUSEKEYS))
1781 /* Indicate that no MouseKeys feature available */
1782 lpMouseKeys->dwFlags = 0;
1783 lpMouseKeys->iMaxSpeed = 360;
1784 lpMouseKeys->iTimeToMaxSpeed = 1000;
1785 lpMouseKeys->iCtrlSpeed = 0;
1786 lpMouseKeys->dwReserved1 = 0;
1787 lpMouseKeys->dwReserved2 = 0;
1795 WINE_SPI_FIXME(SPI_SETMOUSEKEYS); /* 55 */
1797 case SPI_GETSHOWSOUNDS:
1798 ret = get_bool_param( SPI_SETSHOWSOUNDS_IDX,
1799 SPI_SETSHOWSOUNDS_REGKEY,
1800 SPI_SETSHOWSOUNDS_VALNAME,
1801 &show_sounds, pvParam );
1804 case SPI_SETSHOWSOUNDS:
1805 ret = set_bool_param( SPI_SETSHOWSOUNDS_IDX,
1806 SPI_SETSHOWSOUNDS_REGKEY,
1807 SPI_SETSHOWSOUNDS_VALNAME,
1808 &show_sounds, uiParam, fWinIni );
1811 case SPI_GETSTICKYKEYS: /* 58 */
1813 LPSTICKYKEYS lpStickyKeys = (LPSTICKYKEYS)pvParam;
1814 WARN("SPI_GETSTICKYKEYS not fully implemented\n");
1815 if (lpStickyKeys && lpStickyKeys->cbSize == sizeof(STICKYKEYS))
1817 /* Indicate that no StickyKeys feature available */
1818 lpStickyKeys->dwFlags = 0;
1826 WINE_SPI_FIXME(SPI_SETSTICKYKEYS); /* 59 */
1828 case SPI_GETACCESSTIMEOUT: /* 60 */
1830 LPACCESSTIMEOUT lpAccessTimeout = (LPACCESSTIMEOUT)pvParam;
1831 WARN("SPI_GETACCESSTIMEOUT not fully implemented\n");
1832 if (lpAccessTimeout && lpAccessTimeout->cbSize == sizeof(ACCESSTIMEOUT))
1834 /* Indicate that no accessibility features timeout is available */
1835 lpAccessTimeout->dwFlags = 0;
1836 lpAccessTimeout->iTimeOutMSec = 0;
1844 WINE_SPI_FIXME(SPI_SETACCESSTIMEOUT); /* 61 */
1846 case SPI_GETSERIALKEYS: /* 62 WINVER >= 0x400 */
1848 LPSERIALKEYSW lpSerialKeysW = (LPSERIALKEYSW)pvParam;
1849 WARN("SPI_GETSERIALKEYS not fully implemented\n");
1850 if (lpSerialKeysW && lpSerialKeysW->cbSize == sizeof(SERIALKEYSW))
1852 /* Indicate that no SerialKeys feature available */
1853 lpSerialKeysW->dwFlags = 0;
1854 lpSerialKeysW->lpszActivePort = NULL;
1855 lpSerialKeysW->lpszPort = NULL;
1856 lpSerialKeysW->iBaudRate = 0;
1857 lpSerialKeysW->iPortState = 0;
1865 WINE_SPI_FIXME(SPI_SETSERIALKEYS); /* 63 WINVER >= 0x400 */
1867 case SPI_GETSOUNDSENTRY: /* 64 */
1869 LPSOUNDSENTRYW lpSoundSentryW = (LPSOUNDSENTRYW)pvParam;
1870 WARN("SPI_GETSOUNDSENTRY not fully implemented\n");
1871 if (lpSoundSentryW && lpSoundSentryW->cbSize == sizeof(SOUNDSENTRYW))
1873 /* Indicate that no SoundSentry feature available */
1874 lpSoundSentryW->dwFlags = 0;
1875 lpSoundSentryW->iFSTextEffect = 0;
1876 lpSoundSentryW->iFSTextEffectMSec = 0;
1877 lpSoundSentryW->iFSTextEffectColorBits = 0;
1878 lpSoundSentryW->iFSGrafEffect = 0;
1879 lpSoundSentryW->iFSGrafEffectMSec = 0;
1880 lpSoundSentryW->iFSGrafEffectColor = 0;
1881 lpSoundSentryW->iWindowsEffect = 0;
1882 lpSoundSentryW->iWindowsEffectMSec = 0;
1883 lpSoundSentryW->lpszWindowsEffectDLL = 0;
1884 lpSoundSentryW->iWindowsEffectOrdinal = 0;
1892 WINE_SPI_FIXME(SPI_SETSOUNDSENTRY); /* 65 */
1894 case SPI_GETHIGHCONTRAST: /* 66 WINVER >= 0x400 */
1896 LPHIGHCONTRASTW lpHighContrastW = (LPHIGHCONTRASTW)pvParam;
1897 WARN("SPI_GETHIGHCONTRAST not fully implemented\n");
1898 if (lpHighContrastW && lpHighContrastW->cbSize == sizeof(HIGHCONTRASTW))
1900 /* Indicate that no high contrast feature available */
1901 lpHighContrastW->dwFlags = 0;
1902 lpHighContrastW->lpszDefaultScheme = NULL;
1910 WINE_SPI_FIXME(SPI_SETHIGHCONTRAST); /* 67 WINVER >= 0x400 */
1912 case SPI_GETKEYBOARDPREF:
1913 ret = get_bool_param( SPI_SETKEYBOARDPREF_IDX,
1914 SPI_SETKEYBOARDPREF_REGKEY,
1915 SPI_SETKEYBOARDPREF_VALNAME,
1916 &keyboard_pref, pvParam );
1919 case SPI_SETKEYBOARDPREF:
1920 ret = set_bool_param( SPI_SETKEYBOARDPREF_IDX,
1921 SPI_SETKEYBOARDPREF_REGKEY,
1922 SPI_SETKEYBOARDPREF_VALNAME,
1923 &keyboard_pref, uiParam, fWinIni );
1926 case SPI_GETSCREENREADER:
1927 ret = get_bool_param( SPI_SETSCREENREADER_IDX,
1928 SPI_SETSCREENREADER_REGKEY,
1929 SPI_SETSCREENREADER_VALNAME,
1930 &screen_reader, pvParam );
1933 case SPI_SETSCREENREADER:
1934 ret = set_bool_param( SPI_SETSCREENREADER_IDX,
1935 SPI_SETSCREENREADER_REGKEY,
1936 SPI_SETSCREENREADER_VALNAME,
1937 &screen_reader, uiParam, fWinIni );
1940 case SPI_GETANIMATION: /* 72 WINVER >= 0x400 */
1942 LPANIMATIONINFO lpAnimInfo = (LPANIMATIONINFO)pvParam;
1944 /* Tell it "disabled" */
1945 if (lpAnimInfo && lpAnimInfo->cbSize == sizeof(ANIMATIONINFO))
1946 lpAnimInfo->iMinAnimate = 0; /* Minimise and restore animation is disabled (nonzero == enabled) */
1951 WINE_SPI_WARN(SPI_SETANIMATION); /* 73 WINVER >= 0x400 */
1953 case SPI_GETFONTSMOOTHING:
1956 ret = get_uint_param( SPI_SETFONTSMOOTHING_IDX,
1957 SPI_SETFONTSMOOTHING_REGKEY,
1958 SPI_SETFONTSMOOTHING_VALNAME,
1959 &font_smoothing, &tmpval );
1960 *(UINT *) pvParam = ( tmpval != 0);
1963 case SPI_SETFONTSMOOTHING:
1964 uiParam = uiParam ? 2 : 0; /* Win NT4/2k/XP behavior */
1965 ret = set_uint_param( SPI_SETFONTSMOOTHING_IDX,
1966 SPI_SETFONTSMOOTHING_REGKEY,
1967 SPI_SETFONTSMOOTHING_VALNAME,
1968 &font_smoothing, uiParam, fWinIni );
1971 WINE_SPI_FIXME(SPI_SETDRAGWIDTH); /* 76 WINVER >= 0x400 */
1972 WINE_SPI_FIXME(SPI_SETDRAGHEIGHT); /* 77 WINVER >= 0x400 */
1974 WINE_SPI_FIXME(SPI_SETHANDHELD); /* 78 WINVER >= 0x400 */
1976 WINE_SPI_FIXME(SPI_GETLOWPOWERTIMEOUT); /* 79 WINVER >= 0x400 */
1977 WINE_SPI_FIXME(SPI_GETPOWEROFFTIMEOUT); /* 80 WINVER >= 0x400 */
1978 WINE_SPI_FIXME(SPI_SETLOWPOWERTIMEOUT); /* 81 WINVER >= 0x400 */
1979 WINE_SPI_FIXME(SPI_SETPOWEROFFTIMEOUT); /* 82 WINVER >= 0x400 */
1981 case SPI_GETLOWPOWERACTIVE:
1982 ret = get_bool_param( SPI_SETLOWPOWERACTIVE_IDX,
1983 SPI_SETLOWPOWERACTIVE_REGKEY,
1984 SPI_SETLOWPOWERACTIVE_VALNAME,
1985 &lowpoweractive, pvParam );
1988 case SPI_GETPOWEROFFACTIVE:
1989 ret = get_bool_param( SPI_SETPOWEROFFACTIVE_IDX,
1990 SPI_SETPOWEROFFACTIVE_REGKEY,
1991 SPI_SETPOWEROFFACTIVE_VALNAME,
1992 &poweroffactive, pvParam );
1995 case SPI_SETLOWPOWERACTIVE:
1996 ret = set_bool_param( SPI_SETLOWPOWERACTIVE_IDX,
1997 SPI_SETLOWPOWERACTIVE_REGKEY,
1998 SPI_SETLOWPOWERACTIVE_VALNAME,
1999 &lowpoweractive, uiParam, fWinIni );
2002 case SPI_SETPOWEROFFACTIVE:
2003 ret = set_bool_param( SPI_SETPOWEROFFACTIVE_IDX,
2004 SPI_SETPOWEROFFACTIVE_REGKEY,
2005 SPI_SETPOWEROFFACTIVE_VALNAME,
2006 &poweroffactive, uiParam, fWinIni );
2009 WINE_SPI_FIXME(SPI_SETCURSORS); /* 87 WINVER >= 0x400 */
2010 WINE_SPI_FIXME(SPI_SETICONS); /* 88 WINVER >= 0x400 */
2012 case SPI_GETDEFAULTINPUTLANG: /* 89 WINVER >= 0x400 */
2013 ret = GetKeyboardLayout(0) ? TRUE : FALSE;
2016 WINE_SPI_FIXME(SPI_SETDEFAULTINPUTLANG); /* 90 WINVER >= 0x400 */
2018 WINE_SPI_FIXME(SPI_SETLANGTOGGLE); /* 91 WINVER >= 0x400 */
2020 case SPI_GETWINDOWSEXTENSION: /* 92 WINVER >= 0x400 */
2021 WARN("pretend no support for Win9x Plus! for now.\n");
2022 ret = FALSE; /* yes, this is the result value */
2025 WINE_SPI_FIXME(SPI_SETMOUSETRAILS); /* 93 WINVER >= 0x400 */
2026 WINE_SPI_FIXME(SPI_GETMOUSETRAILS); /* 94 WINVER >= 0x400 */
2028 case SPI_GETSNAPTODEFBUTTON: /* 95 WINVER >= 0x400 */
2029 ret = get_bool_param( SPI_SETSNAPTODEFBUTTON_IDX,
2030 SPI_SETSNAPTODEFBUTTON_REGKEY,
2031 SPI_SETSNAPTODEFBUTTON_VALNAME,
2032 &snap_to_default_button, pvParam );
2035 case SPI_SETSNAPTODEFBUTTON: /* 96 WINVER >= 0x400 */
2036 ret = set_bool_param( SPI_SETSNAPTODEFBUTTON_IDX,
2037 SPI_SETSNAPTODEFBUTTON_REGKEY,
2038 SPI_SETSNAPTODEFBUTTON_VALNAME,
2039 &snap_to_default_button, uiParam, fWinIni );
2042 case SPI_SETSCREENSAVERRUNNING:
2043 ret = set_bool_param( SPI_SETSCREENSAVERRUNNING_IDX,
2044 SPI_SETSCREENSAVERRUNNING_REGKEY,
2045 SPI_SETSCREENSAVERRUNNING_VALNAME,
2046 &screensaver_running, uiParam, fWinIni );
2049 case SPI_GETMOUSEHOVERWIDTH:
2050 ret = get_uint_param( SPI_SETMOUSEHOVERWIDTH_IDX,
2051 SPI_SETMOUSEHOVERWIDTH_REGKEY,
2052 SPI_SETMOUSEHOVERWIDTH_VALNAME,
2053 &mouse_hover_width, pvParam );
2056 case SPI_SETMOUSEHOVERWIDTH:
2057 ret = set_uint_param( SPI_SETMOUSEHOVERWIDTH_IDX,
2058 SPI_SETMOUSEHOVERWIDTH_REGKEY,
2059 SPI_SETMOUSEHOVERWIDTH_VALNAME,
2060 &mouse_hover_width, uiParam, fWinIni );
2063 case SPI_GETMOUSEHOVERHEIGHT:
2064 ret = get_uint_param( SPI_SETMOUSEHOVERHEIGHT_IDX,
2065 SPI_SETMOUSEHOVERHEIGHT_REGKEY,
2066 SPI_SETMOUSEHOVERHEIGHT_VALNAME,
2067 &mouse_hover_height, pvParam );
2070 case SPI_SETMOUSEHOVERHEIGHT:
2071 ret = set_uint_param( SPI_SETMOUSEHOVERHEIGHT_IDX,
2072 SPI_SETMOUSEHOVERHEIGHT_REGKEY,
2073 SPI_SETMOUSEHOVERHEIGHT_VALNAME,
2074 &mouse_hover_height, uiParam, fWinIni );
2077 case SPI_GETMOUSEHOVERTIME:
2078 ret = get_uint_param( SPI_SETMOUSEHOVERTIME_IDX,
2079 SPI_SETMOUSEHOVERTIME_REGKEY,
2080 SPI_SETMOUSEHOVERTIME_VALNAME,
2081 &mouse_hover_time, pvParam );
2084 case SPI_SETMOUSEHOVERTIME:
2085 ret = set_uint_param( SPI_SETMOUSEHOVERTIME_IDX,
2086 SPI_SETMOUSEHOVERTIME_REGKEY,
2087 SPI_SETMOUSEHOVERTIME_VALNAME,
2088 &mouse_hover_time, uiParam, fWinIni );
2091 case SPI_GETWHEELSCROLLLINES:
2092 ret = get_uint_param( SPI_SETMOUSESCROLLLINES_IDX,
2093 SPI_SETMOUSESCROLLLINES_REGKEY,
2094 SPI_SETMOUSESCROLLLINES_VALNAME,
2095 &mouse_scroll_lines, pvParam );
2098 case SPI_SETWHEELSCROLLLINES:
2099 ret = set_uint_param( SPI_SETMOUSESCROLLLINES_IDX,
2100 SPI_SETMOUSESCROLLLINES_REGKEY,
2101 SPI_SETMOUSESCROLLLINES_VALNAME,
2102 &mouse_scroll_lines, uiParam, fWinIni );
2105 case SPI_GETMENUSHOWDELAY:
2106 ret = get_uint_param( SPI_SETMENUSHOWDELAY_IDX,
2107 SPI_SETMENUSHOWDELAY_REGKEY,
2108 SPI_SETMENUSHOWDELAY_VALNAME,
2109 &menu_show_delay, pvParam );
2112 case SPI_SETMENUSHOWDELAY:
2113 ret = set_uint_param( SPI_SETMENUSHOWDELAY_IDX,
2114 SPI_SETMENUSHOWDELAY_REGKEY,
2115 SPI_SETMENUSHOWDELAY_VALNAME,
2116 &menu_show_delay, uiParam, fWinIni );
2119 case SPI_GETWHEELSCROLLCHARS: /* 108 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2120 ret = get_uint_param( SPI_SETMOUSESCROLLCHARS_IDX,
2121 SPI_SETMOUSESCROLLCHARS_REGKEY,
2122 SPI_SETMOUSESCROLLCHARS_VALNAME,
2123 &mouse_scroll_chars, pvParam );
2126 case SPI_SETWHEELSCROLLCHARS: /* 109 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2127 ret = set_uint_param( SPI_SETMOUSESCROLLCHARS_IDX,
2128 SPI_SETMOUSESCROLLCHARS_REGKEY,
2129 SPI_SETMOUSESCROLLCHARS_VALNAME,
2130 &mouse_scroll_chars, uiParam, fWinIni );
2133 WINE_SPI_FIXME(SPI_GETSHOWIMEUI); /* 110 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2134 WINE_SPI_FIXME(SPI_SETSHOWIMEUI); /* 111 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2136 case SPI_GETMOUSESPEED: /* 112 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2139 ret = SystemParametersInfoW (SPI_GETMOUSE, 0, buf, fWinIni);
2140 *(INT *)pvParam = buf[2];
2144 case SPI_SETMOUSESPEED: /* 113 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2146 ret = save_int_param( SPI_SETMOUSE_REGKEY, SPI_SETMOUSE_VALNAME3,
2147 &mouse_speed, PtrToInt(pvParam), fWinIni);
2152 case SPI_GETSCREENSAVERRUNNING:
2153 ret = get_bool_param( SPI_SETSCREENSAVERRUNNING_IDX,
2154 SPI_SETSCREENSAVERRUNNING_REGKEY,
2155 SPI_SETSCREENSAVERRUNNING_VALNAME,
2156 &screensaver_running, pvParam );
2159 case SPI_GETDESKWALLPAPER: /* 115 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2161 WCHAR buf[MAX_PATH];
2163 if (!pvParam) return FALSE;
2165 if (uiParam > MAX_PATH)
2170 if (SYSPARAMS_Load(SPI_SETDESKWALLPAPER_REGKEY, SPI_SETDESKWALLPAPER_VALNAME, buf, sizeof(buf)))
2172 lstrcpynW((WCHAR*)pvParam, buf, uiParam);
2176 /* Return an empty string */
2177 memset((WCHAR*)pvParam, 0, uiParam);
2183 WINE_SPI_FIXME(SPI_GETACTIVEWINDOWTRACKING);/* 0x1000 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2184 WINE_SPI_FIXME(SPI_SETACTIVEWINDOWTRACKING);/* 0x1001 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2185 case SPI_GETMENUANIMATION: /* 0x1002 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2186 ret = get_user_pref_param( 0, 0x02, pvParam );
2189 case SPI_SETMENUANIMATION: /* 0x1003 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2190 ret = set_user_pref_param( 0, 0x02, PtrToUlong(pvParam), fWinIni );
2193 case SPI_GETCOMBOBOXANIMATION: /* 0x1004 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2194 ret = get_user_pref_param( 0, 0x04, pvParam );
2197 case SPI_SETCOMBOBOXANIMATION: /* 0x1005 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2198 ret = set_user_pref_param( 0, 0x04, PtrToUlong(pvParam), fWinIni );
2201 case SPI_GETLISTBOXSMOOTHSCROLLING: /* 0x1006 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2202 ret = get_user_pref_param( 0, 0x08, pvParam );
2205 case SPI_SETLISTBOXSMOOTHSCROLLING: /* 0x1007 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2206 ret = set_user_pref_param( 0, 0x08, PtrToUlong(pvParam), fWinIni );
2209 case SPI_GETGRADIENTCAPTIONS:
2210 ret = get_user_pref_param( 0, 0x10, pvParam );
2213 case SPI_SETGRADIENTCAPTIONS:
2214 ret = set_user_pref_param( 0, 0x10, PtrToUlong(pvParam), fWinIni );
2217 case SPI_GETKEYBOARDCUES:
2218 ret = get_user_pref_param( 0, 0x20, pvParam );
2221 case SPI_SETKEYBOARDCUES:
2222 ret = set_user_pref_param( 0, 0x20, PtrToUlong(pvParam), fWinIni );
2225 WINE_SPI_FIXME(SPI_GETACTIVEWNDTRKZORDER); /* 0x100C _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2226 WINE_SPI_FIXME(SPI_SETACTIVEWNDTRKZORDER); /* 0x100D _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2227 case SPI_GETHOTTRACKING:
2228 ret = get_user_pref_param( 0, 0x80, pvParam );
2231 case SPI_SETHOTTRACKING:
2232 ret = set_user_pref_param( 0, 0x80, PtrToUlong(pvParam), fWinIni );
2235 WINE_SPI_FIXME(SPI_GETMENUFADE); /* 0x1012 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2236 WINE_SPI_FIXME(SPI_SETMENUFADE); /* 0x1013 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2237 case SPI_GETSELECTIONFADE: /* 0x1014 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2238 ret = get_user_pref_param( 1, 0x04, pvParam );
2241 case SPI_SETSELECTIONFADE: /* 0x1015 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2242 ret = set_user_pref_param( 1, 0x04, PtrToUlong(pvParam), fWinIni );
2245 case SPI_GETTOOLTIPANIMATION: /* 0x1016 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2246 ret = get_user_pref_param( 1, 0x08, pvParam );
2249 case SPI_SETTOOLTIPANIMATION: /* 0x1017 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2250 ret = set_user_pref_param( 1, 0x08, PtrToUlong(pvParam), fWinIni );
2253 case SPI_GETTOOLTIPFADE: /* 0x1018 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2254 ret = get_user_pref_param( 1, 0x10, pvParam );
2257 case SPI_SETTOOLTIPFADE: /* 0x1019 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2258 ret = set_user_pref_param( 1, 0x10, PtrToUlong(pvParam), fWinIni );
2261 case SPI_GETCURSORSHADOW: /* 0x101A _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2262 ret = get_user_pref_param( 1, 0x20, pvParam );
2265 case SPI_SETCURSORSHADOW: /* 0x101B _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2266 ret = set_user_pref_param( 1, 0x20, PtrToUlong(pvParam), fWinIni );
2269 WINE_SPI_FIXME(SPI_GETMOUSESONAR); /* 0x101C _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2270 WINE_SPI_FIXME(SPI_SETMOUSESONAR); /* 0x101D _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2271 WINE_SPI_FIXME(SPI_GETMOUSECLICKLOCK); /* 0x101E _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2272 WINE_SPI_FIXME(SPI_SETMOUSECLICKLOCK); /* 0x101F _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2273 WINE_SPI_FIXME(SPI_GETMOUSEVANISH); /* 0x1020 _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2274 WINE_SPI_FIXME(SPI_SETMOUSEVANISH); /* 0x1021 _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2275 case SPI_GETFLATMENU:
2276 ret = get_user_pref_param( 2, 0x02, pvParam );
2279 case SPI_SETFLATMENU:
2280 ret = set_user_pref_param( 2, 0x02, PtrToUlong(pvParam), fWinIni );
2283 WINE_SPI_FIXME(SPI_GETDROPSHADOW); /* 0x1024 _WIN32_WINNT >= 0x510 */
2284 WINE_SPI_FIXME(SPI_SETDROPSHADOW); /* 0x1025 _WIN32_WINNT >= 0x510 */
2285 WINE_SPI_FIXME(SPI_GETBLOCKSENDINPUTRESETS);
2286 WINE_SPI_FIXME(SPI_SETBLOCKSENDINPUTRESETS);
2287 case SPI_GETUIEFFECTS:
2288 ret = get_user_pref_param( 3, 0x80, pvParam );
2291 case SPI_SETUIEFFECTS:
2292 /* FIXME: this probably should mask other UI effect values when unset */
2293 ret = set_user_pref_param( 3, 0x80, PtrToUlong(pvParam), fWinIni );
2296 WINE_SPI_FIXME(SPI_GETFOREGROUNDLOCKTIMEOUT);/* 0x2000 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2297 WINE_SPI_FIXME(SPI_SETFOREGROUNDLOCKTIMEOUT);/* 0x2001 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2298 WINE_SPI_FIXME(SPI_GETACTIVEWNDTRKTIMEOUT); /* 0x2002 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2299 WINE_SPI_FIXME(SPI_SETACTIVEWNDTRKTIMEOUT); /* 0x2003 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2300 WINE_SPI_FIXME(SPI_GETFOREGROUNDFLASHCOUNT);/* 0x2004 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2301 WINE_SPI_FIXME(SPI_SETFOREGROUNDFLASHCOUNT);/* 0x2005 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2302 case SPI_GETCARETWIDTH: /* 0x2006 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2303 ret = get_uint_param( SPI_CARETWIDTH_IDX,
2304 SPI_CARETWIDTH_REGKEY,
2305 SPI_CARETWIDTH_VALNAME,
2306 &caret_width, pvParam );
2309 case SPI_SETCARETWIDTH: /* 0x2007 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2310 ret = set_uint_param( SPI_CARETWIDTH_IDX,
2311 SPI_CARETWIDTH_REGKEY,
2312 SPI_CARETWIDTH_VALNAME,
2313 &caret_width, uiParam, fWinIni );
2316 WINE_SPI_FIXME(SPI_GETMOUSECLICKLOCKTIME); /* 0x2008 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2317 WINE_SPI_FIXME(SPI_SETMOUSECLICKLOCKTIME); /* 0x2009 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2318 WINE_SPI_FIXME(SPI_GETFONTSMOOTHINGTYPE); /* 0x200A _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2319 WINE_SPI_FIXME(SPI_SETFONTSMOOTHINGTYPE); /* 0x200B _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2320 WINE_SPI_FIXME(SPI_GETFONTSMOOTHINGCONTRAST);/* 0x200C _WIN32_WINNT >= 0x510 */
2321 WINE_SPI_FIXME(SPI_SETFONTSMOOTHINGCONTRAST);/* 0x200D _WIN32_WINNT >= 0x510 */
2322 WINE_SPI_FIXME(SPI_GETFOCUSBORDERWIDTH); /* 0x200E _WIN32_WINNT >= 0x510 */
2323 WINE_SPI_FIXME(SPI_SETFOCUSBORDERWIDTH); /* 0x200F _WIN32_WINNT >= 0x510 */
2324 WINE_SPI_FIXME(SPI_GETFOCUSBORDERHEIGHT); /* 0x2010 _WIN32_WINNT >= 0x510 */
2325 WINE_SPI_FIXME(SPI_SETFOCUSBORDERHEIGHT); /* 0x2011 _WIN32_WINNT >= 0x510 */
2326 WINE_SPI_FIXME(SPI_GETFONTSMOOTHINGORIENTATION); /* 0x2012 */
2327 WINE_SPI_FIXME(SPI_SETFONTSMOOTHINGORIENTATION); /* 0x2013 */
2330 FIXME( "Unknown action: %u\n", uiAction );
2331 SetLastError( ERROR_INVALID_SPI_VALUE );
2337 SYSPARAMS_NotifyChange( uiAction, fWinIni );
2338 TRACE("(%u, %u, %p, %u) ret %d\n",
2339 uiAction, uiParam, pvParam, fWinIni, ret);
2342 #undef WINE_SPI_FIXME
2343 #undef WINE_SPI_WARN
2347 /***********************************************************************
2348 * SystemParametersInfo (USER.483)
2350 BOOL16 WINAPI SystemParametersInfo16( UINT16 uAction, UINT16 uParam,
2351 LPVOID lpvParam, UINT16 fuWinIni )
2355 TRACE("(%u, %u, %p, %u)\n", uAction, uParam, lpvParam, fuWinIni);
2359 case SPI_GETBEEP: /* 1 */
2360 case SPI_GETSCREENSAVEACTIVE: /* 16 */
2361 case SPI_GETICONTITLEWRAP: /* 25 */
2362 case SPI_GETMENUDROPALIGNMENT: /* 27 */
2363 case SPI_GETFASTTASKSWITCH: /* 35 */
2364 case SPI_GETDRAGFULLWINDOWS: /* 38 WINVER >= 0x0400 */
2367 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2368 if (ret && lpvParam)
2369 *(BOOL16 *)lpvParam = tmp;
2373 case SPI_GETBORDER: /* 5 */
2374 case SPI_ICONHORIZONTALSPACING: /* 13 */
2375 case SPI_GETSCREENSAVETIMEOUT: /* 14 */
2376 case SPI_GETGRIDGRANULARITY: /* 18 */
2377 case SPI_GETKEYBOARDDELAY: /* 22 */
2378 case SPI_ICONVERTICALSPACING: /* 24 */
2381 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2382 if (ret && lpvParam)
2383 *(INT16 *)lpvParam = tmp;
2387 case SPI_GETKEYBOARDSPEED: /* 10 */
2390 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2391 if (ret && lpvParam)
2392 *(WORD *)lpvParam = tmp;
2396 case SPI_GETICONTITLELOGFONT: /* 31 */
2399 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2400 if (ret && lpvParam)
2401 SYSPARAMS_LogFont32ATo16( &tmp, (LPLOGFONT16)lpvParam );
2405 case SPI_GETNONCLIENTMETRICS: /* 41 WINVER >= 0x400 */
2407 NONCLIENTMETRICSA tmp;
2408 LPNONCLIENTMETRICS16 lpnm16 = (LPNONCLIENTMETRICS16)lpvParam;
2409 if (lpnm16 && lpnm16->cbSize == sizeof(NONCLIENTMETRICS16))
2411 tmp.cbSize = sizeof(NONCLIENTMETRICSA);
2412 ret = SystemParametersInfoA( uAction, uParam, &tmp, fuWinIni );
2414 SYSPARAMS_NonClientMetrics32ATo16( &tmp, lpnm16 );
2416 else /* winfile 95 sets cbSize to 340 */
2417 ret = SystemParametersInfoA( uAction, uParam, lpvParam, fuWinIni );
2421 case SPI_GETWORKAREA: /* 48 WINVER >= 0x400 */
2424 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2425 if (ret && lpvParam)
2427 RECT16 *r16 = (RECT16 *)lpvParam;
2428 r16->left = tmp.left;
2430 r16->right = tmp.right;
2431 r16->bottom = tmp.bottom;
2436 case SPI_GETMOUSEHOVERWIDTH: /* 98 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2437 case SPI_GETMOUSEHOVERHEIGHT: /* 100 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2438 case SPI_GETMOUSEHOVERTIME: /* 102 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2441 ret = SystemParametersInfoA( uAction, uParam, lpvParam ? &tmp : NULL, fuWinIni );
2442 if (ret && lpvParam)
2443 *(UINT16 *)lpvParam = tmp;
2448 ret = SystemParametersInfoA( uAction, uParam, lpvParam, fuWinIni );
2454 /***********************************************************************
2455 * SystemParametersInfoA (USER32.@)
2457 BOOL WINAPI SystemParametersInfoA( UINT uiAction, UINT uiParam,
2458 PVOID pvParam, UINT fuWinIni )
2462 TRACE("(%u, %u, %p, %u)\n", uiAction, uiParam, pvParam, fuWinIni);
2466 case SPI_SETDESKWALLPAPER: /* 20 */
2467 case SPI_SETDESKPATTERN: /* 21 */
2471 if (!MultiByteToWideChar( CP_ACP, 0, (LPSTR)pvParam, -1,
2472 buffer, sizeof(buffer)/sizeof(WCHAR) ))
2473 buffer[sizeof(buffer)/sizeof(WCHAR)-1] = 0;
2474 ret = SystemParametersInfoW( uiAction, uiParam, pvParam ? buffer : NULL, fuWinIni );
2478 case SPI_GETICONTITLELOGFONT: /* 31 */
2481 ret = SystemParametersInfoW( uiAction, uiParam, pvParam ? &tmp : NULL, fuWinIni );
2483 SYSPARAMS_LogFont32WTo32A( &tmp, (LPLOGFONTA)pvParam );
2487 case SPI_GETNONCLIENTMETRICS: /* 41 WINVER >= 0x400 */
2489 NONCLIENTMETRICSW tmp;
2490 LPNONCLIENTMETRICSA lpnmA = (LPNONCLIENTMETRICSA)pvParam;
2491 if (lpnmA && lpnmA->cbSize == sizeof(NONCLIENTMETRICSA))
2493 tmp.cbSize = sizeof(NONCLIENTMETRICSW);
2494 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2496 SYSPARAMS_NonClientMetrics32WTo32A( &tmp, lpnmA );
2503 case SPI_SETNONCLIENTMETRICS: /* 42 WINVER >= 0x400 */
2505 NONCLIENTMETRICSW tmp;
2506 LPNONCLIENTMETRICSA lpnmA = (LPNONCLIENTMETRICSA)pvParam;
2507 if (lpnmA && lpnmA->cbSize == sizeof(NONCLIENTMETRICSA))
2509 tmp.cbSize = sizeof(NONCLIENTMETRICSW);
2510 SYSPARAMS_NonClientMetrics32ATo32W( lpnmA, &tmp );
2511 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2518 case SPI_GETICONMETRICS: /* 45 WINVER >= 0x400 */
2521 LPICONMETRICSA lpimA = (LPICONMETRICSA)pvParam;
2522 if (lpimA && lpimA->cbSize == sizeof(ICONMETRICSA))
2524 tmp.cbSize = sizeof(ICONMETRICSW);
2525 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2528 lpimA->iHorzSpacing = tmp.iHorzSpacing;
2529 lpimA->iVertSpacing = tmp.iVertSpacing;
2530 lpimA->iTitleWrap = tmp.iTitleWrap;
2531 SYSPARAMS_LogFont32WTo32A( &tmp.lfFont, &lpimA->lfFont );
2539 case SPI_SETICONMETRICS: /* 46 WINVER >= 0x400 */
2542 LPICONMETRICSA lpimA = (LPICONMETRICSA)pvParam;
2543 if (lpimA && lpimA->cbSize == sizeof(ICONMETRICSA))
2545 tmp.cbSize = sizeof(ICONMETRICSW);
2546 tmp.iHorzSpacing = lpimA->iHorzSpacing;
2547 tmp.iVertSpacing = lpimA->iVertSpacing;
2548 tmp.iTitleWrap = lpimA->iTitleWrap;
2549 SYSPARAMS_LogFont32ATo32W( &lpimA->lfFont, &tmp.lfFont);
2550 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2557 case SPI_GETHIGHCONTRAST: /* 66 WINVER >= 0x400 */
2560 LPHIGHCONTRASTA lphcA = (LPHIGHCONTRASTA)pvParam;
2561 if (lphcA && lphcA->cbSize == sizeof(HIGHCONTRASTA))
2563 tmp.cbSize = sizeof(HIGHCONTRASTW);
2564 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2567 lphcA->dwFlags = tmp.dwFlags;
2568 lphcA->lpszDefaultScheme = NULL; /* FIXME? */
2576 case SPI_GETDESKWALLPAPER: /* 115 */
2578 WCHAR buffer[MAX_PATH];
2579 ret = (SystemParametersInfoW( SPI_GETDESKWALLPAPER, uiParam, buffer, fuWinIni ) &&
2580 WideCharToMultiByte(CP_ACP, 0, buffer, -1, pvParam, uiParam, NULL, NULL));
2585 ret = SystemParametersInfoW( uiAction, uiParam, pvParam, fuWinIni );
2592 /***********************************************************************
2593 * GetSystemMetrics (USER32.@)
2595 INT WINAPI GetSystemMetrics( INT index )
2599 /* some metrics are dynamic */
2603 return GetDeviceCaps( get_display_dc(), HORZRES );
2605 return GetDeviceCaps( get_display_dc(), VERTRES );
2607 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2608 return nonclient_metrics.iScrollWidth;
2610 return GetSystemMetrics(SM_CXVSCROLL);
2612 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2613 return nonclient_metrics.iCaptionHeight + 1;
2616 /* SM_C{X,Y}BORDER always returns 1 regardless of 'BorderWidth' value in registry */
2622 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2623 return nonclient_metrics.iScrollHeight;
2625 return GetSystemMetrics(SM_CYVTHUMB);
2627 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2628 return icon_size.cx;
2630 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2631 return icon_size.cy;
2636 return GetSystemMetrics(SM_CYMENUSIZE) + 1;
2637 case SM_CXFULLSCREEN:
2638 /* see the remark for SM_CXMAXIMIZED, at least this formulation is
2640 return GetSystemMetrics( SM_CXMAXIMIZED) - 2 * GetSystemMetrics( SM_CXFRAME);
2641 case SM_CYFULLSCREEN:
2642 /* see the remark for SM_CYMAXIMIZED, at least this formulation is
2644 return GetSystemMetrics( SM_CYMAXIMIZED) - GetSystemMetrics( SM_CYMIN);
2645 case SM_CYKANJIWINDOW:
2647 case SM_MOUSEPRESENT:
2650 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2651 return nonclient_metrics.iScrollHeight;
2653 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2654 return nonclient_metrics.iScrollHeight;
2658 get_bool_param( SPI_SETMOUSEBUTTONSWAP_IDX, SPI_SETMOUSEBUTTONSWAP_REGKEY,
2659 SPI_SETMOUSEBUTTONSWAP_VALNAME, &swap_buttons, (BOOL*)&ret );
2667 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2668 return 3 * nonclient_metrics.iCaptionWidth + GetSystemMetrics( SM_CYSIZE) +
2669 4 * CaptionFontAvCharWidth + 2 * GetSystemMetrics( SM_CXFRAME) + 4;
2671 return GetSystemMetrics( SM_CYCAPTION) + 2 * GetSystemMetrics( SM_CYFRAME);
2673 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2674 return nonclient_metrics.iCaptionWidth;
2676 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2677 return nonclient_metrics.iCaptionHeight;
2679 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2680 return GetSystemMetrics(SM_CXDLGFRAME) + nonclient_metrics.iBorderWidth;
2682 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2683 return GetSystemMetrics(SM_CYDLGFRAME) + nonclient_metrics.iBorderWidth;
2685 return GetSystemMetrics(SM_CXMIN);
2687 return GetSystemMetrics(SM_CYMIN);
2688 case SM_CXDOUBLECLK:
2689 get_uint_param( SPI_SETDOUBLECLKWIDTH_IDX, SPI_SETDOUBLECLKWIDTH_REGKEY1,
2690 SPI_SETDOUBLECLKWIDTH_VALNAME, &double_click_width, &ret );
2692 case SM_CYDOUBLECLK:
2693 get_uint_param( SPI_SETDOUBLECLKHEIGHT_IDX, SPI_SETDOUBLECLKHEIGHT_REGKEY1,
2694 SPI_SETDOUBLECLKHEIGHT_VALNAME, &double_click_height, &ret );
2696 case SM_CXICONSPACING:
2697 SystemParametersInfoW( SPI_ICONHORIZONTALSPACING, 0, &ret, 0 );
2699 case SM_CYICONSPACING:
2700 SystemParametersInfoW( SPI_ICONVERTICALSPACING, 0, &ret, 0 );
2702 case SM_MENUDROPALIGNMENT:
2703 SystemParametersInfoW( SPI_GETMENUDROPALIGNMENT, 0, &ret, 0 );
2707 case SM_DBCSENABLED:
2710 GetCPInfo( CP_ACP, &cpinfo );
2711 return (cpinfo.MaxCharSize > 1);
2713 case SM_CMOUSEBUTTONS:
2718 return GetSystemMetrics(SM_CXBORDER) + 1;
2720 return GetSystemMetrics(SM_CYBORDER) + 1;
2721 case SM_CXMINSPACING:
2722 if( spi_loaded[SPI_MINIMIZEDMETRICS_IDX]) load_minimized_metrics();
2723 return GetSystemMetrics(SM_CXMINIMIZED) + minimized_metrics.iHorzGap;
2724 case SM_CYMINSPACING:
2725 if( spi_loaded[SPI_MINIMIZEDMETRICS_IDX]) load_minimized_metrics();
2726 return GetSystemMetrics(SM_CYMINIMIZED) + minimized_metrics.iVertGap;
2730 case SM_CYSMCAPTION:
2731 return GetSystemMetrics(SM_CYSMSIZE) + 1;
2733 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2734 return nonclient_metrics.iSmCaptionWidth;
2736 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2737 return nonclient_metrics.iSmCaptionHeight;
2739 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2740 return nonclient_metrics.iMenuWidth;
2742 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2743 return nonclient_metrics.iMenuHeight;
2745 if( spi_loaded[SPI_MINIMIZEDMETRICS_IDX]) load_minimized_metrics();
2746 return minimized_metrics.iArrange;
2747 case SM_CXMINIMIZED:
2748 if( spi_loaded[SPI_MINIMIZEDMETRICS_IDX]) load_minimized_metrics();
2749 return minimized_metrics.iWidth + 6;
2750 case SM_CYMINIMIZED:
2751 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2752 return nonclient_metrics.iCaptionHeight + 6;
2754 return GetSystemMetrics(SM_CXVIRTUALSCREEN) + 4 + 2 * GetSystemMetrics(SM_CXFRAME);
2756 return GetSystemMetrics(SM_CYVIRTUALSCREEN) + 4 + 2 * GetSystemMetrics(SM_CYFRAME);
2757 case SM_CXMAXIMIZED:
2758 /* FIXME: subtract the width of any vertical application toolbars*/
2759 return GetSystemMetrics(SM_CXSCREEN) + 2 * GetSystemMetrics(SM_CXFRAME);
2760 case SM_CYMAXIMIZED:
2761 /* FIXME: subtract the width of any horizontal application toolbars*/
2762 return GetSystemMetrics(SM_CYSCREEN) + 2 * GetSystemMetrics(SM_CYCAPTION);
2764 return 3; /* FIXME */
2766 return 0; /* 0 = ok, 1 = failsafe, 2 = failsafe + network */
2771 SystemParametersInfoW( SPI_GETSHOWSOUNDS, 0, &ret, 0 );
2773 case SM_CXMENUCHECK:
2774 case SM_CYMENUCHECK:
2775 if (!spi_loaded[SPI_NONCLIENTMETRICS_IDX]) load_nonclient_metrics();
2776 return tmMenuFont.tmHeight <= 0 ? 13 :
2777 ((tmMenuFont.tmHeight + tmMenuFont.tmExternalLeading + 1) / 2) * 2 - 1;
2778 case SM_SLOWMACHINE:
2779 return 0; /* Never true */
2780 case SM_MIDEASTENABLED:
2781 return 0; /* FIXME */
2782 case SM_MOUSEWHEELPRESENT:
2784 case SM_XVIRTUALSCREEN:
2786 struct monitor_info info;
2787 get_monitors_info( &info );
2788 return info.virtual_rect.left;
2790 case SM_YVIRTUALSCREEN:
2792 struct monitor_info info;
2793 get_monitors_info( &info );
2794 return info.virtual_rect.top;
2796 case SM_CXVIRTUALSCREEN:
2798 struct monitor_info info;
2799 get_monitors_info( &info );
2800 return info.virtual_rect.right - info.virtual_rect.left;
2802 case SM_CYVIRTUALSCREEN:
2804 struct monitor_info info;
2805 get_monitors_info( &info );
2806 return info.virtual_rect.bottom - info.virtual_rect.top;
2810 struct monitor_info info;
2811 get_monitors_info( &info );
2814 case SM_SAMEDISPLAYFORMAT:
2817 return 0; /* FIXME */
2818 case SM_CXFOCUSBORDER:
2819 case SM_CYFOCUSBORDER:
2822 case SM_MEDIACENTER:
2832 /***********************************************************************
2833 * SwapMouseButton (USER32.@)
2834 * Reverse or restore the meaning of the left and right mouse buttons
2835 * fSwap [I ] TRUE - reverse, FALSE - original
2839 BOOL WINAPI SwapMouseButton( BOOL fSwap )
2841 BOOL prev = GetSystemMetrics(SM_SWAPBUTTON);
2842 SystemParametersInfoW(SPI_SETMOUSEBUTTONSWAP, fSwap, 0, 0);
2847 /**********************************************************************
2848 * SetDoubleClickTime (USER32.@)
2850 BOOL WINAPI SetDoubleClickTime( UINT interval )
2852 return SystemParametersInfoW(SPI_SETDOUBLECLICKTIME, interval, 0, 0);
2856 /**********************************************************************
2857 * GetDoubleClickTime (USER32.@)
2859 UINT WINAPI GetDoubleClickTime(void)
2863 get_uint_param( SPI_SETDOUBLECLICKTIME_IDX,
2864 SPI_SETDOUBLECLICKTIME_REGKEY,
2865 SPI_SETDOUBLECLICKTIME_VALNAME,
2866 &double_click_time, &time );
2867 if (!time) time = 500;
2872 /*************************************************************************
2873 * GetSysColor (USER32.@)
2875 COLORREF WINAPI GetSysColor( INT nIndex )
2877 if (nIndex >= 0 && nIndex < NUM_SYS_COLORS)
2878 return SysColors[nIndex];
2884 /*************************************************************************
2885 * SetSysColors (USER32.@)
2887 BOOL WINAPI SetSysColors( INT nChanges, const INT *lpSysColor,
2888 const COLORREF *lpColorValues )
2892 for (i = 0; i < nChanges; i++) SYSPARAMS_SetSysColor( lpSysColor[i], lpColorValues[i] );
2894 /* Send WM_SYSCOLORCHANGE message to all windows */
2896 SendMessageTimeoutW( HWND_BROADCAST, WM_SYSCOLORCHANGE, 0, 0, SMTO_ABORTIFHUNG, 2000, NULL );
2898 /* Repaint affected portions of all visible windows */
2900 RedrawWindow( GetDesktopWindow(), NULL, 0,
2901 RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN );
2906 /*************************************************************************
2907 * SetSysColorsTemp (USER32.@)
2911 * Called by W98SE desk.cpl Control Panel Applet:
2912 * handle = SetSysColorsTemp(ptr, ptr, nCount); ("set" call)
2913 * result = SetSysColorsTemp(NULL, NULL, handle); ("restore" call)
2915 * pPens is an array of COLORREF values, which seems to be used
2916 * to indicate the color values to create new pens with.
2918 * pBrushes is an array of solid brush handles (returned by a previous
2919 * CreateSolidBrush), which seems to contain the brush handles to set
2920 * for the system colors.
2922 * n seems to be used for
2923 * a) indicating the number of entries to operate on (length of pPens,
2925 * b) passing the handle that points to the previously used color settings.
2926 * I couldn't figure out in hell what kind of handle this is on
2927 * Windows. I just use a heap handle instead. Shouldn't matter anyway.
2930 * heap handle of our own copy of the current syscolors in case of
2931 * "set" call, i.e. pPens, pBrushes != NULL.
2932 * TRUE (unconditionally !) in case of "restore" call,
2933 * i.e. pPens, pBrushes == NULL.
2934 * FALSE in case of either pPens != NULL and pBrushes == NULL
2935 * or pPens == NULL and pBrushes != NULL.
2937 * I'm not sure whether this implementation is 100% correct. [AM]
2939 DWORD WINAPI SetSysColorsTemp( const COLORREF *pPens, const HBRUSH *pBrushes, DWORD n)
2943 if (pPens && pBrushes) /* "set" call */
2945 /* allocate our structure to remember old colors */
2946 LPVOID pOldCol = HeapAlloc(GetProcessHeap(), 0, sizeof(DWORD)+n*sizeof(HPEN)+n*sizeof(HBRUSH));
2948 *(DWORD *)p = n; p = (char*)p + sizeof(DWORD);
2949 memcpy(p, SysColorPens, n*sizeof(HPEN)); p = (char*)p + n*sizeof(HPEN);
2950 memcpy(p, SysColorBrushes, n*sizeof(HBRUSH)); p = (char*)p + n*sizeof(HBRUSH);
2952 for (i=0; i < n; i++)
2954 SysColorPens[i] = CreatePen( PS_SOLID, 1, pPens[i] );
2955 SysColorBrushes[i] = pBrushes[i];
2958 return (DWORD)pOldCol; /* FIXME: pointer truncation */
2960 if (!pPens && !pBrushes) /* "restore" call */
2962 LPVOID pOldCol = (LPVOID)n; /* FIXME: not 64-bit safe */
2964 DWORD nCount = *(DWORD *)p;
2965 p = (char*)p + sizeof(DWORD);
2967 for (i=0; i < nCount; i++)
2969 DeleteObject(SysColorPens[i]);
2970 SysColorPens[i] = *(HPEN *)p; p = (char*)p + sizeof(HPEN);
2972 for (i=0; i < nCount; i++)
2974 SysColorBrushes[i] = *(HBRUSH *)p; p = (char*)p + sizeof(HBRUSH);
2976 /* get rid of storage structure */
2977 HeapFree(GetProcessHeap(), 0, pOldCol);
2985 /***********************************************************************
2986 * GetSysColorBrush (USER32.@)
2988 HBRUSH WINAPI GetSysColorBrush( INT index )
2990 if (0 <= index && index < NUM_SYS_COLORS) return SysColorBrushes[index];
2991 WARN("Unknown index(%d)\n", index );
2992 return GetStockObject(LTGRAY_BRUSH);
2996 /***********************************************************************
2999 HPEN SYSCOLOR_GetPen( INT index )
3001 /* We can assert here, because this function is internal to Wine */
3002 assert (0 <= index && index < NUM_SYS_COLORS);
3003 return SysColorPens[index];
3007 /***********************************************************************
3008 * ChangeDisplaySettingsA (USER32.@)
3010 LONG WINAPI ChangeDisplaySettingsA( LPDEVMODEA devmode, DWORD flags )
3012 if (devmode) devmode->dmDriverExtra = 0;
3014 return ChangeDisplaySettingsExA(NULL,devmode,NULL,flags,NULL);
3018 /***********************************************************************
3019 * ChangeDisplaySettingsW (USER32.@)
3021 LONG WINAPI ChangeDisplaySettingsW( LPDEVMODEW devmode, DWORD flags )
3023 if (devmode) devmode->dmDriverExtra = 0;
3025 return ChangeDisplaySettingsExW(NULL,devmode,NULL,flags,NULL);
3029 /***********************************************************************
3030 * ChangeDisplaySettingsExA (USER32.@)
3032 LONG WINAPI ChangeDisplaySettingsExA( LPCSTR devname, LPDEVMODEA devmode, HWND hwnd,
3033 DWORD flags, LPVOID lparam )
3036 UNICODE_STRING nameW;
3038 if (devname) RtlCreateUnicodeStringFromAsciiz(&nameW, devname);
3039 else nameW.Buffer = NULL;
3045 devmodeW = GdiConvertToDevmodeW(devmode);
3048 ret = ChangeDisplaySettingsExW(nameW.Buffer, devmodeW, hwnd, flags, lparam);
3049 HeapFree(GetProcessHeap(), 0, devmodeW);
3052 ret = DISP_CHANGE_SUCCESSFUL;
3056 ret = ChangeDisplaySettingsExW(nameW.Buffer, NULL, hwnd, flags, lparam);
3059 if (devname) RtlFreeUnicodeString(&nameW);
3064 /***********************************************************************
3065 * ChangeDisplaySettingsExW (USER32.@)
3067 LONG WINAPI ChangeDisplaySettingsExW( LPCWSTR devname, LPDEVMODEW devmode, HWND hwnd,
3068 DWORD flags, LPVOID lparam )
3070 /* make sure the desktop window is created before mode changing */
3073 return USER_Driver->pChangeDisplaySettingsEx( devname, devmode, hwnd, flags, lparam );
3077 /***********************************************************************
3078 * EnumDisplaySettingsW (USER32.@)
3081 * TRUE if nth setting exists found (described in the LPDEVMODEW struct)
3082 * FALSE if we do not have the nth setting
3084 BOOL WINAPI EnumDisplaySettingsW( LPCWSTR name, DWORD n, LPDEVMODEW devmode )
3086 return EnumDisplaySettingsExW(name, n, devmode, 0);
3090 /***********************************************************************
3091 * EnumDisplaySettingsA (USER32.@)
3093 BOOL WINAPI EnumDisplaySettingsA(LPCSTR name,DWORD n,LPDEVMODEA devmode)
3095 return EnumDisplaySettingsExA(name, n, devmode, 0);
3099 /***********************************************************************
3100 * EnumDisplaySettingsExA (USER32.@)
3102 BOOL WINAPI EnumDisplaySettingsExA(LPCSTR lpszDeviceName, DWORD iModeNum,
3103 LPDEVMODEA lpDevMode, DWORD dwFlags)
3107 UNICODE_STRING nameW;
3109 if (lpszDeviceName) RtlCreateUnicodeStringFromAsciiz(&nameW, lpszDeviceName);
3110 else nameW.Buffer = NULL;
3112 ret = EnumDisplaySettingsExW(nameW.Buffer,iModeNum,&devmodeW,dwFlags);
3115 lpDevMode->dmSize = FIELD_OFFSET(DEVMODEA, dmICMMethod);
3116 lpDevMode->dmSpecVersion = devmodeW.dmSpecVersion;
3117 lpDevMode->dmDriverVersion = devmodeW.dmDriverVersion;
3118 WideCharToMultiByte(CP_ACP, 0, devmodeW.dmDeviceName, -1,
3119 (LPSTR)lpDevMode->dmDeviceName, CCHDEVICENAME, NULL, NULL);
3120 lpDevMode->dmDriverExtra = 0; /* FIXME */
3121 lpDevMode->dmBitsPerPel = devmodeW.dmBitsPerPel;
3122 lpDevMode->dmPelsHeight = devmodeW.dmPelsHeight;
3123 lpDevMode->dmPelsWidth = devmodeW.dmPelsWidth;
3124 lpDevMode->u2.dmDisplayFlags = devmodeW.u2.dmDisplayFlags;
3125 lpDevMode->dmDisplayFrequency = devmodeW.dmDisplayFrequency;
3126 lpDevMode->dmFields = devmodeW.dmFields;
3128 lpDevMode->u1.s2.dmPosition.x = devmodeW.u1.s2.dmPosition.x;
3129 lpDevMode->u1.s2.dmPosition.y = devmodeW.u1.s2.dmPosition.y;
3130 lpDevMode->u1.s2.dmDisplayOrientation = devmodeW.u1.s2.dmDisplayOrientation;
3131 lpDevMode->u1.s2.dmDisplayFixedOutput = devmodeW.u1.s2.dmDisplayFixedOutput;
3133 if (lpszDeviceName) RtlFreeUnicodeString(&nameW);
3138 /***********************************************************************
3139 * EnumDisplaySettingsExW (USER32.@)
3141 BOOL WINAPI EnumDisplaySettingsExW(LPCWSTR lpszDeviceName, DWORD iModeNum,
3142 LPDEVMODEW lpDevMode, DWORD dwFlags)
3144 /* make sure the desktop window is created before mode enumeration */
3147 return USER_Driver->pEnumDisplaySettingsEx(lpszDeviceName, iModeNum, lpDevMode, dwFlags);
3150 /***********************************************************************
3151 * SetProcessDPIAware (USER32.@)
3153 BOOL WINAPI SetProcessDPIAware( VOID )