mirror of
https://github.com/reactos/reactos.git
synced 2024-12-29 10:35:28 +00:00
Changed file system decision as per Brian Palmers suggestion.
Prepare check for valid bootsectors. svn path=/trunk/; revision=5846
This commit is contained in:
parent
aee5772252
commit
d84b0927cd
3 changed files with 102 additions and 22 deletions
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: partlist.c,v 1.21 2003/08/20 20:07:33 ekohl Exp $
|
||||
/* $Id: partlist.c,v 1.22 2003/08/25 11:56:07 ekohl Exp $
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS text-mode setup
|
||||
* FILE: subsys/system/usetup/partlist.c
|
||||
|
@ -253,6 +253,52 @@ AddPartitionToList (ULONG DiskNumber,
|
|||
sizeof(PARTITION_INFORMATION));
|
||||
}
|
||||
|
||||
if (IsContainerPartition(PartEntry->PartInfo[0].PartitionType))
|
||||
{
|
||||
PartEntry->FormatState = Unformatted;
|
||||
}
|
||||
else if ((PartEntry->PartInfo[0].PartitionType == PARTITION_FAT_12) ||
|
||||
(PartEntry->PartInfo[0].PartitionType == PARTITION_FAT_16) ||
|
||||
(PartEntry->PartInfo[0].PartitionType == PARTITION_HUGE) ||
|
||||
(PartEntry->PartInfo[0].PartitionType == PARTITION_XINT13) ||
|
||||
(PartEntry->PartInfo[0].PartitionType == PARTITION_FAT32) ||
|
||||
(PartEntry->PartInfo[0].PartitionType == PARTITION_FAT32_XINT13))
|
||||
{
|
||||
#if 0
|
||||
if (CheckFatFormat())
|
||||
{
|
||||
PartEntry->FormatState = Preformatted;
|
||||
}
|
||||
else
|
||||
{
|
||||
PartEntry->FormatState = Unformatted;
|
||||
}
|
||||
#endif
|
||||
PartEntry->FormatState = Preformatted;
|
||||
}
|
||||
else if (PartEntry->PartInfo[0].PartitionType == PARTITION_IFS)
|
||||
{
|
||||
#if 0
|
||||
if (CheckNtfsFormat())
|
||||
{
|
||||
PartEntry->FormatState = Preformatted;
|
||||
}
|
||||
else if (CheckHpfsFormat())
|
||||
{
|
||||
PartEntry->FormatState = Preformatted;
|
||||
}
|
||||
else
|
||||
{
|
||||
PartEntry->FormatState = Unformatted;
|
||||
}
|
||||
#endif
|
||||
PartEntry->FormatState = Preformatted;
|
||||
}
|
||||
else
|
||||
{
|
||||
PartEntry->FormatState = Unknown;
|
||||
}
|
||||
|
||||
InsertTailList (&DiskEntry->PartListHead,
|
||||
&PartEntry->ListEntry);
|
||||
}
|
||||
|
@ -287,6 +333,8 @@ ScanForUnpartitionedDiskSpace (PDISKENTRY DiskEntry)
|
|||
PartEntry->UnpartitionedOffset = 0ULL;
|
||||
PartEntry->UnpartitionedLength = DiskEntry->DiskSize;
|
||||
|
||||
PartEntry->FormatState = Unformatted;
|
||||
|
||||
InsertTailList (&DiskEntry->PartListHead,
|
||||
&PartEntry->ListEntry);
|
||||
}
|
||||
|
@ -332,6 +380,8 @@ ScanForUnpartitionedDiskSpace (PDISKENTRY DiskEntry)
|
|||
if (j == 0)
|
||||
NewPartEntry->UnpartitionedLength -= DiskEntry->TrackSize;
|
||||
|
||||
NewPartEntry->FormatState = Unformatted;
|
||||
|
||||
/* Insert the table into the list */
|
||||
InsertTailList (&PartEntry->ListEntry,
|
||||
&NewPartEntry->ListEntry);
|
||||
|
@ -465,8 +515,6 @@ AddDiskToList (HANDLE FileHandle,
|
|||
DiskEntry->Bus = ScsiAddress.PathId;
|
||||
DiskEntry->Id = ScsiAddress.TargetId;
|
||||
|
||||
DiskEntry->UseLba = (DiskEntry->DiskSize > (1024ULL * 255ULL * 63ULL * 512ULL));
|
||||
|
||||
GetDriverName (DiskEntry);
|
||||
|
||||
InsertTailList (&List->DiskListHead,
|
||||
|
@ -1269,6 +1317,7 @@ CreateNewPartition (PPARTLIST List,
|
|||
PartitionSize == PartEntry->UnpartitionedLength)
|
||||
{
|
||||
/* Convert current entry to 'new (unformatted)' */
|
||||
PartEntry->FormatState = Unformatted;
|
||||
PartEntry->PartInfo[0].StartingOffset.QuadPart =
|
||||
PartEntry->UnpartitionedOffset + DiskEntry->TrackSize;
|
||||
PartEntry->PartInfo[0].PartitionLength.QuadPart =
|
||||
|
@ -1340,8 +1389,17 @@ CreateNewPartition (PPARTLIST List,
|
|||
PartEntry->PartInfo[0].PartitionLength.QuadPart + DiskEntry->TrackSize;
|
||||
}
|
||||
|
||||
PrevPartEntry->PartInfo[1].PartitionType =
|
||||
(DiskEntry->UseLba == TRUE) ? PARTITION_XINT13_EXTENDED : PARTITION_EXTENDED;
|
||||
if ((PartEntry->PartInfo[1].StartingOffset.QuadPart +
|
||||
PartEntry->PartInfo[1].PartitionLength.QuadPart) <
|
||||
(1024ULL * 255ULL * 63ULL * 512ULL))
|
||||
{
|
||||
PrevPartEntry->PartInfo[1].PartitionType = PARTITION_EXTENDED;
|
||||
}
|
||||
else
|
||||
{
|
||||
PrevPartEntry->PartInfo[1].PartitionType = PARTITION_XINT13_EXTENDED;
|
||||
}
|
||||
|
||||
PrevPartEntry->PartInfo[1].BootIndicator = FALSE;
|
||||
PrevPartEntry->PartInfo[1].RewritePartition = TRUE;
|
||||
}
|
||||
|
@ -1370,6 +1428,7 @@ CreateNewPartition (PPARTLIST List,
|
|||
|
||||
NewPartEntry->New = TRUE;
|
||||
|
||||
NewPartEntry->FormatState = Unformatted;
|
||||
NewPartEntry->PartInfo[0].StartingOffset.QuadPart =
|
||||
PartEntry->UnpartitionedOffset + DiskEntry->TrackSize;
|
||||
NewPartEntry->PartInfo[0].PartitionLength.QuadPart =
|
||||
|
@ -1441,8 +1500,17 @@ CreateNewPartition (PPARTLIST List,
|
|||
NewPartEntry->PartInfo[0].PartitionLength.QuadPart + DiskEntry->TrackSize;
|
||||
}
|
||||
|
||||
PrevPartEntry->PartInfo[1].PartitionType =
|
||||
(DiskEntry->UseLba == TRUE) ? PARTITION_XINT13_EXTENDED : PARTITION_EXTENDED;
|
||||
if ((PartEntry->PartInfo[1].StartingOffset.QuadPart +
|
||||
PartEntry->PartInfo[1].PartitionLength.QuadPart) <
|
||||
(1024ULL * 255ULL * 63ULL * 512ULL))
|
||||
{
|
||||
PrevPartEntry->PartInfo[1].PartitionType = PARTITION_EXTENDED;
|
||||
}
|
||||
else
|
||||
{
|
||||
PrevPartEntry->PartInfo[1].PartitionType = PARTITION_XINT13_EXTENDED;
|
||||
}
|
||||
|
||||
PrevPartEntry->PartInfo[1].BootIndicator = FALSE;
|
||||
PrevPartEntry->PartInfo[1].RewritePartition = TRUE;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* 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.20 2003/08/20 20:07:33 ekohl Exp $
|
||||
/* $Id: partlist.h,v 1.21 2003/08/25 11:56:07 ekohl Exp $
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS text-mode setup
|
||||
* FILE: subsys/system/usetup/partlist.h
|
||||
|
@ -27,6 +27,15 @@
|
|||
#ifndef __PARTLIST_H__
|
||||
#define __PARTLIST_H__
|
||||
|
||||
typedef enum _FORMATSTATE
|
||||
{
|
||||
Unformatted,
|
||||
UnformattedOrDamaged,
|
||||
UnknownFormat,
|
||||
Preformatted,
|
||||
Formatted
|
||||
} FORMATSTATE, *PFORMATSTATE;
|
||||
|
||||
|
||||
typedef struct _PARTENTRY
|
||||
{
|
||||
|
@ -45,6 +54,8 @@ typedef struct _PARTENTRY
|
|||
/* 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.
|
||||
|
@ -75,9 +86,6 @@ typedef struct _DISKENTRY
|
|||
USHORT Bus;
|
||||
USHORT Id;
|
||||
|
||||
/* Use LBA or CHS? */
|
||||
BOOLEAN UseLba;
|
||||
|
||||
/* Has the partition list been modified? */
|
||||
BOOLEAN Modified;
|
||||
|
||||
|
|
|
@ -1589,34 +1589,38 @@ FormatPartitionPage (PINPUT_RECORD Ir)
|
|||
/* FAT12 CHS partition (disk is smaller than 4.1MB) */
|
||||
PartEntry->PartInfo[0].PartitionType = PARTITION_FAT_12;
|
||||
}
|
||||
else if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (32ULL * 1024ULL * 1024ULL))
|
||||
else if (PartEntry->PartInfo[0].StartingOffset.QuadPart < (1024ULL * 255ULL * 63ULL * 512ULL))
|
||||
{
|
||||
/* FAT16 CHS partition (disk is smaller than 32MB) */
|
||||
PartEntry->PartInfo[0].PartitionType = PARTITION_FAT_16;
|
||||
}
|
||||
else if (DiskEntry->UseLba == FALSE)
|
||||
{
|
||||
if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (512ULL * 1024ULL * 1024ULL))
|
||||
/* Partition starts below the 8.4GB boundary ==> CHS partition */
|
||||
|
||||
if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (32ULL * 1024ULL * 1024ULL))
|
||||
{
|
||||
/* FAT16 CHS partition (disk is smaller than 512MB) */
|
||||
/* FAT16 CHS partition (partiton size < 32MB) */
|
||||
PartEntry->PartInfo[0].PartitionType = PARTITION_FAT_16;
|
||||
}
|
||||
else if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (512ULL * 1024ULL * 1024ULL))
|
||||
{
|
||||
/* FAT16 CHS partition (partition size < 512MB) */
|
||||
PartEntry->PartInfo[0].PartitionType = PARTITION_HUGE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* FAT32 CHS partition (partition size 512MB or larger) */
|
||||
/* FAT32 CHS partition (partition size >= 512MB) */
|
||||
PartEntry->PartInfo[0].PartitionType = PARTITION_FAT32;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Partition starts above the 8.4GB boundary ==> LBA partition */
|
||||
|
||||
if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (512ULL * 1024ULL * 1024ULL))
|
||||
{
|
||||
/* FAT16 LBA partition (partition size is smaller than 512MB) */
|
||||
/* FAT16 LBA partition (partition size < 512MB) */
|
||||
PartEntry->PartInfo[0].PartitionType = PARTITION_XINT13;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* FAT32 LBA partition (partition size 512MB or larger) */
|
||||
/* FAT32 LBA partition (partition size >= 512MB) */
|
||||
PartEntry->PartInfo[0].PartitionType = PARTITION_FAT32_XINT13;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue