- if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
- (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
- {
- if (ConfirmQuit(Ir) == TRUE)
- return(QUIT_PAGE);
- break;
- }
- else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
- (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE)) /* ESC */
- {
- DestroyFileSystemList(FileSystemList);
- return(SELECT_PARTITION_PAGE);
- }
- else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
- (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
- {
- ScrollDownFileSystemList(FileSystemList);
- }
- else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
- (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
- {
- ScrollUpFileSystemList(FileSystemList);
- }
- else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN) /* ENTER */
- {
- if (FileSystemList->CurrentFileSystem == FsKeep)
- {
- return(CHECK_FILE_SYSTEM_PAGE);
- }
- else
- {
- return(FORMAT_PARTITION_PAGE);
- }
- }
- }
-}
+ if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
+ (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
+ {
+ if (ConfirmQuit (Ir) == TRUE)
+ {
+ return QUIT_PAGE;
+ }
+ break;
+ }
+ else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN) /* ENTER */
+ {
+ SetStatusText (" Please wait ...");
+
+ if (PartEntry->PartInfo[0].PartitionType == PARTITION_ENTRY_UNUSED)
+ {
+ switch (FileSystemList->CurrentFileSystem)
+ {
+ case FsFat:
+ if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (4200ULL * 1024ULL))
+ {
+ /* FAT12 CHS partition (disk is smaller than 4.1MB) */
+ PartEntry->PartInfo[0].PartitionType = PARTITION_FAT_12;
+ }
+ else if (PartEntry->PartInfo[0].StartingOffset.QuadPart < (1024ULL * 255ULL * 63ULL * 512ULL))
+ {
+ /* Partition starts below the 8.4GB boundary ==> CHS partition */
+
+ if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (32ULL * 1024ULL * 1024ULL))
+ {
+ /* FAT16 CHS partition (partiton size < 32MB) */
+ PartEntry->PartInfo[0].PartitionType = PARTITION_FAT_16;
+ }
+ else if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (512ULL * 1024ULL * 1024ULL))
+ {
+ /* FAT16 CHS partition (partition size < 512MB) */
+ PartEntry->PartInfo[0].PartitionType = PARTITION_HUGE;
+ }
+ else
+ {
+ /* FAT32 CHS partition (partition size >= 512MB) */
+ PartEntry->PartInfo[0].PartitionType = PARTITION_FAT32;
+ }
+ }
+ else
+ {
+ /* Partition starts above the 8.4GB boundary ==> LBA partition */
+
+ if (PartEntry->PartInfo[0].PartitionLength.QuadPart < (512ULL * 1024ULL * 1024ULL))
+ {
+ /* FAT16 LBA partition (partition size < 512MB) */
+ PartEntry->PartInfo[0].PartitionType = PARTITION_XINT13;
+ }
+ else
+ {
+ /* FAT32 LBA partition (partition size >= 512MB) */
+ PartEntry->PartInfo[0].PartitionType = PARTITION_FAT32_XINT13;
+ }
+ }
+ break;
+
+ case FsKeep:
+ break;
+
+ default:
+ return QUIT_PAGE;
+ }
+ }
+
+ CheckActiveBootPartition (PartitionList);
+
+//#ifndef NDEBUG
+ PrintTextXY (6, 12,
+ "Disk: %I64u Cylinder: %I64u Track: %I64u",
+ DiskEntry->DiskSize,
+ DiskEntry->CylinderSize,
+ DiskEntry->TrackSize);
+
+ Line = 13;
+ DiskEntry = PartitionList->CurrentDisk;
+ Entry = DiskEntry->PartListHead.Flink;
+ while (Entry != &DiskEntry->PartListHead)
+ {
+ PartEntry = CONTAINING_RECORD(Entry, PARTENTRY, ListEntry);
+
+ if (PartEntry->Unpartitioned == FALSE)
+ {
+
+ for (i = 0; i < 4; i++)
+ {
+ PrintTextXY (6, Line,
+ "%2u: %2u %c %12I64u %12I64u %2u %c",
+ i,
+ PartEntry->PartInfo[i].PartitionNumber,
+ PartEntry->PartInfo[i].BootIndicator ? 'A' : '-',
+ PartEntry->PartInfo[i].StartingOffset.QuadPart,
+ PartEntry->PartInfo[i].PartitionLength.QuadPart,
+ PartEntry->PartInfo[i].PartitionType,
+ PartEntry->PartInfo[i].RewritePartition ? '*' : ' ');
+
+ Line++;
+ }
+
+ Line++;
+ }
+
+ Entry = Entry->Flink;
+ }
+
+ /* Restore the old entry */
+ PartEntry = PartitionList->CurrentPartition;
+//#endif
+
+ if (WritePartitionsToDisk (PartitionList) == FALSE)
+ {
+ DPRINT ("WritePartitionsToDisk() failed\n");
+
+ PopupError ("Setup failed to write partition tables.\n",
+ "ENTER = Reboot computer");
+
+ while (TRUE)
+ {
+ ConInKey (Ir);
+
+ if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
+ {
+ return QUIT_PAGE;
+ }
+ }
+ }
+
+
+ /* Set DestinationRootPath */
+ RtlFreeUnicodeString (&DestinationRootPath);
+ swprintf (PathBuffer,
+ L"\\Device\\Harddisk%lu\\Partition%lu",
+ PartitionList->CurrentDisk->DiskNumber,
+ PartitionList->CurrentPartition->PartInfo[0].PartitionNumber);
+ RtlCreateUnicodeString (&DestinationRootPath,
+ PathBuffer);
+ DPRINT ("DestinationRootPath: %wZ\n", &DestinationRootPath);