[SETUPLIB][USETUP] Remove CurrentDisk/Partition from the partlist lib code, and move...
[reactos.git] / base / setup / usetup / partlist.h
index a4e5871..ea92e75 100644 (file)
  *  with this program; if not, write to the Free Software Foundation, Inc.,
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
-/* COPYRIGHT:       See COPYING in the top level directory
+/*
+ * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS text-mode setup
- * FILE:            subsys/system/usetup/partlist.h
+ * FILE:            base/setup/usetup/partlist.h
  * PURPOSE:         Partition list functions
- * PROGRAMMER:      Eric Kohl
+ * PROGRAMMER:
  */
 
 #pragma once
 
-/* We have to define it there, because it is not in the MS DDK */
-#define PARTITION_EXT2 0x83
-
-typedef enum _FORMATSTATE
-{
-    Unformatted,
-    UnformattedOrDamaged,
-    UnknownFormat,
-    Preformatted,
-    Formatted
-} FORMATSTATE, *PFORMATSTATE;
-
-
-typedef struct _PARTENTRY
-{
-    LIST_ENTRY ListEntry;
-
-    struct _DISKENTRY *DiskEntry;
-
-    ULARGE_INTEGER StartSector;
-    ULARGE_INTEGER SectorCount;
-
-    BOOLEAN BootIndicator;
-    UCHAR PartitionType;
-    ULONG HiddenSectors;
-    ULONG PartitionNumber;
-    ULONG PartitionIndex;
-
-    CHAR DriveLetter;
-    CHAR VolumeLabel[17];
-    CHAR FileSystemName[9];
-
-    BOOLEAN LogicalPartition;
-
-    /* Partition is partitioned disk space */
-    BOOLEAN IsPartitioned;
-
-    /* Partition is new. Table does not exist on disk yet */
-    BOOLEAN New;
-
-    /* Partition was created automatically. */
-    BOOLEAN AutoCreate;
-
-    FORMATSTATE FormatState;
-
-} PARTENTRY, *PPARTENTRY;
-
+// #include "../lib/utils/partlist.h"
 
-typedef struct _BIOSDISKENTRY
+typedef enum _FORMATMACHINESTATE
 {
-    LIST_ENTRY ListEntry;
-    ULONG DiskNumber;
-    ULONG Signature;
-    ULONG Checksum;
-    BOOLEAN Recognized;
-    CM_DISK_GEOMETRY_DEVICE_DATA DiskGeometry;
-    CM_INT13_DRIVE_PARAMETER Int13DiskData;
-} BIOSDISKENTRY, *PBIOSDISKENTRY;
-
-
-typedef struct _DISKENTRY
+    Start,
+    FormatSystemPartition,
+    FormatInstallPartition,
+    FormatOtherPartition,
+    FormatDone,
+    // CheckSystemPartition,
+    // CheckInstallPartition,
+    // CheckOtherPartition,
+    // CheckDone
+} FORMATMACHINESTATE, *PFORMATMACHINESTATE;
+
+typedef struct _PARTLIST_UI
 {
-    LIST_ENTRY ListEntry;
-
-    ULONGLONG Cylinders;
-    ULONG TracksPerCylinder;
-    ULONG SectorsPerTrack;
-    ULONG BytesPerSector;
-
-    ULARGE_INTEGER SectorCount;
-    ULONG SectorAlignment;
-
-    BOOLEAN BiosFound;
-    ULONG BiosDiskNumber;
-//    ULONG Signature;
-//    ULONG Checksum;
-
-    ULONG DiskNumber;
-    USHORT Port;
-    USHORT Bus;
-    USHORT Id;
-
-    /* Has the partition list been modified? */
-    BOOLEAN Dirty;
-
-    BOOLEAN NewDisk;
-    BOOLEAN NoMbr; /* MBR is absent */
-
-    UNICODE_STRING DriverName;
-
-    PDRIVE_LAYOUT_INFORMATION LayoutBuffer;
-
-    PPARTENTRY ExtendedPartition;
-
-    LIST_ENTRY PrimaryPartListHead;
-    LIST_ENTRY LogicalPartListHead;
-
-} DISKENTRY, *PDISKENTRY;
+    PPARTLIST List;
+
+    /*
+     * Selected partition.
+     *
+     * NOTE that when CurrentPartition != NULL, then CurrentPartition->DiskEntry
+     * must be the same as CurrentDisk. We should however keep the two members
+     * separated as we can have a selected disk without any partition.
+     */
+    PDISKENTRY CurrentDisk;
+    PPARTENTRY CurrentPartition;
 
+    // PLIST_ENTRY FirstShown;
+    // PLIST_ENTRY LastShown;
 
-typedef struct _PARTLIST
-{
     SHORT Left;
     SHORT Top;
     SHORT Right;
@@ -135,132 +66,36 @@ typedef struct _PARTLIST
     SHORT Line;
     SHORT Offset;
 
-    ULONG TopDisk;
-    ULONG TopPartition;
+    // BOOL Redraw;
+} PARTLIST_UI, *PPARTLIST_UI;
 
-    PDISKENTRY CurrentDisk;
-    PPARTENTRY CurrentPartition;
-
-    PDISKENTRY ActiveBootDisk;
-    PPARTENTRY ActiveBootPartition;
-
-    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);
 
 VOID
-DestroyPartitionList(
-    PPARTLIST List);
+GetPartTypeStringFromPartitionType(
+    IN UCHAR partitionType,
+    OUT PCHAR strPartType,
+    IN ULONG cchPartType);
 
 VOID
-DrawPartitionList(
-    PPARTLIST List);
-
-DWORD
-SelectPartition(
-    PPARTLIST List,
-    ULONG DiskNumber,
-    ULONG PartitionNumber);
-
-BOOL
-SetMountedDeviceValues(
-    PPARTLIST List);
-
-BOOL
-ScrollDownPartitionList(
-    PPARTLIST List);
-
-BOOL
-ScrollUpPartitionList(
-    PPARTLIST List);
-
-VOID
-CreatePrimaryPartition(
-    PPARTLIST List,
-    ULONGLONG PartitionSize,
-    BOOLEAN AutoCreate);
-
-VOID
-CreateExtendedPartition(
-    PPARTLIST List,
-    ULONGLONG PartitionSize);
+InitPartitionListUi(
+    IN OUT PPARTLIST_UI ListUi,
+    IN PPARTLIST List,
+    IN PPARTENTRY CurrentEntry OPTIONAL,
+    IN SHORT Left,
+    IN SHORT Top,
+    IN SHORT Right,
+    IN SHORT Bottom);
 
 VOID
-CreateLogicalPartition(
-    PPARTLIST List,
-    ULONGLONG PartitionSize);
+ScrollDownPartitionList(
+    IN PPARTLIST_UI ListUi);
 
 VOID
-DeleteCurrentPartition(
-    PPARTLIST List);
+ScrollUpPartitionList(
+    IN PPARTLIST_UI ListUi);
 
 VOID
-CheckActiveBootPartition(
-    PPARTLIST List);
-
-BOOLEAN
-CheckForLinuxFdiskPartitions(
-    PPARTLIST List);
-
-BOOLEAN
-WritePartitionsToDisk(
-    PPARTLIST List);
-
-ULONG
-PrimaryPartitionCreationChecks(
-    IN PPARTLIST List);
-
-ULONG
-ExtendedPartitionCreationChecks(
-    IN PPARTLIST List);
-
-ULONG
-LogicalPartitionCreationChecks(
-    IN PPARTLIST List);
+DrawPartitionList(
+    IN PPARTLIST_UI ListUi);
 
 /* EOF */