onioctl.asm
上传用户:lnzz01
上传日期:2013-05-23
资源大小:130k
文件大小:2k
- .386p
- .xlist
- include vmm.inc
- include blockdev.inc
- include cdioctl.inc
- include ior.inc
- include iop.inc
- include debug.inc
- ; include iodebug.inc ; various IOS assertions (like AssertIOP)
- .list
- VXD_LOCKED_DATA_SEG
- extrn hFile:WORD
- VXD_LOCKED_DATA_ENDS
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- VXD_LOCKED_CODE_SEG
- public OnCDRomIOCtl
- BeginProc OnCDRomIOCtl , esp, sCall
- ArgVar IOR_ptr,DWORD
-
- TRAP
- EnterProc
-
- mov eax, IOR_ptr
- push ebx
- mov ebx, eax
- movzx eax, [ebx]._ureq._IOR_ioctl_function
-
- cmp eax, CD_IO_RESET_DRIVE
- je ResetDrive
- cmp eax, CD_IO_SEEK
- je Seek
- cmp eax, CD_IO_GET_DEV_STATUS
- je GetDevStatus
- ; cmp eax, CD_IO_QUERY_IOCTL_FUNC
- ; je QueryIoctlFunc
- cmp eax, CD_IO_DISC_INFO
- je GetDiscInfo
-
- mov [ebx]._ureq._IOR_ioctl_return, IORS_INVALID_COMMAND
- xor eax,eax
- jmp IO_invalid
-
- IO_Quit:
- mov [ebx].IOR_status, IORS_SUCCESS
- jmp IO_finish
- IO_invalid:
- mov [ebx].IOR_status, IORS_INVALID_COMMAND
- IO_finish:
- pop ebx
- LeaveProc
- return
- ResetDrive:
- mov [ebx]._ureq._IOR_ioctl_return, NO_ERROR
- jmp IO_Quit
- Seek:
- mov [ebx]._ureq._IOR_ioctl_return, NO_ERROR
- jmp IO_Quit
- GetDevStatus:
- mov [ebx]._ureq._IOR_ioctl_return, NO_ERROR
- mov eax, [ebx]._ureq._IOR_ioctl_buffer_ptr
- mov [eax].DeviceStatus, CDDEVSTAT_AUDIO_MANIPULATE
- or [eax].DeviceStatus, CDDEVSTAT_REDBOOK_TOO
- ; or [eax].DeviceStatus, CDDEVSTAT_PLAY_AUDIO_TOO
- or [eax].DeviceStatus, CDDEVSTAT_NO_DISK_IN_DRIVE + CDDEVSTAT_CDXA
- jmp IO_Quit
-
- GetDiscInfo:
- test hFile, 0
- ; jz @F
- ;@@:
- mov [ebx]._ureq._IOR_ioctl_return, IORS_NO_MEDIA
- jmp IO_Quit
- QueryIoctlFunc:
- jmp IO_Quit
-
- EndProc OnCDRomIOCtl
- VXD_LOCKED_CODE_ENDS
- end