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 LogicalPartition
;
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 PPARTENTRY ExtendedPartition
;
122 LIST_ENTRY PrimaryPartListHead
;
123 LIST_ENTRY LogicalPartListHead
;
125 } DISKENTRY
, *PDISKENTRY
;
128 typedef struct _PARTLIST
141 PDISKENTRY CurrentDisk
;
142 PPARTENTRY CurrentPartition
;
144 PDISKENTRY ActiveBootDisk
;
145 PPARTENTRY ActiveBootPartition
;
147 LIST_ENTRY DiskListHead
;
148 LIST_ENTRY BiosDiskListHead
;
150 } PARTLIST
, *PPARTLIST
;
152 #define PARTITION_TBL_SIZE 4
154 #include <pshpack1.h>
156 typedef struct _PARTITION
158 unsigned char BootFlags
; /* bootable? 0=no, 128=yes */
159 unsigned char StartingHead
; /* beginning head number */
160 unsigned char StartingSector
; /* beginning sector number */
161 unsigned char StartingCylinder
; /* 10 bit nmbr, with high 2 bits put in begsect */
162 unsigned char PartitionType
; /* Operating System type indicator code */
163 unsigned char EndingHead
; /* ending head number */
164 unsigned char EndingSector
; /* ending sector number */
165 unsigned char EndingCylinder
; /* also a 10 bit nmbr, with same high 2 bit trick */
166 unsigned int StartingBlock
; /* first sector relative to start of disk */
167 unsigned int SectorCount
; /* number of sectors in partition */
168 } PARTITION
, *PPARTITION
;
170 typedef struct _PARTITION_SECTOR
172 UCHAR BootCode
[440]; /* 0x000 */
173 ULONG Signature
; /* 0x1B8 */
174 UCHAR Reserved
[2]; /* 0x1BC */
175 PARTITION Partition
[PARTITION_TBL_SIZE
]; /* 0x1BE */
176 USHORT Magic
; /* 0x1FE */
177 } PARTITION_SECTOR
, *PPARTITION_SECTOR
;
183 LIST_ENTRY ListEntry
;
187 } BIOS_DISK
, *PBIOS_DISK
;
197 DestroyPartitionList(
208 ULONG PartitionNumber
);
211 SetMountedDeviceValues(
215 ScrollDownPartitionList(
219 ScrollUpPartitionList(
223 CreatePrimaryPartition(
225 ULONGLONG PartitionSize
,
229 CreateExtendedPartition(
231 ULONGLONG PartitionSize
);
234 CreateLogicalPartition(
236 ULONGLONG PartitionSize
);
239 DeleteCurrentPartition(
243 CheckActiveBootPartition(
247 CheckForLinuxFdiskPartitions(
251 WritePartitionsToDisk(
255 PrimaryPartitionCreationChecks(
259 ExtendedPartitionCreationChecks(
263 LogicalPartitionCreationChecks(