Commit Graph

115 Commits

Author SHA1 Message Date
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
Pete Batard 9d1a2bc25e
[net] fix session variables not being cleared in ResolveRedirect()
* Also set default network timeouts to 3500ms
* Also add '-Sta' option when running Fido so that at at least the UI can display on Windows 7
2019-03-05 16:25:14 +00:00
Pete Batard db68bcd7f9
[fido] use Rufus existing alert handler to close Fido's cookie prompts
* Addresses pbatard/Fido#1 while being much more effective than an all-script solution
2019-03-05 12:41:10 +00:00
Pete Batard 8823c0cf9c
[net] always download latest release of Fido
* Also clean up/factorize some of the net code
2019-03-04 19:14:54 +00:00
Pete Batard 2a77763dc3
[net] add ISO selection after successful download
* Also use UM_TIMER_START message to start timed operations
2019-03-04 11:57:33 +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
Pete Batard 078aaf7714
[net] disable BETA version check for anything but x86_32 2019-02-05 17:49:27 +00:00
Pete Batard 04a5793ee7
[misc] use compilation flag to undefine NDEBUG for assert 2018-11-21 17:45:18 +00:00
Pete Batard 6109d91c38 [net] add automated update support for ARM/ARM64 2018-10-22 17:42:40 +01:00
Pete Batard bc6e23ec11 [net] drop the requirement for text/plain MIME on the .ver files
* This should fix the update check when picking off the .ver off github
* Also update non working links
* Closes #1229
2018-10-16 21:51:40 +01:00
Pete Batard 71578459d7 [loc] fix spaces before full stops
* Also: "Asserts, it's not just for debug any more!"
2018-07-31 20:47:24 +01:00
Pete Batard 275493c3f5 [net] add additional error messages
* Also update 7-zip URL
2018-07-24 14:07:08 +01:00
Pete Batard c12640b547 [ui] fix progress not being displayed for syslinux/grub downloads
* Also make download of .sig files a bit less verbose
2018-07-03 22:54:06 +01:00
Pete Batard 7c142fadbc [net] improve handling of invalid signatures
* Also make bPromptOnError an actual parameter to the download function calls
* Also prefer the use of assert() to custom assertion messages
2018-06-30 22:45:15 +01:00
Pete Batard fdfc9ff82d [pki] add RSA-2048 signature validation for all server downloads
* Closes #1172
* Also fix a MinGW warning in badblocks.c
2018-06-29 18:19:05 +01:00