// ntddscsi.h
// CTL_CODE(0x0004, 0x401, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
#define IOCTL_SCSI_PASS_THROUGH 0x0004D004
View the official Windows Driver Kit DDI referenceNo description available.
Allows an application to send almost any SCSI command to a target device, with the following restrictions:
The calling application creates the SCSI command descriptor block, which can include a request for request-sense data if a CHECK CONDITION occurs.
IOCTL_SCSI_PASS_THROUGH is a buffered device control request. To bypass buffering in system memory, callers should use IOCTL_SCSI_PASS_THROUGH_DIRECT. When handling an IOCTL_SCSI_PASS_THROUGH_DIRECT request, the system locks down the buffer in user memory and the device accesses this memory directly.
This request is typically used for transferring small amounts of data (<16K).
Applications can send this request by means of an IRP_MJ_DEVICE_CONTROL request.
Storage class drivers set the minor IRP number to IRP_MN_SCSI_CLASS to indicate that the request has been processed by a storage class driver.
Note The SCSI port driver and SCSI miniport driver models may be altered or unavailable in the future. Instead, we recommend using the Storport driver and Storport miniport driver models.
This structure includes a SCSI CDB, which must be initialized by the caller except for the path, target ID, and logical unit number (LUN), which are filled in by the port driver. For a data-out command, the data to be transferred is included in the buffer at Irp->AssociatedIrp.SystemBuffer at DataBufferOffset in the SCSI_PASS_THROUGH structure. However, the caller must allocate additional storage, immediately following SCSI_PASS_THROUGH, if the caller asks for request-sense data.
Parameters.DeviceIoControl.InputBufferLength indicates the size, in bytes, of the buffer at Irp->AssociatedIrp.SystemBuffer, which must be at least (sense data size + sizeof(SCSI_PASS_THROUGH)). The size of the SCSI_PASS_THROUGH structure varies, depending on its DataTransferLength specification.
The port driver returns any request-sense data and any data transferred from the device to the buffer at Irp->AssociatedIrp.SystemBuffer.
The SenseInfoLength and DataTransferLength in the SCSI_PASS_THROUGH structure are updated to indicate the amount of data transferred.
The Information field is set to the number of bytes returned in the output buffer at Irp->AssociatedIrp.SystemBuffer. The Status field is set to STATUS_SUCCESS, or possibly to STATUS_BUFFER_TOO_SMALL or STATUS_INVALID_PARAMETER if the input Length value in SCSI_PASS_THROUGH is improperly set.