Commit Graph

210 Commits

Author SHA1 Message Date
Pete Batard 03d46b3d87
[misc] silence a benign log warning
* Also update ChangeLog for 4.5 BETA.
2024-05-08 15:44:32 +01:00
Pete Batard 6dac531552
[misc] don't pass an output size in DeviceIoControl() when not needed
* Also improve partition creation and address 2 Coverity warnings.
2024-04-01 14:56: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 15e3886499
[iso] enable persistence support for Linux Mint
* Mint users sure are lucky that one of them *lied their way through* pretending that
  persistence actually used to work with previous version of Mint, when it never did,
  because they got us going through a whole refactor of the partition creation process
  just so we could make Mint persistence work.
* Closes #2428.
* Also fix a Coverity warning.
2024-02-09 16:59:28 +00:00
Pete Batard 0f23c47184
[misc] refactor partition creation 2024-02-08 14:17:03 +00:00
Pete Batard ebe01cc7b6
[dev] filter out Microsoft Dev Drives
* Microsoft Dev Drives are VHDs consisting of a small MSR followed by a large (50 GB or more)
  ReFS partition. See https://learn.microsoft.com/en-us/windows/dev-drive/.
* Closes #2395.
2024-01-08 16:43:52 +00: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 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 10dbfdd7e1
[core] make sure the main partition size is aligned to the cluster size
* Having NTFS partitions properly aligned to the cluster size can drastically
  improve the speed of capturing a disk to an FFU image, as, when the size
  is aligned, the FFU capture uses the actual NTFS allocation map to only read
  and capture the clusters that are actually in use, whereas, if no aligned,
  FFU capture falls back to a sector by sector copy that is both much slower
  and also includes unwanted leftover garbage.
* Also only enable FFU when we detect FFUProvider.dll as a system library.
2023-07-04 13:26:04 +01:00
Pete Batard 0b1c68635a
[vhd] add experimental save to Full Flash Update (FFU) image support
* Full Flash Update (FFU) image support was added to dism with Windows 10 1709
  and is an alternate way to save a virtual hard disk for restoration.
* While more modern than VHD/VHDX, FFU creation only works for drives with file
  systems that Windows natively recognizes (FAT, NTFS) and that look like Windows
  installation media, so you can forget about FFU'ing a Linux disk.
* The other *intentional* drawback that Microsoft added is that they don't want
  anybody but themselves being able to create and restore FFU images, so, even
  as they have nice FfuApplyImage()/FfuCaptureImage() calls in FfuProvider.dll
  they have decided not to make these public.
* This means that, since we don't have time to spend on figuring and direct
  hooking internal DLL calls for x86_32, x86_64, ARM and ARM64 (and worrying
  that Microsoft may ever so slightly change their DLL between revs to break
  our hooks), we just call on dism.exe behind the scenes to create the FFU.
2023-07-03 23:57:04 +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 23d89d9764
[misc] apply a timeout when querying drives for letters/type
* Some Windows Store reports suggest that the existing call might freeze
  on CreateFile() leading some users to kill the app. So switch to using
  a CreateFile() call that times out instead of waiting forever...
2023-05-03 16:26:54 +01:00
Pete Batard 3177e70e25
[misc] fix CodeQL warnings 2023-04-22 16:36:27 +01:00
Pete Batard d18260bec3
[misc] update version to 4.0
* With the removal of Windows 7 support, wrong platform archs in the check for updates
  (that has now been fixed) and switch to an x86_64 default MinGW binary, we have enough
  breaking changes to warrant a version bump for the major. So just do that.
* Also fix a couple Coverity warnings and update a URL.
2023-04-22 15:46:03 +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 65542b9179
[misc] fix 2 Coverity warnings
* Yay, for once Coverity actually found an actual issue!
2023-03-09 09:55:17 +00:00
Pete Batard ed80d696f4
[core] minor drive.c improvements
* Double the timeout when searching for conflicting processes on error
  and improve the disk extent/drive number error messages.
