test: kbd.c File Reference

Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

# kbd.c File Reference

`#include "precomp.h"`

Go to the source code of this file.

## Defines

#define | aulAltCvt_VK aulShiftCvt_VK

## Functions

BOOL | xxxNumpadCursor (PKE pKe)
BOOL | xxxICO_00 (PKE pKe)

## Variables

BYTE | aVkNumpad []
ULONG | aulShiftCvt_VK []
ULONG | aulShiftControlCvt_VK_IBM02 []
ULONG | aulControlCvt_VK []
ULONG | aulControlCvt_VK_IBM02 []
VK_TO_BIT | aVkToBits_VK []
VK_TO_BIT | aVkToBits_VK_IBM02 []
MODIFIERS | Modifiers_VK_STANDARD
MODIFIERS | Modifiers_VK_IBM02
ULONG * | gapulCvt_VK_101 []
ULONG * | gapulCvt_VK_84 []
ULONG * | gapulCvt_VK_IBM02 []
PULONG * | gapulCvt_VK = gapulCvt_VK_101
PMODIFIERS | gpModifiers_VK = &Modifiers_VK_STANDARD
USHORT | ausNumPadCvt []
KEPROC | aKEProcOEM []

## Define Documentation

#define aulAltCvt_VK aulShiftCvt_VK

| Definition at line 72 of file kbd.c.

## Function Documentation

BOOL xxxICO_00 | ( | PKE | pKe | ) |

Definition at line 327 of file kbd.c.

References CheckCritIn, FALSE, TRUE, and xxxKeyEvent().

    00329 {
    00330     CheckCritIn();
    00331
    00332     if ((pKe->usFlaggedVk & 0xFF) != VK_ICO_00) {
    00333         /*
    00334          * Pass the keystroke on unaltered
    00335          */
    00336         return TRUE;
    00337     }
    00338
    00339     if (pKe->usFlaggedVk & KBDBREAK) {
    00340         /*
    00341          * '0' key comes up
    00342          */
    00343         pKe->usFlaggedVk = '0' | KBDEXT | KBDBREAK;
    00344     } else {
    00345         /*
    00346          * '0' down, up, down
    00347          */
    00348         xxxKeyEvent('0', pKe->bScanCode, pKe->dwTime, 0, FALSE);
    00349         xxxKeyEvent('0' | KBDBREAK, pKe->bScanCode, pKe->dwTime, 0, FALSE);
    00350         pKe->usFlaggedVk = '0' | KBDEXT;
    00351     }
    00352
    00353     return TRUE;
    00354 }

BOOL xxxNumpadCursor | ( | PKE | pKe | ) |

Definition at line 211 of file kbd.c.

