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.

183 lines
2.6 KiB

  1. .LALL
  2. TITLE $EXVECTOR
  3. .386P
  4. INCLUDE VMM.INC
  5. INCLUDE EXVECTOR.INC
  6. ; the following equate makes the VXD dynamically loadable.
  7. %DEVICE_DYNAMIC EQU 1
  8. DECLARE_VIRTUAL_DEVICE %DEVICE, 1, 0, <%DEVICE>_Control, Undefined_Device_Id, Vmm_init_order
  9. ;
  10. ; LData
  11. ;
  12. VxD_LOCKED_DATA_SEG
  13. Public bInitAlready
  14. bInitAlready DB 0
  15. Public _pPrevHook1
  16. _pPrevHook1 DD 0
  17. Public _pPrevHook3
  18. _pPrevHook3 DD 0
  19. Public _pfnHandler
  20. _pfnHandler DD 0
  21. Public _pProcessHandle
  22. _pProcessHandle DD 0
  23. VxD_LOCKED_DATA_ENDS
  24. ;
  25. ; LCode
  26. ;
  27. VxD_LOCKED_CODE_SEG
  28. Begin_Control_Dispatch %DEVICE
  29. Control_Dispatch Sys_Dynamic_Device_Init, _C_Device_Init
  30. Control_Dispatch Sys_Dynamic_Device_Exit, _C_Device_Exit
  31. Control_Dispatch W32_DEVICEIOCONTROL, DriverIOControl, sCall, <ecx, ebx, edx, esi>
  32. End_Control_Dispatch %DEVICE
  33. BeginProc _C_Device_Init
  34. IFDEF _STDCALL
  35. extern _DriverControl@4:NEAR
  36. ELSE
  37. extern _DriverControl:NEAR
  38. ENDIF
  39. mov al, bInitAlready
  40. cmp al, 0 ; Make sure we' haven't been called already.
  41. jnz Succeed_Init_Phase
  42. inc bInitAlready ; Set the "Called Already" Flag
  43. push 0
  44. IFDEF _STDCALL
  45. call _DriverControl@4
  46. ELSE
  47. call _DriverControl
  48. add esp,4
  49. ENDIF
  50. cmp eax, 1
  51. jz Fail_Init_Phase
  52. Succeed_Init_Phase:
  53. clc
  54. ret
  55. Fail_Init_Phase:
  56. stc
  57. ret
  58. EndProc _C_Device_Init
  59. BeginProc _C_Device_Exit
  60. IFDEF _STDCALL
  61. extern _DriverControl@4:NEAR
  62. ELSE
  63. extern _DriverControl:NEAR
  64. ENDIF
  65. push 1
  66. IFDEF _STDCALL
  67. call _DriverControl@4
  68. ELSE
  69. call _DriverControl
  70. add esp,4
  71. ENDIF
  72. cmp eax, 1
  73. jz Fail_Exit_Phase
  74. Succeed_Exit_Phase:
  75. clc
  76. ret
  77. Fail_Exit_Phase:
  78. stc
  79. ret
  80. EndProc _C_Device_Exit
  81. BeginProc _C_Handle_Trap_1, HOOK_PROC, _pPrevHook1, LOCKED
  82. extern _C_Trap_Exception_Handler:NEAR
  83. pushfd
  84. pushad
  85. cli
  86. cCall _C_Trap_Exception_Handler, <esi, ebp>
  87. sti
  88. cmp eax, 0
  89. jnz Trap1_Handled
  90. ;Try the next handler
  91. cmp [_pPrevHook1], 0
  92. jz Trap1_Handled
  93. ;Here we go
  94. popad
  95. popfd
  96. jmp [_pPrevHook1]
  97. Trap1_Handled:
  98. popad
  99. popfd
  100. ret
  101. EndProc _C_Handle_Trap_1
  102. BeginProc _C_Handle_Trap_3, HOOK_PROC, _pPrevHook3, LOCKED
  103. extern _C_Trap_Exception_Handler:NEAR
  104. pushfd
  105. pushad
  106. cli
  107. cCall _C_Trap_Exception_Handler, <esi, ebp>
  108. sti
  109. cmp eax, 0
  110. jnz Trap3_Handled
  111. ;Try the next handler
  112. cmp [_pPrevHook3], 0
  113. jz Trap3_Handled
  114. ;Here we go
  115. popad
  116. popfd
  117. jmp [_pPrevHook3]
  118. Trap3_Handled:
  119. popad
  120. popfd
  121. ret
  122. EndProc _C_Handle_Trap_3
  123. VxD_LOCKED_CODE_ENDS
  124. ;
  125. ; Not using IData or ICode
  126. ;
  127. ;
  128. ; Or RCode
  129. ;
  130. END