winioctl

Bindings for the Win32 IoApiCtl API.

class gonto.win32.winioctl.CreateDiskGPT

Contains information that the IOCTL_DISK_CREATE_DISK control code uses to initialize GPT partition table (flattened GPT version).

Warning

The partition_style field MUST be set to PARTITION_STYLE.GPT.

See:

guid

Structure/Union member

max_partition_count

Structure/Union member

partition_style

Structure/Union member

class gonto.win32.winioctl.DiskExtent

Represents a disk extent.

See: https://learn.microsoft.com/en-us/windows/win32/api/winioctl/ns-winioctl-disk_extent

disk_number

Structure/Union member

extent_length

Structure/Union member

starting_offset

Structure/Union member

class gonto.win32.winioctl.FILE_ACCESS(*values)

Define the access check value for any access.

See: https://github.com/microsoft/win32metadata/blob/main/generation/WinSDK/RecompiledIdlHeaders/um/winioctl.h#L301

ANY = 0
READ = 1
SPECIAL = 0
WRITE = 2
gonto.win32.winioctl.IOCTL_DISK_BASE = 7

See: https://github.com/microsoft/win32metadata/blob/main/generation/WinSDK/RecompiledIdlHeaders/um/winioctl.h#L9013

gonto.win32.winioctl.IOCTL_DISK_CREATE_DISK = 507992

Initializes the specified disk and disk partition table using the information in the CREATE_DISK structure.

See: https://learn.microsoft.com/en-us/windows/win32/api/winioctl/ni-winioctl-ioctl_disk_create_disk

gonto.win32.winioctl.IOCTL_DISK_GET_DRIVE_LAYOUT_EX = 458832

Retrieves extended information for each entry in the partition tables for a disk.

See: https://learn.microsoft.com/en-us/windows/win32/api/winioctl/ni-winioctl-ioctl_disk_get_drive_layout_ex

gonto.win32.winioctl.IOCTL_DISK_SET_DRIVE_LAYOUT_EX = 507988

Partitions a disk according to the specified drive layout and partition information data.

See: https://learn.microsoft.com/en-us/windows/win32/api/winioctl/ni-winioctl-ioctl_disk_set_drive_layout_ex

gonto.win32.winioctl.IOCTL_DISK_UPDATE_PROPERTIES = 459072

Invalidates the cached partition table and re-enumerates the device.

See: https://learn.microsoft.com/en-us/windows/win32/api/winioctl/ni-winioctl-ioctl_disk_update_properties

gonto.win32.winioctl.IOCTL_VOLUME_BASE = 86

See: https://github.com/microsoft/win32metadata/blob/main/generation/WinSDK/RecompiledIdlHeaders/um/winioctl.h#L17713

gonto.win32.winioctl.IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS = 5636096

IOCTL to obtain the physical location of the specified volume on one or more disks.

See: https://learn.microsoft.com/en-us/windows/win32/api/winioctl/ni-winioctl-ioctl_volume_get_volume_disk_extents

class gonto.win32.winioctl.METHOD(*values)

Define the method codes for how buffers are passed for I/O and FS controls.

See: https://github.com/microsoft/win32metadata/blob/main/generation/WinSDK/RecompiledIdlHeaders/um/winioctl.h#L287

BUFFERED = 0
IN_DIRECT = 1
NEITHER = 3
OUT_DIRECT = 2
class gonto.win32.winioctl.PARTITION_STYLE(*values)

Represents the format of a partition.

See: https://learn.microsoft.com/en-us/windows/win32/api/winioctl/ne-winioctl-partition_style

GPT = 1
MBR = 0
RAW = 2
class gonto.win32.winioctl.PARTITION_TYPE_GUID(*values)

GUIDs that identifies partition types.

See: https://learn.microsoft.com/en-us/windows/win32/api/winioctl/ns-winioctl-partition_information_gpt

BASIC_DATA = b'\xa2\xa0\xd0\xeb\xe5\xb93D\x87\xc0h\xb6\xb7&\x99\xc7'
ENTRY_UNUSED = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
LDM_DATA = b'\xa0`\x9b\xaf1\x14bO\xbch3\x11qJi\xad'
LDM_METADATA = b'\xaa\xc8\x08X\x8f~\xe0B\x85\xd2\xe1\xe9\x044\xcf\xb3'
MSFT_RECOVERY = b'\xa4\xbb\x94\xde\xd1\x06@M\xa1j\xbf\xd5\x01y\xd6\xac'
MSFT_RESERVED = b'\x16\xe3\xc9\xe3\\\x0b\xb8M\x81}\xf9-\xf0\x02\x15\xae'
SYSTEM = b'(s*\xc1\x1f\xf8\xd2\x11\xbaK\x00\xa0\xc9>\xc9;'
class gonto.win32.winioctl.PartitionInformationExGPT

Contains GPT partition information.

See:

attributes

Structure/Union member

is_service_partition

Structure/Union member

name

Structure/Union member

partition_id

Structure/Union member

partition_length

Structure/Union member

partition_number

Structure/Union member

partition_ordinal

Structure/Union member

partition_style

Structure/Union member

partition_type

Structure/Union member

rewrite_partition

Structure/Union member

starting_offset

Structure/Union member

class gonto.win32.winioctl.VolumeDiskExtents

Represents a physical location on a disk. It is the output buffer for the IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS control code.

See: https://learn.microsoft.com/en-us/windows/win32/api/winioctl/ns-winioctl-volume_disk_extents

extents

Structure/Union member

number_of_disk_extents

Structure/Union member

gonto.win32.winioctl.drive_layout_information_ex_gpt_factory(partition_count: int = 1, **params) Structure

Generate a DriveLayoutInformationExGPT structure which can store the information for partition_count partitions.

Parameters:
  • partition_count – The number of partitions (default: 1).

  • params – Any member of the DriveLayoutInformationExGPT struct to initialize values.

class gonto.win32.winioctl.DriveLayoutInformationExGPT

Contains extended information about a drive’s partitions (flattened GPT variant).

See:

partition_style
partition_count
disk_id
starting_usable_offset
usable_length
max_partition_count
partition_entry