Commit Graph

353 Commits

Author SHA1 Message Date
Pete Batard fbad63666e
[wue] add fallback to index 1 if boot.wim index 2 is not available
* Some "unofficial" Windows ISOs use a custom boot.wim that only includes the Setup
  image at index 1, rather than at index 2, after the PE image, for official ISOs.
* Also refactor to add a long needed vhd.h header.
* Also fix a MinGW warning.
2022-08-02 20:14:29 +01:00
Pete Batard a19828c9d1
[wue] move WUE, Windows To Go and WinPE calls to their own source 2022-07-25 13:18:14 +01:00
Pete Batard c34cbab3b5
[wue] remove non-existent min disk size bypass
* Closes #1990
* Also group all of SB, TPM and min RAM into a single option and update French translation
2022-07-22 13:02:02 +01:00
Pete Batard 9073962faf
[wue] add automatic local account creation and regional settings duplication
* Local account is created with the same name as the current user along with an *empty* password
  (which we force the user to change on next logon). This is done to assuage users who might be
  weary of entering a password in a third party application, and has the benefit of enabling
  autologon when the install is complete.
* Note that the creation of a local account through an answer file prevents Windows 11 22H2
  from bugging users about MSA *even with an active network connection*.
* For convenience reasons, only duplication of the current username is enabled. We *may* add a
  dialog to enter any random username in a future version, but for 3.20, this is all you get.
* Likewise, the locale duplication is only carried out during OOBE and *not* WinPE (which means
  that you still get the initial "Windows setup language and user preferences" prompt). This is
  intentional as otherwise the default screen and "Repair Windows" options are not presented.
* It's not my fault that the Windows password change screen is super ill conceived, whereas it
  doesn't hide the current password field as it should when the current password is blank, and
  one needs to click on a very small arrow to get the changes applied, instead of a PROMINENT
  button that should intuitively have been positioned right next to "Cancel".
* If you want to complain that we should just "present the user with XYZ and be done with it",
  please bear in mind that we can't add new dialogs to Rufus as willy-nilly as you believe we
  can. *ANY* new UI interface requires major planning, which is the reason why, for the time
  being, we are limited to reusing a simple dissociated list of checkboxes for all WUE options.
2022-07-19 19:11:06 +01:00
Pete Batard 5117a3b4a8
[wue] fix MSA bypass not being applied unless SB/TPM or RAM/Disk bypass is also selected
* In a manner that defies logic, Microsoft designed Windows setup to parse Autounattend.xml
  for windowsPE tasks in the PE environment, but only carry out the copying of that file
  to %WINDIR%\Panther for subsequent processing with the other passes *IF* there exist an
  actual windowsPE section.
* In short, when using the Autounattend.xml method, Microsoft have made all passes there
  dependent on the existence of a windowsPE pass, regardless of whether that pass has any
  use or not.
