// ntdddisk.h
// CTL_CODE(0x0007, 0x029, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
#define IOCTL_DISK_REASSIGN_BLOCKS_EX 0x0007C0A4
View the official Windows Driver Kit DDI reference// winioctl.h
// CTL_CODE(0x0007, 0x029, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
#define IOCTL_DISK_REASSIGN_BLOCKS_EX 0x0007C0A4
View the official Win32 API referenceNo description available.
Maps defective blocks to a new location on disk. This request instructs the device to reassign the bad block address to a good block from its spare-block pool. A IOCTL_DISK_REASSIGN_BLOCKS_EX request allows for a larger number of blocks for assignment than the IOCTL_DISK_REASSIGN_BLOCKS request.
The buffer at Irp->AssociatedIrp.SystemBuffer contains the REASSIGN_BLOCKS_EX values to be set. Note that this structure contains a variable-sized array of block numbers. It is the caller's responsibility to make sure that the array of block numbers is sorted in ascending order.
Parameters.DeviceIoControl.InputBufferLength in the I/O stack location of the IRP indicates the size, in bytes, of the buffer, which must be >= sizeof(REASSIGN_BLOCKS_EX).
None.
None.
The Information field is set to zero. The Status field can be set to STATUS_SUCCESS, or possibly to STATUS_INFO_LENGTH_MISMATCH, STATUS_INSUFFICIENT_RESOURCES, or STATUS_BUFFER_TOO_SMALL.
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
IOCTL_DISK_REASSIGN_BLOCKS_EX, // dwIoControlCode
(LPVOID) lpInBuffer, // input buffer
(DWORD) nInBufferSize, // size of input buffer
NULL, // lpOutBuffer
0, // nOutBufferSize
(LPDWORD) lpBytesReturned, // number of bytes returned
(LPOVERLAPPED) lpOverlapped // OVERLAPPED structure
);
Irp->IoStatus.Status is set to STATUS_SUCCESS if the request is successful.
Otherwise, Status to the appropriate error condition as a NTSTATUS code.
For more information, see NTSTATUS Values.
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).