From 22808893bcfc43355d40e39430ccec8441a1205b Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Mon, 3 Jun 2013 19:55:23 +0100 Subject: [PATCH] [misc] small enhancements * Add detection for user cancellation during between atomic format operations * Clear existing PBR along with MBR/GPT data * Improve log messages --- src/drive.c | 3 +-- src/format.c | 26 +++++++++++++++++--------- src/rufus.c | 6 ++++-- src/rufus.rc | 10 +++++----- 4 files changed, 27 insertions(+), 18 deletions(-) diff --git a/src/drive.c b/src/drive.c index 303426bb..356bf29f 100644 --- a/src/drive.c +++ b/src/drive.c @@ -216,7 +216,6 @@ HANDLE GetLogicalHandle(DWORD DriveIndex, BOOL bWriteAccess, BOOL bLockDrive) /* * Returns the first drive letter for a volume located on the drive identified by DriveIndex - * TODO: should we return all the drive letters? */ char GetDriveLetter(DWORD DriveIndex) { @@ -456,7 +455,7 @@ BOOL GetDrivePartitionData(DWORD DriveIndex, char* FileSystemName, DWORD FileSys // Populate the filesystem data volume_name = GetLogicalName(DriveIndex, TRUE); if ((volume_name == NULL) || (!GetVolumeInformationA(volume_name, NULL, 0, NULL, NULL, NULL, FileSystemName, FileSystemNameSize))) { - uprintf("Did not get volume information for disk 0x%02x\n", DriveIndex); + uprintf("No volume information for disk 0x%02x\n", DriveIndex); FileSystemName[0] = 0; } safe_free(volume_name); diff --git a/src/format.c b/src/format.c index f29febc9..2c59a530 100644 --- a/src/format.c +++ b/src/format.c @@ -328,7 +328,7 @@ static DWORD GetFATSizeSectors(DWORD DskSize, DWORD ReservedSecCnt, DWORD SecPer * Large FAT32 volume formatting from fat32format by Tom Thornhill * http://www.ridgecrop.demon.co.uk/index.htm?fat32format.htm */ -// TODO: disable slow format for > 32 GB FAT32 +// TODO: (v1.3.4) disable slow format for > 32 GB FAT32 static BOOL FormatFAT32(DWORD DriveIndex) { BOOL r = FALSE; @@ -759,15 +759,13 @@ static BOOL AnalyzePBR(HANDLE hLogicalVolume) return TRUE; } -// TODO: We may have to clear a few more sectors past the MBR buffer zone -// so that Windows relinquishes access static BOOL ClearMBRGPT(HANDLE hPhysicalDrive, LONGLONG DiskSize, DWORD SectorSize) { BOOL r = FALSE; uint64_t i, last_sector = DiskSize/SectorSize; unsigned char* pBuf = (unsigned char*) calloc(SectorSize, 1); - PrintStatus(0, TRUE, "Clearing MBR/GPT structures..."); + PrintStatus(0, TRUE, "Clearing MBR/PBR/GPT structures..."); if (pBuf == NULL) { FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_NOT_ENOUGH_MEMORY; goto out; @@ -785,6 +783,13 @@ static BOOL ClearMBRGPT(HANDLE hPhysicalDrive, LONGLONG DiskSize, DWORD SectorSi goto out; } } + // Also attempt to clear the PBR, usually located at the 1 MB mark + for (i=1024*1024/SectorSize; i Toggle detection of fixed disks // By default Rufus does not allow formatting USB fixed disk drives, such as USB HDDs // This is a safety feature, to avoid someone unintentionally formatting a backup diff --git a/src/rufus.rc b/src/rufus.rc index 778d0324..f3fe0f34 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -30,7 +30,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL IDD_DIALOG DIALOGEX 12, 12, 206, 316 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_APPWINDOW -CAPTION "Rufus v1.3.3.243" +CAPTION "Rufus v1.3.3.244" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "Start",IDC_START,94,278,50,14 @@ -274,8 +274,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,3,3,243 - PRODUCTVERSION 1,3,3,243 + FILEVERSION 1,3,3,244 + PRODUCTVERSION 1,3,3,244 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -292,13 +292,13 @@ BEGIN BEGIN VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "1.3.3.243" + VALUE "FileVersion", "1.3.3.244" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "(c) 2011-2013 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" VALUE "OriginalFilename", "rufus.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "1.3.3.243" + VALUE "ProductVersion", "1.3.3.244" END END BLOCK "VarFileInfo"