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.

186 lines
4.7 KiB

  1. ;****************************************************************************
  2. ; *
  3. ; THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY *
  4. ; KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE *
  5. ; IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PAGLITCHICULAR *
  6. ; PURPOSE. *
  7. ; *
  8. ; Copyright (C) 1993-99 Microsoft Corporation. All Rights Reserved. *
  9. ; *
  10. ;****************************************************************************
  11. PAGE 58,132
  12. ;******************************************************************************
  13. TITLE GENERIC - GLITCH VxD
  14. ;******************************************************************************
  15. ;
  16. ; Title: GLITCH.ASM
  17. ;
  18. ; Version: 1.00
  19. ;
  20. ;==============================================================================
  21. .386p
  22. ;******************************************************************************
  23. ; I N C L U D E S
  24. ;******************************************************************************
  25. DDK_VERSION EQU 400H
  26. GLITCH_VER_MAJOR equ 1
  27. GLITCH_VER_MINOR equ 0
  28. .XLIST
  29. INCLUDE VMM.Inc
  30. ; INCLUDE VDMAD.Inc
  31. ; INCLUDE VPICD.Inc
  32. ; INCLUDE DOSMGR.Inc
  33. INCLUDE Debug.Inc
  34. .LIST
  35. Declare_Virtual_Device GLITCH, GLITCH_VER_MAJOR, GLITCH_VER_MINOR, GLITCH_VxD_Control
  36. VxD_DATA_SEG
  37. ;******************************************************************************
  38. ; D A T A
  39. ;******************************************************************************
  40. ; Normal Data here
  41. public C IRQHand
  42. IRQHand dd 0
  43. EXTERN _GlitchWin32API@4:near
  44. dma_status_struc STRUC
  45. DMA_PhysicalAddress DD ?
  46. DMA_Count DD ?
  47. DMA_Status DD ?
  48. dma_status_struc ENDS
  49. VxD_DATA_ENDS
  50. VxD_LOCKED_DATA_SEG
  51. next_begin dd 0
  52. next_end dd 0
  53. VxD_LOCKED_DATA_ENDS
  54. VxD_LOCKED_CODE_SEG
  55. ;******************************************************************************
  56. ;
  57. ; GLITCH_Init_VxD
  58. ;
  59. ; DESCRIPTION:
  60. ; This is a shell for a routine that is called at system BOOT.
  61. ; Typically, a VxD would do its initialization in this routine.
  62. ;
  63. ; ENTRY:
  64. ; EBX = System VM handle
  65. ;
  66. ; EXIT:
  67. ; We return 0 in eax upon success, 1 in eax if failure.
  68. ; Caller MUST fail to load the device if we return 1.
  69. ;
  70. ; USES:
  71. ; flags
  72. ;
  73. ;==============================================================================
  74. BeginProc GLITCH_Init_VxD, SCALL, PUBLIC
  75. EnterProc
  76. SaveReg <ebx, esi, edi>
  77. ; Note that we this routine should only be executed ONCE. So we
  78. ; ensure that that is the case.
  79. mov edi, offset32 GLITCH_DDB
  80. VMMCall VMM_Add_DDB
  81. Debug_Outc "DDB already loaded for GLITCH!"
  82. xor eax,eax
  83. RestoreReg <edi, esi, ebx>
  84. LeaveProc
  85. Return
  86. EndProc GLITCH_Init_VxD
  87. ;******************************************************************************
  88. ;
  89. ;
  90. ; Description:
  91. ;
  92. ; Entry:
  93. ; Exit:
  94. ; Uses:
  95. ;==============================================================================
  96. BeginProc GLITCH_Uninit_VxD, SCALL, PUBLIC
  97. EnterProc
  98. SaveReg <ebx,esi,edi>
  99. TRAP
  100. xor eax,eax
  101. push eax
  102. mov edi, offset32 GLITCH_DDB
  103. VMMCall VMM_Remove_DDB
  104. Debug_Outc "Could not remove DDB for GLITCH!"
  105. pop eax
  106. rcl eax,1
  107. RestoreReg <edi,esi,ebx>
  108. LeaveProc
  109. Return
  110. EndProc GLITCH_Uninit_VxD
  111. ;******************************************************************************
  112. ;
  113. ; GLITCH_VxD_Control
  114. ;
  115. ; DESCRIPTION:
  116. ;
  117. ; This is a call-back routine to handle the messages that are sent
  118. ; to VxD's to control system operation. Every VxD needs this function
  119. ; regardless if messages are processed or not. The control proc must
  120. ; be in the LOCKED code segment.
  121. ;
  122. ; The Control_Dispatch macro used in this procedure simplifies
  123. ; the handling of messages. To handle a particular message, add
  124. ; a Control_Dispatch statement with the message name, followed
  125. ; by the procedure that should handle the message.
  126. ;
  127. ; The two messages handled in this sample control proc, Device_Init
  128. ; and Create_VM, are done only to illustrate how messages are
  129. ; typically handled by a VxD. A VxD is not required to handle any
  130. ; messages.
  131. ;
  132. ; ENTRY:
  133. ; EAX = Message number
  134. ; EBX = VM Handle
  135. ;
  136. ;==============================================================================
  137. BeginProc GLITCH_VxD_Control, PUBLIC
  138. Control_Dispatch W32_DEVICEIOCONTROL, GlitchWin32API, sCall, <esi>
  139. clc
  140. ret
  141. EndProc GLITCH_VxD_Control
  142. VxD_LOCKED_CODE_ENDS
  143. END