Commit Graph

80 Commits

Author SHA1 Message Date
Pete Batard 45423becd5
[vhd] fix VHDX being inadvertently saved as VHD
* Addresses the error reported in #2468.
* Also use memmove instead of memcpy where overlapping data is involved.
2024-05-12 13:06:23 +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 8738e7a7de
[vhd] fix truncated write operation when using a VHDX image as source
* The legacy code we used for writing disk images used the size of the source image as
  the maximum number of bytes we should copy, which is fine for uncompressed DD or VHD
  images, but not so much for compressed VHDX ones. So we now make sure to use the
  actual size of the virtual disk, which we obtain when mounting the VHD/VHDX.
* Also fix log progress update as well as a MinGW warning.
2024-03-04 00:49:57 +00:00
Pete Batard c2b2624b62
[vhd] improve handing of user selected filename on save to VHD/FFU
* Use of '*.*' as pattern in file save dialog could lead to assert and crash, so
  we now try to derive the type of image to be saved from the file extension. We
  also did not properly handle user cancellation in the file save dialog.
* Also update iso9660/iso9660_fs.c to latest proposal of El Torito image handling.
* Also add a couple asserts in the hash table functions so that, if these ever get
  triggered we will pick them from Windows Store reports, and clean up code.
2024-02-03 18:39:44 +00:00
Pete Batard 58c56eb398
[vhd] fix a crash when saving .ffu images with release version
* Also update Rufus next to 4.4
2023-10-27 22:45:24 +02:00
Pete Batard 9c6b1ad977
[vhd] fix Rufus being unable to open .vhd images
* Due to a typo in vhd.c where the second safe_stricmp() should be against ".vhd" and not ".vhdx" again.
* Also enable the ignore boot marker bypass for VHD/VHDX/FFU and don't misreport those images as
  "compressed disk images".
* Closes #2309.
2023-08-20 13:12:38 +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 5bbcba8534
[vhd] add write support for .vhdx and .ffu images
* Also move VHD mounting function calls from iso.c to vhd.c and remove unused VHD footer elements.
2023-07-06 19:47:26 +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 f9370e002e
[iso] fix a crash when parsing Windows ISOs with MinGW x86_32
* MinGW32's delay loading functionality is not yet up to par with MSVC's and especially, for
  some libraries (wininet, virtdisk) attempting to delay load them simply crashes the runtime.
* This results in the MinGW32 version of the app crashing when selecting a Windows ISO, as we
  will then try to mount the ISO using virtdisk to poke the build version. Note that this crash
  does not happen with the MinGW64 version or with MSVC.
* Closes #2272.
* Also fix a Coverity warning in SaveImageThread() and improve the VHD saving code.
2023-07-02 13:15:51 +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 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 018718b2c8
[misc] disable Windows 7 support
* Also set rufus-next to 3.23 and fix a date typo in ChangeLog.txt
2023-03-27 21:45:55 +02:00
Pete Batard 21ac145a4b
[vhd] add force unmount of stale .wim images
* Required because some users appear to force kill Rufus while we're doing WUE patching of boot.wim,
  and Windows prevents a .wim with the same path and index from being mounted twice, even if the
  original .wim has become stale or deleted. Oh, and of course the WIM APIs don't have a force-mount
  flag that would take care of this whole situation.
* Basically, this forces us to parse HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WIMMount\Mounted Images
  and check each instance for a .wim/index match, so that we can access to the existing mount path
  so that we can actually unmout the image (because, in typical Microsoft fashion, WIMUnmountImage
  requires both the mount path and the source image to be provided).
