1
1
Fork 0
mirror of https://github.com/pbatard/rufus.git synced 2024-08-14 23:57:05 +00:00

[badblocks] use 0x55 and 0xAA for less than 2 passes checks

* Should be more effective at detecting errors than 0x00 and 0xFF.
This commit is contained in:
Pete Batard 2020-11-10 17:24:52 +00:00
parent f8c951f3d7
commit 9c71ac25d5
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
5 changed files with 14 additions and 12 deletions

View file

@ -408,7 +408,8 @@ static unsigned int test_rw(HANDLE hDrive, blk64_t last_block, size_t block_size
size_t blocks_at_once, int pattern_type, int nb_passes) size_t blocks_at_once, int pattern_type, int nb_passes)
{ {
const unsigned int pattern[BADLOCKS_PATTERN_TYPES][BADBLOCK_PATTERN_COUNT] = const unsigned int pattern[BADLOCKS_PATTERN_TYPES][BADBLOCK_PATTERN_COUNT] =
{ BADBLOCK_PATTERN_SLC, BADCLOCK_PATTERN_MLC, BADBLOCK_PATTERN_TLC }; { BADBLOCK_PATTERN_ONE_PASS, BADBLOCK_PATTERN_TWO_PASSES, BADBLOCK_PATTERN_SLC,
BADCLOCK_PATTERN_MLC, BADBLOCK_PATTERN_TLC };
unsigned char *buffer = NULL, *read_buffer; unsigned char *buffer = NULL, *read_buffer;
int i, pat_idx; int i, pat_idx;
unsigned int bb_count = 0; unsigned int bb_count = 0;

View file

@ -1810,8 +1810,7 @@ DWORD WINAPI FormatThread(void* param)
fflush(log_fd); fflush(log_fd);
} }
if (!BadBlocks(hPhysicalDrive, SelectedDrive.DiskSize, (sel >= 2) ? 4 : sel +1, if (!BadBlocks(hPhysicalDrive, SelectedDrive.DiskSize, (sel >= 2) ? 4 : sel +1, sel, &report, log_fd)) {
(sel < 2) ? 0 : sel - 2, &report, log_fd)) {
uprintf("Bad blocks: Check failed."); uprintf("Bad blocks: Check failed.");
if (!IS_ERROR(FormatStatus)) if (!IS_ERROR(FormatStatus))
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|APPERR(ERROR_BADBLOCKS_FAILURE); FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|APPERR(ERROR_BADBLOCKS_FAILURE);

View file

@ -91,8 +91,10 @@
#define MARQUEE_TIMER_REFRESH 10 // Time between progress bar marquee refreshes, in ms #define MARQUEE_TIMER_REFRESH 10 // Time between progress bar marquee refreshes, in ms
#define FS_DEFAULT FS_FAT32 #define FS_DEFAULT FS_FAT32
#define SINGLE_CLUSTERSIZE_DEFAULT 0x00000100 #define SINGLE_CLUSTERSIZE_DEFAULT 0x00000100
#define BADLOCKS_PATTERN_TYPES 3 #define BADLOCKS_PATTERN_TYPES 5
#define BADBLOCK_PATTERN_COUNT 4 #define BADBLOCK_PATTERN_COUNT 4
#define BADBLOCK_PATTERN_ONE_PASS {0x55, 0x00, 0x00, 0x00}
#define BADBLOCK_PATTERN_TWO_PASSES {0x55, 0xaa, 0x00, 0x00}
#define BADBLOCK_PATTERN_SLC {0x00, 0xff, 0x55, 0xaa} #define BADBLOCK_PATTERN_SLC {0x00, 0xff, 0x55, 0xaa}
#define BADCLOCK_PATTERN_MLC {0x00, 0xff, 0x33, 0xcc} #define BADCLOCK_PATTERN_MLC {0x00, 0xff, 0x33, 0xcc}
#define BADBLOCK_PATTERN_TLC {0x00, 0xff, 0x1c71c7, 0xe38e38} #define BADBLOCK_PATTERN_TLC {0x00, 0xff, 0x1c71c7, 0xe38e38}

View file

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 232, 326 IDD_DIALOG DIALOGEX 12, 12, 232, 326
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 3.13.1720" CAPTION "Rufus 3.13.1721"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0 FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@ -395,8 +395,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,13,1720,0 FILEVERSION 3,13,1721,0
PRODUCTVERSION 3,13,1720,0 PRODUCTVERSION 3,13,1721,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -414,13 +414,13 @@ BEGIN
VALUE "Comments", "https://rufus.ie" VALUE "Comments", "https://rufus.ie"
VALUE "CompanyName", "Akeo Consulting" VALUE "CompanyName", "Akeo Consulting"
VALUE "FileDescription", "Rufus" VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "3.13.1720" VALUE "FileVersion", "3.13.1721"
VALUE "InternalName", "Rufus" VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2020 Pete Batard (GPL v3)" VALUE "LegalCopyright", "© 2011-2020 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html" VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
VALUE "OriginalFilename", "rufus-3.13.exe" VALUE "OriginalFilename", "rufus-3.13.exe"
VALUE "ProductName", "Rufus" VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "3.13.1720" VALUE "ProductVersion", "3.13.1721"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View file

@ -1555,11 +1555,11 @@ void ShowLanguageMenu(RECT rcExclude)
void SetPassesTooltip(void) void SetPassesTooltip(void)
{ {
const unsigned int pattern[BADLOCKS_PATTERN_TYPES][BADBLOCK_PATTERN_COUNT] = const unsigned int pattern[BADLOCKS_PATTERN_TYPES][BADBLOCK_PATTERN_COUNT] =
{ BADBLOCK_PATTERN_SLC, BADCLOCK_PATTERN_MLC, BADBLOCK_PATTERN_TLC }; { BADBLOCK_PATTERN_ONE_PASS, BADBLOCK_PATTERN_TWO_PASSES, BADBLOCK_PATTERN_SLC,
BADCLOCK_PATTERN_MLC, BADBLOCK_PATTERN_TLC };
int sel = ComboBox_GetCurSel(hNBPasses); int sel = ComboBox_GetCurSel(hNBPasses);
int type = (sel < 2) ? 0 : sel - 2;
CreateTooltip(hNBPasses, lmprintf(MSG_153 + ((sel >= 2) ? 3 : sel), CreateTooltip(hNBPasses, lmprintf(MSG_153 + ((sel >= 2) ? 3 : sel),
pattern[type][0], pattern[type][1], pattern[type][2], pattern[type][3]), -1); pattern[sel][0], pattern[sel][1], pattern[sel][2], pattern[sel][3]), -1);
} }
void SetBootTypeDropdownWidth(void) void SetBootTypeDropdownWidth(void)