Commit Graph

657 Commits

Author SHA1 Message Date
Pete Batard d0bc05077a
[misc] improve size based constants
* Make them more explicit by ensuring that they use a size suffix.
* Also improve whitespace consistency.
* Also make sure that we display the search for conflicting process message
  in the status on a search operation that may timeout.
2024-05-07 12:53:40 +01:00
Pete Batard 180a61736c
[misc] move the revoked UEFI bootloader prompt before the ISO → ESP one
* Also fix a potential buffer overflow when displaying the detailed HDD vs UFD score due to the
  safe_sprintf() macro re-evaluating the expression passed as parameter.
* Also refactor and clean up the the safe_###() macros to avoid similar issues.
* Also use FOF_NO_UI as flag for SHDeleteDirectoryExU(), which may alleviate some Alt-D errors.
2024-05-06 19:47:36 +01:00
Pete Batard 513c5f44a5
[misc] fix possible buffer overflows in _snprintf()
* _snprintf() is not always guaranteed to NUL terminate a string which could
  lead to  buffer overflows in iso_extract_files() and iso_extract_files().
* Fix this by switching to using the more secure _snprintf_s().
* Vulnerability discovered and reported by Mansour Gashasbi (@gashasbi).
* For good measure, we also switch to the strncat_s() where possible and also
  use memmove() instead of memcpy()/strcpy() as the behaviour of the latter on
  overlapping memory regions is undefined.
* Also fix some additional MinGW warnings regarding casts and nb_blocks.
2024-04-17 17:19:03 +01:00
Pete Batard 92ac1c770c
[wue] don't display WUE when '/sources/$OEM$/$$/Panther/unattend.xml' exists
* Closes #2451.
* Also update Coverity workflow to use latest actions/upload-artifact.
2024-04-15 16:35:52 +01:00
Pete Batard f813eb05d8
[iso] fix a buffer overflow in syslinux.c
* p[safe_strlen(p)] = 0; was pointless and could lead to a buffer overflow if
  the string was not already NUL terminated, so remove it and make sure we
  process a buffer that either contains legitimate Syslinux version strings
  (that are NUL terminated always) or that has been read through read_file()
  (that always adds a NUL terminator to the buffer).
* Also fix some whitespaces in related code sections and switch to using
  read_file() for GRUB version lookup.
* Vulnerability discovered and reported by Mansour Gashasbi (@gashasbi).
2024-04-10 10:26:31 +02:00
Pete Batard dd8314b2f0
[ui] add runtime UEFI media validation as a selectable advanced option
* Also add Ctrl-A as a new cheat-mode to toggle the use of Rufus MBR (which is enabled by default)
  which replaces the previous UI checkbox. The Disk ID field is now completely removed as we now
  use the default values for XP and non XP installs, and will expect people with multiple disks to
  disconnect all except the one where they plan to install Windows.
2024-04-02 17:18:06 +01:00
Pete Batard 8a5a5a318a
[misc] improve readability of error code handling
* Also don't pass a read size value in WriteFileWithRetry() if we don't use it.
2024-04-01 02:16:41 +01:00
Pete Batard 52ca79816f
[md5sum] Add md5sum.txt creation and runtime UEFI validation
* This allows *runtime* validation of UEFI bootable media, such as Windows
  or Linux installers, which, considering the unreliability of USB flash
  drives, we assert is a a much better proposal than write-time validation
  that utilities like balenaEcther (and to a lesser extent MCT) provide.
