[USETUP] Remove unused VolumeLabel and FileSystemName from the PARTENTRY type
[reactos.git] / base / setup / usetup / partlist.h
1 /*
2 * ReactOS kernel
3 * Copyright (C) 2002, 2003 ReactOS Team
4 *
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.
9 *
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.
14 *
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.
18 */
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
24 */
25
26 #pragma once
27
28 typedef enum _FORMATSTATE
29 {
30 Unformatted,
31 UnformattedOrDamaged,
32 UnknownFormat,
33 Preformatted,
34 Formatted
35 } FORMATSTATE, *PFORMATSTATE;
36
37 typedef enum _FORMATMACHINESTATE
38 {
39 Start,
40 FormatSystemPartition,
41 FormatInstallPartition,
42 FormatOtherPartition,
43 FormatDone,
44 CheckSystemPartition,
45 CheckInstallPartition,
46 CheckOtherPartition,
47 CheckDone
48 } FORMATMACHINESTATE, *PFORMATMACHINESTATE;
49
50 typedef struct _PARTENTRY
51 {
52 LIST_ENTRY ListEntry;
53
54 struct _DISKENTRY *DiskEntry;
55
56 ULARGE_INTEGER StartSector;
57 ULARGE_INTEGER SectorCount;
58
59 BOOLEAN BootIndicator;
60 UCHAR PartitionType;
61 ULONG HiddenSectors;
62 ULONG PartitionNumber;
63 ULONG PartitionIndex;
64
65 CHAR DriveLetter;
66
67 BOOLEAN LogicalPartition;
68
69 /* Partition is partitioned disk space */
70 BOOLEAN IsPartitioned;
71
72 /* Partition is new, table does not exist on disk yet */
73 BOOLEAN New;
74
75 /* Partition was created automatically */
76 BOOLEAN AutoCreate;
77
78 FORMATSTATE FormatState;
79
80 /* Partition must be checked */
81 BOOLEAN NeedsCheck;
82
83 struct _FILE_SYSTEM_ITEM *FileSystem;
84 } PARTENTRY, *PPARTENTRY;
85
86
87 typedef struct _BIOSDISKENTRY
88 {
89 LIST_ENTRY ListEntry;
90 ULONG DiskNumber;
91 ULONG Signature;
92 ULONG Checksum;
93 BOOLEAN Recognized;
94 CM_DISK_GEOMETRY_DEVICE_DATA DiskGeometry;
95 CM_INT13_DRIVE_PARAMETER Int13DiskData;
96 } BIOSDISKENTRY, *PBIOSDISKENTRY;
97
98
99 typedef struct _DISKENTRY
100 {
101 LIST_ENTRY ListEntry;
102
103 ULONGLONG Cylinders;
104 ULONG TracksPerCylinder;
105 ULONG SectorsPerTrack;
106 ULONG BytesPerSector;
107
108 ULARGE_INTEGER SectorCount;
109 ULONG SectorAlignment;
110 ULONG CylinderAlignment;
111
112 BOOLEAN BiosFound;
113 ULONG BiosDiskNumber;
114 // ULONG Signature;
115 // ULONG Checksum;
116
117 ULONG DiskNumber;
118 USHORT Port;
119 USHORT Bus;
120 USHORT Id;
121
122 /* Has the partition list been modified? */
123 BOOLEAN Dirty;
124
125 BOOLEAN NewDisk;
126 BOOLEAN NoMbr; /* MBR is absent */
127
128 UNICODE_STRING DriverName;
129
130 PDRIVE_LAYOUT_INFORMATION LayoutBuffer;
131
132 PPARTENTRY ExtendedPartition;
133
134 LIST_ENTRY PrimaryPartListHead;
135 LIST_ENTRY LogicalPartListHead;
136
137 } DISKENTRY, *PDISKENTRY;
138
139
140 typedef struct _PARTLIST
141 {
142 SHORT Left;
143 SHORT Top;
144 SHORT Right;
145 SHORT Bottom;
146
147 SHORT Line;
148 SHORT Offset;
149
150 PDISKENTRY CurrentDisk;
151 PPARTENTRY CurrentPartition;
152
153 /* The system disk and partition where the boot manager resides */
154 PDISKENTRY SystemDisk;
155 PPARTENTRY SystemPartition;
156 /*
157 * The original system disk and partition in case we are redefining them
158 * because we do not have write support on them.
159 * Please not that this is partly a HACK and MUST NEVER happen on
160 * architectures where real system partitions are mandatory (because then
161 * they are formatted in FAT FS and we support write operation on them).
162 */
163 PDISKENTRY OriginalSystemDisk;
164 PPARTENTRY OriginalSystemPartition;
165
166 PDISKENTRY TempDisk;
167 PPARTENTRY TempPartition;
168 FORMATMACHINESTATE FormatState;
169
170 LIST_ENTRY DiskListHead;
171 LIST_ENTRY BiosDiskListHead;
172
173 } PARTLIST, *PPARTLIST;
174
175 #define PARTITION_TBL_SIZE 4
176
177 #include <pshpack1.h>
178
179 typedef struct _PARTITION
180 {
181 unsigned char BootFlags; /* bootable? 0=no, 128=yes */
182 unsigned char StartingHead; /* beginning head number */
183 unsigned char StartingSector; /* beginning sector number */
184 unsigned char StartingCylinder; /* 10 bit nmbr, with high 2 bits put in begsect */
185 unsigned char PartitionType; /* Operating System type indicator code */
186 unsigned char EndingHead; /* ending head number */
187 unsigned char EndingSector; /* ending sector number */
188 unsigned char EndingCylinder; /* also a 10 bit nmbr, with same high 2 bit trick */
189 unsigned int StartingBlock; /* first sector relative to start of disk */
190 unsigned int SectorCount; /* number of sectors in partition */
191 } PARTITION, *PPARTITION;
192
193 typedef struct _PARTITION_SECTOR
194 {
195 UCHAR BootCode[440]; /* 0x000 */
196 ULONG Signature; /* 0x1B8 */
197 UCHAR Reserved[2]; /* 0x1BC */
198 PARTITION Partition[PARTITION_TBL_SIZE]; /* 0x1BE */
199 USHORT Magic; /* 0x1FE */
200 } PARTITION_SECTOR, *PPARTITION_SECTOR;
201
202 #include <poppack.h>
203
204 typedef struct
205 {
206 LIST_ENTRY ListEntry;
207 ULONG DiskNumber;
208 ULONG Identifier;
209 ULONG Signature;
210 } BIOS_DISK, *PBIOS_DISK;
211
212 PPARTLIST
213 CreatePartitionList(
214 SHORT Left,
215 SHORT Top,
216 SHORT Right,
217 SHORT Bottom);
218
219 VOID
220 DestroyPartitionList(
221 PPARTLIST List);
222
223 VOID
224 DrawPartitionList(
225 PPARTLIST List);
226
227 DWORD
228 SelectPartition(
229 PPARTLIST List,
230 ULONG DiskNumber,
231 ULONG PartitionNumber);
232
233 BOOL
234 SetMountedDeviceValues(
235 PPARTLIST List);
236
237 BOOL
238 ScrollDownPartitionList(
239 PPARTLIST List);
240
241 BOOL
242 ScrollUpPartitionList(
243 PPARTLIST List);
244
245 VOID
246 CreatePrimaryPartition(
247 PPARTLIST List,
248 ULONGLONG SectorCount,
249 BOOLEAN AutoCreate);
250
251 VOID
252 CreateExtendedPartition(
253 PPARTLIST List,
254 ULONGLONG SectorCount);
255
256 VOID
257 CreateLogicalPartition(
258 PPARTLIST List,
259 ULONGLONG SectorCount,
260 BOOLEAN AutoCreate);
261
262 VOID
263 DeleteCurrentPartition(
264 PPARTLIST List);
265
266 VOID
267 CheckActiveSystemPartition(
268 IN PPARTLIST List,
269 IN PFILE_SYSTEM_LIST FileSystemList);
270
271 BOOLEAN
272 WritePartitionsToDisk(
273 PPARTLIST List);
274
275 ULONG
276 PrimaryPartitionCreationChecks(
277 IN PPARTLIST List);
278
279 ULONG
280 ExtendedPartitionCreationChecks(
281 IN PPARTLIST List);
282
283 ULONG
284 LogicalPartitionCreationChecks(
285 IN PPARTLIST List);
286
287 BOOL
288 GetNextUnformattedPartition(
289 IN PPARTLIST List,
290 OUT PDISKENTRY *pDiskEntry,
291 OUT PPARTENTRY *pPartEntry);
292
293 BOOL
294 GetNextUncheckedPartition(
295 IN PPARTLIST List,
296 OUT PDISKENTRY *pDiskEntry,
297 OUT PPARTENTRY *pPartEntry);
298
299 VOID
300 GetPartTypeStringFromPartitionType(
301 UCHAR partitionType,
302 PCHAR strPartType,
303 DWORD cchPartType);
304
305 /* EOF */