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.

324 lines
8.7 KiB

  1. ;++
  2. ;
  3. ; WOW v1.0
  4. ;
  5. ; Copyright (c) 1991, Microsoft Corporation
  6. ;
  7. ; KBDLOCAL.ASM
  8. ;
  9. ; Win16 KEYBOARD APIS that are 'internal'
  10. ; We make these apis a 'nop'. Relevant code has been copied from WIN31.
  11. ; The intention here is to maintain the stack. Any arguments to the apis
  12. ; are popped and that is it.
  13. ;
  14. ; History:
  15. ;
  16. ; Created 06-Jan-1992 by NanduriR
  17. ;--
  18. TITLE KBDLOCAL.ASM
  19. PAGE ,132
  20. .286p
  21. .xlist
  22. include wow.inc
  23. include wowkbd.inc
  24. include cmacros.inc
  25. include windefs.inc
  26. .list
  27. __acrtused = 0
  28. public __acrtused ;satisfy external C ref.
  29. createSeg _TEXT,CODE,WORD,PUBLIC,CODE
  30. createSeg _DATA,DATA,WORD,PUBLIC,DATA,DGROUP
  31. defgrp DGROUP,DATA
  32. ; Double byte range values for the East Asia.
  33. ; The values defined here are for the Rest Of the World.
  34. ; These values are for the inquireData (KBINFO) structure defined below.
  35. ; ('KeyInfo' in the Kernel, pState in USER)
  36. ;
  37. ; KKFIX 10/19/96 #56665
  38. ifdef JAPAN
  39. BeginRange1 equ 129 ; 81h
  40. EndRange1 equ 159 ; 9Fh
  41. BeginRange2 equ 224 ; E0h
  42. EndRange2 equ 252 ; FCh
  43. else ; not JAPAN
  44. ifdef TAIWAN ; Big-5 lead byte range, pisuih, 3/16/95'
  45. BeginRange1 equ 129 ; 81h
  46. EndRange1 equ 254 ; FEh
  47. else ; TAIWAN
  48. ifdef PRC ; GB2312 lead byte range, pisuih, 3/16/95'
  49. BeginRange1 equ 129 ; 81h Change to GBK lead byte, shanxu 2/22/96
  50. EndRange1 equ 254 ; FEh
  51. else ; PRC
  52. ifdef KOREA
  53. BeginRange1 equ 129
  54. EndRange1 equ 254
  55. else ; not KOREA
  56. BeginRange1 equ 255
  57. EndRange1 equ 254
  58. endif ; KOREA
  59. endif ; PRC
  60. endif ; TAIWAN
  61. BeginRange2 equ 255
  62. EndRange2 equ 254
  63. endif ;
  64. sBegin DATA
  65. globalD bios_proc, 0
  66. globalD nmi_vector, 0
  67. ;externD nmi_vector
  68. public fSysReq
  69. fSysReq db 0 ; Enables CTRL-ALT-SysReq if NZ
  70. ; Keyboard information block (copied to 'KeyInfo' in the kernel)
  71. ; this is a KBINFO data structure.. defined in KERNEL.INC, USER.INC, USER.H
  72. ; and WINDEFS.INC.
  73. ;
  74. ; As of 3.0, build 1.30, KBINFO includes the number of function keys
  75. ; As of 3.0, build 1.59, the number of bytes in the state block is
  76. ; fixed at 4 MAX, for compatibility with Excel 2.1c!!!
  77. ;
  78. PUBLIC inquireData
  79. PUBLIC iqdNumFunc
  80. inquireData LABEL BYTE
  81. DB BeginRange1
  82. DB EndRange1
  83. DB BeginRange2
  84. DB EndRange2
  85. DW 4 ; #bytes of state info for ToAscii()
  86. iqdNumFunc label word
  87. dw 10 ; number of function keys
  88. sEnd DATA
  89. sBegin CODE
  90. assumes CS,CODE
  91. assumes DS,NOTHING
  92. assumes ES,NOTHING
  93. assumes DS,DATA
  94. ;***************************************************************************
  95. ;
  96. ; Inquire( pKBINFO ) - copies information about the keyboard hardware into
  97. ; the area pointer to by the long pointer argument. Returns a count of the
  98. ; number of bytes copied.
  99. ;
  100. ; The Windows kernel calls this to copy information to its 'KeyInfo' data
  101. ; structure.
  102. ;
  103. ;***************************************************************************
  104. cProc Inquire,<PUBLIC,FAR>,<si,di>
  105. parmD pKBINFO
  106. cBegin Inquire
  107. ; .. now pass data to Windows ..
  108. les di,pKBINFO ; Get far pointer of destination area
  109. mov si, OFFSET inquireData ; Get source
  110. mov ax,size KBINFO ; Get number of bytes to move
  111. mov cx,ax ; (Return byte count in AX)
  112. rep movsb ; Move the bytes
  113. cEnd Inquire
  114. ;---------------------------------------------------------------------
  115. ;
  116. ;---- ScreenSwitchEnable( fEnable ) ----------------------------------
  117. ;
  118. ; This function is called by the display driver to inform the keyboard
  119. ; driver that the display driver is in a critical section and to ignore
  120. ; all OS/2 screen switches until the display driver leaves its
  121. ; critical section. The fEnable parameter is set to 0 to disable
  122. ; screen switches, and a NONZERO value to re-enable them. At startup,
  123. ; screen switches are enabled.
  124. ;---------------------------------------------------------------------
  125. ;
  126. cProc ScreenSwitchEnable,<PUBLIC,FAR>
  127. parmW fEnable
  128. cBegin ScreenSwitchEnable
  129. mov ax,fEnable ; get WORD parameter
  130. or al,ah ; stuff any NZ bits into AL
  131. ;;; mov fSwitchEnable,al ; save BYTE.
  132. cEnd ScreenSwitchEnable
  133. ;---------------------------------------------------------------------
  134. ;
  135. ;---- EnableKBSysReq( fSys ) ----------------------------------
  136. ;
  137. ; This function enables and shuttles off NMI interrupt simulation
  138. ; (trap to debugger) when CTRL-ALT-SysReq is pressed.
  139. ; CVWBreak overides int 2.
  140. ; fSysParm = 01 enable int 2
  141. ; = 02 disable int 2
  142. ; = 04 enable CVWBreak
  143. ; = 08 disable CVWBreak
  144. ;
  145. ;---------------------------------------------------------------------
  146. ;
  147. cProc EnableKBSysReq,<PUBLIC,FAR>
  148. parmW fSysParm
  149. cBegin EnableKBSysReq
  150. mov ax, fSysParm ; get WORD parameter
  151. test al,01 ; turn on int 2?
  152. jz @F
  153. or fSysReq,01 ; yes, turn it on!
  154. @@: test al,02 ; turn off int 2?
  155. jz @F
  156. and fSysReq,NOT 01 ; yes, turn it off!
  157. @@: test al,04 ; turn on CVWBreak?
  158. jz @F
  159. or fSysReq,02 ; yes, turn it on!
  160. @@: test al,08 ; turn off CVWBreak?
  161. jz @F
  162. and fSysReq,NOT 02 ; yes, turn it off!
  163. @@:
  164. xor ah,ah
  165. mov al,fSysReq
  166. ifdef NEWNMI
  167. push ax ; save return value
  168. call short GetNmi ; save NMI
  169. pop ax ; restore ..
  170. endif
  171. cEnd EnableKBSysReq
  172. ; save NMI vector. Called above in EnableKBSysReq() and in Enable().
  173. ifdef NEWNMI
  174. GetNmi proc near
  175. mov ax,3502h
  176. int 21h
  177. mov word ptr ds:[nmi_vector][0],bx
  178. mov word ptr ds:[nmi_vector][2],es
  179. ret
  180. GetNmi endp
  181. endif
  182. ;***************************************************************************
  183. ;
  184. ; Enable( eventProc ) - enable hardware keyboard interrupts, with the passed
  185. ; procedure address being the target of all keyboard events.
  186. ;
  187. ; lpKeyState is a long pointer to the Windows 256 byte keystate table
  188. ;
  189. ;***************************************************************************
  190. cProc Enable,<PUBLIC,FAR>,<si,di>
  191. parmD eventProc
  192. parmD lpKeyState
  193. cBegin Enable
  194. sub ax, ax
  195. cEnd Enable
  196. ;***************************************************************************
  197. ; Disable( eventProc ) - disable hardware keyboard interrupts, restoring
  198. ; the previous IBM BIOS keyboard interrupt handler.
  199. ;
  200. ;***************************************************************************
  201. cProc Disable,<PUBLIC,FAR>,<si,di>
  202. cBegin Disable
  203. sub ax,ax
  204. cEnd Disable
  205. ; ** GetTableSeg() ***************************************
  206. ;
  207. ; This finds the paragraph of the TABS segment and stores
  208. ; it in TableSeg.
  209. ;
  210. ; Calling this will force the segment to be loaded.
  211. ;
  212. ; This segment isn't written to.
  213. ;
  214. ; REMEMBER that AX is TRASHED !!
  215. cProc GetTableSeg,<PUBLIC,FAR>,<si,di>
  216. cBegin GetTableSeg
  217. ;;; mov ax,cs
  218. ;;; mov TableSeg,ax
  219. cEnd GetTableSeg
  220. ;***************************************************************************
  221. ;
  222. ; NewTable()
  223. ;
  224. ; Change keyboard tables, if a keyboard table DLL is defined in
  225. ; SYSTEM.INI and the function GetKbdTable() exists and returns
  226. ; successfully.
  227. ;
  228. ; This function is passed no parameters by the caller -- it obtains
  229. ; the following from SYSTEM.INI:
  230. ;
  231. ; [keyboard]
  232. ; TYPE = 4 ; 1..6. 4 is enhanced kbd.
  233. ; SUBTYPE = 0 ; 0 for all but Olivetti
  234. ; ; 8086 systems & AT&T 6300+
  235. ; KEYBOARD.DLL = kbdus.dll ; name of DLL file
  236. ; OEMANSI.BIN = XLATNO.BIN ; oem/ansi tables file
  237. ;
  238. ; The module name of the DLL is expected to be the root of the DLL's
  239. ; file name. In any event, the module name must be different for
  240. ; each keyboard-table DLL!
  241. ;
  242. ;***************************************************************************
  243. cProc NewTable,<PUBLIC,FAR>,<si,di>
  244. ; LOCAL variables on stack:
  245. cBegin NewTable
  246. sub ax,ax
  247. cEnd NewTable
  248. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  249. ; SetSpeed.asm
  250. ;
  251. ;
  252. ; Sets 'typematic' speed of AT-type keyboards (type code 3 or 4 in this
  253. ; driver).
  254. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  255. cProc SetSpeed,<FAR,PASCAL,PUBLIC>
  256. parmW rate_of_speed
  257. cBegin
  258. SS_error_return:
  259. mov ax,-1 ; error return
  260. SS_end:
  261. cEnd
  262. cProc GetBIOSKeyProc, <FAR, PUBLIC>
  263. cBegin
  264. mov ax, word ptr [bios_proc][0]
  265. mov dx, word ptr [bios_proc][2]
  266. cEnd
  267. sEnd CODE
  268. end