[img] add a retry for DD Images

* Also try to ignore autorun.inf issues from idiotic antivirus solutions, when writing ISOs
* Also remove the columns in the English labels (improves high DPI display)
* Also update additional ISO related messages to make them more generic
This commit is contained in:
Pete Batard 2014-02-09 23:38:16 +00:00
parent 89a7a3deb1
commit cd4dd3cc47
7 changed files with 66 additions and 51 deletions

View File

@ -2,7 +2,7 @@ o Version 1.4.4 (2013.02.??)
Add *uncompressed* DD Image support (FreeBSD, FreeNAS, etc.)
Add right-to-left language support
Add NTFS Compression support (unofficial)
Improve Syslinux v5+ support (requires an internet connection)
Improve Syslinux v5+ support (requires an internet connection to download extra files)
Improve hotplug detection
Fix detection for Toshiba drives (again)
Fix support for latest gparted, ArchLinux, and other Syslinux v5+ based ISOs

View File

@ -17,8 +17,12 @@ o Version 1.0.10 (2014.02.09)
- *NEW* MSG_261 "Writing image: %0.1f%% completed"
- *NEW* MSG_187 "Invalid image for selected boot option"
- *NEW* MSG_188 "The current image doesn't match the boot option selected..." (see rufus.loc for full text)
- Changed MSG_086 "No ISO image selected" -> "No image selected"
- Changed MSG_087 "Please click on the disc button to select a bootable ISO..." -> "Please click on the disc button to select a bootable image..." (see rufus.loc for full text)
- Changed MSG_088 "ISO too big" -> "Image is too big"
- Changed MSG_089 "This ISO image is too big for the selected target." -> "The image is too big for the selected target."
- Changed MSG_202 "Scanning ISO image..." -> "Scanning image..."
- Changed MSG_203 "Failed to scan ISO image" -> "Failed to scan image"
o Version 1.0.9 (2014.01.31)
- *NEW* MSG_260 "NTFS compression"

View File

@ -63,9 +63,9 @@ t IDS_FILESYSTEM_TXT "File system"
t IDS_CLUSTERSIZE_TXT "Cluster size"
t IDS_LABEL_TXT "New volume label"
t IDS_FORMAT_OPTIONS_GRP "Format Options "
t IDC_BADBLOCKS "Check device for bad blocks:"
t IDC_BADBLOCKS "Check device for bad blocks"
t IDC_QUICKFORMAT "Quick format"
t IDC_BOOT "Create a bootable disk using:"
t IDC_BOOT "Create a bootable disk using"
t IDC_SET_ICON "Create extended label and icon files"
t IDC_ABOUT "About..."
t IDC_LOG "Log"
@ -79,7 +79,7 @@ t IDC_EXTRA_PARTITION "Add fixes for old BIOSes (extra partition, align, etc.)"
# 'MBR': See http://en.wikipedia.org/wiki/Master_boot_record
# Rufus can install it's own custom MBR (the Rufus MBR), which also allows users
# to specify a custom disk ID for the BIOS. Note: the tooltip for this control is MSG_167.
t IDC_RUFUS_MBR "Use Rufus MBR with BIOS ID:"
t IDC_RUFUS_MBR "Use Rufus MBR with BIOS ID"
# About dialog
g IDD_ABOUTBOX
@ -243,11 +243,11 @@ t MSG_084 "This ISO image seems to use an obsolete version of '%s'.\n"
"Note: The new file will be downloaded in the current directory and once a "
"'%s' exists there, it will be reused automatically."
t MSG_085 "Downloading %s"
t MSG_086 "No ISO image selected"
t MSG_086 "No image selected"
# The content between the quotes below (\"Create a bootable disk\") should match
# the beginning of the IDC_BOOT text
t MSG_087 "Please click on the disc button to select a bootable ISO, "
"or uncheck the \"Create a bootable disk...\" checkbox."
t MSG_087 "Please click on the disc button to select a bootable image, "
"or uncheck the \"Create a bootable disk using\" checkbox."
t MSG_088 "Image is too big"
t MSG_089 "The image is too big for the selected target."
t MSG_090 "Unsupported ISO"
@ -355,8 +355,8 @@ t MSG_188 "The current image doesn't match the boot option selected. Please use
# Status messages - these messages will appear on the status bar
t MSG_201 "Cancelling - Please wait..."
t MSG_202 "Scanning ISO image..."
t MSG_203 "Failed to scan ISO image"
t MSG_202 "Scanning image..."
t MSG_203 "Failed to scan image"
# Parameter: the name of an obsolete Syslinux .c32 module. eg: "Obsolete vesamenu.c32 detected"
t MSG_204 "Obsolete %s detected"
# Display the name of the ISO selected. eg: "Using ISO: en_win7_x64_sp1.iso"
@ -1766,9 +1766,9 @@ t MSG_084 "Cette image ISO utilise une version obsolète du fichier '%s'.\n"
"Note : Le nouveau fichier sera téléchargé dans le répertoire courant. "
"Si un '%s' existe à cet endroit, il sera réutilisé automatiquement."
t MSG_085 "Téléchargement de %s"
t MSG_086 "Aucune image ISO sélectionnée"
t MSG_087 "Veuillez cliquer sur le bouton avec un disque pour choisir une image ISO démarrable "
"ou décochez l'option \"Disque de démarrage...\"."
t MSG_086 "Aucune image sélectionnée"
t MSG_087 "Veuillez cliquer sur le bouton avec un disque pour sélectionner une image démarrable "
"ou décochez l'option \"Créer un disque de démarrage\"."
t MSG_088 "Image trop large"
t MSG_089 "L'image est trop large pour être copiée sur le périphérique sélectionné."
t MSG_090 "Image ISO on supportée"
@ -1874,8 +1874,8 @@ t MSG_188 "L'image choisie ne correspond pas à l'option de démarrage sélectio
# Status messages
t MSG_201 "Annulation - Veuillez patienter..."
t MSG_202 "Analyse de l'image ISO..."
t MSG_203 "Echec d'analyse de l'image ISO"
t MSG_202 "Analyse de l'image..."
t MSG_203 "Echec d'analyse de l'image"
t MSG_204 "Fichier %s obsolète détecté"
t MSG_205 "ISO utilisée : %s"
t MSG_206 "Fichier %s manquant"

