/*
* ReactOS kernel
- * Copyright (C) 2002 ReactOS Team
+ * Copyright (C) 2002, 2003 ReactOS Team
*
* 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
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: partlist.h,v 1.11 2003/08/02 16:49:36 ekohl Exp $
+/* $Id$
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS text-mode setup
* FILE: subsys/system/usetup/partlist.h
#ifndef __PARTLIST_H__
#define __PARTLIST_H__
-typedef struct _PARTDATA
+typedef enum _FORMATSTATE
{
- ULONGLONG DiskSize;
- ULONG DiskNumber;
- USHORT Port;
- USHORT Bus;
- USHORT Id;
-
- BOOLEAN CreatePartition;
- ULONGLONG PartSize;
- ULONGLONG NewPartSize;
- ULONG PartNumber;
- ULONG PartType;
-
- CHAR DriveLetter;
-
- UNICODE_STRING DriverName;
-} PARTDATA, *PPARTDATA;
+ Unformatted,
+ UnformattedOrDamaged,
+ UnknownFormat,
+ Preformatted,
+ Formatted
+} FORMATSTATE, *PFORMATSTATE;
typedef struct _PARTENTRY
{
- ULONGLONG StartingOffset;
- ULONGLONG PartSize;
- ULONG PartNumber;
- ULONG PartType;
- BOOLEAN Active;
+ LIST_ENTRY ListEntry;
CHAR DriveLetter;
CHAR VolumeLabel[17];
CHAR FileSystemName[9];
- BOOL Unpartitioned;
+ /* Partition is unused disk space */
+ BOOLEAN Unpartitioned;
- BOOL Used;
+ /* Partition is new. Table does not exist on disk yet */
+ BOOLEAN New;
+
+ /* Partition was created automatically. */
+ BOOLEAN AutoCreate;
+
+ FORMATSTATE FormatState;
+
+ /*
+ * Raw offset and length of the unpartitioned disk space.
+ * Includes the leading, not yet existing, partition table.
+ */
+ ULONGLONG UnpartitionedOffset;
+ ULONGLONG UnpartitionedLength;
+
+ PARTITION_INFORMATION PartInfo[4];
- BOOLEAN HidePartEntry;
} PARTENTRY, *PPARTENTRY;
+typedef struct _BIOSDISKENTRY
+{
+ LIST_ENTRY ListEntry;
+ ULONG DiskNumber;
+ ULONG Signature;
+ ULONG Checksum;
+} BIOSDISKENTRY, *PBIOSDISKENTRY;
+
+
typedef struct _DISKENTRY
{
LIST_ENTRY ListEntry;
- ULONGLONG DiskSize;
ULONGLONG Cylinders;
ULONGLONG TracksPerCylinder;
ULONGLONG SectorsPerTrack;
ULONGLONG BytesPerSector;
+
+ ULONGLONG DiskSize;
+ ULONGLONG CylinderSize;
+ ULONGLONG TrackSize;
+
+ BOOLEAN BiosFound;
+ ULONG BiosDiskNumber;
+ ULONG Signature;
+ ULONG Checksum;
+
ULONG DiskNumber;
USHORT Port;
USHORT Bus;
USHORT Id;
+ /* Has the partition list been modified? */
+ BOOLEAN Modified;
+
+ BOOLEAN NewDisk;
+
UNICODE_STRING DriverName;
- ULONG PartCount;
- PPARTENTRY PartArray;
+ LIST_ENTRY PartListHead;
} DISKENTRY, *PDISKENTRY;
SHORT Bottom;
SHORT Line;
+ SHORT Offset;
ULONG TopDisk;
ULONG TopPartition;
PDISKENTRY CurrentDisk;
- ULONG CurrentPartition;
+ PPARTENTRY CurrentPartition;
+
+ PDISKENTRY ActiveBootDisk;
+ PPARTENTRY ActiveBootPartition;
- LIST_ENTRY DiskList;
+ LIST_ENTRY DiskListHead;
+ LIST_ENTRY BiosDiskListHead;
} PARTLIST, *PPARTLIST;
+#define PARTITION_TBL_SIZE 4
+
+#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;
PPARTLIST
-CreatePartitionList(SHORT Left,
- SHORT Top,
- SHORT Right,
- SHORT Bottom);
+CreatePartitionList (SHORT Left,
+ SHORT Top,
+ SHORT Right,
+ SHORT Bottom);
-BOOLEAN
-MarkPartitionActive(ULONG DiskNumber,
- ULONG PartitionNumber,
- PPARTDATA ActivePartition);
+VOID
+DestroyPartitionList (PPARTLIST List);
VOID
-DestroyPartitionList(PPARTLIST List);
+DrawPartitionList (PPARTLIST List);
VOID
-DrawPartitionList(PPARTLIST List);
+SelectPartition(PPARTLIST List, ULONG DiskNumber, ULONG PartitionNumber);
VOID
-ScrollDownPartitionList(PPARTLIST List);
+ScrollDownPartitionList (PPARTLIST List);
VOID
-ScrollUpPartitionList(PPARTLIST List);
+ScrollUpPartitionList (PPARTLIST List);
-BOOLEAN
-GetSelectedPartition(PPARTLIST List,
- PPARTDATA Data);
+VOID
+CreateNewPartition (PPARTLIST List,
+ ULONGLONG PartitionSize,
+ BOOLEAN AutoCreate);
-BOOLEAN
-GetActiveBootPartition(PPARTLIST List,
- PPARTDATA Data);
+VOID
+DeleteCurrentPartition (PPARTLIST List);
+
+VOID
+CheckActiveBootPartition (PPARTLIST List);
BOOLEAN
-CreateSelectedPartition(PPARTLIST List,
- ULONG PartType,
- ULONGLONG NewPartSize);
+CheckForLinuxFdiskPartitions (PPARTLIST List);
BOOLEAN
-DeleteSelectedPartition(PPARTLIST List);
+WritePartitionsToDisk (PPARTLIST List);
#endif /* __PARTLIST_H__ */