mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 01:24:38 +00:00
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:
parent
e4b7ecbc70
commit
1926975c01
1 changed files with 76 additions and 37 deletions
|
@ -702,6 +702,8 @@ SelectPartitionPage(PINPUT_RECORD Ir)
|
|||
}
|
||||
}
|
||||
|
||||
CheckActiveBootPartition (PartitionList);
|
||||
|
||||
DrawPartitionList (PartitionList);
|
||||
|
||||
while(TRUE)
|
||||
|
@ -1545,39 +1547,44 @@ FormatPartitionPage (PINPUT_RECORD Ir)
|
|||
{
|
||||
SetStatusText (" Please wait ...");
|
||||
|
||||
switch (FileSystemList->CurrentFileSystem)
|
||||
if (PartEntry->PartInfo[0].PartitionType == PARTITION_ENTRY_UNUSED)
|
||||
{
|
||||
case FsFat:
|
||||
if (DiskEntry->UseLba == FALSE)
|
||||
{
|
||||
if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (32ULL * 1024ULL * 1024ULL))
|
||||
switch (FileSystemList->CurrentFileSystem)
|
||||
{
|
||||
case FsFat:
|
||||
if (DiskEntry->UseLba == FALSE)
|
||||
{
|
||||
/* FAT16 CHS partition (disk is smaller than 32MB) */
|
||||
PartEntry->PartInfo[0].PartitionType = PARTITION_FAT_16;
|
||||
if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (32ULL * 1024ULL * 1024ULL))
|
||||
{
|
||||
/* FAT16 CHS partition (disk is smaller than 32MB) */
|
||||
PartEntry->PartInfo[0].PartitionType = PARTITION_FAT_16;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* FAT16 CHS partition (disk is smaller than 8.4GB) */
|
||||
PartEntry->PartInfo[0].PartitionType = PARTITION_HUGE;
|
||||
}
|
||||
}
|
||||
else if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (2ULL * 1024ULL * 1024ULL * 1024ULL))
|
||||
{
|
||||
/* FAT16 LBA partition (partition is smaller than 2GB) */
|
||||
DPRINT1("%x\n", PartEntry->PartInfo[0].PartitionType);
|
||||
PartEntry->PartInfo[0].PartitionType = PARTITION_XINT13;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* FAT16 CHS partition (disk is smaller than 8.4GB) */
|
||||
PartEntry->PartInfo[0].PartitionType = PARTITION_HUGE;
|
||||
DPRINT1("%x\n", PartEntry->PartInfo[0].PartitionType);
|
||||
/* FAT32 LBA partition (partition is at least 2GB) */
|
||||
PartEntry->PartInfo[0].PartitionType = PARTITION_FAT32_XINT13;
|
||||
}
|
||||
}
|
||||
else if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (2ULL * 1024ULL * 1024ULL * 1024ULL))
|
||||
{
|
||||
/* FAT16 LBA partition (partition is smaller than 2GB) */
|
||||
PartEntry->PartInfo[0].PartitionType = PARTITION_XINT13;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* FAT32 LBA partition (partition is at least 2GB) */
|
||||
PartEntry->PartInfo[0].PartitionType = PARTITION_FAT32_XINT13;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case FsKeep:
|
||||
break;
|
||||
case FsKeep:
|
||||
break;
|
||||
|
||||
default:
|
||||
return QUIT_PAGE;
|
||||
default:
|
||||
return QUIT_PAGE;
|
||||
}
|
||||
}
|
||||
|
||||
CheckActiveBootPartition (PartitionList);
|
||||
|
@ -1619,6 +1626,9 @@ FormatPartitionPage (PINPUT_RECORD Ir)
|
|||
|
||||
Entry = Entry->Flink;
|
||||
}
|
||||
|
||||
/* Restore the old entry */
|
||||
PartEntry = PartitionList->CurrentPartition;
|
||||
//#endif
|
||||
|
||||
if (WritePartitionsToDisk (PartitionList) == FALSE)
|
||||
|
@ -1673,19 +1683,48 @@ FormatPartitionPage (PINPUT_RECORD Ir)
|
|||
return QUIT_PAGE;
|
||||
}
|
||||
|
||||
/* FIXME: Install boot code. This is a hack! */
|
||||
wcscpy (PathBuffer, SourceRootPath.Buffer);
|
||||
wcscat (PathBuffer, L"\\loader\\fat32.bin");
|
||||
|
||||
DPRINT1 ("Install FAT32 bootcode: %S ==> %S\n", PathBuffer,
|
||||
DestinationRootPath.Buffer);
|
||||
Status = InstallFat32BootCodeToDisk (PathBuffer,
|
||||
DestinationRootPath.Buffer);
|
||||
if (!NT_SUCCESS (Status))
|
||||
PartEntry->New = FALSE;
|
||||
if (FileSystemList != NULL)
|
||||
{
|
||||
DPRINT1 ("InstallFat32BootCodeToDisk() failed with status 0x%.08x\n", Status);
|
||||
/* FIXME: show an error dialog */
|
||||
return QUIT_PAGE;
|
||||
DestroyFileSystemList (FileSystemList);
|
||||
FileSystemList = NULL;
|
||||
}
|
||||
|
||||
CheckActiveBootPartition (PartitionList);
|
||||
|
||||
/* 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);
|
||||
wcscat (PathBuffer, L"\\loader\\fat32.bin");
|
||||
|
||||
DPRINT1 ("Install FAT32 bootcode: %S ==> %S\n", PathBuffer,
|
||||
DestinationRootPath.Buffer);
|
||||
Status = InstallFat32BootCodeToDisk (PathBuffer,
|
||||
DestinationRootPath.Buffer);
|
||||
if (!NT_SUCCESS (Status))
|
||||
{
|
||||
DPRINT1 ("InstallFat32BootCodeToDisk() failed with status 0x%.08x\n", Status);
|
||||
/* FIXME: show an error dialog */
|
||||
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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue