IOCTL_STORAGE_REINITIALIZE_MEDIA IOCTL (ntddstor.h)

A driver can issue a IOCTL_STORAGE_REINITIALIZE_MEDIA control code to offload the erasure process to the storage device.

Major code

IRP_MJ_DEVICE_CONTROL

Input buffer

For Windows Server 2022 and later, contains an optional STORAGE_REINITIALIZE_MEDIA structure with sanitize options, or NULL. For earlier OS versions, the input buffer is NULL.

Input buffer length

For Windows 10 release 21H1 and later, Parameters.DeviceIoControl.InputBufferLength indicates the size, in bytes, of the parameter buffer at Irp->AssociatedIrp.SystemBuffer, which must be >= sizeof(STORAGE_REINITIALIZE_MEDIA) if Parameters.DeviceIoControl.InputBuffer != NULL; otherwise zero. For earlier OS versions, the input buffer length is zero.

Output buffer

None.

Output buffer length

None.

Input / Output buffer

n/a

Input / Output buffer length

n/a

Status block

The Information field is set to zero if the call completes successfully; otherwise, it is set to a non-zero value.

Remarks

IOCTL_STORAGE_REINITIALIZE_MEDIA offloads the erasure to the storage device. There is no guarantee as to the successful deletion or recoverability of the data of the storage device after the command completes.

This IOCTL is limited to data disks on devices in the desktop device family. In Windows Preinstallation Environment (WinPE), this IOCTL is supported for both boot and data disks.

In earlier OS versions, the implementation requires no input and returns no output other than status.

Callers should first call FSCTL_LOCK_VOLUME before calling this IOCTL to flush out cached data in upper layers. No waiting of outstanding request completion is done before issuing the command to the device.

Requirements

Requirement Value
Minimum supported client Windows 10, version 1607
Minimum supported server Windows Server 2016
Header ntddstor.h

See also

IO_STATUS_BLOCK structure

STORAGE_REINITIALIZE_MEDIA

How to Complete an IRP in a Dispatch Routine