* Working around this would be fine and all (just add an empty windowsPE pass so that the
  later passes get executed) if the absence of a windowsPE pass didn't also determine
  whether the user will be presented with the default Windows setup screens that include
  the "Repair your computer" option or a completely different set of screens (c.f. #1971).
* This means that, to keep users happy, we need to add yet another method to carry out
  tasks that should have remained the realm of boot.wim's Autounattend.xml, and instead
  create a \sources\$OEM$\$$\Panther\unattend.xml when there are no windowsPE tasks (on
  account that setup copies anything found under \sources\$OEM$\$$\ to %WINDIR%\).
  Only through this can we have the specialize and oobeSystem tasks actually carried out
  (for bypassing MSA requirements of skipping the data collection screens) while keeping
  the original Windows Setup look and feel.
* Closes #1981
2022-07-13 18:31:11 +01:00
Pete Batard 14f19e5275
[wue] revert to inserting the bypass registry keys directly where possible
* The use of an unattend.xml to create the TPM/Secure Boot/Disk/RAM bypass keys was
  prompted by Microsoft restricting the ability of Windows Store app from manipulating
  offline registry hives.
* However, the use of a windowsPE phase in unattend.xml to insert the keys results in
  a windows command prompt briefly appearing when setup launches, as well as slightly
  different Windows setup screens from the default.
* So we are now reverting to trying to edit the boot.wim registry hive offline (which
  should work for the non Store version of Rufus) while falling back to using a PE
  unattend section if that doesn't work.
* Closes #1971
2022-07-08 18:48:02 +01:00
Pete Batard e043a49fa7
[ui] add option to set internal drives offline for Windows 11 To Go
* This is enabled by default for Windows 11 images and is done to prevent the
  annoying behaviour of Windows 11 *automatically* upgrading all ReFS drives
  it sees to latest version, thereby instantly preventing you from accessing
  these drives ever again with Windows 10.
* See: https://gist.github.com/0xbadfca11/da0598e47dd643d933dc#Mountability.
2022-06-24 17:47:08 +01:00
Pete Batard a25af06b3c
[ui] drop the option to remove the "unsupported hardware" watermark
* I've never seen that watermark in the first place, therefore can't test if the option is
  working, and, as opposed to the other options, users can deal with it post install anyway.
* Also ensure that we prompt for customization when selecting an install.wim.
2022-06-24 14:27:02 +01:00
Pete Batard a0d669232c
[ui] add a new selection dialog for Windows 11 setup customization
* This moves the extended Windows 11 options (bypass TPM & Secure Boot) away from
  "Image options" into a new explicit dialog, along with supplementary customization
  such as enabling offline account (for Windows 11 22H2) and skipping all data
  collection questions.
* This customization is now enacted through an unattend.xml file rather than offline
  registry manipulation, so that this *should* also work with the Windows Store version.
* Also update arch detection and rework/reorganize upcoming translation changes.
* Note: The 'Remove "unsupported hardware" desktop watermark' option is *UNTESTED*.
2022-06-23 13:34:24 +01:00
Pete Batard 9690742d91
[ui] extend SelectionDialog() to support checkbox selection 2022-06-20 13:47:43 +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 746f91acc7
[core] work around Windows refusing to mount Linux MBR partitions on FIXED drives
* Fixes #1922.
* Also fix a typo and apply minor updates for GitHub Actions workflows.
2022-05-31 16:30:19 +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 3528ca773d
[iso] add support for distros using a NONSTANDARD GRUB 2.0 prefix directory
* Looking at you, openSUSE Live and GeckoLinux!
2022-04-07 01:58:22 +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 209fb18b1c
[iso] add bypass of Windows 11 restrictions for in-place upgrades 2022-02-16 17:25:43 +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
Pete Batard c28f9bc491
[misc] fix PVS-Studio warnings 2022-01-05 12:57:26 +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 d8a2c29a67
[core] fix MBR cleanup regression
* Commit 9dc045a701 introduced a regression on account that we didn't set the
  file pointer to 0 before clearing the disk.
* This leads to the MBR not being properly cleared, with the result that Windows may in turn
  produce errors when trying to repartition the disk.
* Fix this by making sure we do invoke SetFilePointerEx() before calling WriteFileWithRetry().
* Also set rufus-next to 3.17
* Also fix a MinGW warning
2021-10-17 13:35:31 +01:00
Pete Batard 0b618f3de7
[misc] misc improvements and fixes
* Remove BypassRAMCheck from Extended Windows 11 installation since the minimum
  RAM requirements for Windows 11 are 4 GB and not 8 GB as pointed out in #1791.
* Display Windows edition code when we can't resolve it.
* VS2019 wants us to have PackageOptionalProjectsInIdeBuilds enabled? So be it.
2021-10-15 13:13:36 +01:00
Pete Batard 957ec183c9
[ui] improve progress report when disabling Windows 11 installation restrictions
* Also fix Image Options content being lost when switching language.
2021-10-09 16:18:45 +01:00
Pete Batard b043db33e6
[core] add option to bypass TPM 2.0/Secure Boot/RAM requirements for Windows 11 ISOs
* If 'Extended Windows 11 Installation' mode is selected, the system registry hive of
  'sources\boot.wim' is patched to add the Setup\LabConfig registry keys that bypass
  the TPM 2.0/Secure Boot/8GB+ RAM Windows 11 system requirements.
2021-10-08 19:24:10 +01:00
Pete Batard a10b8e8c54
[iso] add Windows ISO version report
* Use sources/compatresources.dll, when available, to try to detect the Windows ISO version and build.
* Also report what facility we use for formatting.
2021-10-08 19:24:07 +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 df8058b4f3
[core] add workaround for Windows 11's locking issue
* Windows 11 appears to be a lot more proactive in locking system partitions (ESPs, MSRs)
  than previous versions of Windows were, resulting in format or access errors.
* Try to work around these by disabling exclusive drive locking as needed.
2021-09-28 16:17:35 +01:00
Pete Batard d203c91403
[core] report Windows edition
* Also use build number to detect Windows Server 2019 and Windows 11
  since Microsoft are COMPLETE ASSES about their version reporting.
* Also fix a compilation warning.
2021-09-26 16:20:46 +01:00
Pete Batard deee38d4e5
[misc] fix log potentially not being saved on exit
* Also ensures that if the user deleted the directory we don't recreate it for the log.
* Also fix typos and Coverity warnings.
2021-09-19 21:01:45 +01:00
Pete Batard 9dc045a701
[core] speed up the clearing of MBR/GPT sectors
* write_sector() should really only be used when writing single sectors as it
  is way to slow for anything else => Switch to using WriteFileWithRetry().
* Also revert an unwarranted change from f0047986e7.
2021-09-19 14:29:30 +01: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 57af9e7106
[misc] set rufus-next to 3.15
* Also update DB for GRUB 2.06 binary and fix a line break when writing images
2021-06-22 19:08:34 +01:00
longpanda 49eefa2e03
[cmp] add support for Ventoy Sparse Image (.vtsi) 2021-06-22 19:08:33 +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 3bb83709da
[core] avoid the creation of 'System Volume Information' for ESPs written in DD mode
* Trying to mount accessible partitions after writing an image may lead to the
  creation of the infamous 'System Volume Information' folder on ESPs, which in
  turn leads to checksum errors for Ubuntu's boot/grub/efi.img (that maps to the
  Ubuntu ESP). So comment out that code.
