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

DNA

开发平台:

C/C++

  1. .386p
  2. .xlist
  3. include vmm.inc
  4. include blockdev.inc
  5. include cdioctl.inc
  6. include ior.inc
  7. include iop.inc
  8. include debug.inc
  9. ; include iodebug.inc     ; various IOS assertions (like AssertIOP)
  10. .list
  11. VXD_LOCKED_DATA_SEG
  12. extrn hFile:WORD
  13. VXD_LOCKED_DATA_ENDS
  14. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  15. VXD_LOCKED_CODE_SEG
  16. public OnCDRomIOCtl
  17. BeginProc OnCDRomIOCtl , esp, sCall
  18. ArgVar IOR_ptr,DWORD
  19. TRAP
  20. EnterProc
  21. mov eax, IOR_ptr
  22. push ebx
  23. mov ebx, eax
  24. movzx eax, [ebx]._ureq._IOR_ioctl_function
  25. cmp eax, CD_IO_RESET_DRIVE
  26. je ResetDrive
  27. cmp eax, CD_IO_SEEK
  28. je Seek
  29. cmp eax, CD_IO_GET_DEV_STATUS
  30. je GetDevStatus
  31. ; cmp eax, CD_IO_QUERY_IOCTL_FUNC
  32. ; je QueryIoctlFunc
  33. cmp eax, CD_IO_DISC_INFO
  34. je GetDiscInfo
  35. mov [ebx]._ureq._IOR_ioctl_return, IORS_INVALID_COMMAND
  36. xor eax,eax
  37. jmp IO_invalid
  38. IO_Quit:
  39. mov [ebx].IOR_status, IORS_SUCCESS
  40. jmp IO_finish
  41. IO_invalid:
  42. mov [ebx].IOR_status, IORS_INVALID_COMMAND
  43. IO_finish:
  44. pop ebx
  45. LeaveProc
  46. return
  47. ResetDrive:
  48. mov [ebx]._ureq._IOR_ioctl_return, NO_ERROR
  49. jmp IO_Quit
  50. Seek:
  51. mov [ebx]._ureq._IOR_ioctl_return, NO_ERROR
  52. jmp IO_Quit
  53. GetDevStatus:
  54. mov [ebx]._ureq._IOR_ioctl_return, NO_ERROR
  55. mov eax, [ebx]._ureq._IOR_ioctl_buffer_ptr 
  56. mov [eax].DeviceStatus, CDDEVSTAT_AUDIO_MANIPULATE
  57. or [eax].DeviceStatus, CDDEVSTAT_REDBOOK_TOO
  58. ; or [eax].DeviceStatus, CDDEVSTAT_PLAY_AUDIO_TOO
  59. or [eax].DeviceStatus, CDDEVSTAT_NO_DISK_IN_DRIVE + CDDEVSTAT_CDXA
  60. jmp IO_Quit
  61. GetDiscInfo:
  62. test hFile, 0
  63. ; jz @F
  64. ;@@:
  65. mov [ebx]._ureq._IOR_ioctl_return, IORS_NO_MEDIA
  66. jmp IO_Quit
  67. QueryIoctlFunc:
  68. jmp IO_Quit
  69. EndProc OnCDRomIOCtl
  70. VXD_LOCKED_CODE_ENDS
  71. end