References ausNumPadCvt, BYTE, CheckCritIn, FALSE, HIBYTE, IsSAS(), LOBYTE, TestRawKeyDown, TestRawKeyToggle, TRUE, UINT, USHORT, and xxxKeyEvent().

    00213 {
    00214     static BYTE bLastNumpadCursor = 0;
    00215     static USHORT VkFakedShiftUp;  // VK_LSHIFT or VK_RSHIFT
    00216     static BYTE VscFakedShiftUp;   // 0x2A or 0x36 resp.
    00217     int i;
    00218
    00219     CheckCritIn();
    00220
    00221     if (bLastNumpadCursor) {
    00222         if (bLastNumpadCursor == (BYTE)(pKe->usFlaggedVk)) {
    00223             /*
    00224              * Same key as last one: if coming up, or going down?
    00225              */
    00226             if (pKe->usFlaggedVk & KBDBREAK) {
    00227                 /*
    00228                  * Numpad Cursor key came back up. Send this key now, and make
    00229                  * sure that the Shift key will then appear to go back down
    00230                  * again.
    00231                  */
    00232                 xxxKeyEvent(pKe->usFlaggedVk, pKe->bScanCode,
    00233                             pKe->dwTime, 0, FALSE);
    00234                 bLastNumpadCursor = 0;
    00235                 pKe->usFlaggedVk = VkFakedShiftUp;
    00236                 pKe->bScanCode = VscFakedShiftUp;
    00237             }
    00238             /*
    00239              * Going down: this key is repeating, so just pass it on
    00240              * unaltered and keep the KEProc active
    00241              */
    00242             return TRUE;
    00243         } else {
    00244             /*
    00245              * It is a different key.  Fake the Shift key back down again,
    00246              * and continue (it may be another Numpad Cursor key)
    00247              */
    00248             xxxKeyEvent(VkFakedShiftUp,
    00249                     (WORD)(VscFakedShiftUp | SCANCODE_SIMULATED),
    00250                      pKe->dwTime, 0, FALSE);
    00251             bLastNumpadCursor = 0;
    00252         }
    00253     }
    00254
    00255     if (pKe->usFlaggedVk & KBDNUMPAD) {
    00256
    00257         UINT fsModifiers;
    00258         /*
    00259          * This is the numeric pad.
    00260          * Here, if NumLock is set, we change the virtual keycodes to
    00261          * numeric VK_NUMPAD codes, so the keys will be translated
    00262          * as numbers etc.  But if a shift key is down, we handle
    00263          * these as cursor keys, but we need to make sure that these
    00264          * are seen as UNSHIFTED
    00265          */
    00266
    00267         /*
    00268          * Check for SAS.
    00269          */
    00270         if (IsSAS((BYTE)(pKe->usFlaggedVk), &fsModifiers)) {
    00271             return TRUE;
    00272         } else if (TestRawKeyToggle(VK_NUMLOCK)) {
    00273             if (TestRawKeyDown(VK_SHIFT)) {
    00274                 /*
    00275                  * key is down (bit(s) set in BIOS key state), so we are going
    00276                  * to keep this as a cursor key.  To do this, we need to
    00277                  * make sure that Windows' state vector entry for VK_SHIFT is
    00278                  * OFF even though a shift key is actually down.
    00279                  */
    00280                 bLastNumpadCursor = (BYTE)(pKe->usFlaggedVk);
    00281                 if (TestRawKeyDown(VK_RSHIFT)) {
    00282                     VkFakedShiftUp = VK_RSHIFT | KBDEXT;
    00283                     VscFakedShiftUp = 0x36;
    00284                 } else {
    00285                     VkFakedShiftUp = VK_LSHIFT;
    00286                     VscFakedShiftUp = 0x2A;
    00287                 }
    00288                 xxxKeyEvent((USHORT)(VkFakedShiftUp | KBDBREAK),
    00289                         (WORD)(VscFakedShiftUp | SCANCODE_SIMULATED),
    00290                          pKe->dwTime, 0, FALSE);
    00291                 return TRUE;
    00292             }
    00293
    00294             /*
    00295              * NumLock ON but Shift key up: Alter the Virtual Key event,
    00296              * but not for injected virtual keys.
    00297              */
    00298             if ((pKe->usFlaggedVk & KBDINJECTEDVK) == 0) {
    00299                 for (i = 0; ausNumPadCvt[i] != 0; i++) {
    00300                     if (LOBYTE(ausNumPadCvt[i]) == LOBYTE(pKe->usFlaggedVk)) {
    00301                         /*
    00302                          * keep extra bits, but change VK value
    00303                          */
    00304                         pKe->usFlaggedVk &= ~0xFF;
    00305                         pKe->usFlaggedVk |= (UINT)(HIBYTE(ausNumPadCvt[i]));
    00306                         break;
    00307
    00308                     }
    00309                 }
    00310             }
    00311         }
    00312     }
    00313     return TRUE;
    00314 }

## Variable Documentation

KEPROC aKEProcOEM[]

Initial value:

     {
        xxxICO_00,
        xxxNumpadCursor,
        NULL
    }

Definition at line 356 of file kbd.c.

Referenced by KEOEMProcs().

ULONG aulControlCvt_VK[]

Initial value:

     {
        MAKELONG(VK_NUMLOCK,  VK_PAUSE | KBDEXT),
        MAKELONG(VK_SCROLL,   VK_CANCEL),

    }

Definition at line 55 of file kbd.c.

ULONG aulControlCvt_VK_IBM02[]

Initial value:

     {
        MAKELONG(VK_PAUSE, VK_CANCEL | KBDEXT),
        MAKELONG(VK_SCROLL, VK_CANCEL | KBDEXT),

    }

Definition at line 62 of file kbd.c.

ULONG aulShiftControlCvt_VK_IBM02[]

