Commit Graph

191 Commits

Author SHA1 Message Date
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
Pete Batard 500172a7a3
[core] fix format error when trying to use old BIOS fixes with VHDs
* And other improvements
* Closes #1409
2020-07-03 15:24:37 +01:00
Pete Batard c8078b0119
[misc] fix Coverity warnings
* Also re-instate the _coverity.cmd script and try to fix AppVeyor Coverity uploads
2020-06-19 10:53:40 +01:00
Pete Batard c601aed054
[core] add option to write a small enough ISO to an ESP
* This is mostly aimed at Debian 11 netinst on the Raspberry Pi 4
* Only available for regular UEFI ISOs if GPT and FAT are selected (no MBR ESPs).
* Also fix a MinGW warning in GetUnusedDriveLetter()
2020-06-06 22:19:20 +01:00
Pete Batard 23057f6124
[core] add a cheat mode (Alt-P) to toggle GPT ESP to Basic Data
* Windows 10 or later *ONLY*
* Also don't report a GPT partition name if it's empty
2020-06-06 16:37:25 +01:00
Pete Batard 3b327bff83
[loc] flag "Deleting partitions" message as a potential lengthy operation
* Also use this update to factorize all "This may take a while" messages.
2020-06-03 16:03:20 +01:00
Pete Batard 56e87429d7
[misc] fix MinGW/gcc 10.x multiple definition errors 2020-05-18 21:25:44 +01:00
Derek Foreman 8a59238022
[core] don't leak logical handle from GetDriveLabel()
* Closes #1525
2020-04-28 17:47:26 +01:00
Pete Batard 70fb34549b
[misc] fix a VS2019 analysis warning
* Also fix minor whitespace issues.
2020-04-11 15:02:08 +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
Pete Batard e0bc2e5ffd
[core] fix reporting of unpartitioned drives
* Also add an extra note to the protective GPT MBR
2020-02-20 11:58:03 +00:00
Pete Batard 88be86d3d4
[core] improve reporting of partition types
* Add GPT partition types and improve MBR partition type handling
2020-02-06 18:23:19 +00:00
Pete Batard bf8d888b21
[ext2fs] fix creation of persistent partitions for pre-1703 platforms
* Windows platforms prior to Windows 10 1703 cannot access any logical partition besides the
  first one (we don't even get a volume for those).
* This fix enables the use of physical + offset for ext# formatting to work around this,
  which is file since we don't actually need to mount the partition.
* Also fix ext2fs_open2() not handling normalized versions of Windows drive paths ("\\?\...")
* Also fix an issue where we would make the drive letter unavailable after formatting a
  standalone partition to ext#.
* Also ensure that we return an error if the drive we attempt to locate a partition on
  through an offset does not match the currently selected one.
* Also remove some unused calls in drive.c.
* Closes #1374
2019-09-14 23:33:46 +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 94e2015edf
[core] use offset rather than index to identify a partition
* Also fix potential bcdboot invocation failure by introducing a new AltGetLogicalName() call.
* Also use the AltMount calls for ext# formatting
2019-08-18 14:13:09 +01:00
Pete Batard 936bd9beb0
[core] revert to having the ESP as the last partition
* This is to avoid Microsoft's appalling refresh of the partition layout,
  which can result in partitions not being assigned a volume GUID.
* Mostly reverts a change that was applied in 1c39a80d72.
* Also add some more enum output and bail if we can't get a logical drive.
* Closes #1351
2019-08-13 09:14:13 +01:00
Pete Batard f95aa94c57
[core] prevent the enumeration of Windows 10 19H1 sandbox VHDs
* The new 19H1 Windows Sandbox feature relies on VHDs labelled 'PortableBaseLayer' → Don't list those
2019-07-15 12:35:22 +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 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 5ae6e4f494
[ext2fs] improve error reporting
* Also clean up VDS error messages
2019-05-02 15:41:42 +01:00