IOCTL_DISK_GET_DRIVE_LAYOUT - NtDoc

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

// CTL_CODE(0x0007, 0x003, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_DISK_GET_DRIVE_LAYOUT 0x0007400C

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

// CTL_CODE(0x0007, 0x003, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_DISK_GET_DRIVE_LAYOUT 0x0007400C

View the official Win32 API reference

NtDoc

No description available.

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

IOCTL_DISK_GET_DRIVE_LAYOUT IOCTL

Description

Returns information about the number of partitions, disk signature, and features of each partition on a disk. (Floppy drivers need not handle this request.)

Parameters

Major code

Input buffer

None.

Input buffer length

None.

Output buffer

The driver returns the DRIVE_LAYOUT_INFORMATION data in the buffer at Irp->AssociatedIrp.SystemBuffer.

Output buffer length

Parameters.DeviceIoControl.OutputBufferLength in the I/O stack location of the IRP indicates the size, in bytes, of the buffer, which must be >= sizeof(DRIVE_LAYOUT_INFORMATION). Note that this structure contains a variable-sized array of PARTITION_INFORMATION elements.

Input/output buffer

Input/output buffer length

Status block

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

See also

DRIVE_LAYOUT_INFORMATION

PARTITION_INFORMATION


Win32 API reference (ni-winioctl-ioctl_disk_get_drive_layout)

IOCTL_DISK_GET_DRIVE_LAYOUT IOCTL

Description

Retrieves information for each entry in the partition tables for a disk.

[!NOTE] IOCTL_DISK_GET_DRIVE_LAYOUT has been superseded by IOCTL_DISK_GET_DRIVE_LAYOUT_EX, which retrieves layout information for AT and EFI (Extensible Firmware Interface) partitions.

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

BOOL DeviceIoControl(
  (HANDLE) hDevice,             // handle to device
  IOCTL_DISK_GET_DRIVE_LAYOUT,  // dwIoControlCode
  NULL,                         // lpInBuffer
  0,                            // nInBufferSize
  (LPVOID) lpOutBuffer,         // output buffer
  (DWORD) nOutBufferSize,       // size of output buffer
  (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_GET_DRIVE_LAYOUT for this operation.

lpInBuffer [in, optional]

Not used with this operation. Set to NULL.

nInBufferSize [in]

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

lpOutBuffer [out, optional]

A pointer to the output buffer that is to receive the DRIVE_LAYOUT_INFORMATION data returned by the operation.

If the output buffer is not large enough to store the data, the function returns FALSE and GetLastError returns ERROR_INSUFFICIENT_BUFFER.

nOutBufferSize [in]

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

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

This operation retrieves information for each primary partition as well as each logical drive. To determine whether the entry is an extended or unused partition, check the Disk Partition Types.

See also