2002-10-18 20:04:00 +00:00
|
|
|
/*
|
2002-10-29 18:40:02 +00:00
|
|
|
* ReactOS kernel
|
2003-08-04 15:54:05 +00:00
|
|
|
* Copyright (C) 2002, 2003 ReactOS Team
|
2002-10-29 18:40:02 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
2009-10-27 10:34:16 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2002-10-29 18:40:02 +00:00
|
|
|
*/
|
2008-02-11 16:52:49 +00:00
|
|
|
/* COPYRIGHT: See COPYING in the top level directory
|
2002-10-29 18:40:02 +00:00
|
|
|
* PROJECT: ReactOS text-mode setup
|
2015-09-13 16:40:36 +00:00
|
|
|
* FILE: base/setup/usetup/partlist.h
|
2002-10-29 18:40:02 +00:00
|
|
|
* PURPOSE: Partition list functions
|
|
|
|
* PROGRAMMER: Eric Kohl
|
2002-10-18 20:04:00 +00:00
|
|
|
*/
|
|
|
|
|
2010-02-26 11:43:19 +00:00
|
|
|
#pragma once
|
2002-10-18 20:04:00 +00:00
|
|
|
|
2003-08-25 11:56:07 +00:00
|
|
|
typedef enum _FORMATSTATE
|
|
|
|
{
|
2014-05-04 22:03:00 +00:00
|
|
|
Unformatted,
|
|
|
|
UnformattedOrDamaged,
|
|
|
|
UnknownFormat,
|
|
|
|
Preformatted,
|
|
|
|
Formatted
|
2003-08-25 11:56:07 +00:00
|
|
|
} FORMATSTATE, *PFORMATSTATE;
|
|
|
|
|
2015-06-12 21:51:57 +00:00
|
|
|
typedef enum _FORMATMACHINESTATE
|
|
|
|
{
|
|
|
|
Start,
|
|
|
|
FormatSystemPartition,
|
|
|
|
FormatInstallPartition,
|
|
|
|
FormatOtherPartition,
|
|
|
|
FormatDone,
|
|
|
|
CheckSystemPartition,
|
|
|
|
CheckInstallPartition,
|
|
|
|
CheckOtherPartition,
|
|
|
|
CheckDone
|
|
|
|
} FORMATMACHINESTATE, *PFORMATMACHINESTATE;
|
2002-10-18 20:04:00 +00:00
|
|
|
|
|
|
|
typedef struct _PARTENTRY
|
|
|
|
{
|
2014-05-04 22:03:00 +00:00
|
|
|
LIST_ENTRY ListEntry;
|
2002-11-02 23:17:06 +00:00
|
|
|
|
2014-05-18 15:14:24 +00:00
|
|
|
struct _DISKENTRY *DiskEntry;
|
|
|
|
|
|
|
|
ULARGE_INTEGER StartSector;
|
|
|
|
ULARGE_INTEGER SectorCount;
|
|
|
|
|
|
|
|
BOOLEAN BootIndicator;
|
|
|
|
UCHAR PartitionType;
|
|
|
|
ULONG HiddenSectors;
|
|
|
|
ULONG PartitionNumber;
|
|
|
|
ULONG PartitionIndex;
|
|
|
|
|
|
|
|
CHAR DriveLetter;
|
2014-05-04 22:03:00 +00:00
|
|
|
CHAR VolumeLabel[17];
|
|
|
|
CHAR FileSystemName[9];
|
2002-11-13 18:25:18 +00:00
|
|
|
|
2014-05-22 14:55:04 +00:00
|
|
|
BOOLEAN LogicalPartition;
|
2014-05-21 20:20:18 +00:00
|
|
|
|
2014-05-18 15:14:24 +00:00
|
|
|
/* Partition is partitioned disk space */
|
|
|
|
BOOLEAN IsPartitioned;
|
2003-08-03 12:20:22 +00:00
|
|
|
|
2016-02-28 15:25:22 +00:00
|
|
|
/* Partition is new, table does not exist on disk yet */
|
2015-01-04 13:53:45 +00:00
|
|
|
BOOLEAN New;
|
2003-08-05 20:39:24 +00:00
|
|
|
|
2016-02-28 15:25:22 +00:00
|
|
|
/* Partition was created automatically */
|
2014-05-04 22:03:00 +00:00
|
|
|
BOOLEAN AutoCreate;
|
2003-08-09 16:32:26 +00:00
|
|
|
|
2014-05-04 22:03:00 +00:00
|
|
|
FORMATSTATE FormatState;
|
2003-08-25 11:56:07 +00:00
|
|
|
|
2015-06-12 21:51:57 +00:00
|
|
|
/* Partition must be checked */
|
|
|
|
BOOLEAN NeedsCheck;
|
|
|
|
|
|
|
|
struct _FILE_SYSTEM_ITEM *FileSystem;
|
2002-10-18 20:04:00 +00:00
|
|
|
} PARTENTRY, *PPARTENTRY;
|
|
|
|
|
2003-08-02 16:49:36 +00:00
|
|
|
|
2005-09-15 17:19:31 +00:00
|
|
|
typedef struct _BIOSDISKENTRY
|
|
|
|
{
|
2014-05-04 22:03:00 +00:00
|
|
|
LIST_ENTRY ListEntry;
|
|
|
|
ULONG DiskNumber;
|
|
|
|
ULONG Signature;
|
|
|
|
ULONG Checksum;
|
|
|
|
BOOLEAN Recognized;
|
|
|
|
CM_DISK_GEOMETRY_DEVICE_DATA DiskGeometry;
|
|
|
|
CM_INT13_DRIVE_PARAMETER Int13DiskData;
|
2007-10-19 23:21:45 +00:00
|
|
|
} BIOSDISKENTRY, *PBIOSDISKENTRY;
|
2005-09-15 17:19:31 +00:00
|
|
|
|
|
|
|
|
2002-10-18 20:04:00 +00:00
|
|
|
typedef struct _DISKENTRY
|
|
|
|
{
|
2014-05-04 22:03:00 +00:00
|
|
|
LIST_ENTRY ListEntry;
|
2003-08-02 16:49:36 +00:00
|
|
|
|
2014-05-04 22:03:00 +00:00
|
|
|
ULONGLONG Cylinders;
|
2014-05-18 15:14:24 +00:00
|
|
|
ULONG TracksPerCylinder;
|
|
|
|
ULONG SectorsPerTrack;
|
|
|
|
ULONG BytesPerSector;
|
2003-08-03 12:20:22 +00:00
|
|
|
|
2014-05-18 15:14:24 +00:00
|
|
|
ULARGE_INTEGER SectorCount;
|
|
|
|
ULONG SectorAlignment;
|
2015-08-09 13:14:00 +00:00
|
|
|
ULONG CylinderAlignment;
|
2003-08-03 12:20:22 +00:00
|
|
|
|
2014-05-04 22:03:00 +00:00
|
|
|
BOOLEAN BiosFound;
|
|
|
|
ULONG BiosDiskNumber;
|
2014-05-18 15:14:24 +00:00
|
|
|
// ULONG Signature;
|
|
|
|
// ULONG Checksum;
|
2005-09-15 17:19:31 +00:00
|
|
|
|
2014-05-04 22:03:00 +00:00
|
|
|
ULONG DiskNumber;
|
|
|
|
USHORT Port;
|
|
|
|
USHORT Bus;
|
|
|
|
USHORT Id;
|
2002-10-18 20:04:00 +00:00
|
|
|
|
2014-05-04 22:03:00 +00:00
|
|
|
/* Has the partition list been modified? */
|
2014-05-18 15:14:24 +00:00
|
|
|
BOOLEAN Dirty;
|
2003-08-06 16:37:46 +00:00
|
|
|
|
2014-05-04 22:03:00 +00:00
|
|
|
BOOLEAN NewDisk;
|
|
|
|
BOOLEAN NoMbr; /* MBR is absent */
|
2003-08-19 15:54:47 +00:00
|
|
|
|
2014-05-04 22:03:00 +00:00
|
|
|
UNICODE_STRING DriverName;
|
2002-11-28 19:20:38 +00:00
|
|
|
|
2014-05-18 15:14:24 +00:00
|
|
|
PDRIVE_LAYOUT_INFORMATION LayoutBuffer;
|
|
|
|
|
2014-05-22 14:55:04 +00:00
|
|
|
PPARTENTRY ExtendedPartition;
|
|
|
|
|
2014-05-18 15:14:24 +00:00
|
|
|
LIST_ENTRY PrimaryPartListHead;
|
2014-05-22 14:55:04 +00:00
|
|
|
LIST_ENTRY LogicalPartListHead;
|
2002-10-18 20:04:00 +00:00
|
|
|
|
|
|
|
} DISKENTRY, *PDISKENTRY;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct _PARTLIST
|
|
|
|
{
|
2014-05-04 22:03:00 +00:00
|
|
|
SHORT Left;
|
|
|
|
SHORT Top;
|
|
|
|
SHORT Right;
|
|
|
|
SHORT Bottom;
|
2002-10-18 20:04:00 +00:00
|
|
|
|
2014-05-04 22:03:00 +00:00
|
|
|
SHORT Line;
|
|
|
|
SHORT Offset;
|
2002-10-29 18:40:02 +00:00
|
|
|
|
2014-05-04 22:03:00 +00:00
|
|
|
PDISKENTRY CurrentDisk;
|
|
|
|
PPARTENTRY CurrentPartition;
|
2002-10-18 20:04:00 +00:00
|
|
|
|
2016-02-28 15:25:22 +00:00
|
|
|
/* The system disk and partition where the boot manager resides */
|
|
|
|
PDISKENTRY SystemDisk;
|
|
|
|
PPARTENTRY SystemPartition;
|
[USETUP]
- bootsup.c/.h, usetup.c: Save the old MBR sector in the system partition (this makes easier to restore the old one).
- fslist.c/.h, usetup.h: Fix header inclusion order.
- partlist.c/.h, usetup.c: On BIOS-PC architectures, the system partition can be formatted in any FS as long as it is the active partition (on the contrary, on architectures where such system partition is required, it is formatted in FAT). We currently do not have write support for all FSes out there (apart for FAT until now), so do a "clever" "trick" to work around this problem: on initialized disks, find the active partition and check its FS. If we support write access to this FS then we're OK, otherwise we change the (active) system partition for the one on which we are going to install ReactOS (which is, by construction, formatted with a FS on which we support write access).
The MBR (resp. the VBR) of the disk (resp. of the system partition) are always saved into files, making easy for people to boot on them (using FreeLdr) or restoring them.
CORE-10898
svn path=/trunk/; revision=70837
2016-03-01 15:00:56 +00:00
|
|
|
/*
|
|
|
|
* The original system disk and partition in case we are redefining them
|
|
|
|
* because we do not have write support on them.
|
|
|
|
* Please not that this is partly a HACK and MUST NEVER happen on
|
|
|
|
* architectures where real system partitions are mandatory (because then
|
|
|
|
* they are formatted in FAT FS and we support write operation on them).
|
|
|
|
*/
|
|
|
|
PDISKENTRY OriginalSystemDisk;
|
|
|
|
PPARTENTRY OriginalSystemPartition;
|
2015-06-12 21:51:57 +00:00
|
|
|
|
|
|
|
PDISKENTRY TempDisk;
|
|
|
|
PPARTENTRY TempPartition;
|
|
|
|
FORMATMACHINESTATE FormatState;
|
2003-08-04 15:54:05 +00:00
|
|
|
|
2014-05-04 22:03:00 +00:00
|
|
|
LIST_ENTRY DiskListHead;
|
|
|
|
LIST_ENTRY BiosDiskListHead;
|
2002-10-18 20:04:00 +00:00
|
|
|
|
|
|
|
} PARTLIST, *PPARTLIST;
|
|
|
|
|
2005-09-15 17:19:31 +00:00
|
|
|
#define PARTITION_TBL_SIZE 4
|
2002-10-18 20:04:00 +00:00
|
|
|
|
2005-09-15 17:19:31 +00:00
|
|
|
#include <pshpack1.h>
|
|
|
|
|
|
|
|
typedef struct _PARTITION
|
|
|
|
{
|
2014-05-04 22:03:00 +00:00
|
|
|
unsigned char BootFlags; /* bootable? 0=no, 128=yes */
|
|
|
|
unsigned char StartingHead; /* beginning head number */
|
|
|
|
unsigned char StartingSector; /* beginning sector number */
|
|
|
|
unsigned char StartingCylinder; /* 10 bit nmbr, with high 2 bits put in begsect */
|
|
|
|
unsigned char PartitionType; /* Operating System type indicator code */
|
|
|
|
unsigned char EndingHead; /* ending head number */
|
|
|
|
unsigned char EndingSector; /* ending sector number */
|
|
|
|
unsigned char EndingCylinder; /* also a 10 bit nmbr, with same high 2 bit trick */
|
|
|
|
unsigned int StartingBlock; /* first sector relative to start of disk */
|
|
|
|
unsigned int SectorCount; /* number of sectors in partition */
|
2005-09-15 17:19:31 +00:00
|
|
|
} PARTITION, *PPARTITION;
|
|
|
|
|
|
|
|
typedef struct _PARTITION_SECTOR
|
|
|
|
{
|
2014-05-04 22:03:00 +00:00
|
|
|
UCHAR BootCode[440]; /* 0x000 */
|
|
|
|
ULONG Signature; /* 0x1B8 */
|
|
|
|
UCHAR Reserved[2]; /* 0x1BC */
|
|
|
|
PARTITION Partition[PARTITION_TBL_SIZE]; /* 0x1BE */
|
|
|
|
USHORT Magic; /* 0x1FE */
|
2005-09-15 17:19:31 +00:00
|
|
|
} PARTITION_SECTOR, *PPARTITION_SECTOR;
|
|
|
|
|
|
|
|
#include <poppack.h>
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2014-05-04 22:03:00 +00:00
|
|
|
LIST_ENTRY ListEntry;
|
|
|
|
ULONG DiskNumber;
|
2016-11-05 14:55:55 +00:00
|
|
|
ULONG Identifier;
|
2014-05-04 22:03:00 +00:00
|
|
|
ULONG Signature;
|
2005-09-15 17:19:31 +00:00
|
|
|
} BIOS_DISK, *PBIOS_DISK;
|
2002-10-18 20:04:00 +00:00
|
|
|
|
|
|
|
PPARTLIST
|
2014-05-04 22:03:00 +00:00
|
|
|
CreatePartitionList(
|
|
|
|
SHORT Left,
|
|
|
|
SHORT Top,
|
|
|
|
SHORT Right,
|
|
|
|
SHORT Bottom);
|
2002-10-18 20:04:00 +00:00
|
|
|
|
|
|
|
VOID
|
2014-05-04 22:03:00 +00:00
|
|
|
DestroyPartitionList(
|
|
|
|
PPARTLIST List);
|
2002-10-18 20:04:00 +00:00
|
|
|
|
|
|
|
VOID
|
2014-05-04 22:03:00 +00:00
|
|
|
DrawPartitionList(
|
|
|
|
PPARTLIST List);
|
2002-10-18 20:04:00 +00:00
|
|
|
|
2007-08-26 18:19:23 +00:00
|
|
|
DWORD
|
2014-05-04 22:03:00 +00:00
|
|
|
SelectPartition(
|
|
|
|
PPARTLIST List,
|
|
|
|
ULONG DiskNumber,
|
|
|
|
ULONG PartitionNumber);
|
2003-10-06 19:22:42 +00:00
|
|
|
|
2005-09-21 17:28:14 +00:00
|
|
|
BOOL
|
2014-05-04 22:03:00 +00:00
|
|
|
SetMountedDeviceValues(
|
|
|
|
PPARTLIST List);
|
2005-09-21 17:28:14 +00:00
|
|
|
|
2014-06-07 20:02:26 +00:00
|
|
|
BOOL
|
2014-05-04 22:03:00 +00:00
|
|
|
ScrollDownPartitionList(
|
|
|
|
PPARTLIST List);
|
2002-10-18 20:04:00 +00:00
|
|
|
|
2014-06-07 20:02:26 +00:00
|
|
|
BOOL
|
2014-05-04 22:03:00 +00:00
|
|
|
ScrollUpPartitionList(
|
|
|
|
PPARTLIST List);
|
2002-10-18 20:04:00 +00:00
|
|
|
|
2003-08-06 16:37:46 +00:00
|
|
|
VOID
|
2014-05-20 23:48:36 +00:00
|
|
|
CreatePrimaryPartition(
|
2014-05-04 22:03:00 +00:00
|
|
|
PPARTLIST List,
|
2015-05-29 11:44:34 +00:00
|
|
|
ULONGLONG SectorCount,
|
2014-05-04 22:03:00 +00:00
|
|
|
BOOLEAN AutoCreate);
|
2003-04-28 19:44:13 +00:00
|
|
|
|
2014-05-20 23:48:36 +00:00
|
|
|
VOID
|
|
|
|
CreateExtendedPartition(
|
|
|
|
PPARTLIST List,
|
2015-05-29 11:44:34 +00:00
|
|
|
ULONGLONG SectorCount);
|
2014-05-20 23:48:36 +00:00
|
|
|
|
2014-06-09 01:49:24 +00:00
|
|
|
VOID
|
|
|
|
CreateLogicalPartition(
|
|
|
|
PPARTLIST List,
|
2015-07-04 16:04:09 +00:00
|
|
|
ULONGLONG SectorCount,
|
|
|
|
BOOLEAN AutoCreate);
|
2014-06-09 01:49:24 +00:00
|
|
|
|
2003-08-06 16:37:46 +00:00
|
|
|
VOID
|
2014-05-04 22:03:00 +00:00
|
|
|
DeleteCurrentPartition(
|
|
|
|
PPARTLIST List);
|
2003-08-04 15:54:05 +00:00
|
|
|
|
2003-08-19 15:54:47 +00:00
|
|
|
VOID
|
2016-02-28 15:25:22 +00:00
|
|
|
CheckActiveSystemPartition(
|
[USETUP]
- bootsup.c/.h, usetup.c: Save the old MBR sector in the system partition (this makes easier to restore the old one).
- fslist.c/.h, usetup.h: Fix header inclusion order.
- partlist.c/.h, usetup.c: On BIOS-PC architectures, the system partition can be formatted in any FS as long as it is the active partition (on the contrary, on architectures where such system partition is required, it is formatted in FAT). We currently do not have write support for all FSes out there (apart for FAT until now), so do a "clever" "trick" to work around this problem: on initialized disks, find the active partition and check its FS. If we support write access to this FS then we're OK, otherwise we change the (active) system partition for the one on which we are going to install ReactOS (which is, by construction, formatted with a FS on which we support write access).
The MBR (resp. the VBR) of the disk (resp. of the system partition) are always saved into files, making easy for people to boot on them (using FreeLdr) or restoring them.
CORE-10898
svn path=/trunk/; revision=70837
2016-03-01 15:00:56 +00:00
|
|
|
IN PPARTLIST List,
|
|
|
|
IN PFILE_SYSTEM_LIST FileSystemList);
|
2003-08-19 15:54:47 +00:00
|
|
|
|
2015-01-04 13:53:45 +00:00
|
|
|
BOOLEAN
|
|
|
|
WritePartitionsToDisk(
|
2014-05-04 22:03:00 +00:00
|
|
|
PPARTLIST List);
|
2003-08-12 15:56:21 +00:00
|
|
|
|
2014-05-20 23:48:36 +00:00
|
|
|
ULONG
|
|
|
|
PrimaryPartitionCreationChecks(
|
|
|
|
IN PPARTLIST List);
|
|
|
|
|
|
|
|
ULONG
|
|
|
|
ExtendedPartitionCreationChecks(
|
|
|
|
IN PPARTLIST List);
|
|
|
|
|
2014-06-08 19:05:03 +00:00
|
|
|
ULONG
|
|
|
|
LogicalPartitionCreationChecks(
|
|
|
|
IN PPARTLIST List);
|
|
|
|
|
2015-06-12 21:51:57 +00:00
|
|
|
BOOL
|
|
|
|
GetNextUnformattedPartition(
|
|
|
|
IN PPARTLIST List,
|
|
|
|
OUT PDISKENTRY *pDiskEntry,
|
|
|
|
OUT PPARTENTRY *pPartEntry);
|
|
|
|
|
|
|
|
BOOL
|
|
|
|
GetNextUncheckedPartition(
|
|
|
|
IN PPARTLIST List,
|
|
|
|
OUT PDISKENTRY *pDiskEntry,
|
|
|
|
OUT PPARTENTRY *pPartEntry);
|
|
|
|
|
2015-12-06 20:14:29 +00:00
|
|
|
VOID
|
2016-02-27 20:49:17 +00:00
|
|
|
GetPartTypeStringFromPartitionType(
|
2015-12-06 20:14:29 +00:00
|
|
|
UCHAR partitionType,
|
2016-02-27 20:49:17 +00:00
|
|
|
PCHAR strPartType,
|
2015-12-06 20:14:29 +00:00
|
|
|
DWORD cchPartType);
|
|
|
|
|
2003-02-27 14:42:43 +00:00
|
|
|
/* EOF */
|