Commit Graph

179 Commits

Author SHA1 Message Date
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
Pete Batard f0c843fcdc
[ext2fs] add BIOS persistence for Debian Live & Ubuntu 2019-08-06 18:50:07 +01:00
Pete Batard fcb15ab6e9
[ext2fs] automated persistence set up for Debian Live & Ubuntu
* Only UEFI boot for now (GRUB) & requires a post 2019.07.26 ISO for Ubuntu.
* This adds the relevant persistence/persistent kernel option to the conf file, sets the
  expected volume label and creates a /persistence.conf file where needed.
* Also improve token parsing by ensuring a token is followed by at least one white space.
2019-08-02 17:57:10 +01:00
Pete Batard 180e6d4364
[iso] disable ISO mode for incompatible Manjaro 2019-07-03 23:07:24 +01:00
Pete Batard 8b18d8ce1d
[core] add CycleDevice and VDS layout refresh
* Also fix some minor issues
2019-05-23 13:09:25 +01:00
Pete Batard 5f9e65707f
[core] partitioning improvements
* Improve report and make sure we zero leftovers from the start of a partition
* Also add VDS error codes
* Also fix Coverity warnings
2019-04-27 16:04:47 +01:00
Pete Batard 0ad3f8c1d3
[ext2fs] integrate ext3 formatting into UI operations
* Add display of persistence controls on relevant images
* Add progress on ext3 formatting and improve error reporting
* Also improve MountVolume() and fix some Coverity warnings
2019-04-16 20:44:13 +01:00
Pete Batard 5dbf537dfb
[core] add listing exception for Apple SD card readers
* Also fix a Coverity warning
2019-04-05 22:02:36 +01:00
Pete Batard f02fbe3acc
[core] add full extraction support for efi.img
* Also, Solus distro maintainers, I hate you!
2019-04-04 19:12:48 +01:00
Pete Batard efd6d9f345
[misc] fix Coverity warnings
* What would be nicer was if half these Coverity issues weren't false positives...
* Also update Readme and fix progress bar colour not being reset after error
2019-03-15 11:00:13 +00:00
Pete Batard e073fb47b0
[net] add Windows retail ISO downloads
* This is accomplished through Fido (https://github.com/pbatard/Fido), a *SIGNED*
  PowerShell script, that is downloaded from GitHub and that resides in memory for
  the duration of a session.
* The reason we use a downloaded PS script, rather than an embedded on, is because:
  - Microsoft have regularly been changing the deal with regards to how retail ISOs
    can be downloaded, and not for the better, so we can't simply embed a static
    means of downloading ISOs and expect that to work forever.
  - By using an external script, we can immediately respond to whatever new means of
    *ANNOYING* their legitimate users Microsoft will come up with next, as well as
    make sure that, the minute a new retail version of Windows becomes available, it
    also becomes available for download in Rufus.
* Note that if you are concerned about downloading a remote PS script that is being
  run at the same level as an elevated application, you should understand that:
  - Only scripts downloaded from GitHub, from an account that is protected with 2FA,
    are allowed to run (i.e. someone would first have to steal a *physical* 2FA key
    to be in a position to upload a malicious script).
  - On top of this, only scripts that are signed with a separate private key (RSA +
    AES-256), that is itself also protected with a strong unique password which only
    a single person knows (and must manually enter each time they want to make a new
    version of the script available for download), are allowed to run.
  The above means that there's about as much chance for someone to manage to upload
  a malicious script on the GitHub servers, that Rufus would allow to run, as there
  is for someone to upload a malicious version of Rufus itself.
  Still, if you are paranoid and have concerns that, even as you can validate from
  its source that Rufus does not attempt to execute any remote script unless a user
  actively selected and clicked the DOWNLOAD button, you can also completely disable
  the remote script download feature, if you just set the update check to disabled
  (which, by the way, Rufus *EXPLICITLY* asks you to choose whether you want to
  enable or not, the very first time you run the application).
* Also remove _unlinkU() which duplicates what DeleteFileU() already does.
2019-03-02 23:34:32 +00:00