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
|
|
|
|
* FILE: subsys/system/usetup/partlist.h
|
|
|
|
* 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
|
|
|
|
{
|
|
|
|
Unformatted,
|
|
|
|
UnformattedOrDamaged,
|
|
|
|
UnknownFormat,
|
|
|
|
Preformatted,
|
|
|
|
Formatted
|
|
|
|
} FORMATSTATE, *PFORMATSTATE;
|
|
|
|
|
2002-10-18 20:04:00 +00:00
|
|
|
|
|
|
|
typedef struct _PARTENTRY
|
|
|
|
{
|
2003-08-03 12:20:22 +00:00
|
|
|
LIST_ENTRY ListEntry;
|
2002-11-02 23:17:06 +00:00
|
|
|
|
2009-04-09 18:59:28 +00:00
|
|
|
CHAR DriveLetter[4];
|
2002-11-13 18:25:18 +00:00
|
|
|
CHAR VolumeLabel[17];
|
|
|
|
CHAR FileSystemName[9];
|
|
|
|
|
2003-08-05 20:39:24 +00:00
|
|
|
/* Partition is unused disk space */
|
2003-08-03 12:20:22 +00:00
|
|
|
BOOLEAN Unpartitioned;
|
|
|
|
|
2003-08-05 20:39:24 +00:00
|
|
|
/* Partition is new. Table does not exist on disk yet */
|
|
|
|
BOOLEAN New;
|
|
|
|
|
2003-08-09 16:32:26 +00:00
|
|
|
/* Partition was created automatically. */
|
|
|
|
BOOLEAN AutoCreate;
|
|
|
|
|
2003-08-25 11:56:07 +00:00
|
|
|
FORMATSTATE FormatState;
|
|
|
|
|
2003-08-03 12:20:22 +00:00
|
|
|
/*
|
|
|
|
* Raw offset and length of the unpartitioned disk space.
|
|
|
|
* Includes the leading, not yet existing, partition table.
|
|
|
|
*/
|
|
|
|
ULONGLONG UnpartitionedOffset;
|
|
|
|
ULONGLONG UnpartitionedLength;
|
2002-11-13 18:25:18 +00:00
|
|
|
|
2003-08-03 12:20:22 +00:00
|
|
|
PARTITION_INFORMATION PartInfo[4];
|
2003-04-18 Casper S. Hornstrup <chorns@users.sourceforge.net>
* subsys/system/usetup/partlist.c (AddPartitionList): Create
unpartitioned areas.
(CreatePartitionListNoGUI): Save disk geometry.
(PrintDiskData): Do not print hidden partition list entries.
(ScrollDownPartitionList, ScrollUpPartitionList): Skip hidden partition
list entries.
(GetActiveBootPartition): Use CurrentDisk as index.
(CreateSelectedPartition): New function.
* subsys/system/usetup/partlist.h (PARTDATA): Add field NewPartSize.
(PARTENTRY): Add fields StartingOffset and HidePartEntry.
(DISKENTRY): Add fields Cylinders, TracksPerCylinder, SectorsPerTrack,
and BytesPerSector;
(CreateSelectedPartition): Add Prototype.
* subsys/system/usetup/usetup.c (PAGE_NUMBER): Add CREATE_PARTITION_PAGE
and FORMAT_PARTITION_PAGE
(CurrentPartitionList, CurrentFileSystemList): New globals.
(SelectPartitionPage): Set CurrentPartitionList.
(PARTITION_SIZE_INPUT_FIELD_LENGTH): Define as 6.
(DrawInputField, ShowPartitionSizeInputBox, CreatePartitionPage,
CreateFileSystemList, DestroyFileSystemList, DrawFileSystemList,
ScrollDownFileSystemList, ScrollUpFileSystemList, FormatPartitionPage):
New functions.
(SelectFileSystemPage): Draw partition screen.
(CheckFileSystemPage): Handle CREATE_PARTITION_PAGE and
FORMAT_PARTITION_PAGE.
* subsys/system/usetup/usetup.h (FILE_SYSTEM, FILE_SYSTEM_LIST): Add enums.
svn path=/trunk/; revision=4552
2003-04-18 14:00:17 +00:00
|
|
|
|
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
|
|
|
|
{
|
|
|
|
LIST_ENTRY ListEntry;
|
|
|
|
ULONG DiskNumber;
|
|
|
|
ULONG Signature;
|
|
|
|
ULONG Checksum;
|
2005-09-19 20:01:29 +00:00
|
|
|
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
|
|
|
|
{
|
2003-08-02 16:49:36 +00:00
|
|
|
LIST_ENTRY ListEntry;
|
|
|
|
|
2003-04-18 Casper S. Hornstrup <chorns@users.sourceforge.net>
* subsys/system/usetup/partlist.c (AddPartitionList): Create
unpartitioned areas.
(CreatePartitionListNoGUI): Save disk geometry.
(PrintDiskData): Do not print hidden partition list entries.
(ScrollDownPartitionList, ScrollUpPartitionList): Skip hidden partition
list entries.
(GetActiveBootPartition): Use CurrentDisk as index.
(CreateSelectedPartition): New function.
* subsys/system/usetup/partlist.h (PARTDATA): Add field NewPartSize.
(PARTENTRY): Add fields StartingOffset and HidePartEntry.
(DISKENTRY): Add fields Cylinders, TracksPerCylinder, SectorsPerTrack,
and BytesPerSector;
(CreateSelectedPartition): Add Prototype.
* subsys/system/usetup/usetup.c (PAGE_NUMBER): Add CREATE_PARTITION_PAGE
and FORMAT_PARTITION_PAGE
(CurrentPartitionList, CurrentFileSystemList): New globals.
(SelectPartitionPage): Set CurrentPartitionList.
(PARTITION_SIZE_INPUT_FIELD_LENGTH): Define as 6.
(DrawInputField, ShowPartitionSizeInputBox, CreatePartitionPage,
CreateFileSystemList, DestroyFileSystemList, DrawFileSystemList,
ScrollDownFileSystemList, ScrollUpFileSystemList, FormatPartitionPage):
New functions.
(SelectFileSystemPage): Draw partition screen.
(CheckFileSystemPage): Handle CREATE_PARTITION_PAGE and
FORMAT_PARTITION_PAGE.
* subsys/system/usetup/usetup.h (FILE_SYSTEM, FILE_SYSTEM_LIST): Add enums.
svn path=/trunk/; revision=4552
2003-04-18 14:00:17 +00:00
|
|
|
ULONGLONG Cylinders;
|
|
|
|
ULONGLONG TracksPerCylinder;
|
|
|
|
ULONGLONG SectorsPerTrack;
|
|
|
|
ULONGLONG BytesPerSector;
|
2003-08-03 12:20:22 +00:00
|
|
|
|
|
|
|
ULONGLONG DiskSize;
|
|
|
|
ULONGLONG CylinderSize;
|
|
|
|
ULONGLONG TrackSize;
|
|
|
|
|
2005-09-15 17:19:31 +00:00
|
|
|
BOOLEAN BiosFound;
|
|
|
|
ULONG BiosDiskNumber;
|
|
|
|
ULONG Signature;
|
|
|
|
ULONG Checksum;
|
|
|
|
|
2002-10-18 20:04:00 +00:00
|
|
|
ULONG DiskNumber;
|
|
|
|
USHORT Port;
|
|
|
|
USHORT Bus;
|
|
|
|
USHORT Id;
|
|
|
|
|
2003-08-06 16:37:46 +00:00
|
|
|
/* Has the partition list been modified? */
|
|
|
|
BOOLEAN Modified;
|
|
|
|
|
2003-08-19 15:54:47 +00:00
|
|
|
BOOLEAN NewDisk;
|
2009-04-10 10:37:08 +00:00
|
|
|
BOOLEAN NoMbr; /* MBR is absent */
|
2003-08-19 15:54:47 +00:00
|
|
|
|
2002-11-28 19:20:38 +00:00
|
|
|
UNICODE_STRING DriverName;
|
|
|
|
|
2003-08-03 12:20:22 +00:00
|
|
|
LIST_ENTRY PartListHead;
|
2002-10-18 20:04:00 +00:00
|
|
|
|
|
|
|
} DISKENTRY, *PDISKENTRY;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct _PARTLIST
|
|
|
|
{
|
|
|
|
SHORT Left;
|
|
|
|
SHORT Top;
|
|
|
|
SHORT Right;
|
|
|
|
SHORT Bottom;
|
|
|
|
|
2002-10-29 18:40:02 +00:00
|
|
|
SHORT Line;
|
2004-08-21 19:30:12 +00:00
|
|
|
SHORT Offset;
|
2002-10-29 18:40:02 +00:00
|
|
|
|
2002-10-18 20:04:00 +00:00
|
|
|
ULONG TopDisk;
|
|
|
|
ULONG TopPartition;
|
|
|
|
|
2003-08-02 16:49:36 +00:00
|
|
|
PDISKENTRY CurrentDisk;
|
2003-08-03 12:20:22 +00:00
|
|
|
PPARTENTRY CurrentPartition;
|
2009-04-09 12:42:09 +00:00
|
|
|
UCHAR CurrentPartitionNumber;
|
2002-10-18 20:04:00 +00:00
|
|
|
|
2003-08-04 15:54:05 +00:00
|
|
|
PDISKENTRY ActiveBootDisk;
|
|
|
|
PPARTENTRY ActiveBootPartition;
|
2009-04-09 18:59:28 +00:00
|
|
|
UCHAR ActiveBootPartitionNumber;
|
2003-08-04 15:54:05 +00:00
|
|
|
|
2003-08-03 12:20:22 +00:00
|
|
|
LIST_ENTRY DiskListHead;
|
2005-09-15 17:19:31 +00:00
|
|
|
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
|
|
|
|
{
|
|
|
|
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 */
|
|
|
|
} PARTITION, *PPARTITION;
|
|
|
|
|
|
|
|
typedef struct _PARTITION_SECTOR
|
|
|
|
{
|
|
|
|
UCHAR BootCode[440]; /* 0x000 */
|
|
|
|
ULONG Signature; /* 0x1B8 */
|
|
|
|
UCHAR Reserved[2]; /* 0x1BC */
|
|
|
|
PARTITION Partition[PARTITION_TBL_SIZE]; /* 0x1BE */
|
|
|
|
USHORT Magic; /* 0x1FE */
|
|
|
|
} PARTITION_SECTOR, *PPARTITION_SECTOR;
|
|
|
|
|
|
|
|
#include <poppack.h>
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
LIST_ENTRY ListEntry;
|
|
|
|
ULONG DiskNumber;
|
|
|
|
ULONG Idendifier;
|
|
|
|
ULONG Signature;
|
|
|
|
} BIOS_DISK, *PBIOS_DISK;
|
2002-10-18 20:04:00 +00:00
|
|
|
|
|
|
|
PPARTLIST
|
2003-08-06 16:37:46 +00:00
|
|
|
CreatePartitionList (SHORT Left,
|
|
|
|
SHORT Top,
|
|
|
|
SHORT Right,
|
|
|
|
SHORT Bottom);
|
2002-10-18 20:04:00 +00:00
|
|
|
|
|
|
|
VOID
|
2003-08-06 16:37:46 +00:00
|
|
|
DestroyPartitionList (PPARTLIST List);
|
2002-10-18 20:04:00 +00:00
|
|
|
|
|
|
|
VOID
|
2003-08-06 16:37:46 +00:00
|
|
|
DrawPartitionList (PPARTLIST List);
|
2002-10-18 20:04:00 +00:00
|
|
|
|
2007-08-26 18:19:23 +00:00
|
|
|
DWORD
|
2003-10-06 19:22:42 +00:00
|
|
|
SelectPartition(PPARTLIST List, ULONG DiskNumber, ULONG PartitionNumber);
|
|
|
|
|
2005-09-21 17:28:14 +00:00
|
|
|
BOOL
|
|
|
|
SetMountedDeviceValues(PPARTLIST List);
|
|
|
|
|
2002-10-18 20:04:00 +00:00
|
|
|
VOID
|
2003-08-06 16:37:46 +00:00
|
|
|
ScrollDownPartitionList (PPARTLIST List);
|
2002-10-18 20:04:00 +00:00
|
|
|
|
|
|
|
VOID
|
2003-08-06 16:37:46 +00:00
|
|
|
ScrollUpPartitionList (PPARTLIST List);
|
2002-10-18 20:04:00 +00:00
|
|
|
|
2003-08-06 16:37:46 +00:00
|
|
|
VOID
|
|
|
|
CreateNewPartition (PPARTLIST List,
|
2003-08-09 16:32:26 +00:00
|
|
|
ULONGLONG PartitionSize,
|
|
|
|
BOOLEAN AutoCreate);
|
2003-04-28 19:44:13 +00:00
|
|
|
|
2003-08-06 16:37:46 +00:00
|
|
|
VOID
|
|
|
|
DeleteCurrentPartition (PPARTLIST List);
|
2003-08-04 15:54:05 +00:00
|
|
|
|
2003-08-19 15:54:47 +00:00
|
|
|
VOID
|
|
|
|
CheckActiveBootPartition (PPARTLIST List);
|
|
|
|
|
2003-08-20 20:07:33 +00:00
|
|
|
BOOLEAN
|
|
|
|
CheckForLinuxFdiskPartitions (PPARTLIST List);
|
|
|
|
|
2003-08-12 15:56:21 +00:00
|
|
|
BOOLEAN
|
|
|
|
WritePartitionsToDisk (PPARTLIST List);
|
|
|
|
|
2003-02-27 14:42:43 +00:00
|
|
|
/* EOF */
|