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
|
|
|
|
2008-02-11 16:52:49 +00:00
|
|
|
/* We have to define it there, because it is not in the MS DDK */
|
|
|
|
#define PARTITION_EXT2 0x83
|
|
|
|
|
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
|
|
|
|
2014-05-04 22:03:00 +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
|
|
|
|
2014-05-04 22:03:00 +00:00
|
|
|
/* Partition was created automatically. */
|
|
|
|
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
|
|
|
ULONG TopDisk;
|
|
|
|
ULONG TopPartition;
|
2002-10-18 20:04:00 +00:00
|
|
|
|
2014-05-04 22:03:00 +00:00
|
|
|
PDISKENTRY CurrentDisk;
|
|
|
|
PPARTENTRY CurrentPartition;
|
2002-10-18 20:04:00 +00:00
|
|
|
|
2015-06-12 21:51:57 +00:00
|
|
|
PDISKENTRY BootDisk;
|
|
|
|
PPARTENTRY BootPartition;
|
|
|
|
|
|
|
|
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;
|
|
|
|
ULONG Idendifier;
|
|
|
|
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
|
2014-05-04 22:03:00 +00:00
|
|
|
CheckActiveBootPartition(
|
|
|
|
PPARTLIST List);
|
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);
|
|
|
|
|
2003-02-27 14:42:43 +00:00
|
|
|
/* EOF */
|