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.

336 lines
17 KiB

  1. .XLIST
  2. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3. ;;
  4. ;; (C) Copyright Microsoft Corp. 1987-1991
  5. ;; MS-DOS 5.00 - NLS Support - KEYB Command
  6. ;;
  7. ;; File Name: KEYBSHAR.INC
  8. ;; ----------
  9. ;;
  10. ;; Description:
  11. ;; ------------
  12. ;; Include file containing structure definitions Shared Data Area
  13. ;; for the Shared Data Area.
  14. ;; The Shared Data Area contains data which is required by
  15. ;; both the resident and transient KEYB code. The Shared
  16. ;; Data Area is allocated in the KEYBI2F file and will be
  17. ;; resident following initial installation.
  18. ;;
  19. ;; Change History:
  20. ;; ---------------
  21. ;;
  22. ;; ;jwg ; - Feb 1990 For 4.03.
  23. ;; ;AN007; - Add Patriot/Sebring determination code for HOT Replug
  24. ;; so that INT 9 handler can alter keyboard Scan Code set.
  25. ;; ;M030 Merged IBM (Kermit - JP), KEYBOARD.SYS and KEYB.COM
  26. ;; versions of this file into one.
  27. ;;
  28. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  29. ;;
  30. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  31. ;; SHARED_DATA_STR defines the initial fixed length portion of the
  32. ;; Shared Data Area.
  33. ;; Tables are loaded beginning at TABLE_AREA in the following order:
  34. ;; State Logic
  35. ;; Common Translate Section
  36. ;; Specific Translate Sections for
  37. ;; each code page
  38. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  39. ;; SPECIAL_FEATURES equates:
  40. TYPEWRITER_CAPS_LK EQU 8000H ;; typewriter style caps lock
  41. ;;
  42. JR_HOT_KEY_1_2 equ 4000h ;; M030 Merged back for kdfcf.asm
  43. ;;========================================
  44. ;; Added YST for Cyrillic keyboards
  45. ;; 1/21/90
  46. ;;========================================
  47. SHIFTS_TO_LOGIC EQU 2000H ;; - transfer CTRL, SHIFT, ALT keys
  48. ;; to LOGIC section
  49. ;;
  50. SWITCHABLE EQU 1000H ;; - Driver can use NLS/Def mode
  51. ;; switching (like Rus/Lat mode)
  52. ;; Used for Int 2Fh, function 0AD83h answer
  53. ;;========================================
  54. ;; End of YST
  55. ;;========================================
  56. JR_KB equ 8000h ;; M030 Merged back for kdfcf.asm
  57. ;; Some useful scan codes:
  58. F1_SCAN EQU 59 ;; F1
  59. F2_SCAN EQU 60 ;; F2
  60. ;;
  61. ;; SYSTEM_FLAG / Hardware equates:
  62. ;; INT 16h and remote support
  63. EXT_16 EQU 8000H ;; extended INT 16h support is there
  64. EXT_122 EQU 4000H ;; extended INT 16h for 122 is there
  65. ; EQU 2000H ;; unused
  66. PC_NET EQU 1000H ;; flag PC Net is installed
  67. ;; System type/hardware support flags
  68. PC_81 EQU 0800H ;; flag for Original PC
  69. PC_XT EQU 0400H ;; code for PC, PC/XT, PORTABLE
  70. PC_LAP EQU 0200H ;; code for Convertiable (p-12)
  71. PC_PAL EQU 0080H ;; code for Model 30 (PALACE)
  72. PC_AT EQU 0040H ;; code for PC-AT with 8042
  73. PC_386 EQU 0020H ;; code for PS/2's with 8042 (WRANGLER)
  74. PS_8042 EQU 0010H ;; 8042 is a Patriot/Sebring type array;AN007;jwg
  75. ;; or system set translate OFF (SCS=01)
  76. SECURITY_ACTIVE EQU 0008h ; M030 ;; Server password mode is active
  77. ; ; M030 ;; This bit becomes off from on when
  78. ; ; M030 ;; correct password is entered JP9010
  79. ;;
  80. ;; HOT_KEY_FLAG EQUATES:
  81. US_MODE EQU 0 ;; hot key is active => US
  82. LANG_MODE EQU 0FFH ;; hot key is inactive
  83. ;;
  84. ;; -----------------------------------
  85. SHARED_DATA_STR STRUC ;; SHARED DATA AREA
  86. ;;
  87. OLD_INT_9 DD 0 ;; saved int 9 vector
  88. OLD_INT_2F DD 0 ;; saved int 2F vector
  89. dd 0 ;; reserved
  90. KEYB_TYPE DW 0 ;; type of keyboard
  91. SYSTEM_FLAG DW 0 ;; system configuration flags
  92. TABLE_OK DB 0 ;; flag to INT 9 that table is built
  93. db 5 dup (0) ;; reserved
  94. ;;
  95. ;; Table copy begins here:
  96. ACTIVE_LANGUAGE DB 'US' ;; language code
  97. INVOKED_CP_TABLE DW 437 ;; ptr to table for invoked code page
  98. INVOKED_KBD_ID DW 0 ;; WGR invoked keyboard id. ;AN000
  99. ACTIVE_XLAT_PTR DW -1 ;; ptr to active Specific Translate Sect
  100. FIRST_XLAT_PTR DW -1 ;; ptr to first Specific Translate Sect
  101. RESIDENT_END DW 0ffffh ;; offset of last byte in resident mem
  102. LOGIC_PTR DW -1 ;; ptr to State Logic
  103. COMMON_XLAT_PTR DW -1 ;; ptr to Common Translate Section
  104. SPECIAL_FEATURES DW ? ;; special Features
  105. TABLE_OVERFLOW DB 0 ;; overflow flag for table rebuild
  106. HOT_KEY_ON_SCAN DB ? ;; scan codes to use with ALT+CTRL
  107. HOT_KEY_OFF_SCAN DB ? ;; to turn hot key on and off
  108. DB 4 DUP(0) ;; reserved
  109. TABLE_AREA DB ? ;; tables loaded here:
  110. ;; State Logic
  111. ;; Common Translate Section
  112. ;; Specific Translate Sections for
  113. ;; each code page
  114. SHARED_DATA_STR ENDS ;;
  115. ;;
  116. ;;
  117. ;;
  118. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  119. ;; State Logic equates.
  120. ;; Contains equates for our NLS Flags and for the State Logic
  121. ;; commands.
  122. ;; State Logic command macros are defined in KEYBMAC.INC
  123. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  124. ;;
  125. STATE_LOGIC_STR STRUC ;;
  126. ;;
  127. SL_LOGIC_LEN DW ? ;; length of state logic
  128. SL_SPECIAL_FEATURES DW ? ;;
  129. SL_LOGIC_CMDS DB 0 ;; state logic commands begin here
  130. ;;
  131. STATE_LOGIC_STR ENDS ;;
  132. ;;
  133. ;;
  134. NUM_BIOS_FLAGS EQU 4 ;;
  135. NUM_NLS_FLAGS EQU 2 ;; '+1' below is the EXT_KB_FLAG
  136. NUM_FLAGS EQU NUM_BIOS_FLAGS+NUM_NLS_FLAGS+1
  137. ;;
  138. ;;
  139. EITHER_SHIFT EQU 80H ;; EXT_KB_FLAG : our own shift state
  140. EITHER_CTL EQU 40H ;; flags
  141. EITHER_ALT EQU 20H ;;
  142. SCAN_MATCH EQU 08H ;; set if scan code found in XLATT
  143. ;; or SET_FLAG searches
  144. ;;
  145. SHIFTS_PRESSED EQU 04H ;; set if any SHIFT, ALT, CTRL key
  146. ;; pressed (added YST for Cyrillic keyb.)
  147. ;;
  148. KB_FLAG_ID EQU 0 ;; Flag ID's as coded in IFF and ANDF
  149. KB_FLAG_1_ID EQU 1 ;; commands
  150. KB_FLAG_2_ID EQU 2 ;;
  151. KB_FLAG_3_ID EQU 3 ;;
  152. EXT_KB_FLAG_ID EQU 4 ;;
  153. NLS_FLAG_1_ID EQU 5 ;;
  154. NLS_FLAG_2_ID EQU 6 ;;
  155. ;;
  156. COMMAND_BITS EQU 0F0H ;; Mask to isolate command code
  157. SUB_CMD_BITS EQU 0FH ;; mask to isolate sub command code
  158. NOT_TEST EQU 08H ;; NOT bit in IFF, ANDF
  159. COMMAND_SHIFT EQU 4 ;; shift amount for command code
  160. FLAG_ID_BITS EQU 07H ;; mask to isolate flag id in IFF, ANDF
  161. NUM_COMMANDS EQU 0CH ;; number of commands
  162. ;;
  163. IFF_COMMAND EQU 00H ;;
  164. ANDF_COMMAND EQU 10H ;;
  165. ELSEF_COMMAND EQU 20H ;;
  166. ENDIFF_COMMAND EQU 30H ;;
  167. XLATT_COMMAND EQU 40H ;;
  168. OPTION_COMMAND EQU 50H ;;
  169. SET_FLAG_COMMAND EQU 60H ;;
  170. PUT_ERROR_COMMAND EQU 70H ;;
  171. IFKBD_COMMAND EQU 80H ;;
  172. GOTO_COMMAND EQU 90H ;;
  173. BEEP_COMMAND EQU 0A0H ;;
  174. RESET_NLS_COMMAND EQU 0B0H ;;
  175. RESET_NLS1_COMMAND EQU 0C0H ;;
  176. CHECK_CORE_COMMAND EQU 0D0H ;;
  177. ;;
  178. ;;
  179. EXIT_INT_9_FLAG EQU 01H ;; Special forms of GOTO. These
  180. EXIT_STATE_LOGIC_FLAG EQU 02H ;; values are in the right nibble
  181. ;; of the GOTO command.
  182. ;;
  183. ;; PROCESSING OPTIONS:
  184. EXIT_IF_FOUND EQU 80H ;; exit INT 9 if a translation
  185. ;; match is found
  186. ;;
  187. ANY_KB EQU 0FFFFH ;;
  188. XT_KB EQU 4000H ;;
  189. AT_KB EQU 2000H ;;
  190. G_KB EQU 1000H ;;
  191. P_KB EQU 0800H ;;
  192. P12_KB EQU 0400H ;;
  193. DBCS_OLD_A_KB EQU 0080H ; M030 ;; JP9009
  194. DBCS_OLD_P_KB EQU 0040H ; M030 ;; JP9009
  195. DBCS_OLD_G_KB EQU 0020H ; M030 ;; JP9009
  196. DBCS_OLD_KB EQU 00C0H ; M030 ;; JP9009
  197. DBCS_KB EQU 0020H ; M030 ;; JP9009
  198. ;;
  199. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  200. ;; Translate Table Sections. Both the Specific and Common
  201. ;; Translate Sections are formatted as follows.
  202. ;;
  203. ;; The Specific Translate Sections are chained together using the
  204. ;; XS_NEXT_SECT_PTR field (-1 if last section).
  205. ;; Translate Sections contains multiple States.
  206. ;; A State contains the translate tables for a single
  207. ;; shift state (IE lower case, upper case ....)
  208. ;; Each State may contain multiple translate tables.
  209. ;;
  210. ;; The Translate Section layout is defined using several STRUCs.
  211. ;; These STRUCs are allocated in the Shared Data Area as follows:
  212. ;;
  213. ;; XLAT_SECT_STR ; header info for the section
  214. ;; STATE_STR ; header for state #1
  215. ;; XLAT_STR ; first translate tab for state #1
  216. ;; XLAT_TYPE_1_STR or XLAT_TYPE_2_STR
  217. ;; XLAT_STR ; second translate tab
  218. ;; XLAT_TYPE_1_STR or XLAT_TYPE_2_STR
  219. ;; ...
  220. ;; STATE_STR ; header for state #2
  221. ;; XLAT_STR
  222. ;; XLAT_TYPE_1_STR or XLAT_TYPE_2_STR
  223. ;; ...
  224. ;; ...
  225. ;;
  226. ;; A State may contain a "Set_Flag" table instead of translate tables.
  227. ;; These tables are used to set the NLS flags instead of generating
  228. ;; ASCII codes (for example: to remember dead key states).
  229. ;; There can be only on Set_Flag table per state.
  230. ;; The Set_Flag table layout is defined in the SET_FLAG_STR STRUC.
  231. ;;
  232. ;; So some states will contain translate tables (to generate ASCII codes)
  233. ;; and some states will contain a Set_Flag table (to record dead key
  234. ;; status).
  235. ;;
  236. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  237. ;;
  238. XLAT_SECT_STR STRUC ;;
  239. ;;
  240. XS_NEXT_SECT_PTR DW ? ;; Pointer to next Specific Translate
  241. ;; Section
  242. XS_CP_ID DW ? ;; code page id
  243. XS_FIRST_STATE DB ? ;;
  244. ;;
  245. XLAT_SECT_STR ENDS ;;
  246. ;;
  247. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  248. ;; State structure.
  249. ;; The last State is a null State containing only the
  250. ;; XS_STATE_LEN field with a value of 0.
  251. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  252. ;;
  253. STATE_STR STRUC ;;
  254. ;;
  255. XS_STATE_LEN DW ? ;; length of state section
  256. XS_STATE_ID DB ? ;; State ID
  257. XS_KBD_TYPE DW ? ;; Keyboard Type
  258. XS_ERROR_CHAR DW ? ;; Buffer entry for error character
  259. XS_FIRST_TAB DB ? ;;
  260. ;;
  261. STATE_STR ENDS ;;
  262. ;;
  263. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  264. ;; Translate Table structures.
  265. ;; There may be many translate tables in a State. The last
  266. ;; table is a null table containing only the XLAT_TAB_SIZE field with
  267. ;; a value of 0.
  268. ;; The xlate table can be in one of two forms:
  269. ;; Type 1 = Table contains buffer entries only.
  270. ;; Scan code is used as an index into xlat table
  271. ;; Type 2 = Table contains pairs of SCAN/BUFFER_ENTRY.
  272. ;; Table must be searched for matching scan.
  273. ;; Type 1 is the default. Type 2 tables should be identified by setting
  274. ;; the TYPE_2_TAB bit in XLAT_OPTIONS.
  275. ;; Buffer entries default to 2-bytes per entry.
  276. ;; Optionally the table may contain ASCII codes only
  277. ;; (1-byte entries). This is specified by setting the ASCII_ONLY bit
  278. ;; in XLAT_OPTIONS. 2-byte buffer entries are coded ASCII,SCAN.
  279. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  280. ;;
  281. ;; Translate options:
  282. ASCII_ONLY EQU 80H ;; Only ASCII codes listed - use
  283. ;; incoming scan for buffer entry
  284. TYPE_2_TAB EQU 40H ;; search xlat table for matching scan
  285. ZERO_SCAN EQU 20H ;; set the scan half of the buffer
  286. ;; entry to 0
  287. ;;
  288. NULL_ASCII_CODE EQU -1 ;;
  289. ;;
  290. DEFAULT_TAB_2_ENT_SZ EQU 3 ;;
  291. ASC_ONLY_TAB_2_ENT_SZ EQU 2 ;;
  292. ;;
  293. ;;
  294. XLAT_STR STRUC ;;
  295. ;;
  296. XLAT_TAB_SIZE DW ? ;; Size in bytes of this table -
  297. ;; includes this field, options etc.
  298. XLAT_OPTIONS DB ? ;; xlat options
  299. ;; XLAT TABLE IS HERE
  300. XLAT_STR ENDS ;;
  301. ;;
  302. XLAT_TYPE_1_STR STRUC ;; use scan code as index into table
  303. DB TYPE XLAT_STR DUP(?) ;; filler
  304. XLAT_SCAN_LO DB ? ;; Scan code
  305. XLAT_SCAN_HI DB ? ;; range
  306. XLAT_1_BUF_ENTRY DB ? ;; The table itself
  307. XLAT_TYPE_1_STR ENDS ;;
  308. ;;
  309. XLAT_TYPE_2_STR STRUC ;; search table for scan
  310. DB TYPE XLAT_STR DUP(?) ;; filler
  311. XLAT_NUM DB ? ;; number of scans
  312. XLAT_SCAN DB ? ;; Scan code
  313. XLAT_2_BUF_ENTRY DB ? ;; The table itself
  314. XLAT_TYPE_2_STR ENDS ;;
  315. ;;
  316. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  317. ;; Set_Flag Tables.
  318. ;; State Sections immediately following the LAST_ENTRYs.
  319. ;; Dead key definitions. If the scan matches then
  320. ;; set the bit in NLS_FLAGs indicated in DK_MASK
  321. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  322. ;;
  323. SF_ENT_SZ EQU 3 ;; size of entry
  324. ;;
  325. SET_FLAG_STR STRUC ;;
  326. ;;
  327. SF_NUM DB 0 ;; Number of entries
  328. SF_SCAN_CODE DB 0 ;; scan code
  329. SF_FLAG_ID DB 0 ;; flag id
  330. SF_FLAG_MASK DB 0 ;; flag mask
  331. ;;
  332. SET_FLAG_STR ENDS ;;
  333. ;;
  334. ;;
  335. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  336. .LIST