From 967ad1da33bea0dd691db83b0dfa8df42e4d24dd Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Thu, 4 Jul 2013 22:51:15 +0100 Subject: [PATCH] [core] remove the call to IOCTL_DISK_DELETE_DRIVE_LAYOUT * As per issue #122, this creates problems when formatting a drive in FAT16 * Also remove an unnecessary backslash in icon.c --- src/drive.c | 28 ---------------------------- src/format.c | 10 +--------- src/icon.c | 2 +- src/rufus.rc | 10 +++++----- 4 files changed, 7 insertions(+), 43 deletions(-) diff --git a/src/drive.c b/src/drive.c index 2ad0a634..87964a96 100644 --- a/src/drive.c +++ b/src/drive.c @@ -676,34 +676,6 @@ BOOL CreatePartition(HANDLE hDrive, int partition_style, int file_system, BOOL m return TRUE; } -/* Delete the disk partition table */ -BOOL DeletePartitions(HANDLE hDrive) -{ - BOOL r; - DWORD size; - - PrintStatus(0, TRUE, "Erasing Partitions..."); - - r = DeviceIoControl(hDrive, IOCTL_DISK_DELETE_DRIVE_LAYOUT, NULL, 0, NULL, 0, &size, NULL ); - if (!r) { - // Ignore GEN_FAILURE as this is what XP returns for unpartitioned - if (GetLastError() != ERROR_GEN_FAILURE) { - uprintf("Could not delete drive layout: %s\n", WindowsErrorString()); - safe_closehandle(hDrive); - return FALSE; - } - } - - r = DeviceIoControl(hDrive, IOCTL_DISK_UPDATE_PROPERTIES, NULL, 0, NULL, 0, &size, NULL ); - if (!r) { - uprintf("Could not refresh drive layout: %s\n", WindowsErrorString()); - safe_closehandle(hDrive); - return FALSE; - } - - return TRUE; -} - /* * Convert a partition type to its human readable form using * (slightly modified) entries from GNU fdisk diff --git a/src/format.c b/src/format.c index 683e8b78..e7dc2316 100644 --- a/src/format.c +++ b/src/format.c @@ -1265,14 +1265,6 @@ DWORD WINAPI FormatThread(LPVOID param) } UpdateProgress(OP_ANALYZE_MBR, -1.0f); - // Zap any existing partitions. This should help to prevent access errors - // TODO: With this, we should be able to avoid having to deal with the logical volume above - if (!DeletePartitions(hPhysicalDrive)) { - uprintf("Could not reset partitions\n"); - FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_PARTITION_FAILURE; - goto out; - } - if (IsChecked(IDC_BADBLOCKS)) { do { // create a log file for bad blocks report. Since %USERPROFILE% may @@ -1346,7 +1338,7 @@ DWORD WINAPI FormatThread(LPVOID param) // TODO: (v1.4) Our start button should become cancel instead of close // Especially after destructive badblocks test, you must zero the MBR/GPT completely - // before repartitioning. Else, all kind of bad things can happen. + // before repartitioning. Else, all kind of bad things happen. if (!ClearMBRGPT(hPhysicalDrive, SelectedDrive.DiskSize, SelectedDrive.Geometry.BytesPerSector)) { uprintf("unable to zero MBR/GPT\n"); if (!IS_ERROR(FormatStatus)) diff --git a/src/icon.c b/src/icon.c index 81293c93..793101b1 100644 --- a/src/icon.c +++ b/src/icon.c @@ -160,7 +160,7 @@ BOOL SetAutorun(const char* path) char filename[64]; wchar_t wlabel[128], wRufusVersion[32]; - safe_sprintf(filename, sizeof(filename), "%s\\autorun.inf", path); + safe_sprintf(filename, sizeof(filename), "%sautorun.inf", path); fd = fopen(filename, "r"); // If there's an existing autorun, don't overwrite if (fd != NULL) { uprintf("%s already exists - keeping it\n", filename); diff --git a/src/rufus.rc b/src/rufus.rc index bcc80a9b..d63f4ba2 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -30,7 +30,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL IDD_DIALOG DIALOGEX 12, 12, 206, 329 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_APPWINDOW -CAPTION "Rufus v1.3.4.263" +CAPTION "Rufus v1.3.4.264" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "Start",IDC_START,94,291,50,14 @@ -278,8 +278,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,3,4,263 - PRODUCTVERSION 1,3,4,263 + FILEVERSION 1,3,4,264 + PRODUCTVERSION 1,3,4,264 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -296,13 +296,13 @@ BEGIN BEGIN VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "1.3.4.263" + VALUE "FileVersion", "1.3.4.264" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "© 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.4.263" + VALUE "ProductVersion", "1.3.4.264" END END BLOCK "VarFileInfo"