win32knapi: More / improved tests for NtUserSystemParametersInfo, NtGdiSelectBrush...
[reactos.git] / rostests / apitests / w32knapi / ntuser / NtUserSystemParametersInfo.c
1
2 static const WCHAR* KEY_MOUSE = L"Control Panel\\Mouse";
3 //static const WCHAR* VAL_MOUSE1 = L"MouseThreshold1";
4 //static const WCHAR* VAL_MOUSE2 = L"MouseThreshold2";
5 //static const WCHAR* VAL_MOUSE3 = L"MouseSpeed";
6 //static const WCHAR* VAL_DBLCLKWIDTH = L"DoubleClickWidth";
7 //static const WCHAR* VAL_DBLCLKHEIGHT = L"DoubleClickHeight";
8 //static const WCHAR* VAL_DBLCLKTIME = L"DoubleClickSpeed";
9 static const WCHAR* VAL_SWAP = L"SwapMouseButtons";
10
11 static const WCHAR* KEY_DESKTOP = L"Control Panel\\Desktop";
12 //static const WCHAR* VAL_SCRTO = L"ScreenSaveTimeOut";
13 //static const WCHAR* VAL_SCRACT = L"ScreenSaveActive";
14 //static const WCHAR* VAL_GRID = L"GridGranularity";
15 //static const WCHAR* VAL_DRAG = L"DragFullWindows";
16 //static const WCHAR* VAL_DRAGHEIGHT = L"DragHeight";
17 //static const WCHAR* VAL_DRAGWIDTH = L"DragWidth";
18 //static const WCHAR* VAL_FNTSMOOTH = L"FontSmoothing";
19 static const WCHAR* VAL_PREFMASK = L"UserPreferencesMask";
20 #define PREFMASK_MENUANIM 0x2
21 #define PREFMASK_KBDCUES 0x20
22
23 //static const WCHAR* KEY_MDALIGN = L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows";
24 //static const WCHAR* VAL_MDALIGN = L"MenuDropAlignment";
25
26 static const WCHAR* KEY_METRIC = L"Control Panel\\Desktop\\WindowMetrics";
27 //static const WCHAR* VAL_BORDER = L"BorderWidth";
28 //static const WCHAR* VAL_ICONSPC = L"IconSpacing";
29 //static const WCHAR* VAL_ICONVSPC = L"IconVerticalspacing";
30 //static const WCHAR* VAL_ITWRAP = L"IconTitleWrap";
31
32 static const WCHAR* KEY_SOUND = L"Control Panel\\Sound";
33 static const WCHAR* VAL_BEEP = L"Beep";
34
35 //static const WCHAR* KEY_KBD = L"Control Panel\\Keyboard";
36 //static const WCHAR* VAL_KBDSPD = L"KeyboardSpeed";
37 //static const WCHAR* VAL_KBDDELAY = L"KeyboardDelay";
38
39 //static const WCHAR* KEY_SHOWSNDS = L"Control Panel\\Accessibility\\ShowSounds";
40 //static const WCHAR* KEY_KDBPREF = L"Control Panel\\Accessibility\\Keyboard Preference";
41 //static const WCHAR* KEY_SCRREAD = L"Control Panel\\Accessibility\\Blind Access";
42 //static const WCHAR* VAL_ON = L"On";
43
44 LONG
45 QueryUserRegValueW(PCWSTR pszSubKey, PCWSTR pszValueName, PVOID pData, LPDWORD cbSize, LPDWORD pType)
46 {
47 HKEY hKey;
48 LONG ret;
49
50 RegOpenKeyExW(HKEY_CURRENT_USER, pszSubKey, 0, KEY_QUERY_VALUE, &hKey);
51 ret = RegQueryValueExW(hKey, pszValueName, NULL, pType, (LPBYTE)pData, cbSize);
52 RegCloseKey(hKey);
53 return ret;
54 }
55
56
57 HWND
58 CreateTestWindow()
59 {
60 WNDCLASSA wc;
61
62 wc.style = 0;
63 wc.lpfnWndProc = DefWindowProcA;
64 wc.cbClsExtra = 0;
65 wc.cbWndExtra = 0;
66 wc.hInstance = g_hInstance;
67 wc.hIcon = NULL;
68 wc.hCursor = NULL;
69 wc.hbrBackground = NULL;
70 wc.lpszMenuName = NULL;
71 wc.lpszClassName = "testclass";
72
73 RegisterClassA(&wc);
74 return CreateWindowA("testclass",
75 "testwnd",
76 WS_VISIBLE,
77 0,
78 0,
79 50,
80 30,
81 NULL,
82 NULL,
83 g_hInstance,
84 0);
85 }
86
87 void
88 Test_NtUserSystemParametersInfo_Params(PTESTINFO pti)
89 {
90 // UINT uint;
91 DWORD data[1000];
92 UINT i, uint;
93 ACCESSTIMEOUT ato;
94 /* Test normal */
95 SetLastError(ERROR_SUCCESS);
96 TEST(NtUserSystemParametersInfo(SPI_GETFOCUSBORDERHEIGHT, 0, &uint, 0) == TRUE);
97 TEST(GetLastError() == ERROR_SUCCESS);
98
99 /* Test invalid SPI code */
100 SetLastError(ERROR_SUCCESS);
101 TEST(NtUserSystemParametersInfo(7, 0, &data, 0) == FALSE);
102 TEST(GetLastError() == ERROR_INVALID_PARAMETER);
103
104 /* Test wrong cbSize member */
105 ato.cbSize = 1;
106 SetLastError(0xdeadbeef);
107 TEST(NtUserSystemParametersInfo(SPI_GETACCESSTIMEOUT, 0, &ato, 0) == FALSE);
108 TEST(GetLastError() == 0xdeadbeef);
109 #if 0
110 /* Test undocumented, but valid SPI codes */
111 for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef;
112 SetLastError(ERROR_SUCCESS);
113 TEST(NtUserSystemParametersInfo(0x1010, 0, &data, 0) == TRUE);
114 TEST(GetLastError() == ERROR_SUCCESS);
115 TEST(data[0] <= 1);
116 TEST(data[1] == 0xdeadbeef);
117
118 for(i = 0; i < 1000; i++) data[i] = 0xbeefdead;
119 SetLastError(ERROR_SUCCESS);
120 TEST(NtUserSystemParametersInfo(0x1011, 0, &data, 0) == TRUE);
121 TEST(GetLastError() == ERROR_SUCCESS);
122 TEST(data[0] == 0xbeefdead);
123 TEST(data[1] == 0xbeefdead);
124 data[0] = 0;
125 NtUserSystemParametersInfo(0x1010, 0, &data, 0);
126 TEST(data[0] == 1);
127
128 for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef;
129 SetLastError(ERROR_SUCCESS);
130 TEST(NtUserSystemParametersInfo(0x1028, 0, &data, 0) == TRUE);
131 TEST(GetLastError() == ERROR_SUCCESS);
132 TEST(data[0] != 0xdeadbeef);
133 TEST(data[1] == 0xdeadbeef);
134
135 for(i = 0; i < 1000; i++) data[i] = 0xbeefdead;
136 SetLastError(ERROR_SUCCESS);
137 TEST(NtUserSystemParametersInfo(0x1029, 0, &data, 0) == TRUE);
138 TEST(GetLastError() == ERROR_SUCCESS);
139 TEST(data[0] == 0xbeefdead);
140 TEST(data[1] == 0xbeefdead);
141
142 for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef;
143 SetLastError(ERROR_SUCCESS);
144 TEST(NtUserSystemParametersInfo(0x102A, 0, &data, 0) == TRUE);
145 TEST(GetLastError() == ERROR_SUCCESS);
146 TEST(data[0] != 0xdeadbeef);
147 TEST(data[1] == 0xdeadbeef);
148
149 for(i = 0; i < 1000; i++) data[i] = 0xbeefdead;
150 SetLastError(ERROR_SUCCESS);
151 TEST(NtUserSystemParametersInfo(4139, 0, &data, 0) == TRUE);
152 TEST(GetLastError() == ERROR_SUCCESS);
153 TEST(data[0] == 0xbeefdead);
154 TEST(data[1] == 0xbeefdead);
155
156 for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef;
157 SetLastError(ERROR_SUCCESS);
158 TEST(NtUserSystemParametersInfo(4140, 0, &data, 0) == TRUE);
159 TEST(GetLastError() == ERROR_SUCCESS);
160 TEST(data[0] != 0xdeadbeef);
161 TEST(data[1] == 0xdeadbeef);
162
163 for(i = 0; i < 1000; i++) data[i] = 0xbeefdead;
164 SetLastError(ERROR_SUCCESS);
165 TEST(NtUserSystemParametersInfo(4141, 0, &data, 0) == TRUE);
166 TEST(GetLastError() == ERROR_SUCCESS);
167 TEST(data[0] == 0xbeefdead);
168 TEST(data[1] == 0xbeefdead);
169
170 for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef;
171 SetLastError(ERROR_SUCCESS);
172 TEST(NtUserSystemParametersInfo(4142, 0, &data, 0) == TRUE);
173 TEST(GetLastError() == ERROR_SUCCESS);
174 TEST(data[0] != 0xdeadbeef);
175 TEST(data[1] == 0xdeadbeef);
176
177 for(i = 0; i < 1000; i++) data[i] = 0xbeefdead;
178 SetLastError(ERROR_SUCCESS);
179 TEST(NtUserSystemParametersInfo(4143, 0, &data, 0) == TRUE);
180 TEST(GetLastError() == ERROR_SUCCESS);
181 TEST(data[0] == 0xbeefdead);
182 TEST(data[1] == 0xbeefdead);
183
184 for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef;
185 SetLastError(ERROR_SUCCESS);
186 TEST(NtUserSystemParametersInfo(4144, 0, &data, 0) == TRUE);
187 TEST(GetLastError() == ERROR_SUCCESS);
188 TEST(data[0] != 0xdeadbeef);
189 TEST(data[1] == 0xdeadbeef);
190
191 for(i = 0; i < 1000; i++) data[i] = 0xbeefdead;
192 SetLastError(ERROR_SUCCESS);
193 TEST(NtUserSystemParametersInfo(4145, 0, &data, 0) == TRUE);
194 TEST(GetLastError() == ERROR_SUCCESS);
195 TEST(data[0] == 0xbeefdead);
196 TEST(data[1] == 0xbeefdead);
197
198 for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef;
199 SetLastError(ERROR_SUCCESS);
200 TEST(NtUserSystemParametersInfo(4146, 0, &data, 0) == TRUE);
201 TEST(GetLastError() == ERROR_SUCCESS);
202 TEST(data[0] != 0xdeadbeef);
203 TEST(data[1] == 0xdeadbeef);
204
205 for(i = 0; i < 1000; i++) data[i] = 0xbeefdead;
206 SetLastError(ERROR_SUCCESS);
207 TEST(NtUserSystemParametersInfo(4147, 0, &data, 0) == TRUE);
208 TEST(GetLastError() == ERROR_SUCCESS);
209 TEST(data[0] == 0xbeefdead);
210 TEST(data[1] == 0xbeefdead);
211
212 for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef;
213 SetLastError(ERROR_SUCCESS);
214 TEST(NtUserSystemParametersInfo(4148, 0, &data, 0) == TRUE);
215 TEST(GetLastError() == ERROR_SUCCESS);
216 TEST(data[0] != 0xdeadbeef);
217 TEST(data[1] == 0xdeadbeef);
218
219 for(i = 0; i < 1000; i++) data[i] = 0xbeefdead;
220 SetLastError(ERROR_SUCCESS);
221 TEST(NtUserSystemParametersInfo(4149, 0, &data, 0) == TRUE);
222 TEST(GetLastError() == ERROR_SUCCESS);
223 TEST(data[0] == 0xbeefdead);
224 TEST(data[1] == 0xbeefdead);
225
226 for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef;
227 SetLastError(ERROR_SUCCESS);
228 TEST(NtUserSystemParametersInfo(4150, 0, &data, 0) == TRUE);
229 TEST(GetLastError() == ERROR_SUCCESS);
230 TEST(data[0] != 0xdeadbeef);
231 TEST(data[1] == 0xdeadbeef);
232
233 for(i = 0; i < 1000; i++) data[i] = 0xbeefdead;
234 SetLastError(ERROR_SUCCESS);
235 TEST(NtUserSystemParametersInfo(4151, 0, &data, 0) == TRUE);
236 TEST(GetLastError() == ERROR_SUCCESS);
237 TEST(data[0] == 0xbeefdead);
238 TEST(data[1] == 0xbeefdead);
239
240 for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef;
241 SetLastError(ERROR_SUCCESS);
242 TEST(NtUserSystemParametersInfo(4152, 0, &data, 0) == TRUE);
243 TEST(GetLastError() == ERROR_SUCCESS);
244 TEST(data[0] != 0xdeadbeef);
245 TEST(data[1] == 0xdeadbeef);
246
247 for(i = 0; i < 1000; i++) data[i] = 0xbeefdead;
248 SetLastError(ERROR_SUCCESS);
249 TEST(NtUserSystemParametersInfo(4153, 0, &data, 0) == TRUE);
250 TEST(GetLastError() == ERROR_SUCCESS);
251 TEST(data[0] == 0xbeefdead);
252 TEST(data[1] == 0xbeefdead);
253
254 for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef;
255 SetLastError(ERROR_SUCCESS);
256 TEST(NtUserSystemParametersInfo(4154, 0, &data, 0) == TRUE);
257 TEST(GetLastError() == ERROR_SUCCESS);
258 TEST(data[0] != 0xdeadbeef);
259 TEST(data[1] == 0xdeadbeef);
260
261 for(i = 0; i < 1000; i++) data[i] = 0xbeefdead;
262 SetLastError(ERROR_SUCCESS);
263 TEST(NtUserSystemParametersInfo(4155, 0, &data, 0) == TRUE);
264 TEST(GetLastError() == ERROR_SUCCESS);
265 TEST(data[0] == 0xbeefdead);
266 TEST(data[1] == 0xbeefdead);
267
268 for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef;
269 SetLastError(ERROR_SUCCESS);
270 TEST(NtUserSystemParametersInfo(4156, 0, &data, 0) == TRUE);
271 TEST(GetLastError() == ERROR_SUCCESS);
272 TEST(data[0] != 0xdeadbeef);
273 TEST(data[1] == 0xdeadbeef);
274
275 for(i = 0; i < 1000; i++) data[i] = 0xbeefdead;
276 SetLastError(ERROR_SUCCESS);
277 TEST(NtUserSystemParametersInfo(4157, 0, &data, 0) == TRUE);
278 TEST(GetLastError() == ERROR_SUCCESS);
279 TEST(data[0] == 0xbeefdead);
280 TEST(data[1] == 0xbeefdead);
281 #endif
282 /* Test invalid pointer */
283 SetLastError(ERROR_SUCCESS);
284 TEST(NtUserSystemParametersInfo(SPI_GETFOCUSBORDERHEIGHT, 0, (PVOID)0x80000000, 0) == FALSE);
285 TEST(GetLastError() == ERROR_NOACCESS);
286 for(i = 0; i < 1000; i++) data[i] = 0xdeadbeef;
287
288 /* test wrong bools */
289 }
290
291 void
292 Test_NtUserSystemParametersInfo_Winsta(PTESTINFO pti)
293 {
294 HWINSTA hwinsta, hwinstaOld;
295 INT ai[20];
296 BOOL bRet;
297 // INT i;
298
299 hwinstaOld = GetProcessWindowStation();
300 hwinsta = CreateWindowStation(NULL, 0, READ_CONTROL, NULL);
301 SetProcessWindowStation(hwinsta);
302 printf("hwinstaOld=%p, hwinsta=%p\n", hwinstaOld, hwinsta);
303
304 #if 1 // currently Winsta stuff is broken in ros
305 TEST(SystemParametersInfoA(SPI_GETBEEP, 0, ai, 0) == 0);
306 TEST(GetLastError() == ERROR_ACCESS_DENIED);
307 TEST(SystemParametersInfoA(SPI_SETBEEP, 0, ai, 0) == 0);
308 TEST(GetLastError() == ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION);
309 TEST(SystemParametersInfoA(SPI_GETMOUSE, 0, ai, 0) == 0);
310 TEST(GetLastError() == ERROR_ACCESS_DENIED);
311 TEST(SystemParametersInfoA(SPI_SETMOUSE, 0, ai, 0) == 0);
312 TEST(GetLastError() == ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION);
313 TEST(SystemParametersInfoA(SPI_GETBORDER, 0, ai, 0) == 0);
314 TEST(GetLastError() == ERROR_ACCESS_DENIED);
315 TEST(SystemParametersInfoA(SPI_SETBORDER, 0, ai, 0) == 0);
316 TEST(GetLastError() == ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION);
317 TEST(SystemParametersInfoA(SPI_GETKEYBOARDSPEED, 0, ai, 0) == 0);
318 TEST(GetLastError() == ERROR_ACCESS_DENIED);
319 TEST(SystemParametersInfoA(SPI_SETKEYBOARDSPEED, 0, ai, 0) == 0);
320 TEST(GetLastError() == ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION);
321 TEST(SystemParametersInfoA(SPI_ICONHORIZONTALSPACING, 0, ai, 0) == 0);
322 TEST(GetLastError() == ERROR_ACCESS_DENIED);
323 TEST(SystemParametersInfoA(SPI_ICONHORIZONTALSPACING, 32, 0, 0) == 0);
324 TEST(GetLastError() == ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION);
325 TEST(SystemParametersInfoA(SPI_GETSCREENSAVETIMEOUT, 0, ai, 0) == 0);
326 TEST(GetLastError() == ERROR_ACCESS_DENIED);
327 TEST(SystemParametersInfoA(SPI_SETSCREENSAVETIMEOUT, 0, ai, 0) == 0);
328 TEST(GetLastError() == ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION);
329 TEST(SystemParametersInfoA(SPI_GETKEYBOARDCUES, 0, &bRet, 0) == 0);
330 TEST(GetLastError() == ERROR_ACCESS_DENIED);
331 TEST(SystemParametersInfoA(SPI_SETKEYBOARDCUES, 0, (PVOID)1, 0) == 0);
332 TEST(GetLastError() == ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION);
333 #endif
334
335 SetProcessWindowStation(hwinstaOld);
336 }
337
338 void
339 Test_NtUserSystemParametersInfo_fWinIni(PTESTINFO pti)
340 {
341 ACCESSTIMEOUT ato;
342 // UINT uFocusBorderHeight;
343 WCHAR Buffer[6];
344 DWORD cbSize;
345
346 ato.cbSize = sizeof(ato);
347 NtUserSystemParametersInfo(SPI_GETACCESSTIMEOUT, 0, &ato, 0);
348 ato.iTimeOutMSec++;
349 NtUserSystemParametersInfo(SPI_SETACCESSTIMEOUT, 0, &ato, 0);
350 ato.iTimeOutMSec--;
351
352 // NtUserSystemParametersInfo(SPI_GETFOCUSBORDERHEIGHT, 0, &uFocusBorderHeight, 0);
353 // NtUserSystemParametersInfo(SPI_SETFOCUSBORDERHEIGHT, 0, &uFocusBorderHeight, SPIF_UPDATEINIFILE);
354
355 NtUserSystemParametersInfo(SPI_SETACCESSTIMEOUT, 0, &ato, 0);
356
357 cbSize = 6;
358 QueryUserRegValueW(L"Control Panel\\Accessibility\\TimeOut", L"TimeToWait", &Buffer, &cbSize, NULL);
359
360 }
361
362 void
363 Test_MetricKey(PTESTINFO pti, PCWSTR pwszVal, INT iVal)
364 {
365 WCHAR szReg[10];
366 DWORD cbSize;
367
368 cbSize = sizeof(szReg);
369 TESTX(QueryUserRegValueW(KEY_METRIC, pwszVal, &szReg, &cbSize, NULL) == ERROR_SUCCESS, "Value=%S\n", pwszVal);
370 TESTX(_wcsicmp(szReg, L"1") == 0, "Value=%S\n", pwszVal);
371
372 }
373
374 INT
375 Test_UserPref(PTESTINFO pti, UINT uiGet, UINT uiSet, DWORD dwPrefMask)
376 {
377 BOOL bOrig, bTemp = 0;
378 DWORD dwUserPref, dwUserPrefOrg;
379 DWORD cbSize;
380
381 /* Get original values */
382 NtUserSystemParametersInfo(uiGet, 0, &bOrig, 0);
383 cbSize = sizeof(dwUserPrefOrg);
384 QueryUserRegValueW(KEY_DESKTOP, VAL_PREFMASK, &dwUserPrefOrg, &cbSize, NULL);
385
386 /* Value 0 */
387 NtUserSystemParametersInfo(uiSet, 0, NULL, SPIF_UPDATEINIFILE);
388 NtUserSystemParametersInfo(uiGet, 0, &bTemp, 0);
389 TEST(bTemp == 0);
390 cbSize = sizeof(dwUserPref);
391 TEST(QueryUserRegValueW(KEY_DESKTOP, VAL_PREFMASK, &dwUserPref, &cbSize, NULL) == ERROR_SUCCESS);
392 TEST((dwUserPref & dwPrefMask) == 0);
393 TEST((dwUserPref & (~dwPrefMask)) == (dwUserPrefOrg & (~dwPrefMask)));
394
395 /* Value 1 without Registry */
396 NtUserSystemParametersInfo(uiSet, 0, (PVOID)1, 0);
397 NtUserSystemParametersInfo(uiGet, 0, &bTemp, 0);
398 TEST(bTemp == 1);
399 cbSize = sizeof(dwUserPref);
400 TEST(QueryUserRegValueW(KEY_DESKTOP, VAL_PREFMASK, &dwUserPref, &cbSize, NULL) == ERROR_SUCCESS);
401 TEST((dwUserPref & dwPrefMask) == 0);
402 TEST((dwUserPref & (~dwPrefMask)) == (dwUserPrefOrg & (~dwPrefMask)));
403
404 /* Value 1 with Registry */
405 NtUserSystemParametersInfo(uiSet, 0, (PVOID)1, SPIF_UPDATEINIFILE);
406 NtUserSystemParametersInfo(uiGet, 0, &bTemp, 0);
407 TEST(bTemp == 1);
408 cbSize = sizeof(dwUserPref);
409 TEST(QueryUserRegValueW(KEY_DESKTOP, VAL_PREFMASK, &dwUserPref, &cbSize, NULL) == ERROR_SUCCESS);
410 TEST((dwUserPref & dwPrefMask) == dwPrefMask);
411 TEST((dwUserPref & (~dwPrefMask)) == (dwUserPrefOrg & (~dwPrefMask)));
412
413 /* Restore original value */
414 NtUserSystemParametersInfo(uiSet, 0, (PVOID)bOrig, SPIF_UPDATEINIFILE);
415
416 return APISTATUS_NORMAL;
417 }
418
419
420 /******************************************************************************/
421
422 void
423 Test_SPI_SETBEEP(PTESTINFO pti)
424 {
425 BOOL bOrig, bTemp = 0;
426 WCHAR szReg[10];
427 DWORD cbSize;
428
429 /* Get original value */
430 NtUserSystemParametersInfo(SPI_GETBEEP, 0, &bOrig, 0);
431
432 /* Value 0 */
433 NtUserSystemParametersInfo(SPI_SETBEEP, 0, NULL, SPIF_UPDATEINIFILE);
434 NtUserSystemParametersInfo(SPI_GETBEEP, 0, &bTemp, 0);
435 TEST(bTemp == 0);
436 cbSize = sizeof(szReg);
437 TEST(QueryUserRegValueW(KEY_SOUND, VAL_BEEP, &szReg, &cbSize, NULL) == ERROR_SUCCESS);
438 TEST(_wcsicmp(szReg, L"No") == 0);
439
440 /* Value 1 */
441 NtUserSystemParametersInfo(SPI_SETBEEP, 1, NULL, SPIF_UPDATEINIFILE);
442 NtUserSystemParametersInfo(SPI_GETBEEP, 0, &bTemp, 0);
443 TEST(bTemp == 1);
444 cbSize = sizeof(szReg);
445 TEST(QueryUserRegValueW(KEY_SOUND, VAL_BEEP, &szReg, &cbSize, NULL) == ERROR_SUCCESS);
446 TEST(_wcsicmp(szReg, L"Yes") == 0);
447
448 /* Value 2 */
449 NtUserSystemParametersInfo(SPI_SETBEEP, 2, NULL, SPIF_UPDATEINIFILE);
450 NtUserSystemParametersInfo(SPI_GETBEEP, 0, &bTemp, 0);
451 TEST(bTemp == 1);
452 cbSize = sizeof(szReg);
453 TEST(QueryUserRegValueW(KEY_SOUND, VAL_BEEP, &szReg, &cbSize, NULL) == ERROR_SUCCESS);
454 TEST(_wcsicmp(szReg, L"Yes") == 0);
455
456 /* Restore original value */
457 NtUserSystemParametersInfo(SPI_SETBEEP, 0, &bOrig, SPIF_UPDATEINIFILE);
458 }
459
460 void
461 Test_SPI_SETMOUSE(PTESTINFO pti)
462 {
463 INT aiOrig[3], aiTemp[3];
464
465 /* Get original value */
466 NtUserSystemParametersInfo(SPI_GETMOUSE, 0, aiOrig, 0);
467
468 /* Test uiParam value */
469 TEST(NtUserSystemParametersInfo(SPI_GETMOUSE, 0, aiTemp, 0) == 1);
470 TEST(NtUserSystemParametersInfo(SPI_GETMOUSE, 1, aiTemp, 0) == 1);
471 TEST(NtUserSystemParametersInfo(SPI_GETMOUSE, -1, aiTemp, 0) == 1);
472 TEST(NtUserSystemParametersInfo(SPI_GETMOUSE, 0xdeadbeef, aiTemp, 0) == 1);
473
474 /* Set modified values */
475 aiTemp[0] = aiOrig[0] + 1;
476 aiTemp[1] = aiOrig[1] - 1;
477 aiTemp[2] = aiOrig[2] + 2;
478 NtUserSystemParametersInfo(SPI_SETMOUSE, 2, aiTemp, SPIF_UPDATEINIFILE);
479 aiTemp[0] = aiTemp[1] = aiTemp[2] = 0;
480
481 /* Get new values */
482 NtUserSystemParametersInfo(SPI_GETMOUSE, 0, aiTemp, 0);
483
484 /* Test modified values */
485 TEST(aiTemp[0] == aiOrig[0] + 1);
486 TEST(aiTemp[1] == aiOrig[1] - 1);
487 TEST(aiTemp[2] == aiOrig[2] + 2);
488
489 // FIXME: Test registry values
490
491 /* Restore original value */
492 NtUserSystemParametersInfo(SPI_SETMOUSE, 0, aiOrig, SPIF_UPDATEINIFILE);
493 }
494
495 void
496 Test_SPI_SETBORDER(PTESTINFO pti)
497 {
498 INT iOrig, iTemp = 0;
499
500 /* Get original value */
501 NtUserSystemParametersInfo(SPI_GETBORDER, 0, &iOrig, 0);
502
503 /* Value 0 */
504 NtUserSystemParametersInfo(SPI_SETBORDER, 0, NULL, SPIF_UPDATEINIFILE);
505 NtUserSystemParametersInfo(SPI_GETBORDER, 0, &iTemp, 0);
506 TEST(iTemp == 1);
507 TEST(GetSystemMetrics(SM_CXBORDER) == 1);
508
509 /* Value 1 */
510 NtUserSystemParametersInfo(SPI_SETBORDER, 1, NULL, SPIF_UPDATEINIFILE);
511 NtUserSystemParametersInfo(SPI_GETBORDER, 0, &iTemp, 0);
512 TEST(iTemp == 1);
513 // Test_MetricKey(pti, VAL_BORDER, 1);
514
515 /* Value 2 */
516 NtUserSystemParametersInfo(SPI_SETBORDER, 2, NULL, SPIF_UPDATEINIFILE);
517 NtUserSystemParametersInfo(SPI_GETBORDER, 0, &iTemp, 0);
518 TEST(iTemp == 2);
519 TEST(GetSystemMetrics(SM_CXBORDER) == 1);
520
521 /* Restore original value */
522 NtUserSystemParametersInfo(SPI_SETBORDER, iOrig, NULL, SPIF_UPDATEINIFILE);
523
524 }
525
526 // Test_SPI_SETKEYBOARDSPEED(pti);
527 // Test_SPI_LANGDRIVER(pti);
528 // Test_SPI_ICONHORIZONTALSPACING(pti);
529 // Test_SPI_SETSCREENSAVETIMEOUT(pti);
530 // Test_SPI_SETSCREENSAVEACTIVE(pti);
531 // Test_SPI_SETGRIDGRANULARITY(pti);
532
533 void
534 Test_SPI_SETDESKWALLPAPER(PTESTINFO pti)
535 {
536 UNICODE_STRING ustrOld, ustrNew;
537 WCHAR szOld[MAX_PATH];
538 WCHAR szNew[MAX_PATH];
539
540 /* Get old Wallpaper */
541 TEST(NtUserSystemParametersInfo(SPI_GETDESKWALLPAPER, MAX_PATH, szOld, 0) == 1);
542 RtlInitUnicodeString(&ustrOld, szOld);
543
544 /* Set no Wallpaper */
545 TEST(NtUserSystemParametersInfo(SPI_SETDESKWALLPAPER, 0, L"", 0) == 1);
546 TEST(NtUserSystemParametersInfo(SPI_GETDESKWALLPAPER, MAX_PATH, szNew, 0) == 1);
547 TEST(szNew[0] == 0);
548
549 /* Set no Wallpaper 2 */
550 RtlInitUnicodeString(&ustrNew, L"");
551 TEST(NtUserSystemParametersInfo(SPI_SETDESKWALLPAPER, 0, &ustrNew, 0) == 1);
552 TEST(NtUserSystemParametersInfo(SPI_GETDESKWALLPAPER, MAX_PATH, szNew, 0) == 1);
553 TEST(szNew[0] == 0);
554
555 /* Reset Wallpaper */
556 TEST(NtUserSystemParametersInfo(SPI_SETDESKWALLPAPER, 0, NULL, 0) == 1);
557 TEST(NtUserSystemParametersInfo(SPI_GETDESKWALLPAPER, MAX_PATH, szNew, 0) == 1);
558 TEST(wcscmp(szNew, szOld) == 0);
559
560 /* Set new Wallpaper */
561 RtlInitUnicodeString(&ustrNew, L"test.bmp");
562 TEST(NtUserSystemParametersInfo(SPI_SETDESKWALLPAPER, 0, &ustrNew, 0) == 1);
563 TEST(NtUserSystemParametersInfo(SPI_GETDESKWALLPAPER, MAX_PATH, szNew, 0) == 1);
564 TEST(wcscmp(szNew, L"test.bmp") == 0);
565
566 /* Get Wallpaper, too small buffer */
567 szNew[0] = 0; szNew[1] = 0; szNew[2] = 0;
568 TEST(NtUserSystemParametersInfo(SPI_GETDESKWALLPAPER, 3, szNew, 0) == 1);
569 TEST(szNew[0] != 0);
570 TEST(szNew[1] != 0);
571 TEST(szNew[2] != 0);
572
573 /* Set invalid Wallpaper */
574 SetLastError(0xdeadbeef);
575 RtlInitUnicodeString(&ustrNew, L"*#!!-&");
576 TEST(NtUserSystemParametersInfo(SPI_SETDESKWALLPAPER, 0, &ustrNew, 0) == 0);
577 TEST(GetLastError() == ERROR_FILE_NOT_FOUND);
578 TEST(NtUserSystemParametersInfo(SPI_GETDESKWALLPAPER, MAX_PATH, szNew, 0) == 1);
579 TEST(wcscmp(szNew, L"*#!!-&") == 0);
580
581 /* Restore old Wallpaper */
582 TEST(NtUserSystemParametersInfo(SPI_SETDESKWALLPAPER, MAX_PATH, &ustrOld, SPIF_UPDATEINIFILE) == 1);
583
584 }
585
586 // Test_SPI_SETDESKPATTERN(pti);
587 // Test_SPI_SETKEYBOARDDELAY(pti);
588 // Test_SPI_ICONVERTICALSPACING(pti);
589 // Test_SPI_SETICONTITLEWRAP(pti);
590 // Test_SPI_SETMENUDROPALIGNMENT(pti);
591 // Test_SPI_SETDOUBLECLKWIDTH(pti);
592 // Test_SPI_SETDOUBLECLKHEIGHT(pti);
593 // Test_SPI_SETDOUBLECLICKTIME(pti);
594
595 INT
596 Test_SPI_SETMOUSEBUTTONSWAP(PTESTINFO pti)
597 {
598 BOOL bOrig, bTemp = 0;
599 WCHAR szReg[10];
600 DWORD cbSize;
601
602 /* Get original value */
603 bOrig = GetSystemMetrics(SM_SWAPBUTTON);
604
605 /* Value 0 */
606 NtUserSystemParametersInfo(SPI_SETMOUSEBUTTONSWAP, 0, NULL, SPIF_UPDATEINIFILE);
607 bTemp = GetSystemMetrics(SM_SWAPBUTTON);
608 TEST(bTemp == 0);
609 cbSize = sizeof(szReg);
610 TEST(QueryUserRegValueW(KEY_MOUSE, VAL_SWAP, &szReg, &cbSize, NULL) == ERROR_SUCCESS);
611 TEST(_wcsicmp(szReg, L"0") == 0);
612
613 /* Value 1 */
614 NtUserSystemParametersInfo(SPI_SETMOUSEBUTTONSWAP, 1, NULL, SPIF_UPDATEINIFILE);
615 bTemp = GetSystemMetrics(SM_SWAPBUTTON);
616 TEST(bTemp == 1);
617 cbSize = sizeof(szReg);
618 TEST(QueryUserRegValueW(KEY_MOUSE, VAL_SWAP, &szReg, &cbSize, NULL) == ERROR_SUCCESS);
619 TEST(_wcsicmp(szReg, L"1") == 0);
620
621 /* Value 2 */
622 NtUserSystemParametersInfo(SPI_SETMOUSEBUTTONSWAP, 2, NULL, SPIF_UPDATEINIFILE);
623 bTemp = GetSystemMetrics(SM_SWAPBUTTON);
624 TEST(bTemp == 1);
625 cbSize = sizeof(szReg);
626 TEST(QueryUserRegValueW(KEY_MOUSE, VAL_SWAP, &szReg, &cbSize, NULL) == ERROR_SUCCESS);
627 TEST(_wcsicmp(szReg, L"2") == 0);
628
629 /* Value -1 */
630 NtUserSystemParametersInfo(SPI_SETMOUSEBUTTONSWAP, -1, NULL, SPIF_UPDATEINIFILE);
631 bTemp = GetSystemMetrics(SM_SWAPBUTTON);
632 TEST(bTemp == 1);
633 cbSize = sizeof(szReg);
634 TEST(QueryUserRegValueW(KEY_MOUSE, VAL_SWAP, &szReg, &cbSize, NULL) == ERROR_SUCCESS);
635 TEST(_wcsicmp(szReg, L"-1") == 0);
636
637 /* Restore original value */
638 NtUserSystemParametersInfo(SPI_SETMOUSEBUTTONSWAP, bOrig, 0, SPIF_UPDATEINIFILE);
639
640 return APISTATUS_NORMAL;
641 }
642
643 INT
644 Test_SPI_SETICONTITLELOGFONT(PTESTINFO pti)
645 {
646 LOGFONTW lfOrig;
647 struct
648 {
649 LOGFONTW lf;
650 DWORD dwRedzone;
651 } buf;
652
653 /* Get original value */
654 ASSERT(NtUserSystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(lfOrig), &lfOrig, 0));
655
656 /* Test uiParam == 0 */
657 memset(&buf, 0, sizeof(buf));
658 buf.lf.lfFaceName[LF_FACESIZE-1] = 33;
659 buf.dwRedzone = 0xdeadbeef;
660 TEST(NtUserSystemParametersInfo(SPI_GETICONTITLELOGFONT, 0, &buf.lf, 0) == 1);
661 TEST(buf.lf.lfHeight != 0);
662 TEST(buf.lf.lfWeight != 0);
663 TEST(buf.lf.lfFaceName[0] != 0);
664 TEST(buf.lf.lfFaceName[LF_FACESIZE-1] == 0);
665 TEST(buf.dwRedzone == 0xdeadbeef);
666
667 /* Test uiParam < sizeof(LOGFONTW) */
668 memset(&buf, 0, sizeof(buf));
669 buf.lf.lfFaceName[LF_FACESIZE-1] = 33;
670 buf.dwRedzone = 0xdeadbeef;
671 TEST(NtUserSystemParametersInfo(SPI_GETICONTITLELOGFONT, 8, &buf.lf, 0) == 1);
672 TEST(buf.lf.lfHeight != 0);
673 TEST(buf.lf.lfWeight != 0);
674 TEST(buf.lf.lfFaceName[0] != 0);
675 TEST(buf.lf.lfFaceName[LF_FACESIZE-1] == 0);
676 TEST(buf.dwRedzone == 0xdeadbeef);
677
678 /* Test uiParam < 0 */
679 TEST(NtUserSystemParametersInfo(SPI_GETICONTITLELOGFONT, -1, &buf.lf, 0) == 1);
680
681 return APISTATUS_NORMAL;
682 }
683
684 INT
685 Test_SPI_SETFASTTASKSWITCH(PTESTINFO pti)
686 {
687 char buf[10];
688 TEST(NtUserSystemParametersInfo(SPI_SETFASTTASKSWITCH, 0, 0, 0) == 1);
689 TEST(NtUserSystemParametersInfo(SPI_SETFASTTASKSWITCH, 0, buf, 0) == 1);
690
691 return APISTATUS_NORMAL;
692 }
693
694 INT
695 Test_SPI_SETDRAGFULLWINDOWS(PTESTINFO pti)
696 {
697 return APISTATUS_NORMAL;
698 }
699
700 INT
701 Test_SPI_SETNONCLIENTMETRICS(PTESTINFO pti)
702 {
703 return APISTATUS_NORMAL;
704 }
705
706 INT
707 Test_SPI_SETMINIMIZEDMETRICS(PTESTINFO pti)
708 {
709 return APISTATUS_NORMAL;
710 }
711
712 INT
713 Test_SPI_SETICONMETRICS(PTESTINFO pti)
714 {
715 return APISTATUS_NORMAL;
716 }
717
718 INT
719 Test_SPI_SETWORKAREA(PTESTINFO pti)
720 {
721 RECT rcOrig, rc;
722
723 /* Get the original value */
724 ASSERT(NtUserSystemParametersInfo(SPI_GETWORKAREA, 0, &rcOrig, 0) == 1);
725
726 /* Change value */
727 rc = rcOrig;
728 rc.left += 1;
729 rc.top += 2;
730 rc.right -= 3;
731 rc.bottom -= 2;
732 TEST(NtUserSystemParametersInfo(SPI_SETWORKAREA, 1, &rc, 0) == 1);
733 TEST(NtUserSystemParametersInfo(SPI_SETWORKAREA, 0, &rc, 0) == 1);
734 TEST(NtUserSystemParametersInfo(SPI_SETWORKAREA, sizeof(RECT), &rc, 0) == 1);
735
736 TEST(NtUserSystemParametersInfo(SPI_GETWORKAREA, 1, &rc, 0) == 1);
737 TEST(NtUserSystemParametersInfo(SPI_GETWORKAREA, -1, &rc, 0) == 1);
738 TEST(NtUserSystemParametersInfo(SPI_GETWORKAREA, 0xdeadbeef, &rc, 0) == 1);
739 TEST(NtUserSystemParametersInfo(SPI_GETWORKAREA, 0, (PVOID)0xdeadbeef, 0) == 0);
740
741 /* Test values */
742 rc = rcOrig; rc.left = -1;
743 TEST(NtUserSystemParametersInfo(SPI_SETWORKAREA, 0, &rc, 0) == 0);
744 rc = rcOrig; rc.top = -1;
745 TEST(NtUserSystemParametersInfo(SPI_SETWORKAREA, 0, &rc, 0) == 0);
746 rc = rcOrig; rc.top = 10; rc.bottom = 11;
747 TEST(NtUserSystemParametersInfo(SPI_SETWORKAREA, 0, &rc, 0) == 1);
748 rc = rcOrig; rc.top = 10; rc.bottom = 10;
749 TEST(NtUserSystemParametersInfo(SPI_SETWORKAREA, 0, &rc, 0) == 0);
750 rc = rcOrig; rc.top = 10; rc.bottom = 9;
751 TEST(NtUserSystemParametersInfo(SPI_SETWORKAREA, 0, &rc, 0) == 0);
752 rc = rcOrig; rc.left = 10; rc.right = 11;
753 TEST(NtUserSystemParametersInfo(SPI_SETWORKAREA, 0, &rc, 0) == 1);
754 rc = rcOrig; rc.left = 10; rc.right = 10;
755 TEST(NtUserSystemParametersInfo(SPI_SETWORKAREA, 0, &rc, 0) == 0);
756 rc = rcOrig; rc.left = 10; rc.right = 9;
757 TEST(NtUserSystemParametersInfo(SPI_SETWORKAREA, 0, &rc, 0) == 0);
758 rc = rcOrig; rc.bottom = GetSystemMetrics(SM_CYVIRTUALSCREEN);
759 TEST(NtUserSystemParametersInfo(SPI_SETWORKAREA, 0, &rc, 0) == 1);
760 rc = rcOrig; rc.bottom = GetSystemMetrics(SM_CYVIRTUALSCREEN)+1;
761 TEST(NtUserSystemParametersInfo(SPI_SETWORKAREA, 0, &rc, 0) == 0);
762 rc = rcOrig; rc.right = GetSystemMetrics(SM_CXVIRTUALSCREEN);
763 TEST(NtUserSystemParametersInfo(SPI_SETWORKAREA, 0, &rc, 0) == 1);
764 rc = rcOrig; rc.right = GetSystemMetrics(SM_CXVIRTUALSCREEN)+1;
765 TEST(NtUserSystemParametersInfo(SPI_SETWORKAREA, 0, &rc, 0) == 0);
766
767 /* Restore original value */
768 ASSERT(NtUserSystemParametersInfo(SPI_SETWORKAREA, 0, &rcOrig, 0) == 1);
769
770 return APISTATUS_NORMAL;
771 }
772
773 INT
774 Test_SPI_SETPENWINDOWS(PTESTINFO pti)
775 {
776 return APISTATUS_NORMAL;
777 }
778
779 INT
780 Test_SPI_SETFILTERKEYS(PTESTINFO pti)
781 {
782 return APISTATUS_NORMAL;
783 }
784
785 INT
786 Test_SPI_SETTOGGLEKEYS(PTESTINFO pti)
787 {
788 return APISTATUS_NORMAL;
789 }
790
791 INT
792 Test_SPI_SETMOUSEKEYS(PTESTINFO pti)
793 {
794 return APISTATUS_NORMAL;
795 }
796
797 INT
798 Test_SPI_SETSHOWSOUNDS(PTESTINFO pti)
799 {
800 return APISTATUS_NORMAL;
801 }
802
803 INT
804 Test_SPI_SETSTICKYKEYS(PTESTINFO pti)
805 {
806 STICKYKEYS skOrig, sk;
807
808 /* Get original values */
809 skOrig.cbSize = sizeof(STICKYKEYS);
810 ASSERT(NtUserSystemParametersInfo(SPI_GETSTICKYKEYS, 0, &skOrig, 0) == 1);
811
812 sk.cbSize = sizeof(STICKYKEYS)+1;
813 TEST(NtUserSystemParametersInfo(SPI_GETSTICKYKEYS, 0, &sk, 0) == 0);
814
815 sk.cbSize = sizeof(STICKYKEYS)-1;
816 TEST(NtUserSystemParametersInfo(SPI_GETSTICKYKEYS, 0, &sk, 0) == 0);
817
818 sk.cbSize = sizeof(STICKYKEYS);
819 TEST(NtUserSystemParametersInfo(SPI_GETSTICKYKEYS, 1, &sk, 0) == 0);
820 TEST(NtUserSystemParametersInfo(SPI_GETSTICKYKEYS, -1, &sk, 0) == 0);
821 TEST(NtUserSystemParametersInfo(SPI_GETSTICKYKEYS, sk.cbSize, &sk, 0) == 1);
822 TEST(NtUserSystemParametersInfo(SPI_GETSTICKYKEYS, sk.cbSize-1, &sk, 0) == 0);
823 TEST(NtUserSystemParametersInfo(SPI_GETSTICKYKEYS, sk.cbSize+1, &sk, 0) == 0);
824
825 sk = skOrig;
826 sk.dwFlags = (skOrig.dwFlags ^ 1);
827 TEST(NtUserSystemParametersInfo(SPI_SETSTICKYKEYS, sk.cbSize+1, &sk, 0) == 0);
828 TEST(NtUserSystemParametersInfo(SPI_SETSTICKYKEYS, sk.cbSize-1, &sk, 0) == 0);
829 TEST(NtUserSystemParametersInfo(SPI_SETSTICKYKEYS, sk.cbSize, &sk, 0) == 1);
830
831 sk = skOrig;
832 TEST(NtUserSystemParametersInfo(SPI_GETSTICKYKEYS, 0, &sk, 0) == 1);
833 TEST(sk.dwFlags == (skOrig.dwFlags ^ 1));
834
835 /* Restore original values */
836 skOrig.cbSize = sizeof(STICKYKEYS);
837 ASSERT(NtUserSystemParametersInfo(SPI_SETSTICKYKEYS, 0, &skOrig, 0) == 1);
838
839 return APISTATUS_NORMAL;
840 }
841
842 INT
843 Test_SPI_SETACCESSTIMEOUT(PTESTINFO pti)
844 {
845 ACCESSTIMEOUT atoOrig, atoTmp;
846
847 /* Get original values */
848 atoOrig.cbSize = sizeof(ACCESSTIMEOUT);
849 ASSERT(NtUserSystemParametersInfo(SPI_GETACCESSTIMEOUT, 0, &atoOrig, 0) == 1);
850
851 atoTmp.cbSize = sizeof(ACCESSTIMEOUT) - 1;
852 TEST(NtUserSystemParametersInfo(SPI_GETACCESSTIMEOUT, 0, &atoTmp, 0) == 0);
853 atoTmp.cbSize = sizeof(ACCESSTIMEOUT) + 1;
854 TEST(NtUserSystemParametersInfo(SPI_GETACCESSTIMEOUT, 0, &atoTmp, 0) == 0);
855 atoTmp.cbSize = sizeof(ACCESSTIMEOUT);
856 TEST(NtUserSystemParametersInfo(SPI_GETACCESSTIMEOUT, 0, &atoTmp, 0) == 1);
857 atoTmp.cbSize = sizeof(ACCESSTIMEOUT);
858 TEST(NtUserSystemParametersInfo(SPI_GETACCESSTIMEOUT, 1, &atoTmp, 0) == 0);
859 atoTmp.cbSize = sizeof(ACCESSTIMEOUT);
860 TEST(NtUserSystemParametersInfo(SPI_GETACCESSTIMEOUT, -1, &atoTmp, 0) == 0);
861 atoTmp.cbSize = sizeof(ACCESSTIMEOUT);
862 TEST(NtUserSystemParametersInfo(SPI_GETACCESSTIMEOUT, sizeof(ACCESSTIMEOUT), &atoTmp, 0) == 1);
863 atoTmp.cbSize = sizeof(ACCESSTIMEOUT);
864 TEST(NtUserSystemParametersInfo(SPI_GETACCESSTIMEOUT, sizeof(ACCESSTIMEOUT)-1, &atoTmp, 0) == 0);
865 atoTmp.cbSize = sizeof(ACCESSTIMEOUT);
866 TEST(NtUserSystemParametersInfo(SPI_GETACCESSTIMEOUT, sizeof(ACCESSTIMEOUT)+1, &atoTmp, 0) == 0);
867
868 /* Restore original values */
869 ASSERT(NtUserSystemParametersInfo(SPI_SETACCESSTIMEOUT, sizeof(atoOrig), &atoOrig, 0) == 1);
870
871 return APISTATUS_NORMAL;
872 }
873
874 INT
875 Test_SPI_SETSERIALKEYS(PTESTINFO pti)
876 {
877 return APISTATUS_NORMAL;
878 }
879
880 INT
881 Test_SPI_SETSOUNDSENTRY(PTESTINFO pti)
882 {
883 return APISTATUS_NORMAL;
884 }
885
886 INT
887 Test_SPI_SETHIGHCONTRAST(PTESTINFO pti)
888 {
889 return APISTATUS_NORMAL;
890 }
891
892 INT
893 Test_SPI_SETKEYBOARDPREF(PTESTINFO pti)
894 {
895 return APISTATUS_NORMAL;
896 }
897
898 // Test_SPI_SETSCREENREADER(pti);
899 /// Test_SPI_SETANIMATION(pti);
900 // Test_SPI_SETFONTSMOOTHING(pti);
901 // Test_SPI_SETDRAGWIDTH(pti);
902 // Test_SPI_SETDRAGHEIGHT(pti);
903 // Test_SPI_SETHANDHELD(pti);
904 // Test_SPI_SETLOWPOWERTIMEOUT(pti);
905 // Test_SPI_SETPOWEROFFTIMEOUT(pti);
906 // Test_SPI_SETLOWPOWERACTIVE(pti);
907 // Test_SPI_SETPOWEROFFACTIVE(pti);
908 // Test_SPI_SETCURSORS(pti);
909 // Test_SPI_SETICONS(pti);
910 // Test_SPI_SETDEFAULTINPUTLANG(pti);
911 // Test_SPI_SETLANGTOGGLE(pti);
912 // Test_SPI_GETWINDOWSEXTENSION(pti);
913 // Test_SPI_SETMOUSETRAILS(pti);
914 // Test_SPI_SETSNAPTODEFBUTTON(pti);
915 // Test_SPI_GETSCREENSAVERRUNNING(pti);
916 // Test_SPI_SETMOUSEHOVERWIDTH(pti);
917 // Test_SPI_SETMOUSEHOVERHEIGHT(pti);
918 // Test_SPI_SETMOUSEHOVERTIME(pti);
919 // Test_SPI_SETWHEELSCROLLLINES(pti);
920 // Test_SPI_SETMENUSHOWDELAY(pti);
921 // Test_SPI_SETWHEELSCROLLCHARS(pti);
922 // Test_SPI_SETSHOWIMEUI(pti);
923 // Test_SPI_SETMOUSESPEED(pti);
924 // Test_SPI_GETSCREENSAVERRUNNING(pti);
925 // Test_SPI_SETAUDIODESCRIPTION(pti);
926 // Test_SPI_SETSCREENSAVESECURE(pti);
927 // Test_SPI_SETACTIVEWINDOWTRACKING(pti);
928
929 INT
930 Test_SPI_SETMENUANIMATION(PTESTINFO pti)
931 {
932 BOOL bOrig, bTemp = 0;
933 DWORD dwUserPrefMask;
934 DWORD cbSize;
935
936 /* Get original values */
937 NtUserSystemParametersInfo(SPI_GETMENUANIMATION, 0, &bOrig, 0);
938
939 /* Value 0 */
940 NtUserSystemParametersInfo(SPI_SETMENUANIMATION, 0, NULL, SPIF_UPDATEINIFILE);
941 NtUserSystemParametersInfo(SPI_GETMENUANIMATION, 0, &bTemp, 0);
942 TEST(bTemp == 0);
943 cbSize = sizeof(dwUserPrefMask);
944 TEST(QueryUserRegValueW(KEY_DESKTOP, VAL_PREFMASK, &dwUserPrefMask, &cbSize, NULL) == ERROR_SUCCESS);
945 TEST((dwUserPrefMask & PREFMASK_MENUANIM) == 0);
946
947 /* Value 1 */
948 NtUserSystemParametersInfo(SPI_SETMENUANIMATION, 0, (PVOID)1, SPIF_UPDATEINIFILE);
949 NtUserSystemParametersInfo(SPI_GETMENUANIMATION, 0, &bTemp, 0);
950 TEST(bTemp == 1);
951 cbSize = sizeof(dwUserPrefMask);
952 TEST(QueryUserRegValueW(KEY_DESKTOP, VAL_PREFMASK, &dwUserPrefMask, &cbSize, NULL) == ERROR_SUCCESS);
953 TEST((dwUserPrefMask & PREFMASK_MENUANIM) != 0);
954
955
956 /* Restore original values */
957 NtUserSystemParametersInfo(SPI_SETMENUANIMATION, 0, (PVOID)bOrig, SPIF_UPDATEINIFILE);
958
959 return APISTATUS_NORMAL;
960 }
961
962 // Test_SPI_SETCOMBOBOXANIMATION(pti);
963 // Test_SPI_SETLISTBOXSMOOTHSCROLLING(pti);
964 // Test_SPI_SETGRADIENTCAPTIONS(pti);
965
966 INT
967 Test_SPI_SETKEYBOARDCUES(PTESTINFO pti)
968 {
969 return Test_UserPref(pti, SPI_GETKEYBOARDCUES, SPI_SETKEYBOARDCUES, PREFMASK_KBDCUES);
970 }
971
972 // Test_SPI_SETACTIVEWNDTRKZORDER(pti);
973 // Test_SPI_SETHOTTRACKING(pti);
974 // Test_SPI_SETMENUFADE(pti);
975 // Test_SPI_SETSELECTIONFADE(pti);
976 // Test_SPI_SETTOOLTIPANIMATION(pti);
977 // Test_SPI_SETTOOLTIPFADE(pti);
978 // Test_SPI_SETCURSORSHADOW(pti);
979 // Test_SPI_SETMOUSESONAR(pti);
980 // Test_SPI_SETMOUSECLICKLOCK(pti);
981 // Test_SPI_SETMOUSEVANISH(pti);
982 // Test_SPI_SETFLATMENU(pti);
983 // Test_SPI_SETDROPSHADOW(pti);
984 // Test_SPI_SETBLOCKSENDINPUTRESETS(pti);
985 // Test_SPI_GETSETUIEFFECTS(pti);
986 // Test_SPI_SETDISABLEOVERLAPPEDCONTENT(pti);
987 // Test_SPI_SETCLIENTAREAANIMATION(pti);
988 // Test_SPI_SETCLEARTYPE(pti);
989 // Test_SPI_SETSPEECHRECOGNITION(pti);
990 // Test_SPI_SETFOREGROUNDLOCKTIMEOUT(pti);
991 // Test_SPI_SETACTIVEWNDTRKTIMEOUT(pti);
992 // Test_SPI_SETFOREGROUNDFLASHCOUNT(pti);
993 // Test_SPI_SETCARETWIDTH(pti);
994 // Test_SPI_SETMOUSECLICKLOCKTIME(pti);
995 // Test_SPI_SETFONTSMOOTHINGTYPE(pti);
996 // Test_SPI_SETFONTSMOOTHINGCONTRAST(pti);
997 // Test_SPI_SETFOCUSBORDERWIDTH(pti);
998 // Test_SPI_SETFOCUSBORDERHEIGHT(pti);
999 // Test_SPI_SETFONTSMOOTHINGORIENTATION(pti);
1000
1001
1002 INT
1003 Test_NtUserSystemParametersInfo(PTESTINFO pti)
1004 {
1005 HWND hWnd;
1006
1007 hWnd = CreateTestWindow();
1008 ASSERT(hWnd);
1009
1010 Test_NtUserSystemParametersInfo_Params(pti);
1011 Test_NtUserSystemParametersInfo_fWinIni(pti);
1012 Test_NtUserSystemParametersInfo_Winsta(pti);
1013
1014 Test_SPI_SETBEEP(pti);
1015 Test_SPI_SETMOUSE(pti);
1016 Test_SPI_SETBORDER(pti);
1017 // Test_SPI_SETKEYBOARDSPEED(pti);
1018 // Test_SPI_LANGDRIVER(pti);
1019 // Test_SPI_ICONHORIZONTALSPACING(pti);
1020 // Test_SPI_SETSCREENSAVETIMEOUT(pti);
1021 // Test_SPI_SETSCREENSAVEACTIVE(pti);
1022 // Test_SPI_SETGRIDGRANULARITY(pti);
1023 Test_SPI_SETDESKWALLPAPER(pti);
1024 // Test_SPI_SETDESKPATTERN(pti);
1025 // Test_SPI_SETKEYBOARDDELAY(pti);
1026 // Test_SPI_ICONVERTICALSPACING(pti);
1027 // Test_SPI_SETICONTITLEWRAP(pti);
1028 // Test_SPI_SETMENUDROPALIGNMENT(pti);
1029 // Test_SPI_SETDOUBLECLKWIDTH(pti);
1030 // Test_SPI_SETDOUBLECLKHEIGHT(pti);
1031 // Test_SPI_SETDOUBLECLICKTIME(pti);
1032 Test_SPI_SETMOUSEBUTTONSWAP(pti);
1033 Test_SPI_SETICONTITLELOGFONT(pti);
1034 Test_SPI_SETFASTTASKSWITCH(pti);
1035 Test_SPI_SETDRAGFULLWINDOWS(pti);
1036 Test_SPI_SETNONCLIENTMETRICS(pti);
1037 Test_SPI_SETMINIMIZEDMETRICS(pti);
1038 Test_SPI_SETICONMETRICS(pti);
1039 Test_SPI_SETWORKAREA(pti);
1040 Test_SPI_SETPENWINDOWS(pti);
1041 Test_SPI_SETFILTERKEYS(pti);
1042 Test_SPI_SETTOGGLEKEYS(pti);
1043 Test_SPI_SETMOUSEKEYS(pti);
1044 Test_SPI_SETSHOWSOUNDS(pti);
1045 Test_SPI_SETSTICKYKEYS(pti);
1046 Test_SPI_SETACCESSTIMEOUT(pti);
1047 Test_SPI_SETSERIALKEYS(pti);
1048 Test_SPI_SETSOUNDSENTRY(pti);
1049 Test_SPI_SETHIGHCONTRAST(pti);
1050 Test_SPI_SETKEYBOARDPREF(pti);
1051 // Test_SPI_SETSCREENREADER(pti);
1052 /// Test_SPI_SETANIMATION(pti);
1053 // Test_SPI_SETFONTSMOOTHING(pti);
1054 // Test_SPI_SETDRAGWIDTH(pti);
1055 // Test_SPI_SETDRAGHEIGHT(pti);
1056 // Test_SPI_SETHANDHELD(pti);
1057 // Test_SPI_SETLOWPOWERTIMEOUT(pti);
1058 // Test_SPI_SETPOWEROFFTIMEOUT(pti);
1059 // Test_SPI_SETLOWPOWERACTIVE(pti);
1060 // Test_SPI_SETPOWEROFFACTIVE(pti);
1061 // Test_SPI_SETCURSORS(pti);
1062 // Test_SPI_SETICONS(pti);
1063 // Test_SPI_SETDEFAULTINPUTLANG(pti);
1064 // Test_SPI_SETLANGTOGGLE(pti);
1065 // Test_SPI_GETWINDOWSEXTENSION(pti);
1066 // Test_SPI_SETMOUSETRAILS(pti);
1067 // Test_SPI_SETSNAPTODEFBUTTON(pti);
1068 // Test_SPI_GETSCREENSAVERRUNNING(pti);
1069 // Test_SPI_SETMOUSEHOVERWIDTH(pti);
1070 // Test_SPI_SETMOUSEHOVERHEIGHT(pti);
1071 // Test_SPI_SETMOUSEHOVERTIME(pti);
1072 // Test_SPI_SETWHEELSCROLLLINES(pti);
1073 // Test_SPI_SETMENUSHOWDELAY(pti);
1074 // Test_SPI_SETWHEELSCROLLCHARS(pti);
1075 // Test_SPI_SETSHOWIMEUI(pti);
1076 // Test_SPI_SETMOUSESPEED(pti);
1077 // Test_SPI_GETSCREENSAVERRUNNING(pti);
1078 // Test_SPI_SETAUDIODESCRIPTION(pti);
1079 // Test_SPI_SETSCREENSAVESECURE(pti);
1080 // Test_SPI_SETACTIVEWINDOWTRACKING(pti);
1081 Test_SPI_SETMENUANIMATION(pti);
1082 // Test_SPI_SETCOMBOBOXANIMATION(pti);
1083 // Test_SPI_SETLISTBOXSMOOTHSCROLLING(pti);
1084 // Test_SPI_SETGRADIENTCAPTIONS(pti);
1085 Test_SPI_SETKEYBOARDCUES(pti);
1086 // Test_SPI_SETACTIVEWNDTRKZORDER(pti);
1087 // Test_SPI_SETHOTTRACKING(pti);
1088 // Test_SPI_SETMENUFADE(pti);
1089 // Test_SPI_SETSELECTIONFADE(pti);
1090 // Test_SPI_SETTOOLTIPANIMATION(pti);
1091 // Test_SPI_SETTOOLTIPFADE(pti);
1092 // Test_SPI_SETCURSORSHADOW(pti);
1093 // Test_SPI_SETMOUSESONAR(pti);
1094 // Test_SPI_SETMOUSECLICKLOCK(pti);
1095 // Test_SPI_SETMOUSEVANISH(pti);
1096 // Test_SPI_SETFLATMENU(pti);
1097 // Test_SPI_SETDROPSHADOW(pti);
1098 // Test_SPI_SETBLOCKSENDINPUTRESETS(pti);
1099 // Test_SPI_GETSETUIEFFECTS(pti);
1100 // Test_SPI_SETDISABLEOVERLAPPEDCONTENT(pti);
1101 // Test_SPI_SETCLIENTAREAANIMATION(pti);
1102 // Test_SPI_SETCLEARTYPE(pti);
1103 // Test_SPI_SETSPEECHRECOGNITION(pti);
1104 // Test_SPI_SETFOREGROUNDLOCKTIMEOUT(pti);
1105 // Test_SPI_SETACTIVEWNDTRKTIMEOUT(pti);
1106 // Test_SPI_SETFOREGROUNDFLASHCOUNT(pti);
1107 // Test_SPI_SETCARETWIDTH(pti);
1108 // Test_SPI_SETMOUSECLICKLOCKTIME(pti);
1109 // Test_SPI_SETFONTSMOOTHINGTYPE(pti);
1110 // Test_SPI_SETFONTSMOOTHINGCONTRAST(pti);
1111 // Test_SPI_SETFOCUSBORDERWIDTH(pti);
1112 // Test_SPI_SETFOCUSBORDERHEIGHT(pti);
1113 // Test_SPI_SETFONTSMOOTHINGORIENTATION(pti);
1114
1115 DestroyWindow(hWnd);
1116
1117 return APISTATUS_NORMAL;
1118 }