85 Commits

Author SHA1 Message Date
Pete Batard
d4d537fc5b [uefi] change the name of the UEFI:NTFS partition to RUFUS_BOOT
* This should make it more explicit to Windows users to identify the installation media.
* Also update crazy-max/ghaction-upx to latest (Closes #2936).
* Also fix a Coverity warning and use improve StrArray handling/init.
2026-03-11 15:47:06 +00:00
Pete Batard
06c2924296 [dev] filter out the new Bitdefender VHDs
* It appears that Bitdefender now mounts a 32 MB VHD on the system where it is installed, so filter it out.
* For reference, this is how it is otherwise detected by Rufus:
Found VHD device 'Microsoft Virtual Disk'
Disk type: FIXED, Disk size: 33 MB, Sector size: 512 bytes
Cylinders: 4, Tracks per cylinder: 255, Sectors per track: 63
Partition type: GPT, NB Partitions: 1
Disk GUID: {3A182634-ECAF-4D9C-9CE0-9E61EC7A093A}
Max parts: 128, Start Offset: 17408, Usable = 33520128 bytes
Partition 1:
  Type: Microsoft Basic Data Partition
  Name: 'Bitdefender Partition'
  Detected File System: NTFS
  ID: {BA5FBC33-B5DD-4468-B9FB-349269EF43B8}
  Size: 31.9 MB (33488896 bytes)
  Start Sector: 64, Attributes: 0x8000000000000001
2026-01-15 18:21:05 +00:00
Pete Batard
1efb25b06b [iso] fix Rufus saving images as FFU instead of ISO, when FFU is not supported
* Our image type selection forgot to shift the actual type to ISO when FFU is not supported,
  leading to dism being invoked instead of oscdimg.
* Closes #2889.
* Also make sure the UDF label is no more than 32 characters.
* Also increase the oscdimg.exe commandline size as 256 characters may not be enough with long paths.
* Also try to report 'oscdimg.exe` errors in the log instead of silencing them.
* Also fix devices with (non-USB-compliant) VID 0000 being ignored by default.
2026-01-14 23:38:14 +00:00
Pete Batard
2476a92d70 [dev] try to support non USB compliant devices that use VID 0000
* This is meant to address #2894.
* Also update copyright year.
2026-01-12 12:21:11 +00:00
Pete Batard
79b0425c57 [dev] Increase the Hardware ID buffer size
* Some (newer) SSD devices appear to have very long Hardware IDs, with tons of underscore
  (eg: "SCSI\DiskNVMe______________________________NVME_SSD_512GBS1111H0L")
* Because of this, and because Hardware ID is a REG_SZ, where entries can be repeated many
  times, our static MAX_PATH buffer can be too small, preventing UAS disks from being
  properly listed.
* Fix this by bumping our buffer to 4 KB, as well as reporting errors on Hardware ID fetch
  in enum debug mode.
* Closes #2894.
2026-01-11 11:45:15 +00:00
Pete Batard
fec6051000 [wue] filter disallowed characters in local account names
* Per https://learn.microsoft.com/en-us/windows-hardware/customize/desktop/unattend/microsoft-windows-shell-setup-useraccounts-localaccounts-localaccount-name
* Also add 'NONE' to the list of prohibited local account names, and add '.' to the list of disallowed characters based on user report.
* Also update actions/upload-artifact to latest.
* Closes #2878.
* Closes #2879.
2025-12-20 13:36:06 +00:00
Pete Batard
99c04a9f46 [misc] fix various printf issues
* Also bump actions/checkout to v5.
* Closes #2791.
2025-09-03 11:32:12 +01:00
Pete Batard
c93793092a [internal] rename the if_not_assert() macro to a more explicit if_assert_fails()
* Also add a new if_assert_succeeds() macro.
2025-07-25 14:56:22 +01:00
Pete Batard
1a4175891b [iso] fix a situation where no file system might be proposed in ISO mode
* The Nutanix phoenix.x86_64-fnd_5.6.1_patch-aos_6.8.1_ga.iso contains a GRUB bootloader that somehow stripped
  the 'fshelp' source string from the fat module, and therefore prevents Rufus from detecting that FAT32 support
  is available.
* As a result, since NTFS is also not supported, no file system able to be selected by the user for ISO mode,
  and the media creation process fails with "Could Not Partition Drive".
* Fix this by only disabling FAT32 in ISO mode if NTFS is available, and producing a warning in the log if we
  have to forcefully enable FAT32 even if we didn't detect FAT32 compatibility.
* Closes #2769.
* Also add the setup wrapper binaries produced from previous commit and harmonise the casing of WARNING messages.
2025-07-16 14:07:24 +01:00
Pete Batard
446e71f56d [dbx] fix UTC epoch being interpreted as local time for DBX timestamp comparison
* Per MS documentation, _mktime64() *ALTERS* the time being passed to first add/substract
  the timezone offset before converting to an epoch.
* This resulted in our evaluated epoch from the DBX GitHub commit being a few hours more
  recent than the epoch we store for our embedded files (which is UTC) for timezones that
  are behind of UTC, since their epoch have an offset added to convert localtime to UTC.
* Fix this by using _mkgmtime64() that does not suffer an unwanted time manipulation.
* For safety, also use -u for epoch format conversion in our script just in case.
* Closes #2762.
* Also comment the "unsupported check; not verifying file integrity" warning for XZ
  decompression, improve XZ ARM64 support and add an exception for some Samsung UFDs.
2025-06-25 10:54:10 +01:00
Pete Batard
4adfa4f37e [misc] more MinGW DLL side loading "improvements"
- Side load SetupAPI.dll, as this is the DLL that was causing the CfgMgr32.dll local load.
  This reverts part of 622e60659c since we no longer have to hook into CfgMgr32.dll directly.
- Also set the redefinition of DECLSPEC_IMPORT, which we need for MinGW32 x86, in the global AM_CFLAGS
  of configure.ac, so that we no longer have to worry about forgetting to do it in a source and experience
  crashes on 32-bit as a result (See 965759f58a).
- Also delay-load crypt32.dll while we're at it.
- Also add provision for enabling /DEPENDENTLOADFLAG:0x800 on MinGW, by leaving a properly crafted entry
  in the .rdata section that can then be used with the loadcfg.py Python script.
- Sadly, per https://github.com/pbatard/rufus/issues/2701#issuecomment-2874788564 and subsequent comment,
  having DependentLoadFlags set to LOAD_LIBRARY_SEARCH_SYSTEM32 is still not enough to take care of side
  loading issues, as, ever since the introduction of wimlib support, we are seeing CRYPTBASE.DLL being
  side-loaded in MinGW, and, even with crypt32.dll being delay-loaded there is literally *nothing* we can
  do about it!
- The end result of all the above is that we will have no choice but ditch MinGW for release executables
  as it's just impossible to properly take care of side-loading vulnerabilities with MinGW (and Microsoft
  are REALLY not helping with this whole mess either, when they don't even use LOAD_LIBRARY_SEARCH_SYSTEM32
  for Windows' system DLLs).
- In preparation for this, we add UPX compression to the x86_64 and x86_32 MSVC executables.
- Finally, we also fix one last Coverity warning in xml.c and remove duplicates in .vcxproj for ARM64.
2025-05-13 20:31:35 +01:00
Pete Batard
622e60659c [dev] fix a side-loading vulnerability with cfgmgr32.dll
* Current Rufus and earlier versions (when compiled with MinGW) suffer from a side-loading vulnerability
  due to cfgmgr32.dll being attempted to be loaded from the same directory as the executable. This may
  result in someone being able to execute elevated malicious code if they already have gained user-level
  access to the platform and were able to drop an arbitrary cfgmgr32.dll in the same directory as rufus.
* While we were able to address similar vulnerabilities using delay-loading, this method does not appear
  to work for MinGW with this specific DLL, so we remove all the implicit CM_ function calls, that result
  in automated DLL loading that cannot be mitigated, to replace them with direct DLL hooks, which are
  not subject to Windows' default (vulnerable) DLL lookup behaviour. We still add the def for the delay
  loading in case we manage to find how to delay load cfgmgr32 with MinGW in the future...
* Fixes CVE-2025-26624 (https://github.com/pbatard/rufus/security/advisories/GHSA-p8p5-r296-g2jv).
* This vulnerability was discovered by @EmperialX working with @Shauryae1337 and reported by @EmperialX.
2025-02-19 11:58:10 +00:00
Pete Batard
37e383ade6 [dev] add disk exclusion by GPT Disk GUID
* Similar to what we already do with IgnoreUSB##, except this time, users
  can add REG_SZ keys IgnoreDisk01 to IgnoreDisk08, with a string like
  "{F333EC2E-25C9-488D-A7FC-9147C2367623}" to ignore a GPT disk with this
  specific GUID.
* This may be useful for people who mount fixed virtual drives, or people
  who have enabled Hot Swap on their SATA storage, and who want to make sure
  they won't be able to inadvertently select that disk in Rufus.
* Also set rufus-next to 4.7.
2024-11-22 00:03:13 +00:00
Pete Batard
f453dc272b [misc] fix a potential double free and avoid nonsensical error messages
* buf could be freed twice in iso.c.
* Using HRESULT_CODE(error_code) in WindowsErrorString() could lead to "Error: SUCCESS" messages.
* Closes #2524.
* Also try to address potential issues that appear to have been seen in the wild.
2024-09-30 17:38:47 +01:00
Pete Batard
d5302c0bad [misc] fix Coverity warnings
* Also use a new if_not_assert() construct where possible.
2024-07-19 13:46:42 +01:00
Pete Batard
83b1e73062 [dev] add exception for Samsung uSD Card devices
* Closes #2506.
2024-07-08 13:22:37 +01:00
Mark Peek
6f764ab637 [dev] allow the use of FreeBSD bhyve virtual disks
* Closes #2504.
2024-07-08 10:59:48 +01:00
Pete Batard
d0bc05077a [misc] improve size based constants
* Make them more explicit by ensuring that they use a size suffix.
* Also improve whitespace consistency.
* Also make sure that we display the search for conflicting process message
  in the status on a search operation that may timeout.
2024-05-07 12:53:40 +01:00
Pete Batard
6ac2dfb0df [misc] fix temp_dir not being properly initialized
* The static_/safe_ string macros were not properly designed to handle the case where
  an expression such as strlen() rather than a static value was passed for the count,
  leading to unexpected results, such as excessive truncation of strings. Fix that.
* Also fix a buffer overflow in GetDevices() due to using a wrong string length.
2024-04-26 19:15:48 +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
fff39c56e8 [misc] fix UEFI:NTFS partition not being added when needed in MBR mode
* Also add support for SD card readers identifying themselves as SDXC.
2024-01-17 14:10:46 +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
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
109df708b4 [misc] add an exception for 23A9:EF18 UFDs
* Closes #2247
2023-05-29 18:04:42 +01:00
Pete Batard
1a3a155e8c [dev] fix description of UAS devices
* Having Windows append "SCSI Disk Device" screws up the scoring regarding
  disks that are actually describing themselves as SCSI, so replace that
  with "UAS Device", as it should be.
* Closes #2221.
* Also fix a MinGW warning.
2023-04-19 13:38:19 +01:00
Pete Batard
e86523e024 [enum] minor improvements to drive size handling
* Also fix a typo when trying to detect x86 running on ARM
2023-04-04 10:28:01 +02: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
b163b3dfe2 [core] fix default listing of large SanDisk SSD devices
* Closes #2164
* Also add breakdown of score computation when device enumeration debug is active
* Also fix a minor Code Analysis warning in msapi_utf8.h
2023-02-13 13:34:17 +00:00
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
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
cd9d3737b1 [core] add the ability to ignore USBs through VID:PID
* This enables the provision of Registry/Settings key IgnoreUsb01 to IgnoreUsb08 where
  one can specify a USB device to ignore by providing its VID:PID as a 32-bit hex value.
* Closes #1879.
* Also update rufus.ini sample for current Rufus version.
* Also fix status display for Alt-Q.
2022-06-14 23:29:33 +01:00
Pete Batard
c76327f96e [ui] list drives by increasing order of size
* Also silence MSVC and MinGW obnoxious warnings about bidirectional Unicode characters.
2022-05-25 13:22:47 +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
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
c28f9bc491 [misc] fix PVS-Studio warnings 2022-01-05 12:57:26 +01:00
Pete Batard
f0047986e7 [dev] add support for intel NUC card readers
* Also make sure that cards larger than 200 GB are not listed by default.
2021-09-09 22:20:57 +02:00
Pete Batard
16c0e8e2a2 [misc] UFD vs HDD detection improvements 2021-04-23 12:03:43 +01:00
Pete Batard
fce645543f [dev] add exception for Realtek card readers
* Also update copyright year to 2021
* Also update version for rufus-next
* Also set Win32 "A" APIs to UTF-8 and enable long paths in manifest
2021-01-06 19:27:31 +00:00
Pete Batard
b3caf638b6 [misc] miscellaneous code cleanup and fixes
* Don't use hDrive handle for longer than necessary
* Move all the popcount() function calls into missing.h
* Ensure that the thread_affinity[] array is properly sized
* Improve timeouts for conflicting process search
2020-09-09 17:00:39 +01:00
Pete Batard
c2017ad659 [dev] add exception for SSDs sitting behind a VIA-Labs adapter
* Also adjust the sizes under and above which we consider a drive is UFD/HDD
2020-08-01 15:36:59 +01:00
Pete Batard
ba3665d990 [dev] add exception for SanDisk SSD U100 2020-06-03 11:20:30 +01:00
Pete Batard
077f143252 [core] add cheat mode to disable VHD listing (Alt-G) 2020-04-27 10:28:00 +01:00
Pete Batard
155b86bc01 [dev] improve UFD vs HDD/SSD detection
* If the device reports HDD or SSD in its name, take it into account
* Also fix ChangeLog
2020-04-16 17:33:08 +01:00
Pete Batard
11633a318a [internal] update ChangeLog for BETA
* Also add an extra device to the list of internally unlisted
2020-04-15 16:59:01 +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
761953fdbf [vds] enable device cycling when using VDS
* Hopefully using DICS_FLAG_CONFIGSPECIFIC instead of DICS_FLAG_GLOBAL is all that was needed
  to get device disabling/re-enabling work without creating zombie devices, because we sure
  need to force Windows' hand when it comes to detecting logical volumes...
2020-02-15 14:46:00 +00:00
Pete Batard
1b02181f74 [ui] fix percent not being displayed on slow format 2019-09-21 22:39:00 +01:00
Pete Batard
798029237f [iso] improve fallback for dual UDF+ISO9660 images
* Also add private filtering of LM90X USB⟷SSD devices
2019-08-28 11:00:32 +01:00
Pete Batard
c8fda3e4e8 [core] report SuperSpeed+ devices
* Also clean up cfgmgr32 dependencies and set rufus-next to 3.7
2019-07-31 22:45:11 +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