From 5024e7f65e076eb3c43b4c967b9b7e05aae3121c Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Wed, 2 Sep 2015 23:20:00 +0100 Subject: [PATCH] [internal] refactor iso_report -> img_report * Also set rufus-next to 2.4 --- configure | 20 +++--- configure.ac | 2 +- src/checksum.c | 4 +- src/format.c | 68 +++++++++---------- src/iso.c | 152 +++++++++++++++++++++--------------------- src/rufus.c | 177 ++++++++++++++++++++++++------------------------- src/rufus.h | 9 +-- src/rufus.rc | 10 +-- src/syslinux.c | 12 ++-- src/vhd.c | 27 ++++---- 10 files changed, 241 insertions(+), 240 deletions(-) diff --git a/configure b/configure index 061a0a64..bfd5c89f 100644 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for rufus 2.3. +# Generated by GNU Autoconf 2.69 for rufus 2.4. # # Report bugs to . # @@ -580,8 +580,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='rufus' PACKAGE_TARNAME='rufus' -PACKAGE_VERSION='2.3' -PACKAGE_STRING='rufus 2.3' +PACKAGE_VERSION='2.4' +PACKAGE_STRING='rufus 2.4' PACKAGE_BUGREPORT='https://github.com/pbatard/rufus/issues' PACKAGE_URL='http://rufus.akeo.ie' @@ -1228,7 +1228,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures rufus 2.3 to adapt to many kinds of systems. +\`configure' configures rufus 2.4 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1294,7 +1294,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of rufus 2.3:";; + short | recursive ) echo "Configuration of rufus 2.4:";; esac cat <<\_ACEOF @@ -1385,7 +1385,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -rufus configure 2.3 +rufus configure 2.4 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1440,7 +1440,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by rufus $as_me 2.3, which was +It was created by rufus $as_me 2.4, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2303,7 +2303,7 @@ fi # Define the identity of the package. PACKAGE='rufus' - VERSION='2.3' + VERSION='2.4' cat >>confdefs.h <<_ACEOF @@ -4480,7 +4480,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by rufus $as_me 2.3, which was +This file was extended by rufus $as_me 2.4, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4534,7 +4534,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -rufus config.status 2.3 +rufus config.status 2.4 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 7dc9174d..b42f1bfb 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([rufus], [2.3], [https://github.com/pbatard/rufus/issues], [rufus], [http://rufus.akeo.ie]) +AC_INIT([rufus], [2.4], [https://github.com/pbatard/rufus/issues], [rufus], [http://rufus.akeo.ie]) AM_INIT_AUTOMAKE([-Wno-portability foreign no-dist no-dependencies]) AC_CONFIG_SRCDIR([src/rufus.c]) AC_CONFIG_MACRO_DIR([m4]) diff --git a/src/checksum.c b/src/checksum.c index dbb20f3e..78aeb0da 100644 --- a/src/checksum.c +++ b/src/checksum.c @@ -626,10 +626,10 @@ DWORD WINAPI SumThread(void* param) for (rb = 0; ; rb += rSize) { if (GetTickCount() > LastRefresh + 25) { LastRefresh = GetTickCount(); - format_percent = (100.0f*rb) / (1.0f*iso_report.projected_size); + format_percent = (100.0f*rb) / (1.0f*img_report.projected_size); PrintInfo(0, MSG_271, format_percent); SendMessage(hProgress, PBM_SETPOS, (WPARAM)((format_percent/100.0f)*MAX_PROGRESS), 0); - SetTaskbarProgressValue(rb, iso_report.projected_size); + SetTaskbarProgressValue(rb, img_report.projected_size); } CHECK_FOR_USER_CANCEL; if (!ReadFile(h, buffer, sizeof(buffer), &rSize, NULL)) { diff --git a/src/format.c b/src/format.c index 5a0b25d8..76b64eb5 100644 --- a/src/format.c +++ b/src/format.c @@ -303,7 +303,7 @@ static void ToValidLabel(WCHAR* name, BOOL bFAT) } // Needed for disk by label isolinux.cfg workaround - wchar_to_utf8_no_alloc(name, iso_report.usb_label, sizeof(iso_report.usb_label)); + wchar_to_utf8_no_alloc(name, img_report.usb_label, sizeof(img_report.usb_label)); } /* @@ -929,21 +929,21 @@ static BOOL WriteMBR(HANDLE hPhysicalDrive) // Syslinux if ( (bt == BT_SYSLINUX_V4) || (bt == BT_SYSLINUX_V6) || - ((bt == BT_ISO) && (HAS_SYSLINUX(iso_report)) && (IS_FAT(fs))) ) { + ((bt == BT_ISO) && (HAS_SYSLINUX(img_report)) && (IS_FAT(fs))) ) { uprintf(using_msg, "Syslinux"); r = write_syslinux_mbr(fp); goto notify; } // Grub 2.0 - if ( ((bt == BT_ISO) && (iso_report.has_grub2)) || (bt == BT_GRUB2) ) { + if ( ((bt == BT_ISO) && (img_report.has_grub2)) || (bt == BT_GRUB2) ) { uprintf(using_msg, "Grub 2.0"); r = write_grub2_mbr(fp); goto notify; } // Grub4DOS - if ( ((bt == BT_ISO) && (iso_report.has_grub4dos)) || (bt == BT_GRUB4DOS) ) { + if ( ((bt == BT_ISO) && (img_report.has_grub4dos)) || (bt == BT_GRUB4DOS) ) { uprintf(using_msg, "Grub4DOS"); r = write_grub_mbr(fp); goto notify; @@ -957,7 +957,7 @@ static BOOL WriteMBR(HANDLE hPhysicalDrive) } // KolibriOS - if ( (bt == BT_ISO) && (iso_report.has_kolibrios) && (IS_FAT(fs))) { + if ( (bt == BT_ISO) && (img_report.has_kolibrios) && (IS_FAT(fs))) { uprintf(using_msg, "KolibriOS"); r = write_kolibri_mbr(fp); goto notify; @@ -965,7 +965,7 @@ static BOOL WriteMBR(HANDLE hPhysicalDrive) // If everything else failed, fall back to a conventional Windows/Rufus MBR windows_mbr: - if ((IS_WINPE(iso_report.winpe) && !iso_report.uses_minint) || (IsChecked(IDC_RUFUS_MBR))) { + if ((IS_WINPE(img_report.winpe) && !img_report.uses_minint) || (IsChecked(IDC_RUFUS_MBR))) { uprintf(using_msg, APPLICATION_NAME); r = write_rufus_mbr(fp); } else { @@ -1002,10 +1002,10 @@ static BOOL WriteSBR(HANDLE hPhysicalDrive) (DWORD)(SelectedDrive.Geometry.BytesPerSector * SelectedDrive.Geometry.SectorsPerTrack) : 1024 * 1024; max_size -= mbr_size; // Syslinux has precedence over Grub - if ((bt == BT_ISO) && (!HAS_SYSLINUX(iso_report))) { - if (iso_report.has_grub4dos) + if ((bt == BT_ISO) && (!HAS_SYSLINUX(img_report))) { + if (img_report.has_grub4dos) bt = BT_GRUB4DOS; - if (iso_report.has_grub2) + if (img_report.has_grub2) bt = BT_GRUB2; } @@ -1056,7 +1056,7 @@ static __inline const char* bt_to_name(int bt) { case BT_FREEDOS: return "FreeDOS"; case BT_REACTOS: return "ReactOS"; default: - return ((bt==BT_ISO)&&(iso_report.has_kolibrios))?"KolibriOS":"Standard"; + return ((bt==BT_ISO)&&(img_report.has_kolibrios))?"KolibriOS":"Standard"; } } static BOOL WritePBR(HANDLE hLogicalVolume) @@ -1082,7 +1082,7 @@ static BOOL WritePBR(HANDLE hLogicalVolume) if (!write_fat_16_fd_br(fp, 0)) break; } else if (bt == BT_REACTOS) { if (!write_fat_16_ros_br(fp, 0)) break; - } else if ((bt == BT_ISO) && (iso_report.has_kolibrios)) { + } else if ((bt == BT_ISO) && (img_report.has_kolibrios)) { uprintf("FAT16 is not supported for KolibriOS\n"); break; } else { if (!write_fat_16_br(fp, 0)) break; @@ -1104,7 +1104,7 @@ static BOOL WritePBR(HANDLE hLogicalVolume) if (!write_fat_32_fd_br(fp, 0)) break; } else if (bt == BT_REACTOS) { if (!write_fat_32_ros_br(fp, 0)) break; - } else if ((bt == BT_ISO) && (iso_report.has_kolibrios)) { + } else if ((bt == BT_ISO) && (img_report.has_kolibrios)) { if (!write_fat_32_kos_br(fp, 0)) break; } else { if (!write_fat_32_br(fp, 0)) break; @@ -1152,7 +1152,7 @@ static BOOL SetupWinPE(char drive_letter) BOOL r = FALSE; char* buf = NULL; - index = ((iso_report.winpe&WINPE_I386) == WINPE_I386)?0:1; + index = ((img_report.winpe&WINPE_I386) == WINPE_I386)?0:1; // Allow other values than harddisk 1, as per user choice for disk ID safe_sprintf(setupsrcdev, sizeof(setupsrcdev), "SetupSourceDevice = \"\\device\\harddisk%d\\partition1\"", ComboBox_GetCurSel(hDiskID)); @@ -1160,7 +1160,7 @@ static BOOL SetupWinPE(char drive_letter) safe_sprintf(src, sizeof(src), "%c:\\%s\\ntdetect.com", drive_letter, basedir[index]); safe_sprintf(dst, sizeof(dst), "%c:\\ntdetect.com", drive_letter); CopyFileA(src, dst, TRUE); - if (!iso_report.uses_minint) { + if (!img_report.uses_minint) { // Create a copy of txtsetup.sif, as we want to keep the i386 files unmodified safe_sprintf(src, sizeof(src), "%c:\\%s\\txtsetup.sif", drive_letter, basedir[index]); safe_sprintf(dst, sizeof(dst), "%c:\\txtsetup.sif", drive_letter); @@ -1182,11 +1182,11 @@ static BOOL SetupWinPE(char drive_letter) // \minint with /minint option doesn't require further processing => return true // \minint and no \i386 without /minint is unclear => return error - if (iso_report.winpe&WINPE_MININT) { - if (iso_report.uses_minint) { + if (img_report.winpe&WINPE_MININT) { + if (img_report.uses_minint) { uprintf("Detected \\minint directory with /minint option: nothing to patch\n"); r = TRUE; - } else if (!(iso_report.winpe&WINPE_I386)) { + } else if (!(img_report.winpe&WINPE_I386)) { uprintf("Detected \\minint directory only but no /minint option: not sure what to do\n"); } goto out; @@ -1231,7 +1231,7 @@ static BOOL SetupWinPE(char drive_letter) } } - if (!iso_report.uses_minint) { + if (!img_report.uses_minint) { // Additional setupldr.bin/bootmgr patching for (i=0; i rdisk(#) disk masquerading @@ -1310,7 +1310,7 @@ BOOL SetupWinToGo(const char* drive_name, BOOL use_ms_efi) uprintf("Mounted ISO as '%s'", mounted_iso); // Now we use the WIM API to apply that image - static_sprintf(image, "%s%s", mounted_iso, &iso_report.install_wim_path[2]); + static_sprintf(image, "%s%s", mounted_iso, &img_report.install_wim_path[2]); if (!WimApplyImage(image, 1, drive_name)) { uprintf("Failed to apply Windows To Go image"); if (!IS_ERROR(FormatStatus)) @@ -1460,7 +1460,7 @@ void update_progress(const uint64_t processed_bytes) { if (GetTickCount() > LastRefresh + 25) { LastRefresh = GetTickCount(); - format_percent = (100.0f*processed_bytes)/(1.0f*iso_report.projected_size); + format_percent = (100.0f*processed_bytes)/(1.0f*img_report.projected_size); PrintInfo(0, MSG_261, format_percent); UpdateProgress(OP_FORMAT, format_percent); } @@ -1509,14 +1509,14 @@ DWORD WINAPI FormatThread(void* param) pt = GETPARTTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme))); tt = GETTARGETTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme))); use_large_fat32 = (fs == FS_FAT32) && ((SelectedDrive.DiskSize > LARGE_FAT32_SIZE) || (force_large_fat32)); - windows_to_go = (togo_mode) && HAS_TOGO(iso_report) && (Button_GetCheck(GetDlgItem(hMainDialog, IDC_WINDOWS_TO_GO)) == BST_CHECKED); + windows_to_go = (togo_mode) && HAS_TOGO(img_report) && (Button_GetCheck(GetDlgItem(hMainDialog, IDC_WINDOWS_TO_GO)) == BST_CHECKED); // Find out if we need to add any extra partitions if ((windows_to_go) && (tt == TT_UEFI) && (pt == PARTITION_STYLE_GPT)) // According to Microsoft, every GPT disk (we RUN Windows from) must have an MSR due to not having hidden sectors // http://msdn.microsoft.com/en-us/library/windows/hardware/dn640535.aspx#gpt_faq_what_disk_require_msr extra_partitions = XP_MSR | XP_EFI; else if ( (fs == FS_NTFS) && ((bt == BT_UEFI_NTFS) || - ((bt == BT_ISO) && (iso_report.has_efi) && ((tt == TT_UEFI) || (windows_to_go) || (allow_dual_uefi_bios)))) ) + ((bt == BT_ISO) && (img_report.has_efi) && ((tt == TT_UEFI) || (windows_to_go) || (allow_dual_uefi_bios)))) ) extra_partitions = XP_UEFI_NTFS; else if (IsChecked(IDC_EXTRA_PARTITION)) extra_partitions = XP_COMPAT; @@ -1674,10 +1674,10 @@ DWORD WINAPI FormatThread(void* param) } LastRefresh = 0; - if (iso_report.compression_type != BLED_COMPRESSION_NONE) { + if (img_report.compression_type != BLED_COMPRESSION_NONE) { uprintf("Writing Compressed Image..."); bled_init(_uprintf, update_progress, &FormatStatus); - bled_uncompress_with_handles(hSourceImage, hPhysicalDrive, iso_report.compression_type); + bled_uncompress_with_handles(hSourceImage, hPhysicalDrive, img_report.compression_type); bled_exit(); } else { uprintf("Writing Image..."); @@ -1706,13 +1706,13 @@ DWORD WINAPI FormatThread(void* param) break; if (GetTickCount() > LastRefresh + 25) { LastRefresh = GetTickCount(); - format_percent = (100.0f*wb)/(1.0f*iso_report.projected_size); + format_percent = (100.0f*wb)/(1.0f*img_report.projected_size); PrintInfo(0, MSG_261, format_percent); UpdateProgress(OP_FORMAT, format_percent); } // Don't overflow our projected size (mostly for VHDs) - if (wb + rSize > iso_report.projected_size) { - rSize = (DWORD)(iso_report.projected_size - wb); + if (wb + rSize > img_report.projected_size) { + rSize = (DWORD)(img_report.projected_size - wb); } // WriteFile fails unless the size is a multiple of sector size if (rSize % SectorSize != 0) @@ -1826,13 +1826,13 @@ DWORD WINAPI FormatThread(void* param) // All good } else if (tt == TT_UEFI) { // For once, no need to do anything - just check our sanity - if ( (bt != BT_ISO) || (!iso_report.has_efi) || (fs > FS_NTFS) ) { + if ( (bt != BT_ISO) || (!img_report.has_efi) || (fs > FS_NTFS) ) { uprintf("Spock gone crazy error!\n"); FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_INSTALL_FAILURE; goto out; } } else if ( (bt == BT_SYSLINUX_V4) || (bt == BT_SYSLINUX_V6) || - ((bt == BT_ISO) && (HAS_SYSLINUX(iso_report) || IS_REACTOS(iso_report)) && + ((bt == BT_ISO) && (HAS_SYSLINUX(img_report) || IS_REACTOS(img_report)) && (!allow_dual_uefi_bios) && (IS_FAT(fs))) ) { if (!InstallSyslinux(DriveIndex, drive_name[0], fs)) { FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_INSTALL_FAILURE; @@ -1902,7 +1902,7 @@ DWORD WINAPI FormatThread(void* param) FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|APPERR(ERROR_ISO_EXTRACT); goto out; } - if (iso_report.has_kolibrios) { + if (img_report.has_kolibrios) { kolibri_dst[0] = drive_name[0]; uprintf("Installing: %s (KolibriOS loader)\n", kolibri_dst); if (ExtractISOFile(image_path, "HD_Load/USB_Boot/MTLD_F32", kolibri_dst, @@ -1911,9 +1911,9 @@ DWORD WINAPI FormatThread(void* param) } } // EFI mode selected, with no 'boot###.efi' but Windows 7 x64's 'bootmgr.efi' (bit #0) - if ((tt == TT_UEFI) && IS_WIN7_EFI(iso_report)) { + if ((tt == TT_UEFI) && IS_WIN7_EFI(img_report)) { PrintInfoDebug(0, MSG_232); - iso_report.install_wim_path[0] = drive_name[0]; + img_report.install_wim_path[0] = drive_name[0]; efi_dst[0] = drive_name[0]; efi_dst[sizeof(efi_dst) - sizeof("\\bootx64.efi")] = 0; if (!CreateDirectoryA(efi_dst, 0)) { @@ -1921,13 +1921,13 @@ DWORD WINAPI FormatThread(void* param) FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|APPERR(ERROR_CANT_PATCH); } else { efi_dst[sizeof(efi_dst) - sizeof("\\bootx64.efi")] = '\\'; - if (!WimExtractFile(iso_report.install_wim_path, 1, "Windows\\Boot\\EFI\\bootmgfw.efi", efi_dst)) { + if (!WimExtractFile(img_report.install_wim_path, 1, "Windows\\Boot\\EFI\\bootmgfw.efi", efi_dst)) { uprintf("Failed to setup Win7 EFI boot\n"); FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|APPERR(ERROR_CANT_PATCH); } } } - if ( (tt == TT_BIOS) && (IS_WINPE(iso_report.winpe)) ) { + if ( (tt == TT_BIOS) && (IS_WINPE(img_report.winpe)) ) { // Apply WinPe fixup if (!SetupWinPE(drive_name[0])) FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|APPERR(ERROR_CANT_PATCH); diff --git a/src/iso.c b/src/iso.c index 443162c9..0db138b1 100644 --- a/src/iso.c +++ b/src/iso.c @@ -60,7 +60,7 @@ typedef struct { BOOLEAN is_old_c32[NB_OLD_C32]; } EXTRACT_PROPS; -RUFUS_ISO_REPORT iso_report; +RUFUS_IMG_REPORT img_report; int64_t iso_blocking_status = -1; BOOL enable_iso = TRUE, enable_joliet = TRUE, enable_rockridge = TRUE, preserve_timestamps = FALSE, has_ldlinux_c32; #define ISO_BLOCKING(x) do {x; iso_blocking_status++; } while(0) @@ -144,7 +144,7 @@ static BOOL check_iso_props(const char* psz_dirname, int64_t i_file_length, cons if (safe_stricmp(psz_basename, syslinux_cfg[i]) == 0) { props->is_syslinux_cfg = TRUE; if ((scan_only) && (i == 1) && (safe_stricmp(psz_dirname, efi_dirname) == 0)) - iso_report.has_efi_syslinux = TRUE; + img_report.has_efi_syslinux = TRUE; } } @@ -157,7 +157,7 @@ static BOOL check_iso_props(const char* psz_dirname, int64_t i_file_length, cons // Check for the Grub config file if (scan_only) { if ((safe_stricmp(psz_dirname, grub_dirname) == 0) && (safe_stricmp(psz_basename, grub_cfg) == 0)) - iso_report.has_grub2 = TRUE; + img_report.has_grub2 = TRUE; } else if (safe_stricmp(psz_basename, grub_cfg) == 0) { props->is_grub_cfg = TRUE; } @@ -171,35 +171,35 @@ static BOOL check_iso_props(const char* psz_dirname, int64_t i_file_length, cons // Check for various files in root (psz_dirname = "") if (*psz_dirname == 0) { if (safe_strnicmp(psz_basename, bootmgr_efi_name, safe_strlen(bootmgr_efi_name)-5) == 0) { - iso_report.has_bootmgr = TRUE; + img_report.has_bootmgr = TRUE; } if (safe_stricmp(psz_basename, grldr_name) == 0) { - iso_report.has_grub4dos = TRUE; + img_report.has_grub4dos = TRUE; } if (safe_stricmp(psz_basename, kolibri_name) == 0) { - iso_report.has_kolibrios = TRUE; + img_report.has_kolibrios = TRUE; } if (safe_stricmp(psz_basename, bootmgr_efi_name) == 0) { - iso_report.has_efi |= 1; + img_report.has_efi |= 1; } } // Check for ReactOS' setupldr.sys anywhere - if ((iso_report.reactos_path[0] == 0) && (safe_stricmp(psz_basename, reactos_name) == 0)) - safe_strcpy(iso_report.reactos_path, sizeof(iso_report.reactos_path), psz_fullpath); + if ((img_report.reactos_path[0] == 0) && (safe_stricmp(psz_basename, reactos_name) == 0)) + safe_strcpy(img_report.reactos_path, sizeof(img_report.reactos_path), psz_fullpath); // Check for the EFI boot entries if (safe_stricmp(psz_dirname, efi_dirname) == 0) { for (i=0; iis_syslinux_cfg) { // Maintain a list of all the isolinux/syslinux configs identified so far @@ -220,10 +220,10 @@ static BOOL check_iso_props(const char* psz_dirname, int64_t i_file_length, cons for (i=0; iis_old_c32[i]) - iso_report.has_old_c32[i] = TRUE; + img_report.has_old_c32[i] = TRUE; } if (i_file_length >= FOUR_GIGABYTES) - iso_report.has_4GB_file = TRUE; + img_report.has_4GB_file = TRUE; // Compute projected size needed total_blocks += i_file_length/UDF_BLOCKSIZE; // NB: ISO_BLOCKSIZE = UDF_BLOCKSIZE @@ -255,8 +255,8 @@ static void fix_config(const char* psz_fullpath, const char* psz_path, const cha // 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"); + iso_label = replace_char(img_report.label, ' ', "\\x20"); + usb_label = replace_char(img_report.usb_label, ' ', "\\x20"); if ((iso_label != NULL) && (usb_label != 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); @@ -268,7 +268,7 @@ static void fix_config(const char* psz_fullpath, const char* psz_path, const cha // 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)) ) { + (!img_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); @@ -280,8 +280,8 @@ static void fix_config(const char* psz_fullpath, const char* psz_path, const cha iso_label = malloc(MAX_PATH); usb_label = malloc(MAX_PATH); if ((iso_label != NULL) && (usb_label != NULL)) { - safe_sprintf(iso_label, MAX_PATH, "cd9660:/dev/iso9660/%s", iso_report.label); - safe_sprintf(usb_label, MAX_PATH, "msdosfs:/dev/msdosfs/%s", iso_report.usb_label); + safe_sprintf(iso_label, MAX_PATH, "cd9660:/dev/iso9660/%s", img_report.label); + safe_sprintf(usb_label, MAX_PATH, "msdosfs:/dev/msdosfs/%s", img_report.usb_label); if (replace_in_token_data(src, "set", iso_label, usb_label, TRUE) != NULL) uprintf(" Patched %s: '%s' ⇨ '%s'\n", src, iso_label, usb_label); } @@ -513,12 +513,12 @@ static int iso_extract_files(iso9660_t* p_iso, const char *psz_path) if ((p_statbuf->rr.b3_rock == yep) && enable_rockridge) { safe_strcpy(psz_basename, sizeof(psz_fullpath)-i_length-1, p_statbuf->filename); if (safe_strlen(p_statbuf->filename) > 64) - iso_report.has_long_filename = TRUE; + img_report.has_long_filename = TRUE; // libcdio has a memleak for Rock Ridge symlinks. It doesn't look like there's an easy fix there as // a generic list that's unaware of RR extensions is being used, so we prevent that memleak ourselves is_symlink = (p_statbuf->rr.psz_symlink != NULL); if (is_symlink) - iso_report.has_symlinks = TRUE; + img_report.has_symlinks = TRUE; if (scan_only) safe_free(p_statbuf->rr.psz_symlink); } else { @@ -623,12 +623,12 @@ void GetGrubVersion(char* buf, size_t buf_size) for (i=0; i "KASPERSKYYYYYY!!!..." (https://github.com/pbatard/rufus/issues/467) // But seriously, these guys should know better than "security" through obscurity... - if (iso_report.grub2_version[0] == '0') - iso_report.grub2_version[0] = 0; + if (img_report.grub2_version[0] == '0') + img_report.grub2_version[0] = 0; } BOOL ExtractISO(const char* src_iso, const char* dest_dir, BOOL scan) @@ -670,7 +670,7 @@ BOOL ExtractISO(const char* src_iso, const char* dest_dir, BOOL scan) uprintf("ISO analysis:"); SendMessage(hMainDialog, UM_PROGRESS_INIT, PBS_MARQUEE, 0); total_blocks = 0; - memset(&iso_report, 0, sizeof(iso_report)); + memset(&img_report, 0, sizeof(img_report)); has_ldlinux_c32 = FALSE; // String array of all isolinux/syslinux locations StrArrayCreate(&config_path, 8); @@ -701,8 +701,8 @@ BOOL ExtractISO(const char* src_iso, const char* dest_dir, BOOL scan) goto out; } if (scan_only) { - if (udf_get_logical_volume_id(p_udf, iso_report.label, sizeof(iso_report.label)) <= 0) - iso_report.label[0] = 0; + if (udf_get_logical_volume_id(p_udf, img_report.label, sizeof(img_report.label)) <= 0) + img_report.label[0] = 0; } r = udf_extract_files(p_udf, p_udf_root, ""); goto out; @@ -711,7 +711,7 @@ try_iso: // Perform our first scan with Joliet disabled (if Rock Ridge is enabled), so that we can find if // there exists a Rock Ridge file with a name > 64 chars or if there are symlinks. If that is the // case then we also disable Joliet during the extract phase. - if ((!enable_joliet) || (enable_rockridge && (scan_only || iso_report.has_long_filename || iso_report.has_symlinks))) { + if ((!enable_joliet) || (enable_rockridge && (scan_only || img_report.has_long_filename || img_report.has_symlinks))) { iso_extension_mask &= ~ISO_EXTENSION_JOLIET; } if (!enable_rockridge) { @@ -728,10 +728,10 @@ try_iso: i_joliet_level = iso9660_ifs_get_joliet_level(p_iso); if (scan_only) { if (iso9660_ifs_get_volume_id(p_iso, &tmp)) { - safe_strcpy(iso_report.label, sizeof(iso_report.label), tmp); + safe_strcpy(img_report.label, sizeof(img_report.label), tmp); safe_free(tmp); } else - iso_report.label[0] = 0; + img_report.label[0] = 0; } else { if (iso_extension_mask & (ISO_EXTENSION_JOLIET|ISO_EXTENSION_ROCK_RIDGE)) uprintf("%sThis image will be extracted using %s extensions (if present)", spacing, @@ -745,18 +745,18 @@ out: iso_blocking_status = -1; if (scan_only) { // Remove trailing spaces from the label - for (j=(int)safe_strlen(iso_report.label)-1; ((j>=0)&&(isspaceU(iso_report.label[j]))); j--) - iso_report.label[j] = 0; + for (j=(int)safe_strlen(img_report.label)-1; ((j>=0)&&(isspaceU(img_report.label[j]))); j--) + img_report.label[j] = 0; // We use the fact that UDF_BLOCKSIZE and ISO_BLOCKSIZE are the same here - iso_report.projected_size = total_blocks * ISO_BLOCKSIZE; + img_report.projected_size = total_blocks * ISO_BLOCKSIZE; // We will link the existing isolinux.cfg from a syslinux.cfg we create // If multiple config files exist, choose the one with the shortest path // (so that a '/syslinux.cfg' is preferred over a '/isolinux/isolinux.cfg') if (!IsStrArrayEmpty(config_path)) { - // Set the iso_report.cfg_path string to maximum length, so that we don't have to + // Set the img_report.cfg_path string to maximum length, so that we don't have to // do a special case for StrArray entry 0. - memset(iso_report.cfg_path, '_', sizeof(iso_report.cfg_path)-1); - iso_report.cfg_path[sizeof(iso_report.cfg_path)-1] = 0; + memset(img_report.cfg_path, '_', sizeof(img_report.cfg_path)-1); + img_report.cfg_path[sizeof(img_report.cfg_path)-1] = 0; for (i=0; i= safe_strlen(config_path.String[i])) - safe_strcpy(iso_report.cfg_path, sizeof(iso_report.cfg_path), config_path.String[i]); + if (safe_strlen(img_report.cfg_path) >= safe_strlen(config_path.String[i])) + safe_strcpy(img_report.cfg_path, sizeof(img_report.cfg_path), config_path.String[i]); } - uprintf(" Will use '%s' for Syslinux", iso_report.cfg_path); + uprintf(" Will use '%s' for Syslinux", img_report.cfg_path); // Extract all of the isolinux.bin files we found to identify their versions for (i=0; i= 5)) ) + img_report.sl_version_str, img_report.sl_version_ext, isolinux_path.String[j]); + if ( (has_ldlinux_c32 && (SL_MAJOR(img_report.sl_version) < 5)) + || (!has_ldlinux_c32 && (SL_MAJOR(img_report.sl_version) >= 5)) ) uprintf(" Warning: Conflict between Isolinux version and the presence of ldlinux.c32..."); } else { // Couldn't find a version from isolinux.bin. Force set to the versions we embed - iso_report.sl_version = embedded_sl_version[has_ldlinux_c32?1:0]; - static_sprintf(iso_report.sl_version_str, "%d.%02d", - SL_MAJOR(iso_report.sl_version), SL_MINOR(iso_report.sl_version)); + img_report.sl_version = embedded_sl_version[has_ldlinux_c32?1:0]; + static_sprintf(img_report.sl_version_str, "%d.%02d", + SL_MAJOR(img_report.sl_version), SL_MINOR(img_report.sl_version)); uprintf(" Warning: Could not detect Isolinux version - Forcing to %s (embedded)", - iso_report.sl_version_str); + img_report.sl_version_str); } } - if (IS_WINPE(iso_report.winpe)) { + if (IS_WINPE(img_report.winpe)) { // In case we have a WinPE 1.x based iso, we extract and parse txtsetup.sif // during scan, to see if /minint was provided for OsLoadOptions, as it decides // whether we should use 0x80 or 0x81 as the disk ID in the MBR safe_sprintf(path, sizeof(path), "/%s/txtsetup.sif", - basedir[((iso_report.winpe&WINPE_I386) == WINPE_I386)?0:1]); + basedir[((img_report.winpe&WINPE_I386) == WINPE_I386)?0:1]); ExtractISOFile(src_iso, path, tmp_sif, FILE_ATTRIBUTE_NORMAL); tmp = get_token_data_file("OsLoadOptions", tmp_sif); if (tmp != NULL) { for (i=0; i0)&&(iso_report.cfg_path[i]!='/'); i--); + fprintf(fd, "DEFAULT loadconfig\n\nLABEL loadconfig\n CONFIG %s\n", img_report.cfg_path); + for (i=safe_strlen(img_report.cfg_path); (i>0)&&(img_report.cfg_path[i]!='/'); i--); if (i>0) { - iso_report.cfg_path[i] = 0; - fprintf(fd, " APPEND %s/\n", iso_report.cfg_path); - iso_report.cfg_path[i] = '/'; + img_report.cfg_path[i] = 0; + fprintf(fd, " APPEND %s/\n", img_report.cfg_path); + img_report.cfg_path[i] = '/'; } uprintf("Created: %s", path); } @@ -1022,7 +1022,7 @@ uint32_t GetInstallWimVersion(const char* iso) udf_dirent_t *p_udf_root = NULL, *p_udf_file = NULL; iso9660_stat_t *p_statbuf = NULL; - wim_path = safe_strdup(&iso_report.install_wim_path[2]); + wim_path = safe_strdup(&img_report.install_wim_path[2]); for (p = wim_path; p != 0; p++) if (*p == '\\') *p = '/'; diff --git a/src/rufus.c b/src/rufus.c index f8e9e20a..a8981748 100644 --- a/src/rufus.c +++ b/src/rufus.c @@ -415,7 +415,7 @@ static void SetMBRForUEFI(BOOL replace) return; if (image_path != NULL) { - if ( (!iso_report.has_efi) || ((iso_report.has_bootmgr) && (!allow_dual_uefi_bios) && + if ( (!img_report.has_efi) || ((img_report.has_bootmgr) && (!allow_dual_uefi_bios) && (Button_GetCheck(GetDlgItem(hMainDialog, IDC_WINDOWS_TO_GO)) != BST_CHECKED)) ) useCSM = TRUE; } @@ -501,7 +501,7 @@ static void SetFSFromISO(void) int i, fs, selected_fs = FS_UNKNOWN; uint32_t fs_mask = 0; int tt = GETTARGETTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme))); - BOOL windows_to_go = (togo_mode) && HAS_TOGO(iso_report) && + BOOL windows_to_go = (togo_mode) && HAS_TOGO(img_report) && (Button_GetCheck(GetDlgItem(hMainDialog, IDC_WINDOWS_TO_GO)) == BST_CHECKED); if (image_path == NULL) @@ -514,14 +514,14 @@ static void SetFSFromISO(void) } // Syslinux and EFI have precedence over bootmgr (unless the user selected BIOS as target type) - if ((HAS_SYSLINUX(iso_report)) || (IS_REACTOS(iso_report)) || (iso_report.has_kolibrios) || - ((iso_report.has_efi) && (tt == TT_UEFI) && (!iso_report.has_4GB_file) && (!windows_to_go))) { + if ((HAS_SYSLINUX(img_report)) || (IS_REACTOS(img_report)) || (img_report.has_kolibrios) || + ((img_report.has_efi) && (tt == TT_UEFI) && (!img_report.has_4GB_file) && (!windows_to_go))) { if (fs_mask & (1<64 chars filename: %s", YesNo(iso_report.has_long_filename)); - uprintf(" Has Symlinks: %s", YesNo(iso_report.has_symlinks)); - uprintf(" Has a >4GB file: %s", YesNo(iso_report.has_4GB_file)); - uprintf(" Uses Bootmgr: %s", YesNo(iso_report.has_bootmgr)); - uprintf(" Uses EFI: %s%s", YesNo(iso_report.has_efi), IS_WIN7_EFI(iso_report) ? " (win7_x64)" : ""); - uprintf(" Uses Grub 2: %s", YesNo(iso_report.has_grub2)); - uprintf(" Uses Grub4DOS: %s", YesNo(iso_report.has_grub4dos)); + uprintf("ISO label: '%s'", img_report.label); + uprintf(" Size: %" PRIu64 " bytes", img_report.projected_size); + uprintf(" Has a >64 chars filename: %s", YesNo(img_report.has_long_filename)); + uprintf(" Has Symlinks: %s", YesNo(img_report.has_symlinks)); + uprintf(" Has a >4GB file: %s", YesNo(img_report.has_4GB_file)); + uprintf(" Uses Bootmgr: %s", YesNo(img_report.has_bootmgr)); + uprintf(" Uses EFI: %s%s", YesNo(img_report.has_efi), IS_WIN7_EFI(img_report) ? " (win7_x64)" : ""); + uprintf(" Uses Grub 2: %s", YesNo(img_report.has_grub2)); + uprintf(" Uses Grub4DOS: %s", YesNo(img_report.has_grub4dos)); uprintf(" Uses isolinux: %s", isolinux_str); - if (HAS_SYSLINUX(iso_report) && (SL_MAJOR(iso_report.sl_version) < 5)) { + if (HAS_SYSLINUX(img_report) && (SL_MAJOR(img_report.sl_version) < 5)) { for (i = 0; i> 24) & 0xff, - (iso_report.install_wim_version >> 16) & 0xff, (iso_report.install_wim_version >> 8) & 0xff); + uprintf(" Uses KolibriOS: %s", YesNo(img_report.has_kolibrios)); + uprintf(" Uses ReactOS: %s", YesNo(IS_REACTOS(img_report))); + uprintf(" Uses WinPE: %s%s", YesNo(IS_WINPE(img_report.winpe)), (img_report.uses_minint) ? " (with /minint)" : ""); + if (HAS_INSTALL_WIM(img_report)) { + uprintf(" Uses Install.wim: Yes (version %d.%d.%d)", (img_report.install_wim_version >> 24) & 0xff, + (img_report.install_wim_version >> 16) & 0xff, (img_report.install_wim_version >> 8) & 0xff); // Microsoft somehow managed to make their ESD WIMs incompatible with their own APIs // (yes, EVEN the Windows 10 APIs), so we must filter them out... - if (iso_report.install_wim_version >= MAX_WIM_VERSION) + if (img_report.install_wim_version >= MAX_WIM_VERSION) uprintf(" Note: This WIM version is NOT compatible with Windows To Go"); } // We don't support ToGo on Windows 7 or earlier, for lack of ISO mount capabilities // TODO: add install.wim extraction workaround for Windows 7 if (nWindowsVersion >= WINDOWS_8) - if ( ((!togo_mode) && (HAS_TOGO(iso_report))) || ((togo_mode) && (!HAS_TOGO(iso_report))) ) + if ( ((!togo_mode) && (HAS_TOGO(img_report))) || ((togo_mode) && (!HAS_TOGO(img_report))) ) ToggleToGo(); } @@ -1022,16 +1022,15 @@ static void DisplayISOProps(void) DWORD WINAPI ISOScanThread(LPVOID param) { int i; - BOOL is_iso, is_img; if (image_path == NULL) goto out; PrintInfoDebug(0, MSG_202); user_notified = FALSE; EnableControls(FALSE); - is_iso = ExtractISO(image_path, "", TRUE); - is_img = IsHDImage(image_path); - if (!is_iso && !is_img) { + img_report.is_iso = ExtractISO(image_path, "", TRUE); + img_report.is_bootable_img = IsBootableImage(image_path); + if (!img_report.is_iso && !img_report.is_bootable_img) { SendMessage(hMainDialog, UM_PROGRESS_EXIT, 0, 0); PrintInfoDebug(0, MSG_203); safe_free(image_path); @@ -1042,20 +1041,20 @@ DWORD WINAPI ISOScanThread(LPVOID param) goto out; } - if (is_img) { + if (img_report.is_bootable_img) { uprintf(" Image is a %sbootable %s image", - (iso_report.compression_type != BLED_COMPRESSION_NONE) ? "compressed " : "", iso_report.is_vhd ? "VHD" : "disk"); + (img_report.compression_type != BLED_COMPRESSION_NONE) ? "compressed " : "", img_report.is_vhd ? "VHD" : "disk"); selection_default = BT_IMG; } - if (is_iso) { + if (img_report.is_iso) { // Will override BT_IMG above for ISOHybrid selection_default = BT_ISO; DisplayISOProps(); } // Only enable AFTER we have determined the image type EnableControls(TRUE); - if ( (!iso_report.has_bootmgr) && (!HAS_SYSLINUX(iso_report)) && (!IS_WINPE(iso_report.winpe)) && (!IS_GRUB(iso_report)) - && (!iso_report.has_efi) && (!IS_REACTOS(iso_report) && (!iso_report.has_kolibrios) && (!iso_report.is_bootable_img)) ) { + if ( (!img_report.has_bootmgr) && (!HAS_SYSLINUX(img_report)) && (!IS_WINPE(img_report.winpe)) && (!IS_GRUB(img_report)) + && (!img_report.has_efi) && (!IS_REACTOS(img_report) && (!img_report.has_kolibrios) && (!img_report.is_bootable_img)) ) { PrintInfo(0, MSG_081); safe_free(image_path); EnableWindow(hStatusToolbar, FALSE); @@ -1065,14 +1064,14 @@ DWORD WINAPI ISOScanThread(LPVOID param) } else { // Enable bootable and set Target System and FS accordingly CheckDlgButton(hMainDialog, IDC_BOOT, BST_CHECKED); - if (!iso_report.is_bootable_img) { + if (!img_report.is_bootable_img) { SetTargetSystem(); SetFSFromISO(); SetMBRProps(); // Some Linux distros, such as Arch Linux, require the USB drive to have // a specific label => copy the one we got from the ISO image - if (iso_report.label[0] != 0) { - SetWindowTextU(hLabel, iso_report.label); + if (img_report.label[0] != 0) { + SetWindowTextU(hLabel, img_report.label); } } else { SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE<<16) | IDC_FILESYSTEM, @@ -1289,16 +1288,16 @@ static BOOL BootCheck(void) MessageBoxU(hMainDialog, lmprintf(MSG_087), lmprintf(MSG_086), MB_OK|MB_ICONERROR|MB_IS_RTL); return FALSE; } - if ((size_check) && (iso_report.projected_size > (uint64_t)SelectedDrive.DiskSize)) { + if ((size_check) && (img_report.projected_size > (uint64_t)SelectedDrive.DiskSize)) { // This ISO image is too big for the selected target MessageBoxU(hMainDialog, lmprintf(MSG_089), lmprintf(MSG_088), MB_OK|MB_ICONERROR|MB_IS_RTL); return FALSE; } if (bt == BT_IMG) { - if (!iso_report.is_bootable_img) + if (!img_report.is_bootable_img) // The selected image doesn't match the boot option selected. MessageBoxU(hMainDialog, lmprintf(MSG_188), lmprintf(MSG_187), MB_OK|MB_ICONERROR|MB_IS_RTL); - return (iso_report.is_bootable_img); + return (img_report.is_bootable_img); } fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem)); tt = GETTARGETTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme))); @@ -1320,46 +1319,46 @@ static BOOL BootCheck(void) return FALSE; } } else if (tt == TT_UEFI) { - if (!iso_report.has_efi) { + if (!img_report.has_efi) { // Unsupported ISO MessageBoxU(hMainDialog, lmprintf(MSG_091), lmprintf(MSG_090), MB_OK|MB_ICONERROR|MB_IS_RTL); return FALSE; } - if (IS_WIN7_EFI(iso_report) && (!WimExtractCheck())) { + if (IS_WIN7_EFI(img_report) && (!WimExtractCheck())) { // Your platform cannot extract files from WIM archives => download 7-zip? if (MessageBoxU(hMainDialog, lmprintf(MSG_102), lmprintf(MSG_101), MB_YESNO|MB_ICONERROR|MB_IS_RTL) == IDYES) ShellExecuteA(hMainDialog, "open", SEVENZIP_URL, NULL, NULL, SW_SHOWNORMAL); return FALSE; } - } else if ( ((fs == FS_NTFS) && (!iso_report.has_bootmgr) && (!IS_WINPE(iso_report.winpe)) && (!IS_GRUB(iso_report))) - || ((IS_FAT(fs)) && (!HAS_SYSLINUX(iso_report)) && (!allow_dual_uefi_bios) && - (!IS_REACTOS(iso_report)) && (!iso_report.has_kolibrios) && (!IS_GRUB(iso_report))) ) { + } else if ( ((fs == FS_NTFS) && (!img_report.has_bootmgr) && (!IS_WINPE(img_report.winpe)) && (!IS_GRUB(img_report))) + || ((IS_FAT(fs)) && (!HAS_SYSLINUX(img_report)) && (!allow_dual_uefi_bios) && + (!IS_REACTOS(img_report)) && (!img_report.has_kolibrios) && (!IS_GRUB(img_report))) ) { // Incompatible FS and ISO MessageBoxU(hMainDialog, lmprintf(MSG_096), lmprintf(MSG_092), MB_OK|MB_ICONERROR|MB_IS_RTL); return FALSE; - } else if ((fs == FS_FAT16) && (iso_report.has_kolibrios)) { + } else if ((fs == FS_FAT16) && (img_report.has_kolibrios)) { // KolibriOS doesn't support FAT16 MessageBoxU(hMainDialog, lmprintf(MSG_189), lmprintf(MSG_099), MB_OK|MB_ICONERROR|MB_IS_RTL); return FALSE; } - if ((IS_FAT(fs)) && (iso_report.has_4GB_file)) { + if ((IS_FAT(fs)) && (img_report.has_4GB_file)) { // This ISO image contains a file larger than 4GB file (FAT32) MessageBoxU(hMainDialog, lmprintf(MSG_100), lmprintf(MSG_099), MB_OK|MB_ICONERROR|MB_IS_RTL); return FALSE; } - if ((iso_report.has_grub2) && (iso_report.grub2_version[0] != 0) && - (strcmp(iso_report.grub2_version, GRUB2_PACKAGE_VERSION) != 0)) { + if ((img_report.has_grub2) && (img_report.grub2_version[0] != 0) && + (strcmp(img_report.grub2_version, GRUB2_PACKAGE_VERSION) != 0)) { // We may have to download a different Grub2 version if we can find one IGNORE_RETVAL(_chdirU(app_dir)); IGNORE_RETVAL(_mkdir(FILES_DIR)); IGNORE_RETVAL(_chdir(FILES_DIR)); - static_sprintf(tmp, "%s-%s/%s", grub, iso_report.grub2_version, core_img); + static_sprintf(tmp, "%s-%s/%s", grub, img_report.grub2_version, core_img); fd = fopen(tmp, "rb"); if (fd != NULL) { // If a file already exists in the current directory, use that one uprintf("Will reuse '%s' from './" FILES_DIR "/%s-%s/' for Grub 2.x installation\n", - core_img, grub, iso_report.grub2_version); + core_img, grub, img_report.grub2_version); fseek(fd, 0, SEEK_END); grub2_len = ftell(fd); fseek(fd, 0, SEEK_SET); @@ -1373,14 +1372,14 @@ static BOOL BootCheck(void) } fclose(fd); } else { - r = MessageBoxU(hMainDialog, lmprintf(MSG_116, iso_report.grub2_version, GRUB2_PACKAGE_VERSION), + r = MessageBoxU(hMainDialog, lmprintf(MSG_116, img_report.grub2_version, GRUB2_PACKAGE_VERSION), lmprintf(MSG_115), MB_YESNOCANCEL|MB_ICONWARNING|MB_IS_RTL); if (r == IDCANCEL) return FALSE; else if (r == IDYES) { - static_sprintf(tmp, "%s-%s", grub, iso_report.grub2_version); + static_sprintf(tmp, "%s-%s", grub, img_report.grub2_version); IGNORE_RETVAL(_mkdir(tmp)); - static_sprintf(tmp, "%s/%s-%s/%s", FILES_URL, grub, iso_report.grub2_version, core_img); + static_sprintf(tmp, "%s/%s-%s/%s", FILES_URL, grub, img_report.grub2_version, core_img); PrintInfoDebug(0, MSG_085, tmp); PromptOnError = FALSE; grub2_len = (long)DownloadFile(tmp, &tmp[sizeof(FILES_URL)], hMainDialog); @@ -1403,11 +1402,11 @@ static BOOL BootCheck(void) } } - if (HAS_SYSLINUX(iso_report)) { - if (SL_MAJOR(iso_report.sl_version) < 5) { + if (HAS_SYSLINUX(img_report)) { + if (SL_MAJOR(img_report.sl_version) < 5) { IGNORE_RETVAL(_chdirU(app_dir)); for (i=0; i try to download without the version extra uprintf("Extended version was not found, trying main version\n"); - static_sprintf(tmp, "%s/%s-%s/%s.%s", FILES_URL, syslinux, iso_report.sl_version_str, + static_sprintf(tmp, "%s/%s-%s/%s.%s", FILES_URL, syslinux, img_report.sl_version_str, ldlinux, ldlinux_ext[i]); PrintInfo(0, MSG_085, tmp); syslinux_ldlinux_len[i] = DownloadFile(tmp, &tmp[sizeof(FILES_URL)], hMainDialog); if (syslinux_ldlinux_len[i] != 0) { // Duplicate the file so that the user won't be prompted to download again - static_sprintf(tmp, "%s-%s\\%s.%s", syslinux, iso_report.sl_version_str, ldlinux, ldlinux_ext[i]); - static_sprintf(tmp2, "%s-%s\\%s\\%s.%s", syslinux, iso_report.sl_version_str, - &iso_report.sl_version_ext[1], ldlinux, ldlinux_ext[i]); + static_sprintf(tmp, "%s-%s\\%s.%s", syslinux, img_report.sl_version_str, ldlinux, ldlinux_ext[i]); + static_sprintf(tmp2, "%s-%s\\%s\\%s.%s", syslinux, img_report.sl_version_str, + &img_report.sl_version_ext[1], ldlinux, ldlinux_ext[i]); CopyFileA(tmp, tmp2, FALSE); } } @@ -2365,9 +2364,9 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA ToggleImage(!IsChecked(IDC_BOOT) || (selection_default != BT_IMG)); SetToGo(); if ((selection_default == BT_ISO) || (selection_default == BT_IMG)) { - if ((image_path != NULL) && (iso_report.label[0] != 0)) { + if ((image_path != NULL) && (img_report.label[0] != 0)) { // Some distros (eg. Arch Linux) want to see a specific label => ignore user one - SetWindowTextU(hLabel, iso_report.label); + SetWindowTextU(hLabel, img_report.label); } } else { if (selection_default == BT_UEFI_NTFS) { @@ -2462,7 +2461,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA } // Ask users how they want to write ISOHybrid images - if ((IsChecked(IDC_BOOT)) && (iso_report.is_bootable_img) && + if ((IsChecked(IDC_BOOT)) && (img_report.is_bootable_img) && (ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType)) == BT_ISO)) { char* iso_image = lmprintf(MSG_036); char* dd_image = lmprintf(MSG_095); diff --git a/src/rufus.h b/src/rufus.h index 9f6e1f21..6716253e 100644 --- a/src/rufus.h +++ b/src/rufus.h @@ -260,6 +260,8 @@ typedef struct { char install_wim_path[64]; /* path to install.wim or install.swm */ uint64_t projected_size; uint32_t install_wim_version; + BOOLEAN is_iso; + BOOLEAN is_bootable_img; uint8_t winpe; uint8_t has_efi; BOOLEAN has_4GB_file; @@ -275,14 +277,13 @@ typedef struct { BOOLEAN has_grub2; BOOLEAN has_kolibrios; BOOLEAN uses_minint; - BOOLEAN is_bootable_img; BOOLEAN compression_type; BOOLEAN is_vhd; uint16_t sl_version; // Syslinux/Isolinux version char sl_version_str[12]; char sl_version_ext[32]; char grub2_version[32]; -} RUFUS_ISO_REPORT; +} RUFUS_IMG_REPORT; /* Isolate the Syslinux version numbers */ #define SL_MAJOR(x) ((uint8_t)((x)>>8)) @@ -366,7 +367,7 @@ extern RUFUS_DRIVE_INFO SelectedDrive; extern const int nb_steps[FS_MAX]; extern BOOL use_own_c32[NB_OLD_C32], detect_fakes, iso_op_in_progress, format_op_in_progress, right_to_left_mode; extern BOOL allow_dual_uefi_bios, togo_mode; -extern RUFUS_ISO_REPORT iso_report; +extern RUFUS_IMG_REPORT img_report; extern int64_t iso_blocking_status; extern uint16_t rufus_version[3], embedded_sl_version[2]; extern int nWindowsVersion; @@ -442,7 +443,7 @@ extern void parse_update(char* buf, size_t len); extern uint8_t WimExtractCheck(void); extern BOOL WimExtractFile(const char* wim_image, int index, const char* src, const char* dst); extern BOOL WimApplyImage(const char* image, int index, const char* dst); -extern BOOL IsHDImage(const char* path); +extern BOOL IsBootableImage(const char* path); extern BOOL AppendVHDFooter(const char* vhd_path); extern int IsHDD(DWORD DriveIndex, uint16_t vid, uint16_t pid, const char* strid); extern void LostTranslatorCheck(void); diff --git a/src/rufus.rc b/src/rufus.rc index 3c7f6dcc..669b2639 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.711" +CAPTION "Rufus 2.4.712" FONT 8, "Segoe UI Symbol", 400, 0, 0x0 BEGIN LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8 @@ -317,8 +317,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,3,711,0 - PRODUCTVERSION 2,3,711,0 + FILEVERSION 2,4,712,0 + PRODUCTVERSION 2,4,712,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -335,13 +335,13 @@ BEGIN BEGIN VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "2.3.711" + VALUE "FileVersion", "2.4.712" 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.711" + VALUE "ProductVersion", "2.4.712" END END BLOCK "VarFileInfo" diff --git a/src/syslinux.c b/src/syslinux.c index cd837af3..ec1543af 100644 --- a/src/syslinux.c +++ b/src/syslinux.c @@ -105,9 +105,9 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int fs_type) uint32_t ldlinux_cluster; int i, nsectors; int bt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType)); - BOOL use_v5 = (bt == BT_SYSLINUX_V6) || ((bt == BT_ISO) && (SL_MAJOR(iso_report.sl_version) >= 5)); + BOOL use_v5 = (bt == BT_SYSLINUX_V6) || ((bt == BT_ISO) && (SL_MAJOR(img_report.sl_version) >= 5)); - PrintInfoDebug(0, MSG_234, (bt == BT_ISO)?iso_report.sl_version_str:embedded_sl_version_str[use_v5?1:0]); + PrintInfoDebug(0, MSG_234, (bt == BT_ISO)?img_report.sl_version_str:embedded_sl_version_str[use_v5?1:0]); // 4K sector size workaround SECTOR_SHIFT = 0; @@ -133,8 +133,8 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int fs_type) syslinux_ldlinux[i] = (unsigned char*) malloc(syslinux_ldlinux_len[i]); if (syslinux_ldlinux[i] == NULL) goto out; - static_sprintf(path, "%s/%s-%s%s/%s.%s", FILES_DIR, syslinux, iso_report.sl_version_str, - iso_report.sl_version_ext, ldlinux, i==0?"sys":"bss"); + static_sprintf(path, "%s/%s-%s%s/%s.%s", FILES_DIR, syslinux, img_report.sl_version_str, + img_report.sl_version_ext, ldlinux, i==0?"sys":"bss"); fd = fopen(path, "rb"); if (fd == NULL) { uprintf("Could not open %s\n", path); @@ -315,7 +315,7 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int fs_type) uprintf("Failed to create '%s': %s\n", path, WindowsErrorString()); } } - } else if (IS_REACTOS(iso_report)) { + } else if (IS_REACTOS(img_report)) { uprintf("Setting up ReactOS...\n"); syslinux_mboot = GetResource(hMainInstance, MAKEINTRESOURCEA(IDR_SL_MBOOT_C32), _RT_RCDATA, "mboot.c32", &syslinux_mboot_len, FALSE); @@ -346,7 +346,7 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int fs_type) } /* Write the syslinux.cfg for ReactOS */ fprintf(fd, "DEFAULT ReactOS\nLABEL ReactOS\n KERNEL %s\n APPEND %s\n", - mboot_c32, iso_report.reactos_path); + mboot_c32, img_report.reactos_path); fclose(fd); } diff --git a/src/vhd.c b/src/vhd.c index f5a97cb1..c3321de1 100644 --- a/src/vhd.c +++ b/src/vhd.c @@ -243,7 +243,7 @@ BOOL IsCompressedBootableImage(const char* path) BOOL r = FALSE; int64_t dc; - iso_report.compression_type = BLED_COMPRESSION_NONE; + img_report.compression_type = BLED_COMPRESSION_NONE; for (p = (char*)&path[strlen(path)-1]; (*p != '.') && (p != path); p--); if (p == path) @@ -251,7 +251,7 @@ BOOL IsCompressedBootableImage(const char* path) for (i = 0; i= (512 + size))) { + if ((img_report.compression_type == BLED_COMPRESSION_NONE) && (img_report.projected_size >= (512 + size))) { footer = (vhd_footer*)malloc(size); - ptr.QuadPart = iso_report.projected_size - size; + ptr.QuadPart = img_report.projected_size - size; if ( (footer == NULL) || (!SetFilePointerEx(handle, ptr, NULL, FILE_BEGIN)) || (!ReadFile(handle, footer, size, &size, NULL)) || (size != sizeof(vhd_footer)) ) { uprintf(" Could not read VHD footer"); goto out; } if (memcmp(footer->cookie, conectix_str, sizeof(footer->cookie)) == 0) { - iso_report.projected_size -= sizeof(vhd_footer); + img_report.projected_size -= sizeof(vhd_footer); if ( (bswap_uint32(footer->file_format_version) != VHD_FOOTER_FILE_FORMAT_V1_0) || (bswap_uint32(footer->disk_type) != VHD_FOOTER_TYPE_FIXED_HARD_DISK)) { uprintf(" Unsupported type of VHD image"); - iso_report.is_bootable_img = FALSE; + is_bootable_img = FALSE; goto out; } // Might as well validate the checksum while we're at it @@ -328,14 +329,14 @@ BOOL IsHDImage(const char* path) uprintf(" Warning: VHD footer seems corrupted (checksum: %04X, expected: %04X)", old_checksum, checksum); // Need to remove the footer from our payload uprintf(" Image is a Fixed Hard Disk VHD file"); - iso_report.is_vhd = TRUE; + img_report.is_vhd = TRUE; } } out: safe_free(footer); safe_closehandle(handle); - return iso_report.is_bootable_img; + return is_bootable_img; } #define WIM_HAS_API_EXTRACT 1