* Closes #2199.
* Also improve the existing VHD code to use a struct where possible.
2023-03-08 20:00:37 +00:00
Pete Batard b2bf29f652
v3.20 (Build 1929)
* Fix a Coverity warning and lock.yml syntax
2022-08-03 16:49:31 +01:00
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 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 d9a7a03834
[vhd] improve mounting/unmounting of WIM
* Also fix wininet not having been removed from DelayLoadDLLs except x64.
2022-07-07 11:20:30 +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 a47072c3c6
[ui] produce a more explicit error message when an image can't be opened/read
* Closes #1843
* Also publish Coverity artifacts since upload to Coverity seems to be broken atm.
2022-01-07 13:27:15 +00:00
Pete Batard 56a99e6394
[misc] use application dir for storage in portable mode
* Also improve path reporting in the log.
* Also fix MinGW warnings
2021-10-11 20:11:06 +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
longpanda 49eefa2e03
[cmp] add support for Ventoy Sparse Image (.vtsi) 2021-06-22 19:08:33 +01: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 35b0ab2470
[ui] add cheat mode (Alt-M) to ignore Boot Marker 2020-11-12 17:38:20 +00:00
Pete Batard 6f5ea5f88f
[efi] add RISC-V support
* Also fix Coverity warnings
2020-07-29 19:32:32 +01:00
Pete Batard 34b1d8a3ca
[core] enable the direct provision of install.wim/install.esd for Windows To Go
* Also remove the use of 'unattend.xml' to disable the recovery environment (use bcdedit instead)
* Also some code cleanup and refactoring
2020-07-19 22:35:30 +01:00
Pete Batard 09d2f2f0ab
[ui] add cheat mode (Alt +/-) to increase/decrease thread priority
* This *may* help improve write speeds if your system is starved for I/O
* Related to #968
2020-07-10 12:00:10 +01: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
Pete Batard c1613ab7fc
[cmp] upgrade Bled to latest 2019-12-27 00:21:22 +01:00
Pete Batard 398baf23d8
[ui] fix WIM image application progress
* Use UpdateProgressWithInfo() always
* Remove cubic progress and use an estimated overhead instead
2019-08-25 14:09:28 +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 521034da99
[togo] add newer install.wim + install.esd support
* With no thanks whatsoever to Microsoft for *NOT* documenting that you need
  to pass flag 0x2000000 to WIMCreateFile() if you want to avoid an open error.
  One has to wonder if Microsoft isn't deliberately adding *BULLSHIT FLAGS*
  that only they know of, to hinder competing third-party tools...
2019-01-08 18:30:07 +00:00
Pete Batard befe2606cf
[misc] use %S to print wchar_t strings where possible
* Also fix some Coverity warnings
2019-01-03 12:29:28 +00:00
Pete Batard 790b188b3d [ui] fix disabling of Quick Format checkbox
* Closes #1211
* Also fix MBR analysis report displayed each time the user changes boot selection
2018-10-03 19:14:40 +02:00
Pete Batard 903ac993f2 [misc] remove no longer needed XP workarounds 2017-11-13 14:30:25 +00:00
Pete Batard 90dc847e24 [misc] add static_strcat & static_strcpy and use static_ calls wherever possible
* Also set Rufus next to 2.17 and fix a warning
2017-08-10 19:43:52 +01:00
Pete Batard 390c134b7a [togo] be more verbose about the files being applied 2017-06-20 14:10:22 +01:00
Pete Batard 30137de7cb [iso] improve handling of image size
* Don't use the projected size where the actual image size should be used
* Also fix an issue with the projected size computation
2017-05-01 16:22:34 +01:00
Pete Batard 2f81e4f177 [core] avoid the use of FILE_SHARE_WRITE
* Not having FILE_SHARE_WRITE on a disk or volume handle helps
  prevent spurious accesses from the OS or other apps while we
  are repartitioning/refomatting.
2017-02-16 14:13:30 +00:00
Pete Batard 7d302d340f [togo] enable selection of Windows version
* Closes #847
* Also set rufus-next to 2.12
2016-12-13 14:26:27 +00:00
Pete Batard 39d6b90447 [misc] fixes for Clang/C2 compilation support 2016-06-04 17:13:50 +01:00
Pete Batard 250d46e401 [core] use GetTickCount64() always where possible
* Damn you XP!!!
* Also some more code cleanup
2016-02-24 16:10:54 +00:00
Pete Batard c3f47ada06 [misc] add missing.h header
* Also clean up code
2016-02-20 22:52:32 +00:00
Pete Batard 1f2b73dfac [vhd] fix an issue when extracting WIM with 7z
* 7z has a quirk in that one MUST specify the image index
  when a WIM has multiple images, but the same index MUST
  be omitted if there is only one.
* Because of this, Windows 7 Enterprise images reported a
  (nonfatal) extraction error when trying 7z.
* Closes #680
* Also fix a typo in registry.h
2016-01-26 18:00:20 +00:00
Pete Batard f2a539a48c [core] add and use WriteFileWithRetry() where possible 2016-01-14 17:43:02 +00:00