// ntdddisk.h
// CTL_CODE(0x0007, 0x028, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_DISK_GET_DRIVE_GEOMETRY_EX 0x000700A0
View the official Windows Driver Kit DDI reference
// winioctl.h
// CTL_CODE(0x0007, 0x028, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_DISK_GET_DRIVE_GEOMETRY_EX 0x000700A0
View the official Win32 API reference
No description available.
Returns information about the physical disk's geometry (media type, number of cylinders, tracks per cylinder, sectors per track, and bytes per sector).
The difference between IOCTL_DISK_GET_DRIVE_GEOMETRY_EX and the older IOCTL_DISK_GET_DRIVE_GEOMETRY request is that IOCTL_DISK_GET_DRIVE_GEOMETRY_EX can retrieve information from both Master Boot Record (MBR) and GUID Partition Table (GPT)-type partitioned media, whereas IOCTL_DISK_GET_DRIVE_GEOMETRY can only read MBR-style media.
None.
None.
The driver returns the DISK_GEOMETRY_EX data in the buffer at Irp->AssociatedIrp.SystemBuffer. The size of the output buffer may not be the same size as the input buffer.
Parameters.DeviceIoControl.OutputBufferLength in the I/O stack location of the IRP indicates the size, in bytes, of the buffer, which must be at least (sizeof(DISK_GEOMETRY) + sizeof(LARGE_INTEGER)) and up to (sizeof(DISK_GEOMETRY) + sizeof(LARGE_INTEGER) + sizeof(DISK_PARTITION_INFO) + sizeof(DISK_DETECTION_INFO)).
The Information field is set to the size, in bytes, of the returned data.
The Status field returns one of the following values:
Only callers above Partmgr.sys may call this IOCTL as it contains disk partition information.
This IOCTL uses IOCTL_DISK_GET_DRIVE_GEOMETRY to get the DISK_GEOMETRY structure and IOCTL_DISK_GET_LENGTH_INFO to get the GET_LENGTH_INFORMATION structure. Both of these IOCTL's are supported for use at the disk.sys level.
Retrieves extended information about the physical disk's geometry: type, number of cylinders, tracks per cylinder, sectors per track, bytes per sector, and size.
To perform this operation, call the DeviceIoControl function with the following parameters.
BOOL DeviceIoControl(
(HANDLE) hDevice, // handle to device
IOCTL_DISK_GET_DRIVE_GEOMETRY_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_GEOMETRY_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 DISK_GEOMETRY_EX data returned by the operation.
If the size of the output buffer is (sizeof(DISK_GEOMETRY) + sizeof(LARGE_INTEGER)), the output buffer receives only DISK_GEOMETRY data and disk size.
If you want to get DISK_PARTITION_INFO data and DISK_DETECTION_INFO data, the size of the output buffer must be at least (sizeof(DISK_GEOMETRY) + sizeof(LARGE_INTEGER) + sizeof(DISK_PARTITION_INFO) + sizeof(DISK_DETECTION_INFO)).
nOutBufferSize
[in]The size of the output buffer, in bytes. It must be at least (sizeof(DISK_GEOMETRY) + sizeof(LARGE_INTEGER)).
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.