2023-03-08 13:03:25 +00:00
Pete Batard 861d1473ac
[misc] add a notice about hidden VHDs limiting the drives Rufus can list
* See #2029
2022-08-28 15:24:57 +01:00
Pete Batard d8af83dd14
[core] use Linux Data GUID for ext GPT partitions
* Also add an IS_EXT() macro
2022-06-08 19:37:24 +01:00
Pete Batard f669f05403
[iso] add ISOHybrid "CD" partition and ISO9660 file system detection
* Notably for openSUSE-Leap-15.3-XFCE-Live-x86_64-Build9.427-Media.iso
2022-04-05 18:31:03 +01:00
Pete Batard 8ec570570f
[core] reassign a letter for drives written in DD mode that don't have an ESP
* This should help with the CoreELEC usage case described in #1842
* Also add MBR handling for ESP ↔ FAT cheat mode (Alt-P)
* Also set rufus-next to 3.19
2022-03-24 17:24:39 +00:00
Pete Batard d07ec87b3a
[mingw] fix compilation breakage due to MinGW header screwup
* See https://github.com/pbatard/rufus/actions/runs/1900092904
* Guys, I know VDS is fundamentally broken... but that's no reason to break it further!
2022-02-28 22:00:41 +00:00
Pete Batard 4223fe9681
[misc] fix inverted memset() parameters
* Also fix artifact name for VS2022 builds.
2022-02-11 18:42:38 +00:00
Pete Batard ebaa7d561a
[core] add file System detection from superblock
* Also prevent GitHub Actions from failing on VirusTotal upload
2022-02-04 17:41:44 +00:00
Pete Batard 036f6260c5
[ui] fix regression in conditional expression and use %c always
* This fixes the regression introduced in c28f9bc491.
* 'if ((a && !b) || (!a && b))' can not always be simplified as 'if (a != b)' when the types for 'a' and 'b' are not straight booleans.
* Closes #1862
* Also drop the use of '%C' in printf() expression, as it is intended to print wide characters and not turn a char to uppercase.
2022-01-31 16:55:42 +00:00
Pete Batard 00a802ca1d
[iso] fix ISO→ESP creation for Windows 11
* In their great "wisdom", Microsoft made it even harder to access ESPs on Windows 11,
  meaning that we have to use even more convoluted ways of providing the ISO→ESP feature.
* Closes #1855
2022-01-20 15:24:35 +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 b30e3b387a
[efi] update UEFI:NTFS to latest
* Also remove Secure Boot notice since (outside of 32-bit ARM and exFAT)
  our bootloaders and NTFS drivers are now Secure Boot signed.
2021-10-23 02:49:15 +01:00
Pete Batard ce8aaa99f7
[core] add VDS detection and print a notice if VDS is unavailable 2021-10-04 14:29:09 +02:00
Pete Batard 8ceb0045fa
[grub] update embedded GRUB to 2.06
* Also enable NTFS and ext# as GRUB2 compatible file systems.
2021-07-27 18:10:29 +01:00
Pete Batard aeae66e971
[efi] prevent a drive letter to be assigned to the UEFI:NTFS partition
* Closes pbatard/uefi-ntfs#25
* Also make the UEFI:NTFS partition read-only for release version
2021-05-29 13:59:59 +01:00
Pete Batard 80eca5739d
[core] split zeroing and dd write operations
* This is in preparation for async reads
* Also move open/close image operations to WriteDrive()
* Also increase DD buffer size to 32 MB to improve performance
2021-04-21 22:58:41 +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 20b8a84595
[core] fix potential "loss" of disk after writing Ubuntu 20.10 in DD mode
* Due to the partition gymnastic that is required by the hack that is ISOHybrid,
  some ISOHybrid images that are written in DD mode, such as Ubuntu 20.10, may
  result in Windows somehow "losing" the target disk from some of its listings.
* This "removal" can be seen for instance if you have diskpart already open and
  issue 'list disk' after Rufus 3.13 completed its image writing.
* In the worst case scenario, Windows may flat out refuse to access the disk at
  the sector level be it in diskpart or disk manager, which forces ones to clear
  the partition tables on Linux or some other OS to be able to "recover" the disk.
* This appears to be mostly due to Windows VDS cache (which Microsoft assures
  should be able to do a proper job of refreshing itself on its own, in the same
  stride as they also feel the need to introduce IVdsService::Refresh whose sole
  purpose appears to work around a limitation that Microsoft knows exists) not
  being in sync with the actual disk layout.
