mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
[USETUP][SETUPLIB] Continue hiding the FAT32 format in the format list, but take it into account anyway later on.
The formatter will select it anyway as soon as the partition size permits it. We make it available internally however so as to "emulate" FMIFS functionality. Now rely on the partition filesystem for InstallVBRToPartition() instead of the unreliable and deprecated partition type.
This commit is contained in:
parent
593bcce999
commit
08924c1850
6 changed files with 97 additions and 59 deletions
|
@ -794,7 +794,7 @@ InstallFatBootcodeToPartition(
|
|||
IN PUNICODE_STRING SystemRootPath,
|
||||
IN PUNICODE_STRING SourceRootPath,
|
||||
IN PUNICODE_STRING DestinationArcPath,
|
||||
IN UCHAR PartitionType)
|
||||
IN PCWSTR FileSystemName)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
BOOLEAN DoesFreeLdrExist;
|
||||
|
@ -856,8 +856,7 @@ InstallFatBootcodeToPartition(
|
|||
/* Install new bootcode into a file */
|
||||
CombinePaths(DstPath, ARRAYSIZE(DstPath), 2, SystemRootPath->Buffer, L"bootsect.ros");
|
||||
|
||||
if (PartitionType == PARTITION_FAT32 ||
|
||||
PartitionType == PARTITION_FAT32_XINT13)
|
||||
if (wcsicmp(FileSystemName, L"FAT32") == 0)
|
||||
{
|
||||
/* Install FAT32 bootcode */
|
||||
CombinePaths(SrcPath, ARRAYSIZE(SrcPath), 2, SourceRootPath->Buffer, L"\\loader\\fat32.bin");
|
||||
|
@ -872,7 +871,7 @@ InstallFatBootcodeToPartition(
|
|||
return Status;
|
||||
}
|
||||
}
|
||||
else
|
||||
else // if (wcsicmp(FileSystemName, L"FAT") == 0)
|
||||
{
|
||||
/* Install FAT16 bootcode */
|
||||
CombinePaths(SrcPath, ARRAYSIZE(SrcPath), 2, SourceRootPath->Buffer, L"\\loader\\fat.bin");
|
||||
|
@ -1070,8 +1069,7 @@ InstallFatBootcodeToPartition(
|
|||
}
|
||||
|
||||
/* Install new bootsector on the disk */
|
||||
if (PartitionType == PARTITION_FAT32 ||
|
||||
PartitionType == PARTITION_FAT32_XINT13)
|
||||
if (wcsicmp(FileSystemName, L"FAT32") == 0)
|
||||
{
|
||||
/* Install FAT32 bootcode */
|
||||
CombinePaths(SrcPath, ARRAYSIZE(SrcPath), 2, SourceRootPath->Buffer, L"\\loader\\fat32.bin");
|
||||
|
@ -1084,7 +1082,7 @@ InstallFatBootcodeToPartition(
|
|||
return Status;
|
||||
}
|
||||
}
|
||||
else
|
||||
else // if (wcsicmp(FileSystemName, L"FAT") == 0)
|
||||
{
|
||||
/* Install FAT16 bootcode */
|
||||
CombinePaths(SrcPath, ARRAYSIZE(SrcPath), 2, SourceRootPath->Buffer, L"\\loader\\fat.bin");
|
||||
|
@ -1212,40 +1210,46 @@ InstallVBRToPartition(
|
|||
IN PUNICODE_STRING SystemRootPath,
|
||||
IN PUNICODE_STRING SourceRootPath,
|
||||
IN PUNICODE_STRING DestinationArcPath,
|
||||
IN UCHAR PartitionType)
|
||||
IN PCWSTR FileSystemName)
|
||||
{
|
||||
switch (PartitionType)
|
||||
if (wcsicmp(FileSystemName, L"FAT") == 0 ||
|
||||
wcsicmp(FileSystemName, L"FAT32") == 0)
|
||||
{
|
||||
case PARTITION_FAT_12:
|
||||
case PARTITION_FAT_16:
|
||||
case PARTITION_HUGE:
|
||||
case PARTITION_XINT13:
|
||||
case PARTITION_FAT32:
|
||||
case PARTITION_FAT32_XINT13:
|
||||
{
|
||||
return InstallFatBootcodeToPartition(SystemRootPath,
|
||||
SourceRootPath,
|
||||
DestinationArcPath,
|
||||
PartitionType);
|
||||
}
|
||||
|
||||
case PARTITION_LINUX:
|
||||
{
|
||||
return InstallBtrfsBootcodeToPartition(SystemRootPath,
|
||||
SourceRootPath,
|
||||
DestinationArcPath);
|
||||
}
|
||||
|
||||
case PARTITION_IFS:
|
||||
DPRINT1("Partitions of type NTFS or HPFS are not supported yet!\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
DPRINT1("PartitionType 0x%02X unknown!\n", PartitionType);
|
||||
break;
|
||||
return InstallFatBootcodeToPartition(SystemRootPath,
|
||||
SourceRootPath,
|
||||
DestinationArcPath,
|
||||
FileSystemName);
|
||||
}
|
||||
/*
|
||||
else if (wcsicmp(FileSystemName, L"NTFS") == 0)
|
||||
{
|
||||
DPRINT1("Partitions of type NTFS or HPFS are not supported yet!\n");
|
||||
return STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
*/
|
||||
else if (wcsicmp(FileSystemName, L"BTRFS") == 0)
|
||||
{
|
||||
return InstallBtrfsBootcodeToPartition(SystemRootPath,
|
||||
SourceRootPath,
|
||||
DestinationArcPath);
|
||||
}
|
||||
/*
|
||||
else if (wcsicmp(FileSystemName, L"EXT2") == 0 ||
|
||||
wcsicmp(FileSystemName, L"EXT3") == 0 ||
|
||||
wcsicmp(FileSystemName, L"EXT4") == 0 ||
|
||||
wcsicmp(FileSystemName, L"FFS") == 0 ||
|
||||
wcsicmp(FileSystemName, L"REISERFS") == 0)
|
||||
{
|
||||
return STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
*/
|
||||
else
|
||||
{
|
||||
/* Unknown file system */
|
||||
DPRINT1("Unknown file system '%S'\n", FileSystemName);
|
||||
}
|
||||
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
return STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ InstallVBRToPartition(
|
|||
IN PUNICODE_STRING SystemRootPath,
|
||||
IN PUNICODE_STRING SourceRootPath,
|
||||
IN PUNICODE_STRING DestinationArcPath,
|
||||
IN UCHAR PartitionType);
|
||||
IN PCWSTR FileSystemName);
|
||||
|
||||
NTSTATUS
|
||||
InstallFatBootcodeToFloppy(
|
||||
|
|
|
@ -129,11 +129,11 @@ typedef struct _FILE_SYSTEM
|
|||
/* The list of file systems on which we can install ReactOS */
|
||||
static FILE_SYSTEM RegisteredFileSystems[] =
|
||||
{
|
||||
/* NOTE: The FAT formatter automatically determines
|
||||
* whether it will use FAT-16 or FAT-32. */
|
||||
/* NOTE: The FAT formatter will automatically
|
||||
* determine whether to use FAT12/16 or FAT32. */
|
||||
{ L"FAT" , VfatFormat, VfatChkdsk },
|
||||
{ L"FAT32", VfatFormat, VfatChkdsk },
|
||||
#if 0
|
||||
{ L"FAT32", VfatFormat, VfatChkdsk }, // Do we support specific FAT sub-formats specifications?
|
||||
{ L"FATX" , VfatxFormat, VfatxChkdsk },
|
||||
{ L"NTFS" , NtfsFormat, NtfsChkdsk },
|
||||
#endif
|
||||
|
@ -180,9 +180,7 @@ GetFileSystemByName(
|
|||
{
|
||||
Item = CONTAINING_RECORD(ListEntry, FILE_SYSTEM_ITEM, ListEntry);
|
||||
if (Item->FileSystemName &&
|
||||
(wcsicmp(FileSystemName, Item->FileSystemName) == 0 ||
|
||||
/* Map FAT32 back to FAT */
|
||||
(wcsicmp(FileSystemName, L"FAT32") == 0 && wcsicmp(Item->FileSystemName, L"FAT") == 0)))
|
||||
(wcsicmp(FileSystemName, Item->FileSystemName) == 0))
|
||||
{
|
||||
return Item;
|
||||
}
|
||||
|
@ -200,9 +198,7 @@ GetFileSystemByName(
|
|||
while (Count--)
|
||||
{
|
||||
if (FileSystems->FileSystemName &&
|
||||
(wcsicmp(FileSystemName, FileSystems->FileSystemName) == 0 ||
|
||||
/* Map FAT32 back to FAT */
|
||||
(wcsicmp(FileSystemName, L"FAT32") == 0 && wcsicmp(FileSystems->FileSystemName, L"FAT") == 0)))
|
||||
(wcsicmp(FileSystemName, FileSystems->FileSystemName) == 0))
|
||||
{
|
||||
return FileSystems;
|
||||
}
|
||||
|
@ -330,7 +326,7 @@ FormatFileSystem(
|
|||
//
|
||||
|
||||
NTSTATUS
|
||||
InstallFat1216BootCode(
|
||||
InstallFatBootCode(
|
||||
IN PCWSTR SrcPath, // FAT12/16 bootsector source file (on the installation medium)
|
||||
IN HANDLE DstPath, // Where to save the bootsector built from the source + partition information
|
||||
IN HANDLE RootPartition) // Partition holding the (old) FAT12/16 information
|
||||
|
@ -645,6 +641,19 @@ PreparePartitionForFormatting(
|
|||
|
||||
SetPartitionType(PartEntry, PartitionType);
|
||||
|
||||
/*
|
||||
* Adjust the filesystem name in case of FAT vs. FAT32, according to
|
||||
* the type of partition set by FileSystemToPartitionType().
|
||||
*/
|
||||
if (wcsicmp(FileSystemName, L"FAT") == 0)
|
||||
{
|
||||
if ((/*PartEntry->*/PartitionType == PARTITION_FAT32) ||
|
||||
(/*PartEntry->*/PartitionType == PARTITION_FAT32_XINT13))
|
||||
{
|
||||
FileSystemName = L"FAT32";
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// FIXME: Do this now, or after the partition was actually formatted??
|
||||
//
|
||||
|
|
|
@ -76,13 +76,13 @@ typedef NTSTATUS
|
|||
IN HANDLE RootPartition); // Partition holding the (old) bootsector data information
|
||||
|
||||
NTSTATUS
|
||||
InstallFat1216BootCode(
|
||||
InstallFatBootCode(
|
||||
IN PCWSTR SrcPath,
|
||||
IN HANDLE DstPath,
|
||||
IN HANDLE RootPartition);
|
||||
|
||||
#define InstallFat12BootCode InstallFat1216BootCode
|
||||
#define InstallFat16BootCode InstallFat1216BootCode
|
||||
#define InstallFat12BootCode InstallFatBootCode
|
||||
#define InstallFat16BootCode InstallFatBootCode
|
||||
|
||||
NTSTATUS
|
||||
InstallFat32BootCode(
|
||||
|
|
|
@ -29,6 +29,9 @@
|
|||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
/* Enable this define to hide FAT32 choice in case FAT is already present */
|
||||
#define HIDE_FAT32_CHOICE
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
static VOID
|
||||
|
@ -60,14 +63,38 @@ AddProvider(
|
|||
|
||||
static VOID
|
||||
InitializeFileSystemList(
|
||||
IN PFILE_SYSTEM_LIST List,
|
||||
IN OUT PFILE_SYSTEM_LIST List,
|
||||
IN BOOLEAN ForceFormat)
|
||||
{
|
||||
ULONG Index = 0;
|
||||
PCWSTR FileSystemName;
|
||||
ULONG Index;
|
||||
|
||||
#ifdef HIDE_FAT32_CHOICE
|
||||
BOOLEAN FatPresent = FALSE;
|
||||
|
||||
/* Check whether the FAT filesystem is present */
|
||||
Index = 0;
|
||||
while (GetRegisteredFileSystems(Index++, &FileSystemName))
|
||||
{
|
||||
if (wcsicmp(FileSystemName, L"FAT") == 0)
|
||||
{
|
||||
FatPresent = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Index = 0;
|
||||
while (GetRegisteredFileSystems(Index++, &FileSystemName))
|
||||
{
|
||||
#ifdef HIDE_FAT32_CHOICE
|
||||
/* USETUP only: If the FAT filesystem is present, show it, but
|
||||
* don't display FAT32. The FAT formatter will automatically
|
||||
* determine whether to use FAT12/16 or FAT32. */
|
||||
if (FatPresent && wcsicmp(FileSystemName, L"FAT32") == 0)
|
||||
continue;
|
||||
#endif
|
||||
AddProvider(List, FileSystemName);
|
||||
}
|
||||
|
||||
|
|
|
@ -3510,7 +3510,7 @@ FormatPartitionPage(PINPUT_RECORD Ir)
|
|||
|
||||
/* Format the partition */
|
||||
Status = FormatPartition(&PartitionRootPath,
|
||||
SelectedFileSystem->FileSystem,
|
||||
PartEntry->FileSystem,
|
||||
SelectedFileSystem->QuickFormat);
|
||||
if (Status == STATUS_NOT_SUPPORTED)
|
||||
{
|
||||
|
@ -3519,7 +3519,7 @@ FormatPartitionPage(PINPUT_RECORD Ir)
|
|||
"\n"
|
||||
" \x07 Press ENTER to continue Setup.\n"
|
||||
" \x07 Press F3 to quit Setup.",
|
||||
SelectedFileSystem->FileSystem);
|
||||
PartEntry->FileSystem);
|
||||
|
||||
PopupError(Buffer,
|
||||
MUIGetString(STRING_QUITCONTINUE),
|
||||
|
@ -4612,11 +4612,10 @@ BootLoaderHarddiskVbrPage(PINPUT_RECORD Ir)
|
|||
{
|
||||
NTSTATUS Status;
|
||||
|
||||
// FIXME! We must not use the partition type, but instead use the partition FileSystem!!
|
||||
Status = InstallVBRToPartition(&USetupData.SystemRootPath,
|
||||
&USetupData.SourceRootPath,
|
||||
&USetupData.DestinationArcPath,
|
||||
SystemPartition->PartitionType);
|
||||
SystemPartition->FileSystem);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
MUIDisplayError(ERROR_WRITE_BOOT, Ir, POPUP_WAIT_ENTER,
|
||||
|
@ -4649,11 +4648,10 @@ BootLoaderHarddiskMbrPage(PINPUT_RECORD Ir)
|
|||
WCHAR DestinationDevicePathBuffer[MAX_PATH];
|
||||
|
||||
/* Step 1: Write the VBR */
|
||||
// FIXME! We must not use the partition type, but instead use the partition FileSystem!!
|
||||
Status = InstallVBRToPartition(&USetupData.SystemRootPath,
|
||||
&USetupData.SourceRootPath,
|
||||
&USetupData.DestinationArcPath,
|
||||
SystemPartition->PartitionType);
|
||||
SystemPartition->FileSystem);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
MUIDisplayError(ERROR_WRITE_BOOT, Ir, POPUP_WAIT_ENTER,
|
||||
|
|
Loading…
Reference in a new issue