Bewerken

Delen via


Handling SCSI Pass-Through Requests

A class driver that generates an IOCTL_SCSI_PASS_THROUGH request or an IOCTL_SCSI_PASS_THROUGH_DIRECT request is responsible for the following:

  • Setting the length of the user buffer at Parameters.DeviceIoControl.InputBufferLength to at least sizeof(SCSI_PASS_THROUGH) or sizeof(SCSI_PASS_THROUGH_DIRECT)

  • Setting up the storage port driver's I/O stack location as usual

  • Setting the MinorFunction in the IRP to IRP_MJ_DEVICE_CONTROL, which marks the request as having been processed by a storage class driver.

On receipt of an IOCTL_SCSI_PASS_THROUGH or IOCTL_SCSI_PASS_THROUGH_DIRECT request from a higher-level driver, a storage class driver's DispatchDeviceControl routine is responsible for checking the validity of the embedded SCSI command (CDB) and, if the command is valid for its device, sending the request to the storage port driver.

If the port driver's I/O stack location for an IOCTL_SCSI_PASS_THROUGH or IOCTL_SCSI_PASS_THROUGH_DIRECT request does not have its MinorFunction field set with IRP_MJ_DEVICE_CONTROL, the port driver assumes the request came directly from an application and that no class driver exists for the target device type. It is an application error to send such a request directly to the port driver for a device that has been claimed by a storage class driver.

The port driver does not check the validity of the SCSI command embedded in such a pass-through request.