[USETUP]
authorEric Kohl <eric.kohl@reactos.org>
Mon, 9 Jun 2014 01:49:24 +0000 (01:49 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Mon, 9 Jun 2014 01:49:24 +0000 (01:49 +0000)
Add the create logical partition page.

svn path=/trunk/; revision=63574

26 files changed:
reactos/base/setup/usetup/interface/usetup.c
reactos/base/setup/usetup/lang/bg-BG.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 800046a..502e6cf 100644 (file)
@@ -2131,8 +2131,146 @@ CreateExtendedPartitionPage(PINPUT_RECORD Ir)
 static PAGE_NUMBER
 CreateLogicalPartitionPage(PINPUT_RECORD Ir)
 {
+    PDISKENTRY DiskEntry;
+    PPARTENTRY PartEntry;
+    BOOLEAN Quit;
+    BOOLEAN Cancel;
+    CHAR InputBuffer[50];
+    ULONG MaxSize;
+    ULONGLONG PartSize;
+    ULONGLONG DiskSize;
+    ULONGLONG SectorCount;
+    PCHAR Unit;
 
-    return SELECT_PARTITION_PAGE;
+    if (PartitionList == NULL ||
+        PartitionList->CurrentDisk == NULL ||
+        PartitionList->CurrentPartition == NULL)
+    {
+        /* FIXME: show an error dialog */
+        return QUIT_PAGE;
+    }
+
+    DiskEntry = PartitionList->CurrentDisk;
+    PartEntry = PartitionList->CurrentPartition;
+
+    CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT));
+
+    CONSOLE_SetTextXY(6, 8, MUIGetString(STRING_CHOOSE_NEW_LOGICAL_PARTITION));
+
+    DiskSize = DiskEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector;
+#if 0
+    if (DiskSize >= 10737418240) /* 10 GB */
+    {
+        DiskSize = DiskSize / 1073741824;
+        Unit = MUIGetString(STRING_GB);
+    }
+    else
+#endif
+    {
+        DiskSize = DiskSize / 1048576;
+        if (DiskSize == 0)
+            DiskSize = 1;
+
+        Unit = MUIGetString(STRING_MB);
+    }
+
+    if (DiskEntry->DriverName.Length > 0)
+    {
+        CONSOLE_PrintTextXY(6, 10,
+                            MUIGetString(STRING_HDINFOPARTCREATE),
+                            DiskSize,
+                            Unit,
+                            DiskEntry->DiskNumber,
+                            DiskEntry->Port,
+                            DiskEntry->Bus,
+                            DiskEntry->Id,
+                            &DiskEntry->DriverName);
+    }
+    else
+    {
+        CONSOLE_PrintTextXY(6, 10,
+                            MUIGetString(STRING_HDDINFOUNK1),
+                            DiskSize,
+                            Unit,
+                            DiskEntry->DiskNumber,
+                            DiskEntry->Port,
+                            DiskEntry->Bus,
+                            DiskEntry->Id);
+    }
+
+    CONSOLE_SetTextXY(6, 12, MUIGetString(STRING_HDDSIZE));
+
+#if 0
+    CONSOLE_PrintTextXY(8, 10, "Maximum size of the new partition is %I64u MB",
+                        PartitionList->CurrentPartition->SectorCount * DiskEntry->BytesPerSector / 1048576);
+#endif
+
+    CONSOLE_SetStatusText(MUIGetString(STRING_CREATEPARTITION));
+
+    PartEntry = PartitionList->CurrentPartition;
+    while (TRUE)
+    {
+        MaxSize = (PartEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector) / 1048576;  /* in MBytes (rounded) */
+
+        if (MaxSize > PARTITION_MAXSIZE)
+            MaxSize = PARTITION_MAXSIZE;
+
+        ShowPartitionSizeInputBox(12, 14, xScreen - 12, 17, /* left, top, right, bottom */
+                                  MaxSize, InputBuffer, &Quit, &Cancel);
+
+        if (Quit == TRUE)
+        {
+            if (ConfirmQuit (Ir) == TRUE)
+            {
+                return QUIT_PAGE;
+            }
+        }
+        else if (Cancel == TRUE)
+        {
+            return SELECT_PARTITION_PAGE;
+        }
+        else
+        {
+            PartSize = atoi(InputBuffer);
+
+            if (PartSize < 1)
+            {
+                /* Too small */
+                continue;
+            }
+
+            if (PartSize > MaxSize)
+            {
+                /* Too large */
+                continue;
+            }
+
+            /* Convert to bytes */
+            if (PartSize == MaxSize)
+            {
+                /* Use all of the unpartitioned disk space */
+                SectorCount = PartEntry->SectorCount.QuadPart;
+            }
+            else
+            {
+                /* Calculate the sector count from the size in MB */
+                SectorCount = PartSize * 1048576 / DiskEntry->BytesPerSector;
+
+                /* But never get larger than the unpartitioned disk space */
+                if (SectorCount > PartEntry->SectorCount.QuadPart)
+                    SectorCount = PartEntry->SectorCount.QuadPart;
+            }
+
+            DPRINT("Partition size: %I64u bytes\n", PartSize);
+
+            CreateLogicalPartition(PartitionList,
+                                   SectorCount);
+
+            return SELECT_PARTITION_PAGE;
+        }
+    }
+
+    return CREATE_LOGICAL_PARTITION_PAGE;
 }
 
 
