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.

164 lines
4.2 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. INTA0 equ 20h ;X'20' 8259 Interrupt Control Port
  69. EOI equ 20h ;X'20' 8259 End-of-Interrupt ack
  70. public keybd_int
  71. keybd_int PROC FAR
  72. push ax
  73. push bx
  74. push es
  75. mov al,EOI ; Send Non-Specific EOI
  76. out INTA0,al
  77. ;
  78. ; Now we test the bit in low memory that is set by wow32 to see if this
  79. ; is really a keyboard int forced in by the hung app support.
  80. ;
  81. mov ax, 40h ;use bios data selector
  82. mov es, ax
  83. mov bx, FIXED_NTVDMSTATE_LINEAR - 400h
  84. .386 ;make it assemble
  85. .errnz VDM_WOWHUNGAPP AND 0ff00ffffh ;make sure it's the third byte
  86. test byte ptr es:[bx+2], VDM_WOWHUNGAPP SHR 16
  87. jnz short hungapp_exit ;jump if this is really a hung app
  88. pop es
  89. pop bx
  90. pop ax
  91. iret
  92. hungapp_exit:
  93. and byte ptr es:[bx+2], 255 - (VDM_WOWHUNGAPP SHR 16) ; turn it off
  94. pop es
  95. pop bx
  96. pop ax
  97. .286p
  98. DPMIBOP HungAppIretAndExit ; They said OK to Nuke app.
  99. keybd_int ENDP
  100. cProc WEP,<PUBLIC,FAR,PASCAL,NODATA,NOWIN,ATOMIC>
  101. parmW iExit ;DLL exit code
  102. cBegin
  103. mov ax,1 ;always indicate success
  104. cEnd
  105. assumes DS,NOTHING
  106. ;;; KbdThunk INQUIRE ;Internal LOCALAPI
  107. ;;; KbdThunk ENABLE ;Internal
  108. ;;; KbdThunk DISABLE ;Internal
  109. KbdThunk TOASCII
  110. KbdThunk ANSITOOEM
  111. KbdThunk OEMTOANSI
  112. ;;; KbdThunk SETSPEED ;Internal
  113. ;;; KbdThunk SCREENSWITCHENABLE ;Internal
  114. ;;; KbdThunk GETTABLESEG ;Internal
  115. ;;; KbdThunk NEWTABLE ;Internal
  116. KbdThunk OEMKEYSCAN
  117. KbdThunk VKKEYSCAN
  118. KbdThunk GETKEYBOARDTYPE
  119. KbdThunk MAPVIRTUALKEY
  120. KbdThunk GETKBCODEPAGE
  121. KbdThunk GETKEYNAMETEXT
  122. KbdThunk ANSITOOEMBUFF
  123. KbdThunk OEMTOANSIBUFF
  124. ;;; KbdThunk ENABLEKBSYSREQ ;Internal LOCALAPI
  125. ;;; KbdThunk GETBIOSKEYPROC ; in kbdlocal.asm
  126. sEnd CODE
  127. end KEYBOARD16