1 /* Unit test suite for functions SystemParametersInfo and GetSystemMetrics.
3 * Copyright 2002 Andriy Palamarchuk
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include "wine/test.h"
29 #ifndef IDI_APPLICATIONA
30 # define IDI_APPLICATIONA IDI_APPLICATION
33 # define IDC_ARROWA IDC_ARROW
36 #ifndef SPI_GETDESKWALLPAPER
37 # define SPI_GETDESKWALLPAPER 0x0073
42 #define eq(received, expected, label, type) \
43 ok((received) == (expected), "%s: got " type " instead of " type, (label),(received),(expected))
46 #define SPI_SETBEEP_REGKEY "Control Panel\\Sound"
47 #define SPI_SETBEEP_VALNAME "Beep"
48 #define SPI_SETMOUSE_REGKEY "Control Panel\\Mouse"
49 #define SPI_SETMOUSE_VALNAME1 "MouseThreshold1"
50 #define SPI_SETMOUSE_VALNAME2 "MouseThreshold2"
51 #define SPI_SETMOUSE_VALNAME3 "MouseSpeed"
52 #define SPI_SETBORDER_REGKEY "Control Panel\\Desktop\\WindowMetrics"
53 #define SPI_SETBORDER_VALNAME "BorderWidth"
54 #define SPI_SETKEYBOARDSPEED_REGKEY "Control Panel\\Keyboard"
55 #define SPI_SETKEYBOARDSPEED_VALNAME "KeyboardSpeed"
56 #define SPI_SETSCREENSAVETIMEOUT_REGKEY "Control Panel\\Desktop"
57 #define SPI_SETSCREENSAVETIMEOUT_VALNAME "ScreenSaveTimeOut"
58 #define SPI_SETSCREENSAVEACTIVE_REGKEY "Control Panel\\Desktop"
59 #define SPI_SETSCREENSAVEACTIVE_VALNAME "ScreenSaveActive"
60 #define SPI_SETGRIDGRANULARITY_REGKEY "Control Panel\\Desktop"
61 #define SPI_SETGRIDGRANULARITY_VALNAME "GridGranularity"
62 #define SPI_SETKEYBOARDDELAY_REGKEY "Control Panel\\Keyboard"
63 #define SPI_SETKEYBOARDDELAY_VALNAME "KeyboardDelay"
64 #define SPI_SETICONTITLEWRAP_REGKEY1 "Control Panel\\Desktop\\WindowMetrics"
65 #define SPI_SETICONTITLEWRAP_REGKEY2 "Control Panel\\Desktop"
66 #define SPI_SETICONTITLEWRAP_VALNAME "IconTitleWrap"
67 #define SPI_SETMENUDROPALIGNMENT_REGKEY1 "Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows"
68 #define SPI_SETMENUDROPALIGNMENT_REGKEY2 "Control Panel\\Desktop"
69 #define SPI_SETMENUDROPALIGNMENT_VALNAME "MenuDropAlignment"
70 #define SPI_SETDOUBLECLKWIDTH_REGKEY1 "Control Panel\\Mouse"
71 #define SPI_SETDOUBLECLKWIDTH_REGKEY2 "Control Panel\\Desktop"
72 #define SPI_SETDOUBLECLKWIDTH_VALNAME "DoubleClickWidth"
73 #define SPI_SETDOUBLECLKHEIGHT_REGKEY1 "Control Panel\\Mouse"
74 #define SPI_SETDOUBLECLKHEIGHT_REGKEY2 "Control Panel\\Desktop"
75 #define SPI_SETDOUBLECLKHEIGHT_VALNAME "DoubleClickHeight"
76 #define SPI_SETDOUBLECLICKTIME_REGKEY "Control Panel\\Mouse"
77 #define SPI_SETDOUBLECLICKTIME_VALNAME "DoubleClickSpeed"
78 #define SPI_SETMOUSEBUTTONSWAP_REGKEY "Control Panel\\Mouse"
79 #define SPI_SETMOUSEBUTTONSWAP_VALNAME "SwapMouseButtons"
80 #define SPI_SETWORKAREA_REGKEY "Control Panel\\Desktop"
81 #define SPI_SETWORKAREA_VALNAME "WINE_WorkArea"
82 #define SPI_SETSHOWSOUNDS_REGKEY "Control Panel\\Accessibility\\ShowSounds"
83 #define SPI_SETSHOWSOUNDS_VALNAME "On"
84 #define SPI_SETDRAGFULLWINDOWS_REGKEY "Control Panel\\Desktop"
85 #define SPI_SETDRAGFULLWINDOWS_VALNAME "DragFullWindows"
86 #define SPI_SETDESKWALLPAPER_REGKEY "Control Panel\\Desktop"
87 #define SPI_SETDESKWALLPAPER_VALNAME "Wallpaper"
88 /* FIXME - don't have access to Windows with this action (W95, NT5.0). Set real values */
89 #define SPI_SETKEYBOARDPREF_REGKEY "Control Panel\\Desktop"
90 #define SPI_SETKEYBOARDPREF_VALNAME "WINE_WorkArea"
91 #define SPI_SETSCREENREADER_REGKEY "Control Panel\\Desktop"
92 #define SPI_SETSCREENREADER_VALNAME "???"
94 /* volatile registry branch under CURRENT_USER_REGKEY for temporary values storage */
95 #define WINE_CURRENT_USER_REGKEY "Wine"
97 static HWND ghTestWnd;
99 static DWORD WINAPI SysParamsThreadFunc( LPVOID lpParam );
100 static LRESULT CALLBACK SysParamsTestWndProc( HWND hWnd, UINT msg, WPARAM wParam,
102 static int change_counter;
103 static int change_last_param;
105 static LRESULT CALLBACK SysParamsTestWndProc( HWND hWnd, UINT msg, WPARAM wParam,
110 case WM_SETTINGCHANGE:
111 if (change_counter>0) {
112 ok(0,"too many changes counter=%d last change=%d\n",
113 change_counter,change_last_param);
116 change_last_param = wParam;
120 PostQuitMessage( 0 );
124 return( DefWindowProcA( hWnd, msg, wParam, lParam ) );
131 Performs testing for system parameters messages
133 - system parameter id
134 - supposed value of the registry key
136 static void test_change_message( int action, int optional )
138 if (change_counter==0 && optional==1)
140 ok( 1 == change_counter,
141 "Missed a message: change_counter=%d", change_counter );
143 ok( action == change_last_param,
144 "Wrong action got %d expected %d", change_last_param, action );
145 change_last_param = 0;
149 * Tests the HKEY_CURRENT_USER subkey value.
150 * The value should contain string value.
153 * lpsSubKey - subkey name
154 * lpsRegName - registry entry name
155 * lpsTestValue - value to test
157 static void _test_reg_key( LPSTR subKey1, LPSTR subKey2, LPSTR valName, LPSTR testValue )
159 CHAR value[MAX_PATH];
167 valueLen=sizeof(value);
168 RegOpenKeyA( HKEY_CURRENT_USER, subKey1, &hKey );
169 rc=RegQueryValueExA( hKey, valName, NULL, &type, value, &valueLen );
171 if (rc==ERROR_SUCCESS)
173 ok( !strcmp( testValue, value ),
174 "Wrong value in registry: subKey=%s, valName=%s, testValue=%s, value=%s",
175 subKey1, valName, testValue, value );
180 ok(0,"Missing registry entry: subKey=%s, valName=%s",
183 if (subKey2 && !strict)
186 valueLen=sizeof(value);
187 RegOpenKeyA( HKEY_CURRENT_USER, subKey2, &hKey );
188 rc=RegQueryValueExA( hKey, valName, NULL, &type, value, &valueLen );
190 if (rc==ERROR_SUCCESS)
192 ok( !strcmp( testValue, value ),
193 "Wrong value in registry: subKey=%s, valName=%s, testValue=%s, value=%s",
194 subKey2, valName, testValue, value );
198 ok(found,"Missing registry entry: %s in %s or %s",
199 valName, subKey1, (subKey2?subKey2:"<n/a>") );
202 #define test_reg_key( subKey, valName, testValue ) \
203 _test_reg_key( subKey, NULL, valName, testValue )
204 #define test_reg_key_ex( subKey1, subKey2, valName, testValue ) \
205 _test_reg_key( subKey1, subKey2, valName, testValue )
207 static void test_SPI_SETBEEP( void ) /* 2 */
214 trace("testing SPI_{GET,SET}BEEP\n");
215 rc=SystemParametersInfoA( SPI_GETBEEP, 0, &old_b, 0 );
216 ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
219 rc=SystemParametersInfoA( SPI_SETBEEP, curr_val, 0, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
220 ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
221 test_change_message( SPI_SETBEEP, 0 );
222 test_reg_key( SPI_SETBEEP_REGKEY,
224 curr_val ? "Yes" : "No" );
225 rc=SystemParametersInfoA( SPI_GETBEEP, 0, &b, 0 );
226 ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
227 eq( b, curr_val, "SPI_{GET,SET}BEEP", "%d" );
228 rc=SystemParametersInfoW( SPI_GETBEEP, 0, &b, 0 );
229 if (rc!=0 || GetLastError()!=ERROR_CALL_NOT_IMPLEMENTED)
231 ok(rc!=0,"SystemParametersInfoW: rc=%d err=%ld\n",rc,GetLastError());
232 eq( b, curr_val, "SystemParametersInfoW", "%d" );
235 /* is a message sent for the second change? */
236 rc=SystemParametersInfoA( SPI_SETBEEP, curr_val, 0, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
237 ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
238 test_change_message( SPI_SETBEEP, 0 );
241 rc=SystemParametersInfoW( SPI_SETBEEP, curr_val, 0, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
242 if (rc==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
243 rc=SystemParametersInfoA( SPI_SETBEEP, curr_val, 0, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
244 ok(rc!=0,"SystemParametersInfo: rc=%d err=%ld\n",rc,GetLastError());
245 test_change_message( SPI_SETBEEP, 0 );
246 test_reg_key( SPI_SETBEEP_REGKEY,
248 curr_val ? "Yes" : "No" );
249 rc=SystemParametersInfoA( SPI_GETBEEP, 0, &b, 0 );
250 ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
251 eq( b, curr_val, "SPI_{GET,SET}BEEP", "%d" );
252 rc=SystemParametersInfoW( SPI_GETBEEP, 0, &b, 0 );
253 if (rc!=0 || GetLastError()!=ERROR_CALL_NOT_IMPLEMENTED)
255 ok(rc!=0,"SystemParametersInfoW: rc=%d err=%ld\n",rc,GetLastError());
256 eq( b, curr_val, "SystemParametersInfoW", "%d" );
258 ok( MessageBeep( MB_OK ), "Return value of MessageBeep when sound is disabled" );
260 rc=SystemParametersInfoA( SPI_SETBEEP, old_b, 0, SPIF_UPDATEINIFILE );
261 ok(rc!=0,"***warning*** failed to restore the original value: rc=%d err=%ld\n",rc,GetLastError());
264 static char *setmouse_valuenames[3] = {
265 SPI_SETMOUSE_VALNAME1,
266 SPI_SETMOUSE_VALNAME2,
267 SPI_SETMOUSE_VALNAME3
271 * Runs check for one setting of spi_setmouse.
273 static void run_spi_setmouse_test( int curr_val[], POINT *req_change, POINT *proj_change,
278 static int aw_turn = 0;
285 if (aw_turn % 2!=0) /* call unicode version each second call */
286 rc=SystemParametersInfoW( SPI_SETMOUSE, 0, curr_val, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
287 if (aw_turn % 2==0 || (rc==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED))
288 rc=SystemParametersInfoA( SPI_SETMOUSE, 0, curr_val, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
289 ok(rc!=0,"SystemParametersInfo: rc=%d err=%ld\n",rc,GetLastError());
290 test_change_message( SPI_SETMOUSE, 0 );
291 for (i = 0; i < 3; i++)
293 sprintf( buf, "%d", curr_val[i] );
294 test_reg_key( SPI_SETMOUSE_REGKEY, setmouse_valuenames[i], buf );
297 rc=SystemParametersInfoA( SPI_GETMOUSE, 0, mi, 0 );
298 ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
299 for (i = 0; i < 3; i++)
301 ok(mi[i] == curr_val[i],
302 "incorrect value for %d: %d != %d", i, mi[i], curr_val[i]);
305 rc=SystemParametersInfoW( SPI_GETMOUSE, 0, mi, 0 );
306 if (rc!=0 && GetLastError()!=ERROR_CALL_NOT_IMPLEMENTED)
308 ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
309 for (i = 0; i < 3; i++)
311 ok(mi[i] == curr_val[i],
312 "incorrect value for %d: %d != %d", i, mi[i], curr_val[i]);
316 #if 0 /* FIXME: this always fails for me - AJ */
317 for (i = 0; i < nchange; i++)
320 mouse_event( MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE, 0, 0, 0, 0 );
321 mouse_event( MOUSEEVENTF_MOVE, req_change[i].x, req_change[i].y, 0, 0 );
323 ok( proj_change[i].x == mv.x, "Projected dx and real dx comparison. May fail under high load." );
324 ok( proj_change[i].y == mv.y, "Projected dy equals real dy. May fail under high load." );
329 static void test_SPI_SETMOUSE( void ) /* 4 */
334 /* win nt default values - 6, 10, 1 */
335 INT curr_val[3] = {6, 10, 1};
337 /* requested and projected mouse movements */
338 POINT req_change[] = { {6, 6}, { 7, 6}, { 8, 6}, {10, 10}, {11, 10}, {100, 100} };
339 POINT proj_change1[] = { {6, 6}, {14, 6}, {16, 6}, {20, 20}, {22, 20}, {200, 200} };
340 POINT proj_change2[] = { {6, 6}, {14, 6}, {16, 6}, {20, 20}, {44, 20}, {400, 400} };
341 POINT proj_change3[] = { {6, 6}, {14, 6}, {16, 6}, {20, 20}, {22, 20}, {200, 200} };
342 POINT proj_change4[] = { {6, 6}, { 7, 6}, { 8, 6}, {10, 10}, {11, 10}, {100, 100} };
343 POINT proj_change5[] = { {6, 6}, { 7, 6}, {16, 6}, {20, 20}, {22, 20}, {200, 200} };
344 POINT proj_change6[] = { {6, 6}, {28, 6}, {32, 6}, {40, 40}, {44, 40}, {400, 400} };
345 POINT proj_change7[] = { {6, 6}, {14, 6}, {32, 6}, {40, 40}, {44, 40}, {400, 400} };
346 POINT proj_change8[] = { {6, 6}, {28, 6}, {32, 6}, {40, 40}, {44, 40}, {400, 400} };
348 int nchange = sizeof( req_change ) / sizeof( POINT );
350 trace("testing SPI_{GET,SET}MOUSE\n");
351 rc=SystemParametersInfoA( SPI_GETMOUSE, 0, old_mi, 0 );
352 ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
354 run_spi_setmouse_test( curr_val, req_change, proj_change1, nchange );
356 /* acceleration change */
358 run_spi_setmouse_test( curr_val, req_change, proj_change2, nchange );
360 /* acceleration change */
362 run_spi_setmouse_test( curr_val, req_change, proj_change3, nchange );
364 /* acceleration change */
366 run_spi_setmouse_test( curr_val, req_change, proj_change4, nchange );
368 /* threshold change */
371 run_spi_setmouse_test( curr_val, req_change, proj_change5, nchange );
373 /* threshold change */
377 run_spi_setmouse_test( curr_val, req_change, proj_change6, nchange );
379 /* threshold change */
381 run_spi_setmouse_test( curr_val, req_change, proj_change7, nchange );
383 /* threshold change */
385 run_spi_setmouse_test( curr_val, req_change, proj_change8, nchange );
387 rc=SystemParametersInfoA( SPI_SETMOUSE, 0, old_mi, SPIF_UPDATEINIFILE );
388 ok(rc!=0,"***warning*** failed to restore the original value: rc=%d err=%ld\n",rc,GetLastError());
391 static void test_setborder(UINT curr_val)
398 rc=SystemParametersInfoA( SPI_SETBORDER, curr_val, 0, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
399 ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
400 test_change_message( SPI_SETBORDER, 1 );
401 sprintf( buf, "%d", curr_val );
402 test_reg_key( SPI_SETBORDER_REGKEY, SPI_SETBORDER_VALNAME, buf );
406 rc=SystemParametersInfoA( SPI_GETBORDER, 0, &border, 0 );
407 ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
408 eq( border, curr_val, "SPI_{GET,SET}BORDER", "%d");
410 frame = curr_val + GetSystemMetrics( SM_CXDLGFRAME );
411 eq( frame, GetSystemMetrics( SM_CXFRAME ), "SM_CXFRAME", "%d" );
412 eq( frame, GetSystemMetrics( SM_CYFRAME ), "SM_CYFRAME", "%d" );
413 eq( frame, GetSystemMetrics( SM_CXSIZEFRAME ), "SM_CXSIZEFRAME", "%d" );
414 eq( frame, GetSystemMetrics( SM_CYSIZEFRAME ), "SM_CYSIZEFRAME", "%d" );
417 static void test_SPI_SETBORDER( void ) /* 6 */
422 /* These tests hang when XFree86 4.0 for Windows is running (tested on
423 * WinNT, SP2, Cygwin/XFree 4.1.0. Skip the test when XFree86 is
426 if (FindWindowA( NULL, "Cygwin/XFree86" ))
429 trace("testing SPI_{GET,SET}BORDER\n");
430 rc=SystemParametersInfoA( SPI_GETBORDER, 0, &old_border, 0 );
431 ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
438 /* This will restore sane values if the test hang previous run. */
439 if ( old_border == 7 || old_border == 20 )
442 rc=SystemParametersInfoA( SPI_SETBORDER, old_border, 0, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
443 ok(rc!=0,"***warning*** failed to restore the original value: rc=%d err=%ld\n",rc,GetLastError());
446 static void test_SPI_SETKEYBOARDSPEED( void ) /* 10 */
450 const UINT vals[]={0,20,31};
453 trace("testing SPI_{GET,SET}KEYBOARDSPEED\n");
454 rc=SystemParametersInfoA( SPI_GETKEYBOARDSPEED, 0, &old_speed, 0 );
455 ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
457 for (i=0;i<sizeof(vals)/sizeof(*vals);i++)
462 rc=SystemParametersInfoA( SPI_SETKEYBOARDSPEED, vals[i], 0,
463 SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
464 ok(rc!=0,"%d: rc=%d err=%ld\n",i,rc,GetLastError());
465 test_change_message( SPI_SETKEYBOARDSPEED, 0 );
466 sprintf( buf, "%d", vals[i] );
467 test_reg_key( SPI_SETKEYBOARDSPEED_REGKEY, SPI_SETKEYBOARDSPEED_VALNAME, buf );
469 rc=SystemParametersInfoA( SPI_GETKEYBOARDSPEED, 0, &v, 0 );
470 ok(rc!=0,"%d: rc=%d err=%ld\n",i,rc,GetLastError());
471 eq( v, vals[i], "SPI_{GET,SET}KEYBOARDSPEED", "%d" );
474 rc=SystemParametersInfoA( SPI_SETKEYBOARDSPEED, old_speed, 0, SPIF_UPDATEINIFILE );
475 ok(rc!=0,"***warning*** failed to restore the original value: rc=%d err=%ld\n",rc,GetLastError());
478 static void test_SPI_ICONHORIZONTALSPACING( void ) /* 13 */
485 trace("testing SPI_ICONHORIZONTALSPACING\n");
486 /* default value: 75 */
487 rc=SystemParametersInfoA( SPI_ICONHORIZONTALSPACING, 0, &old_spacing, 0 );
488 ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
490 /* do not increase the value as it would upset the user's icon layout */
491 curr_val = (old_spacing > 32 ? old_spacing-1 : 32);
492 rc=SystemParametersInfoA( SPI_ICONHORIZONTALSPACING, curr_val, 0,
493 SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
494 ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
495 test_change_message( SPI_ICONHORIZONTALSPACING, 0 );
496 /* The registry keys depend on the Windows version and the values too
500 rc=SystemParametersInfoA( SPI_ICONHORIZONTALSPACING, 0, &spacing, 0 );
501 ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
502 eq( spacing, curr_val, "ICONHORIZONTALSPACING", "%d");
503 eq( GetSystemMetrics( SM_CXICONSPACING ), curr_val, "SM_CXICONSPACING", "%d" );
506 rc=SystemParametersInfoA( SPI_ICONHORIZONTALSPACING, curr_val, 0,
507 SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
508 ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
509 curr_val = 32; /*min value*/
510 test_change_message( SPI_ICONHORIZONTALSPACING, 0 );
512 rc=SystemParametersInfoA( SPI_ICONHORIZONTALSPACING, 0, &spacing, 0 );
513 ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
514 eq( spacing, curr_val, "ICONHORIZONTALSPACING", "%d" );
515 eq( GetSystemMetrics( SM_CXICONSPACING ), curr_val, "SM_CXICONSPACING", "%d" );
517 rc=SystemParametersInfoA( SPI_ICONHORIZONTALSPACING, old_spacing, 0, SPIF_UPDATEINIFILE );
518 ok(rc!=0,"***warning*** failed to restore the original value: rc=%d err=%ld\n",rc,GetLastError());
521 static void test_SPI_SETSCREENSAVETIMEOUT( void ) /* 14 */
525 const UINT vals[]={0,32767};
528 trace("testing SPI_{GET,SET}SCREENSAVETIMEOUT\n");
529 rc=SystemParametersInfoA( SPI_GETSCREENSAVETIMEOUT, 0, &old_timeout, 0 );
530 ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
532 for (i=0;i<sizeof(vals)/sizeof(*vals);i++)
537 rc=SystemParametersInfoA( SPI_SETSCREENSAVETIMEOUT, vals[i], 0,
538 SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
539 ok(rc!=0,"%d: rc=%d err=%ld\n",i,rc,GetLastError());
540 test_change_message( SPI_SETSCREENSAVETIMEOUT, 0 );
541 sprintf( buf, "%d", vals[i] );
542 test_reg_key( SPI_SETSCREENSAVETIMEOUT_REGKEY,
543 SPI_SETSCREENSAVETIMEOUT_VALNAME, buf );
545 SystemParametersInfoA( SPI_GETSCREENSAVETIMEOUT, 0, &v, 0 );
546 ok(rc!=0,"%d: rc=%d err=%ld\n",i,rc,GetLastError());
547 eq( v, vals[i], "SPI_{GET,SET}SCREENSAVETIMEOUT", "%d" );
550 rc=SystemParametersInfoA( SPI_SETSCREENSAVETIMEOUT, old_timeout, 0,
551 SPIF_UPDATEINIFILE );
552 ok(rc!=0,"***warning*** failed to restore the original value: rc=%d err=%ld\n",rc,GetLastError());
555 static void test_SPI_SETSCREENSAVEACTIVE( void ) /* 17 */
559 const UINT vals[]={TRUE,FALSE};
562 trace("testing SPI_{GET,SET}SCREENSAVEACTIVE\n");
563 rc=SystemParametersInfoA( SPI_GETSCREENSAVEACTIVE, 0, &old_b, 0 );
564 ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
566 for (i=0;i<sizeof(vals)/sizeof(*vals);i++)
570 rc=SystemParametersInfoA( SPI_SETSCREENSAVEACTIVE, vals[i], 0,
571 SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
572 ok(rc!=0,"%d: rc=%d err=%ld\n",i,rc,GetLastError());
573 test_change_message( SPI_SETSCREENSAVEACTIVE, 0 );
574 test_reg_key( SPI_SETSCREENSAVEACTIVE_REGKEY,
575 SPI_SETSCREENSAVEACTIVE_VALNAME,
576 vals[i] ? "1" : "0" );
578 rc=SystemParametersInfoA( SPI_GETSCREENSAVEACTIVE, 0, &v, 0 );
579 ok(rc!=0,"%d: rc=%d err=%ld\n",i,rc,GetLastError());
580 eq( v, vals[i], "SPI_{GET,SET}SCREENSAVEACTIVE", "%d" );
583 rc=SystemParametersInfoA( SPI_SETSCREENSAVEACTIVE, old_b, 0, SPIF_UPDATEINIFILE );
584 ok(rc!=0,"***warning*** failed to restore the original value: rc=%d err=%ld\n",rc,GetLastError());
587 static void test_SPI_SETGRIDGRANULARITY( void ) /* 19 */
592 static void test_SPI_SETKEYBOARDDELAY( void ) /* 23 */
596 const UINT vals[]={0,3};
599 trace("testing SPI_{GET,SET}KEYBOARDDELAY\n");
600 rc=SystemParametersInfoA( SPI_GETKEYBOARDDELAY, 0, &old_delay, 0 );
601 ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
603 for (i=0;i<sizeof(vals)/sizeof(*vals);i++)
608 rc=SystemParametersInfoA( SPI_SETKEYBOARDDELAY, vals[i], 0,
609 SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
610 ok(rc!=0,"%d: rc=%d err=%ld\n",i,rc,GetLastError());
611 test_change_message( SPI_SETKEYBOARDDELAY, 0 );
612 sprintf( buf, "%d", vals[i] );
613 test_reg_key( SPI_SETKEYBOARDDELAY_REGKEY,
614 SPI_SETKEYBOARDDELAY_VALNAME, buf );
616 rc=SystemParametersInfoA( SPI_GETKEYBOARDDELAY, 0, &delay, 0 );
617 ok(rc!=0,"%d: rc=%d err=%ld\n",i,rc,GetLastError());
618 eq( delay, vals[i], "SPI_{GET,SET}KEYBOARDDELAY", "%d" );
621 rc=SystemParametersInfoA( SPI_SETKEYBOARDDELAY, old_delay, 0, SPIF_UPDATEINIFILE );
622 ok(rc!=0,"***warning*** failed to restore the original value: rc=%d err=%ld\n",rc,GetLastError());
625 static void test_SPI_ICONVERTICALSPACING( void ) /* 24 */
632 trace("testing SPI_ICONVERTICALSPACING\n");
633 /* default value: 75 */
634 rc=SystemParametersInfoA( SPI_ICONVERTICALSPACING, 0, &old_spacing, 0 );
635 ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
637 /* do not increase the value as it would upset the user's icon layout */
638 curr_val = old_spacing-1;
639 rc=SystemParametersInfoA( SPI_ICONVERTICALSPACING, curr_val, 0,
640 SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
641 ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
642 test_change_message( SPI_ICONVERTICALSPACING, 0 );
643 /* The registry keys depend on the Windows version and the values too
647 rc=SystemParametersInfoA( SPI_ICONVERTICALSPACING, 0, &spacing, 0 );
648 ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
649 eq( spacing, curr_val, "ICONVERTICALSPACING", "%d" );
650 eq( GetSystemMetrics( SM_CYICONSPACING ), curr_val, "SM_CYICONSPACING", "%d" );
653 rc=SystemParametersInfoA( SPI_ICONVERTICALSPACING, curr_val, 0,
654 SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
655 ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
656 curr_val = 32; /*min value*/
657 test_change_message( SPI_ICONVERTICALSPACING, 0 );
659 rc=SystemParametersInfoA( SPI_ICONVERTICALSPACING, 0, &spacing, 0 );
660 ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
661 eq( spacing, curr_val, "ICONVERTICALSPACING", "%d" );
662 eq( GetSystemMetrics( SM_CYICONSPACING ), curr_val, "SM_CYICONSPACING", "%d" );
664 rc=SystemParametersInfoA( SPI_ICONVERTICALSPACING, old_spacing, 0,
665 SPIF_UPDATEINIFILE );
666 ok(rc!=0,"***warning*** failed to restore the original value: rc=%d err=%ld\n",rc,GetLastError());
669 static void test_SPI_SETICONTITLEWRAP( void ) /* 26 */
673 const UINT vals[]={TRUE,FALSE};
676 /* These tests hang when XFree86 4.0 for Windows is running (tested on
677 * WinNT, SP2, Cygwin/XFree 4.1.0. Skip the test when XFree86 is
680 if (FindWindowA( NULL, "Cygwin/XFree86" ))
683 trace("testing SPI_{GET,SET}ICONTITLEWRAP\n");
684 rc=SystemParametersInfoA( SPI_GETICONTITLEWRAP, 0, &old_b, 0 );
685 ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
687 for (i=0;i<sizeof(vals)/sizeof(*vals);i++)
691 rc=SystemParametersInfoA( SPI_SETICONTITLEWRAP, vals[i], 0,
692 SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
693 ok(rc!=0,"%d: rc=%d err=%ld\n",i,rc,GetLastError());
694 test_change_message( SPI_SETICONTITLEWRAP, 1 );
695 test_reg_key_ex( SPI_SETICONTITLEWRAP_REGKEY1,
696 SPI_SETICONTITLEWRAP_REGKEY2,
697 SPI_SETICONTITLEWRAP_VALNAME,
698 vals[i] ? "1" : "0" );
700 rc=SystemParametersInfoA( SPI_GETICONTITLEWRAP, 0, &v, 0 );
701 ok(rc!=0,"%d: rc=%d err=%ld\n",i,rc,GetLastError());
702 eq( v, vals[i], "SPI_{GET,SET}ICONTITLEWRAP", "%d" );
705 rc=SystemParametersInfoA( SPI_SETICONTITLEWRAP, old_b, 0, SPIF_UPDATEINIFILE );
706 ok(rc!=0,"***warning*** failed to restore the original value: rc=%d err=%ld\n",rc,GetLastError());
709 static void test_SPI_SETMENUDROPALIGNMENT( void ) /* 28 */
713 const UINT vals[]={TRUE,FALSE};
716 trace("testing SPI_{GET,SET}MENUDROPALIGNMENT\n");
717 rc=SystemParametersInfoA( SPI_GETMENUDROPALIGNMENT, 0, &old_b, 0 );
718 ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
720 for (i=0;i<sizeof(vals)/sizeof(*vals);i++)
724 rc=SystemParametersInfoA( SPI_SETMENUDROPALIGNMENT, vals[i], 0,
725 SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
726 ok(rc!=0,"%d: rc=%d err=%ld\n",i,rc,GetLastError());
727 test_change_message( SPI_SETMENUDROPALIGNMENT, 0 );
728 test_reg_key_ex( SPI_SETMENUDROPALIGNMENT_REGKEY1,
729 SPI_SETMENUDROPALIGNMENT_REGKEY2,
730 SPI_SETMENUDROPALIGNMENT_VALNAME,
731 vals[i] ? "1" : "0" );
733 rc=SystemParametersInfoA( SPI_GETMENUDROPALIGNMENT, 0, &v, 0 );
734 ok(rc!=0,"%d: rc=%d err=%ld\n",i,rc,GetLastError());
735 eq( v, vals[i], "SPI_{GET,SET}MENUDROPALIGNMENT", "%d" );
736 eq( GetSystemMetrics( SM_MENUDROPALIGNMENT ), (int)vals[i],
737 "SM_MENUDROPALIGNMENT", "%d" );
740 rc=SystemParametersInfoA( SPI_SETMENUDROPALIGNMENT, old_b, 0,
741 SPIF_UPDATEINIFILE );
742 ok(rc!=0,"***warning*** failed to restore the original value: rc=%d err=%ld\n",rc,GetLastError());
745 static void test_SPI_SETDOUBLECLKWIDTH( void ) /* 29 */
749 const UINT vals[]={0,10000};
752 trace("testing SPI_{GET,SET}DOUBLECLKWIDTH\n");
753 old_width = GetSystemMetrics( SM_CXDOUBLECLK );
755 for (i=0;i<sizeof(vals)/sizeof(*vals);i++)
759 rc=SystemParametersInfoA( SPI_SETDOUBLECLKWIDTH, vals[i], 0,
760 SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
761 ok(rc!=0,"%d: rc=%d err=%ld\n",i,rc,GetLastError());
762 test_change_message( SPI_SETDOUBLECLKWIDTH, 0 );
763 sprintf( buf, "%d", vals[i] );
764 test_reg_key_ex( SPI_SETDOUBLECLKWIDTH_REGKEY1,
765 SPI_SETDOUBLECLKWIDTH_REGKEY2,
766 SPI_SETDOUBLECLKWIDTH_VALNAME, buf );
767 eq( GetSystemMetrics( SM_CXDOUBLECLK ), (int)vals[i],
768 "SM_CXDOUBLECLK", "%d" );
771 rc=SystemParametersInfoA( SPI_SETDOUBLECLKWIDTH, old_width, 0,
772 SPIF_UPDATEINIFILE );
773 ok(rc!=0,"***warning*** failed to restore the original value: rc=%d err=%ld\n",rc,GetLastError());
776 static void test_SPI_SETDOUBLECLKHEIGHT( void ) /* 30 */
780 const UINT vals[]={0,10000};
783 trace("testing SPI_{GET,SET}DOUBLECLKHEIGHT\n");
784 old_height = GetSystemMetrics( SM_CYDOUBLECLK );
786 for (i=0;i<sizeof(vals)/sizeof(*vals);i++)
790 rc=SystemParametersInfoA( SPI_SETDOUBLECLKHEIGHT, vals[i], 0,
791 SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
792 ok(rc!=0,"%d: rc=%d err=%ld\n",i,rc,GetLastError());
793 test_change_message( SPI_SETDOUBLECLKHEIGHT, 0 );
794 sprintf( buf, "%d", vals[i] );
795 test_reg_key_ex( SPI_SETDOUBLECLKHEIGHT_REGKEY1,
796 SPI_SETDOUBLECLKHEIGHT_REGKEY2,
797 SPI_SETDOUBLECLKHEIGHT_VALNAME, buf );
798 eq( GetSystemMetrics( SM_CYDOUBLECLK ), (int)vals[i],
799 "SM_CYDOUBLECLK", "%d" );
802 rc=SystemParametersInfoA( SPI_SETDOUBLECLKHEIGHT, old_height, 0,
803 SPIF_UPDATEINIFILE );
804 ok(rc!=0,"***warning*** failed to restore the original value: rc=%d err=%ld\n",rc,GetLastError());
807 static void test_SPI_SETDOUBLECLICKTIME( void ) /* 32 */
815 trace("testing SPI_{GET,SET}DOUBLECLICKTIME\n");
816 old_time = GetDoubleClickTime();
819 rc=SystemParametersInfoA( SPI_SETDOUBLECLICKTIME, curr_val, 0,
820 SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
821 ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
822 test_change_message( SPI_SETDOUBLECLICKTIME, 0 );
823 sprintf( buf, "%d", curr_val );
824 test_reg_key( SPI_SETDOUBLECLICKTIME_REGKEY,
825 SPI_SETDOUBLECLICKTIME_VALNAME, buf );
826 curr_val = 500; /* used value for 0 */
827 eq( GetDoubleClickTime(), curr_val, "GetDoubleClickTime", "%d" );
830 rc=SystemParametersInfoA( SPI_SETDOUBLECLICKTIME, curr_val, 0,
831 SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
832 ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
833 test_change_message( SPI_SETDOUBLECLICKTIME, 0 );
834 sprintf( buf, "%d", curr_val );
835 test_reg_key( SPI_SETDOUBLECLICKTIME_REGKEY,
836 SPI_SETDOUBLECLICKTIME_VALNAME, buf );
837 eq( GetDoubleClickTime(), curr_val, "GetDoubleClickTime", "%d" );
839 saved_val = curr_val;
842 SetDoubleClickTime( curr_val );
843 sprintf( buf, "%d", saved_val );
844 test_reg_key( SPI_SETDOUBLECLICKTIME_REGKEY,
845 SPI_SETDOUBLECLICKTIME_VALNAME, buf );
846 curr_val = 500; /* used value for 0 */
847 eq( GetDoubleClickTime(), curr_val, "GetDoubleClickTime", "%d" );
850 SetDoubleClickTime( curr_val );
851 sprintf( buf, "%d", saved_val );
852 test_reg_key( SPI_SETDOUBLECLICKTIME_REGKEY,
853 SPI_SETDOUBLECLICKTIME_VALNAME, buf );
854 eq( GetDoubleClickTime(), curr_val, "GetDoubleClickTime", "%d" );
856 rc=SystemParametersInfoA(SPI_SETDOUBLECLICKTIME, old_time, 0, SPIF_UPDATEINIFILE);
857 ok(rc!=0,"***warning*** failed to restore the original value: rc=%d err=%ld\n",rc,GetLastError());
860 static void test_SPI_SETMOUSEBUTTONSWAP( void ) /* 33 */
864 const UINT vals[]={TRUE,FALSE};
867 trace("testing SPI_{GET,SET}MOUSEBUTTONSWAP\n");
868 old_b = GetSystemMetrics( SM_SWAPBUTTON );
870 for (i=0;i<sizeof(vals)/sizeof(*vals);i++)
872 rc=SystemParametersInfoA( SPI_SETMOUSEBUTTONSWAP, vals[i], 0,
873 SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
874 ok(rc!=0,"%d: rc=%d err=%ld\n",i,rc,GetLastError());
875 test_change_message( SPI_SETMOUSEBUTTONSWAP, 0 );
876 test_reg_key( SPI_SETMOUSEBUTTONSWAP_REGKEY,
877 SPI_SETMOUSEBUTTONSWAP_VALNAME,
878 vals[i] ? "1" : "0" );
879 eq( GetSystemMetrics( SM_SWAPBUTTON ), (int)vals[i],
880 "SM_SWAPBUTTON", "%d" );
883 rc=SystemParametersInfoA( SPI_SETMOUSEBUTTONSWAP, old_b, 0,
884 SPIF_UPDATEINIFILE );
885 ok(rc!=0,"***warning*** failed to restore the original value: rc=%d err=%ld\n",rc,GetLastError());
888 static void test_SPI_SETFASTTASKSWITCH( void ) /* 36 */
893 trace("testing SPI_GETFASTTASKSWITCH\n");
894 rc=SystemParametersInfoA( SPI_GETFASTTASKSWITCH, 0, &v, 0 );
895 ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
896 /* there is not a single Windows platform on which SPI_GETFASTTASKSWITCH
897 * works. That sure simplifies testing!
901 static void test_SPI_SETDRAGFULLWINDOWS( void ) /* 37 */
905 const UINT vals[]={TRUE,FALSE};
908 trace("testing SPI_{GET,SET}DRAGFULLWINDOWS\n");
909 rc=SystemParametersInfoA( SPI_GETDRAGFULLWINDOWS, 0, &old_b, 0 );
910 if (rc==0 && (GetLastError()==0 || GetLastError()==ERROR_CALL_NOT_IMPLEMENTED))
912 /* SPI_{GET,SET}DRAGFULLWINDOWS is not implemented on Win95 */
913 trace("SPI_{GET,SET}DRAGFULLWINDOWS not supported on this platform\n");
916 ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
918 for (i=0;i<sizeof(vals)/sizeof(*vals);i++)
922 rc=SystemParametersInfoA( SPI_SETDRAGFULLWINDOWS, vals[i], 0,
923 SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
924 ok(rc!=0,"%d: rc=%d err=%ld\n",i,rc,GetLastError());
925 test_change_message( SPI_SETDRAGFULLWINDOWS, 0 );
926 test_reg_key( SPI_SETDRAGFULLWINDOWS_REGKEY,
927 SPI_SETDRAGFULLWINDOWS_VALNAME,
928 vals[i] ? "1" : "0" );
930 rc=SystemParametersInfoA( SPI_GETDRAGFULLWINDOWS, 0, &v, 0 );
931 ok(rc!=0,"%d: rc=%d err=%ld\n",i,rc,GetLastError());
932 eq( v, vals[i], "SPI_{GET,SET}DRAGFULLWINDOWS", "%d" );
935 rc=SystemParametersInfoA( SPI_SETDRAGFULLWINDOWS, old_b, 0, SPIF_UPDATEINIFILE );
936 ok(rc!=0,"***warning*** failed to restore the original value: rc=%d err=%ld\n",rc,GetLastError());
939 static void test_SPI_SETWORKAREA( void ) /* 47 */
946 trace("testing SPI_{GET,SET}WORKAREA\n");
947 rc=SystemParametersInfoA(SPI_GETWORKAREA, 0, &old_area, 0);
948 ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
950 /* Modify the work area only minimally as this causes the icons that
951 * fall outside it to be moved around thus requiring the user to
952 * reposition them manually one by one.
953 * Changing the work area by just one pixel should make this occurence
954 * reasonably unlikely.
956 curr_val.left = old_area.left;
957 curr_val.top = old_area.top;
958 curr_val.right = old_area.right-1;
959 curr_val.bottom = old_area.bottom-1;
960 rc=SystemParametersInfoA( SPI_SETWORKAREA, 0, &curr_val,
961 SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
962 ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
963 test_change_message( SPI_SETWORKAREA, 0 );
964 rc=SystemParametersInfoA( SPI_GETWORKAREA, 0, &area, 0 );
965 ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
966 eq( area.left, curr_val.left, "left", "%ld" );
967 eq( area.top, curr_val.top, "top", "%ld" );
968 eq( area.right, curr_val.right, "right", "%ld" );
969 eq( area.bottom, curr_val.bottom, "bottom", "%ld" );
971 rc=SystemParametersInfoA( SPI_SETWORKAREA, 0, &old_area,
972 SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
973 ok(rc!=0,"***warning*** failed to restore the original value: rc=%d err=%ld\n",rc,GetLastError());
974 test_change_message( SPI_SETWORKAREA, 0 );
975 rc=SystemParametersInfoA( SPI_GETWORKAREA, 0, &area, 0 );
976 ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
977 eq( area.left, old_area.left, "left", "%ld" );
978 eq( area.top, old_area.top, "top", "%ld" );
979 eq( area.right, old_area.right, "right", "%ld" );
980 eq( area.bottom, old_area.bottom, "bottom", "%ld" );
983 static void test_SPI_SETSHOWSOUNDS( void ) /* 57 */
987 const UINT vals[]={TRUE,FALSE};
990 trace("testing SPI_{GET,SET}SHOWSOUNDS\n");
992 rc=SystemParametersInfoA( SPI_GETSHOWSOUNDS, 0, &old_b, 0 );
993 if (rc==0 && GetLastError()==0)
995 /* SPI_{GET,SET}SHOWSOUNDS is completely broken on Win9x */
996 trace("SPI_{GET,SET}SHOWSOUNDS not supported on this platform\n");
999 ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
1001 for (i=0;i<sizeof(vals)/sizeof(*vals);i++)
1005 rc=SystemParametersInfoA( SPI_SETSHOWSOUNDS, vals[i], 0,
1006 SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
1007 ok(rc!=0,"%d: rc=%d err=%ld\n",i,rc,GetLastError());
1008 test_change_message( SPI_SETSHOWSOUNDS, 0 );
1009 test_reg_key( SPI_SETSHOWSOUNDS_REGKEY,
1010 SPI_SETSHOWSOUNDS_VALNAME,
1011 vals[i] ? "1" : "0" );
1013 rc=SystemParametersInfoA( SPI_GETSHOWSOUNDS, 0, &v, 0 );
1014 ok(rc!=0,"%d: rc=%d err=%ld\n",i,rc,GetLastError());
1015 eq( v, vals[i], "SPI_GETSHOWSOUNDS", "%d" );
1016 eq( GetSystemMetrics( SM_SHOWSOUNDS ), (int)vals[i],
1017 "SM_SHOWSOUNDS", "%d" );
1020 rc=SystemParametersInfoA( SPI_SETSHOWSOUNDS, old_b, 0, SPIF_UPDATEINIFILE );
1021 ok(rc!=0,"***warning*** failed to restore the original value: rc=%d err=%ld\n",rc,GetLastError());
1024 static void test_SPI_SETKEYBOARDPREF( void ) /* 69 */
1026 /* TODO!!! - don't have version of Windows which has this */
1029 static void test_SPI_SETSCREENREADER( void ) /* 71 */
1031 /* TODO!!! - don't have version of Windows which has this */
1034 static void test_SPI_SETWALLPAPER( void ) /* 115 */
1040 trace("testing SPI_{GET,SET}DESKWALLPAPER\n");
1042 rc=SystemParametersInfoA(SPI_GETDESKWALLPAPER, 260, oldval, 0);
1043 if (rc==0 && (GetLastError()==0 || GetLastError()==ERROR_INVALID_SPI_VALUE))
1045 /* SPI_{GET,SET}DESKWALLPAPER is completely broken on Win9x and
1046 * unimplemented on NT4
1048 trace("SPI_{GET,SET}DESKWALLPAPER not supported on this platform\n");
1051 ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
1052 test_reg_key(SPI_SETDESKWALLPAPER_REGKEY, SPI_SETDESKWALLPAPER_VALNAME, oldval);
1055 rc=SystemParametersInfoA(SPI_SETDESKWALLPAPER, 0, newval, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
1056 ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,GetLastError());
1057 test_change_message(SPI_SETDESKWALLPAPER, 0);
1059 rc=SystemParametersInfoA(SPI_SETDESKWALLPAPER, 0, oldval, SPIF_UPDATEINIFILE);
1060 ok(rc!=0,"***warning*** failed to restore the original value: rc=%d err=%ld\n",rc,GetLastError());
1064 * Registry entries for the system parameters.
1065 * Names are created by 'SET' flags names.
1066 * We assume that corresponding 'GET' entries use the same registry keys.
1068 static DWORD WINAPI SysParamsThreadFunc( LPVOID lpParam )
1070 test_SPI_SETBEEP(); /* 1 */
1071 test_SPI_SETMOUSE(); /* 4 */
1072 /* Messes up systems settings on Win9x */
1073 /*test_SPI_SETBORDER();*/ /* 6 */
1074 test_SPI_SETKEYBOARDSPEED(); /* 10 */
1075 test_SPI_ICONHORIZONTALSPACING(); /* 13 */
1076 test_SPI_SETSCREENSAVETIMEOUT(); /* 14 */
1077 test_SPI_SETSCREENSAVEACTIVE(); /* 17 */
1078 test_SPI_SETGRIDGRANULARITY(); /* 19 */
1079 test_SPI_SETKEYBOARDDELAY(); /* 23 */
1080 test_SPI_ICONVERTICALSPACING(); /* 24 */
1081 test_SPI_SETICONTITLEWRAP(); /* 26 */
1082 test_SPI_SETMENUDROPALIGNMENT(); /* 28 */
1083 test_SPI_SETDOUBLECLKWIDTH(); /* 29 */
1084 test_SPI_SETDOUBLECLKHEIGHT(); /* 30 */
1085 test_SPI_SETDOUBLECLICKTIME(); /* 32 */
1086 test_SPI_SETMOUSEBUTTONSWAP(); /* 33 */
1087 test_SPI_SETFASTTASKSWITCH(); /* 36 */
1088 test_SPI_SETDRAGFULLWINDOWS(); /* 37 */
1089 test_SPI_SETWORKAREA(); /* 47 */
1090 test_SPI_SETSHOWSOUNDS(); /* 57 */
1091 test_SPI_SETKEYBOARDPREF(); /* 69 */
1092 test_SPI_SETSCREENREADER(); /* 71 */
1093 test_SPI_SETWALLPAPER(); /* 115 */
1094 SendMessageA( ghTestWnd, WM_DESTROY, 0, 0 );
1098 START_TEST(sysparams)
1106 HANDLE hInstance = GetModuleHandleA( NULL );
1108 argc = winetest_get_mainargs(&argv);
1109 strict=(argc >= 3 && strcmp(argv[2],"strict")==0);
1110 trace("strict=%d\n",strict);
1113 change_last_param = 0;
1115 wc.lpszClassName = "SysParamsTestClass";
1116 wc.lpfnWndProc = SysParamsTestWndProc;
1117 wc.style = CS_OWNDC | CS_VREDRAW | CS_HREDRAW;
1118 wc.hInstance = hInstance;
1119 wc.hIcon = LoadIconA( 0, IDI_APPLICATIONA );
1120 wc.hCursor = LoadCursorA( 0, IDC_ARROWA );
1121 wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1 );
1122 wc.lpszMenuName = 0;
1125 RegisterClassA( &wc );
1127 ghTestWnd = CreateWindowA( "SysParamsTestClass", "Test System Parameters Application",
1128 WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, hInstance, NULL );
1130 hThread = CreateThread( NULL, 0, SysParamsThreadFunc, 0, 0, &dwThreadId );
1132 CloseHandle( hThread );
1134 while( GetMessageA( &msg, 0, 0, 0 )) {
1135 TranslateMessage( &msg );
1136 DispatchMessageA( &msg );