diff --git a/src/.msvc/rufus.vcxproj b/src/.msvc/rufus.vcxproj index 3766519d..3d52a6e5 100644 --- a/src/.msvc/rufus.vcxproj +++ b/src/.msvc/rufus.vcxproj @@ -40,12 +40,12 @@ Application Unicode true - v110_xp + v110 Application Unicode - v110_xp + v110 diff --git a/src/icon.c b/src/icon.c index 793101b1..9f79876c 100644 --- a/src/icon.c +++ b/src/icon.c @@ -171,6 +171,8 @@ BOOL SetAutorun(const char* path) fd = fopen(filename, "w, ccs=UTF-16LE"); if (fd == NULL) { uprintf("Unable to create %s\n", filename); + uprintf("NOTE: This may be caused by a poorly designed security solution. " + "See http://rufus.akeo.ie/compatibility."); return FALSE; } diff --git a/src/iso.c b/src/iso.c index 079e6d5c..ebd1bca5 100644 --- a/src/iso.c +++ b/src/iso.c @@ -47,6 +47,7 @@ // 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;} @@ -64,6 +65,7 @@ static const char* efi_dirname = "/efi/boot"; static const char* isolinux_name[] = { "isolinux.cfg", "syslinux.cfg", "extlinux.conf"}; static const char* pe_dirname[] = { "/i386", "/minint" }; static const char* pe_file[] = { "ntdetect.com", "setupldr.bin", "txtsetup.sif" }; +static const char* autorun_name = "autorun.inf"; static 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; @@ -200,7 +202,7 @@ static __inline BOOL check_iso_props(const char* psz_dirname, BOOL* is_syslinux_ static int udf_extract_files(udf_t *p_udf, udf_dirent_t *p_udf_dirent, const char *psz_path) { HANDLE file_handle = NULL; - DWORD buf_size, wr_size; + DWORD buf_size, wr_size, err; BOOL r, is_syslinux_cfg, is_old_c32[NB_OLD_C32]; int i_length; size_t i, nul_pos; @@ -266,7 +268,12 @@ static int udf_extract_files(udf_t *p_udf, udf_dirent_t *p_udf_dirent, const cha file_handle = CreateFileU(psz_fullpath, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); 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) { @@ -274,15 +281,21 @@ static int udf_extract_files(udf_t *p_udf, udf_dirent_t *p_udf_dirent, const cha memset(buf, 0, UDF_BLOCKSIZE); i_read = udf_read_block(p_udf_dirent, buf, 1); if (i_read < 0) { - uprintf(" Error reading UDF file %s\n", &psz_fullpath[strlen(psz_extract_dir)]); + uprintf(" Error reading UDF file %s", &psz_fullpath[strlen(psz_extract_dir)]); goto out; } buf_size = (DWORD)MIN(i_file_length, i_read); - ISO_BLOCKING(r = WriteFile(file_handle, buf, buf_size, &wr_size, NULL)); - if ((!r) || (buf_size != wr_size)) { - uprintf(" Error writing file: %s\n", WindowsErrorString()); - goto out; + for (i=0; i= WRITE_RETRIES) goto out; i_file_length -= i_read; if (nb_blocks++ % PROGRESS_THRESHOLD == 0) { SendMessage(hISOProgressBar, PBM_SETPOS, (WPARAM)((MAX_PROGRESS*nb_blocks)/total_blocks), 0); @@ -318,7 +331,7 @@ out: static int iso_extract_files(iso9660_t* p_iso, const char *psz_path) { HANDLE file_handle = NULL; - DWORD buf_size, wr_size; + DWORD buf_size, wr_size, err; BOOL s, is_syslinux_cfg, is_old_c32[NB_OLD_C32]; int i_length, r = 1; char psz_fullpath[1024], *psz_basename; @@ -395,7 +408,12 @@ static int iso_extract_files(iso9660_t* p_iso, const char *psz_path) file_handle = CreateFileU(psz_fullpath, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); 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++) { @@ -408,11 +426,18 @@ static int iso_extract_files(iso9660_t* p_iso, const char *psz_path) goto out; } buf_size = (DWORD)MIN(i_file_length, ISO_BLOCKSIZE); - ISO_BLOCKING(s = WriteFile(file_handle, buf, buf_size, &wr_size, NULL)); - if ((!s) || (buf_size != wr_size)) { - uprintf(" Error writing file: %s\n", WindowsErrorString()); - goto out; + + for (i=0; i= WRITE_RETRIES) goto out; i_file_length -= ISO_BLOCKSIZE; if (nb_blocks++ % PROGRESS_THRESHOLD == 0) { SendMessage(hISOProgressBar, PBM_SETPOS, (WPARAM)((MAX_PROGRESS*nb_blocks)/total_blocks), 0); diff --git a/src/rufus.c b/src/rufus.c index c7c118b4..f2854688 100644 --- a/src/rufus.c +++ b/src/rufus.c @@ -1937,7 +1937,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA SendMessage(hProgress, PBM_SETSTATE, (WPARAM)PBST_ERROR, 0); SetTaskbarProgressState(TASKBAR_ERROR); PrintStatus(0, FALSE, lmprintf(MSG_212)); - Notification(MSG_ERROR, NULL, lmprintf(MSG_042), lmprintf(MSG_043), StrError(FormatStatus)); + Notification(MSG_ERROR, NULL, lmprintf(MSG_042), lmprintf(MSG_043, StrError(FormatStatus)), StrError(FormatStatus)); } FormatStatus = 0; format_op_in_progress = FALSE; @@ -2171,10 +2171,10 @@ relaunch: GetUSBDevices(0); continue; } - // Alt-F => Toggle detection of fixed disks - // By default Rufus does not allow formatting USB fixed disk drives, such as USB HDDs - // This is a safety feature, to avoid someone unintentionally formatting a backup - // drive instead of an USB key. If this is enabled, Rufus will allow fixed disk formatting. + // Alt-F => Toggle detection of USB HDDs + // By default Rufus does not list USB HDDs. This is a safety feature aimed at avoiding + // unintentional formattings of backup drives instead of USB keys. + // When enabled, Rufus will list and allow the formatting of USB HDDs. if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'F')) { enable_HDDs = !enable_HDDs; PrintStatus2000(lmprintf(MSG_253), enable_HDDs); diff --git a/src/rufus.rc b/src/rufus.rc index f29d66bc..214092e9 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -33,7 +33,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 EXSTYLE WS_EX_APPWINDOW -CAPTION "Rufus v1.4.0.319" +CAPTION "Rufus v1.4.0.320" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "Start",IDC_START,94,291,50,14 @@ -288,8 +288,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,4,0,319 - PRODUCTVERSION 1,4,0,319 + FILEVERSION 1,4,0,320 + PRODUCTVERSION 1,4,0,320 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -306,13 +306,13 @@ BEGIN BEGIN VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "1.4.0.319" + VALUE "FileVersion", "1.4.0.320" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "© 2011-2013 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" VALUE "OriginalFilename", "rufus.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "1.4.0.319" + VALUE "ProductVersion", "1.4.0.320" END END BLOCK "VarFileInfo" diff --git a/src/smart.c b/src/smart.c index a03cbc38..87e95f2f 100644 --- a/src/smart.c +++ b/src/smart.c @@ -455,16 +455,18 @@ int IsHDD(DWORD DriveIndex, uint16_t vid, uint16_t pid, const char* strid) score -= 10; // Check the string against well known HDD identifiers - ilen = safe_strlen(strid); - for (i=0; i ilen) - break; - wc = (str_score[i].name[mlen-1] == '#'); - if ( (_strnicmp(strid, str_score[i].name, mlen-((wc)?1:0)) == 0) - && ((!wc) || ((strid[mlen] >= '0') && (strid[mlen] <= '9'))) ) { - score += str_score[i].score; - break; + if (strid != NULL) { + ilen = strlen(strid); + for (i=0; i ilen) + break; + wc = (str_score[i].name[mlen-1] == '#'); + if ( (_strnicmp(strid, str_score[i].name, mlen-((wc)?1:0)) == 0) + && ((!wc) || ((strid[mlen] >= '0') && (strid[mlen] <= '9'))) ) { + score += str_score[i].score; + break; + } } }