IOCTL_DISK_GET_DRIVE_GEOMETRY - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
// 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

NtDoc

No description available.

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

IOCTL_DISK_GET_DRIVE_GEOMETRY IOCTL

Description

Returns information about the physical disk's geometry (media type, number of cylinders, tracks per cylinder, sectors per track, and bytes per sector).

Parameters

Major code

Input buffer

None

Input buffer length

None

Output buffer

The driver returns the DISK_GEOMETRY 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(DISK_GEOMETRY).

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_UNRECOGNIZED_MEDIA, STATUS_INVALID_PARAMETER, STATUS_INVALID_DEVICE_REQUEST, STATUS_INFO_LENGTH_MISMATCH, STATUS_INSUFFICIENT_RESOURCES, or STATUS_BUFFER_TOO_SMALL.

See also

DISK_GEOMETRY


Win32 API reference (ni-winioctl-ioctl_disk_get_drive_geometry)

IOCTL_DISK_GET_DRIVE_GEOMETRY IOCTL

Description

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
);

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_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.

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.

See also