IOCTL_DISK_SET_DRIVE_LAYOUT_EX - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
// ntdddisk.h

// CTL_CODE(0x0007, 0x015, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
#define IOCTL_DISK_SET_DRIVE_LAYOUT_EX 0x0007C054

View the official Windows Driver Kit DDI reference
// winioctl.h

// CTL_CODE(0x0007, 0x015, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
#define IOCTL_DISK_SET_DRIVE_LAYOUT_EX 0x0007C054

View the official Win32 API reference

NtDoc

No description available.

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

IOCTL_DISK_SET_DRIVE_LAYOUT_EX IOCTL

Description

Repartitions a disk as specified. (Floppy drivers need not handle this request.)

Parameters

Major code

Input buffer

The buffer at Irp->AssociatedIrp.SystemBuffer contains the DRIVE_LAYOUT_INFORMATION_EX values to be set.

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

Output buffer

Returns updated DRIVE_LAYOUT_INFORMATION_EX, possibly with modified partition numbers, to the buffer at Irp->AssociatedIrp.SystemBuffer.

Output buffer length

Length of a DRIVE_LAYOUT_INFORMATION_EX.

Input/output buffer

Input/output buffer length

Status block

The Information field is set to the size, in bytes, of the returned information. The Status field can be set to STATUS_SUCCESS, or possibly to STATUS_INVALID_PARAMETER, STATUS_INFO_LENGTH_MISMATCH, STATUS_INSUFFICIENT_RESOURCES, or STATUS_BUFFER_TOO_SMALL.

See also

DRIVE_LAYOUT_INFORMATION_EX


Win32 API reference (ni-winioctl-ioctl_disk_set_drive_layout_ex)

IOCTL_DISK_SET_DRIVE_LAYOUT_EX IOCTL

Description

Partitions a disk according to the specified drive layout and partition information data.

To perform this operation, call the DeviceIoControl function with the following parameters. You must have write access to the drive in order to use this control code.

BOOL DeviceIoControl(
  (HANDLE) hDevice,                 // handle to device
  IOCTL_DISK_SET_DRIVE_LAYOUT_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

hDevice [in]

A handle to the disk.

To retrieve a device handle, call the CreateFile function.

dwIoControlCode [in]

The control code for the operation.

Use IOCTL_DISK_SET_DRIVE_LAYOUT_EX for this operation.

lpInBuffer [in, optional]

A pointer to the input buffer that contains the DRIVE_LAYOUT_INFORMATION_EX data to be set.

nInBufferSize [in]

The size of the input buffer, in bytes. It must be >= sizeof(DRIVE_LAYOUT_INFORMATION_EX).

lpOutBuffer [out, optional]

Not used with this operation. Set to NULL.

nOutBufferSize [in]

The size of the input buffer, in bytes. Set to 0 (zero).

lpBytesReturned [out, optional]

A pointer to a variable that receives the size of the data stored in the output buffer, in bytes.

lpOverlapped [in, out, optional]

A pointer to an OVERLAPPED structure.

Return value

If the operation completes successfully, the return value is nonzero.

If the operation fails or is pending, the return value is zero. To get extended error information, call GetLastError.

Remarks

When specifying a GUID partition table (GPT) as the PARTITION_STYLE of the CREATE_DISK structure, an application should wait for the MSR partition arrival before sending the IOCTL_DISK_SET_DRIVE_LAYOUT_EX control code. For more information about device notification, see RegisterDeviceNotification.

When creating and manipulating an Extended Boot Record (EBR), the first entry of the EBR should point to the logical drive that immediately follows the EBR and the next EBR should lie after the end of the current logical drive and before the start of the next logical drive.

If the partition is on a disk formatted as type master boot record (MBR), partition size totals are limited. For more information, see the Remarks section of IOCTL_DISK_SET_DRIVE_LAYOUT.

See also