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: base/setup/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
;
40 typedef enum _FORMATMACHINESTATE
43 FormatSystemPartition
,
44 FormatInstallPartition
,
48 CheckInstallPartition
,
51 } FORMATMACHINESTATE
, *PFORMATMACHINESTATE
;
53 typedef struct _PARTENTRY
57 struct _DISKENTRY
*DiskEntry
;
59 ULARGE_INTEGER StartSector
;
60 ULARGE_INTEGER SectorCount
;
62 BOOLEAN BootIndicator
;
65 ULONG PartitionNumber
;
70 CHAR FileSystemName
[9];
72 BOOLEAN LogicalPartition
;
74 /* Partition is partitioned disk space */
75 BOOLEAN IsPartitioned
;
77 /* Partition is new. Table does not exist on disk yet */
80 /* Partition was created automatically. */
83 FORMATSTATE FormatState
;
85 /* Partition must be checked */
88 struct _FILE_SYSTEM_ITEM
*FileSystem
;
89 } PARTENTRY
, *PPARTENTRY
;
92 typedef struct _BIOSDISKENTRY
99 CM_DISK_GEOMETRY_DEVICE_DATA DiskGeometry
;
100 CM_INT13_DRIVE_PARAMETER Int13DiskData
;
101 } BIOSDISKENTRY
, *PBIOSDISKENTRY
;
104 typedef struct _DISKENTRY
106 LIST_ENTRY ListEntry
;
109 ULONG TracksPerCylinder
;
110 ULONG SectorsPerTrack
;
111 ULONG BytesPerSector
;
113 ULARGE_INTEGER SectorCount
;
114 ULONG SectorAlignment
;
115 ULONG CylinderAlignment
;
118 ULONG BiosDiskNumber
;
127 /* Has the partition list been modified? */
131 BOOLEAN NoMbr
; /* MBR is absent */
133 UNICODE_STRING DriverName
;
135 PDRIVE_LAYOUT_INFORMATION LayoutBuffer
;
137 PPARTENTRY ExtendedPartition
;
139 LIST_ENTRY PrimaryPartListHead
;
140 LIST_ENTRY LogicalPartListHead
;
142 } DISKENTRY
, *PDISKENTRY
;
145 typedef struct _PARTLIST
158 PDISKENTRY CurrentDisk
;
159 PPARTENTRY CurrentPartition
;
162 PPARTENTRY BootPartition
;
165 PPARTENTRY TempPartition
;
166 FORMATMACHINESTATE FormatState
;
168 LIST_ENTRY DiskListHead
;
169 LIST_ENTRY BiosDiskListHead
;
171 } PARTLIST
, *PPARTLIST
;
173 #define PARTITION_TBL_SIZE 4
175 #include <pshpack1.h>
177 typedef struct _PARTITION
179 unsigned char BootFlags
; /* bootable? 0=no, 128=yes */
180 unsigned char StartingHead
; /* beginning head number */
181 unsigned char StartingSector
; /* beginning sector number */
182 unsigned char StartingCylinder
; /* 10 bit nmbr, with high 2 bits put in begsect */
183 unsigned char PartitionType
; /* Operating System type indicator code */
184 unsigned char EndingHead
; /* ending head number */
185 unsigned char EndingSector
; /* ending sector number */
186 unsigned char EndingCylinder
; /* also a 10 bit nmbr, with same high 2 bit trick */
187 unsigned int StartingBlock
; /* first sector relative to start of disk */
188 unsigned int SectorCount
; /* number of sectors in partition */
189 } PARTITION
, *PPARTITION
;
191 typedef struct _PARTITION_SECTOR
193 UCHAR BootCode
[440]; /* 0x000 */
194 ULONG Signature
; /* 0x1B8 */
195 UCHAR Reserved
[2]; /* 0x1BC */
196 PARTITION Partition
[PARTITION_TBL_SIZE
]; /* 0x1BE */
197 USHORT Magic
; /* 0x1FE */
198 } PARTITION_SECTOR
, *PPARTITION_SECTOR
;
204 LIST_ENTRY ListEntry
;
208 } BIOS_DISK
, *PBIOS_DISK
;
218 DestroyPartitionList(
229 ULONG PartitionNumber
);
232 SetMountedDeviceValues(
236 ScrollDownPartitionList(
240 ScrollUpPartitionList(
244 CreatePrimaryPartition(
246 ULONGLONG SectorCount
,
250 CreateExtendedPartition(
252 ULONGLONG SectorCount
);
255 CreateLogicalPartition(
257 ULONGLONG SectorCount
,
261 DeleteCurrentPartition(
265 CheckActiveBootPartition(
269 WritePartitionsToDisk(
273 PrimaryPartitionCreationChecks(
277 ExtendedPartitionCreationChecks(
281 LogicalPartitionCreationChecks(
285 GetNextUnformattedPartition(
287 OUT PDISKENTRY
*pDiskEntry
,
288 OUT PPARTENTRY
*pPartEntry
);
291 GetNextUncheckedPartition(
293 OUT PDISKENTRY
*pDiskEntry
,
294 OUT PPARTENTRY
*pPartEntry
);