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.
20 * COPYRIGHT: See COPYING in the top level directory
21 * PROJECT: ReactOS text-mode setup
22 * FILE: subsys/system/usetup/partlist.h
23 * PURPOSE: Partition list functions
24 * PROGRAMMER: Eric Kohl
27 #ifndef __PARTLIST_H__
28 #define __PARTLIST_H__
30 typedef enum _FORMATSTATE
37 } FORMATSTATE
, *PFORMATSTATE
;
40 typedef struct _PARTENTRY
46 CHAR FileSystemName
[9];
48 /* Partition is unused disk space */
49 BOOLEAN Unpartitioned
;
51 /* Partition is new. Table does not exist on disk yet */
54 /* Partition was created automatically. */
57 FORMATSTATE FormatState
;
60 * Raw offset and length of the unpartitioned disk space.
61 * Includes the leading, not yet existing, partition table.
63 ULONGLONG UnpartitionedOffset
;
64 ULONGLONG UnpartitionedLength
;
66 PARTITION_INFORMATION PartInfo
[4];
68 } PARTENTRY
, *PPARTENTRY
;
71 typedef struct _BIOSDISKENTRY
77 } BIOSDISKENTRY
, *PBIOSDISKENTRY
;
80 typedef struct _DISKENTRY
85 ULONGLONG TracksPerCylinder
;
86 ULONGLONG SectorsPerTrack
;
87 ULONGLONG BytesPerSector
;
90 ULONGLONG CylinderSize
;
103 /* Has the partition list been modified? */
108 UNICODE_STRING DriverName
;
110 LIST_ENTRY PartListHead
;
112 } DISKENTRY
, *PDISKENTRY
;
115 typedef struct _PARTLIST
128 PDISKENTRY CurrentDisk
;
129 PPARTENTRY CurrentPartition
;
131 PDISKENTRY ActiveBootDisk
;
132 PPARTENTRY ActiveBootPartition
;
134 LIST_ENTRY DiskListHead
;
135 LIST_ENTRY BiosDiskListHead
;
137 } PARTLIST
, *PPARTLIST
;
139 #define PARTITION_TBL_SIZE 4
141 #include <pshpack1.h>
143 typedef struct _PARTITION
145 unsigned char BootFlags
; /* bootable? 0=no, 128=yes */
146 unsigned char StartingHead
; /* beginning head number */
147 unsigned char StartingSector
; /* beginning sector number */
148 unsigned char StartingCylinder
; /* 10 bit nmbr, with high 2 bits put in begsect */
149 unsigned char PartitionType
; /* Operating System type indicator code */
150 unsigned char EndingHead
; /* ending head number */
151 unsigned char EndingSector
; /* ending sector number */
152 unsigned char EndingCylinder
; /* also a 10 bit nmbr, with same high 2 bit trick */
153 unsigned int StartingBlock
; /* first sector relative to start of disk */
154 unsigned int SectorCount
; /* number of sectors in partition */
155 } PARTITION
, *PPARTITION
;
157 typedef struct _PARTITION_SECTOR
159 UCHAR BootCode
[440]; /* 0x000 */
160 ULONG Signature
; /* 0x1B8 */
161 UCHAR Reserved
[2]; /* 0x1BC */
162 PARTITION Partition
[PARTITION_TBL_SIZE
]; /* 0x1BE */
163 USHORT Magic
; /* 0x1FE */
164 } PARTITION_SECTOR
, *PPARTITION_SECTOR
;
170 LIST_ENTRY ListEntry
;
174 } BIOS_DISK
, *PBIOS_DISK
;
177 CreatePartitionList (SHORT Left
,
183 DestroyPartitionList (PPARTLIST List
);
186 DrawPartitionList (PPARTLIST List
);
189 SelectPartition(PPARTLIST List
, ULONG DiskNumber
, ULONG PartitionNumber
);
192 ScrollDownPartitionList (PPARTLIST List
);
195 ScrollUpPartitionList (PPARTLIST List
);
198 CreateNewPartition (PPARTLIST List
,
199 ULONGLONG PartitionSize
,
203 DeleteCurrentPartition (PPARTLIST List
);
206 CheckActiveBootPartition (PPARTLIST List
);
209 CheckForLinuxFdiskPartitions (PPARTLIST List
);
212 WritePartitionsToDisk (PPARTLIST List
);
214 #endif /* __PARTLIST_H__ */