Commit Graph

189 Commits

Author SHA1 Message Date
Pete Batard 8814944c35
[wue] improve Windows version reporting from ISO/.wim
* Pick the version and build number directly from the install[.wim|.esd] XML index.
  This forces us to mount the ISO during scan, but it's the only way to get an accurate Build number...
* Also drop linking to version.dll (along with the whole version.dll delay-loading shenanigans).
2022-10-04 11:58:30 +01:00
Pete Batard 2cf183e9f1
[misc] fix Y2K38 related Coverity warnings 2022-09-14 10:58:18 +02:00
Pete Batard d9e8b8caeb
[iso] fix incorrect detection of GRUB with nonstandard prefixes
* Existing code was trying to detect if GRUB patching was needed for GRUB bootloaders
  even if they were using standard prefixes, and as a result dropped GRUB support for
  any versions that wasn't 2.04 or 2.06, since we don't have a patch for those.
* This patch restores the expected behaviour to ensure that we don't disable GRUB if
  a standard prefix is being used, regardless of the version being reported.
* Note that this issue only affected BIOS GRUB boot. UEFI GRUB boot was unaffected.
* Also set rufus-next to 3.21.
2022-09-07 18:10:30 +01:00
Pete Batard eda1f59a38
[iso] fix GRUB version detection for Fedora Rawhide
* How nice of "Open Source proponent" IBM/Red-Hat/Fedora to fix double space typos while making sure the
  provenance of the software they are using is hidden:
  https://src.fedoraproject.org/rpms/grub2/blob/rawhide/f/0024-Don-t-say-GNU-Linux-in-generated-menus.patch
* Long story short: Fedora fixed the double space in "GRUB  version", but of course they didn't upstream
  this change since it is part of a patch that removes every possible mention of GNU. This made our GRUB
  version detection break, since it relies on finding a "GRUB  version" string.
* Fix this by looking for both "GRUB  version" and "GRUB version".
* This, however, does not fix Fedora Rawhide BIOS boot, since they also added custom GRUB calls such as
  'grub_debug_is_enabled', which we don't have in our vanilla produced GRUB binary.
* Closes #2002.
2022-07-28 15:47:05 +01:00
Pete Batard 2b7b81808f
[misc] improve/factorize '/' ↔ '\' conversions 2022-07-09 18:16:42 +01:00
Pete Batard 2be4470bc5
[iso] add workaround for ISOs that have a syslinux symbolic link to isolinux
* This is for Knoppix images that have a /boot/syslinux that links to /boot/isolinux/
  with EFI Syslinux trying to use /boot/syslinux/syslnx[32|64].cfg as its config file.
* Note to Knoppix devs, you could have ensured EFI File System transposition by using
  the same approach as we do here, which is to create non-symlinked /boot/syslinux
  config files that point back to the isolinux ones.
2022-07-08 13:34:34 +01:00
Pete Batard a0d669232c
[ui] add a new selection dialog for Windows 11 setup customization
* This moves the extended Windows 11 options (bypass TPM & Secure Boot) away from
  "Image options" into a new explicit dialog, along with supplementary customization
  such as enabling offline account (for Windows 11 22H2) and skipping all data
  collection questions.
* This customization is now enacted through an unattend.xml file rather than offline
  registry manipulation, so that this *should* also work with the Windows Store version.
* Also update arch detection and rework/reorganize upcoming translation changes.
* Note: The 'Remove "unsupported hardware" desktop watermark' option is *UNTESTED*.
2022-06-23 13:34:24 +01:00
Pete Batard c2cd5185a3
[iso] enforce DD mode for Proxmox ISOHybrid images 2022-06-07 16:39:03 +01:00
Pete Batard d029551929
[core] drop direct hooking into dwmapi DLL and use delay-loading instead
* Now that we can delay-load DLLs for both MinGW and MSVC, we can also remove
  the direct DLL hook that was added into dwmapi.dll due to side loading and
  revert to using a direct API call instead.
* This reverts part of e1d864f755.
* Also attempt to silence that damn Coverity warning.
2022-04-12 13:55:33 +01:00
Pete Batard 3194a4dac4
[net] drop direct hooking into wininet DLL and use delay-loading instead
* Now that we can delay-load DLLs for both MinGW and MSVC, we can remove the
  cumbersome direct DLL hooks into wininet.dll (which is vulnerable to side
  loading when not delay-loaded) and revert to using direct API calls instead.