* Based on uefi-md5sum (https://github.com/pbatard/uefi-md5sum).
* Unconditionally activated on ISO extraction for GPT targets for now.
  This will be changed to a user selectable option later.
2024-03-29 00:48:05 +00:00
Pete Batard 5eae8a6441
[cmp] Enable extraction of zip archives outside of ISO copy mode
* This enables the use of Ctrl-SELECT to also extract files from a .zip
  when using non-bootable, DOS, UEFI-NTFS, etc.
* Also clean up some uprintf line terminations and some additional code.
* Also fix some Coverity and MinGW warnings.
2024-03-12 17:41:27 +00:00
Bella Zhang 026afa7e3d
[iso] add Circle Linux to the list of Red-Hat derivatives
* Closes #2414.
2024-02-09 17:04:40 +00:00
Pete Batard ac9a3f42d8
[misc] fix revoked bootloaders message does not display when using MBR
* Also update version to rufus-next
2024-02-06 20:02:36 +00:00
Pete Batard e0b5c6d96f
[misc] improve the code related to the commandline hogger deletion
* Also small additional code improvements
2023-11-09 17:39:38 +00:00
Pete Batard 1630e912d4
[iso] add exception for Mint's LMDE
* Mint have decided to make their installation rely on a working /live/ ➔ /casper/ symlink for LMDE
  thereby breaking the promise of File System Transposition that all Debian derivatives should have.
* Because of this, trying to use FAT32 with LMDE will fail, as reported in linuxmint/live-installer#152.
* Therefore, now that we can replicate symlinks on NTFS, we add an exception to always enforce the use
  of NTFS for LMDE.
2023-10-12 18:28:56 +01:00
Pete Batard 45a5f22d43
[process] move the search for conflicting process to a background thread
* Removes the annoyance of having to wait for the process search to complete before media creation can start.
* Also update the "Process Hacker" references to its new "System Informer" name.
2023-10-10 22:22:45 +01:00
Pete Batard 99bffe8364
[misc] add '.wic' to the list of default image extensions
* '.wic' are DD images used by the Yocto project.
* Why Yocto chose to use their own extension instead of using the de-facto '.img' is beyond me but hey...
* Also update GitHub Actions dependencies to latest.
* Closes #2319.
2023-09-08 17:14:09 +01:00
Pete Batard d5bf53054b
[misc] improve retrieval of core directories
* This *might* help with the issue reported in #2296.
2023-08-28 11:08:03 +01:00
Pete Batard 9c6b1ad977
[vhd] fix Rufus being unable to open .vhd images
* Due to a typo in vhd.c where the second safe_stricmp() should be against ".vhd" and not ".vhdx" again.
* Also enable the ignore boot marker bypass for VHD/VHDX/FFU and don't misreport those images as
  "compressed disk images".
* Closes #2309.
2023-08-20 13:12:38 +01:00
Pete Batard c5ad16fdeb
[wue] add an expert feature to restrict a Windows installation to S Mode
* This is placed behind an expert wall (Ctrl-Alt-E) on account that:
  - If you happen to boot a Windows To Go drive in S Mode on a computer, it may set any
    existing Windows installation there to S Mode as well, *even if their disk is offline!*
  - It can be *exceedingly* tricky to get out of S Mode, as the SkuPolicyRequired registry
    trick alone may not be enough (i.e. You can have very much a Windows install in S Mode
    *without* SkuPolicyRequired being set anywhere).
* Also set version to rufus-next and fix a ChangeLog typo.
2023-08-15 11:15:16 +01:00
Pete Batard 64e85ed09a
[uefi] don't revoke Windows 11 or post Windows 10 20H1 boot media yet
* As opposed to what we originally asserted, Microsoft did enact a blanket revocation
  in SkuSiPolicy.p7b for all post 1703 up to 2305 Windows UEFI bootloaders.
* As a result, unconditionally copying SkuSiPolicy.p7b will result in media as recent
  as Windows 11 22H2 (v1) being flagged as revoked, which we don't want to enforce as
  long as Microsoft themselves haven't entered the enforcing phase of their Black
  Lotus mitigation (currently planned for early 2024).
* Because of this, while we add some revocation detection for post 1703 bootloaders,
  we set it to only go as far as 20H1 for now, which means that all post 20H1 Windows
  10 media and all Windows 11 media will not yet be flagged by Rufus as revoked and
  will still boot in a Secure Boot environment due to lack of an SkuSiPolicy.p7b.
* Ultimately, per #2244 we may look for a BOOTMGRSECURITYVERSIONNUMBER resource to
  blanket revoke all post 1703 - pre 2305 Windows UEFI bootloaders.
* Also remove the now unused comdlg32 library from the linker.
2023-07-15 23:20:59 +02:00
Pete Batard 5191c68337
[ui] keep user preferred image type when saving drive to VHD
* Also fix a Coverity warning and use a better description for SELECT image types.
2023-07-10 11:34:50 +02:00
Pete Batard 5bbcba8534
[vhd] add write support for .vhdx and .ffu images
* Also move VHD mounting function calls from iso.c to vhd.c and remove unused VHD footer elements.
2023-07-06 19:47:26 +01:00
Pete Batard 0363bfe503
[misc] add an address resolver for internal DLL function calls
* Not sure if we'll use this to hook into FfuCaptureImage()/FfuApplyImage()/FfuMountImage()
  directly. But at least, if we ever need it, it's there...
2023-07-05 18:36:58 +01:00
Pete Batard ef345bf106
[uefi] fix UEFI bootloader extraction when case doesn't match
* With ISO-9660 being case sensitive, we could end up in situations where trying to extract
  '/efi/boot/bootx64.efi' for revocation validation would fail if the file on the image was
  stored as '/EFI/boot/bootx64.efi' (e.g. Debian 12).
* Fox this by storing the exact UEFI bootloader path we detected during ISO scan, and using
  this path for file extraction.
* Also add a Cancel choice to the revocation dialog and harmonize whitespaces.
2023-07-04 18:05:30 +01:00
Pete Batard d4c9f2dfa1
[vhd] enable saving device to compressed VHDX
* Now that we don't have to deal with Windows 7, we can use CreateVirtualDisk() to
  automatically dump a physical disk to VHD/VHDX, so do just that
* Also move the relevant VHD/ISO imaging call to the appropriate source.
2023-07-01 20:43:26 +01:00
Pete Batard 52a5551749
[uefi] improve revoked UEFI bootloader reporting
* Remove duplicates from Microsoft's SKUSiPolicy.p7b
* Also display the number of revoked from embedded
* Also use Microsoft's official capitalization for SKUSiPolicy.p7b's target path
2023-06-22 11:18:49 +01:00
Pete Batard 16570f8662
[uefi] warn about revoked UEFI bootloaders when creating Windows To Go drives
* Also move the warning after the WUE dialog.
* Also work around another possible access violation in process.c.
2023-06-19 10:38:30 +02:00
Pete Batard be5b590cfb
[uefi] add parsing and copying of the system's SkuSiPolicy.p7b
* Instead of embedding the content of the most recent revoked bootloader hashes in db.h
  we now parse the system's SkuSiPolicy.p7b to do so. This has the drawback of not alerting
  users running Rufus on systems where SkuSiPolicy.p7b is not up to date, but I believe the
  trade-off is worth it.
* We now also copy the system's SkuSiPolicy.p7b to the created media when possible (for
  Windows 10 or later), so that Microsoft's WDAC UEFI revocations can apply during boot.
