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
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, 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
26 #ifndef __PARTLIST_H__
27 #define __PARTLIST_H__
29 /* We have to define it there, because it is not in the MS DDK */
30 #define PARTITION_EXT2 0x83
32 typedef enum _FORMATSTATE
39 } FORMATSTATE
, *PFORMATSTATE
;
42 typedef struct _PARTENTRY
48 CHAR FileSystemName
[9];
50 /* Partition is unused disk space */
51 BOOLEAN Unpartitioned
;
53 /* Partition is new. Table does not exist on disk yet */
56 /* Partition was created automatically. */
59 FORMATSTATE FormatState
;
62 * Raw offset and length of the unpartitioned disk space.
63 * Includes the leading, not yet existing, partition table.
65 ULONGLONG UnpartitionedOffset
;
66 ULONGLONG UnpartitionedLength
;
68 PARTITION_INFORMATION PartInfo
[4];
70 } PARTENTRY
, *PPARTENTRY
;
73 typedef struct _BIOSDISKENTRY
80 CM_DISK_GEOMETRY_DEVICE_DATA DiskGeometry
;
81 CM_INT13_DRIVE_PARAMETER Int13DiskData
;
82 } BIOSDISKENTRY
, *PBIOSDISKENTRY
;
85 typedef struct _DISKENTRY
90 ULONGLONG TracksPerCylinder
;
91 ULONGLONG SectorsPerTrack
;
92 ULONGLONG BytesPerSector
;
95 ULONGLONG CylinderSize
;
108 /* Has the partition list been modified? */
113 UNICODE_STRING DriverName
;
115 LIST_ENTRY PartListHead
;
117 } DISKENTRY
, *PDISKENTRY
;
120 typedef struct _PARTLIST
133 PDISKENTRY CurrentDisk
;
134 PPARTENTRY CurrentPartition
;
136 PDISKENTRY ActiveBootDisk
;
137 PPARTENTRY ActiveBootPartition
;
139 LIST_ENTRY DiskListHead
;
140 LIST_ENTRY BiosDiskListHead
;
142 } PARTLIST
, *PPARTLIST
;
144 #define PARTITION_TBL_SIZE 4
146 #include <pshpack1.h>
148 typedef struct _PARTITION
150 unsigned char BootFlags
; /* bootable? 0=no, 128=yes */
151 unsigned char StartingHead
; /* beginning head number */
152 unsigned char StartingSector
; /* beginning sector number */
153 unsigned char StartingCylinder
; /* 10 bit nmbr, with high 2 bits put in begsect */
154 unsigned char PartitionType
; /* Operating System type indicator code */
155 unsigned char EndingHead
; /* ending head number */
156 unsigned char EndingSector
; /* ending sector number */
157 unsigned char EndingCylinder
; /* also a 10 bit nmbr, with same high 2 bit trick */
158 unsigned int StartingBlock
; /* first sector relative to start of disk */
159 unsigned int SectorCount
; /* number of sectors in partition */
160 } PARTITION
, *PPARTITION
;
162 typedef struct _PARTITION_SECTOR
164 UCHAR BootCode
[440]; /* 0x000 */
165 ULONG Signature
; /* 0x1B8 */
166 UCHAR Reserved
[2]; /* 0x1BC */
167 PARTITION Partition
[PARTITION_TBL_SIZE
]; /* 0x1BE */
168 USHORT Magic
; /* 0x1FE */
169 } PARTITION_SECTOR
, *PPARTITION_SECTOR
;
175 LIST_ENTRY ListEntry
;
179 } BIOS_DISK
, *PBIOS_DISK
;
182 CreatePartitionList (SHORT Left
,
188 DestroyPartitionList (PPARTLIST List
);
191 DrawPartitionList (PPARTLIST List
);
194 SelectPartition(PPARTLIST List
, ULONG DiskNumber
, ULONG PartitionNumber
);
197 SetMountedDeviceValues(PPARTLIST List
);
200 ScrollDownPartitionList (PPARTLIST List
);
203 ScrollUpPartitionList (PPARTLIST List
);
206 CreateNewPartition (PPARTLIST List
,
207 ULONGLONG PartitionSize
,
211 DeleteCurrentPartition (PPARTLIST List
);
214 CheckActiveBootPartition (PPARTLIST List
);
217 CheckForLinuxFdiskPartitions (PPARTLIST List
);
220 WritePartitionsToDisk (PPARTLIST List
);
222 #endif /* __PARTLIST_H__ */