// ntdddisk.h
// CTL_CODE(0x0007, 0x014, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_DISK_GET_DRIVE_LAYOUT_EX 0x00070050
View the official Windows Driver Kit DDI reference
// winioctl.h
// CTL_CODE(0x0007, 0x014, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_DISK_GET_DRIVE_LAYOUT_EX 0x00070050
View the official Win32 API reference
No description available.
Returns information about the number of partitions, disk signature, and features of each partition on a disk. (Floppy drivers need not handle this request.)
None.
None.
The driver returns the DRIVE_LAYOUT_INFORMATION_EX data in the buffer at Irp->AssociatedIrp.SystemBuffer.
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_EX). Note that this structure contains a variable-sized array of PARTITION_INFORMATION_EX elements.
To determine the size of output buffer that is required, caller should send this IOCTL request in a loop. Every time the storage stack rejects the IOCTL with an error message indicating that the buffer was too small, caller should double the buffer size.
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_INFO_LENGTH_MISMATCH, STATUS_INSUFFICIENT_RESOURCES, or STATUS_BUFFER_TOO_SMALL.
Retrieves extended information for each entry in the partition tables for a disk.
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_EX, // 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
);
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_EX 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_EX 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_EX).
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.
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.
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.