IOCTL_STORAGE_GET_DEVICE_INTERNAL_LOG IOCTL (ntddstor.h)

A driver can use IOCTL_STORAGE_GET_DEVICE_INTERNAL_LOG to get the internal status data from the device.

Major code

IRP_MJ_INTERNAL_DEVICE_CONTROL

Input buffer

A GET_DEVICE_INTERNAL_STATUS_DATA_REQUEST structure that identifies the type of data to be queried.

Input buffer length

Parameters.DeviceIoControl.InputBufferLength indicates the size, in bytes, of the parameter buffer at Irp->AssociatedIrp.SystemBuffer, which must be >= sizeof(GET_DEVICE_INTERNAL_STATUS_DATA_REQUEST).

Output buffer

The driver returns output to the buffer at Irp->AssociatedIrp.SystemBuffer. This buffer contains a DEVICE_INTERNAL_STATUS_DATA structure with the device's internal status.

Output buffer length

Parameters.DeviceIoControl.OutputBufferLength in the I/O stack location indicates the size, in bytes, of the parameter buffer, which must be >= sizeof(DEVICE_INTERNAL_STATUS_DATA).

Input / Output buffer

n/a

Input / Output buffer length

n/a

Status block

Irp->IoStatus.Status is set to STATUS_SUCCESS if the request is successful. Otherwise, Status is set to the appropriate error condition as a NTSTATUS code. For more information, see NTSTATUS Values.

Remarks

IOCTL_STORAGE_GET_DEVICE_INTERNAL_LOG returns the host-initiated device telemetry log from any storage device. The following pseudocode shows how to request the telemetry data header:

// Allocate a GET_DEVICE_INTERNAL_STATUS_DATA_REQUEST structure, then
// initialize it with a data header request:
//   request.Version = sizeof(GET_DEVICE_INTERNAL_STATUS_DATA_REQUEST);
//   request.Size = sizeof(GET_DEVICE_INTERNAL_STATUS_DATA_REQUEST);
//   request.RequestDataType = DeviceCurrentInternalStatusDataHeader;

// Allocate a DEVICE_INTERNAL_STATUS_DATA structure in which
// to return the header data, with outputBufferLength set to
// (sizeof(DEVICE_INTERNAL_STATUS_DATA) + 512).

// Get the device internal status data.
BOOL result = TRUE;
ULONG returnedLength = 0;
result = DeviceIoControl(deviceHandle,
            IOCTL_STORAGE_GET_DEVICE_INTERNAL_LOG,
            &request,
            sizeof(GET_DEVICE_INTERNAL_STATUS_DATA_REQUEST),
            &outputBuffer,
            outputBufferLength,
            &returnedLength,
            NULL);

Requirements

Requirement Value
Minimum supported client Windows 10, version 2004
Header ntddstor.h

See also

DEVICE_INTERNAL_STATUS_DATA

GET_DEVICE_INTERNAL_STATUS_DATA_REQUEST