usetup Spanish localization by gabriel <gabrielilardi at hotmail dot it>
[reactos.git] / reactos / 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
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 BOOLEAN Recognized;
78 CM_DISK_GEOMETRY_DEVICE_DATA DiskGeometry;
79 CM_INT13_DRIVE_PARAMETER Int13DiskData;
80 } BIOSDISKENTRY, *PBIOSDISKENTRY;
81
82
83 typedef struct _DISKENTRY
84 {
85 LIST_ENTRY ListEntry;
86
87 ULONGLONG Cylinders;
88 ULONGLONG TracksPerCylinder;
89 ULONGLONG SectorsPerTrack;
90 ULONGLONG BytesPerSector;
91
92 ULONGLONG DiskSize;
93 ULONGLONG CylinderSize;
94 ULONGLONG TrackSize;
95
96 BOOLEAN BiosFound;
97 ULONG BiosDiskNumber;
98 ULONG Signature;
99 ULONG Checksum;
100
101 ULONG DiskNumber;
102 USHORT Port;
103 USHORT Bus;
104 USHORT Id;
105
106 /* Has the partition list been modified? */
107 BOOLEAN Modified;
108
109 BOOLEAN NewDisk;
110
111 UNICODE_STRING DriverName;
112
113 LIST_ENTRY PartListHead;
114
115 } DISKENTRY, *PDISKENTRY;
116
117
118 typedef struct _PARTLIST
119 {
120 SHORT Left;
121 SHORT Top;
122 SHORT Right;
123 SHORT Bottom;
124
125 SHORT Line;
126 SHORT Offset;
127
128 ULONG TopDisk;
129 ULONG TopPartition;
130
131 PDISKENTRY CurrentDisk;
132 PPARTENTRY CurrentPartition;
133
134 PDISKENTRY ActiveBootDisk;
135 PPARTENTRY ActiveBootPartition;
136
137 LIST_ENTRY DiskListHead;
138 LIST_ENTRY BiosDiskListHead;
139
140 } PARTLIST, *PPARTLIST;
141
142 #define PARTITION_TBL_SIZE 4
143
144 #include <pshpack1.h>
145
146 typedef struct _PARTITION
147 {
148 unsigned char BootFlags; /* bootable? 0=no, 128=yes */
149 unsigned char StartingHead; /* beginning head number */
150 unsigned char StartingSector; /* beginning sector number */
151 unsigned char StartingCylinder; /* 10 bit nmbr, with high 2 bits put in begsect */
152 unsigned char PartitionType; /* Operating System type indicator code */
153 unsigned char EndingHead; /* ending head number */
154 unsigned char EndingSector; /* ending sector number */
155 unsigned char EndingCylinder; /* also a 10 bit nmbr, with same high 2 bit trick */
156 unsigned int StartingBlock; /* first sector relative to start of disk */
157 unsigned int SectorCount; /* number of sectors in partition */
158 } PARTITION, *PPARTITION;
159
160 typedef struct _PARTITION_SECTOR
161 {
162 UCHAR BootCode[440]; /* 0x000 */
163 ULONG Signature; /* 0x1B8 */
164 UCHAR Reserved[2]; /* 0x1BC */
165 PARTITION Partition[PARTITION_TBL_SIZE]; /* 0x1BE */
166 USHORT Magic; /* 0x1FE */
167 } PARTITION_SECTOR, *PPARTITION_SECTOR;
168
169 #include <poppack.h>
170
171 typedef struct
172 {
173 LIST_ENTRY ListEntry;
174 ULONG DiskNumber;
175 ULONG Idendifier;
176 ULONG Signature;
177 } BIOS_DISK, *PBIOS_DISK;
178
179 PPARTLIST
180 CreatePartitionList (SHORT Left,
181 SHORT Top,
182 SHORT Right,
183 SHORT Bottom);
184
185 VOID
186 DestroyPartitionList (PPARTLIST List);
187
188 VOID
189 DrawPartitionList (PPARTLIST List);
190
191 DWORD
192 SelectPartition(PPARTLIST List, ULONG DiskNumber, ULONG PartitionNumber);
193
194 BOOL
195 SetMountedDeviceValues(PPARTLIST List);
196
197 VOID
198 ScrollDownPartitionList (PPARTLIST List);
199
200 VOID
201 ScrollUpPartitionList (PPARTLIST List);
202
203 VOID
204 CreateNewPartition (PPARTLIST List,
205 ULONGLONG PartitionSize,
206 BOOLEAN AutoCreate);
207
208 VOID
209 DeleteCurrentPartition (PPARTLIST List);
210
211 VOID
212 CheckActiveBootPartition (PPARTLIST List);
213
214 BOOLEAN
215 CheckForLinuxFdiskPartitions (PPARTLIST List);
216
217 BOOLEAN
218 WritePartitionsToDisk (PPARTLIST List);
219
220 #endif /* __PARTLIST_H__ */
221
222 /* EOF */