* Also fix a missing CRLFs in the log after displaying write progress.
2021-05-18 15:18:28 +01:00
Pete Batard e22955aa2b
[core] fix fast-zeroing assertion 2021-05-04 21:04:30 +01:00
Pete Batard a0904cad35
[core] switch to async I/O for image writing
* Combined with the increase in buffer size from previous commits, this
  should help us get close to a device's maximum write speed.
* Also add async write support to winio.h
* Also increase the buffer size for bad blocks check operations
2021-04-22 01:01:56 +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 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 480214bbb6
[ui] add a message for ISOHybrids that don't allow for ISO mode
* Also limit VDS refresh to DD image writing
* Also increase the number of loc messages
2021-03-25 20:49:45 +00: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 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 630c508525
[ui] fix ability to toggle progress report during WIM image extraction
* Also add log progress report for compressed images
2020-11-14 19:38:56 +00:00
Pete Batard 29205b3a0e
[core] lock the logical drive when DeletePartition() fails
* Yeah, that's another SUPER EMPIRICAL behaviour you have to figure out
  the hard way when you try to use VDS. Thanks for nothing, Microsoft!
2020-11-13 18:06:50 +00:00
Pete Batard 460ab5dd73
[core] add log progress report when writing an image/zeroing a drive
* Also simplify a nonsensical condition in format_ext
2020-11-13 17:58:56 +00:00
Pete Batard 9c71ac25d5
[badblocks] use 0x55 and 0xAA for less than 2 passes checks
* Should be more effective at detecting errors than 0x00 and 0xFF.
2020-11-10 17:24:52 +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 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