* This reverts part of e1d864f755.
* Also attempt to silence a Coverity warning.
2022-04-12 13:35:41 +01:00
Pete Batard e7b66e7e4c
[mingw] use delay loading for DLLs that are subject to side loading
* This reverts much of commits f6ac559f4d and 1947266837
  so that we call the Windows APIs directly again, while ensuring that, by the time we load the DLLs,
  sideloading mitigation has already been applied by the application.
* This is a continuation of #1877, and should help prevent re-introducing side-loading issues when we
  link against new libraries, as well as allow us to drop some of the manual DLL hooking we've been
  doing to prevent it, to clean up the code.
* Note that this is a bit more complex than what the stackoverflow post suggests, because we need to
  create delayloaded libs for both 32-bit and 64-bit, which use a different calling convention and
  therefore need to use different .def files. So there's a lot of gymkhana involved, with Makefiles
  and whatnot, to get us there.
* Also simplify the use of CM_Get_DevNode_Registry_PropertyA() in dev.c since recent versions of
  MinGW now have support for it.
* Also fix 2 small issues in net.c (potential overflow) and format.c (memory leak).
2022-04-12 11:09:59 +01:00
Pete Batard 3528ca773d
[iso] add support for distros using a NONSTANDARD GRUB 2.0 prefix directory
* Looking at you, openSUSE Live and GeckoLinux!
2022-04-07 01:58:22 +01:00
Pete Batard 42483d23ed
[dos] update FreeDOS to version 1.3
* FreeDOS 1.3 has just been released. Yay! :)
* Closes #1740
* Also addresses 2 warnings reported by Coverity.
2022-02-21 20:02:53 +00:00
Pete Batard f6ac559f4d
[iso] don't link with version.lib to prevent DLL sideloading issues
* This is part of #1838, where we need to sort the version.dll sideloading problem for MinGW.
* A subsequent patch will be applied to MSVC, to more generally delay the loading of DLLs.
* Also fix a typo with an assert expression.
2022-01-05 16:49:06 +00:00
Pete Batard c28f9bc491
[misc] fix PVS-Studio warnings 2022-01-05 12:57:26 +01:00
Dimitri Papadopoulos d840083a32
[misc] fix typos found by codespell
* 3rd party software was left out.
* Most changes are in code comments, but one user-visible string has also been fixed.
* Closes #1817
2021-11-16 18:53:52 +00:00
Pete Batard 9cd7adaaaa
[iso] finalize workaround for Red Hat 8 derivatives
* See #1777
2021-10-11 17:55:46 +01:00
Pete Batard a10b8e8c54
[iso] add Windows ISO version report
* Use sources/compatresources.dll, when available, to try to detect the Windows ISO version and build.
* Also report what facility we use for formatting.
2021-10-08 19:24:07 +01:00
Pete Batard c09ede16b3
[iso] add kernel options update for Red Hat derivatives
* Since version 8.2, and rhinstaller/anaconda@a766101954,
  Red Hat derivatives have changed their CD-ROM detection policy which leads to
  the installation source not being found when writing the media in ISO mode.
