3 * Copyright (C) 2002, 2003 ReactOS Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 /* COPYRIGHT: See COPYING in the top level directory
20 * PROJECT: ReactOS text-mode setup
21 * FILE: subsys/system/usetup/partlist.h
22 * PURPOSE: Partition list functions
23 * PROGRAMMER: Eric Kohl
28 /* We have to define it there, because it is not in the MS DDK */
29 #define PARTITION_EXT2 0x83
31 typedef enum _FORMATSTATE
38 } FORMATSTATE
, *PFORMATSTATE
;
41 typedef struct _PARTENTRY
47 CHAR FileSystemName
[9];
49 /* Partition is unused disk space */
50 BOOLEAN Unpartitioned
;
52 /* Partition is new. Table does not exist on disk yet */
55 /* Partition was created automatically. */
58 FORMATSTATE FormatState
;
61 * Raw offset and length of the unpartitioned disk space.
62 * Includes the leading, not yet existing, partition table.
64 ULONGLONG UnpartitionedOffset
;
65 ULONGLONG UnpartitionedLength
;
67 PARTITION_INFORMATION PartInfo
[4];
69 } PARTENTRY
, *PPARTENTRY
;
72 typedef struct _BIOSDISKENTRY
79 CM_DISK_GEOMETRY_DEVICE_DATA DiskGeometry
;
80 CM_INT13_DRIVE_PARAMETER Int13DiskData
;
81 } BIOSDISKENTRY
, *PBIOSDISKENTRY
;
84 typedef struct _DISKENTRY
89 ULONGLONG TracksPerCylinder
;
90 ULONGLONG SectorsPerTrack
;
91 ULONGLONG BytesPerSector
;
94 ULONGLONG CylinderSize
;
107 /* Has the partition list been modified? */
111 BOOLEAN NoMbr
; /* MBR is absent */
113 UNICODE_STRING DriverName
;
115 LIST_ENTRY PartListHead
;
117 } DISKENTRY
, *PDISKENTRY
;
120 typedef struct _PARTLIST
133 PDISKENTRY CurrentDisk
;
134 PPARTENTRY CurrentPartition
;
135 UCHAR CurrentPartitionNumber
;
137 PDISKENTRY ActiveBootDisk
;
138 PPARTENTRY ActiveBootPartition
;
139 UCHAR ActiveBootPartitionNumber
;
141 LIST_ENTRY DiskListHead
;
142 LIST_ENTRY BiosDiskListHead
;
144 } PARTLIST
, *PPARTLIST
;
146 #define PARTITION_TBL_SIZE 4
148 #include <pshpack1.h>
150 typedef struct _PARTITION
152 unsigned char BootFlags
; /* bootable? 0=no, 128=yes */
153 unsigned char StartingHead
; /* beginning head number */
154 unsigned char StartingSector
; /* beginning sector number */
155 unsigned char StartingCylinder
; /* 10 bit nmbr, with high 2 bits put in begsect */
156 unsigned char PartitionType
; /* Operating System type indicator code */
157 unsigned char EndingHead
; /* ending head number */
158 unsigned char EndingSector
; /* ending sector number */
159 unsigned char EndingCylinder
; /* also a 10 bit nmbr, with same high 2 bit trick */
160 unsigned int StartingBlock
; /* first sector relative to start of disk */
161 unsigned int SectorCount
; /* number of sectors in partition */
162 } PARTITION
, *PPARTITION
;
164 typedef struct _PARTITION_SECTOR
166 UCHAR BootCode
[440]; /* 0x000 */
167 ULONG Signature
; /* 0x1B8 */
168 UCHAR Reserved
[2]; /* 0x1BC */
169 PARTITION Partition
[PARTITION_TBL_SIZE
]; /* 0x1BE */
170 USHORT Magic
; /* 0x1FE */
171 } PARTITION_SECTOR
, *PPARTITION_SECTOR
;
177 LIST_ENTRY ListEntry
;
181 } BIOS_DISK
, *PBIOS_DISK
;
184 CreatePartitionList (SHORT Left
,
190 DestroyPartitionList (PPARTLIST List
);
193 DrawPartitionList (PPARTLIST List
);
196 SelectPartition(PPARTLIST List
, ULONG DiskNumber
, ULONG PartitionNumber
);
199 SetMountedDeviceValues(PPARTLIST List
);
202 ScrollDownPartitionList (PPARTLIST List
);
205 ScrollUpPartitionList (PPARTLIST List
);
208 CreateNewPartition (PPARTLIST List
,
209 ULONGLONG PartitionSize
,
213 DeleteCurrentPartition (PPARTLIST List
);
216 CheckActiveBootPartition (PPARTLIST List
);
219 CheckForLinuxFdiskPartitions (PPARTLIST List
);
222 WritePartitionsToDisk (PPARTLIST List
);