Install FAT16 bootcode on FAT16 partitions.

Don't modify valid partition types when a partiton is formatted.

svn path=/trunk/; revision=5708
This commit is contained in:
Eric Kohl 2003-08-20 16:31:21 +00:00
parent e4b7ecbc70
commit 1926975c01

View file

@ -702,6 +702,8 @@ SelectPartitionPage(PINPUT_RECORD Ir)
} }
} }
CheckActiveBootPartition (PartitionList);
DrawPartitionList (PartitionList); DrawPartitionList (PartitionList);
while(TRUE) while(TRUE)
@ -1545,6 +1547,8 @@ FormatPartitionPage (PINPUT_RECORD Ir)
{ {
SetStatusText (" Please wait ..."); SetStatusText (" Please wait ...");
if (PartEntry->PartInfo[0].PartitionType == PARTITION_ENTRY_UNUSED)
{
switch (FileSystemList->CurrentFileSystem) switch (FileSystemList->CurrentFileSystem)
{ {
case FsFat: case FsFat:
@ -1564,10 +1568,12 @@ FormatPartitionPage (PINPUT_RECORD Ir)
else if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (2ULL * 1024ULL * 1024ULL * 1024ULL)) else if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (2ULL * 1024ULL * 1024ULL * 1024ULL))
{ {
/* FAT16 LBA partition (partition is smaller than 2GB) */ /* FAT16 LBA partition (partition is smaller than 2GB) */
DPRINT1("%x\n", PartEntry->PartInfo[0].PartitionType);
PartEntry->PartInfo[0].PartitionType = PARTITION_XINT13; PartEntry->PartInfo[0].PartitionType = PARTITION_XINT13;
} }
else else
{ {
DPRINT1("%x\n", PartEntry->PartInfo[0].PartitionType);
/* FAT32 LBA partition (partition is at least 2GB) */ /* FAT32 LBA partition (partition is at least 2GB) */
PartEntry->PartInfo[0].PartitionType = PARTITION_FAT32_XINT13; PartEntry->PartInfo[0].PartitionType = PARTITION_FAT32_XINT13;
} }
@ -1579,6 +1585,7 @@ FormatPartitionPage (PINPUT_RECORD Ir)
default: default:
return QUIT_PAGE; return QUIT_PAGE;
} }
}
CheckActiveBootPartition (PartitionList); CheckActiveBootPartition (PartitionList);
@ -1619,6 +1626,9 @@ FormatPartitionPage (PINPUT_RECORD Ir)
Entry = Entry->Flink; Entry = Entry->Flink;
} }
/* Restore the old entry */
PartEntry = PartitionList->CurrentPartition;
//#endif //#endif
if (WritePartitionsToDisk (PartitionList) == FALSE) if (WritePartitionsToDisk (PartitionList) == FALSE)
@ -1673,7 +1683,19 @@ FormatPartitionPage (PINPUT_RECORD Ir)
return QUIT_PAGE; return QUIT_PAGE;
} }
PartEntry->New = FALSE;
if (FileSystemList != NULL)
{
DestroyFileSystemList (FileSystemList);
FileSystemList = NULL;
}
CheckActiveBootPartition (PartitionList);
/* FIXME: Install boot code. This is a hack! */ /* FIXME: Install boot code. This is a hack! */
if ((PartEntry->PartInfo[0].PartitionType == PARTITION_FAT32_XINT13) ||
(PartEntry->PartInfo[0].PartitionType == PARTITION_FAT32))
{
wcscpy (PathBuffer, SourceRootPath.Buffer); wcscpy (PathBuffer, SourceRootPath.Buffer);
wcscat (PathBuffer, L"\\loader\\fat32.bin"); wcscat (PathBuffer, L"\\loader\\fat32.bin");
@ -1687,6 +1709,23 @@ FormatPartitionPage (PINPUT_RECORD Ir)
/* FIXME: show an error dialog */ /* FIXME: show an error dialog */
return QUIT_PAGE; return QUIT_PAGE;
} }
}
else
{
wcscpy (PathBuffer, SourceRootPath.Buffer);
wcscat (PathBuffer, L"\\loader\\fat.bin");
DPRINT1 ("Install FAT bootcode: %S ==> %S\n", PathBuffer,
DestinationRootPath.Buffer);
Status = InstallFat16BootCodeToDisk (PathBuffer,
DestinationRootPath.Buffer);
if (!NT_SUCCESS (Status))
{
DPRINT1 ("InstallFat16BootCodeToDisk() failed with status 0x%.08x\n", Status);
/* FIXME: show an error dialog */
return QUIT_PAGE;
}
}
break; break;
case FsKeep: case FsKeep: