[USETUP]
authorEric Kohl <eric.kohl@reactos.org>
Fri, 12 Jun 2015 21:51:57 +0000 (21:51 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Fri, 12 Jun 2015 21:51:57 +0000 (21:51 +0000)
- 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

29 files changed:
reactos/base/setup/usetup/fslist.c
reactos/base/setup/usetup/fslist.h
reactos/base/setup/usetup/interface/usetup.c
reactos/base/setup/usetup/lang/bg-BG.h
reactos/base/setup/usetup/lang/bn-BD.h
reactos/base/setup/usetup/lang/cs-CZ.h
reactos/base/setup/usetup/lang/de-DE.h
reactos/base/setup/usetup/lang/el-GR.h
reactos/base/setup/usetup/lang/en-US.h
reactos/base/setup/usetup/lang/es-ES.h
reactos/base/setup/usetup/lang/et-EE.h
reactos/base/setup/usetup/lang/fr-FR.h
reactos/base/setup/usetup/lang/he-IL.h
reactos/base/setup/usetup/lang/it-IT.h
reactos/base/setup/usetup/lang/ja-JP.h
reactos/base/setup/usetup/lang/lt-LT.h
reactos/base/setup/usetup/lang/nl-NL.h
reactos/base/setup/usetup/lang/pl-PL.h
reactos/base/setup/usetup/lang/pt-BR.h
reactos/base/setup/usetup/lang/ro-RO.h
reactos/base/setup/usetup/lang/ru-RU.h
reactos/base/setup/usetup/lang/sk-SK.h
reactos/base/setup/usetup/lang/sq-AL.h
reactos/base/setup/usetup/lang/sv-SE.h
reactos/base/setup/usetup/lang/tr-TR.h
reactos/base/setup/usetup/lang/uk-UA.h
reactos/base/setup/usetup/mui.h
reactos/base/setup/usetup/partlist.c
reactos/base/setup/usetup/partlist.h

index 1aa6609..aa07cff 100644 (file)
@@ -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 */
index 6b28e29..fe48a1a 100644 (file)
@@ -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 */
index e223f5a..2f3b83f 100644 (file)
@@ -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");
index d349246..7640232 100644 (file)
@@ -1669,6 +1669,10 @@ MUI_STRING bgBGStrings[] =
     "\8f।á⮨ ä®à¬ â¨à ­¥ ­  ¤ï« ."},
     {STRING_NONFORMATTEDPART,
     "\88§¡à «¨ á⥠¤  á«®¦¨â¥ \90¥ ªâ\8e\91 ­  ­®¢ ¨«¨ ­¥à §¯à¥¤¥«¥­ ¤ï«."},
+    {STRING_NONFORMATTEDSYSTEMPART,
+    "The system partition is not formatted yet."},
+    {STRING_NONFORMATTEDOTHERPART,
+    "The new partition is not formatted yet."},
     {STRING_INSTALLONPART,
     "\91« £ ­¥ ­  \90¥ ªâ\8e\91 ¢êàåã ¤ï«"},
     {STRING_CHECKINGPART,
index 61d6dc6..c64ece3 100644 (file)
@@ -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,
index 5456c58..dbda9bd 100644 (file)
@@ -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,
index 9bc2f05..85ece1c 100644 (file)
@@ -1658,6 +1658,10 @@ MUI_STRING deDEStrings[] =
     "Diese Partition wird als n\84chstes 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,
index 200b48d..0d596b1 100644 (file)
@@ -1679,6 +1679,10 @@ MUI_STRING elGRStrings[] =
     "\80¬«æ «¦ Partition \9f\98 \9b \98£¦¨­à\9f\9cå £\9c«á."},
     {STRING_NONFORMATTEDPART,
     "\84§ ¢â¥\98«\9c ¤\98 \9c\9a¡\98«\98©«ã©\9c«\9c «¦ ReactOS ©\9c â¤\98 ¤â¦ ã £\9e \9b \98£¦¨­à£â¤¦ 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,
index 3b5d278..9e1b510 100644 (file)
@@ -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,
index 33eaf7b..9292ab2 100644 (file)
@@ -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,
index 96d829e..28c3e1d 100644 (file)
@@ -1654,6 +1654,10 @@ MUI_STRING etEEStrings[] =
     "J\84rgmisena 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,
index 09088ad..fdc6ed3 100644 (file)
@@ -1667,6 +1667,10 @@ MUI_STRING frFRStrings[] =
     "Cette Partition sera ensuite format\82e."},
     {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,
index 6265ec0..f1ed579 100644 (file)
@@ -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,
index 835a9d6..68d589f 100644 (file)
@@ -1658,6 +1658,10 @@ MUI_STRING itITStrings[] =
     "Questa partizione sar\85 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\85 ReactOS sulla partitione"},
     {STRING_CHECKINGPART,
index e70f60f..b7ae3e8 100644 (file)
@@ -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,
index db36891..c3372b3 100644 (file)
@@ -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,
index 1b1ab3e..5089c15 100644 (file)
@@ -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,
index 036ccdf..add2123 100644 (file)
@@ -1664,6 +1664,10 @@ MUI_STRING plPLStrings[] =
     "Nast©puj¥ca partycja zostanie sformatowana."},
     {STRING_NONFORMATTEDPART,
     "Mo¾esz zainstalowa\86 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,
index c292c42..f3ffa68 100644 (file)
@@ -1693,6 +1693,10 @@ MUI_STRING ptBRStrings[] =
     "Esta parti\87Æo ser  formatada logo em seguida."},
     {STRING_NONFORMATTEDPART,
     "Voc\88 solicitou instalar o ReactOS em uma parti\87Æ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\87Æo"},
     {STRING_CHECKINGPART,
index 6cac64a..2d3626f 100644 (file)
@@ -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,
index 709905b..b61d1a3 100644 (file)
@@ -1655,6 +1655,10 @@ MUI_STRING ruRUStrings[] =
     "\9dâ®â à §¤¥« ¡ã¤¥â ®âä®à¬ â¨à®¢ ­ ¤ «¥¥."},
     {STRING_NONFORMATTEDPART,
     "\82ë ¢ë¡à «¨ ãáâ ­®¢ªã ReactOS ­  ­®¢ë© ­¥®âä®à¬ â¨à®¢ ­­ë© à §¤¥«."},
