From 76e910579c7d72c8672d3e0297f24f53e86f0e5f Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Fri, 12 Jun 2015 21:51:57 +0000 Subject: [PATCH] [USETUP] - Implement mandatory filesystem selection, formatting and filesystem checks for all new partitons. - Implement optional filesystem selection, formatting and filesystem checks for formatted boot and install partitions. - Enable installing ReactOS on primary partitions other than the first one. Usetup will install Freeloader on the first (or active) partition (aka boot partition) and install ReactOS on the chosen partition (aka install partition). svn path=/trunk/; revision=68112 --- reactos/base/setup/usetup/fslist.c | 36 ++- reactos/base/setup/usetup/fslist.h | 9 +- reactos/base/setup/usetup/interface/usetup.c | 275 +++++++++++++++---- reactos/base/setup/usetup/lang/bg-BG.h | 4 + reactos/base/setup/usetup/lang/bn-BD.h | 4 + reactos/base/setup/usetup/lang/cs-CZ.h | 4 + reactos/base/setup/usetup/lang/de-DE.h | 4 + reactos/base/setup/usetup/lang/el-GR.h | 4 + reactos/base/setup/usetup/lang/en-US.h | 4 + reactos/base/setup/usetup/lang/es-ES.h | 4 + reactos/base/setup/usetup/lang/et-EE.h | 4 + reactos/base/setup/usetup/lang/fr-FR.h | 4 + reactos/base/setup/usetup/lang/he-IL.h | 4 + reactos/base/setup/usetup/lang/it-IT.h | 4 + reactos/base/setup/usetup/lang/ja-JP.h | 4 + reactos/base/setup/usetup/lang/lt-LT.h | 4 + reactos/base/setup/usetup/lang/nl-NL.h | 4 + reactos/base/setup/usetup/lang/pl-PL.h | 4 + reactos/base/setup/usetup/lang/pt-BR.h | 4 + reactos/base/setup/usetup/lang/ro-RO.h | 4 + reactos/base/setup/usetup/lang/ru-RU.h | 4 + reactos/base/setup/usetup/lang/sk-SK.h | 4 + reactos/base/setup/usetup/lang/sq-AL.h | 4 + reactos/base/setup/usetup/lang/sv-SE.h | 4 + reactos/base/setup/usetup/lang/tr-TR.h | 4 + reactos/base/setup/usetup/lang/uk-UA.h | 4 + reactos/base/setup/usetup/mui.h | 2 + reactos/base/setup/usetup/partlist.c | 145 +++++++++- reactos/base/setup/usetup/partlist.h | 36 ++- 29 files changed, 510 insertions(+), 85 deletions(-) diff --git a/reactos/base/setup/usetup/fslist.c b/reactos/base/setup/usetup/fslist.c index 1aa660978d1..aa07cff611d 100644 --- a/reactos/base/setup/usetup/fslist.c +++ b/reactos/base/setup/usetup/fslist.c @@ -35,7 +35,7 @@ VOID FS_AddProvider( IN OUT PFILE_SYSTEM_LIST List, - IN LPCWSTR FileSystem, + IN LPCWSTR FileSystemName, IN FORMATEX FormatFunc, IN CHKDSKEX ChkdskFunc) { @@ -45,7 +45,7 @@ FS_AddProvider( if (!Item) return; - Item->FileSystem = FileSystem; + Item->FileSystemName = FileSystemName; Item->FormatFunc = FormatFunc; Item->ChkdskFunc = ChkdskFunc; Item->QuickFormat = TRUE; @@ -58,7 +58,7 @@ FS_AddProvider( if (!Item) return; - Item->FileSystem = FileSystem; + Item->FileSystemName = FileSystemName; Item->FormatFunc = FormatFunc; Item->ChkdskFunc = ChkdskFunc; Item->QuickFormat = FALSE; @@ -99,7 +99,7 @@ CreateFileSystemList( while (ListEntry != &List->ListHead) { Item = CONTAINING_RECORD(ListEntry, FILE_SYSTEM_ITEM, ListEntry); - if (Item->FileSystem && wcscmp(ForceFileSystem, Item->FileSystem) == 0) + if (Item->FileSystemName && wcscmp(ForceFileSystem, Item->FileSystemName) == 0) { List->Selected = Item; break; @@ -163,12 +163,12 @@ DrawFileSystemList( coPos, &Written); - if (Item->FileSystem) + if (Item->FileSystemName) { if (Item->QuickFormat) - snprintf(Buffer, sizeof(Buffer), MUIGetString(STRING_FORMATDISK1), Item->FileSystem); + snprintf(Buffer, sizeof(Buffer), MUIGetString(STRING_FORMATDISK1), Item->FileSystemName); else - snprintf(Buffer, sizeof(Buffer), MUIGetString(STRING_FORMATDISK2), Item->FileSystem); + snprintf(Buffer, sizeof(Buffer), MUIGetString(STRING_FORMATDISK2), Item->FileSystemName); } else snprintf(Buffer, sizeof(Buffer), MUIGetString(STRING_KEEPFORMAT)); @@ -210,4 +210,26 @@ ScrollUpFileSystemList( } } + +PFILE_SYSTEM_ITEM +GetFileSystemByName( + IN PFILE_SYSTEM_LIST List, + IN LPWSTR FileSystemName) +{ + PLIST_ENTRY ListEntry; + PFILE_SYSTEM_ITEM Item; + + ListEntry = List->ListHead.Flink; + while (ListEntry != &List->ListHead) + { + Item = CONTAINING_RECORD(ListEntry, FILE_SYSTEM_ITEM, ListEntry); + if (Item->FileSystemName && wcsicmp(FileSystemName, Item->FileSystemName) == 0) + return Item; + + ListEntry = ListEntry->Flink; + } + + return NULL; +} + /* EOF */ diff --git a/reactos/base/setup/usetup/fslist.h b/reactos/base/setup/usetup/fslist.h index 6b28e29073e..fe48a1aefcc 100644 --- a/reactos/base/setup/usetup/fslist.h +++ b/reactos/base/setup/usetup/fslist.h @@ -31,7 +31,7 @@ typedef struct _FILE_SYSTEM_ITEM { LIST_ENTRY ListEntry; - LPCWSTR FileSystem; /* Not owned by the item */ + LPCWSTR FileSystemName; /* Not owned by the item */ FORMATEX FormatFunc; CHKDSKEX ChkdskFunc; BOOLEAN QuickFormat; @@ -48,7 +48,7 @@ typedef struct _FILE_SYSTEM_LIST VOID FS_AddProvider( IN OUT PFILE_SYSTEM_LIST List, - IN LPCWSTR FileSystem, + IN LPCWSTR FileSystemName, IN FORMATEX FormatFunc, IN CHKDSKEX ChkdskFunc); @@ -75,4 +75,9 @@ VOID ScrollUpFileSystemList( IN PFILE_SYSTEM_LIST List); +PFILE_SYSTEM_ITEM +GetFileSystemByName( + IN PFILE_SYSTEM_LIST List, + IN LPWSTR FileSystemName); + /* EOF */ diff --git a/reactos/base/setup/usetup/interface/usetup.c b/reactos/base/setup/usetup/interface/usetup.c index e223f5af40b..2f3b83f2377 100644 --- a/reactos/base/setup/usetup/interface/usetup.c +++ b/reactos/base/setup/usetup/interface/usetup.c @@ -2418,6 +2418,8 @@ SelectFileSystemPage(PINPUT_RECORD Ir) PCHAR PartUnit; PCHAR PartType; + DPRINT("SelectFileSystemPage()\n"); + if (PartitionList == NULL || PartitionList->CurrentDisk == NULL || PartitionList->CurrentPartition == NULL) @@ -2426,8 +2428,90 @@ SelectFileSystemPage(PINPUT_RECORD Ir) return QUIT_PAGE; } - DiskEntry = PartitionList->CurrentDisk; - PartEntry = PartitionList->CurrentPartition; + /* Find or set the active partition */ + CheckActiveBootPartition(PartitionList); + + if (PartitionList->BootDisk == NULL || + PartitionList->BootPartition == NULL) + { + /* FIXME: show an error dialog */ + return QUIT_PAGE; + } + + switch (PartitionList->FormatState) + { + case Start: + if (PartitionList->CurrentPartition != PartitionList->BootPartition) + { + PartitionList->TempDisk = PartitionList->BootDisk; + PartitionList->TempPartition = PartitionList->BootPartition; + PartitionList->TempPartition->NeedsCheck = TRUE; + + PartitionList->FormatState = FormatSystemPartition; + DPRINT1("FormatState: Start --> FormatSystemPartition\n"); + } + else + { + PartitionList->TempDisk = PartitionList->CurrentDisk; + PartitionList->TempPartition = PartitionList->CurrentPartition; + PartitionList->TempPartition->NeedsCheck = TRUE; + + PartitionList->FormatState = FormatInstallPartition; + DPRINT1("FormatState: Start --> FormatInstallPartition\n"); + } + break; + + case FormatSystemPartition: + PartitionList->TempDisk = PartitionList->CurrentDisk; + PartitionList->TempPartition = PartitionList->CurrentPartition; + PartitionList->TempPartition->NeedsCheck = TRUE; + + PartitionList->FormatState = FormatInstallPartition; + DPRINT1("FormatState: FormatSystemPartition --> FormatInstallPartition\n"); + break; + + case FormatInstallPartition: + if (GetNextUnformattedPartition(PartitionList, + &PartitionList->TempDisk, + &PartitionList->TempPartition)) + { + PartitionList->FormatState = FormatOtherPartition; + PartitionList->TempPartition->NeedsCheck = TRUE; + DPRINT1("FormatState: FormatInstallPartition --> FormatOtherPartition\n"); + } + else + { + PartitionList->FormatState = FormatDone; + DPRINT1("FormatState: FormatInstallPartition --> FormatDone\n"); + return CHECK_FILE_SYSTEM_PAGE; + } + break; + + case FormatOtherPartition: + if (GetNextUnformattedPartition(PartitionList, + &PartitionList->TempDisk, + &PartitionList->TempPartition)) + { + PartitionList->FormatState = FormatOtherPartition; + PartitionList->TempPartition->NeedsCheck = TRUE; + DPRINT1("FormatState: FormatOtherPartition --> FormatOtherPartition\n"); + } + else + { + PartitionList->FormatState = FormatDone; + DPRINT1("FormatState: FormatOtherPartition --> FormatDone\n"); + return CHECK_FILE_SYSTEM_PAGE; + } + break; + + default: + DPRINT1("FormatState: Invalid value %ld\n", PartitionList->FormatState); + /* FIXME: show an error dialog */ + return QUIT_PAGE; + } + + DiskEntry = PartitionList->TempDisk; + PartEntry = PartitionList->TempPartition; /* adjust disk size */ DiskSize = DiskEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector; @@ -2513,7 +2597,24 @@ SelectFileSystemPage(PINPUT_RECORD Ir) } else if (PartEntry->New == TRUE) { - CONSOLE_SetTextXY(6, 8, MUIGetString(STRING_NONFORMATTEDPART)); + switch (PartitionList->FormatState) + { + case FormatSystemPartition: + CONSOLE_SetTextXY(6, 8, MUIGetString(STRING_NONFORMATTEDSYSTEMPART)); + break; + + case FormatInstallPartition: + CONSOLE_SetTextXY(6, 8, MUIGetString(STRING_NONFORMATTEDPART)); + break; + + case FormatOtherPartition: + CONSOLE_SetTextXY(6, 8, MUIGetString(STRING_NONFORMATTEDOTHERPART)); + break; + + default: + break; + } + CONSOLE_SetTextXY(6, 10, MUIGetString(STRING_PARTFORMAT)); } else @@ -2577,6 +2678,8 @@ SelectFileSystemPage(PINPUT_RECORD Ir) { if (UnattendFormatPartition) { + PartEntry->FileSystem = GetFileSystemByName(FileSystemList, + L"FAT"); return FORMAT_PARTITION_PAGE; } @@ -2616,10 +2719,11 @@ SelectFileSystemPage(PINPUT_RECORD Ir) { if (!FileSystemList->Selected->FormatFunc) { - return CHECK_FILE_SYSTEM_PAGE; + return SELECT_FILE_SYSTEM_PAGE; } else { + PartEntry->FileSystem = FileSystemList->Selected; return FORMAT_PARTITION_PAGE; } } @@ -2632,6 +2736,7 @@ SelectFileSystemPage(PINPUT_RECORD Ir) static ULONG FormatPartitionPage(PINPUT_RECORD Ir) { + UNICODE_STRING PartitionRootPath; WCHAR PathBuffer[MAX_PATH]; PDISKENTRY DiskEntry; PPARTENTRY PartEntry; @@ -2643,18 +2748,20 @@ FormatPartitionPage(PINPUT_RECORD Ir) PLIST_ENTRY Entry; #endif + DPRINT("FormatPartitionPage()\n"); + MUIDisplayPage(FORMAT_PARTITION_PAGE); if (PartitionList == NULL || - PartitionList->CurrentDisk == NULL || - PartitionList->CurrentPartition == NULL) + PartitionList->TempDisk == NULL || + PartitionList->TempPartition == NULL) { /* FIXME: show an error dialog */ return QUIT_PAGE; } - DiskEntry = PartitionList->CurrentDisk; - PartEntry = PartitionList->CurrentPartition; + DiskEntry = PartitionList->TempDisk; + PartEntry = PartitionList->TempPartition; while (TRUE) { @@ -2677,7 +2784,7 @@ FormatPartitionPage(PINPUT_RECORD Ir) { CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT)); - if (wcscmp(FileSystemList->Selected->FileSystem, L"FAT") == 0) + if (wcscmp(PartEntry->FileSystem->FileSystemName, L"FAT") == 0) { if (PartEntry->SectorCount.QuadPart < 8192) { @@ -2720,17 +2827,24 @@ FormatPartitionPage(PINPUT_RECORD Ir) } } + DiskEntry->Dirty = TRUE; DiskEntry->LayoutBuffer->PartitionEntry[PartEntry->PartitionIndex].PartitionType = PartEntry->PartitionType; + DiskEntry->LayoutBuffer->PartitionEntry[PartEntry->PartitionIndex].RewritePartition = TRUE; } #if 0 - else if (wcscmp(FileSystemList->Selected->FileSystem, L"EXT2") == 0) + else if (wcscmp(PartEntry->FileSystem->FileSystemName, L"EXT2") == 0) { PartEntry->PartitionType = PARTITION_EXT2; + + DiskEntry->Dirty = TRUE; DiskEntry->LayoutBuffer->PartitionEntry[PartEntry->PartitionIndex].PartitionType = PartEntry->PartitionType; + DiskEntry->LayoutBuffer->PartitionEntry[PartEntry->PartitionIndex].RewritePartition = TRUE; } #endif - else if (!FileSystemList->Selected->FormatFunc) + else if (!PartEntry->FileSystem->FormatFunc) + { return QUIT_PAGE; + } #ifndef NDEBUG CONSOLE_PrintTextXY(6, 12, @@ -2740,7 +2854,7 @@ FormatPartitionPage(PINPUT_RECORD Ir) DiskEntry->TrackSize); Line = 13; - DiskEntry = PartitionList->CurrentDisk; + DiskEntry = PartitionList->TempDisk; Entry = DiskEntry->PartListHead.Flink; while (Entry != &DiskEntry->PrimaryPartListHead) @@ -2765,11 +2879,9 @@ FormatPartitionPage(PINPUT_RECORD Ir) } /* Restore the old entry */ - PartEntry = PartitionList->CurrentPartition; + PartEntry = PartitionList->TempPartition; #endif - CheckActiveBootPartition(PartitionList); - if (WritePartitionsToDisk(PartitionList) == FALSE) { DPRINT("WritePartitionsToDisk() failed\n"); @@ -2777,20 +2889,19 @@ FormatPartitionPage(PINPUT_RECORD Ir) return QUIT_PAGE; } - /* Set DestinationRootPath */ - RtlFreeUnicodeString(&DestinationRootPath); + /* Set PartitionRootPath */ swprintf(PathBuffer, L"\\Device\\Harddisk%lu\\Partition%lu", - PartitionList->CurrentDisk->DiskNumber, - PartitionList->CurrentPartition->PartitionNumber); - RtlCreateUnicodeString(&DestinationRootPath, - PathBuffer); - DPRINT("DestinationRootPath: %wZ\n", &DestinationRootPath); + DiskEntry->DiskNumber, + PartEntry->PartitionNumber); + RtlInitUnicodeString(&PartitionRootPath, + PathBuffer); + DPRINT("PartitionRootPath: %wZ\n", &PartitionRootPath); - if (FileSystemList->Selected->FormatFunc) + if (PartEntry->FileSystem->FormatFunc) { - Status = FormatPartition(&DestinationRootPath, - FileSystemList->Selected); + Status = FormatPartition(&PartitionRootPath, + PartEntry->FileSystem); if (!NT_SUCCESS(Status)) { DPRINT1("FormatPartition() failed with status 0x%08lx\n", Status); @@ -2799,7 +2910,6 @@ FormatPartitionPage(PINPUT_RECORD Ir) } PartEntry->New = FALSE; - } #ifndef NDEBUG @@ -2807,9 +2917,7 @@ FormatPartitionPage(PINPUT_RECORD Ir) CONSOLE_ConInKey(Ir); #endif - DestroyFileSystemList(FileSystemList); - FileSystemList = NULL; - return INSTALL_DIRECTORY_PAGE; + return SELECT_FILE_SYSTEM_PAGE; } } @@ -2821,35 +2929,76 @@ static ULONG CheckFileSystemPage(PINPUT_RECORD Ir) { PFILE_SYSTEM_ITEM CurrentFileSystem; + UNICODE_STRING PartitionRootPath; WCHAR PathBuffer[MAX_PATH]; CHAR Buffer[MAX_PATH]; + LPWSTR FileSystemName = NULL; + PDISKENTRY DiskEntry; + PPARTENTRY PartEntry; NTSTATUS Status; - /* FIXME: code duplicated in FormatPartitionPage */ - /* Set DestinationRootPath */ - RtlFreeUnicodeString(&DestinationRootPath); + if (PartitionList == NULL) + { + /* FIXME: show an error dialog */ + return QUIT_PAGE; + } + + if (!GetNextUncheckedPartition(PartitionList, + &DiskEntry, + &PartEntry)) + { + return INSTALL_DIRECTORY_PAGE; + } + + /* Set PartitionRootPath */ swprintf(PathBuffer, L"\\Device\\Harddisk%lu\\Partition%lu", - PartitionList->CurrentDisk->DiskNumber, - PartitionList->CurrentPartition->PartitionNumber); - RtlCreateUnicodeString(&DestinationRootPath, PathBuffer); - DPRINT("DestinationRootPath: %wZ\n", &DestinationRootPath); + DiskEntry->DiskNumber, + PartEntry->PartitionNumber); + RtlInitUnicodeString(&PartitionRootPath, PathBuffer); + DPRINT("PartitionRootPath: %wZ\n", &PartitionRootPath); CONSOLE_SetTextXY(6, 8, MUIGetString(STRING_CHECKINGPART)); CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT)); - /* WRONG: first filesystem is not necesseraly the one of the current partition! */ - CurrentFileSystem = CONTAINING_RECORD(FileSystemList->ListHead.Flink, FILE_SYSTEM_ITEM, ListEntry); + CurrentFileSystem = PartEntry->FileSystem; + if (CurrentFileSystem->FileSystemName == NULL) + { + if ((PartEntry->PartitionType == PARTITION_FAT_12) || + (PartEntry->PartitionType == PARTITION_FAT_16) || + (PartEntry->PartitionType == PARTITION_HUGE) || + (PartEntry->PartitionType == PARTITION_XINT13)) + { + FileSystemName = L"FAT"; + } + else if ((PartEntry->PartitionType == PARTITION_FAT32) || + (PartEntry->PartitionType == PARTITION_FAT32_XINT13)) + { + FileSystemName = L"FAT32"; + } + else if (PartEntry->PartitionType == PARTITION_EXT2) + { + FileSystemName = L"EXT2"; + } + else if (PartEntry->PartitionType == PARTITION_IFS) + { + FileSystemName = L"NTFS"; /* FIXME: Not quite correct! */ + } - if (!CurrentFileSystem->ChkdskFunc) + if (FileSystemName != NULL) + CurrentFileSystem = GetFileSystemByName(FileSystemList, + FileSystemName); + } + + if (CurrentFileSystem == NULL || CurrentFileSystem->ChkdskFunc == NULL) { sprintf(Buffer, "Setup is currently unable to check a partition formatted in %S.\n" "\n" " \x07 Press ENTER to continue Setup.\n" " \x07 Press F3 to quit Setup.", - CurrentFileSystem->FileSystem); + CurrentFileSystem->FileSystemName); PopupError(Buffer, MUIGetString(STRING_QUITCONTINUE), @@ -2869,13 +3018,14 @@ CheckFileSystemPage(PINPUT_RECORD Ir) } else if (Ir->Event.KeyEvent.uChar.AsciiChar == VK_RETURN) /* ENTER */ { - return INSTALL_DIRECTORY_PAGE; + PartEntry->NeedsCheck = FALSE; + return CHECK_FILE_SYSTEM_PAGE; } } } else { - Status = ChkdskPartition(&DestinationRootPath, CurrentFileSystem); + Status = ChkdskPartition(&PartitionRootPath, CurrentFileSystem); if (!NT_SUCCESS(Status)) { DPRINT("ChkdskPartition() failed with status 0x%08lx\n", Status); @@ -2889,7 +3039,8 @@ CheckFileSystemPage(PINPUT_RECORD Ir) return QUIT_PAGE; } - return INSTALL_DIRECTORY_PAGE; + PartEntry->NeedsCheck = FALSE; + return CHECK_FILE_SYSTEM_PAGE; } } @@ -2906,6 +3057,15 @@ InstallDirectoryPage1(PWCHAR InstallDir, RtlCreateUnicodeString(&InstallPath, InstallDir); + /* Create 'DestinationRootPath' string */ + RtlFreeUnicodeString(&DestinationRootPath); + swprintf(PathBuffer, + L"\\Device\\Harddisk%lu\\Partition%lu", + DiskEntry->DiskNumber, + PartEntry->PartitionNumber); + RtlCreateUnicodeString(&DestinationRootPath, PathBuffer); + DPRINT("DestinationRootPath: %wZ\n", &DestinationRootPath); + /* Create 'DestinationPath' string */ RtlFreeUnicodeString(&DestinationPath); wcscpy(PathBuffer, DestinationRootPath.Buffer); @@ -2941,6 +3101,10 @@ InstallDirectoryPage(PINPUT_RECORD Ir) WCHAR InstallDir[51]; ULONG Length; + /* We do not need the filsystem list any more */ + DestroyFileSystemList(FileSystemList); + FileSystemList = NULL; + if (PartitionList == NULL || PartitionList->CurrentDisk == NULL || PartitionList->CurrentPartition == NULL) @@ -3760,27 +3924,16 @@ BootLoaderPage(PINPUT_RECORD Ir) CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT)); - /* Find or set the active partition */ - CheckActiveBootPartition(PartitionList); - - /* Update the partition table because we may have changed the active partition */ - if (WritePartitionsToDisk(PartitionList) == FALSE) - { - DPRINT("WritePartitionsToDisk() failed\n"); - MUIDisplayError(ERROR_WRITE_PTABLE, Ir, POPUP_WAIT_ENTER); - return QUIT_PAGE; - } - RtlFreeUnicodeString(&SystemRootPath); swprintf(PathBuffer, L"\\Device\\Harddisk%lu\\Partition%lu", - PartitionList->ActiveBootDisk->DiskNumber, - PartitionList->ActiveBootPartition->PartitionNumber); + PartitionList->BootDisk->DiskNumber, + PartitionList->BootPartition->PartitionNumber); RtlCreateUnicodeString(&SystemRootPath, PathBuffer); DPRINT("SystemRootPath: %wZ\n", &SystemRootPath); - PartitionType = PartitionList->ActiveBootPartition->PartitionType; + PartitionType = PartitionList->BootPartition->PartitionType; if (IsUnattendedSetup) { @@ -3958,13 +4111,14 @@ BootLoaderFloppyPage(PINPUT_RECORD Ir) return BOOT_LOADER_FLOPPY_PAGE; } + static PAGE_NUMBER BootLoaderHarddiskVbrPage(PINPUT_RECORD Ir) { UCHAR PartitionType; NTSTATUS Status; - PartitionType = PartitionList->ActiveBootPartition->PartitionType; + PartitionType = PartitionList->BootPartition->PartitionType; Status = InstallVBRToPartition(&SystemRootPath, &SourceRootPath, @@ -3979,6 +4133,7 @@ BootLoaderHarddiskVbrPage(PINPUT_RECORD Ir) return SUCCESS_PAGE; } + static PAGE_NUMBER BootLoaderHarddiskMbrPage(PINPUT_RECORD Ir) { @@ -3988,7 +4143,7 @@ BootLoaderHarddiskMbrPage(PINPUT_RECORD Ir) WCHAR SourceMbrPathBuffer[MAX_PATH]; /* Step 1: Write the VBR */ - PartitionType = PartitionList->ActiveBootPartition->PartitionType; + PartitionType = PartitionList->BootPartition->PartitionType; Status = InstallVBRToPartition(&SystemRootPath, &SourceRootPath, @@ -4003,7 +4158,7 @@ BootLoaderHarddiskMbrPage(PINPUT_RECORD Ir) /* Step 2: Write the MBR */ swprintf(DestinationDevicePathBuffer, L"\\Device\\Harddisk%d\\Partition0", - PartitionList->ActiveBootDisk->DiskNumber); + PartitionList->BootDisk->DiskNumber); wcscpy(SourceMbrPathBuffer, SourceRootPath.Buffer); wcscat(SourceMbrPathBuffer, L"\\loader\\dosmbr.bin"); diff --git a/reactos/base/setup/usetup/lang/bg-BG.h b/reactos/base/setup/usetup/lang/bg-BG.h index d349246a985..76402326956 100644 --- a/reactos/base/setup/usetup/lang/bg-BG.h +++ b/reactos/base/setup/usetup/lang/bg-BG.h @@ -1669,6 +1669,10 @@ MUI_STRING bgBGStrings[] = "।á⮨ ä®à¬ â¨à ­¥ ­  ¤ï« ."}, {STRING_NONFORMATTEDPART, "ˆ§¡à «¨ á⥠¤  á«®¦¨â¥ ¥ ªâŽ‘ ­  ­®¢ ¨«¨ ­¥à §¯à¥¤¥«¥­ ¤ï«."}, + {STRING_NONFORMATTEDSYSTEMPART, + "The system partition is not formatted yet."}, + {STRING_NONFORMATTEDOTHERPART, + "The new partition is not formatted yet."}, {STRING_INSTALLONPART, "‘« £ ­¥ ­  ¥ ªâŽ‘ ¢êàåã ¤ï«"}, {STRING_CHECKINGPART, diff --git a/reactos/base/setup/usetup/lang/bn-BD.h b/reactos/base/setup/usetup/lang/bn-BD.h index 61d6dc645d5..c64ece3fa46 100644 --- a/reactos/base/setup/usetup/lang/bn-BD.h +++ b/reactos/base/setup/usetup/lang/bn-BD.h @@ -1653,6 +1653,10 @@ MUI_STRING bnBDStrings[] = "This Partition will be formatted next."}, {STRING_NONFORMATTEDPART, "You chose to install ReactOS on a new or unformatted Partition."}, + {STRING_NONFORMATTEDSYSTEMPART, + "The system partition is not formatted yet."}, + {STRING_NONFORMATTEDOTHERPART, + "The new partition is not formatted yet."}, {STRING_INSTALLONPART, "Setup installs ReactOS onto Partition"}, {STRING_CHECKINGPART, diff --git a/reactos/base/setup/usetup/lang/cs-CZ.h b/reactos/base/setup/usetup/lang/cs-CZ.h index 5456c58461b..dbda9bdc6f6 100644 --- a/reactos/base/setup/usetup/lang/cs-CZ.h +++ b/reactos/base/setup/usetup/lang/cs-CZ.h @@ -1662,6 +1662,10 @@ MUI_STRING csCZStrings[] = "Tento odd¡l bude zform tov n."}, {STRING_NONFORMATTEDPART, "Zvolili jste instalaci ReactOS na novì nebo nezform tovanì odd¡l."}, + {STRING_NONFORMATTEDSYSTEMPART, + "The system partition is not formatted yet."}, + {STRING_NONFORMATTEDOTHERPART, + "The new partition is not formatted yet."}, {STRING_INSTALLONPART, "Instalace nakop¡ruje ReactOS na odd¡l"}, {STRING_CHECKINGPART, diff --git a/reactos/base/setup/usetup/lang/de-DE.h b/reactos/base/setup/usetup/lang/de-DE.h index 9bc2f055f62..85ece1cf3ed 100644 --- a/reactos/base/setup/usetup/lang/de-DE.h +++ b/reactos/base/setup/usetup/lang/de-DE.h @@ -1658,6 +1658,10 @@ MUI_STRING deDEStrings[] = "Diese Partition wird als n„chstes formatiert."}, {STRING_NONFORMATTEDPART, "Sie wollen ReactOS auf einer neuen/unformatierten Partition installieren."}, + {STRING_NONFORMATTEDSYSTEMPART, + "The system partition is not formatted yet."}, + {STRING_NONFORMATTEDOTHERPART, + "The new partition is not formatted yet."}, {STRING_INSTALLONPART, "ReactOS wird auf dieser Partition installiert."}, {STRING_CHECKINGPART, diff --git a/reactos/base/setup/usetup/lang/el-GR.h b/reactos/base/setup/usetup/lang/el-GR.h index 200b48d8b9f..0d596b1f38e 100644 --- a/reactos/base/setup/usetup/lang/el-GR.h +++ b/reactos/base/setup/usetup/lang/el-GR.h @@ -1679,6 +1679,10 @@ MUI_STRING elGRStrings[] = "€¬«æ «¦ Partition Ÿ˜ › ˜£¦¨­àŸœå £œ«á."}, {STRING_NONFORMATTEDPART, "„§ ¢â¥˜«œ ¤˜ œš¡˜«˜©«ã©œ«œ «¦ ReactOS ©œ ⤘ ¤â¦ ã £ž › ˜£¦¨­à£â¤¦ Partition."}, + {STRING_NONFORMATTEDSYSTEMPART, + "The system partition is not formatted yet."}, + {STRING_NONFORMATTEDOTHERPART, + "The new partition is not formatted yet."}, {STRING_INSTALLONPART, "Setup install ReactOS onto Partition"}, {STRING_CHECKINGPART, diff --git a/reactos/base/setup/usetup/lang/en-US.h b/reactos/base/setup/usetup/lang/en-US.h index 3b5d278a0bc..9e1b510d5e3 100644 --- a/reactos/base/setup/usetup/lang/en-US.h +++ b/reactos/base/setup/usetup/lang/en-US.h @@ -1653,6 +1653,10 @@ MUI_STRING enUSStrings[] = "This Partition will be formatted next."}, {STRING_NONFORMATTEDPART, "You chose to install ReactOS on a new or unformatted Partition."}, + {STRING_NONFORMATTEDSYSTEMPART, + "The system partition is not formatted yet."}, + {STRING_NONFORMATTEDOTHERPART, + "The new partition is not formatted yet."}, {STRING_INSTALLONPART, "Setup installs ReactOS onto Partition"}, {STRING_CHECKINGPART, diff --git a/reactos/base/setup/usetup/lang/es-ES.h b/reactos/base/setup/usetup/lang/es-ES.h index 33eaf7b9f11..9292ab271c9 100644 --- a/reactos/base/setup/usetup/lang/es-ES.h +++ b/reactos/base/setup/usetup/lang/es-ES.h @@ -1661,6 +1661,10 @@ MUI_STRING esESStrings[] = "A continuaci¢n se formatear  esta partici¢n."}, {STRING_NONFORMATTEDPART, "Ha elegido instalar ReactOS en una nueva partici¢n o en una partici¢n sin formato."}, + {STRING_NONFORMATTEDSYSTEMPART, + "The system partition is not formatted yet."}, + {STRING_NONFORMATTEDOTHERPART, + "The new partition is not formatted yet."}, {STRING_INSTALLONPART, "El instalador est  instalando ReactOS en la partici¢n"}, {STRING_CHECKINGPART, diff --git a/reactos/base/setup/usetup/lang/et-EE.h b/reactos/base/setup/usetup/lang/et-EE.h index 96d829eb85b..28c3e1ded28 100644 --- a/reactos/base/setup/usetup/lang/et-EE.h +++ b/reactos/base/setup/usetup/lang/et-EE.h @@ -1654,6 +1654,10 @@ MUI_STRING etEEStrings[] = "J„rgmisena vormindatakse seda partitsiooni."}, {STRING_NONFORMATTEDPART, "Oled valinud ReactOSi paigaldamise uuele väi vormindamata partitsioonile."}, + {STRING_NONFORMATTEDSYSTEMPART, + "The system partition is not formatted yet."}, + {STRING_NONFORMATTEDOTHERPART, + "The new partition is not formatted yet."}, {STRING_INSTALLONPART, "ReactOS paigaldatakse partitsioonile"}, {STRING_CHECKINGPART, diff --git a/reactos/base/setup/usetup/lang/fr-FR.h b/reactos/base/setup/usetup/lang/fr-FR.h index 09088ad51c9..fdc6ed31917 100644 --- a/reactos/base/setup/usetup/lang/fr-FR.h +++ b/reactos/base/setup/usetup/lang/fr-FR.h @@ -1667,6 +1667,10 @@ MUI_STRING frFRStrings[] = "Cette Partition sera ensuite format‚e."}, {STRING_NONFORMATTEDPART, "Vous avez choisi d'installer ReactOS sur une nouvelle partition."}, + {STRING_NONFORMATTEDSYSTEMPART, + "The system partition is not formatted yet."}, + {STRING_NONFORMATTEDOTHERPART, + "The new partition is not formatted yet."}, {STRING_INSTALLONPART, "Setup installe ReactOS sur la partition"}, {STRING_CHECKINGPART, diff --git a/reactos/base/setup/usetup/lang/he-IL.h b/reactos/base/setup/usetup/lang/he-IL.h index 6265ec03df0..f1ed579cac1 100644 --- a/reactos/base/setup/usetup/lang/he-IL.h +++ b/reactos/base/setup/usetup/lang/he-IL.h @@ -1655,6 +1655,10 @@ MUI_STRING heILStrings[] = "This Partition will be formatted next."}, {STRING_NONFORMATTEDPART, "You chose to install ReactOS on a new or unformatted Partition."}, + {STRING_NONFORMATTEDSYSTEMPART, + "The system partition is not formatted yet."}, + {STRING_NONFORMATTEDOTHERPART, + "The new partition is not formatted yet."}, {STRING_INSTALLONPART, "Setup installs ReactOS onto Partition"}, {STRING_CHECKINGPART, diff --git a/reactos/base/setup/usetup/lang/it-IT.h b/reactos/base/setup/usetup/lang/it-IT.h index 835a9d6343d..68d589f879d 100644 --- a/reactos/base/setup/usetup/lang/it-IT.h +++ b/reactos/base/setup/usetup/lang/it-IT.h @@ -1658,6 +1658,10 @@ MUI_STRING itITStrings[] = "Questa partizione sar… formattata successivamente."}, {STRING_NONFORMATTEDPART, "Avete scelto di installare ReactOS su una partizione nuova o non formattata."}, + {STRING_NONFORMATTEDSYSTEMPART, + "The system partition is not formatted yet."}, + {STRING_NONFORMATTEDOTHERPART, + "The new partition is not formatted yet."}, {STRING_INSTALLONPART, "Setup installer… ReactOS sulla partitione"}, {STRING_CHECKINGPART, diff --git a/reactos/base/setup/usetup/lang/ja-JP.h b/reactos/base/setup/usetup/lang/ja-JP.h index e70f60fa84b..b7ae3e89116 100644 --- a/reactos/base/setup/usetup/lang/ja-JP.h +++ b/reactos/base/setup/usetup/lang/ja-JP.h @@ -1657,6 +1657,10 @@ MUI_STRING jaJPStrings[] = "ºÉ Ê߰è¼®ÝÊ Â·ÞÉ Ã¼Þ­ÝÃÞ Ì«°Ï¯Ä »ÚϽ¡"}, {STRING_NONFORMATTEDPART, "ReactOS¦ ¼Ý· ÏÀÊ ÐÌ«°Ï¯ÄÉ Ê߰è¼®ÝÆ ²Ý½Ä°Ù½Ù ºÄ¶Þ ¾ÝÀ¸ »ÚϼÀ¡"}, + {STRING_NONFORMATTEDSYSTEMPART, + "The system partition is not formatted yet."}, + {STRING_NONFORMATTEDOTHERPART, + "The new partition is not formatted yet."}, {STRING_INSTALLONPART, "¾¯Ä±¯ÌßÊ ReactOS¦ Ê߰è¼®Ý ¼Þ®³Æ ²Ý½Ä°Ù¼Ï½¡"}, {STRING_CHECKINGPART, diff --git a/reactos/base/setup/usetup/lang/lt-LT.h b/reactos/base/setup/usetup/lang/lt-LT.h index db3689194b3..c3372b33c6c 100644 --- a/reactos/base/setup/usetup/lang/lt-LT.h +++ b/reactos/base/setup/usetup/lang/lt-LT.h @@ -1664,6 +1664,10 @@ MUI_STRING ltLTStrings[] = "This Partition will be formatted next."}, {STRING_NONFORMATTEDPART, "You chose to install ReactOS on a new or unformatted Partition."}, + {STRING_NONFORMATTEDSYSTEMPART, + "The system partition is not formatted yet."}, + {STRING_NONFORMATTEDOTHERPART, + "The new partition is not formatted yet."}, {STRING_INSTALLONPART, "Setup installs ReactOS onto Partition"}, {STRING_CHECKINGPART, diff --git a/reactos/base/setup/usetup/lang/nl-NL.h b/reactos/base/setup/usetup/lang/nl-NL.h index 1b1ab3efd7d..5089c1546a1 100644 --- a/reactos/base/setup/usetup/lang/nl-NL.h +++ b/reactos/base/setup/usetup/lang/nl-NL.h @@ -1702,6 +1702,10 @@ MUI_STRING nlNLStrings[] = "Deze partitie zal vervolgens geformatteerd worden."}, {STRING_NONFORMATTEDPART, "U wilt ReactOS installeren op een nieuwe of ongeformatteerde partitie."}, + {STRING_NONFORMATTEDSYSTEMPART, + "The system partition is not formatted yet."}, + {STRING_NONFORMATTEDOTHERPART, + "The new partition is not formatted yet."}, {STRING_INSTALLONPART, "Setup installeert ReactOS op Partitie"}, {STRING_CHECKINGPART, diff --git a/reactos/base/setup/usetup/lang/pl-PL.h b/reactos/base/setup/usetup/lang/pl-PL.h index 036ccdf458c..add21232e78 100644 --- a/reactos/base/setup/usetup/lang/pl-PL.h +++ b/reactos/base/setup/usetup/lang/pl-PL.h @@ -1664,6 +1664,10 @@ MUI_STRING plPLStrings[] = "Nast©puj¥ca partycja zostanie sformatowana."}, {STRING_NONFORMATTEDPART, "Mo¾esz zainstalowa† ReactOS na nowej lub niesformatowanej partycji."}, + {STRING_NONFORMATTEDSYSTEMPART, + "The system partition is not formatted yet."}, + {STRING_NONFORMATTEDOTHERPART, + "The new partition is not formatted yet."}, {STRING_INSTALLONPART, "Instalator kopiuje pliki systemu na wybran¥ partycj©."}, {STRING_CHECKINGPART, diff --git a/reactos/base/setup/usetup/lang/pt-BR.h b/reactos/base/setup/usetup/lang/pt-BR.h index c292c4206d3..f3ffa68b7d3 100644 --- a/reactos/base/setup/usetup/lang/pt-BR.h +++ b/reactos/base/setup/usetup/lang/pt-BR.h @@ -1693,6 +1693,10 @@ MUI_STRING ptBRStrings[] = "Esta parti‡Æo ser  formatada logo em seguida."}, {STRING_NONFORMATTEDPART, "Vocˆ solicitou instalar o ReactOS em uma parti‡Æo nova ou sem formato."}, + {STRING_NONFORMATTEDSYSTEMPART, + "The system partition is not formatted yet."}, + {STRING_NONFORMATTEDOTHERPART, + "The new partition is not formatted yet."}, {STRING_INSTALLONPART, "O instalador instala o ReactOS na parti‡Æo"}, {STRING_CHECKINGPART, diff --git a/reactos/base/setup/usetup/lang/ro-RO.h b/reactos/base/setup/usetup/lang/ro-RO.h index 6cac64a5b7c..2d3626fbe82 100644 --- a/reactos/base/setup/usetup/lang/ro-RO.h +++ b/reactos/base/setup/usetup/lang/ro-RO.h @@ -1730,6 +1730,10 @@ MUI_STRING roROStrings[] = "AceastÇ partiîie urmeazÇ sÇ fie formatatÇ."}, {STRING_NONFORMATTEDPART, "Alegeîi sÇ instalaîi ReactOS pe partiîie nouÇ sau neformatatÇ."}, + {STRING_NONFORMATTEDSYSTEMPART, + "The system partition is not formatted yet."}, + {STRING_NONFORMATTEDOTHERPART, + "The new partition is not formatted yet."}, {STRING_INSTALLONPART, "ReactOS va fi instalat pe partiîia"}, {STRING_CHECKINGPART, diff --git a/reactos/base/setup/usetup/lang/ru-RU.h b/reactos/base/setup/usetup/lang/ru-RU.h index 709905b3348..b61d1a39379 100644 --- a/reactos/base/setup/usetup/lang/ru-RU.h +++ b/reactos/base/setup/usetup/lang/ru-RU.h @@ -1655,6 +1655,10 @@ MUI_STRING ruRUStrings[] = "â®â à §¤¥« ¡ã¤¥â ®âä®à¬ â¨à®¢ ­ ¤ «¥¥."}, {STRING_NONFORMATTEDPART, "‚ë ¢ë¡à «¨ ãáâ ­®¢ªã ReactOS ­  ­®¢ë© ­¥®âä®à¬ â¨à®¢ ­­ë© à §¤¥«."}, + {STRING_NONFORMATTEDSYSTEMPART, + "The system partition is not formatted yet."}, + {STRING_NONFORMATTEDOTHERPART, + "The new partition is not formatted yet."}, {STRING_INSTALLONPART, "ReactOS ãáâ ­ ¢«¨¢ ¥âáï ­  à §¤¥«:"}, {STRING_CHECKINGPART, diff --git a/reactos/base/setup/usetup/lang/sk-SK.h b/reactos/base/setup/usetup/lang/sk-SK.h index 45fa1c84bfc..f737c5e16c9 100644 --- a/reactos/base/setup/usetup/lang/sk-SK.h +++ b/reactos/base/setup/usetup/lang/sk-SK.h @@ -1668,6 +1668,10 @@ MUI_STRING skSKStrings[] = "T to oblasœ sa bude form tovaœ ako Ôalçia."}, {STRING_NONFORMATTEDPART, "Zvolili ste inçtal ciu syst‚mu ReactOS na nov£ alebo nenaform tovan£ oblasœ."}, + {STRING_NONFORMATTEDSYSTEMPART, + "The system partition is not formatted yet."}, + {STRING_NONFORMATTEDOTHERPART, + "The new partition is not formatted yet."}, {STRING_INSTALLONPART, "Inçtal tor nainçtaluje syst‚m ReactOS na oblasœ"}, {STRING_CHECKINGPART, diff --git a/reactos/base/setup/usetup/lang/sq-AL.h b/reactos/base/setup/usetup/lang/sq-AL.h index f6697d9f956..154a35c37cc 100644 --- a/reactos/base/setup/usetup/lang/sq-AL.h +++ b/reactos/base/setup/usetup/lang/sq-AL.h @@ -1660,6 +1660,10 @@ MUI_STRING sqALStrings[] = "Ky particion do t‰ formatohet tani."}, {STRING_NONFORMATTEDPART, "Ju zgjodh‰t ReactOS p‰r tu instaluar n‰ nj‰ particion t'ri t‰ paformatuar."}, + {STRING_NONFORMATTEDSYSTEMPART, + "The system partition is not formatted yet."}, + {STRING_NONFORMATTEDOTHERPART, + "The new partition is not formatted yet."}, {STRING_INSTALLONPART, "Instalimi i ReactOS ne Particion"}, {STRING_CHECKINGPART, diff --git a/reactos/base/setup/usetup/lang/sv-SE.h b/reactos/base/setup/usetup/lang/sv-SE.h index 8c19e785cdb..dd5533b1d74 100644 --- a/reactos/base/setup/usetup/lang/sv-SE.h +++ b/reactos/base/setup/usetup/lang/sv-SE.h @@ -1663,6 +1663,10 @@ MUI_STRING svSEStrings[] = "Denna Partition kommer att bli formaterad h„rn„st."}, {STRING_NONFORMATTEDPART, "Du valde att installera ReactOS p† en oformaterad partition."}, + {STRING_NONFORMATTEDSYSTEMPART, + "The system partition is not formatted yet."}, + {STRING_NONFORMATTEDOTHERPART, + "The new partition is not formatted yet."}, {STRING_INSTALLONPART, "Setup installerar ReactOS till Partitionen"}, {STRING_CHECKINGPART, diff --git a/reactos/base/setup/usetup/lang/tr-TR.h b/reactos/base/setup/usetup/lang/tr-TR.h index 2a2f578c587..1bb7529d629 100644 --- a/reactos/base/setup/usetup/lang/tr-TR.h +++ b/reactos/base/setup/usetup/lang/tr-TR.h @@ -1641,6 +1641,10 @@ MUI_STRING trTRStrings[] = "Bu b”lm ileride bi‡imlendirilecektir."}, {STRING_NONFORMATTEDPART, "ReactOS'u yeni ya da bi‡imlendirilmemiŸ bir b”lme kurmay se‡tiniz."}, + {STRING_NONFORMATTEDSYSTEMPART, + "The system partition is not formatted yet."}, + {STRING_NONFORMATTEDOTHERPART, + "The new partition is not formatted yet."}, {STRING_INSTALLONPART, "Kur, ReactOS'u b”lm zerine kurar."}, {STRING_CHECKINGPART, diff --git a/reactos/base/setup/usetup/lang/uk-UA.h b/reactos/base/setup/usetup/lang/uk-UA.h index 839d64b1351..91bec3913b7 100644 --- a/reactos/base/setup/usetup/lang/uk-UA.h +++ b/reactos/base/setup/usetup/lang/uk-UA.h @@ -1663,6 +1663,10 @@ MUI_STRING ukUAStrings[] = "–¥© à®§¤i« ¡ã¤¥ ¢i¤ä®à¬ â®¢ ­®."}, {STRING_NONFORMATTEDPART, "‚¨ ¢¨¡à «¨ ¢áâ ­®¢«¥­­ï ReactOS ­  ­®¢¨©  ¡® ­¥ä®à¬ â®¢ ­¨© à®§¤i«."}, + {STRING_NONFORMATTEDSYSTEMPART, + "The system partition is not formatted yet."}, + {STRING_NONFORMATTEDOTHERPART, + "The new partition is not formatted yet."}, {STRING_INSTALLONPART, "ReactOS ¢áâ ­®¢«îóâìáï ­  à®§¤i«"}, {STRING_CHECKINGPART, diff --git a/reactos/base/setup/usetup/mui.h b/reactos/base/setup/usetup/mui.h index b950a0e9d1b..22f9f3b3dd9 100644 --- a/reactos/base/setup/usetup/mui.h +++ b/reactos/base/setup/usetup/mui.h @@ -111,6 +111,8 @@ MUIGetString( #define STRING_CREATEPARTITION 7 #define STRING_PARTFORMAT 8 #define STRING_NONFORMATTEDPART 9 +#define STRING_NONFORMATTEDSYSTEMPART 62 +#define STRING_NONFORMATTEDOTHERPART 63 #define STRING_INSTALLONPART 10 #define STRING_CHECKINGPART 11 #define STRING_QUITCONTINUE 12 diff --git a/reactos/base/setup/usetup/partlist.c b/reactos/base/setup/usetup/partlist.c index 9b98c3c552d..b1242470aaa 100644 --- a/reactos/base/setup/usetup/partlist.c +++ b/reactos/base/setup/usetup/partlist.c @@ -31,7 +31,7 @@ #define NDEBUG #include -#define DUMP_PARTITION_TABLE +//#define DUMP_PARTITION_TABLE /* FUNCTIONS ****************************************************************/ @@ -47,7 +47,7 @@ DumpPartitionTable( for (i = 0; i < DiskEntry->LayoutBuffer->PartitionCount; i++) { PartitionInfo = &DiskEntry->LayoutBuffer->PartitionEntry[i]; - DPRINT("\n%lu: %12I64u %12I64u %10lu %2lu %2x %c %c\n", + DPRINT1("\n%lu: %12I64u %12I64u %10lu %2lu %2x %c %c\n", i, PartitionInfo->StartingOffset.QuadPart, PartitionInfo->PartitionLength.QuadPart, @@ -1274,6 +1274,13 @@ CreatePartitionList( List->CurrentDisk = NULL; List->CurrentPartition = NULL; + List->BootDisk = NULL; + List->BootPartition = NULL; + + List->TempDisk = NULL; + List->TempPartition = NULL; + List->FormatState = Start; + InitializeListHead(&List->DiskListHead); InitializeListHead(&List->BiosDiskListHead); @@ -2739,14 +2746,14 @@ CheckActiveBootPartition( /* Check for empty disk list */ if (IsListEmpty (&List->DiskListHead)) { - List->ActiveBootDisk = NULL; - List->ActiveBootPartition = NULL; + List->BootDisk = NULL; + List->BootPartition = NULL; return; } #if 0 - if (List->ActiveBootDisk != NULL && - List->ActiveBootPartition != NULL) + if (List->BootDisk != NULL && + List->BootPartition != NULL) { /* We already have an active boot partition */ return; @@ -2759,8 +2766,8 @@ CheckActiveBootPartition( /* Check for empty partition list */ if (IsListEmpty (&DiskEntry->PrimaryPartListHead)) { - List->ActiveBootDisk = NULL; - List->ActiveBootPartition = NULL; + List->BootDisk = NULL; + List->BootPartition = NULL; return; } @@ -2778,15 +2785,15 @@ CheckActiveBootPartition( DiskEntry->Dirty = TRUE; /* FIXME: Might be incorrect if partitions were created by Linux FDISK */ - List->ActiveBootDisk = DiskEntry; - List->ActiveBootPartition = PartEntry; + List->BootDisk = DiskEntry; + List->BootPartition = PartEntry; return; } /* Disk is not new, scan all partitions to find a bootable one */ - List->ActiveBootDisk = NULL; - List->ActiveBootPartition = NULL; + List->BootDisk = NULL; + List->BootPartition = NULL; ListEntry = DiskEntry->PrimaryPartListHead.Flink; while (ListEntry != &DiskEntry->PrimaryPartListHead) @@ -2802,8 +2809,8 @@ CheckActiveBootPartition( PartEntry->BootIndicator) { /* Yes, we found it */ - List->ActiveBootDisk = DiskEntry; - List->ActiveBootPartition = PartEntry; + List->BootDisk = DiskEntry; + List->BootPartition = PartEntry; DPRINT("Found bootable partition disk %d, drive letter %c\n", DiskEntry->DiskNumber, PartEntry->DriveLetter); @@ -3104,4 +3111,114 @@ LogicalPartitionCreationChecks( return ERROR_SUCCESS; } + +BOOL +GetNextUnformattedPartition( + IN PPARTLIST List, + OUT PDISKENTRY *pDiskEntry, + OUT PPARTENTRY *pPartEntry) +{ + PLIST_ENTRY Entry1, Entry2; + PDISKENTRY DiskEntry; + PPARTENTRY PartEntry; + + Entry1 = List->DiskListHead.Flink; + while (Entry1 != &List->DiskListHead) + { + DiskEntry = CONTAINING_RECORD(Entry1, + DISKENTRY, + ListEntry); + + Entry2 = DiskEntry->PrimaryPartListHead.Flink; + while (Entry2 != &DiskEntry->PrimaryPartListHead) + { + PartEntry = CONTAINING_RECORD(Entry2, PARTENTRY, ListEntry); + if (PartEntry->IsPartitioned && PartEntry->New) + { + *pDiskEntry = DiskEntry; + *pPartEntry = PartEntry; + return TRUE; + } + + Entry2 = Entry2->Flink; + } + + Entry2 = DiskEntry->LogicalPartListHead.Flink; + while (Entry2 != &DiskEntry->LogicalPartListHead) + { + PartEntry = CONTAINING_RECORD(Entry2, PARTENTRY, ListEntry); + if (PartEntry->IsPartitioned && PartEntry->New) + { + *pDiskEntry = DiskEntry; + *pPartEntry = PartEntry; + return TRUE; + } + + Entry2 = Entry2->Flink; + } + + Entry1 = Entry1->Flink; + } + + *pDiskEntry = NULL; + *pPartEntry = NULL; + + return FALSE; +} + + +BOOL +GetNextUncheckedPartition( + IN PPARTLIST List, + OUT PDISKENTRY *pDiskEntry, + OUT PPARTENTRY *pPartEntry) +{ + PLIST_ENTRY Entry1, Entry2; + PDISKENTRY DiskEntry; + PPARTENTRY PartEntry; + + Entry1 = List->DiskListHead.Flink; + while (Entry1 != &List->DiskListHead) + { + DiskEntry = CONTAINING_RECORD(Entry1, + DISKENTRY, + ListEntry); + + Entry2 = DiskEntry->PrimaryPartListHead.Flink; + while (Entry2 != &DiskEntry->PrimaryPartListHead) + { + PartEntry = CONTAINING_RECORD(Entry2, PARTENTRY, ListEntry); + if (PartEntry->NeedsCheck == TRUE) + { + *pDiskEntry = DiskEntry; + *pPartEntry = PartEntry; + return TRUE; + } + + Entry2 = Entry2->Flink; + } + + Entry2 = DiskEntry->LogicalPartListHead.Flink; + while (Entry2 != &DiskEntry->LogicalPartListHead) + { + PartEntry = CONTAINING_RECORD(Entry2, PARTENTRY, ListEntry); + if (PartEntry->NeedsCheck == TRUE) + { + *pDiskEntry = DiskEntry; + *pPartEntry = PartEntry; + return TRUE; + } + + Entry2 = Entry2->Flink; + } + + Entry1 = Entry1->Flink; + } + + *pDiskEntry = NULL; + *pPartEntry = NULL; + + return FALSE; +} + /* EOF */ diff --git a/reactos/base/setup/usetup/partlist.h b/reactos/base/setup/usetup/partlist.h index 63d9706391f..74ef4567b4f 100644 --- a/reactos/base/setup/usetup/partlist.h +++ b/reactos/base/setup/usetup/partlist.h @@ -37,6 +37,18 @@ typedef enum _FORMATSTATE Formatted } FORMATSTATE, *PFORMATSTATE; +typedef enum _FORMATMACHINESTATE +{ + Start, + FormatSystemPartition, + FormatInstallPartition, + FormatOtherPartition, + FormatDone, + CheckSystemPartition, + CheckInstallPartition, + CheckOtherPartition, + CheckDone +} FORMATMACHINESTATE, *PFORMATMACHINESTATE; typedef struct _PARTENTRY { @@ -70,6 +82,10 @@ typedef struct _PARTENTRY FORMATSTATE FormatState; + /* Partition must be checked */ + BOOLEAN NeedsCheck; + + struct _FILE_SYSTEM_ITEM *FileSystem; } PARTENTRY, *PPARTENTRY; @@ -141,8 +157,12 @@ typedef struct _PARTLIST PDISKENTRY CurrentDisk; PPARTENTRY CurrentPartition; - PDISKENTRY ActiveBootDisk; - PPARTENTRY ActiveBootPartition; + PDISKENTRY BootDisk; + PPARTENTRY BootPartition; + + PDISKENTRY TempDisk; + PPARTENTRY TempPartition; + FORMATMACHINESTATE FormatState; LIST_ENTRY DiskListHead; LIST_ENTRY BiosDiskListHead; @@ -263,4 +283,16 @@ ULONG LogicalPartitionCreationChecks( IN PPARTLIST List); +BOOL +GetNextUnformattedPartition( + IN PPARTLIST List, + OUT PDISKENTRY *pDiskEntry, + OUT PPARTENTRY *pPartEntry); + +BOOL +GetNextUncheckedPartition( + IN PPARTLIST List, + OUT PDISKENTRY *pDiskEntry, + OUT PPARTENTRY *pPartEntry); + /* EOF */