mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +00:00
[REACTOS] Temporarily revert 0ca4e6dcfa
, as requested by Hermès
The setup mistakes the unpartitioned disk as GPT.
This reverts commit 0ca4e6dcfa
.
This commit is contained in:
parent
0ca4e6dcfa
commit
bbdcc14b1c
4 changed files with 56 additions and 44 deletions
|
@ -2818,48 +2818,41 @@ GetAdjUnpartitionedEntry(
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static ERROR_NUMBER
|
||||
MBRPartitionCreateChecks(
|
||||
_In_ PPARTENTRY PartEntry,
|
||||
_In_opt_ ULONGLONG SizeBytes,
|
||||
_In_opt_ ULONG_PTR PartitionInfo)
|
||||
ERROR_NUMBER
|
||||
PartitionCreationChecks(
|
||||
_In_ PPARTENTRY PartEntry)
|
||||
{
|
||||
PDISKENTRY DiskEntry = PartEntry->DiskEntry;
|
||||
BOOLEAN isContainer = IsContainerPartition((UCHAR)PartitionInfo);
|
||||
|
||||
ASSERT(DiskEntry->DiskStyle == PARTITION_STYLE_MBR);
|
||||
ASSERT(!PartEntry->IsPartitioned);
|
||||
|
||||
if (isContainer)
|
||||
if (DiskEntry->DiskStyle == PARTITION_STYLE_GPT)
|
||||
{
|
||||
/* Cannot create an extended partition within logical partition space */
|
||||
if (PartEntry->LogicalPartition)
|
||||
return ERROR_ONLY_ONE_EXTENDED;
|
||||
|
||||
/* Fail if there is another extended partition in the list */
|
||||
if (DiskEntry->ExtendedPartition)
|
||||
return ERROR_ONLY_ONE_EXTENDED;
|
||||
DPRINT1("GPT-partitioned disk detected, not currently supported by SETUP!\n");
|
||||
return ERROR_WARN_PARTITION;
|
||||
}
|
||||
|
||||
/* Fail if the partition is already in use */
|
||||
if (PartEntry->IsPartitioned)
|
||||
return ERROR_NEW_PARTITION;
|
||||
|
||||
/*
|
||||
* Primary or Extended partitions
|
||||
* For primary partitions
|
||||
*/
|
||||
if (!PartEntry->LogicalPartition || isContainer)
|
||||
if (!PartEntry->LogicalPartition)
|
||||
{
|
||||
/* Only one primary partition is allowed on super-floppy */
|
||||
if (IsSuperFloppy(DiskEntry))
|
||||
return ERROR_PARTITION_TABLE_FULL;
|
||||
|
||||
/* Fail if there are too many primary partitions */
|
||||
/* Fail if there are already 4 primary partitions in the list */
|
||||
if (GetPrimaryPartitionCount(DiskEntry) >= 4)
|
||||
return ERROR_PARTITION_TABLE_FULL;
|
||||
}
|
||||
/*
|
||||
* Logical partitions
|
||||
* For logical partitions
|
||||
*/
|
||||
else
|
||||
{
|
||||
// TODO: Check that we are inside an extended partition!
|
||||
// TODO: Check that we are inside an extended partition!!
|
||||
// Then the following check will be useless.
|
||||
|
||||
/* Only one (primary) partition is allowed on super-floppy */
|
||||
|
@ -2871,24 +2864,38 @@ MBRPartitionCreateChecks(
|
|||
}
|
||||
|
||||
ERROR_NUMBER
|
||||
PartitionCreateChecks(
|
||||
_In_ PPARTENTRY PartEntry,
|
||||
_In_opt_ ULONGLONG SizeBytes,
|
||||
_In_opt_ ULONG_PTR PartitionInfo)
|
||||
ExtendedPartitionCreationChecks(
|
||||
_In_ PPARTENTRY PartEntry)
|
||||
{
|
||||
PDISKENTRY DiskEntry = PartEntry->DiskEntry;
|
||||
|
||||
if (DiskEntry->DiskStyle == PARTITION_STYLE_GPT)
|
||||
{
|
||||
DPRINT1("GPT-partitioned disk detected, not currently supported by SETUP!\n");
|
||||
return ERROR_WARN_PARTITION;
|
||||
}
|
||||
|
||||
/* Fail if the partition is already in use */
|
||||
if (PartEntry->IsPartitioned)
|
||||
return ERROR_NEW_PARTITION;
|
||||
|
||||
if (DiskEntry->DiskStyle == PARTITION_STYLE_MBR)
|
||||
return MBRPartitionCreateChecks(PartEntry, SizeBytes, PartitionInfo);
|
||||
else // if (DiskEntry->DiskStyle == PARTITION_STYLE_GPT)
|
||||
{
|
||||
DPRINT1("GPT-partitioned disk detected, not currently supported by SETUP!\n");
|
||||
return ERROR_WARN_PARTITION;
|
||||
}
|
||||
/* Cannot create an extended partition within logical partition space */
|
||||
if (PartEntry->LogicalPartition)
|
||||
return ERROR_ONLY_ONE_EXTENDED;
|
||||
|
||||
/* Only one primary partition is allowed on super-floppy */
|
||||
if (IsSuperFloppy(DiskEntry))
|
||||
return ERROR_PARTITION_TABLE_FULL;
|
||||
|
||||
/* Fail if there are already 4 primary partitions in the list */
|
||||
if (GetPrimaryPartitionCount(DiskEntry) >= 4)
|
||||
return ERROR_PARTITION_TABLE_FULL;
|
||||
|
||||
/* Fail if there is another extended partition in the list */
|
||||
if (DiskEntry->ExtendedPartition)
|
||||
return ERROR_ONLY_ONE_EXTENDED;
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
// TODO: Improve upon the PartitionInfo parameter later
|
||||
|
@ -2919,10 +2926,13 @@ CreatePartition(
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
Error = PartitionCreateChecks(PartEntry, SizeBytes, PartitionInfo);
|
||||
if (isContainer)
|
||||
Error = ExtendedPartitionCreationChecks(PartEntry);
|
||||
else
|
||||
Error = PartitionCreationChecks(PartEntry);
|
||||
if (Error != NOT_AN_ERROR)
|
||||
{
|
||||
DPRINT1("PartitionCreateChecks(%s) failed with error %lu\n", mainType, Error);
|
||||
DPRINT1("PartitionCreationChecks(%s) failed with error %lu\n", mainType, Error);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -338,10 +338,12 @@ GetAdjUnpartitionedEntry(
|
|||
_In_ BOOLEAN Direction);
|
||||
|
||||
ERROR_NUMBER
|
||||
PartitionCreateChecks(
|
||||
_In_ PPARTENTRY PartEntry,
|
||||
_In_opt_ ULONGLONG SizeBytes,
|
||||
_In_opt_ ULONG_PTR PartitionInfo);
|
||||
PartitionCreationChecks(
|
||||
_In_ PPARTENTRY PartEntry);
|
||||
|
||||
ERROR_NUMBER
|
||||
ExtendedPartitionCreationChecks(
|
||||
_In_ PPARTENTRY PartEntry);
|
||||
|
||||
BOOLEAN
|
||||
CreatePartition(
|
||||
|
|
|
@ -1975,7 +1975,7 @@ DriveDlgProc(
|
|||
// TODO: In the future: first test needs to be augmented with:
|
||||
// (... && PartEntry->Volume->IsSimpleVolume)
|
||||
if ((PartEntry->IsPartitioned && PartEntry->Volume) ||
|
||||
(!PartEntry->IsPartitioned && (PartitionCreateChecks(PartEntry, 0ULL, 0) == NOT_AN_ERROR)))
|
||||
(!PartEntry->IsPartitioned && (PartitionCreationChecks(PartEntry) == NOT_AN_ERROR)))
|
||||
{
|
||||
// ASSERT(PartEntry != PartEntry->DiskEntry->ExtendedPartition);
|
||||
ASSERT(!IsContainerPartition(PartEntry->PartitionType));
|
||||
|
@ -2090,7 +2090,7 @@ DisableWizNext:
|
|||
{
|
||||
ULONG Error;
|
||||
|
||||
Error = PartitionCreateChecks(PartEntry, 0ULL, 0);
|
||||
Error = PartitionCreationChecks(PartEntry);
|
||||
if (Error != NOT_AN_ERROR)
|
||||
{
|
||||
// MUIDisplayError(Error, Ir, POPUP_WAIT_ANY_KEY);
|
||||
|
|
|
@ -1711,7 +1711,7 @@ SelectPartitionPage(PINPUT_RECORD Ir)
|
|||
{
|
||||
ASSERT(CurrentPartition);
|
||||
|
||||
Error = PartitionCreateChecks(CurrentPartition, 0ULL, 0);
|
||||
Error = PartitionCreationChecks(CurrentPartition);
|
||||
if (Error != NOT_AN_ERROR)
|
||||
{
|
||||
MUIDisplayError(Error, Ir, POPUP_WAIT_ANY_KEY);
|
||||
|
@ -1729,7 +1729,7 @@ SelectPartitionPage(PINPUT_RECORD Ir)
|
|||
if (CurrentPartition->LogicalPartition)
|
||||
continue;
|
||||
|
||||
Error = PartitionCreateChecks(CurrentPartition, 0ULL, PARTITION_EXTENDED);
|
||||
Error = ExtendedPartitionCreationChecks(CurrentPartition);
|
||||
if (Error != NOT_AN_ERROR)
|
||||
{
|
||||
MUIDisplayError(Error, Ir, POPUP_WAIT_ANY_KEY);
|
||||
|
@ -1789,7 +1789,7 @@ CreateInstallPartition:
|
|||
/* Create the partition if the selected region is empty */
|
||||
if (!CurrentPartition->IsPartitioned)
|
||||
{
|
||||
Error = PartitionCreateChecks(CurrentPartition, 0ULL, 0);
|
||||
Error = PartitionCreationChecks(CurrentPartition);
|
||||
if (Error != NOT_AN_ERROR)
|
||||
{
|
||||
MUIDisplayError(Error, Ir, POPUP_WAIT_ANY_KEY);
|
||||
|
|
Loading…
Reference in a new issue