// ntdddisk.h
// CTL_CODE(0x0007, 0x000, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_DISK_GET_DRIVE_GEOMETRY 0x00070000
View the official Windows Driver Kit DDI reference
// winioctl.h
// CTL_CODE(0x0007, 0x000, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_DISK_GET_DRIVE_GEOMETRY 0x00070000
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).
None
None
The driver returns the DISK_GEOMETRY 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(DISK_GEOMETRY).
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_UNRECOGNIZED_MEDIA, STATUS_INVALID_PARAMETER, STATUS_INVALID_DEVICE_REQUEST, STATUS_INFO_LENGTH_MISMATCH, STATUS_INSUFFICIENT_RESOURCES, or STATUS_BUFFER_TOO_SMALL.
Retrieves information about the physical disk's geometry: type, number of cylinders, tracks per cylinder, sectors per track, and bytes per sector.
[!NOTE] IOCTL_DISK_GET_DRIVE_GEOMETRY has been superseded by IOCTL_DISK_GET_DRIVE_GEOMETRY_EX, which retrieves additional information.
To perform this operation, call the DeviceIoControl function with the following parameters.
BOOL DeviceIoControl(
(HANDLE) hDevice, // handle to device
IOCTL_DISK_GET_DRIVE_GEOMETRY, // 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 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 data returned by the operation.
nOutBufferSize
[in]The size of the output buffer, in bytes. It must be >= sizeof(DISK_GEOMETRY).
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.