d3d10: Initialise the type tree in D3D10CreateEffectFromMemory() (AFL).
[wine.git] / dlls / user32 / sysparams.c
bloba42a302853d1fda6cc9bc605755804dd1f651422
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;
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 static INT CALLBACK real_fontname_proc(const LOGFONTW *lf, const TEXTMETRICW *ntm, DWORD type, LPARAM lparam)
626 const ENUMLOGFONTW *elf = (const ENUMLOGFONTW *)lf;
627 LOGFONTW *lfW = (LOGFONTW *)lparam;
629 lstrcpynW(lfW->lfFaceName, elf->elfFullName, LF_FACESIZE);
630 return 0;
633 static void get_real_fontname(LOGFONTW *lf)
635 EnumFontFamiliesExW(get_display_dc(), lf, real_fontname_proc, (LPARAM)lf, 0);
638 /* adjust some of the raw values found in the registry */
639 static void normalize_nonclientmetrics( NONCLIENTMETRICSW *pncm)
641 TEXTMETRICW tm;
642 if( pncm->iBorderWidth < 1) pncm->iBorderWidth = 1;
643 if( pncm->iCaptionWidth < 8) pncm->iCaptionWidth = 8;
644 if( pncm->iScrollWidth < 8) pncm->iScrollWidth = 8;
645 if( pncm->iScrollHeight < 8) pncm->iScrollHeight = 8;
647 /* adjust some heights to the corresponding font */
648 get_text_metr_size( get_display_dc(), &pncm->lfMenuFont, &tm, NULL);
649 pncm->iMenuHeight = max( pncm->iMenuHeight, 2 + tm.tmHeight + tm.tmExternalLeading );
650 get_real_fontname( &pncm->lfMenuFont );
651 get_text_metr_size( get_display_dc(), &pncm->lfCaptionFont, &tm, NULL);
652 pncm->iCaptionHeight = max( pncm->iCaptionHeight, 2 + tm.tmHeight);
653 get_real_fontname( &pncm->lfCaptionFont );
654 get_text_metr_size( get_display_dc(), &pncm->lfSmCaptionFont, &tm, NULL);
655 pncm->iSmCaptionHeight = max( pncm->iSmCaptionHeight, 2 + tm.tmHeight);
656 get_real_fontname( &pncm->lfSmCaptionFont );
658 get_real_fontname( &pncm->lfStatusFont );
659 get_real_fontname( &pncm->lfMessageFont );
662 static BOOL CALLBACK enum_monitors( HMONITOR monitor, HDC hdc, LPRECT rect, LPARAM lp )
664 MONITORINFO mi;
666 mi.cbSize = sizeof(mi);
667 if (GetMonitorInfoW( monitor, &mi ) && (mi.dwFlags & MONITORINFOF_PRIMARY))
669 LPRECT work = (LPRECT)lp;
670 *work = mi.rcWork;
671 return FALSE;
673 return TRUE;
676 /* load a uint parameter from the registry */
677 static BOOL get_uint_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param )
679 if (!ptr_param) return FALSE;
681 if (!entry->hdr.loaded)
683 WCHAR buf[32];
685 if (load_entry( &entry->hdr, buf, sizeof(buf) )) entry->uint.val = atoiW( buf );
687 *(UINT *)ptr_param = entry->uint.val;
688 return TRUE;
691 /* set a uint parameter in the registry */
692 static BOOL set_uint_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param, UINT flags )
694 WCHAR buf[32];
696 wsprintfW( buf, CSu, int_param );
697 if (!save_entry_string( &entry->hdr, buf, flags )) return FALSE;
698 entry->uint.val = int_param;
699 entry->hdr.loaded = TRUE;
700 return TRUE;
703 /* initialize a uint parameter */
704 static BOOL init_uint_entry( union sysparam_all_entry *entry )
706 WCHAR buf[32];
708 wsprintfW( buf, CSu, entry->uint.val );
709 return init_entry_string( &entry->hdr, buf );
712 /* set an int parameter in the registry */
713 static BOOL set_int_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param, UINT flags )
715 WCHAR buf[32];
717 wsprintfW( buf, CSd, int_param );
718 if (!save_entry_string( &entry->hdr, buf, flags )) return FALSE;
719 entry->uint.val = int_param;
720 entry->hdr.loaded = TRUE;
721 return TRUE;
724 /* initialize an int parameter */
725 static BOOL init_int_entry( union sysparam_all_entry *entry )
727 WCHAR buf[32];
729 wsprintfW( buf, CSd, entry->uint.val );
730 return init_entry_string( &entry->hdr, buf );
733 /* load a twips parameter from the registry */
734 static BOOL get_twips_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param )
736 if (!ptr_param) return FALSE;
738 if (!entry->hdr.loaded)
740 WCHAR buf[32];
742 if (load_entry( &entry->hdr, buf, sizeof(buf) ))
744 int val = atoiW( buf );
745 /* Dimensions are quoted as being "twips" values if negative and pixels if positive.
746 * One inch is 1440 twips.
747 * See for example
748 * Technical Reference to the Windows 2000 Registry ->
749 * HKEY_CURRENT_USER -> Control Panel -> Desktop -> WindowMetrics
751 if (val < 0) val = (-val * get_display_dpi() + 720) / 1440;
752 entry->uint.val = val;
755 *(UINT *)ptr_param = entry->uint.val;
756 return TRUE;
759 /* load a bool parameter from the registry */
760 static BOOL get_bool_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param )
762 if (!ptr_param) return FALSE;
764 if (!entry->hdr.loaded)
766 WCHAR buf[32];
768 if (load_entry( &entry->hdr, buf, sizeof(buf) )) entry->bool.val = atoiW( buf ) != 0;
770 *(UINT *)ptr_param = entry->bool.val;
771 return TRUE;
774 /* set a bool parameter in the registry */
775 static BOOL set_bool_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param, UINT flags )
777 WCHAR buf[32];
779 wsprintfW( buf, CSu, int_param != 0 );
780 if (!save_entry_string( &entry->hdr, buf, flags )) return FALSE;
781 entry->bool.val = int_param != 0;
782 entry->hdr.loaded = TRUE;
783 return TRUE;
786 /* initialize a bool parameter */
787 static BOOL init_bool_entry( union sysparam_all_entry *entry )
789 WCHAR buf[32];
791 wsprintfW( buf, CSu, entry->bool.val != 0 );
792 return init_entry_string( &entry->hdr, buf );
795 /* load a bool parameter using Yes/No strings from the registry */
796 static BOOL get_yesno_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param )
798 if (!ptr_param) return FALSE;
800 if (!entry->hdr.loaded)
802 WCHAR buf[32];
804 if (load_entry( &entry->hdr, buf, sizeof(buf) )) entry->bool.val = !lstrcmpiW( Yes, buf );
806 *(UINT *)ptr_param = entry->bool.val;
807 return TRUE;
810 /* set a bool parameter using Yes/No strings from the registry */
811 static BOOL set_yesno_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param, UINT flags )
813 const WCHAR *str = int_param ? Yes : No;
815 if (!save_entry_string( &entry->hdr, str, flags )) return FALSE;
816 entry->bool.val = int_param != 0;
817 entry->hdr.loaded = TRUE;
818 return TRUE;
821 /* initialize a bool parameter using Yes/No strings */
822 static BOOL init_yesno_entry( union sysparam_all_entry *entry )
824 return init_entry_string( &entry->hdr, entry->bool.val ? Yes : No );
827 /* load a dword (binary) parameter from the registry */
828 static BOOL get_dword_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param )
830 if (!ptr_param) return FALSE;
832 if (!entry->hdr.loaded)
834 DWORD val;
835 if (load_entry( &entry->hdr, &val, sizeof(val) ) == sizeof(DWORD)) entry->dword.val = val;
837 *(DWORD *)ptr_param = entry->bool.val;
838 return TRUE;
841 /* set a dword (binary) parameter in the registry */
842 static BOOL set_dword_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param, UINT flags )
844 DWORD val = PtrToUlong( ptr_param );
846 if (!save_entry( &entry->hdr, &val, sizeof(val), REG_DWORD, flags )) return FALSE;
847 entry->dword.val = val;
848 entry->hdr.loaded = TRUE;
849 return TRUE;
852 /* initialize a dword parameter */
853 static BOOL init_dword_entry( union sysparam_all_entry *entry )
855 return init_entry( &entry->hdr, &entry->dword.val, sizeof(entry->dword.val), REG_DWORD );
858 /* load an RGB parameter from the registry */
859 static BOOL get_rgb_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param )
861 if (!ptr_param) return FALSE;
863 if (!entry->hdr.loaded)
865 WCHAR buf[32];
867 if (load_entry( &entry->hdr, buf, sizeof(buf) ))
869 DWORD r, g, b;
870 WCHAR *end, *str = buf;
872 r = strtoulW( str, &end, 10 );
873 if (end == str || !*end) goto done;
874 str = end + 1;
875 g = strtoulW( str, &end, 10 );
876 if (end == str || !*end) goto done;
877 str = end + 1;
878 b = strtoulW( str, &end, 10 );
879 if (end == str) goto done;
880 if (r > 255 || g > 255 || b > 255) goto done;
881 entry->rgb.val = RGB( r, g, b );
884 done:
885 *(COLORREF *)ptr_param = entry->rgb.val;
886 return TRUE;
889 /* set an RGB parameter in the registry */
890 static BOOL set_rgb_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param, UINT flags )
892 WCHAR buf[32];
893 HBRUSH brush;
894 HPEN pen;
896 wsprintfW( buf, CSrgb, GetRValue(int_param), GetGValue(int_param), GetBValue(int_param) );
897 if (!save_entry_string( &entry->hdr, buf, flags )) return FALSE;
898 entry->rgb.val = int_param;
899 entry->hdr.loaded = TRUE;
900 if ((brush = InterlockedExchangePointer( (void **)&entry->rgb.brush, 0 )))
902 __wine_make_gdi_object_system( brush, FALSE );
903 DeleteObject( brush );
905 if ((pen = InterlockedExchangePointer( (void **)&entry->rgb.pen, 0 )))
907 __wine_make_gdi_object_system( pen, FALSE );
908 DeleteObject( pen );
910 return TRUE;
913 /* initialize an RGB parameter */
914 static BOOL init_rgb_entry( union sysparam_all_entry *entry )
916 WCHAR buf[32];
918 wsprintfW( buf, CSrgb, GetRValue(entry->rgb.val), GetGValue(entry->rgb.val), GetBValue(entry->rgb.val) );
919 return init_entry_string( &entry->hdr, buf );
922 /* load a font (binary) parameter from the registry */
923 static BOOL get_font_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param )
925 if (!ptr_param) return FALSE;
927 if (!entry->hdr.loaded)
929 LOGFONTW font;
931 switch (load_entry( &entry->hdr, &font, sizeof(font) ))
933 case sizeof(font):
934 if (font.lfHeight > 0) /* positive height value means points ( inch/72 ) */
935 font.lfHeight = -MulDiv( font.lfHeight, get_display_dpi(), 72 );
936 entry->font.val = font;
937 break;
938 case sizeof(LOGFONT16): /* win9x-winME format */
939 SYSPARAMS_LogFont16To32W( (LOGFONT16 *)&font, &entry->font.val );
940 if (entry->font.val.lfHeight > 0)
941 entry->font.val.lfHeight = -MulDiv( entry->font.val.lfHeight, get_display_dpi(), 72 );
942 break;
943 default:
944 WARN( "Unknown format in key %s value %s\n",
945 debugstr_w( parameter_key_names[entry->hdr.regval[0]] ),
946 debugstr_w( entry->hdr.regval + 1 ));
947 /* fall through */
948 case 0: /* use the default GUI font */
949 GetObjectW( GetStockObject( DEFAULT_GUI_FONT ), sizeof(font), &font );
950 font.lfWeight = entry->font.weight;
951 entry->font.val = font;
952 break;
954 entry->hdr.loaded = TRUE;
956 *(LOGFONTW *)ptr_param = entry->font.val;
957 return TRUE;
960 /* set a font (binary) parameter in the registry */
961 static BOOL set_font_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param, UINT flags )
963 LOGFONTW font;
964 WCHAR *ptr;
966 memcpy( &font, ptr_param, sizeof(font) );
967 /* zero pad the end of lfFaceName so we don't save uninitialised data */
968 ptr = memchrW( font.lfFaceName, 0, LF_FACESIZE );
969 if (ptr) memset( ptr, 0, (font.lfFaceName + LF_FACESIZE - ptr) * sizeof(WCHAR) );
971 if (!save_entry( &entry->hdr, &font, sizeof(font), REG_BINARY, flags )) return FALSE;
972 entry->font.val = font;
973 entry->hdr.loaded = TRUE;
974 return TRUE;
977 /* initialize a font (binary) parameter */
978 static BOOL init_font_entry( union sysparam_all_entry *entry )
980 GetObjectW( GetStockObject( DEFAULT_GUI_FONT ), sizeof(entry->font.val), &entry->font.val );
981 entry->font.val.lfWeight = entry->font.weight;
982 return init_entry( &entry->hdr, &entry->font.val, sizeof(entry->font.val), REG_BINARY );
985 /* get a path parameter in the registry */
986 static BOOL get_path_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param )
988 if (!ptr_param) return FALSE;
990 if (!entry->hdr.loaded)
992 WCHAR buffer[MAX_PATH];
994 if (load_entry( &entry->hdr, buffer, sizeof(buffer) ))
995 lstrcpynW( entry->path.path, buffer, MAX_PATH );
997 lstrcpynW( ptr_param, entry->path.path, int_param );
998 return TRUE;
1001 /* set a path parameter in the registry */
1002 static BOOL set_path_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param, UINT flags )
1004 WCHAR buffer[MAX_PATH];
1005 BOOL ret;
1007 lstrcpynW( buffer, ptr_param, MAX_PATH );
1008 ret = save_entry_string( &entry->hdr, buffer, flags );
1009 if (ret)
1011 strcpyW( entry->path.path, buffer );
1012 entry->hdr.loaded = TRUE;
1014 return ret;
1017 /* initialize a path parameter */
1018 static BOOL init_path_entry( union sysparam_all_entry *entry )
1020 return init_entry_string( &entry->hdr, entry->path.path );
1023 /* get a binary parameter in the registry */
1024 static BOOL get_binary_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param )
1026 if (!ptr_param) return FALSE;
1028 if (!entry->hdr.loaded)
1030 void *buffer = HeapAlloc( GetProcessHeap(), 0, entry->bin.size );
1031 DWORD len = load_entry( &entry->hdr, buffer, entry->bin.size );
1033 if (len)
1035 memcpy( entry->bin.ptr, buffer, entry->bin.size );
1036 memset( (char *)entry->bin.ptr + len, 0, entry->bin.size - len );
1038 HeapFree( GetProcessHeap(), 0, buffer );
1040 memcpy( ptr_param, entry->bin.ptr, min( int_param, entry->bin.size ) );
1041 return TRUE;
1044 /* set a binary parameter in the registry */
1045 static BOOL set_binary_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param, UINT flags )
1047 BOOL ret;
1048 void *buffer = HeapAlloc( GetProcessHeap(), 0, entry->bin.size );
1050 memcpy( buffer, entry->bin.ptr, entry->bin.size );
1051 memcpy( buffer, ptr_param, min( int_param, entry->bin.size ));
1052 ret = save_entry( &entry->hdr, buffer, entry->bin.size, REG_BINARY, flags );
1053 if (ret)
1055 memcpy( entry->bin.ptr, buffer, entry->bin.size );
1056 entry->hdr.loaded = TRUE;
1058 HeapFree( GetProcessHeap(), 0, buffer );
1059 return ret;
1062 /* initialize a binary parameter */
1063 static BOOL init_binary_entry( union sysparam_all_entry *entry )
1065 return init_entry( &entry->hdr, entry->bin.ptr, entry->bin.size, REG_BINARY );
1068 /* get a user pref parameter in the registry */
1069 static BOOL get_userpref_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param )
1071 union sysparam_all_entry *parent_entry = (union sysparam_all_entry *)entry->pref.parent;
1072 BYTE prefs[8];
1074 if (!ptr_param) return FALSE;
1076 if (!parent_entry->hdr.get( parent_entry, sizeof(prefs), prefs )) return FALSE;
1077 *(BOOL *)ptr_param = (prefs[entry->pref.offset] & entry->pref.mask) != 0;
1078 return TRUE;
1081 /* set a user pref parameter in the registry */
1082 static BOOL set_userpref_entry( union sysparam_all_entry *entry, UINT int_param, void *ptr_param, UINT flags )
1084 union sysparam_all_entry *parent_entry = (union sysparam_all_entry *)entry->pref.parent;
1085 BYTE prefs[8];
1087 parent_entry->hdr.loaded = FALSE; /* force loading it again */
1088 if (!parent_entry->hdr.get( parent_entry, sizeof(prefs), prefs )) return FALSE;
1090 if (PtrToUlong( ptr_param )) prefs[entry->pref.offset] |= entry->pref.mask;
1091 else prefs[entry->pref.offset] &= ~entry->pref.mask;
1093 return parent_entry->hdr.set( parent_entry, sizeof(prefs), prefs, flags );
1096 static BOOL get_entry( void *ptr, UINT int_param, void *ptr_param )
1098 union sysparam_all_entry *entry = ptr;
1099 return entry->hdr.get( entry, int_param, ptr_param );
1102 static BOOL set_entry( void *ptr, UINT int_param, void *ptr_param, UINT flags )
1104 union sysparam_all_entry *entry = ptr;
1105 return entry->hdr.set( entry, int_param, ptr_param, flags );
1108 #define UINT_ENTRY(name,val) \
1109 struct sysparam_uint_entry entry_##name = { { get_uint_entry, set_uint_entry, init_uint_entry, \
1110 name ##_VALNAME }, (val) }
1112 #define UINT_ENTRY_MIRROR(name,val) \
1113 struct sysparam_uint_entry entry_##name = { { get_uint_entry, set_uint_entry, init_uint_entry, \
1114 name ##_VALNAME, name ##_MIRROR }, (val) }
1116 #define INT_ENTRY(name,val) \
1117 struct sysparam_uint_entry entry_##name = { { get_uint_entry, set_int_entry, init_int_entry, \
1118 name ##_VALNAME }, (val) }
1120 #define BOOL_ENTRY(name,val) \
1121 struct sysparam_bool_entry entry_##name = { { get_bool_entry, set_bool_entry, init_bool_entry, \
1122 name ##_VALNAME }, (val) }
1124 #define BOOL_ENTRY_MIRROR(name,val) \
1125 struct sysparam_bool_entry entry_##name = { { get_bool_entry, set_bool_entry, init_bool_entry, \
1126 name ##_VALNAME, name ##_MIRROR }, (val) }
1128 #define YESNO_ENTRY(name,val) \
1129 struct sysparam_bool_entry entry_##name = { { get_yesno_entry, set_yesno_entry, init_yesno_entry, \
1130 name ##_VALNAME }, (val) }
1132 #define TWIPS_ENTRY(name,val) \
1133 struct sysparam_uint_entry entry_##name = { { get_twips_entry, set_int_entry, init_int_entry, \
1134 name ##_VALNAME }, (val) }
1136 #define DWORD_ENTRY(name,val) \
1137 struct sysparam_dword_entry entry_##name = { { get_dword_entry, set_dword_entry, init_dword_entry, \
1138 name ##_VALNAME }, (val) }
1140 #define BINARY_ENTRY(name,data) \
1141 struct sysparam_binary_entry entry_##name = { { get_binary_entry, set_binary_entry, init_binary_entry, \
1142 name ##_VALNAME }, data, sizeof(data) }
1144 #define PATH_ENTRY(name) \
1145 struct sysparam_path_entry entry_##name = { { get_path_entry, set_path_entry, init_path_entry, \
1146 name ##_VALNAME } }
1148 #define FONT_ENTRY(name,weight) \
1149 struct sysparam_font_entry entry_##name = { { get_font_entry, set_font_entry, init_font_entry, \
1150 name ##_VALNAME }, (weight) }
1152 #define USERPREF_ENTRY(name,offset,mask) \
1153 struct sysparam_pref_entry entry_##name = { { get_userpref_entry, set_userpref_entry }, \
1154 &entry_USERPREFERENCESMASK, (offset), (mask) }
1156 static UINT_ENTRY( DRAGWIDTH, 4 );
1157 static UINT_ENTRY( DRAGHEIGHT, 4 );
1158 static UINT_ENTRY( DOUBLECLICKTIME, 500 );
1159 static UINT_ENTRY( FONTSMOOTHING, 2 );
1160 static UINT_ENTRY( GRIDGRANULARITY, 0 );
1161 static UINT_ENTRY( ICONSIZE, 32 );
1162 static UINT_ENTRY( KEYBOARDDELAY, 1 );
1163 static UINT_ENTRY( KEYBOARDSPEED, 31 );
1164 static UINT_ENTRY( MENUSHOWDELAY, 400 );
1165 static UINT_ENTRY( MINARRANGE, ARW_HIDE );
1166 static UINT_ENTRY( MINHORZGAP, 0 );
1167 static UINT_ENTRY( MINVERTGAP, 0 );
1168 static UINT_ENTRY( MINWIDTH, 154 );
1169 static UINT_ENTRY( MOUSEHOVERHEIGHT, 4 );
1170 static UINT_ENTRY( MOUSEHOVERTIME, 400 );
1171 static UINT_ENTRY( MOUSEHOVERWIDTH, 4 );
1172 static UINT_ENTRY( MOUSESPEED, 10 );
1173 static UINT_ENTRY( MOUSETRAILS, 0 );
1174 static UINT_ENTRY( SCREENSAVETIMEOUT, 300 );
1175 static UINT_ENTRY( WHEELSCROLLCHARS, 3 );
1176 static UINT_ENTRY( WHEELSCROLLLINES, 3 );
1177 static UINT_ENTRY_MIRROR( DOUBLECLKHEIGHT, 4 );
1178 static UINT_ENTRY_MIRROR( DOUBLECLKWIDTH, 4 );
1179 static UINT_ENTRY_MIRROR( MENUDROPALIGNMENT, 0 );
1181 static INT_ENTRY( MOUSETHRESHOLD1, 6 );
1182 static INT_ENTRY( MOUSETHRESHOLD2, 10 );
1183 static INT_ENTRY( MOUSEACCELERATION, 1 );
1185 static BOOL_ENTRY( BLOCKSENDINPUTRESETS, FALSE );
1186 static BOOL_ENTRY( DRAGFULLWINDOWS, FALSE );
1187 static BOOL_ENTRY( KEYBOARDPREF, TRUE );
1188 static BOOL_ENTRY( LOWPOWERACTIVE, FALSE );
1189 static BOOL_ENTRY( MOUSEBUTTONSWAP, FALSE );
1190 static BOOL_ENTRY( POWEROFFACTIVE, FALSE );
1191 static BOOL_ENTRY( SCREENREADER, FALSE );
1192 static BOOL_ENTRY( SCREENSAVEACTIVE, TRUE );
1193 static BOOL_ENTRY( SCREENSAVERRUNNING, FALSE );
1194 static BOOL_ENTRY( SHOWSOUNDS, FALSE );
1195 static BOOL_ENTRY( SNAPTODEFBUTTON, FALSE );
1196 static BOOL_ENTRY_MIRROR( ICONTITLEWRAP, TRUE );
1198 static YESNO_ENTRY( BEEP, TRUE );
1200 static TWIPS_ENTRY( BORDER, -15 );
1201 static TWIPS_ENTRY( CAPTIONHEIGHT, -270 );
1202 static TWIPS_ENTRY( CAPTIONWIDTH, -270 );
1203 static TWIPS_ENTRY( ICONHORIZONTALSPACING, -1125 );
1204 static TWIPS_ENTRY( ICONVERTICALSPACING, -1125 );
1205 static TWIPS_ENTRY( MENUHEIGHT, -270 );
1206 static TWIPS_ENTRY( MENUWIDTH, -270 );
1207 static TWIPS_ENTRY( PADDEDBORDERWIDTH, 0 );
1208 static TWIPS_ENTRY( SCROLLHEIGHT, -240 );
1209 static TWIPS_ENTRY( SCROLLWIDTH, -240 );
1210 static TWIPS_ENTRY( SMCAPTIONHEIGHT, -225 );
1211 static TWIPS_ENTRY( SMCAPTIONWIDTH, -225 );
1213 static DWORD_ENTRY( ACTIVEWINDOWTRACKING, 0 );
1214 static DWORD_ENTRY( ACTIVEWNDTRKTIMEOUT, 0 );
1215 static DWORD_ENTRY( CARETWIDTH, 1 );
1216 static DWORD_ENTRY( FOCUSBORDERHEIGHT, 1 );
1217 static DWORD_ENTRY( FOCUSBORDERWIDTH, 1 );
1218 static DWORD_ENTRY( FONTSMOOTHINGCONTRAST, 0 );
1219 static DWORD_ENTRY( FONTSMOOTHINGORIENTATION, FE_FONTSMOOTHINGORIENTATIONRGB );
1220 static DWORD_ENTRY( FONTSMOOTHINGTYPE, FE_FONTSMOOTHINGSTANDARD );
1221 static DWORD_ENTRY( FOREGROUNDFLASHCOUNT, 3 );
1222 static DWORD_ENTRY( FOREGROUNDLOCKTIMEOUT, 0 );
1223 static DWORD_ENTRY( MOUSECLICKLOCKTIME, 1200 );
1225 static PATH_ENTRY( DESKPATTERN );
1226 static PATH_ENTRY( DESKWALLPAPER );
1228 static BYTE user_prefs[8] = { 0x30, 0x00, 0x00, 0x80, 0x10, 0x00, 0x00, 0x00 };
1229 static BINARY_ENTRY( USERPREFERENCESMASK, user_prefs );
1231 static FONT_ENTRY( CAPTIONLOGFONT, FW_BOLD );
1232 static FONT_ENTRY( ICONTITLELOGFONT, FW_NORMAL );
1233 static FONT_ENTRY( MENULOGFONT, FW_NORMAL );
1234 static FONT_ENTRY( MESSAGELOGFONT, FW_NORMAL );
1235 static FONT_ENTRY( SMCAPTIONLOGFONT, FW_NORMAL );
1236 static FONT_ENTRY( STATUSLOGFONT, FW_NORMAL );
1238 static USERPREF_ENTRY( MENUANIMATION, 0, 0x02 );
1239 static USERPREF_ENTRY( COMBOBOXANIMATION, 0, 0x04 );
1240 static USERPREF_ENTRY( LISTBOXSMOOTHSCROLLING, 0, 0x08 );
1241 static USERPREF_ENTRY( GRADIENTCAPTIONS, 0, 0x10 );
1242 static USERPREF_ENTRY( KEYBOARDCUES, 0, 0x20 );
1243 static USERPREF_ENTRY( ACTIVEWNDTRKZORDER, 0, 0x40 );
1244 static USERPREF_ENTRY( HOTTRACKING, 0, 0x80 );
1245 static USERPREF_ENTRY( MENUFADE, 1, 0x02 );
1246 static USERPREF_ENTRY( SELECTIONFADE, 1, 0x04 );
1247 static USERPREF_ENTRY( TOOLTIPANIMATION, 1, 0x08 );
1248 static USERPREF_ENTRY( TOOLTIPFADE, 1, 0x10 );
1249 static USERPREF_ENTRY( CURSORSHADOW, 1, 0x20 );
1250 static USERPREF_ENTRY( MOUSESONAR, 1, 0x40 );
1251 static USERPREF_ENTRY( MOUSECLICKLOCK, 1, 0x80 );
1252 static USERPREF_ENTRY( MOUSEVANISH, 2, 0x01 );
1253 static USERPREF_ENTRY( FLATMENU, 2, 0x02 );
1254 static USERPREF_ENTRY( DROPSHADOW, 2, 0x04 );
1255 static USERPREF_ENTRY( UIEFFECTS, 3, 0x80 );
1256 static USERPREF_ENTRY( DISABLEOVERLAPPEDCONTENT, 4, 0x01 );
1257 static USERPREF_ENTRY( CLIENTAREAANIMATION, 4, 0x02 );
1258 static USERPREF_ENTRY( CLEARTYPE, 4, 0x10 );
1259 static USERPREF_ENTRY( SPEECHRECOGNITION, 4, 0x20 );
1261 static struct sysparam_rgb_entry system_colors[] =
1263 #define RGB_ENTRY(name,val) { { get_rgb_entry, set_rgb_entry, init_rgb_entry, name ##_VALNAME }, (val) }
1264 RGB_ENTRY( COLOR_SCROLLBAR, RGB(212, 208, 200) ),
1265 RGB_ENTRY( COLOR_BACKGROUND, RGB(58, 110, 165) ),
1266 RGB_ENTRY( COLOR_ACTIVECAPTION, RGB(10, 36, 106) ),
1267 RGB_ENTRY( COLOR_INACTIVECAPTION, RGB(128, 128, 128) ),
1268 RGB_ENTRY( COLOR_MENU, RGB(212, 208, 200) ),
1269 RGB_ENTRY( COLOR_WINDOW, RGB(255, 255, 255) ),
1270 RGB_ENTRY( COLOR_WINDOWFRAME, RGB(0, 0, 0) ),
1271 RGB_ENTRY( COLOR_MENUTEXT, RGB(0, 0, 0) ),
1272 RGB_ENTRY( COLOR_WINDOWTEXT, RGB(0, 0, 0) ),
1273 RGB_ENTRY( COLOR_CAPTIONTEXT, RGB(255, 255, 255) ),
1274 RGB_ENTRY( COLOR_ACTIVEBORDER, RGB(212, 208, 200) ),
1275 RGB_ENTRY( COLOR_INACTIVEBORDER, RGB(212, 208, 200) ),
1276 RGB_ENTRY( COLOR_APPWORKSPACE, RGB(128, 128, 128) ),
1277 RGB_ENTRY( COLOR_HIGHLIGHT, RGB(10, 36, 106) ),
1278 RGB_ENTRY( COLOR_HIGHLIGHTTEXT, RGB(255, 255, 255) ),
1279 RGB_ENTRY( COLOR_BTNFACE, RGB(212, 208, 200) ),
1280 RGB_ENTRY( COLOR_BTNSHADOW, RGB(128, 128, 128) ),
1281 RGB_ENTRY( COLOR_GRAYTEXT, RGB(128, 128, 128) ),
1282 RGB_ENTRY( COLOR_BTNTEXT, RGB(0, 0, 0) ),
1283 RGB_ENTRY( COLOR_INACTIVECAPTIONTEXT, RGB(212, 208, 200) ),
1284 RGB_ENTRY( COLOR_BTNHIGHLIGHT, RGB(255, 255, 255) ),
1285 RGB_ENTRY( COLOR_3DDKSHADOW, RGB(64, 64, 64) ),
1286 RGB_ENTRY( COLOR_3DLIGHT, RGB(212, 208, 200) ),
1287 RGB_ENTRY( COLOR_INFOTEXT, RGB(0, 0, 0) ),
1288 RGB_ENTRY( COLOR_INFOBK, RGB(255, 255, 225) ),
1289 RGB_ENTRY( COLOR_ALTERNATEBTNFACE, RGB(181, 181, 181) ),
1290 RGB_ENTRY( COLOR_HOTLIGHT, RGB(0, 0, 200) ),
1291 RGB_ENTRY( COLOR_GRADIENTACTIVECAPTION, RGB(166, 202, 240) ),
1292 RGB_ENTRY( COLOR_GRADIENTINACTIVECAPTION, RGB(192, 192, 192) ),
1293 RGB_ENTRY( COLOR_MENUHILIGHT, RGB(10, 36, 106) ),
1294 RGB_ENTRY( COLOR_MENUBAR, RGB(212, 208, 200) )
1295 #undef RGB_ENTRY
1297 #define NUM_SYS_COLORS (sizeof(system_colors) / sizeof(system_colors[0]))
1299 /* entries that are initialized by default in the registry */
1300 static union sysparam_all_entry * const default_entries[] =
1302 (union sysparam_all_entry *)&entry_ACTIVEWINDOWTRACKING,
1303 (union sysparam_all_entry *)&entry_ACTIVEWNDTRKTIMEOUT,
1304 (union sysparam_all_entry *)&entry_BEEP,
1305 (union sysparam_all_entry *)&entry_BLOCKSENDINPUTRESETS,
1306 (union sysparam_all_entry *)&entry_BORDER,
1307 (union sysparam_all_entry *)&entry_CAPTIONHEIGHT,
1308 (union sysparam_all_entry *)&entry_CAPTIONWIDTH,
1309 (union sysparam_all_entry *)&entry_CARETWIDTH,
1310 (union sysparam_all_entry *)&entry_DESKWALLPAPER,
1311 (union sysparam_all_entry *)&entry_DOUBLECLICKTIME,
1312 (union sysparam_all_entry *)&entry_DOUBLECLKHEIGHT,
1313 (union sysparam_all_entry *)&entry_DOUBLECLKWIDTH,
1314 (union sysparam_all_entry *)&entry_DRAGFULLWINDOWS,
1315 (union sysparam_all_entry *)&entry_DRAGHEIGHT,
1316 (union sysparam_all_entry *)&entry_DRAGWIDTH,
1317 (union sysparam_all_entry *)&entry_FOCUSBORDERHEIGHT,
1318 (union sysparam_all_entry *)&entry_FOCUSBORDERWIDTH,
1319 (union sysparam_all_entry *)&entry_FONTSMOOTHING,
1320 (union sysparam_all_entry *)&entry_FONTSMOOTHINGCONTRAST,
1321 (union sysparam_all_entry *)&entry_FONTSMOOTHINGORIENTATION,
1322 (union sysparam_all_entry *)&entry_FONTSMOOTHINGTYPE,
1323 (union sysparam_all_entry *)&entry_FOREGROUNDFLASHCOUNT,
1324 (union sysparam_all_entry *)&entry_FOREGROUNDLOCKTIMEOUT,
1325 (union sysparam_all_entry *)&entry_ICONHORIZONTALSPACING,
1326 (union sysparam_all_entry *)&entry_ICONSIZE,
1327 (union sysparam_all_entry *)&entry_ICONTITLEWRAP,
1328 (union sysparam_all_entry *)&entry_ICONVERTICALSPACING,
1329 (union sysparam_all_entry *)&entry_KEYBOARDDELAY,
1330 (union sysparam_all_entry *)&entry_KEYBOARDPREF,
1331 (union sysparam_all_entry *)&entry_KEYBOARDSPEED,
1332 (union sysparam_all_entry *)&entry_LOWPOWERACTIVE,
1333 (union sysparam_all_entry *)&entry_MENUHEIGHT,
1334 (union sysparam_all_entry *)&entry_MENUSHOWDELAY,
1335 (union sysparam_all_entry *)&entry_MENUWIDTH,
1336 (union sysparam_all_entry *)&entry_MOUSEACCELERATION,
1337 (union sysparam_all_entry *)&entry_MOUSEBUTTONSWAP,
1338 (union sysparam_all_entry *)&entry_MOUSECLICKLOCKTIME,
1339 (union sysparam_all_entry *)&entry_MOUSEHOVERHEIGHT,
1340 (union sysparam_all_entry *)&entry_MOUSEHOVERTIME,
1341 (union sysparam_all_entry *)&entry_MOUSEHOVERWIDTH,
1342 (union sysparam_all_entry *)&entry_MOUSESPEED,
1343 (union sysparam_all_entry *)&entry_MOUSETHRESHOLD1,
1344 (union sysparam_all_entry *)&entry_MOUSETHRESHOLD2,
1345 (union sysparam_all_entry *)&entry_PADDEDBORDERWIDTH,
1346 (union sysparam_all_entry *)&entry_SCREENREADER,
1347 (union sysparam_all_entry *)&entry_SCROLLHEIGHT,
1348 (union sysparam_all_entry *)&entry_SCROLLWIDTH,
1349 (union sysparam_all_entry *)&entry_SHOWSOUNDS,
1350 (union sysparam_all_entry *)&entry_SMCAPTIONHEIGHT,
1351 (union sysparam_all_entry *)&entry_SMCAPTIONWIDTH,
1352 (union sysparam_all_entry *)&entry_SNAPTODEFBUTTON,
1353 (union sysparam_all_entry *)&entry_USERPREFERENCESMASK,
1354 (union sysparam_all_entry *)&entry_WHEELSCROLLCHARS,
1355 (union sysparam_all_entry *)&entry_WHEELSCROLLLINES,
1358 /***********************************************************************
1359 * SYSPARAMS_Init
1361 void SYSPARAMS_Init(void)
1363 HKEY key;
1364 DWORD i, dispos;
1366 /* this one must be non-volatile */
1367 if (RegCreateKeyW( HKEY_CURRENT_USER, WINE_CURRENT_USER_REGKEY, &key ))
1369 ERR("Can't create wine registry branch\n");
1370 return;
1373 /* @@ Wine registry key: HKCU\Software\Wine\Temporary System Parameters */
1374 if (RegCreateKeyExW( key, WINE_CURRENT_USER_REGKEY_TEMP_PARAMS, 0, 0,
1375 REG_OPTION_VOLATILE, KEY_ALL_ACCESS, 0, &volatile_base_key, &dispos ))
1376 ERR("Can't create non-permanent wine registry branch\n");
1378 RegCloseKey( key );
1380 if (volatile_base_key && dispos == REG_CREATED_NEW_KEY) /* first process, initialize entries */
1382 for (i = 0; i < sizeof(default_entries)/sizeof(default_entries[0]); i++)
1383 default_entries[i]->hdr.init( default_entries[i] );
1387 static BOOL update_desktop_wallpaper(void)
1389 DWORD pid;
1391 if (GetWindowThreadProcessId( GetDesktopWindow(), &pid ) && pid == GetCurrentProcessId())
1393 WCHAR wallpaper[MAX_PATH], pattern[256];
1395 entry_DESKWALLPAPER.hdr.loaded = entry_DESKPATTERN.hdr.loaded = FALSE;
1396 if (get_entry( &entry_DESKWALLPAPER, MAX_PATH, wallpaper ) &&
1397 get_entry( &entry_DESKPATTERN, 256, pattern ))
1398 update_wallpaper( wallpaper, pattern );
1400 else SendMessageW( GetDesktopWindow(), WM_SETTINGCHANGE, SPI_SETDESKWALLPAPER, 0 );
1401 return TRUE;
1404 /***********************************************************************
1405 * SystemParametersInfoW (USER32.@)
1407 * Each system parameter has flag which shows whether the parameter
1408 * is loaded or not. Parameters, stored directly in SysParametersInfo are
1409 * loaded from registry only when they are requested and the flag is
1410 * "false", after the loading the flag is set to "true". On interprocess
1411 * notification of the parameter change the corresponding parameter flag is
1412 * set to "false". The parameter value will be reloaded when it is requested
1413 * the next time.
1414 * Parameters, backed by or depend on GetSystemMetrics are processed
1415 * differently. These parameters are always loaded. They are reloaded right
1416 * away on interprocess change notification. We can't do lazy loading because
1417 * we don't want to complicate GetSystemMetrics.
1418 * Parameters, backed by X settings are read from corresponding setting.
1419 * On the parameter change request the setting is changed. Interprocess change
1420 * notifications are ignored.
1421 * When parameter value is updated the changed value is stored in permanent
1422 * registry branch if saving is requested. Otherwise it is stored
1423 * in temporary branch
1425 * Some SPI values can also be stored as Twips values in the registry,
1426 * don't forget the conversion!
1428 BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
1429 PVOID pvParam, UINT fWinIni )
1431 #define WINE_SPI_FIXME(x) \
1432 case x: \
1434 static BOOL warn = TRUE; \
1435 if (warn) \
1437 warn = FALSE; \
1438 FIXME( "Unimplemented action: %u (%s)\n", x, #x ); \
1441 SetLastError( ERROR_INVALID_SPI_VALUE ); \
1442 ret = FALSE; \
1443 break
1444 #define WINE_SPI_WARN(x) \
1445 case x: \
1446 WARN( "Ignored action: %u (%s)\n", x, #x ); \
1447 ret = TRUE; \
1448 break
1450 BOOL ret = USER_Driver->pSystemParametersInfo( uiAction, uiParam, pvParam, fWinIni );
1451 unsigned spi_idx = 0;
1453 if (!ret) switch (uiAction)
1455 case SPI_GETBEEP:
1456 ret = get_entry( &entry_BEEP, uiParam, pvParam );
1457 break;
1458 case SPI_SETBEEP:
1459 ret = set_entry( &entry_BEEP, uiParam, pvParam, fWinIni );
1460 break;
1461 case SPI_GETMOUSE:
1462 ret = get_entry( &entry_MOUSETHRESHOLD1, uiParam, (INT *)pvParam ) &&
1463 get_entry( &entry_MOUSETHRESHOLD2, uiParam, (INT *)pvParam + 1 ) &&
1464 get_entry( &entry_MOUSEACCELERATION, uiParam, (INT *)pvParam + 2 );
1465 break;
1466 case SPI_SETMOUSE:
1467 ret = set_entry( &entry_MOUSETHRESHOLD1, ((INT *)pvParam)[0], pvParam, fWinIni ) &&
1468 set_entry( &entry_MOUSETHRESHOLD2, ((INT *)pvParam)[1], pvParam, fWinIni ) &&
1469 set_entry( &entry_MOUSEACCELERATION, ((INT *)pvParam)[2], pvParam, fWinIni );
1470 break;
1471 case SPI_GETBORDER:
1472 ret = get_entry( &entry_BORDER, uiParam, pvParam );
1473 if (*(INT*)pvParam < 1) *(INT*)pvParam = 1;
1474 break;
1475 case SPI_SETBORDER:
1476 ret = set_entry( &entry_BORDER, uiParam, pvParam, fWinIni );
1477 break;
1478 case SPI_GETKEYBOARDSPEED:
1479 ret = get_entry( &entry_KEYBOARDSPEED, uiParam, pvParam );
1480 break;
1481 case SPI_SETKEYBOARDSPEED:
1482 if (uiParam > 31) uiParam = 31;
1483 ret = set_entry( &entry_KEYBOARDSPEED, uiParam, pvParam, fWinIni );
1484 break;
1486 /* not implemented in Windows */
1487 WINE_SPI_WARN(SPI_LANGDRIVER); /* 12 */
1489 case SPI_ICONHORIZONTALSPACING:
1490 if (pvParam != NULL)
1491 ret = get_entry( &entry_ICONHORIZONTALSPACING, uiParam, pvParam );
1492 else
1493 ret = set_entry( &entry_ICONHORIZONTALSPACING, max( 32, uiParam ), pvParam, fWinIni );
1494 break;
1495 case SPI_GETSCREENSAVETIMEOUT:
1496 ret = get_entry( &entry_SCREENSAVETIMEOUT, uiParam, pvParam );
1497 break;
1498 case SPI_SETSCREENSAVETIMEOUT:
1499 ret = set_entry( &entry_SCREENSAVETIMEOUT, uiParam, pvParam, fWinIni );
1500 break;
1501 case SPI_GETSCREENSAVEACTIVE:
1502 ret = get_entry( &entry_SCREENSAVEACTIVE, uiParam, pvParam );
1503 break;
1504 case SPI_SETSCREENSAVEACTIVE:
1505 ret = set_entry( &entry_SCREENSAVEACTIVE, uiParam, pvParam, fWinIni );
1506 break;
1507 case SPI_GETGRIDGRANULARITY:
1508 ret = get_entry( &entry_GRIDGRANULARITY, uiParam, pvParam );
1509 break;
1510 case SPI_SETGRIDGRANULARITY:
1511 ret = set_entry( &entry_GRIDGRANULARITY, uiParam, pvParam, fWinIni );
1512 break;
1513 case SPI_SETDESKWALLPAPER:
1514 if (!pvParam || set_entry( &entry_DESKWALLPAPER, uiParam, pvParam, fWinIni ))
1515 ret = update_desktop_wallpaper();
1516 break;
1517 case SPI_SETDESKPATTERN:
1518 if (!pvParam || set_entry( &entry_DESKPATTERN, uiParam, pvParam, fWinIni ))
1519 ret = update_desktop_wallpaper();
1520 break;
1521 case SPI_GETKEYBOARDDELAY:
1522 ret = get_entry( &entry_KEYBOARDDELAY, uiParam, pvParam );
1523 break;
1524 case SPI_SETKEYBOARDDELAY:
1525 ret = set_entry( &entry_KEYBOARDDELAY, uiParam, pvParam, fWinIni );
1526 break;
1527 case SPI_ICONVERTICALSPACING:
1528 if (pvParam != NULL)
1529 ret = get_entry( &entry_ICONVERTICALSPACING, uiParam, pvParam );
1530 else
1531 ret = set_entry( &entry_ICONVERTICALSPACING, max( 32, uiParam ), pvParam, fWinIni );
1532 break;
1533 case SPI_GETICONTITLEWRAP:
1534 ret = get_entry( &entry_ICONTITLEWRAP, uiParam, pvParam );
1535 break;
1536 case SPI_SETICONTITLEWRAP:
1537 ret = set_entry( &entry_ICONTITLEWRAP, uiParam, pvParam, fWinIni );
1538 break;
1539 case SPI_GETMENUDROPALIGNMENT:
1540 ret = get_entry( &entry_MENUDROPALIGNMENT, uiParam, pvParam );
1541 break;
1542 case SPI_SETMENUDROPALIGNMENT:
1543 ret = set_entry( &entry_MENUDROPALIGNMENT, uiParam, pvParam, fWinIni );
1544 break;
1545 case SPI_SETDOUBLECLKWIDTH:
1546 ret = set_entry( &entry_DOUBLECLKWIDTH, uiParam, pvParam, fWinIni );
1547 break;
1548 case SPI_SETDOUBLECLKHEIGHT:
1549 ret = set_entry( &entry_DOUBLECLKHEIGHT, uiParam, pvParam, fWinIni );
1550 break;
1551 case SPI_GETICONTITLELOGFONT:
1552 ret = get_entry( &entry_ICONTITLELOGFONT, uiParam, pvParam );
1553 break;
1554 case SPI_SETDOUBLECLICKTIME:
1555 ret = set_entry( &entry_DOUBLECLICKTIME, uiParam, pvParam, fWinIni );
1556 break;
1557 case SPI_SETMOUSEBUTTONSWAP:
1558 ret = set_entry( &entry_MOUSEBUTTONSWAP, uiParam, pvParam, fWinIni );
1559 break;
1560 case SPI_SETICONTITLELOGFONT:
1561 ret = set_entry( &entry_ICONTITLELOGFONT, uiParam, pvParam, fWinIni );
1562 break;
1564 case SPI_GETFASTTASKSWITCH: /* 35 */
1565 if (!pvParam) return FALSE;
1566 *(BOOL *)pvParam = TRUE;
1567 ret = TRUE;
1568 break;
1570 case SPI_SETFASTTASKSWITCH: /* 36 */
1571 /* the action is disabled */
1572 ret = FALSE;
1573 break;
1575 case SPI_SETDRAGFULLWINDOWS:
1576 ret = set_entry( &entry_DRAGFULLWINDOWS, uiParam, pvParam, fWinIni );
1577 break;
1578 case SPI_GETDRAGFULLWINDOWS:
1579 ret = get_entry( &entry_DRAGFULLWINDOWS, uiParam, pvParam );
1580 break;
1581 case SPI_GETNONCLIENTMETRICS:
1583 LPNONCLIENTMETRICSW lpnm = pvParam;
1585 if (!pvParam) return FALSE;
1587 ret = get_entry( &entry_BORDER, 0, &lpnm->iBorderWidth ) &&
1588 get_entry( &entry_SCROLLWIDTH, 0, &lpnm->iScrollWidth ) &&
1589 get_entry( &entry_SCROLLHEIGHT, 0, &lpnm->iScrollHeight ) &&
1590 get_entry( &entry_CAPTIONWIDTH, 0, &lpnm->iCaptionWidth ) &&
1591 get_entry( &entry_CAPTIONHEIGHT, 0, &lpnm->iCaptionHeight ) &&
1592 get_entry( &entry_CAPTIONLOGFONT, 0, &lpnm->lfCaptionFont ) &&
1593 get_entry( &entry_SMCAPTIONWIDTH, 0, &lpnm->iSmCaptionWidth ) &&
1594 get_entry( &entry_SMCAPTIONHEIGHT, 0, &lpnm->iSmCaptionHeight ) &&
1595 get_entry( &entry_SMCAPTIONLOGFONT, 0, &lpnm->lfSmCaptionFont ) &&
1596 get_entry( &entry_MENUWIDTH, 0, &lpnm->iMenuWidth ) &&
1597 get_entry( &entry_MENUHEIGHT, 0, &lpnm->iMenuHeight ) &&
1598 get_entry( &entry_MENULOGFONT, 0, &lpnm->lfMenuFont ) &&
1599 get_entry( &entry_STATUSLOGFONT, 0, &lpnm->lfStatusFont ) &&
1600 get_entry( &entry_MESSAGELOGFONT, 0, &lpnm->lfMessageFont );
1601 if (ret && lpnm->cbSize == sizeof(NONCLIENTMETRICSW))
1602 ret = get_entry( &entry_PADDEDBORDERWIDTH, 0, &lpnm->iPaddedBorderWidth );
1603 normalize_nonclientmetrics( lpnm );
1604 break;
1606 case SPI_SETNONCLIENTMETRICS:
1608 LPNONCLIENTMETRICSW lpnm = pvParam;
1610 if (lpnm && (lpnm->cbSize == sizeof(NONCLIENTMETRICSW) ||
1611 lpnm->cbSize == FIELD_OFFSET(NONCLIENTMETRICSW, iPaddedBorderWidth)))
1613 ret = set_entry( &entry_BORDER, lpnm->iBorderWidth, NULL, fWinIni ) &&
1614 set_entry( &entry_SCROLLWIDTH, lpnm->iScrollWidth, NULL, fWinIni ) &&
1615 set_entry( &entry_SCROLLHEIGHT, lpnm->iScrollHeight, NULL, fWinIni ) &&
1616 set_entry( &entry_CAPTIONWIDTH, lpnm->iCaptionWidth, NULL, fWinIni ) &&
1617 set_entry( &entry_CAPTIONHEIGHT, lpnm->iCaptionHeight, NULL, fWinIni ) &&
1618 set_entry( &entry_SMCAPTIONWIDTH, lpnm->iSmCaptionWidth, NULL, fWinIni ) &&
1619 set_entry( &entry_SMCAPTIONHEIGHT, lpnm->iSmCaptionHeight, NULL, fWinIni ) &&
1620 set_entry( &entry_MENUWIDTH, lpnm->iMenuWidth, NULL, fWinIni ) &&
1621 set_entry( &entry_MENUHEIGHT, lpnm->iMenuHeight, NULL, fWinIni ) &&
1622 set_entry( &entry_MENULOGFONT, 0, &lpnm->lfMenuFont, fWinIni ) &&
1623 set_entry( &entry_CAPTIONLOGFONT, 0, &lpnm->lfCaptionFont, fWinIni ) &&
1624 set_entry( &entry_SMCAPTIONLOGFONT, 0, &lpnm->lfSmCaptionFont, fWinIni ) &&
1625 set_entry( &entry_STATUSLOGFONT, 0, &lpnm->lfStatusFont, fWinIni ) &&
1626 set_entry( &entry_MESSAGELOGFONT, 0, &lpnm->lfMessageFont, fWinIni );
1628 if (ret && lpnm->cbSize == sizeof(NONCLIENTMETRICSW))
1629 set_entry( &entry_PADDEDBORDERWIDTH, lpnm->iPaddedBorderWidth, NULL, fWinIni );
1631 break;
1633 case SPI_GETMINIMIZEDMETRICS:
1635 MINIMIZEDMETRICS * lpMm = pvParam;
1636 if (lpMm && lpMm->cbSize == sizeof(*lpMm)) {
1637 ret = get_entry( &entry_MINWIDTH, 0, &lpMm->iWidth ) &&
1638 get_entry( &entry_MINHORZGAP, 0, &lpMm->iHorzGap ) &&
1639 get_entry( &entry_MINVERTGAP, 0, &lpMm->iVertGap ) &&
1640 get_entry( &entry_MINARRANGE, 0, &lpMm->iArrange );
1641 lpMm->iWidth = max( 0, lpMm->iWidth );
1642 lpMm->iHorzGap = max( 0, lpMm->iHorzGap );
1643 lpMm->iVertGap = max( 0, lpMm->iVertGap );
1644 lpMm->iArrange &= 0x0f;
1646 break;
1648 case SPI_SETMINIMIZEDMETRICS:
1650 MINIMIZEDMETRICS * lpMm = pvParam;
1651 if (lpMm && lpMm->cbSize == sizeof(*lpMm))
1652 ret = set_entry( &entry_MINWIDTH, max( 0, lpMm->iWidth ), NULL, fWinIni ) &&
1653 set_entry( &entry_MINHORZGAP, max( 0, lpMm->iHorzGap ), NULL, fWinIni ) &&
1654 set_entry( &entry_MINVERTGAP, max( 0, lpMm->iVertGap ), NULL, fWinIni ) &&
1655 set_entry( &entry_MINARRANGE, lpMm->iArrange & 0x0f, NULL, fWinIni );
1656 break;
1658 case SPI_GETICONMETRICS:
1660 LPICONMETRICSW lpIcon = pvParam;
1661 if(lpIcon && lpIcon->cbSize == sizeof(*lpIcon))
1663 ret = get_entry( &entry_ICONHORIZONTALSPACING, 0, &lpIcon->iHorzSpacing ) &&
1664 get_entry( &entry_ICONVERTICALSPACING, 0, &lpIcon->iVertSpacing ) &&
1665 get_entry( &entry_ICONTITLEWRAP, 0, &lpIcon->iTitleWrap ) &&
1666 get_entry( &entry_ICONTITLELOGFONT, 0, &lpIcon->lfFont );
1668 break;
1670 case SPI_SETICONMETRICS:
1672 LPICONMETRICSW lpIcon = pvParam;
1673 if (lpIcon && lpIcon->cbSize == sizeof(*lpIcon))
1674 ret = set_entry( &entry_ICONVERTICALSPACING, max(32,lpIcon->iVertSpacing), NULL, fWinIni ) &&
1675 set_entry( &entry_ICONHORIZONTALSPACING, max(32,lpIcon->iHorzSpacing), NULL, fWinIni ) &&
1676 set_entry( &entry_ICONTITLEWRAP, lpIcon->iTitleWrap, NULL, fWinIni ) &&
1677 set_entry( &entry_ICONTITLELOGFONT, 0, &lpIcon->lfFont, fWinIni );
1678 break;
1681 case SPI_SETWORKAREA: /* 47 WINVER >= 0x400 */
1683 if (!pvParam) return FALSE;
1685 spi_idx = SPI_SETWORKAREA_IDX;
1686 CopyRect( &work_area, pvParam );
1687 spi_loaded[spi_idx] = TRUE;
1688 ret = TRUE;
1689 break;
1692 case SPI_GETWORKAREA: /* 48 WINVER >= 0x400 */
1694 if (!pvParam) return FALSE;
1696 spi_idx = SPI_SETWORKAREA_IDX;
1697 if (!spi_loaded[spi_idx])
1699 SetRect( &work_area, 0, 0,
1700 GetSystemMetrics( SM_CXSCREEN ),
1701 GetSystemMetrics( SM_CYSCREEN ) );
1702 EnumDisplayMonitors( 0, NULL, enum_monitors, (LPARAM)&work_area );
1703 spi_loaded[spi_idx] = TRUE;
1705 CopyRect( pvParam, &work_area );
1706 ret = TRUE;
1707 TRACE("work area %s\n", wine_dbgstr_rect( &work_area ));
1708 break;
1711 WINE_SPI_FIXME(SPI_SETPENWINDOWS); /* 49 WINVER >= 0x400 */
1713 case SPI_GETFILTERKEYS: /* 50 */
1715 LPFILTERKEYS lpFilterKeys = pvParam;
1716 WARN("SPI_GETFILTERKEYS not fully implemented\n");
1717 if (lpFilterKeys && lpFilterKeys->cbSize == sizeof(FILTERKEYS))
1719 /* Indicate that no FilterKeys feature available */
1720 lpFilterKeys->dwFlags = 0;
1721 lpFilterKeys->iWaitMSec = 0;
1722 lpFilterKeys->iDelayMSec = 0;
1723 lpFilterKeys->iRepeatMSec = 0;
1724 lpFilterKeys->iBounceMSec = 0;
1725 ret = TRUE;
1727 break;
1729 WINE_SPI_FIXME(SPI_SETFILTERKEYS); /* 51 */
1731 case SPI_GETTOGGLEKEYS: /* 52 */
1733 LPTOGGLEKEYS lpToggleKeys = pvParam;
1734 WARN("SPI_GETTOGGLEKEYS not fully implemented\n");
1735 if (lpToggleKeys && lpToggleKeys->cbSize == sizeof(TOGGLEKEYS))
1737 /* Indicate that no ToggleKeys feature available */
1738 lpToggleKeys->dwFlags = 0;
1739 ret = TRUE;
1741 break;
1743 WINE_SPI_FIXME(SPI_SETTOGGLEKEYS); /* 53 */
1745 case SPI_GETMOUSEKEYS: /* 54 */
1747 LPMOUSEKEYS lpMouseKeys = pvParam;
1748 WARN("SPI_GETMOUSEKEYS not fully implemented\n");
1749 if (lpMouseKeys && lpMouseKeys->cbSize == sizeof(MOUSEKEYS))
1751 /* Indicate that no MouseKeys feature available */
1752 lpMouseKeys->dwFlags = 0;
1753 lpMouseKeys->iMaxSpeed = 360;
1754 lpMouseKeys->iTimeToMaxSpeed = 1000;
1755 lpMouseKeys->iCtrlSpeed = 0;
1756 lpMouseKeys->dwReserved1 = 0;
1757 lpMouseKeys->dwReserved2 = 0;
1758 ret = TRUE;
1760 break;
1762 WINE_SPI_FIXME(SPI_SETMOUSEKEYS); /* 55 */
1764 case SPI_GETSHOWSOUNDS:
1765 ret = get_entry( &entry_SHOWSOUNDS, uiParam, pvParam );
1766 break;
1767 case SPI_SETSHOWSOUNDS:
1768 ret = set_entry( &entry_SHOWSOUNDS, uiParam, pvParam, fWinIni );
1769 break;
1771 case SPI_GETSTICKYKEYS: /* 58 */
1773 LPSTICKYKEYS lpStickyKeys = pvParam;
1774 WARN("SPI_GETSTICKYKEYS not fully implemented\n");
1775 if (lpStickyKeys && lpStickyKeys->cbSize == sizeof(STICKYKEYS))
1777 /* Indicate that no StickyKeys feature available */
1778 lpStickyKeys->dwFlags = 0;
1779 ret = TRUE;
1781 break;
1783 WINE_SPI_FIXME(SPI_SETSTICKYKEYS); /* 59 */
1785 case SPI_GETACCESSTIMEOUT: /* 60 */
1787 LPACCESSTIMEOUT lpAccessTimeout = pvParam;
1788 WARN("SPI_GETACCESSTIMEOUT not fully implemented\n");
1789 if (lpAccessTimeout && lpAccessTimeout->cbSize == sizeof(ACCESSTIMEOUT))
1791 /* Indicate that no accessibility features timeout is available */
1792 lpAccessTimeout->dwFlags = 0;
1793 lpAccessTimeout->iTimeOutMSec = 0;
1794 ret = TRUE;
1796 break;
1798 WINE_SPI_FIXME(SPI_SETACCESSTIMEOUT); /* 61 */
1800 case SPI_GETSERIALKEYS: /* 62 WINVER >= 0x400 */
1802 LPSERIALKEYSW lpSerialKeysW = pvParam;
1803 WARN("SPI_GETSERIALKEYS not fully implemented\n");
1804 if (lpSerialKeysW && lpSerialKeysW->cbSize == sizeof(SERIALKEYSW))
1806 /* Indicate that no SerialKeys feature available */
1807 lpSerialKeysW->dwFlags = 0;
1808 lpSerialKeysW->lpszActivePort = NULL;
1809 lpSerialKeysW->lpszPort = NULL;
1810 lpSerialKeysW->iBaudRate = 0;
1811 lpSerialKeysW->iPortState = 0;
1812 ret = TRUE;
1814 break;
1816 WINE_SPI_FIXME(SPI_SETSERIALKEYS); /* 63 WINVER >= 0x400 */
1818 case SPI_GETSOUNDSENTRY: /* 64 */
1820 LPSOUNDSENTRYW lpSoundSentryW = pvParam;
1821 WARN("SPI_GETSOUNDSENTRY not fully implemented\n");
1822 if (lpSoundSentryW && lpSoundSentryW->cbSize == sizeof(SOUNDSENTRYW))
1824 /* Indicate that no SoundSentry feature available */
1825 lpSoundSentryW->dwFlags = 0;
1826 lpSoundSentryW->iFSTextEffect = 0;
1827 lpSoundSentryW->iFSTextEffectMSec = 0;
1828 lpSoundSentryW->iFSTextEffectColorBits = 0;
1829 lpSoundSentryW->iFSGrafEffect = 0;
1830 lpSoundSentryW->iFSGrafEffectMSec = 0;
1831 lpSoundSentryW->iFSGrafEffectColor = 0;
1832 lpSoundSentryW->iWindowsEffect = 0;
1833 lpSoundSentryW->iWindowsEffectMSec = 0;
1834 lpSoundSentryW->lpszWindowsEffectDLL = 0;
1835 lpSoundSentryW->iWindowsEffectOrdinal = 0;
1836 ret = TRUE;
1838 break;
1840 WINE_SPI_FIXME(SPI_SETSOUNDSENTRY); /* 65 */
1842 case SPI_GETHIGHCONTRAST: /* 66 WINVER >= 0x400 */
1844 LPHIGHCONTRASTW lpHighContrastW = pvParam;
1845 WARN("SPI_GETHIGHCONTRAST not fully implemented\n");
1846 if (lpHighContrastW && lpHighContrastW->cbSize == sizeof(HIGHCONTRASTW))
1848 /* Indicate that no high contrast feature available */
1849 lpHighContrastW->dwFlags = 0;
1850 lpHighContrastW->lpszDefaultScheme = NULL;
1851 ret = TRUE;
1853 break;
1855 WINE_SPI_FIXME(SPI_SETHIGHCONTRAST); /* 67 WINVER >= 0x400 */
1857 case SPI_GETKEYBOARDPREF:
1858 ret = get_entry( &entry_KEYBOARDPREF, uiParam, pvParam );
1859 break;
1860 case SPI_SETKEYBOARDPREF:
1861 ret = set_entry( &entry_KEYBOARDPREF, uiParam, pvParam, fWinIni );
1862 break;
1863 case SPI_GETSCREENREADER:
1864 ret = get_entry( &entry_SCREENREADER, uiParam, pvParam );
1865 break;
1866 case SPI_SETSCREENREADER:
1867 ret = set_entry( &entry_SCREENREADER, uiParam, pvParam, fWinIni );
1868 break;
1870 case SPI_GETANIMATION: /* 72 WINVER >= 0x400 */
1872 LPANIMATIONINFO lpAnimInfo = pvParam;
1874 /* Tell it "disabled" */
1875 if (lpAnimInfo && lpAnimInfo->cbSize == sizeof(ANIMATIONINFO))
1877 lpAnimInfo->iMinAnimate = 0; /* Minimise and restore animation is disabled (nonzero == enabled) */
1878 ret = TRUE;
1880 break;
1882 WINE_SPI_WARN(SPI_SETANIMATION); /* 73 WINVER >= 0x400 */
1884 case SPI_GETFONTSMOOTHING:
1885 ret = get_entry( &entry_FONTSMOOTHING, uiParam, pvParam );
1886 if (ret) *(UINT *)pvParam = (*(UINT *)pvParam != 0);
1887 break;
1888 case SPI_SETFONTSMOOTHING:
1889 uiParam = uiParam ? 2 : 0; /* Win NT4/2k/XP behavior */
1890 ret = set_entry( &entry_FONTSMOOTHING, uiParam, pvParam, fWinIni );
1891 break;
1892 case SPI_SETDRAGWIDTH:
1893 ret = set_entry( &entry_DRAGWIDTH, uiParam, pvParam, fWinIni );
1894 break;
1895 case SPI_SETDRAGHEIGHT:
1896 ret = set_entry( &entry_DRAGHEIGHT, uiParam, pvParam, fWinIni );
1897 break;
1899 WINE_SPI_FIXME(SPI_SETHANDHELD); /* 78 WINVER >= 0x400 */
1901 WINE_SPI_FIXME(SPI_GETLOWPOWERTIMEOUT); /* 79 WINVER >= 0x400 */
1902 WINE_SPI_FIXME(SPI_GETPOWEROFFTIMEOUT); /* 80 WINVER >= 0x400 */
1903 WINE_SPI_FIXME(SPI_SETLOWPOWERTIMEOUT); /* 81 WINVER >= 0x400 */
1904 WINE_SPI_FIXME(SPI_SETPOWEROFFTIMEOUT); /* 82 WINVER >= 0x400 */
1906 case SPI_GETLOWPOWERACTIVE:
1907 ret = get_entry( &entry_LOWPOWERACTIVE, uiParam, pvParam );
1908 break;
1909 case SPI_SETLOWPOWERACTIVE:
1910 ret = set_entry( &entry_LOWPOWERACTIVE, uiParam, pvParam, fWinIni );
1911 break;
1912 case SPI_GETPOWEROFFACTIVE:
1913 ret = get_entry( &entry_POWEROFFACTIVE, uiParam, pvParam );
1914 break;
1915 case SPI_SETPOWEROFFACTIVE:
1916 ret = set_entry( &entry_POWEROFFACTIVE, uiParam, pvParam, fWinIni );
1917 break;
1919 WINE_SPI_FIXME(SPI_SETCURSORS); /* 87 WINVER >= 0x400 */
1920 WINE_SPI_FIXME(SPI_SETICONS); /* 88 WINVER >= 0x400 */
1922 case SPI_GETDEFAULTINPUTLANG: /* 89 WINVER >= 0x400 */
1923 ret = GetKeyboardLayout(0) != 0;
1924 break;
1926 WINE_SPI_FIXME(SPI_SETDEFAULTINPUTLANG); /* 90 WINVER >= 0x400 */
1928 WINE_SPI_FIXME(SPI_SETLANGTOGGLE); /* 91 WINVER >= 0x400 */
1930 case SPI_GETWINDOWSEXTENSION: /* 92 WINVER >= 0x400 */
1931 WARN("pretend no support for Win9x Plus! for now.\n");
1932 ret = FALSE; /* yes, this is the result value */
1933 break;
1934 case SPI_SETMOUSETRAILS:
1935 ret = set_entry( &entry_MOUSETRAILS, uiParam, pvParam, fWinIni );
1936 break;
1937 case SPI_GETMOUSETRAILS:
1938 ret = get_entry( &entry_MOUSETRAILS, uiParam, pvParam );
1939 break;
1940 case SPI_GETSNAPTODEFBUTTON:
1941 ret = get_entry( &entry_SNAPTODEFBUTTON, uiParam, pvParam );
1942 break;
1943 case SPI_SETSNAPTODEFBUTTON:
1944 ret = set_entry( &entry_SNAPTODEFBUTTON, uiParam, pvParam, fWinIni );
1945 break;
1946 case SPI_SETSCREENSAVERRUNNING:
1947 ret = set_entry( &entry_SCREENSAVERRUNNING, uiParam, pvParam, fWinIni );
1948 break;
1949 case SPI_GETMOUSEHOVERWIDTH:
1950 ret = get_entry( &entry_MOUSEHOVERWIDTH, uiParam, pvParam );
1951 break;
1952 case SPI_SETMOUSEHOVERWIDTH:
1953 ret = set_entry( &entry_MOUSEHOVERWIDTH, uiParam, pvParam, fWinIni );
1954 break;
1955 case SPI_GETMOUSEHOVERHEIGHT:
1956 ret = get_entry( &entry_MOUSEHOVERHEIGHT, uiParam, pvParam );
1957 break;
1958 case SPI_SETMOUSEHOVERHEIGHT:
1959 ret = set_entry( &entry_MOUSEHOVERHEIGHT, uiParam, pvParam, fWinIni );
1960 break;
1961 case SPI_GETMOUSEHOVERTIME:
1962 ret = get_entry( &entry_MOUSEHOVERTIME, uiParam, pvParam );
1963 break;
1964 case SPI_SETMOUSEHOVERTIME:
1965 ret = set_entry( &entry_MOUSEHOVERTIME, uiParam, pvParam, fWinIni );
1966 break;
1967 case SPI_GETWHEELSCROLLLINES:
1968 ret = get_entry( &entry_WHEELSCROLLLINES, uiParam, pvParam );
1969 break;
1970 case SPI_SETWHEELSCROLLLINES:
1971 ret = set_entry( &entry_WHEELSCROLLLINES, uiParam, pvParam, fWinIni );
1972 break;
1973 case SPI_GETMENUSHOWDELAY:
1974 ret = get_entry( &entry_MENUSHOWDELAY, uiParam, pvParam );
1975 break;
1976 case SPI_SETMENUSHOWDELAY:
1977 ret = set_entry( &entry_MENUSHOWDELAY, uiParam, pvParam, fWinIni );
1978 break;
1979 case SPI_GETWHEELSCROLLCHARS:
1980 ret = get_entry( &entry_WHEELSCROLLCHARS, uiParam, pvParam );
1981 break;
1982 case SPI_SETWHEELSCROLLCHARS:
1983 ret = set_entry( &entry_WHEELSCROLLCHARS, uiParam, pvParam, fWinIni );
1984 break;
1986 WINE_SPI_FIXME(SPI_GETSHOWIMEUI); /* 110 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
1987 WINE_SPI_FIXME(SPI_SETSHOWIMEUI); /* 111 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
1989 case SPI_GETMOUSESPEED:
1990 ret = get_entry( &entry_MOUSESPEED, uiParam, pvParam );
1991 break;
1992 case SPI_SETMOUSESPEED:
1993 ret = set_entry( &entry_MOUSESPEED, uiParam, pvParam, fWinIni );
1994 break;
1995 case SPI_GETSCREENSAVERRUNNING:
1996 ret = get_entry( &entry_SCREENSAVERRUNNING, uiParam, pvParam );
1997 break;
1998 case SPI_GETDESKWALLPAPER:
1999 ret = get_entry( &entry_DESKWALLPAPER, uiParam, pvParam );
2000 break;
2001 case SPI_GETACTIVEWINDOWTRACKING:
2002 ret = get_entry( &entry_ACTIVEWINDOWTRACKING, uiParam, pvParam );
2003 break;
2004 case SPI_SETACTIVEWINDOWTRACKING:
2005 ret = set_entry( &entry_ACTIVEWINDOWTRACKING, uiParam, pvParam, fWinIni );
2006 break;
2007 case SPI_GETMENUANIMATION:
2008 ret = get_entry( &entry_MENUANIMATION, uiParam, pvParam );
2009 break;
2010 case SPI_SETMENUANIMATION:
2011 ret = set_entry( &entry_MENUANIMATION, uiParam, pvParam, fWinIni );
2012 break;
2013 case SPI_GETCOMBOBOXANIMATION:
2014 ret = get_entry( &entry_COMBOBOXANIMATION, uiParam, pvParam );
2015 break;
2016 case SPI_SETCOMBOBOXANIMATION:
2017 ret = set_entry( &entry_COMBOBOXANIMATION, uiParam, pvParam, fWinIni );
2018 break;
2019 case SPI_GETLISTBOXSMOOTHSCROLLING:
2020 ret = get_entry( &entry_LISTBOXSMOOTHSCROLLING, uiParam, pvParam );
2021 break;
2022 case SPI_SETLISTBOXSMOOTHSCROLLING:
2023 ret = set_entry( &entry_LISTBOXSMOOTHSCROLLING, uiParam, pvParam, fWinIni );
2024 break;
2025 case SPI_GETGRADIENTCAPTIONS:
2026 ret = get_entry( &entry_GRADIENTCAPTIONS, uiParam, pvParam );
2027 break;
2028 case SPI_SETGRADIENTCAPTIONS:
2029 ret = set_entry( &entry_GRADIENTCAPTIONS, uiParam, pvParam, fWinIni );
2030 break;
2031 case SPI_GETKEYBOARDCUES:
2032 ret = get_entry( &entry_KEYBOARDCUES, uiParam, pvParam );
2033 break;
2034 case SPI_SETKEYBOARDCUES:
2035 ret = set_entry( &entry_KEYBOARDCUES, uiParam, pvParam, fWinIni );
2036 break;
2037 case SPI_GETACTIVEWNDTRKZORDER:
2038 ret = get_entry( &entry_ACTIVEWNDTRKZORDER, uiParam, pvParam );
2039 break;
2040 case SPI_SETACTIVEWNDTRKZORDER:
2041 ret = set_entry( &entry_ACTIVEWNDTRKZORDER, uiParam, pvParam, fWinIni );
2042 break;
2043 case SPI_GETHOTTRACKING:
2044 ret = get_entry( &entry_HOTTRACKING, uiParam, pvParam );
2045 break;
2046 case SPI_SETHOTTRACKING:
2047 ret = set_entry( &entry_HOTTRACKING, uiParam, pvParam, fWinIni );
2048 break;
2049 case SPI_GETMENUFADE:
2050 ret = get_entry( &entry_MENUFADE, uiParam, pvParam );
2051 break;
2052 case SPI_SETMENUFADE:
2053 ret = set_entry( &entry_MENUFADE, uiParam, pvParam, fWinIni );
2054 break;
2055 case SPI_GETSELECTIONFADE:
2056 ret = get_entry( &entry_SELECTIONFADE, uiParam, pvParam );
2057 break;
2058 case SPI_SETSELECTIONFADE:
2059 ret = set_entry( &entry_SELECTIONFADE, uiParam, pvParam, fWinIni );
2060 break;
2061 case SPI_GETTOOLTIPANIMATION:
2062 ret = get_entry( &entry_TOOLTIPANIMATION, uiParam, pvParam );
2063 break;
2064 case SPI_SETTOOLTIPANIMATION:
2065 ret = set_entry( &entry_TOOLTIPANIMATION, uiParam, pvParam, fWinIni );
2066 break;
2067 case SPI_GETTOOLTIPFADE:
2068 ret = get_entry( &entry_TOOLTIPFADE, uiParam, pvParam );
2069 break;
2070 case SPI_SETTOOLTIPFADE:
2071 ret = set_entry( &entry_TOOLTIPFADE, uiParam, pvParam, fWinIni );
2072 break;
2073 case SPI_GETCURSORSHADOW:
2074 ret = get_entry( &entry_CURSORSHADOW, uiParam, pvParam );
2075 break;
2076 case SPI_SETCURSORSHADOW:
2077 ret = set_entry( &entry_CURSORSHADOW, uiParam, pvParam, fWinIni );
2078 break;
2079 case SPI_GETMOUSESONAR:
2080 ret = get_entry( &entry_MOUSESONAR, uiParam, pvParam );
2081 break;
2082 case SPI_SETMOUSESONAR:
2083 ret = set_entry( &entry_MOUSESONAR, uiParam, pvParam, fWinIni );
2084 break;
2085 case SPI_GETMOUSECLICKLOCK:
2086 ret = get_entry( &entry_MOUSECLICKLOCK, uiParam, pvParam );
2087 break;
2088 case SPI_SETMOUSECLICKLOCK:
2089 ret = set_entry( &entry_MOUSECLICKLOCK, uiParam, pvParam, fWinIni );
2090 break;
2091 case SPI_GETMOUSEVANISH:
2092 ret = get_entry( &entry_MOUSEVANISH, uiParam, pvParam );
2093 break;
2094 case SPI_SETMOUSEVANISH:
2095 ret = set_entry( &entry_MOUSEVANISH, uiParam, pvParam, fWinIni );
2096 break;
2097 case SPI_GETFLATMENU:
2098 ret = get_entry( &entry_FLATMENU, uiParam, pvParam );
2099 break;
2100 case SPI_SETFLATMENU:
2101 ret = set_entry( &entry_FLATMENU, uiParam, pvParam, fWinIni );
2102 break;
2103 case SPI_GETDROPSHADOW:
2104 ret = get_entry( &entry_DROPSHADOW, uiParam, pvParam );
2105 break;
2106 case SPI_SETDROPSHADOW:
2107 ret = set_entry( &entry_DROPSHADOW, uiParam, pvParam, fWinIni );
2108 break;
2109 case SPI_GETBLOCKSENDINPUTRESETS:
2110 ret = get_entry( &entry_BLOCKSENDINPUTRESETS, uiParam, pvParam );
2111 break;
2112 case SPI_SETBLOCKSENDINPUTRESETS:
2113 ret = set_entry( &entry_BLOCKSENDINPUTRESETS, uiParam, pvParam, fWinIni );
2114 break;
2115 case SPI_GETUIEFFECTS:
2116 ret = get_entry( &entry_UIEFFECTS, uiParam, pvParam );
2117 break;
2118 case SPI_SETUIEFFECTS:
2119 /* FIXME: this probably should mask other UI effect values when unset */
2120 ret = set_entry( &entry_UIEFFECTS, uiParam, pvParam, fWinIni );
2121 break;
2122 case SPI_GETDISABLEOVERLAPPEDCONTENT:
2123 ret = get_entry( &entry_DISABLEOVERLAPPEDCONTENT, uiParam, pvParam );
2124 break;
2125 case SPI_SETDISABLEOVERLAPPEDCONTENT:
2126 ret = set_entry( &entry_DISABLEOVERLAPPEDCONTENT, uiParam, pvParam, fWinIni );
2127 break;
2128 case SPI_GETCLIENTAREAANIMATION:
2129 ret = get_entry( &entry_CLIENTAREAANIMATION, uiParam, pvParam );
2130 break;
2131 case SPI_SETCLIENTAREAANIMATION:
2132 ret = set_entry( &entry_CLIENTAREAANIMATION, uiParam, pvParam, fWinIni );
2133 break;
2134 case SPI_GETCLEARTYPE:
2135 ret = get_entry( &entry_CLEARTYPE, uiParam, pvParam );
2136 break;
2137 case SPI_SETCLEARTYPE:
2138 ret = set_entry( &entry_CLEARTYPE, uiParam, pvParam, fWinIni );
2139 break;
2140 case SPI_GETSPEECHRECOGNITION:
2141 ret = get_entry( &entry_SPEECHRECOGNITION, uiParam, pvParam );
2142 break;
2143 case SPI_SETSPEECHRECOGNITION:
2144 ret = set_entry( &entry_SPEECHRECOGNITION, uiParam, pvParam, fWinIni );
2145 break;
2146 case SPI_GETFOREGROUNDLOCKTIMEOUT:
2147 ret = get_entry( &entry_FOREGROUNDLOCKTIMEOUT, uiParam, pvParam );
2148 break;
2149 case SPI_SETFOREGROUNDLOCKTIMEOUT:
2150 /* FIXME: this should check that the calling thread
2151 * is able to change the foreground window */
2152 ret = set_entry( &entry_FOREGROUNDLOCKTIMEOUT, uiParam, pvParam, fWinIni );
2153 break;
2154 case SPI_GETACTIVEWNDTRKTIMEOUT:
2155 ret = get_entry( &entry_ACTIVEWNDTRKTIMEOUT, uiParam, pvParam );
2156 break;
2157 case SPI_SETACTIVEWNDTRKTIMEOUT:
2158 ret = get_entry( &entry_ACTIVEWNDTRKTIMEOUT, uiParam, pvParam );
2159 break;
2160 case SPI_GETFOREGROUNDFLASHCOUNT:
2161 ret = get_entry( &entry_FOREGROUNDFLASHCOUNT, uiParam, pvParam );
2162 break;
2163 case SPI_SETFOREGROUNDFLASHCOUNT:
2164 ret = set_entry( &entry_FOREGROUNDFLASHCOUNT, uiParam, pvParam, fWinIni );
2165 break;
2166 case SPI_GETCARETWIDTH:
2167 ret = get_entry( &entry_CARETWIDTH, uiParam, pvParam );
2168 break;
2169 case SPI_SETCARETWIDTH:
2170 ret = set_entry( &entry_CARETWIDTH, uiParam, pvParam, fWinIni );
2171 break;
2172 case SPI_GETMOUSECLICKLOCKTIME:
2173 ret = get_entry( &entry_MOUSECLICKLOCKTIME, uiParam, pvParam );
2174 break;
2175 case SPI_SETMOUSECLICKLOCKTIME:
2176 ret = set_entry( &entry_MOUSECLICKLOCKTIME, uiParam, pvParam, fWinIni );
2177 break;
2178 case SPI_GETFONTSMOOTHINGTYPE:
2179 ret = get_entry( &entry_FONTSMOOTHINGTYPE, uiParam, pvParam );
2180 break;
2181 case SPI_SETFONTSMOOTHINGTYPE:
2182 ret = set_entry( &entry_FONTSMOOTHINGTYPE, uiParam, pvParam, fWinIni );
2183 break;
2184 case SPI_GETFONTSMOOTHINGCONTRAST:
2185 ret = get_entry( &entry_FONTSMOOTHINGCONTRAST, uiParam, pvParam );
2186 break;
2187 case SPI_SETFONTSMOOTHINGCONTRAST:
2188 ret = set_entry( &entry_FONTSMOOTHINGCONTRAST, uiParam, pvParam, fWinIni );
2189 break;
2190 case SPI_GETFOCUSBORDERWIDTH:
2191 ret = get_entry( &entry_FOCUSBORDERWIDTH, uiParam, pvParam );
2192 break;
2193 case SPI_GETFOCUSBORDERHEIGHT:
2194 ret = get_entry( &entry_FOCUSBORDERHEIGHT, uiParam, pvParam );
2195 break;
2196 case SPI_SETFOCUSBORDERWIDTH:
2197 ret = set_entry( &entry_FOCUSBORDERWIDTH, uiParam, pvParam, fWinIni );
2198 break;
2199 case SPI_SETFOCUSBORDERHEIGHT:
2200 ret = set_entry( &entry_FOCUSBORDERHEIGHT, uiParam, pvParam, fWinIni );
2201 break;
2202 case SPI_GETFONTSMOOTHINGORIENTATION:
2203 ret = get_entry( &entry_FONTSMOOTHINGORIENTATION, uiParam, pvParam );
2204 break;
2205 case SPI_SETFONTSMOOTHINGORIENTATION:
2206 ret = set_entry( &entry_FONTSMOOTHINGORIENTATION, uiParam, pvParam, fWinIni );
2207 break;
2209 default:
2210 FIXME( "Unknown action: %u\n", uiAction );
2211 SetLastError( ERROR_INVALID_SPI_VALUE );
2212 ret = FALSE;
2213 break;
2216 if (ret)
2217 SYSPARAMS_NotifyChange( uiAction, fWinIni );
2218 TRACE("(%u, %u, %p, %u) ret %d\n",
2219 uiAction, uiParam, pvParam, fWinIni, ret);
2220 return ret;
2222 #undef WINE_SPI_FIXME
2223 #undef WINE_SPI_WARN
2227 /***********************************************************************
2228 * SystemParametersInfoA (USER32.@)
2230 BOOL WINAPI SystemParametersInfoA( UINT uiAction, UINT uiParam,
2231 PVOID pvParam, UINT fuWinIni )
2233 BOOL ret;
2235 TRACE("(%u, %u, %p, %u)\n", uiAction, uiParam, pvParam, fuWinIni);
2237 switch (uiAction)
2239 case SPI_SETDESKWALLPAPER: /* 20 */
2240 case SPI_SETDESKPATTERN: /* 21 */
2242 WCHAR buffer[256];
2243 if (pvParam)
2244 if (!MultiByteToWideChar( CP_ACP, 0, pvParam, -1, buffer,
2245 sizeof(buffer)/sizeof(WCHAR) ))
2246 buffer[sizeof(buffer)/sizeof(WCHAR)-1] = 0;
2247 ret = SystemParametersInfoW( uiAction, uiParam, pvParam ? buffer : NULL, fuWinIni );
2248 break;
2251 case SPI_GETICONTITLELOGFONT: /* 31 */
2253 LOGFONTW tmp;
2254 ret = SystemParametersInfoW( uiAction, uiParam, pvParam ? &tmp : NULL, fuWinIni );
2255 if (ret && pvParam)
2256 SYSPARAMS_LogFont32WTo32A( &tmp, pvParam );
2257 break;
2260 case SPI_GETNONCLIENTMETRICS: /* 41 WINVER >= 0x400 */
2262 NONCLIENTMETRICSW tmp;
2263 LPNONCLIENTMETRICSA lpnmA = pvParam;
2264 if (lpnmA && (lpnmA->cbSize == sizeof(NONCLIENTMETRICSA) ||
2265 lpnmA->cbSize == FIELD_OFFSET(NONCLIENTMETRICSA, iPaddedBorderWidth)))
2267 tmp.cbSize = sizeof(NONCLIENTMETRICSW);
2268 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2269 if (ret)
2270 SYSPARAMS_NonClientMetrics32WTo32A( &tmp, lpnmA );
2272 else
2273 ret = FALSE;
2274 break;
2277 case SPI_SETNONCLIENTMETRICS: /* 42 WINVER >= 0x400 */
2279 NONCLIENTMETRICSW tmp;
2280 LPNONCLIENTMETRICSA lpnmA = pvParam;
2281 if (lpnmA && (lpnmA->cbSize == sizeof(NONCLIENTMETRICSA) ||
2282 lpnmA->cbSize == FIELD_OFFSET(NONCLIENTMETRICSA, iPaddedBorderWidth)))
2284 tmp.cbSize = sizeof(NONCLIENTMETRICSW);
2285 SYSPARAMS_NonClientMetrics32ATo32W( lpnmA, &tmp );
2286 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2288 else
2289 ret = FALSE;
2290 break;
2293 case SPI_GETICONMETRICS: /* 45 WINVER >= 0x400 */
2295 ICONMETRICSW tmp;
2296 LPICONMETRICSA lpimA = pvParam;
2297 if (lpimA && lpimA->cbSize == sizeof(ICONMETRICSA))
2299 tmp.cbSize = sizeof(ICONMETRICSW);
2300 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2301 if (ret)
2303 lpimA->iHorzSpacing = tmp.iHorzSpacing;
2304 lpimA->iVertSpacing = tmp.iVertSpacing;
2305 lpimA->iTitleWrap = tmp.iTitleWrap;
2306 SYSPARAMS_LogFont32WTo32A( &tmp.lfFont, &lpimA->lfFont );
2309 else
2310 ret = FALSE;
2311 break;
2314 case SPI_SETICONMETRICS: /* 46 WINVER >= 0x400 */
2316 ICONMETRICSW tmp;
2317 LPICONMETRICSA lpimA = pvParam;
2318 if (lpimA && lpimA->cbSize == sizeof(ICONMETRICSA))
2320 tmp.cbSize = sizeof(ICONMETRICSW);
2321 tmp.iHorzSpacing = lpimA->iHorzSpacing;
2322 tmp.iVertSpacing = lpimA->iVertSpacing;
2323 tmp.iTitleWrap = lpimA->iTitleWrap;
2324 SYSPARAMS_LogFont32ATo32W( &lpimA->lfFont, &tmp.lfFont);
2325 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2327 else
2328 ret = FALSE;
2329 break;
2332 case SPI_GETHIGHCONTRAST: /* 66 WINVER >= 0x400 */
2334 HIGHCONTRASTW tmp;
2335 LPHIGHCONTRASTA lphcA = pvParam;
2336 if (lphcA && lphcA->cbSize == sizeof(HIGHCONTRASTA))
2338 tmp.cbSize = sizeof(HIGHCONTRASTW);
2339 ret = SystemParametersInfoW( uiAction, uiParam, &tmp, fuWinIni );
2340 if (ret)
2342 lphcA->dwFlags = tmp.dwFlags;
2343 lphcA->lpszDefaultScheme = NULL; /* FIXME? */
2346 else
2347 ret = FALSE;
2348 break;
2351 case SPI_GETDESKWALLPAPER: /* 115 */
2353 WCHAR buffer[MAX_PATH];
2354 ret = (SystemParametersInfoW( SPI_GETDESKWALLPAPER, uiParam, buffer, fuWinIni ) &&
2355 WideCharToMultiByte(CP_ACP, 0, buffer, -1, pvParam, uiParam, NULL, NULL));
2356 break;
2359 default:
2360 ret = SystemParametersInfoW( uiAction, uiParam, pvParam, fuWinIni );
2361 break;
2363 return ret;
2367 /***********************************************************************
2368 * GetSystemMetrics (USER32.@)
2370 INT WINAPI GetSystemMetrics( INT index )
2372 NONCLIENTMETRICSW ncm;
2373 UINT ret;
2375 /* some metrics are dynamic */
2376 switch (index)
2378 case SM_CXSCREEN:
2379 return GetDeviceCaps( get_display_dc(), HORZRES );
2380 case SM_CYSCREEN:
2381 return GetDeviceCaps( get_display_dc(), VERTRES );
2382 case SM_CXVSCROLL:
2383 case SM_CYHSCROLL:
2384 get_entry( &entry_SCROLLWIDTH, 0, &ret );
2385 return max( 8, ret );
2386 case SM_CYCAPTION:
2387 return GetSystemMetrics( SM_CYSIZE ) + 1;
2388 case SM_CXBORDER:
2389 case SM_CYBORDER:
2390 /* SM_C{X,Y}BORDER always returns 1 regardless of 'BorderWidth' value in registry */
2391 return 1;
2392 case SM_CXDLGFRAME:
2393 case SM_CYDLGFRAME:
2394 return 3;
2395 case SM_CYVTHUMB:
2396 case SM_CXHTHUMB:
2397 case SM_CYVSCROLL:
2398 case SM_CXHSCROLL:
2399 get_entry( &entry_SCROLLHEIGHT, 0, &ret );
2400 return max( 8, ret );
2401 case SM_CXICON:
2402 case SM_CYICON:
2403 get_entry( &entry_ICONSIZE, 0, &ret );
2404 return ret;
2405 case SM_CXCURSOR:
2406 case SM_CYCURSOR:
2407 return 32;
2408 case SM_CYMENU:
2409 return GetSystemMetrics(SM_CYMENUSIZE) + 1;
2410 case SM_CXFULLSCREEN:
2411 /* see the remark for SM_CXMAXIMIZED, at least this formulation is
2412 * correct */
2413 return GetSystemMetrics( SM_CXMAXIMIZED) - 2 * GetSystemMetrics( SM_CXFRAME);
2414 case SM_CYFULLSCREEN:
2415 /* see the remark for SM_CYMAXIMIZED, at least this formulation is
2416 * correct */
2417 return GetSystemMetrics( SM_CYMAXIMIZED) - GetSystemMetrics( SM_CYMIN);
2418 case SM_CYKANJIWINDOW:
2419 return 0;
2420 case SM_MOUSEPRESENT:
2421 return 1;
2422 case SM_DEBUG:
2423 return 0;
2424 case SM_SWAPBUTTON:
2425 get_entry( &entry_MOUSEBUTTONSWAP, 0, &ret );
2426 return ret;
2427 case SM_RESERVED1:
2428 case SM_RESERVED2:
2429 case SM_RESERVED3:
2430 case SM_RESERVED4:
2431 return 0;
2432 case SM_CXMIN:
2433 ncm.cbSize = sizeof(ncm);
2434 SystemParametersInfoW( SPI_GETNONCLIENTMETRICS, 0, &ncm, 0 );
2435 get_text_metr_size( get_display_dc(), &ncm.lfCaptionFont, NULL, &ret );
2436 return 3 * ncm.iCaptionWidth + ncm.iCaptionHeight + 4 * ret + 2 * GetSystemMetrics(SM_CXFRAME) + 4;
2437 case SM_CYMIN:
2438 return GetSystemMetrics( SM_CYCAPTION) + 2 * GetSystemMetrics( SM_CYFRAME);
2439 case SM_CXSIZE:
2440 get_entry( &entry_CAPTIONWIDTH, 0, &ret );
2441 return max( 8, ret );
2442 case SM_CYSIZE:
2443 ncm.cbSize = sizeof(ncm);
2444 SystemParametersInfoW( SPI_GETNONCLIENTMETRICS, 0, &ncm, 0 );
2445 return ncm.iCaptionHeight;
2446 case SM_CXFRAME:
2447 get_entry( &entry_BORDER, 0, &ret );
2448 return GetSystemMetrics(SM_CXDLGFRAME) + max( 1, ret );
2449 case SM_CYFRAME:
2450 get_entry( &entry_BORDER, 0, &ret );
2451 return GetSystemMetrics(SM_CYDLGFRAME) + max( 1, ret );
2452 case SM_CXMINTRACK:
2453 return GetSystemMetrics(SM_CXMIN);
2454 case SM_CYMINTRACK:
2455 return GetSystemMetrics(SM_CYMIN);
2456 case SM_CXDOUBLECLK:
2457 get_entry( &entry_DOUBLECLKWIDTH, 0, &ret );
2458 return ret;
2459 case SM_CYDOUBLECLK:
2460 get_entry( &entry_DOUBLECLKHEIGHT, 0, &ret );
2461 return ret;
2462 case SM_CXICONSPACING:
2463 get_entry( &entry_ICONHORIZONTALSPACING, 0, &ret );
2464 return ret;
2465 case SM_CYICONSPACING:
2466 get_entry( &entry_ICONVERTICALSPACING, 0, &ret );
2467 return ret;
2468 case SM_MENUDROPALIGNMENT:
2469 get_entry( &entry_MENUDROPALIGNMENT, 0, &ret );
2470 return ret;
2471 case SM_PENWINDOWS:
2472 return 0;
2473 case SM_DBCSENABLED:
2475 CPINFO cpinfo;
2476 GetCPInfo( CP_ACP, &cpinfo );
2477 return (cpinfo.MaxCharSize > 1);
2479 case SM_CMOUSEBUTTONS:
2480 return 3;
2481 case SM_SECURE:
2482 return 0;
2483 case SM_CXEDGE:
2484 return GetSystemMetrics(SM_CXBORDER) + 1;
2485 case SM_CYEDGE:
2486 return GetSystemMetrics(SM_CYBORDER) + 1;
2487 case SM_CXMINSPACING:
2488 get_entry( &entry_MINHORZGAP, 0, &ret );
2489 return GetSystemMetrics(SM_CXMINIMIZED) + max( 0, (INT)ret );
2490 case SM_CYMINSPACING:
2491 get_entry( &entry_MINVERTGAP, 0, &ret );
2492 return GetSystemMetrics(SM_CYMINIMIZED) + max( 0, (INT)ret );
2493 case SM_CXSMICON:
2494 case SM_CYSMICON:
2495 return 16;
2496 case SM_CYSMCAPTION:
2497 return GetSystemMetrics(SM_CYSMSIZE) + 1;
2498 case SM_CXSMSIZE:
2499 get_entry( &entry_SMCAPTIONWIDTH, 0, &ret );
2500 return ret;
2501 case SM_CYSMSIZE:
2502 ncm.cbSize = sizeof(ncm);
2503 SystemParametersInfoW( SPI_GETNONCLIENTMETRICS, 0, &ncm, 0 );
2504 return ncm.iSmCaptionHeight;
2505 case SM_CXMENUSIZE:
2506 get_entry( &entry_MENUWIDTH, 0, &ret );
2507 return ret;
2508 case SM_CYMENUSIZE:
2509 ncm.cbSize = sizeof(ncm);
2510 SystemParametersInfoW( SPI_GETNONCLIENTMETRICS, 0, &ncm, 0 );
2511 return ncm.iMenuHeight;
2512 case SM_ARRANGE:
2513 get_entry( &entry_MINARRANGE, 0, &ret );
2514 return ret & 0x0f;
2515 case SM_CXMINIMIZED:
2516 get_entry( &entry_MINWIDTH, 0, &ret );
2517 return max( 0, (INT)ret ) + 6;
2518 case SM_CYMINIMIZED:
2519 return GetSystemMetrics( SM_CYSIZE ) + 6;
2520 case SM_CXMAXTRACK:
2521 return GetSystemMetrics(SM_CXVIRTUALSCREEN) + 4 + 2 * GetSystemMetrics(SM_CXFRAME);
2522 case SM_CYMAXTRACK:
2523 return GetSystemMetrics(SM_CYVIRTUALSCREEN) + 4 + 2 * GetSystemMetrics(SM_CYFRAME);
2524 case SM_CXMAXIMIZED:
2525 /* FIXME: subtract the width of any vertical application toolbars*/
2526 return GetSystemMetrics(SM_CXSCREEN) + 2 * GetSystemMetrics(SM_CXFRAME);
2527 case SM_CYMAXIMIZED:
2528 /* FIXME: subtract the width of any horizontal application toolbars*/
2529 return GetSystemMetrics(SM_CYSCREEN) + 2 * GetSystemMetrics(SM_CYCAPTION);
2530 case SM_NETWORK:
2531 return 3; /* FIXME */
2532 case SM_CLEANBOOT:
2533 return 0; /* 0 = ok, 1 = failsafe, 2 = failsafe + network */
2534 case SM_CXDRAG:
2535 get_entry( &entry_DRAGWIDTH, 0, &ret );
2536 return ret;
2537 case SM_CYDRAG:
2538 get_entry( &entry_DRAGHEIGHT, 0, &ret );
2539 return ret;
2540 case SM_SHOWSOUNDS:
2541 get_entry( &entry_SHOWSOUNDS, 0, &ret );
2542 return ret;
2543 case SM_CXMENUCHECK:
2544 case SM_CYMENUCHECK:
2546 TEXTMETRICW tm;
2547 ncm.cbSize = sizeof(ncm);
2548 SystemParametersInfoW( SPI_GETNONCLIENTMETRICS, 0, &ncm, 0 );
2549 get_text_metr_size( get_display_dc(), &ncm.lfMenuFont, &tm, NULL);
2550 return tm.tmHeight <= 0 ? 13 : ((tm.tmHeight + tm.tmExternalLeading + 1) / 2) * 2 - 1;
2552 case SM_SLOWMACHINE:
2553 return 0; /* Never true */
2554 case SM_MIDEASTENABLED:
2555 return 0; /* FIXME */
2556 case SM_MOUSEWHEELPRESENT:
2557 return 1;
2558 case SM_XVIRTUALSCREEN:
2560 RECT rect = get_virtual_screen_rect();
2561 return rect.left;
2563 case SM_YVIRTUALSCREEN:
2565 RECT rect = get_virtual_screen_rect();
2566 return rect.top;
2568 case SM_CXVIRTUALSCREEN:
2570 RECT rect = get_virtual_screen_rect();
2571 return rect.right - rect.left;
2573 case SM_CYVIRTUALSCREEN:
2575 RECT rect = get_virtual_screen_rect();
2576 return rect.bottom - rect.top;
2578 case SM_CMONITORS:
2580 struct monitor_info info;
2581 get_monitors_info( &info );
2582 return info.count;
2584 case SM_SAMEDISPLAYFORMAT:
2585 return 1;
2586 case SM_IMMENABLED:
2587 return 0; /* FIXME */
2588 case SM_CXFOCUSBORDER:
2589 case SM_CYFOCUSBORDER:
2590 return 1;
2591 case SM_TABLETPC:
2592 case SM_MEDIACENTER:
2593 return 0;
2594 case SM_CMETRICS:
2595 return SM_CMETRICS;
2596 default:
2597 return 0;
2602 /***********************************************************************
2603 * SwapMouseButton (USER32.@)
2604 * Reverse or restore the meaning of the left and right mouse buttons
2605 * fSwap [I ] TRUE - reverse, FALSE - original
2606 * RETURN
2607 * previous state
2609 BOOL WINAPI SwapMouseButton( BOOL fSwap )
2611 BOOL prev = GetSystemMetrics(SM_SWAPBUTTON);
2612 SystemParametersInfoW(SPI_SETMOUSEBUTTONSWAP, fSwap, 0, 0);
2613 return prev;
2617 /**********************************************************************
2618 * SetDoubleClickTime (USER32.@)
2620 BOOL WINAPI SetDoubleClickTime( UINT interval )
2622 return SystemParametersInfoW(SPI_SETDOUBLECLICKTIME, interval, 0, 0);
2626 /**********************************************************************
2627 * GetDoubleClickTime (USER32.@)
2629 UINT WINAPI GetDoubleClickTime(void)
2631 UINT time = 0;
2633 get_entry( &entry_DOUBLECLICKTIME, 0, &time );
2634 if (!time) time = 500;
2635 return time;
2639 /*************************************************************************
2640 * GetSysColor (USER32.@)
2642 COLORREF WINAPI DECLSPEC_HOTPATCH GetSysColor( INT nIndex )
2644 COLORREF ret = 0;
2646 if (nIndex >= 0 && nIndex < NUM_SYS_COLORS) get_entry( &system_colors[nIndex], 0, &ret );
2647 return ret;
2651 /*************************************************************************
2652 * SetSysColors (USER32.@)
2654 BOOL WINAPI SetSysColors( INT count, const INT *colors, const COLORREF *values )
2656 int i;
2658 if (IS_INTRESOURCE(colors)) return FALSE; /* stupid app passes a color instead of an array */
2660 for (i = 0; i < count; i++)
2661 if (colors[i] >= 0 && colors[i] <= NUM_SYS_COLORS)
2662 set_entry( &system_colors[colors[i]], values[i], 0, 0 );
2664 /* Send WM_SYSCOLORCHANGE message to all windows */
2666 SendMessageTimeoutW( HWND_BROADCAST, WM_SYSCOLORCHANGE, 0, 0, SMTO_ABORTIFHUNG, 2000, NULL );
2668 /* Repaint affected portions of all visible windows */
2670 RedrawWindow( GetDesktopWindow(), NULL, 0,
2671 RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN );
2672 return TRUE;
2676 /*************************************************************************
2677 * SetSysColorsTemp (USER32.@)
2679 DWORD_PTR WINAPI SetSysColorsTemp( const COLORREF *pPens, const HBRUSH *pBrushes, DWORD_PTR n)
2681 FIXME( "no longer supported\n" );
2682 return FALSE;
2686 /***********************************************************************
2687 * GetSysColorBrush (USER32.@)
2689 HBRUSH WINAPI DECLSPEC_HOTPATCH GetSysColorBrush( INT index )
2691 if (index < 0 || index >= NUM_SYS_COLORS) return 0;
2693 if (!system_colors[index].brush)
2695 HBRUSH brush = CreateSolidBrush( GetSysColor( index ));
2696 __wine_make_gdi_object_system( brush, TRUE );
2697 if (InterlockedCompareExchangePointer( (void **)&system_colors[index].brush, brush, 0 ))
2699 __wine_make_gdi_object_system( brush, FALSE );
2700 DeleteObject( brush );
2703 return system_colors[index].brush;
2707 /***********************************************************************
2708 * SYSCOLOR_GetPen
2710 HPEN SYSCOLOR_GetPen( INT index )
2712 /* We can assert here, because this function is internal to Wine */
2713 assert (0 <= index && index < NUM_SYS_COLORS);
2715 if (!system_colors[index].pen)
2717 HPEN pen = CreatePen( PS_SOLID, 1, GetSysColor( index ));
2718 __wine_make_gdi_object_system( pen, TRUE );
2719 if (InterlockedCompareExchangePointer( (void **)&system_colors[index].pen, pen, 0 ))
2721 __wine_make_gdi_object_system( pen, FALSE );
2722 DeleteObject( pen );
2725 return system_colors[index].pen;
2729 /***********************************************************************
2730 * SYSCOLOR_Get55AABrush
2732 HBRUSH SYSCOLOR_Get55AABrush(void)
2734 static const WORD pattern[] = { 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa };
2735 static HBRUSH brush_55aa;
2737 if (!brush_55aa)
2739 HBITMAP bitmap = CreateBitmap( 8, 8, 1, 1, pattern );
2740 HBRUSH brush = CreatePatternBrush( bitmap );
2741 DeleteObject( bitmap );
2742 __wine_make_gdi_object_system( brush, TRUE );
2743 if (InterlockedCompareExchangePointer( (void **)&brush_55aa, brush, 0 ))
2745 __wine_make_gdi_object_system( brush, FALSE );
2746 DeleteObject( brush );
2749 return brush_55aa;
2752 /***********************************************************************
2753 * ChangeDisplaySettingsA (USER32.@)
2755 LONG WINAPI ChangeDisplaySettingsA( LPDEVMODEA devmode, DWORD flags )
2757 if (devmode) devmode->dmDriverExtra = 0;
2759 return ChangeDisplaySettingsExA(NULL,devmode,NULL,flags,NULL);
2763 /***********************************************************************
2764 * ChangeDisplaySettingsW (USER32.@)
2766 LONG WINAPI ChangeDisplaySettingsW( LPDEVMODEW devmode, DWORD flags )
2768 if (devmode) devmode->dmDriverExtra = 0;
2770 return ChangeDisplaySettingsExW(NULL,devmode,NULL,flags,NULL);
2774 /***********************************************************************
2775 * ChangeDisplaySettingsExA (USER32.@)
2777 LONG WINAPI ChangeDisplaySettingsExA( LPCSTR devname, LPDEVMODEA devmode, HWND hwnd,
2778 DWORD flags, LPVOID lparam )
2780 LONG ret;
2781 UNICODE_STRING nameW;
2783 if (devname) RtlCreateUnicodeStringFromAsciiz(&nameW, devname);
2784 else nameW.Buffer = NULL;
2786 if (devmode)
2788 DEVMODEW *devmodeW;
2790 devmodeW = GdiConvertToDevmodeW(devmode);
2791 if (devmodeW)
2793 ret = ChangeDisplaySettingsExW(nameW.Buffer, devmodeW, hwnd, flags, lparam);
2794 HeapFree(GetProcessHeap(), 0, devmodeW);
2796 else
2797 ret = DISP_CHANGE_SUCCESSFUL;
2799 else
2801 ret = ChangeDisplaySettingsExW(nameW.Buffer, NULL, hwnd, flags, lparam);
2804 if (devname) RtlFreeUnicodeString(&nameW);
2805 return ret;
2809 /***********************************************************************
2810 * ChangeDisplaySettingsExW (USER32.@)
2812 LONG WINAPI ChangeDisplaySettingsExW( LPCWSTR devname, LPDEVMODEW devmode, HWND hwnd,
2813 DWORD flags, LPVOID lparam )
2815 return USER_Driver->pChangeDisplaySettingsEx( devname, devmode, hwnd, flags, lparam );
2819 /***********************************************************************
2820 * DisplayConfigGetDeviceInfo (USER32.@)
2822 LONG WINAPI DisplayConfigGetDeviceInfo(DISPLAYCONFIG_DEVICE_INFO_HEADER *packet)
2824 FIXME("stub: %p\n", packet);
2825 return ERROR_NOT_SUPPORTED;
2828 /***********************************************************************
2829 * EnumDisplaySettingsW (USER32.@)
2831 * RETURNS
2832 * TRUE if nth setting exists found (described in the LPDEVMODEW struct)
2833 * FALSE if we do not have the nth setting
2835 BOOL WINAPI EnumDisplaySettingsW( LPCWSTR name, DWORD n, LPDEVMODEW devmode )
2837 return EnumDisplaySettingsExW(name, n, devmode, 0);
2841 /***********************************************************************
2842 * EnumDisplaySettingsA (USER32.@)
2844 BOOL WINAPI EnumDisplaySettingsA(LPCSTR name,DWORD n,LPDEVMODEA devmode)
2846 return EnumDisplaySettingsExA(name, n, devmode, 0);
2850 /***********************************************************************
2851 * EnumDisplaySettingsExA (USER32.@)
2853 BOOL WINAPI EnumDisplaySettingsExA(LPCSTR lpszDeviceName, DWORD iModeNum,
2854 LPDEVMODEA lpDevMode, DWORD dwFlags)
2856 DEVMODEW devmodeW;
2857 BOOL ret;
2858 UNICODE_STRING nameW;
2860 if (lpszDeviceName) RtlCreateUnicodeStringFromAsciiz(&nameW, lpszDeviceName);
2861 else nameW.Buffer = NULL;
2863 ret = EnumDisplaySettingsExW(nameW.Buffer,iModeNum,&devmodeW,dwFlags);
2864 if (ret)
2866 lpDevMode->dmSize = FIELD_OFFSET(DEVMODEA, dmICMMethod);
2867 lpDevMode->dmSpecVersion = devmodeW.dmSpecVersion;
2868 lpDevMode->dmDriverVersion = devmodeW.dmDriverVersion;
2869 WideCharToMultiByte(CP_ACP, 0, devmodeW.dmDeviceName, -1,
2870 (LPSTR)lpDevMode->dmDeviceName, CCHDEVICENAME, NULL, NULL);
2871 lpDevMode->dmDriverExtra = 0; /* FIXME */
2872 lpDevMode->dmBitsPerPel = devmodeW.dmBitsPerPel;
2873 lpDevMode->dmPelsHeight = devmodeW.dmPelsHeight;
2874 lpDevMode->dmPelsWidth = devmodeW.dmPelsWidth;
2875 lpDevMode->u2.dmDisplayFlags = devmodeW.u2.dmDisplayFlags;
2876 lpDevMode->dmDisplayFrequency = devmodeW.dmDisplayFrequency;
2877 lpDevMode->dmFields = devmodeW.dmFields;
2879 lpDevMode->u1.s2.dmPosition.x = devmodeW.u1.s2.dmPosition.x;
2880 lpDevMode->u1.s2.dmPosition.y = devmodeW.u1.s2.dmPosition.y;
2881 lpDevMode->u1.s2.dmDisplayOrientation = devmodeW.u1.s2.dmDisplayOrientation;
2882 lpDevMode->u1.s2.dmDisplayFixedOutput = devmodeW.u1.s2.dmDisplayFixedOutput;
2884 if (lpszDeviceName) RtlFreeUnicodeString(&nameW);
2885 return ret;
2889 /***********************************************************************
2890 * EnumDisplaySettingsExW (USER32.@)
2892 BOOL WINAPI EnumDisplaySettingsExW(LPCWSTR lpszDeviceName, DWORD iModeNum,
2893 LPDEVMODEW lpDevMode, DWORD dwFlags)
2895 return USER_Driver->pEnumDisplaySettingsEx(lpszDeviceName, iModeNum, lpDevMode, dwFlags);
2898 /***********************************************************************
2899 * SetProcessDPIAware (USER32.@)
2901 BOOL WINAPI SetProcessDPIAware( VOID )
2903 FIXME( "stub!\n");
2905 return TRUE;
2908 /***********************************************************************
2909 * IsProcessDPIAware (USER32.@)
2911 BOOL WINAPI IsProcessDPIAware(void)
2913 FIXME( "stub!\n");
2914 return FALSE;