- Do only allow to install reactos on disks which are visible by the bios.
[reactos.git] / reactos / subsys / system / 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
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19 /* $Id$
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
25 */
26
27 #ifndef __PARTLIST_H__
28 #define __PARTLIST_H__
29
30 typedef enum _FORMATSTATE
31 {
32 Unformatted,
33 UnformattedOrDamaged,
34 UnknownFormat,
35 Preformatted,
36 Formatted
37 } FORMATSTATE, *PFORMATSTATE;
38
39
40 typedef struct _PARTENTRY
41 {
42 LIST_ENTRY ListEntry;
43
44 CHAR DriveLetter;
45 CHAR VolumeLabel[17];
46 CHAR FileSystemName[9];
47
48 /* Partition is unused disk space */
49 BOOLEAN Unpartitioned;
50
51 /* Partition is new. Table does not exist on disk yet */
52 BOOLEAN New;
53
54 /* Partition was created automatically. */
55 BOOLEAN AutoCreate;
56
57 FORMATSTATE FormatState;
58
59 /*
60 * Raw offset and length of the unpartitioned disk space.
61 * Includes the leading, not yet existing, partition table.
62 */
63 ULONGLONG UnpartitionedOffset;
64 ULONGLONG UnpartitionedLength;
65
66 PARTITION_INFORMATION PartInfo[4];
67
68 } PARTENTRY, *PPARTENTRY;
69
70
71 typedef struct _BIOSDISKENTRY
72 {
73 LIST_ENTRY ListEntry;
74 ULONG DiskNumber;
75 ULONG Signature;
76 ULONG Checksum;
77 } BIOSDISKENTRY, *PBIOSDISKENTRY;
78
79
80 typedef struct _DISKENTRY
81 {
82 LIST_ENTRY ListEntry;
83
84 ULONGLONG Cylinders;
85 ULONGLONG TracksPerCylinder;
86 ULONGLONG SectorsPerTrack;
87 ULONGLONG BytesPerSector;
88
89 ULONGLONG DiskSize;
90 ULONGLONG CylinderSize;
91 ULONGLONG TrackSize;
92
93 BOOLEAN BiosFound;
94 ULONG BiosDiskNumber;
95 ULONG Signature;
96 ULONG Checksum;
97
98 ULONG DiskNumber;
99 USHORT Port;
100 USHORT Bus;
101 USHORT Id;
102
103 /* Has the partition list been modified? */
104 BOOLEAN Modified;
105
106 BOOLEAN NewDisk;
107
108 UNICODE_STRING DriverName;
109
110 LIST_ENTRY PartListHead;
111
112 } DISKENTRY, *PDISKENTRY;
113
114
115 typedef struct _PARTLIST
116 {
117 SHORT Left;
118 SHORT Top;
119 SHORT Right;
120 SHORT Bottom;
121
122 SHORT Line;
123 SHORT Offset;
124
125 ULONG TopDisk;
126 ULONG TopPartition;
127
128 PDISKENTRY CurrentDisk;
129 PPARTENTRY CurrentPartition;
130
131 PDISKENTRY ActiveBootDisk;
132 PPARTENTRY ActiveBootPartition;
133
134 LIST_ENTRY DiskListHead;
135 LIST_ENTRY BiosDiskListHead;
136
137 } PARTLIST, *PPARTLIST;
138
139 #define PARTITION_TBL_SIZE 4
140
141 #include <pshpack1.h>
142
143 typedef struct _PARTITION
144 {
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;
156
157 typedef struct _PARTITION_SECTOR
158 {
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;
165
166 #include <poppack.h>
167
168 typedef struct
169 {
170 LIST_ENTRY ListEntry;
171 ULONG DiskNumber;
172 ULONG Idendifier;
173 ULONG Signature;
174 } BIOS_DISK, *PBIOS_DISK;
175
176 PPARTLIST
177 CreatePartitionList (SHORT Left,
178 SHORT Top,
179 SHORT Right,
180 SHORT Bottom);
181
182 VOID
183 DestroyPartitionList (PPARTLIST List);
184
185 VOID
186 DrawPartitionList (PPARTLIST List);
187
188 VOID
189 SelectPartition(PPARTLIST List, ULONG DiskNumber, ULONG PartitionNumber);
190
191 VOID
192 ScrollDownPartitionList (PPARTLIST List);
193
194 VOID
195 ScrollUpPartitionList (PPARTLIST List);
196
197 VOID
198 CreateNewPartition (PPARTLIST List,
199 ULONGLONG PartitionSize,
200 BOOLEAN AutoCreate);
201
202 VOID
203 DeleteCurrentPartition (PPARTLIST List);
204
205 VOID
206 CheckActiveBootPartition (PPARTLIST List);
207
208 BOOLEAN
209 CheckForLinuxFdiskPartitions (PPARTLIST List);
210
211 BOOLEAN
212 WritePartitionsToDisk (PPARTLIST List);
213
214 #endif /* __PARTLIST_H__ */
215
216 /* EOF */