From e0bc2e5ffd807ca790496e70976ad432922647b7 Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Thu, 20 Feb 2020 11:56:15 +0000 Subject: [PATCH] [core] fix reporting of unpartitioned drives * Also add an extra note to the protective GPT MBR --- ChangeLog.txt | 15 ++++++++------- res/mbr/msg.txt | 7 ++++--- src/drive.c | 21 ++++++++++++++------- src/rufus.rc | 10 +++++----- 4 files changed, 31 insertions(+), 22 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index a3ee1d0c..96788440 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,14 +1,15 @@ o Version 3.9 (2020.02.??) + Add exFAT support when creating blank UEFI:NTFS drives [EXPERIMENTAL] Fix ext2/ext3 corruption for partitions larger than 4 GB - Improve ex2/ext3 formatting speed - Add exFAT support for bare UEFI:NTFS partitions [EXPERIMENTAL] - Keep early boot files uncompressed on compressed NTFS partitions - Improve reporting of GPT partition types - Improve reporting of Windows version - Improve error reporting on Syslinux/GRUB download issues - Report the usage of UDF symbolic links + Fix early boot files not being usable on compressed NTFS partitions Fix writing of compressed streams that don't end on sector boundary Fix percent not being displayed on slow format + Improve file preallocation and speed up ISO extraction (courtesy of Mattiwatti) + Improve ex2/ext3 formatting speed + Improve protective MBR message for GPT partitioned drives + Improve reporting on Syslinux/GRUB download errors + Improve reporting of partition types and of Windows' version + Report the usage of UDF symbolic links Update embedded Syslinux to 6.04-pre1 o Version 3.8 (2019.09.16) [BUGFIX RELEASE] diff --git a/res/mbr/msg.txt b/res/mbr/msg.txt index 1f912c5e..1a2bbee8 100644 --- a/res/mbr/msg.txt +++ b/res/mbr/msg.txt @@ -1,11 +1,9 @@ -\07 - \70 ษออออออออออออออออออออออออออออออออออออออออออออออออป \07 +\07 \70 ษออออออออออออออออออออออออออออออออออออออออออออออออป \07 \70 บ บ \07 \70 บ \74ERROR: BIOS/LEGACY BOOT OF UEFI-ONLY MEDIA\70 บ \07 \70 บ บ \07 \70 ศออออออออออออออออออออออออออออออออออออออออออออออออผ \07 - This drive was created by Rufus [\09https://rufus.ie\07]. It can boot in \04UEFI mode only\07 but you are trying to @@ -19,3 +17,6 @@ * \09Target system\07 -> \09BIOS (...)\07 o \02OR\07 Erase the whole drive in Rufus by selecting: * \09Boot Type\07 -> \09Non bootable\07 + + Note: You may also see this message if you installed a new + OS and your computer is unable to boot that OS in UEFI mode. \ No newline at end of file diff --git a/src/drive.c b/src/drive.c index f1d58547..15190527 100644 --- a/src/drive.c +++ b/src/drive.c @@ -1183,7 +1183,7 @@ BOOL GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSys switch (DriveLayout->PartitionStyle) { case PARTITION_STYLE_MBR: SelectedDrive.PartitionStyle = PARTITION_STYLE_MBR; - for (i=0; iPartitionCount; i++) { + for (i = 0; i < DriveLayout->PartitionCount; i++) { if (DriveLayout->PartitionEntry[i].Mbr.PartitionType != PARTITION_ENTRY_UNUSED) { SelectedDrive.nPartitions++; } @@ -1191,7 +1191,7 @@ BOOL GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSys // Detect drives that are using the whole disk as a single partition if ((DriveLayout->PartitionEntry[0].Mbr.PartitionType != PARTITION_ENTRY_UNUSED) && (DriveLayout->PartitionEntry[0].StartingOffset.QuadPart == 0LL)) { - suprintf("Partition type: SFD (%s) or Unpartitioned", sfd_name); + suprintf("Partition type: SFD (%s) or unpartitioned", sfd_name); super_floppy_disk = TRUE; } else { suprintf("Partition type: MBR, NB Partitions: %d", SelectedDrive.nPartitions); @@ -1199,10 +1199,16 @@ BOOL GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSys suprintf("Disk ID: 0x%08X %s", DriveLayout->Mbr.Signature, SelectedDrive.has_mbr_uefi_marker?"(UEFI target)":""); AnalyzeMBR(hPhysical, "Drive", bSilent); } - for (i=0; iPartitionCount; i++) { + for (i = 0; i < DriveLayout->PartitionCount; i++) { isUefiNtfs = FALSE; if (DriveLayout->PartitionEntry[i].Mbr.PartitionType != PARTITION_ENTRY_UNUSED) { part_type = DriveLayout->PartitionEntry[i].Mbr.PartitionType; + // Microsoft will have to explain why they completely ignore the actual MBR partition + // type for zeroed drive (which *IS* 0x00) and fill in Small FAT16 instead (0x04). + // This means that if we detect a Small FAT16 "partition", that "starts" at offset 0 + // and that is larger than 16 MB, our drive is actually unpartitioned. + if (part_type == 0x04 && super_floppy_disk && SelectedDrive.DiskSize > 16 * MB) + break; if (part_type == 0xef) { // Check the FAT label to see if we're dealing with an UEFI_NTFS partition buf = calloc(SelectedDrive.SectorSize, 1); @@ -1214,8 +1220,8 @@ BOOL GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSys free(buf); } } - suprintf("Partition %d%s:", i+(super_floppy_disk?0:1), isUefiNtfs?" (UEFI:NTFS)":""); - for (j=0; jPartitionEntry[i].PartitionLength.QuadPart, TRUE, FALSE), DriveLayout->PartitionEntry[i].PartitionLength.QuadPart, DriveLayout->PartitionEntry[i].StartingOffset.QuadPart / SelectedDrive.SectorSize, @@ -1249,7 +1256,7 @@ BOOL GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSys suprintf("Disk GUID: %s", GuidToString(&DriveLayout->Gpt.DiskId)); suprintf("Max parts: %d, Start Offset: %" PRIi64 ", Usable = %" PRIi64 " bytes", DriveLayout->Gpt.MaxPartitionCount, DriveLayout->Gpt.StartingUsableOffset.QuadPart, DriveLayout->Gpt.UsableLength.QuadPart); - for (i=0; iPartitionCount; i++) { + for (i = 0; i < DriveLayout->PartitionCount; i++) { if (i < MAX_PARTITIONS) { SelectedDrive.PartitionOffset[i] = DriveLayout->PartitionEntry[i].StartingOffset.QuadPart; SelectedDrive.PartitionSize[i] = DriveLayout->PartitionEntry[i].PartitionLength.QuadPart; diff --git a/src/rufus.rc b/src/rufus.rc index 7462679a..18c447eb 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL IDD_DIALOG DIALOGEX 12, 12, 232, 326 STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_ACCEPTFILES -CAPTION "Rufus 3.9.1621" +CAPTION "Rufus 3.9.1622" FONT 9, "Segoe UI Symbol", 400, 0, 0x0 BEGIN LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP @@ -395,8 +395,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,9,1621,0 - PRODUCTVERSION 3,9,1621,0 + FILEVERSION 3,9,1622,0 + PRODUCTVERSION 3,9,1622,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -414,13 +414,13 @@ BEGIN VALUE "Comments", "https://rufus.ie" VALUE "CompanyName", "Akeo Consulting" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "3.9.1621" + VALUE "FileVersion", "3.9.1622" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "ยฉ 2011-2020 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html" VALUE "OriginalFilename", "rufus-3.9.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "3.9.1621" + VALUE "ProductVersion", "3.9.1622" END END BLOCK "VarFileInfo"