DISK_GEOMETRY_EX - NtDoc

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

typedef struct _DISK_GEOMETRY_EX {
  DISK_GEOMETRY Geometry;
  LARGE_INTEGER DiskSize;
  UCHAR         Data[1];
} DISK_GEOMETRY_EX, *PDISK_GEOMETRY_EX;

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

typedef struct _DISK_GEOMETRY_EX {
  DISK_GEOMETRY Geometry;
  LARGE_INTEGER DiskSize;
  BYTE          Data[1];
} DISK_GEOMETRY_EX, *PDISK_GEOMETRY_EX;

View the official Win32 API reference

NtDoc

No description available.

Windows Driver Kit DDI reference (ns-ntdddisk-_disk_geometry_ex)

_DISK_GEOMETRY_EX structure

Description

The DISK_GEOMETRY_EX structure is an arbitrary-length structure composed of a DISK_GEOMETRY structure followed by a DISK_PARTITION_INFO structure followed, in turn, by a DISK_DETECTION_INFO structure.

Members

Geometry

See DISK_GEOMETRY for a description of this member.

DiskSize

Contains the size in bytes of the disk.

Data

Beginning of the data block, starting with a DISK_PARTITION_INFO structure followed by a DISK_DETECTION_INFO structure.

Remarks

DISK_GEOMETRY_EX is used in conjunction with the IOCTL_DISK_GET_DRIVE_GEOMETRY_EX and the IOCTL_DISK_GET_MEDIA_TYPES IOCTLs, in order to retrieve information about the geometry of a physical disk (media type, number of cylinders, tracks per cylinder, sectors per track, and bytes per sector).

Because the partition and detect information are not at fixed locations within the DISK_GEOMETRY_EX structure, ntdddisk.h provides two macros for accessing this information. Both macros take a pointer to a structure of type DISK_GEOMETRY_EX as an argument:

#if (NTDDI_VERSION < NTDDI_WS03)
#define DiskGeometryGetPartition(Geometry)\
                        ((PDISK_PARTITION_INFO)((Geometry)+1))

#define DiskGeometryGetDetect(Geometry)\
                        ((PDISK_DETECTION_INFO)(((PBYTE)DiskGeometryGetPartition(Geometry)+\
                                        DiskGeometryGetPartition(Geometry)->SizeOfPartitionInfo)))
#else
#define DiskGeometryGetPartition(Geometry)\
                        ((PDISK_PARTITION_INFO)((Geometry)->Data))

#define DiskGeometryGetDetect(Geometry)\
                        ((PDISK_DETECTION_INFO)(((ULONG_PTR)DiskGeometryGetPartition(Geometry)+\
                                        DiskGeometryGetPartition(Geometry)->SizeOfPartitionInfo)))
#endif

See also

DISK_DETECTION_INFO

DISK_GEOMETRY

DISK_PARTITION_INFO

IOCTL_DISK_GET_DRIVE_GEOMETRY

IOCTL_DISK_GET_MEDIA_TYPES


Win32 API reference (ns-winioctl-disk_geometry_ex)

DISK_GEOMETRY_EX structure

Description

Describes the extended geometry of disk devices and media.

Members

Geometry

A DISK_GEOMETRY structure.

DiskSize

The disk size, in bytes. See LARGE_INTEGER.

Data

Any additional data. For more information, see Remarks.

Remarks

DISK_GEOMETRY_EX is a variable-length structure composed of a DISK_GEOMETRY structure followed by a DISK_PARTITION_INFO structure and a DISK_DETECTION_INFO structure. Because the detection information is not at a fixed location within the DISK_GEOMETRY_EX structure, use the following macro to access the DISK_DETECTION_INFO structure.

PDISK_DETECTION_INFO DiskGeometryGetDetect(
  PDISK_GEOMETRY_EX Geometry
);

Similarly, use the following macro to access the DISK_PARTITION_INFO structure.

PDISK_PARTITION_INFO DiskGeometryGetPartition(
  PDISK_GEOMETRY_EX Geometry
);

The information returned does not include the number of partitions nor the partition information contained in the DISK_PARTITION_INFO structure. To obtain this information, use the IOCTL_DISK_GET_DRIVE_LAYOUT_EX control code.

See also

DISK_GEOMETRY, DISK_DETECTION_INFO, DISK_PARTITION_INFO, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX