Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1641 lines
93 KiB

  1. /* File: \WACKER\emu\vtutf8ini.c (Created: 2001)
  2. *
  3. * Copyright 2001 by Hilgraeve Inc. -- Monroe, MI
  4. * All rights reserved
  5. *
  6. * $Revision: 17 $
  7. * $Date: 5/07/02 1:25p $
  8. */
  9. #include <windows.h>
  10. #include <mbctype.h>
  11. #include <locale.h>
  12. #include <stdio.h>
  13. #pragma hdrstop
  14. //#define DEBUGSTR
  15. #include <tdll\stdtyp.h>
  16. #include <tdll\session.h>
  17. #include <tdll\assert.h>
  18. #include <tdll\mc.h>
  19. #include <tdll\backscrl.h>
  20. #include <tdll\com.h>
  21. #include <tdll\cloop.h>
  22. #include "emu.h"
  23. #include "emu.hh"
  24. #include "emuid.h"
  25. #include "emudec.hh"
  26. #include "keytbls.h"
  27. #if defined(INCL_VTUTF8)
  28. #define UTF8_1ST_OF_2_BYTES_CODE 0x00C0
  29. #define UTF8_2ND_OF_2_BYTES_CODE 0x0080
  30. #define UTF8_1ST_OF_3_BYTES_CODE 0x00E0
  31. #define UTF8_2ND_OF_3_BYTES_CODE 0x0080
  32. #define UTF8_3RD_OF_3_BYTES_CODE 0x0080
  33. #define UTF8_2_BYTES_HIGHEST_5_BITS 0x07C0
  34. #define UTF8_2_BYTES_LOWEST_6_BITS 0x003F
  35. #define UTF8_3_BYTES_HIGHEST_4_BITS 0xF000
  36. #define UTF8_3_BYTES_MIDDLE_6_BITS 0x0FC0
  37. #define UTF8_3_BYTES_LOWEST_6_BITS 0x003F
  38. #define FIRST_4_BITS 0x000F
  39. #define FIRST_5_BITS 0x001F
  40. #define FIRST_6_BITS 0x003F
  41. #define UTF8_TYPE_MASK 0x00E0
  42. const KEYTBLSTORAGE VTUTF8KeyTable[MAX_VTUTF8_KEYS] =
  43. {
  44. {VK_UP | VIRTUAL_KEY, {"\x1B[A\xff"}}, /* KN_UP */
  45. {VK_DOWN | VIRTUAL_KEY, {"\x1B[B\xff"}}, /* KN_DOWN */
  46. {VK_RIGHT| VIRTUAL_KEY, {"\x1B[C\xff"}}, /* KN_RIGHT */
  47. {VK_LEFT | VIRTUAL_KEY, {"\x1B[D\xff"}}, /* KN_LEFT */
  48. {VK_HOME | VIRTUAL_KEY, {"\x1Bh\xff"}},/* KN_HOME */
  49. {VK_INSERT | VIRTUAL_KEY, {"\x1B+\xff"}}, /* KN_INS */
  50. {VK_DELETE | VIRTUAL_KEY, {"\x1B-\xff"}}, /* KN_DEL */
  51. {VK_NEXT | VIRTUAL_KEY, {"\x1B/\xff"}}, /* KN_PGDN */
  52. {VK_PRIOR | VIRTUAL_KEY, {"\x1B?\xff"}}, /* KN_PGUP */
  53. {VK_END | VIRTUAL_KEY, {"\x1Bk\xff"}}, /* KN_END */
  54. {VK_UP | EXTENDED_KEY | VIRTUAL_KEY,{"\x1B[A\xff"}}, /* KN_UP */
  55. {VK_DOWN | EXTENDED_KEY | VIRTUAL_KEY,{"\x1B[B\xff"}}, /* KN_DOWN */
  56. {VK_RIGHT| EXTENDED_KEY | VIRTUAL_KEY,{"\x1B[C\xff"}}, /* KN_RIGHT */
  57. {VK_LEFT | EXTENDED_KEY | VIRTUAL_KEY,{"\x1B[D\xff"}}, /* KN_LEFT */
  58. {VK_HOME | EXTENDED_KEY | VIRTUAL_KEY, {"\x1Bh\xff"}}, /* KN_HOME */
  59. {VK_INSERT | EXTENDED_KEY | VIRTUAL_KEY, {"\x1B+\xff"}}, /* KN_INS */
  60. {VK_DELETE | EXTENDED_KEY | VIRTUAL_KEY, {"\x1B-\xff"}}, /* KN_DEL */
  61. {VK_NEXT | EXTENDED_KEY | VIRTUAL_KEY, {"\x1B/\xff"}}, /* KN_PGDN */
  62. {VK_PRIOR | EXTENDED_KEY | VIRTUAL_KEY, {"\x1B?\xff"}}, /* KN_PGUP */
  63. {VK_END | EXTENDED_KEY | VIRTUAL_KEY, {"\x1Bk\xff"}}, /* KN_END */
  64. {VK_F1 | VIRTUAL_KEY, {"\x1B\x31\xff"}}, /* KN_F1 */
  65. {VK_F2 | VIRTUAL_KEY, {"\x1B\x32\xff"}}, /* KN_F2 */
  66. {VK_F3 | VIRTUAL_KEY, {"\x1B\x33\xff"}}, /* KN_F3 */
  67. {VK_F4 | VIRTUAL_KEY, {"\x1B\x34\xff"}}, /* KN_F4 */
  68. {VK_F5 | VIRTUAL_KEY, {"\x1B\x35\xff"}}, /* KN_F5 */
  69. {VK_F6 | VIRTUAL_KEY, {"\x1B\x36\xff"}}, /* KN_F6 */
  70. {VK_F7 | VIRTUAL_KEY, {"\x1B\x37\xff"}}, /* KN_F7 */
  71. {VK_F8 | VIRTUAL_KEY, {"\x1B\x38\xff"}}, /* KN_F8 */
  72. {VK_F9 | VIRTUAL_KEY, {"\x1B\x39\xff"}}, /* KN_F9 */
  73. {VK_F10 | VIRTUAL_KEY, {"\x1B\x30\xff"}}, /* KN_F10 */
  74. {VK_F11 | VIRTUAL_KEY, {"\x1B!\xff"}}, /* KN_F11 */
  75. {VK_F12 | VIRTUAL_KEY, {"\x1B@\xff"}}, /* KN_F12 */
  76. {VK_F1 | EXTENDED_KEY | VIRTUAL_KEY, {"\x1B\x31\xff"}}, /* KN_F1 */
  77. {VK_F2 | EXTENDED_KEY | VIRTUAL_KEY, {"\x1B\x32\xff"}}, /* KN_F2 */
  78. {VK_F3 | EXTENDED_KEY | VIRTUAL_KEY, {"\x1B\x33\xff"}}, /* KN_F3 */
  79. {VK_F4 | EXTENDED_KEY | VIRTUAL_KEY, {"\x1B\x34\xff"}}, /* KN_F4 */
  80. {VK_F5 | EXTENDED_KEY | VIRTUAL_KEY, {"\x1B\x35\xff"}}, /* KN_F5 */
  81. {VK_F6 | EXTENDED_KEY | VIRTUAL_KEY, {"\x1B\x36\xff"}}, /* KN_F6 */
  82. {VK_F7 | EXTENDED_KEY | VIRTUAL_KEY, {"\x1B\x37\xff"}}, /* KN_F7 */
  83. {VK_F8 | EXTENDED_KEY | VIRTUAL_KEY, {"\x1B\x38\xff"}}, /* KN_F8 */
  84. {VK_F9 | EXTENDED_KEY | VIRTUAL_KEY, {"\x1B\x39\xff"}}, /* KN_F9 */
  85. {VK_F10 | EXTENDED_KEY | VIRTUAL_KEY, {"\x1B\x30\xff"}}, /* KN_F10 */
  86. {VK_F11 | EXTENDED_KEY | VIRTUAL_KEY, {"\x1B!\xff"}}, /* KN_F11 */
  87. {VK_F12 | EXTENDED_KEY | VIRTUAL_KEY, {"\x1B@\xff"}}, /* KN_F12 */
  88. {VK_TAB | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x5B\x5A\xff"}}, /* KT_SHIFT + KN_TAB */
  89. {0x2F | EXTENDED_KEY, {"\x2F\xff"}}, /* number pad / */
  90. {VK_ADD | VIRTUAL_KEY, {",\xff"}},
  91. {VK_RETURN | EXTENDED_KEY | VIRTUAL_KEY, {"\x0D\xff"}}, /* number pad Enter */
  92. {VK_SPACE | VIRTUAL_KEY | CTRL_KEY, {"\x00\xff"}}, /* CTRL + SPACE */
  93. {0x32 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x00\xff"}}, /* CTRL + @ */
  94. {0x32 | VIRTUAL_KEY | CTRL_KEY, {"\x00\xff"}}, /* CTRL + 2 */
  95. {0x36 | VIRTUAL_KEY | CTRL_KEY, {"\x1e\xff"}}, /* CTRL + 6 */
  96. {0xbd | VIRTUAL_KEY | CTRL_KEY, {"\x1f\xff"}}, /* CTRL + - */
  97. };
  98. const KEYTBLSTORAGE VTUTF8_Cursor_KeyTable[MAX_VTUTF8_CURSOR_KEYS] =
  99. {
  100. {VK_UP | VIRTUAL_KEY, {"\x1BOA\xff"}}, /* KN_UP */
  101. {VK_DOWN | VIRTUAL_KEY, {"\x1BOB\xff"}}, /* KN_DOWN */
  102. {VK_RIGHT| VIRTUAL_KEY, {"\x1BOC\xff"}}, /* KN_RIGHT */
  103. {VK_LEFT | VIRTUAL_KEY, {"\x1BOD\xff"}}, /* KN_LEFT */
  104. {VK_UP | EXTENDED_KEY | VIRTUAL_KEY, {"\x1BOA\xff"}}, /* KN_UP */
  105. {VK_DOWN | EXTENDED_KEY | VIRTUAL_KEY,{"\x1BOB\xff"}}, /* KN_DOWN */
  106. {VK_RIGHT| EXTENDED_KEY | VIRTUAL_KEY,{"\x1BOC\xff"}}, /* KN_RIGHT */
  107. {VK_LEFT | EXTENDED_KEY | VIRTUAL_KEY,{"\x1BOD\xff"}}, /* KN_LEFT */
  108. // Shift key
  109. {VK_UP | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1BOA\xff"}}, /* KN_UP */
  110. {VK_DOWN | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1BOB\xff"}}, /* KN_DOWN */
  111. {VK_RIGHT| VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1BOC\xff"}}, /* KN_RIGHT */
  112. {VK_LEFT | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1BOD\xff"}}, /* KN_LEFT */
  113. {VK_UP | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1BOA\xff"}}, /* KN_UP */
  114. {VK_DOWN | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1BOB\xff"}}, /* KN_DOWN */
  115. {VK_RIGHT| EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1BOC\xff"}}, /* KN_RIGHT */
  116. {VK_LEFT | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1BOD\xff"}}, /* KN_LEFT */
  117. // Ctrl key
  118. {VK_UP | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1BOA\xff"}}, /* KN_UP */
  119. {VK_DOWN | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1BOB\xff"}}, /* KN_DOWN */
  120. {VK_RIGHT| VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1BOC\xff"}}, /* KN_RIGHT */
  121. {VK_LEFT | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1BOD\xff"}}, /* KN_LEFT */
  122. {VK_UP | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1BOA\xff"}}, /* KN_UP */
  123. {VK_DOWN | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1BOB\xff"}}, /* KN_DOWN */
  124. {VK_RIGHT| EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1BOC\xff"}}, /* KN_RIGHT */
  125. {VK_LEFT | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1BOD\xff"}}, /* KN_LEFT */
  126. // Alt key
  127. {VK_UP | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1BOA\xff"}}, /* KN_UP */
  128. {VK_DOWN | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1BOB\xff"}}, /* KN_DOWN */
  129. {VK_RIGHT| VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1BOC\xff"}}, /* KN_RIGHT */
  130. {VK_LEFT | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1BOD\xff"}}, /* KN_LEFT */
  131. {VK_UP | EXTENDED_KEY | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1BOA\xff"}}, /* KN_UP */
  132. {VK_DOWN | EXTENDED_KEY | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1BOB\xff"}}, /* KN_DOWN */
  133. {VK_RIGHT| EXTENDED_KEY | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1BOC\xff"}}, /* KN_RIGHT */
  134. {VK_LEFT | EXTENDED_KEY | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1BOD\xff"}}, /* KN_LEFT */
  135. // Shift Ctrl key
  136. {VK_UP | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1BOA\xff"}}, /* KN_UP */
  137. {VK_DOWN | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1BOB\xff"}}, /* KN_DOWN */
  138. {VK_RIGHT| VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1BOC\xff"}}, /* KN_RIGHT */
  139. {VK_LEFT | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1BOD\xff"}}, /* KN_LEFT */
  140. {VK_UP | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1BOA\xff"}}, /* KN_UP */
  141. {VK_DOWN | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1BOB\xff"}}, /* KN_DOWN */
  142. {VK_RIGHT| EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1BOC\xff"}}, /* KN_RIGHT */
  143. {VK_LEFT | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1BOD\xff"}}, /* KN_LEFT */
  144. // Shift Alt key
  145. {VK_UP | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1BOA\xff"}}, /* KN_UP */
  146. {VK_DOWN | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1BOB\xff"}}, /* KN_DOWN */
  147. {VK_RIGHT| VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1BOC\xff"}}, /* KN_RIGHT */
  148. {VK_LEFT | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1BOD\xff"}}, /* KN_LEFT */
  149. {VK_UP | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1BOA\xff"}}, /* KN_UP */
  150. {VK_DOWN | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1BOB\xff"}}, /* KN_DOWN */
  151. {VK_RIGHT| EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1BOC\xff"}}, /* KN_RIGHT */
  152. {VK_LEFT | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1BOD\xff"}}, /* KN_LEFT */
  153. // Ctrl Alt key
  154. {VK_UP | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1BOA\xff"}}, /* KN_UP */
  155. {VK_DOWN | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1BOB\xff"}}, /* KN_DOWN */
  156. {VK_RIGHT| VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1BOC\xff"}}, /* KN_RIGHT */
  157. {VK_LEFT | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1BOD\xff"}}, /* KN_LEFT */
  158. {VK_UP | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1BOA\xff"}}, /* KN_UP */
  159. {VK_DOWN | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1BOB\xff"}}, /* KN_DOWN */
  160. {VK_RIGHT| EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1BOC\xff"}}, /* KN_RIGHT */
  161. {VK_LEFT | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1BOD\xff"}}, /* KN_LEFT */
  162. // Shift Ctrl Alt key
  163. {VK_UP | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1BOA\xff"}}, /* KN_UP */
  164. {VK_DOWN | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1BOB\xff"}}, /* KN_DOWN */
  165. {VK_RIGHT| VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1BOC\xff"}}, /* KN_RIGHT */
  166. {VK_LEFT | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1BOD\xff"}}, /* KN_LEFT */
  167. {VK_UP | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1BOA\xff"}}, /* KN_UP */
  168. {VK_DOWN | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1BOB\xff"}}, /* KN_DOWN */
  169. {VK_RIGHT| EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1BOC\xff"}}, /* KN_RIGHT */
  170. {VK_LEFT | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1BOD\xff"}}, /* KN_LEFT */
  171. };
  172. const KEYTBLSTORAGE VTUTF8_Keypad_KeyTable[MAX_VTUTF8_KEYPAD_KEYS] =
  173. {
  174. {VK_NUMPAD0 | VIRTUAL_KEY, {"\x1BOp\xff"}}, /* KT_KP + '0' (alternate mode) */
  175. {VK_NUMPAD1 | VIRTUAL_KEY, {"\x1BOq\xff"}}, /* KT_KP + '1' (alternate mode) */
  176. {VK_NUMPAD2 | VIRTUAL_KEY, {"\x1BOr\xff"}}, /* KT_KP + '2' (alternate mode) */
  177. {VK_NUMPAD3 | VIRTUAL_KEY, {"\x1BOs\xff"}}, /* KT_KP + '3' (alternate mode) */
  178. {VK_NUMPAD4 | VIRTUAL_KEY, {"\x1BOt\xff"}}, /* KT_KP + '4' (alternate mode) */
  179. {VK_NUMPAD5 | VIRTUAL_KEY, {"\x1BOu\xff"}}, /* KT_KP + '5' (alternate mode) */
  180. {VK_NUMPAD6 | VIRTUAL_KEY, {"\x1BOv\xff"}}, /* KT_KP + '6' (alternate mode) */
  181. {VK_NUMPAD7 | VIRTUAL_KEY, {"\x1BOw\xff"}}, /* KT_KP + '7' (alternate mode) */
  182. {VK_NUMPAD8 | VIRTUAL_KEY, {"\x1BOx\xff"}}, /* KT_KP + '8' (alternate mode) */
  183. {VK_NUMPAD9 | VIRTUAL_KEY, {"\x1BOy\xff"}}, /* KT_KP + '9' (alternate mode) */
  184. {VK_DECIMAL | VIRTUAL_KEY, {"\x1BOn\xff"}}, /* KT_KP + '.' (alternate mode) */
  185. {VK_ADD | VIRTUAL_KEY, {"\x1BOl\xff"}}, /* KT_KP + '*' (alternate mode) */
  186. {VK_RETURN | EXTENDED_KEY, {"\x1BOM\xff"}}, /* KT_KP + '+' (alternate mode) */
  187. {VK_SUBTRACT | VIRTUAL_KEY, {"\x1BOm\xff"}}, /* KT_KP + '-' (alternate mode) */
  188. // Shift key
  189. {VK_NUMPAD0 | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1BOp\xff"}}, /* KT_KP + '0' (alternate mode) */
  190. {VK_NUMPAD1 | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1BOq\xff"}}, /* KT_KP + '1' (alternate mode) */
  191. {VK_NUMPAD2 | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1BOr\xff"}}, /* KT_KP + '2' (alternate mode) */
  192. {VK_NUMPAD3 | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1BOs\xff"}}, /* KT_KP + '3' (alternate mode) */
  193. {VK_NUMPAD4 | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1BOt\xff"}}, /* KT_KP + '4' (alternate mode) */
  194. {VK_NUMPAD5 | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1BOu\xff"}}, /* KT_KP + '5' (alternate mode) */
  195. {VK_NUMPAD6 | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1BOv\xff"}}, /* KT_KP + '6' (alternate mode) */
  196. {VK_NUMPAD7 | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1BOw\xff"}}, /* KT_KP + '7' (alternate mode) */
  197. {VK_NUMPAD8 | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1BOx\xff"}}, /* KT_KP + '8' (alternate mode) */
  198. {VK_NUMPAD9 | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1BOy\xff"}}, /* KT_KP + '9' (alternate mode) */
  199. {VK_DECIMAL | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1BOn\xff"}}, /* KT_KP + '.' (alternate mode) */
  200. {VK_ADD | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1BOl\xff"}}, /* KT_KP + '*' (alternate mode) */
  201. {VK_SUBTRACT| VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1BOm\xff"}}, /* KT_KP + '-' (alternate mode) */
  202. {VK_RETURN | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1BOM\xff"}}, /* KT_KP + '+' (alternate mode) */
  203. // Ctrl key
  204. {VK_NUMPAD0 | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1BOp\xff"}}, /* KT_KP + '0' (alternate mode) */
  205. {VK_NUMPAD1 | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1BOq\xff"}}, /* KT_KP + '1' (alternate mode) */
  206. {VK_NUMPAD2 | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1BOr\xff"}}, /* KT_KP + '2' (alternate mode) */
  207. {VK_NUMPAD3 | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1BOs\xff"}}, /* KT_KP + '3' (alternate mode) */
  208. {VK_NUMPAD4 | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1BOt\xff"}}, /* KT_KP + '4' (alternate mode) */
  209. {VK_NUMPAD5 | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1BOu\xff"}}, /* KT_KP + '5' (alternate mode) */
  210. {VK_NUMPAD6 | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1BOv\xff"}}, /* KT_KP + '6' (alternate mode) */
  211. {VK_NUMPAD7 | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1BOw\xff"}}, /* KT_KP + '7' (alternate mode) */
  212. {VK_NUMPAD8 | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1BOx\xff"}}, /* KT_KP + '8' (alternate mode) */
  213. {VK_NUMPAD9 | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1BOy\xff"}}, /* KT_KP + '9' (alternate mode) */
  214. {VK_DECIMAL | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1BOn\xff"}}, /* KT_KP + '.' (alternate mode) */
  215. {VK_ADD | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1BOl\xff"}}, /* KT_KP + '*' (alternate mode) */
  216. {VK_SUBTRACT| VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1BOm\xff"}}, /* KT_KP + '-' (alternate mode) */
  217. {VK_RETURN | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1BOM\xff"}}, /* KT_KP + '+' (alternate mode) */
  218. // Alt key
  219. {VK_NUMPAD0 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1BOp\xff"}}, /* KT_KP + '0' (alternate mode) */
  220. {VK_NUMPAD1 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1BOq\xff"}}, /* KT_KP + '1' (alternate mode) */
  221. {VK_NUMPAD2 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1BOr\xff"}}, /* KT_KP + '2' (alternate mode) */
  222. {VK_NUMPAD3 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1BOs\xff"}}, /* KT_KP + '3' (alternate mode) */
  223. {VK_NUMPAD4 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1BOt\xff"}}, /* KT_KP + '4' (alternate mode) */
  224. {VK_NUMPAD5 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1BOu\xff"}}, /* KT_KP + '5' (alternate mode) */
  225. {VK_NUMPAD6 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1BOv\xff"}}, /* KT_KP + '6' (alternate mode) */
  226. {VK_NUMPAD7 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1BOw\xff"}}, /* KT_KP + '7' (alternate mode) */
  227. {VK_NUMPAD8 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1BOx\xff"}}, /* KT_KP + '8' (alternate mode) */
  228. {VK_NUMPAD9 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1BOy\xff"}}, /* KT_KP + '9' (alternate mode) */
  229. {VK_DECIMAL | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1BOn\xff"}}, /* KT_KP + '.' (alternate mode) */
  230. {VK_ADD | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1BOl\xff"}}, /* KT_KP + '*' (alternate mode) */
  231. {VK_SUBTRACT| VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1BOm\xff"}}, /* KT_KP + '-' (alternate mode) */
  232. {VK_RETURN | EXTENDED_KEY | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1BOM\xff"}}, /* KT_KP + '+' (alternate mode) */
  233. // Shift Ctrl key
  234. {VK_NUMPAD0 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1BOp\xff"}}, /* KT_KP + '0' (alternate mode) */
  235. {VK_NUMPAD1 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1BOq\xff"}}, /* KT_KP + '1' (alternate mode) */
  236. {VK_NUMPAD2 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1BOr\xff"}}, /* KT_KP + '2' (alternate mode) */
  237. {VK_NUMPAD3 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1BOs\xff"}}, /* KT_KP + '3' (alternate mode) */
  238. {VK_NUMPAD4 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1BOt\xff"}}, /* KT_KP + '4' (alternate mode) */
  239. {VK_NUMPAD5 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1BOu\xff"}}, /* KT_KP + '5' (alternate mode) */
  240. {VK_NUMPAD6 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1BOv\xff"}}, /* KT_KP + '6' (alternate mode) */
  241. {VK_NUMPAD7 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1BOw\xff"}}, /* KT_KP + '7' (alternate mode) */
  242. {VK_NUMPAD8 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1BOx\xff"}}, /* KT_KP + '8' (alternate mode) */
  243. {VK_NUMPAD9 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1BOy\xff"}}, /* KT_KP + '9' (alternate mode) */
  244. {VK_DECIMAL | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1BOn\xff"}}, /* KT_KP + '.' (alternate mode) */
  245. {VK_ADD | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1BOl\xff"}}, /* KT_KP + '*' (alternate mode) */
  246. {VK_SUBTRACT| VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1BOm\xff"}}, /* KT_KP + '-' (alternate mode) */
  247. {VK_RETURN | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1BOM\xff"}}, /* KT_KP + '+' (alternate mode) */
  248. // Shift Alt key
  249. {VK_NUMPAD0 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1BOp\xff"}}, /* KT_KP + '0' (alternate mode) */
  250. {VK_NUMPAD1 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1BOq\xff"}}, /* KT_KP + '1' (alternate mode) */
  251. {VK_NUMPAD2 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1BOr\xff"}}, /* KT_KP + '2' (alternate mode) */
  252. {VK_NUMPAD3 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1BOs\xff"}}, /* KT_KP + '3' (alternate mode) */
  253. {VK_NUMPAD4 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1BOt\xff"}}, /* KT_KP + '4' (alternate mode) */
  254. {VK_NUMPAD5 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1BOu\xff"}}, /* KT_KP + '5' (alternate mode) */
  255. {VK_NUMPAD6 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1BOv\xff"}}, /* KT_KP + '6' (alternate mode) */
  256. {VK_NUMPAD7 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1BOw\xff"}}, /* KT_KP + '7' (alternate mode) */
  257. {VK_NUMPAD8 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1BOx\xff"}}, /* KT_KP + '8' (alternate mode) */
  258. {VK_NUMPAD9 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1BOy\xff"}}, /* KT_KP + '9' (alternate mode) */
  259. {VK_DECIMAL | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1BOn\xff"}}, /* KT_KP + '.' (alternate mode) */
  260. {VK_ADD | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1BOl\xff"}}, /* KT_KP + '*' (alternate mode) */
  261. {VK_SUBTRACT| VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1BOm\xff"}}, /* KT_KP + '-' (alternate mode) */
  262. {VK_RETURN | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1BOM\xff"}}, /* KT_KP + '+' (alternate mode) */
  263. // Ctrl Alt key
  264. {VK_NUMPAD0 | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1BOp\xff"}}, /* KT_KP + '0' (alternate mode) */
  265. {VK_NUMPAD1 | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1BOq\xff"}}, /* KT_KP + '1' (alternate mode) */
  266. {VK_NUMPAD2 | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1BOr\xff"}}, /* KT_KP + '2' (alternate mode) */
  267. {VK_NUMPAD3 | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1BOs\xff"}}, /* KT_KP + '3' (alternate mode) */
  268. {VK_NUMPAD4 | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1BOt\xff"}}, /* KT_KP + '4' (alternate mode) */
  269. {VK_NUMPAD5 | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1BOu\xff"}}, /* KT_KP + '5' (alternate mode) */
  270. {VK_NUMPAD6 | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1BOv\xff"}}, /* KT_KP + '6' (alternate mode) */
  271. {VK_NUMPAD7 | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1BOw\xff"}}, /* KT_KP + '7' (alternate mode) */
  272. {VK_NUMPAD8 | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1BOx\xff"}}, /* KT_KP + '8' (alternate mode) */
  273. {VK_NUMPAD9 | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1BOy\xff"}}, /* KT_KP + '9' (alternate mode) */
  274. {VK_DECIMAL | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1BOn\xff"}}, /* KT_KP + '.' (alternate mode) */
  275. {VK_ADD | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1BOl\xff"}}, /* KT_KP + '*' (alternate mode) */
  276. {VK_SUBTRACT| VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1BOm\xff"}}, /* KT_KP + '-' (alternate mode) */
  277. {VK_RETURN | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1BOM\xff"}}, /* KT_KP + '+' (alternate mode) */
  278. // Shift Ctrl Alt key
  279. {VK_NUMPAD0 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1BOp\xff"}}, /* KT_KP + '0' (alternate mode) */
  280. {VK_NUMPAD1 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1BOq\xff"}}, /* KT_KP + '1' (alternate mode) */
  281. {VK_NUMPAD2 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1BOr\xff"}}, /* KT_KP + '2' (alternate mode) */
  282. {VK_NUMPAD3 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1BOs\xff"}}, /* KT_KP + '3' (alternate mode) */
  283. {VK_NUMPAD4 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1BOt\xff"}}, /* KT_KP + '4' (alternate mode) */
  284. {VK_NUMPAD5 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1BOu\xff"}}, /* KT_KP + '5' (alternate mode) */
  285. {VK_NUMPAD6 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1BOv\xff"}}, /* KT_KP + '6' (alternate mode) */
  286. {VK_NUMPAD7 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1BOw\xff"}}, /* KT_KP + '7' (alternate mode) */
  287. {VK_NUMPAD8 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1BOx\xff"}}, /* KT_KP + '8' (alternate mode) */
  288. {VK_NUMPAD9 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1BOy\xff"}}, /* KT_KP + '9' (alternate mode) */
  289. {VK_DECIMAL | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1BOn\xff"}}, /* KT_KP + '.' (alternate mode) */
  290. {VK_ADD | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1BOl\xff"}}, /* KT_KP + '*' (alternate mode) */
  291. {VK_SUBTRACT| VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1BOm\xff"}}, /* KT_KP + '-' (alternate mode) */
  292. {VK_RETURN | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03x1B\x01\x1BOM\xff"}}, /* KT_KP + '+' (alternate mode) */
  293. };
  294. const KEYTBLSTORAGE VTUTF8ModifiedKeyTable[MAX_VTUTF8_MODIFIED_KEYS] =
  295. {
  296. // Shift keys
  297. {VK_UP | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B[A\xff"}}, /* KN_UP */
  298. {VK_DOWN | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B[B\xff"}}, /* KN_DOWN */
  299. {VK_RIGHT | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B[C\xff"}}, /* KN_RIGHT */
  300. {VK_LEFT | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B[D\xff"}}, /* KN_LEFT */
  301. {VK_HOME | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1Bh\xff"}}, /* KN_HOME */
  302. {VK_INSERT | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B+\xff"}}, /* KN_INS */
  303. {VK_DELETE | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B-\xff"}}, /* KN_DEL */
  304. {VK_NEXT | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B/\xff"}}, /* KN_PGDN */
  305. {VK_PRIOR | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B?\xff"}}, /* KN_PGUP */
  306. {VK_END | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1Bk\xff"}}, /* KN_END */
  307. {VK_BACKSPACE|VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x08\xff"}}, /* KN_BACKSPACE */
  308. {VK_ESCAPE | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B\xff"}}, /* KN_ESC */
  309. {VK_UP | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B[A\xff"}}, /* KN_UP */
  310. {VK_DOWN | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B[B\xff"}}, /* KN_DOWN */
  311. {VK_RIGHT | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B[C\xff"}}, /* KN_RIGHT */
  312. {VK_LEFT | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B[D\xff"}}, /* KN_LEFT */
  313. {VK_HOME | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1Bh\xff"}}, /* KN_HOME */
  314. {VK_INSERT | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B+\xff"}}, /* KN_INS */
  315. {VK_DELETE | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B-\xff"}}, /* KN_DEL */
  316. {VK_NEXT | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B/\xff"}}, /* KN_PGDN */
  317. {VK_PRIOR | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B?\xff"}}, /* KN_PGUP */
  318. {VK_END | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1Bk\xff"}}, /* KN_END */
  319. {0x2F | EXTENDED_KEY | SHIFT_KEY, {"\x1B\x13\x2F\xff"}}, /* number pad / */
  320. {VK_RETURN| EXTENDED_KEY, {"\x1B\x13\x0D\xff"}}, /* number pad / */
  321. {VK_F1 | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B\x31\xff"}}, /* KN_F1 */
  322. {VK_F2 | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B\x32\xff"}}, /* KN_F2 */
  323. {VK_F3 | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B\x33\xff"}}, /* KN_F3 */
  324. {VK_F4 | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B\x34\xff"}}, /* KN_F4 */
  325. {VK_F5 | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B\x35\xff"}}, /* KN_F5 */
  326. {VK_F6 | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B\x36\xff"}}, /* KN_F6 */
  327. {VK_F7 | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B\x37\xff"}}, /* KN_F7 */
  328. {VK_F8 | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B\x38\xff"}}, /* KN_F8 */
  329. {VK_F9 | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B\x39\xff"}}, /* KN_F9 */
  330. {VK_F10 | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B\x30\xff"}}, /* KN_F10 */
  331. {VK_F11 | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B!\xff"}}, /* KN_F11 */
  332. {VK_F12 | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B@\xff"}}, /* KN_F12 */
  333. {VK_F1 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B\x31\xff"}}, /* KN_F1 */
  334. {VK_F2 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B\x32\xff"}}, /* KN_F2 */
  335. {VK_F3 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B\x33\xff"}}, /* KN_F3 */
  336. {VK_F4 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B\x34\xff"}}, /* KN_F4 */
  337. {VK_F5 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B\x35\xff"}}, /* KN_F5 */
  338. {VK_F6 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B\x36\xff"}}, /* KN_F6 */
  339. {VK_F7 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B\x37\xff"}}, /* KN_F7 */
  340. {VK_F8 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B\x38\xff"}}, /* KN_F8 */
  341. {VK_F9 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B\x39\xff"}}, /* KN_F9 */
  342. {VK_F10 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B\x30\xff"}}, /* KN_F10 */
  343. {VK_F11 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B!\xff"}}, /* KN_F11 */
  344. {VK_F12 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY, {"\x1B\x13\x1B@\xff"}}, /* KN_F12 */
  345. // Ctrl keys
  346. {VK_UP | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B[A\xff"}}, /* KN_UP */
  347. {VK_DOWN | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B[B\xff"}}, /* KN_DOWN */
  348. {VK_RIGHT | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B[C\xff"}}, /* KN_RIGHT */
  349. {VK_LEFT | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B[D\xff"}}, /* KN_LEFT */
  350. {VK_HOME | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1Bh\xff"}}, /* KN_HOME */
  351. {VK_INSERT | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B+\xff"}}, /* KN_INS */
  352. {VK_DELETE | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B-\xff"}}, /* KN_DEL */
  353. {VK_NEXT | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B/\xff"}}, /* KN_PGDN */
  354. {VK_PRIOR | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B?\xff"}}, /* KN_PGUP */
  355. {VK_END | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1Bk\xff"}}, /* KN_END */
  356. {VK_TAB | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x09\xff"}}, /* KN_TAB */
  357. {VK_BACKSPACE|VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x08\xff"}}, /* KN_BACKSPACE */
  358. {VK_ESCAPE | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B\xff"}}, /* KN_ESC */
  359. {VK_UP | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B[A\xff"}}, /* KN_UP */
  360. {VK_DOWN | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B[B\xff"}}, /* KN_DOWN */
  361. {VK_RIGHT | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B[C\xff"}}, /* KN_RIGHT */
  362. {VK_LEFT | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B[D\xff"}}, /* KN_LEFT */
  363. {VK_HOME | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1Bh\xff"}}, /* KN_HOME */
  364. {VK_INSERT | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B+\xff"}}, /* KN_INS */
  365. {VK_DELETE | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B-\xff"}}, /* KN_DEL */
  366. {VK_NEXT | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B/\xff"}}, /* KN_PGDN */
  367. {VK_PRIOR | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B?\xff"}}, /* KN_PGUP */
  368. {VK_END | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1Bk\xff"}}, /* KN_END */
  369. {VK_DIVIDE | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x2F\xff"}}, /* number pad / */
  370. {VK_MULTIPLY | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03*\xff"}}, /* number pad * */
  371. {VK_SUBTRACT | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03-\xff"}}, /* number pad - */
  372. {VK_ADD | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03,\xff"}}, /* number pad + */
  373. {0x0A | EXTENDED_KEY, {"\x0A\xff"}}, /* number pad Enter */
  374. {VK_F1 | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B\x31\xff"}}, /* KN_F1 */
  375. {VK_F2 | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B\x32\xff"}}, /* KN_F2 */
  376. {VK_F3 | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B\x33\xff"}}, /* KN_F3 */
  377. {VK_F4 | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B\x34\xff"}}, /* KN_F4 */
  378. {VK_F5 | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B\x35\xff"}}, /* KN_F5 */
  379. {VK_F6 | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B\x36\xff"}}, /* KN_F6 */
  380. {VK_F7 | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B\x37\xff"}}, /* KN_F7 */
  381. {VK_F8 | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B\x38\xff"}}, /* KN_F8 */
  382. {VK_F9 | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B\x39\xff"}}, /* KN_F9 */
  383. {VK_F10 | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B\x30\xff"}}, /* KN_F10 */
  384. {VK_F11 | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B!\xff"}}, /* KN_F11 */
  385. {VK_F12 | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B@\xff"}}, /* KN_F12 */
  386. {VK_F1 | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B\x31\xff"}}, /* KN_F1 */
  387. {VK_F2 | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B\x32\xff"}}, /* KN_F2 */
  388. {VK_F3 | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B\x33\xff"}}, /* KN_F3 */
  389. {VK_F4 | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B\x34\xff"}}, /* KN_F4 */
  390. {VK_F5 | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B\x35\xff"}}, /* KN_F5 */
  391. {VK_F6 | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B\x36\xff"}}, /* KN_F6 */
  392. {VK_F7 | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B\x37\xff"}}, /* KN_F7 */
  393. {VK_F8 | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B\x38\xff"}}, /* KN_F8 */
  394. {VK_F9 | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B\x39\xff"}}, /* KN_F9 */
  395. {VK_F10 | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B\x30\xff"}}, /* KN_F10 */
  396. {VK_F11 | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B!\xff"}}, /* KN_F11 */
  397. {VK_F12 | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x1B@\xff"}}, /* KN_F12 */
  398. // Alt keys
  399. {VK_UP | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B[A\xff"}}, /* KN_UP */
  400. {VK_DOWN | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B[B\xff"}}, /* KN_DOWN */
  401. {VK_RIGHT | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B[C\xff"}}, /* KN_RIGHT */
  402. {VK_LEFT | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B[D\xff"}}, /* KN_LEFT */
  403. {VK_HOME | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1Bh\xff"}}, /* KN_HOME */
  404. {VK_INSERT | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B+\xff"}}, /* KN_INS */
  405. {VK_DELETE | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B-\xff"}}, /* KN_DEL */
  406. {VK_NEXT | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B/\xff"}}, /* KN_PGDN */
  407. {VK_PRIOR | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B?\xff"}}, /* KN_PGUP */
  408. {VK_END | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1Bk\xff"}}, /* KN_END */
  409. {VK_TAB | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x09\xff"}}, /* KN_TAB */
  410. {VK_BACKSPACE|VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x08\xff"}}, /* KN_BACKSPACE */
  411. {VK_ESCAPE | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B\xff"}}, /* KN_ESC */
  412. {VK_UP | EXTENDED_KEY | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B[A\xff"}}, /* KN_UP */
  413. {VK_DOWN | EXTENDED_KEY | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B[B\xff"}}, /* KN_DOWN */
  414. {VK_RIGHT | EXTENDED_KEY | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B[C\xff"}}, /* KN_RIGHT */
  415. {VK_LEFT | EXTENDED_KEY | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B[D\xff"}}, /* KN_LEFT */
  416. {VK_HOME | EXTENDED_KEY | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1Bh\xff"}}, /* KN_HOME */
  417. {VK_INSERT | EXTENDED_KEY | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B+\xff"}}, /* KN_INS */
  418. {VK_DELETE | EXTENDED_KEY | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B-\xff"}}, /* KN_DEL */
  419. {VK_NEXT | EXTENDED_KEY | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B/\xff"}}, /* KN_PGDN */
  420. {VK_PRIOR | EXTENDED_KEY | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B?\xff"}}, /* KN_PGUP */
  421. {VK_END | EXTENDED_KEY | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1Bk\xff"}}, /* KN_END */
  422. {0x2F | EXTENDED_KEY | ALT_KEY, {"\x1B\x01\x2F\xff"}}, /* number pad / */
  423. {VK_RETURN | EXTENDED_KEY | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x0D\xff"}}, /* number pad Enter */
  424. {VK_F1 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B\x31\xff"}}, /* KN_F1 */
  425. {VK_F2 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B\x32\xff"}}, /* KN_F2 */
  426. {VK_F3 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B\x33\xff"}}, /* KN_F3 */
  427. {VK_F4 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B\x34\xff"}}, /* KN_F4 */
  428. {VK_F5 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B\x35\xff"}}, /* KN_F5 */
  429. {VK_F6 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B\x36\xff"}}, /* KN_F6 */
  430. {VK_F7 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B\x37\xff"}}, /* KN_F7 */
  431. {VK_F8 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B\x38\xff"}}, /* KN_F8 */
  432. {VK_F9 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B\x39\xff"}}, /* KN_F9 */
  433. {VK_F10 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B\x30\xff"}}, /* KN_F10 */
  434. {VK_F11 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B!\xff"}}, /* KN_F11 */
  435. {VK_F12 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B@\xff"}}, /* KN_F12 */
  436. {VK_F1 | EXTENDED_KEY | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B\x31\xff"}}, /* KN_F1 */
  437. {VK_F2 | EXTENDED_KEY | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B\x32\xff"}}, /* KN_F2 */
  438. {VK_F3 | EXTENDED_KEY | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B\x33\xff"}}, /* KN_F3 */
  439. {VK_F4 | EXTENDED_KEY | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B\x34\xff"}}, /* KN_F4 */
  440. {VK_F5 | EXTENDED_KEY | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B\x35\xff"}}, /* KN_F5 */
  441. {VK_F6 | EXTENDED_KEY | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B\x36\xff"}}, /* KN_F6 */
  442. {VK_F7 | EXTENDED_KEY | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B\x37\xff"}}, /* KN_F7 */
  443. {VK_F8 | EXTENDED_KEY | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B\x38\xff"}}, /* KN_F8 */
  444. {VK_F9 | EXTENDED_KEY | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B\x39\xff"}}, /* KN_F9 */
  445. {VK_F10 | EXTENDED_KEY | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B\x30\xff"}}, /* KN_F10 */
  446. {VK_F11 | EXTENDED_KEY | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B!\xff"}}, /* KN_F11 */
  447. {VK_F12 | EXTENDED_KEY | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x1B@\xff"}}, /* KN_F12 */
  448. // Shift Ctrl keys
  449. {VK_UP | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B[A\xff"}}, /* KN_UP */
  450. {VK_DOWN | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B[B\xff"}}, /* KN_DOWN */
  451. {VK_RIGHT | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B[C\xff"}}, /* KN_RIGHT */
  452. {VK_LEFT | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B[D\xff"}}, /* KN_LEFT */
  453. {VK_HOME | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1Bh\xff"}}, /* KN_HOME */
  454. {VK_INSERT | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B+\xff"}}, /* KN_INS */
  455. {VK_DELETE | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B-\xff"}}, /* KN_DEL */
  456. {VK_NEXT | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B/\xff"}}, /* KN_PGDN */
  457. {VK_PRIOR | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B?\xff"}}, /* KN_PGUP */
  458. {VK_END | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1Bk\xff"}}, /* KN_END */
  459. {VK_TAB | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x03\x5B\x5A\xff"}}, /* KN_TAB */
  460. {VK_BACKSPACE|VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x08\xff"}}, /* KN_BACKSPACE */
  461. {VK_ESCAPE | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B\xff"}}, /* KN_ESC */
  462. {VK_UP | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B[A\xff"}}, /* KN_UP */
  463. {VK_DOWN | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B[B\xff"}}, /* KN_DOWN */
  464. {VK_RIGHT | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B[C\xff"}}, /* KN_RIGHT */
  465. {VK_LEFT | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B[D\xff"}}, /* KN_LEFT */
  466. {VK_HOME | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1Bh\xff"}}, /* KN_HOME */
  467. {VK_INSERT | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B+\xff"}}, /* KN_INS */
  468. {VK_DELETE | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B-\xff"}}, /* KN_DEL */
  469. {VK_NEXT | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B/\xff"}}, /* KN_PGDN */
  470. {VK_PRIOR | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B?\xff"}}, /* KN_PGUP */
  471. {VK_END | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1Bk\xff"}}, /* KN_END */
  472. {VK_DIVIDE | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x2F\xff"}}, /* number pad / */
  473. {VK_MULTIPLY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03*\xff"}}, /* number pad * */
  474. {VK_SUBTRACT | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03-\xff"}}, /* number pad - */
  475. {VK_ADD | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03,\xff"}}, /* number pad + */
  476. {VK_RETURN | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x0D\xff"}}, /* number pad Enter */
  477. {VK_F1 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B\x31\xff"}}, /* KN_F1 */
  478. {VK_F2 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B\x32\xff"}}, /* KN_F2 */
  479. {VK_F3 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B\x33\xff"}}, /* KN_F3 */
  480. {VK_F4 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B\x34\xff"}}, /* KN_F4 */
  481. {VK_F5 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B\x35\xff"}}, /* KN_F5 */
  482. {VK_F6 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B\x36\xff"}}, /* KN_F6 */
  483. {VK_F7 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B\x37\xff"}}, /* KN_F7 */
  484. {VK_F8 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B\x38\xff"}}, /* KN_F8 */
  485. {VK_F9 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B\x39\xff"}}, /* KN_F9 */
  486. {VK_F10 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B\x30\xff"}}, /* KN_F10 */
  487. {VK_F11 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B!\xff"}}, /* KN_F11 */
  488. {VK_F12 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B@\xff"}}, /* KN_F12 */
  489. {VK_F1 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B\x31\xff"}}, /* KN_F1 */
  490. {VK_F2 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B\x32\xff"}}, /* KN_F2 */
  491. {VK_F3 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B\x33\xff"}}, /* KN_F3 */
  492. {VK_F4 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B\x34\xff"}}, /* KN_F4 */
  493. {VK_F5 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B\x35\xff"}}, /* KN_F5 */
  494. {VK_F6 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B\x36\xff"}}, /* KN_F6 */
  495. {VK_F7 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B\x37\xff"}}, /* KN_F7 */
  496. {VK_F8 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B\x38\xff"}}, /* KN_F8 */
  497. {VK_F9 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B\x39\xff"}}, /* KN_F9 */
  498. {VK_F10 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B\x30\xff"}}, /* KN_F10 */
  499. {VK_F11 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B!\xff"}}, /* KN_F11 */
  500. {VK_F12 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x1B@\xff"}}, /* KN_F12 */
  501. // Shift Alt keys
  502. {VK_UP | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B[A\xff"}}, /* KN_UP */
  503. {VK_DOWN | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B[B\xff"}}, /* KN_DOWN */
  504. {VK_RIGHT | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B[C\xff"}}, /* KN_RIGHT */
  505. {VK_LEFT | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B[D\xff"}}, /* KN_LEFT */
  506. {VK_HOME | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1Bh\xff"}}, /* KN_HOME */
  507. {VK_INSERT | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B+\xff"}}, /* KN_INS */
  508. {VK_DELETE | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B-\xff"}}, /* KN_DEL */
  509. {VK_NEXT | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B/\xff"}}, /* KN_PGDN */
  510. {VK_PRIOR | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B?\xff"}}, /* KN_PGUP */
  511. {VK_END | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1Bk\xff"}}, /* KN_END */
  512. {VK_TAB | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x01\x5B\x5A\xff"}}, /* KN_TAB */
  513. {VK_BACKSPACE|VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x08\xff"}}, /* KN_BACKSPACE */
  514. {VK_ESCAPE | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B\xff"}}, /* KN_ESC */
  515. {VK_UP | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B[A\xff"}}, /* KN_UP */
  516. {VK_DOWN | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B[B\xff"}}, /* KN_DOWN */
  517. {VK_RIGHT | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B[C\xff"}}, /* KN_RIGHT */
  518. {VK_LEFT | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B[D\xff"}}, /* KN_LEFT */
  519. {VK_HOME | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1Bh\xff"}}, /* KN_HOME */
  520. {VK_INSERT | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B+\xff"}}, /* KN_INS */
  521. {VK_DELETE | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B-\xff"}}, /* KN_DEL */
  522. {VK_NEXT | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B/\xff"}}, /* KN_PGDN */
  523. {VK_PRIOR | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B?\xff"}}, /* KN_PGUP */
  524. {VK_END | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1Bk\xff"}}, /* KN_END */
  525. {0x2F | EXTENDED_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x01\x2F\xff"}}, /* number pad / */
  526. {VK_RETURN | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x01\x0D\xff"}}, /* number pad Enter */
  527. {VK_F1 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B\x31\xff"}}, /* KN_F1 */
  528. {VK_F2 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B\x32\xff"}}, /* KN_F2 */
  529. {VK_F3 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B\x33\xff"}}, /* KN_F3 */
  530. {VK_F4 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B\x34\xff"}}, /* KN_F4 */
  531. {VK_F5 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B\x35\xff"}}, /* KN_F5 */
  532. {VK_F6 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B\x36\xff"}}, /* KN_F6 */
  533. {VK_F7 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B\x37\xff"}}, /* KN_F7 */
  534. {VK_F8 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B\x38\xff"}}, /* KN_F8 */
  535. {VK_F9 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B\x39\xff"}}, /* KN_F9 */
  536. {VK_F10 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B\x30\xff"}}, /* KN_F10 */
  537. {VK_F11 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B!\xff"}}, /* KN_F11 */
  538. {VK_F12 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B@\xff"}}, /* KN_F12 */
  539. {VK_F1 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B\x31\xff"}}, /* KN_F1 */
  540. {VK_F2 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B\x32\xff"}}, /* KN_F2 */
  541. {VK_F3 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B\x33\xff"}}, /* KN_F3 */
  542. {VK_F4 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B\x34\xff"}}, /* KN_F4 */
  543. {VK_F5 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B\x35\xff"}}, /* KN_F5 */
  544. {VK_F6 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B\x36\xff"}}, /* KN_F6 */
  545. {VK_F7 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B\x37\xff"}}, /* KN_F7 */
  546. {VK_F8 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B\x38\xff"}}, /* KN_F8 */
  547. {VK_F9 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B\x39\xff"}}, /* KN_F9 */
  548. {VK_F10 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B\x30\xff"}}, /* KN_F10 */
  549. {VK_F11 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B!\xff"}}, /* KN_F11 */
  550. {VK_F12 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x1B@\xff"}}, /* KN_F12 */
  551. // Ctrl Alt keys
  552. {VK_UP | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B[A\xff"}}, /* KN_UP */
  553. {VK_DOWN | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B[B\xff"}}, /* KN_DOWN */
  554. {VK_RIGHT | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B[C\xff"}}, /* KN_RIGHT */
  555. {VK_LEFT | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B[D\xff"}}, /* KN_LEFT */
  556. {VK_HOME | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1Bh\xff"}}, /* KN_HOME */
  557. {VK_INSERT | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B+\xff"}}, /* KN_INS */
  558. {VK_DELETE | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B-\xff"}}, /* KN_DEL */
  559. {VK_NEXT | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B/\xff"}}, /* KN_PGDN */
  560. {VK_PRIOR | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B?\xff"}}, /* KN_PGUP */
  561. {VK_END | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1Bk\xff"}}, /* KN_END */
  562. {VK_TAB | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x09\xff"}}, /* KN_TAB */
  563. {VK_BACKSPACE|VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x08\xff"}}, /* KN_BACKSPACE */
  564. {VK_ESCAPE | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B\xff"}}, /* KN_ESC */
  565. {VK_UP | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B[A\xff"}}, /* KN_UP */
  566. {VK_DOWN | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B[B\xff"}}, /* KN_DOWN */
  567. {VK_RIGHT | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B[C\xff"}}, /* KN_RIGHT */
  568. {VK_LEFT | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B[D\xff"}}, /* KN_LEFT */
  569. {VK_HOME | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1Bh\xff"}}, /* KN_HOME */
  570. {VK_INSERT | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B+\xff"}}, /* KN_INS */
  571. {VK_DELETE | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B-\xff"}}, /* KN_DEL */
  572. {VK_NEXT | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B/\xff"}}, /* KN_PGDN */
  573. {VK_PRIOR | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B?\xff"}}, /* KN_PGUP */
  574. {VK_END | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1Bk\xff"}}, /* KN_END */
  575. {VK_DIVIDE | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x2F\xff"}}, /* number pad / */
  576. {VK_MULTIPLY | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x01*\xff"}}, /* number pad * */
  577. {VK_SUBTRACT | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x01-\xff"}}, /* number pad - */
  578. {VK_ADD | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x01,\xff"}}, /* number pad + */
  579. {VK_RETURN | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x0D\xff"}}, /* number pad Enter */
  580. {VK_F1 | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B\x31\xff"}}, /* KN_F1 */
  581. {VK_F2 | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B\x32\xff"}}, /* KN_F2 */
  582. {VK_F3 | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B\x33\xff"}}, /* KN_F3 */
  583. {VK_F4 | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B\x34\xff"}}, /* KN_F4 */
  584. {VK_F5 | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B\x35\xff"}}, /* KN_F5 */
  585. {VK_F6 | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B\x36\xff"}}, /* KN_F6 */
  586. {VK_F7 | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B\x37\xff"}}, /* KN_F7 */
  587. {VK_F8 | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B\x38\xff"}}, /* KN_F8 */
  588. {VK_F9 | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B\x39\xff"}}, /* KN_F9 */
  589. {VK_F10 | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B\x30\xff"}}, /* KN_F10 */
  590. {VK_F11 | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B!\xff"}}, /* KN_F11 */
  591. {VK_F12 | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B@\xff"}}, /* KN_F12 */
  592. {VK_F1 | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B\x31\xff"}}, /* KN_F1 */
  593. {VK_F2 | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B\x32\xff"}}, /* KN_F2 */
  594. {VK_F3 | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B\x33\xff"}}, /* KN_F3 */
  595. {VK_F4 | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B\x34\xff"}}, /* KN_F4 */
  596. {VK_F5 | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B\x35\xff"}}, /* KN_F5 */
  597. {VK_F6 | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B\x36\xff"}}, /* KN_F6 */
  598. {VK_F7 | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B\x37\xff"}}, /* KN_F7 */
  599. {VK_F8 | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B\x38\xff"}}, /* KN_F8 */
  600. {VK_F9 | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B\x39\xff"}}, /* KN_F9 */
  601. {VK_F10 | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B\x30\xff"}}, /* KN_F10 */
  602. {VK_F11 | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B!\xff"}}, /* KN_F11 */
  603. {VK_F12 | EXTENDED_KEY | VIRTUAL_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x1B@\xff"}}, /* KN_F12 */
  604. // Shift Ctrl Alt keys
  605. {VK_UP | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B[A\xff"}}, /* KN_UP */
  606. {VK_DOWN | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B[B\xff"}}, /* KN_DOWN */
  607. {VK_RIGHT | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B[C\xff"}}, /* KN_RIGHT */
  608. {VK_LEFT | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B[D\xff"}}, /* KN_LEFT */
  609. {VK_HOME | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1Bh\xff"}}, /* KN_HOME */
  610. {VK_INSERT | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B+\xff"}}, /* KN_INS */
  611. {VK_DELETE | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B-\xff"}}, /* KN_DEL */
  612. {VK_NEXT | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B/\xff"}}, /* KN_PGDN */
  613. {VK_PRIOR | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B?\xff"}}, /* KN_PGUP */
  614. {VK_END | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1Bk\xff"}}, /* KN_END */
  615. {VK_TAB | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x5B\x5A\xff"}}, /* KN_TAB */
  616. {VK_BACKSPACE|VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x08\xff"}}, /* KN_BACKSPACE */
  617. {VK_ESCAPE | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B\xff"}}, /* KN_ESC */
  618. {VK_UP | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B[A\xff"}}, /* KN_UP */
  619. {VK_DOWN | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B[B\xff"}}, /* KN_DOWN */
  620. {VK_RIGHT | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B[C\xff"}}, /* KN_RIGHT */
  621. {VK_LEFT | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B[D\xff"}}, /* KN_LEFT */
  622. {VK_HOME | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1Bh\xff"}}, /* KN_HOME */
  623. {VK_INSERT | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B+\xff"}}, /* KN_INS */
  624. {VK_DELETE | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B-\xff"}}, /* KN_DEL */
  625. {VK_NEXT | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B/\xff"}}, /* KN_PGDN */
  626. {VK_PRIOR | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B?\xff"}}, /* KN_PGUP */
  627. {VK_END | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1Bk\xff"}}, /* KN_END */
  628. {VK_DIVIDE | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x2F\xff"}}, /* number pad / */
  629. {VK_MULTIPLY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01*\xff"}}, /* number pad * */
  630. {VK_SUBTRACT | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01-\xff"}}, /* number pad - */
  631. {VK_ADD | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01,\xff"}}, /* number pad + */
  632. {VK_RETURN | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x0D\xff"}}, /* number pad Enter */
  633. {VK_F1 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B\x31\xff"}}, /* KN_F1 */
  634. {VK_F2 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B\x32\xff"}}, /* KN_F2 */
  635. {VK_F3 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B\x33\xff"}}, /* KN_F3 */
  636. {VK_F4 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B\x34\xff"}}, /* KN_F4 */
  637. {VK_F5 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B\x35\xff"}}, /* KN_F5 */
  638. {VK_F6 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B\x36\xff"}}, /* KN_F6 */
  639. {VK_F7 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B\x37\xff"}}, /* KN_F7 */
  640. {VK_F8 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B\x38\xff"}}, /* KN_F8 */
  641. {VK_F9 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B\x39\xff"}}, /* KN_F9 */
  642. {VK_F10 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B\x30\xff"}}, /* KN_F10 */
  643. {VK_F11 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B!\xff"}}, /* KN_F11 */
  644. {VK_F12 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B@\xff"}}, /* KN_F12 */
  645. {VK_F1 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B\x31\xff"}}, /* KN_F1 */
  646. {VK_F2 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B\x32\xff"}}, /* KN_F2 */
  647. {VK_F3 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B\x33\xff"}}, /* KN_F3 */
  648. {VK_F4 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B\x34\xff"}}, /* KN_F4 */
  649. {VK_F5 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B\x35\xff"}}, /* KN_F5 */
  650. {VK_F6 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B\x36\xff"}}, /* KN_F6 */
  651. {VK_F7 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B\x37\xff"}}, /* KN_F7 */
  652. {VK_F8 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B\x38\xff"}}, /* KN_F8 */
  653. {VK_F9 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B\x39\xff"}}, /* KN_F9 */
  654. {VK_F10 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B\x30\xff"}}, /* KN_F10 */
  655. {VK_F11 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B!\xff"}}, /* KN_F11 */
  656. {VK_F12 | EXTENDED_KEY | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x1B@\xff"}}, /* KN_F12 */
  657. };
  658. const KEYTBLSTORAGE VTUTF8ModifiedAlhpaKeyTable[MAX_VTUTF8_MODIFIED_ALPHA_KEYS] =
  659. {
  660. // Alt keys
  661. {0x20 | ALT_KEY, {"\x1B\x01\x20\xff"}}, /* space */
  662. {0x21 | ALT_KEY, {"\x1B\x01\x21\xff"}}, /* ! */
  663. {0x22 | ALT_KEY, {"\x1B\x01\x22\xff"}}, /* " */
  664. {0x23 | ALT_KEY, {"\x1B\x01\x23\xff"}}, /* # */
  665. {0x24 | ALT_KEY, {"\x1B\x01\x24\xff"}}, /* $ */
  666. {0x25 | ALT_KEY, {"\x1B\x01\x25\xff"}}, /* % */
  667. {0x26 | ALT_KEY, {"\x1B\x01\x26\xff"}}, /* & */
  668. {0x27 | ALT_KEY, {"\x1B\x01\x27\xff"}}, /* ' */
  669. {0x28 | ALT_KEY, {"\x1B\x01\x28\xff"}}, /* ( */
  670. {0x29 | ALT_KEY, {"\x1B\x01\x29\xff"}}, /* ) */
  671. {0x2A | ALT_KEY, {"\x1B\x01\x2A\xff"}}, /* * */
  672. {0x2B | ALT_KEY, {"\x1B\x01\x2B\xff"}}, /* + */
  673. {0x2C | ALT_KEY, {"\x1B\x01\x2C\xff"}}, /* , */
  674. {0x2D | ALT_KEY, {"\x1B\x01\x2D\xff"}}, /* - */
  675. {0x2E | ALT_KEY, {"\x1B\x01\x2E\xff"}}, /* . */
  676. {0x2F | ALT_KEY, {"\x1B\x01\x2F\xff"}}, /* / */
  677. {0x30 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x30\xff"}}, /* 0 */
  678. {0x31 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x31\xff"}}, /* 1 */
  679. {0x32 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x32\xff"}}, /* 2 */
  680. {0x33 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x33\xff"}}, /* 3 */
  681. {0x34 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x34\xff"}}, /* 4 */
  682. {0x35 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x35\xff"}}, /* 5 */
  683. {0x36 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x36\xff"}}, /* 6 */
  684. {0x37 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x37\xff"}}, /* 7 */
  685. {0x38 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x38\xff"}}, /* 8 */
  686. {0x39 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x39\xff"}}, /* 9 */
  687. {0x3A | ALT_KEY, {"\x1B\x01\x3A\xff"}}, /* : */
  688. {0x3B | ALT_KEY, {"\x1B\x01\x3B\xff"}}, /* ; */
  689. {0x3C | ALT_KEY, {"\x1B\x01\x3C\xff"}}, /* < */
  690. {0x3D | ALT_KEY, {"\x1B\x01\x3D\xff"}}, /* = */
  691. {0x3E | ALT_KEY, {"\x1B\x01\x3E\xff"}}, /* > */
  692. {0x3F | ALT_KEY, {"\x1B\x01\x3F\xff"}}, /* ? */
  693. {0x40 | ALT_KEY, {"\x1B\x01\x40\xff"}}, /* @ */
  694. {0x41 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x41\xff"}}, /* A */
  695. {0x42 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x42\xff"}}, /* B */
  696. {0x43 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x43\xff"}}, /* C */
  697. {0x44 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x44\xff"}}, /* D */
  698. {0x45 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x45\xff"}}, /* E */
  699. {0x46 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x46\xff"}}, /* F */
  700. {0x47 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x47\xff"}}, /* G */
  701. {0x48 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x48\xff"}}, /* H */
  702. {0x49 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x49\xff"}}, /* I */
  703. {0x4A | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x4A\xff"}}, /* J */
  704. {0x4B | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x4B\xff"}}, /* K */
  705. {0x4C | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x4C\xff"}}, /* L */
  706. {0x4D | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x4D\xff"}}, /* M */
  707. {0x4E | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x4E\xff"}}, /* N */
  708. {0x4F | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x4F\xff"}}, /* O */
  709. {0x50 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x50\xff"}}, /* P */
  710. {0x51 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x51\xff"}}, /* Q */
  711. {0x52 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x52\xff"}}, /* R */
  712. {0x53 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x53\xff"}}, /* S */
  713. {0x54 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x54\xff"}}, /* T */
  714. {0x55 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x55\xff"}}, /* U */
  715. {0x56 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x56\xff"}}, /* V */
  716. {0x57 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x57\xff"}}, /* W */
  717. {0x58 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x58\xff"}}, /* X */
  718. {0x59 | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x59\xff"}}, /* Y */
  719. {0x5A | VIRTUAL_KEY | ALT_KEY, {"\x1B\x01\x5A\xff"}}, /* Z */
  720. {0x5B | ALT_KEY, {"\x1B\x01\x5B\xff"}}, /* [ */
  721. {0x5C | ALT_KEY, {"\x1B\x01\x5C\xff"}}, /* \ */
  722. {0x5D | ALT_KEY, {"\x1B\x01\x5D\xff"}}, /* ] */
  723. {0x5E | ALT_KEY, {"\x1B\x01\x5E\xff"}}, /* ^ */
  724. {0x5F | ALT_KEY, {"\x1B\x01\x5F\xff"}}, /* _ */
  725. {0x60 | ALT_KEY, {"\x1B\x01\x60\xff"}}, /* ` */
  726. {0x7B | ALT_KEY, {"\x1B\x01\x7B\xff"}}, /* { */
  727. {0x7C | ALT_KEY, {"\x1B\x01\x7C\xff"}}, /* | */
  728. {0x7D | ALT_KEY, {"\x1B\x01\x7D\xff"}}, /* } */
  729. {0x7E | ALT_KEY, {"\x1B\x01\x7E\xff"}}, /* ~ */
  730. // Ctrl keys
  731. {0xB0 | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x20\xff"}}, /* space */
  732. {0xB7 | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x27\xff"}}, /* ' */
  733. {0xBC | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x2C\xff"}}, /* , */
  734. {0xBD | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x2D\xff"}}, /* - */
  735. {0xBE | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x2E\xff"}}, /* . */
  736. {0xBF | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x2F\xff"}}, /* / */
  737. {0x30 | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x30\xff"}}, /* 0 */
  738. {0x31 | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x31\xff"}}, /* 1 */
  739. {0x32 | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x32\xff"}}, /* 2 */
  740. {0x33 | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x33\xff"}}, /* 3 */
  741. {0x34 | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x34\xff"}}, /* 4 */
  742. {0x35 | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x35\xff"}}, /* 5 */
  743. {0x36 | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x36\xff"}}, /* 6 */
  744. {0x37 | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x37\xff"}}, /* 7 */
  745. {0x38 | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x38\xff"}}, /* 8 */
  746. {0x39 | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x39\xff"}}, /* 9 */
  747. {0xBA | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x3B\xff"}}, /* ; */
  748. {0xBB | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x3D\xff"}}, /* = */
  749. {0xC0 | VIRTUAL_KEY | CTRL_KEY, {"\x1B\x03\x60\xff"}}, /* ` */
  750. // Ctrl Alt keys
  751. {0xB0 | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x03\x1B\x01\x20\xff"}}, /* space */
  752. {0xB7 | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x03\x1B\x01\x27\xff"}}, /* ' */
  753. {0xBC | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x03\x1B\x01\x2C\xff"}}, /* , */
  754. {0xBD | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x03\x1B\x01\x2D\xff"}}, /* - */
  755. {0xBE | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x03\x1B\x01\x2E\xff"}}, /* . */
  756. {0xBF | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x03\x1B\x01\x2F\xff"}}, /* / */
  757. {0x30 | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x03\x1B\x01\x30\xff"}}, /* 0 */
  758. {0x31 | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x03\x1B\x01\x31\xff"}}, /* 1 */
  759. {0x32 | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x03\x1B\x01\x32\xff"}}, /* 2 */
  760. {0x33 | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x03\x1B\x01\x33\xff"}}, /* 3 */
  761. {0x34 | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x03\x1B\x01\x34\xff"}}, /* 4 */
  762. {0x35 | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x03\x1B\x01\x35\xff"}}, /* 5 */
  763. {0x36 | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x03\x1B\x01\x36\xff"}}, /* 6 */
  764. {0x37 | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x03\x1B\x01\x37\xff"}}, /* 7 */
  765. {0x38 | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x03\x1B\x01\x38\xff"}}, /* 8 */
  766. {0x39 | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x03\x1B\x01\x39\xff"}}, /* 9 */
  767. {0xBA | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x03\x1B\x01\x3B\xff"}}, /* ; */
  768. {0xBB | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x03\x1B\x01\x3D\xff"}}, /* = */
  769. {0x41 | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x01\x01\xff"}}, /* A */
  770. {0x42 | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x01\x02\xff"}}, /* B */
  771. {0x43 | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x01\x03\xff"}}, /* C */
  772. {0x44 | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x01\x04\xff"}}, /* D */
  773. {0x45 | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x01\x05\xff"}}, /* E */
  774. {0x46 | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x01\x06\xff"}}, /* F */
  775. {0x47 | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x01\x07\xff"}}, /* G */
  776. {0x48 | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x01\x08\xff"}}, /* H */
  777. {0x49 | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x01\x09\xff"}}, /* I */
  778. {0x4A | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x01\x0A\xff"}}, /* J */
  779. {0x4B | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x01\x0B\xff"}}, /* K */
  780. {0x4C | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x01\x0C\xff"}}, /* L */
  781. {0x4D | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x01\x0D\xff"}}, /* M */
  782. {0x4E | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x01\x0E\xff"}}, /* N */
  783. {0x4F | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x01\x0F\xff"}}, /* O */
  784. {0x50 | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x01\x10\xff"}}, /* P */
  785. {0x51 | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x01\x11\xff"}}, /* Q */
  786. {0x52 | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x01\x12\xff"}}, /* R */
  787. {0x53 | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x01\x13\xff"}}, /* S */
  788. {0x54 | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x01\x14\xff"}}, /* T */
  789. {0x55 | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x01\x15\xff"}}, /* U */
  790. {0x56 | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x01\x16\xff"}}, /* V */
  791. {0x57 | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x01\x17\xff"}}, /* W */
  792. {0x58 | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x01\x18\xff"}}, /* X */
  793. {0x59 | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x01\x19\xff"}}, /* Y */
  794. {0x5A | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x01\x1A\xff"}}, /* Z */
  795. {0xDB | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x01\x1B\xff"}}, /* [ */
  796. {0xDC | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x01\x1C\xff"}}, /* \ */
  797. {0xDD | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x01\x1D\xff"}}, /* ] */
  798. {0xC0 | VIRTUAL_KEY | ALT_KEY | CTRL_KEY, {"\x1B\x03\x1B\x01\x10\xff"}}, /* ` */
  799. // Shift Ctrl keys
  800. {0x20 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x13\x1B\x03\x20\xff"}}, /* space */
  801. {0x31 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x03\x21\xff"}}, /* ! */
  802. {0xDE | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x03\x22\xff"}}, /* " */
  803. {0x33 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x03\x23\xff"}}, /* # */
  804. {0x34 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x03\x24\xff"}}, /* $ */
  805. {0x35 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x03\x25\xff"}}, /* % */
  806. {0x37 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x03\x26\xff"}}, /* & */
  807. {0x39 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x03\x28\xff"}}, /* ( */
  808. {0x30 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x03\x29\xff"}}, /* ) */
  809. {0x38 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x03\x2A\xff"}}, /* * */
  810. {0xBB | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x03\x2B\xff"}}, /* + */
  811. {0xBA | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x03\x3A\xff"}}, /* : */
  812. {0xBC | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x03\x3C\xff"}}, /* < */
  813. {0xBE | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x03\x3E\xff"}}, /* > */
  814. {0xBF | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x03\x3F\xff"}}, /* ? */
  815. {0xDB | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x03\x7B\xff"}}, /* { */
  816. {0xDC | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x03\x7C\xff"}}, /* | */
  817. {0xDD | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x03\x7D\xff"}}, /* } */
  818. {0xC0 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY, {"\x1B\x03\x7E\xff"}}, /* ~ */
  819. // Shift Alt keys
  820. {0x20 | SHIFT_KEY | ALT_KEY, {"\x1B\x13\x1B\x01\x20\xff"}}, /* space */
  821. {0x41 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x01\x41\xff"}}, /* A */
  822. {0x42 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x01\x42\xff"}}, /* B */
  823. {0x43 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x01\x43\xff"}}, /* C */
  824. {0x44 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x01\x44\xff"}}, /* D */
  825. {0x45 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x01\x45\xff"}}, /* E */
  826. {0x46 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x01\x46\xff"}}, /* F */
  827. {0x47 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x01\x47\xff"}}, /* G */
  828. {0x48 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x01\x48\xff"}}, /* H */
  829. {0x49 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x01\x49\xff"}}, /* I */
  830. {0x4A | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x01\x4A\xff"}}, /* J */
  831. {0x4B | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x01\x4B\xff"}}, /* K */
  832. {0x4C | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x01\x4C\xff"}}, /* L */
  833. {0x4D | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x01\x4D\xff"}}, /* M */
  834. {0x4E | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x01\x4E\xff"}}, /* N */
  835. {0x4F | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x01\x4F\xff"}}, /* O */
  836. {0x50 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x01\x50\xff"}}, /* P */
  837. {0x51 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x01\x51\xff"}}, /* Q */
  838. {0x52 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x01\x52\xff"}}, /* R */
  839. {0x53 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x01\x53\xff"}}, /* S */
  840. {0x54 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x01\x54\xff"}}, /* T */
  841. {0x55 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x01\x55\xff"}}, /* U */
  842. {0x56 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x01\x56\xff"}}, /* V */
  843. {0x57 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x01\x57\xff"}}, /* W */
  844. {0x58 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x01\x58\xff"}}, /* X */
  845. {0x59 | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x01\x59\xff"}}, /* Y */
  846. {0x5A | VIRTUAL_KEY | SHIFT_KEY | ALT_KEY, {"\x1B\x01\x5A\xff"}}, /* Z */
  847. // Shift Ctrl Alt keys
  848. {0x20 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x20\xff"}}, /* space */
  849. {0x31 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x21\xff"}}, /* ! */
  850. {0xDE | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x22\xff"}}, /* " */
  851. {0x33 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x23\xff"}}, /* # */
  852. {0x34 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x24\xff"}}, /* $ */
  853. {0x35 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x25\xff"}}, /* % */
  854. {0x37 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x26\xff"}}, /* & */
  855. {0x39 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x28\xff"}}, /* ( */
  856. {0x30 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x29\xff"}}, /* ) */
  857. {0x38 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x2A\xff"}}, /* * */
  858. {0xBB | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x2B\xff"}}, /* + */
  859. {0xBA | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x3A\xff"}}, /* : */
  860. {0xBC | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x3C\xff"}}, /* < */
  861. {0xBE | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x3E\xff"}}, /* > */
  862. {0xBF | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x03\x1B\x01\x3F\xff"}}, /* ? */
  863. {0x40 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x01\x00\xff"}}, /* @ */
  864. {0x41 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x01\x01\xff"}}, /* A */
  865. {0x42 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x01\x02\xff"}}, /* B */
  866. {0x43 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x01\x03\xff"}}, /* C */
  867. {0x44 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x01\x04\xff"}}, /* D */
  868. {0x45 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x01\x05\xff"}}, /* E */
  869. {0x46 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x01\x06\xff"}}, /* F */
  870. {0x47 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x01\x07\xff"}}, /* G */
  871. {0x48 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x01\x08\xff"}}, /* H */
  872. {0x49 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x01\x09\xff"}}, /* I */
  873. {0x4A | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x01\x0A\xff"}}, /* J */
  874. {0x4B | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x01\x0B\xff"}}, /* K */
  875. {0x4C | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x01\x0C\xff"}}, /* L */
  876. {0x4D | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x01\x0D\xff"}}, /* M */
  877. {0x4E | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x01\x0E\xff"}}, /* N */
  878. {0x4F | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x01\x0F\xff"}}, /* O */
  879. {0x50 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x01\x10\xff"}}, /* P */
  880. {0x51 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x01\x11\xff"}}, /* Q */
  881. {0x52 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x01\x12\xff"}}, /* R */
  882. {0x53 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x01\x13\xff"}}, /* S */
  883. {0x54 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x01\x14\xff"}}, /* T */
  884. {0x55 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x01\x15\xff"}}, /* U */
  885. {0x56 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x01\x16\xff"}}, /* V */
  886. {0x57 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x01\x17\xff"}}, /* W */
  887. {0x58 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x01\x18\xff"}}, /* X */
  888. {0x59 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x01\x19\xff"}}, /* Y */
  889. {0x5A | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x01\x1A\xff"}}, /* Z */
  890. {0x5B | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x01\x1B\xff"}}, /* [ */
  891. {0x5C | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x01\x1C\xff"}}, /* \ */
  892. {0x5D | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x01\x1D\xff"}}, /* ] */
  893. {0x5E | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x01\x1E\xff"}}, /* ^ */
  894. {0x5F | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x01\x1F\xff"}}, /* _ */
  895. {0xDB | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x7B\xff"}}, /* { */
  896. {0xDC | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x7C\xff"}}, /* | */
  897. {0xDD | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x7D\xff"}}, /* } */
  898. {0xC0 | VIRTUAL_KEY | SHIFT_KEY | CTRL_KEY | ALT_KEY, {"\x1B\x13\x1B\x03\x1B\x01\x7E\xff"}}, /* ~ */
  899. };
  900. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  901. * vtutf8_init
  902. *
  903. * DESCRIPTION:
  904. * Initializes the VT-UTF8 emulator.
  905. *
  906. * ARGUMENTS:
  907. *
  908. * RETURNS:
  909. * nothing
  910. */
  911. void vtutf8_init(const HHEMU hhEmu)
  912. {
  913. PSTDECPRIVATE pstPRI;
  914. int iRow;
  915. char *pszLocale = NULL;
  916. UINT uiOEMCP = 0;
  917. TCHAR str[20];
  918. static struct trans_entry const vtutf8_tbl[] =
  919. {
  920. {NEW_STATE, 0, 0, 0}, // State 0
  921. {0, ETEXT('\x20'), ETEXT('\x7E'), emuDecGraphic}, // Space - ~
  922. {9, ETEXT('\x80'), 0xFFFF, vtUTF8FirstDataByte}, // 80h - FFh
  923. {1, ETEXT('\x1B'), ETEXT('\x1B'), nothing}, // Esc
  924. {0, ETEXT('\x05'), ETEXT('\x05'), vt100_answerback}, // Ctrl-E
  925. {0, ETEXT('\x07'), ETEXT('\x07'), emu_bell}, // Ctrl-G
  926. {0, ETEXT('\x08'), ETEXT('\x08'), vt_backspace}, // BackSpace
  927. {0, ETEXT('\x09'), ETEXT('\x09'), emuDecTab}, // Tab
  928. {0, ETEXT('\x0A'), ETEXT('\x0C'), emuLineFeed}, // NL - FF
  929. {0, ETEXT('\x0D'), ETEXT('\x0D'), carriagereturn}, // CR
  930. {0, ETEXT('\x0E'), ETEXT('\x0F'), vt_charshift}, // Ctrl-N
  931. {7, ETEXT('\x18'), ETEXT('\x18'), EmuStdChkZmdm}, // Ctrl-X
  932. {NEW_STATE, 0, 0, 0}, // State 1 // Esc
  933. {2, ETEXT('\x5B'), ETEXT('\x5B'), ANSI_Pn_Clr}, // [
  934. {3, ETEXT('\x23'), ETEXT('\x23'), nothing}, // #
  935. {4, ETEXT('\x28'), ETEXT('\x29'), vt_scs1}, // ( - )
  936. {0, ETEXT('\x37'), ETEXT('\x38'), vt100_savecursor}, // 7 - 8
  937. {1, ETEXT('\x3B'), ETEXT('\x3B'), ANSI_Pn_End}, // ;
  938. {0, ETEXT('\x3D'), ETEXT('\x3E'), vt_alt_kpmode}, // = - >
  939. {0, ETEXT('\x44'), ETEXT('\x44'), emuDecIND}, // D
  940. {0, ETEXT('\x45'), ETEXT('\x45'), ANSI_NEL}, // E
  941. {0, ETEXT('\x48'), ETEXT('\x48'), ANSI_HTS}, // H
  942. {0, ETEXT('\x48'), ETEXT('\x48'), DEC_HHC}, // H
  943. {0, ETEXT('\x4D'), ETEXT('\x4D'), emuDecRI}, // M
  944. {8, ETEXT('\x52'), ETEXT('\x52'), nothing}, // R
  945. {0, ETEXT('\x5A'), ETEXT('\x5A'), ANSI_DA}, // Z
  946. {0, ETEXT('\x63'), ETEXT('\x63'), vt100_hostreset}, // c
  947. {NEW_STATE, 0, 0, 0}, // State 2 // Esc[
  948. {2, ETEXT('\x3B'), ETEXT('\x3B'), ANSI_Pn_End}, // ;
  949. {2, ETEXT('\x30'), ETEXT('\x3F'), ANSI_Pn}, // 0 - ?
  950. {5, ETEXT('\x22'), ETEXT('\x22'), nothing}, // "
  951. {0, ETEXT('\x41'), ETEXT('\x41'), emuDecCUU}, // A
  952. {0, ETEXT('\x42'), ETEXT('\x42'), emuDecCUD}, // B
  953. {0, ETEXT('\x43'), ETEXT('\x43'), emuDecCUF}, // C
  954. {0, ETEXT('\x44'), ETEXT('\x44'), emuDecCUB}, // D
  955. {0, ETEXT('\x48'), ETEXT('\x48'), emuDecCUP}, // H
  956. {0, ETEXT('\x4A'), ETEXT('\x4A'), emuDecED}, // J
  957. {0, ETEXT('\x4B'), ETEXT('\x4B'), ANSI_EL}, // K
  958. {0, ETEXT('\x4C'), ETEXT('\x4C'), vt_IL}, // L
  959. {0, ETEXT('\x4D'), ETEXT('\x4D'), vt_DL}, // M
  960. {0, ETEXT('\x50'), ETEXT('\x50'), vt_DCH}, // P
  961. {0, ETEXT('\x5A'), ETEXT('\x5A'), ANSI_CBT}, // Z (Back tab (CBT))
  962. {0, ETEXT('\x63'), ETEXT('\x63'), ANSI_DA}, // c
  963. {0, ETEXT('\x66'), ETEXT('\x66'), emuDecCUP}, // f
  964. {0, ETEXT('\x67'), ETEXT('\x67'), ANSI_TBC}, // g
  965. {0, ETEXT('\x68'), ETEXT('\x68'), ANSI_SM}, // h
  966. {0, ETEXT('\x69'), ETEXT('\x69'), vt100PrintCommands},// i
  967. {0, ETEXT('\x6C'), ETEXT('\x6C'), ANSI_RM}, // l
  968. {0, ETEXT('\x6D'), ETEXT('\x6D'), ANSI_SGR}, // m
  969. {0, ETEXT('\x6E'), ETEXT('\x6E'), ANSI_DSR}, // n
  970. {0, ETEXT('\x71'), ETEXT('\x71'), nothing}, // q
  971. {0, ETEXT('\x72'), ETEXT('\x72'), vt_scrollrgn}, // r
  972. {0, ETEXT('\x78'), ETEXT('\x78'), vt100_report}, // x
  973. {NEW_STATE, 0, 0, 0}, // State 3 // Esc#
  974. {0, ETEXT('\x33'), ETEXT('\x36'), emuSetDoubleAttr}, // 3 - 6
  975. {0, ETEXT('\x38'), ETEXT('\x38'), vt_screen_adjust}, // 8
  976. {NEW_STATE, 0, 0, 0}, // State 4 // Esc ( - )
  977. {0, ETEXT('\x01'), ETEXT('\xFF'), vt_scs2}, // All
  978. {NEW_STATE, 0, 0, 0}, // State 5 // Esc["
  979. {0, ETEXT('\x70'), ETEXT('\x70'), nothing}, // p
  980. {NEW_STATE, 0, 0, 0}, // State 6 // Printer control
  981. {6, ETEXT('\x00'), ETEXT('\xFF'), vt100_prnc}, // All
  982. {NEW_STATE, 0, 0, 0}, // State 7 // Ctrl-X
  983. {7, ETEXT('\x00'), ETEXT('\xFF'), EmuStdChkZmdm}, // All
  984. {NEW_STATE, 0, 0, 0}, // State 8 // 80h - FFh
  985. {9, ETEXT('\x00'), 0xFFFF, vtUTF8MiddleDataByte}, // all data
  986. {NEW_STATE, 0, 0, 0}, // State 9 // 80h - FFh
  987. {0, ETEXT('\x00'), 0xFFFF, vtUTF8LastDataByte}, // all data
  988. };
  989. emuInstallStateTable(hhEmu, vtutf8_tbl, DIM(vtutf8_tbl));
  990. // Allocate space for and initialize data that is used only by the
  991. // VT100 emulator.
  992. //
  993. hhEmu->pvPrivate = malloc(sizeof(DECPRIVATE));
  994. if (hhEmu->pvPrivate == 0)
  995. {
  996. assert(FALSE);
  997. return;
  998. }
  999. pstPRI = (PSTDECPRIVATE)hhEmu->pvPrivate;
  1000. memset(pstPRI, 0, sizeof(DECPRIVATE));
  1001. // Allocate an array to hold line attribute values.
  1002. //
  1003. pstPRI->aiLineAttr = malloc(MAX_EMUROWS * sizeof(int) );
  1004. if (pstPRI->aiLineAttr == 0)
  1005. {
  1006. assert(FALSE);
  1007. return;
  1008. }
  1009. for (iRow = 0; iRow < MAX_EMUROWS; iRow++)
  1010. pstPRI->aiLineAttr[iRow] = NO_LINE_ATTR;
  1011. pstPRI->sv_row = 0;
  1012. pstPRI->sv_col = 0;
  1013. pstPRI->gn = 0;
  1014. pstPRI->sv_AWM = RESET;
  1015. pstPRI->sv_DECOM = RESET;
  1016. pstPRI->sv_protectmode = FALSE;
  1017. pstPRI->fAttrsSaved = FALSE;
  1018. pstPRI->pntr = pstPRI->storage;
  1019. // Initialize hhEmu values for VT100.
  1020. //
  1021. hhEmu->emu_kbdin = vtUTF8_kbdin;
  1022. hhEmu->emuResetTerminal = vt100_reset;
  1023. hhEmu->emu_setcurpos = emuDecSetCurPos;
  1024. hhEmu->emu_deinstall = emuVTUTF8Unload;
  1025. hhEmu->emu_clearscreen = emuDecClearScreen;
  1026. hhEmu->emu_highchar = 0xFFFF;
  1027. hhEmu->emu_maxrow = 25; // 25 line emulator
  1028. hhEmu->emu_maxcol = 80; // 80 column emulator
  1029. hhEmu->mode_vt220 = FALSE;
  1030. hhEmu->bottom_margin = hhEmu->emu_maxrow; // this has to equal emu_maxrow which changed
  1031. std_dsptbl(hhEmu, TRUE);
  1032. vt_charset_init(hhEmu);
  1033. emuKeyTableLoad(hhEmu, VTUTF8KeyTable,
  1034. sizeof(VTUTF8KeyTable)/sizeof(KEYTBLSTORAGE),
  1035. &hhEmu->stEmuKeyTbl);
  1036. emuKeyTableLoad(hhEmu, VTUTF8_Keypad_KeyTable,
  1037. sizeof(VTUTF8_Keypad_KeyTable)/sizeof(KEYTBLSTORAGE),
  1038. &hhEmu->stEmuKeyTbl2);
  1039. emuKeyTableLoad(hhEmu, VTUTF8_Cursor_KeyTable,
  1040. sizeof(VTUTF8_Cursor_KeyTable)/sizeof(KEYTBLSTORAGE),
  1041. &hhEmu->stEmuKeyTbl3);
  1042. emuKeyTableLoad(hhEmu, VTUTF8ModifiedKeyTable,
  1043. sizeof(VTUTF8ModifiedKeyTable)/sizeof(KEYTBLSTORAGE),
  1044. &hhEmu->stEmuKeyTbl4);
  1045. emuKeyTableLoad(hhEmu, VTUTF8ModifiedAlhpaKeyTable,
  1046. sizeof(VTUTF8ModifiedAlhpaKeyTable)/sizeof(KEYTBLSTORAGE),
  1047. &hhEmu->stEmuKeyTbl5);
  1048. // This is needed to set the locale to the default defined by the regional
  1049. // controls on the control panel. Without it, the locale is "C" and the
  1050. // wctomb() conversion would not work. (See the setlocale documentation for
  1051. // more details.) rde 26 Sep 01
  1052. sprintf((char *)(&str[0]), ".%d", GetOEMCP());
  1053. pszLocale = setlocale(LC_ALL, str);
  1054. // This was the first attempt which partially worked.
  1055. //pszLocale = setlocale(LC_ALL, "");
  1056. DbgOutStr("vtUTF8 locale=%s\r\n", pszLocale, 0,0,0,0);
  1057. backscrlSetShowFlag(sessQueryBackscrlHdl(hhEmu->hSession), TRUE);
  1058. return;
  1059. }
  1060. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  1061. * emuVTUTF8Unload
  1062. *
  1063. * DESCRIPTION:
  1064. * Unloads current emulator by freeing used memory.
  1065. *
  1066. * ARGUMENTS:
  1067. * none
  1068. *
  1069. * RETURNS:
  1070. * nothing
  1071. */
  1072. void emuVTUTF8Unload(const HHEMU hhEmu)
  1073. {
  1074. PSTDECPRIVATE pstPRI = (PSTDECPRIVATE)hhEmu->pvPrivate;
  1075. assert(hhEmu);
  1076. if (pstPRI)
  1077. {
  1078. if (pstPRI->aiLineAttr)
  1079. {
  1080. free(pstPRI->aiLineAttr);
  1081. pstPRI->aiLineAttr = 0;
  1082. }
  1083. free(hhEmu->pvPrivate);
  1084. hhEmu->pvPrivate = 0;
  1085. }
  1086. //
  1087. // Make sure to free the key tables that were created when the emulator
  1088. // was loaded, otherwise there is a memory leak. REV: 05/09/2001
  1089. //
  1090. emuKeyTableFree(&hhEmu->stEmuKeyTbl);
  1091. emuKeyTableFree(&hhEmu->stEmuKeyTbl2);
  1092. emuKeyTableFree(&hhEmu->stEmuKeyTbl3);
  1093. emuKeyTableFree(&hhEmu->stEmuKeyTbl4);
  1094. emuKeyTableFree(&hhEmu->stEmuKeyTbl5);
  1095. return;
  1096. }
  1097. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  1098. * vtUTF8_kbdin
  1099. *
  1100. * DESCRIPTION:
  1101. * Processes local keyboard keys for the VT-UTF8 emulator.
  1102. * Note: The only reason for a separate VT-UTF8 kbd function is to be
  1103. * able to convert key codes >= 80h (Alt-number pad keys) to UTF8 format.
  1104. * 20 Jul 2001 rde
  1105. *
  1106. * ARGUMENTS:
  1107. * hhEmu - Private emulator handle.
  1108. * kcode - The key to examine.
  1109. * fTest - TRUE if we only want to test the key.
  1110. *
  1111. * RETURNS:
  1112. * 0 if we can process the key, -1 otherwise.
  1113. *
  1114. * AUTHOR: Bob Everett - 20 Jul 2001
  1115. */
  1116. int vtUTF8_kbdin(const HHEMU hhEmu, int key, const int fTest)
  1117. {
  1118. int index = 0;
  1119. // DbgOutStr("vtUTF8_kbdin fTest=%d, key=%8x\r\n", fTest, key, 0, 0, 0);
  1120. /* -------------- Check Backspace & Delete keys ------------- */
  1121. if (hhEmu->stUserSettings.fReverseDelBk && ((key == VK_BACKSPACE) ||
  1122. (key == DELETE_KEY) || (key == DELETE_KEY_EXT)))
  1123. {
  1124. key = (key == VK_BACKSPACE) ? DELETE_KEY : VK_BACKSPACE;
  1125. }
  1126. /* -------------- Cursor Key Mode ------------- */
  1127. else if (hhEmu->mode_DECCKM == SET &&
  1128. (index = emuKbdKeyLookup(hhEmu, key, &hhEmu->stEmuKeyTbl3)) != -1)
  1129. {
  1130. if (!fTest)
  1131. emuSendKeyString(hhEmu, index, &hhEmu->stEmuKeyTbl3);
  1132. }
  1133. /* -------------- Keypad Application Mode ------------- */
  1134. else if (hhEmu->mode_DECKPAM &&
  1135. (index = emuKbdKeyLookup(hhEmu, key, &hhEmu->stEmuKeyTbl2)) != -1)
  1136. {
  1137. if (!fTest)
  1138. emuSendKeyString(hhEmu, index, &hhEmu->stEmuKeyTbl2);
  1139. }
  1140. /* -------------- Normal keys ------------- */
  1141. else if ((index = emuKbdKeyLookup(hhEmu, key, &hhEmu->stEmuKeyTbl)) != -1)
  1142. {
  1143. if (!fTest)
  1144. emuSendKeyString(hhEmu, index, &hhEmu->stEmuKeyTbl);
  1145. }
  1146. /* -------------- Modified (Alt, etc.) Non-alpha keys ------------- */
  1147. else if ((index = emuKbdKeyLookup(hhEmu, key, &hhEmu->stEmuKeyTbl4)) != -1)
  1148. {
  1149. if (!fTest)
  1150. emuSendKeyString(hhEmu, index, &hhEmu->stEmuKeyTbl4);
  1151. }
  1152. /* -------------- Modified (Alt, etc.) Alphanumeric keys ------------- */
  1153. else if ((index = emuKbdKeyLookup(hhEmu, key, &hhEmu->stEmuKeyTbl5)) != -1)
  1154. {
  1155. if (!fTest)
  1156. emuSendKeyString(hhEmu, index, &hhEmu->stEmuKeyTbl5);
  1157. }
  1158. else
  1159. {
  1160. static const int KeyBreak = VK_CANCEL|VIRTUAL_KEY|CTRL_KEY;
  1161. static const int KeyExtBreak = VK_CANCEL|VIRTUAL_KEY|CTRL_KEY|EXTENDED_KEY;
  1162. static const int KeyBreakNT = VK_CANCEL|EXTENDED_KEY;
  1163. static const int KeyAltBreak = VK_PAUSE |VIRTUAL_KEY|ALT_KEY;
  1164. ECHAR eChar;
  1165. HCLOOP hCloop = sessQueryCLoopHdl(hhEmu->hSession);
  1166. if (fTest)
  1167. {
  1168. // The backspace key is a special case. We must convert it to
  1169. // whatever the user has specified in the "Settings" properties
  1170. // page. So, if we are testing for backspace, return 0. This
  1171. // ensures that we get called again with fTest set to FALSE. When
  1172. // this happens we will process the key. - cab:11/18/96
  1173. //
  1174. if (key == VK_BACKSPACE)
  1175. {
  1176. #ifdef INCL_USER_DEFINED_BACKSPACE_AND_TELNET_TERMINAL_ID
  1177. index = 0;
  1178. #else
  1179. index = -1;
  1180. #endif
  1181. }
  1182. // We also process the break key.
  1183. //
  1184. else if (key == KeyBreak || key == KeyExtBreak ||
  1185. key == KeyAltBreak || key == KeyBreakNT)
  1186. {
  1187. index = 0;
  1188. }
  1189. else
  1190. {
  1191. index = -1;
  1192. }
  1193. }
  1194. else
  1195. {
  1196. // Process the backspace key according to the user setting
  1197. // in the "Settings" properties page. - cab:11/18/96
  1198. //
  1199. if (key == VK_BACKSPACE)
  1200. {
  1201. #ifdef INCL_USER_DEFINED_BACKSPACE_AND_TELNET_TERMINAL_ID
  1202. switch(hhEmu->stUserSettings.nBackspaceKeys)
  1203. {
  1204. case EMU_BKSPKEYS_CTRLH:
  1205. CLoopCharOut(hCloop, TEXT('\x08'));
  1206. break;
  1207. case EMU_BKSPKEYS_DEL:
  1208. CLoopCharOut(hCloop, TEXT('\x7F'));
  1209. break;
  1210. case EMU_BKSPKEYS_CTRLHSPACE:
  1211. CLoopCharOut(hCloop, TEXT('\x08'));
  1212. CLoopCharOut(hCloop, TEXT('\x20'));
  1213. CLoopCharOut(hCloop, TEXT('\x08'));
  1214. break;
  1215. default:
  1216. assert(0);
  1217. break;
  1218. }
  1219. #endif
  1220. index = -1;
  1221. }
  1222. // Process the break key.
  1223. //
  1224. else if (key == KeyBreak || key == KeyExtBreak || key == KeyBreakNT)
  1225. {
  1226. ComDriverSpecial(sessQueryComHdl(hhEmu->hSession), "Send Break", NULL, 0);
  1227. index = -1;
  1228. }
  1229. else if (key == KeyAltBreak)
  1230. {
  1231. ComDriverSpecial(sessQueryComHdl(hhEmu->hSession), "Send IP", NULL, 0);
  1232. index = -1;
  1233. }
  1234. // Processing for the enter key
  1235. //
  1236. else if (key == (VK_RETURN | VIRTUAL_KEY))
  1237. {
  1238. CLoopCharOut(hCloop, TEXT('\x0D'));
  1239. index = -1;
  1240. }
  1241. // processing for the for the escape key
  1242. //
  1243. else if (key == (VK_ESCAPE | VIRTUAL_KEY))
  1244. {
  1245. CLoopCharOut(hCloop, TEXT('\x1B'));
  1246. index = -1;
  1247. }
  1248. // processing for the for the tab key
  1249. //
  1250. else if (key == (VK_TAB | VIRTUAL_KEY))
  1251. {
  1252. CLoopCharOut(hCloop, TEXT('\x09'));
  1253. index = -1;
  1254. }
  1255. // Throw away any other virtual keys.
  1256. //
  1257. else if (key & VIRTUAL_KEY)
  1258. {
  1259. index = -1;
  1260. }
  1261. //
  1262. // Note: A 'Text Send' file transfer sends all its data through
  1263. // this kbd routine.
  1264. //
  1265. // Note: Maybe we also need to see if this character is a DBCS
  1266. // character and send both bytes if it is. REV 25 Jul 2001
  1267. //
  1268. else
  1269. {
  1270. // Send any other characters out the port.
  1271. //
  1272. if ((unsigned)key <= 0x007F)
  1273. {
  1274. // No UTF8 conversion is needed.
  1275. eChar = (ECHAR)key;
  1276. CLoopCharOut(hCloop, (UCHAR)(eChar & 0x00FF));
  1277. }
  1278. else if ((unsigned)key <=0x07FF)
  1279. {
  1280. // I think only Alt-numberpad keys can fall in this range.
  1281. eChar = (ECHAR)(UTF8_1ST_OF_2_BYTES_CODE | ((key & UTF8_2_BYTES_HIGHEST_5_BITS) >> 6));
  1282. CLoopCharOut(hCloop, (UCHAR)(eChar & 0x00FF));
  1283. eChar = (ECHAR)(UTF8_2ND_OF_2_BYTES_CODE | (key & UTF8_2_BYTES_LOWEST_6_BITS));
  1284. CLoopCharOut(hCloop, (UCHAR)(eChar & 0x00FF));
  1285. }
  1286. else
  1287. {
  1288. // I don't think any keys can fall in this range, but what the hey.
  1289. eChar = (ECHAR)(UTF8_1ST_OF_3_BYTES_CODE | ((key & UTF8_3_BYTES_HIGHEST_4_BITS) >> 12));
  1290. CLoopCharOut(hCloop, (UCHAR)(eChar & 0x00FF));
  1291. eChar = (ECHAR)(UTF8_2ND_OF_3_BYTES_CODE | ((key & UTF8_3_BYTES_MIDDLE_6_BITS) >> 6));
  1292. CLoopCharOut(hCloop, (UCHAR)(eChar & 0x00FF));
  1293. eChar = (ECHAR)(UTF8_3RD_OF_3_BYTES_CODE | (key & UTF8_3_BYTES_LOWEST_6_BITS));
  1294. CLoopCharOut(hCloop, (UCHAR)(eChar & 0x00FF));
  1295. }
  1296. index = -1;
  1297. }
  1298. }
  1299. }
  1300. // DbgOutStr("vtUTF8_kbdin return=%dd\r\n", index, 0, 0, 0, 0);
  1301. return index;
  1302. }
  1303. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  1304. * vtUTF8FirstDataByte
  1305. *
  1306. * DESCRIPTION:
  1307. * Handles UTF8 data coming in from a remote computer.
  1308. *
  1309. * ARGUMENTS:
  1310. * hhEmu - Private emulator handle.
  1311. *
  1312. * RETURNS:
  1313. * Nothing
  1314. *
  1315. * AUTHOR: Bob Everett - 20 Jul 2001
  1316. */
  1317. void vtUTF8FirstDataByte(const HHEMU hhEmu)
  1318. {
  1319. ECHAR echCode = (ECHAR)hhEmu->emu_code;
  1320. ECHAR echUTF8Type = 0;
  1321. ECHAR echUTF8Code = 0;
  1322. BOOL f2Bytes = FALSE;
  1323. if (echCode >= 0x0100)
  1324. {
  1325. // Sometimes the data comes in as 1 byte (0x00##) and sometimes as
  1326. // 2 bytes (0x####). It appears to be random. In this case, it's 2
  1327. // bytes. Each byte must be processed separately.
  1328. echCode = (ECHAR)(hhEmu->emu_code >> 8);
  1329. f2Bytes = TRUE;
  1330. }
  1331. echUTF8Type = UTF8_TYPE_MASK & echCode;
  1332. if (echUTF8Type == UTF8_1ST_OF_3_BYTES_CODE)
  1333. {
  1334. hhEmu->state = 8;
  1335. echUTF8Code = ((echCode & FIRST_4_BITS) << 12);
  1336. DbgOutStr("vtUTF8 byte 1 of 3: code=%4x, Code=%4x, UTF8Code=%4x\r\n",
  1337. hhEmu->emu_code, echCode, echUTF8Code, 0, 0);
  1338. }
  1339. else
  1340. {
  1341. echUTF8Code = ((echCode & FIRST_5_BITS) << 6);
  1342. DbgOutStr("vtUTF8 byte 1 of 2: code=%4x, Code=%4x, UTF8Code=%4x, state=%d\r\n",
  1343. hhEmu->emu_code, echCode, echUTF8Code, hhEmu->state, 0);
  1344. }
  1345. ((PSTDECPRIVATE)hhEmu->pvPrivate)->echUTF8CodeInProgress = echUTF8Code;
  1346. if (f2Bytes)
  1347. {
  1348. // Process the 2nd byte.
  1349. hhEmu->emu_code &= 0x00FF;
  1350. if (echUTF8Type == UTF8_1ST_OF_3_BYTES_CODE)
  1351. {
  1352. vtUTF8MiddleDataByte(hhEmu);
  1353. hhEmu->state = 9;
  1354. }
  1355. else
  1356. {
  1357. vtUTF8LastDataByte(hhEmu);
  1358. hhEmu->state = 0;
  1359. }
  1360. }
  1361. }
  1362. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  1363. * vtUTF8MiddleDataByte
  1364. *
  1365. * DESCRIPTION:
  1366. * Handles UTF8 data coming in from a remote computer.
  1367. *
  1368. * ARGUMENTS:
  1369. * hhEmu - Private emulator handle.
  1370. *
  1371. * RETURNS:
  1372. * Nothing
  1373. *
  1374. * AUTHOR: Bob Everett - 20 Jul 2001
  1375. */
  1376. void vtUTF8MiddleDataByte(const HHEMU hhEmu)
  1377. {
  1378. ECHAR echCode = (ECHAR)hhEmu->emu_code;
  1379. ECHAR echUTF8Code = 0;
  1380. BOOL f2Bytes = FALSE;
  1381. if (echCode >= 0x0100)
  1382. {
  1383. // It's 2 bytes. Each byte must be processed separately.
  1384. echCode = (ECHAR)(hhEmu->emu_code >> 8);
  1385. f2Bytes = TRUE;
  1386. }
  1387. echUTF8Code = ((echCode & FIRST_6_BITS) << 6);
  1388. ((PSTDECPRIVATE)hhEmu->pvPrivate)->echUTF8CodeInProgress |= echUTF8Code;
  1389. DbgOutStr("vtUTF8 byte 2 of 3: code=%4x, Code=%4x, UTF8Code=%4x, InProg=%4x\r\n",
  1390. hhEmu->emu_code, echCode, echUTF8Code, ((PSTDECPRIVATE)hhEmu->pvPrivate)->echUTF8CodeInProgress, 0);
  1391. if (f2Bytes)
  1392. {
  1393. // Process the 2nd byte.
  1394. hhEmu->emu_code &= 0x00FF;
  1395. vtUTF8LastDataByte(hhEmu);
  1396. hhEmu->state = 0;
  1397. }
  1398. }
  1399. /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  1400. * vtUTF8LastDataByte
  1401. *
  1402. * DESCRIPTION:
  1403. * Handles UTF8 data coming in from a remote computer.
  1404. *
  1405. * ARGUMENTS:
  1406. * hhEmu - Private emulator handle.
  1407. *
  1408. * RETURNS:
  1409. * Nothing
  1410. *
  1411. * AUTHOR: Bob Everett - 20 Jul 2001
  1412. */
  1413. void vtUTF8LastDataByte(const HHEMU hhEmu)
  1414. {
  1415. ECHAR echCode = (ECHAR)hhEmu->emu_code;
  1416. ECHAR echUTF8Code = 0;
  1417. ECHAR echUniCode = 0;
  1418. ECHAR echOriginalCode = (ECHAR)hhEmu->emu_code;
  1419. BOOL f2Bytes = FALSE;
  1420. int iRetval = 0;
  1421. if (echCode >= 0x0100)
  1422. {
  1423. // It's 2 bytes. Each byte must be processed separately.
  1424. echCode = (ECHAR)(hhEmu->emu_code >> 8);
  1425. f2Bytes = TRUE;
  1426. }
  1427. echUTF8Code = ((echCode & FIRST_6_BITS));
  1428. hhEmu->emu_code = ETEXT(((PSTDECPRIVATE)hhEmu->pvPrivate)->echUTF8CodeInProgress | echUTF8Code);
  1429. DbgOutStr("vtUTF8 last byte: code=%4x, Code=%4x, UTF8Code=%4x, code=%4x\r\n",
  1430. echOriginalCode, echCode, echUTF8Code, hhEmu->emu_code, 0);
  1431. // The incoming bytes are now converted to Unicode. To support Unicode,
  1432. // don't call wctomb() which converts Unicode to MBCS.
  1433. iRetval = wctomb((char *)&echUniCode, hhEmu->emu_code);
  1434. if (iRetval < 0)
  1435. hhEmu->emu_code = '?';
  1436. else if (iRetval < 2)
  1437. {
  1438. // Only 1 byte was returned. This may not be necessary, but clear
  1439. // the higher order byte.
  1440. hhEmu->emu_code = echUniCode & 0x00ff;
  1441. }
  1442. else
  1443. {
  1444. // For unknown reasons, wctomb returns the bytes in the reverse order
  1445. // from what the codepage documents show and what HT needs to display
  1446. // properly. rde 26 Sep 01
  1447. hhEmu->emu_code = ((echUniCode & 0x00ff) << 8) | ((echUniCode & 0xff00) >> 8);
  1448. }
  1449. DbgOutStr("vtUTF8 iRetval=%4x, Code=%4x, code=%4x\r\n",
  1450. iRetval, echUniCode, hhEmu->emu_code, 0,0);
  1451. emuDecGraphic(hhEmu);
  1452. if (f2Bytes)
  1453. {
  1454. // Process the 2nd byte.
  1455. hhEmu->emu_code = echOriginalCode & 0x00FF;
  1456. #if defined(EXTENDED_FEATURES)
  1457. (void)(*hhEmu->emu_datain)(hhEmu, hhEmu->emu_code);
  1458. #else
  1459. (void)(*hhEmu->emu_datain)((HEMU)hhEmu, hhEmu->emu_code);
  1460. #endif
  1461. }
  1462. }
  1463. #endif // INCL_VTUTF8
  1464. /* end of vtutf8ini.c */