Add the create logical partition page.
svn path=/trunk/; revision=63574
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;
}
// "\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,
// "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,
"nutzbaren Setups.",
TEXT_STYLE_NORMAL
},
- {
+ {
6,
14,
"Die Reparaturfunktionen sind noch nicht implementiert.",
"Benutzen Sie die Entf-TASTE, um Zeichen zu l\94schen.",
TEXT_STYLE_NORMAL
},
- {
+ {
6,
17,
"Best\84tigen Sie die Eingabe mit der EINGABETASTE.",
{
//ERROR_UPDATE_DISPLAY_SETTINGS,
"Die Registrierungseintr\84ge der Anzeigeeinstellungen\n"
- "konnten nicht aktualisiert werden.",
+ "konnten nicht aktualisiert werden.",
"EINGABETASTER = Computer neu starten"
},
{
{
//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"
},
{
"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,
// "\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,
"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,
// "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,
// "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,
"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,
"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,
// "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,
// "±À×¼² Ê߰輮ݦ ·ÞÆ »¸¾²½Ù ºÄ¶Þ ¾ÝÀ¸ »ÚϼÀ:"},
{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,
"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,
// "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,
// "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,
// "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,
// "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,
// "\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,
// "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,
"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,
// "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,
// "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,
// "\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,
#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
}
+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)
PPARTLIST List,
ULONGLONG PartitionSize);
+VOID
+CreateLogicalPartition(
+ PPARTLIST List,
+ ULONGLONG PartitionSize);
+
VOID
DeleteCurrentPartition(
PPARTLIST List);