diff --git a/src/iso.c b/src/iso.c index ac05e3fe..0567cafd 100644 --- a/src/iso.c +++ b/src/iso.c @@ -153,11 +153,11 @@ static BOOL check_iso_props(const char* psz_dirname, int64_t i_file_length, cons } // Check for the Grub config file - if ((safe_stricmp(psz_dirname, grub_dirname) == 0) && (safe_stricmp(psz_basename, grub_cfg) == 0)) { - if (scan_only) + if (scan_only) { + if ((safe_stricmp(psz_dirname, grub_dirname) == 0) && (safe_stricmp(psz_basename, grub_cfg) == 0)) iso_report.has_grub2 = TRUE; - else - props->is_grub_cfg = TRUE; + } else if (safe_stricmp(psz_basename, grub_cfg) == 0) { + props->is_grub_cfg = TRUE; } if (scan_only) { @@ -237,6 +237,7 @@ static BOOL check_iso_props(const char* psz_dirname, int64_t i_file_length, cons return FALSE; } +// Apply various workarounds to Linux config files static void fix_config(const char* psz_fullpath, const char* psz_path, const char* psz_basename, EXTRACT_PROPS* props) { size_t i, nul_pos; @@ -249,26 +250,31 @@ static void fix_config(const char* psz_fullpath, const char* psz_path, const cha for (i=0; iis_syslinux_cfg) { - // Workaround for isolinux config files requiring an ISO label for kernel - // append that may be different from our USB label. Oh, and these labels - // must have spaces converted to \x20. + // Workaround for config files requiring an ISO label for kernel append that may be + // different from our USB label. Oh, and these labels must have spaces converted to \x20. + if ((props->is_syslinux_cfg) || (props->is_grub_cfg)) { iso_label = replace_char(iso_report.label, ' ', "\\x20"); usb_label = replace_char(iso_report.usb_label, ' ', "\\x20"); if ((iso_label != NULL) && (usb_label != NULL)) { - if (replace_in_token_data(src, "append", iso_label, usb_label, TRUE) != NULL) + if (replace_in_token_data(src, (props->is_syslinux_cfg) ? "append" : "linuxefi", iso_label, usb_label, TRUE) != NULL) uprintf(" Patched %s: '%s' ⇨ '%s'\n", src, iso_label, usb_label); - // Fix dual BIOS + EFI support for tails and other ISOs - if ( (safe_stricmp(psz_path, efi_dirname) == 0) && (safe_stricmp(psz_basename, syslinux_cfg[0]) == 0) && - (!iso_report.has_efi_syslinux) && (dst = safe_strdup(src)) ) { - dst[nul_pos-12] = 's'; dst[nul_pos-11] = 'y'; dst[nul_pos-10] = 's'; - CopyFileA(src, dst, TRUE); - uprintf("Duplicated %s to %s\n", src, dst); - free(dst); - } } - } else if (props->is_grub_cfg) { - // Workaround for FreeNAS + safe_free(iso_label); + safe_free(usb_label); + } + + // Fix dual BIOS + EFI support for tails and other ISOs + if ( (props->is_syslinux_cfg) && (safe_stricmp(psz_path, efi_dirname) == 0) && + (safe_stricmp(psz_basename, syslinux_cfg[0]) == 0) && + (!iso_report.has_efi_syslinux) && (dst = safe_strdup(src)) ) { + dst[nul_pos-12] = 's'; dst[nul_pos-11] = 'y'; dst[nul_pos-10] = 's'; + CopyFileA(src, dst, TRUE); + uprintf("Duplicated %s to %s\n", src, dst); + free(dst); + } + + // Workaround for FreeNAS + if (props->is_grub_cfg) { iso_label = malloc(MAX_PATH); usb_label = malloc(MAX_PATH); if ((iso_label != NULL) && (usb_label != NULL)) { @@ -277,9 +283,10 @@ static void fix_config(const char* psz_fullpath, const char* psz_path, const cha if (replace_in_token_data(src, "set", iso_label, usb_label, TRUE) != NULL) uprintf(" Patched %s: '%s' ⇨ '%s'\n", src, iso_label, usb_label); } + safe_free(iso_label); + safe_free(usb_label); } - safe_free(iso_label); - safe_free(usb_label); + free(src); } diff --git a/src/parser.c b/src/parser.c index 3ba3ab5b..0a89a669 100644 --- a/src/parser.c +++ b/src/parser.c @@ -1145,8 +1145,8 @@ char* replace_in_token_data(const char* filename, const char* token, const char* break; } fseek(fd_in, 0, SEEK_SET); - duprintf("'%s' was detected as %s\n", filename, - (mode==0)?"ANSI/UTF8 (no BOM)":((mode==1)?"UTF8 (with BOM)":"UTF16 (with BOM")); +// duprintf("'%s' was detected as %s\n", filename, +// (mode==0)?"ANSI/UTF8 (no BOM)":((mode==1)?"UTF8 (with BOM)":"UTF16 (with BOM")); wtmpname = (wchar_t*)calloc(wcslen(wfilename)+2, sizeof(wchar_t)); diff --git a/src/rufus.rc b/src/rufus.rc index 92a6c000..7a9cf0a6 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -32,7 +32,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 -CAPTION "Rufus 2.3.697" +CAPTION "Rufus 2.3.698" FONT 8, "Segoe UI Symbol", 400, 0, 0x0 BEGIN LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8 @@ -298,8 +298,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,3,697,0 - PRODUCTVERSION 2,3,697,0 + FILEVERSION 2,3,698,0 + PRODUCTVERSION 2,3,698,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -316,13 +316,13 @@ BEGIN BEGIN VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "2.3.697" + VALUE "FileVersion", "2.3.698" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "© 2011-2015 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" VALUE "OriginalFilename", "rufus.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "2.3.697" + VALUE "ProductVersion", "2.3.698" END END BLOCK "VarFileInfo"