Windows Driver Kit: Storage Devices
SMART_SEND_DRIVE_COMMAND
Operation
Sends one of the following Self-Monitoring Analysis and Reporting Technology (SMART) commands to the device:
- Enable or disable reporting on the device
- Enable or disable autosaving of attributes
- Save current attributes now
- Execute offline diagnostics
- Get current SMART status
- Write to SMART log
This IOCTL must be handled by drivers that support SMART.
Input
The buffer at Irp->AssociatedIrp.SystemBuffer contains a SENDCMDINPARAMS structure that describes the command being sent to the device. The irDriveRegs.bCommandReg member must specify SMART_CMD. The irDriveRegs.bFeaturesReg member must specify a SMART subcommand. For a list of subcommands, see IDEREGS.
If the caller specifies a SMART subcommand of SMART_WRITE_LOG in irDriveRegs.bFeaturesReg, caller must also indicate the number of sectors to write in irDriveRegs.bSectorCountReg. The input buffer size must be >= sizeof(SENDCMDINPARAMS) - 1) + (irDriveRegs.bSectorCountReg * SMART_LOG_SECTOR_SIZE). Caller must put the data to write in the buffer indicated by the bBuffer member of SENDCMDINPARAMS.
Parameters.DeviceIoControl.InputBufferLength specifies the size in, bytes, of the input buffer, which must be >= (sizeof(SENDCMDINPARAMS) − 1).
Parameters.DeviceIoControl.OutputBufferLength specifies the size, in bytes, of the output buffer, which must be >= (sizeof(SENDCMDOUTPARAMS) − 1). If SMART status is being requested, the output buffer must be >= (sizeof(SENDCMDOUTPARAMS) − 1 + sizeof(IDEREGS)).
Output
The driver returns the SENDCMDOUTPARAMS structure to the buffer at Irp->AssociatedIrp.SystemBuffer. If SMART status was requested and successfully received from the device, the driver includes the IDEREGS structure in the output buffer.
I/O Status Block
When the driver sets the Status field to STATUS_SUCCESS, it sets the Information field is set to ((sizeof(SENDCMDOUTPARAMS) − 1) + sizeof(IDEREGS)) for returning SMART status and to (sizeof(SENDCMDOUTPARAMS) − 1) for all other commands. The driver should set the Status field to STATUS_INVALID_PARAMETER if an input parameter is incorrect or to STATUS_IO_DEVICE_ERROR if the device aborts a command it does not support. If Status is not STATUS_SUCCESS, the driver sets the Information field to zero.
Requirements
Versions: Supported in Microsoft Windows 2000 and later operating systems.
Headers: Defined in Ntdddisk.h. Include Ntdddisk.h.
See Also
SENDCMDINPARAMS, SENDCMDOUTPARAMS