Commit Graph

129 Commits

Author SHA1 Message Date
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 1be7eaf306
[net] fix Fido script not being able to be launched again on user cancel
* Also update workflows to latest setup-msbuild
* Closes #2419
2024-02-07 19:24:17 +00:00
Pete Batard 94ecf74c5f
[misc] use FORMAT_MESSAGE_FROM_HMODULE where possible and drop our custom message tables 2023-09-04 11:41:35 +01: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 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 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 c47ee4c435
[cmp] update Bled to latest
* Adds the provision of default buffer size in bled_init()
2023-06-30 13:05:42 +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 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 3177e70e25
[misc] fix CodeQL warnings 2023-04-22 16:36:27 +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 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 6280e8020a
[net] fix incorrect architectures when querying for updates 2023-04-16 19:47:54 +01:00
Pete Batard 6ebe13eb31
[fido] deactivate Fido for Windows 7
* Also add an extra Fido translation string and improve/fix Fido testing.
* Also add an exception for HP iLO SD-CARD devices (Closes #2136).
2023-01-27 17:23:08 +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
Pete Batard a3c75e480e
[core] revert to direct-hooking into wininet.dll
* This reverts 3194a4dac4 on account that MinGW's delay loading of
  wininet.dll causes the application to prematurely close.
* Yet another episode of the never ending #1877 saga...
2022-04-27 10:41:19 +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 89db56acbc
[net] add fallback to InternetGetConnectedState() when INetworkListManager service dependencies are missing
* INetworkListManager appears to depend on specific services to be able to work,
  which one can actually disable while still getting full Internet connectivity.
* If that is the case, HRESULT_FROM_WIN32(ERROR_SERVICE_DEPENDENCY_FAIL) will be
  returned, therefore we add a fallback to using InternetGetConnectedState(), which
  does not have such dependencies (but has other limitations per b2492908be)
  when we detect a dependency error.
* Also take this opportunity to switch to using INetworkListManager::get_IsConnectedToInternet().
* Also fix Coverity breakage due to Synopsys having upgraded their toolchain.
* Closes #1801
2022-02-18 17:18:34 +00: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 6ed7524c1b
[ui] fix download status message remaining indefinitely
* Closes #1727
2021-07-26 17:19:45 +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 f26fd2fbe3
[fido] add additional Authenticode validation before running the script
* This basically means that the script is validate *TWICE*, using two
  completely independent signatures, before it is allowed to run, which
  should add another mitigation layer against TOCTOU (which we already
  friggin' mitigated against anyway) and other potential vectors of
  attack.
* Also remove -DisableFirstRunCustomize option and the associated cookie
  prompt monitoring, which the latest version of Fido no longer requires.
* Also update WDK version for signtool and flesh out PKI error messages.
2021-05-27 00:19:25 +01:00
Pete Batard d77a825ffd
[misc] don't overdo CoUninitialize calls
* 2e1833e91e introduced issues with VDS since, despite what
  Microsoft's documentation says, balancing CoInitialize with CoUninitialize
  leads to VDS not properly relinquishing disk access.
2021-04-14 18:13:36 +01:00
Pete Batard 2e1833e91e
[misc] improve CoInitialize calls
* Balance with CoUninitialize and add COINIT_DISABLE_OLE1DDE
* Also add /BREPRO linker flag for reproducible VS2019 release builds
2021-04-09 12:36:30 +01:00
Pete Batard b2492908be
[net] switch to INetworkListManager::GetConnectivity to detect connectivity
* InternetGetConnectedState() is next to useless and doesn't provide
  coherent outcome on the ARM64 platform I'm testing with. This results
  in Rufus declaring that Internet is unavailable on platforms that do
  have actual Internet connectivity.
* Swicth to using INetworkListManager::GetConnectivity(), which actually
  reports a dependable result.
* Closes #1691
* Also remove the mutex for uprintf(), which may produce thread lockout
  and remove an unwanted double GetSignatureName() call on startup.
2021-02-06 18:58:42 +00:00
Pete Batard 69bf32dd33
[misc] fix some static analysis warnings
* Also improve fast-zeroing code and upgrade Bled to latest
2020-10-27 10:12:24 +00:00
Pete Batard 71ede6d9a0
[cmp] update Bled to latest
* Also ensure that we support Unicode paths for 7-zip
* Also ensure that error messages are displayed in English
2020-06-10 20:13:12 +01:00
dmex 63bb308ad6
[net] add HHTP2, gzip, deflate support
* Closes #1550
2020-06-02 12:05:03 +01:00
Pete Batard 3c75ca92b4
[core] fix potential invalid label for non western locales
* If a converted label contains mostly underscore, the proposed
  label is used for FAT32 instead. However this label still has
  the KB/MB/GB symbols localized so it may be invalid.
* Ensure that we use a non-localized version of the size when
  using such a label.
* Closes #1506.
* Also fix a VS2019 static analysis warning in net.c.
2020-04-10 17:59:12 +01:00
Pete Batard 2442aaf76f
[dev] improve FIXED vs REMOVABLE detection for drives with unmounted partitions
* And add an exception for a reported flash drive
* Also fix a couple warnings in msapi_utf8.h and net.c
2020-04-10 13:16:57 +01:00
Tsarevich Dmitry 121257c584
[misc] fix PVS-Studio static analyzer warnings
* Surround macro params to ensure expected results
* Fix copy-paste errors
* Fix a potential buffer overflow in SetSectionHeaders()
* Add const modifier where relevant
* Use GetWindowLongPtr() everywhere
* Use proper sprintf format for unsigned int
* Use %s for printf-like funcs (https://www.viva64.com/en/w/v618/print/)
* Closes #1464
2020-02-28 17:08:11 +00:00
Pete Batard c1613ab7fc
[cmp] upgrade Bled to latest 2019-12-27 00:21:22 +01:00
Pete Batard 7ec7331200
[net] fix a small memory leak in the update check
* A 257-byte signature buffer was not being freed if check for BETAs was enabled.
2019-10-24 13:05:07 +01:00
Pete Batard 4c816a519e
[misc] update license URLs and align ms-sys's write_data buffer to 4K
* Also remove some obsolete TODOs
2019-09-06 11:32:37 +01:00
Pete Batard 21351b9fbe
[misc] refactor the "operation in progress" detection
* Remove unused iso_op_in_progress and use a single op_in_progress that gets
  set when we disable the controls.
* Also fix an issue where Ctrl-L was being processed as Alt-L due yet another
  completely backwards Windows behaviour where the message that is meant to
  indicating whether Alt is pressed is also sometimes used to indicate that
  another key is being pressed if the dialog doesn't have keyboard focus...
2019-08-22 14:04:41 +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 f6687e729b
[ui] fix unwanted persistence unit overlay
* Also fix a typo and make sure to quote more paths when invoking Fido.
2019-06-05 17:00:21 +01:00
Pete Batard a89ed8bc60
[net] make sure Fido script path is quoted
* Fixes pbatard/Fido#11
2019-06-05 16:29:54 +01:00
Pete Batard 2ff6da49f0
[extfs] add standalone ext2/ext3 formatting
* Only enabled when Advanced format options are shown
* Also enable reading of extfs volume label
* Also improve GRUB lookup fallback
* Also fix possible truncation when sanitizing labels
* Also write a zeroed MBR when non-bootable is selected
2019-05-03 23:51:05 +01:00
Pete Batard 2a1c57c750
[ui] disable button and add a countdown when launching update
* Also disable Launch button while we do so
* Also add new <Ctrl>-<Alt>-<Y> cheat mode
* Also terminate update thread before exiting if running
* Also set version to rufus-next
2019-04-01 16:38:27 +01:00
Pete Batard 661ba7b64c
[core] fix Win7 EFI boot file extraction when dual BIOS+UEFI is in use
* Closes #1292
* Also add "RISD" (Ricoh IDE SD Card reader) to list of card readers (#551)
* Also make running Fido script read-only
2019-03-27 12:21:41 +00:00
Pete Batard 4271e42b50
[fido] download an LZMA compressed version of the script
* Since we have compression available through Bled we might as well use it
* Also validate that the download URL comes from https://github.com/pbatard/Fido
* Also prevent the check for update from running while we are downloading ISOs
2019-03-23 13:59:20 +00:00
Pete Batard 3aecbf371b
[net] fix display of download filesize for RTL languages
* Closes #1279
2019-03-20 13:28:42 +00: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 9cc9d3fefe
[misc] update the Changelog
* Also fix a warning about uninitialized variable
2019-03-14 23:16:31 +00:00
Pete Batard 25a4666911
[ui] fix fs selection and remove prompt for GRUB/Syslinux downloads in GPT mode
* FS selection might default to NTFS instead of FAT32 after having selected a Linux ISO if
  no drive was plugged in when the ISO was selected and then a drive was plugged using NTFS.
* Also display Fido's exist code
* Closes #1255
2019-03-14 18:53:08 +00:00
Pete Batard 0c368b4e69
[loc] finalize translations for 3.5
* Also update for latest Fido and simplify SetLGP
2019-03-12 19:53:25 +00:00
Pete Batard 65f886141b
[fido] improve UI handling
* Center dialog on open
* Close dialog on main application exit
* Display ISO short name & size on status bar during download
* Display ISO download progress on taskbar
* Also fix improper detection of EAGET Mass Storage USB Device as HDD
2019-03-07 16:29:43 +00:00