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
45 struct _DISKENTRY
*DiskEntry
;
47 ULARGE_INTEGER StartSector
;
48 ULARGE_INTEGER SectorCount
;
50 BOOLEAN BootIndicator
;
53 ULONG PartitionNumber
;
58 CHAR FileSystemName
[9];
60 BOOLEAN ExtendedPartition
;
62 /* Partition is partitioned disk space */
63 BOOLEAN IsPartitioned
;
65 /* Partition is new. Table does not exist on disk yet */
68 /* Partition was created automatically. */
71 FORMATSTATE FormatState
;
73 } PARTENTRY
, *PPARTENTRY
;
76 typedef struct _BIOSDISKENTRY
83 CM_DISK_GEOMETRY_DEVICE_DATA DiskGeometry
;
84 CM_INT13_DRIVE_PARAMETER Int13DiskData
;
85 } BIOSDISKENTRY
, *PBIOSDISKENTRY
;
88 typedef struct _DISKENTRY
93 ULONG TracksPerCylinder
;
94 ULONG SectorsPerTrack
;
97 ULARGE_INTEGER SectorCount
;
98 ULONG SectorAlignment
;
101 ULONG BiosDiskNumber
;
110 /* Has the partition list been modified? */
114 BOOLEAN NoMbr
; /* MBR is absent */
116 UNICODE_STRING DriverName
;
118 PDRIVE_LAYOUT_INFORMATION LayoutBuffer
;
120 LIST_ENTRY PrimaryPartListHead
;
121 LIST_ENTRY ExtendedPartListHead
;
123 } DISKENTRY
, *PDISKENTRY
;
126 typedef struct _PARTLIST
139 PDISKENTRY CurrentDisk
;
140 PPARTENTRY CurrentPartition
;
142 PDISKENTRY ActiveBootDisk
;
143 PPARTENTRY ActiveBootPartition
;
145 LIST_ENTRY DiskListHead
;
146 LIST_ENTRY BiosDiskListHead
;
148 } PARTLIST
, *PPARTLIST
;
150 #define PARTITION_TBL_SIZE 4
152 #include <pshpack1.h>
154 typedef struct _PARTITION
156 unsigned char BootFlags
; /* bootable? 0=no, 128=yes */
157 unsigned char StartingHead
; /* beginning head number */
158 unsigned char StartingSector
; /* beginning sector number */
159 unsigned char StartingCylinder
; /* 10 bit nmbr, with high 2 bits put in begsect */
160 unsigned char PartitionType
; /* Operating System type indicator code */
161 unsigned char EndingHead
; /* ending head number */
162 unsigned char EndingSector
; /* ending sector number */
163 unsigned char EndingCylinder
; /* also a 10 bit nmbr, with same high 2 bit trick */
164 unsigned int StartingBlock
; /* first sector relative to start of disk */
165 unsigned int SectorCount
; /* number of sectors in partition */
166 } PARTITION
, *PPARTITION
;
168 typedef struct _PARTITION_SECTOR
170 UCHAR BootCode
[440]; /* 0x000 */
171 ULONG Signature
; /* 0x1B8 */
172 UCHAR Reserved
[2]; /* 0x1BC */
173 PARTITION Partition
[PARTITION_TBL_SIZE
]; /* 0x1BE */
174 USHORT Magic
; /* 0x1FE */
175 } PARTITION_SECTOR
, *PPARTITION_SECTOR
;
181 LIST_ENTRY ListEntry
;
185 } BIOS_DISK
, *PBIOS_DISK
;
195 DestroyPartitionList(
206 ULONG PartitionNumber
);
209 SetMountedDeviceValues(
213 ScrollDownPartitionList(
217 ScrollUpPartitionList(
221 CreatePrimaryPartition(
223 ULONGLONG PartitionSize
,
227 CreateExtendedPartition(
229 ULONGLONG PartitionSize
);
232 DeleteCurrentPartition(
236 CheckActiveBootPartition(
240 CheckForLinuxFdiskPartitions(
244 WritePartitionsToDisk(
248 PrimaryPartitionCreationChecks(
252 ExtendedPartitionCreationChecks(