ayncInit.asm
上传用户:lnzz01
上传日期:2013-05-23
资源大小:130k
文件大小:4k
源码类别:

DNA

开发平台:

C/C++

  1. .386p
  2. .xlist
  3. include vmm.inc
  4. include debug.inc
  5. include ilb.inc
  6. include aep.inc
  7. include isp.inc
  8. include ddb.inc
  9. include dcb.inc
  10. include portddb.inc
  11. ; include iodebug.inc ; dragon debug stuff
  12. include configmg.inc ; used to process the dev node
  13. include opttest.inc ; optimized test, or, and and macros
  14. .list
  15. memcpy proto C, lpd:PTR, lps:DWORD, size_t:DWORD
  16. VXD_LOCKED_CODE_SEG
  17. extrn milb:DWORD
  18. extrn OnAsyncRequest:near
  19. BeginProc Port_Async_Request, esp ;处理系统事件
  20. ArgVar AEPPtr, DWORD
  21. TRAP
  22. EnterProc
  23. mov ebx, AEPPtr
  24. mov [ebx.AEP_result], AEP_SUCCESS
  25. mov si, [ebx.AEP_func]
  26. cmp si, AEP_INITIALIZE
  27. je AEP_Init
  28. cmp  si, AEP_Boot_Complete
  29. je AEP_BootComplete
  30. cmp si, AEP_CONFIG_DCB
  31. je AEP_ConfigDcb
  32. cmp si, AEP_IOP_TIMEOUT
  33. je AEP_IopTimeOut
  34. cmp si, AEP_DEVICE_INQUIRY
  35. je AEP_DeviceInquiry
  36. mov [ebx.AEP_result],AEP_FAILURE
  37. LeaveProc
  38. Return
  39. EndProc Port_Async_Request
  40. VXD_LOCKED_CODE_ENDS
  41. ;==================================================
  42. VXD_PAGEABLE_DATA_SEG
  43. public DevCount
  44. DevCount db 0
  45. vendor db " Yan.J.F  VCDRom Driver     ",0,0
  46. BDF_Removable  EQU 4
  47. VXD_PAGEABLE_DATA_ENDS
  48. ;==================================================
  49. VXD_PAGEABLE_CODE_SEG
  50. BeginProc AEP_Init
  51. TRAP
  52. EnterProc
  53. sub  esp, size ISP_ddb_create
  54. mov edi, esp
  55. mov [edi].ISP_ddb_hdr.ISP_func, ISP_CREATE_DDB
  56. mov [edi].ISP_ddb_size, size DDB;
  57. mov [edi].ISP_ddb_flags, 0
  58. push edi
  59. call [milb.ILB_service_rtn]
  60. movzx eax, [edi].ISP_ddb_hdr.ISP_result
  61. add esp, size ISP_ddb_create + 4
  62. cmp eax, 0
  63. jne @F
  64. m_exit:
  65. ;;;;;;;;;;;// not deallocate!!!!!!!!!
  66. LeaveProc
  67. Return
  68. @@:
  69. mov [ebx.AEP_result],AEP_FAILURE
  70. jmp m_exit
  71. EndProc AEP_Init
  72. ;;;;;;;;;;;;;;;;;;;;;;;;;;
  73. BeginProc AEP_ConfigDcb
  74. TRAP
  75. EnterProc
  76. mov  esi, [ebx].AEP_d_c_dcb
  77. inc [DevCount]
  78. mov [esi].DCB_device_type, DCB_type_cdrom ; 我是光驱
  79. mov [esi].DCB_disk_bpb_flags, DCBF_DISK_BPB_USEFAKE
  80. or [esi].DCB_device_flags, DCB_DEV_REMOVABLE
  81. or [esi].DCB_tsd_flags, DCB_TSD_ACTUAL_PRE_SET
  82. ;;;;;;;;;;;;;;;;;;;;;;
  83. mov [esi].DCB_max_xfer_len, 08000H
  84. mov [esi].DCB_max_sg_elements, 16
  85. push  esi
  86. push edi
  87. mov esi, edi
  88. sub esp, size ISP_calldown_insert
  89. mov edi, esp
  90. mov [edi].ISP_func, ISP_insert_calldown
  91. mov [edi].ISP_i_cd_flags, DCB_dmd_small_memory
  92. or [edi].ISP_i_cd_flags, DCB_dmd_physical
  93. or [edi].ISP_i_cd_flags, DCB_dmd_load_eject_media
  94. mov [edi].ISP_i_cd_dcb, esi
  95. mov al, [ebx.AEP_lgn]
  96. mov [edi].ISP_i_cd_lgn, al
  97. mov [edi].ISP_i_cd_req, offset32 OnAsyncRequest ;挂接客户呼叫处理过程
  98. mov eax, [ebx.AEP_ddb]
  99. mov [edi].ISP_i_cd_ddb, eax
  100. mov [edi].ISP_i_cd_expan_len, 0
  101. push edi
  102. call [milb.ILB_Service_rtn]
  103. add esp, size ISP_calldown_insert + 4
  104. pop edi
  105. pop esi
  106. c_exit:
  107. LeaveProc
  108. Return
  109. failed_exit:
  110. mov [ebx].AEP_result, AEP_FAILURE
  111. jmp c_exit
  112. EndProc AEP_ConfigDcb
  113. ;;;;;;;;;;;;;;;;;;;;
  114. BeginProc AEP_BootComplete
  115. TRAP
  116. EnterProc
  117. cmp  [DevCount], 0 ;我只建立一个虚拟光驱
  118. je @F
  119. LeaveProc
  120. Return
  121. @@:
  122. mov  [ebx.AEP_result], AEP_FAILURE
  123. EndProc AEP_BootComplete
  124. ;;;;;;;;;;;;;;;;;;;;;;;;;;;
  125. BeginProc AEP_IopTimeOut
  126. TRAP
  127. Return
  128. EndProc AEP_IopTimeOut
  129. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  130. BeginProc AEP_DeviceInquiry ;填写虚拟光驱信息
  131. TRAP
  132. EnterProc
  133. mov  esi, [ebx.AEP_i_d_dcb]
  134. ; AssertDCB <esi>      this macro in the <iodebug.inc>
  135. movzx ecx, [esi].DCB_unit_on_ctl
  136. cmp  ecx, 0
  137. jne @F
  138. mov [esi].DCB_inquiry_flags, DCB_type_cdrom
  139. invoke memcpy, addr [esi].DCB_vendor_id, near32 ptr [vendor], 28
  140. q_exit:
  141. LeaveProc
  142. Return
  143. @@:
  144. mov [ebx.AEP_result], AEP_NO_MORE_DEVICES
  145. jmp q_exit
  146. EndProc AEP_DeviceInquiry
  147. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  148. VXD_PAGEABLE_CODE_ENDS
  149. end