index d68f602..80aaaa8 100644 (file)
@@ -1664,6 +1664,8 @@ MUI_STRING bgBGStrings[] =
 //     "\88§¡à «¨ á⥠¤  áꧤ ¤¥â¥ ­®¢ ¤ï« ­ "},
     {STRING_CHOOSE_NEW_EXTENDED_PARTITION,
      "You have chosen to create an extended partition on"},
+    {STRING_CHOOSE_NEW_LOGICAL_PARTITION,
+     "You have chosen to create a logical partition on"},
     {STRING_HDDSIZE,
     "\82ꢥ¤¥â¥ à §¬¥à  ­  ­®¢¨ï ¤ï« (¢ ¬¥£ ¡ ©â¨)."},
     {STRING_CREATEPARTITION,
index 8440fc2..9e8071e 100644 (file)
@@ -1660,6 +1660,8 @@ MUI_STRING csCZStrings[] =
 //     "Zvolili jste vytvoýen¡ nov\82ho odd¡lu na"},
     {STRING_CHOOSE_NEW_EXTENDED_PARTITION,
      "You have chosen to create an extended partition on"},
+    {STRING_CHOOSE_NEW_LOGICAL_PARTITION,
+     "You have chosen to create a logical partition on"},
     {STRING_HDDSIZE,
     "Zadejte velikost nov\82ho odd¡lu v megabajtech."},
     {STRING_CREATEPARTITION,
index e85dfb9..ab58aae 100644 (file)
@@ -466,7 +466,7 @@ static MUI_ENTRY deDERepairPageEntries[] =
         "nutzbaren Setups.",
         TEXT_STYLE_NORMAL
     },
-           {
+    {
         6,
         14,
         "Die Reparaturfunktionen sind noch nicht implementiert.",
@@ -915,7 +915,7 @@ static MUI_ENTRY deDEInstallDirectoryEntries[] =
         "Benutzen Sie die Entf-TASTE, um Zeichen zu l\94schen.",
         TEXT_STYLE_NORMAL
     },
-       {
+    {
         6,
         17,
         "Best\84tigen Sie die Eingabe mit der EINGABETASTE.",
@@ -1398,7 +1398,7 @@ MUI_ERROR deDEErrorEntries[] =
     {
         //ERROR_UPDATE_DISPLAY_SETTINGS,
         "Die Registrierungseintr\84ge der Anzeigeeinstellungen\n"
-               "konnten nicht aktualisiert werden.",
+        "konnten nicht aktualisiert werden.",
         "EINGABETASTER = Computer neu starten"
     },
     {
@@ -1439,7 +1439,7 @@ MUI_ERROR deDEErrorEntries[] =
     {
         //ERROR_COPY_QUEUE,
         "Die Liste mit den zu kopierenden Dateien\n"
-               "konnte nicht gefunden werden.\n",
+        "konnte nicht gefunden werden.\n",
         "EINGABETASTE = Computer neu starten"
     },
     {
@@ -1654,6 +1654,8 @@ MUI_STRING deDEStrings[] =
      "Eine prim\84re Partition soll hier erstellt werden:"},
     {STRING_CHOOSE_NEW_EXTENDED_PARTITION,
      "Eine erweiterte Partition soll hier erstellt werden:"},
+    {STRING_CHOOSE_NEW_LOGICAL_PARTITION,
+     "Ein logisches Laufwerk soll hier erstellt werden:"},
     {STRING_HDDSIZE,
     "Bitte geben Sie die Gr\94áe der neuen Partition in Megabyte ein."},
     {STRING_CREATEPARTITION,
index d12bb69..82d83d4 100644 (file)
@@ -1676,6 +1676,8 @@ MUI_STRING elGRStrings[] =
 //     "\84§ ¢â¥\98«\9c ¤\98 \9b\9e£ ¦¬¨\9aã©\9c«\9c â¤\98 ¤â¦ partition on"},
     {STRING_CHOOSE_NEW_EXTENDED_PARTITION,
      "You have chosen to create an extended partition on"},
+    {STRING_CHOOSE_NEW_LOGICAL_PARTITION,
+     "You have chosen to create a logical partition on"},
     {STRING_HDDSIZE,
     "\8f\98¨\98¡\98¢é \9bé©«\9c «¦ £â\9a\9c\9f¦ª «¦¬ partition ©\9c megabytes."},
     {STRING_CREATEPARTITION,
index 6b20c08..7f752f3 100644 (file)
@@ -1648,6 +1648,8 @@ MUI_STRING enUSStrings[] =
      "You have chosen to create a primary partition on"},
     {STRING_CHOOSE_NEW_EXTENDED_PARTITION,
      "You have chosen to create an extended partition on"},
+    {STRING_CHOOSE_NEW_LOGICAL_PARTITION,
+     "You have chosen to create a logical partition on"},
     {STRING_HDDSIZE,
     "Please enter the size of the new partition in megabytes."},
     {STRING_CREATEPARTITION,
index 04a53da..d8bad41 100644 (file)
@@ -1658,6 +1658,8 @@ MUI_STRING esESStrings[] =
 //     "Ha elegido crear una nueva partici¢n en"},
     {STRING_CHOOSE_NEW_EXTENDED_PARTITION,
      "You have chosen to create an extended partition on"},
+    {STRING_CHOOSE_NEW_LOGICAL_PARTITION,
+     "You have chosen to create a logical partition on"},
     {STRING_HDDSIZE,
     "Por favor, introduzca el tama¤o de la nueva partici¢n en megabytes."},
     {STRING_CREATEPARTITION,
index 71fdece..e90023d 100644 (file)
@@ -1649,6 +1649,8 @@ MUI_STRING etEEStrings[] =
 //     "Oled valinud kettale uue partitsiooni loomise"},
     {STRING_CHOOSE_NEW_EXTENDED_PARTITION,
      "You have chosen to create an extended partition on"},
+    {STRING_CHOOSE_NEW_LOGICAL_PARTITION,
+     "You have chosen to create a logical partition on"},
     {STRING_HDDSIZE,
     "Sisesta uue partitsiooni suurus megabaitides."},
     {STRING_CREATEPARTITION,
index 84ce39a..c4dac54 100644 (file)
@@ -1662,6 +1662,8 @@ MUI_STRING frFRStrings[] =
      "Vous avez choisi de cr\82er une partition primaire sur"},
     {STRING_CHOOSE_NEW_EXTENDED_PARTITION,
      "Vous avez choisi de cr\82er une partition \82tendue sur"},
+    {STRING_CHOOSE_NEW_LOGICAL_PARTITION,
+     "You have chosen to create a logical partition on"},
     {STRING_HDDSIZE,
     "Veuillez entrer la taille de la nouvelle partition en m\82gaoctets."},
     {STRING_CREATEPARTITION,
index 5b415a6..b4a3945 100644 (file)
@@ -1650,6 +1650,8 @@ MUI_STRING heILStrings[] =
      "You have chosen to create a primary partition on"},
     {STRING_CHOOSE_NEW_EXTENDED_PARTITION,
      "You have chosen to create an extended partition on"},
+    {STRING_CHOOSE_NEW_LOGICAL_PARTITION,
+     "You have chosen to create a logical partition on"},
     {STRING_HDDSIZE,
     "Please enter the size of the new partition in megabytes."},
     {STRING_CREATEPARTITION,
index 936f3b4..e911a74 100644 (file)
@@ -1653,6 +1653,8 @@ MUI_STRING itITStrings[] =
 //     "Avete scelto di creare una nuova partizione su"},
     {STRING_CHOOSE_NEW_EXTENDED_PARTITION,
      "You have chosen to create an extended partition on"},
+    {STRING_CHOOSE_NEW_LOGICAL_PARTITION,
+     "You have chosen to create a logical partition on"},
     {STRING_HDDSIZE,
     "Indicare la dimensione della nuova partizione in megabyte."},
     {STRING_CREATEPARTITION,
index b70ecc9..6914066 100644 (file)
@@ -1652,6 +1652,8 @@ MUI_STRING jaJPStrings[] =
 //     "±À×¼² Ê߰輮ݦ Â·ÞÆ »¸¾²½Ù ºÄ¶Þ ¾ÝÀ¸ »ÚϼÀ:"},
     {STRING_CHOOSE_NEW_EXTENDED_PARTITION,
      "You have chosen to create an extended partition on"},
+    {STRING_CHOOSE_NEW_LOGICAL_PARTITION,
+     "You have chosen to create a logical partition on"},
     {STRING_HDDSIZE,
     "±À×¼² Ê߰è¼®ÝÉ »²½Þ¦ Ò¶ÞÊ޲ĠÀݲÃÞ Æ­³Ø®¸ ¼Ã¸ÀÞ»²¡"},
     {STRING_CREATEPARTITION,
index fbb759e..7a7b4f7 100644 (file)
@@ -1659,6 +1659,8 @@ MUI_STRING ltLTStrings[] =
      "You have chosen to create a primary partition on"},
     {STRING_CHOOSE_NEW_EXTENDED_PARTITION,
      "You have chosen to create an extended partition on"},
+    {STRING_CHOOSE_NEW_LOGICAL_PARTITION,
+     "You have chosen to create a logical partition on"},
     {STRING_HDDSIZE,
     "Please enter the size of the new partition in megabytes."},
     {STRING_CREATEPARTITION,
index dac2f56..167e109 100644 (file)
@@ -1697,6 +1697,8 @@ MUI_STRING nlNLStrings[] =
 //     "U wilt een nieuwe partitie aanmaken op"},
     {STRING_CHOOSE_NEW_EXTENDED_PARTITION,
      "You have chosen to create an extended partition on"},
+    {STRING_CHOOSE_NEW_LOGICAL_PARTITION,
+     "You have chosen to create a logical partition on"},
     {STRING_HDDSIZE,
     "Voert u de grootte van de nieuwe partitie in in megabytes."},
     {STRING_CREATEPARTITION,
index a9e8c72..3d700c4 100644 (file)
@@ -1661,6 +1661,8 @@ MUI_STRING plPLStrings[] =
 //     "Wybrane: utworzenie nowej partycji na"},
     {STRING_CHOOSE_NEW_EXTENDED_PARTITION,
      "You have chosen to create an extended partition on"},
+    {STRING_CHOOSE_NEW_LOGICAL_PARTITION,
+     "You have chosen to create a logical partition on"},
     {STRING_HDDSIZE,
     "Prosz© wprowadzi\86 rozmiar nowej partycji w megabajtach."},
     {STRING_CREATEPARTITION,
index fc8ef34..19ad671 100644 (file)
@@ -1688,6 +1688,8 @@ MUI_STRING ptBRStrings[] =
 //    "Voc\88 solicitou a cria\87Æo de uma nova parti\87Æo em"},
     {STRING_CHOOSE_NEW_EXTENDED_PARTITION,
      "You have chosen to create an extended partition on"},
+    {STRING_CHOOSE_NEW_LOGICAL_PARTITION,
+     "You have chosen to create a logical partition on"},
     {STRING_HDDSIZE,
     "Por favor, insira o tamanho da nova parti\87Æo em megabytes (MB)."},
     {STRING_CREATEPARTITION,
index d6b9425..fce9d70 100644 (file)
@@ -1729,6 +1729,8 @@ MUI_STRING roROStrings[] =
 //     "Aîi ales crearea unei noi partiîii pe"},
     {STRING_CHOOSE_NEW_EXTENDED_PARTITION,
      "You have chosen to create an extended partition on"},
+    {STRING_CHOOSE_NEW_LOGICAL_PARTITION,
+     "You have chosen to create a logical partition on"},
     {STRING_HDDSIZE,
     "Introduceîi mÇrimea noii partiîii \8cn megaocteîi."},
     {STRING_CREATEPARTITION,
index 852c263..d838503 100644 (file)
@@ -1653,6 +1653,8 @@ MUI_STRING ruRUStrings[] =
 //     "\82ë å®â¨â¥ á®§¤ âì ­®¢ë© à §¤¥« ­ "},
     {STRING_CHOOSE_NEW_EXTENDED_PARTITION,
      "You have chosen to create an extended partition on"},
+    {STRING_CHOOSE_NEW_LOGICAL_PARTITION,
+     "You have chosen to create a logical partition on"},
     {STRING_HDDSIZE,
     "\8f®¦ «ã©áâ , ¢¢¥¤¨â¥ à §¬¥à ­®¢®£® à §¤¥«  ¢ ¬¥£ ¡ ©â å."},
     {STRING_CREATEPARTITION,
index 74e2ee3..1373b27 100644 (file)
@@ -1663,6 +1663,8 @@ MUI_STRING skSKStrings[] =
 //     "Zvolili ste vytvorenie novej oblasti na"},
     {STRING_CHOOSE_NEW_EXTENDED_PARTITION,
      "You have chosen to create an extended partition on"},
+    {STRING_CHOOSE_NEW_LOGICAL_PARTITION,
+     "You have chosen to create a logical partition on"},
     {STRING_HDDSIZE,
     "Zadajte, pros¡m, ve\96kos\9c novej oblasti v megabajtoch."},
     {STRING_CREATEPARTITION,
index f23fc7c..906fd89 100644 (file)
@@ -1655,6 +1655,8 @@ MUI_STRING sqALStrings[] =
      "Ju keni zgjedhur p\89r t\89 krijuar nj\89 ndarje t\89 re n\89"},
     {STRING_CHOOSE_NEW_EXTENDED_PARTITION,
      "You have chosen to create an extended partition on"},
+    {STRING_CHOOSE_NEW_LOGICAL_PARTITION,
+     "You have chosen to create a logical partition on"},
     {STRING_HDDSIZE,
     "Ju lutem, jepini madh\89sin\89 e particionit t\89 ri n\89 megabajt."},
     {STRING_CREATEPARTITION,
index 3ee1326..c9101b6 100644 (file)
@@ -1658,6 +1658,8 @@ MUI_STRING svSEStrings[] =
 //     "Du har valt att skapa en ny partiton p\86"},
     {STRING_CHOOSE_NEW_EXTENDED_PARTITION,
      "You have chosen to create an extended partition on"},
+    {STRING_CHOOSE_NEW_LOGICAL_PARTITION,
+     "You have chosen to create a logical partition on"},
     {STRING_HDDSIZE,
     "V\84nligen skriv in storleken av den nya partitionen i megabytes."},
     {STRING_CREATEPARTITION,
index d805879..47b4d81 100644 (file)
@@ -1626,6 +1626,8 @@ MUI_STRING trTRStrings[] =
 //    "Yeni bir b\94l\81m olu\9fturmay\8d se\87tiniz."},
     {STRING_CHOOSE_NEW_EXTENDED_PARTITION,
      "You have chosen to create an extended partition on"},
+    {STRING_CHOOSE_NEW_LOGICAL_PARTITION,
+     "You have chosen to create a logical partition on"},
     {STRING_HDDSIZE,
     "Olu\9fturulacak b\94l\81m\81n b\81y\81kl\81§\81n\81 mega\87oklu olarak giriniz."},
     {STRING_CREATEPARTITION,
index 2d538b7..aa723b0 100644 (file)
@@ -1658,6 +1658,8 @@ MUI_STRING ukUAStrings[] =
 //     "\82¨ å®ç¥â¥ á⢮à¨â¨ ­®¢¨© à®§¤i« ­ "},
     {STRING_CHOOSE_NEW_EXTENDED_PARTITION,
      "You have chosen to create an extended partition on"},
+    {STRING_CHOOSE_NEW_LOGICAL_PARTITION,
+     "You have chosen to create a logical partition on"},
     {STRING_HDDSIZE,
     "\81ã¤ì-« áª , ¢¢¥¤iâì à®§¬ià ­®¢®£® à®§¤i«ã ¢ ¬¥£ ¡ ©â å."},
     {STRING_CREATEPARTITION,
index f36317c..d8b0f1b 100644 (file)
@@ -105,6 +105,7 @@ MUIGetString(
 #define STRING_PARTITIONSIZE             4
 #define STRING_CHOOSENEWPARTITION        5
 #define STRING_CHOOSE_NEW_EXTENDED_PARTITION  57
+#define STRING_CHOOSE_NEW_LOGICAL_PARTITION   61
 #define STRING_HDDSIZE                   6
 #define STRING_CREATEPARTITION           7
 #define STRING_PARTFORMAT                8
index d48a1bf..fd6c613 100644 (file)
@@ -2577,6 +2577,32 @@ DPRINT1("Total Sectors: %I64u\n", NewPartEntry->SectorCount.QuadPart);
 }
 
 
+VOID
+CreateLogicalPartition(
+    PPARTLIST List,
+    ULONGLONG SectorCount)
+{
+//    PDISKENTRY DiskEntry;
+    PPARTENTRY PartEntry;
+//    PPARTENTRY NewPartEntry;
+
+    DPRINT1("CreateLogicalPartition(%I64u)\n", SectorCount);
+
+    if (List == NULL ||
+        List->CurrentDisk == NULL ||
+        List->CurrentPartition == NULL ||
+        List->CurrentPartition->IsPartitioned == TRUE)
+    {
+        return;
+    }
+
+//    DiskEntry = List->CurrentDisk;
+    PartEntry = List->CurrentPartition;
+
+    DPRINT1("Current partition sector count: %I64u\n", PartEntry->SectorCount.QuadPart);
+}
+
+
 VOID
 DeleteCurrentPartition(
     PPARTLIST List)
index ad4765a..a4e5871 100644 (file)
@@ -230,6 +230,11 @@ CreateExtendedPartition(
     PPARTLIST List,
     ULONGLONG PartitionSize);
 
+VOID
+CreateLogicalPartition(
+    PPARTLIST List,
+    ULONGLONG PartitionSize);
+
 VOID
 DeleteCurrentPartition(
     PPARTLIST List);