+    {STRING_NONFORMATTEDSYSTEMPART,
+    "The system partition is not formatted yet."},
+    {STRING_NONFORMATTEDOTHERPART,
+    "The new partition is not formatted yet."},
     {STRING_INSTALLONPART,
     "ReactOS ãáâ ­ ¢«¨¢ ¥âáï ­  à §¤¥«:"},
     {STRING_CHECKINGPART,
index 45fa1c8..f737c5e 100644 (file)
@@ -1668,6 +1668,10 @@ MUI_STRING skSKStrings[] =
     "T to oblas\9c sa bude form tova\9c ako Ôalçia."},
     {STRING_NONFORMATTEDPART,
     "Zvolili ste inçtal ciu syst\82mu ReactOS na nov£ alebo nenaform tovan£ oblas\9c."},
+    {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\82m ReactOS na oblas\9c"},
     {STRING_CHECKINGPART,
index f6697d9..154a35c 100644 (file)
@@ -1660,6 +1660,10 @@ MUI_STRING sqALStrings[] =
     "Ky particion do t\89 formatohet tani."},
     {STRING_NONFORMATTEDPART,
     "Ju zgjodh\89t ReactOS p\89r tu instaluar n\89 nj\89 particion t'ri t\89 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,
index 8c19e78..dd5533b 100644 (file)
@@ -1663,6 +1663,10 @@ MUI_STRING svSEStrings[] =
     "Denna Partition kommer att bli formaterad h\84rn\84st."},
     {STRING_NONFORMATTEDPART,
     "Du valde att installera ReactOS p\86 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,
index 2a2f578..1bb7529 100644 (file)
@@ -1641,6 +1641,10 @@ MUI_STRING trTRStrings[] =
     "Bu b\94l\81m ileride bi\87imlendirilecektir."},
     {STRING_NONFORMATTEDPART,
     "ReactOS'u yeni ya da bi\87imlendirilmemi\9f bir b\94l\81me kurmay\8d se\87tiniz."},
+    {STRING_NONFORMATTEDSYSTEMPART,
+    "The system partition is not formatted yet."},
+    {STRING_NONFORMATTEDOTHERPART,
+    "The new partition is not formatted yet."},
     {STRING_INSTALLONPART,
     "Kur, ReactOS'u b\94l\81\81zerine kurar."},
     {STRING_CHECKINGPART,
index 839d64b..91bec39 100644 (file)
@@ -1663,6 +1663,10 @@ MUI_STRING ukUAStrings[] =
     "\96¥© à®§¤i« ¡ã¤¥ ¢i¤ä®à¬ â®¢ ­®."},
     {STRING_NONFORMATTEDPART,
     "\82¨ ¢¨¡à «¨ ¢áâ ­®¢«¥­­ï 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,
index b950a0e..22f9f3b 100644 (file)
@@ -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
index 9b98c3c..b124247 100644 (file)
@@ -31,7 +31,7 @@
 #define NDEBUG
 #include <debug.h>
 
-#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 */
index 63d9706..74ef456 100644 (file)
@@ -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 */