diff --git a/res/appstore/Package.appxmanifest b/res/appstore/Package.appxmanifest
index 31807a8b..7523f49c 100644
--- a/res/appstore/Package.appxmanifest
+++ b/res/appstore/Package.appxmanifest
@@ -11,7 +11,7 @@
+ Version="3.16.1820.0" />
Rufus
diff --git a/src/format.c b/src/format.c
index a0b6ed65..8e68ae3d 100644
--- a/src/format.c
+++ b/src/format.c
@@ -710,19 +710,16 @@ out:
static BOOL ClearMBRGPT(HANDLE hPhysicalDrive, LONGLONG DiskSize, DWORD SectorSize, BOOL add1MB)
{
BOOL r = FALSE;
- uint64_t i, last_sector = DiskSize/SectorSize, num_sectors_to_clear;
- unsigned char* pBuf = (unsigned char*) calloc(SectorSize, 1);
+ LARGE_INTEGER liFilePointer;
+ uint64_t num_sectors_to_clear;
+ unsigned char* pZeroBuf = NULL;
PrintInfoDebug(0, MSG_224);
- if (pBuf == NULL) {
- FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_NOT_ENOUGH_MEMORY;
- goto out;
- }
// http://en.wikipedia.org/wiki/GUID_Partition_Table tells us we should clear 34 sectors at the
// beginning and 33 at the end. We bump these values to MAX_SECTORS_TO_CLEAR each end to help
// with reluctant access to large drive.
- // We try to clear at least 1MB + the PBR when Large FAT32 is selected (add1MB), but
+ // We try to clear at least 1MB + the VBR when Large FAT32 is selected (add1MB), but
// don't do it otherwise, as it seems unnecessary and may take time for slow drives.
// Also, for various reasons (one of which being that Windows seems to have issues
// with GPT drives that contain a lot of small partitions) we try not not to clear
@@ -733,22 +730,23 @@ static BOOL ClearMBRGPT(HANDLE hPhysicalDrive, LONGLONG DiskSize, DWORD SectorSi
num_sectors_to_clear = (DWORD)((add1MB ? 2048 : 0) + MAX_SECTORS_TO_CLEAR);
uprintf("Erasing %d sectors", num_sectors_to_clear);
- for (i = 0; i < num_sectors_to_clear; i++) {
- CHECK_FOR_USER_CANCEL;
- if (write_sectors(hPhysicalDrive, SectorSize, i, 1, pBuf) != SectorSize)
- goto out;
- }
- for (i = last_sector - MAX_SECTORS_TO_CLEAR; i < last_sector; i++) {
- CHECK_FOR_USER_CANCEL;
- // Windows seems to be an ass about keeping a lock on a backup GPT,
- // so we try to be lenient about not being able to clear it.
- if (write_sectors(hPhysicalDrive, SectorSize, i, 1, pBuf) != SectorSize)
- break;
+ pZeroBuf = calloc(SectorSize, num_sectors_to_clear);
+ if (pZeroBuf == NULL) {
+ FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | ERROR_NOT_ENOUGH_MEMORY;
+ goto out;
}
+ if (!WriteFileWithRetry(hPhysicalDrive, pZeroBuf, (DWORD)(SectorSize * num_sectors_to_clear), NULL, WRITE_RETRIES))
+ goto out;
+ CHECK_FOR_USER_CANCEL;
+ liFilePointer.QuadPart = DiskSize - (LONGLONG)SectorSize * MAX_SECTORS_TO_CLEAR;
+ SetFilePointerEx(hPhysicalDrive, liFilePointer, &liFilePointer, FILE_BEGIN);
+ // Windows seems to be an ass about keeping a lock on a backup GPT,
+ // so we try to be lenient about not being able to clear it.
+ WriteFileWithRetry(hPhysicalDrive, pZeroBuf, SectorSize * MAX_SECTORS_TO_CLEAR, NULL, WRITE_RETRIES);
r = TRUE;
out:
- safe_free(pBuf);
+ safe_free(pZeroBuf);
return r;
}
diff --git a/src/hdd_vs_ufd.h b/src/hdd_vs_ufd.h
index 2740b573..54c2ec62 100644
--- a/src/hdd_vs_ufd.h
+++ b/src/hdd_vs_ufd.h
@@ -91,7 +91,6 @@ static str_score_t str_adjust[] = {
{ "Gadget", -10 },
{ "Flash", -10 },
{ "HDD", +20 },
- { "SDXC", +10 },
{ "SSD", +20 }
};
diff --git a/src/rufus.rc b/src/rufus.rc
index 70966489..451f52e1 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.16.1819"
+CAPTION "Rufus 3.16.1820"
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,16,1819,0
- PRODUCTVERSION 3,16,1819,0
+ FILEVERSION 3,16,1820,0
+ PRODUCTVERSION 3,16,1820,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.16.1819"
+ VALUE "FileVersion", "3.16.1820"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2021 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
VALUE "OriginalFilename", "rufus-3.16.exe"
VALUE "ProductName", "Rufus"
- VALUE "ProductVersion", "3.16.1819"
+ VALUE "ProductVersion", "3.16.1820"
END
END
BLOCK "VarFileInfo"
diff --git a/src/stdio.c b/src/stdio.c
index 1f49ddea..f14c3631 100644
--- a/src/stdio.c
+++ b/src/stdio.c
@@ -855,6 +855,10 @@ BOOL WriteFileWithRetry(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWr
DWORD nTry;
BOOL readFilePointer;
LARGE_INTEGER liFilePointer, liZero = { { 0,0 } };
+ DWORD NumberOfBytesWritten;
+
+ if (lpNumberOfBytesWritten == NULL)
+ lpNumberOfBytesWritten = &NumberOfBytesWritten;
// Need to get the current file pointer in case we need to retry
readFilePointer = SetFilePointerEx(hFile, liZero, &liFilePointer, FILE_CURRENT);