ReactOS  0.4.9-dev-717-g6d91262
partlist.h
Go to the documentation of this file.
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 {
36 
37 typedef enum _FORMATMACHINESTATE
38 {
49 
50 typedef struct _PARTENTRY
51 {
53 
55 
58 
64 
68 
70 
71  /* Partition is partitioned disk space */
73 
74  /* Partition is new, table does not exist on disk yet */
76 
77  /* Partition was created automatically */
79 
81 
82  /* Partition must be checked */
84 
87 
88 
89 typedef struct _BIOSDISKENTRY
90 {
99 
100 
101 typedef struct _DISKENTRY
102 {
104 
109 
113 
116 // ULONG Signature;
117 // ULONG Checksum;
118 
123 
124  /* Has the partition list been modified? */
126 
128  BOOLEAN NoMbr; /* MBR is absent */
129 
131 
133 
134  PPARTENTRY ExtendedPartition;
135 
138 
140 
141 
142 typedef struct _PARTLIST
143 {
148 
151 
152  PDISKENTRY CurrentDisk;
153  PPARTENTRY CurrentPartition;
154 
155  /* The system disk and partition where the boot manager resides */
156  PDISKENTRY SystemDisk;
157  PPARTENTRY SystemPartition;
158  /*
159  * The original system disk and partition in case we are redefining them
160  * because we do not have write support on them.
161  * Please not that this is partly a HACK and MUST NEVER happen on
162  * architectures where real system partitions are mandatory (because then
163  * they are formatted in FAT FS and we support write operation on them).
164  */
165  PDISKENTRY OriginalSystemDisk;
167 
168  PDISKENTRY TempDisk;
169  PPARTENTRY TempPartition;
171 
174 
175 } PARTLIST, *PPARTLIST;
176 
177 #define PARTITION_TBL_SIZE 4
178 
179 #include <pshpack1.h>
180 
181 typedef struct _PARTITION
182 {
183  unsigned char BootFlags; /* bootable? 0=no, 128=yes */
184  unsigned char StartingHead; /* beginning head number */
185  unsigned char StartingSector; /* beginning sector number */
186  unsigned char StartingCylinder; /* 10 bit nmbr, with high 2 bits put in begsect */
187  unsigned char PartitionType; /* Operating System type indicator code */
188  unsigned char EndingHead; /* ending head number */
189  unsigned char EndingSector; /* ending sector number */
190  unsigned char EndingCylinder; /* also a 10 bit nmbr, with same high 2 bit trick */
191  unsigned int StartingBlock; /* first sector relative to start of disk */
192  unsigned int SectorCount; /* number of sectors in partition */
194 
195 typedef struct _PARTITION_SECTOR
196 {
197  UCHAR BootCode[440]; /* 0x000 */
198  ULONG Signature; /* 0x1B8 */
199  UCHAR Reserved[2]; /* 0x1BC */
201  USHORT Magic; /* 0x1FE */
203 
204 #include <poppack.h>
205 
206 typedef struct
207 {
213 
214 PPARTLIST
216  SHORT Left,
217  SHORT Top,
218  SHORT Right,
219  SHORT Bottom);
220 
221 VOID
223  PPARTLIST List);
224 
225 VOID
227  PPARTLIST List);
228 
229 DWORD
231  PPARTLIST List,
232  ULONG DiskNumber,
234 
235 BOOL
237  PPARTLIST List);
238 
239 BOOL
241  PPARTLIST List);
242 
243 BOOL
245  PPARTLIST List);
246 
247 VOID
249  PPARTLIST List,
251  BOOLEAN AutoCreate);
252 
253 VOID
255  PPARTLIST List,
257 
258 VOID
260  PPARTLIST List,
262  BOOLEAN AutoCreate);
263 
264 VOID
266  PPARTLIST List);
267 
268 VOID
270  IN PPARTLIST List,
272 
273 BOOLEAN
275  PPARTLIST List);
276 
277 ULONG
279  IN PPARTLIST List);
280 
281 ULONG
283  IN PPARTLIST List);
284 
285 ULONG
287  IN PPARTLIST List);
288 
289 BOOL
291  IN PPARTLIST List,
292  OUT PDISKENTRY *pDiskEntry,
293  OUT PPARTENTRY *pPartEntry);
294 
295 BOOL
297  IN PPARTLIST List,
298  OUT PDISKENTRY *pDiskEntry,
299  OUT PPARTENTRY *pPartEntry);
300 
301 VOID
303  UCHAR partitionType,
304  PCHAR strPartType,
305  DWORD cchPartType);
306 
307 /* EOF */
LIST_ENTRY PrimaryPartListHead
Definition: partlist.h:136
signed char * PCHAR
Definition: retypes.h:7
VOID CreateExtendedPartition(PPARTLIST List, ULONGLONG SectorCount)
Definition: partlist.c:2835
DWORD SelectPartition(PPARTLIST List, ULONG DiskNumber, ULONG PartitionNumber)
Definition: partlist.c:2134
#define IN
Definition: typedefs.h:38
ULONG PartitionNumber
Definition: partlist.h:62
VOID GetPartTypeStringFromPartitionType(UCHAR partitionType, PCHAR strPartType, DWORD cchPartType)
Definition: partlist.c:176
SHORT Top
Definition: partlist.h:145
ULARGE_INTEGER StartSector
Definition: partlist.h:56
USHORT Id
Definition: partlist.h:122
BOOL GetNextUncheckedPartition(IN PPARTLIST List, OUT PDISKENTRY *pDiskEntry, OUT PPARTENTRY *pPartEntry)
Definition: partlist.c:3662
enum _FORMATSTATE * PFORMATSTATE
LIST_ENTRY BiosDiskListHead
Definition: partlist.h:173
BOOLEAN WritePartitionsToDisk(PPARTLIST List)
Definition: partlist.c:3464
ULONG CylinderAlignment
Definition: partlist.h:112
ULONG PrimaryPartitionCreationChecks(IN PPARTLIST List)
Definition: partlist.c:3541
struct _DISKENTRY * PDISKENTRY
struct _PARTENTRY * PPARTENTRY
unsigned char EndingSector
Definition: partlist.h:189
USHORT Bus
Definition: partlist.h:121
ULARGE_INTEGER SectorCount
Definition: partlist.h:57
ULONG DiskNumber
Definition: partlist.h:209
enum _FORMATSTATE FORMATSTATE
ULONG Signature
Definition: partlist.h:211
ULONG Checksum
Definition: partlist.h:94
char CHAR
Definition: xmlstorage.h:175
struct _PARTLIST * PPARTLIST
struct _BIOSDISKENTRY * PBIOSDISKENTRY
LIST_ENTRY DiskListHead
Definition: partlist.h:172
ULONG Signature
Definition: partlist.h:93
ULONG DiskNumber
Definition: partlist.h:119
enum _FORMATMACHINESTATE * PFORMATMACHINESTATE
_In_ ULONG _In_ ULONG PartitionNumber
Definition: iofuncs.h:2056
static PFILE_SYSTEM_LIST FileSystemList
Definition: usetup.c:65
LIST_ENTRY ListEntry
Definition: partlist.h:208
DWORD DWORD
Definition: winlogon.h:75
unsigned char EndingCylinder
Definition: partlist.h:190
struct _FILE_SYSTEM_ITEM * FileSystem
Definition: partlist.h:85
PPARTENTRY SystemPartition
Definition: partlist.h:157
BOOL GetNextUnformattedPartition(IN PPARTLIST List, OUT PDISKENTRY *pDiskEntry, OUT PPARTENTRY *pPartEntry)
Definition: partlist.c:3607
PPARTENTRY ExtendedPartition
Definition: partlist.h:134
PDISKENTRY TempDisk
Definition: partlist.h:168
_FORMATMACHINESTATE
Definition: partlist.h:37
CHAR FileSystemName[9]
Definition: partlist.h:67
LIST_ENTRY ListEntry
Definition: partlist.h:52
CHAR VolumeLabel[17]
Definition: partlist.h:66
BOOLEAN LogicalPartition
Definition: partlist.h:69
unsigned char BootFlags
Definition: partlist.h:183
PDISKENTRY OriginalSystemDisk
Definition: partlist.h:165
struct _PARTITION_SECTOR * PPARTITION_SECTOR
FORMATSTATE FormatState
Definition: partlist.h:80
short SHORT
Definition: pedump.c:59
ULONG LogicalPartitionCreationChecks(IN PPARTLIST List)
Definition: partlist.c:3589
BOOLEAN Dirty
Definition: partlist.h:125
VOID DrawPartitionList(PPARTLIST List)
Definition: partlist.c:1890
SHORT Right
Definition: partlist.h:146
unsigned int SectorCount
Definition: partlist.h:192
unsigned int StartingBlock
Definition: partlist.h:191
BOOL ScrollUpPartitionList(PPARTLIST List)
Definition: partlist.c:2279
ULARGE_INTEGER SectorCount
Definition: partlist.h:110
struct _PARTITION PARTITION
BOOLEAN AutoCreate
Definition: partlist.h:78
ULONG SectorAlignment
Definition: partlist.h:111
struct _PARTENTRY PARTENTRY
unsigned char BOOLEAN
VOID CreateLogicalPartition(PPARTLIST List, ULONGLONG SectorCount, BOOLEAN AutoCreate)
Definition: partlist.c:2944
SHORT Bottom
Definition: partlist.h:147
enum _FORMATMACHINESTATE FORMATMACHINESTATE
SHORT Offset
Definition: partlist.h:150
unsigned int BOOL
Definition: ntddk_ex.h:94
UCHAR PartitionType
Definition: partlist.h:60
BOOLEAN BiosFound
Definition: partlist.h:114
VOID CreatePrimaryPartition(PPARTLIST List, ULONGLONG SectorCount, BOOLEAN AutoCreate)
Definition: partlist.c:2716
struct _DISKENTRY * DiskEntry
Definition: partlist.h:54
ULONG BytesPerSector
Definition: partlist.h:108
LIST_ENTRY List
Definition: psmgr.c:57
UNICODE_STRING DriverName
Definition: partlist.h:130
uint64_t ULONGLONG
Definition: typedefs.h:65
unsigned char StartingCylinder
Definition: partlist.h:186
struct _PARTITION * PPARTITION
CM_DISK_GEOMETRY_DEVICE_DATA DiskGeometry
Definition: partlist.h:96
CHAR DriveLetter
Definition: partlist.h:65
FORMATMACHINESTATE FormatState
Definition: partlist.h:170
LIST_ENTRY ListEntry
Definition: partlist.h:103
BOOL SetMountedDeviceValues(PPARTLIST List)
Definition: partlist.c:3492
unsigned char PartitionType
Definition: partlist.h:187
VOID CheckActiveSystemPartition(IN PPARTLIST List, IN PFILE_SYSTEM_LIST FileSystemList)
Definition: partlist.c:3144
PPARTENTRY TempPartition
Definition: partlist.h:169
unsigned char UCHAR
Definition: xmlstorage.h:181
PDISKENTRY SystemDisk
Definition: partlist.h:156
ULONG SectorsPerTrack
Definition: partlist.h:107
ULONG BiosDiskNumber
Definition: partlist.h:115
struct _BIOSDISKENTRY BIOSDISKENTRY
Definition: typedefs.h:117
ULONG SectorCount
Definition: part_xbox.c:32
ULONG PVOID Reserved
Definition: ntimage.h:533
ULONGLONG Cylinders
Definition: partlist.h:105
BOOLEAN New
Definition: partlist.h:75
struct BIOS_DISK * PBIOS_DISK
BOOLEAN Recognized
Definition: partlist.h:95
BOOL ScrollDownPartitionList(PPARTLIST List)
Definition: partlist.c:2183
BOOLEAN NeedsCheck
Definition: partlist.h:83
unsigned char EndingHead
Definition: partlist.h:188
PPARTENTRY OriginalSystemPartition
Definition: partlist.h:166
SHORT Left
Definition: partlist.h:144
static LPHIST_ENTRY Bottom
Definition: history.c:54
LIST_ENTRY ListEntry
Definition: partlist.h:91
unsigned char StartingHead
Definition: partlist.h:184
PPARTLIST CreatePartitionList(SHORT Left, SHORT Top, SHORT Right, SHORT Bottom)
Definition: partlist.c:1398
unsigned short USHORT
Definition: pedump.c:61
_FORMATSTATE
Definition: partlist.h:28
ULONG DiskNumber
Definition: partlist.h:92
PARTITION Partition[PARTITION_TBL_SIZE]
Definition: partlist.h:200
UCHAR BootCode[440]
Definition: partlist.h:197
USHORT Port
Definition: partlist.h:120
PPARTENTRY CurrentPartition
Definition: partlist.h:153
PDISKENTRY CurrentDisk
Definition: partlist.h:152
VOID DestroyPartitionList(PPARTLIST List)
Definition: partlist.c:1517
ULONG TracksPerCylinder
Definition: partlist.h:106
struct _PARTLIST PARTLIST
LIST_ENTRY LogicalPartListHead
Definition: partlist.h:137
BOOLEAN BootIndicator
Definition: partlist.h:59
#define OUT
Definition: typedefs.h:39
struct _DISKENTRY DISKENTRY
unsigned int ULONG
Definition: retypes.h:1
SHORT Line
Definition: partlist.h:149
ULONG ExtendedPartitionCreationChecks(IN PPARTLIST List)
Definition: partlist.c:3563
CM_INT13_DRIVE_PARAMETER Int13DiskData
Definition: partlist.h:97
unsigned char StartingSector
Definition: partlist.h:185
VOID DeleteCurrentPartition(PPARTLIST List)
Definition: partlist.c:3031
ULONG Identifier
Definition: partlist.h:210
PDRIVE_LAYOUT_INFORMATION LayoutBuffer
Definition: partlist.h:132
static LPHIST_ENTRY Top
Definition: history.c:53
struct _PARTITION_SECTOR PARTITION_SECTOR
Definition: partlist.h:39
BOOLEAN NewDisk
Definition: partlist.h:127
BOOLEAN NoMbr
Definition: partlist.h:128
#define PARTITION_TBL_SIZE
Definition: partlist.h:177
ULONG HiddenSectors
Definition: partlist.h:61
BOOLEAN IsPartitioned
Definition: partlist.h:72
ULONG PartitionIndex
Definition: partlist.h:63