01503 {
01504
PPROCESSINFO ppi =
PpiCurrent();
01505
int clBorderOld;
01506
int clBorderNew;
01507 LPWSTR pwszd =
L"%d";
01508 WCHAR szSection[40];
01509 WCHAR szTemp[40];
01510 WCHAR szPat[
MAX_PATH];
01511
BOOL fWinIniChanged =
FALSE;
01512
BOOL fAlterWinIni = ((flags & SPIF_UPDATEINIFILE) != 0);
01513
BOOL fSendWinIniChange = ((flags & SPIF_SENDCHANGE) != 0);
01514
BOOL fWriteAllowed = !fAlterWinIni;
01515 ACCESS_MASK amRequest;
01516
LARGE_UNICODE_STRING strSection;
01517
int *piTimeOut;
01518
int iResID;
01519
TL tlName;
01520 PUNICODE_STRING pProfileUserName =
NULL;
01521
01522 UserAssert(
IsWinEventNotifyDeferredOK());
01523
01524
01525
01526
01527
01528
01529
01530
01531
01532
01533
switch (wFlag)
01534 {
01535
case SPI_TIMEOUTS:
01536
case SPI_KANJIMENU:
01537
case SPI_LANGDRIVER:
01538
case SPI_UNUSED39:
01539
case SPI_UNUSED40:
01540
case SPI_SETPENWINDOWS:
01541
01542
case SPI_GETWINDOWSEXTENSION:
01543
case SPI_SETSCREENSAVERRUNNING:
01544
01545
case SPI_GETSERIALKEYS:
01546
case SPI_SETSERIALKEYS:
01547
01548
case SPI_SETMOUSETRAILS:
01549
case SPI_GETMOUSETRAILS:
01550 RIPERR1(ERROR_INVALID_PARAMETER,
01551 RIP_WARNING,
01552
"SPI_ 0x%lx parameter not supported", wFlag );
01553
01554
return FALSE;
01555 }
01556
01557
01558
01559
01560
01561
if (ppi->Process !=
gpepCSRSS) {
01562
switch (wFlag) {
01563
case SPI_SETBEEP:
01564
case SPI_SETMOUSE:
01565
case SPI_SETBORDER:
01566
case SPI_SETKEYBOARDSPEED:
01567
case SPI_SETDEFAULTINPUTLANG:
01568
case SPI_SETSCREENSAVETIMEOUT:
01569
case SPI_SETSCREENSAVEACTIVE:
01570
case SPI_SETLOWPOWERTIMEOUT:
01571
case SPI_SETPOWEROFFTIMEOUT:
01572
case SPI_SETLOWPOWERACTIVE:
01573
case SPI_SETPOWEROFFACTIVE:
01574
case SPI_SETGRIDGRANULARITY:
01575
case SPI_SETDESKWALLPAPER:
01576
case SPI_SETDESKPATTERN:
01577
case SPI_SETKEYBOARDDELAY:
01578
case SPI_SETICONTITLEWRAP:
01579
case SPI_SETMENUDROPALIGNMENT:
01580
case SPI_SETDOUBLECLKWIDTH:
01581
case SPI_SETDOUBLECLKHEIGHT:
01582
case SPI_SETDOUBLECLICKTIME:
01583
case SPI_SETMOUSEBUTTONSWAP:
01584
case SPI_SETICONTITLELOGFONT:
01585
case SPI_SETFASTTASKSWITCH:
01586
case SPI_SETFILTERKEYS:
01587
case SPI_SETTOGGLEKEYS:
01588
case SPI_SETMOUSEKEYS:
01589
case SPI_SETSHOWSOUNDS:
01590
case SPI_SETSTICKYKEYS:
01591
case SPI_SETACCESSTIMEOUT:
01592
case SPI_SETSOUNDSENTRY:
01593
case SPI_SETKEYBOARDPREF:
01594
case SPI_SETSCREENREADER:
01595
case SPI_SETSNAPTODEFBUTTON:
01596
case SPI_SETANIMATION:
01597
case SPI_SETNONCLIENTMETRICS:
01598
case SPI_SETICONMETRICS:
01599
case SPI_SETMINIMIZEDMETRICS:
01600
case SPI_SETWORKAREA:
01601
case SPI_SETFONTSMOOTHING:
01602
case SPI_SETMOUSEHOVERWIDTH:
01603
case SPI_SETMOUSEHOVERHEIGHT:
01604
case SPI_SETMOUSEHOVERTIME:
01605
case SPI_SETWHEELSCROLLLINES:
01606
case SPI_SETMENUSHOWDELAY:
01607
case SPI_SETHIGHCONTRAST:
01608
case SPI_SETDRAGFULLWINDOWS:
01609
case SPI_SETDRAGWIDTH:
01610
case SPI_SETDRAGHEIGHT:
01611
case SPI_SETCURSORS:
01612
case SPI_SETICONS:
01613
case SPI_SETLANGTOGGLE:
01614 amRequest = WINSTA_WRITEATTRIBUTES;
01615
break;
01616
01617
case SPI_ICONHORIZONTALSPACING:
01618
case SPI_ICONVERTICALSPACING:
01619
if (
IS_PTR(lParam)) {
01620 amRequest = WINSTA_READATTRIBUTES;
01621 }
else if (wParam) {
01622 amRequest = WINSTA_WRITEATTRIBUTES;
01623 }
else
01624
return TRUE;
01625
break;
01626
01627
default:
01628
if ((wFlag & SPIF_RANGETYPEMASK) && (wFlag & SPIF_SET)) {
01629 amRequest = WINSTA_WRITEATTRIBUTES;
01630 }
else {
01631 amRequest = WINSTA_READATTRIBUTES;
01632 }
01633
break;
01634 }
01635
01636
if (amRequest == WINSTA_READATTRIBUTES) {
01637
RETURN_IF_ACCESS_DENIED(ppi->
amwinsta, amRequest, FALSE);
01638 }
else {
01639 UserAssert(amRequest == WINSTA_WRITEATTRIBUTES);
01640
if (!
CheckWinstaWriteAttributesAccess()) {
01641
return FALSE;
01642 }
01643 }
01644
01645
01646
01647
01648
01649
if (amRequest == WINSTA_READATTRIBUTES)
01650 fWriteAllowed =
TRUE;
01651 }
else {
01652 fWriteAllowed =
TRUE;
01653 }
01654
01655
01656
01657
01658 szSection[0] = 0;
01659
01660
switch (wFlag) {
01661
case SPI_GETBEEP:
01662 (*(
BOOL *)lParam) =
TEST_BOOL_PUDF(PUDF_BEEP);
01663
break;
01664
01665
case SPI_SETBEEP:
01666
if (fAlterWinIni) {
01667
ServerLoadString(
01668 hModuleWin,
01669 (UINT)(wParam ? STR_BEEPYES : STR_BEEPNO),
01670 (LPWSTR)szTemp, 10);
01671
01672 fWinIniChanged =
FastUpdateWinIni(NULL,
01673 PMAP_BEEP,
01674 (UINT) STR_BEEP,
01675 szTemp
01676 );
01677
01678 fWriteAllowed = fWinIniChanged;
01679 }
01680
01681
if (fWriteAllowed) {
01682
SET_OR_CLEAR_PUDF(PUDF_BEEP, wParam);
01683 }
01684
01685
break;
01686
01687
01688
case SPI_SETMOUSESPEED:
01689
if (((LONG_PTR) lParam < MOUSE_SENSITIVITY_MIN) || ((LONG_PTR) lParam >
MOUSE_SENSITIVITY_MAX)) {
01690
return FALSE ;
01691 }
01692
01693
if (fAlterWinIni) {
01694 swprintf(szTemp, pwszd, lParam) ;
01695 fWinIniChanged =
FastUpdateWinIni(NULL,
01696 PMAP_MOUSE,
01697 STR_MOUSESENSITIVITY,
01698 szTemp
01699 );
01700
01701 fWriteAllowed = fWinIniChanged;
01702 }
01703
01704
if (fWriteAllowed) {
01705
gMouseSensitivity = PtrToLong(lParam);
01706
gMouseSensitivityFactor =
CalculateMouseSensitivity(PtrToLong(lParam)) ;
01707 }
01708
break;
01709
01710
case SPI_GETMOUSESPEED:
01711 *((LPINT)lParam) =
gMouseSensitivity ;
01712
break;
01713
01714
case SPI_GETMOUSE:
01715 ((LPINT)lParam)[0] =
gMouseThresh1;
01716 ((LPINT)lParam)[1] =
gMouseThresh2;
01717 ((LPINT)lParam)[2] =
gMouseSpeed;
01718
break;
01719
01720
case SPI_SETMOUSE:
01721
if (fAlterWinIni) {
01722
BOOL bWritten1, bWritten2, bWritten3;
01723
01724 pProfileUserName =
CreateProfileUserName(&tlName);
01725 bWritten1 =
UpdateWinIniInt(pProfileUserName, PMAP_MOUSE, STR_MOUSETHRESH1, ((LPINT)lParam)[0]);
01726 bWritten2 =
UpdateWinIniInt(pProfileUserName, PMAP_MOUSE, STR_MOUSETHRESH2, ((LPINT)lParam)[1]);
01727 bWritten3 =
UpdateWinIniInt(pProfileUserName, PMAP_MOUSE, STR_MOUSESPEED, ((LPINT)lParam)[2]);
01728
if (bWritten1 && bWritten2 && bWritten3)
01729 fWinIniChanged =
TRUE;
01730
else {
01731
01732
01733
01734
01735
if (bWritten1) {
01736
UpdateWinIniInt(pProfileUserName, PMAP_MOUSE, STR_MOUSETHRESH1, gMouseThresh1);
01737 }
01738
if (bWritten2) {
01739
UpdateWinIniInt(pProfileUserName, PMAP_MOUSE, STR_MOUSETHRESH2, gMouseThresh2);
01740 }
01741
if (bWritten3) {
01742
UpdateWinIniInt(pProfileUserName, PMAP_MOUSE, STR_MOUSESPEED, gMouseSpeed);
01743 }
01744 }
01745 fWriteAllowed = fWinIniChanged;
01746
FreeProfileUserName(pProfileUserName, &tlName);
01747 }
01748
if (fWriteAllowed) {
01749
gMouseThresh1 = ((LPINT)lParam)[0];
01750
gMouseThresh2 = ((LPINT)lParam)[1];
01751
gMouseSpeed = ((LPINT)lParam)[2];
01752 }
01753
break;
01754
01755
case SPI_GETSNAPTODEFBUTTON:
01756 (*(LPBOOL)lParam) =
TEST_BOOL_PUSIF(PUSIF_SNAPTO);
01757
break;
01758
01759
case SPI_SETSNAPTODEFBUTTON:
01760 wParam = (wParam != 0);
01761
01762
if (fAlterWinIni) {
01763 fWinIniChanged =
UpdateWinIniInt(NULL, PMAP_MOUSE, STR_SNAPTO, wParam);
01764 fWriteAllowed = fWinIniChanged;
01765 }
01766
01767
if (fWriteAllowed) {
01768
SET_OR_CLEAR_PUSIF(PUSIF_SNAPTO, wParam);
01769 }
01770
01771
break;
01772
01773
case SPI_GETBORDER:
01774 (*(LPINT)lParam) =
gpsi->gclBorder;
01775
break;
01776
01777
case SPI_SETBORDER:
01778 pProfileUserName =
CreateProfileUserName(&tlName);
01779
if (fAlterWinIni) {
01780 fWinIniChanged =
SetWindowMetricInt(pProfileUserName, STR_BORDERWIDTH, wParam);
01781 fWriteAllowed = fWinIniChanged;
01782 }
01783
if (fWriteAllowed) {
01784 clBorderOld =
gpsi->gclBorder;
01785 clBorderNew = wParam;
01786
01787
if (clBorderNew < 1)
01788 clBorderNew = 1;
01789
else if (clBorderNew > 50)
01790 clBorderNew = 50;
01791
01792
if (clBorderOld == clBorderNew) {
01793
01794
01795
01796
01797
FreeProfileUserName(pProfileUserName, &tlName);
01798
break;
01799 }
01800
01801
xxxSetAndDrawNCMetrics(pProfileUserName, clBorderNew, NULL);
01802
01803
01804
01805
01806
01807
01808 bSetDevDragWidth(
gpDispInfo->
hDev,
gpsi->gclBorder + BORDER_EXTRA);
01809 }
01810
FreeProfileUserName(pProfileUserName, &tlName);
01811
break;
01812
01813
case SPI_GETFONTSMOOTHING:
01814 (*(LPINT)lParam) = !!(GreGetFontEnumeration() & FE_AA_ON);
01815
break;
01816
01817
case SPI_SETFONTSMOOTHING:
01818 wParam = (wParam ? FE_AA_ON : 0);
01819
if (fAlterWinIni) {
01820 fWinIniChanged =
UpdateWinIniInt(NULL,PMAP_DESKTOP, STR_FONTSMOOTHING, wParam);
01821 fWriteAllowed = fWinIniChanged;
01822 }
01823
if (fWriteAllowed) {
01824 GreSetFontEnumeration(wParam | FE_SET_AA);
01825 }
01826
break;
01827
01828
case SPI_GETKEYBOARDSPEED:
01829 (*(
int *)lParam) = (
gnKeyboardSpeed &
KSPEED_MASK);
01830
break;
01831
01832
case SPI_SETKEYBOARDSPEED:
01833
01834
01835
01836
if (wParam >
KSPEED_MASK)
01837 wParam =
KSPEED_MASK;
01838
if (fAlterWinIni) {
01839 fWinIniChanged =
UpdateWinIniInt(NULL,PMAP_KEYBOARD, STR_KEYSPEED, wParam);
01840 fWriteAllowed = fWinIniChanged;
01841 }
01842
if (fWriteAllowed) {
01843
gnKeyboardSpeed = (
gnKeyboardSpeed & ~
KSPEED_MASK) | wParam;
01844
SetKeyboardRate(gnKeyboardSpeed );
01845 }
01846
break;
01847
01848
case SPI_GETKEYBOARDDELAY:
01849 (*(
int *)lParam) = (
gnKeyboardSpeed &
KDELAY_MASK) >>
KDELAY_SHIFT;
01850
break;
01851
01852
case SPI_SETKEYBOARDDELAY:
01853
if (fAlterWinIni) {
01854 fWinIniChanged =
UpdateWinIniInt(NULL,PMAP_KEYBOARD, STR_KEYDELAY, wParam);
01855 fWriteAllowed = fWinIniChanged;
01856 }
01857
if (fWriteAllowed) {
01858
gnKeyboardSpeed = (
gnKeyboardSpeed & ~
KDELAY_MASK) | (wParam <<
KDELAY_SHIFT);
01859
SetKeyboardRate(gnKeyboardSpeed);
01860 }
01861
break;
01862
01863
case SPI_SETLANGTOGGLE:
01864
01865
01866
01867
01868
01869
return GetKbdLangSwitch(NULL);
01870
01871
break;
01872
01873
case SPI_GETDEFAULTINPUTLANG:
01874
01875
01876
01877 UserAssert(gspklBaseLayout != NULL);
01878 (*(HKL *)lParam) =
gspklBaseLayout->
hkl;
01879
break;
01880
01881
case SPI_SETDEFAULTINPUTLANG: {
01882
PKL pkl;
01883
01884
01885
01886
01887 pkl =
HKLtoPKL(
PtiCurrent(), *(HKL *)lParam);
01888
if (pkl ==
NULL) {
01889
return FALSE;
01890 }
01891
if (fWriteAllowed) {
01892
Lock(&gspklBaseLayout, pkl);
01893 }
01894
break;
01895 }
01896
01897
case SPI_ICONHORIZONTALSPACING:
01898
if (
IS_PTR(lParam)) {
01899 *(LPINT)lParam =
SYSMET(CXICONSPACING);
01900 }
else if (wParam) {
01901
01902
01903
01904
01905 wParam =
max(wParam, (DWORD)
SYSMET(CXICON));
01906
01907
if (fAlterWinIni) {
01908 fWinIniChanged =
SetWindowMetricInt(NULL, STR_ICONHORZSPACING, wParam );
01909 fWriteAllowed = fWinIniChanged;
01910 }
01911
if (fWriteAllowed) {
01912
SYSMET(CXICONSPACING) = (
UINT)wParam;
01913 }
01914 }
01915
break;
01916
01917
case SPI_ICONVERTICALSPACING:
01918
if (
IS_PTR(lParam)) {
01919 *(LPINT)lParam =
SYSMET(CYICONSPACING);
01920 }
else if (wParam) {
01921 wParam =
max(wParam, (DWORD)
SYSMET(CYICON));
01922
01923
if (fAlterWinIni) {
01924 fWinIniChanged =
SetWindowMetricInt(NULL, STR_ICONVERTSPACING, wParam);
01925 fWriteAllowed = fWinIniChanged;
01926 }
01927
if (fWriteAllowed) {
01928
SYSMET(CYICONSPACING) = (
UINT)wParam;
01929 }
01930 }
01931
break;
01932
01933
case SPI_GETSCREENSAVETIMEOUT:
01934 piTimeOut = &
giScreenSaveTimeOutMs;
01935
goto HandleGetTimeouts;
01936
01937
case SPI_GETLOWPOWERTIMEOUT:
01938
if (!
NT_SUCCESS(DrvGetMonitorPowerState(
gpDispInfo->
pmdev, PowerDeviceD1))) {
01939
return FALSE;
01940 }
01941 piTimeOut = &
giLowPowerTimeOutMs;
01942
goto HandleGetTimeouts;
01943
01944
case SPI_GETPOWEROFFTIMEOUT:
01945
if (!
NT_SUCCESS(DrvGetMonitorPowerState(
gpDispInfo->
pmdev, PowerDeviceD3))) {
01946
return FALSE;
01947 }
01948 piTimeOut = &
giPowerOffTimeOutMs;
01949
01950 HandleGetTimeouts:
01951
01952
01953
01954
01955
01956
if (*piTimeOut < 0)
01957 (*(
int *)lParam) = -*piTimeOut / 1000;
01958
else
01959 (*(
int *)lParam) = *piTimeOut / 1000;
01960
break;
01961
01962
case SPI_SETSCREENSAVETIMEOUT:
01963 piTimeOut = &
giScreenSaveTimeOutMs;
01964 iResID = STR_SCREENSAVETIMEOUT;
01965
goto HandleSetTimeouts;
01966
01967
case SPI_SETLOWPOWERTIMEOUT:
01968
if (!
NT_SUCCESS(DrvGetMonitorPowerState(
gpDispInfo->
pmdev, PowerDeviceD1))) {
01969
return FALSE;
01970 }
01971 piTimeOut = &
giLowPowerTimeOutMs;
01972 iResID = STR_LOWPOWERTIMEOUT;
01973
goto HandleSetTimeouts;
01974
01975
case SPI_SETPOWEROFFTIMEOUT:
01976
if (!
NT_SUCCESS(DrvGetMonitorPowerState(
gpDispInfo->
pmdev, PowerDeviceD3))) {
01977
return FALSE;
01978 }
01979 piTimeOut = &
giPowerOffTimeOutMs;
01980 iResID = STR_POWEROFFTIMEOUT;
01981
01982 HandleSetTimeouts:
01983
01984
01985
01986
01987
01988
if (
CheckDesktopPolicy(NULL, (PCWSTR)iResID)) {
01989 fAlterWinIni =
FALSE;
01990 fWriteAllowed =
FALSE;
01991 }
01992
if (fAlterWinIni) {
01993 fWinIniChanged =
UpdateWinIniInt(NULL,PMAP_DESKTOP, iResID, wParam);
01994 fWriteAllowed = fWinIniChanged;
01995 }
01996
if (fWriteAllowed) {
01997
if (
glinp.
dwFlags &
LINP_POWERTIMEOUTS) {
01998
01999 KdPrint((
"Exit video power down mode\n"));
02000 DrvSetMonitorPowerState(
gpDispInfo->
pmdev, PowerDeviceD0);
02001 }
02002
glinp.
dwFlags &= ~
LINP_INPUTTIMEOUTS;
02003
glinp.
timeLastInputMessage =
NtGetTickCount();
02004
if (*piTimeOut < 0) {
02005 *piTimeOut = -((
int)wParam);
02006 }
else {
02007 *piTimeOut = wParam;
02008 }
02009 *piTimeOut *= 1000;
02010 }
02011
break;
02012
02013
case SPI_GETSCREENSAVEACTIVE:
02014 (*(
BOOL *)lParam) = (
giScreenSaveTimeOutMs > 0);
02015
break;
02016
02017
case SPI_GETLOWPOWERACTIVE:
02018
if (!
NT_SUCCESS(DrvGetMonitorPowerState(
gpDispInfo->
pmdev, PowerDeviceD1))) {
02019
return FALSE;
02020 }
02021 (*(
BOOL *)lParam) = (
giLowPowerTimeOutMs > 0);
02022
break;
02023
02024
case SPI_GETPOWEROFFACTIVE:
02025
if (!
NT_SUCCESS(DrvGetMonitorPowerState(
gpDispInfo->
pmdev, PowerDeviceD3))) {
02026
return FALSE;
02027 }
02028 (*(
BOOL *)lParam) = (
giPowerOffTimeOutMs > 0);
02029
break;
02030
02031
case SPI_SETSCREENSAVEACTIVE:
02032 piTimeOut = &
giScreenSaveTimeOutMs;
02033 iResID = STR_SCREENSAVEACTIVE;
02034
goto HandleSetActive;
02035
02036
case SPI_SETLOWPOWERACTIVE:
02037
if (!
NT_SUCCESS(DrvGetMonitorPowerState(
gpDispInfo->
pmdev, PowerDeviceD1))) {
02038
return FALSE;
02039 }
02040 piTimeOut = &
giLowPowerTimeOutMs;
02041 iResID = STR_LOWPOWERACTIVE;
02042
goto HandleSetActive;
02043
02044
case SPI_SETPOWEROFFACTIVE:
02045
if (!
NT_SUCCESS(DrvGetMonitorPowerState(
gpDispInfo->
pmdev, PowerDeviceD3))) {
02046
return FALSE;
02047 }
02048 piTimeOut = &
giPowerOffTimeOutMs;
02049 iResID = STR_POWEROFFACTIVE;
02050
02051 HandleSetActive:
02052 wParam = (wParam != 0);
02053
02054
if (
CheckDesktopPolicy(NULL, (PCWSTR)iResID)) {
02055 fAlterWinIni =
FALSE;
02056 fWriteAllowed =
FALSE;
02057 }
02058
if (fAlterWinIni) {
02059 fWinIniChanged =
UpdateWinIniInt(NULL,PMAP_DESKTOP, iResID, wParam);
02060 fWriteAllowed = fWinIniChanged;
02061 }
02062
if (fWriteAllowed) {
02063
if (
glinp.
dwFlags &
LINP_POWERTIMEOUTS) {
02064
02065 KdPrint((
"Exit video power down mode\n"));
02066 DrvSetMonitorPowerState(
gpDispInfo->
pmdev, PowerDeviceD0);
02067 }
02068
glinp.
dwFlags &= ~
LINP_INPUTTIMEOUTS;
02069
glinp.
timeLastInputMessage =
NtGetTickCount();
02070
if ((*piTimeOut < 0 && wParam) ||
02071 (*piTimeOut >= 0 && !wParam)) {
02072 *piTimeOut = -*piTimeOut;
02073 }
02074 }
02075
break;
02076
02077
02078
case SPI_SETDESKWALLPAPER:
02079 pProfileUserName =
CreateProfileUserName(&tlName);
02080
if (fAlterWinIni) {
02081
02082
if (wParam != (WPARAM)-1) {
02083
02084
02085
02086
02087
FastGetProfileStringFromIDW(pProfileUserName,
02088 PMAP_DESKTOP,
02089 STR_DTBITMAP,
02090 TEXT(
""),
02091 szPat,
02092
sizeof(szPat) /
sizeof(WCHAR)
02093 );
02094
02095 fWinIniChanged =
FastUpdateWinIni(pProfileUserName,
02096 PMAP_DESKTOP,
02097 STR_DTBITMAP,
02098 (LPWSTR)lParam
02099 );
02100
02101 fWriteAllowed = fWinIniChanged;
02102
02103 }
else {
02104 fWriteAllowed =
TRUE;
02105 }
02106 }
02107
02108
if (fWriteAllowed) {
02109
02110
if (
xxxSetDeskWallpaper(pProfileUserName,(LPWSTR)lParam)) {
02111
02112
if (
grpdeskRitInput) {
02113
02114
xxxInternalInvalidate(
grpdeskRitInput->
pDeskInfo->
spwnd,
02115 HRGN_FULL,
02116 RDW_INVALIDATE |
02117 RDW_ERASE |
02118 RDW_FRAME |
02119 RDW_ALLCHILDREN);
02120 }
02121
02122 }
else if (fAlterWinIni && (wParam != 0xFFFFFFFF)) {
02123
02124
02125
02126
02127
FastUpdateWinIni(pProfileUserName,PMAP_DESKTOP, STR_DTBITMAP, szPat);
02128 fWinIniChanged =
FALSE;
02129 fWriteAllowed = fWinIniChanged;
02130 }
else if (!fAlterWinIni) {
02131
02132
02133
02134
02135 fWinIniChanged =
FALSE;
02136 fWriteAllowed = fWinIniChanged;
02137 }
02138 }
02139
FreeProfileUserName(pProfileUserName, &tlName);
02140
break;
02141
02142
02143
02144
02145
02146
case SPI_GETDESKWALLPAPER:
02147
02148
02149
02150
02151
02152
02153
if (
gpszWall !=
NULL) {
02154
02155
02156
02157 wcscpy(lParam, gpszWall);
02158 }
else {
02159
02160
02161
02162
02163 (*(LPWSTR)lParam) = (WCHAR)0;
02164 }
02165
break;
02166
02167
case SPI_SETDESKPATTERN: {
02168
BOOL fRet;
02169
02170
if (wParam == -1 && lParam != 0)
02171
return FALSE;
02172
02173 pProfileUserName =
CreateProfileUserName(&tlName);
02174
if (fAlterWinIni && wParam != -1) {
02175
02176
02177
02178
02179
FastGetProfileStringFromIDW(pProfileUserName,
02180 PMAP_DESKTOP,
02181 STR_DESKPATTERN,
02182 TEXT(
""),
02183 szPat,
02184
sizeof(szPat) /
sizeof(WCHAR)
02185 );
02186
02187 fWinIniChanged =
FastUpdateWinIni(pProfileUserName,
02188 PMAP_DESKTOP,
02189 STR_DESKPATTERN,
02190 (LPWSTR)lParam
02191 );
02192
02193 fWriteAllowed = fWinIniChanged;
02194 }
02195
02196
if (fWriteAllowed) {
02197
02198 fRet =
xxxSetDeskPattern(pProfileUserName,
02199 wParam == -1 ? (LPWSTR)-1 : (LPWSTR)lParam,
02200 FALSE);
02201
02202
if (!fRet) {
02203
02204
02205
02206
02207
if (fAlterWinIni && wParam != -1) {
02208
02209
FastUpdateWinIni(pProfileUserName,
02210 PMAP_DESKTOP,
02211 STR_DESKPATTERN,
02212 szPat
02213 );
02214 }
02215
02216
FreeProfileUserName(pProfileUserName, &tlName);
02217
return FALSE;
02218 }
02219 }
02220 }
02221
FreeProfileUserName(pProfileUserName, &tlName);
02222
break;
02223
02224
case SPI_GETICONTITLEWRAP:
02225 *((
int *)lParam) =
TEST_BOOL_PUDF(PUDF_ICONTITLEWRAP);
02226
break;
02227
02228
case SPI_SETICONTITLEWRAP:
02229 wParam = (wParam != 0);
02230
if (fAlterWinIni) {
02231 fWinIniChanged =
SetWindowMetricInt(NULL, STR_ICONTITLEWRAP, wParam);
02232 fWriteAllowed = fWinIniChanged;
02233 }
02234
if (fWriteAllowed) {
02235
SET_OR_CLEAR_PUDF(PUDF_ICONTITLEWRAP, wParam);
02236
xxxMetricsRecalc(CALC_FRAME, 0, 0, 0, 0);
02237 }
02238
break;
02239
02240
case SPI_SETDRAGWIDTH:
02241
if (fAlterWinIni) {
02242 fWinIniChanged =
UpdateWinIniInt(NULL, PMAP_DESKTOP, STR_DRAGWIDTH, wParam);
02243 fWriteAllowed = fWinIniChanged;
02244 }
02245
if (fWriteAllowed) {
02246
SYSMET(CXDRAG) = wParam;
02247 }
02248
break;
02249
02250
case SPI_SETDRAGHEIGHT:
02251
if (fAlterWinIni) {
02252 fWinIniChanged =
UpdateWinIniInt(NULL, PMAP_DESKTOP, STR_DRAGHEIGHT, wParam);
02253 fWriteAllowed = fWinIniChanged;
02254 }
02255
if (fWriteAllowed) {
02256
SYSMET(CYDRAG) = wParam;
02257 }
02258
break;
02259
02260
case SPI_GETMENUDROPALIGNMENT:
02261 (*(
int *)lParam) = (
SYSMET(MENUDROPALIGNMENT));
02262
break;
02263
02264
case SPI_SETMENUDROPALIGNMENT:
02265
if (fAlterWinIni) {
02266 fWinIniChanged =
UpdateWinIniInt(NULL, PMAP_WINDOWSU, STR_MENUDROPALIGNMENT, wParam);
02267 fWriteAllowed = fWinIniChanged;
02268 }
02269
if (fWriteAllowed) {
02270
SYSMET(MENUDROPALIGNMENT) = (
BOOL)(wParam != 0);
02271 }
02272
break;
02273
02274
case SPI_SETDOUBLECLKWIDTH:
02275
if (fAlterWinIni) {
02276 fWinIniChanged =
UpdateWinIniInt(NULL, PMAP_MOUSE, STR_DOUBLECLICKWIDTH, wParam);
02277 fWriteAllowed = fWinIniChanged;
02278 }
02279
if (fWriteAllowed) {
02280
SYSMET(CXDOUBLECLK) = wParam;
02281 }
02282
break;
02283
02284
case SPI_SETDOUBLECLKHEIGHT:
02285
if (fAlterWinIni) {
02286 fWinIniChanged =
UpdateWinIniInt(NULL, PMAP_MOUSE, STR_DOUBLECLICKHEIGHT, wParam);
02287 fWriteAllowed = fWinIniChanged;
02288 }
02289
if (fWriteAllowed) {
02290
SYSMET(CYDOUBLECLK) = wParam;
02291 }
02292
break;
02293
02294
case SPI_GETICONTITLELOGFONT:
02295 GreExtGetObjectW(ghIconFont,
sizeof(LOGFONTW), lParam);
02296
break;
02297
02298
case SPI_SETICONTITLELOGFONT:
02299 {
02300
if (lParam !=
NULL) {
02301
if (wParam !=
sizeof(LOGFONTW))
02302
return FALSE;
02303 }
else if (wParam) {
02304
return FALSE;
02305 }
02306
02307 pProfileUserName =
CreateProfileUserName(&tlName);
02308 fWinIniChanged =
xxxSetSPIMetrics(pProfileUserName, wFlag, lParam, fAlterWinIni);
02309
FreeProfileUserName(pProfileUserName, &tlName);
02310
if (fAlterWinIni) {
02311 fWriteAllowed = fWinIniChanged;
02312 }
02313
break;
02314 }
02315
02316
case SPI_SETDOUBLECLICKTIME:
02317
if (fAlterWinIni) {
02318 fWinIniChanged =
UpdateWinIniInt(NULL,PMAP_MOUSE, STR_DBLCLKSPEED, wParam);
02319 fWriteAllowed = fWinIniChanged;
02320 }
02321
if (fWriteAllowed) {
02322
_SetDoubleClickTime((UINT)wParam);
02323 }
02324
break;
02325
02326
case SPI_GETANIMATION: {
02327 LPANIMATIONINFO lpai = (LPANIMATIONINFO) lParam;
02328
02329
if (lpai ==
NULL || (wParam !=
sizeof(ANIMATIONINFO)))
02330
return(
FALSE);
02331
02332 lpai->cbSize =
sizeof(ANIMATIONINFO);
02333 lpai->iMinAnimate =
TEST_BOOL_PUDF(PUDF_ANIMATE);
02334
02335
break;
02336 }
02337
02338
case SPI_GETNONCLIENTMETRICS: {
02339 LPNONCLIENTMETRICS lpnc = (LPNONCLIENTMETRICS) lParam;
02340
if (lpnc ==
NULL)
02341
return FALSE;
02342
02343
GetWindowNCMetrics(lpnc);
02344
break;
02345 }
02346
02347
case SPI_GETMINIMIZEDMETRICS: {
02348 LPMINIMIZEDMETRICS lpmin = (LPMINIMIZEDMETRICS)lParam;
02349
02350 lpmin->cbSize =
sizeof(MINIMIZEDMETRICS);
02351
02352 lpmin->iWidth =
SYSMET(CXMINIMIZED) - 2*
SYSMET(CXFIXEDFRAME);
02353 lpmin->iHorzGap =
SYSMET(CXMINSPACING) -
SYSMET(CXMINIMIZED);
02354 lpmin->iVertGap =
SYSMET(CYMINSPACING) -
SYSMET(CYMINIMIZED);
02355 lpmin->iArrange =
SYSMET(ARRANGE);
02356
02357
break;
02358 }
02359
02360
case SPI_GETICONMETRICS: {
02361 LPICONMETRICS lpicon = (LPICONMETRICS)lParam;
02362
02363 lpicon->cbSize =
sizeof(ICONMETRICS);
02364
02365 lpicon->iHorzSpacing =
SYSMET(CXICONSPACING);
02366 lpicon->iVertSpacing =
SYSMET(CYICONSPACING);
02367 lpicon->iTitleWrap =
TEST_BOOL_PUDF(PUDF_ICONTITLEWRAP);
02368 GreExtGetObjectW(ghIconFont,
sizeof(LOGFONTW), &(lpicon->lfFont));
02369
02370
break;
02371 }
02372
02373
case SPI_SETANIMATION:
02374
case SPI_SETNONCLIENTMETRICS:
02375
case SPI_SETICONMETRICS:
02376
case SPI_SETMINIMIZEDMETRICS:
02377 {
02378 fWinIniChanged =
xxxSetSPIMetrics(NULL, wFlag, lParam, fAlterWinIni);
02379
if (fAlterWinIni) {
02380 fWriteAllowed = fWinIniChanged;
02381 }
02382
ServerLoadString(hModuleWin, STR_METRICS, szSection,
ARRAY_SIZE(szSection));
02383
break;
02384 }
02385
case SPI_SETMOUSEBUTTONSWAP:
02386
if (fAlterWinIni) {
02387 fWinIniChanged =
UpdateWinIniInt(NULL, PMAP_MOUSE, STR_SWAPBUTTONS, wParam);
02388 fWriteAllowed = fWinIniChanged;
02389 }
02390
if (fWriteAllowed) {
02391
_SwapMouseButton((wParam != 0));
02392 }
02393
break;
02394
02395
case SPI_GETFASTTASKSWITCH:
02396 *((
PINT)lParam) =
TRUE;
02397
02398
case SPI_SETFASTTASKSWITCH:
02399 RIPMSG0(RIP_WARNING,
"SPI_SETFASTTASKSWITCH and SPI_GETFASTTASKSWITCH are obsolete actions.");
02400
break;
02401
02402
case SPI_GETWORKAREA:
02403
CopyRect((LPRECT)lParam, &
GetPrimaryMonitor()->rcWork);
02404
break;
02405
02406
case SPI_SETWORKAREA:
02407 {
02408 RECT rcNewWork;
02409 LPRECT lprcNewWork;
02410
PMONITOR pMonitorWork;
02411
02412 lprcNewWork = (LPRECT)lParam;
02413
02414
02415
02416
02417
if ((lprcNewWork !=
NULL) &&
02418 ((lprcNewWork->right < lprcNewWork->left) ||
02419 (lprcNewWork->bottom < lprcNewWork->top))) {
02420
02421 RIPMSG0(RIP_WARNING,
"Bad work rectangle passed to SystemParametersInfo(SPI_SETWORKAREA, ...)\n");
02422
return FALSE;
02423 }
02424
02425
02426
02427
02428
if (!lprcNewWork) {
02429 pMonitorWork =
GetPrimaryMonitor();
02430 lprcNewWork = &pMonitorWork->
rcMonitor;
02431 }
else {
02432 pMonitorWork =
_MonitorFromRect(lprcNewWork, MONITOR_DEFAULTTOPRIMARY);
02433 }
02434
02435
02436
02437
02438
if (!
IntersectRect(&rcNewWork, lprcNewWork, &pMonitorWork->
rcMonitor) ||
02439 !
EqualRect(&rcNewWork, lprcNewWork))
02440 {
02441
02442
02443
02444 RIPERR4(
02445 ERROR_INVALID_PARAMETER,
02446 RIP_WARNING,
02447
"Bad work rectangle passed to SystemParametersInfo(SPI_SETWORKAREA, ...) %d, %d, %d, %d",
02448 lprcNewWork->left, lprcNewWork->top, lprcNewWork->right, lprcNewWork->bottom);
02449
return FALSE;
02450 }
02451
02452
if (!
EqualRect(&pMonitorWork->
rcWork, &rcNewWork))
02453 {
02454
PMONITORRECTS pmr;
02455
02456
02457
02458
02459
02460
if (wParam) {
02461 pmr =
SnapshotMonitorRects();
02462
if (!pmr) {
02463
return FALSE;
02464 }
02465 }
02466
02467 pMonitorWork->
rcWork = rcNewWork;
02468
if (pMonitorWork ==
GetPrimaryMonitor()) {
02469
SetDesktopMetrics();
02470 }
02471
02472
02473
02474
02475
02476
if (wParam) {
02477
02478
TL tlPool;
02479
02480
ThreadLockPool(
PtiCurrent(), pmr, &tlPool);
02481
xxxDesktopRecalc(pmr);
02482
ThreadUnlockAndFreePool(
PtiCurrent(), &tlPool);
02483 }
02484
02485 fWinIniChanged =
TRUE;
02486 }
02487
02488 fWriteAllowed =
TRUE;
02489
break;
02490 }
02491
02492
case SPI_SETDRAGFULLWINDOWS:
02493 wParam = (wParam == 1);
02494
if (fAlterWinIni) {
02495 fWinIniChanged =
UpdateWinIniInt(NULL, PMAP_DESKTOP, STR_DRAGFULLWINDOWS, wParam);
02496 fWriteAllowed = fWinIniChanged;
02497 }
02498
if (fWriteAllowed) {
02499
SET_OR_CLEAR_PUDF(PUDF_DRAGFULLWINDOWS, wParam);
02500 }
02501
break;
02502
02503
case SPI_GETDRAGFULLWINDOWS:
02504 *((
PINT)lParam) =
TEST_BOOL_PUDF(PUDF_DRAGFULLWINDOWS);
02505
break;
02506
02507
case SPI_GETFILTERKEYS:
02508 {
02509 LPFILTERKEYS pFK = (LPFILTERKEYS)lParam;
02510
int cbSkip =
sizeof(
gFilterKeys.cbSize);
02511
02512
if ((wParam != 0) && (wParam !=
sizeof(FILTERKEYS))) {
02513
return FALSE;
02514 }
02515
if (!pFK || (pFK->cbSize !=
sizeof(FILTERKEYS))) {
02516
return FALSE;
02517 }
02518
02519
02520
02521
02522 RtlCopyMemory((LPVOID)((LPBYTE)pFK + cbSkip),
02523 (LPVOID)((LPBYTE)&gFilterKeys + cbSkip),
02524 pFK->cbSize - cbSkip);
02525 }
02526
break;
02527
02528
case SPI_SETFILTERKEYS:
02529 {
02530 LPFILTERKEYS pFK = (LPFILTERKEYS)lParam;
02531
02532
if ((wParam != 0) && (wParam !=
sizeof(FILTERKEYS))) {
02533
return FALSE;
02534 }
02535
if (!pFK || (pFK->cbSize !=
sizeof(FILTERKEYS)))
02536
return FALSE;
02537
02538
02539
02540
02541
if (pFK->iWaitMSec && pFK->iBounceMSec) {
02542
return FALSE;
02543 }
02544
02545
02546
02547
02548
02549
if ((pFK->dwFlags & FKF_VALID) != pFK->dwFlags) {
02550
return FALSE;
02551 }
02552
02553
02554
02555
if (
TEST_ACCESSFLAG(FilterKeys, FKF_AVAILABLE)) {
02556 pFK->dwFlags |= FKF_AVAILABLE;
02557 }
else {
02558 pFK->dwFlags &= ~FKF_AVAILABLE;
02559 }
02560
if ((pFK->iWaitMSec > 2000) ||
02561 (pFK->iDelayMSec > 2000) ||
02562 (pFK->iRepeatMSec > 2000) ||
02563 (pFK->iBounceMSec > 2000)) {
02564
return FALSE;
02565 }
02566
02567
if (fAlterWinIni) {
02568 pProfileUserName =
CreateProfileUserName(&tlName);
02569 fWinIniChanged =
SetFilterKeys(pProfileUserName, pFK);
02570 fWriteAllowed = fWinIniChanged;
02571
if (!fWinIniChanged) {
02572
02573
02574
02575
02576
SetFilterKeys(pProfileUserName, &gFilterKeys);
02577 }
02578
FreeProfileUserName(pProfileUserName, &tlName);
02579 }
02580
if (fWriteAllowed) {
02581 RtlCopyMemory(&gFilterKeys, pFK, pFK->cbSize);
02582
02583
02584
02585
02586
gFilterKeys.cbSize =
sizeof(FILTERKEYS);
02587
02588
if (!
TEST_ACCESSFLAG(FilterKeys, FKF_FILTERKEYSON)) {
02589
StopFilterKeysTimers();
02590 }
02591
SetAccessEnabledFlag();
02592
if (
FCallHookTray())
02593
xxxCallHook(HSHELL_ACCESSIBILITYSTATE,
02594 ACCESS_FILTERKEYS,
02595 (LONG)0,
02596 WH_SHELL);
02597
PostShellHookMessages(HSHELL_ACCESSIBILITYSTATE, ACCESS_FILTERKEYS);
02598 }
02599 }
02600
break;
02601
02602
case SPI_GETSTICKYKEYS:
02603 {
02604 LPSTICKYKEYS pSK = (LPSTICKYKEYS)lParam;
02605
int cbSkip =
sizeof(
gStickyKeys.cbSize);
02606
02607
if ((wParam != 0) && (wParam !=
sizeof(STICKYKEYS))) {
02608
return FALSE;
02609 }
02610
if (!pSK || (pSK->cbSize !=
sizeof(STICKYKEYS))) {
02611
return FALSE;
02612 }
02613
02614
02615
02616
02617 RtlCopyMemory((LPVOID)((LPBYTE)pSK + cbSkip),
02618 (LPVOID)((LPBYTE)&gStickyKeys + cbSkip),
02619 pSK->cbSize - cbSkip);
02620
02621 pSK->dwFlags &= ~SKF_STATEINFO;
02622 pSK->dwFlags |= (
gLatchBits&0xff) <<24;
02623
02624
#if SKF_LALTLATCHED != 0x10000000
02625
#error SKF_LALTLATCHED value is incorrect
02626
#endif
02627
#if SKF_LCTLLATCHED != 0x04000000
02628
#error SKF_LCTLLATCHED value is incorrect
02629
#endif
02630
#if SKF_LSHIFTLATCHED != 0x01000000
02631
#error SKF_LSHIFTLATCHED value is incorrect
02632
#endif
02633
#if SKF_RALTLATCHED != 0x20000000
02634
#error SKF_RALTLATCHED value is incorrect
02635
#endif
02636
#if SKF_RCTLLATCHED != 0x08000000
02637
#error SKF_RCTLLATCHED value is incorrect
02638
#endif
02639
#if SKF_RSHIFTLATCHED != 0x02000000
02640
#error SKF_RSHIFTLATCHED value is incorrect
02641
#endif
02642
pSK->dwFlags |= (
gLockBits&0xff) <<16;
02643
#if SKF_LALTLOCKED != 0x00100000
02644
#error SKF_LALTLOCKED value is incorrect
02645
#endif
02646
#if SKF_LCTLLOCKED != 0x00040000
02647
#error SKF_LCTLLOCKED value is incorrect
02648
#endif
02649
#if SKF_LSHIFTLOCKED != 0x00010000
02650
#error SKF_LSHIFTLOCKED value is incorrect
02651
#endif
02652
#if SKF_RALTLOCKED != 0x00200000
02653
#error SKF_RALTLOCKED value is incorrect
02654
#endif
02655
#if SKF_RCTLLOCKED != 0x00080000
02656
#error SKF_RCTLLOCKED value is incorrect
02657
#endif
02658
#if SKF_RSHIFTLOCKED != 0x00020000
02659
#error SKF_RSHIFTLOCKED value is incorrect
02660
#endif
02661
02662 }
02663
02664
break;
02665
02666
case SPI_SETSTICKYKEYS:
02667 {
02668 LPSTICKYKEYS pSK = (LPSTICKYKEYS)lParam;
02669
BOOL fWasOn;
02670
02671 fWasOn =
TEST_BOOL_ACCESSFLAG(StickyKeys, SKF_STICKYKEYSON);
02672
if ((wParam != 0) && (wParam !=
sizeof(STICKYKEYS))) {
02673
return FALSE;
02674 }
02675
if (!pSK || (pSK->cbSize !=
sizeof(STICKYKEYS)))
02676
return FALSE;
02677
02678 pSK->dwFlags &= ~SKF_STATEINFO;
02679
02680
02681
02682
02683
02684
02685
02686
if ((pSK->dwFlags & SKF_VALID) != pSK->dwFlags) {
02687
return FALSE;
02688 }
02689
02690
02691
02692
if (
TEST_ACCESSFLAG(StickyKeys, SKF_AVAILABLE)) {
02693 pSK->dwFlags |= SKF_AVAILABLE;
02694 }
else {
02695 pSK->dwFlags &= ~SKF_AVAILABLE;
02696 }
02697
02698
if (fAlterWinIni) {
02699 swprintf(szTemp, pwszd, pSK->dwFlags);
02700 fWinIniChanged =
FastWriteProfileStringW(NULL,
02701 PMAP_STICKYKEYS,
02702 L
"Flags",
02703 szTemp
02704 );
02705 fWriteAllowed = fWinIniChanged;
02706 }
02707
if (fWriteAllowed) {
02708 RtlCopyMemory(&gStickyKeys, pSK, pSK->cbSize);
02709
02710
02711
02712
02713
gStickyKeys.cbSize =
sizeof(STICKYKEYS);
02714
if (!
TEST_ACCESSFLAG(StickyKeys, SKF_STICKYKEYSON) && fWasOn) {
02715
xxxTurnOffStickyKeys();
02716 }
02717
02718
SetAccessEnabledFlag();
02719
if (
FCallHookTray())
02720
xxxCallHook(HSHELL_ACCESSIBILITYSTATE,
02721 ACCESS_STICKYKEYS,
02722 (LONG)0,
02723 WH_SHELL);
02724
PostShellHookMessages(HSHELL_ACCESSIBILITYSTATE, ACCESS_STICKYKEYS);
02725 }
02726 }
02727
break;
02728
02729
case SPI_GETTOGGLEKEYS:
02730 {
02731 LPTOGGLEKEYS pTK = (LPTOGGLEKEYS)lParam;
02732
int cbSkip =
sizeof(
gToggleKeys.cbSize);
02733
02734
if ((wParam != 0) && (wParam !=
sizeof(TOGGLEKEYS))) {
02735
return FALSE;
02736 }
02737
if (!pTK || (pTK->cbSize !=
sizeof(TOGGLEKEYS))) {
02738
return FALSE;
02739 }
02740
02741
02742
02743
02744 RtlCopyMemory((LPVOID)((LPBYTE)pTK + cbSkip),
02745 (LPVOID)((LPBYTE)&gToggleKeys + cbSkip),
02746 pTK->cbSize - cbSkip);
02747 }
02748
break;
02749
02750
case SPI_SETTOGGLEKEYS:
02751 {
02752 LPTOGGLEKEYS pTK = (LPTOGGLEKEYS)lParam;
02753
02754
if ((wParam != 0) && (wParam !=
sizeof(TOGGLEKEYS))) {
02755
return FALSE;
02756 }
02757
if (!pTK || (pTK->cbSize !=
sizeof(TOGGLEKEYS)))
02758
return FALSE;
02759
02760
02761
02762
02763
02764
if ((pTK->dwFlags & TKF_VALID) != pTK->dwFlags) {
02765
return FALSE;
02766 }
02767
02768
02769
02770
if (
TEST_ACCESSFLAG(ToggleKeys, TKF_AVAILABLE)) {
02771 pTK->dwFlags |= TKF_AVAILABLE;
02772 }
else {
02773 pTK->dwFlags &= ~TKF_AVAILABLE;
02774 }
02775
02776
if (fAlterWinIni) {
02777 swprintf(szTemp, pwszd, pTK->dwFlags);
02778 fWinIniChanged =
FastWriteProfileStringW(NULL,
02779 PMAP_TOGGLEKEYS,
02780 L
"Flags",
02781 szTemp
02782 );
02783 fWriteAllowed = fWinIniChanged;
02784 }
02785
if (fWriteAllowed) {
02786 RtlCopyMemory(&gToggleKeys, pTK, pTK->cbSize);
02787
02788
02789
02790
02791
gToggleKeys.cbSize =
sizeof(TOGGLEKEYS);
02792
02793
SetAccessEnabledFlag();
02794 }
02795 }
02796
break;
02797
02798
case SPI_GETMOUSEKEYS:
02799 {
02800 LPMOUSEKEYS pMK = (LPMOUSEKEYS)lParam;
02801
int cbSkip =
sizeof(
gMouseKeys.cbSize);
02802
02803
if ((wParam != 0) && (wParam !=
sizeof(MOUSEKEYS))) {
02804
return FALSE;
02805 }
02806
if (!pMK || (pMK->cbSize !=
sizeof(MOUSEKEYS))) {
02807
return FALSE;
02808 }
02809
02810
02811
02812
02813 RtlCopyMemory((LPVOID)((LPBYTE)pMK + cbSkip),
02814 (LPVOID)((LPBYTE)&gMouseKeys + cbSkip),
02815 pMK->cbSize - cbSkip);
02816
02817
02818 pMK->dwFlags &= ~MKF_STATEINFO;
02819
02820
if (
gbMKMouseMode) pMK->dwFlags |= MKF_MOUSEMODE;
02821
02822 pMK->dwFlags |= (
gwMKButtonState & 3) << 24;
02823
#if MOUSE_BUTTON_LEFT != 0x01
02824
#error MOUSE_BUTTON_LEFT value is incorrect
02825
#endif
02826
#if MOUSE_BUTTON_RIGHT != 0x02
02827
#error MOUSE_BUTTON_RIGHT value is incorrect
02828
#endif
02829
#if MKF_LEFTBUTTONDOWN != 0x01000000
02830
#error MKF_LEFTBUTTONDOWN value is incorrect
02831
#endif
02832
#if MKF_RIGHTBUTTONDOWN != 0x02000000
02833
#error MKF_RIGHTBUTTONDOWN value is incorrect
02834
#endif
02835
02836 pMK->dwFlags |= (
gwMKCurrentButton & 3)<< 28;
02837
#if MKF_LEFTBUTTONSEL != 0x10000000
02838
#error MKF_LEFTBUTTONSEL value is incorrect
02839
#endif
02840
#if MKF_RIGHTBUTTONSEL != 0x20000000
02841
#error MKF_RIGHTBUTTONSEL value is incorrect
02842
#endif
02843
}
02844
break;
02845
02846
case SPI_SETMOUSEKEYS: {
02847 LPMOUSEKEYS pMK = (LPMOUSEKEYS)lParam;
02848
02849
if ((wParam != 0) && (wParam !=
sizeof(MOUSEKEYS))) {
02850
return FALSE;
02851 }
02852
if (!pMK || (pMK->cbSize !=
sizeof(MOUSEKEYS)))
02853
return FALSE;
02854
02855
02856
02857
02858
02859 pMK->dwFlags &= ~MKF_STATEINFO;
02860
02861
02862
02863
if ((pMK->dwFlags & MKF_VALID) != pMK->dwFlags) {
02864
return FALSE;
02865 }
02866
02867
02868
02869
if (
TEST_ACCESSFLAG(MouseKeys, MKF_AVAILABLE)) {
02870 pMK->dwFlags |= MKF_AVAILABLE;
02871 }
else {
02872 pMK->dwFlags &= ~MKF_AVAILABLE;
02873 }
02874
if ((pMK->iMaxSpeed < 10) || (pMK->iMaxSpeed > 360)) {
02875
return FALSE;
02876 }
02877
if ((pMK->iTimeToMaxSpeed < 1000) || (pMK->iTimeToMaxSpeed > 5000)) {
02878
return FALSE;
02879 }
02880
02881
if (fAlterWinIni) {
02882 pProfileUserName =
CreateProfileUserName(&tlName);
02883 fWinIniChanged =
SetMouseKeys(pProfileUserName, pMK);
02884 fWriteAllowed = fWinIniChanged;
02885
if (!fWinIniChanged) {
02886
02887
02888
02889
02890
SetMouseKeys(pProfileUserName, &gMouseKeys);
02891 }
02892
FreeProfileUserName(pProfileUserName, &tlName);
02893 }
02894
if (fWriteAllowed) {
02895 RtlCopyMemory(&gMouseKeys, pMK, pMK->cbSize);
02896
02897
02898
02899
02900
gMouseKeys.cbSize =
sizeof(MOUSEKEYS);
02901
02902
CalculateMouseTable();
02903
02904
if (
TEST_ACCESSFLAG(MouseKeys, MKF_MOUSEKEYSON)) {
02905
if ((
TestAsyncKeyStateToggle(gNumLockVk) != 0) ^
02906 (
TEST_ACCESSFLAG(MouseKeys, MKF_REPLACENUMBERS) != 0))
02907
gbMKMouseMode =
TRUE;
02908
else
02909
gbMKMouseMode =
FALSE;
02910
MKShowMouseCursor();
02911 }
else {
02912
MKHideMouseCursor();
02913 }
02914
02915
SetAccessEnabledFlag();
02916
02917
if (
FCallHookTray())
02918
xxxCallHook(HSHELL_ACCESSIBILITYSTATE,
02919 ACCESS_MOUSEKEYS,
02920 (LONG)0,
02921 WH_SHELL);
02922
PostShellHookMessages(HSHELL_ACCESSIBILITYSTATE, ACCESS_MOUSEKEYS);
02923 }
02924 }
02925
break;
02926
02927
case SPI_GETHIGHCONTRAST:
02928 {
02929 LPHIGHCONTRAST pHC = (LPHIGHCONTRAST)lParam;
02930
02931
02932
02933
02934
02935
02936 pHC->dwFlags =
gHighContrast.dwFlags;
02937
02938
02939
02940
02941
02942
try {
02943 RtlCopyMemory(pHC->lpszDefaultScheme, gHighContrastDefaultScheme, MAX_SCHEME_NAME_SIZE *
sizeof(WCHAR));
02944 } except (W32ExceptionHandler(FALSE, RIP_WARNING)) {
02945 }
02946 }
02947
02948
break;
02949
02950
case SPI_SETHIGHCONTRAST:
02951 {
02952
LPINTERNALSETHIGHCONTRAST pHC = (
LPINTERNALSETHIGHCONTRAST)lParam;
02953 WCHAR wcDefaultScheme[MAX_SCHEME_NAME_SIZE];
02954
02955
if (pHC->
usDefaultScheme.Length >= MAX_SCHEME_NAME_SIZE*
sizeof(WCHAR) )
02956
return FALSE;
02957
02958
if (pHC->
usDefaultScheme.Buffer) {
02959
02960
02961
02962
02963
02964
02965
try {
02966 RtlCopyMemory(wcDefaultScheme, pHC->
usDefaultScheme.Buffer, pHC->
usDefaultScheme.Length);
02967 } except (W32ExceptionHandler(TRUE, RIP_WARNING)) {
02968
return FALSE;
02969 }
02970 }
02971 wcDefaultScheme[pHC->
usDefaultScheme.Length /
sizeof(WCHAR)] = 0;
02972
02973
if (fAlterWinIni) {
02974 pProfileUserName =
CreateProfileUserName(&tlName);
02975 swprintf(szTemp, pwszd, pHC->
dwFlags);
02976 fWinIniChanged =
FastWriteProfileStringW(pProfileUserName,
02977 PMAP_HIGHCONTRAST,
02978 L
"Flags",
02979 szTemp
02980 );
02981
02982 fWriteAllowed = fWinIniChanged;
02983
02984
02985
02986
02987
02988
if (pHC->
usDefaultScheme.Buffer) {
02989 fWinIniChanged |=
FastWriteProfileStringW(pProfileUserName,
02990 PMAP_HIGHCONTRAST,
02991 TEXT(
"High Contrast Scheme"),
02992 wcDefaultScheme
02993 );
02994 }
02995
FreeProfileUserName(pProfileUserName, &tlName);
02996
02997 }
02998
if (fWriteAllowed) {
02999
DWORD dwFlagsOld =
gHighContrast.dwFlags;
03000 LPARAM lp = fAlterWinIni?0:ACCESS_HIGHCONTRASTNOREG;
03001
03002
#if (ACCESS_HIGHCONTRASTNOREG | ACCESS_HIGHCONTRASTOFF) != ACCESS_HIGHCONTRASTOFFNOREG
03003
#error ACCESS_HIGHCONTRASTOFF value is incorrect
03004
#endif
03005
#if (ACCESS_HIGHCONTRASTNOREG | ACCESS_HIGHCONTRASTON) != ACCESS_HIGHCONTRASTONNOREG
03006
#error ACCESS_HIGHCONTRASTON value is incorrect
03007
#endif
03008
#if (ACCESS_HIGHCONTRASTNOREG | ACCESS_HIGHCONTRASTCHANGE) != ACCESS_HIGHCONTRASTCHANGENOREG
03009
#error ACCESS_HIGHCONTRASTCHANGE value is incorrect
03010
#endif
03011
03012
03013
03014
03015
03016
03017
if (pHC->
usDefaultScheme.Buffer)
03018 wcscpy(gHighContrastDefaultScheme, wcDefaultScheme);
03019
03020
gHighContrast.dwFlags = pHC->
dwFlags;
03021
03022
03023
03024
03025
03026
if (pHC->
dwFlags & HCF_HIGHCONTRASTON) {
03027
_PostMessage(gspwndLogonNotify, WM_LOGONNOTIFY, LOGON_ACCESSNOTIFY,
03028 (dwFlagsOld & HCF_HIGHCONTRASTON)? (ACCESS_HIGHCONTRASTCHANGE | lp):
03029 (ACCESS_HIGHCONTRASTON | lp));
03030 }
else {
03031
_PostMessage(gspwndLogonNotify, WM_LOGONNOTIFY, LOGON_ACCESSNOTIFY, ACCESS_HIGHCONTRASTOFF | lp);
03032 }
03033
03034 }
03035
break;
03036 }
03037
03038
case SPI_GETACCESSTIMEOUT:
03039 {
03040 LPACCESSTIMEOUT pTO = (LPACCESSTIMEOUT)lParam;
03041
int cbSkip =
sizeof(
gAccessTimeOut.cbSize);
03042
03043
if ((wParam != 0) && (wParam !=
sizeof(ACCESSTIMEOUT))) {
03044
return FALSE;
03045 }
03046
if (!pTO || (pTO->cbSize !=
sizeof(ACCESSTIMEOUT))) {
03047
return FALSE;
03048 }
03049
03050
03051
03052
03053 RtlCopyMemory((LPVOID)((LPBYTE)pTO + cbSkip),
03054 (LPVOID)((LPBYTE)&gAccessTimeOut + cbSkip),
03055 pTO->cbSize - cbSkip);
03056 }
03057
break;
03058
03059
case SPI_SETACCESSTIMEOUT:
03060 {
03061 LPACCESSTIMEOUT pTO = (LPACCESSTIMEOUT)lParam;
03062
03063
if ((wParam != 0) && (wParam !=
sizeof(ACCESSTIMEOUT))) {
03064
return FALSE;
03065 }
03066
if (!pTO || (pTO->cbSize !=
sizeof(ACCESSTIMEOUT)))
03067
return FALSE;
03068
03069
03070
03071
03072
03073
if ((pTO->dwFlags & ATF_VALID) != pTO->dwFlags) {
03074
return FALSE;
03075 }
03076
if (pTO->iTimeOutMSec > 3600000) {
03077
return FALSE;
03078 }
03079
03080
if (fAlterWinIni) {
03081 pProfileUserName =
CreateProfileUserName(&tlName);
03082 swprintf(szTemp, pwszd, pTO->dwFlags);
03083 fWinIniChanged =
FastWriteProfileStringW(pProfileUserName,
03084 PMAP_TIMEOUT,
03085 L
"Flags",
03086 szTemp
03087 );
03088
03089 swprintf(szTemp, pwszd, pTO->iTimeOutMSec);
03090 fWinIniChanged =
FastWriteProfileStringW(pProfileUserName,
03091 PMAP_TIMEOUT,
03092 L
"TimeToWait",
03093 szTemp
03094 );
03095
03096 fWriteAllowed = fWinIniChanged;
03097
if (!fWinIniChanged) {
03098
03099
03100
03101
03102 swprintf(szTemp, pwszd,
gAccessTimeOut.dwFlags);
03103 fWinIniChanged =
FastWriteProfileStringW(pProfileUserName,
03104 PMAP_TIMEOUT,
03105 L
"Flags",
03106 szTemp
03107 );
03108
03109 swprintf(szTemp, pwszd,
gAccessTimeOut.iTimeOutMSec);
03110 fWinIniChanged =
FastWriteProfileStringW(pProfileUserName,
03111 PMAP_TIMEOUT,
03112 L
"TimeToWait",
03113 szTemp
03114 );
03115 }
03116
FreeProfileUserName(pProfileUserName, &tlName);
03117 }
03118
if (fWriteAllowed) {
03119 RtlCopyMemory(&gAccessTimeOut, pTO, pTO->cbSize);
03120
03121
03122
03123
03124
gAccessTimeOut.cbSize =
sizeof(ACCESSTIMEOUT);
03125
03126
SetAccessEnabledFlag();
03127
03128
AccessTimeOutReset();
03129 }
03130 }
03131
break;
03132
03133
case SPI_SETSHOWSOUNDS:
03134
if (fAlterWinIni) {
03135 swprintf(szTemp, pwszd, (wParam == 1));
03136 fWinIniChanged =
FastWriteProfileStringW(NULL,
03137 PMAP_SHOWSOUNDS,
03138 L
"On",
03139 szTemp
03140 );
03141
03142 fWriteAllowed = fWinIniChanged;
03143 }
03144
if (fWriteAllowed) {
03145
SET_OR_CLEAR_ACCF(ACCF_SHOWSOUNDSON, wParam == 1);
03146
SetAccessEnabledFlag();
03147
03148
03149
03150
03151
SYSMET(SHOWSOUNDS) =
TEST_BOOL_ACCF(ACCF_SHOWSOUNDSON);
03152 }
03153
break;
03154
03155
case SPI_GETSHOWSOUNDS: {
03156
PINT pint = (
int *)lParam;
03157
03158 *pint =
TEST_BOOL_ACCF(ACCF_SHOWSOUNDSON);
03159 }
03160
break;
03161
03162
case SPI_GETKEYBOARDPREF:
03163 {
03164 PBOOL pfKeyboardPref = (PBOOL)lParam;
03165
03166 *pfKeyboardPref =
TEST_BOOL_ACCF(ACCF_KEYBOARDPREF);
03167 }
03168
break;
03169
03170
case SPI_SETKEYBOARDPREF:
03171 {
03172
BOOL fKeyboardPref = (
BOOL)wParam;
03173
03174
if (fAlterWinIni) {
03175 fWinIniChanged =
FastWriteProfileStringW(NULL,
03176 PMAP_KEYBOARDPREF,
03177 L
"On",
03178 (fKeyboardPref) ? L
"1" : L
"0"
03179 );
03180
03181 fWriteAllowed = fWinIniChanged;
03182 }
03183
if (fWriteAllowed)
03184 {
03185
SET_OR_CLEAR_ACCF(ACCF_KEYBOARDPREF, wParam);
03186 }
03187 }
03188
break;
03189
03190
case SPI_GETSCREENREADER:
03191 {
03192 PBOOL pfScreenReader = (PBOOL)lParam;
03193
03194 *pfScreenReader =
TEST_BOOL_ACCF(ACCF_SCREENREADER);
03195 }
03196
break;
03197
03198
case SPI_SETSCREENREADER:
03199 {
03200
BOOL fScreenReader = (
BOOL)wParam;
03201
03202
if (fAlterWinIni) {
03203 fWinIniChanged =
FastWriteProfileStringW(NULL,
03204 PMAP_SCREENREADER,
03205 L
"On",
03206 (fScreenReader) ? L
"1" : L
"0"
03207 );
03208 fWriteAllowed = fWinIniChanged;
03209 }
03210
if (fWriteAllowed)
03211 {
03212
SET_OR_CLEAR_ACCF(ACCF_SCREENREADER, wParam);
03213 }
03214 }
03215
break;
03216
03217
case SPI_GETSOUNDSENTRY:
03218 {
03219 LPSOUNDSENTRY pSS = (LPSOUNDSENTRY)lParam;
03220
int cbSkip =
sizeof(
gSoundSentry.cbSize);
03221
03222
if ((wParam != 0) && (wParam !=
sizeof(SOUNDSENTRY))) {
03223
return FALSE;
03224 }
03225
if (!pSS || (pSS->cbSize !=
sizeof(SOUNDSENTRY))) {
03226
return FALSE;
03227 }
03228
03229
03230
03231
03232 RtlCopyMemory((LPVOID)((LPBYTE)pSS + cbSkip),
03233 (LPVOID)((LPBYTE)&gSoundSentry + cbSkip),
03234 pSS->cbSize - cbSkip);
03235 }
03236
break;
03237
03238
case SPI_SETSOUNDSENTRY:
03239 {
03240 LPSOUNDSENTRY pSS = (LPSOUNDSENTRY)lParam;
03241
03242
if ((wParam != 0) && (wParam !=
sizeof(SOUNDSENTRY))) {
03243
return FALSE;
03244 }
03245
if (!pSS || (pSS->cbSize !=
sizeof(SOUNDSENTRY)))
03246
return FALSE;
03247
03248
03249
03250
03251
03252
if ((pSS->dwFlags & SSF_VALID) != pSS->dwFlags) {
03253
return FALSE;
03254 }
03255
03256
03257
03258
if (pSS->iWindowsEffect > SSWF_DISPLAY) {
03259
return FALSE;
03260 }
03261
03262
03263
03264
if (pSS->iFSTextEffect != SSTF_NONE) {
03265
return FALSE;
03266 }
03267
if (pSS->iFSGrafEffect != SSGF_NONE) {
03268
return FALSE;
03269 }
03270
03271
03272
03273
if (
TEST_ACCESSFLAG(SoundSentry, SSF_AVAILABLE)) {
03274 pSS->dwFlags |= SSF_AVAILABLE;
03275 }
else {
03276 pSS->dwFlags &= ~SSF_AVAILABLE;
03277 }
03278
03279
if (fAlterWinIni) {
03280 pProfileUserName =
CreateProfileUserName(&tlName);
03281 fWinIniChanged =
SetSoundSentry(pProfileUserName, pSS);
03282 fWriteAllowed = fWinIniChanged;
03283
if (!fWinIniChanged) {
03284
03285
03286
03287
03288
SetSoundSentry(pProfileUserName, &gSoundSentry);
03289 }
03290
FreeProfileUserName(pProfileUserName, &tlName);
03291 }
03292
if (fWriteAllowed) {
03293 RtlCopyMemory(&gSoundSentry, pSS, pSS->cbSize);
03294
03295
03296
03297
03298
gSoundSentry.cbSize =
sizeof(SOUNDSENTRY);
03299
03300
SetAccessEnabledFlag();
03301 }
03302 }
03303
break;
03304
03305
case SPI_SETCURSORS:
03306 pProfileUserName =
CreateProfileUserName(&tlName);
03307
xxxUpdateSystemCursorsFromRegistry(pProfileUserName);
03308
FreeProfileUserName(pProfileUserName, &tlName);
03309
03310
break;
03311
03312
case SPI_SETICONS:
03313 pProfileUserName =
CreateProfileUserName(&tlName);
03314
xxxUpdateSystemIconsFromRegistry(pProfileUserName);
03315
FreeProfileUserName(pProfileUserName, &tlName);
03316
03317
break;
03318
03319
case SPI_GETMOUSEHOVERWIDTH:
03320 *((
UINT *)lParam) =
gcxMouseHover;
03321
break;
03322
03323
case SPI_SETMOUSEHOVERWIDTH:
03324
if (fAlterWinIni) {
03325 fWinIniChanged =
UpdateWinIniInt(NULL, PMAP_MOUSE, STR_MOUSEHOVERWIDTH, wParam);
03326 fWriteAllowed = fWinIniChanged;
03327 }
03328
if (fWriteAllowed) {
03329
gcxMouseHover = wParam;
03330 }
03331
break;
03332
03333
case SPI_GETMOUSEHOVERHEIGHT:
03334 *((
UINT *)lParam) =
gcyMouseHover;
03335
break;
03336
03337
case SPI_SETMOUSEHOVERHEIGHT:
03338
if (fAlterWinIni) {
03339 fWinIniChanged =
UpdateWinIniInt(NULL, PMAP_MOUSE, STR_MOUSEHOVERHEIGHT, wParam);
03340 fWriteAllowed = fWinIniChanged;
03341 }
03342
if (fWriteAllowed) {
03343
gcyMouseHover = wParam;
03344 }
03345
break;
03346
03347
case SPI_GETMOUSEHOVERTIME:
03348 *((
UINT *)lParam) =
gdtMouseHover;
03349
break;
03350
03351
case SPI_SETMOUSEHOVERTIME:
03352
if (fAlterWinIni) {
03353 fWinIniChanged =
UpdateWinIniInt(NULL, PMAP_MOUSE, STR_MOUSEHOVERTIME, wParam);
03354 fWriteAllowed = fWinIniChanged;
03355 }
03356
if (fWriteAllowed) {
03357
gdtMouseHover = wParam;
03358 }
03359
break;
03360
03361
case SPI_GETWHEELSCROLLLINES:
03362 (*(LPDWORD)lParam) =
gpsi->ucWheelScrollLines;
03363
break;
03364
03365
case SPI_SETWHEELSCROLLLINES:
03366
if (fAlterWinIni) {
03367 fWinIniChanged =
UpdateWinIniInt(NULL, PMAP_DESKTOP, STR_WHEELSCROLLLINES, wParam);
03368 fWriteAllowed = fWinIniChanged;
03369 }
03370
03371
if (fWriteAllowed)
03372
gpsi->ucWheelScrollLines = (
UINT)wParam;
03373
break;
03374
03375
case SPI_GETMENUSHOWDELAY:
03376 (*(LPDWORD)lParam) =
gdtMNDropDown;
03377
break;
03378
03379
case SPI_SETMENUSHOWDELAY:
03380
if (fAlterWinIni) {
03381 fWinIniChanged =
UpdateWinIniInt(NULL, PMAP_DESKTOP, STR_MENUSHOWDELAY, wParam);
03382 fWriteAllowed = fWinIniChanged;
03383 }
03384
if (fWriteAllowed)
03385
gdtMNDropDown = wParam;
03386
break;
03387
03388
case SPI_GETSCREENSAVERRUNNING:
03389 (*(LPBOOL)lParam) =
gppiScreenSaver !=
NULL;
03390
break;
03391
03392
case SPI_SETSHOWIMEUI:
03393
return xxxSetIMEShowStatus(!!wParam);
03394
03395
case SPI_GETSHOWIMEUI:
03396 (*(LPBOOL)lParam) =
_GetIMEShowStatus();
03397
break;
03398
03399
default:
03400
03401
#define ppvi (UPDWORDPointer(wFlag))
03402
#define uDataRead ((UINT)fWinIniChanged)
03403
03404
if (wFlag < SPI_MAX) {
03405 RIPERR1(ERROR_INVALID_SPI_VALUE, RIP_WARNING,
"xxxSystemParamtersInfo: Invalid SPI_:%#lx", wFlag);
03406
return FALSE;
03407 }
03408
03409 UserAssert(wFlag & SPIF_RANGETYPEMASK);
03410
03411
if (!(wFlag & SPIF_SET)) {
03412
03413
if ((wFlag & SPIF_RANGETYPEMASK) == SPIF_BOOL) {
03414
BOOL fDisable, fDisableValue;
03415
03416 UserAssert(
UPIsBOOLRange(wFlag));
03417
03418
03419
03420 fDisable = fDisableValue =
FALSE;
03421
if (wFlag < SPI_GETUIEFFECTS) {
03422
if (!
TestUP(UIEFFECTS)) {
03423
switch (wFlag) {
03424
case SPI_GETACTIVEWNDTRKZORDER:
03425
case SPI_GETACTIVEWINDOWTRACKING:
03426
break;
03427
03428
case SPI_GETKEYBOARDCUES:
03429 fDisableValue =
TRUE;
03430
03431
03432
default:
03433 fDisable =
TRUE;
03434
break;
03435 }
03436 }
else {
03437
switch (wFlag) {
03438
case SPI_GETKEYBOARDCUES:
03439
if (
TEST_BOOL_ACCF(ACCF_KEYBOARDPREF)) {
03440 fDisableValue =
TRUE;
03441 fDisable =
TRUE;
03442 }
03443
break;
03444
03445
case SPI_GETGRADIENTCAPTIONS:
03446
case SPI_GETSELECTIONFADE:
03447
case SPI_GETMENUFADE:
03448
case SPI_GETTOOLTIPFADE:
03449
case SPI_GETCURSORSHADOW:
03450
if (
gbDisableAlpha) {
03451 fDisable =
TRUE;
03452 }
03453
break;
03454 }
03455 }
03456 }
03457
03458
03459
03460
if (fDisable) {
03461 *((
BOOL *)lParam) = fDisableValue;
03462 }
else {
03463 *((
BOOL *)lParam) = !!
TestUPBOOL(gpdwCPUserPreferencesMask, wFlag);
03464 }
03465 }
else {
03466 UserAssert(
UPIsDWORDRange(wFlag));
03467 *((
DWORD *)lParam) =
UPDWORDValue(wFlag);
03468 }
03469
03470 }
else {
03471 pProfileUserName =
CreateProfileUserName(&tlName);
03472
03473
if ((wFlag & SPIF_RANGETYPEMASK) == SPIF_BOOL) {
03474
DWORD pdwValue [SPI_BOOLMASKDWORDSIZE];
03475
03476 UserAssert(
UPIsBOOLRange(wFlag));
03477 UserAssert(
sizeof(pdwValue) ==
sizeof(gpdwCPUserPreferencesMask));
03478
03479
if (fAlterWinIni) {
03480
03481
03482
03483
03484
03485
03486
uDataRead =
FastGetProfileValue(pProfileUserName,
03487
gpviCPUserPreferences->
uSection,
03488
gpviCPUserPreferences->
pwszKeyName,
03489 NULL,
03490 (LPBYTE)pdwValue,
03491
sizeof(pdwValue)
03492 );
03493
03494
03495
03496
03497 UserAssert(uDataRead <=
sizeof(gpdwCPUserPreferencesMask));
03498 RtlCopyMemory(pdwValue + uDataRead,
03499 gpdwCPUserPreferencesMask + uDataRead,
03500
sizeof(gpdwCPUserPreferencesMask) - uDataRead);
03501
03502
03503
03504
03505
if (lParam) {
03506
SetUPBOOL(pdwValue, wFlag);
03507 }
else {
03508
ClearUPBOOL(pdwValue, wFlag);
03509 }
03510
03511 fWinIniChanged =
FastWriteProfileValue(pProfileUserName,
03512
gpviCPUserPreferences->
uSection,
03513
gpviCPUserPreferences->
pwszKeyName,
03514 REG_BINARY,
03515 (LPBYTE)pdwValue,
03516
sizeof(pdwValue)
03517 );
03518
03519 fWriteAllowed = fWinIniChanged;
03520 }
03521
03522
if (fWriteAllowed) {
03523
if (lParam) {
03524
SetUPBOOL(gpdwCPUserPreferencesMask, wFlag);
03525 }
else {
03526
ClearUPBOOL(gpdwCPUserPreferencesMask, wFlag);
03527 }
03528
03529
03530
03531
03532
switch (wFlag) {
03533
case SPI_SETUIEFFECTS:
03534
PropagetUPBOOLTogpsi(UIEFFECTS);
03535
SetPointer(TRUE);
03536
03537
03538
03539
03540
case SPI_SETGRADIENTCAPTIONS:
03541
CreateBitmapStrip();
03542
xxxRedrawScreen();
03543
break;
03544
03545
case SPI_SETCOMBOBOXANIMATION:
03546
PropagetUPBOOLTogpsi(COMBOBOXANIMATION);
03547
break;
03548
03549
case SPI_SETLISTBOXSMOOTHSCROLLING:
03550
PropagetUPBOOLTogpsi(LISTBOXSMOOTHSCROLLING);
03551
break;
03552
03553
case SPI_SETKEYBOARDCUES:
03554
PropagetUPBOOLTogpsi(KEYBOARDCUES);
03555
break;
03556
03557
case SPI_SETCURSORSHADOW:
03558
SetPointer(TRUE);
03559
break;
03560
03561 }
03562
03563 }
03564
03565 }
else {
03566
03567 UserAssert(
UPIsDWORDRange(wFlag));
03568
03569
if (fAlterWinIni) {
03570 fWinIniChanged =
FastWriteProfileValue(pProfileUserName,
03571
ppvi->uSection,
03572
ppvi->pwszKeyName,
03573 REG_DWORD,
03574 (LPBYTE)&lParam,
03575
sizeof(DWORD)
03576 );
03577
03578 fWriteAllowed = fWinIniChanged;
03579 }
03580
03581
if (fWriteAllowed) {
03582
03583
ppvi->dwValue = PtrToUlong(lParam);
03584
03585
switch(wFlag) {
03586
case SPI_SETCARETWIDTH:
03587
gpsi->uCaretWidth =
ppvi->dwValue;
03588
break;
03589
default:
03590
break;
03591 }
03592 }
03593
03594 }
03595
03596
FreeProfileUserName(pProfileUserName, &tlName);
03597 }
03598
03599
break;
03600
#undef ppvi
03601
#undef uDataRead
03602
}
03603
03604
03605
if (fWinIniChanged && fSendWinIniChange) {
03606 ULONG_PTR dwResult;
03607
03608
03609
03610
03611
03612
03613
03614
RtlInitLargeUnicodeString(&strSection, szSection, (UINT)-1);
03615
xxxSendMessageTimeout(PWND_BROADCAST, WM_SETTINGCHANGE, wFlag, (LPARAM)&strSection,
03616 SMTO_NORMAL, 100, &dwResult);
03617 }
03618
03619
return fWriteAllowed;
03620 }