ReactOS 0.4.16-dev-2610-ge2c92c0
part_gpt.h
Go to the documentation of this file.
1/*
2 * PROJECT: FreeLoader
3 * LICENSE: MIT (https://spdx.org/licenses/MIT)
4 * PURPOSE: GPT partitioning scheme support
5 * COPYRIGHT: Copyright 2026 Justin Miller <justin.miller@reactos.org>
6 */
7
8#pragma once
9
10/* GPT (GUID Partition Table) definitions */
11#define EFI_PARTITION_HEADER_SIGNATURE "EFI PART"
12#define EFI_HEADER_LOCATION 1ULL
13#define EFI_TABLE_REVISION 0x00010000
14#define EFI_PARTITION_ENTRIES_BLOCK 2ULL
15#define EFI_PARTITION_ENTRY_COUNT 128
16#define EFI_PARTITION_ENTRY_SIZE 128
17#define EFI_PARTITION_NAME_LENGTH 36
18
19/* GPT Partition Type GUIDs */
20#define EFI_PART_TYPE_UNUSED_GUID \
21 {0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}
22
23#define EFI_PART_TYPE_EFI_SYSTEM_PART_GUID \
24 {0xc12a7328, 0xf81f, 0x11d2, {0xba, 0x4b, 0x00, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b}}
25
26#ifndef PARTITION_GPT
27#define PARTITION_GPT 0xEE // GPT protective partition
28#endif
29
30#include <pshpack1.h>
31
32/* GPT Table Header */
33typedef struct _GPT_TABLE_HEADER
34{
35 CHAR Signature[8]; /* "EFI PART" */
36 UINT32 Revision; /* 0x00010000 */
37 UINT32 HeaderSize; /* Size of header (usually 92) */
38 UINT32 HeaderCrc32; /* CRC32 of header */
39 UINT32 Reserved; /* Must be 0 */
40 UINT64 MyLba; /* LBA of this header */
41 UINT64 AlternateLba; /* LBA of alternate header */
42 UINT64 FirstUsableLba; /* First usable LBA for partitions */
43 UINT64 LastUsableLba; /* Last usable LBA for partitions */
44 GUID DiskGuid; /* Disk GUID */
45 UINT64 PartitionEntryLba; /* LBA of partition entries array */
46 UINT32 NumberOfPartitionEntries; /* Number of partition entries */
47 UINT32 SizeOfPartitionEntry; /* Size of each entry (usually 128) */
48 UINT32 PartitionEntryArrayCrc32; /* CRC32 of partition entries array */
51
52/* GPT Partition Entry */
54{
55 GUID PartitionTypeGuid; /* Partition type GUID */
56 GUID UniquePartitionGuid; /* Unique partition GUID */
57 UINT64 StartingLba; /* Starting LBA */
58 UINT64 EndingLba; /* Ending LBA */
59 UINT64 Attributes; /* Partition attributes */
60 WCHAR PartitionName[EFI_PARTITION_NAME_LENGTH]; /* Partition name (UTF-16) */
63
64#include <poppack.h>
COMPILER_DEPENDENT_UINT64 UINT64
Definition: actypes.h:131
#define C_ASSERT(e)
Definition: intsafe.h:73
#define EFI_PARTITION_NAME_LENGTH
Definition: part_gpt.h:17
struct _GPT_PARTITION_ENTRY GPT_PARTITION_ENTRY
struct _GPT_TABLE_HEADER GPT_TABLE_HEADER
struct _GPT_TABLE_HEADER * PGPT_TABLE_HEADER
struct _GPT_PARTITION_ENTRY * PGPT_PARTITION_ENTRY
short WCHAR
Definition: pedump.c:58
char CHAR
Definition: pedump.c:57
Definition: part_gpt.h:54
UINT64 EndingLba
Definition: part_gpt.h:58
GUID UniquePartitionGuid
Definition: part_gpt.h:56
UINT64 Attributes
Definition: part_gpt.h:59
UINT64 StartingLba
Definition: part_gpt.h:57
GUID PartitionTypeGuid
Definition: part_gpt.h:55
WCHAR PartitionName[EFI_PARTITION_NAME_LENGTH]
Definition: part_gpt.h:60
UINT64 FirstUsableLba
Definition: part_gpt.h:42
UINT64 LastUsableLba
Definition: part_gpt.h:43
UINT32 Revision
Definition: part_gpt.h:36
UINT32 NumberOfPartitionEntries
Definition: part_gpt.h:46
UINT32 SizeOfPartitionEntry
Definition: part_gpt.h:47
UINT32 HeaderSize
Definition: part_gpt.h:37
UINT32 PartitionEntryArrayCrc32
Definition: part_gpt.h:48
UINT32 HeaderCrc32
Definition: part_gpt.h:38
UINT64 PartitionEntryLba
Definition: part_gpt.h:45
UINT32 Reserved
Definition: part_gpt.h:39
CHAR Signature[8]
Definition: part_gpt.h:35
UINT64 AlternateLba
Definition: part_gpt.h:41
uint32_t UINT32
Definition: typedefs.h:59