[iso] add smart testing for Rock Ridge over Joliet

* Some ISO9660 images (such as Ubuntu) use both Joliet and Rock Ridge,
  so we have to make a choice which should be preferred.
* Since Rock Ridge allows a greater filename length compared to Joliet,
  we perform our scan pass with Joliet disabled, to find out if RR is
  being used and if a filename longer than 64 chars exist. If that is
  the case, we'll perform the extraction using RR, else we'll use Joliet.
* Also add Alt-J and Alt-K to toggle Joliet/Rock Ridge
* Closes #178
This commit is contained in:
Pete Batard 2013-10-14 00:02:32 +01:00
parent 5b2e4d1721
commit 3c438db3fd
4 changed files with 47 additions and 15 deletions

View file

@ -99,7 +99,7 @@ static BOOL existing_key = FALSE; // For LGP set/restore
static BOOL size_check = TRUE;
static BOOL log_displayed = FALSE;
static BOOL iso_provided = FALSE;
extern BOOL force_large_fat32;
extern BOOL force_large_fat32, enable_joliet, enable_rockridge;
static int selection_default;
char msgbox[1024], msgbox_title[32];
@ -1034,8 +1034,10 @@ DWORD WINAPI ISOScanThread(LPVOID param)
safe_free(iso_path);
goto out;
}
uprintf("ISO label: '%s'\r\n Size: %lld bytes\r\n Has a >4GB file: %s\r\n Uses EFI: %s%s\r\n Uses Bootmgr: %s\r\n Uses WinPE: %s%s\r\n Uses isolinux: %s %s\n",
iso_report.label, iso_report.projected_size, iso_report.has_4GB_file?"Yes":"No", (iso_report.has_efi || iso_report.has_win7_efi)?"Yes":"No",
uprintf("ISO label: '%s'\r\n Size: %lld bytes\r\n Has a >64 chars filename: %s\r\n Has a >4GB file: %s\r\n"
" Uses EFI: %s%s\r\n Uses Bootmgr: %s\r\n Uses WinPE: %s%s\r\n Uses isolinux: %s %s\n",
iso_report.label, iso_report.projected_size, iso_report.has_long_filename?"Yes":"No",
iso_report.has_4GB_file?"Yes":"No", (iso_report.has_efi || iso_report.has_win7_efi)?"Yes":"No",
(iso_report.has_win7_efi && (!iso_report.has_efi))?" (win7_x64)":"", iso_report.has_bootmgr?"Yes":"No",
IS_WINPE(iso_report.winpe)?"Yes":"No", (iso_report.uses_minint)?" (with /minint)":"", iso_report.has_isolinux?"Yes":"No",
iso_report.has_syslinux_v5?"(v5.0 or later)":iso_report.has_isolinux?"(v4.x or earlier)":"");
@ -2056,12 +2058,27 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
existing_key = FALSE;
continue;
}
// Alt K => Toggle fake drive detection during bad blocks check
// Alt J => Toggle Joliet support for ISO9660 images
// Some ISOs (Ubuntu) have Joliet extensions but expect applications not to use them,
// due to their reliance on filenames that are > 64 chars (the Joliet max length for
// a file name). This option allows users to ignore Joliet when using such images.
if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'J')) {
enable_joliet = !enable_joliet;
PrintStatus2000("Joliet support", enable_joliet);
continue;
}
// Alt K => Toggle Rock Ridge support for ISO9660 image
if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'K')) {
enable_rockridge = !enable_rockridge;
PrintStatus2000("Rock Ridge support", enable_rockridge);
continue;
}
// Alt L => Toggle fake drive detection during bad blocks check
// By default, Rufus will check for fake USB flash drives that mistakenly present
// more capacity than they already have by looping over the flash. This check which
// is enabled by default is performed by writing the block number sequence and reading
// it back during the bad block check.
if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'K')) {
if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'L')) {
detect_fakes = !detect_fakes;
PrintStatus2000("Fake drive detection", detect_fakes);
continue;