Initial value:

     {
        MAKELONG(VK_SCROLL, VK_CANCEL | KBDEXT),
        MAKELONG(VK_NUMLOCK, VK_PAUSE | KBDEXT),

    }

Definition at line 46 of file kbd.c.

ULONG aulShiftCvt_VK[]

Initial value:

     {
        MAKELONG(VK_MULTIPLY, VK_SNAPSHOT),

    }

Definition at line 40 of file kbd.c.

USHORT ausNumPadCvt[]

Initial value:

    {
        MAKEWORD(VK_INSERT, VK_NUMPAD0),
        MAKEWORD(VK_END, VK_NUMPAD1),
        MAKEWORD(VK_DOWN, VK_NUMPAD2),
        MAKEWORD(VK_NEXT, VK_NUMPAD3),
        MAKEWORD(VK_LEFT, VK_NUMPAD4),
        MAKEWORD(VK_CLEAR, VK_NUMPAD5),
        MAKEWORD(VK_RIGHT, VK_NUMPAD6),
        MAKEWORD(VK_HOME, VK_NUMPAD7),
        MAKEWORD(VK_UP, VK_NUMPAD8),
        MAKEWORD(VK_PRIOR, VK_NUMPAD9),
        MAKEWORD(VK_DELETE, VK_DECIMAL),

    }

Definition at line 167 of file kbd.c.

Referenced by xxxInternalKeyEventDirect(), and xxxNumpadCursor().

BYTE aVkNumpad[]

Initial value:

     {
        VK_NUMPAD7,  VK_NUMPAD8,  VK_NUMPAD9, 0xFF,
        VK_NUMPAD4,  VK_NUMPAD5,  VK_NUMPAD6, 0xFF,
        VK_NUMPAD1,  VK_NUMPAD2,  VK_NUMPAD3,
        VK_NUMPAD0,  VK_DECIMAL,  0
    }

Definition at line 30 of file kbd.c.

Referenced by InternalMapVirtualKeyEx(), IsHexNumpadKeys(), and NumPadScanCodeToHex().

VK_TO_BIT aVkToBits_VK[]

Initial value:

     {
        { VK_SHIFT,   KBDSHIFT },
        { VK_CONTROL, KBDCTRL  },
        { VK_MENU,    KBDALT   },
        { 0,          0        }
    }

Definition at line 86 of file kbd.c.

VK_TO_BIT aVkToBits_VK_IBM02[]

Initial value:

     {
        { VK_SHIFT,   KBDSHIFT },
        { VK_CONTROL, KBDCTRL  },
        { 0,          0        }
    }

Definition at line 94 of file kbd.c.

PULONG* gapulCvt_VK = gapulCvt_VK_101

| Definition at line 157 of file kbd.c. Referenced by LW_DriversInit(), VKFromVSC(), and xxxRemotePassthruEnable().

ULONG* gapulCvt_VK_101[]

Initial value:

     {
        NULL,
        aulControlCvt_VK,
        NULL
    }

Definition at line 140 of file kbd.c.

ULONG* gapulCvt_VK_84[]

Initial value:

     {
        aulShiftCvt_VK,
        aulControlCvt_VK,
        aulAltCvt_VK
    }

Definition at line 146 of file kbd.c.

Referenced by LW_DriversInit(), and xxxRemotePassthruEnable().

ULONG* gapulCvt_VK_IBM02[]

Initial value:

     {
        aulControlCvt_VK_IBM02,
        aulShiftControlCvt_VK_IBM02,
    }

Definition at line 152 of file kbd.c.

Referenced by LW_DriversInit().

PMODIFIERS gpModifiers_VK = &Modifiers_VK_STANDARD

| Definition at line 159 of file kbd.c. Referenced by VKFromVSC().

MODIFIERS Modifiers_VK_IBM02

Initial value:

     {
        &aVkToBits_VK_IBM02[0],
        3,
        {
            SHFT_INVALID,
            SHFT_INVALID,
            0,
            1
        }
    }

Definition at line 122 of file kbd.c.

MODIFIERS Modifiers_VK_STANDARD

Initial value:

     {
        &aVkToBits_VK[0],
        4,
        {
            SHFT_INVALID,
            0,
            1,
            SHFT_INVALID,
            2
        }
    }

Definition at line 110 of file kbd.c.