ayncInit.asm
上传用户:lnzz01
上传日期:2013-05-23
资源大小:130k
文件大小:4k
- .386p
- .xlist
- include vmm.inc
- include debug.inc
- include ilb.inc
- include aep.inc
- include isp.inc
- include ddb.inc
- include dcb.inc
- include portddb.inc
-
- ; include iodebug.inc ; dragon debug stuff
- include configmg.inc ; used to process the dev node
- include opttest.inc ; optimized test, or, and and macros
- .list
- memcpy proto C, lpd:PTR, lps:DWORD, size_t:DWORD
- VXD_LOCKED_CODE_SEG
- extrn milb:DWORD
- extrn OnAsyncRequest:near
- BeginProc Port_Async_Request, esp ;处理系统事件
- ArgVar AEPPtr, DWORD
- TRAP
- EnterProc
-
- mov ebx, AEPPtr
- mov [ebx.AEP_result], AEP_SUCCESS
- mov si, [ebx.AEP_func]
- cmp si, AEP_INITIALIZE
- je AEP_Init
- cmp si, AEP_Boot_Complete
- je AEP_BootComplete
- cmp si, AEP_CONFIG_DCB
- je AEP_ConfigDcb
- cmp si, AEP_IOP_TIMEOUT
- je AEP_IopTimeOut
- cmp si, AEP_DEVICE_INQUIRY
- je AEP_DeviceInquiry
-
- mov [ebx.AEP_result],AEP_FAILURE
-
- LeaveProc
- Return
- EndProc Port_Async_Request
- VXD_LOCKED_CODE_ENDS
- ;==================================================
- VXD_PAGEABLE_DATA_SEG
- public DevCount
- DevCount db 0
- vendor db " Yan.J.F VCDRom Driver ",0,0
- BDF_Removable EQU 4
- VXD_PAGEABLE_DATA_ENDS
- ;==================================================
- VXD_PAGEABLE_CODE_SEG
- BeginProc AEP_Init
- TRAP
- EnterProc
- sub esp, size ISP_ddb_create
- mov edi, esp
-
- mov [edi].ISP_ddb_hdr.ISP_func, ISP_CREATE_DDB
- mov [edi].ISP_ddb_size, size DDB;
- mov [edi].ISP_ddb_flags, 0
-
- push edi
- call [milb.ILB_service_rtn]
- movzx eax, [edi].ISP_ddb_hdr.ISP_result
- add esp, size ISP_ddb_create + 4
- cmp eax, 0
- jne @F
-
- m_exit:
- ;;;;;;;;;;;// not deallocate!!!!!!!!!
- LeaveProc
- Return
- @@:
- mov [ebx.AEP_result],AEP_FAILURE
- jmp m_exit
-
- EndProc AEP_Init
- ;;;;;;;;;;;;;;;;;;;;;;;;;;
- BeginProc AEP_ConfigDcb
- TRAP
- EnterProc
- mov esi, [ebx].AEP_d_c_dcb
- inc [DevCount]
- mov [esi].DCB_device_type, DCB_type_cdrom ; 我是光驱
- mov [esi].DCB_disk_bpb_flags, DCBF_DISK_BPB_USEFAKE
- or [esi].DCB_device_flags, DCB_DEV_REMOVABLE
- or [esi].DCB_tsd_flags, DCB_TSD_ACTUAL_PRE_SET
- ;;;;;;;;;;;;;;;;;;;;;;
- mov [esi].DCB_max_xfer_len, 08000H
- mov [esi].DCB_max_sg_elements, 16
-
- push esi
- push edi
- mov esi, edi
- sub esp, size ISP_calldown_insert
- mov edi, esp
-
- mov [edi].ISP_func, ISP_insert_calldown
- mov [edi].ISP_i_cd_flags, DCB_dmd_small_memory
- or [edi].ISP_i_cd_flags, DCB_dmd_physical
- or [edi].ISP_i_cd_flags, DCB_dmd_load_eject_media
- mov [edi].ISP_i_cd_dcb, esi
- mov al, [ebx.AEP_lgn]
- mov [edi].ISP_i_cd_lgn, al
- mov [edi].ISP_i_cd_req, offset32 OnAsyncRequest ;挂接客户呼叫处理过程
- mov eax, [ebx.AEP_ddb]
- mov [edi].ISP_i_cd_ddb, eax
- mov [edi].ISP_i_cd_expan_len, 0
- push edi
- call [milb.ILB_Service_rtn]
- add esp, size ISP_calldown_insert + 4
-
- pop edi
- pop esi
- c_exit:
- LeaveProc
- Return
- failed_exit:
- mov [ebx].AEP_result, AEP_FAILURE
- jmp c_exit
-
- EndProc AEP_ConfigDcb
- ;;;;;;;;;;;;;;;;;;;;
-
- BeginProc AEP_BootComplete
- TRAP
- EnterProc
-
- cmp [DevCount], 0 ;我只建立一个虚拟光驱
- je @F
-
- LeaveProc
- Return
- @@:
- mov [ebx.AEP_result], AEP_FAILURE
- EndProc AEP_BootComplete
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;
- BeginProc AEP_IopTimeOut
-
- TRAP
-
- Return
-
- EndProc AEP_IopTimeOut
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- BeginProc AEP_DeviceInquiry ;填写虚拟光驱信息
-
- TRAP
- EnterProc
-
- mov esi, [ebx.AEP_i_d_dcb]
- ; AssertDCB <esi> this macro in the <iodebug.inc>
- movzx ecx, [esi].DCB_unit_on_ctl
- cmp ecx, 0
- jne @F
-
- mov [esi].DCB_inquiry_flags, DCB_type_cdrom
- invoke memcpy, addr [esi].DCB_vendor_id, near32 ptr [vendor], 28
-
- q_exit:
- LeaveProc
- Return
- @@:
- mov [ebx.AEP_result], AEP_NO_MORE_DEVICES
- jmp q_exit
- EndProc AEP_DeviceInquiry
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- VXD_PAGEABLE_CODE_ENDS
- end