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.

2169 lines
100 KiB

  1. /****************************** Module Header ******************************\
  2. * Module Name: kbd.h
  3. *
  4. * Copyright (c) Microsoft Corporation. All rights reserved.
  5. *
  6. * Keyboard table values that form the basis for languages and keyboard types.
  7. * The basis is US, kbd type 4 - all others are a variation on this.
  8. * This file is included by all kbd**.h files.
  9. *
  10. * History:
  11. * 10-Jan-1991 GregoryW
  12. * 23-Apr-1991 IanJa VSC_TO_VK _* macros from oemtab.c
  13. \***************************************************************************/
  14. #ifndef _KBD_
  15. #define _KBD_
  16. #if defined(BUILD_WOW6432)
  17. #define KBD_LONG_POINTER __ptr64
  18. #else
  19. #define KBD_LONG_POINTER
  20. #endif
  21. /****************************************************************************\
  22. *
  23. * Keyboard Layers. Used in kdb??.dll and in usersrv.dll
  24. *
  25. \****************************************************************************/
  26. /*
  27. * KE.usFlaggedVk values, also used in the keyboard layer tables.
  28. */
  29. #define KBDEXT (USHORT)0x0100
  30. #define KBDMULTIVK (USHORT)0x0200
  31. #define KBDSPECIAL (USHORT)0x0400
  32. #define KBDNUMPAD (USHORT)0x0800
  33. #define KBDUNICODE (USHORT)0x1000
  34. #define KBDINJECTEDVK (USHORT)0x2000
  35. #define KBDMAPPEDVK (USHORT)0x4000
  36. #define KBDBREAK (USHORT)0x8000
  37. /*
  38. * Key message lParam bits
  39. */
  40. #define EXTENDED_BIT 0x01000000
  41. #define DONTCARE_BIT 0x02000000
  42. #define FAKE_KEYSTROKE 0x02000000
  43. #define ALTNUMPAD_BIT 0x04000000 // copied from windows\inc\wincon.w
  44. /*
  45. * Keyboard Shift State defines. These correspond to the bit mask defined
  46. * by the VkKeyScan() API.
  47. */
  48. #define KBDBASE 0
  49. #define KBDSHIFT 1
  50. #define KBDCTRL 2
  51. #define KBDALT 4
  52. // three symbols KANA, ROYA, LOYA are for FE
  53. #define KBDKANA 8
  54. #define KBDROYA 0x10
  55. #define KBDLOYA 0x20
  56. #define KBDGRPSELTAP 0x80
  57. /*
  58. * Handy diacritics
  59. */
  60. #define GRAVE 0x0300
  61. #define ACUTE 0x0301
  62. #define CIRCUMFLEX 0x0302
  63. #define TILDE 0x0303
  64. #define MACRON 0x0304
  65. #define OVERSCORE 0x0305
  66. #define BREVE 0x0306
  67. #define DOT_ABOVE 0x0307
  68. #define UMLAUT 0x0308
  69. #define DIARESIS UMLAUT
  70. #define HOOK_ABOVE 0x0309
  71. #define RING 0x030A
  72. #define DOUBLE_ACUTE 0x030B
  73. #define HACEK 0x030C
  74. #define CEDILLA 0x0327
  75. #define OGONEK 0x0328
  76. #define TONOS 0x0384
  77. #define DIARESIS_TONOS 0x0385
  78. #define wszGRAVE L"\x0300"
  79. #define wszACUTE L"\x0301"
  80. #define wszCIRCUMFLEX L"\x0302"
  81. #define wszTILDE L"\x0303"
  82. #define wszMACRON L"\x0304"
  83. #define wszOVERSCORE L"\x0305"
  84. #define wszBREVE L"\x0306"
  85. #define wszDOT_ABOVE L"\x0307"
  86. #define wszUMLAUT L"\x0308"
  87. #define wszHOOK_ABOVE L"\x0309"
  88. #define wszRING L"\x030A"
  89. #define wszDOUBLE_ACUTE L"\x030B"
  90. #define wszHACEK L"\x030C"
  91. #define wszCEDILLA L"\x0327"
  92. #define wszOGONEK L"\x0328"
  93. #define wszTONOS L"\x0384"
  94. #define wszDIARESIS_TONOS L"\x0385"
  95. #define IDS_FROM_SCANCODE(prefix, base) \
  96. (0xc000 + ((0x ## prefix) >= 0xE0 ? 0x100 : 0) + (0x ## base))
  97. /***************************************************************************\
  98. * MODIFIER KEYS
  99. *
  100. * All keyboards have "Modifier" keys which are used to alter the behaviour of
  101. * some of the other keys. These shifter keys are usually:
  102. * Shift (left and/or right Shift key)
  103. * Ctrl (left and/or right Ctrl key)
  104. * Alt (left and/or right Alt key)
  105. * AltGr (right Alt key only)
  106. *
  107. * NOTE:
  108. * All keyboards use the Shift key.
  109. * All keyboards use a Ctrl key to generate ASCII control characters.
  110. * All keyboards with a number pad use the Alt key and the NumPad to
  111. * generate characters by number.
  112. * Keyboards using AltGr as a Modifier Key usually translate the Virtual
  113. * ScanCode to Virtual Keys VK_CTRL + VK_ALT at input time: the Modifier
  114. * tables should be written to treat Ctrl + Alt as a valid shifter
  115. * key combination in these cases.
  116. *
  117. * By holding down 0 or more of these Modifier keys, a "shift state" is
  118. * obtained : the shift state may affect the translation of Virtual Scancodes
  119. * to Virtual Keys and/or the translation of Virtuals Key to Characters.
  120. *
  121. * EXAMPLES:
  122. *
  123. * Each key on a particular keyboard may be marked with up to five different
  124. * characters in five different positions:
  125. *
  126. * .-------.
  127. * /| |\
  128. * : | 2 4 | :
  129. * | | | |
  130. * | | | |
  131. * | | 1 3 | |
  132. * | |_______| |
  133. * | / \ |
  134. * |/ 5 \|
  135. * `-----------'
  136. *
  137. * A key may also be able to generate a character that is not marked on it:
  138. * these are ASCII Control chars, lower-case letters and/or "invisible keys".
  139. * .-------.
  140. * An example of an "Invisible Key": /| |\
  141. * : | > | :
  142. * The German M24 keyboard 2 should produce the | | | |
  143. * '|' character when ALT SHIFT is is held down | | | |
  144. * while the '<' key (shown here) is pressed: | | < \ | |
  145. * This keyboard has four other invisible | |_______| |
  146. * characters. France, Italy and Spain also | / \ |
  147. * support invisible characters on the M24 |/ \|
  148. * Keyboard 2 with ALT SHIFT depressed. `-----------'
  149. *
  150. * The keyboard table must list the keys that contribute to it's shift state,
  151. * and indicate which combinations are valid. This is done with
  152. * aCharModifiers[] - convert combinations of Modifier Keys to Bitmasks.
  153. * and
  154. * aModification[]; - convert Modifier Bitmasks to enumerated Modifications
  155. *
  156. * AN EXAMPLE OF VALID AND INVALID MODIFIER KEY COMBINATIONS
  157. *
  158. * The US English keyboard has 3 Modifier keys:
  159. * Shift (left or right); Ctrl (left or right); and Alt (left or right).
  160. *
  161. * The only valid combinations of these Modifier Keys are:
  162. * none pressed : Character at position (1) on the key.
  163. * Shift : Character at position (2) on the key.
  164. * Ctrl : Ascii Control characters
  165. * Shift + Ctrl : Ascii Control characters
  166. * Alt : Character-by-number on the numpad
  167. *
  168. * The invalid combinations (that do not generate any characters) are:
  169. * Shift + Alt
  170. * Alt + Ctrl
  171. * Shift + Alt + Ctrl
  172. *
  173. * Something (???) :
  174. * -----------------
  175. * Modifier keys Character produced
  176. * ------------------------- ------------------
  177. * 0 No shifter key depressed position 1
  178. * 1 Shift key is depressed position 2
  179. * 2 AltGr (r.h. Alt) depressed position 4 or 5 (whichever is marked)
  180. *
  181. * However, note that 3 shifter keys (SHIFT, can be combined in a
  182. * characters, depending on the Keyboards
  183. * Consider the following keyboards:
  184. *
  185. * .-------. STRANGE KBD PECULIAR KBD
  186. * /| |\ ================== ==================
  187. * : | 2 4 | : 1 -
  188. * | | | | 2 - SHIFT SHIFT
  189. * | | | | 3 - MENU MENU
  190. * | | 1 3 | | 4 - SHIFT + MENU SHIFT + MENU
  191. * | |_______| | 5 - no such keys CTRL + MENU
  192. * | / \ |
  193. * |/ 5 \|
  194. * `-----------'
  195. * Both STRANGE and PECULIAR keyboards could have aVkToBits[] =
  196. * { VK_SHIFT , KBDSHIFT }, // 0x01
  197. * { VK_CONTROL, KBDCTRL }, // 0x02
  198. * { VK_MENU , KBDALT }, // 0x04
  199. * { 0, 0 }
  200. *
  201. * The STRANGE keyboard has 4 distinct shift states, while the PECULIAR kbd
  202. * has 5. However, note that 3 shifter bits can be combined in a
  203. * total of 2^3 == 8 ways. Each such combination must be related to one (or
  204. * none) of the enumerated shift states.
  205. * Each shifter key combination can be represented by three binary bits:
  206. * Bit 0 is set if VK_SHIFT is down
  207. * Bit 1 is set if VK_CONTROL is down
  208. * Bit 2 is set if VK_MENU is down
  209. *
  210. * Example: If the STRANGE keyboard generates no characters in combination
  211. * when just the ALT key is held down, nor when the SHIFT, CTRL and ALT keys
  212. * are all held down, then the tables might look like this:
  213. *
  214. * VK_MENU,
  215. * VK_CTRL, 0
  216. * };
  217. * aModification[] = {
  218. * 0, // 0 0 0 = 000 <none>
  219. * 1, // 0 0 1 = 001 SHIFT
  220. * SHFT_INVALID, // 0 1 0 = 010 ALT
  221. * 2, // 0 1 1 = 011 SHIFT ALT
  222. * 3, // 1 0 0 = 100 CTRL
  223. * 4, // 1 0 1 = 101 SHIFT CTRL
  224. * 5, // 1 1 0 = 110 CTRL ALT
  225. * SHFT_INVALID // 1 1 1 = 111 SHIFT CTRL ALT
  226. * };
  227. *
  228. *
  229. \***************************************************************************/
  230. /***************************************************************************\
  231. * VK_TO_BIT - associate a Virtual Key with a Modifier bitmask.
  232. *
  233. * Vk - the Virtual key (eg: VK_SHIFT, VK_RMENU, VK_CONTROL etc.)
  234. * Special Values:
  235. * 0 null terminator
  236. * ModBits - a combination of KBDALT, KBDCTRL, KBDSHIFT and kbd-specific bits
  237. * Any kbd-specific shift bits must be the lowest-order bits other
  238. * than KBDSHIFT, KBDCTRL and KBDALT (0, 1 & 2)
  239. *
  240. * Those languages that use AltGr (VK_RMENU) to shift keys convert it to
  241. * CTRL+ALT with the KBDSPECIAL bit in the ausVK[] entry for VK_RMENU
  242. * and by having an entry in aVkToPfnOem[] to simulate the right Vk sequence.
  243. *
  244. \***************************************************************************/
  245. typedef struct {
  246. BYTE Vk;
  247. BYTE ModBits;
  248. } VK_TO_BIT, *KBD_LONG_POINTER PVK_TO_BIT;
  249. /***************************************************************************\
  250. * pModNumber - a table to map shift bits to enumerated shift states
  251. *
  252. * Table attributes: Ordered table
  253. *
  254. * Maps all possible shifter key combinations to an enumerated shift state.
  255. * The size of the table depends on the value of the highest order bit used
  256. * in aCharModifiers[*].ModBits
  257. *
  258. * Special values for aModification[*]
  259. * SHFT_INVALID - no characters produced with this shift state.
  260. LATER: (ianja) no SHFT_CTRL - control characters encoded in tables like others
  261. * SHFT_CTRL - standard control character production (all keyboards must
  262. * be able to produce CTRL-C == 0x0003 etc.)
  263. * Other - enumerated shift state (not less than 0)
  264. *
  265. * This table is indexed by the Modifier Bits to obtain an Modification Number.
  266. *
  267. * CONTROL MENU SHIFT
  268. *
  269. * aModification[] = {
  270. * 0, // 0 0 0 = 000 <none>
  271. * 1, // 0 0 1 = 001 SHIFT
  272. * SHFT_INVALID, // 0 1 0 = 010 ALT
  273. * 2, // 0 1 1 = 011 SHIFT ALT
  274. * 3, // 1 0 0 = 100 CTRL
  275. * 4, // 1 0 1 = 101 SHIFT CTRL
  276. * 5, // 1 1 0 = 110 CTRL ALT
  277. * SHFT_INVALID // 1 1 1 = 111 SHIFT CTRL ALT
  278. * };
  279. *
  280. \***************************************************************************/
  281. typedef struct {
  282. PVK_TO_BIT pVkToBit; // Virtual Keys -> Mod bits
  283. WORD wMaxModBits; // max Modification bit combination value
  284. BYTE ModNumber[]; // Mod bits -> Modification Number
  285. } MODIFIERS, *KBD_LONG_POINTER PMODIFIERS;
  286. WORD GetModifierBits(PMODIFIERS pModifiers, LPBYTE afKeyState);
  287. WORD GetModificationNumber(PMODIFIERS pModifiers, WORD wModBits);
  288. #define SHFT_INVALID 0x0F
  289. /***************************************************************************\
  290. * VSC_VK - Associate a Virtual Scancode with a Virtual Key
  291. * Vsc - Virtual Scancode
  292. * Vk - Virtual Key | flags
  293. * Used by VKFromVSC() for scancodes prefixed 0xE0 or 0xE1
  294. \***************************************************************************/
  295. typedef struct _VSC_VK {
  296. BYTE Vsc;
  297. USHORT Vk;
  298. } VSC_VK, *KBD_LONG_POINTER PVSC_VK;
  299. /***************************************************************************\
  300. * VK_VSC - Associate a Virtual Key with a Virtual Scancode
  301. * Vk - Virtual Key
  302. * Vsc - Virtual Scancode
  303. * Used by MapVirtualKey for Virtual Keys not appearing in ausVK[]
  304. \***************************************************************************/
  305. typedef struct _VK_VSC {
  306. BYTE Vk;
  307. BYTE Vsc;
  308. } VK_VSC, *KBD_LONG_POINTER PVK_VSC;
  309. /***************************************************************************\
  310. *
  311. * VK_TO_WCHARS<n> - Associate a Virtual Key with <n> UNICODE characters
  312. *
  313. * VirtualKey - The Virtual Key.
  314. * wch[] - An array of characters, one for each shift state that
  315. * applies to the specified Virtual Key.
  316. *
  317. * Special values for VirtualKey:
  318. * -1 - This entry contains dead chars for the previous entry
  319. * 0 - Terminates a VK_TO_WCHARS[] table
  320. *
  321. * Special values for Attributes:
  322. * CAPLOK - The CAPS-LOCK key affects this key like SHIFT
  323. * SGCAPS - CapsLock uppercases the unshifted char (Swiss-German)
  324. *
  325. * Special values for wch[*]:
  326. * WCH_NONE - No character is generated by pressing this key with the
  327. * current shift state.
  328. * WCH_DEAD - The character is a dead-key: the next VK_TO_WCHARS[] entry
  329. * will contain the values of the dead characters (diaresis)
  330. * that can be produced by the Virtual Key.
  331. * WCH_LGTR - The character is a ligature. The characters generated by
  332. * this keystroke are found in the ligature table.
  333. *
  334. \***************************************************************************/
  335. #define WCH_NONE 0xF000
  336. #define WCH_DEAD 0xF001
  337. #define WCH_LGTR 0xF002
  338. #define CAPLOK 0x01
  339. #define SGCAPS 0x02
  340. #define CAPLOKALTGR 0x04
  341. // KANALOK is for FE
  342. #define KANALOK 0x08
  343. #define GRPSELTAP 0x80
  344. /*
  345. * Macro for VK to WCHAR with "n" shift states
  346. */
  347. #define TYPEDEF_VK_TO_WCHARS(n) typedef struct _VK_TO_WCHARS##n { \
  348. BYTE VirtualKey; \
  349. BYTE Attributes; \
  350. WCHAR wch[n]; \
  351. } VK_TO_WCHARS##n, *KBD_LONG_POINTER PVK_TO_WCHARS##n;
  352. /*
  353. * To facilitate coding the table scanning routine.
  354. */
  355. /*
  356. * Table element types (for various numbers of shift states), used
  357. * to facilitate static initializations of tables.
  358. * VK_TO_WCHARS1 and PVK_TO_WCHARS1 may be used as the generic type
  359. */
  360. TYPEDEF_VK_TO_WCHARS(1) // VK_TO_WCHARS1, *PVK_TO_WCHARS1;
  361. TYPEDEF_VK_TO_WCHARS(2) // VK_TO_WCHARS2, *PVK_TO_WCHARS2;
  362. TYPEDEF_VK_TO_WCHARS(3) // VK_TO_WCHARS3, *PVK_TO_WCHARS3;
  363. TYPEDEF_VK_TO_WCHARS(4) // VK_TO_WCHARS4, *PVK_TO_WCHARS4;
  364. TYPEDEF_VK_TO_WCHARS(5) // VK_TO_WCHARS5, *PVK_TO_WCHARS5;
  365. TYPEDEF_VK_TO_WCHARS(6) // VK_TO_WCHARS6, *PVK_TO_WCHARS5;
  366. TYPEDEF_VK_TO_WCHARS(7) // VK_TO_WCHARS7, *PVK_TO_WCHARS7;
  367. // these three (8,9,10) are for FE
  368. TYPEDEF_VK_TO_WCHARS(8) // VK_TO_WCHARS8, *PVK_TO_WCHARS8;
  369. TYPEDEF_VK_TO_WCHARS(9) // VK_TO_WCHARS9, *PVK_TO_WCHARS9;
  370. TYPEDEF_VK_TO_WCHARS(10) // VK_TO_WCHARS10, *PVK_TO_WCHARS10;
  371. /***************************************************************************\
  372. *
  373. * VK_TO_WCHAR_TABLE - Describe a table of VK_TO_WCHARS1
  374. *
  375. * pVkToWchars - points to the table.
  376. * nModifications - the number of shift-states supported by this table.
  377. * (this is the number of elements in pVkToWchars[*].wch[])
  378. *
  379. * A keyboard may have several such tables: all keys with the same number of
  380. * shift-states are grouped together in one table.
  381. *
  382. * Special values for pVktoWchars:
  383. * NULL - Terminates a VK_TO_WCHAR_TABLE[] list.
  384. *
  385. \***************************************************************************/
  386. typedef struct _VK_TO_WCHAR_TABLE {
  387. PVK_TO_WCHARS1 pVkToWchars;
  388. BYTE nModifications;
  389. BYTE cbSize;
  390. } VK_TO_WCHAR_TABLE, *KBD_LONG_POINTER PVK_TO_WCHAR_TABLE;
  391. /***************************************************************************\
  392. *
  393. * Dead Key (diaresis) tables
  394. *
  395. * LATER IanJa: supplant by an NLS API that composes Diacritic+Base -> WCHAR
  396. *
  397. \***************************************************************************/
  398. typedef struct {
  399. DWORD dwBoth; // diacritic & char
  400. WCHAR wchComposed;
  401. USHORT uFlags;
  402. } DEADKEY, *KBD_LONG_POINTER PDEADKEY;
  403. #define DEADTRANS(ch, accent, comp, flags) { MAKELONG(ch, accent), comp, flags}
  404. /*
  405. * Bit values for uFlags
  406. */
  407. #define DKF_DEAD 0x0001
  408. /***************************************************************************\
  409. *
  410. * Ligature table
  411. *
  412. \***************************************************************************/
  413. /*
  414. * Macro for ligature with "n" characters
  415. */
  416. #define TYPEDEF_LIGATURE(n) typedef struct _LIGATURE##n { \
  417. BYTE VirtualKey; \
  418. WORD ModificationNumber; \
  419. WCHAR wch[n]; \
  420. } LIGATURE##n, *KBD_LONG_POINTER PLIGATURE##n;
  421. /*
  422. * To facilitate coding the table scanning routine.
  423. */
  424. /*
  425. * Table element types (for various numbers of ligatures), used
  426. * to facilitate static initializations of tables.
  427. *
  428. * LIGATURE1 and PLIGATURE1 are used as the generic type
  429. */
  430. TYPEDEF_LIGATURE(1) // LIGATURE1, *PLIGATURE1;
  431. TYPEDEF_LIGATURE(2) // LIGATURE2, *PLIGATURE2;
  432. TYPEDEF_LIGATURE(3) // LIGATURE3, *PLIGATURE3;
  433. TYPEDEF_LIGATURE(4) // LIGATURE4, *PLIGATURE4;
  434. TYPEDEF_LIGATURE(5) // LIGATURE5, *PLIGATURE5;
  435. /***************************************************************************\
  436. * VSC_LPWSTR - associate a Virtual Scancode with a Text string
  437. *
  438. * Uses:
  439. * GetKeyNameText(), aKeyNames[] Map virtual scancode to name of key
  440. *
  441. \***************************************************************************/
  442. typedef struct {
  443. BYTE vsc;
  444. WCHAR *KBD_LONG_POINTER pwsz;
  445. } VSC_LPWSTR, *KBD_LONG_POINTER PVSC_LPWSTR;
  446. typedef WCHAR *KBD_LONG_POINTER DEADKEY_LPWSTR;
  447. /*
  448. * Along with ligature support we're adding a proper version number.
  449. * The previous version number (actually just unused bits...) was
  450. * always zero. The version number will live in the high word of
  451. * fLocaleFlags.
  452. */
  453. #define KBD_VERSION 1
  454. #define GET_KBD_VERSION(p) (HIWORD((p)->fLocaleFlags))
  455. /*
  456. * Attributes such as AltGr, LRM_RLM, ShiftLock are stored in the the low word
  457. * of fLocaleFlags (layout specific) or in gdwKeyboardAttributes (all layouts)
  458. */
  459. #define KLLF_ALTGR 0x0001
  460. #define KLLF_SHIFTLOCK 0x0002
  461. #define KLLF_LRM_RLM 0x0004
  462. /*
  463. * Some attributes are per-layout (specific to an individual layout), some
  464. * attributes are per-user (apply globally to all layouts). Some are both.
  465. */
  466. #define KLLF_LAYOUT_ATTRS (KLLF_SHIFTLOCK | KLLF_ALTGR | KLLF_LRM_RLM)
  467. #define KLLF_GLOBAL_ATTRS (KLLF_SHIFTLOCK)
  468. /*
  469. * Flags passed in to the KeyboardLayout API (KLF_*) as can be converted to
  470. * internal (KLLF_*) attributes:
  471. */
  472. #define KLL_ATTR_FROM_KLF(x) ((x) >> 15)
  473. #define KLL_LAYOUT_ATTR_FROM_KLF(x) (KLL_ATTR_FROM_KLF(x) & KLLF_LAYOUT_ATTRS)
  474. #define KLL_GLOBAL_ATTR_FROM_KLF(x) (KLL_ATTR_FROM_KLF(x) & KLLF_GLOBAL_ATTRS)
  475. /*
  476. * If KLF_SHIFTLOCK & KLF_LRM_RLM are defined, we can check the KLLF_* values
  477. */
  478. #ifdef KLF_SHIFTLOCK
  479. #if KLLF_SHIFTLOCK != KLL_ATTR_FROM_KLF(KLF_SHIFTLOCK)
  480. #error KLLF_SHIFTLOCK != KLL_ATTR_FROM_KLF(KLF_SHIFTLOCK)
  481. #endif
  482. #endif // KLF_SHIFTLOCK
  483. #ifdef KLF_LRM_RLM
  484. #if KLLF_LRM_RLM != KLL_ATTR_FROM_KLF(KLF_LRM_RLM)
  485. #error KLLF_LRM_RLM != KLL_ATTR_FROM_KLF(KLF_LRM_RLM)
  486. #endif
  487. #endif // KLF_LRM_RLM
  488. /***************************************************************************\
  489. * KBDTABLES
  490. *
  491. * This structure describes all the tables that implement the keyboard layer.
  492. *
  493. * When switching to a new layer, we get a new KBDTABLES structure: all key
  494. * processing tables are accessed indirectly through this structure.
  495. *
  496. \***************************************************************************/
  497. typedef struct tagKbdLayer {
  498. /*
  499. * Modifier keys
  500. */
  501. PMODIFIERS pCharModifiers;
  502. /*
  503. * Characters
  504. */
  505. PVK_TO_WCHAR_TABLE pVkToWcharTable; // ptr to tbl of ptrs to tbl
  506. /*
  507. * Diacritics
  508. */
  509. PDEADKEY pDeadKey;
  510. /*
  511. * Names of Keys
  512. */
  513. PVSC_LPWSTR pKeyNames;
  514. PVSC_LPWSTR pKeyNamesExt;
  515. WCHAR *KBD_LONG_POINTER *KBD_LONG_POINTER pKeyNamesDead;
  516. /*
  517. * Scan codes to Virtual Keys
  518. */
  519. USHORT *KBD_LONG_POINTER pusVSCtoVK;
  520. BYTE bMaxVSCtoVK;
  521. PVSC_VK pVSCtoVK_E0; // Scancode has E0 prefix
  522. PVSC_VK pVSCtoVK_E1; // Scancode has E1 prefix
  523. /*
  524. * Locale-specific special processing
  525. */
  526. DWORD fLocaleFlags;
  527. /*
  528. * Ligatures
  529. */
  530. BYTE nLgMax;
  531. BYTE cbLgEntry;
  532. PLIGATURE1 pLigature;
  533. /*
  534. * Type and subtype. These are optional.
  535. */
  536. DWORD dwType; // Keyboard Type
  537. DWORD dwSubType; // Keyboard SubType: may contain OemId
  538. } KBDTABLES, *KBD_LONG_POINTER PKBDTABLES;
  539. /*
  540. * FarEast-specific special...
  541. */
  542. typedef struct _VK_FUNCTION_PARAM {
  543. BYTE NLSFEProcIndex;
  544. ULONG NLSFEProcParam;
  545. } VK_FPARAM, *KBD_LONG_POINTER PVK_FPARAM;
  546. typedef struct _VK_TO_FUNCTION_TABLE {
  547. BYTE Vk;
  548. BYTE NLSFEProcType;
  549. BYTE NLSFEProcCurrent;
  550. // Index[0] : Base
  551. // Index[1] : Shift
  552. // Index[2] : Control
  553. // Index[3] : Shift+Control
  554. // Index[4] : Alt
  555. // Index[5] : Shift+Alt
  556. // Index[6] : Control+Alt
  557. // Index[7] : Shift+Control+Alt
  558. BYTE NLSFEProcSwitch; // 8 bits
  559. VK_FPARAM NLSFEProc[8];
  560. VK_FPARAM NLSFEProcAlt[8];
  561. } VK_F, *KBD_LONG_POINTER PVK_F;
  562. typedef struct tagKbdNlsLayer {
  563. USHORT OEMIdentifier;
  564. USHORT LayoutInformation;
  565. UINT NumOfVkToF;
  566. PVK_F pVkToF;
  567. //
  568. // The pusMouseVKey array provides a translation from the virtual key
  569. // value to an index. The index is used to select the appropriate
  570. // routine to process the virtual key, as well as to select extra
  571. // information that is used by this routine during its processing.
  572. // If this value is NULL, following default will be used.
  573. //
  574. // ausMouseVKey[] = {
  575. // VK_CLEAR, // Numpad 5: Click active button
  576. // VK_PRIOR, // Numpad 9: Up & Right
  577. // VK_NEXT, // Numpad 3: Down & Right
  578. // VK_END, // Numpad 1: Down & Left
  579. // VK_HOME, // Numpad 7: Up & Left
  580. // VK_LEFT, // Numpad 4: Left
  581. // VK_UP, // Numpad 8: Up
  582. // VK_RIGHT, // Numpad 6: Right
  583. // VK_DOWN, // Numpad 2: Down
  584. // VK_INSERT, // Numpad 0: Active button down
  585. // VK_DELETE, // Numpad .: Active button up
  586. // VK_MULTIPLY, // Numpad *: Select both buttons
  587. // VK_ADD, // Numpad +: Double click active button
  588. // VK_SUBTRACT, // Numpad -: Select right button
  589. // VK_DEVIDE|KBDEXT, // Numpad /: Select left button
  590. // VK_NUMLOCK|KBDEXT}; // Num Lock
  591. //
  592. INT NumOfMouseVKey;
  593. USHORT *KBD_LONG_POINTER pusMouseVKey;
  594. } KBDNLSTABLES, *KBD_LONG_POINTER PKBDNLSTABLES;
  595. /*
  596. * The maximum number of layout tables in a DLL
  597. */
  598. #define KBDTABLE_MULTI_MAX (8)
  599. /*
  600. * Multiple keyboard layout table in a DLL
  601. */
  602. typedef struct tagKBDTABLE_DESC {
  603. WCHAR wszDllName[32];
  604. DWORD dwType; // Keyboard type ID
  605. DWORD dwSubType; // Combined SubType ID (OEMID : SubType)
  606. } KBDTABLE_DESC, *KBD_LONG_POINTER PKBDTABLE_DESC;
  607. typedef struct tagKBDTABLE_MULTI {
  608. UINT nTables;
  609. KBDTABLE_DESC aKbdTables[KBDTABLE_MULTI_MAX];
  610. } KBDTABLE_MULTI, *KBD_LONG_POINTER PKBDTABLE_MULTI;
  611. /*
  612. * Format of the registry value for the Dynamic Layout Switching
  613. */
  614. typedef struct tagKBD_TYPE_INFO {
  615. DWORD dwVersion;
  616. DWORD dwType;
  617. DWORD dwSubType;
  618. } KBD_TYPE_INFO, *PKBD_TYPE_INFO;
  619. //
  620. // Keyboard type
  621. //
  622. #define KEYBOARD_TYPE_GENERIC_101 (4)
  623. //
  624. // Keyboard Type = 7 : Japanese Keyboard
  625. // Keyboard Type = 8 : Korean Keyboard
  626. //
  627. #define KEYBOARD_TYPE_JAPAN (7)
  628. #define KEYBOARD_TYPE_KOREA (8)
  629. // Unknown keyboard type
  630. #define KEYBOARD_TYPE_UNKNOWN (0x51)
  631. //
  632. // OEM Ids - KBDNLSTABLES.OEMIdentifier
  633. //
  634. // PSS ID Number: Q130054
  635. // Article last modified on 05-16-1995
  636. //
  637. // 3.10 1.20 | 3.50 1.20
  638. // WINDOWS | WINDOWS NT
  639. //
  640. // ---------------------------------------------------------------------
  641. // The information in this article applies to:
  642. // - Microsoft Windows Software Development Kit (SDK) for Windows
  643. // version 3.1
  644. // - Microsoft Win32 Software Development Kit (SDK) version 3.5
  645. // - Microsoft Win32s version 1.2
  646. // ---------------------------------------------------------------------
  647. // SUMMARY
  648. // =======
  649. // Because of the variety of computer manufacturers (NEC, Fujitsu, IBMJ, and
  650. // so on) in Japan, sometimes Windows-based applications need to know which
  651. // OEM (original equipment manufacturer) manufactured the computer that is
  652. // running the application. This article explains how.
  653. //
  654. // MORE INFORMATION
  655. // ================
  656. // There is no documented way to detect the manufacturer of the computer that
  657. // is currently running an application. However, a Windows-based application
  658. // can detect the type of OEM Windows by using the return value of the
  659. // GetKeyboardType() function.
  660. //
  661. // If an application uses the GetKeyboardType API, it can get OEM ID by
  662. // specifying "1" (keyboard subtype) as argument of the function. Each OEM ID
  663. // is listed here:
  664. //
  665. // OEM Windows OEM ID
  666. // ------------------------------
  667. // Microsoft 00H (DOS/V)
  668. // all AX 01H
  669. // EPSON 04H
  670. // Fujitsu 05H
  671. // IBMJ 07H
  672. // Matsushita 0AH
  673. // NEC 0DH
  674. // Toshiba 12H
  675. //
  676. // Application programs can use these OEM IDs to distinguish the type of OEM
  677. // Windows. Note, however, that this method is not documented, so Microsoft
  678. // may not support it in the future version of Windows.
  679. //
  680. // As a rule, application developers should write hardware-independent code,
  681. // especially when making Windows-based applications. If they need to make a
  682. // hardware-dependent application, they must prepare the separated program
  683. // file for each different hardware architecture.
  684. //
  685. // Additional reference words: 3.10 1.20 3.50 1.20 kbinf
  686. // KBCategory: kbhw
  687. // KBSubcategory: wintldev
  688. // =============================================================================
  689. // Copyright (c) Microsoft Corporation. All rights reserved.
  690. //
  691. #define NLSKBD_OEM_MICROSOFT 0x00
  692. #define NLSKBD_OEM_AX 0x01
  693. #define NLSKBD_OEM_EPSON 0x04
  694. #define NLSKBD_OEM_FUJITSU 0x05
  695. #define NLSKBD_OEM_IBM 0x07
  696. #define NLSKBD_OEM_MATSUSHITA 0x0A
  697. #define NLSKBD_OEM_NEC 0x0D
  698. #define NLSKBD_OEM_TOSHIBA 0x12
  699. #define NLSKBD_OEM_DEC 0x18 // only NT
  700. //
  701. // Microsoft (default) - keyboards hardware/layout
  702. //
  703. #define MICROSOFT_KBD_101_TYPE 0
  704. #define MICROSOFT_KBD_AX_TYPE 1
  705. #define MICROSOFT_KBD_106_TYPE 2
  706. #define MICROSOFT_KBD_002_TYPE 3
  707. #define MICROSOFT_KBD_001_TYPE 4
  708. #define MICROSOFT_KBD_FUNC 12
  709. //
  710. // AX consortium - keyboards hardware/layout
  711. //
  712. #define AX_KBD_DESKTOP_TYPE 1
  713. //
  714. // Fujitsu - keyboards hardware/layout
  715. //
  716. #define FMR_KBD_JIS_TYPE 0
  717. #define FMR_KBD_OASYS_TYPE 1
  718. #define FMV_KBD_OASYS_TYPE 2
  719. //
  720. // NEC - keyboards hardware/layout
  721. //
  722. #define NEC_KBD_NORMAL_TYPE 1
  723. #define NEC_KBD_N_MODE_TYPE 2
  724. #define NEC_KBD_H_MODE_TYPE 3
  725. #define NEC_KBD_LAPTOP_TYPE 4
  726. #define NEC_KBD_106_TYPE 5
  727. //
  728. // Toshiba - keyboards hardware/layout
  729. //
  730. #define TOSHIBA_KBD_DESKTOP_TYPE 13
  731. #define TOSHIBA_KBD_LAPTOP_TYPE 15
  732. //
  733. // DEC - keyboards hardware/layout
  734. //
  735. #define DEC_KBD_ANSI_LAYOUT_TYPE 1 // only NT
  736. #define DEC_KBD_JIS_LAYOUT_TYPE 2 // only NT
  737. //
  738. // Korean keyboard subtype
  739. //
  740. #define MICROSOFT_KBD_101A_TYPE MICROSOFT_KBD_101_TYPE
  741. #define MICROSOFT_KBD_101B_TYPE 4
  742. #define MICROSOFT_KBD_101C_TYPE 5
  743. #define MICROSOFT_KBD_103_TYPE 6
  744. //
  745. // Keyboard layout information - KBDNLSTABLE.LayoutInformation
  746. //
  747. //
  748. // If this flag is on, System sends notification to keyboard
  749. // drivers (leyout/kernel mode). when IME (Input-Mehod-Editor)
  750. // status become changed.
  751. //
  752. #define NLSKBD_INFO_SEND_IME_NOTIFICATION 0x0001
  753. //
  754. // If this flag is on, System will use VK_HOME/VK_KANA instead of
  755. // VK_NUMLOCK/VK_SCROLL for Accessibility toggle keys.
  756. // + Typically, NEC PC-9800 Series will use this bit, because
  757. // they does not have 'NumLock' and 'ScrollLock' keys.
  758. //
  759. #define NLSKBD_INFO_ACCESSIBILITY_KEYMAP 0x0002
  760. //
  761. // If this flag is on, System will return 101 or 106 Japanese
  762. // keyboard type/subtype id, when GetKeyboardType() is called.
  763. //
  764. #define NLSKBD_INFO_EMURATE_101_KEYBOARD 0x0010
  765. #define NLSKBD_INFO_EMURATE_106_KEYBOARD 0x0020
  766. //
  767. // Keyboard layout function types
  768. //
  769. // - VK_F.NLSFEProcType
  770. //
  771. #define KBDNLS_TYPE_NULL 0
  772. #define KBDNLS_TYPE_NORMAL 1
  773. #define KBDNLS_TYPE_TOGGLE 2
  774. //
  775. // - VK_F.NLSFEProcCurrent
  776. //
  777. #define KBDNLS_INDEX_NORMAL 1
  778. #define KBDNLS_INDEX_ALT 2
  779. //
  780. // - VK_F.NLSFEProc[]
  781. //
  782. #define KBDNLS_NULL 0 // Invalid function
  783. #define KBDNLS_NOEVENT 1 // Drop keyevent
  784. #define KBDNLS_SEND_BASE_VK 2 // Send Base VK_xxx
  785. #define KBDNLS_SEND_PARAM_VK 3 // Send Parameter VK_xxx
  786. #define KBDNLS_KANALOCK 4 // VK_KANA (with hardware lock)
  787. #define KBDNLS_ALPHANUM 5 // VK_DBE_ALPHANUMERIC
  788. #define KBDNLS_HIRAGANA 6 // VK_DBE_HIRAGANA
  789. #define KBDNLS_KATAKANA 7 // VK_DBE_KATAKANA
  790. #define KBDNLS_SBCSDBCS 8 // VK_DBE_SBCSCHAR/VK_DBE_DBCSCHAR
  791. #define KBDNLS_ROMAN 9 // VK_DBE_ROMAN/VK_DBE_NOROMAN
  792. #define KBDNLS_CODEINPUT 10 // VK_DBE_CODEINPUT/VK_DBE_NOCODEINPUT
  793. #define KBDNLS_HELP_OR_END 11 // VK_HELP or VK_END [NEC PC-9800 Only]
  794. #define KBDNLS_HOME_OR_CLEAR 12 // VK_HOME or VK_CLEAR [NEC PC-9800 Only]
  795. #define KBDNLS_NUMPAD 13 // VK_NUMPAD? for Numpad key [NEC PC-9800 Only]
  796. #define KBDNLS_KANAEVENT 14 // VK_KANA [Fujitsu FMV oyayubi Only]
  797. #define KBDNLS_CONV_OR_NONCONV 15 // VK_CONVERT and VK_NONCONVERT [Fujitsu FMV oyayubi Only]
  798. #define JAPANESE_KEYBOARD(Id) ((Id).Type == KEYBOARD_TYPE_JAPAN)
  799. #define KOREAN_KEYBOARD(Id) ((Id).Type == KEYBOARD_TYPE_KOREA)
  800. // Fujitsu Oyayubi-shift keyboard
  801. #define FUJITSU_KBD_CONSOLE(Id) (JAPANESE_KEYBOARD(Id) && \
  802. (Id).Subtype == ((NLSKBD_OEM_FUJITSU<<4)|FMV_KBD_OASYS_TYPE))
  803. // This number 0x00020002 is registered in registry key as
  804. // HKLM\System\CurrentControlSet\Control\Terminal Server\KeyboardType Mapping\JPN
  805. #define FUJITSU_KBD_REMOTE(Id) (JAPANESE_KEYBOARD(Id) && \
  806. (Id).SubType == 0x00020002)
  807. #define KBD_LAYOUT_LANG(hkl) (PRIMARYLANGID(HandleToUlong(hkl)))
  808. #define JAPANESE_KBD_LAYOUT(hkl) (KBD_LAYOUT_LANG(hkl) == LANG_JAPANESE)
  809. #define KOREAN_KBD_LAYOUT(hkl) (KBD_LAYOUT_LANG(hkl) == LANG_KOREAN)
  810. // end of FE specific
  811. /***************************************************************************\
  812. * Macros for ausVK[] values (used below)
  813. *
  814. * These macros prefix each argument with VK_ to produce the name of a Virtual
  815. * Key defined in "winuser.h" (eg: ESCAPE becomes VK_ESCAPE).
  816. \***************************************************************************/
  817. #ifndef KBD_TYPE
  818. #define KBD_TYPE 4
  819. #endif
  820. /*
  821. * _NE() selects the Virtual Key according to keyboard type
  822. */
  823. #if (KBD_TYPE == 1)
  824. #define _NE(v1,v2,v3,v4,v5,v6) (VK_##v1)
  825. #elif (KBD_TYPE == 2)
  826. #define _NE(v1,v2,v3,v4,v5,v6) (VK_##v2)
  827. #elif (KBD_TYPE == 3)
  828. #define _NE(v1,v2,v3,v4,v5,v6) (VK_##v3)
  829. #elif (KBD_TYPE == 4)
  830. #define _NE(v1,v2,v3,v4,v5,v6) (VK_##v4)
  831. #elif (KBD_TYPE == 5)
  832. #define _NE(v1,v2,v3,v4,v5,v6) (VK_##v5)
  833. #elif (KBD_TYPE == 6)
  834. #define _NE(v1,v2,v3,v4,v5,v6) (VK_##v6)
  835. #elif (KBD_TYPE == 7)
  836. #define _NE(v7,v8,v16,v10,v11,v12,v13) (VK_##v7)
  837. #elif (KBD_TYPE == 8)
  838. #define _NE(v7,v8,v16,v10,v11,v12,v13) (VK_##v8)
  839. #elif (KBD_TYPE == 10)
  840. #define _NE(v7,v8,v16,v10,v11,v12,v13) (VK_##v10)
  841. #elif (KBD_TYPE == 11)
  842. #define _NE(v7,v8,v16,v10,v11,v12,v13) (VK_##v11)
  843. #elif (KBD_TYPE == 12)
  844. #define _NE(v7,v8,v16,v10,v11,v12,v13) (VK_##v12)
  845. #elif (KBD_TYPE == 13)
  846. #define _NE(v7,v8,v16,v10,v11,v12,v13) (VK_##v13)
  847. #elif (KBD_TYPE == 16)
  848. #define _NE(v7,v8,v16,v10,v11,v12,v13) (VK_##v16)
  849. #elif (KBD_TYPE == 20)
  850. #define _NE(v20,v21,v22) (VK_##v20)
  851. #elif (KBD_TYPE == 21)
  852. #define _NE(v20,v21,v22) (VK_##v21)
  853. #elif (KBD_TYPE == 22)
  854. #define _NE(v20,v21,v22) (VK_##v22)
  855. #elif (KBD_TYPE == 30)
  856. #define _NE(v30,v33,v34) (VK_##v30)
  857. #elif (KBD_TYPE == 33)
  858. #define _NE(v30,v33,v34) (VK_##v33)
  859. #elif (KBD_TYPE == 34)
  860. #define _NE(v30,v33,v34) (VK_##v34)
  861. #elif (KBD_TYPE == 40)
  862. #define _NE(v40,v41) (VK_##v40)
  863. #elif (KBD_TYPE == 41)
  864. #define _NE(v40,v41) (VK_##v41)
  865. #endif
  866. /*
  867. * _EQ() selects the same Virtual Key for all keyboard types
  868. */
  869. #if (KBD_TYPE <= 6)
  870. #define _EQ( v4 ) (VK_##v4)
  871. #elif (KBD_TYPE >= 7) && (KBD_TYPE <= 16)
  872. #define _EQ( v8 ) (VK_##v8)
  873. #elif (KBD_TYPE > 20) && (KBD_TYPE <= 22)
  874. #define _EQ(v20 ) (VK_##v20)
  875. #elif (KBD_TYPE >= 30) && (KBD_TYPE <= 34)
  876. #define _EQ( v30 ) (VK_##v30)
  877. #elif (KBD_TYPE == 37)
  878. #define _EQ( v37 ) (VK_##v37)
  879. #elif (KBD_TYPE >= 40) && (KBD_TYPE <= 41)
  880. #define _EQ( v40 ) (VK_##v40)
  881. #endif
  882. /*
  883. * A bit of trickery for virtual key names 'A' to 'Z' and '0' to '9' so
  884. * that they are not converted to a VK_* name.
  885. * With this macro, VK_'A' equates to 'A' etc.
  886. */
  887. #define VK_
  888. #define VK__none_ 0xFF
  889. #define VK_ABNT_C1 0xC1
  890. #define VK_ABNT_C2 0xC2
  891. #if (KBD_TYPE <= 6)
  892. /***************************************************************************\
  893. * T** - Values for ausVK[] (Virtual Scan Code to Virtual Key conversion)
  894. *
  895. * These values are for Scancode Set 3 and the USA.
  896. * Other languages substitute their own values where required (files kbd**.h)
  897. *
  898. * Six sets of keyboards are supported, according to KBD_TYPE:
  899. *
  900. * KBD_TYPE Keyboard (examples)
  901. * ======== =======================================================
  902. * 1 AT&T '301' & '302'; Olivetti 83-key; PC-XT 84-key; etc.
  903. * 2 Olivetti M24 102-key
  904. * 3 HP Vectra (DIN); Olivetti 86-key; etc.
  905. * 4 * Enhanced 101/102-key; Olivetti A; etc.
  906. * 5 Nokia (Ericsson) type 5 (1050, etc.)
  907. * 6 Nokia (Ericsson) type 6 (9140)
  908. *
  909. * * If KBD_TYPE is not defined, the default is type 4.
  910. *
  911. * KB3270 comments refers to KB 3270 keyboards in native emulation mode (DIP
  912. * switches all OFF), and the Scancode Map used to convert its scancodes to
  913. * standard scancode set 1.
  914. * KB3270 <= 57 - this entry is reached by mapping from scancode 0x57
  915. * to an arbitrary scancode: the VK is what counts
  916. * KB3270 => HOME - this scancode is mapped to the scancode for VK_HOME
  917. * KB3270 - no mapping involved, a scancode for KB3270 only
  918. *
  919. * _EQ() : all keyboard types have the same virtual key for this scancode
  920. * _NE() : different virtual keys for this scancode, depending on kbd type
  921. *
  922. * +------+ +--------+--------+--------+--------+--------+--------+
  923. * | Scan | | kbd | kbd | kbd | kbd | kbd | kbd |
  924. * | code | | type 1 | type 2 | type 3 | type 4 | type 5 | type 6 |
  925. \****+-------+-+--------+--------+--------+--------+--------+--------+******/
  926. #define T00 _EQ( _none_ )
  927. #define T01 _EQ( ESCAPE )
  928. #define T02 _EQ( '1' )
  929. #define T03 _EQ( '2' )
  930. #define T04 _EQ( '3' )
  931. #define T05 _EQ( '4' )
  932. #define T06 _EQ( '5' )
  933. #define T07 _EQ( '6' )
  934. #define T08 _EQ( '7' )
  935. #define T09 _EQ( '8' )
  936. #define T0A _EQ( '9' )
  937. #define T0B _EQ( '0' )
  938. #define T0C _EQ( OEM_MINUS )
  939. #define T0D _NE(OEM_PLUS,OEM_4, OEM_PLUS,OEM_PLUS,OEM_PLUS,OEM_PLUS)
  940. #define T0E _EQ( BACK )
  941. #define T0F _EQ( TAB )
  942. #define T10 _EQ( 'Q' )
  943. #define T11 _EQ( 'W' )
  944. #define T12 _EQ( 'E' )
  945. #define T13 _EQ( 'R' )
  946. #define T14 _EQ( 'T' )
  947. #define T15 _EQ( 'Y' )
  948. #define T16 _EQ( 'U' )
  949. #define T17 _EQ( 'I' )
  950. #define T18 _EQ( 'O' )
  951. #define T19 _EQ( 'P' )
  952. #define T1A _NE(OEM_4, OEM_6, OEM_4, OEM_4, OEM_4, OEM_4 )
  953. #define T1B _NE(OEM_6, OEM_1, OEM_6, OEM_6, OEM_6, OEM_6 )
  954. #define T1C _EQ( RETURN )
  955. #define T1D _EQ( LCONTROL )
  956. #define T1E _EQ( 'A' )
  957. #define T1F _EQ( 'S' )
  958. #define T20 _EQ( 'D' )
  959. #define T21 _EQ( 'F' )
  960. #define T22 _EQ( 'G' )
  961. #define T23 _EQ( 'H' )
  962. #define T24 _EQ( 'J' )
  963. #define T25 _EQ( 'K' )
  964. #define T26 _EQ( 'L' )
  965. #define T27 _NE(OEM_1, OEM_PLUS,OEM_1, OEM_1, OEM_1, OEM_1 )
  966. #define T28 _NE(OEM_7, OEM_3, OEM_7, OEM_7, OEM_3, OEM_3 )
  967. #define T29 _NE(OEM_3, OEM_7, OEM_3, OEM_3, OEM_7, OEM_7 )
  968. #define T2A _EQ( LSHIFT )
  969. #define T2B _EQ( OEM_5 )
  970. #define T2C _EQ( 'Z' )
  971. #define T2D _EQ( 'X' )
  972. #define T2E _EQ( 'C' )
  973. #define T2F _EQ( 'V' )
  974. #define T30 _EQ( 'B' )
  975. #define T31 _EQ( 'N' )
  976. #define T32 _EQ( 'M' )
  977. #define T33 _EQ( OEM_COMMA )
  978. #define T34 _EQ( OEM_PERIOD )
  979. #define T35 _EQ( OEM_2 )
  980. #define T36 _EQ( RSHIFT )
  981. #define T37 _EQ( MULTIPLY )
  982. #define T38 _EQ( LMENU )
  983. #define T39 _EQ( ' ' )
  984. #define T3A _EQ( CAPITAL )
  985. #define T3B _EQ( F1 )
  986. #define T3C _EQ( F2 )
  987. #define T3D _EQ( F3 )
  988. #define T3E _EQ( F4 )
  989. #define T3F _EQ( F5 )
  990. #define T40 _EQ( F6 )
  991. #define T41 _EQ( F7 )
  992. #define T42 _EQ( F8 )
  993. #define T43 _EQ( F9 )
  994. #define T44 _EQ( F10 )
  995. #define T45 _EQ( NUMLOCK )
  996. #define T46 _EQ( SCROLL )
  997. #define T47 _EQ( HOME )
  998. #define T48 _EQ( UP )
  999. #define T49 _EQ( PRIOR )
  1000. #define T4A _EQ( SUBTRACT )
  1001. #define T4B _EQ( LEFT )
  1002. #define T4C _EQ( CLEAR )
  1003. #define T4D _EQ( RIGHT )
  1004. #define T4E _EQ( ADD )
  1005. #define T4F _EQ( END )
  1006. #define T50 _EQ( DOWN )
  1007. #define T51 _EQ( NEXT )
  1008. #define T52 _EQ( INSERT )
  1009. #define T53 _EQ( DELETE )
  1010. #define T54 _EQ( SNAPSHOT )
  1011. #define T55 _EQ( _none_ ) // KB3270 => DOWN
  1012. #define T56 _NE(OEM_102, HELP, OEM_102, OEM_102, _none_, OEM_PA2 ) // KB3270 => LEFT
  1013. #define T57 _NE(F11, RETURN, F11, F11, _none_, HELP ) // KB3270 => ZOOM
  1014. #define T58 _NE(F12, LEFT, F12, F12, _none_, OEM_102 ) // KB3270 => HELP
  1015. #define T59 _EQ( CLEAR )
  1016. #define T5A _EQ( OEM_WSCTRL )// WSCtrl
  1017. #define T5B _EQ( OEM_FINISH )// Finish
  1018. #define T5C _EQ( OEM_JUMP )// Jump
  1019. #define T5D _EQ( EREOF )
  1020. #define T5E _EQ( OEM_BACKTAB ) // KB3270 <= 7E
  1021. #define T5F _EQ( OEM_AUTO ) // KB3270
  1022. #define T60 _EQ( _none_ )
  1023. #define T61 _EQ( _none_ )
  1024. #define T62 _EQ( ZOOM ) // KB3270 <= 57
  1025. #define T63 _EQ( HELP ) // KB3270 <= 58
  1026. #define T64 _EQ( F13 )
  1027. #define T65 _EQ( F14 )
  1028. #define T66 _EQ( F15 )
  1029. #define T67 _EQ( F16 )
  1030. #define T68 _EQ( F17 )
  1031. #define T69 _EQ( F18 )
  1032. #define T6A _EQ( F19 )
  1033. #define T6B _EQ( F20 )
  1034. #define T6C _EQ( F21 )
  1035. #define T6D _EQ( F22 )
  1036. #define T6E _EQ( F23 )
  1037. #define T6F _EQ( OEM_PA3 ) // KB3270
  1038. #define T70 _EQ( _none_ )
  1039. #define T71 _EQ( OEM_RESET ) // KB3270
  1040. #define T72 _EQ( _none_ )
  1041. #define T73 _EQ( ABNT_C1 )
  1042. #define T74 _EQ( _none_ )
  1043. #define T75 _EQ( _none_ ) // KB3270 => RETURN
  1044. #define T76 _EQ( F24 )
  1045. #define T77 _EQ( _none_ ) // KB3270 => HOME
  1046. #define T78 _EQ( _none_ ) // KB3270 => UP
  1047. #define T79 _EQ( _none_ ) // KB3270 => DELETE
  1048. #define T7A _EQ( _none_ ) // KB3270 => INSERT
  1049. #define T7B _EQ( OEM_PA1 ) // KB3270
  1050. #define T7C _EQ( TAB ) // KB3270 => TAB
  1051. #define T7D _EQ( _none_ ) // KB3270 => RIGHT
  1052. #define T7E _EQ( ABNT_C2 ) // KB3270 => BACKTAB
  1053. #define T7F _EQ( OEM_PA2 ) // KB3270
  1054. #define X10 _EQ( MEDIA_PREV_TRACK ) // SpeedRacer
  1055. #define X19 _EQ( MEDIA_NEXT_TRACK ) // SpeedRacer
  1056. #define X1C _EQ( RETURN )
  1057. #define X1D _EQ( RCONTROL )
  1058. #define X20 _EQ( VOLUME_MUTE ) // SpeedRacer
  1059. #define X21 _EQ( LAUNCH_APP2 ) // SpeedRacer (Calculator?)
  1060. #define X22 _EQ( MEDIA_PLAY_PAUSE ) // SpeedRacer
  1061. #define X24 _EQ( MEDIA_STOP ) // SpeedRacer
  1062. #define X2E _EQ( VOLUME_DOWN ) // SpeedRacer
  1063. #define X30 _EQ( VOLUME_UP ) // SpeedRacer
  1064. #define X32 _EQ( BROWSER_HOME ) // SpeedRacer
  1065. #define X35 _EQ( DIVIDE )
  1066. #define X37 _EQ( SNAPSHOT )
  1067. #define X38 _EQ( RMENU )
  1068. #define X46 _EQ( CANCEL )
  1069. #define X47 _EQ( HOME )
  1070. #define X48 _EQ( UP )
  1071. #define X49 _EQ( PRIOR )
  1072. #define X4B _EQ( LEFT )
  1073. #define X4D _EQ( RIGHT )
  1074. #define X4F _EQ( END )
  1075. #define X50 _EQ( DOWN )
  1076. #define X51 _NE(NEXT, F1, NEXT, NEXT, _none_, OEM_PA2 )
  1077. #define X52 _EQ( INSERT )
  1078. #define X53 _EQ( DELETE )
  1079. #define X5B _EQ( LWIN )
  1080. #define X5C _EQ( RWIN )
  1081. #define X5D _EQ( APPS )
  1082. #define X5E _EQ( POWER )
  1083. #define X5F _EQ( SLEEP ) // SpeedRacer
  1084. #define X65 _EQ( BROWSER_SEARCH ) // SpeedRacer
  1085. #define X66 _EQ( BROWSER_FAVORITES ) // SpeedRacer
  1086. #define X67 _EQ( BROWSER_REFRESH ) // SpeedRacer
  1087. #define X68 _EQ( BROWSER_STOP ) // SpeedRacer
  1088. #define X69 _EQ( BROWSER_FORWARD ) // SpeedRacer
  1089. #define X6A _EQ( BROWSER_BACK ) // SpeedRacer
  1090. #define X6B _EQ( LAUNCH_APP1 ) // SpeedRacer (my computer?)
  1091. #define X6C _EQ( LAUNCH_MAIL ) // SpeedRacer
  1092. #define X6D _EQ( LAUNCH_MEDIA_SELECT ) // SpeedRacer
  1093. /*
  1094. * The break key is sent to us as E1,LCtrl,NumLock
  1095. * We must convert the E1+LCtrl to BREAK, then ignore the Numlock
  1096. */
  1097. #define Y1D _EQ( PAUSE )
  1098. #elif (KBD_TYPE >= 7) && (KBD_TYPE <= 16)
  1099. /***********************************************************************************\
  1100. * T** - Values for ausVK[] (Virtual Scan Code to Virtual Key conversion)
  1101. *
  1102. * Three sets of keyboards are supported, according to KBD_TYPE:
  1103. *
  1104. * KBD_TYPE Keyboard (examples)
  1105. * ======== =====================================
  1106. * 7 Japanese IBM type 002 keyboard.
  1107. * 8 * Japanese OADG (106) keyboard.
  1108. * 10 Korean 101 (type A) keyboard.
  1109. * 11 Korean 101 (type B) keyboard.
  1110. * 12 Korean 101 (type C) keyboard.
  1111. * 13 Korean 103 keyboard.
  1112. * 16 Japanese AX keyboard.
  1113. *
  1114. * +------+ +----------+----------+----------+----------+----------+----------+----------+
  1115. * | Scan | | kbd | kbd | kbd | kbd | kbd | kbd | kbd |
  1116. * | code | | type 7 | type 8 | type 16 | type 10 | type 11 | type 12 | type 13 |
  1117. \****+-------+-+----------+----------+----------+----------+----------+----------+----------+*/
  1118. #define T00 _EQ( _none_ )
  1119. #define T01 _EQ( ESCAPE )
  1120. #define T02 _EQ( '1' )
  1121. #define T03 _EQ( '2' )
  1122. #define T04 _EQ( '3' )
  1123. #define T05 _EQ( '4' )
  1124. #define T06 _EQ( '5' )
  1125. #define T07 _EQ( '6' )
  1126. #define T08 _EQ( '7' )
  1127. #define T09 _EQ( '8' )
  1128. #define T0A _EQ( '9' )
  1129. #define T0B _EQ( '0' )
  1130. #define T0C _EQ( OEM_MINUS )
  1131. #define T0D _NE(OEM_7, OEM_7, OEM_PLUS, OEM_PLUS, OEM_PLUS, OEM_PLUS, OEM_PLUS )
  1132. #define T0E _EQ( BACK )
  1133. #define T0F _EQ( TAB )
  1134. #define T10 _EQ( 'Q' )
  1135. #define T11 _EQ( 'W' )
  1136. #define T12 _EQ( 'E' )
  1137. #define T13 _EQ( 'R' )
  1138. #define T14 _EQ( 'T' )
  1139. #define T15 _EQ( 'Y' )
  1140. #define T16 _EQ( 'U' )
  1141. #define T17 _EQ( 'I' )
  1142. #define T18 _EQ( 'O' )
  1143. #define T19 _EQ( 'P' )
  1144. #define T1A _NE(OEM_4, OEM_3, OEM_4, OEM_4, OEM_4, OEM_4, OEM_4 )
  1145. #define T1B _NE(OEM_6, OEM_4, OEM_6, OEM_6, OEM_6, OEM_6, OEM_6 )
  1146. #define T1C _EQ( RETURN )
  1147. #define T1D _EQ( LCONTROL )
  1148. #define T1E _EQ( 'A' )
  1149. #define T1F _EQ( 'S' )
  1150. #define T20 _EQ( 'D' )
  1151. #define T21 _EQ( 'F' )
  1152. #define T22 _EQ( 'G' )
  1153. #define T23 _EQ( 'H' )
  1154. #define T24 _EQ( 'J' )
  1155. #define T25 _EQ( 'K' )
  1156. #define T26 _EQ( 'L' )
  1157. #define T27 _NE(OEM_PLUS, OEM_PLUS, OEM_1, OEM_1, OEM_1, OEM_1, OEM_1 )
  1158. #define T28 _NE(OEM_1, OEM_1, OEM_7, OEM_7, OEM_7, OEM_7, OEM_7 )
  1159. #define T29 _NE(OEM_3, DBE_SBCSCHAR,OEM_3, OEM_3, OEM_3, OEM_3, OEM_3 )
  1160. #define T2A _EQ( LSHIFT )
  1161. #define T2B _NE(OEM_5, OEM_6, OEM_5, OEM_5, OEM_5, OEM_5, OEM_5 )
  1162. #define T2C _EQ( 'Z' )
  1163. #define T2D _EQ( 'X' )
  1164. #define T2E _EQ( 'C' )
  1165. #define T2F _EQ( 'V' )
  1166. #define T30 _EQ( 'B' )
  1167. #define T31 _EQ( 'N' )
  1168. #define T32 _EQ( 'M' )
  1169. #define T33 _EQ( OEM_COMMA )
  1170. #define T34 _EQ( OEM_PERIOD )
  1171. #define T35 _EQ( OEM_2 )
  1172. #define T36 _EQ( RSHIFT )
  1173. #define T37 _EQ( MULTIPLY )
  1174. #define T38 _EQ( LMENU )
  1175. #define T39 _EQ( ' ' )
  1176. #define T3A _NE(DBE_ALPHANUMERIC,DBE_ALPHANUMERIC,CAPITAL,CAPITAL,CAPITAL,CAPITAL,CAPITAL )
  1177. #define T3B _EQ( F1 )
  1178. #define T3C _EQ( F2 )
  1179. #define T3D _EQ( F3 )
  1180. #define T3E _EQ( F4 )
  1181. #define T3F _EQ( F5 )
  1182. #define T40 _EQ( F6 )
  1183. #define T41 _EQ( F7 )
  1184. #define T42 _EQ( F8 )
  1185. #define T43 _EQ( F9 )
  1186. #define T44 _EQ( F10 )
  1187. #define T45 _EQ( NUMLOCK )
  1188. #define T46 _EQ( SCROLL )
  1189. #define T47 _EQ( HOME )
  1190. #define T48 _EQ( UP )
  1191. #define T49 _EQ( PRIOR )
  1192. #define T4A _EQ( SUBTRACT )
  1193. #define T4B _EQ( LEFT )
  1194. #define T4C _EQ( CLEAR )
  1195. #define T4D _EQ( RIGHT )
  1196. #define T4E _EQ( ADD )
  1197. #define T4F _EQ( END )
  1198. #define T50 _EQ( DOWN )
  1199. #define T51 _EQ( NEXT )
  1200. #define T52 _EQ( INSERT )
  1201. #define T53 _EQ( DELETE )
  1202. #define T54 _EQ( SNAPSHOT )
  1203. #define T55 _EQ( _none_ )
  1204. #define T56 _NE(_none_, _none_, OEM_102, OEM_102, OEM_102, OEM_102, OEM_102 )
  1205. #define T57 _EQ( F11 )
  1206. #define T58 _EQ( F12 )
  1207. #define T59 _EQ( CLEAR )
  1208. #define T5A _NE(NONAME, NONAME, NONCONVERT,OEM_WSCTRL,OEM_WSCTRL,OEM_WSCTRL,OEM_WSCTRL)
  1209. #define T5B _NE(NONAME, NONAME, CONVERT, OEM_FINISH,OEM_FINISH,OEM_FINISH,OEM_FINISH)
  1210. #define T5C _NE(NONAME, NONAME, OEM_AX, OEM_JUMP, OEM_JUMP, OEM_JUMP, OEM_JUMP )
  1211. #define T5D _EQ( EREOF )
  1212. #define T5E _NE(_none_, _none_, _none_, OEM_BACKTAB,OEM_BACKTAB,OEM_BACKTAB,OEM_BACKTAB)
  1213. #define T5F _NE(NONAME, NONAME, NONAME, OEM_AUTO, OEM_AUTO, OEM_AUTO, OEM_AUTO )
  1214. #define T60 _EQ( _none_ )
  1215. #define T61 _NE(_none_, _none_, _none_, ZOOM, ZOOM, ZOOM, ZOOM )
  1216. #define T62 _NE(_none_, _none_, _none_, HELP, HELP, HELP, HELP )
  1217. #define T63 _EQ( _none_ )
  1218. #define T64 _EQ( F13 )
  1219. #define T65 _EQ( F14 )
  1220. #define T66 _EQ( F15 )
  1221. #define T67 _EQ( F16 )
  1222. #define T68 _EQ( F17 )
  1223. #define T69 _EQ( F18 )
  1224. #define T6A _EQ( F19 )
  1225. #define T6B _EQ( F20 )
  1226. #define T6C _EQ( F21 )
  1227. #define T6D _EQ( F22 )
  1228. #define T6E _EQ( F23 )
  1229. #define T6F _NE(_none_, _none_, _none_, OEM_PA3, OEM_PA3, OEM_PA3, OEM_PA3 )
  1230. #define T70 _NE(DBE_KATAKANA,DBE_HIRAGANA,_none_,_none_, _none_, _none_, _none_ )
  1231. #define T71 _NE(_none_, _none_, _none_, OEM_RESET, OEM_RESET, OEM_RESET, OEM_RESET )
  1232. #define T72 _EQ( _none_ )
  1233. #define T73 _NE(OEM_102, OEM_102, _none_, ABNT_C1, ABNT_C1, ABNT_C1, ABNT_C1 )
  1234. #define T74 _EQ( _none_ )
  1235. #define T75 _EQ( _none_ )
  1236. #define T76 _EQ( F24 )
  1237. #define T77 _NE(DBE_SBCSCHAR,_none_, _none_, _none_, _none_, _none_, _none_ )
  1238. #define T78 _EQ( _none_ )
  1239. #define T79 _NE(CONVERT, CONVERT, _none_, _none_, _none_, _none_, _none_ )
  1240. #define T7A _EQ( _none_ )
  1241. #define T7B _NE(NONCONVERT,NONCONVERT,_none_, OEM_PA1, OEM_PA1, OEM_PA1, OEM_PA1 )
  1242. #define T7C _EQ( TAB )
  1243. #define T7D _NE(_none_, OEM_5, _none_, _none_, _none_, _none_, _none_ )
  1244. #define T7E _EQ( ABNT_C2 )
  1245. #define T7F _EQ( OEM_PA2 )
  1246. #define X10 _EQ( MEDIA_PREV_TRACK ) // SpeedRacer
  1247. #define X19 _EQ( MEDIA_NEXT_TRACK ) // SpeedRacer
  1248. #define X1C _EQ( RETURN )
  1249. #define X1D _NE(RCONTROL, RCONTROL,DBE_KATAKANA,HANJA, HANGEUL, RCONTROL, RCONTROL )
  1250. #define X20 _EQ( VOLUME_MUTE ) // SpeedRacer
  1251. #define X21 _EQ( LAUNCH_APP2 ) // SpeedRacer
  1252. #define X22 _EQ( MEDIA_PLAY_PAUSE ) // SpeedRacer
  1253. #define X24 _EQ( MEDIA_STOP ) // SpeedRacer
  1254. #define X2E _EQ( VOLUME_DOWN ) // SpeedRacer
  1255. #define X30 _EQ( VOLUME_UP ) // SpeedRacer
  1256. #define X32 _EQ( BROWSER_HOME ) // SpeedRacer
  1257. #define X33 _NE(OEM_8, _none_, _none_, _none_, _none_, _none_, _none_ )
  1258. #define X35 _EQ( DIVIDE )
  1259. #define X37 _EQ( SNAPSHOT )
  1260. #define X38 _NE(DBE_HIRAGANA,RMENU, KANJI, HANGEUL, HANJA, RMENU, RMENU )
  1261. #define X42 _EQ( _none_ )
  1262. #define X43 _EQ( _none_ )
  1263. #define X44 _EQ( _none_ )
  1264. #define X46 _EQ( CANCEL )
  1265. #define X47 _EQ( HOME )
  1266. #define X48 _EQ( UP )
  1267. #define X49 _EQ( PRIOR )
  1268. #define X4B _EQ( LEFT )
  1269. #define X4D _EQ( RIGHT )
  1270. #define X4F _EQ( END )
  1271. #define X50 _EQ( DOWN )
  1272. #define X51 _EQ( NEXT )
  1273. #define X52 _EQ( INSERT )
  1274. #define X53 _EQ( DELETE )
  1275. #define X5B _EQ( LWIN )
  1276. #define X5C _EQ( RWIN )
  1277. #define X5D _EQ( APPS )
  1278. #define X5E _EQ( POWER )
  1279. #define X5F _EQ( SLEEP )
  1280. #define X65 _EQ( BROWSER_SEARCH ) // SpeedRacer
  1281. #define X66 _EQ( BROWSER_FAVORITES ) // SpeedRacer
  1282. #define X67 _EQ( BROWSER_REFRESH ) // SpeedRacer
  1283. #define X68 _EQ( BROWSER_STOP ) // SpeedRacer
  1284. #define X69 _EQ( BROWSER_FORWARD ) // SpeedRacer
  1285. #define X6A _EQ( BROWSER_BACK ) // SpeedRacer
  1286. #define X6B _EQ( LAUNCH_APP1 ) // SpeedRacer
  1287. #define X6C _EQ( LAUNCH_MAIL ) // SpeedRacer
  1288. #define X6D _EQ( LAUNCH_MEDIA_SELECT ) // SpeedRacer
  1289. #define XF1 _NE(_none_, _none_, _none_, HANJA, HANJA, HANJA, HANJA )
  1290. #define XF2 _NE(_none_, _none_, _none_, HANGEUL, HANGEUL, HANGEUL, HANGEUL )
  1291. /*
  1292. * The break key is sent to us as E1,LCtrl,NumLock
  1293. * We must convert the E1+LCtrl to BREAK, then ignore the Numlock
  1294. */
  1295. #define Y1D _EQ( PAUSE )
  1296. #elif (KBD_TYPE > 20) && (KBD_TYPE <= 22)
  1297. /***********************************************************************\
  1298. * T** - Values for ausVK[] (Virtual Scan Code to Virtual Key conversion)
  1299. *
  1300. * Three sets of keyboards are supported, according to KBD_TYPE:
  1301. *
  1302. * KBD_TYPE Keyboard (examples)
  1303. * ======== =====================================
  1304. * 20 Fujitsu FMR JIS keyboard.
  1305. * 21 Fujitsu FMR OYAYUBI keyboard.
  1306. * 22 * Fujitsu FMV OYAYUBI keyboard.
  1307. *
  1308. * +------+ +----------+----------+----------+
  1309. * | Scan | | kbd | kbd | kbd |
  1310. * | code | | type 20 | type 21 | type 22 |
  1311. \****+-------+-+----------+----------+----------+***********************/
  1312. #define T00 _EQ( _none_ )
  1313. #define T01 _EQ( ESCAPE )
  1314. #define T02 _EQ( '1' )
  1315. #define T03 _EQ( '2' )
  1316. #define T04 _EQ( '3' )
  1317. #define T05 _EQ( '4' )
  1318. #define T06 _EQ( '5' )
  1319. #define T07 _EQ( '6' )
  1320. #define T08 _EQ( '7' )
  1321. #define T09 _EQ( '8' )
  1322. #define T0A _EQ( '9' )
  1323. #define T0B _EQ( '0' )
  1324. #define T0C _EQ( OEM_MINUS )
  1325. #define T0D _EQ( OEM_7 )
  1326. #define T0E _NE(OEM_5, OEM_5, BACK )
  1327. #define T0F _NE(BACK, BACK, TAB )
  1328. #define T10 _NE(TAB, TAB, 'Q' )
  1329. #define T11 _NE('Q', 'Q', 'W' )
  1330. #define T12 _NE('W', 'W', 'E' )
  1331. #define T13 _NE('E', 'E', 'R' )
  1332. #define T14 _NE('R', 'R', 'T' )
  1333. #define T15 _NE('T', 'T', 'Y' )
  1334. #define T16 _NE('Y', 'Y', 'U' )
  1335. #define T17 _NE('U', 'U', 'I' )
  1336. #define T18 _NE('I', 'I', 'O' )
  1337. #define T19 _NE('O', 'O', 'P' )
  1338. #define T1A _NE('P', 'P', OEM_3 )
  1339. #define T1B _NE(OEM_3, OEM_3, OEM_4 )
  1340. #define T1C _NE(OEM_4, OEM_4, RETURN )
  1341. #define T1D _NE(RETURN, RETURN, LCONTROL )
  1342. #define T1E _EQ( 'A' )
  1343. #define T1F _EQ( 'S' )
  1344. #define T20 _EQ( 'D' )
  1345. #define T21 _EQ( 'F' )
  1346. #define T22 _EQ( 'G' )
  1347. #define T23 _EQ( 'H' )
  1348. #define T24 _EQ( 'J' )
  1349. #define T25 _EQ( 'K' )
  1350. #define T26 _EQ( 'L' )
  1351. #define T27 _EQ( OEM_PLUS )
  1352. #define T28 _EQ( OEM_1 )
  1353. #define T29 _NE(OEM_6, OEM_6, DBE_SBCSCHAR)
  1354. #define T2A _NE('Z', 'Z', LSHIFT )
  1355. #define T2B _NE('X', 'X', OEM_6 )
  1356. #define T2C _NE('C', 'C', 'Z' )
  1357. #define T2D _NE('V', 'V', 'X' )
  1358. #define T2E _NE('B', 'B', 'C' )
  1359. #define T2F _NE('N', 'N', 'V' )
  1360. #define T30 _NE('M', 'M', 'B' )
  1361. #define T31 _NE(OEM_COMMA, OEM_COMMA, 'N' )
  1362. #define T32 _NE(OEM_PERIOD,OEM_PERIOD,'M' )
  1363. #define T33 _NE(OEM_2, OEM_2, OEM_COMMA )
  1364. #define T34 _NE(OEM_8, OEM_8, OEM_PERIOD)
  1365. #define T35 _NE(' ', ' ', OEM_2 )
  1366. #define T36 _NE(MULTIPLY, MULTIPLY, RSHIFT )
  1367. #define T37 _NE(DIVIDE, DIVIDE, MULTIPLY )
  1368. #define T38 _NE(ADD, ADD, LMENU )
  1369. #define T39 _NE(SUBTRACT, SUBTRACT, ' ' )
  1370. #define T3A _NE(NUMPAD7, NUMPAD7, DBE_ALPHANUMERIC)
  1371. #define T3B _NE(NUMPAD8, NUMPAD8, F1 )
  1372. #define T3C _NE(NUMPAD9, NUMPAD9, F2 )
  1373. #define T3D _NE(EQUAL, EQUAL, F3 )
  1374. #define T3E _NE(NUMPAD4, NUMPAD4, F4 )
  1375. #define T3F _NE(NUMPAD5, NUMPAD5, F5 )
  1376. #define T40 _NE(NUMPAD6, NUMPAD6, F6 )
  1377. #define T41 _NE(SEPARATOR, SEPARATOR, F7 )
  1378. #define T42 _NE(NUMPAD1, NUMPAD1, F8 )
  1379. #define T43 _NE(NUMPAD2, NUMPAD2, F9 )
  1380. #define T44 _NE(NUMPAD3, NUMPAD3, F10 )
  1381. #define T45 _NE(RETURN, RETURN, NUMLOCK )
  1382. #define T46 _NE(NUMPAD0, NUMPAD0, SCROLL )
  1383. #define T47 _NE(DECIMAL, DECIMAL, HOME )
  1384. #define T48 _NE(INSERT, INSERT, UP )
  1385. #define T49 _NE(OEM_00, OEM_00, PRIOR )
  1386. #define T4A _NE(OEM_000, OEM_000, SUBTRACT )
  1387. #define T4B _NE(DELETE, DELETE, LEFT )
  1388. #define T4C _NE(_none_, _none_, CLEAR )
  1389. #define T4D _NE(UP, UP, RIGHT )
  1390. #define T4E _NE(HOME, HOME, ADD )
  1391. #define T4F _NE(LEFT, LEFT, END )
  1392. #define T50 _EQ( DOWN )
  1393. #define T51 _NE(RIGHT, RIGHT, NEXT )
  1394. #define T52 _NE(LCONTROL, LCONTROL, INSERT )
  1395. #define T53 _NE(LSHIFT, LSHIFT, DELETE )
  1396. #define T54 _NE(_none_, _none_, SNAPSHOT )
  1397. #define T55 _NE(CAPITAL, _none_, _none_ )
  1398. #define T56 _NE(DBE_HIRAGANA,_none_, _none_ )
  1399. #define T57 _NE(NONCONVERT,NONCONVERT,F11 )
  1400. #define T58 _NE(CONVERT, CONVERT, F12 )
  1401. #define T59 _NE(KANJI, KANJI, CLEAR )
  1402. #define T5A _NE(DBE_KATAKANA,_none_, NONAME )
  1403. #define T5B _NE(F12, F12, NONAME )
  1404. #define T5C _NE(LMENU, LMENU, NONAME )
  1405. #define T5D _NE(F1, F1, EREOF )
  1406. #define T5E _NE(F2, F2, _none_ )
  1407. #define T5F _NE(F3, F3, NONAME )
  1408. #define T60 _NE(F4, F4, _none_ )
  1409. #define T61 _NE(F5, F5, _none_ )
  1410. #define T62 _NE(F6, F6, _none_ )
  1411. #define T63 _NE(F7, F7, _none_ )
  1412. #define T64 _NE(F8, F8, F13 )
  1413. #define T65 _NE(F9, F9, F14 )
  1414. #define T66 _NE(F10, F10, F15 )
  1415. #define T67 _NE(_none_, OEM_LOYA, F16 )
  1416. #define T68 _NE(_none_, OEM_ROYA, F17 )
  1417. #define T69 _NE(F11, F11, F18 )
  1418. #define T6A _NE(_none_, DBE_ALPHANUMERIC,F19 )
  1419. #define T6B _NE(OEM_JISHO, OEM_JISHO, F20 )
  1420. #define T6C _NE(OEM_MASSHOU,OEM_MASSHOU,F21 )
  1421. #define T6D _NE(_none_, _none_, F22 )
  1422. #define T6E _NE(PRIOR, PRIOR, F23 )
  1423. #define T6F _NE(_none_, DBE_KATAKANA,_none_ )
  1424. #define T70 _NE(NEXT, NEXT, DBE_HIRAGANA)
  1425. #define T71 _EQ( _none_ )
  1426. #define T72 _NE(CANCEL, CANCEL, _none_ )
  1427. #define T73 _NE(EXECUTE, EXECUTE, OEM_102 )
  1428. #define T74 _NE(F13, F13, _none_ )
  1429. #define T75 _NE(F14, F14, _none_ )
  1430. #define T76 _NE(F15, F15, F24 )
  1431. #define T77 _NE(F16, F16, _none_ )
  1432. #define T78 _NE(CLEAR, CLEAR, _none_ )
  1433. #define T79 _NE(HELP, HELP, CONVERT )
  1434. #define T7A _NE(END, END, _none_ )
  1435. #define T7B _NE(SCROLL, SCROLL, NONCONVERT)
  1436. #define T7C _NE(PAUSE, PAUSE, TAB )
  1437. #define T7D _NE(SNAPSHOT, SNAPSHOT, OEM_5 )
  1438. #define T7E _NE(_none_, _none_, ABNT_C2 )
  1439. #define T7F _NE(_none_, _none_, OEM_PA2 )
  1440. #define X1C _NE(_none_, _none_, RETURN )
  1441. #define X1D _NE(_none_, _none_, RCONTROL )
  1442. #define X33 _EQ( _none_ )
  1443. #define X35 _NE(_none_, _none_, DIVIDE )
  1444. #define X37 _NE(_none_, _none_, SNAPSHOT )
  1445. #define X38 _NE(_none_, _none_, RMENU )
  1446. #define X42 _EQ( _none_ )
  1447. #define X43 _EQ( _none_ )
  1448. #define X44 _EQ( _none_ )
  1449. #define X46 _NE(_none_, _none_, CANCEL )
  1450. #define X47 _NE(_none_, _none_, HOME )
  1451. #define X48 _NE(_none_, _none_, UP )
  1452. #define X49 _NE(_none_, _none_, PRIOR )
  1453. #define X4B _NE(_none_, _none_, LEFT )
  1454. #define X4D _NE(_none_, _none_, RIGHT )
  1455. #define X4F _NE(_none_, _none_, END )
  1456. #define X50 _NE(_none_, _none_, DOWN )
  1457. #define X51 _NE(_none_, _none_, NEXT )
  1458. #define X52 _NE(_none_, _none_, INSERT )
  1459. #define X53 _NE(_none_, _none_, DELETE )
  1460. #define X5B _NE(_none_, _none_, LWIN )
  1461. #define X5C _NE(_none_, _none_, RWIN )
  1462. #define X5D _NE(_none_, _none_, APPS )
  1463. #define X5E _EQ( POWER )
  1464. #define X5F _EQ( SLEEP )
  1465. #define X60 _NE(SCROLL, SCROLL, _none_ )
  1466. #define X61 _NE(HOME, HOME, _none_ )
  1467. #define X62 _NE(END, END, _none_ )
  1468. #define X63 _EQ( _none_ )
  1469. #define X64 _EQ( _none_ )
  1470. #define X65 _EQ( _none_ )
  1471. #define X66 _EQ( _none_ )
  1472. #define X6D _NE(OEM_TOUROKU,OEM_TOUROKU,_none_ )
  1473. #define X71 _NE(DBE_SBCSCHAR,DBE_SBCSCHAR,_none_)
  1474. #define X74 _EQ( _none_ )
  1475. #define X75 _EQ( _none_ )
  1476. #define X76 _EQ( _none_ )
  1477. #define X77 _EQ( _none_ )
  1478. #define X78 _EQ( _none_ )
  1479. #define X79 _EQ( _none_ )
  1480. #define X7A _EQ( _none_ )
  1481. #define X7B _EQ( _none_ )
  1482. /*
  1483. * The break key is sent to us as E1,LCtrl,NumLock
  1484. * We must convert the E1+LCtrl to BREAK, then ignore the Numlock
  1485. * which must be ignored. Alternatively, translate Ctrl-Numlock
  1486. * to break, but don't let the CTRL through as a WM_KEYUP/DOWN) ?
  1487. */
  1488. #define Y1D _EQ( PAUSE )
  1489. #elif (KBD_TYPE >= 30) && (KBD_TYPE <= 34)
  1490. /***********************************************************************\
  1491. * T** - Values for ausVK[] (Virtual Scan Code to Virtual Key conversion)
  1492. *
  1493. * Three sets of keyboards are supported, according to KBD_TYPE:
  1494. *
  1495. * KBD_TYPE Keyboard (examples)
  1496. * ======== =====================================
  1497. * 30 * NEC PC-9800 Normal Keyboard.
  1498. * 31 NEC PC-9800 Document processor Keyboard. - not supported on NT5
  1499. * 32 NEC PC-9800 106 Keyboard. - same as KBD_TYPE 8
  1500. * 33 NEC PC-9800 for Hydra: PC-9800 Keyboard on Windows NT 5.0.
  1501. * NEC PC-98NX for Hydra: PC-9800 Keyboard on Windows 95/NT.
  1502. * 34 NEC PC-9800 for Hydra: PC-9800 Keyboard on Windows NT 3.51/4.0.
  1503. *
  1504. * +------+ +----------+----------+----------+
  1505. * | Scan | | kbd | kbd | kbd |
  1506. * | code | | type 30 | type 33 | type 34 |
  1507. \****+-------+-+----------+----------+----------+***********************/
  1508. #define T00 _EQ(_none_ )
  1509. #define T01 _EQ(ESCAPE )
  1510. #define T02 _EQ('1' )
  1511. #define T03 _EQ('2' )
  1512. #define T04 _EQ('3' )
  1513. #define T05 _EQ('4' )
  1514. #define T06 _EQ('5' )
  1515. #define T07 _EQ('6' )
  1516. #define T08 _EQ('7' )
  1517. #define T09 _EQ('8' )
  1518. #define T0A _EQ('9' )
  1519. #define T0B _EQ('0' )
  1520. #define T0C _EQ(OEM_MINUS )
  1521. #define T0D _NE(OEM_7, OEM_7, OEM_PLUS )
  1522. #define T0E _EQ(BACK )
  1523. #define T0F _EQ(TAB )
  1524. #define T10 _EQ('Q' )
  1525. #define T11 _EQ('W' )
  1526. #define T12 _EQ('E' )
  1527. #define T13 _EQ('R' )
  1528. #define T14 _EQ('T' )
  1529. #define T15 _EQ('Y' )
  1530. #define T16 _EQ('U' )
  1531. #define T17 _EQ('I' )
  1532. #define T18 _EQ('O' )
  1533. #define T19 _EQ('P' )
  1534. #define T1A _NE(OEM_3, OEM_3, OEM_4 )
  1535. #define T1B _NE(OEM_4, OEM_4, OEM_6 )
  1536. #define T1C _EQ(RETURN )
  1537. #define T1D _EQ(LCONTROL )
  1538. #define T1E _EQ('A' )
  1539. #define T1F _EQ('S' )
  1540. #define T20 _EQ('D' )
  1541. #define T21 _EQ('F' )
  1542. #define T22 _EQ('G' )
  1543. #define T23 _EQ('H' )
  1544. #define T24 _EQ('J' )
  1545. #define T25 _EQ('K' )
  1546. #define T26 _EQ('L' )
  1547. #define T27 _NE(OEM_PLUS, OEM_PLUS, OEM_1 )
  1548. #define T28 _NE(OEM_1, OEM_1, OEM_7 )
  1549. #define T29 _NE(DBE_SBCSCHAR, \
  1550. DBE_SBCSCHAR, \
  1551. OEM_3 )
  1552. #define T2A _EQ(LSHIFT )
  1553. #define T2B _NE(OEM_6, OEM_6, OEM_5 )
  1554. #define T2C _EQ('Z' )
  1555. #define T2D _EQ('X' )
  1556. #define T2E _EQ('C' )
  1557. #define T2F _EQ('V' )
  1558. #define T30 _EQ('B' )
  1559. #define T31 _EQ('N' )
  1560. #define T32 _EQ('M' )
  1561. #define T33 _EQ(OEM_COMMA )
  1562. #define T34 _EQ(OEM_PERIOD )
  1563. #define T35 _EQ(OEM_2 )
  1564. #define T36 _EQ(RSHIFT )
  1565. #define T37 _EQ(MULTIPLY )
  1566. #define T38 _EQ(LMENU )
  1567. #define T39 _EQ(' ' )
  1568. #define T3A _EQ(CAPITAL )
  1569. #define T3B _EQ(F1 )
  1570. #define T3C _EQ(F2 )
  1571. #define T3D _EQ(F3 )
  1572. #define T3E _EQ(F4 )
  1573. #define T3F _EQ(F5 )
  1574. #define T40 _EQ(F6 )
  1575. #define T41 _EQ(F7 )
  1576. #define T42 _EQ(F8 )
  1577. #define T43 _EQ(F9 )
  1578. #define T44 _EQ(F10 )
  1579. #define T45 _EQ(NUMLOCK )
  1580. #define T46 _EQ(SCROLL )
  1581. #define T47 _EQ(HOME )
  1582. #define T48 _EQ(UP )
  1583. #define T49 _EQ(PRIOR )
  1584. #define T4A _EQ(SUBTRACT )
  1585. #define T4B _EQ(LEFT )
  1586. #define T4C _EQ(CLEAR )
  1587. #define T4D _EQ(RIGHT )
  1588. #define T4E _EQ(ADD )
  1589. #define T4F _EQ(END )
  1590. #define T50 _EQ(DOWN )
  1591. #define T51 _EQ(NEXT )
  1592. #define T52 _EQ(INSERT )
  1593. #define T53 _EQ(DELETE )
  1594. #define T54 _EQ(SNAPSHOT )
  1595. #define T55 _NE(_none_, _none_, OEM_8 )
  1596. #define T56 _EQ(_none_ )
  1597. #define T57 _EQ(F11 )
  1598. #define T58 _EQ(F12 )
  1599. #define T59 _EQ(OEM_NEC_EQUAL )
  1600. #define T5A _NE(NONAME, NONAME, NONCONVERT)
  1601. #define T5B _NE(_none_, _none_, NONAME )
  1602. #define T5C _EQ(SEPARATOR )
  1603. #define T5D _EQ(F13 )
  1604. #define T5E _EQ(F14 )
  1605. #define T5F _EQ(F15 )
  1606. #define T60 _EQ(_none_ )
  1607. #define T61 _EQ(_none_ )
  1608. #define T62 _EQ(_none_ )
  1609. #define T63 _EQ(_none_ )
  1610. #define T64 _NE(_none_, _none_, F13 )
  1611. #define T65 _NE(_none_, _none_, F14 )
  1612. #define T66 _NE(_none_, _none_, F15 )
  1613. #define T67 _NE(_none_, _none_, F16 )
  1614. #define T68 _NE(_none_, _none_, F17 )
  1615. #define T69 _NE(_none_, _none_, F18 )
  1616. #define T6A _NE(_none_, _none_, F19 )
  1617. #define T6B _NE(_none_, _none_, F20 )
  1618. #define T6C _NE(_none_, _none_, F21 )
  1619. #define T6D _NE(_none_, _none_, F22 )
  1620. #define T6E _NE(_none_, _none_, F23 )
  1621. #define T6F _EQ(_none_ )
  1622. #define T70 _NE(KANA, KANA, DBE_HIRAGANA)
  1623. #define T71 _EQ(_none_ )
  1624. #define T72 _EQ(_none_ )
  1625. #define T73 _NE(OEM_8, OEM_8, _none_ )
  1626. #define T74 _NE(_none_, OEM_NEC_EQUAL, \
  1627. _none_ )
  1628. #define T75 _NE(_none_, SEPARATOR, _none_ )
  1629. #define T76 _NE(_none_, _none_, F24 )
  1630. #define T77 _NE(_none_, _none_, DBE_SBCSCHAR)
  1631. #define T78 _EQ(_none_ )
  1632. #define T79 _EQ(CONVERT )
  1633. #define T7A _EQ(_none_ )
  1634. #define T7B _EQ(NONCONVERT )
  1635. #define T7C _NE(TAB, _none_, _none_ )
  1636. #define T7D _NE(OEM_5, OEM_5, _none_ )
  1637. #define T7E _NE(ABNT_C2, ABNT_C2, _none_ )
  1638. #define T7F _NE(OEM_PA2, OEM_PA2, _none_ )
  1639. #define X1C _EQ(RETURN )
  1640. #define X1D _NE(RCONTROL, RCONTROL, KANA )
  1641. #define X33 _EQ(_none_ )
  1642. #define X35 _EQ(DIVIDE )
  1643. #define X37 _EQ(SNAPSHOT )
  1644. #define X38 _NE(_none_, _none_, KANJI )
  1645. #define X42 _NE(_none_, _none_, RCONTROL )
  1646. #define X43 _NE(_none_, _none_, RMENU )
  1647. #define X44 _EQ(_none_ )
  1648. #define X46 _EQ(CANCEL )
  1649. #define X47 _EQ(HOME )
  1650. #define X48 _EQ(UP )
  1651. #define X49 _EQ(PRIOR )
  1652. #define X4B _EQ(LEFT )
  1653. #define X4D _EQ(RIGHT )
  1654. #define X4F _EQ(END )
  1655. #define X50 _EQ(DOWN )
  1656. #define X51 _EQ(NEXT )
  1657. #define X52 _EQ(INSERT )
  1658. #define X53 _EQ(DELETE )
  1659. #define X5B _EQ(LWIN )
  1660. #define X5C _EQ(RWIN )
  1661. #define X5D _EQ(APPS )
  1662. #define X5E _EQ(POWER )
  1663. #define X5F _EQ(SLEEP )
  1664. #define X60 _EQ(_none_ )
  1665. #define X61 _EQ(_none_ )
  1666. #define X62 _EQ(_none_ )
  1667. #define X63 _EQ(_none_ )
  1668. #define X64 _EQ(_none_ )
  1669. #define X65 _EQ(_none_ )
  1670. #define X66 _EQ(_none_ )
  1671. #define X6D _EQ(_none_ )
  1672. #define X71 _EQ(_none_ )
  1673. #define X74 _EQ(_none_ )
  1674. #define X75 _EQ(_none_ )
  1675. #define X76 _EQ(_none_ )
  1676. #define X77 _EQ(_none_ )
  1677. #define X78 _EQ(_none_ )
  1678. #define X79 _EQ(_none_ )
  1679. #define X7A _EQ(_none_ )
  1680. #define X7B _EQ(_none_ )
  1681. /*
  1682. * The break key is sent to us as E1,LCtrl,NumLock
  1683. * We must convert the E1+LCtrl to BREAK, then ignore the Numlock
  1684. * which must be ignored. Alternatively, translate Ctrl-Numlock
  1685. * to break, but don't let the CTRL through as a WM_KEYUP/DOWN) ?
  1686. */
  1687. #define Y1D _EQ(PAUSE )
  1688. #elif (KBD_TYPE == 37)
  1689. /***********************************************************************\
  1690. * T** - Values for ausVK[] (Virtual Scan Code to Virtual Key conversion)
  1691. *
  1692. * Three sets of keyboards are supported, according to KBD_TYPE:
  1693. *
  1694. * KBD_TYPE Keyboard (examples)
  1695. * ======== =====================================
  1696. * 37 * NEC PC-9800 for Hydra: PC-9800 Keyboard on Windows 95.
  1697. *
  1698. * +------+ +----------+
  1699. * | Scan | | kbd |
  1700. * | code | | type 37 |
  1701. \****+-------+-+----------+*********************************************/
  1702. #define T00 _EQ(ESCAPE )
  1703. #define T01 _EQ('1' )
  1704. #define T02 _EQ('2' )
  1705. #define T03 _EQ('3' )
  1706. #define T04 _EQ('4' )
  1707. #define T05 _EQ('5' )
  1708. #define T06 _EQ('6' )
  1709. #define T07 _EQ('7' )
  1710. #define T08 _EQ('8' )
  1711. #define T09 _EQ('9' )
  1712. #define T0A _EQ('0' )
  1713. #define T0B _EQ(OEM_MINUS )
  1714. #define T0C _EQ(OEM_7 )
  1715. #define T0D _EQ(OEM_5 )
  1716. #define T0E _EQ(BACK )
  1717. #define T0F _EQ(TAB )
  1718. #define T10 _EQ('Q' )
  1719. #define T11 _EQ('W' )
  1720. #define T12 _EQ('E' )
  1721. #define T13 _EQ('R' )
  1722. #define T14 _EQ('T' )
  1723. #define T15 _EQ('Y' )
  1724. #define T16 _EQ('U' )
  1725. #define T17 _EQ('I' )
  1726. #define T18 _EQ('O' )
  1727. #define T19 _EQ('P' )
  1728. #define T1A _EQ(OEM_3 )
  1729. #define T1B _EQ(OEM_4 )
  1730. #define T1C _EQ(RETURN )
  1731. #define T1D _EQ('A' )
  1732. #define T1E _EQ('S' )
  1733. #define T1F _EQ('D' )
  1734. #define T20 _EQ('F' )
  1735. #define T21 _EQ('G' )
  1736. #define T22 _EQ('H' )
  1737. #define T23 _EQ('J' )
  1738. #define T24 _EQ('K' )
  1739. #define T25 _EQ('L' )
  1740. #define T26 _EQ(OEM_PLUS )
  1741. #define T27 _EQ(OEM_1 )
  1742. #define T28 _EQ(OEM_6 )
  1743. #define T29 _EQ('Z' )
  1744. #define T2A _EQ('X' )
  1745. #define T2B _EQ('C' )
  1746. #define T2C _EQ('V' )
  1747. #define T2D _EQ('B' )
  1748. #define T2E _EQ('N' )
  1749. #define T2F _EQ('M' )
  1750. #define T30 _EQ(OEM_COMMA )
  1751. #define T31 _EQ(OEM_PERIOD)
  1752. #define T32 _EQ(OEM_2 )
  1753. #define T33 _EQ(OEM_8 )
  1754. #define T34 _EQ(' ' )
  1755. #define T35 _EQ(CONVERT )
  1756. #define T36 _EQ(NEXT )
  1757. #define T37 _EQ(PRIOR )
  1758. #define T38 _EQ(INSERT )
  1759. #define T39 _EQ(DELETE )
  1760. #define T3A _EQ(UP )
  1761. #define T3B _EQ(LEFT )
  1762. #define T3C _EQ(RIGHT )
  1763. #define T3D _EQ(DOWN )
  1764. #define T3E _EQ(HOME )
  1765. #define T3F _EQ(END )
  1766. #define T40 _EQ(SUBTRACT )
  1767. #define T41 _EQ(DIVIDE )
  1768. #define T42 _EQ(NUMPAD7 )
  1769. #define T43 _EQ(NUMPAD8 )
  1770. #define T44 _EQ(NUMPAD9 )
  1771. #define T45 _EQ(MULTIPLY )
  1772. #define T46 _EQ(NUMPAD4 )
  1773. #define T47 _EQ(NUMPAD5 )
  1774. #define T48 _EQ(NUMPAD6 )
  1775. #define T49 _EQ(ADD )
  1776. #define T4A _EQ(NUMPAD1 )
  1777. #define T4B _EQ(NUMPAD2 )
  1778. #define T4C _EQ(NUMPAD3 )
  1779. #define T4D _EQ(OEM_NEC_EQUAL)
  1780. #define T4E _EQ(NUMPAD0 )
  1781. #define T4F _EQ(SEPARATOR )
  1782. #define T50 _EQ(DECIMAL )
  1783. #define T51 _EQ(NONCONVERT)
  1784. #define T52 _EQ(F11 )
  1785. #define T53 _EQ(F12 )
  1786. #define T54 _EQ(F13 )
  1787. #define T55 _EQ(F14 )
  1788. #define T56 _EQ(F15 )
  1789. #define T57 _EQ(_none_ )
  1790. #define T58 _EQ(_none_ )
  1791. #define T59 _EQ(_none_ )
  1792. #define T5A _EQ(_none_ )
  1793. #define T5B _EQ(_none_ )
  1794. #define T5C _EQ(RETURN )
  1795. #define T5D _EQ(_none_ )
  1796. #define T5E _EQ(_none_ )
  1797. #define T5F _EQ(_none_ )
  1798. #define T60 _EQ(CANCEL )
  1799. #define T61 _EQ(SNAPSHOT )
  1800. #define T62 _EQ(F1 )
  1801. #define T63 _EQ(F2 )
  1802. #define T64 _EQ(F3 )
  1803. #define T65 _EQ(F4 )
  1804. #define T66 _EQ(F5 )
  1805. #define T67 _EQ(F6 )
  1806. #define T68 _EQ(F7 )
  1807. #define T69 _EQ(F8 )
  1808. #define T6A _EQ(F9 )
  1809. #define T6B _EQ(F10 )
  1810. #define T6C _EQ(_none_ )
  1811. #define T6D _EQ(_none_ )
  1812. #define T6E _EQ(_none_ )
  1813. #define T6F _EQ(_none_ )
  1814. #define T70 _EQ(LSHIFT )
  1815. #define T71 _EQ(CAPITAL )
  1816. #define T72 _EQ(KANA )
  1817. #define T73 _EQ(LMENU )
  1818. #define T74 _EQ(LCONTROL )
  1819. #define T75 _EQ(_none_ )
  1820. #define T76 _EQ(_none_ )
  1821. #define T77 _EQ(LWIN )
  1822. #define T78 _EQ(RWIN )
  1823. #define T79 _EQ(APPS )
  1824. #define T7A _EQ(_none_ )
  1825. #define T7B _EQ(_none_ )
  1826. #define T7C _EQ(_none_ )
  1827. #define T7D _EQ(RSHIFT )
  1828. #define T7E _EQ(ABNT_C2 )
  1829. #define T7F _EQ(OEM_PA2 )
  1830. /*
  1831. * The break key is sent to us as E1,LCtrl,NumLock
  1832. * We must conevrt the E1+LCtrl to BREAK, then ignore the Numlock
  1833. * which must be ignored. Alternatively, translate Ctrl-Numlock
  1834. * to break, but don't let the CTRL through as a WM_KEYUP/DOWN) ?
  1835. */
  1836. #define Y1D _EQ(PAUSE )
  1837. #elif (KBD_TYPE >= 40) && (KBD_TYPE <= 41)
  1838. /***********************************************************************\
  1839. * T** - Values for ausVK[] (Virtual Scan Code to Virtual Key conversion)
  1840. *
  1841. * Two sets of keyboards are supported, according to KBD_TYPE:
  1842. *
  1843. * KBD_TYPE Keyboard (examples)
  1844. * ======== =====================================
  1845. * 40 * DEC LK411-JJ (JIS layout) keyboard
  1846. * 41 DEC LK411-AJ (ANSI layout) keyboard
  1847. *
  1848. * +------+ +-----------+-----------+
  1849. * | Scan | | kbd | kbd |
  1850. * | code | | LK411-JJ | LK411-AJ |
  1851. \*****+------+-+-----------+-----------+********************************/
  1852. #define T00 _EQ( _none_ )
  1853. #define T01 _EQ( ESCAPE )
  1854. #define T02 _EQ( '1' )
  1855. #define T03 _EQ( '2' )
  1856. #define T04 _EQ( '3' )
  1857. #define T05 _EQ( '4' )
  1858. #define T06 _EQ( '5' )
  1859. #define T07 _EQ( '6' )
  1860. #define T08 _EQ( '7' )
  1861. #define T09 _EQ( '8' )
  1862. #define T0A _EQ( '9' )
  1863. #define T0B _EQ( '0' )
  1864. #define T0C _EQ( OEM_MINUS )
  1865. #define T0D _NE( OEM_7, OEM_PLUS ) // "^"/"="
  1866. #define T0E _EQ( BACK )
  1867. #define T0F _EQ( TAB )
  1868. #define T10 _EQ( 'Q' )
  1869. #define T11 _EQ( 'W' )
  1870. #define T12 _EQ( 'E' )
  1871. #define T13 _EQ( 'R' )
  1872. #define T14 _EQ( 'T' )
  1873. #define T15 _EQ( 'Y' )
  1874. #define T16 _EQ( 'U' )
  1875. #define T17 _EQ( 'I' )
  1876. #define T18 _EQ( 'O' )
  1877. #define T19 _EQ( 'P' )
  1878. #define T1A _NE( OEM_3, OEM_4 ) // "@"/"["
  1879. #define T1B _NE( OEM_4, OEM_6 ) // "["/"]"
  1880. #define T1C _EQ( RETURN )
  1881. #define T1D _EQ( LCONTROL )
  1882. #define T1E _EQ( 'A' )
  1883. #define T1F _EQ( 'S' )
  1884. #define T20 _EQ( 'D' )
  1885. #define T21 _EQ( 'F' )
  1886. #define T22 _EQ( 'G' )
  1887. #define T23 _EQ( 'H' )
  1888. #define T24 _EQ( 'J' )
  1889. #define T25 _EQ( 'K' )
  1890. #define T26 _EQ( 'L' )
  1891. #define T27 _NE( OEM_PLUS, OEM_1 ) // ";"
  1892. #define T28 _NE( OEM_1, OEM_7 ) // ":"/"'"
  1893. #define T29 _NE( _none_, DBE_SBCSCHAR ) // LK411AJ uses "<>" as SBCS/DBCS key
  1894. #define T2A _EQ( LSHIFT )
  1895. #define T2B _NE( OEM_6, OEM_5 ) // "]"/"\"
  1896. #define T2C _EQ( 'Z' )
  1897. #define T2D _EQ( 'X' )
  1898. #define T2E _EQ( 'C' )
  1899. #define T2F _EQ( 'V' )
  1900. #define T30 _EQ( 'B' )
  1901. #define T31 _EQ( 'N' )
  1902. #define T32 _EQ( 'M' )
  1903. #define T33 _EQ( OEM_COMMA )
  1904. #define T34 _EQ( OEM_PERIOD )
  1905. #define T35 _EQ( OEM_2 ) // "/"
  1906. #define T36 _EQ( RSHIFT )
  1907. #define T37 _EQ( MULTIPLY ) // PF3 : "*"
  1908. #define T38 _EQ( LMENU ) // Alt(Left)
  1909. #define T39 _EQ( ' ' ) // Space
  1910. #define T3A _EQ( CAPITAL ) // LOCK : Caps Lock
  1911. #define T3B _EQ( F1 )
  1912. #define T3C _EQ( F2 )
  1913. #define T3D _EQ( F3 )
  1914. #define T3E _EQ( F4 )
  1915. #define T3F _EQ( F5 )
  1916. #define T40 _EQ( F6 )
  1917. #define T41 _EQ( F7 )
  1918. #define T42 _EQ( F8 )
  1919. #define T43 _EQ( F9 )
  1920. #define T44 _EQ( F10 )
  1921. #define T45 _EQ( NUMLOCK ) // PF1 : Num Lock
  1922. #define T46 _EQ( SCROLL ) // F19 : Scroll Lock
  1923. #define T47 _EQ( HOME ) // KP7 : Home
  1924. #define T48 _EQ( UP ) // KP8 : Up
  1925. #define T49 _EQ( PRIOR ) // KP9 : Page Up
  1926. #define T4A _EQ( SUBTRACT ) // PF4 : "-"
  1927. #define T4B _EQ( LEFT ) // KP4 : Left
  1928. #define T4C _EQ( CLEAR ) // KP5 : Clear
  1929. #define T4D _EQ( RIGHT ) // KP6 : Right
  1930. #define T4E _EQ( ADD ) // KP, : Add
  1931. #define T4F _EQ( END ) // KP1 : End
  1932. #define T50 _EQ( DOWN ) // KP2 : Down
  1933. #define T51 _EQ( NEXT ) // KP3 : Next
  1934. #define T52 _EQ( INSERT ) // KP0 : Ins
  1935. #define T53 _EQ( DELETE ) // KP. : Del
  1936. #define T54 _EQ( SNAPSHOT )
  1937. #define T55 _EQ( _none_ )
  1938. #define T56 _EQ( _none_ )
  1939. #define T57 _EQ( F11 )
  1940. #define T58 _EQ( F12 )
  1941. #define T59 _EQ( _none_ )
  1942. #define T5A _EQ( _none_ )
  1943. #define T5B _EQ( _none_ )
  1944. #define T5C _EQ( _none_ )
  1945. #define T5D _EQ( _none_ )
  1946. #define T5E _EQ( _none_ )
  1947. #define T5F _EQ( _none_ )
  1948. #define T60 _EQ( _none_ )
  1949. #define T61 _EQ( _none_ )
  1950. #define T62 _EQ( _none_ )
  1951. #define T63 _EQ( _none_ )
  1952. #define T64 _EQ( _none_ )
  1953. #define T65 _EQ( _none_ )
  1954. #define T66 _EQ( _none_ )
  1955. #define T67 _EQ( _none_ )
  1956. #define T68 _EQ( _none_ )
  1957. #define T69 _EQ( _none_ )
  1958. #define T6A _EQ( _none_ )
  1959. #define T6B _EQ( _none_ )
  1960. #define T6C _EQ( _none_ )
  1961. #define T6D _EQ( _none_ )
  1962. #define T6E _EQ( _none_ )
  1963. #define T6F _EQ( _none_ )
  1964. #define T70 _EQ( DBE_HIRAGANA ) // Hiragana/Katakana
  1965. #define T71 _EQ( _none_ )
  1966. #define T72 _EQ( _none_ )
  1967. #define T73 _NE( OEM_102, _none_ ) // LK411JJ, Katakana "Ro"
  1968. #define T74 _EQ( _none_ )
  1969. #define T75 _EQ( _none_ )
  1970. #define T76 _EQ( _none_ )
  1971. #define T77 _EQ( _none_ )
  1972. #define T78 _EQ( _none_ )
  1973. #define T79 _EQ( CONVERT ) // Henkan
  1974. #define T7A _EQ( _none_ )
  1975. #define T7B _EQ( NONCONVERT ) // Mu-Henkan
  1976. #define T7C _EQ( _none_ )
  1977. #define T7D _NE( OEM_5, _none_ ) // LK411JJ, Yen(Back-slash)
  1978. #define T7E _EQ( _none_ )
  1979. #define T7F _EQ( _none_ )
  1980. #define X0F _EQ( KANA ) // Kana
  1981. #define X1C _EQ( RETURN ) // Enter
  1982. #define X1D _EQ( RCONTROL ) // Comp : Right Control
  1983. #define X33 _EQ( _none_ )
  1984. #define X35 _EQ( DIVIDE ) // PF2: "/"
  1985. #define X37 _EQ( SNAPSHOT ) // F18: PrintScreen
  1986. #define X38 _EQ( RMENU ) // Alt(Right)
  1987. #define X3D _EQ( F13 )
  1988. #define X3E _EQ( F14 )
  1989. #define X3F _EQ( F15 ) // Help : F15
  1990. #define X40 _EQ( F16 ) // Do : F16
  1991. #define X41 _EQ( F17 )
  1992. #define X42 _EQ( _none_ )
  1993. #define X43 _EQ( _none_ )
  1994. #define X44 _EQ( _none_ )
  1995. #define X46 _EQ( CANCEL )
  1996. #define X47 _EQ( HOME ) // Find : HOME
  1997. #define X48 _EQ( UP )
  1998. #define X49 _EQ( PRIOR ) // Prev : PageUp
  1999. #define X4B _EQ( LEFT )
  2000. #define X4D _EQ( RIGHT )
  2001. #define X4E _EQ( ADD ) // KP- (Minus but "Add")
  2002. #define X4F _EQ( END ) // Select : END
  2003. #define X50 _EQ( DOWN )
  2004. #define X51 _EQ( NEXT ) // Next : PageDown
  2005. #define X52 _EQ( INSERT )
  2006. #define X53 _EQ( DELETE ) // Remove
  2007. #define X5B _EQ( _none_ )
  2008. #define X5C _EQ( _none_ )
  2009. #define X5D _EQ( _none_ )
  2010. #define X5E _EQ( POWER )
  2011. #define X5F _EQ( SLEEP )
  2012. /*
  2013. * The break key is sent to us as E1,LCtrl,NumLock
  2014. * We must convert the E1+LCtrl to BREAK, then ignore the Numlock
  2015. */
  2016. #define Y1D _EQ( PAUSE )
  2017. #endif // KBD_TYPE
  2018. #define SCANCODE_LSHIFT 0x2A
  2019. #define SCANCODE_RSHIFT 0x36
  2020. #define SCANCODE_CTRL 0x1D
  2021. #define SCANCODE_ALT 0x38
  2022. #define SCANCODE_SIMULATED (FAKE_KEYSTROKE >> 16)
  2023. #define SCANCODE_NUMPAD_FIRST 0x47
  2024. #define SCANCODE_NUMPAD_LAST 0x52
  2025. #define SCANCODE_LWIN 0x5B
  2026. #define SCANCODE_RWIN 0x5C
  2027. #define SCANCODE_THAI_LAYOUT_TOGGLE 0x29
  2028. //@@BEGIN_DDKSPLIT
  2029. /*
  2030. * Hydra FarEast
  2031. */
  2032. /*
  2033. * Structure for client keyboard information
  2034. */
  2035. typedef struct _CLIENTKEYBOARDTYPE {
  2036. ULONG Type;
  2037. ULONG SubType;
  2038. ULONG FunctionKey;
  2039. } CLIENTKEYBOARDTYPE, *KBD_LONG_POINTER PCLIENTKEYBOARDTYPE;
  2040. //@@END_DDKSPLIT
  2041. //@@BEGIN_DDKSPLIT
  2042. #if !defined(VK_DBE_ALPHANUMERIC)
  2043. //@@END_DDKSPLIT
  2044. #define VK_DBE_ALPHANUMERIC 0x0f0
  2045. #define VK_DBE_KATAKANA 0x0f1
  2046. #define VK_DBE_HIRAGANA 0x0f2
  2047. #define VK_DBE_SBCSCHAR 0x0f3
  2048. #define VK_DBE_DBCSCHAR 0x0f4
  2049. #define VK_DBE_ROMAN 0x0f5
  2050. #define VK_DBE_NOROMAN 0x0f6
  2051. #define VK_DBE_ENTERWORDREGISTERMODE 0x0f7
  2052. #define VK_DBE_ENTERIMECONFIGMODE 0x0f8
  2053. #define VK_DBE_FLUSHSTRING 0x0f9
  2054. #define VK_DBE_CODEINPUT 0x0fa
  2055. #define VK_DBE_NOCODEINPUT 0x0fb
  2056. #define VK_DBE_DETERMINESTRING 0x0fc
  2057. #define VK_DBE_ENTERDLGCONVERSIONMODE 0x0fd
  2058. //@@BEGIN_DDKSPLIT
  2059. #endif
  2060. //@@END_DDKSPLIT
  2061. #endif // _KBD_