SHARE
TWEET

pb usb

a guest Jun 3rd, 2018 195 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  Structure SCSI_PASS_THROUGH_DIRECT ;PACK
  2.     Length.w ;0
  3.     ScsiStatus.b ;2
  4.     PathId.b ;3
  5.     TargetId.b ;4
  6.     Lun.b ;5
  7.     CdbLength.b ;6
  8.     SenseInfoLength.b ; 7
  9.     DataIn.b          ; 8    
  10.     __pack1.b
  11.     __pack2.b
  12.     __pack3.b
  13.     DataTransferLength.l ; 9 /  12
  14.     TimeOutValue.l
  15.     DataBuffer.l
  16.     SenseInfoOffset.l
  17.     Cdb.b[16]
  18.   EndStructure
  19.  
  20. #SCSI_IOCTL_DATA_OUT =          0
  21. #SCSI_IOCTL_DATA_IN  =          1
  22. #SCSI_IOCTL_DATA_UNSPECIFIED=       2
  23.  
  24.  
  25. Procedure _sendData(*p.SCSI_PASS_THROUGH_DIRECT, *buffer, len)
  26.  
  27. *p\Length = SizeOf(SCSI_PASS_THROUGH_DIRECT)
  28. *p\ScsiStatus=-1
  29. *p\PathId=-1
  30. *p\TargetId=-1
  31. *p\Lun=-1
  32. *p\CdbLength=16
  33. *p\SenseInfoLength=24
  34. *p\DataIn=#SCSI_IOCTL_DATA_OUT
  35. *p\DataTransferLength=len ;65536
  36. *p\TimeOutValue=5
  37. *p\DataBuffer=*buffer
  38. *p\SenseInfoOffset=48
  39. *p\Cdb[0]=-39
  40. *p\Cdb[1]=42
  41. *p\Cdb[2]=-1
  42. *p\Cdb[3]=0
  43. *p\Cdb[4]=0
  44. *p\Cdb[5]=0
  45. *p\Cdb[6]=0
  46. *p\Cdb[7]=0
  47. *p\Cdb[8]=0
  48. *p\Cdb[9]=0
  49. *p\Cdb[10]=0
  50. *p\Cdb[11]=0
  51. *p\Cdb[12]=0
  52. *p\Cdb[13]=0
  53. *p\Cdb[14]=79
  54. *p\Cdb[15]=84
  55. EndProcedure  
  56.  
  57. Procedure _readData(*p.SCSI_PASS_THROUGH_DIRECT, *buffer, len)
  58.  
  59. *p\Length = SizeOf(SCSI_PASS_THROUGH_DIRECT)
  60. *p\ScsiStatus=-1
  61. *p\PathId=-1
  62. *p\TargetId=-1
  63. *p\Lun=-1
  64. *p\CdbLength=16
  65. *p\SenseInfoLength=24
  66. *p\DataIn=#SCSI_IOCTL_DATA_IN
  67. *p\DataTransferLength=len ;65536
  68. *p\TimeOutValue=5
  69. *p\DataBuffer=*buffer
  70. *p\SenseInfoOffset=48
  71.  
  72. *p\Cdb[0]=-39
  73. *p\Cdb[1]=40
  74. *p\Cdb[2]=100
  75. *p\Cdb[3]=0
  76. *p\Cdb[4]=0
  77. *p\Cdb[5]=0
  78. *p\Cdb[6]=0
  79. *p\Cdb[7]=0
  80. *p\Cdb[8]=58
  81. *p\Cdb[9]=0
  82. *p\Cdb[10]=0
  83. *p\Cdb[11]=0
  84. *p\Cdb[12]=0
  85. *p\Cdb[13]=0
  86. *p\Cdb[14]=79
  87. *p\Cdb[15]=84
  88. EndProcedure  
  89.  
  90.  
  91.  
  92. buf = AllocateMemory(65536)
  93. dev = CreateFile_("\\.\F:", #GENERIC_READ|#GENERIC_WRITE, #FILE_SHARE_READ | #FILE_SHARE_WRITE,0,#OPEN_EXISTING,0,0)
  94.  
  95.  
  96. Debug 7
  97. in = AllocateMemory(112)
  98.  A$="Hello Ps"+Space(65536)
  99.  
  100. Repeat
  101.  
  102.   t=t+1
  103.  
  104. _sendData(in,@A$,65536)
  105. DeviceIoControl_(dev,315412,in,112,in,112,@ret,#Null)
  106.  
  107. ;
  108. _readData(in,buf, 65536)
  109. DeviceIoControl_(dev,315412,in,112,in,112,@ret,#Null)
  110.  
  111. Debug ret
  112. Debug PeekS(buf)
  113. Delay(100)
  114.  
  115.  
  116.  
  117.  
  118. ForEver
  119.  
  120. Debug ret
  121. CloseHandle_(dev)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top