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.

173 lines
4.4 KiB

  1. name mscdexnt
  2. ;
  3. ; MSCDEXNT
  4. ;
  5. ; Author: Neil Sandlin (neilsa)
  6. ;
  7. ; Description:
  8. ;
  9. ; This TSR implements the v86 mode portion of MSCDEX support under
  10. ; NT. Basically, all this piece does is hook INT2F and watch for
  11. ; MSCDEX calls.
  12. ;
  13. include bop.inc
  14. include mscdexnt.inc
  15. _TEXT segment word public 'CODE'
  16. assume cs:_TEXT,ds:_TEXT,es:_TEXT
  17. ;*----------------------- TSR Code --------------------------*
  18. DrvStrat proc far ; Strategy Routine
  19. ret
  20. DrvStrat endp
  21. DrvIntr proc far ; INterrupt routine
  22. ret
  23. DrvIntr endp
  24. ;******************************************************************************
  25. ;
  26. ; Int2FHook
  27. ;
  28. ;
  29. ;******************************************************************************
  30. Int2FHook proc near
  31. cmp ah, MSCDEX_ID ;MSCDEX?
  32. jnz int2fchain ;no
  33. cmp al, MAX_MSCDEX_CMD ;command too high?
  34. ja int2fchain ;yes
  35. ;
  36. ; fVDDCheck is 0 if failed, 1 if ok
  37. ;
  38. cmp byte ptr cs:[fVDDChecked], 0
  39. je vddfailed
  40. BOP BOP_DEVICES
  41. db SVC_DEVICES_MSCDEX
  42. iret ;svc handled, return to caller
  43. vddfailed:
  44. or al,al
  45. jnz try_0b
  46. xor bx,bx
  47. jmp short int2f_done
  48. try_0b:
  49. cmp al,0bh
  50. jne int2f_done
  51. ;; williamh - June 1 1993 - if unable to load VDD, we should tell
  52. ;; the caller that the drive is NOT a cd rom.
  53. xor ax, ax
  54. mov bx,0adadh
  55. int2f_done:
  56. iret
  57. int2fchain:
  58. jmp dword ptr cs:[oldint]
  59. Int2FHook endp
  60. ;*----------------------- TSR Data Area ---------------------*
  61. oldint dd 0
  62. fVDDChecked DB 0 ; 0 - failed, 1 - working
  63. ALIGN 16
  64. drive_header:
  65. DrvHd 'MSCDEX00'
  66. ALIGN 16
  67. Init_Fence:
  68. ;*-------------------------- Initialization Code ----------------------*
  69. mscdexnt proc far
  70. ; at this point es,ds -> PSP
  71. ; SS:SP points to stack
  72. ; first check that we are running under NT
  73. mov ax, GET_NT_VERSION
  74. int 21h
  75. cmp bl, NT_MAJOR_VERSION
  76. je cdx_chk_more
  77. jmp cdx_exit
  78. cdx_chk_more:
  79. cmp bh, NT_MINOR_VERSION
  80. je cdx_ver_ok
  81. jmp cdx_exit
  82. cdx_ver_ok:
  83. ; Now check that this TSR is'nt already installed
  84. mov ah,MSCDEX_ID
  85. mov al,0bh ; call function 0b
  86. int MPX_INT ; int 2f
  87. cmp bx,0adadh
  88. jne cdx_chks_done
  89. jmp cdx_exit
  90. cdx_chks_done:
  91. ; free the env segment
  92. push es
  93. push ds
  94. mov es, es:[2ch]
  95. mov ah, 49h
  96. int 21h
  97. mov ah, DOS_GET_VECTOR
  98. mov al, MPX_INT ; 2f
  99. int 21h ; get old vector
  100. mov WORD PTR cs:oldint,bx ; save old vector here
  101. mov WORD PTR cs:oldint+2,es
  102. mov dx, offset Int2FHook
  103. push cs ; get current code segment
  104. pop ds
  105. mov ah, DOS_SET_VECTOR
  106. mov al, MPX_INT ; vector to hook
  107. int 21h ; hook that vector
  108. mov dx, offset drive_header ; pass far pointer to headers cs:dx
  109. BOP BOP_DEVICES
  110. db SVC_DEVICES_MSCDEXINIT
  111. cmc
  112. adc fVDDChecked, 0
  113. ;
  114. ; Compute size of TSR area
  115. ;
  116. pop ds
  117. pop es
  118. mov dx, offset Init_Fence ; end of fixed TSR code
  119. mov cl, 4 ; divide by 16
  120. shr dx, cl
  121. add dx, 16 ; add in PSP
  122. ;
  123. ; Terminate and stay resident
  124. ;
  125. mov ah, DOS_TSR ; TSR
  126. mov al, 0
  127. int 21h ; TSR
  128. cdx_exit:
  129. mov ax,4c00h ; Exit
  130. int 21h
  131. mscdexnt endp
  132. _TEXT ends
  133. InitStack segment para stack 'STACK'
  134. dw 256 dup (?)
  135. top_of_stack equ $
  136. InitStack ends
  137. end mscdexnt