2023-06-18 19:07:45 +02:00
Pete Batard 43764268de
[uefi] add detection and warning for revoked bootloaders
* Considering that alerting users to potential security breaches that may be
  exploited by boot media should also be performed by application that create
  them, we add detection for all the currently known revoked UEFI bootloaders,
  be it the ones from the official UEFI DBX as well as the ones from Windows'
  SkuSiPolicy.p7b, and warn the user when one such bootloader is detected on
  their source media.
* Note that, to actually be revoked, the bootloaders flagged through SkuSiPolicy
  require the copying of the .p7b to the boot media, which we are currently
  not enacting but will perform in a subsequent commit.
* Also fix a Coverity warning in hash.c.
2023-06-16 20:36:50 +02:00
Pete Batard c4b1b23832
[hash] add PE256 hash functions
* Mostly copied from U-Boot's https://github.com/u-boot/u-boot/blob/master/lib/efi_loader/efi_image_loader.c
2023-06-13 17:57:34 +02:00
Pete Batard 090bfb9770
[misc] rename checksum.c to hash.c 2023-06-11 16:18:26 +01:00
Pete Batard 3e81b38c2d
[misc] try to support folks who use a symlink for their temp dir
* Microsoft's WIM mounting APIs can't use symlinked directories and
  some folks want to use a symlinked temp dir...