* So we now add calls to VDS layout refresh where needed, to work around the issue.
* Also fix an ext2fs Coverity warning.
2021-01-15 17:50:57 +00:00
Pete Batard 0e43c5f2ea
[vds] improve VDS error reporting 2020-11-13 17:51:48 +00:00
Pete Batard 35b0ab2470
[ui] add cheat mode (Alt-M) to ignore Boot Marker 2020-11-12 17:38:20 +00:00
Pete Batard a9681c0c2a
[core] fix a possible crash in DeletePartition() with a blank disk
* For blank disks, GetVdsDiskInterface() may return success with a NULL pAdvancedDisk.
* Also silence the annoying "Failed to read label" error on ERROR_UNRECOGNIZED_VOLUME.
2020-11-10 17:30:49 +00:00
Pete Batard 2538974318
[core] improve VDS calls
* Factorize error setting.
* Use break so as to not leak resources on error.
* Ensure that the error codes are set properly.
2020-11-09 16:48:53 +00:00
Pete Batard e8c717c394
[ui] always use fake units for proposed labels
* Also improve log messages
2020-11-03 12:49:08 +00:00
Pete Batard 65a0c2c42d
[core] reinstate locking of the logical drive when writing images
* When writing images such as tails, that contain a large ESP, Windows forcibly
  removes the media while we are writing it, unless we lock the logical drive.
* Also fix a Bled Coverity warning.
2020-10-28 21:41:43 +00:00
Pete Batard b2b621cec7
[core] improve mounting/unmounting of volumes
* Factorize drive letter removal into a RemoveDriveLetters() call.
* Improve MountVolume() and RemountVolume() calls.
* Also bump Rufus version to 3.13
2020-10-26 11:48:33 +00:00
Pete Batard 3758f84b17
[vds] improve VDS calls
* Make sure that instantiated objects are released.
* Factorize the instantiating of disk interfaces.
* Allow the provision of an offset to delete a single partition.
* Add a ListVdsVolumes() call (which is pointless since Microsoft *CRIPPLED* its VDS implementation).
2020-10-25 13:09:32 +00:00
Pete Batard 8085a2846d
[misc] fix small issues
* SetAutoMount()/GetAutoMount() should check for INVALID_HANDLE_VALUE and not NULL.
  Also we don't actually need to open MOUNTMGR_DOS_DEVICE_NAME rw to issue an IOCTL.
* ToggleEsp() failed to exit properly when an ESP offset was specified.
* Introduce PI_MAX to explicitly set the size of the partition_information table.
* write_sectors() has write retry, so there's no need to perform one on top of it.
* When we exit FormatThread(), GetLogicalName() should attempt to look for the the
  main partition and be silent.
2020-10-25 12:31:30 +00: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 f04ed61805
[ext2fs] use physical + offset always for extfs partition creation 2020-09-10 17:50:06 +01:00
Pete Batard 1e56c8812e
[togo] move ESP to the beginning of the drive on systems that allow it 2020-09-10 17:48:09 +01:00
Pete Batard 3f0d574657
[misc] improve ToggleEsp() call to take an offset
* Also fix a MinGW warning
2020-08-15 14:58:55 +01:00
Pete Batard ba406843f4
[core] work around a Windows bug where GetVolumePathNamesForVolumeName() can return the wrong drive letter
* A user is reporting that, on one of their platforms, Rufus is writing to the wrong target during the file-copy
  phase and using their existing Y: local drive instead of the drive associated to the USB, despite the fact
  that Rufus is passing the right volume name to GetVolumePathNamesForVolumeName().

* Here's the PowerShell wmic output, confirming that the volume GUID obtained by Rufus is the right one:

  DriveLetter : Y:
  DeviceId    : \\?\Volume{000349b1-17d0-69f6-c13f-f31162930600}\
  Capacity    : 118540464128
  FileSystem  : NTFS
  Label       : Y-DISK

  DriveLetter : H:
  DeviceId    : \\?\Volume{b150ff4a-d62b-11ea-86e3-f49634660e54}\
  Capacity    : 15791824896
  FileSystem  : FAT32
  Label       : ADATA16GB

* And here's the Rufus log demonstrating that GetVolumePathNamesForVolumeName() is returning the *WRONG* letter:

  Found volume \\?\Volume{b150ff4a-d62b-11ea-86e3-f49634660e54}\
  \\?\Volume{b150ff4a-d62b-11ea-86e3-f49634660e54}\ is already mounted as Y: instead of H: - Will now use this target instead...

* The last line shows, without the shadow of a doubt, that we did feed "\\?\Volume{b150ff4a-d62b-11ea-86e3-f49634660e54}\" to
  GetVolumePathNamesForVolumeName() and that this API call was successful (returned a non zero size) but ultimately returned
  the wrong letter (Y: instead of H:)...

* Therefore, Windows is BUGGY and the use of GetVolumePathNamesForVolumeName() must be avoided.
2020-08-13 14:49:34 +01:00
Pete Batard 4617f91e3b
[misc] introduce hImageOption and ComboBox_GetCurItemData() to simplify code
* Also add retry to ms-sys' write_sectors()
2020-07-17 21:51:15 +01:00