[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
This commit is contained in:
Pete Batard 2016-08-31 12:21:10 +01:00
parent 9872cad1e8
commit 08566fa127
2 changed files with 16 additions and 9 deletions

View File

@ -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)) {

View File

@ -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"