* Closes #2084
2023-06-05 14:08:25 +01:00
Pete Batard 4d89e83b5d
[ui] change the log icon to something more explicit
* Hopefully a notepad/logbook icon will be more intuitive.
* Also tweak the new message for diskcopy.dll download and add French translation.
2023-05-27 16:18:22 +01:00
Pete Batard 3afa139d7a
[dos] reinstate MS-DOS boot disk creation for Windows 10 and later platforms
* The BlackLotus malware shows that it is possible to download individual
  executables and DLLs straight from Microsoft's symbol servers, so we use
  that capability to download the missing Windows 8.1 'diskcopy.dll', that
  contains the flat floppy disk image with MS-DOS files we need. See:
  https://randomascii.wordpress.com/2013/03/09/symbols-the-microsoft-way/
* Also reorder entries in the "Boot selection" dropdown.
* Also use CreateFileWithTimeout() in GetLogicalName().
2023-05-24 17:55:25 +01:00
Pete Batard 3a0f7d3813
[iso] attempt to fix the clusterfuck of GRUB 2.06 incompatible versions
* As was *ENTIRELY PREDICTIBLE*, the lack of timely releases from the GRUB
  project has resulted in distro maintainers (Ubuntu, Fedora, etc.) taking
  matters in their own hand and applying patches on top of their 2.06 version.
  However, these patches result in 2.06 bootloaders that are incompatible
  with 2.06 modules that don't have the same patches applied. Especially this
  now results in the infamous "452: out of range pointer" error message when
  using patched modules with unpatched bootloader or unpatched modules with
  patched bootloaders.
* Making this issue worse, we also have distro maintainers who won't add a
  suffix to their GRUB version, AS ONE SHOULD DO WHEN ONE APPLIES TONS OF
  PATCHES ON TOP OF A PROJECT'S SOURCE, and MISreport their non 2.06 GRUB as
  "2.06", and, because we can't detect what patches are needed from modules
  themselves (unlike what is the case for grub_debug_is_enabled), we have no
  way of telling incompatible GRUB 2.06 binaries from one another.
* As a result, we have no choice but to append a sanitized version of the ISO
  label to the GRUB version, as a means to differentiate between incompatible
  versions, and tweak our existing bootloader download mechanism to *ATTEMPT*
  to download a compatible 'core.img' from our server... where we will have
  to waste a lot of time adding new binaries and symlinks to try to make all
  these GRUB "2.06" based images work, and will probably miss quite few with
  the end results that users who are just trying to install Linux will be left
  stranded.
* Again, I have to point out how the end result of regular users wanting to
  try Linux and being unable to do so is the *DIRECT* result of the GRUB project
  maintainers having sat on a 2-year influx of CONTINUOUS patches, and thinking
  that "Release Early, Release Often" is only a gimmick, and not something that
  should apply to their project, even as they have been warned before, by yours
  truly, that *NOT* releasing on a timely basis is causing actual grievances...
  That's because, had the GRUB maintainers released on a timely basis (at least
  once a year) Fedora and Ubuntu would be using vanilla GRUB 2.07 with the memory
  patches, and we wouldn't be trying to mix that with old GRUB 2.06 binaries.
* For more on this, see #2233, noting that we will need to apply a compatibility
  breaking change during the 4.1 release, to revert the patches we applied to
  the default 2.06 'core.img' in pbatard/rufus-web@320b800592.
2023-05-16 14:05:28 +01:00
Pete Batard 0df68b6af9
[misc] further Windows 7 specifics removals
* Also remove some unused code in stdlg.c
* Note that virtdisk appears to be a vulnerable library, so we go
  through delay loading yet again...