View File

@ -1172,7 +1172,6 @@ DWORD WINAPI CloseFormatPromptThread(LPVOID param) {
* Close the volume handle.
*/
#define CHECK_FOR_USER_CANCEL if (IS_ERROR(FormatStatus)) goto out
#define BSIZE 65536 // TODO: dual buffer and overlapped when writing an image
DWORD WINAPI FormatThread(void* param)
{
int i, r, pt, bt, fs, dt;
@ -1185,7 +1184,7 @@ DWORD WINAPI FormatThread(void* param)
FILE* log_fd;
LARGE_INTEGER li;
uint64_t wb;
uint8_t buffer[BSIZE];
uint8_t buffer[65536];
char *bb_msg, *guid_volume = NULL;
char drive_name[] = "?:\\";
char drive_letters[27];
@ -1327,7 +1326,7 @@ DWORD WINAPI FormatThread(void* param)
// We poked the MBR, so we need to rewind
li.QuadPart = 0;
SetFilePointerEx(hPhysicalDrive, li, NULL, FILE_BEGIN);
hSourceImage = CreateFileU(iso_path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
hSourceImage = CreateFileU(iso_path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL);
if (hSourceImage == INVALID_HANDLE_VALUE) {
uprintf("Could not open image '%s': %s", iso_path, WindowsErrorString());
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_OPEN_FAILED;
@ -1335,11 +1334,15 @@ DWORD WINAPI FormatThread(void* param)
}
uprintf("Writing Image...");
// Don't bother trying for something clever, using double buffering overlapped and whatnot:
// With Windows' default optimizations, sync read + sync write for sequential operations
// will be as fast, if not faster, than whatever async scheme you can come up with.
for (wb = 0; ; wb += wSize) {
s = ReadFile(hSourceImage, buffer, BSIZE, &rSize, NULL);
s = ReadFile(hSourceImage, buffer, sizeof(buffer), &rSize, NULL);
if (!s) {
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_READ_FAULT;
uprintf("read error: %s", WindowsErrorString());
goto out;
}
if (rSize == 0)
break;
@ -1350,16 +1353,24 @@ DWORD WINAPI FormatThread(void* param)
UpdateProgress(OP_FORMAT, format_percent);
}
CHECK_FOR_USER_CANCEL;
// TODO: add a retry on write?
s = WriteFile(hPhysicalDrive, buffer, rSize, &wSize, NULL);
if (!s || wSize != rSize) {
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_WRITE_FAULT;
for (i=0; i<WRITE_RETRIES; i++) {
s = WriteFile(hPhysicalDrive, buffer, rSize, &wSize, NULL);
if ((s) && (wSize == rSize))
break;
if (s)
uprintf("write error: Wrote %d bytes, expected %d bytes\n", wSize, rSize);
else
uprintf("write error: %s", WindowsErrorString());
goto out;
}
if (i < WRITE_RETRIES-1) {
li.QuadPart = wb;
SetFilePointerEx(hPhysicalDrive, li, NULL, FILE_BEGIN);
uprintf(" RETRYING...\n");
} else {
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_WRITE_FAULT;
goto out;
}
}
if (i >= WRITE_RETRIES) goto out;
}
uprintf("Done");
goto out;
@ -1551,6 +1562,7 @@ DWORD WINAPI FormatThread(void* param)
out:
safe_free(guid_volume);
SendMessage(hISOProgressDlg, UM_ISO_EXIT, 0, 0);
safe_closehandle(hSourceImage);
safe_unlockclose(hLogicalVolume);
safe_unlockclose(hPhysicalDrive); // This can take a while
if (IS_ERROR(FormatStatus)) {

View File

@ -47,7 +47,6 @@
// the progress bar for every block will bring extraction to a crawl
#define PROGRESS_THRESHOLD 128
#define FOUR_GIGABYTES 4294967296LL
#define WRITE_RETRIES 3
// Needed for UDF ISO access
CdIo_t* cdio_open (const char* psz_source, driver_id_t driver_id) {return NULL;}
@ -69,6 +68,9 @@ static const char* pe_dirname[] = { "/i386", "/minint" };
static const char* pe_file[] = { "ntdetect.com", "setupldr.bin", "txtsetup.sif" };
static const char* reactos_name = "setupldr.sys"; // TODO: freeldr.sys doesn't seem to work
static const char* autorun_name = "autorun.inf";
static const char* stupid_antivirus = " NOTE: This is usually caused by a poorly designed security solution. "
"See http://rufus.akeo.ie/compatibility.\r\n This file will be skipped for now, but you should really "
"look into using a *SMARTER* antivirus solution.";
const char* old_c32_name[NB_OLD_C32] = OLD_C32_NAMES;
static const int64_t old_c32_threshold[NB_OLD_C32] = OLD_C32_THRESHOLD;
static uint8_t i_joliet_level = 0;
@ -283,13 +285,11 @@ static int udf_extract_files(udf_t *p_udf, udf_dirent_t *p_udf_dirent, const cha
if (file_handle == INVALID_HANDLE_VALUE) {
err = GetLastError();
uprintf(" Unable to create file: %s\n", WindowsErrorString());
if ((err == ERROR_ACCESS_DENIED) && (safe_strcmp(&psz_fullpath[3], autorun_name) == 0)) {
uprintf(" NOTE: This may be caused by a poorly designed security solution. "
"See http://rufus.akeo.ie/compatibility.");
}
goto out;
}
while (i_file_length > 0) {
if ((err == ERROR_ACCESS_DENIED) && (safe_strcmp(&psz_fullpath[3], autorun_name) == 0))
uprintf(stupid_antivirus);
else
goto out;
} else while (i_file_length > 0) {
if (FormatStatus) goto out;
memset(buf, 0, UDF_BLOCKSIZE);
i_read = udf_read_block(p_udf_dirent, buf, 1);
@ -424,13 +424,11 @@ static int iso_extract_files(iso9660_t* p_iso, const char *psz_path)
if (file_handle == INVALID_HANDLE_VALUE) {
err = GetLastError();
uprintf(" Unable to create file: %s\n", WindowsErrorString());
if ((err == ERROR_ACCESS_DENIED) && (safe_strcmp(&psz_fullpath[3], autorun_name) == 0)) {
uprintf(" NOTE: This may be caused by a poorly designed security solution. "
"See http://rufus.akeo.ie/compatibility.");
}
goto out;
}
for (i=0; i_file_length>0; i++) {
if ((err == ERROR_ACCESS_DENIED) && (safe_strcmp(&psz_fullpath[3], autorun_name) == 0))
uprintf(stupid_antivirus);
else
goto out;
} else for (i=0; i_file_length>0; i++) {
if (FormatStatus) goto out;
memset(buf, 0, ISO_BLOCKSIZE);
lsn = p_statbuf->lsn + (lsn_t)i;

View File

@ -52,6 +52,7 @@
#define MAX_SECTORS_TO_CLEAR 128 // nb sectors to zap when clearing the MBR/GPT (must be >34)
#define MBR_UEFI_MARKER 0x49464555 // 'U', 'E', 'F', 'I', as a 32 bit little endian longword
#define PROPOSEDLABEL_TOLERANCE 0.10
#define WRITE_RETRIES 3
#define FS_DEFAULT FS_FAT32
#define BADBLOCK_PATTERNS {0xaa, 0x55, 0xff, 0x00}
#define LARGE_FAT32_SIZE (32*1073741824LL) // Size at which we need to use fat32format

View File

@ -32,7 +32,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
CAPTION "Rufus 1.4.4.405"
CAPTION "Rufus 1.4.4.406"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Start",IDC_START,94,291,50,14
@ -51,16 +51,16 @@ BEGIN
GROUPBOX "Format Options ",IDS_FORMAT_OPTIONS_GRP,7,149,192,66
LTEXT "New volume label",IDS_LABEL_TXT,9,121,186,10
EDITTEXT IDC_LABEL,7,131,190,13,ES_AUTOHSCROLL
CONTROL "Check device for bad blocks:",IDC_BADBLOCKS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,161,101,10
CONTROL "Check device for bad blocks",IDC_BADBLOCKS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,161,101,10
CONTROL "Quick format",IDC_QUICKFORMAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,173,106,10
CONTROL "Create a bootable disk using:",IDC_BOOT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,185,104,10
CONTROL "Create a bootable disk using",IDC_BOOT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,185,104,10
CONTROL "Create extended label and icon files",IDC_SET_ICON,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,198,181,10
CONTROL "",IDC_PROGRESS,"msctls_progress32",PBS_SMOOTH | WS_BORDER,8,272,189,9
COMBOBOX IDC_NBPASSES,119,159,49,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_BOOTTYPE,119,183,49,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "...",IDC_SELECT_ISO,171,182,22,14,BS_ICON
CONTROL "Use Rufus MBR with BIOS ID:",IDC_RUFUS_MBR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,248,106,10
CONTROL "Use Rufus MBR with BIOS ID",IDC_RUFUS_MBR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,248,106,10
PUSHBUTTON "",IDC_ADVANCED,63,148,14,10,BS_TOP | BS_FLAT
GROUPBOX "Advanced Options",IDS_ADVANCED_OPTIONS_GRP,7,210,192,54
COMBOBOX IDC_DISK_ID,119,246,73,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
@ -165,7 +165,7 @@ END
RTL_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_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL
CAPTION "Rufus 1.4.4.405"
CAPTION "Rufus 1.4.4.406"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Start",IDC_START,94,291,50,14
@ -184,16 +184,16 @@ BEGIN
GROUPBOX "Format Options ",IDS_FORMAT_OPTIONS_GRP,7,149,192,66
LTEXT "New volume label",IDS_LABEL_TXT,9,121,186,10
EDITTEXT IDC_LABEL,7,131,190,13,ES_AUTOHSCROLL
CONTROL "Check device for bad blocks:",IDC_BADBLOCKS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,161,101,10
CONTROL "Check device for bad blocks",IDC_BADBLOCKS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,161,101,10
CONTROL "Quick format",IDC_QUICKFORMAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,173,106,10
CONTROL "Create a bootable disk using:",IDC_BOOT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,185,104,10
CONTROL "Create a bootable disk using",IDC_BOOT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,185,104,10
CONTROL "Create extended label and icon files",IDC_SET_ICON,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,198,181,10
CONTROL "",IDC_PROGRESS,"msctls_progress32",PBS_SMOOTH | WS_BORDER,8,272,189,9
COMBOBOX IDC_NBPASSES,119,159,49,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_BOOTTYPE,119,183,49,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "...",IDC_SELECT_ISO,171,182,22,14,BS_ICON
CONTROL "Use Rufus MBR with BIOS ID:",IDC_RUFUS_MBR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,248,106,10
CONTROL "Use Rufus MBR with BIOS ID",IDC_RUFUS_MBR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,248,106,10
PUSHBUTTON "",IDC_ADVANCED,63,148,14,10,BS_TOP | BS_FLAT
GROUPBOX "Advanced Options",IDS_ADVANCED_OPTIONS_GRP,7,210,192,54
COMBOBOX IDC_DISK_ID,119,246,73,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
@ -427,8 +427,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,4,4,405
PRODUCTVERSION 1,4,4,405
FILEVERSION 1,4,4,406
PRODUCTVERSION 1,4,4,406
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -445,13 +445,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "1.4.4.405"
VALUE "FileVersion", "1.4.4.406"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2014 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "1.4.4.405"
VALUE "ProductVersion", "1.4.4.406"
END
END
BLOCK "VarFileInfo"