wbemprox: Return selected properties only from IWbemClassObject::Next.
[wine/wine-gecko.git] / dlls / user32 / sysparams.c
blob9944119251a63c26003c5f7db84ee7c6dc0b2eda
1 /*
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
21 #include "config.h"
23 #include <assert.h>
24 #include <stdarg.h>
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <string.h>
29 #define NONAMELESSUNION
30 #define NONAMELESSSTRUCT
32 #include "windef.h"
33 #include "winbase.h"
34 #include "winnls.h"
35 #include "wingdi.h"
36 #include "winreg.h"
37 #include "wine/wingdi16.h"
38 #include "winerror.h"
40 #include "controls.h"
41 #include "user_private.h"
42 #include "wine/gdi_driver.h"
43 #include "wine/unicode.h"
44 #include "wine/debug.h"
46 WINE_DEFAULT_DEBUG_CHANNEL(system);
48 /* System parameter indexes */
49 enum spi_index
51 SPI_SETWORKAREA_IDX,
52 SPI_INDEX_COUNT
55 /**
56 * Names of the registry subkeys of HKEY_CURRENT_USER key and value names
57 * for the system parameters.
60 /* the various registry keys that are used to store parameters */
61 enum parameter_key
63 COLORS_KEY,
64 DESKTOP_KEY,
65 KEYBOARD_KEY,
66 MOUSE_KEY,
67 METRICS_KEY,
68 SOUND_KEY,
69 VERSION_KEY,
70 SHOWSOUNDS_KEY,
71 KEYBOARDPREF_KEY,
72 SCREENREADER_KEY,
73 NB_PARAM_KEYS
76 static const WCHAR COLORS_REGKEY[] = {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','C','o','l','o','r','s',0};
77 static const WCHAR DESKTOP_REGKEY[] = {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
78 static const WCHAR KEYBOARD_REGKEY[] = {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','K','e','y','b','o','a','r','d',0};
79 static const WCHAR MOUSE_REGKEY[] = {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
80 static const WCHAR METRICS_REGKEY[] = {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p','\\',
81 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
82 static const WCHAR SOUND_REGKEY[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','S','o','u','n','d',0};
83 static const WCHAR VERSION_REGKEY[] = {'S','o','f','t','w','a','r','e','\\',
84 'M','i','c','r','o','s','o','f','t','\\',
85 'W','i','n','d','o','w','s',' ','N','T','\\',
86 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
87 'W','i','n','d','o','w','s',0};
88 static const WCHAR SHOWSOUNDS_REGKEY[] = {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\',
89 'A','c','c','e','s','s','i','b','i','l','i','t','y','\\',
90 'S','h','o','w','S','o','u','n','d','s',0};
91 static const WCHAR KEYBOARDPREF_REGKEY[] = {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\',
92 'A','c','c','e','s','s','i','b','i','l','i','t','y','\\',
93 'K','e','y','b','o','a','r','d',' ','P','r','e','f','e','r','e','n','c','e',0};
94 static const WCHAR SCREENREADER_REGKEY[] = {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\',
95 'A','c','c','e','s','s','i','b','i','l','i','t','y','\\',
96 'B','l','i','n','d',' ','A','c','c','e','s','s',0};
98 static const WCHAR *parameter_key_names[NB_PARAM_KEYS] =
100 COLORS_REGKEY,
101 DESKTOP_REGKEY,
102 KEYBOARD_REGKEY,
103 MOUSE_REGKEY,
104 METRICS_REGKEY,
105 SOUND_REGKEY,
106 VERSION_REGKEY,
107 SHOWSOUNDS_REGKEY,
108 KEYBOARDPREF_REGKEY,
109 SCREENREADER_REGKEY,
112 /* parameter key values; the first char is actually an enum parameter_key to specify the key */
113 static const WCHAR BEEP_VALNAME[]= {SOUND_KEY,'B','e','e','p',0};
114 static const WCHAR MOUSETHRESHOLD1_VALNAME[]= {MOUSE_KEY,'M','o','u','s','e','T','h','r','e','s','h','o','l','d','1',0};
115 static const WCHAR MOUSETHRESHOLD2_VALNAME[]= {MOUSE_KEY,'M','o','u','s','e','T','h','r','e','s','h','o','l','d','2',0};
116 static const WCHAR MOUSEACCELERATION_VALNAME[]= {MOUSE_KEY,'M','o','u','s','e','S','p','e','e','d',0};
117 static const WCHAR BORDER_VALNAME[]= {METRICS_KEY,'B','o','r','d','e','r','W','i','d','t','h',0};
118 static const WCHAR KEYBOARDSPEED_VALNAME[]= {KEYBOARD_KEY,'K','e','y','b','o','a','r','d','S','p','e','e','d',0};
119 static const WCHAR ICONHORIZONTALSPACING_VALNAME[]= {METRICS_KEY,'I','c','o','n','S','p','a','c','i','n','g',0};
120 static const WCHAR SCREENSAVETIMEOUT_VALNAME[]= {DESKTOP_KEY,'S','c','r','e','e','n','S','a','v','e','T','i','m','e','O','u','t',0};
121 static const WCHAR SCREENSAVEACTIVE_VALNAME[]= {DESKTOP_KEY,'S','c','r','e','e','n','S','a','v','e','A','c','t','i','v','e',0};
122 static const WCHAR GRIDGRANULARITY_VALNAME[]= {DESKTOP_KEY,'G','r','i','d','G','r','a','n','u','l','a','r','i','t','y',0};
123 static const WCHAR KEYBOARDDELAY_VALNAME[]= {KEYBOARD_KEY,'K','e','y','b','o','a','r','d','D','e','l','a','y',0};
124 static const WCHAR ICONVERTICALSPACING_VALNAME[]= {METRICS_KEY,'I','c','o','n','V','e','r','t','i','c','a','l','S','p','a','c','i','n','g',0};
125 static const WCHAR ICONTITLEWRAP_VALNAME[]= {DESKTOP_KEY,'I','c','o','n','T','i','t','l','e','W','r','a','p',0};
126 static const WCHAR ICONTITLEWRAP_MIRROR[]= {METRICS_KEY,'I','c','o','n','T','i','t','l','e','W','r','a','p',0};
127 static const WCHAR ICONTITLELOGFONT_VALNAME[]= {METRICS_KEY,'I','c','o','n','F','o','n','t',0};
128 static const WCHAR MENUDROPALIGNMENT_VALNAME[]= {DESKTOP_KEY,'M','e','n','u','D','r','o','p','A','l','i','g','n','m','e','n','t',0};
129 static const WCHAR MENUDROPALIGNMENT_MIRROR[]= {VERSION_KEY,'M','e','n','u','D','r','o','p','A','l','i','g','n','m','e','n','t',0};
130 static const WCHAR MOUSETRAILS_VALNAME[]= {MOUSE_KEY,'M','o','u','s','e','T','r','a','i','l','s',0};
131 static const WCHAR SNAPTODEFBUTTON_VALNAME[]= {MOUSE_KEY,'S','n','a','p','T','o','D','e','f','a','u','l','t','B','u','t','t','o','n',0};
132 static const WCHAR DOUBLECLKWIDTH_VALNAME[]= {MOUSE_KEY,'D','o','u','b','l','e','C','l','i','c','k','W','i','d','t','h',0};
133 static const WCHAR DOUBLECLKWIDTH_MIRROR[]= {DESKTOP_KEY,'D','o','u','b','l','e','C','l','i','c','k','W','i','d','t','h',0};
134 static const WCHAR DOUBLECLKHEIGHT_VALNAME[]= {MOUSE_KEY,'D','o','u','b','l','e','C','l','i','c','k','H','e','i','g','h','t',0};
135 static const WCHAR DOUBLECLKHEIGHT_MIRROR[]= {DESKTOP_KEY,'D','o','u','b','l','e','C','l','i','c','k','H','e','i','g','h','t',0};
136 static const WCHAR DOUBLECLICKTIME_VALNAME[]= {MOUSE_KEY,'D','o','u','b','l','e','C','l','i','c','k','S','p','e','e','d',0};
137 static const WCHAR MOUSEBUTTONSWAP_VALNAME[]= {MOUSE_KEY,'S','w','a','p','M','o','u','s','e','B','u','t','t','o','n','s',0};
138 static const WCHAR DRAGFULLWINDOWS_VALNAME[]= {DESKTOP_KEY,'D','r','a','g','F','u','l','l','W','i','n','d','o','w','s',0};
139 static const WCHAR SHOWSOUNDS_VALNAME[]= {SHOWSOUNDS_KEY,'O','n',0};
140 static const WCHAR KEYBOARDPREF_VALNAME[]= {KEYBOARDPREF_KEY,'O','n',0};
141 static const WCHAR SCREENREADER_VALNAME[]= {SCREENREADER_KEY,'O','n',0};
142 static const WCHAR DESKWALLPAPER_VALNAME[]= {DESKTOP_KEY,'W','a','l','l','p','a','p','e','r',0};
143 static const WCHAR DESKPATTERN_VALNAME[]= {DESKTOP_KEY,'P','a','t','t','e','r','n',0};
144 static const WCHAR FONTSMOOTHING_VALNAME[]= {DESKTOP_KEY,'F','o','n','t','S','m','o','o','t','h','i','n','g',0};
145 static const WCHAR DRAGWIDTH_VALNAME[]= {DESKTOP_KEY,'D','r','a','g','W','i','d','t','h',0};
146 static const WCHAR DRAGHEIGHT_VALNAME[]= {DESKTOP_KEY,'D','r','a','g','H','e','i','g','h','t',0};
147 static const WCHAR LOWPOWERACTIVE_VALNAME[]= {DESKTOP_KEY,'L','o','w','P','o','w','e','r','A','c','t','i','v','e',0};
148 static const WCHAR POWEROFFACTIVE_VALNAME[]= {DESKTOP_KEY,'P','o','w','e','r','O','f','f','A','c','t','i','v','e',0};
149 static const WCHAR USERPREFERENCESMASK_VALNAME[]= {DESKTOP_KEY,'U','s','e','r','P','r','e','f','e','r','e','n','c','e','s','M','a','s','k',0};
150 static const WCHAR MOUSEHOVERWIDTH_VALNAME[]= {MOUSE_KEY,'M','o','u','s','e','H','o','v','e','r','W','i','d','t','h',0};
151 static const WCHAR MOUSEHOVERHEIGHT_VALNAME[]= {MOUSE_KEY,'M','o','u','s','e','H','o','v','e','r','H','e','i','g','h','t',0};
152 static const WCHAR MOUSEHOVERTIME_VALNAME[]= {MOUSE_KEY,'M','o','u','s','e','H','o','v','e','r','T','i','m','e',0};
153 static const WCHAR WHEELSCROLLCHARS_VALNAME[]= {DESKTOP_KEY,'W','h','e','e','l','S','c','r','o','l','l','C','h','a','r','s',0};
154 static const WCHAR WHEELSCROLLLINES_VALNAME[]= {DESKTOP_KEY,'W','h','e','e','l','S','c','r','o','l','l','L','i','n','e','s',0};
155 static const WCHAR ACTIVEWINDOWTRACKING_VALNAME[]= {MOUSE_KEY,'A','c','t','i','v','e','W','i','n','d','o','w','T','r','a','c','k','i','n','g',0};
156 static const WCHAR MENUSHOWDELAY_VALNAME[]= {DESKTOP_KEY,'M','e','n','u','S','h','o','w','D','e','l','a','y',0};
157 static const WCHAR BLOCKSENDINPUTRESETS_VALNAME[]= {DESKTOP_KEY,'B','l','o','c','k','S','e','n','d','I','n','p','u','t','R','e','s','e','t','s',0};
158 static const WCHAR FOREGROUNDLOCKTIMEOUT_VALNAME[]= {DESKTOP_KEY,'F','o','r','e','g','r','o','u','n','d','L','o','c','k','T','i','m','e','o','u','t',0};
159 static const WCHAR ACTIVEWNDTRKTIMEOUT_VALNAME[]= {DESKTOP_KEY,'A','c','t','i','v','e','W','n','d','T','r','a','c','k','T','i','m','e','o','u','t',0};
160 static const WCHAR FOREGROUNDFLASHCOUNT_VALNAME[]= {DESKTOP_KEY,'F','o','r','e','g','r','o','u','n','d','F','l','a','s','h','C','o','u','n','t',0};
161 static const WCHAR CARETWIDTH_VALNAME[]= {DESKTOP_KEY,'C','a','r','e','t','W','i','d','t','h',0};
162 static const WCHAR MOUSECLICKLOCKTIME_VALNAME[]= {DESKTOP_KEY,'C','l','i','c','k','L','o','c','k','T','i','m','e',0};
163 static const WCHAR MOUSESPEED_VALNAME[]= {MOUSE_KEY,'M','o','u','s','e','S','e','n','s','i','t','i','v','i','t','y',0};
164 static const WCHAR FONTSMOOTHINGTYPE_VALNAME[]= {DESKTOP_KEY,'F','o','n','t','S','m','o','o','t','h','i','n','g','T','y','p','e',0};
165 static const WCHAR FONTSMOOTHINGCONTRAST_VALNAME[]= {DESKTOP_KEY,'F','o','n','t','S','m','o','o','t','h','i','n','g','G','a','m','m','a',0};
166 static const WCHAR FONTSMOOTHINGORIENTATION_VALNAME[]= {DESKTOP_KEY,'F','o','n','t','S','m','o','o','t','h','i','n','g','O','r','i','e','n','t','a','t','i','o','n',0};
167 static const WCHAR FOCUSBORDERWIDTH_VALNAME[]= {DESKTOP_KEY,'F','o','c','u','s','B','o','r','d','e','r','W','i','d','t','h',0};
168 static const WCHAR FOCUSBORDERHEIGHT_VALNAME[]= {DESKTOP_KEY,'F','o','c','u','s','B','o','r','d','e','r','H','e','i','g','h','t',0};
169 static const WCHAR SCROLLWIDTH_VALNAME[]= {METRICS_KEY,'S','c','r','o','l','l','W','i','d','t','h',0};
170 static const WCHAR SCROLLHEIGHT_VALNAME[]= {METRICS_KEY,'S','c','r','o','l','l','H','e','i','g','h','t',0};
171 static const WCHAR CAPTIONWIDTH_VALNAME[]= {METRICS_KEY,'C','a','p','t','i','o','n','W','i','d','t','h',0};
172 static const WCHAR CAPTIONHEIGHT_VALNAME[]= {METRICS_KEY,'C','a','p','t','i','o','n','H','e','i','g','h','t',0};
173 static const WCHAR SMCAPTIONWIDTH_VALNAME[]= {METRICS_KEY,'S','m','C','a','p','t','i','o','n','W','i','d','t','h',0};
174 static const WCHAR SMCAPTIONHEIGHT_VALNAME[]= {METRICS_KEY,'S','m','C','a','p','t','i','o','n','H','e','i','g','h','t',0};
175 static const WCHAR MENUWIDTH_VALNAME[]= {METRICS_KEY,'M','e','n','u','W','i','d','t','h',0};
176 static const WCHAR MENUHEIGHT_VALNAME[]= {METRICS_KEY,'M','e','n','u','H','e','i','g','h','t',0};
177 static const WCHAR ICONSIZE_VALNAME[]= {METRICS_KEY,'S','h','e','l','l',' ','I','c','o','n',' ','S','i','z','e',0};
178 static const WCHAR PADDEDBORDERWIDTH_VALNAME[]= {METRICS_KEY,'P','a','d','d','e','d','B','o','r','d','e','r','W','i','d','t','h',0};
179 static const WCHAR CAPTIONLOGFONT_VALNAME[]= {METRICS_KEY,'C','a','p','t','i','o','n','F','o','n','t',0};
180 static const WCHAR SMCAPTIONLOGFONT_VALNAME[]= {METRICS_KEY,'S','m','C','a','p','t','i','o','n','F','o','n','t',0};
181 static const WCHAR MENULOGFONT_VALNAME[]= {METRICS_KEY,'M','e','n','u','F','o','n','t',0};
182 static const WCHAR MESSAGELOGFONT_VALNAME[]= {METRICS_KEY,'M','e','s','s','a','g','e','F','o','n','t',0};
183 static const WCHAR STATUSLOGFONT_VALNAME[]= {METRICS_KEY,'S','t','a','t','u','s','F','o','n','t',0};
184 static const WCHAR MINWIDTH_VALNAME[] = {METRICS_KEY,'M','i','n','W','i','d','t','h',0};
185 static const WCHAR MINHORZGAP_VALNAME[] = {METRICS_KEY,'M','i','n','H','o','r','z','G','a','p',0};
186 static const WCHAR MINVERTGAP_VALNAME[] = {METRICS_KEY,'M','i','n','V','e','r','t','G','a','p',0};
187 static const WCHAR MINARRANGE_VALNAME[] = {METRICS_KEY,'M','i','n','A','r','r','a','n','g','e',0};
188 static const WCHAR COLOR_SCROLLBAR_VALNAME[] = {COLORS_KEY,'S','c','r','o','l','l','b','a','r',0};
189 static const WCHAR COLOR_BACKGROUND_VALNAME[] = {COLORS_KEY,'B','a','c','k','g','r','o','u','n','d',0};
190 static const WCHAR COLOR_ACTIVECAPTION_VALNAME[] = {COLORS_KEY,'A','c','t','i','v','e','T','i','t','l','e',0};
191 static const WCHAR COLOR_INACTIVECAPTION_VALNAME[] = {COLORS_KEY,'I','n','a','c','t','i','v','e','T','i','t','l','e',0};
192 static const WCHAR COLOR_MENU_VALNAME[] = {COLORS_KEY,'M','e','n','u',0};
193 static const WCHAR COLOR_WINDOW_VALNAME[] = {COLORS_KEY,'W','i','n','d','o','w',0};
194 static const WCHAR COLOR_WINDOWFRAME_VALNAME[] = {COLORS_KEY,'W','i','n','d','o','w','F','r','a','m','e',0};
195 static const WCHAR COLOR_MENUTEXT_VALNAME[] = {COLORS_KEY,'M','e','n','u','T','e','x','t',0};
196 static const WCHAR COLOR_WINDOWTEXT_VALNAME[] = {COLORS_KEY,'W','i','n','d','o','w','T','e','x','t',0};
197 static const WCHAR COLOR_CAPTIONTEXT_VALNAME[] = {COLORS_KEY,'T','i','t','l','e','T','e','x','t',0};
198 static const WCHAR COLOR_ACTIVEBORDER_VALNAME[] = {COLORS_KEY,'A','c','t','i','v','e','B','o','r','d','e','r',0};
199 static const WCHAR COLOR_INACTIVEBORDER_VALNAME[] = {COLORS_KEY,'I','n','a','c','t','i','v','e','B','o','r','d','e','r',0};
200 static const WCHAR COLOR_APPWORKSPACE_VALNAME[] = {COLORS_KEY,'A','p','p','W','o','r','k','S','p','a','c','e',0};
201 static const WCHAR COLOR_HIGHLIGHT_VALNAME[] = {COLORS_KEY,'H','i','l','i','g','h','t',0};
202 static const WCHAR COLOR_HIGHLIGHTTEXT_VALNAME[] = {COLORS_KEY,'H','i','l','i','g','h','t','T','e','x','t',0};
203 static const WCHAR COLOR_BTNFACE_VALNAME[] = {COLORS_KEY,'B','u','t','t','o','n','F','a','c','e',0};
204 static const WCHAR COLOR_BTNSHADOW_VALNAME[] = {COLORS_KEY,'B','u','t','t','o','n','S','h','a','d','o','w',0};
205 static const WCHAR COLOR_GRAYTEXT_VALNAME[] = {COLORS_KEY,'G','r','a','y','T','e','x','t',0};
206 static const WCHAR COLOR_BTNTEXT_VALNAME[] = {COLORS_KEY,'B','u','t','t','o','n','T','e','x','t',0};
207 static const WCHAR COLOR_INACTIVECAPTIONTEXT_VALNAME[] = {COLORS_KEY,'I','n','a','c','t','i','v','e','T','i','t','l','e','T','e','x','t',0};
208 static const WCHAR COLOR_BTNHIGHLIGHT_VALNAME[] = {COLORS_KEY,'B','u','t','t','o','n','H','i','l','i','g','h','t',0};
209 static const WCHAR COLOR_3DDKSHADOW_VALNAME[] = {COLORS_KEY,'B','u','t','t','o','n','D','k','S','h','a','d','o','w',0};
210 static const WCHAR COLOR_3DLIGHT_VALNAME[] = {COLORS_KEY,'B','u','t','t','o','n','L','i','g','h','t',0};
211 static const WCHAR COLOR_INFOTEXT_VALNAME[] = {COLORS_KEY,'I','n','f','o','T','e','x','t',0};
212 static const WCHAR COLOR_INFOBK_VALNAME[] = {COLORS_KEY,'I','n','f','o','W','i','n','d','o','w',0};
213 static const WCHAR COLOR_ALTERNATEBTNFACE_VALNAME[] = {COLORS_KEY,'B','u','t','t','o','n','A','l','t','e','r','n','a','t','e','F','a','c','e',0};
214 static const WCHAR COLOR_HOTLIGHT_VALNAME[] = {COLORS_KEY,'H','o','t','T','r','a','c','k','i','n','g','C','o','l','o','r',0};
215 static const WCHAR COLOR_GRADIENTACTIVECAPTION_VALNAME[] = {COLORS_KEY,'G','r','a','d','i','e','n','t','A','c','t','i','v','e','T','i','t','l','e',0};
216 static const WCHAR COLOR_GRADIENTINACTIVECAPTION_VALNAME[] = {COLORS_KEY,'G','r','a','d','i','e','n','t','I','n','a','c','t','i','v','e','T','i','t','l','e',0};
217 static const WCHAR COLOR_MENUHILIGHT_VALNAME[] = {COLORS_KEY,'M','e','n','u','H','i','l','i','g','h','t',0};
218 static const WCHAR COLOR_MENUBAR_VALNAME[] = {COLORS_KEY,'M','e','n','u','B','a','r',0};
220 /* FIXME - real value */
221 static const WCHAR SCREENSAVERRUNNING_VALNAME[]= {DESKTOP_KEY,'W','I','N','E','_','S','c','r','e','e','n','S','a','v','e','r','R','u','n','n','i','n','g',0};
223 static const WCHAR WINE_CURRENT_USER_REGKEY[] = {'S','o','f','t','w','a','r','e','\\',
224 'W','i','n','e',0};
226 /* volatile registry branch under WINE_CURRENT_USER_REGKEY for temporary values storage */
227 static const WCHAR WINE_CURRENT_USER_REGKEY_TEMP_PARAMS[] = {'T','e','m','p','o','r','a','r','y',' ',
228 'S','y','s','t','e','m',' ',
229 'P','a','r','a','m','e','t','e','r','s',0};
231 static const WCHAR Yes[] = {'Y','e','s',0};
232 static const WCHAR No[] = {'N','o',0};
233 static const WCHAR CSu[] = {'%','u',0};
234 static const WCHAR CSd[] = {'%','d',0};
235 static const WCHAR CSrgb[] = {'%','u',' ','%','u',' ','%','u',0};
237 /* Indicators whether system parameter value is loaded */
238 static char spi_loaded[SPI_INDEX_COUNT];
240 static BOOL notify_change = TRUE;
242 /* System parameters storage */
243 static RECT work_area;
245 static HKEY volatile_base_key;
247 union sysparam_all_entry;
249 struct sysparam_entry
251 BOOL (*get)( union sysparam_all_entry *entry, UINT int_param, void *ptr_param );
252 BOOL (*set)( union sysparam_all_entry *entry, UINT int_param, void *ptr_param, UINT flags );
253 BOOL (*init)( union sysparam_all_entry *entry );
254 const WCHAR *regval;
255 const WCHAR *mirror;
256 BOOL loaded;
259 struct sysparam_uint_entry
261 struct sysparam_entry hdr;
262 UINT val;
265 struct sysparam_bool_entry
267 struct sysparam_entry hdr;
268 BOOL val;
271 struct sysparam_dword_entry
273 struct sysparam_entry hdr;
274 DWORD val;
277 struct sysparam_rgb_entry
279 struct sysparam_entry hdr;
280 COLORREF val;
281 HBRUSH brush;
282 HPEN pen;
285 struct sysparam_binary_entry
287 struct sysparam_entry hdr;
288 void *ptr;
289 size_t size;
292 struct sysparam_path_entry
294 struct sysparam_entry hdr;
295 WCHAR path[MAX_PATH];
298 struct sysparam_font_entry
300 struct sysparam_entry hdr;
301 UINT weight;
302 LOGFONTW val;
305 struct sysparam_pref_entry
307 struct sysparam_entry hdr;
308 struct sysparam_binary_entry *parent;
309 UINT offset;
310 UINT mask;
313 union sysparam_all_entry
315 struct sysparam_entry hdr;
316 struct sysparam_uint_entry uint;
317 struct sysparam_bool_entry bool;
318 struct sysparam_dword_entry dword;
319 struct sysparam_rgb_entry rgb;
320 struct sysparam_binary_entry bin;
321 struct sysparam_path_entry path;
322 struct sysparam_font_entry font;
323 struct sysparam_pref_entry pref;
326 static void SYSPARAMS_LogFont16To32W( const LOGFONT16 *font16, LPLOGFONTW font32 )
328 font32->lfHeight = font16->lfHeight;
329 font32->lfWidth = font16->lfWidth;
330 font32->lfEscapement = font16->lfEscapement;
331 font32->lfOrientation = font16->lfOrientation;
332 font32->lfWeight = font16->lfWeight;
333 font32->lfItalic = font16->lfItalic;
334 font32->lfUnderline = font16->lfUnderline;
335 font32->lfStrikeOut = font16->lfStrikeOut;
336 font32->lfCharSet = font16->lfCharSet;
337 font32->lfOutPrecision = font16->lfOutPrecision;
338 font32->lfClipPrecision = font16->lfClipPrecision;
339 font32->lfQuality = font16->lfQuality;
340 font32->lfPitchAndFamily = font16->lfPitchAndFamily;
341 MultiByteToWideChar( CP_ACP, 0, font16->lfFaceName, -1, font32->lfFaceName, LF_FACESIZE );
342 font32->lfFaceName[LF_FACESIZE-1] = 0;
345 static void SYSPARAMS_LogFont32WTo32A( const LOGFONTW* font32W, LPLOGFONTA font32A )
347 font32A->lfHeight = font32W->lfHeight;
348 font32A->lfWidth = font32W->lfWidth;
349 font32A->lfEscapement = font32W->lfEscapement;
350 font32A->lfOrientation = font32W->lfOrientation;
351 font32A->lfWeight = font32W->lfWeight;
352 font32A->lfItalic = font32W->lfItalic;
353 font32A->lfUnderline = font32W->lfUnderline;
354 font32A->lfStrikeOut = font32W->lfStrikeOut;
355 font32A->lfCharSet = font32W->lfCharSet;
356 font32A->lfOutPrecision = font32W->lfOutPrecision;
357 font32A->lfClipPrecision = font32W->lfClipPrecision;
358 font32A->lfQuality = font32W->lfQuality;
359 font32A->lfPitchAndFamily = font32W->lfPitchAndFamily;
360 WideCharToMultiByte( CP_ACP, 0, font32W->lfFaceName, -1, font32A->lfFaceName, LF_FACESIZE, NULL, NULL );
361 font32A->lfFaceName[LF_FACESIZE-1] = 0;
364 static void SYSPARAMS_LogFont32ATo32W( const LOGFONTA* font32A, LPLOGFONTW font32W )
366 font32W->lfHeight = font32A->lfHeight;
367 font32W->lfWidth = font32A->lfWidth;
368 font32W->lfEscapement = font32A->lfEscapement;
369 font32W->lfOrientation = font32A->lfOrientation;
370 font32W->lfWeight = font32A->lfWeight;
371 font32W->lfItalic = font32A->lfItalic;
372 font32W->lfUnderline = font32A->lfUnderline;
373 font32W->lfStrikeOut = font32A->lfStrikeOut;
374 font32W->lfCharSet = font32A->lfCharSet;
375 font32W->lfOutPrecision = font32A->lfOutPrecision;
376 font32W->lfClipPrecision = font32A->lfClipPrecision;
377 font32W->lfQuality = font32A->lfQuality;
378 font32W->lfPitchAndFamily = font32A->lfPitchAndFamily;
379 MultiByteToWideChar( CP_ACP, 0, font32A->lfFaceName, -1, font32W->lfFaceName, LF_FACESIZE );
380 font32W->lfFaceName[LF_FACESIZE-1] = 0;
383 static void SYSPARAMS_NonClientMetrics32WTo32A( const NONCLIENTMETRICSW* lpnm32W, LPNONCLIENTMETRICSA lpnm32A )
385 lpnm32A->iBorderWidth = lpnm32W->iBorderWidth;
386 lpnm32A->iScrollWidth = lpnm32W->iScrollWidth;
387 lpnm32A->iScrollHeight = lpnm32W->iScrollHeight;
388 lpnm32A->iCaptionWidth = lpnm32W->iCaptionWidth;
389 lpnm32A->iCaptionHeight = lpnm32W->iCaptionHeight;
390 SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfCaptionFont, &lpnm32A->lfCaptionFont );
391 lpnm32A->iSmCaptionWidth = lpnm32W->iSmCaptionWidth;
392 lpnm32A->iSmCaptionHeight = lpnm32W->iSmCaptionHeight;
393 SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfSmCaptionFont, &lpnm32A->lfSmCaptionFont );
394 lpnm32A->iMenuWidth = lpnm32W->iMenuWidth;
395 lpnm32A->iMenuHeight = lpnm32W->iMenuHeight;
396 SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfMenuFont, &lpnm32A->lfMenuFont );
397 SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfStatusFont, &lpnm32A->lfStatusFont );
398 SYSPARAMS_LogFont32WTo32A( &lpnm32W->lfMessageFont, &lpnm32A->lfMessageFont );
399 if (lpnm32A->cbSize > FIELD_OFFSET(NONCLIENTMETRICSA, iPaddedBorderWidth))
401 if (lpnm32W->cbSize > FIELD_OFFSET(NONCLIENTMETRICSW, iPaddedBorderWidth))
402 lpnm32A->iPaddedBorderWidth = lpnm32W->iPaddedBorderWidth;
403 else
404 lpnm32A->iPaddedBorderWidth = 0;
408 static void SYSPARAMS_NonClientMetrics32ATo32W( const NONCLIENTMETRICSA* lpnm32A, LPNONCLIENTMETRICSW lpnm32W )
410 lpnm32W->iBorderWidth = lpnm32A->iBorderWidth;
411 lpnm32W->iScrollWidth = lpnm32A->iScrollWidth;
412 lpnm32W->iScrollHeight = lpnm32A->iScrollHeight;
413 lpnm32W->iCaptionWidth = lpnm32A->iCaptionWidth;
414 lpnm32W->iCaptionHeight = lpnm32A->iCaptionHeight;
415 SYSPARAMS_LogFont32ATo32W( &lpnm32A->lfCaptionFont, &lpnm32W->lfCaptionFont );
416 lpnm32W->iSmCaptionWidth = lpnm32A->iSmCaptionWidth;
417 lpnm32W->iSmCaptionHeight = lpnm32A->iSmCaptionHeight;
418 SYSPARAMS_LogFont32ATo32W( &lpnm32A->lfSmCaptionFont, &lpnm32W->lfSmCaptionFont );
419 lpnm32W->iMenuWidth = lpnm32A->iMenuWidth;
420 lpnm32W->iMenuHeight = lpnm32A->iMenuHeight;
421 SYSPARAMS_LogFont32ATo32W( &lpnm32A->lfMenuFont, &lpnm32W->lfMenuFont );
422 SYSPARAMS_LogFont32ATo32W( &lpnm32A->lfStatusFont, &lpnm32W->lfStatusFont );
423 SYSPARAMS_LogFont32ATo32W( &lpnm32A->lfMessageFont, &lpnm32W->lfMessageFont );
424 if (lpnm32W->cbSize > FIELD_OFFSET(NONCLIENTMETRICSW, iPaddedBorderWidth))
426 if (lpnm32A->cbSize > FIELD_OFFSET(NONCLIENTMETRICSA, iPaddedBorderWidth))
427 lpnm32W->iPaddedBorderWidth = lpnm32A->iPaddedBorderWidth;
428 else
429 lpnm32W->iPaddedBorderWidth = 0;
434 /* Helper functions to retrieve monitors info */
436 struct monitor_info
438 int count;
439 RECT virtual_rect;
442 static BOOL CALLBACK monitor_info_proc( HMONITOR monitor, HDC hdc, LPRECT rect, LPARAM lp )
444 struct monitor_info *info = (struct monitor_info *)lp;
445 info->count++;
446 UnionRect( &info->virtual_rect, &info->virtual_rect, rect );
447 return TRUE;
450 static void get_monitors_info( struct monitor_info *info )
452 info->count = 0;
453 SetRectEmpty( &info->virtual_rect );
454 EnumDisplayMonitors( 0, NULL, monitor_info_proc, (LPARAM)info );
457 RECT get_virtual_screen_rect(void)
459 struct monitor_info info;
460 get_monitors_info( &info );
461 return info.virtual_rect;
464 /* get text metrics and/or "average" char width of the specified logfont
465 * for the specified dc */
466 static void get_text_metr_size( HDC hdc, LOGFONTW *plf, TEXTMETRICW * ptm, UINT *psz)
468 HFONT hfont, hfontsav;
469 TEXTMETRICW tm;
470 if( !ptm) ptm = &tm;
471 hfont = CreateFontIndirectW( plf);
472 if( !hfont || ( hfontsav = SelectObject( hdc, hfont)) == NULL ) {
473 ptm->tmHeight = -1;
474 if( psz) *psz = 10;
475 if( hfont) DeleteObject( hfont);
476 return;
478 GetTextMetricsW( hdc, ptm);
479 if( psz)
480 if( !(*psz = GdiGetCharDimensions( hdc, ptm, NULL)))
481 *psz = 10;
482 SelectObject( hdc, hfontsav);
483 DeleteObject( hfont);
486 /***********************************************************************
487 * SYSPARAMS_NotifyChange
489 * Sends notification about system parameter update.
491 static void SYSPARAMS_NotifyChange( UINT uiAction, UINT fWinIni )
493 static const WCHAR emptyW[1];
495 if (notify_change)
497 if (fWinIni & SPIF_UPDATEINIFILE)
499 if (fWinIni & (SPIF_SENDWININICHANGE | SPIF_SENDCHANGE))
500 SendMessageTimeoutW(HWND_BROADCAST, WM_SETTINGCHANGE,
501 uiAction, (LPARAM) emptyW,
502 SMTO_ABORTIFHUNG, 2000, NULL );
504 else
506 /* FIXME notify other wine processes with internal message */
511 /* retrieve the cached base keys for a given entry */
512 static BOOL get_base_keys( enum parameter_key index, HKEY *base_key, HKEY *volatile_key )
514 static HKEY base_keys[NB_PARAM_KEYS];
515 static HKEY volatile_keys[NB_PARAM_KEYS];
516 HKEY key;
518 if (!base_keys[index] && base_key)
520 if (RegCreateKeyW( HKEY_CURRENT_USER, parameter_key_names[index], &key )) return FALSE;
521 if (InterlockedCompareExchangePointer( (void **)&base_keys[index], key, 0 ))
522 RegCloseKey( key );
524 if (!volatile_keys[index] && volatile_key)
526 if (RegCreateKeyExW( volatile_base_key, parameter_key_names[index],
527 0, 0, REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &key, 0 )) return FALSE;
528 if (InterlockedCompareExchangePointer( (void **)&volatile_keys[index], key, 0 ))
529 RegCloseKey( key );
531 if (base_key) *base_key = base_keys[index];
532 if (volatile_key) *volatile_key = volatile_keys[index];
533 return TRUE;
536 /* load a value to a registry entry */
537 static DWORD load_entry( struct sysparam_entry *entry, void *data, DWORD size )
539 DWORD type, count = 0;
540 HKEY base_key, volatile_key;
542 if (!get_base_keys( entry->regval[0], &base_key, &volatile_key )) return FALSE;
544 count = size;
545 if (RegQueryValueExW( volatile_key, entry->regval + 1, NULL, &type, data, &count ))
547 count = size;
548 if (RegQueryValueExW( base_key, entry->regval + 1, NULL, &type, data, &count )) count = 0;
550 /* make sure strings are null-terminated */
551 if (size && count == size && type == REG_SZ) ((WCHAR *)data)[count - 1] = 0;
552 entry->loaded = TRUE;
553 return count;
556 /* save a value to a registry entry */
557 static BOOL save_entry( const struct sysparam_entry *entry, const void *data, DWORD size,
558 DWORD type, UINT flags )
560 HKEY base_key, volatile_key;
562 if (flags & SPIF_UPDATEINIFILE)
564 if (!get_base_keys( entry->regval[0], &base_key, &volatile_key )) return FALSE;
565 if (RegSetValueExW( base_key, entry->regval + 1, 0, type, data, size )) return FALSE;
566 RegDeleteValueW( volatile_key, entry->regval + 1 );
568 if (entry->mirror && get_base_keys( entry->mirror[0], &base_key, NULL ))
569 RegSetValueExW( base_key, entry->mirror + 1, 0, type, data, size );
571 else
573 if (!get_base_keys( entry->regval[0], NULL, &volatile_key )) return FALSE;
574 if (RegSetValueExW( volatile_key, entry->regval + 1, 0, type, data, size )) return FALSE;
576 return TRUE;
579 /* save a string value to a registry entry */
580 static BOOL save_entry_string( const struct sysparam_entry *entry, const WCHAR *str, UINT flags )
582 return save_entry( entry, str, (strlenW(str) + 1) * sizeof(WCHAR), REG_SZ, flags );
585 /* initialize an entry in the registry if missing */
586 static BOOL init_entry( struct sysparam_entry *entry, const void *data, DWORD size, DWORD type )
588 HKEY base_key;
590 if (!get_base_keys( entry->regval[0], &base_key, NULL )) return FALSE;
591 if (!RegQueryValueExW( base_key, entry->regval + 1, NULL, NULL, NULL, NULL )) return TRUE;
592 if (RegSetValueExW( base_key, entry->regval + 1, 0, type, data, size )) return FALSE;
593 if (entry->mirror && get_base_keys( entry->mirror[0], &base_key, NULL ))
594 RegSetValueExW( base_key, entry->mirror + 1, 0, type, data, size );
595 entry->loaded = TRUE;
596 return TRUE;
599 /* initialize a string value in the registry if missing */
600 static BOOL init_entry_string( struct sysparam_entry *entry, const WCHAR *str )
602 return init_entry( entry, str, (strlenW(str) + 1) * sizeof(WCHAR), REG_SZ );
605 static inline HDC get_display_dc(void)
607 static const WCHAR DISPLAY[] = {'D','I','S','P','L','A','Y',0};
608 static HDC display_dc;
609 if (!display_dc)
611 display_dc = CreateICW( DISPLAY, NULL, NULL, NULL );
612 __wine_make_gdi_object_system( display_dc, TRUE );
614 return display_dc;
617 static inline int get_display_dpi(void)
619 static int display_dpi;
620 if (!display_dpi) display_dpi = GetDeviceCaps( get_display_dc(), LOGPIXELSY );
621 return display_dpi;
624 /* adjust some of the raw values found in the registry */
625 static void normalize_nonclientmetrics( NONCLIENTMETRICSW *pncm)
627 TEXTMETRICW tm;
628 if( pncm->iBorderWidth < 1) pncm->iBorderWidth = 1;
629 if( pncm->iCaptionWidth < 8) pncm->iCaptionWidth = 8;
630 if( pncm->iScrollWidth < 8) pncm->iScrollWidth = 8;
631 if( pncm->iScrollHeight < 8) pncm->iScrollHeight = 8;
633 /* adjust some heights to the corresponding font */
634 get_text_metr_size( get_display_dc(), &pncm->lfMenuFont, &tm, NULL);
635 pncm->iMenuHeight = max( pncm->iMenuHeight, 2 + tm.tmHeight + tm.tmExternalLeading );
636 get_text_metr_size( get_display_dc(), &pncm->lfCaptionFont, &tm, NULL);
637 pncm->iCaptionHeight = max( pncm->iCaptionHeight, 2 + tm.tmHeight);
638 get_text_metr_size( get_display_dc(), &pncm->lfSmCaptionFont, &tm, NULL);
639 pncm->iSmCaptionHeight = max( pncm->iSmCaptionHeight, 2 + tm.tmHeight);
642 static BOOL CALLBACK enum_monitors( HMONITOR monitor, HDC hdc, LPRECT rect, LPARAM lp )
644 MONITORINFO mi;
646 mi.cbSize = sizeof(mi);
647 if (GetMonitorInfoW( monitor, &mi ) && (mi.dwFlags & MONITORINFOF_PRIMARY))
649 LPRECT work = (LPRECT)lp;
650 *work = mi.rcWork;
651 return FALSE;
653 return TRUE;
656 /* load a uint parameter from the registry */
657 static BOOL get_uint_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param )
659 if (!ptr_param) return FALSE;
661 if (!entry->hdr.loaded)
663 WCHAR buf[32];
665 if (load_entry( &entry->hdr, buf, sizeof(buf) )) entry->uint.val = atoiW( buf );
667 *(UINT *)ptr_param = entry->uint.val;
668 return TRUE;
671 /* set a uint parameter in the registry */
672 static BOOL set_uint_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param, UINT flags )
674 WCHAR buf[32];
676 wsprintfW( buf, CSu, int_param );
677 if (!save_entry_string( &entry->hdr, buf, flags )) return FALSE;
678 entry->uint.val = int_param;
679 entry->hdr.loaded = TRUE;
680 return TRUE;
683 /* initialize a uint parameter */
684 static BOOL init_uint_entry( union sysparam_all_entry *entry )
686 WCHAR buf[32];
688 wsprintfW( buf, CSu, entry->uint.val );
689 return init_entry_string( &entry->hdr, buf );
692 /* set an int parameter in the registry */
693 static BOOL set_int_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param, UINT flags )
695 WCHAR buf[32];
697 wsprintfW( buf, CSd, int_param );
698 if (!save_entry_string( &entry->hdr, buf, flags )) return FALSE;
699 entry->uint.val = int_param;
700 entry->hdr.loaded = TRUE;
701 return TRUE;
704 /* initialize an int parameter */
705 static BOOL init_int_entry( union sysparam_all_entry *entry )
707 WCHAR buf[32];
709 wsprintfW( buf, CSd, entry->uint.val );
710 return init_entry_string( &entry->hdr, buf );
713 /* load a twips parameter from the registry */
714 static BOOL get_twips_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param )
716 if (!ptr_param) return FALSE;
718 if (!entry->hdr.loaded)
720 WCHAR buf[32];
722 if (load_entry( &entry->hdr, buf, sizeof(buf) ))
724 int val = atoiW( buf );
725 /* Dimension are quoted as being "twips" values if negative and pixels if positive.
726 * One inch is 1440 twips.
727 * See for example
728 * Technical Reference to the Windows 2000 Registry ->
729 * HKEY_CURRENT_USER -> Control Panel -> Desktop -> WindowMetrics
731 if (val < 0) val = (-val * get_display_dpi() + 720) / 1440;
732 entry->uint.val = val;
735 *(UINT *)ptr_param = entry->uint.val;
736 return TRUE;
739 /* load a bool parameter from the registry */
740 static BOOL get_bool_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param )
742 if (!ptr_param) return FALSE;
744 if (!entry->hdr.loaded)
746 WCHAR buf[32];
748 if (load_entry( &entry->hdr, buf, sizeof(buf) )) entry->bool.val = atoiW( buf ) != 0;
750 *(UINT *)ptr_param = entry->bool.val;
751 return TRUE;
754 /* set a bool parameter in the registry */
755 static BOOL set_bool_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param, UINT flags )
757 WCHAR buf[32];
759 wsprintfW( buf, CSu, int_param != 0 );
760 if (!save_entry_string( &entry->hdr, buf, flags )) return FALSE;
761 entry->bool.val = int_param != 0;
762 entry->hdr.loaded = TRUE;
763 return TRUE;
766 /* initialize a bool parameter */
767 static BOOL init_bool_entry( union sysparam_all_entry *entry )
769 WCHAR buf[32];
771 wsprintfW( buf, CSu, entry->bool.val != 0 );
772 return init_entry_string( &entry->hdr, buf );
775 /* load a bool parameter using Yes/No strings from the registry */
776 static BOOL get_yesno_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param )
778 if (!ptr_param) return FALSE;
780 if (!entry->hdr.loaded)
782 WCHAR buf[32];
784 if (load_entry( &entry->hdr, buf, sizeof(buf) )) entry->bool.val = !lstrcmpiW( Yes, buf );
786 *(UINT *)ptr_param = entry->bool.val;
787 return TRUE;
790 /* set a bool parameter using Yes/No strings from the registry */
791 static BOOL set_yesno_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param, UINT flags )
793 const WCHAR *str = int_param ? Yes : No;
795 if (!save_entry_string( &entry->hdr, str, flags )) return FALSE;
796 entry->bool.val = int_param != 0;
797 entry->hdr.loaded = TRUE;
798 return TRUE;
801 /* initialize a bool parameter using Yes/No strings */
802 static BOOL init_yesno_entry( union sysparam_all_entry *entry )
804 return init_entry_string( &entry->hdr, entry->bool.val ? Yes : No );
807 /* load a dword (binary) parameter from the registry */
808 static BOOL get_dword_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param )
810 if (!ptr_param) return FALSE;
812 if (!entry->hdr.loaded)
814 DWORD val;
815 if (load_entry( &entry->hdr, &val, sizeof(val) ) == sizeof(DWORD)) entry->dword.val = val;
817 *(DWORD *)ptr_param = entry->bool.val;
818 return TRUE;
821 /* set a dword (binary) parameter in the registry */
822 static BOOL set_dword_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param, UINT flags )
824 DWORD val = PtrToUlong( ptr_param );
826 if (!save_entry( &entry->hdr, &val, sizeof(val), REG_DWORD, flags )) return FALSE;
827 entry->dword.val = val;
828 entry->hdr.loaded = TRUE;
829 return TRUE;
832 /* initialize a dword parameter */
833 static BOOL init_dword_entry( union sysparam_all_entry *entry )
835 return init_entry( &entry->hdr, &entry->dword.val, sizeof(entry->dword.val), REG_DWORD );
838 /* load an RGB parameter from the registry */
839 static BOOL get_rgb_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param )
841 if (!ptr_param) return FALSE;
843 if (!entry->hdr.loaded)
845 WCHAR buf[32];
847 if (load_entry( &entry->hdr, buf, sizeof(buf) ))
849 DWORD r, g, b;
850 WCHAR *end, *str = buf;
852 r = strtoulW( str, &end, 10 );
853 if (end == str || !*end) goto done;
854 str = end + 1;
855 g = strtoulW( str, &end, 10 );
856 if (end == str || !*end) goto done;
857 str = end + 1;
858 b = strtoulW( str, &end, 10 );
859 if (end == str) goto done;
860 if (r > 255 || g > 255 || b > 255) goto done;
861 entry->rgb.val = RGB( r, g, b );
864 done:
865 *(COLORREF *)ptr_param = entry->rgb.val;
866 return TRUE;
869 /* set an RGB parameter in the registry */
870 static BOOL set_rgb_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param, UINT flags )
872 WCHAR buf[32];
873 HBRUSH brush;
874 HPEN pen;
876 wsprintfW( buf, CSrgb, GetRValue(int_param), GetGValue(int_param), GetBValue(int_param) );
877 if (!save_entry_string( &entry->hdr, buf, flags )) return FALSE;
878 entry->rgb.val = int_param;
879 entry->hdr.loaded = TRUE;
880 if ((brush = InterlockedExchangePointer( (void **)&entry->rgb.brush, 0 )))
882 __wine_make_gdi_object_system( brush, FALSE );
883 DeleteObject( brush );
885 if ((pen = InterlockedExchangePointer( (void **)&entry->rgb.pen, 0 )))
887 __wine_make_gdi_object_system( pen, FALSE );
888 DeleteObject( pen );
890 return TRUE;
893 /* initialize an RGB parameter */
894 static BOOL init_rgb_entry( union sysparam_all_entry *entry )
896 WCHAR buf[32];
898 wsprintfW( buf, CSrgb, GetRValue(entry->rgb.val), GetGValue(entry->rgb.val), GetBValue(entry->rgb.val) );
899 return init_entry_string( &entry->hdr, buf );
902 /* load a font (binary) parameter from the registry */
903 static BOOL get_font_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param )
905 if (!ptr_param) return FALSE;
907 if (!entry->hdr.loaded)
909 LOGFONTW font;
911 switch (load_entry( &entry->hdr, &font, sizeof(font) ))
913 case sizeof(font):
914 if (font.lfHeight > 0) /* positive height value means points ( inch/72 ) */
915 font.lfHeight = -MulDiv( font.lfHeight, get_display_dpi(), 72 );
916 entry->font.val = font;
917 break;
918 case sizeof(LOGFONT16): /* win9x-winME format */
919 SYSPARAMS_LogFont16To32W( (LOGFONT16 *)&font, &entry->font.val );
920 if (entry->font.val.lfHeight > 0)
921 entry->font.val.lfHeight = -MulDiv( entry->font.val.lfHeight, get_display_dpi(), 72 );
922 break;
923 default:
924 WARN( "Unknown format in key %s value %s\n",
925 debugstr_w( parameter_key_names[entry->hdr.regval[0]] ),
926 debugstr_w( entry->hdr.regval + 1 ));
927 /* fall through */
928 case 0: /* use the default GUI font */
929 GetObjectW( GetStockObject( DEFAULT_GUI_FONT ), sizeof(font), &font );
930 font.lfWeight = entry->font.weight;
931 entry->font.val = font;
932 break;
934 entry->hdr.loaded = TRUE;
936 *(LOGFONTW *)ptr_param = entry->font.val;
937 return TRUE;
940 /* set a font (binary) parameter in the registry */
941 static BOOL set_font_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param, UINT flags )
943 LOGFONTW font;
944 WCHAR *ptr;
946 memcpy( &font, ptr_param, sizeof(font) );
947 /* zero pad the end of lfFaceName so we don't save uninitialised data */
948 ptr = memchrW( font.lfFaceName, 0, LF_FACESIZE );
949 if (ptr) memset( ptr, 0, (font.lfFaceName + LF_FACESIZE - ptr) * sizeof(WCHAR) );
951 if (!save_entry( &entry->hdr, &font, sizeof(font), REG_BINARY, flags )) return FALSE;
952 entry->font.val = font;
953 entry->hdr.loaded = TRUE;
954 return TRUE;
957 /* initialize a font (binary) parameter */
958 static BOOL init_font_entry( union sysparam_all_entry *entry )
960 GetObjectW( GetStockObject( DEFAULT_GUI_FONT ), sizeof(entry->font.val), &entry->font.val );
961 entry->font.val.lfWeight = entry->font.weight;
962 return init_entry( &entry->hdr, &entry->font.val, sizeof(entry->font.val), REG_BINARY );
965 /* get a path parameter in the registry */
966 static BOOL get_path_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param )
968 if (!ptr_param) return FALSE;
970 if (!entry->hdr.loaded)
972 WCHAR buffer[MAX_PATH];
974 if (load_entry( &entry->hdr, buffer, sizeof(buffer) ))
975 lstrcpynW( entry->path.path, buffer, MAX_PATH );
977 lstrcpynW( ptr_param, entry->path.path, int_param );
978 return TRUE;
981 /* set a path parameter in the registry */
982 static BOOL set_path_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param, UINT flags )
984 WCHAR buffer[MAX_PATH];
985 BOOL ret;
987 lstrcpynW( buffer, ptr_param, MAX_PATH );
988 ret = save_entry_string( &entry->hdr, buffer, flags );
989 if (ret)
991 strcpyW( entry->path.path, buffer );
992 entry->hdr.loaded = TRUE;
994 return ret;
997 /* initialize a path parameter */
998 static BOOL init_path_entry( union sysparam_all_entry *entry )
1000 return init_entry_string( &entry->hdr, entry->path.path );
1003 /* get a binary parameter in the registry */
1004 static BOOL get_binary_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param )
1006 if (!ptr_param) return FALSE;
1008 if (!entry->hdr.loaded)
1010 void *buffer = HeapAlloc( GetProcessHeap(), 0, entry->bin.size );
1011 DWORD len = load_entry( &entry->hdr, buffer, entry->bin.size );
1013 if (len)
1015 memcpy( entry->bin.ptr, buffer, entry->bin.size );
1016 memset( (char *)entry->bin.ptr + len, 0, entry->bin.size - len );
1018 HeapFree( GetProcessHeap(), 0, buffer );
1020 memcpy( ptr_param, entry->bin.ptr, min( int_param, entry->bin.size ) );
1021 return TRUE;
1024 /* set a binary parameter in the registry */
1025 static BOOL set_binary_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param, UINT flags )
1027 BOOL ret;
1028 void *buffer = HeapAlloc( GetProcessHeap(), 0, entry->bin.size );
1030 memcpy( buffer, entry->bin.ptr, entry->bin.size );
1031 memcpy( buffer, ptr_param, min( int_param, entry->bin.size ));
1032 ret = save_entry( &entry->hdr, buffer, entry->bin.size, REG_BINARY, flags );
1033 if (ret)
1035 memcpy( entry->bin.ptr, buffer, entry->bin.size );
1036 entry->hdr.loaded = TRUE;
1038 HeapFree( GetProcessHeap(), 0, buffer );
1039 return ret;
1042 /* initialize a binary parameter */
1043 static BOOL init_binary_entry( union sysparam_all_entry *entry )
1045 return init_entry( &entry->hdr, entry->bin.ptr, entry->bin.size, REG_BINARY );
1048 /* get a user pref parameter in the registry */
1049 static BOOL get_userpref_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param )
1051 union sysparam_all_entry *parent_entry = (union sysparam_all_entry *)entry->pref.parent;
1052 BYTE prefs[8];
1054 if (!ptr_param) return FALSE;
1056 if (!parent_entry->hdr.get( parent_entry, sizeof(prefs), prefs )) return FALSE;
1057 *(BOOL *)ptr_param = (prefs[entry->pref.offset] & entry->pref.mask) != 0;
1058 return TRUE;
1061 /* set a user pref parameter in the registry */
1062 static BOOL set_userpref_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param, UINT flags )
1064 union sysparam_all_entry *parent_entry = (union sysparam_all_entry *)entry->pref.parent;
1065 BYTE prefs[8];
1067 parent_entry->hdr.loaded = FALSE; /* force loading it again */
1068 if (!parent_entry->hdr.get( parent_entry, sizeof(prefs), prefs )) return FALSE;
1070 if (PtrToUlong( ptr_param )) prefs[entry->pref.offset] |= entry->pref.mask;
1071 else prefs[entry->pref.offset] &= ~entry->pref.mask;
1073 return parent_entry->hdr.set( parent_entry, sizeof(prefs), prefs, flags );
1076 static BOOL get_entry( void *ptr, UINT int_param, void *ptr_param )
1078 union sysparam_all_entry *entry = ptr;
1079 return entry->hdr.get( entry, int_param, ptr_param );
1082 static BOOL set_entry( void *ptr, UINT int_param, void *ptr_param, UINT flags )
1084 union sysparam_all_entry *entry = ptr;
1085 return entry->hdr.set( entry, int_param, ptr_param, flags );
1088 #define UINT_ENTRY(name,val) \
1089 struct sysparam_uint_entry entry_##name = { { get_uint_entry, set_uint_entry, init_uint_entry, \
1090 name ##_VALNAME }, (val) }
1092 #define UINT_ENTRY_MIRROR(name,val) \
1093 struct sysparam_uint_entry entry_##name = { { get_uint_entry, set_uint_entry, init_uint_entry, \
1094 name ##_VALNAME, name ##_MIRROR }, (val) }
1096 #define INT_ENTRY(name,val) \
1097 struct sysparam_uint_entry entry_##name = { { get_uint_entry, set_int_entry, init_int_entry, \
1098 name ##_VALNAME }, (val) }
1100 #define BOOL_ENTRY(name,val) \
1101 struct sysparam_bool_entry entry_##name = { { get_bool_entry, set_bool_entry, init_bool_entry, \
1102 name ##_VALNAME }, (val) }
1104 #define BOOL_ENTRY_MIRROR(name,val) \
1105 struct sysparam_bool_entry entry_##name = { { get_bool_entry, set_bool_entry, init_bool_entry, \
1106 name ##_VALNAME, name ##_MIRROR }, (val) }
1108 #define YESNO_ENTRY(name,val) \
1109 struct sysparam_bool_entry entry_##name = { { get_yesno_entry, set_yesno_entry, init_yesno_entry, \
1110 name ##_VALNAME }, (val) }
1112 #define TWIPS_ENTRY(name,val) \
1113 struct sysparam_uint_entry entry_##name = { { get_twips_entry, set_int_entry, init_int_entry, \
1114 name ##_VALNAME }, (val) }
1116 #define DWORD_ENTRY(name,val) \
1117 struct sysparam_dword_entry entry_##name = { { get_dword_entry, set_dword_entry, init_dword_entry, \
1118 name ##_VALNAME }, (val) }
1120 #define BINARY_ENTRY(name,data) \
1121 struct sysparam_binary_entry entry_##name = { { get_binary_entry, set_binary_entry, init_binary_entry, \
1122 name ##_VALNAME }, data, sizeof(data) }
1124 #define PATH_ENTRY(name) \
1125 struct sysparam_path_entry entry_##name = { { get_path_entry, set_path_entry, init_path_entry, \
1126 name ##_VALNAME } }
1128 #define FONT_ENTRY(name,weight) \
1129 struct sysparam_font_entry entry_##name = { { get_font_entry, set_font_entry, init_font_entry, \
1130 name ##_VALNAME }, (weight) }
1132 #define USERPREF_ENTRY(name,offset,mask) \
1133 struct sysparam_pref_entry entry_##name = { { get_userpref_entry, set_userpref_entry }, \
1134 &entry_USERPREFERENCESMASK, (offset), (mask) }
1136 static UINT_ENTRY( DRAGWIDTH, 4 );
1137 static UINT_ENTRY( DRAGHEIGHT, 4 );
1138 static UINT_ENTRY( DOUBLECLICKTIME, 500 );
1139 static UINT_ENTRY( FONTSMOOTHING, 2 );
1140 static UINT_ENTRY( GRIDGRANULARITY, 0 );
1141 static UINT_ENTRY( ICONSIZE, 32 );
1142 static UINT_ENTRY( KEYBOARDDELAY, 1 );
1143 static UINT_ENTRY( KEYBOARDSPEED, 31 );
1144 static UINT_ENTRY( MENUSHOWDELAY, 400 );
1145 static UINT_ENTRY( MINARRANGE, ARW_HIDE );
1146 static UINT_ENTRY( MINHORZGAP, 0 );
1147 static UINT_ENTRY( MINVERTGAP, 0 );
1148 static UINT_ENTRY( MINWIDTH, 154 );
1149 static UINT_ENTRY( MOUSEHOVERHEIGHT, 4 );
1150 static UINT_ENTRY( MOUSEHOVERTIME, 400 );
1151 static UINT_ENTRY( MOUSEHOVERWIDTH, 4 );
1152 static UINT_ENTRY( MOUSESPEED, 10 );
1153 static UINT_ENTRY( MOUSETRAILS, 0 );
1154 static UINT_ENTRY( SCREENSAVETIMEOUT, 300 );
1155 static UINT_ENTRY( WHEELSCROLLCHARS, 3 );
1156 static UINT_ENTRY( WHEELSCROLLLINES, 3 );
1157 static UINT_ENTRY_MIRROR( DOUBLECLKHEIGHT, 4 );
1158 static UINT_ENTRY_MIRROR( DOUBLECLKWIDTH, 4 );
1159 static UINT_ENTRY_MIRROR( MENUDROPALIGNMENT, 0 );
1161 static INT_ENTRY( MOUSETHRESHOLD1, 6 );
1162 static INT_ENTRY( MOUSETHRESHOLD2, 10 );
1163 static INT_ENTRY( MOUSEACCELERATION, 1 );
1165 static BOOL_ENTRY( BLOCKSENDINPUTRESETS, FALSE );
1166 static BOOL_ENTRY( DRAGFULLWINDOWS, FALSE );
1167 static BOOL_ENTRY( KEYBOARDPREF, TRUE );
1168 static BOOL_ENTRY( LOWPOWERACTIVE, FALSE );
1169 static BOOL_ENTRY( MOUSEBUTTONSWAP, FALSE );
1170 static BOOL_ENTRY( POWEROFFACTIVE, FALSE );
1171 static BOOL_ENTRY( SCREENREADER, FALSE );
1172 static BOOL_ENTRY( SCREENSAVEACTIVE, TRUE );
1173 static BOOL_ENTRY( SCREENSAVERRUNNING, FALSE );
1174 static BOOL_ENTRY( SHOWSOUNDS, FALSE );
1175 static BOOL_ENTRY( SNAPTODEFBUTTON, FALSE );
1176 static BOOL_ENTRY_MIRROR( ICONTITLEWRAP, TRUE );
1178 static YESNO_ENTRY( BEEP, TRUE );
1180 static TWIPS_ENTRY( BORDER, -15 );
1181 static TWIPS_ENTRY( CAPTIONHEIGHT, -270 );
1182 static TWIPS_ENTRY( CAPTIONWIDTH, -270 );
1183 static TWIPS_ENTRY( ICONHORIZONTALSPACING, -1125 );
1184 static TWIPS_ENTRY( ICONVERTICALSPACING, -1125 );
1185 static TWIPS_ENTRY( MENUHEIGHT, -270 );
1186 static TWIPS_ENTRY( MENUWIDTH, -270 );
1187 static TWIPS_ENTRY( PADDEDBORDERWIDTH, 0 );
1188 static TWIPS_ENTRY( SCROLLHEIGHT, -240 );
1189 static TWIPS_ENTRY( SCROLLWIDTH, -240 );
1190 static TWIPS_ENTRY( SMCAPTIONHEIGHT, -225 );
1191 static TWIPS_ENTRY( SMCAPTIONWIDTH, -225 );
1193 static DWORD_ENTRY( ACTIVEWINDOWTRACKING, 0 );
1194 static DWORD_ENTRY( ACTIVEWNDTRKTIMEOUT, 0 );
1195 static DWORD_ENTRY( CARETWIDTH, 1 );
1196 static DWORD_ENTRY( FOCUSBORDERHEIGHT, 1 );
1197 static DWORD_ENTRY( FOCUSBORDERWIDTH, 1 );
1198 static DWORD_ENTRY( FONTSMOOTHINGCONTRAST, 0 );
1199 static DWORD_ENTRY( FONTSMOOTHINGORIENTATION, FE_FONTSMOOTHINGORIENTATIONRGB );
1200 static DWORD_ENTRY( FONTSMOOTHINGTYPE, FE_FONTSMOOTHINGSTANDARD );
1201 static DWORD_ENTRY( FOREGROUNDFLASHCOUNT, 3 );
1202 static DWORD_ENTRY( FOREGROUNDLOCKTIMEOUT, 0 );
1203 static DWORD_ENTRY( MOUSECLICKLOCKTIME, 1200 );
1205 static PATH_ENTRY( DESKPATTERN );
1206 static PATH_ENTRY( DESKWALLPAPER );
1208 static BYTE user_prefs[8] = { 0x30, 0x00, 0x00, 0x80, 0x10, 0x00, 0x00, 0x00 };
1209 static BINARY_ENTRY( USERPREFERENCESMASK, user_prefs );
1211 static FONT_ENTRY( CAPTIONLOGFONT, FW_BOLD );
1212 static FONT_ENTRY( ICONTITLELOGFONT, FW_NORMAL );
1213 static FONT_ENTRY( MENULOGFONT, FW_NORMAL );
1214 static FONT_ENTRY( MESSAGELOGFONT, FW_NORMAL );
1215 static FONT_ENTRY( SMCAPTIONLOGFONT, FW_NORMAL );
1216 static FONT_ENTRY( STATUSLOGFONT, FW_NORMAL );
1218 static USERPREF_ENTRY( MENUANIMATION, 0, 0x02 );
1219 static USERPREF_ENTRY( COMBOBOXANIMATION, 0, 0x04 );
1220 static USERPREF_ENTRY( LISTBOXSMOOTHSCROLLING, 0, 0x08 );
1221 static USERPREF_ENTRY( GRADIENTCAPTIONS, 0, 0x10 );
1222 static USERPREF_ENTRY( KEYBOARDCUES, 0, 0x20 );
1223 static USERPREF_ENTRY( ACTIVEWNDTRKZORDER, 0, 0x40 );
1224 static USERPREF_ENTRY( HOTTRACKING, 0, 0x80 );
1225 static USERPREF_ENTRY( MENUFADE, 1, 0x02 );
1226 static USERPREF_ENTRY( SELECTIONFADE, 1, 0x04 );
1227 static USERPREF_ENTRY( TOOLTIPANIMATION, 1, 0x08 );
1228 static USERPREF_ENTRY( TOOLTIPFADE, 1, 0x10 );
1229 static USERPREF_ENTRY( CURSORSHADOW, 1, 0x20 );
1230 static USERPREF_ENTRY( MOUSESONAR, 1, 0x40 );
1231 static USERPREF_ENTRY( MOUSECLICKLOCK, 1, 0x80 );
1232 static USERPREF_ENTRY( MOUSEVANISH, 2, 0x01 );
1233 static USERPREF_ENTRY( FLATMENU, 2, 0x02 );
1234 static USERPREF_ENTRY( DROPSHADOW, 2, 0x04 );
1235 static USERPREF_ENTRY( UIEFFECTS, 3, 0x80 );
1236 static USERPREF_ENTRY( DISABLEOVERLAPPEDCONTENT, 4, 0x01 );
1237 static USERPREF_ENTRY( CLIENTAREAANIMATION, 4, 0x02 );
1238 static USERPREF_ENTRY( CLEARTYPE, 4, 0x10 );
1239 static USERPREF_ENTRY( SPEECHRECOGNITION, 4, 0x20 );
1241 static struct sysparam_rgb_entry system_colors[] =
1243 #define RGB_ENTRY(name,val) { { get_rgb_entry, set_rgb_entry, init_rgb_entry, name ##_VALNAME }, (val) }
1244 RGB_ENTRY( COLOR_SCROLLBAR, RGB(212, 208, 200) ),
1245 RGB_ENTRY( COLOR_BACKGROUND, RGB(58, 110, 165) ),
1246 RGB_ENTRY( COLOR_ACTIVECAPTION, RGB(10, 36, 106) ),
1247 RGB_ENTRY( COLOR_INACTIVECAPTION, RGB(128, 128, 128) ),
1248 RGB_ENTRY( COLOR_MENU, RGB(212, 208, 200) ),
1249 RGB_ENTRY( COLOR_WINDOW, RGB(255, 255, 255) ),
1250 RGB_ENTRY( COLOR_WINDOWFRAME, RGB(0, 0, 0) ),
1251 RGB_ENTRY( COLOR_MENUTEXT, RGB(0, 0, 0) ),
1252 RGB_ENTRY( COLOR_WINDOWTEXT, RGB(0, 0, 0) ),
1253 RGB_ENTRY( COLOR_CAPTIONTEXT, RGB(255, 255, 255) ),
1254 RGB_ENTRY( COLOR_ACTIVEBORDER, RGB(212, 208, 200) ),
1255 RGB_ENTRY( COLOR_INACTIVEBORDER, RGB(212, 208, 200) ),
1256 RGB_ENTRY( COLOR_APPWORKSPACE, RGB(128, 128, 128) ),
1257 RGB_ENTRY( COLOR_HIGHLIGHT, RGB(10, 36, 106) ),
1258 RGB_ENTRY( COLOR_HIGHLIGHTTEXT, RGB(255, 255, 255) ),
1259 RGB_ENTRY( COLOR_BTNFACE, RGB(212, 208, 200) ),
1260 RGB_ENTRY( COLOR_BTNSHADOW, RGB(128, 128, 128) ),
1261 RGB_ENTRY( COLOR_GRAYTEXT, RGB(128, 128, 128) ),
1262 RGB_ENTRY( COLOR_BTNTEXT, RGB(0, 0, 0) ),
1263 RGB_ENTRY( COLOR_INACTIVECAPTIONTEXT, RGB(212, 208, 200) ),
1264 RGB_ENTRY( COLOR_BTNHIGHLIGHT, RGB(255, 255, 255) ),
1265 RGB_ENTRY( COLOR_3DDKSHADOW, RGB(64, 64, 64) ),
1266 RGB_ENTRY( COLOR_3DLIGHT, RGB(212, 208, 200) ),
1267 RGB_ENTRY( COLOR_INFOTEXT, RGB(0, 0, 0) ),
1268 RGB_ENTRY( COLOR_INFOBK, RGB(255, 255, 225) ),
1269 RGB_ENTRY( COLOR_ALTERNATEBTNFACE, RGB(181, 181, 181) ),
1270 RGB_ENTRY( COLOR_HOTLIGHT, RGB(0, 0, 200) ),
1271 RGB_ENTRY( COLOR_GRADIENTACTIVECAPTION, RGB(166, 202, 240) ),
1272 RGB_ENTRY( COLOR_GRADIENTINACTIVECAPTION, RGB(192, 192, 192) ),
1273 RGB_ENTRY( COLOR_MENUHILIGHT, RGB(10, 36, 106) ),
1274 RGB_ENTRY( COLOR_MENUBAR, RGB(212, 208, 200) )
1275 #undef RGB_ENTRY
1277 #define NUM_SYS_COLORS (sizeof(system_colors) / sizeof(system_colors[0]))
1279 /* entries that are initialized by default in the registry */
1280 static union sysparam_all_entry * const default_entries[] =
1282 (union sysparam_all_entry *)&entry_ACTIVEWINDOWTRACKING,
1283 (union sysparam_all_entry *)&entry_ACTIVEWNDTRKTIMEOUT,
1284 (union sysparam_all_entry *)&entry_BEEP,
1285 (union sysparam_all_entry *)&entry_BLOCKSENDINPUTRESETS,
1286 (union sysparam_all_entry *)&entry_BORDER,
1287 (union sysparam_all_entry *)&entry_CAPTIONHEIGHT,
1288 (union sysparam_all_entry *)&entry_CAPTIONWIDTH,
1289 (union sysparam_all_entry *)&entry_CARETWIDTH,
1290 (union sysparam_all_entry *)&entry_DESKWALLPAPER,
1291 (union sysparam_all_entry *)&entry_DOUBLECLICKTIME,
1292 (union sysparam_all_entry *)&entry_DOUBLECLKHEIGHT,
1293 (union sysparam_all_entry *)&entry_DOUBLECLKWIDTH,
1294 (union sysparam_all_entry *)&entry_DRAGFULLWINDOWS,
1295 (union sysparam_all_entry *)&entry_DRAGHEIGHT,
1296 (union sysparam_all_entry *)&entry_DRAGWIDTH,
1297 (union sysparam_all_entry *)&entry_FOCUSBORDERHEIGHT,
1298 (union sysparam_all_entry *)&entry_FOCUSBORDERWIDTH,
1299 (union sysparam_all_entry *)&entry_FONTSMOOTHING,
1300 (union sysparam_all_entry *)&entry_FONTSMOOTHINGCONTRAST,
1301 (union sysparam_all_entry *)&entry_FONTSMOOTHINGORIENTATION,
1302 (union sysparam_all_entry *)&entry_FONTSMOOTHINGTYPE,
1303 (union sysparam_all_entry *)&entry_FOREGROUNDFLASHCOUNT,
1304 (union sysparam_all_entry *)&entry_FOREGROUNDLOCKTIMEOUT,
1305 (union sysparam_all_entry *)&entry_ICONHORIZONTALSPACING,
1306 (union sysparam_all_entry *)&entry_ICONSIZE,
1307 (union sysparam_all_entry *)&entry_ICONTITLEWRAP,
1308 (union sysparam_all_entry *)&entry_ICONVERTICALSPACING,
1309 (union sysparam_all_entry *)&entry_KEYBOARDDELAY,
1310 (union sysparam_all_entry *)&entry_KEYBOARDPREF,
1311 (union sysparam_all_entry *)&entry_KEYBOARDSPEED,
1312 (union sysparam_all_entry *)&entry_LOWPOWERACTIVE,
1313 (union sysparam_all_entry *)&entry_MENUHEIGHT,
1314 (union sysparam_all_entry *)&entry_MENUSHOWDELAY,
1315 (union sysparam_all_entry *)&entry_MENUWIDTH,
1316 (union sysparam_all_entry *)&entry_MOUSEACCELERATION,
1317 (union sysparam_all_entry *)&entry_MOUSEBUTTONSWAP,
1318 (union sysparam_all_entry *)&entry_MOUSECLICKLOCKTIME,
1319 (union sysparam_all_entry *)&entry_MOUSEHOVERHEIGHT,
1320 (union sysparam_all_entry *)&entry_MOUSEHOVERTIME,
1321 (union sysparam_all_entry *)&entry_MOUSEHOVERWIDTH,
1322 (union sysparam_all_entry *)&entry_MOUSESPEED,
1323 (union sysparam_all_entry *)&entry_MOUSETHRESHOLD1,
1324 (union sysparam_all_entry *)&entry_MOUSETHRESHOLD2,
1325 (union sysparam_all_entry *)&entry_PADDEDBORDERWIDTH,
1326 (union sysparam_all_entry *)&entry_SCREENREADER,
1327 (union sysparam_all_entry *)&entry_SCROLLHEIGHT,
1328 (union sysparam_all_entry *)&entry_SCROLLWIDTH,
1329 (union sysparam_all_entry *)&entry_SHOWSOUNDS,
1330 (union sysparam_all_entry *)&entry_SMCAPTIONHEIGHT,
1331 (union sysparam_all_entry *)&entry_SMCAPTIONWIDTH,
1332 (union sysparam_all_entry *)&entry_SNAPTODEFBUTTON,
1333 (union sysparam_all_entry *)&entry_USERPREFERENCESMASK,
1334 (union sysparam_all_entry *)&entry_WHEELSCROLLCHARS,
1335 (union sysparam_all_entry *)&entry_WHEELSCROLLLINES,
1338 /***********************************************************************
1339 * SYSPARAMS_Init
1341 void SYSPARAMS_Init(void)
1343 HKEY key;
1344 DWORD i, dispos;
1346 /* this one must be non-volatile */
1347 if (RegCreateKeyW( HKEY_CURRENT_USER, WINE_CURRENT_USER_REGKEY, &key ))
1349 ERR("Can't create wine registry branch\n");
1350 return;
1353 /* @@ Wine registry key: HKCU\Software\Wine\Temporary System Parameters */
1354 if (RegCreateKeyExW( key, WINE_CURRENT_USER_REGKEY_TEMP_PARAMS, 0, 0,
1355 REG_OPTION_VOLATILE, KEY_ALL_ACCESS, 0, &volatile_base_key, &dispos ))
1356 ERR("Can't create non-permanent wine registry branch\n");
1358 RegCloseKey( key );
1360 if (volatile_base_key && dispos == REG_CREATED_NEW_KEY) /* first process, initialize entries */
1362 for (i = 0; i < sizeof(default_entries)/sizeof(default_entries[0]); i++)
1363 default_entries[i]->hdr.init( default_entries[i] );
1367 static BOOL update_desktop_wallpaper(void)
1369 DWORD pid;
1371 if (GetWindowThreadProcessId( GetDesktopWindow(), &pid ) && pid == GetCurrentProcessId())
1373 WCHAR wallpaper[MAX_PATH], pattern[256];
1375 entry_DESKWALLPAPER.hdr.loaded = entry_DESKPATTERN.hdr.loaded = FALSE;
1376 if (get_entry( &entry_DESKWALLPAPER, MAX_PATH, wallpaper ) &&
1377 get_entry( &entry_DESKPATTERN, 256, pattern ))
1378 update_wallpaper( wallpaper, pattern );
1380 else SendMessageW( GetDesktopWindow(), WM_SETTINGCHANGE, SPI_SETDESKWALLPAPER, 0 );
1381 return TRUE;
1384 /***********************************************************************
1385 * SystemParametersInfoW (USER32.@)
1387 * Each system parameter has flag which shows whether the parameter
1388 * is loaded or not. Parameters, stored directly in SysParametersInfo are
1389 * loaded from registry only when they are requested and the flag is
1390 * "false", after the loading the flag is set to "true". On interprocess
1391 * notification of the parameter change the corresponding parameter flag is
1392 * set to "false". The parameter value will be reloaded when it is requested
1393 * the next time.
1394 * Parameters, backed by or depend on GetSystemMetrics are processed
1395 * differently. These parameters are always loaded. They are reloaded right
1396 * away on interprocess change notification. We can't do lazy loading because
1397 * we don't want to complicate GetSystemMetrics.
1398 * Parameters, backed by X settings are read from corresponding setting.
1399 * On the parameter change request the setting is changed. Interprocess change
1400 * notifications are ignored.
1401 * When parameter value is updated the changed value is stored in permanent
1402 * registry branch if saving is requested. Otherwise it is stored
1403 * in temporary branch
1405 * Some SPI values can also be stored as Twips values in the registry,
1406 * don't forget the conversion!
1408 BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
1409 PVOID pvParam, UINT fWinIni )
1411 #define WINE_SPI_FIXME(x) \
1412 case x: \
1414 static BOOL warn = TRUE; \
1415 if (warn) \
1417 warn = FALSE; \
1418 FIXME( "Unimplemented action: %u (%s)\n", x, #x ); \
1421 SetLastError( ERROR_INVALID_SPI_VALUE ); \
1422 ret = FALSE; \
1423 break
1424 #define WINE_SPI_WARN(x) \
1425 case x: \
1426 WARN( "Ignored action: %u (%s)\n", x, #x ); \
1427 ret = TRUE; \
1428 break
1430 BOOL ret = USER_Driver->pSystemParametersInfo( uiAction, uiParam, pvParam, fWinIni );
1431 unsigned spi_idx = 0;
1433 if (!ret) switch (uiAction)
1435 case SPI_GETBEEP:
1436 ret = get_entry( &entry_BEEP, uiParam, pvParam );
1437 break;
1438 case SPI_SETBEEP:
1439 ret = set_entry( &entry_BEEP, uiParam, pvParam, fWinIni );
1440 break;
1441 case SPI_GETMOUSE:
1442 ret = get_entry( &entry_MOUSETHRESHOLD1, uiParam, (INT *)pvParam ) &&
1443 get_entry( &entry_MOUSETHRESHOLD2, uiParam, (INT *)pvParam + 1 ) &&
1444 get_entry( &entry_MOUSEACCELERATION, uiParam, (INT *)pvParam + 2 );
1445 break;
1446 case SPI_SETMOUSE:
1447 ret = set_entry( &entry_MOUSETHRESHOLD1, ((INT *)pvParam)[0], pvParam, fWinIni ) &&
1448 set_entry( &entry_MOUSETHRESHOLD2, ((INT *)pvParam)[1], pvParam, fWinIni ) &&
1449 set_entry( &entry_MOUSEACCELERATION, ((INT *)pvParam)[2], pvParam, fWinIni );
1450 break;
1451 case SPI_GETBORDER:
1452 ret = get_entry( &entry_BORDER, uiParam, pvParam );
1453 if (*(INT*)pvParam < 1) *(INT*)pvParam = 1;
1454 break;
1455 case SPI_SETBORDER:
1456 ret = set_entry( &entry_BORDER, uiParam, pvParam, fWinIni );
1457 break;
1458 case SPI_GETKEYBOARDSPEED:
1459 ret = get_entry( &entry_KEYBOARDSPEED, uiParam, pvParam );
1460 break;
1461 case SPI_SETKEYBOARDSPEED:
1462 if (uiParam > 31) uiParam = 31;
1463 ret = set_entry( &entry_KEYBOARDSPEED, uiParam, pvParam, fWinIni );
1464 break;
1466 /* not implemented in Windows */
1467 WINE_SPI_WARN(SPI_LANGDRIVER); /* 12 */
1469 case SPI_ICONHORIZONTALSPACING:
1470 if (pvParam != NULL)
1471 ret = get_entry( &entry_ICONHORIZONTALSPACING, uiParam, pvParam );
1472 else
1473 ret = set_entry( &entry_ICONHORIZONTALSPACING, max( 32, uiParam ), pvParam, fWinIni );
1474 break;
1475 case SPI_GETSCREENSAVETIMEOUT:
1476 ret = get_entry( &entry_SCREENSAVETIMEOUT, uiParam, pvParam );
1477 break;
1478 case SPI_SETSCREENSAVETIMEOUT:
1479 ret = set_entry( &entry_SCREENSAVETIMEOUT, uiParam, pvParam, fWinIni );
1480 break;
1481 case SPI_GETSCREENSAVEACTIVE:
1482 ret = get_entry( &entry_SCREENSAVEACTIVE, uiParam, pvParam );
1483 break;
1484 case SPI_SETSCREENSAVEACTIVE:
1485 ret = set_entry( &entry_SCREENSAVEACTIVE, uiParam, pvParam, fWinIni );
1486 break;
1487 case SPI_GETGRIDGRANULARITY:
1488 ret = get_entry( &entry_GRIDGRANULARITY, uiParam, pvParam );
1489 break;
1490 case SPI_SETGRIDGRANULARITY:
1491 ret = set_entry( &entry_GRIDGRANULARITY, uiParam, pvParam, fWinIni );
1492 break;
1493 case SPI_SETDESKWALLPAPER:
1494 if (!pvParam || set_entry( &entry_DESKWALLPAPER, uiParam, pvParam, fWinIni ))
1495 ret = update_desktop_wallpaper();
1496 break;
1497 case SPI_SETDESKPATTERN:
1498 if (!pvParam || set_entry( &entry_DESKPATTERN, uiParam, pvParam, fWinIni ))
1499 ret = update_desktop_wallpaper();
1500 break;
1501 case SPI_GETKEYBOARDDELAY:
1502 ret = get_entry( &entry_KEYBOARDDELAY, uiParam, pvParam );
1503 break;
1504 case SPI_SETKEYBOARDDELAY:
1505 ret = set_entry( &entry_KEYBOARDDELAY, uiParam, pvParam, fWinIni );
1506 break;
1507 case SPI_ICONVERTICALSPACING:
1508 if (pvParam != NULL)
1509 ret = get_entry( &entry_ICONVERTICALSPACING, uiParam, pvParam );
1510 else
1511 ret = set_entry( &entry_ICONVERTICALSPACING, max( 32, uiParam ), pvParam, fWinIni );
1512 break;
1513 case SPI_GETICONTITLEWRAP:
1514 ret = get_entry( &entry_ICONTITLEWRAP, uiParam, pvParam );
1515 break;
1516 case SPI_SETICONTITLEWRAP:
1517 ret = set_entry( &entry_ICONTITLEWRAP, uiParam, pvParam, fWinIni );
1518 break;
1519 case SPI_GETMENUDROPALIGNMENT:
1520 ret = get_entry( &entry_MENUDROPALIGNMENT, uiParam, pvParam );
1521 break;
1522 case SPI_SETMENUDROPALIGNMENT:
1523 ret = set_entry( &entry_MENUDROPALIGNMENT, uiParam, pvParam, fWinIni );
1524 break;
1525 case SPI_SETDOUBLECLKWIDTH:
1526 ret = set_entry( &entry_DOUBLECLKWIDTH, uiParam, pvParam, fWinIni );
1527 break;
1528 case SPI_SETDOUBLECLKHEIGHT:
1529 ret = set_entry( &entry_DOUBLECLKHEIGHT, uiParam, pvParam, fWinIni );
1530 break;
1531 case SPI_GETICONTITLELOGFONT:
1532 ret = get_entry( &entry_ICONTITLELOGFONT, uiParam, pvParam );
1533 break;
1534 case SPI_SETDOUBLECLICKTIME:
1535 ret = set_entry( &entry_DOUBLECLICKTIME, uiParam, pvParam, fWinIni );
1536 break;
1537 case SPI_SETMOUSEBUTTONSWAP:
1538 ret = set_entry( &entry_MOUSEBUTTONSWAP, uiParam, pvParam, fWinIni );
1539 break;
1540 case SPI_SETICONTITLELOGFONT:
1541 ret = set_entry( &entry_ICONTITLELOGFONT, uiParam, pvParam, fWinIni );
1542 break;
1544 case SPI_GETFASTTASKSWITCH: /* 35 */
1545 if (!pvParam) return FALSE;
1546 *(BOOL *)pvParam = TRUE;
1547 ret = TRUE;
1548 break;
1550 case SPI_SETFASTTASKSWITCH: /* 36 */
1551 /* the action is disabled */
1552 ret = FALSE;
1553 break;
1555 case SPI_SETDRAGFULLWINDOWS:
1556 ret = set_entry( &entry_DRAGFULLWINDOWS, uiParam, pvParam, fWinIni );
1557 break;
1558 case SPI_GETDRAGFULLWINDOWS:
1559 ret = get_entry( &entry_DRAGFULLWINDOWS, uiParam, pvParam );
1560 break;
1561 case SPI_GETNONCLIENTMETRICS:
1563 LPNONCLIENTMETRICSW lpnm = pvParam;
1565 if (!pvParam) return FALSE;
1567 ret = get_entry( &entry_BORDER, 0, &lpnm->iBorderWidth ) &&
1568 get_entry( &entry_SCROLLWIDTH, 0, &lpnm->iScrollWidth ) &&
1569 get_entry( &entry_SCROLLHEIGHT, 0, &lpnm->iScrollHeight ) &&
1570 get_entry( &entry_CAPTIONWIDTH, 0, &lpnm->iCaptionWidth ) &&
1571 get_entry( &entry_CAPTIONHEIGHT, 0, &lpnm->iCaptionHeight ) &&
1572 get_entry( &entry_CAPTIONLOGFONT, 0, &lpnm->lfCaptionFont ) &&
1573 get_entry( &entry_SMCAPTIONWIDTH, 0, &lpnm->iSmCaptionWidth ) &&
1574 get_entry( &entry_SMCAPTIONHEIGHT, 0, &lpnm->iSmCaptionHeight ) &&
1575 get_entry( &entry_SMCAPTIONLOGFONT, 0, &lpnm->lfSmCaptionFont ) &&
1576 get_entry( &entry_MENUWIDTH, 0, &lpnm->iMenuWidth ) &&
1577 get_entry( &entry_MENUHEIGHT, 0, &lpnm->iMenuHeight ) &&
1578 get_entry( &entry_MENULOGFONT, 0, &lpnm->lfMenuFont ) &&
1579 get_entry( &entry_STATUSLOGFONT, 0, &lpnm->lfStatusFont ) &&
1580 get_entry( &entry_MESSAGELOGFONT, 0, &lpnm->lfMessageFont );
1581 if (ret && lpnm->cbSize == sizeof(NONCLIENTMETRICSW))
1582 ret = get_entry( &entry_PADDEDBORDERWIDTH, 0, &lpnm->iPaddedBorderWidth );
1583 normalize_nonclientmetrics( lpnm );
1584 break;
1586 case SPI_SETNONCLIENTMETRICS:
1588 LPNONCLIENTMETRICSW lpnm = pvParam;
1590 if (lpnm && (lpnm->cbSize == sizeof(NONCLIENTMETRICSW) ||
1591 lpnm->cbSize == FIELD_OFFSET(NONCLIENTMETRICSW, iPaddedBorderWidth)))
1593 ret = set_entry( &entry_BORDER, lpnm->iBorderWidth, NULL, fWinIni ) &&
1594 set_entry( &entry_SCROLLWIDTH, lpnm->iScrollWidth, NULL, fWinIni ) &&
1595 set_entry( &entry_SCROLLHEIGHT, lpnm->iScrollHeight, NULL, fWinIni ) &&
1596 set_entry( &entry_CAPTIONWIDTH, lpnm->iCaptionWidth, NULL, fWinIni ) &&
1597 set_entry( &entry_CAPTIONHEIGHT, lpnm->iCaptionHeight, NULL, fWinIni ) &&
1598 set_entry( &entry_SMCAPTIONWIDTH, lpnm->iSmCaptionWidth, NULL, fWinIni ) &&
1599 set_entry( &entry_SMCAPTIONHEIGHT, lpnm->iSmCaptionHeight, NULL, fWinIni ) &&
1600 set_entry( &entry_MENUWIDTH, lpnm->iMenuWidth, NULL, fWinIni ) &&
1601 set_entry( &entry_MENUHEIGHT, lpnm->iMenuHeight, NULL, fWinIni ) &&
1602 set_entry( &entry_MENULOGFONT, 0, &lpnm->lfMenuFont, fWinIni ) &&
1603 set_entry( &entry_CAPTIONLOGFONT, 0, &lpnm->lfCaptionFont, fWinIni ) &&
1604 set_entry( &entry_SMCAPTIONLOGFONT, 0, &lpnm->lfSmCaptionFont, fWinIni ) &&
1605 set_entry( &entry_STATUSLOGFONT, 0, &lpnm->lfStatusFont, fWinIni ) &&
1606 set_entry( &entry_MESSAGELOGFONT, 0, &lpnm->lfMessageFont, fWinIni );
1608 if (ret && lpnm->cbSize == sizeof(NONCLIENTMETRICSW))
1609 set_entry( &entry_PADDEDBORDERWIDTH, lpnm->iPaddedBorderWidth, NULL, fWinIni );
1611 break;
1613 case SPI_GETMINIMIZEDMETRICS:
1615 MINIMIZEDMETRICS * lpMm = pvParam;
1616 if (lpMm && lpMm->cbSize == sizeof(*lpMm)) {
1617 ret = get_entry( &entry_MINWIDTH, 0, &lpMm->iWidth ) &&
1618 get_entry( &entry_MINHORZGAP, 0, &lpMm->iHorzGap ) &&
1619 get_entry( &entry_MINVERTGAP, 0, &lpMm->iVertGap ) &&
1620 get_entry( &entry_MINARRANGE, 0, &lpMm->iArrange );
1621 lpMm->iWidth = max( 0, lpMm->iWidth );
1622 lpMm->iHorzGap = max( 0, lpMm->iHorzGap );
1623 lpMm->iVertGap = max( 0, lpMm->iVertGap );
1624 lpMm->iArrange &= 0x0f;
1626 break;
1628 case SPI_SETMINIMIZEDMETRICS:
1630 MINIMIZEDMETRICS * lpMm = pvParam;
1631 if (lpMm && lpMm->cbSize == sizeof(*lpMm))
1632 ret = set_entry( &entry_MINWIDTH, max( 0, lpMm->iWidth ), NULL, fWinIni ) &&
1633 set_entry( &entry_MINHORZGAP, max( 0, lpMm->iHorzGap ), NULL, fWinIni ) &&
1634 set_entry( &entry_MINVERTGAP, max( 0, lpMm->iVertGap ), NULL, fWinIni ) &&
1635 set_entry( &entry_MINARRANGE, lpMm->iArrange & 0x0f, NULL, fWinIni );
1636 break;
1638 case SPI_GETICONMETRICS:
1640 LPICONMETRICSW lpIcon = pvParam;
1641 if(lpIcon && lpIcon->cbSize == sizeof(*lpIcon))
1643 ret = get_entry( &entry_ICONHORIZONTALSPACING, 0, &lpIcon->iHorzSpacing ) &&
1644 get_entry( &entry_ICONVERTICALSPACING, 0, &lpIcon->iVertSpacing ) &&
1645 get_entry( &entry_ICONTITLEWRAP, 0, &lpIcon->iTitleWrap ) &&
1646 get_entry( &entry_ICONTITLELOGFONT, 0, &lpIcon->lfFont );
1648 break;
1650 case SPI_SETICONMETRICS:
1652 LPICONMETRICSW lpIcon = pvParam;
1653 if (lpIcon && lpIcon->cbSize == sizeof(*lpIcon))
1654 ret = set_entry( &entry_ICONVERTICALSPACING, max(32,lpIcon->iVertSpacing), NULL, fWinIni ) &&
1655 set_entry( &entry_ICONHORIZONTALSPACING, max(32,lpIcon->iHorzSpacing), NULL, fWinIni ) &&
1656 set_entry( &entry_ICONTITLEWRAP, lpIcon->iTitleWrap, NULL, fWinIni ) &&
1657 set_entry( &entry_ICONTITLELOGFONT, 0, &lpIcon->lfFont, fWinIni );
1658 break;
1661 case SPI_SETWORKAREA: /* 47 WINVER >= 0x400 */
1663 if (!pvParam) return FALSE;
1665 spi_idx = SPI_SETWORKAREA_IDX;
1666 CopyRect( &work_area, pvParam );
1667 spi_loaded[spi_idx] = TRUE;
1668 ret = TRUE;
1669 break;
1672 case SPI_GETWORKAREA: /* 48 WINVER >= 0x400 */
1674 if (!pvParam) return FALSE;
1676 spi_idx = SPI_SETWORKAREA_IDX;
1677 if (!spi_loaded[spi_idx])
1679 SetRect( &work_area, 0, 0,
1680 GetSystemMetrics( SM_CXSCREEN ),
1681 GetSystemMetrics( SM_CYSCREEN ) );
1682 EnumDisplayMonitors( 0, NULL, enum_monitors, (LPARAM)&work_area );
1683 spi_loaded[spi_idx] = TRUE;
1685 CopyRect( pvParam, &work_area );
1686 ret = TRUE;
1687 TRACE("work area %s\n", wine_dbgstr_rect( &work_area ));
1688 break;
1691 WINE_SPI_FIXME(SPI_SETPENWINDOWS); /* 49 WINVER >= 0x400 */
1693 case SPI_GETFILTERKEYS: /* 50 */
1695 LPFILTERKEYS lpFilterKeys = pvParam;
1696 WARN("SPI_GETFILTERKEYS not fully implemented\n");
1697 if (lpFilterKeys && lpFilterKeys->cbSize == sizeof(FILTERKEYS))
1699 /* Indicate that no FilterKeys feature available */
1700 lpFilterKeys->dwFlags = 0;
1701 lpFilterKeys->iWaitMSec = 0;
1702 lpFilterKeys->iDelayMSec = 0;
1703 lpFilterKeys->iRepeatMSec = 0;
1704 lpFilterKeys->iBounceMSec = 0;
1705 ret = TRUE;
1707 break;
1709 WINE_SPI_FIXME(SPI_SETFILTERKEYS); /* 51 */
1711 case SPI_GETTOGGLEKEYS: /* 52 */
1713 LPTOGGLEKEYS lpToggleKeys = pvParam;
1714 WARN("SPI_GETTOGGLEKEYS not fully implemented\n");
1715 if (lpToggleKeys && lpToggleKeys->cbSize == sizeof(TOGGLEKEYS))
1717 /* Indicate that no ToggleKeys feature available */
1718 lpToggleKeys->dwFlags = 0;
1719 ret = TRUE;
1721 break;
1723 WINE_SPI_FIXME(SPI_SETTOGGLEKEYS); /* 53 */
1725 case SPI_GETMOUSEKEYS: /* 54 */
1727 LPMOUSEKEYS lpMouseKeys = pvParam;
1728 WARN("SPI_GETMOUSEKEYS not fully implemented\n");
1729 if (lpMouseKeys && lpMouseKeys->cbSize == sizeof(MOUSEKEYS))
1731 /* Indicate that no MouseKeys feature available */
1732 lpMouseKeys->dwFlags = 0;
1733 lpMouseKeys->iMaxSpeed = 360;
1734 lpMouseKeys->iTimeToMaxSpeed = 1000;
1735 lpMouseKeys->iCtrlSpeed = 0;
1736 lpMouseKeys->dwReserved1 = 0;
1737 lpMouseKeys->dwReserved2 = 0;
1738 ret = TRUE;
1740 break;
1742 WINE_SPI_FIXME(SPI_SETMOUSEKEYS); /* 55 */
1744 case SPI_GETSHOWSOUNDS:
1745 ret = get_entry( &entry_SHOWSOUNDS, uiParam, pvParam );
1746 break;
1747 case SPI_SETSHOWSOUNDS:
1748 ret = set_entry( &entry_SHOWSOUNDS, uiParam, pvParam, fWinIni );
1749 break;
1751 case SPI_GETSTICKYKEYS: /* 58 */
1753 LPSTICKYKEYS lpStickyKeys = pvParam;
1754 WARN("SPI_GETSTICKYKEYS not fully implemented\n");
1755 if (lpStickyKeys && lpStickyKeys->cbSize == sizeof(STICKYKEYS))
1757 /* Indicate that no StickyKeys feature available */
1758 lpStickyKeys->dwFlags = 0;
1759 ret = TRUE;
1761 break;
1763 WINE_SPI_FIXME(SPI_SETSTICKYKEYS); /* 59 */
1765 case SPI_GETACCESSTIMEOUT: /* 60 */
1767 LPACCESSTIMEOUT lpAccessTimeout = pvParam;
1768 WARN("SPI_GETACCESSTIMEOUT not fully implemented\n");
1769 if (lpAccessTimeout && lpAccessTimeout->cbSize == sizeof(ACCESSTIMEOUT))
1771 /* Indicate that no accessibility features timeout is available */
1772 lpAccessTimeout->dwFlags = 0;
1773 lpAccessTimeout->iTimeOutMSec = 0;
1774 ret = TRUE;
1776 break;
1778 WINE_SPI_FIXME(SPI_SETACCESSTIMEOUT); /* 61 */
1780 case SPI_GETSERIALKEYS: /* 62 WINVER >= 0x400 */
1782 LPSERIALKEYSW lpSerialKeysW = pvParam;
1783 WARN("SPI_GETSERIALKEYS not fully implemented\n");
1784 if (lpSerialKeysW && lpSerialKeysW->cbSize == sizeof(SERIALKEYSW))
1786 /* Indicate that no SerialKeys feature available */
1787 lpSerialKeysW->dwFlags = 0;
1788 lpSerialKeysW->lpszActivePort = NULL;
1789 lpSerialKeysW->lpszPort = NULL;
1790 lpSerialKeysW->iBaudRate = 0;
1791 lpSerialKeysW->iPortState = 0;
1792 ret = TRUE;
1794 break;
1796 WINE_SPI_FIXME(SPI_SETSERIALKEYS); /* 63 WINVER >= 0x400 */
1798 case SPI_GETSOUNDSENTRY: /* 64 */
1800 LPSOUNDSENTRYW lpSoundSentryW = pvParam;
1801 WARN("SPI_GETSOUNDSENTRY not fully implemented\n");
1802 if (lpSoundSentryW && lpSoundSentryW->cbSize == sizeof(SOUNDSENTRYW))
1804 /* Indicate that no SoundSentry feature available */
1805 lpSoundSentryW->dwFlags = 0;
1806 lpSoundSentryW->iFSTextEffect = 0;
1807 lpSoundSentryW->iFSTextEffectMSec = 0;
1808 lpSoundSentryW->iFSTextEffectColorBits = 0;
1809 lpSoundSentryW->iFSGrafEffect = 0;
1810 lpSoundSentryW->iFSGrafEffectMSec = 0;
1811 lpSoundSentryW->iFSGrafEffectColor = 0;
1812 lpSoundSentryW->iWindowsEffect = 0;
1813 lpSoundSentryW->iWindowsEffectMSec = 0;
1814 lpSoundSentryW->lpszWindowsEffectDLL = 0;
1815 lpSoundSentryW->iWindowsEffectOrdinal = 0;
1816 ret = TRUE;
1818 break;
1820 WINE_SPI_FIXME(SPI_SETSOUNDSENTRY); /* 65 */
1822 case SPI_GETHIGHCONTRAST: /* 66 WINVER >= 0x400 */
1824 LPHIGHCONTRASTW lpHighContrastW = pvParam;
1825 WARN("SPI_GETHIGHCONTRAST not fully implemented\n");
1826 if (lpHighContrastW && lpHighContrastW->cbSize == sizeof(HIGHCONTRASTW))
1828 /* Indicate that no high contrast feature available */
1829 lpHighContrastW->dwFlags = 0;
1830 lpHighContrastW->lpszDefaultScheme = NULL;
1831 ret = TRUE;
1833 break;
1835 WINE_SPI_FIXME(SPI_SETHIGHCONTRAST); /* 67 WINVER >= 0x400 */
1837 case SPI_GETKEYBOARDPREF:
1838 ret = get_entry( &entry_KEYBOARDPREF, uiParam, pvParam );
1839 break;
1840 case SPI_SETKEYBOARDPREF:
1841 ret = set_entry( &entry_KEYBOARDPREF, uiParam, pvParam, fWinIni );
1842 break;
1843 case SPI_GETSCREENREADER:
1844 ret = get_entry( &entry_SCREENREADER, uiParam, pvParam );
1845 break;
1846 case SPI_SETSCREENREADER:
1847 ret = set_entry( &entry_SCREENREADER, uiParam, pvParam, fWinIni );
1848 break;
1850 case SPI_GETANIMATION: /* 72 WINVER >= 0x400 */
1852 LPANIMATIONINFO lpAnimInfo = pvParam;
1854 /* Tell it "disabled" */
1855 if (lpAnimInfo && lpAnimInfo->cbSize == sizeof(ANIMATIONINFO))
1857 lpAnimInfo->iMinAnimate = 0; /* Minimise and restore animation is disabled (nonzero == enabled) */
1858 ret = TRUE;
1860 break;
1862 WINE_SPI_WARN(SPI_SETANIMATION); /* 73 WINVER >= 0x400 */
1864 case SPI_GETFONTSMOOTHING:
1865 ret = get_entry( &entry_FONTSMOOTHING, uiParam, pvParam );
1866 if (ret) *(UINT *)pvParam = (*(UINT *)pvParam != 0);
1867 break;
1868 case SPI_SETFONTSMOOTHING:
1869 uiParam = uiParam ? 2 : 0; /* Win NT4/2k/XP behavior */
1870 ret = set_entry( &entry_FONTSMOOTHING, uiParam, pvParam, fWinIni );
1871 break;
1872 case SPI_SETDRAGWIDTH:
1873 ret = set_entry( &entry_DRAGWIDTH, uiParam, pvParam, fWinIni );
1874 break;
1875 case SPI_SETDRAGHEIGHT:
1876 ret = set_entry( &entry_DRAGHEIGHT, uiParam, pvParam, fWinIni );
1877 break;
1879 WINE_SPI_FIXME(SPI_SETHANDHELD); /* 78 WINVER >= 0x400 */
1881 WINE_SPI_FIXME(SPI_GETLOWPOWERTIMEOUT); /* 79 WINVER >= 0x400 */
1882 WINE_SPI_FIXME(SPI_GETPOWEROFFTIMEOUT); /* 80 WINVER >= 0x400 */
1883 WINE_SPI_FIXME(SPI_SETLOWPOWERTIMEOUT); /* 81 WINVER >= 0x400 */
1884 WINE_SPI_FIXME(SPI_SETPOWEROFFTIMEOUT); /* 82 WINVER >= 0x400 */
1886 case SPI_GETLOWPOWERACTIVE:
1887 ret = get_entry( &entry_LOWPOWERACTIVE, uiParam, pvParam );
1888 break;
1889 case SPI_SETLOWPOWERACTIVE:
1890 ret = set_entry( &entry_LOWPOWERACTIVE, uiParam, pvParam, fWinIni );
1891 break;
1892 case SPI_GETPOWEROFFACTIVE:
1893 ret = get_entry( &entry_POWEROFFACTIVE, uiParam, pvParam );
1894 break;
1895 case SPI_SETPOWEROFFACTIVE:
1896 ret = set_entry( &entry_POWEROFFACTIVE, uiParam, pvParam, fWinIni );
1897 break;
1899 WINE_SPI_FIXME(SPI_SETCURSORS); /* 87 WINVER >= 0x400 */
1900 WINE_SPI_FIXME(SPI_SETICONS); /* 88 WINVER >= 0x400 */
1902 case SPI_GETDEFAULTINPUTLANG: /* 89 WINVER >= 0x400 */
1903 ret = GetKeyboardLayout(0) != 0;
1904 break;
1906 WINE_SPI_FIXME(SPI_SETDEFAULTINPUTLANG); /* 90 WINVER >= 0x400 */
1908 WINE_SPI_FIXME(SPI_SETLANGTOGGLE); /* 91 WINVER >= 0x400 */
1910 case SPI_GETWINDOWSEXTENSION: /* 92 WINVER >= 0x400 */
1911 WARN("pretend no support for Win9x Plus! for now.\n");
1912 ret = FALSE; /* yes, this is the result value */
1913 break;
1914 case SPI_SETMOUSETRAILS:
1915 ret = set_entry( &entry_MOUSETRAILS, uiParam, pvParam, fWinIni );
1916 break;
1917 case SPI_GETMOUSETRAILS:
1918 ret = get_entry( &entry_MOUSETRAILS, uiParam, pvParam );
1919 break;
1920 case SPI_GETSNAPTODEFBUTTON:
1921 ret = get_entry( &entry_SNAPTODEFBUTTON, uiParam, pvParam );
1922 break;
1923 case SPI_SETSNAPTODEFBUTTON:
1924 ret = set_entry( &entry_SNAPTODEFBUTTON, uiParam, pvParam, fWinIni );
1925 break;
1926 case SPI_SETSCREENSAVERRUNNING:
1927 ret = set_entry( &entry_SCREENSAVERRUNNING, uiParam, pvParam, fWinIni );
1928 break;
1929 case SPI_GETMOUSEHOVERWIDTH:
1930 ret = get_entry( &entry_MOUSEHOVERWIDTH, uiParam, pvParam );
1931 break;
1932 case SPI_SETMOUSEHOVERWIDTH:
1933 ret = set_entry( &entry_MOUSEHOVERWIDTH, uiParam, pvParam, fWinIni );
1934 break;
1935 case SPI_GETMOUSEHOVERHEIGHT:
1936 ret = get_entry( &entry_MOUSEHOVERHEIGHT, uiParam, pvParam );
1937 break;
1938 case SPI_SETMOUSEHOVERHEIGHT:
1939 ret = set_entry( &entry_MOUSEHOVERHEIGHT, uiParam, pvParam, fWinIni );
1940 break;
1941 case SPI_GETMOUSEHOVERTIME:
1942 ret = get_entry( &entry_MOUSEHOVERTIME, uiParam, pvParam );
1943 break;
1944 case SPI_SETMOUSEHOVERTIME:
1945 ret = set_entry( &entry_MOUSEHOVERTIME, uiParam, pvParam, fWinIni );
1946 break;
1947 case SPI_GETWHEELSCROLLLINES:
1948 ret = get_entry( &entry_WHEELSCROLLLINES, uiParam, pvParam );
1949 break;
1950 case SPI_SETWHEELSCROLLLINES:
1951 ret = set_entry( &entry_WHEELSCROLLLINES, uiParam, pvParam, fWinIni );
1952 break;
1953 case SPI_GETMENUSHOWDELAY:
1954 ret = get_entry( &entry_MENUSHOWDELAY, uiParam, pvParam );
1955 break;
1956 case SPI_SETMENUSHOWDELAY:
1957 ret = set_entry( &entry_MENUSHOWDELAY, uiParam, pvParam, fWinIni );
1958 break;
1959 case SPI_GETWHEELSCROLLCHARS:
1960 ret = get_entry( &entry_WHEELSCROLLCHARS, uiParam, pvParam );
1961 break;
1962 case SPI_SETWHEELSCROLLCHARS:
1963 ret = set_entry( &entry_WHEELSCROLLCHARS, uiParam, pvParam, fWinIni );
1964 break;
1966 WINE_SPI_FIXME(SPI_GETSHOWIMEUI); /* 110 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
1967 WINE_SPI_FIXME(SPI_SETSHOWIMEUI); /* 111 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
1969 case SPI_GETMOUSESPEED:
1970 ret = get_entry( &entry_MOUSESPEED, uiParam, pvParam );
1971 break;
1972 case SPI_SETMOUSESPEED:
1973 ret = set_entry( &entry_MOUSESPEED, uiParam, pvParam, fWinIni );
1974 break;
1975 case SPI_GETSCREENSAVERRUNNING:
1976 ret = get_entry( &entry_SCREENSAVERRUNNING, uiParam, pvParam );
1977 break;
1978 case SPI_GETDESKWALLPAPER:
1979 ret = get_entry( &entry_DESKWALLPAPER, uiParam, pvParam );
1980 break;
1981 case SPI_GETACTIVEWINDOWTRACKING:
1982 ret = get_entry( &entry_ACTIVEWINDOWTRACKING, uiParam, pvParam );
1983 break;
1984 case SPI_SETACTIVEWINDOWTRACKING:
1985 ret = set_entry( &entry_ACTIVEWINDOWTRACKING, uiParam, pvParam, fWinIni );
1986 break;
1987 case SPI_GETMENUANIMATION:
1988 ret = get_entry( &entry_MENUANIMATION, uiParam, pvParam );
1989 break;
1990 case SPI_SETMENUANIMATION:
1991 ret = set_entry( &entry_MENUANIMATION, uiParam, pvParam, fWinIni );
1992 break;
1993 case SPI_GETCOMBOBOXANIMATION:
1994 ret = get_entry( &entry_COMBOBOXANIMATION, uiParam, pvParam );
1995 break;
1996 case SPI_SETCOMBOBOXANIMATION:
1997 ret = set_entry( &entry_COMBOBOXANIMATION, uiParam, pvParam, fWinIni );
1998 break;
1999 case SPI_GETLISTBOXSMOOTHSCROLLING:
2000 ret = get_entry( &entry_LISTBOXSMOOTHSCROLLING, uiParam, pvParam );
2001 break;
2002 case SPI_SETLISTBOXSMOOTHSCROLLING:
2003 ret = set_entry( &entry_LISTBOXSMOOTHSCROLLING, uiParam, pvParam, fWinIni );
2004 break;
2005 case SPI_GETGRADIENTCAPTIONS:
2006 ret = get_entry( &entry_GRADIENTCAPTIONS, uiParam, pvParam );
2007 break;
2008 case SPI_SETGRADIENTCAPTIONS:
2009 ret = set_entry( &entry_GRADIENTCAPTIONS, uiParam, pvParam, fWinIni );
2010 break;
2011 case SPI_GETKEYBOARDCUES:
2012 ret = get_entry( &entry_KEYBOARDCUES, uiParam, pvParam );
2013 break;
2014 case SPI_SETKEYBOARDCUES:
2015 ret = set_entry( &entry_KEYBOARDCUES, uiParam, pvParam, fWinIni );
2016 break;
2017 case SPI_GETACTIVEWNDTRKZORDER:
2018 ret = get_entry( &entry_ACTIVEWNDTRKZORDER, uiParam, pvParam );
2019 break;
2020 case SPI_SETACTIVEWNDTRKZORDER:
2021 ret = set_entry( &entry_ACTIVEWNDTRKZORDER, uiParam, pvParam, fWinIni );
2022 break;
2023 case SPI_GETHOTTRACKING:
2024 ret = get_entry( &entry_HOTTRACKING, uiParam, pvParam );
2025 break;
2026 case SPI_SETHOTTRACKING:
2027 ret = set_entry( &entry_HOTTRACKING, uiParam, pvParam, fWinIni );
2028 break;
2029 case SPI_GETMENUFADE:
2030 ret = get_entry( &entry_MENUFADE, uiParam, pvParam );
2031 break;
2032 case SPI_SETMENUFADE:
2033 ret = set_entry( &entry_MENUFADE, uiParam, pvParam, fWinIni );
2034 break;
2035 case SPI_GETSELECTIONFADE:
2036 ret = get_entry( &entry_SELECTIONFADE, uiParam, pvParam );
2037 break;
2038 case SPI_SETSELECTIONFADE:
2039 ret = set_entry( &entry_SELECTIONFADE, uiParam, pvParam, fWinIni );
2040 break;
2041 case SPI_GETTOOLTIPANIMATION:
2042 ret = get_entry( &entry_TOOLTIPANIMATION, uiParam, pvParam );
2043 break;
2044 case SPI_SETTOOLTIPANIMATION:
2045 ret = set_entry( &entry_TOOLTIPANIMATION, uiParam, pvParam, fWinIni );
2046 break;
2047 case SPI_GETTOOLTIPFADE:
2048 ret = get_entry( &entry_TOOLTIPFADE, uiParam, pvParam );
2049 break;
2050 case SPI_SETTOOLTIPFADE:
2051 ret = set_entry( &entry_TOOLTIPFADE, uiParam, pvParam, fWinIni );
2052 break;
2053 case SPI_GETCURSORSHADOW:
2054 ret = get_entry( &entry_CURSORSHADOW, uiParam, pvParam );
2055 break;
2056 case SPI_SETCURSORSHADOW:
2057 ret = set_entry( &entry_CURSORSHADOW, uiParam, pvParam, fWinIni );
2058 break;
2059 case SPI_GETMOUSESONAR:
2060 ret = get_entry( &entry_MOUSESONAR, uiParam, pvParam );
2061 break;
2062 case SPI_SETMOUSESONAR:
2063 ret = set_entry( &entry_MOUSESONAR, uiParam, pvParam, fWinIni );
2064 break;
2065 case SPI_GETMOUSECLICKLOCK:
2066 ret = get_entry( &entry_MOUSECLICKLOCK, uiParam, pvParam );
2067 break;
2068 case SPI_SETMOUSECLICKLOCK:
2069 ret = set_entry( &entry_MOUSECLICKLOCK, uiParam, pvParam, fWinIni );
2070 break;
2071 case SPI_GETMOUSEVANISH:
2072 ret = get_entry( &entry_MOUSEVANISH, uiParam, pvParam );
2073 break;
2074 case SPI_SETMOUSEVANISH:
2075 ret = set_entry( &entry_MOUSEVANISH, uiParam, pvParam, fWinIni );
2076 break;
2077 case SPI_GETFLATMENU:
2078 ret = get_entry( &entry_FLATMENU, uiParam, pvParam );
2079 break;
2080 case SPI_SETFLATMENU:
2081 ret = set_entry( &entry_FLATMENU, uiParam, pvParam, fWinIni );
2082 break;
2083 case SPI_GETDROPSHADOW:
2084 ret = get_entry( &entry_DROPSHADOW, uiParam, pvParam );
2085 break;
2086 case SPI_SETDROPSHADOW:
2087 ret = set_entry( &entry_DROPSHADOW, uiParam, pvParam, fWinIni );
2088 break;
2089 case SPI_GETBLOCKSENDINPUTRESETS:
2090 ret = get_entry( &entry_BLOCKSENDINPUTRESETS, uiParam, pvParam );
2091 break;
2092 case SPI_SETBLOCKSENDINPUTRESETS:
2093 ret = set_entry( &entry_BLOCKSENDINPUTRESETS, uiParam, pvParam, fWinIni );
2094 break;
2095 case SPI_GETUIEFFECTS:
2096 ret = get_entry( &entry_UIEFFECTS, uiParam, pvParam );
2097 break;
2098 case SPI_SETUIEFFECTS:
2099 /* FIXME: this probably should mask other UI effect values when unset */
2100 ret = set_entry( &entry_UIEFFECTS, uiParam, pvParam, fWinIni );
2101 break;
2102 case SPI_GETDISABLEOVERLAPPEDCONTENT:
2103 ret = get_entry( &entry_DISABLEOVERLAPPEDCONTENT, uiParam, pvParam );
2104 break;
2105 case SPI_SETDISABLEOVERLAPPEDCONTENT:
2106 ret = set_entry( &entry_DISABLEOVERLAPPEDCONTENT, uiParam, pvParam, fWinIni );
2107 break;
2108 case SPI_GETCLIENTAREAANIMATION:
2109 ret = get_entry( &entry_CLIENTAREAANIMATION, uiParam, pvParam );
2110 break;
2111 case SPI_SETCLIENTAREAANIMATION:
2112 ret = set_entry( &entry_CLIENTAREAANIMATION, uiParam, pvParam, fWinIni );
2113 break;
2114 case SPI_GETCLEARTYPE:
2115 ret = get_entry( &entry_CLEARTYPE, uiParam, pvParam );
2116 break;
2117 case SPI_SETCLEARTYPE:
2118 ret = set_entry( &entry_CLEARTYPE, uiParam, pvParam, fWinIni );
2119 break;
2120 case SPI_GETSPEECHRECOGNITION:
2121 ret = get_entry( &entry_SPEECHRECOGNITION, uiParam, pvParam );
2122 break;
2123 case SPI_SETSPEECHRECOGNITION:
2124 ret = set_entry( &entry_SPEECHRECOGNITION, uiParam, pvParam, fWinIni );
2125 break;
2126 case SPI_GETFOREGROUNDLOCKTIMEOUT:
2127 ret = get_entry( &entry_FOREGROUNDLOCKTIMEOUT, uiParam, pvParam );
2128 break;
2129 case SPI_SETFOREGROUNDLOCKTIMEOUT:
2130 /* FIXME: this should check that the calling thread
2131 * is able to change the foreground window */
2132 ret = set_entry( &entry_FOREGROUNDLOCKTIMEOUT, uiParam, pvParam, fWinIni );
2133 break;
2134 case SPI_GETACTIVEWNDTRKTIMEOUT:
2135 ret = get_entry( &entry_ACTIVEWNDTRKTIMEOUT, uiParam, pvParam );
2136 break;
2137 case SPI_SETACTIVEWNDTRKTIMEOUT:
2138 ret = get_entry( &entry_ACTIVEWNDTRKTIMEOUT, uiParam, pvParam );
2139 break;
2140 case SPI_GETFOREGROUNDFLASHCOUNT:
2141 ret = get_entry( &entry_FOREGROUNDFLASHCOUNT, uiParam, pvParam );
2142 break;
2143 case SPI_SETFOREGROUNDFLASHCOUNT:
2144 ret = set_entry( &entry_FOREGROUNDFLASHCOUNT, uiParam, pvParam, fWinIni );
2145 break;
2146 case SPI_GETCARETWIDTH:
2147 ret = get_entry( &entry_CARETWIDTH, uiParam, pvParam );
2148 break;
2149 case SPI_SETCARETWIDTH:
2150 ret = set_entry( &entry_CARETWIDTH, uiParam, pvParam, fWinIni );
2151 break;
2152 case SPI_GETMOUSECLICKLOCKTIME:
2153 ret = get_entry( &entry_MOUSECLICKLOCKTIME, uiParam, pvParam );
2154 break;
2155 case SPI_SETMOUSECLICKLOCKTIME:
2156 ret = set_entry( &entry_MOUSECLICKLOCKTIME, uiParam, pvParam, fWinIni );
2157 break;
2158 case SPI_GETFONTSMOOTHINGTYPE:
2159 ret = get_entry( &entry_FONTSMOOTHINGTYPE, uiParam, pvParam );
2160 break;
2161 case SPI_SETFONTSMOOTHINGTYPE:
2162 ret = set_entry( &entry_FONTSMOOTHINGTYPE, uiParam, pvParam, fWinIni );
2163 break;
2164 case SPI_GETFONTSMOOTHINGCONTRAST:
2165 ret = get_entry( &entry_FONTSMOOTHINGCONTRAST, uiParam, pvParam );
2166 break;
2167 case SPI_SETFONTSMOOTHINGCONTRAST:
2168 ret = set_entry( &entry_FONTSMOOTHINGCONTRAST, uiParam, pvParam, fWinIni );
2169 break;
2170 case SPI_GETFOCUSBORDERWIDTH:
2171 ret = get_entry( &entry_FOCUSBORDERWIDTH, uiParam, pvParam );
2172 break;
2173 case SPI_GETFOCUSBORDERHEIGHT:
2174 ret = get_entry( &entry_FOCUSBORDERHEIGHT, uiParam, pvParam );
2175 break;
2176 case SPI_SETFOCUSBORDERWIDTH:
2177 ret = set_entry( &entry_FOCUSBORDERWIDTH, uiParam, pvParam, fWinIni );
2178 break;
2179 case SPI_SETFOCUSBORDERHEIGHT:
2180 ret = set_entry( &entry_FOCUSBORDERHEIGHT, uiParam, pvParam, fWinIni );
2181 break;
2182 case SPI_GETFONTSMOOTHINGORIENTATION:
2183 ret = get_entry( &entry_FONTSMOOTHINGORIENTATION, uiParam, pvParam );
2184 break;
2185 case SPI_SETFONTSMOOTHINGORIENTATION:
2186 ret = set_entry( &entry_FONTSMOOTHINGORIENTATION, uiParam, pvParam, fWinIni );
2187 break;
2189 default:
2190 FIXME( "Unknown action: %u\n", uiAction );
2191 SetLastError( ERROR_INVALID_SPI_VALUE );
2192 ret = FALSE;
2193 break;
2196 if (ret)
2197 SYSPARAMS_NotifyChange( uiAction, fWinIni );
2198 TRACE("(%u, %u, %p, %u) ret %d\n",
2199 uiAction, uiParam, pvParam, fWinIni, ret);
2200 return ret;
2202 #undef WINE_SPI_FIXME
2203 #undef WINE_SPI_WARN
2207 /***********************************************************************
2208 * SystemParametersInfoA (USER32.@)
2210 BOOL WINAPI SystemParametersInfoA( UINT uiAction, UINT uiParam,
2211 PVOID pvParam, UINT fuWinIni )
2213 BOOL ret;
2215 TRACE("(%u, %u, %p, %u)\n", uiAction, uiParam, pvParam, fuWinIni);
2217 switch (uiAction)
2219 case SPI_SETDESKWALLPAPER: /* 20 */
2220 case SPI_SETDESKPATTERN: /* 21 */
2222 WCHAR buffer[256];
2223 if (pvParam)
2224 if (!MultiByteToWideChar( CP_ACP, 0, pvParam, -1, buffer,
2225 sizeof(buffer)/sizeof(WCHAR) ))
2226 buffer[sizeof(buffer)/sizeof(WCHAR)-1] = 0;
2227 ret = SystemParametersInfoW( uiAction, uiParam, pvParam ? buffer : NULL, fuWinIni );
2228 break;
2231 case SPI_GETICONTITLELOGFONT: /* 31 */
2233 LOGFONTW tmp;
2234 ret = SystemParametersInfoW( uiAction, uiParam, pvParam ? &tmp : NULL, fuWinIni );
2235 if (ret && pvParam)
2236 SYSPARAMS_LogFont32WTo32A( &tmp, pvParam );
2237 break;
2240 case SPI_GETNONCLIENTMETRICS: /* 41 WINVER >= 0x400 */
2242 NONCLIENTMETRICSW tmp;
2243 LPNONCLIENTMETRICSA lpnmA = pvParam;
2244 if (lpnmA && (lpnmA->cbSize == sizeof(NONCLIENTMETRICSA) ||
2245 lpnmA->cbSize == FIELD_OFFSET(NONCLIENTMETRICSA, iPaddedBorderWidth)))
2247 tmp.cbSize = sizeof(NONCLIENTMETRICSW);
2248 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2249 if (ret)
2250 SYSPARAMS_NonClientMetrics32WTo32A( &tmp, lpnmA );
2252 else
2253 ret = FALSE;
2254 break;
2257 case SPI_SETNONCLIENTMETRICS: /* 42 WINVER >= 0x400 */
2259 NONCLIENTMETRICSW tmp;
2260 LPNONCLIENTMETRICSA lpnmA = pvParam;
2261 if (lpnmA && (lpnmA->cbSize == sizeof(NONCLIENTMETRICSA) ||
2262 lpnmA->cbSize == FIELD_OFFSET(NONCLIENTMETRICSA, iPaddedBorderWidth)))
2264 tmp.cbSize = sizeof(NONCLIENTMETRICSW);
2265 SYSPARAMS_NonClientMetrics32ATo32W( lpnmA, &tmp );
2266 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2268 else
2269 ret = FALSE;
2270 break;
2273 case SPI_GETICONMETRICS: /* 45 WINVER >= 0x400 */
2275 ICONMETRICSW tmp;
2276 LPICONMETRICSA lpimA = pvParam;
2277 if (lpimA && lpimA->cbSize == sizeof(ICONMETRICSA))
2279 tmp.cbSize = sizeof(ICONMETRICSW);
2280 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2281 if (ret)
2283 lpimA->iHorzSpacing = tmp.iHorzSpacing;
2284 lpimA->iVertSpacing = tmp.iVertSpacing;
2285 lpimA->iTitleWrap = tmp.iTitleWrap;
2286 SYSPARAMS_LogFont32WTo32A( &tmp.lfFont, &lpimA->lfFont );
2289 else
2290 ret = FALSE;
2291 break;
2294 case SPI_SETICONMETRICS: /* 46 WINVER >= 0x400 */
2296 ICONMETRICSW tmp;
2297 LPICONMETRICSA lpimA = pvParam;
2298 if (lpimA && lpimA->cbSize == sizeof(ICONMETRICSA))
2300 tmp.cbSize = sizeof(ICONMETRICSW);
2301 tmp.iHorzSpacing = lpimA->iHorzSpacing;
2302 tmp.iVertSpacing = lpimA->iVertSpacing;
2303 tmp.iTitleWrap = lpimA->iTitleWrap;
2304 SYSPARAMS_LogFont32ATo32W( &lpimA->lfFont, &tmp.lfFont);
2305 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2307 else
2308 ret = FALSE;
2309 break;
2312 case SPI_GETHIGHCONTRAST: /* 66 WINVER >= 0x400 */
2314 HIGHCONTRASTW tmp;
2315 LPHIGHCONTRASTA lphcA = pvParam;
2316 if (lphcA && lphcA->cbSize == sizeof(HIGHCONTRASTA))
2318 tmp.cbSize = sizeof(HIGHCONTRASTW);
2319 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2320 if (ret)
2322 lphcA->dwFlags = tmp.dwFlags;
2323 lphcA->lpszDefaultScheme = NULL; /* FIXME? */
2326 else
2327 ret = FALSE;
2328 break;
2331 case SPI_GETDESKWALLPAPER: /* 115 */
2333 WCHAR buffer[MAX_PATH];
2334 ret = (SystemParametersInfoW( SPI_GETDESKWALLPAPER, uiParam, buffer, fuWinIni ) &&
2335 WideCharToMultiByte(CP_ACP, 0, buffer, -1, pvParam, uiParam, NULL, NULL));
2336 break;
2339 default:
2340 ret = SystemParametersInfoW( uiAction, uiParam, pvParam, fuWinIni );
2341 break;
2343 return ret;
2347 /***********************************************************************
2348 * GetSystemMetrics (USER32.@)
2350 INT WINAPI GetSystemMetrics( INT index )
2352 NONCLIENTMETRICSW ncm;
2353 UINT ret;
2355 /* some metrics are dynamic */
2356 switch (index)
2358 case SM_CXSCREEN:
2359 return GetDeviceCaps( get_display_dc(), HORZRES );
2360 case SM_CYSCREEN:
2361 return GetDeviceCaps( get_display_dc(), VERTRES );
2362 case SM_CXVSCROLL:
2363 case SM_CYHSCROLL:
2364 get_entry( &entry_SCROLLWIDTH, 0, &ret );
2365 return max( 8, ret );
2366 case SM_CYCAPTION:
2367 return GetSystemMetrics( SM_CYSIZE ) + 1;
2368 case SM_CXBORDER:
2369 case SM_CYBORDER:
2370 /* SM_C{X,Y}BORDER always returns 1 regardless of 'BorderWidth' value in registry */
2371 return 1;
2372 case SM_CXDLGFRAME:
2373 case SM_CYDLGFRAME:
2374 return 3;
2375 case SM_CYVTHUMB:
2376 case SM_CXHTHUMB:
2377 case SM_CYVSCROLL:
2378 case SM_CXHSCROLL:
2379 get_entry( &entry_SCROLLHEIGHT, 0, &ret );
2380 return max( 8, ret );
2381 case SM_CXICON:
2382 case SM_CYICON:
2383 get_entry( &entry_ICONSIZE, 0, &ret );
2384 return ret;
2385 case SM_CXCURSOR:
2386 case SM_CYCURSOR:
2387 return 32;
2388 case SM_CYMENU:
2389 return GetSystemMetrics(SM_CYMENUSIZE) + 1;
2390 case SM_CXFULLSCREEN:
2391 /* see the remark for SM_CXMAXIMIZED, at least this formulation is
2392 * correct */
2393 return GetSystemMetrics( SM_CXMAXIMIZED) - 2 * GetSystemMetrics( SM_CXFRAME);
2394 case SM_CYFULLSCREEN:
2395 /* see the remark for SM_CYMAXIMIZED, at least this formulation is
2396 * correct */
2397 return GetSystemMetrics( SM_CYMAXIMIZED) - GetSystemMetrics( SM_CYMIN);
2398 case SM_CYKANJIWINDOW:
2399 return 0;
2400 case SM_MOUSEPRESENT:
2401 return 1;
2402 case SM_DEBUG:
2403 return 0;
2404 case SM_SWAPBUTTON:
2405 get_entry( &entry_MOUSEBUTTONSWAP, 0, &ret );
2406 return ret;
2407 case SM_RESERVED1:
2408 case SM_RESERVED2:
2409 case SM_RESERVED3:
2410 case SM_RESERVED4:
2411 return 0;
2412 case SM_CXMIN:
2413 ncm.cbSize = sizeof(ncm);
2414 SystemParametersInfoW( SPI_GETNONCLIENTMETRICS, 0, &ncm, 0 );
2415 get_text_metr_size( get_display_dc(), &ncm.lfCaptionFont, NULL, &ret );
2416 return 3 * ncm.iCaptionWidth + ncm.iCaptionHeight + 4 * ret + 2 * GetSystemMetrics(SM_CXFRAME) + 4;
2417 case SM_CYMIN:
2418 return GetSystemMetrics( SM_CYCAPTION) + 2 * GetSystemMetrics( SM_CYFRAME);
2419 case SM_CXSIZE:
2420 get_entry( &entry_CAPTIONWIDTH, 0, &ret );
2421 return max( 8, ret );
2422 case SM_CYSIZE:
2423 ncm.cbSize = sizeof(ncm);
2424 SystemParametersInfoW( SPI_GETNONCLIENTMETRICS, 0, &ncm, 0 );
2425 return ncm.iCaptionHeight;
2426 case SM_CXFRAME:
2427 get_entry( &entry_BORDER, 0, &ret );
2428 return GetSystemMetrics(SM_CXDLGFRAME) + max( 1, ret );
2429 case SM_CYFRAME:
2430 get_entry( &entry_BORDER, 0, &ret );
2431 return GetSystemMetrics(SM_CYDLGFRAME) + max( 1, ret );
2432 case SM_CXMINTRACK:
2433 return GetSystemMetrics(SM_CXMIN);
2434 case SM_CYMINTRACK:
2435 return GetSystemMetrics(SM_CYMIN);
2436 case SM_CXDOUBLECLK:
2437 get_entry( &entry_DOUBLECLKWIDTH, 0, &ret );
2438 return ret;
2439 case SM_CYDOUBLECLK:
2440 get_entry( &entry_DOUBLECLKHEIGHT, 0, &ret );
2441 return ret;
2442 case SM_CXICONSPACING:
2443 get_entry( &entry_ICONHORIZONTALSPACING, 0, &ret );
2444 return ret;
2445 case SM_CYICONSPACING:
2446 get_entry( &entry_ICONVERTICALSPACING, 0, &ret );
2447 return ret;
2448 case SM_MENUDROPALIGNMENT:
2449 get_entry( &entry_MENUDROPALIGNMENT, 0, &ret );
2450 return ret;
2451 case SM_PENWINDOWS:
2452 return 0;
2453 case SM_DBCSENABLED:
2455 CPINFO cpinfo;
2456 GetCPInfo( CP_ACP, &cpinfo );
2457 return (cpinfo.MaxCharSize > 1);
2459 case SM_CMOUSEBUTTONS:
2460 return 3;
2461 case SM_SECURE:
2462 return 0;
2463 case SM_CXEDGE:
2464 return GetSystemMetrics(SM_CXBORDER) + 1;
2465 case SM_CYEDGE:
2466 return GetSystemMetrics(SM_CYBORDER) + 1;
2467 case SM_CXMINSPACING:
2468 get_entry( &entry_MINHORZGAP, 0, &ret );
2469 return GetSystemMetrics(SM_CXMINIMIZED) + max( 0, (INT)ret );
2470 case SM_CYMINSPACING:
2471 get_entry( &entry_MINVERTGAP, 0, &ret );
2472 return GetSystemMetrics(SM_CYMINIMIZED) + max( 0, (INT)ret );
2473 case SM_CXSMICON:
2474 case SM_CYSMICON:
2475 return 16;
2476 case SM_CYSMCAPTION:
2477 return GetSystemMetrics(SM_CYSMSIZE) + 1;
2478 case SM_CXSMSIZE:
2479 get_entry( &entry_SMCAPTIONWIDTH, 0, &ret );
2480 return ret;
2481 case SM_CYSMSIZE:
2482 ncm.cbSize = sizeof(ncm);
2483 SystemParametersInfoW( SPI_GETNONCLIENTMETRICS, 0, &ncm, 0 );
2484 return ncm.iSmCaptionHeight;
2485 case SM_CXMENUSIZE:
2486 get_entry( &entry_MENUWIDTH, 0, &ret );
2487 return ret;
2488 case SM_CYMENUSIZE:
2489 ncm.cbSize = sizeof(ncm);
2490 SystemParametersInfoW( SPI_GETNONCLIENTMETRICS, 0, &ncm, 0 );
2491 return ncm.iMenuHeight;
2492 case SM_ARRANGE:
2493 get_entry( &entry_MINARRANGE, 0, &ret );
2494 return ret & 0x0f;
2495 case SM_CXMINIMIZED:
2496 get_entry( &entry_MINWIDTH, 0, &ret );
2497 return max( 0, (INT)ret ) + 6;
2498 case SM_CYMINIMIZED:
2499 return GetSystemMetrics( SM_CYSIZE ) + 6;
2500 case SM_CXMAXTRACK:
2501 return GetSystemMetrics(SM_CXVIRTUALSCREEN) + 4 + 2 * GetSystemMetrics(SM_CXFRAME);
2502 case SM_CYMAXTRACK:
2503 return GetSystemMetrics(SM_CYVIRTUALSCREEN) + 4 + 2 * GetSystemMetrics(SM_CYFRAME);
2504 case SM_CXMAXIMIZED:
2505 /* FIXME: subtract the width of any vertical application toolbars*/
2506 return GetSystemMetrics(SM_CXSCREEN) + 2 * GetSystemMetrics(SM_CXFRAME);
2507 case SM_CYMAXIMIZED:
2508 /* FIXME: subtract the width of any horizontal application toolbars*/
2509 return GetSystemMetrics(SM_CYSCREEN) + 2 * GetSystemMetrics(SM_CYCAPTION);
2510 case SM_NETWORK:
2511 return 3; /* FIXME */
2512 case SM_CLEANBOOT:
2513 return 0; /* 0 = ok, 1 = failsafe, 2 = failsafe + network */
2514 case SM_CXDRAG:
2515 get_entry( &entry_DRAGWIDTH, 0, &ret );
2516 return ret;
2517 case SM_CYDRAG:
2518 get_entry( &entry_DRAGHEIGHT, 0, &ret );
2519 return ret;
2520 case SM_SHOWSOUNDS:
2521 get_entry( &entry_SHOWSOUNDS, 0, &ret );
2522 return ret;
2523 case SM_CXMENUCHECK:
2524 case SM_CYMENUCHECK:
2526 TEXTMETRICW tm;
2527 ncm.cbSize = sizeof(ncm);
2528 SystemParametersInfoW( SPI_GETNONCLIENTMETRICS, 0, &ncm, 0 );
2529 get_text_metr_size( get_display_dc(), &ncm.lfMenuFont, &tm, NULL);
2530 return tm.tmHeight <= 0 ? 13 : ((tm.tmHeight + tm.tmExternalLeading + 1) / 2) * 2 - 1;
2532 case SM_SLOWMACHINE:
2533 return 0; /* Never true */
2534 case SM_MIDEASTENABLED:
2535 return 0; /* FIXME */
2536 case SM_MOUSEWHEELPRESENT:
2537 return 1;
2538 case SM_XVIRTUALSCREEN:
2540 RECT rect = get_virtual_screen_rect();
2541 return rect.left;
2543 case SM_YVIRTUALSCREEN:
2545 RECT rect = get_virtual_screen_rect();
2546 return rect.top;
2548 case SM_CXVIRTUALSCREEN:
2550 RECT rect = get_virtual_screen_rect();
2551 return rect.right - rect.left;
2553 case SM_CYVIRTUALSCREEN:
2555 RECT rect = get_virtual_screen_rect();
2556 return rect.bottom - rect.top;
2558 case SM_CMONITORS:
2560 struct monitor_info info;
2561 get_monitors_info( &info );
2562 return info.count;
2564 case SM_SAMEDISPLAYFORMAT:
2565 return 1;
2566 case SM_IMMENABLED:
2567 return 0; /* FIXME */
2568 case SM_CXFOCUSBORDER:
2569 case SM_CYFOCUSBORDER:
2570 return 1;
2571 case SM_TABLETPC:
2572 case SM_MEDIACENTER:
2573 return 0;
2574 case SM_CMETRICS:
2575 return SM_CMETRICS;
2576 default:
2577 return 0;
2582 /***********************************************************************
2583 * SwapMouseButton (USER32.@)
2584 * Reverse or restore the meaning of the left and right mouse buttons
2585 * fSwap [I ] TRUE - reverse, FALSE - original
2586 * RETURN
2587 * previous state
2589 BOOL WINAPI SwapMouseButton( BOOL fSwap )
2591 BOOL prev = GetSystemMetrics(SM_SWAPBUTTON);
2592 SystemParametersInfoW(SPI_SETMOUSEBUTTONSWAP, fSwap, 0, 0);
2593 return prev;
2597 /**********************************************************************
2598 * SetDoubleClickTime (USER32.@)
2600 BOOL WINAPI SetDoubleClickTime( UINT interval )
2602 return SystemParametersInfoW(SPI_SETDOUBLECLICKTIME, interval, 0, 0);
2606 /**********************************************************************
2607 * GetDoubleClickTime (USER32.@)
2609 UINT WINAPI GetDoubleClickTime(void)
2611 UINT time = 0;
2613 get_entry( &entry_DOUBLECLICKTIME, 0, &time );
2614 if (!time) time = 500;
2615 return time;
2619 /*************************************************************************
2620 * GetSysColor (USER32.@)
2622 COLORREF WINAPI DECLSPEC_HOTPATCH GetSysColor( INT nIndex )
2624 COLORREF ret = 0;
2626 if (nIndex >= 0 && nIndex < NUM_SYS_COLORS) get_entry( &system_colors[nIndex], 0, &ret );
2627 return ret;
2631 /*************************************************************************
2632 * SetSysColors (USER32.@)
2634 BOOL WINAPI SetSysColors( INT count, const INT *colors, const COLORREF *values )
2636 int i;
2638 if (IS_INTRESOURCE(colors)) return FALSE; /* stupid app passes a color instead of an array */
2640 for (i = 0; i < count; i++)
2641 if (colors[i] >= 0 && colors[i] <= NUM_SYS_COLORS)
2642 set_entry( &system_colors[colors[i]], values[i], 0, 0 );
2644 /* Send WM_SYSCOLORCHANGE message to all windows */
2646 SendMessageTimeoutW( HWND_BROADCAST, WM_SYSCOLORCHANGE, 0, 0, SMTO_ABORTIFHUNG, 2000, NULL );
2648 /* Repaint affected portions of all visible windows */
2650 RedrawWindow( GetDesktopWindow(), NULL, 0,
2651 RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN );
2652 return TRUE;
2656 /*************************************************************************
2657 * SetSysColorsTemp (USER32.@)
2659 DWORD_PTR WINAPI SetSysColorsTemp( const COLORREF *pPens, const HBRUSH *pBrushes, DWORD_PTR n)
2661 FIXME( "no longer supported\n" );
2662 return FALSE;
2666 /***********************************************************************
2667 * GetSysColorBrush (USER32.@)
2669 HBRUSH WINAPI DECLSPEC_HOTPATCH GetSysColorBrush( INT index )
2671 if (index < 0 || index >= NUM_SYS_COLORS) return 0;
2673 if (!system_colors[index].brush)
2675 HBRUSH brush = CreateSolidBrush( GetSysColor( index ));
2676 __wine_make_gdi_object_system( brush, TRUE );
2677 if (InterlockedCompareExchangePointer( (void **)&system_colors[index].brush, brush, 0 ))
2679 __wine_make_gdi_object_system( brush, FALSE );
2680 DeleteObject( brush );
2683 return system_colors[index].brush;
2687 /***********************************************************************
2688 * SYSCOLOR_GetPen
2690 HPEN SYSCOLOR_GetPen( INT index )
2692 /* We can assert here, because this function is internal to Wine */
2693 assert (0 <= index && index < NUM_SYS_COLORS);
2695 if (!system_colors[index].pen)
2697 HPEN pen = CreatePen( PS_SOLID, 1, GetSysColor( index ));
2698 __wine_make_gdi_object_system( pen, TRUE );
2699 if (InterlockedCompareExchangePointer( (void **)&system_colors[index].pen, pen, 0 ))
2701 __wine_make_gdi_object_system( pen, FALSE );
2702 DeleteObject( pen );
2705 return system_colors[index].pen;
2709 /***********************************************************************
2710 * SYSCOLOR_Get55AABrush
2712 HBRUSH SYSCOLOR_Get55AABrush(void)
2714 static const WORD pattern[] = { 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa };
2715 static HBRUSH brush_55aa;
2717 if (!brush_55aa)
2719 HBITMAP bitmap = CreateBitmap( 8, 8, 1, 1, pattern );
2720 HBRUSH brush = CreatePatternBrush( bitmap );
2721 DeleteObject( bitmap );
2722 __wine_make_gdi_object_system( brush, TRUE );
2723 if (InterlockedCompareExchangePointer( (void **)&brush_55aa, brush, 0 ))
2725 __wine_make_gdi_object_system( brush, FALSE );
2726 DeleteObject( brush );
2729 return brush_55aa;
2732 /***********************************************************************
2733 * ChangeDisplaySettingsA (USER32.@)
2735 LONG WINAPI ChangeDisplaySettingsA( LPDEVMODEA devmode, DWORD flags )
2737 if (devmode) devmode->dmDriverExtra = 0;
2739 return ChangeDisplaySettingsExA(NULL,devmode,NULL,flags,NULL);
2743 /***********************************************************************
2744 * ChangeDisplaySettingsW (USER32.@)
2746 LONG WINAPI ChangeDisplaySettingsW( LPDEVMODEW devmode, DWORD flags )
2748 if (devmode) devmode->dmDriverExtra = 0;
2750 return ChangeDisplaySettingsExW(NULL,devmode,NULL,flags,NULL);
2754 /***********************************************************************
2755 * ChangeDisplaySettingsExA (USER32.@)
2757 LONG WINAPI ChangeDisplaySettingsExA( LPCSTR devname, LPDEVMODEA devmode, HWND hwnd,
2758 DWORD flags, LPVOID lparam )
2760 LONG ret;
2761 UNICODE_STRING nameW;
2763 if (devname) RtlCreateUnicodeStringFromAsciiz(&nameW, devname);
2764 else nameW.Buffer = NULL;
2766 if (devmode)
2768 DEVMODEW *devmodeW;
2770 devmodeW = GdiConvertToDevmodeW(devmode);
2771 if (devmodeW)
2773 ret = ChangeDisplaySettingsExW(nameW.Buffer, devmodeW, hwnd, flags, lparam);
2774 HeapFree(GetProcessHeap(), 0, devmodeW);
2776 else
2777 ret = DISP_CHANGE_SUCCESSFUL;
2779 else
2781 ret = ChangeDisplaySettingsExW(nameW.Buffer, NULL, hwnd, flags, lparam);
2784 if (devname) RtlFreeUnicodeString(&nameW);
2785 return ret;
2789 /***********************************************************************
2790 * ChangeDisplaySettingsExW (USER32.@)
2792 LONG WINAPI ChangeDisplaySettingsExW( LPCWSTR devname, LPDEVMODEW devmode, HWND hwnd,
2793 DWORD flags, LPVOID lparam )
2795 return USER_Driver->pChangeDisplaySettingsEx( devname, devmode, hwnd, flags, lparam );
2799 /***********************************************************************
2800 * EnumDisplaySettingsW (USER32.@)
2802 * RETURNS
2803 * TRUE if nth setting exists found (described in the LPDEVMODEW struct)
2804 * FALSE if we do not have the nth setting
2806 BOOL WINAPI EnumDisplaySettingsW( LPCWSTR name, DWORD n, LPDEVMODEW devmode )
2808 return EnumDisplaySettingsExW(name, n, devmode, 0);
2812 /***********************************************************************
2813 * EnumDisplaySettingsA (USER32.@)
2815 BOOL WINAPI EnumDisplaySettingsA(LPCSTR name,DWORD n,LPDEVMODEA devmode)
2817 return EnumDisplaySettingsExA(name, n, devmode, 0);
2821 /***********************************************************************
2822 * EnumDisplaySettingsExA (USER32.@)
2824 BOOL WINAPI EnumDisplaySettingsExA(LPCSTR lpszDeviceName, DWORD iModeNum,
2825 LPDEVMODEA lpDevMode, DWORD dwFlags)
2827 DEVMODEW devmodeW;
2828 BOOL ret;
2829 UNICODE_STRING nameW;
2831 if (lpszDeviceName) RtlCreateUnicodeStringFromAsciiz(&nameW, lpszDeviceName);
2832 else nameW.Buffer = NULL;
2834 ret = EnumDisplaySettingsExW(nameW.Buffer,iModeNum,&devmodeW,dwFlags);
2835 if (ret)
2837 lpDevMode->dmSize = FIELD_OFFSET(DEVMODEA, dmICMMethod);
2838 lpDevMode->dmSpecVersion = devmodeW.dmSpecVersion;
2839 lpDevMode->dmDriverVersion = devmodeW.dmDriverVersion;
2840 WideCharToMultiByte(CP_ACP, 0, devmodeW.dmDeviceName, -1,
2841 (LPSTR)lpDevMode->dmDeviceName, CCHDEVICENAME, NULL, NULL);
2842 lpDevMode->dmDriverExtra = 0; /* FIXME */
2843 lpDevMode->dmBitsPerPel = devmodeW.dmBitsPerPel;
2844 lpDevMode->dmPelsHeight = devmodeW.dmPelsHeight;
2845 lpDevMode->dmPelsWidth = devmodeW.dmPelsWidth;
2846 lpDevMode->u2.dmDisplayFlags = devmodeW.u2.dmDisplayFlags;
2847 lpDevMode->dmDisplayFrequency = devmodeW.dmDisplayFrequency;
2848 lpDevMode->dmFields = devmodeW.dmFields;
2850 lpDevMode->u1.s2.dmPosition.x = devmodeW.u1.s2.dmPosition.x;
2851 lpDevMode->u1.s2.dmPosition.y = devmodeW.u1.s2.dmPosition.y;
2852 lpDevMode->u1.s2.dmDisplayOrientation = devmodeW.u1.s2.dmDisplayOrientation;
2853 lpDevMode->u1.s2.dmDisplayFixedOutput = devmodeW.u1.s2.dmDisplayFixedOutput;
2855 if (lpszDeviceName) RtlFreeUnicodeString(&nameW);
2856 return ret;
2860 /***********************************************************************
2861 * EnumDisplaySettingsExW (USER32.@)
2863 BOOL WINAPI EnumDisplaySettingsExW(LPCWSTR lpszDeviceName, DWORD iModeNum,
2864 LPDEVMODEW lpDevMode, DWORD dwFlags)
2866 return USER_Driver->pEnumDisplaySettingsEx(lpszDeviceName, iModeNum, lpDevMode, dwFlags);
2869 /***********************************************************************
2870 * SetProcessDPIAware (USER32.@)
2872 BOOL WINAPI SetProcessDPIAware( VOID )
2874 FIXME( "stub!\n");
2876 return TRUE;