2023-04-28 17:46:05 +01:00
Pete Batard 1e51385bed
[misc] revert to using the OS arch rather than app arch for the update download
* This means that someone running Rufus x64 or ARM64 should be
  proposed Rufus ARM64 rather than Rufus x64 as an upgrade.
* Also switch the BETA channel from x86 to x64.
* Also remove the _chdirU(app_dir) when using -i in commandline.
2023-04-24 20:50:53 +01:00
Pete Batard a354178239
[cmd] fix the use of relative paths with option -i
* Closes #2232
2023-04-23 13:06:32 +01:00
Pete Batard fffd4d1160
[misc] harden usage of uprintf()
* Passing a non-formatting buffer as first parameter of uprintf() can lead
  to an exception if this buffer happens to contain a '%' character, so
  usage of uprintf() with string buffers that may contain '%' should be
  sanitized.
* Also drop the _uprintf/_uprintfs aliases as they are no longer required.
2023-04-20 17:43:24 +01:00
Pete Batard 1a3a155e8c
[dev] fix description of UAS devices
* Having Windows append "SCSI Disk Device" screws up the scoring regarding
  disks that are actually describing themselves as SCSI, so replace that
  with "UAS Device", as it should be.
* Closes #2221.
* Also fix a MinGW warning.
2023-04-19 13:38:19 +01:00
Pete Batard a6451c6fc7
[misc] further Windows version and arch detection improvements
* Now also populate the underlying Windows arch in the version struct
* Also fix MinGW warnings
2023-04-18 17:32:47 +01:00
Pete Batard e5f90282ed
[misc] improve Windows version detection
* Also use actual Windows major.minor when checking for updates
2023-04-17 13:33:05 +01:00
Pete Batard e86523e024
[enum] minor improvements to drive size handling
* Also fix a typo when trying to detect x86 running on ARM
2023-04-04 10:28:01 +02:00
Pete Batard 018718b2c8
[misc] disable Windows 7 support
* Also set rufus-next to 3.23 and fix a date typo in ChangeLog.txt
2023-03-27 21:45:55 +02:00
Pete Batard 247dbe2f7b
[ui] preserve user-specified label on error/cancel or drive insertion
* Also produce warnings in the log if we detect Windows write-protection policies.
2023-03-14 20:31:51 +00:00
Pete Batard d78a556e4e
[loc] report if an external loc file is used, in the UI log
* Also avoid using LPTSTR in lieu of LPWSTR (even if they do resolve to the exact
  same thing) and force the use of app_dir when looking for a local .loc file.
* Closes #2193
2023-03-04 16:21:25 +00:00
Pete Batard aed34ca635
[misc] report if running x86 emulation on ARM
* Also fix a static analysis warning.
2023-02-26 22:10:22 +00:00
Pete Batard b163b3dfe2
[core] fix default listing of large SanDisk SSD devices
* Closes #2164
* Also add breakdown of score computation when device enumeration debug is active
* Also fix a minor Code Analysis warning in msapi_utf8.h
2023-02-13 13:34:17 +00:00
Pete Batard 1dc9fab917
[misc] add a cheat mode to preserve the log between sessions
* This new cheatmode (<Ctrl>-<P>) is mostly designed to help with development.
2023-01-13 21:49:57 +00:00
Pete Batard 1ce1f47a8b
[wue] add option to Disable BitLocker automatic device encryption
* See https://learn.microsoft.com/en-us/windows-hardware/design/device-experiences/oem-bitlocker#disable-bitlocker-automatic-device-encryption
* Closes #2121
2023-01-10 20:43:07 +00:00
Rose fab095c043
[misc] prefer strtol/strtoull over atol/atoll
* This means we don't need to worry about conversion issues regarding signedess. In addition,
  the behavior will no longer be undefined if for some reason the conversion cannot happen.
* Closes #2104.
2022-12-08 11:21:39 +00:00