Source code of Windows XP (NT5)
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.

168 lines
4.1 KiB

  1. ;++
  2. ;
  3. ; WOW v1.0
  4. ;
  5. ; Copyright (c) 1991, Microsoft Corporation
  6. ;
  7. ; KBD.ASM
  8. ; Win16 KEYBOARD thunks
  9. ;
  10. ; History:
  11. ;
  12. ; Created 06-Jan-1992 by NanduriR
  13. ;--
  14. TITLE KEYBOARD.ASM
  15. PAGE ,132
  16. .286p
  17. .xlist
  18. include wow.inc
  19. include wowkbd.inc
  20. include cmacros.inc
  21. include windefs.inc
  22. include vdmtib.inc
  23. include dpmi.inc
  24. .list
  25. __acrtused = 0
  26. public __acrtused ;satisfy external C ref.
  27. ifdef DBCS
  28. externFP GetSystemDefaultLangID
  29. endif ; DBCS
  30. externFP WOW16Call
  31. createSeg _TEXT,CODE,WORD,PUBLIC,CODE
  32. createSeg _DATA,DATA,WORD,PUBLIC,DATA,DGROUP
  33. defgrp DGROUP,DATA
  34. sBegin DATA
  35. Reserved db 16 dup (0) ;reserved for Windows
  36. KEYBOARD_Identifier db 'KEYBOARD16 Data Segment'
  37. externD bios_proc
  38. sEnd DATA
  39. sBegin CODE
  40. assumes CS,CODE
  41. assumes DS,DATA
  42. assumes ES,NOTHING
  43. ; Hung App Support
  44. ; If USER32 is unable to terminate an app via End Task then it calls
  45. ; WOW32 to kill the app. We do this by generating a keyboard h/w
  46. ; interrupt 9. Since in WOW all keyboard input comes via USER32 the
  47. ; keyboard h/w interrupt is unused for anything else so we can reuse
  48. ; this interrupt.
  49. cProc KEYBOARD16,<PUBLIC,FAR>
  50. cBegin
  51. mov ax,3500h or 09h
  52. int 21h ; vector is in ES:BX
  53. mov word ptr [bios_proc][0], bx
  54. mov word ptr [bios_proc][2], es
  55. ; Setup keyboard interrupt vector to point to our interrupt routine
  56. mov ax,2500h or 09h
  57. mov dx,OFFSET keybd_int
  58. push ds ; save DS
  59. push cs
  60. pop ds ; set DS = CS
  61. int 21h ; set the vector
  62. pop ds ; restore DS
  63. ifdef DBCS
  64. cCall GetSystemDefaultLangID
  65. endif ; DBCS
  66. mov ax,1
  67. cEnd
  68. ifdef NEC_98
  69. INTA0 equ 0h ;
  70. else ; NEC_98
  71. INTA0 equ 20h ;X'20' 8259 Interrupt Control Port
  72. endif ; NEC_98
  73. EOI equ 20h ;X'20' 8259 End-of-Interrupt ack
  74. public keybd_int
  75. keybd_int PROC FAR
  76. push ax
  77. push bx
  78. push es
  79. mov al,EOI ; Send Non-Specific EOI
  80. out INTA0,al
  81. ;
  82. ; Now we test the bit in low memory that is set by wow32 to see if this
  83. ; is really a keyboard int forced in by the hung app support.
  84. ;
  85. mov ax, 40h ;use bios data selector
  86. mov es, ax
  87. mov bx, FIXED_NTVDMSTATE_LINEAR - 400h
  88. .386 ;make it assemble
  89. .errnz VDM_WOWHUNGAPP AND 0ff00ffffh ;make sure it's the third byte
  90. test byte ptr es:[bx+2], VDM_WOWHUNGAPP SHR 16
  91. jnz short hungapp_exit ;jump if this is really a hung app
  92. pop es
  93. pop bx
  94. pop ax
  95. iret
  96. hungapp_exit:
  97. and byte ptr es:[bx+2], 255 - (VDM_WOWHUNGAPP SHR 16) ; turn it off
  98. pop es
  99. pop bx
  100. pop ax
  101. .286p
  102. DPMIBOP HungAppIretAndExit ; They said OK to Nuke app.
  103. keybd_int ENDP
  104. cProc WEP,<PUBLIC,FAR,PASCAL,NODATA,NOWIN,ATOMIC>
  105. parmW iExit ;DLL exit code
  106. cBegin
  107. mov ax,1 ;always indicate success
  108. cEnd
  109. assumes DS,NOTHING
  110. ;;; KbdThunk INQUIRE ;Internal LOCALAPI
  111. ;;; KbdThunk ENABLE ;Internal
  112. ;;; KbdThunk DISABLE ;Internal
  113. KbdThunk TOASCII
  114. KbdThunk ANSITOOEM
  115. KbdThunk OEMTOANSI
  116. ;;; KbdThunk SETSPEED ;Internal
  117. ;;; KbdThunk SCREENSWITCHENABLE ;Internal
  118. ;;; KbdThunk GETTABLESEG ;Internal
  119. ;;; KbdThunk NEWTABLE ;Internal
  120. KbdThunk OEMKEYSCAN
  121. KbdThunk VKKEYSCAN
  122. KbdThunk GETKEYBOARDTYPE
  123. KbdThunk MAPVIRTUALKEY
  124. KbdThunk GETKBCODEPAGE
  125. KbdThunk GETKEYNAMETEXT
  126. KbdThunk ANSITOOEMBUFF
  127. KbdThunk OEMTOANSIBUFF
  128. ;;; KbdThunk ENABLEKBSYSREQ ;Internal LOCALAPI
  129. ;;; KbdThunk GETBIOSKEYPROC ; in kbdlocal.asm
  130. sEnd CODE
  131. end KEYBOARD16