ULONGLONG DiskSize;
ULONGLONG SectorCount;
PCHAR Unit;
- NTSTATUS Status;
if (PartitionList == NULL ||
PartitionList->CurrentDisk == NULL ||
SectorCount,
FALSE);
- Status = WriteDirtyPartitions(PartitionList);
- if (!NT_SUCCESS(Status))
- {
- DPRINT("WriteDirtyPartitions() failed\n");
- MUIDisplayError(ERROR_WRITE_PTABLE, Ir, POPUP_WAIT_ENTER);
- return QUIT_PAGE;
- }
-
return SELECT_FILE_SYSTEM_PAGE;
}
}
ULONGLONG DiskSize;
ULONGLONG SectorCount;
PCHAR Unit;
- NTSTATUS Status;
if (PartitionList == NULL ||
PartitionList->CurrentDisk == NULL ||
CreateLogicalPartition(PartitionList,
SectorCount);
- Status = WriteDirtyPartitions(PartitionList);
- if (!NT_SUCCESS(Status))
- {
- DPRINT("WriteDirtyPartitions() failed\n");
- MUIDisplayError(ERROR_WRITE_PTABLE, Ir, POPUP_WAIT_ENTER);
- return QUIT_PAGE;
- }
-
return SELECT_FILE_SYSTEM_PAGE;
}
}
}
+static
+VOID
+UpdatePartitionType(
+ PPARTENTRY PartEntry,
+ LPCWSTR FileSystem)
+{
+ if (wcscmp(FileSystem, L"FAT") == 0)
+ {
+ if (PartEntry->SectorCount.QuadPart < 8192)
+ {
+ /* FAT12 CHS partition (disk is smaller than 4.1MB) */
+ PartEntry->PartitionType = PARTITION_FAT_12;
+ }
+ else if (PartEntry->StartSector.QuadPart < 1450560)
+ {
+ /* Partition starts below the 8.4GB boundary ==> CHS partition */
+
+ if (PartEntry->SectorCount.QuadPart < 65536)
+ {
+ /* FAT16 CHS partition (partiton size < 32MB) */
+ PartEntry->PartitionType = PARTITION_FAT_16;
+ }
+ else if (PartEntry->SectorCount.QuadPart < 1048576)
+ {
+ /* FAT16 CHS partition (partition size < 512MB) */
+ PartEntry->PartitionType = PARTITION_HUGE;
+ }
+ else
+ {
+ /* FAT32 CHS partition (partition size >= 512MB) */
+ PartEntry->PartitionType = PARTITION_FAT32;
+ }
+ }
+ else
+ {
+ /* Partition starts above the 8.4GB boundary ==> LBA partition */
+
+ if (PartEntry->SectorCount.QuadPart < 1048576)
+ {
+ /* FAT16 LBA partition (partition size < 512MB) */
+ PartEntry->PartitionType = PARTITION_XINT13;
+ }
+ else
+ {
+ /* FAT32 LBA partition (partition size >= 512MB) */
+ PartEntry->PartitionType = PARTITION_FAT32_XINT13;
+ }
+ }
+
+ PartEntry->DiskEntry->LayoutBuffer->PartitionEntry[PartEntry->PartitionIndex].PartitionType = PartEntry->PartitionType;
+ }
+#if 0
+ else if (wcscmp(FileSystemList->Selected->FileSystem, L"EXT2") == 0)
+ {
+ PartEntry->PartitionType = PARTITION_EXT2;
+ PartEntry->DiskEntry->LayoutBuffer->PartitionEntry[PartEntry->PartitionIndex].PartitionType = PartEntry->PartitionType;
+ }
+#endif
+}
+
+
static PAGE_NUMBER
SelectFileSystemPage(PINPUT_RECORD Ir)
{
PCHAR DiskUnit;
PCHAR PartUnit;
PCHAR PartType;
+ NTSTATUS Status;
if (PartitionList == NULL ||
PartitionList->CurrentDisk == NULL ||
{
if (UnattendFormatPartition)
{
+ UpdatePartitionType(PartEntry,
+ FileSystemList->Selected->FileSystem);
+
+ Status = WriteDirtyPartitions(PartitionList);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("WriteDirtyPartitions() failed (Status 0x%08lx)\n", Status);
+ MUIDisplayError(ERROR_WRITE_PTABLE, Ir, POPUP_WAIT_ENTER);
+ return QUIT_PAGE;
+ }
+
return FORMAT_PARTITION_PAGE;
}
}
else
{
+ UpdatePartitionType(PartEntry,
+ FileSystemList->Selected->FileSystem);
+
+ CheckActiveBootPartition(PartitionList);
+
+ Status = WriteDirtyPartitions(PartitionList);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT("WriteDirtyPartitions() failed (Status 0x%08lx)\n", Status);
+ MUIDisplayError(ERROR_WRITE_PTABLE, Ir, POPUP_WAIT_ENTER);
+ return QUIT_PAGE;
+ }
+
return FORMAT_PARTITION_PAGE;
}
}
FormatPartitionPage(PINPUT_RECORD Ir)
{
WCHAR PathBuffer[MAX_PATH];
- PDISKENTRY DiskEntry;
+// PDISKENTRY DiskEntry;
PPARTENTRY PartEntry;
NTSTATUS Status;
return QUIT_PAGE;
}
- DiskEntry = PartitionList->CurrentDisk;
+// DiskEntry = PartitionList->CurrentDisk;
PartEntry = PartitionList->CurrentPartition;
while (TRUE)
{
CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT));
- if (wcscmp(FileSystemList->Selected->FileSystem, L"FAT") == 0)
- {
- if (PartEntry->SectorCount.QuadPart < 8192)
- {
- /* FAT12 CHS partition (disk is smaller than 4.1MB) */
- PartEntry->PartitionType = PARTITION_FAT_12;
- }
- else if (PartEntry->StartSector.QuadPart < 1450560)
- {
- /* Partition starts below the 8.4GB boundary ==> CHS partition */
-
- if (PartEntry->SectorCount.QuadPart < 65536)
- {
- /* FAT16 CHS partition (partiton size < 32MB) */
- PartEntry->PartitionType = PARTITION_FAT_16;
- }
- else if (PartEntry->SectorCount.QuadPart < 1048576)
- {
- /* FAT16 CHS partition (partition size < 512MB) */
- PartEntry->PartitionType = PARTITION_HUGE;
- }
- else
- {
- /* FAT32 CHS partition (partition size >= 512MB) */
- PartEntry->PartitionType = PARTITION_FAT32;
- }
- }
- else
- {
- /* Partition starts above the 8.4GB boundary ==> LBA partition */
-
- if (PartEntry->SectorCount.QuadPart < 1048576)
- {
- /* FAT16 LBA partition (partition size < 512MB) */
- PartEntry->PartitionType = PARTITION_XINT13;
- }
- else
- {
- /* FAT32 LBA partition (partition size >= 512MB) */
- PartEntry->PartitionType = PARTITION_FAT32_XINT13;
- }
- }
-
- DiskEntry->LayoutBuffer->PartitionEntry[PartEntry->PartitionIndex].PartitionType = PartEntry->PartitionType;
- }
-#if 0
- else if (wcscmp(FileSystemList->Selected->FileSystem, L"EXT2") == 0)
- {
- PartEntry->PartitionType = PARTITION_EXT2;
- DiskEntry->LayoutBuffer->PartitionEntry[PartEntry->PartitionIndex].PartitionType = PartEntry->PartitionType;
- }
-#endif
- else if (!FileSystemList->Selected->FormatFunc)
+ if (!FileSystemList->Selected->FormatFunc)
return QUIT_PAGE;
#ifndef NDEBUG
PartEntry = PartitionList->CurrentPartition;
#endif
- CheckActiveBootPartition(PartitionList);
-
- Status = WriteDirtyPartitions(PartitionList);
- if (!NT_SUCCESS(Status))
- {
- DPRINT("WriteDirtyPartitions() failed\n");
- MUIDisplayError(ERROR_WRITE_PTABLE, Ir, POPUP_WAIT_ENTER);
- return QUIT_PAGE;
- }
-
/* Set DestinationRootPath */
RtlFreeUnicodeString(&DestinationRootPath);
swprintf(PathBuffer,