Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

winkeyboard.cpp

Go to the documentation of this file.
00001 /* $Id: winkeyboard.cpp,v 1.29 2002/01/02 18:37:09 sandervl Exp $ */
00002 /*
00003  * Win32 <-> PM key translation
00004  *
00005  *
00006  * Project Odin Software License can be found in LICENSE.TXT
00007  *
00008  */
00009 
00010 #include <odin.h>
00011 #include <odinwrap.h>
00012 #include <os2sel.h>
00013 
00014 #include <os2win.h>
00015 
00016 #include <string.h>
00017 #include <stdio.h>
00018 #include <winkeyboard.h>
00019 #include "oslibwin.h"
00020 #include <heapstring.h>
00021 #include <pmscan.h>
00022 #include <winscan.h>
00023 #include <winuser32.h>
00024 #include "initterm.h"
00025 
00026 #define DBG_LOCALLOG    DBG_winkeyboard
00027 #include "dbglocal.h"
00028 
00029 
00030 
00031 
00032 ODINDEBUGCHANNEL(USER32-WINKBD)
00033 
00034 
00035 /****************************************************************************
00036  * module local variables
00037  ****************************************************************************/
00038 
00039 static char arrchOverlayKeyState[256] = {0};
00040 
00041 
00042 
00043 
00044 /****************************************************************************
00045  * implementation
00046  ****************************************************************************/
00047 
00048 BOOL OPEN32API _O32_GetKeyboardState( PBYTE lpKeyState );
00049 
00050 inline BOOL O32_GetKeyboardState(PBYTE lpKeyState)
00051 {
00052  BOOL yyrc;
00053  USHORT sel = RestoreOS2FS();
00054 
00055     yyrc = _O32_GetKeyboardState(lpKeyState);
00056     SetFS(sel);
00057 
00058     return yyrc;
00059 }
00060 
00061 
00062 BYTE abPMScanToWinVKey[256][2] =
00063 /****************************************************************************/
00064 /* PM Scancode              *    Win32 vkey                 Extended Key     */
00065 /****************************************************************************/
00066 /* 0x00                     */ { 0x00,                      FALSE
00067 /* 0x01 PMSCAN_ESC          */ , VK_ESCAPE                  ,FALSE
00068 /* 0x02 PMSCAN_ONE          */ , VK_1                       ,FALSE
00069 /* 0x03 PMSCAN_TWO          */ , VK_2                       ,FALSE
00070 /* 0x04 PMSCAN_THREE        */ , VK_3                       ,FALSE
00071 /* 0x05 PMSCAN_FOUR         */ , VK_4                       ,FALSE
00072 /* 0x06 PMSCAN_FIVE         */ , VK_5                       ,FALSE
00073 /* 0x07 PMSCAN_SIX          */ , VK_6                       ,FALSE
00074 /* 0x08 PMSCAN_SEVEN        */ , VK_7                       ,FALSE
00075 /* 0x09 PMSCAN_EIGHT        */ , VK_8                       ,FALSE
00076 /* 0x0A PMSCAN_NINE         */ , VK_9                       ,FALSE
00077 /* 0x0B PMSCAN_ZERO         */ , VK_0                       ,FALSE
00078 /* 0x0C PMSCAN_HYPHEN       */ , VK_HYPHEN                  ,FALSE
00079 /* 0x0D PMSCAN_EQUAL        */ , VK_EQUAL                   ,FALSE
00080 /* 0x0E PMSCAN_BACKSPACE    */ , VK_BACK                    ,FALSE
00081 /* 0x0F PMSCAN_TAB          */ , VK_TAB                     ,FALSE
00082 /* 0x10 PMSCAN_Q            */ , VK_Q                       ,FALSE
00083 /* 0x11 PMSCAN_W            */ , VK_W                       ,FALSE
00084 /* 0x12 PMSCAN_E            */ , VK_E                       ,FALSE
00085 /* 0x13 PMSCAN_R            */ , VK_R                       ,FALSE
00086 /* 0x14 PMSCAN_T            */ , VK_T                       ,FALSE
00087 /* 0x15 PMSCAN_Y            */ , VK_Y                       ,FALSE
00088 /* 0x16 PMSCAN_U            */ , VK_U                       ,FALSE
00089 /* 0x17 PMSCAN_I            */ , VK_I                       ,FALSE
00090 /* 0x18 PMSCAN_O            */ , VK_O                       ,FALSE
00091 /* 0x19 PMSCAN_P            */ , VK_P                       ,FALSE
00092 /* 0x1A PMSCAN_BRACKETLEFT  */ , VK_BRACKETLEFT             ,FALSE
00093 /* 0x1B PMSCAN_BRACKETRIGHT */ , VK_BRACKETRIGHT            ,FALSE
00094 /* 0x1C PMSCAN_ENTER        */ , VK_RETURN                  ,FALSE
00095 /* 0x1D PMSCAN_CTRLLEFT     */ , VK_LCONTROL                ,FALSE
00096 /* 0x1E PMSCAN_A            */ , VK_A                       ,FALSE
00097 /* 0x1F PMSCAN_S            */ , VK_S                       ,FALSE
00098 /* 0x20 PMSCAN_D            */ , VK_D                       ,FALSE
00099 /* 0x21 PMSCAN_F            */ , VK_F                       ,FALSE
00100 /* 0x22 PMSCAN_G            */ , VK_G                       ,FALSE
00101 /* 0x23 PMSCAN_H            */ , VK_H                       ,FALSE
00102 /* 0x24 PMSCAN_J            */ , VK_J                       ,FALSE
00103 /* 0x25 PMSCAN_K            */ , VK_K                       ,FALSE
00104 /* 0x26 PMSCAN_L            */ , VK_L                       ,FALSE
00105 /* 0x27 PMSCAN_SEMICOLON    */ , VK_SEMICOLON               ,FALSE
00106 /* 0x28 PMSCAN_QUOTESINGLE  */ , VK_QUOTESINGLE             ,FALSE
00107 /* 0x29 PMSCAN_GRAVE        */ , VK_GRAVE                   ,FALSE
00108 /* 0x2A PMSCAN_SHIFTLEFT    */ , VK_LSHIFT                  ,FALSE
00109 /* 0x2B PMSCAN_BACKSLASH    */ , VK_BACKSLASH               ,FALSE
00110 /* 0x2C PMSCAN_Z            */ , VK_Z                       ,FALSE
00111 /* 0x2D PMSCAN_X            */ , VK_X                       ,FALSE
00112 /* 0x2E PMSCAN_C            */ , VK_C                       ,FALSE
00113 /* 0x2F PMSCAN_V            */ , VK_V                       ,FALSE
00114 /* 0x30 PMSCAN_B            */ , VK_B                       ,FALSE
00115 /* 0x31 PMSCAN_N            */ , VK_N                       ,FALSE
00116 /* 0x32 PMSCAN_M            */ , VK_M                       ,FALSE
00117 /* 0x33 PMSCAN_COMMA        */ , VK_COMMA                   ,FALSE
00118 /* 0x34 PMSCAN_PERIOD       */ , VK_PERIOD                  ,FALSE
00119 /* 0x35 PMSCAN_SLASH        */ , VK_SLASH                   ,FALSE
00120 /* 0x36 PMSCAN_SHIFTRIGHT   */ , VK_RSHIFT                  ,TRUE
00121 /* 0x37 PMSCAN_PADASTERISK  */ , VK_MULTIPLY                ,FALSE
00122 /* 0x38 PMSCAN_ALTLEFT      */ , VK_LMENU                   ,FALSE
00123 /* 0x39 PMSCAN_SPACE        */ , VK_SPACE                   ,FALSE
00124 /* 0x3A PMSCAN_CAPSLOCK     */ , VK_CAPITAL                 ,FALSE
00125 /* 0x3B PMSCAN_F1           */ , VK_F1                      ,FALSE
00126 /* 0x3C PMSCAN_F2           */ , VK_F2                      ,FALSE
00127 /* 0x3D PMSCAN_F3           */ , VK_F3                      ,FALSE
00128 /* 0x3E PMSCAN_F4           */ , VK_F4                      ,FALSE
00129 /* 0x3F PMSCAN_F5           */ , VK_F5                      ,FALSE
00130 /* 0x40 PMSCAN_F6           */ , VK_F6                      ,FALSE
00131 /* 0x41 PMSCAN_F7           */ , VK_F7                      ,FALSE
00132 /* 0x42 PMSCAN_F8           */ , VK_F8                      ,FALSE
00133 /* 0x43 PMSCAN_F9           */ , VK_F9                      ,FALSE
00134 /* 0x44 PMSCAN_F10          */ , VK_F10                     ,FALSE
00135 /* 0x45 PMSCAN_NUMLOCK      */ , VK_NUMLOCK                 ,TRUE
00136 /* 0x46 PMSCAN_SCROLLLOCK   */ , VK_SCROLL                  ,FALSE
00137 /* 0x47 PMSCAN_PAD7         */ , VK_NUMPAD7                 ,FALSE
00138 /* 0x48 PMSCAN_PAD8         */ , VK_NUMPAD8                 ,FALSE
00139 /* 0x49 PMSCAN_PAD9         */ , VK_NUMPAD9                 ,FALSE
00140 /* 0x4A PMSCAN_PADMINUS     */ , VK_SUBTRACT                ,FALSE
00141 /* 0x4B PMSCAN_PAD4         */ , VK_NUMPAD4                 ,FALSE
00142 /* 0x4C PMSCAN_PAD5         */ , VK_NUMPAD5                 ,FALSE
00143 /* 0x4D PMSCAN_PAD6         */ , VK_NUMPAD6                 ,FALSE
00144 /* 0x4E PMSCAN_PADPLUS      */ , VK_ADD                     ,FALSE
00145 /* 0x4F PMSCAN_PAD1         */ , VK_NUMPAD1                 ,FALSE
00146 /* 0x50 PMSCAN_PAD2         */ , VK_NUMPAD2                 ,FALSE
00147 /* 0x51 PMSCAN_PAD3         */ , VK_NUMPAD3                 ,FALSE
00148 /* 0x52 PMSCAN_PAD0         */ , VK_NUMPAD0                 ,FALSE
00149 /* 0x53 PMSCAN_PADPERIOD    */ , VK_DECIMAL                 ,FALSE
00150 /* 0x54 PMSCAN_SYSREQ       */ , 0x00                       ,FALSE
00151 /* 0x55 PMSCAN_RESET        */ , 0x00                       ,FALSE
00152 /* 0x56 PMSCAN_EXTRA        */ , VK_EXTRA                   ,FALSE
00153 /* 0x57 PMSCAN_F11          */ , VK_F11                     ,FALSE
00154 /* 0x58 PMSCAN_F12          */ , VK_F12                     ,FALSE
00155 /* 0x59 PMSCAN_BACKTAB      */ , 0x00                       ,FALSE
00156 /* 0x5A PMSCAN_PADENTER     */ , VK_RETURN                  ,TRUE
00157 /* 0x5B PMSCAN_CTRLRIGHT    */ , VK_RCONTROL                ,TRUE
00158 /* 0x5C PMSCAN_PADSLASH     */ , VK_DIVIDE                  ,TRUE
00159 /* 0x5D PMSCAN_PRINT        */ , VK_SNAPSHOT                ,TRUE
00160 /* 0x5E PMSCAN_ALTRIGHT     */ , VK_RMENU                   ,TRUE
00161 /* 0x5F PMSCAN_PAUSE        */ , VK_PAUSE                   ,FALSE
00162 /* 0x60 PMSCAN_HOME         */ , VK_HOME                    ,TRUE
00163 /* 0x61 PMSCAN_UP           */ , VK_UP                      ,TRUE
00164 /* 0x62 PMSCAN_PAGEUP       */ , VK_PRIOR                   ,TRUE
00165 /* 0x63 PMSCAN_LEFT         */ , VK_LEFT                    ,TRUE
00166 /* 0x64 PMSCAN_RIGHT        */ , VK_RIGHT                   ,TRUE
00167 /* 0x65 PMSCAN_END          */ , VK_END                     ,TRUE
00168 /* 0x66 PMSCAN_DOWN         */ , VK_DOWN                    ,TRUE
00169 /* 0x67 PMSCAN_PAGEDOWN     */ , VK_NEXT                    ,TRUE
00170 /* 0x68 PMSCAN_INSERT       */ , VK_INSERT                  ,TRUE
00171 /* 0x69 PMSCAN_DELETE       */ , VK_DELETE                  ,TRUE
00172 /* 0x6A PMSCAN_F23          */ , VK_F23                     ,FALSE
00173 /* 0x6B PMSCAN_F24          */ , VK_F24                     ,FALSE
00174 /* 0x6C PMSCAN_SYSMEM       */ , 0x00                       ,FALSE
00175 /* 0x6D PMSCAN_ERASEEOF     */ , VK_EREOF                   ,FALSE
00176 /* 0x6E PMSCAN_BREAK        */ , VK_CANCEL                  ,TRUE
00177 /* 0x6F PMSCAN_MOVEWIN      */ , 0x00                       ,FALSE
00178 /* 0x70 PMSCAN_NLS3         */ , 0x00                       ,FALSE
00179 /* 0x71 PMSCAN_HELP         */ , VK_HELP                    ,FALSE
00180 /* 0x72 PMSCAN_TASKMAN      */ , 0x00                       ,FALSE
00181 /* 0x73 PMSCAN_B11          */ , 0x00                       ,FALSE
00182 /* 0x74 PMSCAN_JUMP         */ , 0x00                       ,FALSE
00183 /* 0x75 PMSCAN_MINWIN       */ , 0x00                       ,FALSE
00184 /* 0x76 PMSCAN_CLEAR        */ , 0x00                       ,FALSE
00185 /* 0x77 PMSCAN_77           */ , 0x00                       ,FALSE
00186 /* 0x78 PMSCAN_78           */ , 0x00                       ,FALSE
00187 /* 0x79 PMSCAN_NLS2         */ , 0x00                       ,FALSE
00188 /* 0x7a PMSCAN_SIZE         */ , 0x00                       ,FALSE
00189 /* 0x7b PMSCAN_NLS1         */ , 0x00                       ,FALSE
00190 /* 0x7c PMSCAN_APPLICATION  */ , VK_APPS                    ,TRUE
00191 /* 0x7d PMSCAN_E13          */ , 0x00                       ,FALSE
00192 /* 0x7e PMSCAN_WINLEFT      */ , VK_LWIN                    ,TRUE
00193 /* 0x7f PMSCAN_WINRIGHT     */ , VK_RWIN                    ,TRUE
00194 /* 0x80 PMSCAN_PA1          */ , VK_PA1                     ,FALSE
00195 /* 0x81 PMSCAN_F13          */ , VK_F13                     ,FALSE
00196 /* 0x82 PMSCAN_F14          */ , VK_F14                     ,FALSE
00197 /* 0x83 PMSCAN_F15          */ , VK_F15                     ,FALSE
00198 /* 0x84 PMSCAN_PA2          */ , 0x00                       ,FALSE
00199 /* 0x85 PMSCAN_PA3          */ , 0x00                       ,FALSE
00200 /* 0x86 PMSCAN_SPACEBREAK   */ , 0x00                       ,FALSE
00201 /* 0x87 PMSCAN_TABRIGHT     */ , 0x00                       ,FALSE
00202 /* 0x88 PMSCAN_NOOP         */ , 0x00                       ,FALSE
00203 /* 0x89 PMSCAN_F16          */ , VK_F16                     ,FALSE
00204 /* 0x8a PMSCAN_F17          */ , VK_F17                     ,FALSE
00205 /* 0x8b PMSCAN_F18          */ , VK_F18                     ,FALSE
00206 /* 0x8c PMSCAN_F19          */ , VK_F19                     ,FALSE
00207 /* 0x8d PMSCAN_F20          */ , VK_F20                     ,FALSE
00208 /* 0x8e PMSCAN_F21          */ , VK_F21                     ,FALSE
00209 /* 0x8f PMSCAN_F22          */ , VK_F22                     ,FALSE
00210 /* 0x90                     */ , 0x00                       ,FALSE
00211 /* 0x91                     */ , 0x00                       ,FALSE
00212 /* 0x92                     */ , 0x00                       ,FALSE
00213 /* 0x93                     */ , 0x00                       ,FALSE
00214 /* 0x94                     */ , 0x00                       ,FALSE
00215 /* 0x95                     */ , 0x00                       ,FALSE
00216 /* 0x96                     */ , 0x00                       ,FALSE
00217 /* 0x97                     */ , 0x00                       ,FALSE
00218 /* 0x98                     */ , 0x00                       ,FALSE
00219 /* 0x99                     */ , 0x00                       ,FALSE
00220 /* 0x9A                     */ , 0x00                       ,FALSE
00221 /* 0x9B                     */ , 0x00                       ,FALSE
00222 /* 0x9C                     */ , 0x00                       ,FALSE
00223 /* 0x9D                     */ , 0x00                       ,FALSE
00224 /* 0x9E                     */ , 0x00                       ,FALSE
00225 /* 0x9F                     */ , 0x00                       ,FALSE
00226 /* 0xA0                     */ , 0x00                       ,FALSE
00227 /* 0xA1                     */ , 0x00                       ,FALSE
00228 /* 0xA2                     */ , 0x00                       ,FALSE
00229 /* 0xA3                     */ , 0x00                       ,FALSE
00230 /* 0xA4                     */ , 0x00                       ,FALSE
00231 /* 0xA5                     */ , 0x00                       ,FALSE
00232 /* 0xA6                     */ , 0x00                       ,FALSE
00233 /* 0xA7                     */ , 0x00                       ,FALSE
00234 /* 0xA8                     */ , 0x00                       ,FALSE
00235 /* 0xA9                     */ , 0x00                       ,FALSE
00236 /* 0xAA                     */ , 0x00                       ,FALSE
00237 /* 0xAB                     */ , 0x00                       ,FALSE
00238 /* 0xAC                     */ , 0x00                       ,FALSE
00239 /* 0xAD                     */ , 0x00                       ,FALSE
00240 /* 0xAE                     */ , 0x00                       ,FALSE
00241 /* 0xAF                     */ , 0x00                       ,FALSE
00242 /* 0xB0                     */ , 0x00                       ,FALSE
00243 /* 0xB1                     */ , 0x00                       ,FALSE
00244 /* 0xB2                     */ , 0x00                       ,FALSE
00245 /* 0xB3                     */ , 0x00                       ,FALSE
00246 /* 0xB4                     */ , 0x00                       ,FALSE
00247 /* 0xB5                     */ , 0x00                       ,FALSE
00248 /* 0xB6                     */ , 0x00                       ,FALSE
00249 /* 0xB7                     */ , 0x00                       ,FALSE
00250 /* 0xB8                     */ , 0x00                       ,FALSE
00251 /* 0xB9                     */ , 0x00                       ,FALSE
00252 /* 0xBA                     */ , 0x00                       ,FALSE
00253 /* 0xBB                     */ , 0x00                       ,FALSE
00254 /* 0xBC                     */ , 0x00                       ,FALSE
00255 /* 0xBD                     */ , 0x00                       ,FALSE
00256 /* 0xBE                     */ , 0x00                       ,FALSE
00257 /* 0xBF                     */ , 0x00                       ,FALSE
00258 /* 0xC0                     */ , 0x00                       ,FALSE
00259 /* 0xC1                     */ , 0x00                       ,FALSE
00260 /* 0xC2                     */ , 0x00                       ,FALSE
00261 /* 0xC3                     */ , 0x00                       ,FALSE
00262 /* 0xC4                     */ , 0x00                       ,FALSE
00263 /* 0xC5                     */ , 0x00                       ,FALSE
00264 /* 0xC6                     */ , 0x00                       ,FALSE
00265 /* 0xC7                     */ , 0x00                       ,FALSE
00266 /* 0xC8                     */ , 0x00                       ,FALSE
00267 /* 0xC9                     */ , 0x00                       ,FALSE
00268 /* 0xCA                     */ , 0x00                       ,FALSE
00269 /* 0xCB                     */ , 0x00                       ,FALSE
00270 /* 0xCC                     */ , 0x00                       ,FALSE
00271 /* 0xCD                     */ , 0x00                       ,FALSE
00272 /* 0xCE                     */ , 0x00                       ,FALSE
00273 /* 0xCF                     */ , 0x00                       ,FALSE
00274 /* 0xD0                     */ , 0x00                       ,FALSE
00275 /* 0xD1                     */ , 0x00                       ,FALSE
00276 /* 0xD2                     */ , 0x00                       ,FALSE
00277 /* 0xD3                     */ , 0x00                       ,FALSE
00278 /* 0xD4                     */ , 0x00                       ,FALSE
00279 /* 0xD5                     */ , 0x00                       ,FALSE
00280 /* 0xD6                     */ , 0x00                       ,FALSE
00281 /* 0xD7                     */ , 0x00                       ,FALSE
00282 /* 0xD8                     */ , 0x00                       ,FALSE
00283 /* 0xD9                     */ , 0x00                       ,FALSE
00284 /* 0xDA                     */ , 0x00                       ,FALSE
00285 /* 0xDB                     */ , 0x00                       ,FALSE
00286 /* 0xDC                     */ , 0x00                       ,FALSE
00287 /* 0xDD                     */ , 0x00                       ,FALSE
00288 /* 0xDE                     */ , 0x00                       ,FALSE
00289 /* 0xDF                     */ , 0x00                       ,FALSE
00290 /* 0xE0                     */ , 0x00                       ,FALSE
00291 /* 0xE1                     */ , 0x00                       ,FALSE
00292 /* 0xE2                     */ , 0x00                       ,FALSE
00293 /* 0xE3                     */ , 0x00                       ,FALSE
00294 /* 0xE4                     */ , 0x00                       ,FALSE
00295 /* 0xE5                     */ , 0x00                       ,FALSE
00296 /* 0xE6                     */ , 0x00                       ,FALSE
00297 /* 0xE7                     */ , 0x00                       ,FALSE
00298 /* 0xE8                     */ , 0x00                       ,FALSE
00299 /* 0xE9                     */ , 0x00                       ,FALSE
00300 /* 0xEA                     */ , 0x00                       ,FALSE
00301 /* 0xEB                     */ , 0x00                       ,FALSE
00302 /* 0xEC                     */ , 0x00                       ,FALSE
00303 /* 0xED                     */ , 0x00                       ,FALSE
00304 /* 0xEE                     */ , 0x00                       ,FALSE
00305 /* 0xEF                     */ , 0x00                       ,FALSE
00306 /* 0xF0                     */ , 0x00                       ,FALSE
00307 /* 0xF1                     */ , 0x00                       ,FALSE
00308 /* 0xF2                     */ , 0x00                       ,FALSE
00309 /* 0xF3                     */ , 0x00                       ,FALSE
00310 /* 0xF4                     */ , 0x00                       ,FALSE
00311 /* 0xF5                     */ , 0x00                       ,FALSE
00312 /* 0xF6                     */ , 0x00                       ,FALSE
00313 /* 0xF7                     */ , 0x00                       ,FALSE
00314 /* 0xF8                     */ , 0x00                       ,FALSE
00315 /* 0xF9                     */ , 0x00                       ,FALSE
00316 /* 0xFA                     */ , 0x00                       ,FALSE
00317 /* 0xFB                     */ , 0x00                       ,FALSE
00318 /* 0xFC                     */ , 0x00                       ,FALSE
00319 /* 0xFD                     */ , 0x00                       ,FALSE
00320 /* 0xFE                     */ , 0x00                       ,FALSE
00321 /* 0xFF                     */ , 0x00                       ,FALSE
00322                                };
00323 
00324 typedef struct tagWinVKeyToPMScan
00325 {
00326   /* index is the VKey value */
00327   BYTE  bPMScanCode;
00328   LPSTR lpstrName;
00329 } WINVKEYTOPMSCAN, *PWINVKEYTOPMSCAN;
00330 
00331 WINVKEYTOPMSCAN abWinVKeyToPMScan[256] =
00332 /**********************************************************************/
00333 /* Vkey                   *    Scancode               * Name          */
00334 /**********************************************************************/
00335 /* 0x00                   */ { 0x00                   , NULL
00336 /* 0x01 VK_LBUTTON        */ , 0x00                   , NULL
00337 /* 0x02 VK_RBUTTON        */ , 0x00                   , NULL
00338 /* 0x03 VK_CANCEL         */ , PMSCAN_BREAK           , "Break"
00339 /* 0x04 VK_MBUTTON        */ , 0x00                   , NULL
00340 /* 0x05                   */ , 0x00                   , NULL
00341 /* 0x06                   */ , 0x00                   , NULL
00342 /* 0x07                   */ , 0x00                   , NULL
00343 /* 0x08 VK_BACK           */ , PMSCAN_BACKSPACE       , "Backspace"
00344 /* 0x09 VK_TAB            */ , PMSCAN_TAB             , "Tab"
00345 /* 0x0A                   */ , 0x00                   , NULL
00346 /* 0x0B                   */ , 0x00                   , NULL
00347 /* 0x0C VK_CLEAR          */ , PMSCAN_PAD5            , "Num 5"
00348 /* 0x0D VK_RETURN         */ , PMSCAN_ENTER           , "Enter" // @@@PH BUG: identical to "Num Enter" !
00349 /* 0x0E                   */ , 0x00                   , NULL
00350 /* 0x0F                   */ , 0x00                   , NULL
00351 /* 0x10 VK_SHIFT          */ , PMSCAN_SHIFTLEFT       , "Left Shift"
00352 /* 0x11 VK_CONTROL        */ , PMSCAN_CTRLLEFT        , "Left Control"
00353 /* 0x12 VK_MENU           */ , PMSCAN_ALTLEFT         , "Left Alt"
00354 /* 0x13 VK_PAUSE          */ , PMSCAN_PAUSE           , "Pause"
00355 /* 0x14 VK_CAPITAL        */ , PMSCAN_CAPSLOCK        , "Caps Lock"
00356 /* 0x15                   */ , 0x00                   , NULL
00357 /* 0x16                   */ , 0x00                   , NULL
00358 /* 0x17                   */ , 0x00                   , NULL
00359 /* 0x18                   */ , 0x00                   , NULL
00360 /* 0x19                   */ , 0x00                   , NULL
00361 /* 0x1A                   */ , 0x00                   , NULL
00362 /* 0x1B VK_ESCAPE         */ , PMSCAN_ESC             , "Escape"
00363 /* 0x1C                   */ , 0x00                   , NULL
00364 /* 0x1D                   */ , 0x00                   , NULL
00365 /* 0x1E                   */ , 0x00                   , NULL
00366 /* 0x1F                   */ , 0x00                   , NULL
00367 /* 0x20 VK_SPACE          */ , PMSCAN_SPACE           , "Space"
00368 /* 0x21 VK_PRIOR          */ , PMSCAN_PAGEUP          , "Page Up"
00369 /* 0x22 VK_NEXT           */ , PMSCAN_PAGEDOWN        , "Page Down"
00370 /* 0x23 VK_END            */ , PMSCAN_END             , "End"
00371 /* 0x24 VK_HOME           */ , PMSCAN_HOME            , "Home"
00372 /* 0x25 VK_LEFT           */ , PMSCAN_LEFT            , "Left"
00373 /* 0x26 VK_UP             */ , PMSCAN_UP              , "Up"
00374 /* 0x27 VK_RIGHT          */ , PMSCAN_RIGHT           , "Right"
00375 /* 0x28 VK_DOWN           */ , PMSCAN_DOWN            , "Down"
00376 /* 0x29 VK_SELECT         */ , 0x00                   , NULL
00377 /* 0x2A VK_PRINT          */ , 0x00                   , NULL
00378 /* 0x2B VK_EXECUTE        */ , 0x00                   , NULL
00379 /* 0x2C VK_SNAPSHOT       */ , PMSCAN_PRINT           , "Print"  // NT4SP6: appears to be printscreen!
00380 /* 0x2D VK_INSERT         */ , PMSCAN_INSERT          , "Insert"
00381 /* 0x2E VK_DELETE         */ , PMSCAN_DELETE          , "Delete"
00382 /* 0x2F VK_HELP           */ , PMSCAN_HELP            , "Help"
00383 /* 0x30 VK_0              */ , PMSCAN_ZERO            , "0"
00384 /* 0x31 VK_1              */ , PMSCAN_ONE             , "1"
00385 /* 0x32 VK_2              */ , PMSCAN_TWO             , "2"
00386 /* 0x33 VK_3              */ , PMSCAN_THREE           , "3"
00387 /* 0x34 VK_4              */ , PMSCAN_FOUR            , "4"
00388 /* 0x35 VK_5              */ , PMSCAN_FIVE            , "5"
00389 /* 0x36 VK_6              */ , PMSCAN_SIX             , "6"
00390 /* 0x37 VK_7              */ , PMSCAN_SEVEN           , "7"
00391 /* 0x38 VK_8              */ , PMSCAN_EIGHT           , "8"
00392 /* 0x39 VK_9              */ , PMSCAN_NINE            , "9"
00393 /* 0x3A                   */ , 0x00                   , NULL
00394 /* 0x3B                   */ , 0x00                   , NULL
00395 /* 0x3C                   */ , 0x00                   , NULL
00396 /* 0x3D                   */ , 0x00                   , NULL
00397 /* 0x3E                   */ , 0x00                   , NULL
00398 /* 0x3F                   */ , 0x00                   , NULL
00399 /* 0x40                   */ , 0x00                   , NULL
00400 /* 0x41 VK_A              */ , PMSCAN_A               , "A"
00401 /* 0x42 VK_B              */ , PMSCAN_B               , "B"
00402 /* 0x43 VK_C              */ , PMSCAN_C               , "C"
00403 /* 0x44 VK_D              */ , PMSCAN_D               , "D"
00404 /* 0x45 VK_E              */ , PMSCAN_E               , "E"
00405 /* 0x46 VK_F              */ , PMSCAN_F               , "F"
00406 /* 0x47 VK_G              */ , PMSCAN_G               , "G"
00407 /* 0x48 VK_H              */ , PMSCAN_H               , "H"
00408 /* 0x49 VK_I              */ , PMSCAN_I               , "I"
00409 /* 0x4A VK_J              */ , PMSCAN_J               , "J"
00410 /* 0x4B VK_K              */ , PMSCAN_K               , "K"
00411 /* 0x4C VK_L              */ , PMSCAN_L               , "L"
00412 /* 0x4D VK_M              */ , PMSCAN_M               , "M"
00413 /* 0x4E VK_N              */ , PMSCAN_N               , "N"
00414 /* 0x4F VK_O              */ , PMSCAN_O               , "O"
00415 /* 0x50 VK_P              */ , PMSCAN_P               , "P"
00416 /* 0x51 VK_Q              */ , PMSCAN_Q               , "Q"
00417 /* 0x52 VK_R              */ , PMSCAN_R               , "R"
00418 /* 0x53 VK_S              */ , PMSCAN_S               , "S"
00419 /* 0x54 VK_T              */ , PMSCAN_T               , "T"
00420 /* 0x55 VK_U              */ , PMSCAN_U               , "U"
00421 /* 0x56 VK_V              */ , PMSCAN_V               , "V"
00422 /* 0x57 VK                */ , PMSCAN_W               , "W"
00423 /* 0x58 VK_X              */ , PMSCAN_X               , "X"
00424 /* 0x59 VK_Y              */ , PMSCAN_Y               , "Y"
00425 /* 0x5A VK_Z              */ , PMSCAN_Z               , "Z"
00426 /* 0x5B VK_LWIN           */ , PMSCAN_WINLEFT         , "Left Win"
00427 /* 0x5C VK_RWIN           */ , PMSCAN_WINRIGHT        , "Right Win"
00428 /* 0x5D VK_APPS           */ , PMSCAN_APPLICATION     , "Application"
00429 /* 0x5E                   */ , 0x00                   , NULL
00430 /* 0x5F                   */ , 0x00                   , NULL
00431 /* 0x60 VK_NUMPAD0        */ , PMSCAN_PAD0            , "Num 0"
00432 /* 0x61 VK_NUMPAD1        */ , PMSCAN_PAD1            , "Num 1"
00433 /* 0x62 VK_NUMPAD2        */ , PMSCAN_PAD2            , "Num 2"
00434 /* 0x63 VK_NUMPAD3        */ , PMSCAN_PAD3            , "Num 3"
00435 /* 0x64 VK_NUMPAD4        */ , PMSCAN_PAD4            , "Num 4"
00436 /* 0x65 VK_NUMPAD5        */ , PMSCAN_PAD5            , "Num 5"
00437 /* 0x66 VK_NUMPAD6        */ , PMSCAN_PAD6            , "Num 6"
00438 /* 0x67 VK_NUMPAD7        */ , PMSCAN_PAD7            , "Num 7"
00439 /* 0x68 VK_NUMPAD8        */ , PMSCAN_PAD8            , "Num 8"
00440 /* 0x69 VK_NUMPAD9        */ , PMSCAN_PAD9            , "Num 9"
00441 /* 0x6A VK_MULTIPLY       */ , PMSCAN_PADASTERISK     , "Num *"
00442 /* 0x6B VK_ADD            */ , PMSCAN_PADPLUS         , "Num +"
00443 /* 0x6C VK_SEPARATOR      */ , 0x00                   , NULL
00444 /* 0x6D VK_SUBTRACT       */ , PMSCAN_PADMINUS        , "Num -"
00445 /* 0x6E VK_DECIMAL        */ , PMSCAN_PADPERIOD       , "Num ."
00446 /* 0x6F VK_DIVIDE         */ , PMSCAN_PADSLASH        , "Num /"
00447 /* 0x70 VK_F1             */ , PMSCAN_F1              , "F1"
00448 /* 0x71 VK_F2             */ , PMSCAN_F2              , "F2"
00449 /* 0x72 VK_F3             */ , PMSCAN_F3              , "F3"
00450 /* 0x73 VK_F4             */ , PMSCAN_F4              , "F4"
00451 /* 0x74 VK_F5             */ , PMSCAN_F5              , "F5"
00452 /* 0x75 VK_F6             */ , PMSCAN_F6              , "F6"
00453 /* 0x76 VK_F7             */ , PMSCAN_F7              , "F7"
00454 /* 0x77 VK_F8             */ , PMSCAN_F8              , "F8"
00455 /* 0x78 VK_F9             */ , PMSCAN_F9              , "F9"
00456 /* 0x79 VK_F10            */ , PMSCAN_F10             , "F10"
00457 /* 0x7A VK_F11            */ , PMSCAN_F11             , "F11"
00458 /* 0x7B VK_F12            */ , PMSCAN_F12             , "F12"
00459 /* 0x7C VK_F13            */ , PMSCAN_F13             , "F13"
00460 /* 0x7D VK_F14            */ , PMSCAN_F14             , "F14"
00461 /* 0x7E VK_F15            */ , PMSCAN_F15             , "F15"
00462 /* 0x7F VK_F16            */ , PMSCAN_F16             , "F16"
00463 /* 0x80 VK_F17            */ , PMSCAN_F17             , "F17"
00464 /* 0x81 VK_F18            */ , PMSCAN_F18             , "F18"
00465 /* 0x82 VK_F19            */ , PMSCAN_F19             , "F19"
00466 /* 0x83 VK_F20            */ , PMSCAN_F20             , "F20"
00467 /* 0x84 VK_F21            */ , PMSCAN_F21             , "F21"
00468 /* 0x85 VK_F22            */ , PMSCAN_F22             , "F22"
00469 /* 0x86 VK_F23            */ , PMSCAN_F23             , "F23"
00470 /* 0x87 VK_F24            */ , PMSCAN_F24             , "F24"
00471 /* 0x88                   */ , 0x00                   , NULL
00472 /* 0x89                   */ , 0x00                   , NULL
00473 /* 0x8A                   */ , 0x00                   , NULL
00474 /* 0x8B                   */ , 0x00                   , NULL
00475 /* 0x8C                   */ , 0x00                   , NULL
00476 /* 0x8D                   */ , 0x00                   , NULL
00477 /* 0x8E                   */ , 0x00                   , NULL
00478 /* 0x8F                   */ , 0x00                   , NULL
00479 /* 0x90 VK_NUMLOCK        */ , PMSCAN_NUMLOCK         , "Num Lock"
00480 /* 0x91 VK_SCROLL         */ , PMSCAN_SCROLLLOCK      , "Scroll Lock"
00481 /* 0x92                   */ , 0x00                   , NULL
00482 /* 0x93                   */ , 0x00                   , NULL
00483 /* 0x94                   */ , 0x00                   , NULL
00484 /* 0x95                   */ , 0x00                   , NULL
00485 /* 0x96                   */ , 0x00                   , NULL
00486 /* 0x97                   */ , 0x00                   , NULL
00487 /* 0x98                   */ , 0x00                   , NULL
00488 /* 0x99                   */ , 0x00                   , NULL
00489 /* 0x9A                   */ , 0x00                   , NULL
00490 /* 0x9B                   */ , 0x00                   , NULL
00491 /* 0x9C                   */ , 0x00                   , NULL
00492 /* 0x9D                   */ , 0x00                   , NULL
00493 /* 0x9E                   */ , 0x00                   , NULL
00494 /* 0x9F                   */ , 0x00                   , NULL
00495 /* 0xA0 VK_LSHIFT         */ , PMSCAN_SHIFTLEFT       , "Left Shift"
00496 /* 0xA1 VK_RSHIFT         */ , PMSCAN_SHIFTRIGHT      , "Right Shift"
00497 /* 0xA2 VK_LCONTROL       */ , PMSCAN_CTRLLEFT        , "Left Control"
00498 /* 0xA3 VK_RCONTROL       */ , PMSCAN_CTRLRIGHT       , "Right Control"
00499 /* 0xA4 VK_LMENU          */ , PMSCAN_ALTLEFT         , "Left Alt"
00500 /* 0xA5 VK_RMENU          */ , PMSCAN_ALTRIGHT        , "Right Alt"
00501 /* 0xA6                   */ , 0x00                   , NULL
00502 /* 0xA7                   */ , 0x00                   , NULL
00503 /* 0xA8                   */ , 0x00                   , NULL
00504 /* 0xA9                   */ , 0x00                   , NULL
00505 /* 0xAA                   */ , 0x00                   , NULL
00506 /* 0xAB                   */ , 0x00                   , NULL
00507 /* 0xAC                   */ , 0x00                   , NULL
00508 /* 0xAD                   */ , 0x00                   , NULL
00509 /* 0xAE                   */ , 0x00                   , NULL
00510 /* 0xAF                   */ , 0x00                   , NULL
00511 /* 0xB0                   */ , 0x00                   , NULL
00512 /* 0xB1                   */ , 0x00                   , NULL
00513 /* 0xB2                   */ , 0x00                   , NULL
00514 /* 0xB3                   */ , 0x00                   , NULL
00515 /* 0xB4                   */ , 0x00                   , NULL
00516 /* 0xB5                   */ , 0x00                   , NULL
00517 /* 0xB6                   */ , 0x00                   , NULL
00518 /* 0xB7                   */ , 0x00                   , NULL
00519 /* 0xB8                   */ , 0x00                   , NULL
00520 /* 0xB9                   */ , 0x00                   , NULL
00521 /* 0xBA VK_SEMICOLON      */ , PMSCAN_SEMICOLON       , ";"
00522 /* 0xBB VK_EQUAL          */ , PMSCAN_EQUAL           , "="
00523 /* 0xBC VK_COMMA          */ , PMSCAN_COMMA           , ","
00524 /* 0xBD VK_HYPHEN         */ , PMSCAN_HYPHEN          , "-"
00525 /* 0xBE VK_PERIOD         */ , PMSCAN_PERIOD          , "."
00526 /* 0xBF VK_SLASH          */ , PMSCAN_SLASH           , "/"
00527 /* 0xC0 VK_GRAVE          */ , PMSCAN_GRAVE           , "'"
00528 /* 0xC1 VK_FFC1           */ , PMSCAN_JEXTRA          , "JExtra" //??
00529 /* 0xC2 VK_YEN            */ , PMSCAN_YEN             , "Yen"
00530 /* 0xC3                   */ , 0x00                   , NULL
00531 /* 0xC4                   */ , 0x00                   , NULL
00532 /* 0xC5                   */ , 0x00                   , NULL
00533 /* 0xC6                   */ , 0x00                   , NULL
00534 /* 0xC7                   */ , 0x00                   , NULL
00535 /* 0xC8                   */ , 0x00                   , NULL
00536 /* 0xC9                   */ , 0x00                   , NULL
00537 /* 0xCA                   */ , 0x00                   , NULL
00538 /* 0xCB                   */ , 0x00                   , NULL
00539 /* 0xCC                   */ , 0x00                   , NULL
00540 /* 0xCD                   */ , 0x00                   , NULL
00541 /* 0xCE                   */ , 0x00                   , NULL
00542 /* 0xCF                   */ , 0x00                   , NULL
00543 /* 0xD0                   */ , 0x00                   , NULL
00544 /* 0xD1                   */ , 0x00                   , NULL
00545 /* 0xD2                   */ , 0x00                   , NULL
00546 /* 0xD3                   */ , 0x00                   , NULL
00547 /* 0xD4                   */ , 0x00                   , NULL
00548 /* 0xD5                   */ , 0x00                   , NULL
00549 /* 0xD6                   */ , 0x00                   , NULL
00550 /* 0xD7                   */ , 0x00                   , NULL
00551 /* 0xD8                   */ , 0x00                   , NULL
00552 /* 0xD9                   */ , 0x00                   , NULL
00553 /* 0xDA                   */ , 0x00                   , NULL
00554 /* 0xDB VK_BRACKETLEFT    */ , PMSCAN_BRACKETLEFT     , "["
00555 /* 0xDC VK_BACKSLASH      */ , PMSCAN_BACKSLASH       , "\\"
00556 /* 0xDD VK_BRACKETRIGHT   */ , PMSCAN_BRACKETRIGHT    , "]"
00557 /* 0xDE VK_QUOTESINGLE    */ , PMSCAN_QUOTESINGLE     , "'"
00558 /* 0xDF                   */ , 0x00                   , NULL
00559 /* 0xE0                   */ , 0x00                   , NULL
00560 /* 0xE1                   */ , 0x00                   , NULL
00561 /* 0xE2 VK_EXTRA          */ , PMSCAN_EXTRA           , "<"
00562 /* 0xE3                   */ , 0x00                   , NULL
00563 /* 0xE4                   */ , 0x00                   , NULL
00564 /* 0xE5                   */ , 0x00                   , NULL
00565 /* 0xE6                   */ , 0x00                   , NULL
00566 /* 0xE7                   */ , 0x00                   , NULL
00567 /* 0xE8                   */ , 0x00                   , NULL
00568 /* 0xE9                   */ , 0x00                   , NULL
00569 /* 0xEA                   */ , 0x00                   , NULL
00570 /* 0xEB                   */ , 0x00                   , NULL
00571 /* 0xEC                   */ , 0x00                   , NULL
00572 /* 0xED                   */ , 0x00                   , NULL
00573 /* 0xEE                   */ , 0x00                   , NULL
00574 /* 0xEF                   */ , 0x00                   , NULL
00575 /* 0xF0                   */ , 0x00                   , NULL
00576 /* 0xF1                   */ , 0x00                   , NULL
00577 /* 0xF2                   */ , 0x00                   , NULL
00578 /* 0xF3                   */ , 0x00                   , NULL
00579 /* 0xF4                   */ , 0x00                   , NULL
00580 /* 0xF5                   */ , 0x00                   , NULL
00581 /* 0xF6 VK_ATTN           */ , 0x00                   , NULL
00582 /* 0xF7 VK_CRSEL          */ , 0x00                   , NULL
00583 /* 0xF8 VK_EXSEL          */ , 0x00                   , NULL
00584 /* 0xF9 VK_EREOF          */ , PMSCAN_ERASEEOF        , "Erase"
00585 /* 0xFA VK_PLAY           */ , 0x00                   , NULL
00586 /* 0xFB VK_ZOOM           */ , 0x00                   , NULL
00587 /* 0xFC VK_NONAME         */ , 0x00                   , NULL
00588 /* 0xFD VK_PA1            */ , PMSCAN_PA1             , "PA1"
00589 /* 0xFE VK_OEM_CLEAR      */ , 0x00                   , NULL
00590 /* 0xFF                   */ , 0x00                   , NULL
00591                              };
00592 
00593 
00594 // @@@PH
00595 // Note: windows uses different scancodes if numlock is pressed
00596 // This is not (yet) reflected here!
00597 BYTE abPMScanToWinScan[256][2] =
00598 /****************************************************************************/
00599 /* PM Scancode              *    Win32 Scancode             Extended Key     */
00600 /****************************************************************************/
00601 /* 0x00                     */ { 0x00,                      FALSE
00602 /* 0x01 PMSCAN_ESC          */ , WINSCAN_ESC                ,FALSE
00603 /* 0x02 PMSCAN_ONE          */ , WINSCAN_ONE                ,FALSE
00604 /* 0x03 PMSCAN_TWO          */ , WINSCAN_TWO                ,FALSE
00605 /* 0x04 PMSCAN_THREE        */ , WINSCAN_THREE              ,FALSE
00606 /* 0x05 PMSCAN_FOUR         */ , WINSCAN_FOUR               ,FALSE
00607 /* 0x06 PMSCAN_FIVE         */ , WINSCAN_FIVE               ,FALSE
00608 /* 0x07 PMSCAN_SIX          */ , WINSCAN_SIX                ,FALSE
00609 /* 0x08 PMSCAN_SEVEN        */ , WINSCAN_SEVEN              ,FALSE
00610 /* 0x09 PMSCAN_EIGHT        */ , WINSCAN_EIGHT              ,FALSE
00611 /* 0x0A PMSCAN_NINE         */ , WINSCAN_NINE               ,FALSE
00612 /* 0x0B PMSCAN_ZERO         */ , WINSCAN_ZERO               ,FALSE
00613 /* 0x0C PMSCAN_HYPHEN       */ , WINSCAN_HYPHEN             ,FALSE
00614 /* 0x0D PMSCAN_EQUAL        */ , WINSCAN_EQUAL              ,FALSE
00615 /* 0x0E PMSCAN_BACKSPACE    */ , WINSCAN_BACKSPACE          ,FALSE
00616 /* 0x0F PMSCAN_TAB          */ , WINSCAN_TAB                ,FALSE
00617 /* 0x10 PMSCAN_Q            */ , WINSCAN_Q                  ,FALSE
00618 /* 0x11 PMSCAN_W            */ , WINSCAN_W                  ,FALSE
00619 /* 0x12 PMSCAN_E            */ , WINSCAN_E                  ,FALSE
00620 /* 0x13 PMSCAN_R            */ , WINSCAN_R                  ,FALSE
00621 /* 0x14 PMSCAN_T            */ , WINSCAN_T                  ,FALSE
00622 /* 0x15 PMSCAN_Y            */ , WINSCAN_Y                  ,FALSE
00623 /* 0x16 PMSCAN_U            */ , WINSCAN_U                  ,FALSE
00624 /* 0x17 PMSCAN_I            */ , WINSCAN_I                  ,FALSE
00625 /* 0x18 PMSCAN_O            */ , WINSCAN_O                  ,FALSE
00626 /* 0x19 PMSCAN_P            */ , WINSCAN_P                  ,FALSE
00627 /* 0x1A PMSCAN_BRACKETLEFT  */ , WINSCAN_BRACKETLEFT        ,FALSE
00628 /* 0x1B PMSCAN_BRACKETRIGHT */ , WINSCAN_BRACKETRIGHT       ,FALSE
00629 /* 0x1C PMSCAN_ENTER        */ , WINSCAN_ENTER              ,FALSE
00630 /* 0x1D PMSCAN_CTRLLEFT     */ , WINSCAN_CTRLLEFT           ,FALSE
00631 /* 0x1E PMSCAN_A            */ , WINSCAN_A                  ,FALSE
00632 /* 0x1F PMSCAN_S            */ , WINSCAN_S                  ,FALSE
00633 /* 0x20 PMSCAN_D            */ , WINSCAN_D                  ,FALSE
00634 /* 0x21 PMSCAN_F            */ , WINSCAN_F                  ,FALSE
00635 /* 0x22 PMSCAN_G            */ , WINSCAN_G                  ,FALSE
00636 /* 0x23 PMSCAN_H            */ , WINSCAN_H                  ,FALSE
00637 /* 0x24 PMSCAN_J            */ , WINSCAN_J                  ,FALSE
00638 /* 0x25 PMSCAN_K            */ , WINSCAN_K                  ,FALSE
00639 /* 0x26 PMSCAN_L            */ , WINSCAN_L                  ,FALSE
00640 /* 0x27 PMSCAN_SEMICOLON    */ , WINSCAN_SEMICOLON          ,FALSE
00641 /* 0x28 PMSCAN_QUOTESINGLE  */ , WINSCAN_QUOTESINGLE        ,FALSE
00642 /* 0x29 PMSCAN_GRAVE        */ , WINSCAN_GRAVE              ,FALSE
00643 /* 0x2A PMSCAN_SHIFTLEFT    */ , WINSCAN_SHIFTLEFT          ,FALSE
00644 /* 0x2B PMSCAN_BACKSLASH    */ , WINSCAN_BACKSLASH          ,FALSE
00645 /* 0x2C PMSCAN_Z            */ , WINSCAN_Z                  ,FALSE
00646 /* 0x2D PMSCAN_X            */ , WINSCAN_X                  ,FALSE
00647 /* 0x2E PMSCAN_C            */ , WINSCAN_C                  ,FALSE
00648 /* 0x2F PMSCAN_V            */ , WINSCAN_V                  ,FALSE
00649 /* 0x30 PMSCAN_B            */ , WINSCAN_B                  ,FALSE
00650 /* 0x31 PMSCAN_N            */ , WINSCAN_N                  ,FALSE
00651 /* 0x32 PMSCAN_M            */ , WINSCAN_M                  ,FALSE
00652 /* 0x33 PMSCAN_COMMA        */ , WINSCAN_COMMA              ,FALSE
00653 /* 0x34 PMSCAN_PERIOD       */ , WINSCAN_PERIOD             ,FALSE
00654 /* 0x35 PMSCAN_SLASH        */ , WINSCAN_SLASH              ,FALSE
00655 /* 0x36 PMSCAN_SHIFTRIGHT   */ , WINSCAN_SHIFTRIGHT         ,TRUE
00656 /* 0x37 PMSCAN_PADASTERISK  */ , WINSCAN_PADASTERISK        ,FALSE
00657 /* 0x38 PMSCAN_ALTLEFT      */ , WINSCAN_ALTLEFT            ,FALSE
00658 /* 0x39 PMSCAN_SPACE        */ , WINSCAN_SPACE              ,FALSE
00659 /* 0x3A PMSCAN_CAPSLOCK     */ , WINSCAN_CAPSLOCK           ,FALSE
00660 /* 0x3B PMSCAN_F1           */ , WINSCAN_F1                 ,FALSE
00661 /* 0x3C PMSCAN_F2           */ , WINSCAN_F2                 ,FALSE
00662 /* 0x3D PMSCAN_F3           */ , WINSCAN_F3                 ,FALSE
00663 /* 0x3E PMSCAN_F4           */ , WINSCAN_F4                 ,FALSE
00664 /* 0x3F PMSCAN_F5           */ , WINSCAN_F5                 ,FALSE
00665 /* 0x40 PMSCAN_F6           */ , WINSCAN_F6                 ,FALSE
00666 /* 0x41 PMSCAN_F7           */ , WINSCAN_F7                 ,FALSE
00667 /* 0x42 PMSCAN_F8           */ , WINSCAN_F8                 ,FALSE
00668 /* 0x43 PMSCAN_F9           */ , WINSCAN_F9                 ,FALSE
00669 /* 0x44 PMSCAN_F10          */ , WINSCAN_F10                ,FALSE
00670 /* 0x45 PMSCAN_NUMLOCK      */ , WINSCAN_NUMLOCK            ,TRUE
00671 /* 0x46 PMSCAN_SCROLLLOCK   */ , WINSCAN_SCROLLLOCK         ,FALSE
00672 /* 0x47 PMSCAN_PAD7         */ , WINSCAN_PAD7               ,FALSE
00673 /* 0x48 PMSCAN_PAD8         */ , WINSCAN_PAD8               ,FALSE
00674 /* 0x49 PMSCAN_PAD9         */ , WINSCAN_PAD9               ,FALSE
00675 /* 0x4A PMSCAN_PADMINUS     */ , WINSCAN_PADMINUS           ,FALSE
00676 /* 0x4B PMSCAN_PAD4         */ , WINSCAN_PAD4               ,FALSE
00677 /* 0x4C PMSCAN_PAD5         */ , WINSCAN_PAD5               ,FALSE
00678 /* 0x4D PMSCAN_PAD6         */ , WINSCAN_PAD6               ,FALSE
00679 /* 0x4E PMSCAN_PADPLUS      */ , WINSCAN_PADPLUS            ,FALSE
00680 /* 0x4F PMSCAN_PAD1         */ , WINSCAN_PAD1               ,FALSE
00681 /* 0x50 PMSCAN_PAD2         */ , WINSCAN_PAD2               ,FALSE
00682 /* 0x51 PMSCAN_PAD3         */ , WINSCAN_PAD3               ,FALSE
00683 /* 0x52 PMSCAN_PAD0         */ , WINSCAN_PAD0               ,FALSE
00684 /* 0x53 PMSCAN_PADPERIOD    */ , WINSCAN_PADPERIOD          ,FALSE
00685 /* 0x54 PMSCAN_SYSREQ       */ , 0x00                       ,FALSE
00686 /* 0x55 PMSCAN_RESET        */ , 0x00                       ,FALSE
00687 /* 0x56 PMSCAN_EXTRA        */ , WINSCAN_EXTRA              ,FALSE
00688 /* 0x57 PMSCAN_F11          */ , WINSCAN_F11                ,FALSE
00689 /* 0x58 PMSCAN_F12          */ , WINSCAN_F12                ,FALSE
00690 /* 0x59 PMSCAN_BACKTAB      */ , 0x00                       ,FALSE
00691 /* 0x5A PMSCAN_PADENTER     */ , WINSCAN_PADENTER           ,TRUE
00692 /* 0x5B PMSCAN_CTRLRIGHT    */ , WINSCAN_CTRLRIGHT          ,TRUE
00693 /* 0x5C PMSCAN_PADSLASH     */ , WINSCAN_PADSLASH           ,TRUE
00694 /* 0x5D PMSCAN_PRINT        */ , WINSCAN_PRINT              ,TRUE
00695 /* 0x5E PMSCAN_ALTRIGHT     */ , WINSCAN_ALTRIGHT           ,TRUE
00696 /* 0x5F PMSCAN_PAUSE        */ , WINSCAN_PAUSE              ,FALSE
00697 /* 0x60 PMSCAN_HOME         */ , WINSCAN_HOME               ,TRUE
00698 /* 0x61 PMSCAN_UP           */ , WINSCAN_UP                 ,TRUE
00699 /* 0x62 PMSCAN_PAGEUP       */ , WINSCAN_PAGEUP             ,TRUE
00700 /* 0x63 PMSCAN_LEFT         */ , WINSCAN_LEFT               ,TRUE
00701 /* 0x64 PMSCAN_RIGHT        */ , WINSCAN_RIGHT              ,TRUE
00702 /* 0x65 PMSCAN_END          */ , WINSCAN_END                ,TRUE
00703 /* 0x66 PMSCAN_DOWN         */ , WINSCAN_DOWN               ,TRUE
00704 /* 0x67 PMSCAN_PAGEDOWN     */ , WINSCAN_PAGEDOWN           ,TRUE
00705 /* 0x68 PMSCAN_INSERT       */ , WINSCAN_INSERT             ,TRUE
00706 /* 0x69 PMSCAN_DELETE       */ , WINSCAN_DELETE             ,TRUE
00707 /* 0x6A PMSCAN_F23          */ , WINSCAN_F23                ,FALSE
00708 /* 0x6B PMSCAN_F24          */ , WINSCAN_F24                ,FALSE
00709 /* 0x6C PMSCAN_SYSMEM       */ , 0x00                       ,FALSE
00710 /* 0x6D PMSCAN_ERASEEOF     */ , WINSCAN_ERASEEOF           ,FALSE
00711 /* 0x6E PMSCAN_BREAK        */ , WINSCAN_BREAK              ,TRUE
00712 /* 0x6F PMSCAN_MOVEWIN      */ , 0x00                       ,FALSE
00713 /* 0x70 PMSCAN_NLS3         */ , WINSCAN_NLS3               ,FALSE
00714 /* 0x71 PMSCAN_HELP         */ , WINSCAN_HELP               ,FALSE
00715 /* 0x72 PMSCAN_TASKMAN      */ , 0x00                       ,FALSE
00716 /* 0x73 PMSCAN_B11          */ , WINSCAN_B11                ,FALSE
00717 /* 0x74 PMSCAN_JUMP         */ , 0x00                       ,FALSE
00718 /* 0x75 PMSCAN_MINWIN       */ , 0x00                       ,FALSE
00719 /* 0x76 PMSCAN_CLEAR        */ , 0x00                       ,FALSE
00720 /* 0x77 PMSCAN_77           */ , 0x00                       ,FALSE
00721 /* 0x78 PMSCAN_78           */ , 0x00                       ,FALSE
00722 /* 0x79 PMSCAN_NLS2         */ , WINSCAN_NLS2               ,FALSE
00723 /* 0x7a PMSCAN_SIZE         */ , 0x00                       ,FALSE
00724 /* 0x7b PMSCAN_NLS1         */ , WINSCAN_NLS1               ,FALSE
00725 /* 0x7c PMSCAN_APPLICATION  */ , WINSCAN_APPLICATION        ,TRUE
00726 /* 0x7d PMSCAN_E13          */ , WINSCAN_YEN                ,FALSE
00727 /* 0x7e PMSCAN_WINLEFT      */ , WINSCAN_WINLEFT            ,TRUE
00728 /* 0x7f PMSCAN_WINRIGHT     */ , WINSCAN_WINRIGHT           ,TRUE
00729 /* 0x80 PMSCAN_PA1          */ , WINSCAN_PA1                ,FALSE
00730 /* 0x81 PMSCAN_F13          */ , WINSCAN_F13                ,FALSE
00731 /* 0x82 PMSCAN_F14          */ , WINSCAN_F14                ,FALSE
00732 /* 0x83 PMSCAN_F15          */ , WINSCAN_F15                ,FALSE
00733 /* 0x84 PMSCAN_PA2          */ , 0x00                       ,FALSE
00734 /* 0x85 PMSCAN_PA3          */ , 0x00                       ,FALSE
00735 /* 0x86 PMSCAN_SPACEBREAK   */ , 0x00                       ,FALSE
00736 /* 0x87 PMSCAN_TABRIGHT     */ , 0x00                       ,FALSE
00737 /* 0x88 PMSCAN_NOOP         */ , 0x00                       ,FALSE
00738 /* 0x89 PMSCAN_F16          */ , WINSCAN_F16                ,FALSE
00739 /* 0x8a PMSCAN_F17          */ , WINSCAN_F17                ,FALSE
00740 /* 0x8b PMSCAN_F18          */ , WINSCAN_F18                ,FALSE
00741 /* 0x8c PMSCAN_F19          */ , WINSCAN_F19                ,FALSE
00742 /* 0x8d PMSCAN_F20          */ , WINSCAN_F20                ,FALSE
00743 /* 0x8e PMSCAN_F21          */ , WINSCAN_F21                ,FALSE
00744 /* 0x8f PMSCAN_F22          */ , WINSCAN_F22                ,FALSE
00745 /* 0x90                     */ , WINSCAN_PREVTRACK          ,FALSE
00746 /* 0x91                     */ , WINSCAN_AT                 ,FALSE
00747 /* 0x92                     */ , WINSCAN_COLON              ,FALSE
00748 /* 0x93                     */ , WINSCAN_UNDERLINE          ,FALSE
00749 /* 0x94                     */ , WINSCAN_KANJI              ,FALSE
00750 /* 0x95                     */ , WINSCAN_STOP               ,FALSE
00751 /* 0x96                     */ , WINSCAN_AX                 ,FALSE
00752 /* 0x97                     */ , WINSCAN_UNLABELED          ,FALSE
00753 /* 0x98                     */ , 0x00                       ,FALSE
00754 /* 0x99                     */ , WINSCAN_NEXTTRACK          ,FALSE
00755 /* 0x9A                     */ , 0x00                       ,FALSE
00756 /* 0x9B                     */ , 0x00                       ,FALSE
00757 /* 0x9C                     */ , 0x00                       ,FALSE
00758 /* 0x9D                     */ , 0x00                       ,FALSE
00759 /* 0x9E                     */ , 0x00                       ,FALSE
00760 /* 0x9F                     */ , 0x00                       ,FALSE
00761 /* 0xA0                     */ , WINSCAN_MUTE               ,FALSE
00762 /* 0xA1                     */ , WINSCAN_CALCULATOR         ,FALSE
00763 /* 0xA2                     */ , WINSCAN_PLAYPAUSE          ,FALSE
00764 /* 0xA3                     */ , 0x00                       ,FALSE
00765 /* 0xA4                     */ , WINSCAN_MEDIASTOP          ,FALSE
00766 /* 0xA5                     */ , 0x00                       ,FALSE
00767 /* 0xA6                     */ , 0x00                       ,FALSE
00768 /* 0xA7                     */ , 0x00                       ,FALSE
00769 /* 0xA8                     */ , 0x00                       ,FALSE
00770 /* 0xA9                     */ , 0x00                       ,FALSE
00771 /* 0xAA                     */ , 0x00                       ,FALSE
00772 /* 0xAB                     */ , 0x00                       ,FALSE
00773 /* 0xAC                     */ , 0x00                       ,FALSE
00774 /* 0xAD                     */ , 0x00                       ,FALSE
00775 /* 0xAE                     */ , WINSCAN_VOLUMEDOWN         ,FALSE
00776 /* 0xAF                     */ , 0x00                       ,FALSE
00777 /* 0xB0                     */ , WINSCAN_VOLUMEUP           ,FALSE
00778 /* 0xB1                     */ , 0x00                       ,FALSE
00779 /* 0xB2                     */ , WINSCAN_WEBHOME            ,FALSE
00780 /* 0xB3                     */ , WINSCAN_NUMPADCOMMA        ,FALSE
00781 /* 0xB4                     */ , 0x00                       ,FALSE
00782 /* 0xB5                     */ , 0x00                       ,FALSE
00783 /* 0xB6                     */ , 0x00                       ,FALSE
00784 /* 0xB7                     */ , 0x00                       ,FALSE
00785 /* 0xB8                     */ , 0x00                       ,FALSE
00786 /* 0xB9                     */ , 0x00                       ,FALSE
00787 /* 0xBA                     */ , 0x00                       ,FALSE
00788 /* 0xBB                     */ , 0x00                       ,FALSE
00789 /* 0xBC                     */ , 0x00                       ,FALSE
00790 /* 0xBD                     */ , 0x00                       ,FALSE
00791 /* 0xBE                     */ , 0x00                       ,FALSE
00792 /* 0xBF                     */ , 0x00                       ,FALSE
00793 /* 0xC0                     */ , 0x00                       ,FALSE
00794 /* 0xC1                     */ , 0x00                       ,FALSE
00795 /* 0xC2                     */ , 0x00                       ,FALSE
00796 /* 0xC3                     */ , 0x00                       ,FALSE
00797 /* 0xC4                     */ , 0x00                       ,FALSE
00798 /* 0xC5                     */ , 0x00                       ,FALSE
00799 /* 0xC6                     */ , 0x00                       ,FALSE
00800 /* 0xC7                     */ , 0x00                       ,FALSE
00801 /* 0xC8                     */ , 0x00                       ,FALSE
00802 /* 0xC9                     */ , 0x00                       ,FALSE
00803 /* 0xCA                     */ , 0x00                       ,FALSE
00804 /* 0xCB                     */ , 0x00                       ,FALSE
00805 /* 0xCC                     */ , 0x00                       ,FALSE
00806 /* 0xCD                     */ , 0x00                       ,FALSE
00807 /* 0xCE                     */ , 0x00                       ,FALSE
00808 /* 0xCF                     */ , 0x00                       ,FALSE
00809 /* 0xD0                     */ , 0x00                       ,FALSE
00810 /* 0xD1                     */ , 0x00                       ,FALSE
00811 /* 0xD2                     */ , 0x00                       ,FALSE
00812 /* 0xD3                     */ , 0x00                       ,FALSE
00813 /* 0xD4                     */ , 0x00                       ,FALSE
00814 /* 0xD5                     */ , 0x00                       ,FALSE
00815 /* 0xD6                     */ , 0x00                       ,FALSE
00816 /* 0xD7                     */ , 0x00                       ,FALSE
00817 /* 0xD8                     */ , 0x00                       ,FALSE
00818 /* 0xD9                     */ , 0x00                       ,FALSE
00819 /* 0xDA                     */ , 0x00                       ,FALSE
00820 /* 0xDB                     */ , 0x00                       ,FALSE
00821 /* 0xDC                     */ , 0x00                       ,FALSE
00822 /* 0xDD                     */ , 0x00                       ,FALSE
00823 /* 0xDE                     */ , WINSCAN_POWER              ,FALSE
00824 /* 0xDF                     */ , WINSCAN_SLEEP              ,FALSE
00825 /* 0xE0                     */ , 0x00                       ,FALSE
00826 /* 0xE1                     */ , 0x00                       ,FALSE
00827 /* 0xE2                     */ , 0x00                       ,FALSE
00828 /* 0xE3                     */ , WINSCAN_WAKE               ,FALSE
00829 /* 0xE4                     */ , 0x00                       ,FALSE
00830 /* 0xE5                     */ , WINSCAN_WEBSEARCH          ,FALSE
00831 /* 0xE6                     */ , WINSCAN_WEBFAVORITES       ,FALSE
00832 /* 0xE7                     */ , WINSCAN_WEBREFRESH         ,FALSE
00833 /* 0xE8                     */ , WINSCAN_WEBSTOP            ,FALSE
00834 /* 0xE9                     */ , WINSCAN_WEBFORWARD         ,FALSE
00835 /* 0xEA                     */ , WINSCAN_WEBBACK            ,FALSE
00836 /* 0xEB                     */ , WINSCAN_MYCOMPUTER         ,FALSE
00837 /* 0xEC                     */ , WINSCAN_MAIL               ,FALSE
00838 /* 0xED                     */ , WINSCAN_MEDIASELECT        ,FALSE
00839 /* 0xEE                     */ , 0x00                       ,FALSE
00840 /* 0xEF                     */ , 0x00                       ,FALSE
00841 /* 0xF0                     */ , 0x00                       ,FALSE
00842 /* 0xF1                     */ , 0x00                       ,FALSE
00843 /* 0xF2                     */ , 0x00                       ,FALSE
00844 /* 0xF3                     */ , 0x00                       ,FALSE
00845 /* 0xF4                     */ , 0x00                       ,FALSE
00846 /* 0xF5                     */ , 0x00                       ,FALSE
00847 /* 0xF6                     */ , 0x00                       ,FALSE
00848 /* 0xF7                     */ , 0x00                       ,FALSE
00849 /* 0xF8                     */ , 0x00                       ,FALSE
00850 /* 0xF9                     */ , 0x00                       ,FALSE
00851 /* 0xFA                     */ , 0x00                       ,FALSE
00852 /* 0xFB                     */ , 0x00                       ,FALSE
00853 /* 0xFC                     */ , 0x00                       ,FALSE
00854 /* 0xFD                     */ , 0x00                       ,FALSE
00855 /* 0xFE                     */ , 0x00                       ,FALSE
00856 /* 0xFF                     */ , 0x00                       ,FALSE
00857                                };
00858 
00859 
00860 //******************************************************************************
00861 //******************************************************************************
00862 
00863 ODINPROCEDURE3(KeyTranslatePMToWinBuf,
00864                BYTE *, pmkey,
00865                BYTE *, winkey,
00866                int,    nrkeys)
00867 {
00868    for(int i=1;i<nrkeys;i++) {
00869        if(abWinVKeyToPMScan[i].bPMScanCode) {
00870             winkey[i] = pmkey[OSLibWinTranslateChar(abWinVKeyToPMScan[i].bPMScanCode, TC_SCANCODETOVIRTUALKEY, 0)];
00871        }
00872    }
00873    winkey[VK_SHIFT]   = winkey[VK_LSHIFT] | winkey[VK_RSHIFT];
00874    winkey[VK_CONTROL] = winkey[VK_LCONTROL] | winkey[VK_RCONTROL];
00875    winkey[VK_MENU]    = winkey[VK_LMENU] | winkey[VK_RMENU];
00876 }
00877 //******************************************************************************
00878 //******************************************************************************
00879 BYTE KeyTranslateWinVKeyToPMScan(BYTE bWinVKey, BOOL fExtended)
00880 {
00881   // if the extended bit didn't match, this is
00882   // the closest hit
00883   BYTE bAlmost = 0;
00884   
00885   // experiment
00886 #if 0
00887   bAlmost = abWinVKeyToPMScan[bWinVKey].bPMScanCode;
00888 #else
00889   for(int i = 0;
00890       i < 256; // sizeof(row of abPMScanToWinVKey)
00891       i++)
00892   {
00893     if (abPMScanToWinVKey[i][0] == bWinVKey)
00894     {
00895       // this represents the PMScan code which is used as index      
00896       bAlmost = i;
00897       
00898       // exact match!
00899       if (abPMScanToWinVKey[i][1] == fExtended)
00900         break;
00901     }
00902   }
00903 #endif
00904   
00905   dprintf(("KeyTranslateWinVKeyToPMScan(%02xh,%d) = %02xh",
00906            bWinVKey,
00907            fExtended,
00908            bAlmost));
00909   
00910   // almost a match or no match at all.
00911   return bAlmost; 
00912 }
00913 //******************************************************************************
00914 //******************************************************************************
00915 void KeyTranslatePMScanToWinVKey(BYTE bPMScan, 
00916                                  BOOL bNumLock,
00917                                  PBYTE pbWinVKey,
00918                                  WORD* pwWinScan,
00919                                  PBOOL pfExtended)
00920 {
00921   // @@@PH numlock is currently ignored
00922   if (pbWinVKey)
00923     *pbWinVKey = abPMScanToWinVKey[bPMScan][0];
00924   
00925   if (pfExtended)
00926     *pfExtended = abPMScanToWinVKey[bPMScan][1];
00927   
00928   if (pwWinScan)
00929     *pwWinScan = abPMScanToWinScan[bPMScan][0];
00930 }
00931 //******************************************************************************
00932 //******************************************************************************
00933 BYTE KeyTranslateWinScanToPMScan(BYTE bWinScan, BOOL fExtended)
00934 {
00935   // Note:
00936   // MapVirtualKeyA requires this function,
00937   // O32_MapVirtualKeyA uses PM Scancodes only!
00938   
00939   // if the extended bit didn't match, this is
00940   // the closest hit
00941   BYTE bAlmost = 0;
00942   
00943   for(int i = 0;
00944       i < 256; // sizeof(row of abPMScanToWinVKey)
00945       i++)
00946   {
00947     if (abPMScanToWinScan[i][0] == bWinScan)
00948     {
00949       // this represents the PMScan code which is used as index      
00950       bAlmost = i;
00951       
00952       // exact match!
00953       if (abPMScanToWinVKey[i][1] == fExtended)
00954         break;
00955     }
00956   }
00957   
00958   dprintf(("KeyTranslateWinScanToPMScan(%02xh,%d) = %02xh",
00959            bWinScan,
00960            fExtended,
00961            bAlmost));
00962   
00963   // almost a match or no match at all.
00964   return bAlmost; 
00965   
00966 }
00967 //******************************************************************************
00968 //******************************************************************************
00969 ODINFUNCTION1(int, GetKeyboardType,
00970               int, nTypeFlag)
00971 {
00972     return O32_GetKeyboardType(nTypeFlag);
00973 }
00974 //******************************************************************************
00975 //******************************************************************************
00976 ODINFUNCTION1(BOOL,  GetKeyboardState,
00977               PBYTE, lpKeyState)
00978 {
00979  BYTE   PMKeyState[256];
00980  BOOL   rc;
00981 
00982   memset(PMKeyState, 0, sizeof(PMKeyState));
00983   memset(lpKeyState, 0, 256);
00984   rc = OSLibWinGetKeyboardStateTable((PBYTE)&PMKeyState[0] );
00985 ////  rc = O32_GetKeyboardState(lpKeyState);
00986   if(rc == TRUE)
00987   {
00988     KeyTranslatePMToWinBuf((BYTE *)&PMKeyState[0], lpKeyState, 256);
00989     
00990     // @@@PH
00991     // Note: we'd have to check the key state overlay array here, too!
00992     
00993 #ifdef DEBUG
00994         for(int i=0;i<256;i++) {
00995             if(PMKeyState[i] & 0x80) {
00996                 dprintf2(("PM  key 0x%0x = %x", i, PMKeyState[i]));
00997             }
00998         }
00999         for(i=0;i<256;i++) {
01000             if(lpKeyState[i]) {
01001                 dprintf2(("Win key 0x%0x = %x", i, lpKeyState[i]));
01002             }
01003         }
01004 #endif
01005         return TRUE;
01006   }
01007   return FALSE;
01008 }
01009 //******************************************************************************
01010 //******************************************************************************
01011 ODINFUNCTION1(BOOL,  SetKeyboardState,
01012               PBYTE, lpKeyState)
01013 {
01014   dprintf(("USER32: SetKeyboardState %x not implemented", lpKeyState));
01015   return(TRUE);
01016 }
01017 /***********************************************************************
01018  *           GetKeyboardLayout          (USER32.250)
01019  *
01020  * FIXME: - device handle for keyboard layout defaulted to
01021  *          the language id. This is the way Windows default works.
01022  *        - the thread identifier (dwLayout) is also ignored.
01023  */
01024 // * Remark    : Based on Wine version (991031)
01025 ODINFUNCTION1(HKL,   GetKeyboardLayout,
01026               DWORD, dwLayout)
01027 {
01028         HKL layout;
01029         layout = GetSystemDefaultLCID(); /* FIXME */
01030         layout |= (layout<<16);          /* FIXME */
01031         dprintf(("GetKeyboardLayout returning %08x\n",layout));
01032         return layout;
01033 }
01034 /*****************************************************************************
01035  * Name      : BOOL WIN32API GetKeyboardLayoutNameA
01036  * Purpose   : The GetKeyboardLayoutName function retrieves the name of the
01037  *             active keyboard layout.
01038  * Parameters: LPTSTR pwszKLID address of buffer for layout name
01039  * Variables :
01040  * Result    : If the function succeeds, the return value is TRUE.
01041  *             If the function fails, the return value is FALSE. To get extended
01042  *               error information, call GetLastError.
01043  * Remark    : Based on Wine version (991031)
01044  * Status    : UNTESTED STUB
01045  *
01046  * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
01047  *****************************************************************************/
01048 ODINFUNCTION1(INT,   GetKeyboardLayoutNameA,
01049               LPSTR, pwszKLID)
01050 {
01051    dprintf(("not correctly implemented"));
01052 
01053    sprintf(pwszKLID, "%08x",GetKeyboardLayout(0));
01054    return 1;
01055 }
01056 
01057 
01058 /*****************************************************************************
01059  * Name      : BOOL WIN32API GetKeyboardLayoutNameW
01060  * Purpose   : The GetKeyboardLayoutName function retrieves the name of the
01061  *             active keyboard layout.
01062  * Parameters: LPTSTR pwszKLID address of buffer for layout name
01063  * Variables :
01064  * Result    : If the function succeeds, the return value is TRUE.
01065  *             If the function fails, the return value is FALSE. To get extended
01066  *               error information, call GetLastError.
01067  * Remark    : Based on Wine version (991031)
01068  * Status    : UNTESTED STUB
01069  *
01070  * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
01071  *****************************************************************************/
01072 ODINFUNCTION1(INT,    GetKeyboardLayoutNameW,
01073               LPWSTR, pwszKLID)
01074 {
01075    LPSTR buf = (LPSTR)HEAP_xalloc( GetProcessHeap(), 0, strlen("00000409")+1);
01076 
01077    int res = GetKeyboardLayoutNameA(buf);
01078    lstrcpyAtoW(pwszKLID,buf);
01079    HeapFree( GetProcessHeap(), 0, buf );
01080    return res;
01081 }
01082 /***********************************************************************
01083  *           GetKeyboardLayoutList      (USER32.251)
01084  *
01085  * FIXME: Supports only the system default language and layout and
01086  *          returns only 1 value.
01087  *
01088  * Return number of values available if either input parm is
01089  *  0, per MS documentation.
01090  *
01091  * Remark    : Based on Wine version (991031)
01092  */
01093 ODINFUNCTION2(INT,   GetKeyboardLayoutList,
01094               INT,   nBuff,
01095               HKL *, layouts)
01096 {
01097   dprintf(("not correctly implemented"));
01098   
01099   if (!nBuff || !layouts)
01100     return 1;
01101   
01102   if (layouts)
01103     layouts[0] = GetKeyboardLayout(0);
01104   
01105   return 1;
01106 }
01107 /*****************************************************************************
01108  * Name      : int WIN32API ToAscii
01109  * Purpose   : The ToAscii function translates the specified virtual-key code
01110  *             and keyboard state to the corresponding Windows character or characters.
01111  * Parameters: UINT   uVirtKey    virtual-key code
01112  *             UINT   uScanCode   scan code
01113  *             PBYTE  lpbKeyState address of key-state array
01114  *             LPWORD lpwTransKey buffer for translated key
01115  *             UINT   fuState     active-menu flag
01116  * Variables :
01117  * Result    : 0 The specified virtual key has no translation for the current
01118  *               state of the keyboard.
01119  *             1 One Windows character was copied to the buffer.
01120  *             2 Two characters were copied to the buffer. This usually happens
01121  *               when a dead-key character (accent or diacritic) stored in the
01122  *               keyboard layout cannot be composed with the specified virtual
01123  *               key to form a single character.
01124  * Remark    :
01125  * Status    : UNTESTED STUB
01126  *
01127  * Author    : SvL
01128  *****************************************************************************/
01129 
01130 ODINFUNCTION5(int,    ToAscii,
01131               UINT,   uVirtKey,
01132               UINT,   uScanCode,
01133               PBYTE,  lpbKeyState,
01134               LPWORD, lpwTransKey,
01135               UINT,   fuState)
01136 {
01137   INT ret;
01138 
01139   if (uScanCode == 0) {
01140         /* This happens when doing Alt+letter : a fake 'down arrow' key press
01141            event is generated by windows. Just ignore it. */
01142         dprintf2(("scanCode=0, doing nothing"));
01143         return 0;
01144   }
01145   if (uScanCode & 0x8000)
01146   {
01147         dprintf2(("Key UP, doing nothing"));
01148         return 0;
01149   }
01150 
01151   /* We have another special case for delete key (XK_Delete) on an
01152      extended keyboard. X returns a char for it, but Windows doesn't */
01153   if (uVirtKey == VK_DELETE)
01154   {
01155        *(char*)lpwTransKey = 0;
01156        ret = 0;
01157   }
01158   else
01159   if (uVirtKey == VK_ESCAPE) {
01160        //NT returns VK_ESCAPE here
01161        *(char*)lpwTransKey = VK_ESCAPE;
01162        ret = 1;
01163   }
01164   else {
01165        ULONG shiftstate = 0;
01166 
01167        //TODO: multiple characters returned (DBCS??)
01168 
01169        if(lpbKeyState[VK_LSHIFT]   & 0x80) shiftstate |= TCF_LSHIFT;
01170        if(lpbKeyState[VK_RSHIFT]   & 0x80) shiftstate |= TCF_RSHIFT;
01171        if(lpbKeyState[VK_SHIFT]    & 0x80) shiftstate |= TCF_SHIFT;
01172        if(lpbKeyState[VK_LCONTROL] & 0x80) shiftstate |= TCF_LCONTROL;
01173        if(lpbKeyState[VK_RCONTROL] & 0x80) shiftstate |= TCF_RCONTROL;
01174        if(lpbKeyState[VK_CONTROL]  & 0x80) shiftstate |= TCF_CONTROL;
01175        if(lpbKeyState[VK_LMENU]    & 0x80) shiftstate |= TCF_ALT;
01176        if(lpbKeyState[VK_RMENU]    & 0x80) shiftstate |= TCF_ALTGR;
01177        if(lpbKeyState[VK_MENU]     & 0x80) shiftstate |= TCF_ALT;
01178        if(lpbKeyState[VK_CAPITAL]  & 1)    shiftstate |= TCF_CAPSLOCK;
01179        if(lpbKeyState[VK_NUMLOCK]  & 1)    shiftstate |= TCF_NUMLOCK;
01180 
01181        //NT only modifies the bytes it returns
01182        *(char *)lpwTransKey = OSLibWinTranslateChar(uScanCode, TC_SCANCODETOCHAR, shiftstate);
01183 
01184        if(shiftstate & TCF_CONTROL) {
01185            if(uVirtKey >= VK_A && uVirtKey <= VK_Z) {
01186                //NT returns key-0x60 (or so it seems) for ctrl-(shift-)-a..z
01187                if(shiftstate & (TCF_SHIFT|TCF_CAPSLOCK)) {
01188                     *(char *)lpwTransKey -= 0x40;
01189                }
01190                else *(char *)lpwTransKey -= 0x60;
01191            }
01192            else
01193            if(uVirtKey == VK_SPACE) {
01194                if(shiftstate & TCF_SHIFT) {
01195                    //NT returns 0 for ctrl-shift-space
01196                    *lpwTransKey = 0;
01197                }
01198            }
01199            else {
01200                //NT returns 0 for ctrl-0, ctrl-.
01201                *lpwTransKey = 0;
01202            }
01203        }
01204 
01205        if(*(char *)lpwTransKey == 0) {
01206             ret = 0;
01207        }
01208        else ret = 1;
01209   }
01210   dprintf2(("USER32:ToAscii returned %x, len %d", *lpwTransKey, ret));
01211   return ret;
01212 }
01213 /*****************************************************************************
01214  * Name      : int WIN32API ToAsciiEx
01215  * Purpose   : The ToAscii function translates the specified virtual-key code
01216  *             and keyboard state to the corresponding Windows character or characters.
01217  * Parameters: UINT   uVirtKey    virtual-key code
01218  *             UINT   uScanCode   scan code
01219  *             PBYTE  lpbKeyState address of key-state array
01220  *             LPWORD lpwTransKey buffer for translated key
01221  *             UINT   fuState     active-menu flag
01222  *             HLK    hlk         keyboard layout handle
01223  * Variables :
01224  * Result    : 0 The specified virtual key has no translation for the current
01225  *               state of the keyboard.
01226  *             1 One Windows character was copied to the buffer.
01227  *             2 Two characters were copied to the buffer. This usually happens
01228  *               when a dead-key character (accent or diacritic) stored in the
01229  *               keyboard layout cannot be composed with the specified virtual
01230  *               key to form a single character.
01231  * Remark    :
01232  * Status    : UNTESTED STUB
01233  *
01234  * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
01235  *****************************************************************************/
01236 
01237 ODINFUNCTION6(int,    ToAsciiEx,
01238               UINT,   uVirtKey,
01239               UINT,   uScanCode,
01240               PBYTE,  lpbKeyState,
01241               LPWORD, lpwTransKey,
01242               UINT,   fuState,
01243               HKL,    hkl)
01244 {
01245   dprintf(("imcompletely implemented"));
01246 
01247   return ToAscii(uVirtKey, uScanCode, lpbKeyState, lpwTransKey, fuState);
01248 }
01249 /*****************************************************************************
01250  * Name      : int WIN32API ToUnicode
01251  * Purpose   : The ToUnicode function translates the specified virtual-key code
01252  *             and keyboard state to the corresponding Unicode character or characters.
01253  * Parameters: UINT   wVirtKey   virtual-key code
01254  *             UINT   wScanCode  scan code
01255  *             PBYTE  lpKeyState address of key-state array
01256  *             LPWSTR pwszBuff   buffer for translated key
01257  *             int    cchBuff    size of translated key buffer
01258  *             UINT   wFlags     set of function-conditioning flags
01259  * Variables :
01260  * Result    : - 1 The specified virtual key is a dead-key character (accent or
01261  *                 diacritic). This value is returned regardless of the keyboard
01262  *                 layout, even if several characters have been typed and are
01263  *                 stored in the keyboard state. If possible, even with Unicode
01264  *                 keyboard layouts, the function has written a spacing version of
01265  *                 the dead-key character to the buffer specified by pwszBuffer.
01266  *                 For example, the function writes the character SPACING ACUTE
01267  *                 (0x00B4), rather than the character NON_SPACING ACUTE (0x0301).
01268  *               0 The specified virtual key has no translation for the current
01269  *                 state of the keyboard. Nothing was written to the buffer
01270  *                 specified by pwszBuffer.
01271  *               1 One character was written to the buffer specified by pwszBuffer.
01272  *       2 or more Two or more characters were written to the buffer specified by
01273  *                 pwszBuff. The most common cause for this is that a dead-key
01274  *                 character (accent or diacritic) stored in the keyboard layout
01275  *                 could not be combined with the specified virtual key to form a
01276  *                 single character.
01277  * Remark    :
01278  * Status    : UNTESTED STUB
01279  *
01280  * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
01281  *****************************************************************************/
01282 
01283 ODINFUNCTION6(int,    ToUnicode,
01284               UINT,   uVirtKey,
01285               UINT,   uScanCode,
01286               PBYTE,  lpKeyState,
01287               LPWSTR, pwszBuff,
01288               int,    cchBuff,
01289               UINT,   wFlags)
01290 {
01291   dprintf(("not implemented.\n"));
01292 
01293   return (0);
01294 }
01295 /*****************************************************************************
01296  * Name      : UINT WIN32API GetKBCodePage
01297  * Purpose   : The GetKBCodePage function is provided for compatibility with
01298  *             earlier versions of Windows. In the Win32 application programming
01299  *             interface (API) it just calls the GetOEMCP function.
01300  * Parameters:
01301  * Variables :
01302  * Result    : If the function succeeds, the return value is an OEM code-page
01303  *             identifier, or it is the default identifier if the registry
01304  *             value is not readable. For a list of OEM code-page identifiers,
01305  *             see GetOEMCP.
01306  * Remark    :
01307  * Status    : COMPLETELY IMPLEMENTED UNTESTED
01308  *
01309  * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
01310  *****************************************************************************/
01311 
01312 ODINFUNCTION0(UINT, GetKBCodePage)
01313 {
01314   return (GetOEMCP());
01315 }
01316 //******************************************************************************
01317 //******************************************************************************
01318 ODINFUNCTION3(int,    GetKeyNameTextA,
01319               LPARAM, lParam, 
01320               LPSTR,  lpString, 
01321               int,    nSize)
01322 {
01323   // check the scancodes if the extended key bit is set so
01324   // we can easily distinguish between "left" and "right" special keys, etc.
01325   BOOL  fDontCare = (lParam & WIN_KEY_DONTCARE) != 0;
01326   BOOL  fExtended = (lParam & WIN_KEY_EXTENDED) != 0;
01327   UCHAR ucWinScan = (lParam & 0x00ff0000) >> 16;
01328   UCHAR ucWinVKey;
01329   UCHAR ucPMScan;
01330   int   result;
01331   
01332   if (fDontCare)
01333   {
01334     fExtended = FALSE;
01335     
01336     // map "right keys" to "universal keys"
01337     // LALT,RALT -> ALT
01338     // etc.
01339     // @@@PH
01340   }
01341   
01342   // Note: Open32 expects PM Scancodes, NOT Winscancodes.
01343   // Note: this is the only way of loss-less conversion!
01344   ucPMScan = KeyTranslateWinScanToPMScan(ucWinScan, fExtended);
01345   dprintf(("ucWinScan=%02xh, fExtended=%d translated to PMscan=%02xh\n",
01346            ucWinScan,
01347            fExtended,
01348            ucPMScan));
01349   ucWinVKey = abPMScanToWinVKey[ucPMScan][0];
01350   dprintf(("ucPMScan=%02xh translated to ucWinVKey=%02xh\n",
01351            ucPMScan,
01352            ucWinVKey));
01353 
01354   // Bug in Open32:
01355   // 0 - expects PMScancodes instead of WinScancodes
01356   // 1 - the "extended key bit" is not taken into account
01357   // 2 - some keys (AltGr) have not been assigned any names
01358   // int result = O32_GetKeyNameText(lParam,lpString,nSize);
01359   
01360   memset(lpString, 0, nSize);
01361   
01362   LPSTR lpstrKey = abWinVKeyToPMScan[ucWinVKey].lpstrName;
01363   if (NULL == lpstrKey)
01364   {
01365     dprintf(("ERROR: keyname for winscan=%02xh winvkey=%02xh, fExtended=%d not found.\n",
01366              ucWinScan, ucWinVKey, fExtended & !fDontCare));
01367     
01368     // build artificial name
01369     
01370     CHAR szName[10];
01371     sprintf(szName, 
01372             "VKey%02x%c",
01373             ucWinScan,
01374             fExtended ? '+' : 0);
01375     memcpy(lpString, szName, nSize);
01376     
01377     // how many chars have been returned?
01378     result = min(nSize, strlen(lpString));
01379   }
01380   else
01381   {
01382     result = min(nSize, strlen(lpstrKey));
01383     strncpy (lpString, lpstrKey, result);
01384   }
01385   
01386   dprintf(("keyname=[%s]\n",
01387            lpString));
01388   
01389   return result;
01390 }
01391 //******************************************************************************
01392 //******************************************************************************
01393 ODINFUNCTION3(int,    GetKeyNameTextW,
01394               LPARAM, lParam,
01395               LPWSTR, lpString,
01396               int,    nSize)
01397 {
01398     dprintf(("USER32:  GetKeyNameTextW DOES NOT WORK (not implemented)\n"));
01399     // NOTE: This will not work as is (needs UNICODE support)
01400     return 0;
01401 //    return O32_GetKeyNameText(arg1, arg2, arg3);
01402 }
01403 //******************************************************************************
01404 //******************************************************************************
01405 ODINFUNCTION1(SHORT, GetKeyState,
01406               int,   nVirtKey)
01407 {
01408   // check overlay array first
01409   char nState = arrchOverlayKeyState[nVirtKey & 0xff];
01410   switch (nState)
01411   {
01412     case KEYOVERLAYSTATE_DONTCARE:
01413       // forward processing ...
01414       break;
01415     
01416     // @@@PH Note: key-toggle is not handled correctpy
01417     case KEYOVERLAYSTATE_DOWN:
01418       return 0x8000;
01419       
01420     case KEYOVERLAYSTATE_UP:
01421       return 0x0000;
01422   }   
01423   return O32_GetKeyState(nVirtKey);
01424 }
01425 //******************************************************************************
01426 //******************************************************************************
01427 ODINFUNCTION1(WORD,  GetAsyncKeyState,
01428               INT,   nVirtKey)
01429 {
01430   // check overlay array first
01431   char nState = arrchOverlayKeyState[nVirtKey & 0xff];
01432   switch (nState)
01433   {
01434     case KEYOVERLAYSTATE_DONTCARE:
01435       // forward processing ...
01436       break;
01437     
01438     // @@@PH Note: key-toggle is not handled correctpy
01439     case KEYOVERLAYSTATE_DOWN:
01440       return 0x8000;
01441       
01442     case KEYOVERLAYSTATE_UP:
01443       return 0x0000;
01444   } 
01445   return O32_GetAsyncKeyState(nVirtKey);
01446 }
01447 //******************************************************************************
01448 //******************************************************************************
01449 ODINFUNCTION2(UINT,  MapVirtualKeyA,
01450               UINT,  uCode, 
01451               UINT,  uMapType)
01452 {
01453   dprintf(("imcompletely implemented"));
01454   
01455   /* A quick fix for Commandos, very incomplete */
01456   switch (uMapType) 
01457   {
01458     case 2:
01459       if (uCode >= VK_A && uCode <= VK_Z) 
01460       {
01461         return 'A' + uCode - VK_A;
01462       }
01463     break;
01464 
01465     case 1:
01466     case 3:
01467       // Open32 uses PMScancodes, not Windows Scancodes!!
01468       // @@@PH the extended flag is to be ignored!
01469       BYTE bPMScan = KeyTranslateWinScanToPMScan(uCode, FALSE);
01470       return O32_MapVirtualKey(bPMScan, uMapType);
01471   }
01472   return O32_MapVirtualKey(uCode, uMapType);
01473 }
01474 //******************************************************************************
01475 //******************************************************************************
01476 ODINFUNCTION2(UINT,  MapVirtualKeyW,
01477               UINT,  uCode, 
01478               UINT,  uMapType)
01479 {
01480   dprintf(("incorrectly implemented\n"));
01481   
01482   // NOTE: This will not work as is (needs UNICODE support)
01483   return O32_MapVirtualKey(uCode,uMapType);
01484 }
01485 /*****************************************************************************
01486  * Name      : UINT WIN32API MapVirtualKeyExA
01487  * Purpose   : The MapVirtualKeyEx function translates (maps) a virtual-key
01488  *             code into a scan code or character value, or translates a scan
01489  *             code into a virtual-key code. The function translates the codes
01490  *             using the input language and physical keyboard layout identified
01491  *             by the given keyboard layout handle.
01492  * Parameters:
01493  * Variables :
01494  * Result    : The return value is either a scan code, a virtual-key code, or
01495  *             a character value, depending on the value of uCode and uMapType.
01496  *             If there is no translation, the return value is zero.
01497  * Remark    :
01498  * Status    : UNTESTED STUB
01499  *
01500  * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
01501  *****************************************************************************/
01502 ODINFUNCTION3(UINT,  MapVirtualKeyExA,
01503               UINT,  uCode, 
01504               UINT,  uMapType, 
01505               HKL,   dwhkl)
01506 {
01507   dprintf(("incompletely implemented"));
01508 
01509   return MapVirtualKeyA(uCode, uMapType);
01510 }
01511 /*****************************************************************************
01512  * Name      : UINT WIN32API MapVirtualKeyExW
01513  * Purpose   : The MapVirtualKeyEx function translates (maps) a virtual-key
01514  *             code into a scan code or character value, or translates a scan
01515  *             code into a virtual-key code. The function translates the codes
01516  *             using the input language and physical keyboard layout identified
01517  *             by the given keyboard layout handle.
01518  * Parameters:
01519  * Variables :
01520  * Result    : The return value is either a scan code, a virtual-key code, or
01521  *             a character value, depending on the value of uCode and uMapType.
01522  *             If there is no translation, the return value is zero.
01523  * Remark    :
01524  * Status    : UNTESTED STUB
01525  *
01526  * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
01527  *****************************************************************************/
01528 ODINFUNCTION3(UINT, MapVirtualKeyExW,
01529               UINT, uCode, 
01530               UINT, uMapType, 
01531               HKL,  dwhkl)
01532 {
01533   dprintf(("incompletely implemented"));
01534 
01535   return MapVirtualKeyW(uCode, uMapType);
01536 }
01537 /*****************************************************************************
01538  * Name      : DWORD WIN32API OemKeyScan
01539  * Purpose   : The OemKeyScan function maps OEM ASCII codes 0 through 0x0FF
01540  *             into the OEM scan codes and shift states. The function provides
01541  *             information that allows a program to send OEM text to another
01542  *             program by simulating keyboard input.
01543  * Parameters:
01544  * Variables :
01545  * Result    :
01546  * Remark    :
01547  * Status    : Borrowed from NT
01548  *
01549  * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
01550  *****************************************************************************/
01551 ODINFUNCTION1(DWORD, OemKeyScan,
01552               WORD,  wOemChar)
01553 {
01554   int nVirtKey;
01555   
01556   OemToCharBuffA((LPCSTR)&wOemChar,
01557                  (LPSTR) &nVirtKey,
01558                  1);
01559   if (nVirtKey != 0)
01560   {
01561     SHORT sScan = VkKeyScanA(nVirtKey);
01562     nVirtKey = MapVirtualKeyA( (sScan & 0xff), 0);
01563     if (nVirtKey != 0)
01564     {
01565       return ( (nVirtKey & 0x00FF) ||
01566                ( (nVirtKey & 0xFF00) << 8) );
01567     }
01568   }
01569   
01570   // if not found ...
01571   return 0xffffffff;
01572 }
01573 //******************************************************************************
01574 //******************************************************************************
01575 ODINFUNCTION4(BOOL,  RegisterHotKey,
01576               HWND,  hwnd, 
01577               int,   idHotKey, 
01578               UINT,  fuModifiers, 
01579               UINT,  uVirtKey)
01580 {
01581   dprintf(("not implemented"));
01582   
01583   hwnd = Win32ToOS2Handle(hwnd);
01584   return(TRUE);
01585 }
01586 //******************************************************************************
01587 //******************************************************************************
01588 ODINFUNCTION2(BOOL, UnregisterHotKey,
01589               HWND, hwnd, 
01590               int,  idHotKey)
01591 {
01592   dprintf(("not implemented"));
01593   
01594   hwnd = Win32ToOS2Handle(hwnd);
01595 
01596   return(TRUE);
01597 }
01598 
01599 //******************************************************************************
01600 //SvL: 24-6-'97 - Added
01601 //******************************************************************************
01602 ODINFUNCTION1(WORD, VkKeyScanA,
01603               char, ch)
01604 {
01605   return O32_VkKeyScan(ch);
01606 }
01607 //******************************************************************************
01608 //******************************************************************************
01609 ODINFUNCTION1(WORD,  VkKeyScanW,
01610               WCHAR, wch)
01611 {
01612   dprintf(("incorrectly implemented"));
01613   // NOTE: This will not work as is (needs UNICODE support)
01614   return O32_VkKeyScan((char)wch);
01615 }
01616 /*****************************************************************************
01617  * Name      : SHORT WIN32API VkKeyScanExW
01618  * Purpose   : The VkKeyScanEx function translates a character to the
01619  *             corresponding virtual-key code and shift state. The function
01620  *             translates the character using the input language and physical
01621  *             keyboard layout identified by the given keyboard layout handle.
01622  * Parameters: UINT uChar character to translate
01623  *             HKL  hkl   keyboard layout handle
01624  * Variables :
01625  * Result    : see docs
01626  * Remark    :
01627  * Status    : UNTESTED STUB
01628  *
01629  * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
01630  *****************************************************************************/
01631 ODINFUNCTION2(WORD,  VkKeyScanExW,
01632               WCHAR, uChar,
01633               HKL,   hkl)
01634 {
01635   dprintf(("partially implemented"));
01636 
01637   return VkKeyScanW(uChar);
01638 }
01639 /*****************************************************************************
01640  * Name      : SHORT WIN32API VkKeyScanExA
01641  * Purpose   : The VkKeyScanEx function translates a character to the
01642  *             corresponding virtual-key code and shift state. The function
01643  *             translates the character using the input language and physical
01644  *             keyboard layout identified by the given keyboard layout handle.
01645  * Parameters: UINT uChar character to translate
01646  *             HKL  hkl   keyboard layout handle
01647  * Variables :
01648  * Result    : see docs
01649  * Remark    :
01650  * Status    : UNTESTED STUB
01651  *
01652  * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
01653  *****************************************************************************/
01654 ODINFUNCTION2(WORD, VkKeyScanExA,
01655               CHAR, uChar,
01656               HKL,  hkl)
01657 {
01658   dprintf(("partially implemented"));
01659 
01660   return VkKeyScanA(uChar);
01661 }
01662 /*****************************************************************************
01663  * Name      : VOID WIN32API keybd_event
01664  * Purpose   : The keybd_event function synthesizes a keystroke. The system
01665  *             can use such a synthesized keystroke to generate a WM_KEYUP or
01666  *             WM_KEYDOWN message. The keyboard driver's interrupt handler calls
01667  *             the keybd_event function.
01668  * Parameters: BYTE  bVk         virtual-key code
01669 
01670  *             BYTE  bScan       hardware scan code
01671  *             DWORD dwFlags     flags specifying various function options
01672  *             DWORD dwExtraInfo additional data associated with keystroke
01673  * Variables :
01674  * Result    :
01675  * Remark    :
01676  * Status    : UNTESTED STUB
01677  *
01678  * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
01679  *****************************************************************************/
01680 ODINPROCEDURE4(keybd_event,
01681                BYTE,  bVk,
01682                BYTE,  bScan,
01683                DWORD, dwFlags,
01684                DWORD, dwExtraInfo)
01685 {
01686   INPUT i;
01687   
01688   // format input packet
01689   i.type           = INPUT_KEYBOARD;
01690   i.ki.wVk         = bVk;
01691   i.ki.wScan       = bScan;
01692   i.ki.dwFlags     = dwFlags;
01693   i.ki.dwExtraInfo = dwExtraInfo;
01694   
01695   // forward to more modern API
01696   SendInput(1, &i, sizeof(i) );
01697 }
01698 /*****************************************************************************
01699  * Name      : HLK WIN32API LoadKeyboardLayoutA
01700  * Purpose   : The LoadKeyboardLayout function loads a new keyboard layout into
01701  *             the system. Several keyboard layouts can be loaded at a time, but
01702  *             only one per process is active at a time. Loading multiple keyboard
01703  *             layouts makes it possible to rapidly switch between layouts.
01704  * Parameters:
01705  * Variables :
01706  * Result    : If the function succeeds, the return value is the handle of the
01707  *               keyboard layout.
01708  *             If the function fails, the return value is NULL. To get extended
01709  *               error information, call GetLastError.
01710  * Remark    :
01711  * Status    : UNTESTED STUB
01712  *
01713  * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
01714  *****************************************************************************/
01715 ODINFUNCTION2(HKL,     LoadKeyboardLayoutA,
01716               LPCSTR,  pwszKLID,
01717               UINT,    Flags)
01718 {
01719   dprintf(("USER32:LeadKeyboardLayoutA (%s,%u) not implemented.\n",
01720          pwszKLID,
01721          Flags));
01722 
01723   return (NULL);
01724 }
01725 /*****************************************************************************
01726  * Name      : HLK WIN32API LoadKeyboardLayoutW
01727  * Purpose   : The LoadKeyboardLayout function loads a new keyboard layout into
01728  *             the system. Several keyboard layouts can be loaded at a time, but
01729  *             only one per process is active at a time. Loading multiple keyboard
01730  *             layouts makes it possible to rapidly switch between layouts.
01731  * Parameters:
01732  * Variables :
01733  * Result    : If the function succeeds, the return value is the handle of the
01734  *               keyboard layout.
01735  *             If the function fails, the return value is NULL. To get extended
01736  *               error information, call GetLastError.
01737  * Remark    :
01738  * Status    : UNTESTED STUB
01739  *
01740  * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
01741  *****************************************************************************/
01742 ODINFUNCTION2(HKL,     LoadKeyboardLayoutW,
01743               LPCWSTR, pwszKLID,
01744               UINT,    Flags)
01745 {
01746   dprintf(("USER32:LoadKeyboardLayoutW (%ls,%u) not implemented.\n",
01747          pwszKLID,
01748          Flags));
01749 
01750   return (NULL);
01751 }
01752 //******************************************************************************
01753 //******************************************************************************
01754 ODINFUNCTION2(BOOL,  ActivateKeyboardLayout,
01755               HKL,   hkl,
01756               UINT,  fuFlags)
01757 {
01758   dprintf(("not implemented\n"));
01759   return(TRUE);
01760 }
01761 /*****************************************************************************
01762  * Name      : BOOL WIN32API UnloadKeyboardLayout
01763  * Purpose   : The UnloadKeyboardLayout function removes a keyboard layout.
01764  * Parameters: HKL hkl handle of keyboard layout
01765  * Variables :
01766  * Result    : If the function succeeds, the return value is the handle of the
01767  *             keyboard layout; otherwise, it is NULL. To get extended error
01768  *             information, use the GetLastError function.
01769  * Remark    :
01770  * Status    : UNTESTED STUB
01771  *
01772  * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
01773  *****************************************************************************/
01774 ODINFUNCTION1(BOOL, UnloadKeyboardLayout,
01775               HKL,  hkl)
01776 {
01777   dprintf(("not implemented.\n"));
01778 
01779   return (TRUE);
01780 }
01781 //******************************************************************************
01782 //******************************************************************************
01783 
01784 // this is an internal function to emulate Alt-Gr behaviour
01785 ODINPROCEDURE2(KeySetOverlayKeyState,
01786                int, nVirtKey,
01787                char, nState)
01788 {
01789   // setup overlay array
01790   arrchOverlayKeyState[nVirtKey & 0xff] = nState;
01791 }
01792 

Generated on Wed Jan 23 23:17:54 2002 for ODIN-user32 by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001