Chris Ryu’s Tech Diary

Windows Embedded OS

Disable specific key in WinCE

Posted by chrisryu on June 24, 2009

Keyboard driver concept

At boot time, GWES loads the keyboard driver whose name is retrieved in HKEY_LOCAL_MACHINE\Hardware\DeviceMap\KEYBD\Drivername registry

 

GWES calls the PFN_KEYBD_DRIVER_INITIALIZE function that initialize hardware and IST.

The keyboard driver is responsible for converting the hardware scan code into a virtual-key code and passing both to GWES through either the PFN_KEYBD_DRIVER_INITIALIZE_EX or keybd_event API.

 

GEWS pulls the keyboard event from the queue and calls back to the driver’s PFN_KEYBD_DRIVER_VKEY_TO_UNICODE routine

 

Keyboard driver : analyzes the specified key event and the virtual-key state and generates the corresponding characters.

 

GWES : sends the virtual-key code and the characters to the appropriate application

 

 

Disabling the shift key

 

GWES

                     ↑   Send Keyboard events

PFN _KEYBD_DRIVER_VKEY_TO_UNICODE  = KeybdDriverVKeyToUnicode()

                                 ↓   Call in order to check the shift flag)

KeybdDriverKeyStateToShiftFlags()

 

 

The path for the modified source code

C:\WINCE600\PUBLIC\COMMON\OAK\DRIVERS\KEYBD\LAYMGR\LayMgr.cpp

 

Adding below code in end of Void KeybdDriverKeyStateToShiftFlags() function, we can set the ShiftFlags value to 0×00.

 

//chris

           if(ShiftFlags == KeyShiftAnyShiftFlag){

       ShiftFlags = 0×00000000;

           }

           else if(ShiftFlags == (KeyShiftAnyShiftFlag | KeyShiftLeftShiftFlag)) {

       ShiftFlags = 0×00000000;

           }

           else if(ShiftFlags == (KeyShiftAnyShiftFlag | KeyShiftRightShiftFlag)){

        ShiftFlags = 0×00000000;

                     }

           //chris

 

           *pShiftStateFlags = ShiftFlags | KeyState[VKey];

    return;

 

As set the ShiftFlags’s value 0, we can disable the Shift key.

◈KeyShiftAnyShiftFlag, KeyShiftLeftShiftFlag, KeyShiftRightShiftFlag values are placed in C:\WINCE600\PUBLIC\COMMON\SDK\INC\Keybd.h

 

The build order

  1. Do Build and Sysgen C:\WINCE600\PUBLIC\COMMON\OAK\DRIVERS\KEYBD\LAYMGR
  2. Do ReBuild the BSP’s Keyboard driver.
  3. Do Make Run Time Image.

 

Keyboard driver concept

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>