From 08566fa127c4b614ce5003a4789c21fd3010677a Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Wed, 31 Aug 2016 12:21:10 +0100 Subject: [PATCH] [core] add half workaround for an XP issue * This is not a complete workaround, but it will do for until we drop support for XP altogether. * Closes #810 --- src/format.c | 15 +++++++++++---- src/rufus.rc | 10 +++++----- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/format.c b/src/format.c index bbfb0678..219572fb 100644 --- a/src/format.c +++ b/src/format.c @@ -1633,6 +1633,10 @@ DWORD WINAPI FormatThread(void* param) UpdateProgress(OP_ANALYZE_MBR, -1.0f); } + // Yet another half-workaround needed for XP... + if (nWindowsVersion <= WINDOWS_XP) + InitializeDisk(hPhysicalDrive); + if (zero_drive) { WriteDrive(hPhysicalDrive, NULL); goto out; @@ -1642,10 +1646,13 @@ DWORD WINAPI FormatThread(void* param) // Note, Microsoft's way of cleaning partitions (IOCTL_DISK_CREATE_DISK, which is what we apply // in InitializeDisk) is *NOT ENOUGH* to reset a disk and can render it inoperable for partitioning // or formatting under Windows. See https://github.com/pbatard/rufus/issues/759 for details. - if ((!ClearMBRGPT(hPhysicalDrive, SelectedDrive.DiskSize, SelectedDrive.SectorSize, use_large_fat32)) || (!InitializeDisk(hPhysicalDrive)) ) { - uprintf("Could not reset partitions\n"); - FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_PARTITION_FAILURE; - goto out; + if (nWindowsVersion > WINDOWS_XP) { + if ((!ClearMBRGPT(hPhysicalDrive, SelectedDrive.DiskSize, SelectedDrive.SectorSize, use_large_fat32)) || + (!InitializeDisk(hPhysicalDrive))) { + uprintf("Could not reset partitions\n"); + FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | ERROR_PARTITION_FAILURE; + goto out; + } } if (IsChecked(IDC_BADBLOCKS)) { diff --git a/src/rufus.rc b/src/rufus.rc index d9d974c6..0eebcedb 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL IDD_DIALOG DIALOGEX 12, 12, 242, 376 STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_ACCEPTFILES -CAPTION "Rufus 2.11.991" +CAPTION "Rufus 2.11.992" FONT 8, "Segoe UI Symbol", 400, 0, 0x0 BEGIN LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8 @@ -320,8 +320,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,11,991,0 - PRODUCTVERSION 2,11,991,0 + FILEVERSION 2,11,992,0 + PRODUCTVERSION 2,11,992,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -338,13 +338,13 @@ BEGIN BEGIN VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "2.11.991" + VALUE "FileVersion", "2.11.992" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "© 2011-2016 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" VALUE "OriginalFilename", "rufus.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "2.11.991" + VALUE "ProductVersion", "2.11.992" END END BLOCK "VarFileInfo"