// ntddscsi.h
typedef struct _ATA_PASS_THROUGH_EX {
USHORT Length;
USHORT AtaFlags;
UCHAR PathId;
UCHAR TargetId;
UCHAR Lun;
UCHAR ReservedAsUchar;
ULONG DataTransferLength;
ULONG TimeOutValue;
ULONG ReservedAsUlong;
ULONG_PTR DataBufferOffset;
UCHAR PreviousTaskFile[8];
UCHAR CurrentTaskFile[8];
} ATA_PASS_THROUGH_EX, *PATA_PASS_THROUGH_EX;
View the official Windows Driver Kit DDI referenceNo description available.
The ATA_PASS_THROUGH_EX structure is used in conjunction with an IOCTL_ATA_PASS_THROUGH request to instruct the port driver to send an embedded ATA command to the target device.
LengthSpecifies the length in bytes of the ATA_PASS_THROUGH_EX structure.
AtaFlagsIndicates the direction of data transfer and specifies the kind of operation to be performed. The value of this member must be some combination of the following flags:
| ATA flags | Meaning |
|---|---|
| ATA_FLAGS_DRDY_REQUIRED | Wait for DRDY status from the device before sending the command to the device. |
| ATA_FLAGS_DATA_IN | Read data from the device. |
| ATA_FLAGS_DATA_OUT | Write data to the device. |
| ATA_FLAGS_48BIT_COMMAND | The ATA command to be sent uses the 48-bit logical block address (LBA) feature set. When this flag is set, the contents of the PreviousTaskFile member in the ATA_PASS_THROUGH_EX structure should be valid. |
| ATA_FLAGS_USE_DMA | Set the transfer mode to DMA. |
| ATA_FLAGS_NO_MULTIPLE | Read single sector only. |
PathIdContains an integer that indicates the IDE port or bus for the request. This value is set by the port driver.
TargetIdContains an integer that indicates the target device on the bus. This value is set by the port driver.
LunIndicates the logical unit number of the device. This value is set by the port driver.
ReservedAsUcharReserved for future use.
DataTransferLengthIndicates the size, in bytes, of the data buffer. If an underrun occurs, the miniport driver must update this member to the number of bytes that were actually transferred.
TimeOutValueIndicates the number of seconds that are allowed for the request to execute before the OS-specific port driver determines that the request has timed out.
ReservedAsUlongReserved for future use.
DataBufferOffsetSpecifies the offset, in bytes, from the beginning of this structure to the data buffer.
PreviousTaskFileSpecifies the contents of the task file input registers prior to the current pass-through command. This member is not used when the ATA_FLAGS_48BIT_COMMAND flag is not set.
CurrentTaskFileSpecifies the content of the task file register on both input and output. On input, the array values in CurrentTaskFile map to the task file input registers in the following manner.
| Byte | Input Register |
|---|---|
| 0 | Features register |
| 1 | Sector count register |
| 2 | Sector number register |
| 3 | Cylinder low register |
| 4 | Cylinder high register |
| 5 | Device/head register |
| 6 | Command register |
| 7 | Reserved |
When IOCTL_ATA_PASS_THROUGH completes, the port driver updates CurrentTaskFile with the values that are present in the device's output registers at the completion of the embedded command. The array values in CurrentTaskFile correspond to the following task file output registers.
| Byte | Output Register |
|---|---|
| 0 | Error register |
| 1 | Sector count register |
| 2 | Sector number register |
| 3 | Cylinder low register |
| 4 | Cylinder high register |
| 5 | Device/head register |
| 6 | Status register |
| 7 | Reserved |
IOCTL_ATA_PASS_THROUGH is a buffered device control request. To bypass buffering in system memory, callers should use IOCTL_ATA_PASS_THROUGH_DIRECT and ATA_PASS_THROUGH_DIRECT. When handling an IOCTL_ATA_PASS_THROUGH_DIRECT request, the system locks down the buffer in user memory and the device accesses this memory directly.