A question about IOCTL_ATA_PASS_THROUGH_DIRECT

Using ZwCreateFile + ZwDeviceIoControl, I was able to send “EC” Command with “IOCTL_SCSI_PASS_THROUGH_DIRECT” from kernel mode driver, and recieve information from SCSI devices like USBs.
and searching around I’ve seen mutliple people who state that “IOCTL_ATA_PASS_THROUGH_DIRECT” doesn’t work from kernel mode driver sending IOCTLs,
is it possible to send ATA commands from kernel driver at all? if so how?

is it possible to send ATA commands from kernel driver at all?

IOCTL_ATA_PASS_THROUGH_DIRECT can bsod if sent from kernel mode due to the buggy MS implementation. Best to stick to IOCTL_ATA_PASS_THROUGH from kernel mode.

I was able to send “EC” Command…and recieve information from SCSI devices like USBs

SCSI and USB don’t communicate using ATA protocol so sending native ATA to them using ATA pass through won’t work. I am guessing your EC command was sent using IOCTL_SCSI_PASS_THROUGH_DIRECT, wrapped in a pass through CDB, and handled by the firmware of certain drives that support it.

Should that be kernel mode or user mode?