Directs the disk device to map one or more blocks to its spare-block pool.

To perform this operation, call the DeviceIoControl function with the following parameters.

BOOL DeviceIoControl(
  (HANDLE) hDevice,                 // handle to device
  (LPVOID) lpInBuffer,              // input buffer
  (DWORD) nInBufferSize,            // size of input buffer
  NULL,                             // lpOutBuffer
  0,                                // nOutBufferSize
  (LPDWORD) lpBytesReturned,        // number of bytes returned
  (LPOVERLAPPED) lpOverlapped       // OVERLAPPED structure


The REASSIGN_BLOCKS_EX structure that the IOCTL_DISK_REASSIGN_BLOCKS_EX control code uses supports 8-byte Logical Block Addresses (LBA). For compatibility, the IOCTL_DISK_REASSIGN_BLOCKS control code and REASSIGN_BLOCKS structure should be used where the LBA fits in the 4-byte LBA that the REASSIGN_BLOCKS structure supports (typically drives up to 2 TB).


Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008, Windows Server 2003 with SP1 [desktop apps only]
Header winioctl.h (include Windows.h)

See also