00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
#include "precomp.h"
00013
#pragma hdrstop
00014
00015 CONST
ACCESSIBILITYPROC aAccessibilityProc[] = {
00016
HighContrastHotKey,
00017
FilterKeys,
00018
xxxStickyKeys,
00019
MouseKeys,
00020
ToggleKeys,
00021
UtilityManager
00022 };
00023
00024 typedef struct tagMODBITINFO {
00025 int BitPosition;
00026 BYTE ScanCode;
00027 USHORT Vk;
00028 }
MODBITINFO, *
PMODBITINFO;
00029
00030 CONST
MODBITINFO aModBit[] =
00031 {
00032 { 0x01, SCANCODE_LSHIFT, VK_LSHIFT },
00033 { 0x02, SCANCODE_RSHIFT, VK_RSHIFT | KBDEXT },
00034 { 0x04, SCANCODE_CTRL, VK_LCONTROL },
00035 { 0x08, SCANCODE_CTRL, VK_RCONTROL | KBDEXT },
00036 { 0x10, SCANCODE_ALT, VK_LMENU },
00037 { 0x20, SCANCODE_ALT, VK_RMENU | KBDEXT },
00038 { 0x40, SCANCODE_LWIN, VK_LWIN },
00039 { 0x80, SCANCODE_RWIN, VK_RWIN | KBDEXT}
00040 };
00041
00042
00043
00044
00045
00046
00047
00048 CONST
USHORT ausMouseVKey[] = {
00049 VK_CLEAR,
00050 VK_PRIOR,
00051 VK_NEXT,
00052 VK_END,
00053 VK_HOME,
00054 VK_LEFT,
00055 VK_UP,
00056 VK_RIGHT,
00057 VK_DOWN,
00058 VK_INSERT,
00059 VK_DELETE,
00060 VK_MULTIPLY,
00061 VK_ADD,
00062 VK_SUBTRACT,
00063 VK_DIVIDE | KBDEXT,
00064 VK_NUMLOCK | KBDEXT
00065 };
00066
00067 CONST
int cMouseVKeys =
sizeof(
ausMouseVKey) /
sizeof(
ausMouseVKey[0]);
00068
00069
00070
00071
00072
00073 CONST
MOUSEPROC aMouseKeyEvent[] = {
00074
xxxMKButtonClick,
00075
xxxMKMouseMove,
00076
xxxMKMouseMove,
00077
xxxMKMouseMove,
00078
xxxMKMouseMove,
00079
xxxMKMouseMove,
00080
xxxMKMouseMove,
00081
xxxMKMouseMove,
00082
xxxMKMouseMove,
00083
xxxMKButtonSetState,
00084
xxxMKButtonSetState,
00085
MKButtonSelect,
00086
xxxMKButtonDoubleClick,
00087
MKButtonSelect,
00088
MKButtonSelect,
00089
xxxMKToggleMouseKeys
00090 };
00091
00092
00093
00094
00095
00096
00097 CONST
USHORT ausMouseKeyData[] = {
00098 0,
00099
MK_UP |
MK_RIGHT,
00100
MK_DOWN |
MK_RIGHT,
00101
MK_DOWN |
MK_LEFT,
00102
MK_UP |
MK_LEFT,
00103
MK_LEFT,
00104
MK_UP,
00105
MK_RIGHT,
00106
MK_DOWN,
00107
FALSE,
00108
TRUE,
00109
MOUSE_BUTTON_LEFT |
MOUSE_BUTTON_RIGHT,
00110 0,
00111
MOUSE_BUTTON_RIGHT,
00112
MOUSE_BUTTON_LEFT,
00113 0
00114 };
00115
00116 __inline
void
00117 PostAccessNotification(UINT accessKeyType)
00118 {
00119
if (
gspwndLogonNotify !=
NULL)
00120 {
00121
glinp.
ptiLastWoken =
GETPTI(
gspwndLogonNotify);
00122
00123
_PostMessage(
gspwndLogonNotify, WM_LOGONNOTIFY,
00124 LOGON_ACCESSNOTIFY, accessKeyType);
00125 }
00126 }
00127
00128 void PostRitSound(
PTERMINAL pTerm, UINT message) {
00129
PostEventMessage(
00130 pTerm->
ptiDesktop,
00131 pTerm->
ptiDesktop->
pq,
00132
QEVENT_RITSOUND,
00133
NULL,
00134 message, 0, 0);
00135
return;
00136 }
00137
00138 void PostAccessibility( LPARAM lParam )
00139 {
00140
PTERMINAL pTerm =
grpdeskRitInput->
rpwinstaParent->
pTerm;
00141
00142
PostEventMessage(
00143 pTerm->
ptiDesktop,
00144 pTerm->
pqDesktop,
00145
QEVENT_RITACCESSIBILITY,
00146
NULL,
00147 0, HSHELL_ACCESSIBILITYSTATE, lParam);
00148 }
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169 BOOL AccessProceduresStream(PKE pKeyEvent, ULONG ExtraInformation,
int dwProcIndex)
00170 {
00171
int index;
00172
00173
CheckCritIn();
00174
for (index = dwProcIndex; index <
ARRAY_SIZE(
aAccessibilityProc); index++) {
00175
if (!
aAccessibilityProc[index](pKeyEvent, ExtraInformation, index+1)) {
00176
return FALSE;
00177 }
00178 }
00179
00180
return TRUE;
00181 }
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201 VOID FKActivationTimer(
PWND pwnd, UINT message, UINT_PTR nID, LPARAM lParam)
00202 {
00203
UINT TimerDelta;
00204
PTERMINAL pTerm =
grpdeskRitInput->
rpwinstaParent->
pTerm;
00205
00206
CheckCritIn();
00207
00208
switch (
gFilterKeysState) {
00209
00210
case FKFIRSTWARNING:
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220 TimerDelta =
FKACTIVATIONDELTA;
00221
break;
00222
00223
case FKTOGGLE:
00224
if (
TEST_ACCESSFLAG(
FilterKeys, FKF_FILTERKEYSON)) {
00225
00226
00227
00228
CLEAR_ACCESSFLAG(
FilterKeys, FKF_FILTERKEYSON);
00229
if (
TEST_ACCESSFLAG(
FilterKeys, FKF_HOTKEYSOUND)) {
00230
PostRitSound(
00231 pTerm,
00232
RITSOUND_DOWNSIREN);
00233 }
00234
PostAccessibility( ACCESS_FILTERKEYS );
00235
00236
00237
00238
if (
gtmridFKResponse != 0) {
00239
KILLRITTIMER(
NULL,
gtmridFKResponse);
00240
gtmridFKResponse = 0;
00241 }
00242
if (
gtmridFKAcceptanceDelay != 0) {
00243
KILLRITTIMER(
NULL,
gtmridFKAcceptanceDelay);
00244
gtmridFKAcceptanceDelay = 0;
00245 }
00246
00247
00248
00249
00250
00251
return;
00252 }
else {
00253
PTERMINAL pTerm =
grpdeskRitInput->
rpwinstaParent->
pTerm;
00254
00255
if (
TEST_ACCESSFLAG(
FilterKeys, FKF_HOTKEYSOUND)) {
00256
PostRitSound(
00257 pTerm,
00258
RITSOUND_UPSIREN);
00259 }
00260
00261
PostAccessNotification(ACCESS_FILTERKEYS);
00262
00263 }
00264 TimerDelta =
FKEMERGENCY1DELTA;
00265
break;
00266
00267
case FKFIRSTLEVELEMERGENCY:
00268
00269
00270
00271
00272
00273
00274
if (
TEST_ACCESSFLAG(
FilterKeys, FKF_HOTKEYSOUND)) {
00275
PostEventMessage(
00276 pTerm->
ptiDesktop,
00277 pTerm->
ptiDesktop->
pq,
00278
QEVENT_RITSOUND,
00279
NULL,
00280
RITSOUND_DOBEEP,
RITSOUND_UPSIREN, 2);
00281 }
00282
gFilterKeys.iRepeatMSec = 0;
00283
gFilterKeys.iWaitMSec = 0;
00284
gFilterKeys.iBounceMSec = 1000;
00285 TimerDelta =
FKEMERGENCY2DELTA;
00286
break;
00287
00288
case FKSECONDLEVELEMERGENCY:
00289
00290
00291
00292
00293
00294
00295
gFilterKeys.iRepeatMSec = 0;
00296
gFilterKeys.iWaitMSec = 2000;
00297
gFilterKeys.iBounceMSec = 0;
00298
if (
TEST_ACCESSFLAG(
FilterKeys, FKF_HOTKEYSOUND)) {
00299
PostEventMessage(
00300 pTerm->
ptiDesktop,
00301 pTerm->
ptiDesktop->
pq,
00302
QEVENT_RITSOUND,
00303
NULL,
00304
RITSOUND_DOBEEP,
RITSOUND_UPSIREN, 3);
00305 }
00306
return;
00307
break;
00308
00309
default:
00310
return;
00311 }
00312
00313
gFilterKeysState++;
00314
gtmridFKActivation =
InternalSetTimer(
00315
NULL,
00316 nID,
00317 TimerDelta,
00318
FKActivationTimer,
00319 TMRF_RIT | TMRF_ONESHOT
00320 );
00321
return;
00322
00323 DBG_UNREFERENCED_PARAMETER(pwnd);
00324 DBG_UNREFERENCED_PARAMETER(lParam);
00325 DBG_UNREFERENCED_PARAMETER(message);
00326 }
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341 VOID FKBounceKeyTimer(
PWND pwnd, UINT message, UINT_PTR nID, LPARAM lParam)
00342 {
00343
00344
CheckCritIn();
00345
00346
00347
00348
00349
gBounceVk = 0;
00350
return;
00351
00352 DBG_UNREFERENCED_PARAMETER(pwnd);
00353 DBG_UNREFERENCED_PARAMETER(lParam);
00354 DBG_UNREFERENCED_PARAMETER(nID);
00355 DBG_UNREFERENCED_PARAMETER(message);
00356
00357 }
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374 VOID xxxFKRepeatRateTimer(
PWND pwnd, UINT message, UINT_PTR nID, LPARAM lParam)
00375 {
00376
00377
CheckCritIn();
00378
00379
00380
00381
if (
TEST_ACCESSFLAG(
FilterKeys, FKF_CLICKON)) {
00382
PTERMINAL pTerm =
grpdeskRitInput->
rpwinstaParent->
pTerm;
00383
PostRitSound(
00384 pTerm,
00385
RITSOUND_KEYCLICK);
00386 }
00387
00388 UserAssert(
gtmridFKAcceptanceDelay == 0);
00389
00390
gtmridFKResponse =
InternalSetTimer(
00391
NULL,
00392 nID,
00393
gFilterKeys.iRepeatMSec,
00394
xxxFKRepeatRateTimer,
00395 TMRF_RIT | TMRF_ONESHOT
00396 );
00397
if (
AccessProceduresStream(
gpFKKeyEvent,
gFKExtraInformation,
gFKNextProcIndex)) {
00398
xxxProcessKeyEvent(
gpFKKeyEvent,
gFKExtraInformation,
FALSE);
00399 }
00400
return;
00401
00402
00403 DBG_UNREFERENCED_PARAMETER(pwnd);
00404 DBG_UNREFERENCED_PARAMETER(lParam);
00405 DBG_UNREFERENCED_PARAMETER(message);
00406 }
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423 VOID xxxFKAcceptanceDelayTimer(
PWND pwnd, UINT message, UINT_PTR nID, LPARAM lParam)
00424 {
00425
00426
CheckCritIn();
00427
00428
00429
00430
if (
TEST_ACCESSFLAG(
FilterKeys, FKF_CLICKON)) {
00431
PTERMINAL pTerm =
grpdeskRitInput->
rpwinstaParent->
pTerm;
00432
PostRitSound(
00433 pTerm,
00434
RITSOUND_KEYCLICK);
00435 }
00436
00437
if (
AccessProceduresStream(
gpFKKeyEvent,
gFKExtraInformation,
gFKNextProcIndex)) {
00438
xxxProcessKeyEvent(
gpFKKeyEvent,
gFKExtraInformation,
FALSE);
00439 }
00440
if (!
gFilterKeys.iRepeatMSec) {
00441
00442
00443
00444
00445
00446
SET_ACCF(
ACCF_FKMAKECODEPROCESSED);
00447
return;
00448 }
00449 UserAssert(
gtmridFKResponse == 0);
00450
if (
gFilterKeys.iDelayMSec) {
00451
gtmridFKResponse =
InternalSetTimer(
00452
NULL,
00453 nID,
00454
gFilterKeys.iDelayMSec,
00455
xxxFKRepeatRateTimer,
00456 TMRF_RIT | TMRF_ONESHOT
00457 );
00458 }
else {
00459
gtmridFKResponse =
InternalSetTimer(
00460
NULL,
00461 nID,
00462
gFilterKeys.iRepeatMSec,
00463
xxxFKRepeatRateTimer,
00464 TMRF_RIT | TMRF_ONESHOT
00465 );
00466 }
00467
00468
00469
00470
gtmridFKAcceptanceDelay = 0;
00471
00472
return;
00473
00474 DBG_UNREFERENCED_PARAMETER(lParam);
00475 DBG_UNREFERENCED_PARAMETER(message);
00476 DBG_UNREFERENCED_PARAMETER(pwnd);
00477 }
00478
00479
00480
00481
00482
00483
00484
00485 BOOL FilterKeys(PKE pKeyEvent, ULONG ExtraInformation,
int NextProcIndex)
00486 {
00487
int fBreak;
00488
BYTE Vk;
00489
00490
CheckCritIn();
00491 Vk = (
BYTE)(pKeyEvent->usFlaggedVk & 0xff);
00492 fBreak = pKeyEvent->usFlaggedVk & KBDBREAK;
00493
00494
00495
00496
00497
if (Vk == VK_RSHIFT) {
00498
if (fBreak) {
00499
if (
gtmridFKActivation != 0) {
00500
KILLRITTIMER(
NULL,
gtmridFKActivation);
00501
gtmridFKActivation = 0;
00502 }
00503
gFilterKeysState =
FKIDLE;
00504 }
else if (
ONLYRIGHTSHIFTDOWN(
gPhysModifierState)) {
00505
00506
00507
00508
if (
TEST_ACCESSFLAG(
FilterKeys, FKF_HOTKEYACTIVE)) {
00509
if ((
gtmridFKActivation == 0) && (
gFilterKeysState !=
FKMOUSEMOVE)) {
00510
gFilterKeysState =
FKFIRSTWARNING;
00511
gtmridFKActivation =
InternalSetTimer(
00512
NULL,
00513 0,
00514
FKFIRSTWARNINGTIME,
00515
FKActivationTimer,
00516 TMRF_RIT | TMRF_ONESHOT
00517 );
00518 }
00519 }
00520 }
00521 }
00522
00523
00524
00525
00526
00527
if ((Vk != VK_RSHIFT) && (
gtmridFKActivation != 0)) {
00528
gFilterKeysState =
FKIDLE;
00529
KILLRITTIMER(
NULL,
gtmridFKActivation);
00530
gtmridFKActivation = 0;
00531 }
00532
00533
00534
00535
if (!
TEST_ACCESSFLAG(
FilterKeys, FKF_FILTERKEYSON)) {
00536
return TRUE;
00537 }
00538
00539
if (fBreak) {
00540
00541
00542
00543
00544
if (Vk ==
gLastVkDown) {
00545
KILLRITTIMER(
NULL,
gtmridFKResponse);
00546
gtmridFKResponse = 0;
00547
00548
gLastVkDown = 0;
00549
if (
gtmridFKAcceptanceDelay != 0) {
00550
KILLRITTIMER(
NULL,
gtmridFKAcceptanceDelay);
00551
gtmridFKAcceptanceDelay = 0;
00552
if (!
TEST_ACCF(
ACCF_FKMAKECODEPROCESSED)) {
00553
00554
00555
00556
00557
return FALSE;
00558 }
else {
00559
CLEAR_ACCF(
ACCF_FKMAKECODEPROCESSED);
00560 }
00561 }
00562
00563
if (
gFilterKeys.iBounceMSec) {
00564
gBounceVk = Vk;
00565
gtmridFKResponse =
InternalSetTimer(
00566
NULL,
00567 0,
00568
gFilterKeys.iBounceMSec,
00569
FKBounceKeyTimer,
00570 TMRF_RIT | TMRF_ONESHOT
00571 );
00572
if (
TEST_ACCF(
ACCF_IGNOREBREAKCODE)) {
00573
return FALSE;
00574 }
00575 }
00576 }
00577 }
else {
00578
00579
00580
00581
00582
00583
00584
00585
if (Vk ==
gLastVkDown) {
00586
return FALSE;
00587 }
00588
00589
00590
00591
gLastVkDown = Vk;
00592
00593
if (
gBounceVk) {
00594
00595
00596
00597
00598
00599
00600
if (Vk ==
gBounceVk) {
00601
00602
00603
00604
00605
SET_ACCF(
ACCF_IGNOREBREAKCODE);
00606
return FALSE;
00607 }
else {
00608
00609
00610
00611
00612 UserAssert(
gtmridFKResponse);
00613
if (
gtmridFKResponse != 0) {
00614
KILLRITTIMER(
NULL,
gtmridFKResponse);
00615
gtmridFKResponse = 0;
00616 }
00617
gBounceVk = 0;
00618 }
00619 }
00620
CLEAR_ACCF(
ACCF_IGNOREBREAKCODE);
00621
00622
00623
00624
00625
if (
TEST_ACCESSFLAG(
FilterKeys, FKF_CLICKON)) {
00626
PTERMINAL pTerm =
grpdeskRitInput->
rpwinstaParent->
pTerm;
00627
PostRitSound(
00628 pTerm,
00629
RITSOUND_KEYCLICK);
00630 }
00631
00632
00633
00634
00635
00636
00637
00638
if (
gtmridFKAcceptanceDelay != 0) {
00639
KILLRITTIMER(
NULL,
gtmridFKAcceptanceDelay);
00640
gtmridFKAcceptanceDelay = 0;
00641 }
00642
00643
00644
00645
00646
00647
if (
gtmridFKResponse != 0) {
00648
KILLRITTIMER(
NULL,
gtmridFKResponse);
00649
gtmridFKResponse = 0;
00650 }
00651
00652
00653
00654
00655
00656 *
gpFKKeyEvent = *pKeyEvent;
00657
gFKExtraInformation = ExtraInformation;
00658
gFKNextProcIndex = NextProcIndex;
00659
00660
00661
00662
00663
00664
if (
gFilterKeys.iWaitMSec) {
00665
gtmridFKAcceptanceDelay =
InternalSetTimer(
00666
NULL,
00667 0,
00668
gFilterKeys.iWaitMSec,
00669
xxxFKAcceptanceDelayTimer,
00670 TMRF_RIT | TMRF_ONESHOT
00671 );
00672
CLEAR_ACCF(
ACCF_FKMAKECODEPROCESSED);
00673
return FALSE;
00674 }
00675
00676
00677
00678
00679
00680
00681
if (!
gFilterKeys.iRepeatMSec) {
00682
return TRUE;
00683 }
00684
00685 UserAssert(
gtmridFKResponse == 0);
00686
if (
gFilterKeys.iDelayMSec) {
00687
gtmridFKResponse =
InternalSetTimer(
00688
NULL,
00689 0,
00690
gFilterKeys.iDelayMSec,
00691
xxxFKRepeatRateTimer,
00692 TMRF_RIT | TMRF_ONESHOT
00693 );
00694 }
else {
00695
gtmridFKResponse =
InternalSetTimer(
00696
NULL,
00697 0,
00698
gFilterKeys.iRepeatMSec,
00699
xxxFKRepeatRateTimer,
00700 TMRF_RIT | TMRF_ONESHOT
00701 );
00702 }
00703 }
00704
00705
return TRUE;
00706 }
00707
00708
00709
00710
00711
00712
00713
00714
00715
00716
00717 VOID StopFilterKeysTimers(VOID)
00718 {
00719
00720
if (
gtmridFKResponse != 0) {
00721
KILLRITTIMER(
NULL,
gtmridFKResponse);
00722
gtmridFKResponse = 0;
00723 }
00724
if (
gtmridFKAcceptanceDelay) {
00725
KILLRITTIMER(
NULL,
gtmridFKAcceptanceDelay);
00726
gtmridFKAcceptanceDelay = 0;
00727 }
00728
gLastVkDown = 0;
00729
gBounceVk = 0;
00730 }
00731
00732
00733
00734
00735
00736
00737
00738 BOOL xxxStickyKeys(PKE pKeyEvent, ULONG ExtraInformation,
int NextProcIndex)
00739 {
00740
int fBreak;
00741
BYTE NewLockBits, NewLatchBits;
00742
int BitPositions;
00743
BOOL bChange;
00744
PTERMINAL pTerm =
grpdeskRitInput->
rpwinstaParent->
pTerm;
00745
00746
00747
CheckCritIn();
00748 fBreak = pKeyEvent->usFlaggedVk & KBDBREAK;
00749
00750
if (
gCurrentModifierBit) {
00751
00752
00753
00754
00755
00756
00757
00758
00759
00760
00761
00762
if (!fBreak) {
00763
if (
gCurrentModifierBit &
gPrevModifierState) {
00764
00765
00766
00767
00768
gPrevModifierState =
gPhysModifierState;
00769
return TRUE;
00770 }
00771 }
00772
00773
gPrevModifierState =
gPhysModifierState;
00774
00775
if (
LEFTSHIFTKEY(pKeyEvent->usFlaggedVk) &&
00776 ((
gPhysModifierState & ~
gCurrentModifierBit) == 0)) {
00777
gStickyKeysLeftShiftCount++;
00778 }
else {
00779
gStickyKeysLeftShiftCount = 0;
00780 }
00781
if (
RIGHTSHIFTKEY(pKeyEvent->usFlaggedVk) &&
00782 ((
gPhysModifierState & ~
gCurrentModifierBit) == 0)) {
00783
gStickyKeysRightShiftCount++;
00784 }
else {
00785
gStickyKeysRightShiftCount = 0;
00786 }
00787
00788
00789
00790
00791
if ((
gStickyKeysLeftShiftCount == (
TOGGLE_STICKYKEYS_COUNT * 2)) ||
00792 (
gStickyKeysRightShiftCount == (
TOGGLE_STICKYKEYS_COUNT * 2))) {
00793
if (
TEST_ACCESSFLAG(StickyKeys, SKF_HOTKEYACTIVE)) {
00794
if (
TEST_ACCESSFLAG(StickyKeys, SKF_STICKYKEYSON)) {
00795
xxxTurnOffStickyKeys();
00796
if (
TEST_ACCESSFLAG(StickyKeys, SKF_HOTKEYSOUND)) {
00797
PostRitSound(
00798 pTerm,
00799
RITSOUND_DOWNSIREN);
00800 }
00801 }
else {
00802
if (
TEST_ACCESSFLAG(StickyKeys, SKF_HOTKEYSOUND)) {
00803
PostRitSound(
00804 pTerm,
00805
RITSOUND_UPSIREN);
00806 }
00807
00808
00809
00810
PostAccessNotification(ACCESS_STICKYKEYS);
00811
00812 }
00813 }
00814
gStickyKeysLeftShiftCount = 0;
00815
gStickyKeysRightShiftCount = 0;
00816
return TRUE;
00817 }
00818
00819
00820
00821
00822
00823
if (
TEST_ACCESSFLAG(StickyKeys, SKF_STICKYKEYSON)) {
00824
if (fBreak) {
00825
00826
00827
00828
00829
if (
UNION(
gLatchBits,
gLockBits) &
gCurrentModifierBit) {
00830
return FALSE;
00831 }
else {
00832
return TRUE;
00833 }
00834 }
else{
00835
if (
gPhysModifierState !=
gCurrentModifierBit) {
00836
00837
00838
00839
00840
00841
00842
00843
00844
if (!
xxxTwoKeysDown(NextProcIndex)) {
00845
return TRUE;
00846 }
00847
00848
00849
00850
00851
00852
00853
00854
00855 bChange =
gLockBits ||
00856 (
gLatchBits !=
gPhysModifierState);
00857
gLatchBits =
gPhysModifierState;
00858
gLockBits = 0;
00859
if (bChange) {
00860
PostAccessibility( ACCESS_STICKYKEYS );
00861 }
00862
00863
00864
00865
00866
if (
TEST_ACCESSFLAG(StickyKeys, SKF_AUDIBLEFEEDBACK)) {
00867
PostRitSound(
00868 pTerm,
00869
RITSOUND_LOWBEEP);
00870
PostRitSound(
00871 pTerm,
00872
RITSOUND_HIGHBEEP);
00873 }
00874
return FALSE;
00875 }
00876
00877
00878
00879
00880
00881
00882
00883
00884
00885
00886
00887
00888
00889
00890
00891
switch(pKeyEvent->usFlaggedVk) {
00892
case VK_LSHIFT:
00893
case VK_RSHIFT:
00894 BitPositions = 0x3;
00895
break;
00896
case VK_LCONTROL:
00897
case VK_RCONTROL:
00898 BitPositions = 0xc;
00899
break;
00900
case VK_LMENU:
00901
case VK_RMENU:
00902 BitPositions = 0x30;
00903
break;
00904
case VK_LWIN:
00905
case VK_RWIN:
00906 BitPositions = 0xc0;
00907
break;
00908 }
00909 NewLatchBits =
gLatchBits;
00910 NewLockBits =
gLockBits;
00911
00912
00913
00914
00915
00916
if (
gLockBits & BitPositions) {
00917 NewLockBits =
gLockBits & ~BitPositions;
00918 NewLatchBits =
gLatchBits & ~BitPositions;
00919
xxxUpdateModifierState(
00920 NewLockBits | NewLatchBits |
gCurrentModifierBit,
00921 NextProcIndex
00922 );
00923 }
else {
00924
00925
00926
00927
00928
if (!(
gLockBits &
gCurrentModifierBit)) {
00929 NewLatchBits =
gLatchBits ^
gCurrentModifierBit;
00930 }
00931
00932
00933
00934
00935
if (
TEST_ACCESSFLAG(StickyKeys, SKF_TRISTATE)) {
00936
if (
UNION(
gLockBits,
gLatchBits) &
gCurrentModifierBit) {
00937 NewLockBits =
gLockBits ^
gCurrentModifierBit;
00938 }
00939 }
00940 }
00941
00942
00943
00944
00945 bChange = ((
gLatchBits != NewLatchBits) ||
00946 (
gLockBits != NewLockBits));
00947
00948
gLatchBits = NewLatchBits;
00949
gLockBits = NewLockBits;
00950
00951
if (bChange) {
00952
PostAccessibility( ACCESS_STICKYKEYS );
00953 }
00954
00955
00956
00957
00958
00959
00960
00961
if (
TEST_ACCESSFLAG(StickyKeys, SKF_AUDIBLEFEEDBACK)) {
00962
if (!(
gLockBits &
gCurrentModifierBit)) {
00963
PostRitSound(
00964 pTerm,
00965
RITSOUND_LOWBEEP);
00966 }
00967
if ((
gLatchBits |
gLockBits) &
gCurrentModifierBit) {
00968
PostRitSound(
00969 pTerm,
00970
RITSOUND_HIGHBEEP);
00971 }
00972 }
00973
00974
00975
00976
00977
if (
gLatchBits &
gCurrentModifierBit) {
00978
return TRUE;
00979 }
else {
00980
return FALSE;
00981 }
00982
00983 }
00984 }
00985 }
else {
00986
00987
00988
00989
gStickyKeysLeftShiftCount = 0;
00990
gStickyKeysRightShiftCount = 0;
00991
if (!
TEST_ACCESSFLAG(StickyKeys, SKF_STICKYKEYSON)) {
00992
return TRUE;
00993 }
00994
00995
00996
00997
00998
00999
if (!
gPhysModifierState || fBreak) {
01000
if (
AccessProceduresStream(pKeyEvent, ExtraInformation, NextProcIndex)) {
01001
xxxProcessKeyEvent(pKeyEvent, ExtraInformation,
FALSE);
01002 }
01003
xxxUpdateModifierState(
gLockBits, NextProcIndex);
01004
01005 bChange =
gLatchBits != 0;
01006
gLatchBits = 0;
01007
if (bChange) {
01008
01009
PostAccessibility( ACCESS_STICKYKEYS );
01010 }
01011
return FALSE;
01012 }
else {
01013
01014
01015
01016
01017
xxxTwoKeysDown(NextProcIndex);
01018
return TRUE;
01019 }
01020 }
01021
01022
return TRUE;
01023 }
01024
01025
01026
01027
01028
01029
01030
01031
01032
01033
01034
01035
01036
01037 VOID xxxUpdateModifierState(
int NewModifierState,
int NextProcIndex)
01038 {
01039 KE ke;
01040
int CurrentModState;
01041
int CurrentModBit, NewModBit;
01042
int i;
01043
01044
CheckCritIn();
01045
01046 CurrentModState =
gLockBits |
gLatchBits;
01047
01048
for (i = 0; i <
ARRAY_SIZE(
aModBit); i++) {
01049 CurrentModBit = CurrentModState &
aModBit[i].
BitPosition;
01050 NewModBit = NewModifierState &
aModBit[i].
BitPosition;
01051
if (CurrentModBit != NewModBit) {
01052 ke.bScanCode = (
BYTE)
aModBit[i].
ScanCode;
01053 ke.usFlaggedVk =
aModBit[i].
Vk;
01054
if (CurrentModBit) {
01055 ke.usFlaggedVk |= KBDBREAK;
01056 }
01057
if (
AccessProceduresStream(&ke, 0
L, NextProcIndex)) {
01058
xxxProcessKeyEvent(&ke, 0
L,
FALSE);
01059 }
01060 }
01061 }
01062 }
01063
01064
01065
01066
01067
01068
01069
01070
01071
01072
01073
01074
01075
01076
01077 VOID xxxTurnOffStickyKeys(VOID)
01078 {
01079
INT index;
01080
01081
CheckCritIn();
01082
01083
for (index = 0; index <
ARRAY_SIZE(
aAccessibilityProc); index++) {
01084
if (
aAccessibilityProc[index] ==
xxxStickyKeys) {
01085
01086
xxxUpdateModifierState(
gPhysModifierState, index+1);
01087
gLockBits =
gLatchBits = 0;
01088
CLEAR_ACCESSFLAG(StickyKeys, SKF_STICKYKEYSON);
01089
01090
PostAccessibility( ACCESS_STICKYKEYS );
01091
break;
01092 }
01093 }
01094 }
01095
01096
01097
01098
01099
01100
01101
01102
01103
01104
01105
01106
01107
01108 VOID xxxUnlatchStickyKeys(VOID)
01109 {
01110
INT index;
01111
BOOL bChange;
01112
01113
if (!
gLatchBits) {
01114
return;
01115 }
01116
01117
for (index = 0; index <
ARRAY_SIZE(
aAccessibilityProc); index++) {
01118
if (
aAccessibilityProc[index] ==
xxxStickyKeys) {
01119
xxxUpdateModifierState(
gLockBits, index+1);
01120 bChange =
gLatchBits != 0;
01121
gLatchBits = 0;
01122
01123
if (bChange) {
01124
01125
PostAccessibility( ACCESS_STICKYKEYS );
01126 }
01127
break;
01128 }
01129 }
01130 }
01131
01132
01133
01134
01135
01136
01137
01138
01139
01140
01141
01142
01143
01144
01145
01146
01147
01148
01149 VOID xxxHardwareMouseKeyUp(DWORD dwButton)
01150 {
01151
CheckCritIn();
01152
01153
if (
TEST_ACCESSFLAG(
MouseKeys, MKF_MOUSEKEYSON)) {
01154
gwMKButtonState &= ~dwButton;
01155 }
01156
01157
01158
01159
01160
if (
TEST_ACCESSFLAG(StickyKeys, SKF_STICKYKEYSON)) {
01161
xxxUnlatchStickyKeys();
01162 }
01163 }
01164
01165
01166
01167
01168
01169
01170
01171
01172
01173
01174
01175
01176
01177
01178
01179
01180 BOOL xxxTwoKeysDown(
int NextProcIndex)
01181 {
01182
PTERMINAL pTerm =
grpdeskRitInput->
rpwinstaParent->
pTerm;
01183
01184
if (
TEST_ACCESSFLAG(StickyKeys, SKF_TWOKEYSOFF)) {
01185
CLEAR_ACCESSFLAG(StickyKeys, SKF_STICKYKEYSON);
01186
if (
TEST_ACCESSFLAG(StickyKeys, SKF_HOTKEYSOUND)) {
01187
PostRitSound(
01188 pTerm,
01189
RITSOUND_DOWNSIREN);
01190 }
01191
gStickyKeysLeftShiftCount = 0;
01192
gStickyKeysRightShiftCount = 0;
01193 }
01194
xxxUpdateModifierState(
gPhysModifierState, NextProcIndex);
01195
gLockBits =
gLatchBits = 0;
01196
01197
PostAccessibility( ACCESS_STICKYKEYS );
01198
01199
return TEST_BOOL_ACCESSFLAG(StickyKeys, SKF_STICKYKEYSON);
01200 }
01201
01202
01203
01204
01205
01206
01207
01208
01209
01210
01211
01212 VOID SetGlobalCursorLevel(
01213 INT iCursorLevel)
01214 {
01215
01216
01217
01218
01219
01220
01221
01222
01223
01224
01225
01226
01227
01228
PDESKTOP pdesk;
01229
PTHREADINFO pti;
01230 PLIST_ENTRY pHead, pEntry;
01231
01232 TAGMSG1(DBGTAG_PNP,
"SetGlobalCursorLevel %x", iCursorLevel);
01233
01234
if (
grpdeskRitInput) {
01235
for (pdesk =
grpdeskRitInput->
rpwinstaParent->
rpdeskList;
01236 pdesk !=
NULL; pdesk = pdesk->
rpdeskNext) {
01237
01238 pHead = &pdesk->
PtiList;
01239
for (pEntry = pHead->Flink; pEntry != pHead; pEntry = pEntry->Flink) {
01240 pti = CONTAINING_RECORD(pEntry,
THREADINFO, PtiLink);
01241
01242 pti->
iCursorLevel = iCursorLevel;
01243 pti->
pq->
iCursorLevel = iCursorLevel;
01244 }
01245 }
01246 }
01247
01248
01249
01250
01251
for (pti =
PpiFromProcess(
gpepCSRSS)->ptiList;
01252 pti !=
NULL; pti = pti->
ptiSibling) {
01253
if (pti->
iCursorLevel != iCursorLevel) {
01254 TAGMSG3(DBGTAG_PNP,
"pti %#p has cursorlevel %x, should be %x",
01255 pti, pti->
iCursorLevel, iCursorLevel);
01256 }
01257
if (pti->
pq->
iCursorLevel != iCursorLevel) {
01258 TAGMSG4(DBGTAG_PNP,
"pti->pq %#p->%#p has cursorlevel %x, should be %x",
01259 pti, pti->
pq, pti->
pq->
iCursorLevel, iCursorLevel);
01260 }
01261 pti->
iCursorLevel = iCursorLevel;
01262 pti->
pq->
iCursorLevel = iCursorLevel;
01263 }
01264 }
01265
01266
01267
01268
01269
01270
01271
01272
01273
01274
01275
01276
01277
01278
01279 VOID MKShowMouseCursor()
01280 {
01281 TAGMSG1(DBGTAG_PNP,
"MKShowMouseCursor (gpDeviceInfoList == %#p)",
gpDeviceInfoList);
01282
01283
01284
01285
01286
01287
01288
if (
TEST_GTERMF(
GTERMF_MOUSE)) {
01289 TAGMSG0(DBGTAG_PNP,
"MKShowMouseCursor just returns");
01290
return;
01291 }
01292
01293
SET_GTERMF(
GTERMF_MOUSE);
01294
SET_ACCF(
ACCF_MKVIRTUALMOUSE);
01295
SYSMET(MOUSEPRESENT) =
TRUE;
01296
SYSMET(CMOUSEBUTTONS) = 2;
01297
01298
01299
01300
01301
01302
01303
01304
01305
01306
SetGlobalCursorLevel(0);
01307 }
01308
01309
01310
01311
01312
01313
01314
01315
01316
01317
01318
01319
01320
01321
01322 VOID MKHideMouseCursor()
01323 {
01324 TAGMSG1(DBGTAG_PNP,
"MKHideMouseCursor (gpDeviceInfoList == %#p)",
gpDeviceInfoList);
01325
01326
01327
01328
01329
if (!
TEST_ACCF(
ACCF_MKVIRTUALMOUSE)) {
01330
return;
01331 }
01332
01333
CLEAR_ACCF(
ACCF_MKVIRTUALMOUSE);
01334
CLEAR_GTERMF(
GTERMF_MOUSE);
01335
SYSMET(MOUSEPRESENT) =
FALSE;
01336
SYSMET(CMOUSEBUTTONS) = 0;
01337
01338
SetGlobalCursorLevel(-1);
01339 }
01340
01341
01342
01343
01344
01345
01346
01347
01348
01349
01350
01351
01352
01353
01354
01355
01356 BOOL xxxMKToggleMouseKeys(USHORT NotUsed)
01357 {
01358
BOOL bRetVal =
TRUE;
01359
BOOL bNewPassThrough;
01360
PTERMINAL pTerm =
grpdeskRitInput->
rpwinstaParent->
pTerm;
01361
01362
01363
01364
01365
01366
if (
TEST_ACCF(
ACCF_MKREPEATVK)) {
01367
return bRetVal;
01368 }
01369
01370
01371
01372
if ((
gLockBits |
gLatchBits |
gPhysModifierState) ==
MOUSEKEYMODBITS) {
01373
if (
TEST_ACCESSFLAG(
MouseKeys, MKF_HOTKEYACTIVE)) {
01374
if (!
gbMKMouseMode) {
01375
01376
01377
01378
01379
01380
01381
01382 bRetVal =
FALSE;
01383 }
01384
TurnOffMouseKeys();
01385 }
01386
return bRetVal;
01387 }
01388
01389
01390
01391
01392
01393
01394
01395
01396 bNewPassThrough =
01397
#ifdef FE_SB // MouseKeys()
01398
(
TestAsyncKeyStateToggle(
gNumLockVk) != 0) ^
01399
#else // FE_SB
01400
(
TestAsyncKeyStateToggle(VK_NUMLOCK) != 0) ^
01401
#endif // FE_SB
01402
(
TEST_ACCESSFLAG(
MouseKeys, MKF_REPLACENUMBERS) != 0);
01403
01404
01405
if (!bNewPassThrough) {
01406
gbMKMouseMode =
TRUE;
01407
PostRitSound(
01408 pTerm,
01409
RITSOUND_HIGHBEEP);
01410 }
else {
01411 WORD SaveCurrentActiveButton;
01412
01413
01414
01415
01416
gbMKMouseMode =
FALSE;
01417
PostRitSound(
01418 pTerm,
01419
RITSOUND_LOWBEEP);
01420 SaveCurrentActiveButton =
gwMKCurrentButton;
01421
gwMKCurrentButton =
MOUSE_BUTTON_LEFT |
MOUSE_BUTTON_RIGHT;
01422
xxxMKButtonSetState(
TRUE);
01423
gwMKCurrentButton = SaveCurrentActiveButton;
01424 }
01425
01426
PostAccessibility( ACCESS_MOUSEKEYS );
01427
01428
return bRetVal;
01429
01430
01431 DBG_UNREFERENCED_PARAMETER(NotUsed);
01432 }
01433
01434
01435
01436
01437
01438
01439
01440
01441
01442
01443
01444 BOOL xxxMKButtonClick(USHORT NotUsed)
01445 {
01446
01447
01448
01449
01450
if (
TEST_ACCF(
ACCF_MKREPEATVK)) {
01451
return FALSE;
01452 }
01453
01454
01455
01456
xxxMKButtonSetState(
TRUE);
01457
01458
01459
01460
xxxMKButtonSetState(
FALSE);
01461
01462
01463
01464
xxxMKButtonSetState(
TRUE);
01465
01466
return FALSE;
01467
01468
01469 UNREFERENCED_PARAMETER(NotUsed);
01470 }
01471
01472
01473
01474
01475
01476
01477
01478
01479
01480
01481
01482
01483
01484
01485
01486 VOID xxxMKMoveConstCursorTimer(
PWND pwnd, UINT message, UINT_PTR nID, LPARAM lParam)
01487 {
01488 LONG MovePixels;
01489
01490
CheckCritIn();
01491
01492
if (
TEST_ACCESSFLAG(
MouseKeys, MKF_MODIFIERS)) {
01493
if ((
gLockBits |
gLatchBits |
gPhysModifierState) &
LRSHIFT) {
01494 MovePixels = 1;
01495
goto MoveIt;
01496 }
01497
if ((
gLockBits |
gLatchBits |
gPhysModifierState) &
LRCONTROL) {
01498 MovePixels =
gMouseCursor.bConstantTable[0] *
MK_CONTROL_SPEED;
01499
goto MoveIt;
01500 }
01501 }
01502
01503
giMouseMoveTable %=
gMouseCursor.bConstantTableLen;
01504
01505 MovePixels =
gMouseCursor.bConstantTable[
giMouseMoveTable++];
01506
01507
if (MovePixels == 0) {
01508
return;
01509 }
01510
01511 MoveIt:
01512
01513
01514
01515
01516
01517
LeaveCrit();
01518
01519
xxxMoveEvent(MovePixels *
gMKDeltaX, MovePixels *
gMKDeltaY, 0, 0, 0,
FALSE);
01520
QueueMouseEvent(0, 0, 0,
gptCursorAsync,
NtGetTickCount(),
FALSE,
TRUE);
01521
EnterCrit();
01522
return;
01523
01524
01525 UNREFERENCED_PARAMETER(pwnd);
01526 UNREFERENCED_PARAMETER(lParam);
01527 UNREFERENCED_PARAMETER(nID);
01528 UNREFERENCED_PARAMETER(message);
01529 }
01530
01531
01532
01533
01534
01535
01536
01537
01538
01539
01540
01541
01542
01543 VOID xxxMKMoveAccelCursorTimer(
PWND pwnd, UINT message, UINT_PTR nID, LPARAM lParam)
01544 {
01545 LONG MovePixels;
01546
01547
CheckCritIn();
01548
01549
if (
TEST_ACCESSFLAG(
MouseKeys, MKF_MODIFIERS)) {
01550
if ((
gLockBits |
gLatchBits |
gPhysModifierState) &
LRSHIFT) {
01551 MovePixels = 1;
01552
goto MoveIt;
01553 }
01554
if ((
gLockBits |
gLatchBits |
gPhysModifierState) &
LRCONTROL) {
01555 MovePixels =
gMouseCursor.bConstantTable[0] *
MK_CONTROL_SPEED;
01556
goto MoveIt;
01557 }
01558 }
01559
01560
if (
giMouseMoveTable <
gMouseCursor.bAccelTableLen) {
01561 MovePixels =
gMouseCursor.bAccelTable[
giMouseMoveTable++];
01562 }
else {
01563
01564
01565
01566 MovePixels =
gMouseCursor.bConstantTable[0];
01567
giMouseMoveTable = 1;
01568
gtmridMKMoveCursor =
InternalSetTimer(
01569
NULL,
01570
gtmridMKMoveCursor,
01571
MOUSETIMERRATE,
01572
xxxMKMoveConstCursorTimer,
01573 TMRF_RIT
01574 );
01575
01576 }
01577
if (MovePixels == 0) {
01578
return;
01579 }
01580
01581 MoveIt:
01582
01583
01584
01585
01586
01587
LeaveCrit();
01588
xxxMoveEvent(MovePixels *
gMKDeltaX, MovePixels *
gMKDeltaY, 0, 0, 0,
FALSE);
01589
QueueMouseEvent(0, 0, 0,
gptCursorAsync,
NtGetTickCount(),
FALSE,
TRUE);
01590
01591
EnterCrit();
01592
01593
return;
01594
01595 UNREFERENCED_PARAMETER(pwnd);
01596 UNREFERENCED_PARAMETER(message);
01597 UNREFERENCED_PARAMETER(nID);
01598 UNREFERENCED_PARAMETER(lParam);
01599 }
01600
01601
01602
01603
01604
01605
01606
01607
01608
01609
01610
01611
01612
01613
01614
01615
01616 BOOL xxxMKMouseMove(USHORT Data)
01617 {
01618
01619
01620
01621
01622
01623
if (
TEST_ACCF(
ACCF_MKREPEATVK) && (
gtmridMKMoveCursor != 0)) {
01624
return FALSE;
01625 }
01626
01627
01628
gMKDeltaX = (LONG)((
CHAR)
LOBYTE(Data));
01629
gMKDeltaY = (LONG)((
CHAR)
HIBYTE(Data));
01630
01631
LeaveCrit();
01632
01633
if ((
TEST_ACCESSFLAG(
MouseKeys, MKF_MODIFIERS) && ((
gLockBits |
gLatchBits |
gPhysModifierState) &
LRCONTROL))) {
01634
xxxMoveEvent(
gMKDeltaX *
MK_CONTROL_SPEED *
gMouseCursor.bConstantTable[0],
gMKDeltaY *
MK_CONTROL_SPEED *
gMouseCursor.bConstantTable[0], 0, 0, 0,
FALSE);
01635 }
else {
01636
xxxMoveEvent(
gMKDeltaX,
gMKDeltaY, 0, 0, 0,
FALSE);
01637 }
01638
01639
QueueMouseEvent(0, 0, 0,
gptCursorAsync,
NtGetTickCount(),
FALSE,
TRUE);
01640
01641
EnterCrit();
01642
01643
01644
01645
01646
01647
01648
if (!
gFilterKeys.iRepeatMSec ||
TEST_ACCF(
ACCF_MKREPEATVK)) {
01649
giMouseMoveTable = 0;
01650
gtmridMKMoveCursor =
InternalSetTimer(
01651
NULL,
01652
gtmridMKMoveCursor,
01653
MOUSETIMERRATE,
01654 (
gMouseCursor.bAccelTableLen) ?
01655
xxxMKMoveAccelCursorTimer :
01656
xxxMKMoveConstCursorTimer,
01657 TMRF_RIT
01658 );
01659 }
01660
return FALSE;
01661 }
01662
01663
01664
01665
01666
01667
01668
01669
01670
01671
01672
01673
01674
01675 BOOL xxxMKButtonSetState(USHORT fButtonUp)
01676 {
01677 WORD NewButtonState;
01678
01679
CheckCritIn();
01680
if (fButtonUp) {
01681 NewButtonState =
gwMKButtonState & ~
gwMKCurrentButton;
01682 }
else {
01683 NewButtonState =
gwMKButtonState |
gwMKCurrentButton;
01684 }
01685
01686
if ((NewButtonState &
MOUSE_BUTTON_LEFT) != (
gwMKButtonState &
MOUSE_BUTTON_LEFT)) {
01687
xxxButtonEvent(
MOUSE_BUTTON_LEFT,
01688
gptCursorAsync,
01689 fButtonUp,
01690
NtGetTickCount(),
01691 0
L,
01692
FALSE,
01693
FALSE);
01694 }
01695
if ((NewButtonState &
MOUSE_BUTTON_RIGHT) != (
gwMKButtonState &
MOUSE_BUTTON_RIGHT)) {
01696
xxxButtonEvent(
MOUSE_BUTTON_RIGHT,
01697
gptCursorAsync,
01698 fButtonUp,
01699
NtGetTickCount(),
01700 0
L,
01701
FALSE,
01702
FALSE);
01703 }
01704
gwMKButtonState = NewButtonState;
01705
01706
PostAccessibility( ACCESS_MOUSEKEYS );
01707
01708
return FALSE;
01709 }
01710
01711
01712
01713
01714
01715
01716
01717
01718
01719
01720
01721
01722 BOOL MKButtonSelect(WORD ThisButton)
01723 {
01724
gwMKCurrentButton = ThisButton;
01725
01726
PostAccessibility( ACCESS_MOUSEKEYS );
01727
return FALSE;
01728 }
01729
01730
01731
01732
01733
01734
01735
01736
01737
01738
01739
01740 BOOL xxxMKButtonDoubleClick(USHORT NotUsed)
01741 {
01742
xxxMKButtonClick(0);
01743
xxxMKButtonClick(0);
01744
return FALSE;
01745
01746 UNREFERENCED_PARAMETER(NotUsed);
01747 }
01748
01749 BOOL HighContrastHotKey(PKE pKeyEvent, ULONG ExtraInformation,
int NotUsed) {
01750
int CurrentModState;
01751
int fBreak;
01752
BYTE Vk;
01753
01754
01755
CheckCritIn();
01756
01757 Vk = (
BYTE)(pKeyEvent->usFlaggedVk & 0xff);
01758 fBreak = pKeyEvent->usFlaggedVk & KBDBREAK;
01759 CurrentModState =
gLockBits |
gLatchBits |
gPhysModifierState;
01760
01761
if (!
TEST_ACCESSFLAG(HighContrast, HCF_HIGHCONTRASTON)) {
01762
if (
TEST_ACCESSFLAG(HighContrast, HCF_HOTKEYACTIVE) && Vk == VK_SNAPSHOT && !fBreak && CurrentModState ==
MOUSEKEYMODBITS) {
01763
01764
if (
TEST_ACCESSFLAG(HighContrast, MKF_HOTKEYSOUND)) {
01765
PTERMINAL pTerm =
grpdeskRitInput->
rpwinstaParent->
pTerm;
01766
PostRitSound(
01767 pTerm,
01768
RITSOUND_UPSIREN);
01769 }
01770
01771
PostAccessNotification(ACCESS_HIGHCONTRAST);
01772
01773
return FALSE;
01774 }
01775 }
else {
01776
if (
TEST_ACCESSFLAG(HighContrast, HCF_HOTKEYACTIVE) && Vk == VK_SNAPSHOT && !fBreak && CurrentModState ==
MOUSEKEYMODBITS) {
01777
01778
CLEAR_ACCESSFLAG(HighContrast, HCF_HIGHCONTRASTON);
01779
01780
if (
TEST_ACCESSFLAG(HighContrast, MKF_HOTKEYSOUND)) {
01781
PTERMINAL pTerm =
grpdeskRitInput->
rpwinstaParent->
pTerm;
01782
PostRitSound(
01783 pTerm,
01784
RITSOUND_DOWNSIREN);
01785 }
01786
01787
if (
gspwndLogonNotify !=
NULL) {
01788
01789
_PostMessage(
gspwndLogonNotify, WM_LOGONNOTIFY,
01790 LOGON_ACCESSNOTIFY, ACCESS_HIGHCONTRASTOFF);
01791 }
01792 }
01793 }
01794
return TRUE;
01795 UNREFERENCED_PARAMETER(NotUsed);
01796 UNREFERENCED_PARAMETER(ExtraInformation);
01797 }
01798
01799
01800
01801
01802
01803
01804
01805
01806
01807
01808
01809
01810
01811
01812
01813 BOOL MouseKeys(PKE pKeyEvent, ULONG ExtraInformation,
int NotUsed)
01814 {
01815
int CurrentModState;
01816
int fBreak;
01817
BYTE Vk;
01818
USHORT FlaggedVk;
01819
int i;
01820
01821
CheckCritIn();
01822 Vk = (
BYTE)(pKeyEvent->usFlaggedVk & 0xff);
01823 fBreak = pKeyEvent->usFlaggedVk & KBDBREAK;
01824 CurrentModState =
gLockBits |
gLatchBits |
gPhysModifierState;
01825
01826
if (!
TEST_ACCESSFLAG(
MouseKeys, MKF_MOUSEKEYSON)) {
01827
01828
01829
01830
01831
#ifdef FE_SB // MouseKeys()
01832
if (
TEST_ACCESSFLAG(
MouseKeys, MKF_HOTKEYACTIVE) && Vk ==
gNumLockVk && !fBreak && CurrentModState ==
MOUSEKEYMODBITS) {
01833
#else // FE_SB
01834
if (
TEST_ACCESSFLAG(
MouseKeys, MKF_HOTKEYACTIVE) && Vk == VK_NUMLOCK && !fBreak && CurrentModState ==
MOUSEKEYMODBITS) {
01835
#endif // FE_SB
01836
gMKPreviousVk = Vk;
01837
if (
TEST_ACCESSFLAG(
MouseKeys, MKF_HOTKEYSOUND)) {
01838
PTERMINAL pTerm =
grpdeskRitInput->
rpwinstaParent->
pTerm;
01839
PostRitSound(
01840 pTerm,
01841
RITSOUND_UPSIREN);
01842 }
01843
PostAccessNotification(ACCESS_MOUSEKEYS);
01844
01845
return FALSE;
01846 }
01847 }
else {
01848
01849
01850
01851
01852 FlaggedVk = Vk | (pKeyEvent->usFlaggedVk & KBDEXT);
01853
for (i = 0; i <
cMouseVKeys; i++) {
01854
#ifdef FE_SB // MouseKeys()
01855
if (FlaggedVk ==
gpusMouseVKey[i]) {
01856
#else // FE_SB
01857
if (FlaggedVk ==
ausMouseVKey[i]) {
01858
#endif // FE_SB
01859
break;
01860 }
01861 }
01862
01863
if (i ==
cMouseVKeys) {
01864
return TRUE;
01865 }
01866
01867
01868
01869
01870
01871
if (!
gbMKMouseMode) {
01872
#ifdef FE_SB // MouseKeys()
01873
if (Vk !=
gNumLockVk) {
01874
#else // FE_SB
01875
if (Vk != VK_NUMLOCK) {
01876
#endif // FE_SB
01877
return TRUE;
01878 }
01879 }
01880
01881
01882
01883
01884
01885
if (Vk == VK_DELETE && CurrentModState &
LRALT && CurrentModState &
LRCONTROL) {
01886
return TRUE;
01887 }
01888
if (fBreak) {
01889
01890
01891
01892
01893
if (
gMKPreviousVk == Vk) {
01894
if (
gtmridMKMoveCursor != 0) {
01895
KILLRITTIMER(
NULL,
gtmridMKMoveCursor);
01896
gtmridMKMoveCursor = 0;
01897 }
01898
CLEAR_ACCF(
ACCF_MKREPEATVK);
01899
gMKPreviousVk = 0;
01900 }
01901
01902
01903
01904
#ifdef FE_SB // MouseKeys()
01905
if (Vk ==
gNumLockVk) {
01906
#else // FE_SB
01907
if (Vk == VK_NUMLOCK) {
01908
#endif // FE_SB
01909
return TRUE;
01910 }
else {
01911
return FALSE;
01912 }
01913 }
else {
01914
SET_OR_CLEAR_ACCF(
ACCF_MKREPEATVK,
01915 (
gMKPreviousVk == Vk));
01916
01917
01918
01919
01920
if ((!
TEST_ACCF(
ACCF_MKREPEATVK)) && (
gtmridMKMoveCursor)) {
01921
KILLRITTIMER(
NULL,
gtmridMKMoveCursor);
01922
gtmridMKMoveCursor = 0;
01923 }
01924
gMKPreviousVk = Vk;
01925 }
01926
return aMouseKeyEvent[i](
ausMouseKeyData[i]);
01927 }
01928
return TRUE;
01929
01930 UNREFERENCED_PARAMETER(NotUsed);
01931 UNREFERENCED_PARAMETER(ExtraInformation);
01932
01933 }
01934
01935
01936
01937
01938
01939
01940
01941
01942
01943
01944 VOID TurnOffMouseKeys(VOID)
01945 {
01946
CLEAR_ACCESSFLAG(
MouseKeys, MKF_MOUSEKEYSON);
01947
01948
CLEAR_ACCF(
ACCF_MKREPEATVK);
01949
MKHideMouseCursor();
01950
if (
TEST_ACCESSFLAG(
MouseKeys, MKF_HOTKEYSOUND)) {
01951
PostRitSound(
01952
grpdeskRitInput->
rpwinstaParent->
pTerm,
01953
RITSOUND_DOWNSIREN);
01954 }
01955
PostAccessibility( ACCESS_MOUSEKEYS );
01956 }
01957
01958
01959
01960
01961
01962
01963
01964
01965
01966
01967
01968
01969
01970
01971
01972
01973 VOID CalculateMouseTable(VOID)
01974 {
01975
long Total_Distance;
01976
01977
long Accel_Per_Tick;
01978
long Current_Speed;
01979
long Max_Speed;
01980
long Real_Total_Distance;
01981
long Real_Delta_Distance;
01982
int i;
01983
int Num_Constant_Table,Num_Accel_Table;
01984
01985
01986 Max_Speed =
gMouseKeys.iMaxSpeed;
01987 Max_Speed *= 1000 /
MOUSETICKS;
01988
01989 Accel_Per_Tick = Max_Speed * 1000 / (
gMouseKeys.iTimeToMaxSpeed *
MOUSETICKS);
01990 Current_Speed = 0;
01991 Total_Distance = 0;
01992 Real_Total_Distance = 0;
01993 Num_Constant_Table = 0;
01994 Num_Accel_Table = 0;
01995
01996
for(i=0; i<= 255; i++) {
01997 Current_Speed = Current_Speed + Accel_Per_Tick;
01998
if (Current_Speed > Max_Speed) {
01999 Current_Speed = Max_Speed;
02000 }
02001 Total_Distance += Current_Speed;
02002
02003
02004
02005
02006 Real_Delta_Distance = ((Total_Distance - (Real_Total_Distance * 1000)) + 500) / 1000 ;
02007
02008
02009
02010 Real_Total_Distance = Real_Total_Distance + Real_Delta_Distance;
02011
02012
if ((Current_Speed < Max_Speed) && (Num_Accel_Table < 128)) {
02013
gMouseCursor.bAccelTable[Num_Accel_Table++] = (
BYTE)Real_Delta_Distance;
02014 }
02015
02016
if ((Current_Speed == Max_Speed) && (Num_Constant_Table < 128)) {
02017
gMouseCursor.bConstantTable[Num_Constant_Table++] = (
BYTE)Real_Delta_Distance;
02018 }
02019
02020 }
02021
gMouseCursor.bAccelTableLen = (
BYTE)Num_Accel_Table;
02022
gMouseCursor.bConstantTableLen = (
BYTE)Num_Constant_Table;
02023 }
02024
02025
02026
02027
02028
02029
02030
02031
02032
02033
02034
02035
02036
02037
02038
02039
02040 VOID xxxToggleKeysTimer(
PWND pwnd, UINT message, UINT_PTR nID, LPARAM lParam)
02041 {
02042 KE ToggleKeyEvent;
02043
PTERMINAL pTerm =
grpdeskRitInput->
rpwinstaParent->
pTerm;
02044
02045
CheckCritIn();
02046
02047
02048
02049
if (
TEST_ACCESSFLAG(
ToggleKeys, TKF_TOGGLEKEYSON)) {
02050
CLEAR_ACCESSFLAG(
ToggleKeys, TKF_TOGGLEKEYSON);
02051
if (
TEST_ACCESSFLAG(
ToggleKeys, TKF_HOTKEYSOUND)) {
02052
PostRitSound(
02053 pTerm,
02054
RITSOUND_DOWNSIREN);
02055 }
02056 }
else {
02057
if (
TEST_ACCESSFLAG(
ToggleKeys, TKF_HOTKEYSOUND)) {
02058
PostRitSound(
02059 pTerm,
02060
RITSOUND_UPSIREN);
02061 }
02062
02063
PostAccessNotification(ACCESS_TOGGLEKEYS);
02064 }
02065
02066
02067
02068
02069
02070 ToggleKeyEvent.bScanCode =
gTKScanCode;
02071
#ifdef FE_SB // ToggleKeysTimer()
02072
ToggleKeyEvent.usFlaggedVk =
gNumLockVk | KBDBREAK;
02073
#else
02074
ToggleKeyEvent.usFlaggedVk = VK_NUMLOCK | KBDBREAK;
02075
#endif // FE_SB
02076
if (
AccessProceduresStream(&ToggleKeyEvent,
gTKExtraInformation,
gTKNextProcIndex)) {
02077
xxxProcessKeyEvent(&ToggleKeyEvent,
gTKExtraInformation,
FALSE);
02078 }
02079
#ifdef FE_SB // ToggleKeysTimer()
02080
ToggleKeyEvent.usFlaggedVk =
gNumLockVk;
02081
#else
02082
ToggleKeyEvent.usFlaggedVk = VK_NUMLOCK;
02083
#endif // FE_SB
02084
if (
AccessProceduresStream(&ToggleKeyEvent,
gTKExtraInformation,
gTKNextProcIndex)) {
02085
xxxProcessKeyEvent(&ToggleKeyEvent,
gTKExtraInformation,
FALSE);
02086 }
02087
return;
02088
02089 UNREFERENCED_PARAMETER(pwnd);
02090 UNREFERENCED_PARAMETER(message);
02091 UNREFERENCED_PARAMETER(nID);
02092 UNREFERENCED_PARAMETER(lParam);
02093 }
02094
02095
02096
02097
02098
02099
02100
02101
02102
02103
02104
02105
02106
02107
02108 BOOL ToggleKeys(PKE pKeyEvent, ULONG ExtraInformation,
int NextProcIndex)
02109 {
02110
int fBreak;
02111
BYTE Vk;
02112
02113
CheckCritIn();
02114 Vk = (
BYTE)pKeyEvent->usFlaggedVk;
02115 fBreak = pKeyEvent->usFlaggedVk & KBDBREAK;
02116
02117
02118
02119
02120
02121
switch (Vk) {
02122
case VK_NUMLOCK:
02123
#ifdef FE_SB // ToggleKeys()
02124
NumLockProc:
02125
#endif // FE_SB
02126
02127
02128
02129
02130
if ((
gLockBits |
gLatchBits |
gPhysModifierState) ==
MOUSEKEYMODBITS &&
02131
TEST_ACCESSFLAG(
MouseKeys, MKF_HOTKEYACTIVE)) {
02132
break;
02133 }
02134
if (fBreak)
02135 {
02136
02137
02138
02139
02140
02141
KILLRITTIMER(
NULL,
gtmridToggleKeys);
02142
gtmridToggleKeys = 0;
02143
gTKExtraInformation = 0;
02144
gTKScanCode = 0;
02145 }
02146
else
02147 {
02148
if (
gtmridToggleKeys == 0 &&
02149
TEST_ACCESSFLAG(
ToggleKeys, TKF_HOTKEYACTIVE))
02150 {
02151
02152
02153
02154
02155
gTKExtraInformation = ExtraInformation;
02156
gTKScanCode = pKeyEvent->bScanCode;
02157
gTKNextProcIndex = NextProcIndex;
02158
gtmridToggleKeys =
InternalSetTimer(
02159
NULL,
02160 0,
02161
TOGGLEKEYTOGGLETIME,
02162
xxxToggleKeysTimer,
02163 TMRF_RIT | TMRF_ONESHOT
02164 );
02165 }
02166 }
02167
02168
02169
02170
02171
if (
TEST_ACCESSFLAG(
MouseKeys, MKF_MOUSEKEYSON)) {
02172
break;
02173 }
02174
02175
02176
case VK_SCROLL:
02177
case VK_CAPITAL:
02178
#ifdef FE_SB // ToggleKeys()
02179
CapitalProc:
02180
#endif // FE_SB
02181
if (
TEST_ACCESSFLAG(
ToggleKeys, TKF_TOGGLEKEYSON) && !fBreak) {
02182
if (!
TestAsyncKeyStateDown(Vk)) {
02183
PTERMINAL pTerm =
grpdeskRitInput->
rpwinstaParent->
pTerm;
02184
if (!
TestAsyncKeyStateToggle(Vk)) {
02185
PostRitSound(
02186 pTerm,
02187
RITSOUND_HIGHBEEP);
02188 }
else {
02189
PostRitSound(
02190 pTerm,
02191
RITSOUND_LOWBEEP);
02192 }
02193 }
02194 }
02195
break;
02196
02197
default:
02198
#ifdef FE_SB // ToggleKeys()
02199
if (Vk ==
gNumLockVk)
goto NumLockProc;
02200
if (Vk ==
gOemScrollVk)
goto CapitalProc;
02201
#endif // FE_SB
02202
if (
gtmridToggleKeys != 0) {
02203
KILLRITTIMER(
NULL,
gtmridToggleKeys);
02204 }
02205 }
02206
02207
return TRUE;
02208 }
02209
02210
02211
02212
02213
02214
02215
02216
02217
02218
02219
02220
02221
02222
02223
02224
02225 VOID xxxAccessTimeOutTimer(
PWND pwnd, UINT message, UINT_PTR nID, LPARAM lParam)
02226 {
02227
CheckCritIn();
02228
02229
02230
02231
02232
02233
02234
if (
TEST_ACCESSFLAG(
FilterKeys, FKF_FILTERKEYSON) ||
02235
TEST_ACCESSFLAG(StickyKeys, SKF_STICKYKEYSON) ||
02236
TEST_ACCESSFLAG(
MouseKeys, MKF_MOUSEKEYSON) ||
02237
TEST_ACCESSFLAG(
ToggleKeys, TKF_TOGGLEKEYSON) ||
02238
TEST_ACCESSFLAG(SoundSentry, SSF_SOUNDSENTRYON) ||
02239
TEST_ACCESSFLAG(HighContrast, HCF_HIGHCONTRASTON) ||
02240
TEST_ACCF(
ACCF_SHOWSOUNDSON)) {
02241
02242
PTERMINAL pTerm =
grpdeskRitInput->
rpwinstaParent->
pTerm;
02243
CLEAR_ACCESSFLAG(
FilterKeys, FKF_FILTERKEYSON);
02244
xxxTurnOffStickyKeys();
02245
CLEAR_ACCESSFLAG(
MouseKeys, MKF_MOUSEKEYSON);
02246
CLEAR_ACCESSFLAG(
ToggleKeys, TKF_TOGGLEKEYSON);
02247
CLEAR_ACCESSFLAG(SoundSentry, SSF_SOUNDSENTRYON);
02248
CLEAR_ACCF(
ACCF_SHOWSOUNDSON);
02249
CLEAR_ACCESSFLAG(HighContrast, HCF_HIGHCONTRASTON);
02250
02251
if (
gspwndLogonNotify !=
NULL) {
02252
02253
_PostMessage(
gspwndLogonNotify, WM_LOGONNOTIFY,
02254 LOGON_ACCESSNOTIFY, ACCESS_HIGHCONTRASTOFF);
02255 }
02256
02257
if (
TEST_ACCESSFLAG(AccessTimeOut, ATF_ONOFFFEEDBACK)) {
02258
PostRitSound(
02259 pTerm,
02260
RITSOUND_DOWNSIREN);
02261 }
02262
PostAccessibility( ACCESS_MOUSEKEYS );
02263
02264
PostAccessibility( ACCESS_FILTERKEYS );
02265
02266
PostAccessibility( ACCESS_STICKYKEYS );
02267
02268 }
02269
SetAccessEnabledFlag();
02270
return;
02271
02272
02273 UNREFERENCED_PARAMETER(pwnd);
02274 UNREFERENCED_PARAMETER(message);
02275 UNREFERENCED_PARAMETER(nID);
02276 UNREFERENCED_PARAMETER(lParam);
02277 }
02278
02279
02280
02281
02282
02283
02284
02285
02286
02287
02288
02289 VOID AccessTimeOutReset()
02290 {
02291
02292
if (
gtmridAccessTimeOut != 0) {
02293
KILLRITTIMER(
NULL,
gtmridAccessTimeOut);
02294 }
02295
if (
TEST_ACCESSFLAG(AccessTimeOut, ATF_TIMEOUTON)) {
02296
gtmridAccessTimeOut =
InternalSetTimer(
02297
NULL,
02298 0,
02299 (
UINT)
gAccessTimeOut.iTimeOutMSec,
02300
xxxAccessTimeOutTimer,
02301 TMRF_RIT | TMRF_ONESHOT
02302 );
02303 }
02304 }
02305
02306
02307
02308
02309
02310
02311
02312
02313
void
02314 xxxUpdatePerUserAccessPackSettings(PUNICODE_STRING pProfileUserName)
02315 {
02316 LUID luidCaller;
02317
NTSTATUS status;
02318
BOOL fSystem =
FALSE;
02319
BOOL fRegFilterKeysOn;
02320
BOOL fRegStickyKeysOn;
02321
BOOL fRegMouseKeysOn;
02322
BOOL fRegToggleKeysOn;
02323
BOOL fRegTimeOutOn;
02324
BOOL fRegKeyboardPref;
02325
BOOL fRegScreenReader;
02326
BOOL fRegHighContrastOn;
02327
DWORD dwDefFlags;
02328 UNICODE_STRING usHighContrastScheme;
02329 WCHAR wcHighContrastScheme[MAX_SCHEME_NAME_SIZE];
02330
02331 status =
GetProcessLuid(
NULL, &luidCaller);
02332
02333
02334
02335
02336
02337
02338
02339
02340
02341
02342
02343
if (
RtlEqualLuid(&luidCaller, &
luidSystem)) {
02344 fSystem =
TRUE;
02345 }
02346
02347
02348
02349 dwDefFlags =
FastGetProfileIntW(pProfileUserName,
02350
PMAP_KEYBOARDRESPONSE,
02351 TEXT(
"Flags"),
02352 0
02353 );
02354 fRegFilterKeysOn = (dwDefFlags & FKF_FILTERKEYSON) != 0;
02355
02356 dwDefFlags =
FastGetProfileIntW(pProfileUserName,
02357
PMAP_STICKYKEYS,
02358 TEXT(
"Flags"),
02359 0
02360 );
02361 fRegStickyKeysOn = (dwDefFlags & SKF_STICKYKEYSON) != 0;
02362
02363 dwDefFlags =
FastGetProfileIntW(pProfileUserName,
02364
PMAP_MOUSEKEYS,
02365 TEXT(
"Flags"),
02366 0
02367 );
02368 fRegMouseKeysOn = (dwDefFlags & MKF_MOUSEKEYSON) != 0;
02369
02370 dwDefFlags =
FastGetProfileIntW(pProfileUserName,
02371
PMAP_TOGGLEKEYS,
02372 TEXT(
"Flags"),
02373 0
02374 );
02375 fRegToggleKeysOn = (dwDefFlags & TKF_TOGGLEKEYSON) != 0;
02376
02377 fRegKeyboardPref = !!
FastGetProfileIntW(pProfileUserName,
02378
PMAP_KEYBOARDPREF,
02379 TEXT(
"On"),
02380 0
02381 );
02382
02383 fRegScreenReader = !!
FastGetProfileIntW(pProfileUserName,
02384
PMAP_SCREENREADER,
02385 TEXT(
"On"),
02386 0
02387 );
02388
02389 dwDefFlags =
FastGetProfileIntW(pProfileUserName,
02390
PMAP_TIMEOUT,
02391 TEXT(
"Flags"),
02392 0
02393 );
02394 fRegTimeOutOn = (dwDefFlags & ATF_TIMEOUTON) != 0;
02395
02396 dwDefFlags =
FastGetProfileIntW(pProfileUserName,
02397
PMAP_HIGHCONTRAST,
02398 TEXT(
"Flags"),
02399 0
02400 );
02401 fRegHighContrastOn = (dwDefFlags & HCF_HIGHCONTRASTON) != 0;
02402
02403
if (fSystem) {
02404
02405
02406
02407
02408
02409
if (fRegFilterKeysOn) {
02410
SET_ACCF(
ACCF_DEFAULTFILTERKEYSON);
02411
SET_ACCESSFLAG(
FilterKeys, FKF_FILTERKEYSON);
02412 }
else {
02413
CLEAR_ACCF(
ACCF_DEFAULTFILTERKEYSON);
02414
CLEAR_ACCESSFLAG(
FilterKeys, FKF_FILTERKEYSON);
02415 }
02416
02417
02418
02419
02420
02421
02422
if (
TEST_ACCESSFLAG(StickyKeys, SKF_STICKYKEYSON) && (fRegFilterKeysOn == 0)) {
02423
xxxTurnOffStickyKeys();
02424 }
02425
02426
if (fRegStickyKeysOn) {
02427
SET_ACCF(
ACCF_DEFAULTSTICKYKEYSON);
02428
SET_ACCESSFLAG(StickyKeys, SKF_STICKYKEYSON);
02429 }
else {
02430
CLEAR_ACCF(
ACCF_DEFAULTSTICKYKEYSON);
02431
CLEAR_ACCESSFLAG(StickyKeys, SKF_STICKYKEYSON);
02432 }
02433
02434
if (fRegMouseKeysOn) {
02435
SET_ACCF(
ACCF_DEFAULTMOUSEKEYSON);
02436
SET_ACCESSFLAG(
MouseKeys, MKF_MOUSEKEYSON);
02437 }
else {
02438
CLEAR_ACCF(
ACCF_DEFAULTMOUSEKEYSON);
02439
CLEAR_ACCESSFLAG(
MouseKeys, MKF_MOUSEKEYSON);
02440 }
02441
02442
if (fRegToggleKeysOn) {
02443
SET_ACCF(
ACCF_DEFAULTTOGGLEKEYSON);
02444
SET_ACCESSFLAG(
ToggleKeys, TKF_TOGGLEKEYSON);
02445 }
else {
02446
CLEAR_ACCF(
ACCF_DEFAULTTOGGLEKEYSON);
02447
CLEAR_ACCESSFLAG(
ToggleKeys, TKF_TOGGLEKEYSON);
02448 }
02449
02450
if (fRegTimeOutOn) {
02451
SET_ACCF(
ACCF_DEFAULTTIMEOUTON);
02452
SET_ACCESSFLAG(AccessTimeOut, ATF_TIMEOUTON);
02453 }
else {
02454
CLEAR_ACCF(
ACCF_DEFAULTTIMEOUTON);
02455
CLEAR_ACCESSFLAG(AccessTimeOut, ATF_TIMEOUTON);
02456 }
02457
02458
if (fRegKeyboardPref) {
02459
SET_ACCF(
ACCF_DEFAULTKEYBOARDPREF);
02460
SET_ACCF(
ACCF_KEYBOARDPREF);
02461
gpsi->bKeyboardPref =
TRUE;
02462 }
else {
02463
CLEAR_ACCF(
ACCF_DEFAULTKEYBOARDPREF);
02464
CLEAR_ACCF(
ACCF_KEYBOARDPREF);
02465
gpsi->bKeyboardPref =
FALSE;
02466 }
02467
02468
if (fRegScreenReader) {
02469
SET_ACCF(
ACCF_DEFAULTSCREENREADER);
02470
SET_ACCF(
ACCF_SCREENREADER);
02471 }
else {
02472
CLEAR_ACCF(
ACCF_DEFAULTSCREENREADER);
02473
CLEAR_ACCF(
ACCF_SCREENREADER);
02474 }
02475
02476
if (fRegHighContrastOn) {
02477
SET_ACCF(
ACCF_DEFAULTHIGHCONTRASTON);
02478
SET_ACCESSFLAG(HighContrast, HCF_HIGHCONTRASTON);
02479 }
else {
02480
CLEAR_ACCF(
ACCF_DEFAULTHIGHCONTRASTON);
02481
CLEAR_ACCESSFLAG(HighContrast, HCF_HIGHCONTRASTON);
02482 }
02483 }
else {
02484
02485
02486
02487
02488
02489
02490
02491
02492
02493
02494
if (
TEST_BOOL_ACCESSFLAG(
FilterKeys, FKF_FILTERKEYSON) ==
02495
TEST_BOOL_ACCF(
ACCF_DEFAULTFILTERKEYSON)) {
02496
02497
02498
02499
02500
02501
SET_OR_CLEAR_ACCESSFLAG(
FilterKeys, FKF_FILTERKEYSON, fRegFilterKeysOn);
02502 }
02503
02504
if (
TEST_BOOL_ACCESSFLAG(StickyKeys, SKF_STICKYKEYSON) ==
02505
TEST_BOOL_ACCF(
ACCF_DEFAULTSTICKYKEYSON)) {
02506
02507
02508
02509
02510
02511
if (
TEST_ACCESSFLAG(StickyKeys, SKF_STICKYKEYSON) &&
02512 (fRegStickyKeysOn == 0)) {
02513
02514
xxxTurnOffStickyKeys();
02515 }
02516
02517
SET_OR_CLEAR_ACCESSFLAG(StickyKeys, SKF_STICKYKEYSON, fRegStickyKeysOn);
02518 }
02519
02520
if (
TEST_BOOL_ACCESSFLAG(
MouseKeys, MKF_MOUSEKEYSON) ==
02521
TEST_BOOL_ACCF(
ACCF_DEFAULTMOUSEKEYSON)) {
02522
02523
02524
02525
02526
SET_OR_CLEAR_ACCESSFLAG(
MouseKeys, MKF_MOUSEKEYSON, fRegMouseKeysOn);
02527 }
02528
02529
if (
TEST_BOOL_ACCESSFLAG(
ToggleKeys, TKF_TOGGLEKEYSON) ==
02530
TEST_BOOL_ACCF(
ACCF_DEFAULTTOGGLEKEYSON)) {
02531
02532
02533
02534
02535
SET_OR_CLEAR_ACCESSFLAG(
ToggleKeys, TKF_TOGGLEKEYSON, fRegToggleKeysOn);
02536 }
02537
02538
if (
TEST_BOOL_ACCESSFLAG(AccessTimeOut, ATF_TIMEOUTON) ==
02539
TEST_BOOL_ACCF(
ACCF_DEFAULTTIMEOUTON)) {
02540
02541
02542
02543
02544
SET_OR_CLEAR_ACCESSFLAG(AccessTimeOut, ATF_TIMEOUTON, fRegTimeOutOn);
02545 }
02546
02547
if (
TEST_BOOL_ACCF(
ACCF_KEYBOARDPREF) ==
02548
TEST_BOOL_ACCF(
ACCF_DEFAULTKEYBOARDPREF)) {
02549
02550
02551
02552
02553
SET_OR_CLEAR_ACCF(
ACCF_KEYBOARDPREF, fRegKeyboardPref);
02554 }
02555
02556
if (
TEST_BOOL_ACCF(
ACCF_SCREENREADER) ==
02557
TEST_BOOL_ACCF(
ACCF_DEFAULTSCREENREADER)) {
02558
02559
02560
02561
02562
SET_OR_CLEAR_ACCF(
ACCF_SCREENREADER, fRegScreenReader);
02563 }
02564
02565
if (
TEST_BOOL_ACCESSFLAG(HighContrast, HCF_HIGHCONTRASTON) ==
02566
TEST_BOOL_ACCF(
ACCF_DEFAULTHIGHCONTRASTON)) {
02567
02568
02569
02570
02571
SET_OR_CLEAR_ACCESSFLAG(HighContrast, HCF_HIGHCONTRASTON, fRegHighContrastOn);
02572 }
02573 }
02574
02575
02576
02577
02578
02579
02580
02581
02582
02583
02584
02585
02586
02587
02588
02589 dwDefFlags =
FastGetProfileIntW(pProfileUserName,
02590
PMAP_KEYBOARDRESPONSE,
02591 TEXT(
"Flags"),
02592 82
02593 );
02594
02595
SET_OR_CLEAR_FLAG(
02596 dwDefFlags,
02597 FKF_FILTERKEYSON,
02598
TEST_ACCESSFLAG(
FilterKeys, FKF_FILTERKEYSON));
02599
02600
gFilterKeys.dwFlags = dwDefFlags;
02601
gFilterKeys.iWaitMSec =
FastGetProfileIntW(pProfileUserName,
02602
PMAP_KEYBOARDRESPONSE,
02603 TEXT(
"DelayBeforeAcceptance"),
02604 1000
02605 );
02606
02607
gFilterKeys.iRepeatMSec =
FastGetProfileIntW(pProfileUserName,
02608
PMAP_KEYBOARDRESPONSE,
02609 TEXT(
"AutoRepeatRate"),
02610 500
02611 );
02612
02613
gFilterKeys.iDelayMSec =
FastGetProfileIntW(pProfileUserName,
02614
PMAP_KEYBOARDRESPONSE,
02615 TEXT(
"AutoRepeatDelay"),
02616 1000
02617 );
02618
02619
gFilterKeys.iBounceMSec =
FastGetProfileIntW(pProfileUserName,
02620
PMAP_KEYBOARDRESPONSE,
02621 TEXT(
"BounceTime"),
02622 0
02623 );
02624
02625
02626
02627
02628
02629
02630
02631
02632
02633
02634
02635
gSoundSentry.dwFlags =
FastGetProfileIntW(pProfileUserName,
02636
PMAP_SOUNDSENTRY,
02637 TEXT(
"Flags"),
02638 2
02639 );
02640
02641
gSoundSentry.iFSTextEffect =
FastGetProfileIntW(pProfileUserName,
02642
PMAP_SOUNDSENTRY,
02643 TEXT(
"FSTextEffect"),
02644 0
02645 );
02646
02647
gSoundSentry.iWindowsEffect =
FastGetProfileIntW(pProfileUserName,
02648
PMAP_SOUNDSENTRY,
02649 TEXT(
"WindowsEffect"),
02650 0
02651 );
02652
02653
02654
02655
02656
SET_OR_CLEAR_ACCF(
ACCF_SHOWSOUNDSON,
FastGetProfileIntW(pProfileUserName,
02657
PMAP_SHOWSOUNDS,
02658 TEXT(
"On"),
02659 0
02660 ));
02661
02662
02663
02664
02665
02666
02667
02668
02669
02670
02671
02672
02673
02674
02675
02676
02677 dwDefFlags =
FastGetProfileIntW(pProfileUserName,
02678
PMAP_STICKYKEYS,
02679 TEXT(
"Flags"),
02680 466
02681 );
02682
02683
SET_OR_CLEAR_FLAG(
02684 dwDefFlags,
02685 SKF_STICKYKEYSON,
02686
TEST_ACCESSFLAG(StickyKeys, SKF_STICKYKEYSON));
02687
02688
gStickyKeys.dwFlags = dwDefFlags;
02689
02690
02691
02692
02693
02694
02695
02696
02697
02698
02699
02700
02701
02702
02703
02704 dwDefFlags =
FastGetProfileIntW(pProfileUserName,
02705
PMAP_MOUSEKEYS,
02706 TEXT(
"Flags"),
02707 18
02708 );
02709
02710
SET_OR_CLEAR_FLAG(
02711 dwDefFlags,
02712 MKF_MOUSEKEYSON,
02713
TEST_ACCESSFLAG(
MouseKeys, MKF_MOUSEKEYSON));
02714
02715
gMouseKeys.dwFlags = dwDefFlags;
02716
gMouseKeys.iMaxSpeed =
FastGetProfileIntW(pProfileUserName,
02717
PMAP_MOUSEKEYS,
02718 TEXT(
"MaximumSpeed"),
02719 40
02720 );
02721
02722
gMouseKeys.iTimeToMaxSpeed =
FastGetProfileIntW(pProfileUserName,
02723
PMAP_MOUSEKEYS,
02724 TEXT(
"TimeToMaximumSpeed"),
02725 3000
02726 );
02727
CalculateMouseTable();
02728
02729
gbMKMouseMode =
02730
#ifdef FE_SB
02731
(
TestAsyncKeyStateToggle(
gNumLockVk) != 0) ^
02732
#else // FE_SB
02733
(
TestAsyncKeyStateToggle(VK_NUMLOCK) != 0) ^
02734
#endif // FE_SB
02735
(
TEST_ACCESSFLAG(
MouseKeys, MKF_REPLACENUMBERS) != 0);
02736
02737
02738
02739
02740
02741
02742
if (
TEST_ACCESSFLAG(
MouseKeys, MKF_MOUSEKEYSON)) {
02743
MKShowMouseCursor();
02744 }
else {
02745
MKHideMouseCursor();
02746 }
02747
02748
02749
02750
02751
02752
02753
02754
02755
02756
02757
02758
02759
02760 dwDefFlags =
FastGetProfileIntW(pProfileUserName,
02761
PMAP_TOGGLEKEYS,
02762 TEXT(
"Flags"),
02763 18
02764 );
02765
02766
SET_OR_CLEAR_FLAG(
02767 dwDefFlags,
02768 TKF_TOGGLEKEYSON,
02769
TEST_ACCESSFLAG(
ToggleKeys, TKF_TOGGLEKEYSON));
02770
02771
gToggleKeys.dwFlags = dwDefFlags;
02772
02773
02774
02775
02776
02777
02778
02779
02780
02781 dwDefFlags =
FastGetProfileIntW(pProfileUserName,
02782
PMAP_TIMEOUT,
02783 TEXT(
"Flags"),
02784 2
02785 );
02786
02787
SET_OR_CLEAR_FLAG(
02788 dwDefFlags,
02789 ATF_TIMEOUTON,
02790
TEST_ACCESSFLAG(AccessTimeOut, ATF_TIMEOUTON));
02791
02792
gAccessTimeOut.dwFlags = dwDefFlags;
02793
02794
#ifdef FE_SB //
02795
if (
gpKbdNlsTbl) {
02796
02797
02798
02799
if ((
gpKbdNlsTbl->NumOfMouseVKey ==
cMouseVKeys) &&
02800 (
gpKbdNlsTbl->pusMouseVKey !=
NULL)) {
02801
02802
02803
02804
gpusMouseVKey =
gpKbdNlsTbl->pusMouseVKey;
02805 }
02806
02807
02808
02809
02810
if (
gpKbdNlsTbl->LayoutInformation & NLSKBD_INFO_ACCESSIBILITY_KEYMAP) {
02811
02812
02813
02814
gNumLockVk = VK_HOME;
02815
gOemScrollVk = VK_KANA;
02816 }
02817 }
02818
#endif // FE_SB
02819
02820
gAccessTimeOut.iTimeOutMSec = (
DWORD)
FastGetProfileIntW(pProfileUserName,
02821
PMAP_TIMEOUT,
02822 TEXT(
"TimeToWait"),
02823 300000
02824 );
02825
02826
02827
02828
02829
02830 dwDefFlags =
FastGetProfileIntW(pProfileUserName,
02831
PMAP_HIGHCONTRAST,
02832 TEXT(
"Flags"),
02833 HCF_AVAILABLE | HCF_HOTKEYSOUND | HCF_HOTKEYAVAILABLE
02834 );
02835
02836
SET_OR_CLEAR_FLAG(
02837 dwDefFlags,
02838 HCF_HIGHCONTRASTON,
02839
TEST_ACCESSFLAG(HighContrast, HCF_HIGHCONTRASTON));
02840
02841
gHighContrast.dwFlags = dwDefFlags;
02842
02843
02844
02845
02846
02847 usHighContrastScheme.Buffer = wcHighContrastScheme;
02848
if (
FastGetProfileStringW(pProfileUserName,
02849
PMAP_HIGHCONTRAST,
02850 TEXT(
"High Contrast Scheme"),
02851
NULL,
02852 wcHighContrastScheme,
02853 MAX_SCHEME_NAME_SIZE
02854 )) {
02855
02856
02857
02858
02859
02860 wcscpy(
gHighContrastDefaultScheme, usHighContrastScheme.Buffer);
02861 }
02862
02863
02864
AccessTimeOutReset();
02865
SetAccessEnabledFlag();
02866 }
02867
02868
02869
02870
02871
02872
02873
02874
02875
02876
02877
02878
02879
02880
02881 VOID SetAccessEnabledFlag(VOID)
02882 {
02883
02884
SET_OR_CLEAR_ACCF(
ACCF_ACCESSENABLED,
02885
TEST_ACCESSFLAG(
FilterKeys, FKF_FILTERKEYSON) ||
02886
TEST_ACCESSFLAG(
FilterKeys, FKF_HOTKEYACTIVE) ||
02887
TEST_ACCESSFLAG(StickyKeys, SKF_STICKYKEYSON) ||
02888
TEST_ACCESSFLAG(StickyKeys, SKF_HOTKEYACTIVE) ||
02889
TEST_ACCESSFLAG(HighContrast, HCF_HOTKEYACTIVE) ||
02890
TEST_ACCESSFLAG(
MouseKeys, MKF_MOUSEKEYSON) ||
02891
TEST_ACCESSFLAG(
MouseKeys, MKF_HOTKEYACTIVE) ||
02892
TEST_ACCESSFLAG(
ToggleKeys, TKF_TOGGLEKEYSON) ||
02893
TEST_ACCESSFLAG(
ToggleKeys, TKF_HOTKEYACTIVE) ||
02894
TEST_ACCESSFLAG(SoundSentry, SSF_SOUNDSENTRYON)||
02895
TEST_ACCF(
ACCF_SHOWSOUNDSON));
02896 }
02897
02898 VOID SoundSentryTimer(
PWND pwnd, UINT message, UINT_PTR idTimer, LPARAM lParam)
02899 {
02900
TL tlpwndT;
02901
PWND pwndSoundSentry;
02902
02903
if (pwndSoundSentry =
RevalidateHwnd(
ghwndSoundSentry)) {
02904
ThreadLock(pwndSoundSentry, &tlpwndT);
02905
xxxFlashWindow(pwndSoundSentry,
02906 (
TEST_BOOL_ACCF(
ACCF_FIRSTTICK) ? FLASHW_ALL : FLASHW_STOP),
02907 0);
02908
ThreadUnlock(&tlpwndT);
02909 }
02910
02911
if (
TEST_ACCF(
ACCF_FIRSTTICK)) {
02912
gtmridSoundSentry =
InternalSetTimer(
02913
NULL,
02914 idTimer,
02915 5,
02916
SoundSentryTimer,
02917 TMRF_RIT | TMRF_ONESHOT
02918 );
02919
CLEAR_ACCF(
ACCF_FIRSTTICK);
02920 }
else {
02921
ghwndSoundSentry =
NULL;
02922
gtmridSoundSentry = 0;
02923
SET_ACCF(
ACCF_FIRSTTICK);
02924 }
02925
02926
return;
02927
02928 UNREFERENCED_PARAMETER(pwnd);
02929 UNREFERENCED_PARAMETER(message);
02930 UNREFERENCED_PARAMETER(lParam);
02931 }
02932
02933
02934
02935
02936
02937
02938
02939
02940
02941
02942
BOOL
02943 _UserSoundSentryWorker(VOID)
02944 {
02945
PWND pwndActive;
02946
TL tlpwndT;
02947
02948
CheckCritIn();
02949
02950
02951
02952
if (!
TEST_ACCESSFLAG(SoundSentry, SSF_SOUNDSENTRYON)) {
02953
return TRUE;
02954 }
02955
02956
if ((
gpqForeground !=
NULL) && (
gpqForeground->
spwndActive !=
NULL)) {
02957 pwndActive =
gpqForeground->
spwndActive;
02958 }
else {
02959
return TRUE;
02960 }
02961
02962
switch (
gSoundSentry.iWindowsEffect) {
02963
02964
case SSWF_NONE:
02965
break;
02966
02967
case SSWF_TITLE:
02968
02969
02970
02971
if (
gtmridSoundSentry) {
02972
break;
02973 }
02974
ThreadLock(pwndActive, &tlpwndT);
02975
xxxFlashWindow(pwndActive, FLASHW_ALL, 0);
02976
ThreadUnlock(&tlpwndT);
02977
02978
ghwndSoundSentry =
HWq(pwndActive);
02979
gtmridSoundSentry =
InternalSetTimer(
02980
NULL,
02981 0,
02982 100,
02983
SoundSentryTimer,
02984 TMRF_RIT | TMRF_ONESHOT
02985 );
02986
break;
02987
02988
case SSWF_WINDOW:
02989 {
02990
02991
02992
02993 HDC hdc;
02994 RECT rc;
02995
02996 hdc =
_GetWindowDC(pwndActive);
02997
_GetWindowRect(pwndActive, &rc);
02998
02999
03000
03001
03002
03003
OffsetRect(&rc, -rc.left, -rc.top);
03004 GreDPtoLP(hdc, (LPPOINT)&rc, 2);
03005
InvertRect(hdc, &rc);
03006
InvertRect(hdc, &rc);
03007
_ReleaseDC(hdc);
03008
break;
03009 }
03010
03011
case SSWF_DISPLAY:
03012 {
03013
03014
03015
03016 HDC hdc;
03017 RECT rc;
03018
03019 hdc =
_GetDCEx(
PWNDDESKTOP(pwndActive),
NULL, DCX_WINDOW | DCX_CACHE);
03020 rc.left = rc.top = 0;
03021 rc.right =
SYSMET(CXVIRTUALSCREEN);
03022 rc.bottom =
SYSMET(CYVIRTUALSCREEN);
03023
InvertRect(hdc, &rc);
03024
InvertRect(hdc, &rc);
03025
_ReleaseDC(hdc);
03026
break;
03027 }
03028 }
03029
03030
return TRUE;
03031 }
03032
03033
03034
03035
03036
03037
03038
03039
03040
03041
03042
03043
03044
03045 BOOL UtilityManager(PKE pKeyEvent, ULONG ExtraInformation,
int NotUsed)
03046 {
03047
int CurrentModState;
03048
int fBreak;
03049
BYTE Vk;
03050
03051
03052
CheckCritIn();
03053
03054 Vk = (
BYTE)(pKeyEvent->usFlaggedVk & 0xff);
03055 fBreak = pKeyEvent->usFlaggedVk & KBDBREAK;
03056 CurrentModState =
gLockBits |
gLatchBits |
gPhysModifierState;
03057
03058
03059
if ((Vk ==
VK_U && !fBreak && (CurrentModState &
LRWIN)) )
03060 {
03061
PostAccessNotification(ACCESS_UTILITYMANAGER);
03062
03063
return FALSE;
03064 }
03065
return TRUE;
03066
03067 UNREFERENCED_PARAMETER(NotUsed);
03068 UNREFERENCED_PARAMETER(ExtraInformation);
03069 }
03070