2 * COPYRIGHT: GPL, see COPYING in the top level directory
3 * PROJECT: ReactOS win32 kernel mode subsystem server
4 * PURPOSE: System parameters functions
5 * FILE: win32ss/user/ntuser/sysparams.c
6 * PROGRAMER: Timo Kreuzer (timo.kreuzer@reactos.org)
10 // - Check all values that are in Winsta in ROS.
11 // - Does setting invalid fonts work?
12 // - Save appropriate text metrics.
15 DBG_DEFAULT_CHANNEL(UserSysparams
);
18 BOOL gbSpiInitialized
= FALSE
;
19 BOOL g_PaintDesktopVersion
= FALSE
;
21 // HACK! We initialize SPI before we have a proper surface to get this from.
23 //(pPrimarySurface->GDIInfo.ulLogPixelsY)
24 #define REG2METRIC(reg) (reg > 0 ? reg : ((-(reg) * dpi + 720) / 1440))
25 #define METRIC2REG(met) (-((((met) * 1440)- 0) / dpi))
27 #define REQ_INTERACTIVE_WINSTA(err) \
28 if (GetW32ProcessInfo()->prpwinsta != InputWindowStation) \
30 if (GetW32ProcessInfo()->prpwinsta == NULL) \
32 ERR("NtUserSystemParametersInfo called without active window station, and it requires an interactive one\n"); \
36 ERR("NtUserSystemParametersInfo requires interactive window station (current is %wZ)\n", &GetW32ProcessInfo()->prpwinsta->Name); \
38 EngSetLastError(err); \
42 static const WCHAR
* KEY_MOUSE
= L
"Control Panel\\Mouse";
43 static const WCHAR
* VAL_MOUSE1
= L
"MouseThreshold1";
44 static const WCHAR
* VAL_MOUSE2
= L
"MouseThreshold2";
45 static const WCHAR
* VAL_MOUSE3
= L
"MouseSpeed";
46 static const WCHAR
* VAL_MOUSETRAILS
= L
"MouseTrails";
47 static const WCHAR
* VAL_DBLCLKWIDTH
= L
"DoubleClickWidth";
48 static const WCHAR
* VAL_DBLCLKHEIGHT
= L
"DoubleClickHeight";
49 static const WCHAR
* VAL_DBLCLKTIME
= L
"DoubleClickSpeed";
50 static const WCHAR
* VAL_SNAPDEFBTN
= L
"SnapToDefaultButton";
51 static const WCHAR
* VAL_SWAP
= L
"SwapMouseButtons";
52 static const WCHAR
* VAL_HOVERTIME
= L
"MouseHoverTime";
53 static const WCHAR
* VAL_HOVERWIDTH
= L
"MouseHoverWidth";
54 static const WCHAR
* VAL_HOVERHEIGHT
= L
"MouseHoverHeight";
55 static const WCHAR
* VAL_SENSITIVITY
= L
"MouseSensitivity";
57 static const WCHAR
* KEY_DESKTOP
= L
"Control Panel\\Desktop";
58 static const WCHAR
* VAL_SCRTO
= L
"ScreenSaveTimeOut";
59 static const WCHAR
* VAL_SCRNSV
= L
"SCRNSAVE.EXE";
60 static const WCHAR
* VAL_SCRACT
= L
"ScreenSaveActive";
61 static const WCHAR
* VAL_GRID
= L
"GridGranularity";
62 static const WCHAR
* VAL_DRAG
= L
"DragFullWindows";
63 static const WCHAR
* VAL_DRAGHEIGHT
= L
"DragHeight";
64 static const WCHAR
* VAL_DRAGWIDTH
= L
"DragWidth";
65 static const WCHAR
* VAL_FNTSMOOTH
= L
"FontSmoothing";
66 static const WCHAR
* VAL_SCRLLLINES
= L
"WheelScrollLines";
67 static const WCHAR
* VAL_CLICKLOCKTIME
= L
"ClickLockTime";
68 static const WCHAR
* VAL_PAINTDESKVER
= L
"PaintDesktopVersion";
69 static const WCHAR
* VAL_CARETRATE
= L
"CursorBlinkRate";
70 #if (_WIN32_WINNT >= 0x0600)
71 static const WCHAR
* VAL_SCRLLCHARS
= L
"WheelScrollChars";
73 static const WCHAR
* VAL_USERPREFMASK
= L
"UserPreferencesMask";
75 static const WCHAR
* KEY_MDALIGN
= L
"Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows";
76 static const WCHAR
* VAL_MDALIGN
= L
"MenuDropAlignment";
78 static const WCHAR
* KEY_METRIC
= L
"Control Panel\\Desktop\\WindowMetrics";
79 static const WCHAR
* VAL_BORDER
= L
"BorderWidth";
80 static const WCHAR
* VAL_ICONSPC
= L
"IconSpacing";
81 static const WCHAR
* VAL_ICONVSPC
= L
"IconVerticalspacing";
82 static const WCHAR
* VAL_ITWRAP
= L
"IconTitleWrap";
84 static const WCHAR
* KEY_SOUND
= L
"Control Panel\\Sound";
85 static const WCHAR
* VAL_BEEP
= L
"Beep";
87 static const WCHAR
* KEY_KBD
= L
"Control Panel\\Keyboard";
88 static const WCHAR
* VAL_KBDSPD
= L
"KeyboardSpeed";
89 static const WCHAR
* VAL_KBDDELAY
= L
"KeyboardDelay";
91 static const WCHAR
* KEY_SHOWSNDS
= L
"Control Panel\\Accessibility\\ShowSounds";
92 static const WCHAR
* KEY_KDBPREF
= L
"Control Panel\\Accessibility\\Keyboard Preference";
93 static const WCHAR
* KEY_SCRREAD
= L
"Control Panel\\Accessibility\\Blind Access";
94 static const WCHAR
* VAL_ON
= L
"On";
98 /** Loading the settings ******************************************************/
102 SpiLoadDWord(PCWSTR pwszKey
, PCWSTR pwszValue
, INT iValue
)
105 if (!RegReadUserSetting(pwszKey
, pwszValue
, REG_DWORD
, &Result
, sizeof(Result
)))
114 SpiLoadInt(PCWSTR pwszKey
, PCWSTR pwszValue
, INT iValue
)
119 cbSize
= sizeof(awcBuffer
);
120 if (!RegReadUserSetting(pwszKey
, pwszValue
, REG_SZ
, awcBuffer
, cbSize
))
124 return _wtoi(awcBuffer
);
129 SpiLoadUserPrefMask(DWORD dValue
)
132 if (!RegReadUserSetting(KEY_DESKTOP
, VAL_USERPREFMASK
, REG_BINARY
, &Result
, sizeof(Result
)))
142 { // Must have the string!
143 WCHAR szApplicationName
[MAX_PATH
];
144 RtlZeroMemory(&szApplicationName
, sizeof(szApplicationName
));
145 if (!RegReadUserSetting(KEY_DESKTOP
, VAL_SCRNSV
, REG_SZ
, &szApplicationName
, sizeof(szApplicationName
)))
149 if (wcslen(szApplicationName
) == 0) return 0;
150 return SpiLoadInt(KEY_DESKTOP
, VAL_SCRTO
, 0);
155 SpiLoadMouse(PCWSTR pwszValue
, INT iValue
)
157 return SpiLoadInt(KEY_MOUSE
, pwszValue
, iValue
);
162 SpiLoadMetric(PCWSTR pwszValue
, INT iValue
)
166 iRegVal
= SpiLoadInt(KEY_METRIC
, pwszValue
, METRIC2REG(iValue
));
167 TRACE("Loaded metric setting '%S', iValue=%d(reg:%d), ret=%d(reg:%d)\n",
168 pwszValue
, iValue
, METRIC2REG(iValue
), REG2METRIC(iRegVal
), iRegVal
);
169 return REG2METRIC(iRegVal
);
174 SpiLoadFont(PLOGFONTW plfOut
, LPWSTR pwszValueName
, PLOGFONTW plfDefault
)
178 bResult
= RegReadUserSetting(KEY_METRIC
,
184 *plfOut
= *plfDefault
;
192 gspv
.ncm
.iCaptionWidth
= max(gspv
.ncm
.iCaptionWidth
, 8);
193 gspv
.ncm
.iBorderWidth
= max(gspv
.ncm
.iBorderWidth
, 1);
194 gspv
.ncm
.iScrollWidth
= max(gspv
.ncm
.iScrollWidth
, 8);
195 gspv
.ncm
.iScrollHeight
= max(gspv
.ncm
.iScrollHeight
, 8);
196 // gspv.ncm.iMenuHeight = max(gspv.ncm.iMenuHeight, gspv.tmMenuFont.tmHeight);
197 // gspv.ncm.iMenuHeight = max(gspv.ncm.iMenuHeight,
198 // 2 + gspv.tmMenuFont.tmHeight +
199 // gspv.tmMenuFont.tmExternalLeading);
200 if (gspv
.iDblClickTime
== 0) gspv
.iDblClickTime
= 500;
203 gspv
.tmMenuFont
.tmHeight
= 11;
204 gspv
.tmMenuFont
.tmExternalLeading
= 2;
206 gspv
.tmCaptionFont
.tmHeight
= 11;
207 gspv
.tmCaptionFont
.tmExternalLeading
= 2;
213 SpiUpdatePerUserSystemParameters(VOID
)
215 static LOGFONTW lf1
= {-11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
,
216 FALSE
, ANSI_CHARSET
, 0, 0, DEFAULT_QUALITY
,
217 VARIABLE_PITCH
| FF_SWISS
, L
"MS Sans Serif"};
218 static LOGFONTW lf2
= {-11, 0, 0, 0, FW_BOLD
, FALSE
, FALSE
,
219 FALSE
, ANSI_CHARSET
, 0, 0, DEFAULT_QUALITY
,
220 VARIABLE_PITCH
| FF_SWISS
, L
"MS Sans Serif"};
222 TRACE("Enter SpiUpdatePerUserSystemParameters\n");
224 /* Clear the structure */
225 RtlZeroMemory(&gspv
, sizeof(gspv
));
227 /* Load mouse settings */
228 gspv
.caiMouse
.FirstThreshold
= SpiLoadMouse(VAL_MOUSE1
, 6);
229 gspv
.caiMouse
.SecondThreshold
= SpiLoadMouse(VAL_MOUSE2
, 10);
230 gspv
.caiMouse
.Acceleration
= SpiLoadMouse(VAL_MOUSE3
, 1);
231 gspv
.iMouseSpeed
= SpiLoadMouse(VAL_SENSITIVITY
, 10);
232 gspv
.bMouseBtnSwap
= SpiLoadMouse(VAL_SWAP
, 0);
233 gspv
.bSnapToDefBtn
= SpiLoadMouse(VAL_SNAPDEFBTN
, 0);
234 gspv
.iMouseTrails
= SpiLoadMouse(VAL_MOUSETRAILS
, 0);
235 gspv
.iDblClickTime
= SpiLoadMouse(VAL_DBLCLKTIME
, 500);
236 gspv
.iDblClickWidth
= SpiLoadMouse(VAL_DBLCLKWIDTH
, 4);
237 gspv
.iDblClickHeight
= SpiLoadMouse(VAL_DBLCLKHEIGHT
, 4);
238 gspv
.iMouseHoverTime
= SpiLoadMouse(VAL_HOVERTIME
, 400);
239 gspv
.iMouseHoverWidth
= SpiLoadMouse(VAL_HOVERWIDTH
, 4);
240 gspv
.iMouseHoverHeight
= SpiLoadMouse(VAL_HOVERHEIGHT
, 4);
242 /* Load NONCLIENTMETRICS */
243 gspv
.ncm
.cbSize
= sizeof(NONCLIENTMETRICSW
);
244 gspv
.ncm
.iBorderWidth
= SpiLoadMetric(VAL_BORDER
, 1);
245 gspv
.ncm
.iScrollWidth
= SpiLoadMetric(L
"ScrollWidth", 16);
246 gspv
.ncm
.iScrollHeight
= SpiLoadMetric(L
"ScrollHeight", 16);
247 gspv
.ncm
.iCaptionWidth
= SpiLoadMetric(L
"CaptionWidth", 19);
248 gspv
.ncm
.iCaptionHeight
= SpiLoadMetric(L
"CaptionHeight", 19);
249 gspv
.ncm
.iSmCaptionWidth
= SpiLoadMetric(L
"SmCaptionWidth", 12);
250 gspv
.ncm
.iSmCaptionHeight
= SpiLoadMetric(L
"SmCaptionHeight", 14);
251 gspv
.ncm
.iMenuWidth
= SpiLoadMetric(L
"MenuWidth", 18);
252 gspv
.ncm
.iMenuHeight
= SpiLoadMetric(L
"MenuHeight", 18);
253 #if (WINVER >= 0x0600)
254 gspv
.ncm
.iPaddedBorderWidth
= SpiLoadMetric(L
"PaddedBorderWidth", 18);
256 SpiLoadFont(&gspv
.ncm
.lfCaptionFont
, L
"CaptionFont", &lf2
);
257 SpiLoadFont(&gspv
.ncm
.lfSmCaptionFont
, L
"SmCaptionFont", &lf1
);
258 SpiLoadFont(&gspv
.ncm
.lfMenuFont
, L
"MenuFont", &lf1
);
259 SpiLoadFont(&gspv
.ncm
.lfStatusFont
, L
"StatusFont", &lf1
);
260 SpiLoadFont(&gspv
.ncm
.lfMessageFont
, L
"MessageFont", &lf1
);
262 /* Load MINIMIZEDMETRICS */
263 gspv
.mm
.cbSize
= sizeof(MINIMIZEDMETRICS
);
264 gspv
.mm
.iWidth
= SpiLoadMetric(L
"MinWidth", 160);
265 gspv
.mm
.iHorzGap
= SpiLoadMetric(L
"MinHorzGap", 160);
266 gspv
.mm
.iVertGap
= SpiLoadMetric(L
"MinVertGap", 24);
267 gspv
.mm
.iArrange
= SpiLoadInt(KEY_METRIC
, L
"MinArrange", ARW_HIDE
);
269 /* Load ICONMETRICS */
270 gspv
.im
.cbSize
= sizeof(ICONMETRICSW
);
271 gspv
.im
.iHorzSpacing
= SpiLoadMetric(VAL_ICONSPC
, 64);
272 gspv
.im
.iVertSpacing
= SpiLoadMetric(VAL_ICONVSPC
, 64);
273 gspv
.im
.iTitleWrap
= SpiLoadMetric(VAL_ITWRAP
, 0);
274 SpiLoadFont(&gspv
.im
.lfFont
, L
"IconFont", &lf1
);
276 /* Load desktop settings */
277 gspv
.bDragFullWindows
= SpiLoadInt(KEY_DESKTOP
, VAL_DRAG
, 0);
278 gspv
.iWheelScrollLines
= SpiLoadInt(KEY_DESKTOP
, VAL_SCRLLLINES
, 3);
279 gspv
.dwMouseClickLockTime
= SpiLoadDWord(KEY_DESKTOP
, VAL_CLICKLOCKTIME
, 1200);
280 gpsi
->dtCaretBlink
= SpiLoadInt(KEY_DESKTOP
, VAL_CARETRATE
, 530);
281 gspv
.dwUserPrefMask
= SpiLoadUserPrefMask(UPM_DEFAULT
);
282 gspv
.bMouseClickLock
= (gspv
.dwUserPrefMask
& UPM_CLICKLOCK
) != 0;
283 gspv
.bMouseCursorShadow
= (gspv
.dwUserPrefMask
& UPM_CURSORSHADOW
) != 0;
284 #if (_WIN32_WINNT >= 0x0600)
285 gspv
.iWheelScrollChars
= SpiLoadInt(KEY_DESKTOP
, VAL_SCRLLCHARS
, 3);
288 /* Some hardcoded values for now */
290 gspv
.tmCaptionFont
.tmAveCharWidth
= 6;
292 gspv
.bFlatMenu
= FALSE
;
293 gspv
.uiFocusBorderWidth
= 1;
294 gspv
.uiFocusBorderHeight
= 1;
295 gspv
.bMenuDropAlign
= 1;
296 gspv
.bDropShadow
= 1;
297 gspv
.dwMenuShowDelay
= 100;
298 gspv
.dwForegroundFlashCount
= 3;
300 gspv
.iScrSaverTimeout
= SpiLoadTimeOut();
301 gspv
.bScrSaverActive
= FALSE
;
302 gspv
.bScrSaverRunning
= FALSE
;
303 #if(WINVER >= 0x0600)
304 gspv
.bScrSaverSecure
= FALSE
;
307 gspv
.accesstimeout
.cbSize
= sizeof(ACCESSTIMEOUT
);
308 gspv
.filterkeys
.cbSize
= sizeof(FILTERKEYS
);
309 gspv
.togglekeys
.cbSize
= sizeof(TOGGLEKEYS
);
310 gspv
.mousekeys
.cbSize
= sizeof(MOUSEKEYS
);
311 gspv
.stickykeys
.cbSize
= sizeof(STICKYKEYS
);
312 gspv
.serialkeys
.cbSize
= sizeof(SERIALKEYS
);
313 gspv
.soundsentry
.cbSize
= sizeof(SOUNDSENTRYW
);
314 gspv
.highcontrast
.cbSize
= sizeof(HIGHCONTRASTW
);
315 gspv
.animationinfo
.cbSize
= sizeof(ANIMATIONINFO
);
317 /* Make sure we don't use broken values */
320 /* Update SystemMetrics */
323 if (gbSpiInitialized
&& gpsi
)
325 if (gspv
.bKbdPref
) gpsi
->dwSRVIFlags
|= SRVINFO_KBDPREF
;
326 if (SPITESTPREF(UPM_KEYBOARDCUES
)) gpsi
->PUSIFlags
|= PUSIF_KEYBOARDCUES
;
327 if (SPITESTPREF(UPM_COMBOBOXANIMATION
)) gpsi
->PUSIFlags
|= PUSIF_COMBOBOXANIMATION
;
328 if (SPITESTPREF(UPM_LISTBOXSMOOTHSCROLLING
)) gpsi
->PUSIFlags
|= PUSIF_LISTBOXSMOOTHSCROLLING
;
330 gdwLanguageToggleKey
= UserGetLanguageToggle();
336 SpiUpdatePerUserSystemParameters();
337 gbSpiInitialized
= TRUE
;
344 NtUserUpdatePerUserSystemParameters(
350 TRACE("Enter NtUserUpdatePerUserSystemParameters\n");
351 UserEnterExclusive();
353 SpiUpdatePerUserSystemParameters();
355 g_PaintDesktopVersion
= SpiLoadDWord(KEY_DESKTOP
, VAL_PAINTDESKVER
, 0);
357 g_PaintDesktopVersion
= FALSE
;
360 TRACE("Leave NtUserUpdatePerUserSystemParameters, returning %d\n", bResult
);
367 /** Storing the settings ******************************************************/
371 SpiStoreDWord(PCWSTR pwszKey
, PCWSTR pwszValue
, DWORD Value
)
373 RegWriteUserSetting(pwszKey
,
382 SpiStoreSz(PCWSTR pwszKey
, PCWSTR pwszValue
, PCWSTR pwsz
)
384 RegWriteUserSetting(pwszKey
,
388 (wcslen(pwsz
) + 1) * sizeof(WCHAR
));
393 SpiStoreSzInt(PCWSTR pwszKey
, PCWSTR pwszValue
, INT iValue
)
397 _itow(iValue
, awcBuffer
, 10);
398 RegWriteUserSetting(pwszKey
,
402 (wcslen(awcBuffer
) + 1) * sizeof(WCHAR
));
407 SpiStoreMetric(LPCWSTR pwszValue
, INT iValue
)
409 SpiStoreSzInt(KEY_METRIC
, pwszValue
, METRIC2REG(iValue
));
414 SpiStoreFont(PCWSTR pwszValue
, LOGFONTW
* plogfont
)
416 RegWriteUserSetting(KEY_METRIC
,
424 /** Get/Set value *************************************************************/
426 // FIXME: get rid of the flags and only use this from um. kernel can access data directly.
429 SpiMemCopy(PVOID pvDst
, PVOID pvSrc
, ULONG cbSize
, BOOL bProtect
)
431 NTSTATUS Status
= STATUS_SUCCESS
;
437 RtlCopyMemory(pvDst
, pvSrc
, cbSize
);
439 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
441 Status
= _SEH2_GetExceptionCode();
447 RtlCopyMemory(pvDst
, pvSrc
, cbSize
);
450 if (!NT_SUCCESS(Status
))
452 SetLastNtError(Status
);
453 ERR("SpiMemCopy failed, pvDst=%p, pvSrc=%p, bProtect=%d\n", pvDst
, pvSrc
, bProtect
);
456 return NT_SUCCESS(Status
);
461 SpiGet(PVOID pvParam
, PVOID pvData
, ULONG cbSize
, FLONG fl
)
463 REQ_INTERACTIVE_WINSTA(ERROR_ACCESS_DENIED
);
464 return SpiMemCopy(pvParam
, pvData
, cbSize
, fl
& SPIF_PROTECT
);
469 SpiSet(PVOID pvData
, PVOID pvParam
, ULONG cbSize
, FLONG fl
)
471 REQ_INTERACTIVE_WINSTA(ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION
);
472 return SpiMemCopy(pvData
, pvParam
, cbSize
, fl
& SPIF_PROTECT
);
477 SpiGetEx(PVOID pvParam
, PVOID pvData
, ULONG cbSize
, FLONG fl
)
480 /* Get the cbSite member from UM memory */
481 if (!SpiSet(&cbBufSize
, pvParam
, sizeof(ULONG
), fl
))
483 /* Verify the correct size */
484 if (cbBufSize
!= cbSize
)
486 return SpiGet(pvParam
, pvData
, cbSize
, fl
);
491 SpiGetInt(PVOID pvParam
, PVOID piValue
, FLONG fl
)
493 return SpiGet(pvParam
, piValue
, sizeof(INT
), fl
);
498 SpiSetYesNo(BOOL
*pbData
, BOOL bValue
, PCWSTR pwszKey
, PCWSTR pwszValue
, FLONG fl
)
500 REQ_INTERACTIVE_WINSTA(ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION
);
501 *pbData
= bValue
? TRUE
: FALSE
;
502 if (fl
& SPIF_UPDATEINIFILE
)
504 SpiStoreSz(pwszKey
, pwszValue
, bValue
? L
"Yes" : L
"No");
506 return (UINT_PTR
)pwszKey
;
511 SpiSetBool(BOOL
*pbData
, INT iValue
, PCWSTR pwszKey
, PCWSTR pwszValue
, FLONG fl
)
513 REQ_INTERACTIVE_WINSTA(ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION
);
514 *pbData
= iValue
? TRUE
: FALSE
;
515 if (fl
& SPIF_UPDATEINIFILE
)
517 SpiStoreSzInt(pwszKey
, pwszValue
, iValue
);
519 return (UINT_PTR
)pwszKey
;
524 SpiSetDWord(PVOID pvData
, INT iValue
, PCWSTR pwszKey
, PCWSTR pwszValue
, FLONG fl
)
526 REQ_INTERACTIVE_WINSTA(ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION
);
527 *(INT
*)pvData
= iValue
;
528 if (fl
& SPIF_UPDATEINIFILE
)
530 SpiStoreDWord(pwszKey
, pwszValue
, iValue
);
532 return (UINT_PTR
)pwszKey
;
537 SpiSetInt(PVOID pvData
, INT iValue
, PCWSTR pwszKey
, PCWSTR pwszValue
, FLONG fl
)
539 REQ_INTERACTIVE_WINSTA(ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION
);
540 *(INT
*)pvData
= iValue
;
541 if (fl
& SPIF_UPDATEINIFILE
)
543 SpiStoreSzInt(pwszKey
, pwszValue
, iValue
);
545 return (UINT_PTR
)pwszKey
;
550 SpiSetMetric(PVOID pvData
, INT iValue
, PCWSTR pwszValue
, FLONG fl
)
552 REQ_INTERACTIVE_WINSTA(ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION
);
553 *(INT
*)pvData
= iValue
;
554 if (fl
& SPIF_UPDATEINIFILE
)
556 SpiStoreMetric(pwszValue
, iValue
);
558 return (UINT_PTR
)KEY_METRIC
;
563 SpiSetUserPref(DWORD dwMask
, PVOID pvValue
, FLONG fl
)
566 BOOL bValue
= (BOOL
)pvValue
;
568 REQ_INTERACTIVE_WINSTA(ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION
);
570 /* Set or clear bit according to bValue */
571 gspv
.dwUserPrefMask
= bValue
? gspv
.dwUserPrefMask
| dwMask
:
572 gspv
.dwUserPrefMask
& ~dwMask
;
574 if (fl
& SPIF_UPDATEINIFILE
)
576 /* Read current value */
577 if (!RegReadUserSetting(KEY_DESKTOP
,
583 WARN("Failed to read UserPreferencesMask setting\n");
587 /* Set or clear bit according to bValue */
588 dwRegMask
= bValue
? (dwRegMask
| dwMask
) : (dwRegMask
& ~dwMask
);
590 /* write back value */
591 RegWriteUserSetting(KEY_DESKTOP
,
598 return (UINT_PTR
)KEY_DESKTOP
;
603 SpiGetUserPref(DWORD dwMask
, PVOID pvParam
, FLONG fl
)
605 INT iValue
= gspv
.dwUserPrefMask
& dwMask
? 1 : 0;
606 return SpiGetInt(pvParam
, &iValue
, fl
);
611 SpiSetWallpaper(PVOID pvParam
, FLONG fl
)
616 HBITMAP hbmp
, hOldBitmap
;
618 ULONG ulTile
, ulStyle
;
620 REQ_INTERACTIVE_WINSTA(ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION
);
624 /* FIXME: Reset Wallpaper to registry value */
625 return (UINT_PTR
)KEY_DESKTOP
;
628 /* Capture UNICODE_STRING */
629 bResult
= SpiMemCopy(&ustr
, pvParam
, sizeof(ustr
), fl
& SPIF_PROTECT
);
630 if (!bResult
) return 0;
631 if (ustr
.Length
> MAX_PATH
* sizeof(WCHAR
))
634 /* Copy the string buffer name */
635 bResult
= SpiMemCopy(gspv
.awcWallpaper
, ustr
.Buffer
, ustr
.Length
, fl
& SPIF_PROTECT
);
636 if (!bResult
) return 0;
638 /* Update the UNICODE_STRING */
639 gspv
.ustrWallpaper
.Buffer
= gspv
.awcWallpaper
;
640 gspv
.ustrWallpaper
.MaximumLength
= MAX_PATH
* sizeof(WCHAR
);
641 gspv
.ustrWallpaper
.Length
= ustr
.Length
;
642 gspv
.awcWallpaper
[ustr
.Length
/ sizeof(WCHAR
)] = 0;
644 TRACE("SpiSetWallpaper, name=%S\n", gspv
.awcWallpaper
);
646 /* Update registry */
647 if (fl
& SPIF_UPDATEINIFILE
)
649 SpiStoreSz(KEY_DESKTOP
, L
"Wallpaper", gspv
.awcWallpaper
);
652 /* Got a filename? */
653 if (gspv
.awcWallpaper
[0] != 0)
655 /* Convert file name to nt file name */
657 ustr
.MaximumLength
= MAX_PATH
* sizeof(WCHAR
);
659 if (!W32kDosPathNameToNtPathName(gspv
.awcWallpaper
, &ustr
))
661 ERR("RtlDosPathNameToNtPathName_U failed\n");
665 /* Load the Bitmap */
666 hbmp
= UserLoadImage(ustr
.Buffer
);
669 ERR("UserLoadImage failed\n");
673 /* Try to get the size of the wallpaper */
674 if(!(psurfBmp
= SURFACE_ShareLockSurface(hbmp
)))
676 GreDeleteObject(hbmp
);
680 gspv
.cxWallpaper
= psurfBmp
->SurfObj
.sizlBitmap
.cx
;
681 gspv
.cyWallpaper
= psurfBmp
->SurfObj
.sizlBitmap
.cy
;
682 gspv
.WallpaperMode
= wmCenter
;
684 SURFACE_ShareUnlockSurface(psurfBmp
);
686 /* Change the bitmap's ownership */
687 GreSetObjectOwner(hbmp
, GDI_OBJ_HMGR_PUBLIC
);
689 /* Yes, Windows really loads the current setting from the registry. */
690 ulTile
= SpiLoadInt(KEY_DESKTOP
, L
"TileWallpaper", 0);
691 ulStyle
= SpiLoadInt(KEY_DESKTOP
, L
"WallpaperStyle", 0);
692 TRACE("SpiSetWallpaper: ulTile=%lu, ulStyle=%lu\n", ulTile
, ulStyle
);
694 /* Check the values we found in the registry */
695 if(ulTile
&& !ulStyle
)
697 gspv
.WallpaperMode
= wmTile
;
699 else if(!ulTile
&& ulStyle
== 2)
701 gspv
.WallpaperMode
= wmStretch
;
706 /* Remove wallpaper */
707 gspv
.cxWallpaper
= 0;
708 gspv
.cyWallpaper
= 0;
712 /* Take care of the old wallpaper, if any */
713 hOldBitmap
= gspv
.hbmWallpaper
;
714 if(hOldBitmap
!= NULL
)
716 /* Delete the old wallpaper */
717 GreSetObjectOwner(hOldBitmap
, GDI_OBJ_HMGR_POWNED
);
718 GreDeleteObject(hOldBitmap
);
721 /* Set the new wallpaper */
722 gspv
.hbmWallpaper
= hbmp
;
724 NtUserRedrawWindow(UserGetShellWindow(), NULL
, NULL
, RDW_INVALIDATE
| RDW_ERASE
);
727 return (UINT_PTR
)KEY_DESKTOP
;
731 SpiNotifyNCMetricsChanged(VOID
)
733 PWND pwndDesktop
, pwndCurrent
;
735 USER_REFERENCE_ENTRY Ref
;
738 pwndDesktop
= UserGetDesktopWindow();
741 ahwnd
= IntWinListChildren(pwndDesktop
);
745 for (i
= 0; ahwnd
[i
]; i
++)
747 pwndCurrent
= UserGetWindowObject(ahwnd
[i
]);
751 UserRefObjectCo(pwndCurrent
, &Ref
);
752 co_WinPosSetWindowPos(pwndCurrent
, 0, pwndCurrent
->rcWindow
.left
,pwndCurrent
->rcWindow
.top
,
753 pwndCurrent
->rcWindow
.right
-pwndCurrent
->rcWindow
.left
754 ,pwndCurrent
->rcWindow
.bottom
- pwndCurrent
->rcWindow
.top
,
755 SWP_FRAMECHANGED
|SWP_NOACTIVATE
|SWP_NOCOPYBITS
|
756 SWP_NOMOVE
|SWP_NOZORDER
|SWP_NOREDRAW
);
757 UserDerefObjectCo(pwndCurrent
);
760 ExFreePoolWithTag(ahwnd
, USERTAG_WINDOWLIST
);
767 SpiGetSet(UINT uiAction
, UINT uiParam
, PVOID pvParam
, FLONG fl
)
772 return SpiGetInt(pvParam
, &gspv
.bBeep
, fl
);
775 return SpiSetYesNo(&gspv
.bBeep
, uiParam
, KEY_SOUND
, VAL_BEEP
, fl
);
778 return SpiGet(pvParam
, &gspv
.caiMouse
, 3 * sizeof(INT
), fl
);
781 if (!SpiSet(&gspv
.caiMouse
, pvParam
, 3 * sizeof(INT
), fl
))
783 if (fl
& SPIF_UPDATEINIFILE
)
785 SpiStoreSzInt(KEY_MOUSE
, VAL_MOUSE1
, gspv
.caiMouse
.FirstThreshold
);
786 SpiStoreSzInt(KEY_MOUSE
, VAL_MOUSE2
, gspv
.caiMouse
.SecondThreshold
);
787 SpiStoreSzInt(KEY_MOUSE
, VAL_MOUSE3
, gspv
.caiMouse
.Acceleration
);
789 return (UINT_PTR
)KEY_MOUSE
;
792 return SpiGetInt(pvParam
, &gspv
.ncm
.iBorderWidth
, fl
);
795 uiParam
= max(uiParam
, 1);
796 return SpiSetInt(&gspv
.ncm
.iBorderWidth
, uiParam
, KEY_METRIC
, VAL_BORDER
, fl
);
798 case SPI_GETKEYBOARDSPEED
:
799 return SpiGetInt(pvParam
, &gspv
.dwKbdSpeed
, fl
);
801 case SPI_SETKEYBOARDSPEED
:
802 return SpiSetInt(&gspv
.dwKbdSpeed
, uiParam
, KEY_KBD
, VAL_KBDSPD
, fl
);
805 ERR("SPI_LANGDRIVER is unimplemented\n");
808 case SPI_GETSCREENSAVETIMEOUT
:
809 return SpiGetInt(pvParam
, &gspv
.iScrSaverTimeout
, fl
);
811 case SPI_SETSCREENSAVETIMEOUT
:
812 return SpiSetInt(&gspv
.iScrSaverTimeout
, uiParam
, KEY_DESKTOP
, VAL_SCRTO
, fl
);
814 case SPI_GETSCREENSAVEACTIVE
:
815 return SpiGetInt(pvParam
, &gspv
.bScrSaverActive
, fl
);
817 case SPI_SETSCREENSAVEACTIVE
:
818 return SpiSetInt(&gspv
.bScrSaverActive
, uiParam
, KEY_DESKTOP
, VAL_SCRACT
, fl
);
820 case SPI_GETGRIDGRANULARITY
:
821 return SpiGetInt(pvParam
, &gspv
.uiGridGranularity
, fl
);
823 case SPI_SETGRIDGRANULARITY
:
824 return SpiSetInt(&gspv
.uiGridGranularity
, uiParam
, KEY_DESKTOP
, VAL_GRID
, fl
);
826 case SPI_GETDESKWALLPAPER
:
827 uiParam
= min(uiParam
, gspv
.ustrWallpaper
.Length
+ 1UL);
828 return SpiGet(pvParam
, gspv
.awcWallpaper
, uiParam
, fl
);
830 case SPI_SETDESKWALLPAPER
:
831 return SpiSetWallpaper(pvParam
, fl
);
833 case SPI_SETDESKPATTERN
:
834 ERR("SPI_SETDESKPATTERN is unimplemented\n");
837 case SPI_GETKEYBOARDDELAY
:
838 return SpiGetInt(pvParam
, &gspv
.iKbdDelay
, fl
);
840 case SPI_SETKEYBOARDDELAY
:
841 return SpiSetInt(&gspv
.iKbdDelay
, uiParam
, KEY_KBD
, VAL_KBDDELAY
, fl
);
843 case SPI_ICONHORIZONTALSPACING
:
846 return SpiGetInt(pvParam
, &gspv
.im
.iHorzSpacing
, fl
);
848 uiParam
= max(uiParam
, 32);
849 return SpiSetMetric(&gspv
.im
.iHorzSpacing
, uiParam
, VAL_ICONSPC
, fl
);
851 case SPI_ICONVERTICALSPACING
:
854 return SpiGetInt(pvParam
, &gspv
.im
.iVertSpacing
, fl
);
856 uiParam
= max(uiParam
, 32);
857 return SpiSetMetric(&gspv
.im
.iVertSpacing
, uiParam
, VAL_ICONVSPC
, fl
);
859 case SPI_GETICONTITLEWRAP
:
860 return SpiGetInt(pvParam
, &gspv
.im
.iTitleWrap
, fl
);
862 case SPI_SETICONTITLEWRAP
:
863 return SpiSetInt(&gspv
.im
.iTitleWrap
, uiParam
, KEY_METRIC
, VAL_ITWRAP
, fl
);
865 case SPI_GETMENUDROPALIGNMENT
:
866 return SpiGetInt(pvParam
, &gspv
.bMenuDropAlign
, fl
);
868 case SPI_SETMENUDROPALIGNMENT
:
869 return SpiSetBool(&gspv
.bMenuDropAlign
, uiParam
, KEY_MDALIGN
, VAL_MDALIGN
, fl
);
871 case SPI_SETDOUBLECLKWIDTH
:
872 return SpiSetInt(&gspv
.iDblClickWidth
, uiParam
, KEY_MOUSE
, VAL_DBLCLKWIDTH
, fl
);
874 case SPI_SETDOUBLECLKHEIGHT
:
875 return SpiSetInt(&gspv
.iDblClickHeight
, uiParam
, KEY_MOUSE
, VAL_DBLCLKHEIGHT
, fl
);
877 case SPI_GETICONTITLELOGFONT
:
878 return SpiGet(pvParam
, &gspv
.im
.lfFont
, sizeof(LOGFONTW
), fl
);
880 case SPI_SETICONTITLELOGFONT
:
881 if (!SpiSet(&gspv
.im
.lfFont
, pvParam
, sizeof(LOGFONTW
), fl
))
883 if (fl
& SPIF_UPDATEINIFILE
)
885 SpiStoreFont(L
"IconFont", &gspv
.im
.lfFont
);
887 return (UINT_PTR
)KEY_METRIC
;
889 case SPI_SETDOUBLECLICKTIME
:
890 return SpiSetInt(&gspv
.iDblClickTime
, uiParam
, KEY_MOUSE
, VAL_DBLCLKTIME
, fl
);
892 case SPI_SETMOUSEBUTTONSWAP
:
893 return SpiSetInt(&gspv
.bMouseBtnSwap
, uiParam
, KEY_MOUSE
, VAL_SWAP
, fl
);
895 case SPI_GETFASTTASKSWITCH
:
896 return SpiGetInt(pvParam
, &gspv
.bFastTaskSwitch
, fl
);
898 case SPI_SETFASTTASKSWITCH
:
899 /* According to Winetest this one is unimplemented */
902 case SPI_GETDRAGFULLWINDOWS
:
903 return SpiGetInt(pvParam
, &gspv
.bDragFullWindows
, fl
);
905 case SPI_SETDRAGFULLWINDOWS
:
906 return SpiSetInt(&gspv
.bDragFullWindows
, uiParam
, KEY_DESKTOP
, VAL_DRAG
, fl
);
908 case SPI_GETNONCLIENTMETRICS
:
910 return SpiGet(pvParam
, &gspv
.ncm
, sizeof(NONCLIENTMETRICSW
), fl
);
913 case SPI_SETNONCLIENTMETRICS
:
915 LPNONCLIENTMETRICSW metrics
= (LPNONCLIENTMETRICSW
)pvParam
;
917 /* Fixup user's structure size */
918 metrics
->cbSize
= sizeof(NONCLIENTMETRICSW
);
920 if (!SpiSet(&gspv
.ncm
, metrics
, sizeof(NONCLIENTMETRICSW
), fl
))
923 if (fl
& SPIF_UPDATEINIFILE
)
925 SpiStoreMetric(VAL_BORDER
, gspv
.ncm
.iBorderWidth
);
926 SpiStoreMetric(L
"ScrollWidth", gspv
.ncm
.iScrollWidth
);
927 SpiStoreMetric(L
"ScrollHeight", gspv
.ncm
.iScrollHeight
);
928 SpiStoreMetric(L
"CaptionWidth", gspv
.ncm
.iCaptionWidth
);
929 SpiStoreMetric(L
"CaptionHeight", gspv
.ncm
.iCaptionHeight
);
930 SpiStoreMetric(L
"SmCaptionWidth", gspv
.ncm
.iSmCaptionWidth
);
931 SpiStoreMetric(L
"SmCaptionHeight", gspv
.ncm
.iSmCaptionHeight
);
932 SpiStoreMetric(L
"MenuWidth", gspv
.ncm
.iMenuWidth
);
933 SpiStoreMetric(L
"MenuHeight", gspv
.ncm
.iMenuHeight
);
934 #if (WINVER >= 0x0600)
935 SpiStoreMetric(L
"PaddedBorderWidth", gspv
.ncm
.iPaddedBorderWidth
);
937 SpiStoreFont(L
"CaptionFont", &gspv
.ncm
.lfCaptionFont
);
938 SpiStoreFont(L
"SmCaptionFont", &gspv
.ncm
.lfSmCaptionFont
);
939 SpiStoreFont(L
"MenuFont", &gspv
.ncm
.lfMenuFont
);
940 SpiStoreFont(L
"StatusFont", &gspv
.ncm
.lfStatusFont
);
941 SpiStoreFont(L
"MessageFont", &gspv
.ncm
.lfMessageFont
);
944 if(!SpiNotifyNCMetricsChanged())
947 return (UINT_PTR
)KEY_METRIC
;
950 case SPI_GETMINIMIZEDMETRICS
:
952 return SpiGet(pvParam
, &gspv
.mm
, sizeof(MINIMIZEDMETRICS
), fl
);
955 case SPI_SETMINIMIZEDMETRICS
:
957 LPMINIMIZEDMETRICS metrics
= (LPMINIMIZEDMETRICS
)pvParam
;
959 /* Fixup user's structure size */
960 metrics
->cbSize
= sizeof(MINIMIZEDMETRICS
);
962 if (!SpiSet(&gspv
.mm
, metrics
, sizeof(MINIMIZEDMETRICS
), fl
))
965 gspv
.mm
.iWidth
= max(0, gspv
.mm
.iWidth
);
966 gspv
.mm
.iHorzGap
= max(0, gspv
.mm
.iHorzGap
);
967 gspv
.mm
.iVertGap
= max(0, gspv
.mm
.iVertGap
);
968 gspv
.mm
.iArrange
= gspv
.mm
.iArrange
& 0xf;
970 if (fl
& SPIF_UPDATEINIFILE
)
972 SpiStoreMetric(L
"MinWidth", gspv
.mm
.iWidth
);
973 SpiStoreMetric(L
"MinHorzGap", gspv
.mm
.iHorzGap
);
974 SpiStoreMetric(L
"MinVertGap", gspv
.mm
.iVertGap
);
975 SpiStoreMetric(L
"MinArrange", gspv
.mm
.iArrange
);
978 return (UINT_PTR
)KEY_METRIC
;
981 case SPI_GETICONMETRICS
:
983 return SpiGet(pvParam
, &gspv
.im
, sizeof(ICONMETRICSW
), fl
);
986 case SPI_SETICONMETRICS
:
988 LPICONMETRICSW metrics
= (LPICONMETRICSW
)pvParam
;
990 /* Fixup user's structure size */
991 metrics
->cbSize
= sizeof(ICONMETRICSW
);
993 if (!SpiSet(&gspv
.im
, metrics
, sizeof(ICONMETRICSW
), fl
))
996 if (fl
& SPIF_UPDATEINIFILE
)
998 SpiStoreMetric(VAL_ICONSPC
, gspv
.im
.iHorzSpacing
);
999 SpiStoreMetric(VAL_ICONVSPC
, gspv
.im
.iVertSpacing
);
1000 SpiStoreMetric(VAL_ITWRAP
, gspv
.im
.iTitleWrap
);
1001 SpiStoreFont(L
"IconFont", &gspv
.im
.lfFont
);
1003 return (UINT_PTR
)KEY_METRIC
;
1006 case SPI_GETWORKAREA
:
1008 PMONITOR pmonitor
= UserGetPrimaryMonitor();
1013 return SpiGet(pvParam
, &pmonitor
->rcWork
, sizeof(RECTL
), fl
);
1016 case SPI_SETWORKAREA
:
1018 /* FIXME: We should set the work area of the monitor
1019 that contains the specified rectangle */
1020 PMONITOR pmonitor
= UserGetPrimaryMonitor();
1026 if (!SpiSet(&rcWorkArea
, pvParam
, sizeof(RECTL
), fl
))
1029 /* Verify the new values */
1030 if (rcWorkArea
.left
< 0 ||
1031 rcWorkArea
.top
< 0 ||
1032 rcWorkArea
.right
> gpsi
->aiSysMet
[SM_CXSCREEN
] ||
1033 rcWorkArea
.bottom
> gpsi
->aiSysMet
[SM_CYSCREEN
] ||
1034 rcWorkArea
.right
<= rcWorkArea
.left
||
1035 rcWorkArea
.bottom
<= rcWorkArea
.top
)
1038 pmonitor
->rcWork
= rcWorkArea
;
1039 if (fl
& SPIF_UPDATEINIFILE
)
1041 // FIXME: What to do?
1043 return (UINT_PTR
)KEY_DESKTOP
;
1046 case SPI_SETPENWINDOWS
:
1047 ERR("SPI_SETPENWINDOWS is unimplemented\n");
1050 case SPI_GETFILTERKEYS
:
1052 LPFILTERKEYS FilterKeys
= (LPFILTERKEYS
)pvParam
;
1054 if (uiParam
!= 0 && uiParam
!= sizeof(FILTERKEYS
))
1057 if (!FilterKeys
|| FilterKeys
->cbSize
!= sizeof(FILTERKEYS
))
1060 return SpiGet(pvParam
, &gspv
.filterkeys
, sizeof(FILTERKEYS
), fl
);
1063 case SPI_SETFILTERKEYS
:
1065 LPFILTERKEYS FilterKeys
= (LPFILTERKEYS
)pvParam
;
1067 if (uiParam
!= 0 && uiParam
!= sizeof(FILTERKEYS
))
1070 if (!FilterKeys
|| FilterKeys
->cbSize
!= sizeof(FILTERKEYS
))
1073 if (!SpiSet(&gspv
.filterkeys
, pvParam
, sizeof(FILTERKEYS
), fl
))
1076 if (fl
& SPIF_UPDATEINIFILE
)
1078 // FIXME: What to do?
1080 return (UINT_PTR
)KEY_DESKTOP
;
1083 case SPI_GETTOGGLEKEYS
:
1085 LPTOGGLEKEYS ToggleKeys
= (LPTOGGLEKEYS
)pvParam
;
1087 if (uiParam
!= 0 && uiParam
!= sizeof(TOGGLEKEYS
))
1090 if (!ToggleKeys
|| ToggleKeys
->cbSize
!= sizeof(TOGGLEKEYS
))
1093 return SpiGet(pvParam
, &gspv
.togglekeys
, sizeof(TOGGLEKEYS
), fl
);
1096 case SPI_SETTOGGLEKEYS
:
1098 LPTOGGLEKEYS ToggleKeys
= (LPTOGGLEKEYS
)pvParam
;
1100 if (uiParam
!= 0 && uiParam
!= sizeof(TOGGLEKEYS
))
1103 if (!ToggleKeys
|| ToggleKeys
->cbSize
!= sizeof(TOGGLEKEYS
))
1106 if (!SpiSet(&gspv
.togglekeys
, pvParam
, sizeof(TOGGLEKEYS
), fl
))
1109 if (fl
& SPIF_UPDATEINIFILE
)
1111 // FIXME: What to do?
1113 return (UINT_PTR
)KEY_DESKTOP
;
1116 case SPI_GETMOUSEKEYS
:
1118 LPMOUSEKEYS MouseKeys
= (LPMOUSEKEYS
)pvParam
;
1120 if (uiParam
!= 0 && uiParam
!= sizeof(MOUSEKEYS
))
1123 if (!MouseKeys
|| MouseKeys
->cbSize
!= sizeof(MOUSEKEYS
))
1126 return SpiGet(pvParam
, &gspv
.mousekeys
, sizeof(MOUSEKEYS
), fl
);
1129 case SPI_SETMOUSEKEYS
:
1131 LPMOUSEKEYS MouseKeys
= (LPMOUSEKEYS
)pvParam
;
1133 if (uiParam
!= 0 && uiParam
!= sizeof(MOUSEKEYS
))
1136 if (!MouseKeys
|| MouseKeys
->cbSize
!= sizeof(MOUSEKEYS
))
1139 if (!SpiSet(&gspv
.mousekeys
, pvParam
, sizeof(MOUSEKEYS
), fl
))
1142 if (fl
& SPIF_UPDATEINIFILE
)
1144 // FIXME: What to do?
1146 return (UINT_PTR
)KEY_DESKTOP
;
1149 case SPI_GETSHOWSOUNDS
:
1150 return SpiGetInt(pvParam
, &gspv
.bShowSounds
, fl
);
1152 case SPI_SETSHOWSOUNDS
:
1153 return SpiSetBool(&gspv
.bShowSounds
, uiParam
, KEY_SHOWSNDS
, VAL_ON
, fl
);
1155 case SPI_GETSTICKYKEYS
:
1157 LPSTICKYKEYS StickyKeys
= (LPSTICKYKEYS
)pvParam
;
1159 if (uiParam
!= 0 && uiParam
!= sizeof(STICKYKEYS
))
1162 if (!StickyKeys
|| StickyKeys
->cbSize
!= sizeof(STICKYKEYS
))
1165 return SpiGetEx(pvParam
, &gspv
.stickykeys
, sizeof(STICKYKEYS
), fl
);
1168 case SPI_SETSTICKYKEYS
:
1170 LPSTICKYKEYS StickyKeys
= (LPSTICKYKEYS
)pvParam
;
1172 if (uiParam
!= 0 && uiParam
!= sizeof(STICKYKEYS
))
1175 if (!StickyKeys
|| StickyKeys
->cbSize
!= sizeof(STICKYKEYS
))
1178 if (!SpiSet(&gspv
.stickykeys
, pvParam
, sizeof(STICKYKEYS
), fl
))
1181 if (fl
& SPIF_UPDATEINIFILE
)
1183 // FIXME: What to do?
1185 return (UINT_PTR
)KEY_DESKTOP
;
1188 case SPI_GETACCESSTIMEOUT
:
1190 LPACCESSTIMEOUT AccessTimeout
= (LPACCESSTIMEOUT
)pvParam
;
1192 if (uiParam
!= 0 && uiParam
!= sizeof(ACCESSTIMEOUT
))
1195 if (!AccessTimeout
|| AccessTimeout
->cbSize
!= sizeof(ACCESSTIMEOUT
))
1198 return SpiGetEx(pvParam
, &gspv
.accesstimeout
, sizeof(ACCESSTIMEOUT
), fl
);
1201 case SPI_SETACCESSTIMEOUT
:
1203 LPACCESSTIMEOUT AccessTimeout
= (LPACCESSTIMEOUT
)pvParam
;
1205 if (uiParam
!= 0 && uiParam
!= sizeof(ACCESSTIMEOUT
))
1210 if (!AccessTimeout
|| AccessTimeout
->cbSize
!= sizeof(ACCESSTIMEOUT
))
1215 if (!SpiSet(&gspv
.accesstimeout
, pvParam
, sizeof(ACCESSTIMEOUT
), fl
))
1218 if (fl
& SPIF_UPDATEINIFILE
)
1220 // FIXME: What to do?
1222 return (UINT_PTR
)KEY_DESKTOP
;
1225 case SPI_GETSERIALKEYS
:
1227 LPSERIALKEYS SerialKeys
= (LPSERIALKEYS
)pvParam
;
1229 if (uiParam
!= 0 && uiParam
!= sizeof(SERIALKEYS
))
1232 if (!SerialKeys
|| SerialKeys
->cbSize
!= sizeof(SERIALKEYS
))
1235 return SpiGet(pvParam
, &gspv
.serialkeys
, sizeof(SERIALKEYS
), fl
);
1238 case SPI_SETSERIALKEYS
:
1240 LPSERIALKEYS SerialKeys
= (LPSERIALKEYS
)pvParam
;
1242 if (uiParam
!= 0 && uiParam
!= sizeof(SERIALKEYS
))
1245 if (!SerialKeys
|| SerialKeys
->cbSize
!= sizeof(SERIALKEYS
))
1248 if (!SpiSet(&gspv
.serialkeys
, pvParam
, sizeof(SERIALKEYS
), fl
))
1251 if (fl
& SPIF_UPDATEINIFILE
)
1253 // FIXME: What to do?
1255 return (UINT_PTR
)KEY_DESKTOP
;
1258 case SPI_GETSOUNDSENTRY
:
1260 LPSOUNDSENTRYW SoundsEntry
= (LPSOUNDSENTRYW
)pvParam
;
1262 if (uiParam
!= 0 && uiParam
!= sizeof(SOUNDSENTRYW
))
1265 if (!SoundsEntry
|| SoundsEntry
->cbSize
!= sizeof(SOUNDSENTRYW
))
1268 return SpiGet(pvParam
, &gspv
.soundsentry
, sizeof(SOUNDSENTRYW
), fl
);
1271 case SPI_SETSOUNDSENTRY
:
1273 LPSOUNDSENTRYW SoundsEntry
= (LPSOUNDSENTRYW
)pvParam
;
1275 if (uiParam
!= 0 && uiParam
!= sizeof(SOUNDSENTRYW
))
1278 if (!SoundsEntry
|| SoundsEntry
->cbSize
!= sizeof(SOUNDSENTRYW
))
1281 if (!SpiSet(&gspv
.soundsentry
, pvParam
, sizeof(SOUNDSENTRYW
), fl
))
1284 if (fl
& SPIF_UPDATEINIFILE
)
1286 // FIXME: What to do?
1288 return (UINT_PTR
)KEY_DESKTOP
;
1291 case SPI_GETHIGHCONTRAST
:
1293 LPHIGHCONTRASTW highcontrast
= (LPHIGHCONTRASTW
)pvParam
;
1295 if (uiParam
!= 0 && uiParam
!= sizeof(HIGHCONTRASTW
))
1298 if (!highcontrast
|| highcontrast
->cbSize
!= sizeof(HIGHCONTRASTW
))
1301 return SpiGet(pvParam
, &gspv
.highcontrast
, sizeof(HIGHCONTRASTW
), fl
);
1304 case SPI_SETHIGHCONTRAST
:
1306 LPHIGHCONTRASTW highcontrast
= (LPHIGHCONTRASTW
)pvParam
;
1308 if (uiParam
!= 0 && uiParam
!= sizeof(HIGHCONTRASTW
))
1311 if (!highcontrast
|| highcontrast
->cbSize
!= sizeof(HIGHCONTRASTW
))
1314 if (!SpiSet(&gspv
.highcontrast
, pvParam
, sizeof(HIGHCONTRASTW
), fl
))
1317 if (fl
& SPIF_UPDATEINIFILE
)
1319 // FIXME: What to do?
1321 return (UINT_PTR
)KEY_DESKTOP
;
1324 case SPI_GETKEYBOARDPREF
:
1325 return SpiGetInt(pvParam
, &gspv
.bKbdPref
, fl
);
1327 case SPI_SETKEYBOARDPREF
:
1328 return SpiSetBool(&gspv
.bKbdPref
, uiParam
, KEY_KDBPREF
, VAL_ON
, fl
);
1330 case SPI_GETSCREENREADER
:
1331 return SpiGetInt(pvParam
, &gspv
.bScreenReader
, fl
);
1333 case SPI_SETSCREENREADER
:
1334 return SpiSetBool(&gspv
.bScreenReader
, uiParam
, KEY_SCRREAD
, VAL_ON
, fl
);
1336 case SPI_GETANIMATION
:
1337 return SpiGet(pvParam
, &gspv
.animationinfo
, sizeof(ANIMATIONINFO
), fl
);
1339 case SPI_SETANIMATION
:
1340 if (!SpiSet(&gspv
.animationinfo
, pvParam
, sizeof(ANIMATIONINFO
), fl
))
1342 if (fl
& SPIF_UPDATEINIFILE
)
1344 // FIXME: What to do?
1346 return (UINT_PTR
)KEY_DESKTOP
;
1348 case SPI_GETFONTSMOOTHING
:
1349 return SpiGetInt(pvParam
, &gspv
.bFontSmoothing
, fl
);
1351 case SPI_SETFONTSMOOTHING
:
1352 gspv
.bFontSmoothing
= uiParam
? TRUE
: FALSE
;
1353 if (fl
& SPIF_UPDATEINIFILE
)
1355 SpiStoreSzInt(KEY_DESKTOP
, VAL_FNTSMOOTH
, uiParam
? 2 : 0);
1357 return (UINT_PTR
)KEY_DESKTOP
;
1359 case SPI_SETDRAGWIDTH
:
1360 return SpiSetInt(&gspv
.iDragWidth
, uiParam
, KEY_DESKTOP
, VAL_DRAGWIDTH
, fl
);
1362 case SPI_SETDRAGHEIGHT
:
1363 return SpiSetInt(&gspv
.iDragHeight
, uiParam
, KEY_DESKTOP
, VAL_DRAGHEIGHT
, fl
);
1365 case SPI_SETHANDHELD
:
1366 return SpiSetBool(&gspv
.bHandHeld
, uiParam
, KEY_DESKTOP
, L
"HandHeld", fl
);
1368 case SPI_GETLOWPOWERTIMEOUT
:
1369 return SpiGetInt(pvParam
, &gspv
.iLowPwrTimeout
, fl
);
1371 case SPI_GETPOWEROFFTIMEOUT
:
1372 return SpiGetInt(pvParam
, &gspv
.iPwrOffTimeout
, fl
);
1374 case SPI_SETLOWPOWERTIMEOUT
:
1375 return SpiSetInt(&gspv
.iLowPwrTimeout
, uiParam
, KEY_DESKTOP
, L
"LowPowerTimeOut", fl
);
1377 case SPI_SETPOWEROFFTIMEOUT
:
1378 return SpiSetInt(&gspv
.iPwrOffTimeout
, uiParam
, KEY_DESKTOP
, L
"PowerOffTimeOut", fl
);
1380 case SPI_GETLOWPOWERACTIVE
:
1381 return SpiGetInt(pvParam
, &gspv
.iPwrOffTimeout
, fl
);
1383 case SPI_GETPOWEROFFACTIVE
:
1384 return SpiGetInt(pvParam
, &gspv
.bPwrOffActive
, fl
);
1386 case SPI_SETLOWPOWERACTIVE
:
1387 return SpiSetBool(&gspv
.bLowPwrActive
, uiParam
, KEY_DESKTOP
, L
"LowPowerActive", fl
);
1389 case SPI_SETPOWEROFFACTIVE
:
1390 return SpiSetBool(&gspv
.bPwrOffActive
, uiParam
, KEY_DESKTOP
, L
"PowerOffActive", fl
);
1392 case SPI_SETCURSORS
:
1393 ERR("SPI_SETCURSORS is unimplemented\n");
1397 ERR("SPI_SETICONS is unimplemented\n");
1400 case SPI_GETDEFAULTINPUTLANG
:
1401 if (!gspklBaseLayout
)
1404 return SpiGet(pvParam
, &gspklBaseLayout
->hkl
, sizeof(HKL
), fl
);
1406 case SPI_SETDEFAULTINPUTLANG
:
1410 /* Note: SPIF_UPDATEINIFILE is not supported */
1411 if ((fl
& SPIF_UPDATEINIFILE
) || !SpiSet(&hkl
, pvParam
, sizeof(hkl
), fl
))
1414 return UserSetDefaultInputLang(hkl
);
1417 case SPI_SETLANGTOGGLE
:
1418 gdwLanguageToggleKey
= UserGetLanguageToggle();
1419 return gdwLanguageToggleKey
;
1422 case SPI_GETWINDOWSEXTENSION
:
1423 ERR("SPI_GETWINDOWSEXTENSION is unimplemented\n");
1426 case SPI_GETMOUSETRAILS
:
1427 return SpiGetInt(pvParam
, &gspv
.iMouseTrails
, fl
);
1429 case SPI_SETMOUSETRAILS
:
1430 return SpiSetInt(&gspv
.iMouseTrails
, uiParam
, KEY_MOUSE
, VAL_MOUSETRAILS
, fl
);
1432 case SPI_GETSNAPTODEFBUTTON
:
1433 return SpiGetInt(pvParam
, &gspv
.bSnapToDefBtn
, fl
);
1435 case SPI_SETSNAPTODEFBUTTON
:
1436 return SpiSetBool(&gspv
.bSnapToDefBtn
, uiParam
, KEY_MOUSE
, VAL_SNAPDEFBTN
, fl
);
1438 case SPI_GETMOUSEHOVERWIDTH
:
1439 return SpiGetInt(pvParam
, &gspv
.iMouseHoverWidth
, fl
);
1441 case SPI_SETMOUSEHOVERWIDTH
:
1442 return SpiSetInt(&gspv
.iMouseHoverWidth
, uiParam
, KEY_MOUSE
, VAL_HOVERWIDTH
, fl
);
1444 case SPI_GETMOUSEHOVERHEIGHT
:
1445 return SpiGetInt(pvParam
, &gspv
.iMouseHoverHeight
, fl
);
1447 case SPI_SETMOUSEHOVERHEIGHT
:
1448 return SpiSetInt(&gspv
.iMouseHoverHeight
, uiParam
, KEY_MOUSE
, VAL_HOVERHEIGHT
, fl
);
1450 case SPI_GETMOUSEHOVERTIME
:
1451 return SpiGetInt(pvParam
, &gspv
.iMouseHoverTime
, fl
);
1453 case SPI_SETMOUSEHOVERTIME
:
1454 /* See http://msdn2.microsoft.com/en-us/library/ms724947.aspx
1455 * copy text from it, if some agument why xp and 2003 behovir diffent
1456 * only if they do not have SP install
1457 * " Windows Server 2003 and Windows XP: The operating system does not
1458 * enforce the use of USER_TIMER_MAXIMUM and USER_TIMER_MINIMUM until
1459 * Windows Server 2003 SP1 and Windows XP SP2 "
1461 return SpiSetInt(&gspv
.iMouseHoverTime
, uiParam
, KEY_MOUSE
, VAL_HOVERTIME
, fl
);
1463 case SPI_GETWHEELSCROLLLINES
:
1464 return SpiGetInt(pvParam
, &gspv
.iWheelScrollLines
, fl
);
1466 case SPI_SETWHEELSCROLLLINES
:
1467 return SpiSetInt(&gspv
.iWheelScrollLines
, uiParam
, KEY_DESKTOP
, VAL_SCRLLLINES
, fl
);
1469 case SPI_GETMENUSHOWDELAY
:
1470 return SpiGetInt(pvParam
, &gspv
.dwMenuShowDelay
, fl
);
1472 case SPI_SETMENUSHOWDELAY
:
1473 return SpiSetInt(&gspv
.dwMenuShowDelay
, uiParam
, KEY_DESKTOP
, L
"MenuShowDelay", fl
);
1475 #if (_WIN32_WINNT >= 0x0600)
1476 case SPI_GETWHEELSCROLLCHARS
:
1477 return SpiGetInt(pvParam
, &gspv
.uiWheelScrollChars
, fl
);
1479 case SPI_SETWHEELSCROLLCHARS
:
1480 return SpiSetInt(&gspv
.uiWheelScrollChars
, uiParam
, KEY_DESKTOP
, VAL_SCRLLCHARS
, fl
);
1482 case SPI_GETSHOWIMEUI
:
1483 return SpiGetInt(pvParam
, &gspv
.bShowImeUi
, fl
);
1485 case SPI_SETSHOWIMEUI
:
1486 return SpiSetBool(&gspv
.bShowImeUi
, uiParam
, KEY_DESKTOP
, L
"", fl
);
1488 case SPI_GETMOUSESPEED
:
1489 return SpiGetInt(pvParam
, &gspv
.iMouseSpeed
, fl
);
1491 case SPI_SETMOUSESPEED
:
1493 /* Allowed range is [1:20] */
1494 if ((INT_PTR
)pvParam
< 1 || (INT_PTR
)pvParam
> 20)
1497 return SpiSetInt(&gspv
.iMouseSpeed
, (INT_PTR
)pvParam
, KEY_MOUSE
, VAL_SENSITIVITY
, fl
);
1500 case SPI_GETSCREENSAVERRUNNING
:
1501 return SpiGetInt(pvParam
, &gspv
.bScrSaverRunning
, fl
);
1503 case SPI_SETSCREENSAVERRUNNING
:
1504 // FIXME: also return value?
1505 return SpiSetBool(&gspv
.bScrSaverRunning
, uiParam
, KEY_MOUSE
, L
"", fl
);
1507 #if(WINVER >= 0x0600)
1508 case SPI_GETAUDIODESCRIPTION
:
1509 return SpiGet(pvParam
, &gspv
.audiodesription
, sizeof(AUDIODESCRIPTION
), fl
);
1511 case SPI_SETAUDIODESCRIPTION
:
1512 ERR("SPI_SETAUDIODESCRIPTION is unimplemented\n");
1515 case SPI_GETSCREENSAVESECURE
:
1516 return SpiGetInt(pvParam
, &gspv
.bScrSaverSecure
, fl
);
1518 case SPI_SETSCREENSAVESECURE
:
1519 return SpiSetBool(&gspv
.bScrSaverSecure
, uiParam
, KEY_DESKTOP
, L
"ScreenSaverIsSecure", fl
);
1522 case SPI_GETACTIVEWINDOWTRACKING
:
1523 return SpiGetUserPref(UPM_ACTIVEWINDOWTRACKING
, pvParam
, fl
);
1525 case SPI_SETACTIVEWINDOWTRACKING
:
1526 return SpiSetUserPref(UPM_ACTIVEWINDOWTRACKING
, pvParam
, fl
);
1528 case SPI_GETMENUANIMATION
:
1529 return SpiGetUserPref(UPM_MENUANIMATION
, pvParam
, fl
);
1531 case SPI_SETMENUANIMATION
:
1532 return SpiSetUserPref(UPM_MENUANIMATION
, pvParam
, fl
);
1534 case SPI_GETCOMBOBOXANIMATION
:
1535 return SpiGetUserPref(UPM_COMBOBOXANIMATION
, pvParam
, fl
);
1537 case SPI_SETCOMBOBOXANIMATION
:
1538 return SpiSetUserPref(UPM_COMBOBOXANIMATION
, pvParam
, fl
);
1540 case SPI_GETLISTBOXSMOOTHSCROLLING
:
1541 return SpiGetUserPref(UPM_LISTBOXSMOOTHSCROLLING
, pvParam
, fl
);
1543 case SPI_SETLISTBOXSMOOTHSCROLLING
:
1544 return SpiSetUserPref(UPM_LISTBOXSMOOTHSCROLLING
, pvParam
, fl
);
1546 case SPI_GETGRADIENTCAPTIONS
:
1547 return SpiGetUserPref(UPM_GRADIENTCAPTIONS
, pvParam
, fl
);
1549 case SPI_SETGRADIENTCAPTIONS
:
1550 return SpiSetUserPref(UPM_GRADIENTCAPTIONS
, pvParam
, fl
);
1552 case SPI_GETKEYBOARDCUES
:
1553 return SpiGetUserPref(UPM_KEYBOARDCUES
, pvParam
, fl
);
1555 case SPI_SETKEYBOARDCUES
:
1556 return SpiSetUserPref(UPM_KEYBOARDCUES
, pvParam
, fl
);
1558 case SPI_GETACTIVEWNDTRKZORDER
:
1559 return SpiGetUserPref(UPM_ACTIVEWNDTRKZORDER
, pvParam
, fl
);
1561 case SPI_SETACTIVEWNDTRKZORDER
:
1562 return SpiSetUserPref(UPM_ACTIVEWNDTRKZORDER
, pvParam
, fl
);
1564 case SPI_GETHOTTRACKING
:
1565 return SpiGetUserPref(UPM_HOTTRACKING
, pvParam
, fl
);
1567 case SPI_SETHOTTRACKING
:
1568 return SpiSetUserPref(UPM_HOTTRACKING
, pvParam
, fl
);
1570 case SPI_GETMENUFADE
:
1571 return SpiGetUserPref(UPM_MENUFADE
, pvParam
, fl
);
1573 case SPI_SETMENUFADE
:
1574 return SpiSetUserPref(UPM_MENUFADE
, pvParam
, fl
);
1576 case SPI_GETSELECTIONFADE
:
1577 return SpiGetUserPref(UPM_SELECTIONFADE
, pvParam
, fl
);
1579 case SPI_SETSELECTIONFADE
:
1580 return SpiSetUserPref(UPM_SELECTIONFADE
, pvParam
, fl
);
1582 case SPI_GETTOOLTIPANIMATION
:
1583 return SpiGetUserPref(UPM_TOOLTIPANIMATION
, pvParam
, fl
);
1585 case SPI_SETTOOLTIPANIMATION
:
1586 return SpiSetUserPref(UPM_TOOLTIPANIMATION
, pvParam
, fl
);
1588 case SPI_GETTOOLTIPFADE
:
1589 return SpiGetUserPref(UPM_TOOLTIPFADE
, pvParam
, fl
);
1591 case SPI_SETTOOLTIPFADE
:
1592 return SpiSetUserPref(UPM_TOOLTIPFADE
, pvParam
, fl
);
1594 case SPI_GETCURSORSHADOW
:
1595 return SpiGetUserPref(UPM_CURSORSHADOW
, pvParam
, fl
);
1597 case SPI_SETCURSORSHADOW
:
1598 gspv
.bMouseCursorShadow
= (BOOL
)pvParam
;
1599 return SpiSetUserPref(UPM_CURSORSHADOW
, pvParam
, fl
);
1601 case SPI_GETUIEFFECTS
:
1602 return SpiGetUserPref(UPM_UIEFFECTS
, pvParam
, fl
);
1604 case SPI_SETUIEFFECTS
:
1605 return SpiSetUserPref(UPM_UIEFFECTS
, pvParam
, fl
);
1607 case SPI_GETMOUSESONAR
:
1608 return SpiGetInt(pvParam
, &gspv
.bMouseSonar
, fl
);
1610 case SPI_SETMOUSESONAR
:
1611 return SpiSetBool(&gspv
.bMouseSonar
, uiParam
, KEY_MOUSE
, L
"", fl
);
1613 case SPI_GETMOUSECLICKLOCK
:
1614 return SpiGetUserPref(UPM_CLICKLOCK
, pvParam
, fl
);
1616 case SPI_SETMOUSECLICKLOCK
:
1617 gspv
.bMouseClickLock
= (BOOL
)pvParam
;
1618 return SpiSetUserPref(UPM_CLICKLOCK
, pvParam
, fl
);
1620 case SPI_GETMOUSEVANISH
:
1621 return SpiGetInt(pvParam
, &gspv
.bMouseVanish
, fl
);
1623 case SPI_SETMOUSEVANISH
:
1624 return SpiSetBool(&gspv
.bMouseVanish
, uiParam
, KEY_MOUSE
, L
"", fl
);
1626 case SPI_GETFLATMENU
:
1627 return SpiGetInt(pvParam
, &gspv
.bFlatMenu
, fl
);
1629 case SPI_SETFLATMENU
:
1630 return SpiSetBool(&gspv
.bFlatMenu
, uiParam
, KEY_MOUSE
, L
"", fl
);
1632 case SPI_GETDROPSHADOW
:
1633 return SpiGetInt(pvParam
, &gspv
.bDropShadow
, fl
);
1635 case SPI_SETDROPSHADOW
:
1636 return SpiSetBool(&gspv
.bDropShadow
, uiParam
, KEY_MOUSE
, L
"", fl
);
1638 case SPI_GETBLOCKSENDINPUTRESETS
:
1639 return SpiGetInt(pvParam
, &gspv
.bBlockSendInputResets
, fl
);
1641 case SPI_SETBLOCKSENDINPUTRESETS
:
1642 return SpiSetBool(&gspv
.bBlockSendInputResets
, uiParam
, KEY_MOUSE
, L
"", fl
);
1644 #if(_WIN32_WINNT >= 0x0600)
1645 case SPI_GETDISABLEOVERLAPPEDCONTENT
:
1646 return SpiGetInt(pvParam
, &gspv
.bDisableOverlappedContent
, fl
);
1648 case SPI_SETDISABLEOVERLAPPEDCONTENT
:
1649 return SpiSetBool(&gspv
.bDisableOverlappedContent
, uiParam
, KEY_MOUSE
, L
"", fl
);
1651 case SPI_GETCLIENTAREAANIMATION
:
1652 return SpiGetInt(pvParam
, &gspv
.bClientAnimation
, fl
);
1654 case SPI_SETCLIENTAREAANIMATION
:
1655 return SpiSetBool(&gspv
.bClientAnimation
, uiParam
, KEY_MOUSE
, L
"", fl
);
1657 case SPI_GETCLEARTYPE
:
1658 return SpiGetInt(pvParam
, &gspv
.bClearType
, fl
);
1660 case SPI_SETCLEARTYPE
:
1661 return SpiSetBool(&gspv
.bClearType
, uiParam
, KEY_MOUSE
, L
"", fl
);
1663 case SPI_GETSPEECHRECOGNITION
:
1664 return SpiGetInt(pvParam
, &gspv
.bSpeechRecognition
, fl
);
1666 case SPI_SETSPEECHRECOGNITION
:
1667 return SpiSetBool(&gspv
.bSpeechRecognition
, uiParam
, KEY_MOUSE
, L
"", fl
);
1670 case SPI_GETFOREGROUNDLOCKTIMEOUT
:
1671 return SpiGetInt(pvParam
, &gspv
.dwForegroundLockTimeout
, fl
);
1673 case SPI_SETFOREGROUNDLOCKTIMEOUT
:
1674 return SpiSetInt(&gspv
.dwForegroundLockTimeout
, uiParam
, KEY_MOUSE
, L
"", fl
);
1676 case SPI_GETACTIVEWNDTRKTIMEOUT
:
1677 return SpiGetInt(pvParam
, &gspv
.dwActiveTrackingTimeout
, fl
);
1679 case SPI_SETACTIVEWNDTRKTIMEOUT
:
1680 return SpiSetInt(&gspv
.dwActiveTrackingTimeout
, uiParam
, KEY_MOUSE
, L
"", fl
);
1682 case SPI_GETFOREGROUNDFLASHCOUNT
:
1683 return SpiGetInt(pvParam
, &gspv
.dwForegroundFlashCount
, fl
);
1685 case SPI_SETFOREGROUNDFLASHCOUNT
:
1686 return SpiSetInt(&gspv
.dwForegroundFlashCount
, uiParam
, KEY_MOUSE
, L
"", fl
);
1688 case SPI_GETCARETWIDTH
:
1689 return SpiGetInt(pvParam
, &gspv
.dwCaretWidth
, fl
);
1691 case SPI_SETCARETWIDTH
:
1692 return SpiSetInt(&gspv
.dwCaretWidth
, uiParam
, KEY_MOUSE
, L
"", fl
);
1694 case SPI_GETMOUSECLICKLOCKTIME
:
1695 return SpiGetInt(pvParam
, &gspv
.dwMouseClickLockTime
, fl
);
1697 case SPI_SETMOUSECLICKLOCKTIME
:
1698 return SpiSetDWord(&gspv
.dwMouseClickLockTime
, uiParam
, KEY_DESKTOP
, VAL_CLICKLOCKTIME
, fl
);
1700 case SPI_GETFONTSMOOTHINGTYPE
:
1701 return SpiGetInt(pvParam
, &gspv
.uiFontSmoothingType
, fl
);
1703 case SPI_SETFONTSMOOTHINGTYPE
:
1704 return SpiSetInt(&gspv
.uiFontSmoothingType
, uiParam
, KEY_MOUSE
, L
"", fl
);
1706 case SPI_GETFONTSMOOTHINGCONTRAST
:
1707 return SpiGetInt(pvParam
, &gspv
.uiFontSmoothingContrast
, fl
);
1709 case SPI_SETFONTSMOOTHINGCONTRAST
:
1710 return SpiSetInt(&gspv
.uiFontSmoothingContrast
, uiParam
, KEY_MOUSE
, L
"", fl
);
1712 case SPI_GETFOCUSBORDERWIDTH
:
1713 return SpiGetInt(pvParam
, &gspv
.uiFocusBorderWidth
, fl
);
1715 case SPI_SETFOCUSBORDERWIDTH
:
1716 return SpiSetInt(&gspv
.uiFocusBorderWidth
, uiParam
, KEY_MOUSE
, L
"", fl
);
1718 case SPI_GETFOCUSBORDERHEIGHT
:
1719 return SpiGetInt(pvParam
, &gspv
.uiFocusBorderHeight
, fl
);
1721 case SPI_SETFOCUSBORDERHEIGHT
:
1722 return SpiSetInt(&gspv
.uiFocusBorderHeight
, uiParam
, KEY_MOUSE
, L
"", fl
);
1724 case SPI_GETFONTSMOOTHINGORIENTATION
:
1725 return SpiGetInt(pvParam
, &gspv
.uiFontSmoothingOrientation
, fl
);
1727 case SPI_SETFONTSMOOTHINGORIENTATION
:
1728 return SpiSetInt(&gspv
.uiFontSmoothingOrientation
, uiParam
, KEY_MOUSE
, L
"", fl
);
1730 /* The following are undocumented, but valid SPI values */
1755 ERR("Undocumented SPI value %x is unimplemented\n", uiAction
);
1759 ERR("Invalid SPI value: %u\n", uiAction
);
1760 EngSetLastError(ERROR_INVALID_PARAMETER
);
1768 SpiGetSetProbeBuffer(UINT uiAction
, UINT uiParam
, PVOID pvParam
)
1770 BOOL bToUser
= TRUE
;
1777 case SPI_GETKEYBOARDSPEED
:
1778 case SPI_GETSCREENSAVETIMEOUT
:
1779 case SPI_GETSCREENSAVEACTIVE
:
1780 case SPI_GETGRIDGRANULARITY
:
1781 case SPI_GETKEYBOARDDELAY
:
1782 case SPI_GETICONTITLEWRAP
:
1783 case SPI_GETMENUDROPALIGNMENT
:
1784 case SPI_GETFASTTASKSWITCH
:
1785 case SPI_GETDRAGFULLWINDOWS
:
1786 case SPI_GETSHOWSOUNDS
:
1787 case SPI_GETKEYBOARDPREF
:
1788 case SPI_GETSCREENREADER
:
1789 case SPI_GETFONTSMOOTHING
:
1790 case SPI_GETLOWPOWERTIMEOUT
:
1791 case SPI_GETPOWEROFFTIMEOUT
:
1792 case SPI_GETLOWPOWERACTIVE
:
1793 case SPI_GETPOWEROFFACTIVE
:
1794 case SPI_GETMOUSETRAILS
:
1795 case SPI_GETSNAPTODEFBUTTON
:
1796 case SPI_GETMOUSEHOVERWIDTH
:
1797 case SPI_GETMOUSEHOVERHEIGHT
:
1798 case SPI_GETMOUSEHOVERTIME
:
1799 case SPI_GETWHEELSCROLLLINES
:
1800 case SPI_GETMENUSHOWDELAY
:
1801 #if (_WIN32_WINNT >= 0x0600)
1802 case SPI_GETWHEELSCROLLCHARS
:
1804 case SPI_GETSHOWIMEUI
:
1805 case SPI_GETMOUSESPEED
:
1806 case SPI_GETSCREENSAVERRUNNING
:
1807 #if(WINVER >= 0x0600)
1808 case SPI_GETSCREENSAVESECURE
:
1810 case SPI_GETACTIVEWINDOWTRACKING
:
1811 case SPI_GETMENUANIMATION
:
1812 case SPI_GETCOMBOBOXANIMATION
:
1813 case SPI_GETLISTBOXSMOOTHSCROLLING
:
1814 case SPI_GETGRADIENTCAPTIONS
:
1815 case SPI_GETKEYBOARDCUES
:
1816 case SPI_GETACTIVEWNDTRKZORDER
:
1817 case SPI_GETHOTTRACKING
:
1818 case SPI_GETMENUFADE
:
1819 case SPI_GETSELECTIONFADE
:
1820 case SPI_GETTOOLTIPANIMATION
:
1821 case SPI_GETTOOLTIPFADE
:
1822 case SPI_GETCURSORSHADOW
:
1823 case SPI_GETUIEFFECTS
:
1824 case SPI_GETMOUSESONAR
:
1825 case SPI_GETMOUSECLICKLOCK
:
1826 case SPI_GETMOUSEVANISH
:
1827 case SPI_GETFLATMENU
:
1828 case SPI_GETDROPSHADOW
:
1829 case SPI_GETBLOCKSENDINPUTRESETS
:
1830 #if(_WIN32_WINNT >= 0x0600)
1831 case SPI_GETDISABLEOVERLAPPEDCONTENT
:
1832 case SPI_GETCLIENTAREAANIMATION
:
1833 case SPI_GETCLEARTYPE
:
1834 case SPI_GETSPEECHRECOGNITION
:
1836 case SPI_GETFOREGROUNDLOCKTIMEOUT
:
1837 case SPI_GETACTIVEWNDTRKTIMEOUT
:
1838 case SPI_GETFOREGROUNDFLASHCOUNT
:
1839 case SPI_GETCARETWIDTH
:
1840 case SPI_GETMOUSECLICKLOCKTIME
:
1841 case SPI_GETFONTSMOOTHINGTYPE
:
1842 case SPI_GETFONTSMOOTHINGCONTRAST
:
1843 case SPI_GETFOCUSBORDERWIDTH
:
1844 case SPI_GETFOCUSBORDERHEIGHT
:
1845 case SPI_GETFONTSMOOTHINGORIENTATION
:
1846 cbSize
= sizeof(INT
);
1849 case SPI_ICONHORIZONTALSPACING
:
1850 case SPI_ICONVERTICALSPACING
:
1851 if (pvParam
) cbSize
= sizeof(INT
);
1855 cbSize
= 3 * sizeof(INT
);
1858 case SPI_GETDESKWALLPAPER
:
1859 cbSize
= min(uiParam
, gspv
.ustrWallpaper
.Length
+ 1UL);
1862 case SPI_GETICONTITLELOGFONT
:
1863 cbSize
= sizeof(LOGFONTW
);
1866 case SPI_GETNONCLIENTMETRICS
:
1867 cbSize
= sizeof(NONCLIENTMETRICSW
);
1870 case SPI_GETMINIMIZEDMETRICS
:
1871 cbSize
= sizeof(MINIMIZEDMETRICS
);
1874 case SPI_GETICONMETRICS
:
1875 cbSize
= sizeof(ICONMETRICSW
);
1878 case SPI_GETWORKAREA
:
1879 cbSize
= sizeof(RECTL
);
1882 case SPI_GETFILTERKEYS
:
1883 cbSize
= sizeof(FILTERKEYS
);
1886 case SPI_GETTOGGLEKEYS
:
1887 cbSize
= sizeof(TOGGLEKEYS
);
1890 case SPI_GETMOUSEKEYS
:
1891 cbSize
= sizeof(MOUSEKEYS
);
1894 case SPI_GETSTICKYKEYS
:
1895 cbSize
= sizeof(STICKYKEYS
);
1898 case SPI_GETACCESSTIMEOUT
:
1899 cbSize
= sizeof(ACCESSTIMEOUT
);
1902 case SPI_GETSERIALKEYS
:
1903 cbSize
= sizeof(SERIALKEYS
);
1906 case SPI_GETSOUNDSENTRY
:
1907 cbSize
= sizeof(SOUNDSENTRYW
);
1910 case SPI_GETHIGHCONTRAST
:
1911 cbSize
= sizeof(HIGHCONTRASTW
);
1914 case SPI_GETANIMATION
:
1915 cbSize
= sizeof(ANIMATIONINFO
);
1918 case SPI_GETDEFAULTINPUTLANG
:
1919 cbSize
= sizeof(HKL
);
1922 #if(WINVER >= 0x0600)
1923 case SPI_GETAUDIODESCRIPTION
:
1924 cbSize
= sizeof(AUDIODESCRIPTION
);
1929 cbSize
= 3 * sizeof(INT
);
1933 case SPI_SETICONTITLELOGFONT
:
1934 cbSize
= sizeof(LOGFONTW
);
1938 case SPI_SETNONCLIENTMETRICS
:
1939 cbSize
= sizeof(NONCLIENTMETRICSW
);
1943 case SPI_SETMINIMIZEDMETRICS
:
1944 cbSize
= sizeof(MINIMIZEDMETRICS
);
1948 case SPI_SETICONMETRICS
:
1949 cbSize
= sizeof(ICONMETRICSW
);
1953 case SPI_SETWORKAREA
:
1954 cbSize
= sizeof(RECTL
);
1958 case SPI_SETFILTERKEYS
:
1959 cbSize
= sizeof(FILTERKEYS
);
1963 case SPI_SETTOGGLEKEYS
:
1964 cbSize
= sizeof(TOGGLEKEYS
);
1968 case SPI_SETMOUSEKEYS
:
1969 cbSize
= sizeof(MOUSEKEYS
);
1973 case SPI_SETSTICKYKEYS
:
1974 cbSize
= sizeof(STICKYKEYS
);
1978 case SPI_SETACCESSTIMEOUT
:
1979 cbSize
= sizeof(ACCESSTIMEOUT
);
1983 case SPI_SETSERIALKEYS
:
1984 cbSize
= sizeof(SERIALKEYS
);
1988 case SPI_SETSOUNDSENTRY
:
1989 cbSize
= sizeof(SOUNDSENTRYW
);
1993 case SPI_SETHIGHCONTRAST
:
1994 cbSize
= sizeof(HIGHCONTRASTW
);
1998 case SPI_SETANIMATION
:
1999 cbSize
= sizeof(ANIMATIONINFO
);
2003 case SPI_SETDEFAULTINPUTLANG
:
2004 cbSize
= sizeof(HKL
);
2008 case SPI_SETMOUSESPEED
:
2009 cbSize
= sizeof(INT
);
2020 ProbeForWrite(pvParam
, cbSize
, sizeof(UCHAR
));
2024 ProbeForRead(pvParam
, cbSize
, sizeof(UCHAR
));
2027 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
2029 _SEH2_YIELD(return FALSE
);
2039 UserSystemParametersInfo(
2046 PPROCESSINFO ppi
= PsGetCurrentProcessWin32Process();
2050 if (!gbSpiInitialized
)
2052 KeRosDumpStackFrames(NULL
, 20);
2057 /* Get a pointer to the current Windowstation */
2058 if (!ppi
->prpwinsta
)
2060 ERR("UserSystemParametersInfo called without active window station.\n");
2065 if ((fWinIni
& SPIF_PROTECT
) && !SpiGetSetProbeBuffer(uiAction
, uiParam
, pvParam
))
2067 EngSetLastError(ERROR_NOACCESS
);
2071 /* Do the actual operation */
2072 ulResult
= SpiGetSet(uiAction
, uiParam
, pvParam
, fWinIni
);
2074 /* Did we change something? */
2079 /* Update system metrics */
2082 /* Send notification to toplevel windows, if requested */
2083 if (fWinIni
& (SPIF_SENDCHANGE
| SPIF_SENDWININICHANGE
))
2085 /* Send WM_SETTINGCHANGE to all toplevel windows */
2086 co_IntSendMessageTimeout(HWND_BROADCAST
,
2102 NtUserSystemParametersInfo(
2110 TRACE("Enter NtUserSystemParametersInfo(%u)\n", uiAction
);
2111 UserEnterExclusive();
2113 // FIXME: Get rid of the flags and only use this from um. kernel can access data directly.
2114 /* Set UM memory protection flag */
2115 fWinIni
|= SPIF_PROTECT
;
2117 /* Call internal function */
2118 bResult
= UserSystemParametersInfo(uiAction
, uiParam
, pvParam
, fWinIni
);
2120 TRACE("Leave NtUserSystemParametersInfo, returning %d\n", bResult
);