IOCTL_DISK_REASSIGN_BLOCKS_EX - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
// 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 reference

NtDoc

No description available.

Windows Driver Kit DDI reference (ni-ntdddisk-ioctl_disk_reassign_blocks_ex)

IOCTL_DISK_REASSIGN_BLOCKS_EX IOCTL

Description

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.

Parameters

Major code

Input buffer

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.

Input buffer length

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).

Output buffer

None.

Output buffer length

None.

Input/output buffer

Input/output buffer length

Status block

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.

See also

REASSIGN_BLOCKS_EX


Win32 API reference (ni-winioctl-ioctl_disk_reassign_blocks_ex)

IOCTL_DISK_REASSIGN_BLOCKS_EX IOCTL

Description

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
);

Parameters

Input buffer

Input buffer length

Output buffer

Output buffer length

Input/output buffer

Input/output buffer length

Status block

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.

Remarks

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).

See also