* Replace 'inst.stage2' by 'inst.repo' in the kernel options.
* Closes #1777 (See also rhinstaller/anaconda#rhinstaller/anaconda#3529).
* Note that this reverts part of 9c8fa40995.
2021-10-03 16:04:34 +02:00
Pete Batard deee38d4e5
[misc] fix log potentially not being saved on exit
* Also ensures that if the user deleted the directory we don't recreate it for the log.
* Also fix typos and Coverity warnings.
2021-09-19 21:01:45 +01:00
Pete Batard 366ce99712
[misc] fix Coverity and CodeQL warnings
* Also make sure to build Release for static analysis.
2021-09-07 23:39:04 +01:00
Pete Batard a787fb34b3
[iso] fix loader/entries/*.conf labels for Arch derivatives...
* ...that didn't get the memo about using UPPERCASE 11-chars max ISO labels.
* There's a reason why Arch labels its ISOs 'ARCH_YYYYMM', people!
* Anyway, EndeavourOS should now work in ISO mode when booted from UEFI.
2021-09-07 01:07:37 +01:00
Pete Batard 8538ce0590
[misc] fix some Coverity warnings 2021-08-02 13:22:49 +01:00
Pete Batard 723b6c98a2
[grub] add workaround for openSUSE Live ISOs
* In their great wisdom, the openSUSE maintainers added a 'set linux=linux'
  line to their grub.cfg, which means that their kernel option token is no
  longer 'linux' but '$linux'... and we have to add a workaround for that.
2021-07-29 22:37:09 +01:00
Pete Batard 9d7e96e293
[core] move downloads from <app_location>\rufus_files\ to %LOCALAPPDATA%\Rufus\
* While this is intended to solve the issue of saving GRUB/Syslinux files for the
  App Store version, we apply this change globally, as it allows the user to move
  the Rufus executable around while preserving access to existing downloads.
* Closes #1744
2021-05-31 16:54:11 +01:00
Pete Batard 318d5ed16d
[iso] fix "ISO has not been properly scanned" error for some ISOs
* Make sure that if we skip a deep directory during scan, we count at
  least one block of data.
* Also produce a note about deep directory long scan times and improve
  the formatting of some messages.
2020-10-12 19:33:54 +01:00
Pete Batard 2d272b7991
[iso] fix md5sum.txt update for Ubuntu 20.10
* Ubuntu switched to using GRUB for BIOS, so our update_md5sum() code was not being called.
* Move update_md5sum() to being called unconditionally to fix this.
* Closes #1616 (again...)
2020-10-05 12:39:52 +01:00
Pete Batard a8f3c6c572
[iso] fix detection of GRUB version
* Commit 77d319267f broke lookup of ISO filenames since iso9660_open()
  enabled the Rock Ridge extensions by default, despite using ISO_EXTENSION_NONE
  for the internal call, and we addressed a FIXME related to this.
* This resulted in Rufus not being able to lookup 'boot/grub/i386-pc/normal.mod' to parse GRUB's
  version, since without Rock Ridge, 'i386-pc/' is unable to match the ISO-9660 'I386_PC/' dir.
* Closes #1573 and addresses part of #1616.
* Also fix a MinGW compilation warning.
2020-09-11 22:45:47 +01:00
Pete Batard ca70b4c213
[iso] fix 'internal error' notice due to bootriscv###.efi support
* These bootloaders will require LFN support. Since we don't expect that
  many people to create bootable media for RISC-V derived from bootloaders
  contained in a 'efi.img`, we simply ignore these for now.
2020-09-10 17:55:07 +01:00
Pete Batard 6f5ea5f88f
[efi] add RISC-V support
* Also fix Coverity warnings
2020-07-29 19:32:32 +01:00
Pete Batard 34b1d8a3ca
[core] enable the direct provision of install.wim/install.esd for Windows To Go
* Also remove the use of 'unattend.xml' to disable the recovery environment (use bcdedit instead)
* Also some code cleanup and refactoring
2020-07-19 22:35:30 +01:00
Pete Batard c35a92cd0c
[iso] speed up scanning of ISOs with lots of deep directory entries
* ISOs with tons of Rock Ridge deep directory entries (such as OPNsense)
  can be very slow to scan due to the nature of deep directory parsing,
  which requires processing the whole ISO9660 fs, for each deep directory
  file, in order to find the relevant LSN entry.
* Since we don't expect much of the content we care about to reside in a
  deep directory entry, we amend the code to cut short the scan of any
  directory that contains such elements.
* Note that this only applies for ISO scan and it does nothing to speed
  up the ISO extraction process.
* Related to issue #1575
2020-07-06 17:30:20 +01:00
Pete Batard 68d42d4153
[iso] remove Ubuntu's splash screen for persistent drives
* This is accomplished by removing the 'maybe-ubiquity' option
* UEFI only
2020-06-11 13:52:14 +01:00
Pete Batard e554d2b4e0
[misc] add Ctrl-SELECT option to provide additional content
* For now only .zip archives are supported
2020-06-10 21:25:33 +01:00
Pete Batard 77d319267f
[iso] add Rock Ridge deep directory support
* Closes #1526
2020-06-02 11:13:47 +01:00
Pete Batard dcc4463273
[iso] update libcdio to latest 2020-05-24 21:09:28 +01:00
Pete Batard 4bf69215bf
[iso] enable extra libcdio debugging with Alt-.
* Also fix 2 memory leaks
2020-05-12 14:13:44 +01:00
Pete Batard 129aa64394
[misc] add alternative test mode
* Also fix some typos and unwanted messages
2020-04-12 23:45:09 +01:00
Pete Batard 1e6e38b180
[iso] update MD5SUMS/md5sums.txt text file for distros that have them
* The upcoming Ubuntu 20.04 comes with MD5 validation turned on by default.
* When creating persistent boot media, we may update some of the validated files
  to add persistence, update the search labels, etc.
* Make sure that the files we modify get their MD5 updated where needed.
* Also add 'loopback.cfg' to the list of config files we can add persistence to.
* Part of #1499
2020-04-06 17:09:48 +01:00
Pete Batard 045f590c3b
[iso] change the Ubuntu-type grub.cfg persistence token
* Among other nefarious things, ubuntu 20.04 added a $casper_flavour suffix
  to their grub.cfg /casper/vmlinuz kernel option, so we can no longer rely
  on 'persistent' being inserted in a proper location.
* Switch to latching on file=/cdrom/preseed and hope that it will work for
  all of Ubuntu & derivatives.
* Part of #1499.
2020-04-04 18:05:22 +01:00
Pete Batard b19f47f9b8
[iso] update the handling of failure of autorun.inf creation
* Commit 4c5adf092e moved us away from using CreateFile()
  when extracting a file on the target media, and as such the error code returned when
  failing to create an 'autorun.inf' due to a security solution has shifted.
* Make sure we handle the new error and don't bail out on 'autorun.inf' creation.
* Also update the actual name of the RtlDosPathNameToNtPathNameXXX function we use.
* Closes #1496
2020-04-01 11:34:13 +01:00
Mattiwatti 4c5adf092e
[iso] use NtCreateFile() to create files with preallocated sizes
* Implement CreatePreallocatedFile() which uses NtCreateFile() to create files with preallocated sizes.
  This is used during ISO extraction to improve performance.
* Remove now-unused preallocate_filesize which was called after CreateFileU().
* Closes #1445
2020-02-14 23:39:57 +00:00
Pete Batard 4ebed1eac2
[iso] report usage of UDF symbolic links
* These may dramatically increase the size required for extraction
  so users may want to have some hints about these.
* Closes #1446
2020-02-05 13:23:49 +00:00
Joseph mendoza 8672feeb0a
[efi] leave .efi files in efi/boot/ uncompressed on NTFS
* While compressed EFI bootloaders are not an issue for UEFI:NTFS, some UEFI firmwares
  embed an NTFS driver that doesn't support NTFS compression.
  To address that, also uncompress the EFI bootloaders on NTFS.
* Closes #1424
2020-01-11 12:33:52 +00:00
Pete Batard 8719412667
[iso] leave bootmgr and bootmgr.efi uncompressed on compressed NTFS
* When using compressed NTFS, having a compressed bootmgr prevents BIOS boot, so we
  now call `compress -u` where needed to leave the relevant bootmgr files uncompressed.
* Closes #1381
* Also fix a minor warning in ext2fs
2019-10-22 17:17:07 +01:00
Pete Batard 0a24940c85
[iso] fix detection of 'txt.cfg' as a main Syslinux config file
* While we need to detect that 'txt.cfg' is a Syslinux config file, so that
  we can alter it for persistence, it should never be used as a main config
  file, such as the one we link to when we create /syslinux.cfg.
* Closes #1375
2019-09-12 13:18:29 +01:00
Pete Batard b251930608
[iso] fix case sensitive comparison when preventing 'ldlinux.sys' overwrite
* Because we install our own ldlinux.sys, we must ensure that if the ISO contains
  an ldlinux.sys in the root directory, this file is not copied over. However, our
  comparison for the 'ldlinux.sys' string was case sensitive which means that some
  ISOs such as R-Drive Image boot ISO, that use 'LDLINUX.SYS' were trying write over
  our file, resulting in a file extraction failure.
* This patch ensures that the string comparison for 'ldlinux.sys' is case insensitive.
* Also add 512px sized icon (upscaled using waifu2x)
2019-08-29 18:03:18 +01:00
Pete Batard 798029237f
[iso] improve fallback for dual UDF+ISO9660 images
* Also add private filtering of LM90X USB⟷SSD devices
2019-08-28 11:00:32 +01:00
Pete Batard af95de8198
[ui] add experimental optional display of transfer speed and time remaining
* You can use <Alt> to switch modes during an operation that supports it (e.g. Checksum
  computation, DD image writing or zeroing, save to VHD, download, etc.
* IMPORTANT: This is *NOT* available for all operations. Especially, if you were hoping
  to get transfer speed or ETA during ISO or WIM extraction, you *WILL* be disappointed.
* Also harmonize the code in checksum.c
2019-08-20 18:06:07 +01:00
Pete Batard 1fa0aaf325
[iso] relax isolinux cfg file detection for persistence and force DD mode for Pop_OS 2019-08-15 21:14:30 +01:00