必须要写,全是英文的看的脑子都大了,从msdn上的说明直接翻译。
If a class driver for the target type of device exists, the application must send the request to the class driver. Thus, an application can send this request directly to the system port driver for a target logical unit (LU) only if there is no class driver for the type of device connected to that LU. The system port driver does not check to determine if a device has been claimed by a class driver before processing a pass-through request. Therefore, if an application bypasses a class driver that has claimed a device and sends a pass-through request for that device directly to the port driver, a conflict for control of the device can occur between the class driver and the application.
如果一个块驱动的目标设备不存在的话,这个应用可以向块驱动器发送请求。因此,只有当这个设备没有驱动程序的时候才允许应用程序直接向系统端口发送请求。系统端口驱动不会检查是否设备被声明,当系统去执行一个pass-through请求的时候。所以,如果应用绕过设备驱动而直接向驱动接口发送传送请求的话,可能引起驱动和应用对设备控制的矛盾。我理解就是一个设备不能同时由两个软件控制,否则会出错。
This request cannot be used if the command requires the underlying driver to access memory directly. If the caller's command might require direct access to memory, use IOCTL_ATA_PASS_THROUGH_DIRECT instead.
这个请求不能用于直接对内存的操作。如果想直接获得内存的权限,使用IOCTL_ATA_PASS_THROUGH_DIRECT代替。
-
Applications must not attempt to send a pass-through request asynchronously. All pass-through requests must be synchronous.
-
Applications do not require administrative privileges to send a pass-through request to a device, but they must have read/write access to the device.
程序不需要管理员特权就可以发送pass-though命令,但是他们必须有对设备读写的权限。
输入参数:InputBufferLength指定了输入数据的内存大小。如果是读操作,这个值必须等于sizeof (ATA_PASS_THROUGH_EX).无论是读还是写,当值小于sizeof (ATA_PASS_THROUGH_EX)时,都会报错。Irp->AssociatedIrp.SystemBuffer 内存什么意思?不懂,就当做是系统内存吧。在系统内存中必须要包含ATA_PASS_THROUGH_EX这个结构体,其中包含了操作码,及操作码的相关参数。用户必须对其初始化,其中PathId, TargetId, and Lun不用管。对于输出的参数来说,必须有结构体中的DataBufferOffset必须指向一列连续内存。(是有我写还是计算机在操作完成后写?)
输出参数:
指定输出使用ATA_PASS_THROUGH_EX结构,数据存在Irp->AssociatedIrp.SystemBuffer中。其中的DataTransferLength说明实际传了多少字节。如果是一个读操作的话,其值为sizeof(ATA_PASS_THROUGH_EX) + DataTransferLength。使用时可以减去结构体的长度。