Compare commits

...

38 commits
v4.6 ... master

Author SHA1 Message Date
Pete Batard
87efc7642a
[iso] update libcdio to latest 2025-05-14 16:07:25 +01:00
Pete Batard
01d18d99de
[misc] remove manual hooks into ntdll
* Since we are now liking with ntdll directly, we can remove all the hooks we applied
  and just use regular calls. We also rename process.h to ntdll.h as a result.
2025-05-14 10:43:45 +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
13c6becf42
[core] fix size check for VHD images
* Recent changes broke the check for whether the source image is larger than the target drive
  in the case of uncompressed VHDs (that have a 512 byte footer), so fix that by making sure
  we always compare with the projected size.
* Closes #2729.
* Also fix some more Coverity warnings.
2025-05-07 13:35:48 +01:00
Pete Batard
965759f58a
[ui] fix a crash when opening the log for MinGW x86_32 executable
* DwmGetWindowAttribute() from dwmapi.dll is delay-loaded so it requires the MinGW DECLSPEC_IMPORT workaround.
* Closes #2728.
* Also fix a bunch of Coverity warnings in wimlib and ezxml.
2025-05-06 18:43:35 +01:00
Pete Batard
ea01cd41c0
[iso] enable splitting of large WIMs when Alt-E is enabled
* Now that we have wimlib, we might as well add this has an option for people who really
  don't want to use NTFS, even if it falls way short of the performance we get with NTFS.
* Also use wimlib to read the install.wim version.
* Also fix a couple Coverity warnings in stdfn.c/stdio.c.
2025-05-06 01:35:26 +01:00
Pete Batard
2470c56c7e
[wue] switch to using wimlib for all WIM operations
* This should greatly improves performance when patching boot.wim for WUE or creating Windows To Go drives.
* This also allows us to discard all the bulky (and limited) native WIM API function calls.
* Also add some UTF-8 wrappers to wimlib and a GetTempDirNameU() function call.
* Also revert to the old ssize_t definition in unistd.h, since trying to be too smart throws static analysers off...
2025-05-05 00:58:07 +01:00
Pete Batard
5d35a0f1fa
[ui] progress reporting improvements
* Factorize the log progress bar update into a new uprint_progress() call.
* Add a new FP_NO_PROGRESS flag to disable progress reporting when formatting.
* Alter the progress reporting frequency of wimlib.
* Also update some copyright dates we missed before.
2025-05-03 21:32:10 +01:00
Pete Batard
96996ae1ee
[vhd] add libcdio integration to wimlib
* Allows working with WIMs without mounting the ISO by referencing something like "C:\Downloads\Windows.iso|sources/install.wim".
2025-05-02 17:28:42 +01:00
Pete Batard
c288f2fe57
[iso] add udf_setpos() support in libcdio
* This is needed for wimlib libcdio integration.
* Also fix a signed/unsigned warning in iso.c.
2025-05-02 17:27:24 +01:00
Pete Batard
9f7d623e2e
[vhd] add wimlib support
* This includes all the changes applied to wimlib for MSVC compilation support.
* The vast majority of these changes were original, but a very small set came
  was lifted from https://github.com/ebiggers/wimlib/pull/6 (which we discovered
  after we went through this whole exercise on our own...)
2025-05-02 17:25:37 +01:00
Pete Batard
1ed92072b8
[vhd] initial wimlib support (original sources)
* From https://wimlib.net/git/?p=wimlib;a=commit;h=4a34203cde54c317f0d277a4c64e19916547bf10
2025-05-02 17:25:35 +01:00
Pete Batard
e60dd7edb8
[wue] add ezxml support for WIM index parsing
* ezxml was partially altered with some changes from PRs found at https://github.com/lxfontes/ezxml.
* Also apply some small improvements to msapi_utf8.h.
2025-05-02 16:51:30 +01:00
Pete Batard
c31df87732
[wue] initial ezxml sources (unmodified)
* From the ezxml-0.8.6.tar.gz download at https://ezxml.sourceforge.net/.
2025-05-02 16:51:29 +01:00
Pete Batard
b895f26ebc
[misc] miscellaneous cleanup
* Make sure we use _M_IX86 and _M_X64 where required.
* Fix some static analysis warnings.
* Update version for rufus-next.
2025-04-21 20:20:59 +01:00
Pete Batard
88f023e796
Rufus 4.7 (Build 2231)
* Update FreeDOS to v1.4
* Update Grub4DOS to latest
2025-04-09 11:10:21 +01:00
Pete Batard
7ff68dc7af
[appstore] drop ARM32 from packaged builds and use our own PE data extractor instead of exiftool
* exiftool is way too cumbersome as a "standalone" commandline executable for our purpose.
* Also update French translation.
2025-04-02 12:16:33 +01:00
Pete Batard
871bc9a25f
[core] fix ReFS no longer being available unless VDS is enabled 2025-03-31 20:39:19 +01:00
Pete Batard
fdde687d46
[uefi] embed and allow the download of official signed DBX binaries
* With Microsoft having finally relinquished the terms of use of DBX binaries (where their
  previous legalese pretty much made it illegal for anyone who wasn't an OS manufacturer to
  download DBX for use in applications) we can now formally embed, as well as download the
  DBXs when they are updated.
* This is accomplished by querying the https://github.com/microsoft/secureboot_objects
  GitHub repo (which is now the official repository for the UEFI Forum's revocation files)
  through api.github.com and checking the timestamps of the last commit on the relevant files.
  If a more recent DBX is found than the one embedded (or a previously downloaded one), Rufus
  will now prompt the user to download it, as part of its regular update check (if enabled).
* Note that, since there have been no official revocations for them yet, IA64, RISCV64 and
  LoongArch64 are currently placeholders.
* Also note that we currently don't use this mechanism for Microsoft's SVN revocations, as
  we already have a more efficient check for it through SBAT.
* Also fix the handling of the RISCV64 MD5Sum UEFI bootloader, whose offset was incorrect.
2025-03-27 16:11:45 +00:00
Pete Batard
845d26e3b6
[ui] fix toolbar ImageLists leaks
* Also fix erroneous use of safe_delete_object() in previous commit and harmonize names.
* Closes #2711.
2025-03-24 13:18:20 +00:00
ozone10
df4f8301d7
[ui] fix GDI leaks
* Closes #2704.
2025-03-21 12:19:16 +00:00
Pete Batard
bc75274a9a
[msvc] further prevent DLL side-loading by using /DEPENDENTLOADFLAG:0x800
* Suggested by @dimhotepus per #2701.
* Sadly a similar feature can't be applied for MinGW builds. (See also 59156023/)
* While we're at it, also sure we use /BREPRO everywhere for MSVC reproducible builds.
2025-03-04 11:47:11 +00:00
Pete Batard
7585a35c2c
[core] improve detection for images that are too large to fit the target drives
* Rufus did not check if the size of the decompressed VHDX was larger than target. Fix that.
2025-02-21 17:53:38 +00:00
Pete Batard
9540ca359d
[misc] don't enable the commandline hogger on POSIX shells
* Assume that the presence of a "SHELL" environment variable is enough to tell if we have a POSIX shell.
2025-02-20 13:13:44 +00: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
Rairii
50801a47ff
[misc] fall back to user/system default locale when getting error description
* Some Windows localisations do not contain English MUI files for specific error codes, so show *something* instead of an error.
* Closes #2687.
2025-02-14 01:07:43 +00:00
Pete Batard
f3c29bf537
[misc] fix and silence some Coverity warnings 2025-02-13 15:14:53 +00:00
lucamosca1
ec604f43d6
[loc] fix a typo in the Italian translation
* Closes #2675.
2025-02-10 17:47:29 +00:00
Pete Batard
d910441427
[misc] Fix issue template no longer being processed
* Since GitHub broke existing paths and did not bother to alert people.
* Closes #2672.
2025-01-25 13:06:07 +00:00
Pete Batard
1c300b428a
[uefi] update UEFI DBX to latest
* This is in light of the 2025.01.14 DBX update due to https://arstechnica.com/security/2025/01/microsoft-patches-windows-to-eliminate-secure-boot-bypass-threat/.
* Also update application copyright year and a translator's e-mail address.
2025-01-24 00:30:22 +00:00
Emmanuel Bourg
1e2f1c1aff
[loc] Improve the French translation
* Closes #2636.
2024-12-17 14:57:51 +01:00
Pete Batard
3d5ab84ec1
[iso] fix FAT filenames being truncated on image extraction
* Needed to read 12 chars instead of stopping at 11 and therefore inserting a NUL.
* Closes #2534.
* Also enable detection of bootriscv64.efi and bootloongarch64.efi bootloaders from FAT images.
2024-12-03 13:53:41 +00:00
Pete Batard
8d1ed44e1e
[cmd] fix hogger not being deleted on exit when executable is in a different directory
* Closes #2622.
2024-12-03 11:51:18 +00:00
Pete Batard
79f1209ab9
[misc] arch/cpu refactoring
* Move the cpu.c/cpu.h in more logical places and remove these sources files.
* Add detection for LoongArch64 EFI bootloaders.
* Pass the detected CPU arch when invoking Fido.
* Also fix some Bled Coverity warnings.
2024-12-02 19:04:51 +00:00
Pete Batard
8f3a9c1c7c
[cmp] update Bled to latest
* This mostly updates the ZSTD code to latest and properly removes all debug message.
* Also switch MinGW from gnu99 to gnu11.
2024-11-27 17:19:36 +00:00
Pete Batard
cef7a5cb0c
[cmp] add ztsd image compression support
* Based on the latest Bled, which adds ztsd compression support.
* Note that initial extraction of the 512 bytes MBR is very slow, because is seems
  clear that ZSTD was never designed for fast init or processing small elements of
  data, but instead for post init large volume streaming.
* Also note that this code adds 400 KB to the Rufus executable *AFTER UPX COMPRESSION*!
  Hopefully, the BusyBox folks can come up with a better and smaller way to add zstd
  support, because it's clear that the method used by the current BusyBox proposal,
  which is to leave as much of the original code untouched, isn't for the best...
* Closes #2590.
* Closes #2620.
* Closes #2621.
2024-11-22 23:25:33 +00:00
Pete Batard
fcdde3dcb8
[misc] drop ARM32 builds
* Per https://github.com/actions/runner-images/issues/10981 and plenty of other similar
  reports, GitHub Actions can no longer compile ARM32 binaries by default using the
  latest Visual Studio toolchain, due to Microsoft current Windows SDK having dropped
  the ARM32 toolchain (per https://github.com/zufuliu/notepad4/issues/839).
* Well, I have better things to do then try to maintain platforms in the process of
  being deprecated, so I'll let the people who care about Rufus on ARM32 propose a
  non-intrusive workaround that can work with current GitHub Actions.
2024-11-22 00:18:58 +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
296 changed files with 90655 additions and 2907 deletions

1
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View file

@ -0,0 +1 @@
blank_issues_enabled: false

View file

@ -1,48 +1,57 @@
<!--
PLEASE READ THIS CAREFULLY:
1. You *MUST* read and complete the steps from the checklist below, by placing
an x into each [ ] (so that it shows '[x]', NOT '[ x]' or '[x ]'), BEFORE
clicking on 'Submit new issue'.
2. Failure to perform these steps, WHICH ARE ONLY THERE TO HELP *YOU*, will
usually result in your issue being dismissed without notice.
3. If you are reporting an issue when trying to run Rufus, or when trying to
boot a media created by Rufus, you *MUST* provide a log, period. Please do
not assume that the developer(s) will be able to "guess" the specifics of
your environment, what image you used, what type of media you used it with
or the many many other critical parameters that the log provides data for.
To investigate an issue, a log from Rufus is ALWAYS required.
4. If you still *choose* not to provide a log when reporting a problem, you
agree that your issue will be closed without any further investigation.
YOU HAVE BEEN WARNED.
-->
Checklist
---------
- [ ] I have been made aware that if my problem can be summarized as _"I've created or tried to create a media using Rufus, and ..."_, and I am not including a log, **this issue will be summarily closed**.
- [ ] I looked at https://github.com/pbatard/rufus/wiki/FAQ to see if my question has already been answered.
- [ ] I performed a search in the issue tracker for similar issues using keywords relevant to my problem, such as the error message I got from the log.
- [ ] I clicked the 'Log' button (🗒️) or pressed <kbd>Ctrl</kbd>-<kbd>L</kbd> in Rufus, or used [DebugView](https://learn.microsoft.com/en-us/sysinternals/downloads/debugview), and copy/pasted the log into the section that says `<FULL LOG>` below.
- [ ] The log I am copying is the FULL log, starting with the line `Rufus version: x.y.z` - I have NOT removed any part of it.
Additionally (if applicable):
- [ ] I ran a bad blocks check, by clicking _Show advanced format options_ then _Check device for bad blocks_, and confirmed that my USB is not defective.
- [ ] I also tried one or more of the following:
- [ ] Using a different USB drive.
- [ ] Plugging the USB into a different port.
- [ ] Running Rufus on a different computer.
- [ ] If using an image, I clicked on the `(✓)` button to compute the MD5, SHA1 and SHA256 checksums, which are therefore present in the log I copied. I confirmed, by performing an internet search, that these values match the ones from the official image.
Issue description
-----------------
<Please describe your issue here>
Log
---
```
<FULL LOG>
```
---
name: Report an issue with the application
about: Please make sure you follow the check-list carefully!
title: ''
labels: ''
assignees: ''
---
<!--
PLEASE READ THIS CAREFULLY:
1. You *MUST* read and complete the steps from the checklist below, by placing
an x into each [ ] (so that it shows '[x]', NOT '[ x]' or '[x ]'), BEFORE
clicking on 'Submit new issue'.
2. Failure to perform these steps, WHICH ARE ONLY THERE TO HELP *YOU*, will
usually result in your issue being dismissed without notice.
3. If you are reporting an issue when trying to run Rufus, or when trying to
boot a media created by Rufus, you *MUST* provide a log, period. Please do
not assume that the developer(s) will be able to "guess" the specifics of
your environment, what image you used, what type of media you used it with
or the many many other critical parameters that the log provides data for.
To investigate an issue, a log from Rufus is ALWAYS required.
4. If you still *choose* not to provide a log when reporting a problem, you
agree that your issue will be closed without any further investigation.
YOU HAVE BEEN WARNED.
-->
Checklist
---------
- [ ] I have been made aware that if my problem can be summarized as _"I've created or tried to create a media using Rufus, and ..."_, and I am not including a log, **this issue will be summarily closed**.
- [ ] I looked at https://github.com/pbatard/rufus/wiki/FAQ to see if my question has already been answered.
- [ ] I performed a search in the issue tracker for similar issues using keywords relevant to my problem, such as the error message I got from the log.
- [ ] I clicked the 'Log' button (🗒️) or pressed <kbd>Ctrl</kbd>-<kbd>L</kbd> in Rufus, or used [DebugView](https://learn.microsoft.com/en-us/sysinternals/downloads/debugview), and copy/pasted the log into the section that says `<FULL LOG>` below.
- [ ] The log I am copying is the FULL log, starting with the line `Rufus version: x.y.z` - I have NOT removed any part of it.
Additionally (if applicable):
- [ ] I ran a bad blocks check, by clicking _Show advanced format options_ then _Check device for bad blocks_, and confirmed that my USB is not defective.
- [ ] I also tried one or more of the following:
- [ ] Using a different USB drive.
- [ ] Plugging the USB into a different port.
- [ ] Running Rufus on a different computer.
- [ ] If using an image, I clicked on the `(✓)` button to compute the MD5, SHA1 and SHA256 checksums, which are therefore present in the log I copied. I confirmed, by performing an internet search, that these values match the ones from the official image.
Issue description
-----------------
<Please describe your issue here>
Log
---
```
<FULL LOG>
```

View file

@ -4,6 +4,7 @@ on:
push:
branches: [master]
paths-ignore:
- '.github/ISSUE_TEMPLATE/**'
- '.gitignore'
- '.gitattributes'
- 'res/**'

View file

@ -4,6 +4,7 @@ on:
push:
branches: [master]
paths-ignore:
- '.github/ISSUE_TEMPLATE/**'
- '.gitignore'
- '.gitattributes'
- 'res/**'

View file

@ -3,6 +3,7 @@ name: MinGW
on:
push:
paths-ignore:
- '.github/ISSUE_TEMPLATE/**'
- '.gitignore'
- '.gitattributes'
- 'res/**'

View file

@ -3,6 +3,7 @@ name: VS2022
on:
push:
paths-ignore:
- '.github/ISSUE_TEMPLATE/**'
- '.gitignore'
- '.gitattributes'
- 'res/**'
@ -35,7 +36,7 @@ jobs:
strategy:
matrix:
TARGET_PLATFORM: [x64, x86, arm64, arm]
TARGET_PLATFORM: [x64, x86, arm64]
steps:
- name: Checkout repository
@ -49,6 +50,11 @@ jobs:
with:
msbuild-architecture: x64
- name: Install UPX
uses: crazy-max/ghaction-upx@v3
with:
install-only: true
- name: Set ALPHA
id: set_alpha
shell: bash
@ -75,6 +81,10 @@ jobs:
move .\${{ matrix.TARGET_PLATFORM }}\Release\rufus.exe .\rufus_${{ matrix.TARGET_PLATFORM }}.exe
move .\${{ matrix.TARGET_PLATFORM }}\Release\rufus.pdb .\rufus_${{ matrix.TARGET_PLATFORM }}.pdb
- name: Compress executables
if: ${{ matrix.TARGET_PLATFORM != 'arm64' }}
run: upx --lzma --best .\rufus_${{ matrix.TARGET_PLATFORM }}.exe
- name: Display SHA-256
run: sha256sum ./rufus_${{ matrix.TARGET_PLATFORM }}.exe

View file

@ -14,12 +14,13 @@ AM_V_SED = $(AM_V_SED_$(V))
# target arch. Oh, and we can't use 'target_cpu' or AC definitions on account that we are
# switching archs when building on our local machine, and don't want to have to go though
# a costly reconf each time when we can simply issue a 'make clean'.
# Oh, and to find the number after the @ sign, just have a look at the MinGW .a libraries.
TUPLE := $(shell $(CC) -dumpmachine)
TARGET := $(word 1,$(subst -, ,$(TUPLE)))
DEF_SUFFIX := $(if $(TARGET:x86_64=),.def,.def64)
.PHONY: all
all: dwmapi-delaylib.lib version-delaylib.lib virtdisk-delaylib.lib wininet-delaylib.lib wintrust-delaylib.lib
all: crypt32-delaylib.lib dwmapi-delaylib.lib setupapi-delaylib.lib version-delaylib.lib virtdisk-delaylib.lib wininet-delaylib.lib wintrust-delaylib.lib
%.def64: %.def
$(AM_V_SED) "s/@.*//" $< >$@

View file

@ -212,6 +212,7 @@ AM_V_SED = $(AM_V_SED_$(V))
# target arch. Oh, and we can't use 'target_cpu' or AC definitions on account that we are
# switching archs when building on our local machine, and don't want to have to go though
# a costly reconf each time when we can simply issue a 'make clean'.
# Oh, and to find the number after the @ sign, just have a look at the MinGW .a libraries.
TUPLE := $(shell $(CC) -dumpmachine)
TARGET := $(word 1,$(subst -, ,$(TUPLE)))
DEF_SUFFIX := $(if $(TARGET:x86_64=),.def,.def64)
@ -367,7 +368,7 @@ uninstall-am:
.PHONY: all
all: dwmapi-delaylib.lib version-delaylib.lib virtdisk-delaylib.lib wininet-delaylib.lib wintrust-delaylib.lib
all: crypt32-delaylib.lib dwmapi-delaylib.lib setupapi-delaylib.lib version-delaylib.lib virtdisk-delaylib.lib wininet-delaylib.lib wintrust-delaylib.lib
%.def64: %.def
$(AM_V_SED) "s/@.*//" $< >$@

10
.mingw/cfgmgr32.def Normal file
View file

@ -0,0 +1,10 @@
EXPORTS
CM_Get_Device_IDA@16
CM_Get_Device_ID_List_SizeA@12
CM_Get_Device_ID_ListA@16
CM_Locate_DevNodeA@12
CM_Get_Child@12
CM_Get_Sibling@12
CM_Get_Parent@12
CM_Get_DevNode_Status@16
CM_Get_DevNode_Registry_PropertyA@24

14
.mingw/crypt32.def Normal file
View file

@ -0,0 +1,14 @@
EXPORTS
CertFindCertificateInStore@24
CertGetCertificateChain@32
CertGetNameStringA@24
CertCloseStore@8
CertFreeCertificateContext@4
CryptQueryObject@44
CryptDecodeObjectEx@32
CryptHashCertificate@28
CryptMsgGetParam@20
CryptMsgClose@4
CryptMsgGetParam@20
CryptMsgOpenToDecode@24
CryptMsgUpdate@16

20
.mingw/setupapi.def Normal file
View file

@ -0,0 +1,20 @@
EXPORTS
CM_Locate_DevNodeA@12
CM_Get_DevNode_Registry_PropertyA@24
CM_Get_DevNode_Status@16
CM_Get_Child@12
CM_Get_Parent@12
CM_Get_Sibling@12
CM_Get_Device_IDA@16
CM_Get_Device_ID_ListA@16
CM_Get_Device_ID_List_SizeA@12
SetupDiGetDeviceInstanceIdA@20
SetupDiGetDeviceRegistryPropertyA@28
SetupDiGetDeviceRegistryPropertyW@28
SetupDiChangeState@8
SetupDiGetClassDevsA@16
SetupDiSetClassInstallParamsW@16
SetupDiEnumDeviceInfo@12
SetupDiEnumDeviceInterfaces@20
SetupDiDestroyDeviceInfoList@4
SetupDiGetDeviceInterfaceDetailA@24

View file

@ -2,6 +2,7 @@ EXPORTS
HttpQueryInfoA@20
HttpOpenRequestA@32
HttpSendRequestA@20
HttpAddRequestHeadersA@16
InternetCloseHandle@4
InternetConnectA@32
InternetCrackUrlA@16

View file

@ -46,32 +46,59 @@
<ClCompile Include="..\src\bled\decompress_unlzma.c" />
<ClCompile Include="..\src\bled\decompress_unxz.c" />
<ClCompile Include="..\src\bled\decompress_unzip.c" />
<ClCompile Include="..\src\bled\decompress_unzstd.c" />
<ClCompile Include="..\src\bled\decompress_vtsi.c" />
<ClCompile Include="..\src\bled\filter_accept_all.c" />
<ClCompile Include="..\src\bled\filter_accept_list.c" />
<ClCompile Include="..\src\bled\filter_accept_reject_list.c" />
<ClCompile Include="..\src\bled\find_list_entry.c" />
<ClCompile Include="..\src\bled\fse_decompress.c" />
<ClCompile Include="..\src\bled\header_list.c" />
<ClCompile Include="..\src\bled\header_skip.c" />
<ClCompile Include="..\src\bled\header_verbose_list.c" />
<ClCompile Include="..\src\bled\huf_decompress.c" />
<ClCompile Include="..\src\bled\init_handle.c" />
<ClCompile Include="..\src\bled\open_transformer.c" />
<ClCompile Include="..\src\bled\seek_by_jump.c" />
<ClCompile Include="..\src\bled\seek_by_read.c" />
<ClCompile Include="..\src\bled\xxhash.c" />
<ClCompile Include="..\src\bled\xz_dec_bcj.c" />
<ClCompile Include="..\src\bled\xz_dec_lzma2.c" />
<ClCompile Include="..\src\bled\xz_dec_stream.c" />
<ClCompile Include="..\src\bled\zstd_common.c" />
<ClCompile Include="..\src\bled\zstd_ddict.c" />
<ClCompile Include="..\src\bled\zstd_decompress.c" />
<ClCompile Include="..\src\bled\zstd_decompress_block.c" />
<ClCompile Include="..\src\bled\zstd_entropy_common.c" />
<ClCompile Include="..\src\bled\zstd_error_private.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\bled\bb_archive.h" />
<ClInclude Include="..\src\bled\bled.h" />
<ClInclude Include="..\src\bled\fse.h" />
<ClInclude Include="..\src\bled\fse_bitstream.h" />
<ClInclude Include="..\src\bled\huf.h" />
<ClInclude Include="..\src\bled\libbb.h" />
<ClInclude Include="..\src\bled\platform.h" />
<ClInclude Include="..\src\bled\xxhash.h" />
<ClInclude Include="..\src\bled\xz.h" />
<ClInclude Include="..\src\bled\xz_config.h" />
<ClInclude Include="..\src\bled\xz_lzma2.h" />
<ClInclude Include="..\src\bled\xz_private.h" />
<ClInclude Include="..\src\bled\xz_stream.h" />
<ClInclude Include="..\src\bled\zstd.h" />
<ClInclude Include="..\src\bled\zstd_bits.h" />
<ClInclude Include="..\src\bled\zstd_compiler.h" />
<ClInclude Include="..\src\bled\zstd_config.h" />
<ClInclude Include="..\src\bled\zstd_cpu.h" />
<ClInclude Include="..\src\bled\zstd_ddict.h" />
<ClInclude Include="..\src\bled\zstd_decompress_block.h" />
<ClInclude Include="..\src\bled\zstd_decompress_internal.h" />
<ClInclude Include="..\src\bled\zstd_deps.h" />
<ClInclude Include="..\src\bled\zstd_errors.h" />
<ClInclude Include="..\src\bled\zstd_error_private.h" />
<ClInclude Include="..\src\bled\zstd_internal.h" />
<ClInclude Include="..\src\bled\zstd_mem.h" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectName>bled</ProjectName>

View file

@ -87,6 +87,36 @@
<ClCompile Include="..\src\bled\decompress_vtsi.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\bled\decompress_unzstd.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\bled\fse_decompress.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\bled\huf_decompress.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\bled\xxhash.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\bled\zstd_decompress.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\bled\zstd_decompress_block.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\bled\zstd_entropy_common.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\bled\zstd_error_private.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\bled\zstd_common.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\bled\zstd_ddict.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\bled\bb_archive.h">
@ -116,5 +146,56 @@
<ClInclude Include="..\src\bled\xz_stream.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\bled\fse.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\bled\fse_bitstream.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\bled\huf.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\bled\xxhash.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\bled\zstd.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\bled\zstd_compiler.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\bled\zstd_config.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\bled\zstd_cpu.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\bled\zstd_ddict.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\bled\zstd_decompress_block.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\bled\zstd_decompress_internal.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\bled\zstd_deps.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\bled\zstd_error_private.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\bled\zstd_errors.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\bled\zstd_internal.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\bled\zstd_mem.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\bled\zstd_bits.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

View file

@ -121,24 +121,25 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<BuildLog />
<ClCompile>
<PreprocessorDefinitions>_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;COBJMACROS;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_RUFUS;_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;COBJMACROS;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>..\src;..\src\msvc-missing;..\src\ms-sys\inc;..\src\syslinux\libinstaller;..\src\syslinux\libfat;..\src\syslinux\win;..\src\libcdio;..\src\getopt;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\src;..\src\msvc-missing;..\src\ms-sys\inc;..\src\syslinux\libinstaller;..\src\syslinux\libfat;..\src\syslinux\win;..\src\libcdio;..\src\getopt;..\src\wimlib;..\res;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsC</CompileAs>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ExceptionHandling>Async</ExceptionHandling>
<DisableSpecificWarnings>4091;5255;28251;28252;28253;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<Optimization>Disabled</Optimization>
<AdditionalOptions>/utf-8 $(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/utf-8 /std:clatest $(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;version.lib;virtdisk.lib;wininet.lib;wintrust.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;ntdll.lib;shlwapi.lib;version.lib;virtdisk.lib;wininet.lib;wintrust.lib;%(AdditionalDependencies)</AdditionalDependencies>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
<DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;version.dll;virtdisk.dll;wininet.dll;wintrust.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<AdditionalOptions>/BREPRO /DEPENDENTLOADFLAG:0x800 %(AdditionalOptions)</AdditionalOptions>
</Link>
<ResourceCompile>
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -151,23 +152,24 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<BuildLog />
<ClCompile>
<PreprocessorDefinitions>_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;COBJMACROS;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_RUFUS;_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;COBJMACROS;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>..\src;..\src\msvc-missing;..\src\ms-sys\inc;..\src\syslinux\libinstaller;..\src\syslinux\libfat;..\src\syslinux\win;..\src\libcdio;..\src\getopt;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\src;..\src\msvc-missing;..\src\ms-sys\inc;..\src\syslinux\libinstaller;..\src\syslinux\libfat;..\src\syslinux\win;..\src\libcdio;..\src\getopt;..\src\wimlib;..\res;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsC</CompileAs>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ExceptionHandling>Async</ExceptionHandling>
<DisableSpecificWarnings>4091;5255;28251;28252;28253;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<AdditionalOptions>/utf-8 $(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/utf-8 /std:clatest $(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;version.lib;virtdisk.lib;wininet.lib;wintrust.lib;ole32.lib;advapi32.lib;gdi32.lib;shell32.lib;comdlg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;ntdll.lib;shlwapi.lib;version.lib;virtdisk.lib;wininet.lib;wintrust.lib;ole32.lib;advapi32.lib;gdi32.lib;shell32.lib;comdlg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<AdditionalLibraryDirectories>C:\Program Files (x86)\Windows Kits\10\Lib\10.0.15063.0\um\arm</AdditionalLibraryDirectories>
<DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;version.dll;virtdisk.dll;wininet.dll;wintrust.dll;ole32.dll;advapi32.dll;gdi32.dll;shell32.dll;comdlg32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;version.dll;virtdisk.dll;wininet.dll;wintrust.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<AdditionalOptions>/BREPRO /DEPENDENTLOADFLAG:0x800 %(AdditionalOptions)</AdditionalOptions>
</Link>
<ResourceCompile>
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -182,23 +184,24 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
<BuildLog />
<ClCompile>
<PreprocessorDefinitions>_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;COBJMACROS;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_RUFUS;_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;COBJMACROS;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>..\src;..\src\msvc-missing;..\src\ms-sys\inc;..\src\syslinux\libinstaller;..\src\syslinux\libfat;..\src\syslinux\win;..\src\libcdio;..\src\getopt;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\src;..\src\msvc-missing;..\src\ms-sys\inc;..\src\syslinux\libinstaller;..\src\syslinux\libfat;..\src\syslinux\win;..\src\libcdio;..\src\getopt;..\src\wimlib;..\res;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsC</CompileAs>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ExceptionHandling>Async</ExceptionHandling>
<DisableSpecificWarnings>4091;5255;28251;28252;28253;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<AdditionalOptions>/utf-8 $(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/utf-8 /std:clatest $(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;version.lib;virtdisk.lib;wininet.lib;wintrust.lib;ole32.lib;advapi32.lib;gdi32.lib;shell32.lib;comdlg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;ntdll.lib;shlwapi.lib;version.lib;virtdisk.lib;wininet.lib;wintrust.lib;ole32.lib;advapi32.lib;gdi32.lib;shell32.lib;comdlg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<AdditionalLibraryDirectories>C:\Program Files (x86)\Windows Kits\10\Lib\10.0.16299.0\um\arm64</AdditionalLibraryDirectories>
<DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;version.dll;virtdisk.dll;wininet.dll;wintrust.dll;ole32.dll;advapi32.dll;gdi32.dll;shell32.dll;comdlg32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;version.dll;virtdisk.dll;wininet.dll;wintrust.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<AdditionalOptions>/BREPRO /DEPENDENTLOADFLAG:0x800 %(AdditionalOptions)</AdditionalOptions>
</Link>
<ResourceCompile>
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -216,8 +219,8 @@
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<AdditionalIncludeDirectories>..\src;..\src\msvc-missing;..\src\ms-sys\inc;..\src\syslinux\libinstaller;..\src\syslinux\libfat;..\src\syslinux\win;..\src\libcdio;..\src\getopt;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;COBJMACROS;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\src;..\src\msvc-missing;..\src\ms-sys\inc;..\src\syslinux\libinstaller;..\src\syslinux\libfat;..\src\syslinux\win;..\src\libcdio;..\src\getopt;..\src\wimlib;..\res;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_RUFUS;_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;COBJMACROS;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
@ -226,15 +229,16 @@
<ExceptionHandling>Async</ExceptionHandling>
<DisableSpecificWarnings>4091;5255;28251;28252;28253;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<Optimization>Disabled</Optimization>
<AdditionalOptions>/utf-8 $(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/utf-8 /std:clatest $(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;version.lib;virtdisk.lib;wininet.lib;wintrust.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;ntdll.lib;shlwapi.lib;version.lib;virtdisk.lib;wininet.lib;wintrust.lib;%(AdditionalDependencies)</AdditionalDependencies>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
<DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;version.dll;virtdisk.dll;wininet.dll;wintrust.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<AdditionalOptions>/BREPRO /DEPENDENTLOADFLAG:0x800 %(AdditionalOptions)</AdditionalOptions>
</Link>
<ResourceCompile>
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -247,25 +251,25 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<BuildLog />
<ClCompile>
<PreprocessorDefinitions>_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;COBJMACROS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_RUFUS;_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;COBJMACROS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>..\src;..\src\msvc-missing;..\src\ms-sys\inc;..\src\syslinux\libinstaller;..\src\syslinux\libfat;..\src\syslinux\win;..\src\libcdio;..\src\getopt;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\src;..\src\msvc-missing;..\src\ms-sys\inc;..\src\syslinux\libinstaller;..\src\syslinux\libfat;..\src\syslinux\win;..\src\libcdio;..\src\getopt;..\src\wimlib;..\res;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsC</CompileAs>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ExceptionHandling>Async</ExceptionHandling>
<DisableSpecificWarnings>4091;5255;28251;28252;28253;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<UndefinePreprocessorDefinitions>NDEBUG</UndefinePreprocessorDefinitions>
<AdditionalOptions>/utf-8 $(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/utf-8 /std:clatest $(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
<StringPooling>true</StringPooling>
</ClCompile>
<Link>
<AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;version.lib;virtdisk.lib;wininet.lib;wintrust.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;ntdll.lib;shlwapi.lib;version.lib;virtdisk.lib;wininet.lib;wintrust.lib;%(AdditionalDependencies)</AdditionalDependencies>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
<AdditionalOptions>/BREPRO %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/BREPRO /DEPENDENTLOADFLAG:0x800 %(AdditionalOptions)</AdditionalOptions>
<DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;version.dll;virtdisk.dll;wininet.dll;wintrust.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
<ResourceCompile>
@ -279,26 +283,26 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<BuildLog />
<ClCompile>
<PreprocessorDefinitions>_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;COBJMACROS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_RUFUS;_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;COBJMACROS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>..\src;..\src\msvc-missing;..\src\ms-sys\inc;..\src\syslinux\libinstaller;..\src\syslinux\libfat;..\src\syslinux\win;..\src\libcdio;..\src\getopt;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\src;..\src\msvc-missing;..\src\ms-sys\inc;..\src\syslinux\libinstaller;..\src\syslinux\libfat;..\src\syslinux\win;..\src\libcdio;..\src\getopt;..\src\wimlib;..\res;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsC</CompileAs>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ExceptionHandling>Async</ExceptionHandling>
<DisableSpecificWarnings>4091;5255;28251;28252;28253;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<UndefinePreprocessorDefinitions>NDEBUG</UndefinePreprocessorDefinitions>
<AdditionalOptions>/utf-8 $(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/utf-8 /std:clatest $(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
<StringPooling>true</StringPooling>
</ClCompile>
<Link>
<AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;version.lib;virtdisk.lib;wininet.lib;wintrust.lib;ole32.lib;advapi32.lib;gdi32.lib;shell32.lib;comdlg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;ntdll.lib;shlwapi.lib;version.lib;virtdisk.lib;wininet.lib;wintrust.lib;ole32.lib;advapi32.lib;gdi32.lib;shell32.lib;comdlg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<AdditionalLibraryDirectories>C:\Program Files (x86)\Windows Kits\10\Lib\10.0.15063.0\um\arm</AdditionalLibraryDirectories>
<AdditionalOptions>/BREPRO %(AdditionalOptions)</AdditionalOptions>
<DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;version.dll;virtdisk.dll;wininet.dll;wintrust.dll;ole32.dll;advapi32.dll;gdi32.dll;shell32.dll;comdlg32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<AdditionalOptions>/BREPRO /DEPENDENTLOADFLAG:0x800 %(AdditionalOptions)</AdditionalOptions>
<DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;version.dll;virtdisk.dll;wininet.dll;wintrust.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
<ResourceCompile>
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -313,26 +317,26 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
<BuildLog />
<ClCompile>
<PreprocessorDefinitions>_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;COBJMACROS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_RUFUS;_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;COBJMACROS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>..\src;..\src\msvc-missing;..\src\ms-sys\inc;..\src\syslinux\libinstaller;..\src\syslinux\libfat;..\src\syslinux\win;..\src\libcdio;..\src\getopt;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\src;..\src\msvc-missing;..\src\ms-sys\inc;..\src\syslinux\libinstaller;..\src\syslinux\libfat;..\src\syslinux\win;..\src\libcdio;..\src\getopt;..\src\wimlib;..\res;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsC</CompileAs>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ExceptionHandling>Async</ExceptionHandling>
<DisableSpecificWarnings>4091;5255;28251;28252;28253;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<UndefinePreprocessorDefinitions>NDEBUG</UndefinePreprocessorDefinitions>
<AdditionalOptions>/utf-8 $(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/utf-8 /std:clatest $(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
<StringPooling>true</StringPooling>
</ClCompile>
<Link>
<AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;version.lib;virtdisk.lib;wininet.lib;wintrust.lib;ole32.lib;advapi32.lib;gdi32.lib;shell32.lib;comdlg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;ntdll.lib;shlwapi.lib;version.lib;virtdisk.lib;wininet.lib;wintrust.lib;ole32.lib;advapi32.lib;gdi32.lib;shell32.lib;comdlg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<AdditionalLibraryDirectories>C:\Program Files (x86)\Windows Kits\10\Lib\10.0.16299.0\um\arm64</AdditionalLibraryDirectories>
<AdditionalOptions>/BREPRO %(AdditionalOptions)</AdditionalOptions>
<DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;version.dll;virtdisk.dll;wininet.dll;wintrust.dll;ole32.dll;advapi32.dll;gdi32.dll;shell32.dll;comdlg32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<AdditionalOptions>/BREPRO /DEPENDENTLOADFLAG:0x800 %(AdditionalOptions)</AdditionalOptions>
<DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;version.dll;virtdisk.dll;wininet.dll;wintrust.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
<ResourceCompile>
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -350,25 +354,25 @@
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<PreprocessorDefinitions>_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;COBJMACROS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_RUFUS;_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;COBJMACROS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>..\src;..\src\msvc-missing;..\src\ms-sys\inc;..\src\syslinux\libinstaller;..\src\syslinux\libfat;..\src\syslinux\win;..\src\libcdio;..\src\getopt;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\src;..\src\msvc-missing;..\src\ms-sys\inc;..\src\syslinux\libinstaller;..\src\syslinux\libfat;..\src\syslinux\win;..\src\libcdio;..\src\getopt;..\src\wimlib;..\res;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsC</CompileAs>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ExceptionHandling>Async</ExceptionHandling>
<DisableSpecificWarnings>4091;5255;28251;28252;28253;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<UndefinePreprocessorDefinitions>NDEBUG</UndefinePreprocessorDefinitions>
<AdditionalOptions>/utf-8 $(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/utf-8 /std:clatest $(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
<StringPooling>true</StringPooling>
</ClCompile>
<Link>
<AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;shlwapi.lib;version.lib;virtdisk.lib;wininet.lib;wintrust.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>advapi32.lib;comctl32.lib;crypt32.lib;gdi32.lib;ole32.lib;dwmapi.lib;setupapi.lib;shell32.lib;ntdll.lib;shlwapi.lib;version.lib;virtdisk.lib;wininet.lib;wintrust.lib;%(AdditionalDependencies)</AdditionalDependencies>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
<AdditionalOptions>/BREPRO %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/BREPRO /DEPENDENTLOADFLAG:0x800 %(AdditionalOptions)</AdditionalOptions>
<DelayLoadDLLs>advapi32.dll;comctl32.dll;crypt32.dll;gdi32.dll;ole32.dll;dwmapi.dll;setupapi.dll;shell32.dll;shlwapi.dll;version.dll;virtdisk.dll;wininet.dll;wintrust.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
<ResourceCompile>
@ -381,7 +385,6 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\src\badblocks.c" />
<ClCompile Include="..\src\cpu.c" />
<ClCompile Include="..\src\dos_locale.c" />
<ClCompile Include="..\src\drive.c" />
<ClCompile Include="..\src\format.c" />
@ -407,20 +410,23 @@
<ClCompile Include="..\src\ui.c" />
<ClCompile Include="..\src\vhd.c" />
<ClCompile Include="..\src\wue.c" />
<ClCompile Include="..\src\xml.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\res\dbx\dbx_info.h" />
<ClInclude Include="..\res\grub2\grub2_version.h" />
<ClInclude Include="..\res\grub\grub_version.h" />
<ClInclude Include="..\src\badblocks.h" />
<ClInclude Include="..\src\bled\bled.h" />
<ClInclude Include="..\src\cpu.h" />
<ClInclude Include="..\src\drive.h" />
<ClInclude Include="..\src\efi.h" />
<ClInclude Include="..\src\format.h" />
<ClInclude Include="..\src\gpt_types.h" />
<ClInclude Include="..\src\hdd_vs_ufd.h" />
<ClInclude Include="..\src\mbr_types.h" />
<ClInclude Include="..\src\missing.h" />
<ClInclude Include="..\src\process.h" />
<ClInclude Include="..\src\msvc-missing\unistd.h" />
<ClInclude Include="..\src\ntdll.h" />
<ClInclude Include="..\src\re.h" />
<ClInclude Include="..\src\settings.h" />
<ClInclude Include="..\src\libcdio\cdio\cdio.h" />
@ -442,6 +448,7 @@
<ClInclude Include="..\src\vhd.h" />
<ClInclude Include="..\src\winio.h" />
<ClInclude Include="..\src\wue.h" />
<ClInclude Include="..\src\xml.h" />
</ItemGroup>
<ItemGroup>
<Manifest Include="..\src\rufus.manifest" />
@ -485,6 +492,9 @@
<ProjectReference Include="ext2fs.vcxproj">
<Project>{b01f5886-2b39-4b66-b65c-6427135b6a02}</Project>
</ProjectReference>
<ProjectReference Include="wimlib.vcxproj">
<Project>{633cfc82-e01b-4777-bde4-dc0739804332}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

View file

@ -93,7 +93,7 @@
<ClCompile Include="..\src\wue.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\cpu.c">
<ClCompile Include="..\src\xml.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
@ -161,7 +161,7 @@
<ClInclude Include="..\src\db.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\process.h">
<ClInclude Include="..\src\ntdll.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\ui.h">
@ -194,7 +194,16 @@
<ClInclude Include="..\src\vhd.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\cpu.h">
<ClInclude Include="..\src\efi.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\res\dbx\dbx_info.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\msvc-missing\unistd.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\xml.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>

416
.vs/wimlib.vcxproj Normal file
View file

@ -0,0 +1,416 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|ARM64">
<Configuration>Debug</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM">
<Configuration>Release</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM64">
<Configuration>Release</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\wimlib\avl_tree.c" />
<ClCompile Include="..\src\wimlib\blob_table.c" />
<ClCompile Include="..\src\wimlib\compress.c" />
<ClCompile Include="..\src\wimlib\compress_common.c" />
<ClCompile Include="..\src\wimlib\compress_parallel.c" />
<ClCompile Include="..\src\wimlib\compress_serial.c" />
<ClCompile Include="..\src\wimlib\cpu_features.c" />
<ClCompile Include="..\src\wimlib\decompress.c" />
<ClCompile Include="..\src\wimlib\decompress_common.c" />
<ClCompile Include="..\src\wimlib\dentry.c" />
<ClCompile Include="..\src\wimlib\divsufsort.c" />
<ClCompile Include="..\src\wimlib\encoding.c" />
<ClCompile Include="..\src\wimlib\error.c" />
<ClCompile Include="..\src\wimlib\export_image.c" />
<ClCompile Include="..\src\wimlib\extract.c" />
<ClCompile Include="..\src\wimlib\file_io.c" />
<ClCompile Include="..\src\wimlib\header.c" />
<ClCompile Include="..\src\wimlib\inode.c" />
<ClCompile Include="..\src\wimlib\inode_fixup.c" />
<ClCompile Include="..\src\wimlib\inode_table.c" />
<ClCompile Include="..\src\wimlib\integrity.c" />
<ClCompile Include="..\src\wimlib\iterate_dir.c" />
<ClCompile Include="..\src\wimlib\lcpit_matchfinder.c" />
<ClCompile Include="..\src\wimlib\lzms_common.c" />
<ClCompile Include="..\src\wimlib\lzms_compress.c" />
<ClCompile Include="..\src\wimlib\lzms_decompress.c" />
<ClCompile Include="..\src\wimlib\lzx_common.c" />
<ClCompile Include="..\src\wimlib\lzx_compress.c" />
<ClCompile Include="..\src\wimlib\lzx_decompress.c" />
<ClCompile Include="..\src\wimlib\metadata_resource.c" />
<ClCompile Include="..\src\wimlib\pathlist.c" />
<ClCompile Include="..\src\wimlib\paths.c" />
<ClCompile Include="..\src\wimlib\pattern.c" />
<ClCompile Include="..\src\wimlib\progress.c" />
<ClCompile Include="..\src\wimlib\registry.c" />
<ClCompile Include="..\src\wimlib\reparse.c" />
<ClCompile Include="..\src\wimlib\resource.c" />
<ClCompile Include="..\src\wimlib\scan.c" />
<ClCompile Include="..\src\wimlib\security.c" />
<ClCompile Include="..\src\wimlib\sha1.c" />
<ClCompile Include="..\src\wimlib\solid.c" />
<ClCompile Include="..\src\wimlib\split.c" />
<ClCompile Include="..\src\wimlib\tagged_items.c" />
<ClCompile Include="..\src\wimlib\textfile.c" />
<ClCompile Include="..\src\wimlib\threads.c" />
<ClCompile Include="..\src\wimlib\timestamp.c" />
<ClCompile Include="..\src\wimlib\update_image.c" />
<ClCompile Include="..\src\wimlib\util.c" />
<ClCompile Include="..\src\wimlib\wim.c" />
<ClCompile Include="..\src\wimlib\wimboot.c" />
<ClCompile Include="..\src\wimlib\win32_apply.c" />
<ClCompile Include="..\src\wimlib\win32_capture.c" />
<ClCompile Include="..\src\wimlib\win32_common.c" />
<ClCompile Include="..\src\wimlib\win32_replacements.c" />
<ClCompile Include="..\src\wimlib\win32_vss.c" />
<ClCompile Include="..\src\wimlib\write.c" />
<ClCompile Include="..\src\wimlib\xml.c" />
<ClCompile Include="..\src\wimlib\xmlproc.c" />
<ClCompile Include="..\src\wimlib\xml_windows.c" />
<ClCompile Include="..\src\wimlib\xpress_compress.c" />
<ClCompile Include="..\src\wimlib\xpress_decompress.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\wimlib\config.h" />
<ClInclude Include="..\src\wimlib\wimlib.h" />
<ClInclude Include="..\src\wimlib\wimlib\alloca.h" />
<ClInclude Include="..\src\wimlib\wimlib\apply.h" />
<ClInclude Include="..\src\wimlib\wimlib\assert.h" />
<ClInclude Include="..\src\wimlib\wimlib\avl_tree.h" />
<ClInclude Include="..\src\wimlib\wimlib\bitops.h" />
<ClInclude Include="..\src\wimlib\wimlib\blob_table.h" />
<ClInclude Include="..\src\wimlib\wimlib\bt_matchfinder.h" />
<ClInclude Include="..\src\wimlib\wimlib\case.h" />
<ClInclude Include="..\src\wimlib\wimlib\chunk_compressor.h" />
<ClInclude Include="..\src\wimlib\wimlib\compiler.h" />
<ClInclude Include="..\src\wimlib\wimlib\compressor_ops.h" />
<ClInclude Include="..\src\wimlib\wimlib\compress_common.h" />
<ClInclude Include="..\src\wimlib\wimlib\cpu_features.h" />
<ClInclude Include="..\src\wimlib\wimlib\decompressor_ops.h" />
<ClInclude Include="..\src\wimlib\wimlib\decompress_common.h" />
<ClInclude Include="..\src\wimlib\wimlib\dentry.h" />
<ClInclude Include="..\src\wimlib\wimlib\divsufsort.h" />
<ClInclude Include="..\src\wimlib\wimlib\encoding.h" />
<ClInclude Include="..\src\wimlib\wimlib\endianness.h" />
<ClInclude Include="..\src\wimlib\wimlib\error.h" />
<ClInclude Include="..\src\wimlib\wimlib\file_io.h" />
<ClInclude Include="..\src\wimlib\wimlib\glob.h" />
<ClInclude Include="..\src\wimlib\wimlib\guid.h" />
<ClInclude Include="..\src\wimlib\wimlib\hc_matchfinder.h" />
<ClInclude Include="..\src\wimlib\wimlib\header.h" />
<ClInclude Include="..\src\wimlib\wimlib\inode.h" />
<ClInclude Include="..\src\wimlib\wimlib\inode_table.h" />
<ClInclude Include="..\src\wimlib\wimlib\integrity.h" />
<ClInclude Include="..\src\wimlib\wimlib\lcpit_matchfinder.h" />
<ClInclude Include="..\src\wimlib\wimlib\list.h" />
<ClInclude Include="..\src\wimlib\wimlib\lzms_common.h" />
<ClInclude Include="..\src\wimlib\wimlib\lzms_constants.h" />
<ClInclude Include="..\src\wimlib\wimlib\lzx_common.h" />
<ClInclude Include="..\src\wimlib\wimlib\lzx_constants.h" />
<ClInclude Include="..\src\wimlib\wimlib\matchfinder_common.h" />
<ClInclude Include="..\src\wimlib\wimlib\metadata.h" />
<ClInclude Include="..\src\wimlib\wimlib\ntfs_3g.h" />
<ClInclude Include="..\src\wimlib\wimlib\object_id.h" />
<ClInclude Include="..\src\wimlib\wimlib\pathlist.h" />
<ClInclude Include="..\src\wimlib\wimlib\paths.h" />
<ClInclude Include="..\src\wimlib\wimlib\pattern.h" />
<ClInclude Include="..\src\wimlib\wimlib\progress.h" />
<ClInclude Include="..\src\wimlib\wimlib\registry.h" />
<ClInclude Include="..\src\wimlib\wimlib\reparse.h" />
<ClInclude Include="..\src\wimlib\wimlib\resource.h" />
<ClInclude Include="..\src\wimlib\wimlib\scan.h" />
<ClInclude Include="..\src\wimlib\wimlib\security.h" />
<ClInclude Include="..\src\wimlib\wimlib\security_descriptor.h" />
<ClInclude Include="..\src\wimlib\wimlib\sha1.h" />
<ClInclude Include="..\src\wimlib\wimlib\solid.h" />
<ClInclude Include="..\src\wimlib\wimlib\tagged_items.h" />
<ClInclude Include="..\src\wimlib\wimlib\test_support.h" />
<ClInclude Include="..\src\wimlib\wimlib\textfile.h" />
<ClInclude Include="..\src\wimlib\wimlib\threads.h" />
<ClInclude Include="..\src\wimlib\wimlib\timestamp.h" />
<ClInclude Include="..\src\wimlib\wimlib\types.h" />
<ClInclude Include="..\src\wimlib\wimlib\unaligned.h" />
<ClInclude Include="..\src\wimlib\wimlib\unix_data.h" />
<ClInclude Include="..\src\wimlib\wimlib\util.h" />
<ClInclude Include="..\src\wimlib\wimlib\wim.h" />
<ClInclude Include="..\src\wimlib\wimlib\wimboot.h" />
<ClInclude Include="..\src\wimlib\wimlib\win32.h" />
<ClInclude Include="..\src\wimlib\wimlib\win32_common.h" />
<ClInclude Include="..\src\wimlib\wimlib\win32_vss.h" />
<ClInclude Include="..\src\wimlib\wimlib\wof.h" />
<ClInclude Include="..\src\wimlib\wimlib\write.h" />
<ClInclude Include="..\src\wimlib\wimlib\xattr.h" />
<ClInclude Include="..\src\wimlib\wimlib\xml.h" />
<ClInclude Include="..\src\wimlib\wimlib\xmlproc.h" />
<ClInclude Include="..\src\wimlib\wimlib\xml_windows.h" />
<ClInclude Include="..\src\wimlib\wimlib\xpress_constants.h" />
<ClInclude Include="..\src\wimlib\wimlib_tchar.h" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{633CFC82-E01B-4777-BDE4-DC0739804332}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>wimlib</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v143</PlatformToolset>
<WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v143</PlatformToolset>
<WindowsSDKDesktopARM64Support>true</WindowsSDKDesktopARM64Support>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v143</PlatformToolset>
<WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v143</PlatformToolset>
<WindowsSDKDesktopARM64Support>true</WindowsSDKDesktopARM64Support>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">$(SolutionDir)arm\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">$(SolutionDir)arm\$(Configuration)\$(ProjectName)\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">$(SolutionDir)arm\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">$(SolutionDir)arm\$(Configuration)\$(ProjectName)\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">$(SolutionDir)arm64\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">$(SolutionDir)arm64\$(Configuration)\$(ProjectName)\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">$(SolutionDir)arm64\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">$(SolutionDir)arm64\$(Configuration)\$(ProjectName)\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)x86\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)x86\$(Configuration)\$(ProjectName)\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)x86\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)x86\$(Configuration)\$(ProjectName)\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)x64\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)x64\$(Configuration)\$(ProjectName)\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)x64\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)x64\$(Configuration)\$(ProjectName)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">false</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">false</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">false</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">false</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\src;..\src\wimlib;..\src\msvc-missing;..\src\libcdio;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4018;4146;4267;4244;4334;4789;4996;6201;6239;6246;6255;6262;6297;6326;28252;28253</DisableSpecificWarnings>
<CompileAs>CompileAsC</CompileAs>
<AdditionalOptions>/std:clatest</AdditionalOptions>
<PreprocessorDefinitions>_RUFUS;HAVE_CONFIG_H;UNICODE;_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_FILE_OFFSET_BITS=64;__SSE2__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<Lib>
<TargetMachine>MachineX86</TargetMachine>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\src;..\src\wimlib;..\src\msvc-missing;..\src\libcdio;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalOptions>/std:clatest</AdditionalOptions>
<DisableSpecificWarnings>4018;4146;4267;4244;4334;4789;4996;6201;6239;6246;6255;6262;6297;6326;28252;28253</DisableSpecificWarnings>
<PreprocessorDefinitions>_RUFUS;HAVE_CONFIG_H;UNICODE;_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_FILE_OFFSET_BITS=64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<Lib />
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\src;..\src\wimlib;..\src\msvc-missing;..\src\libcdio;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalOptions>/std:clatest</AdditionalOptions>
<DisableSpecificWarnings>4018;4146;4267;4244;4334;4789;4996;6201;6239;6246;6255;6262;6297;6326;28252;28253</DisableSpecificWarnings>
<PreprocessorDefinitions>_RUFUS;HAVE_CONFIG_H;UNICODE;_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_FILE_OFFSET_BITS=64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<Lib />
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>..\src;..\src\wimlib;..\src\msvc-missing;..\src\libcdio;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4018;4146;4267;4244;4334;4789;4996;6201;6239;6246;6255;6262;6297;6326;28252;28253</DisableSpecificWarnings>
<CompileAs>CompileAsC</CompileAs>
<AdditionalOptions>/std:clatest</AdditionalOptions>
<StringPooling>true</StringPooling>
<PreprocessorDefinitions>_RUFUS;HAVE_CONFIG_H;UNICODE;_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_FILE_OFFSET_BITS=64;__SSE2__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Lib>
<TargetMachine>MachineX86</TargetMachine>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>..\src;..\src\wimlib;..\src\msvc-missing;..\src\libcdio;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalOptions>/std:clatest</AdditionalOptions>
<DisableSpecificWarnings>4018;4146;4267;4244;4334;4789;4996;6201;6239;6246;6255;6262;6297;6326;28252;28253</DisableSpecificWarnings>
<StringPooling>true</StringPooling>
<PreprocessorDefinitions>_RUFUS;HAVE_CONFIG_H;UNICODE;_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_FILE_OFFSET_BITS=64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Lib />
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>..\src;..\src\wimlib;..\src\msvc-missing;..\src\libcdio;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalOptions>/std:clatest</AdditionalOptions>
<DisableSpecificWarnings>4018;4146;4267;4244;4334;4789;4996;6201;6239;6246;6255;6262;6297;6326;28252;28253</DisableSpecificWarnings>
<StringPooling>true</StringPooling>
<PreprocessorDefinitions>_RUFUS;HAVE_CONFIG_H;UNICODE;_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_FILE_OFFSET_BITS=64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Lib />
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\src;..\src\wimlib;..\src\msvc-missing;..\src\libcdio;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4018;4146;4267;4244;4334;4789;4996;6201;6239;6246;6255;6262;6297;6326;28252;28253</DisableSpecificWarnings>
<CompileAs>CompileAsC</CompileAs>
<AdditionalOptions>/std:clatest</AdditionalOptions>
<PreprocessorDefinitions>_RUFUS;HAVE_CONFIG_H;UNICODE;_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_FILE_OFFSET_BITS=64;__SSE2__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<Lib>
<TargetMachine>MachineX64</TargetMachine>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>..\src;..\src\wimlib;..\src\msvc-missing;..\src\libcdio;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4018;4146;4267;4244;4334;4789;4996;6201;6239;6246;6255;6262;6297;6326;28252;28253</DisableSpecificWarnings>
<CompileAs>CompileAsC</CompileAs>
<AdditionalOptions>/std:clatest</AdditionalOptions>
<StringPooling>true</StringPooling>
<PreprocessorDefinitions>_RUFUS;HAVE_CONFIG_H;UNICODE;_OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_FILE_OFFSET_BITS=64;__SSE2__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<Lib>
<TargetMachine>MachineX64</TargetMachine>
</Lib>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

422
.vs/wimlib.vcxproj.filters Normal file
View file

@ -0,0 +1,422 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\wimlib\wim.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\extract.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\xml.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\xmlproc.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\util.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\error.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\win32_replacements.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\win32_common.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\blob_table.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\encoding.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\cpu_features.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\threads.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\win32_apply.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\win32_vss.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\header.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\metadata_resource.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\resource.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\security.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\decompress.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\decompress_common.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\sha1.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\xpress_decompress.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\write.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\file_io.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\progress.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\integrity.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\dentry.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\export_image.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\inode.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\iterate_dir.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\avl_tree.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\win32_capture.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\timestamp.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\pathlist.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\paths.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\scan.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\lzms_common.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\lzms_decompress.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\lzx_common.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\lzx_decompress.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\solid.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\reparse.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\compress_parallel.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\compress_serial.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\compress.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\xpress_compress.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\lzms_compress.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\lzx_compress.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\compress_common.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\pattern.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\lcpit_matchfinder.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\textfile.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\divsufsort.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\inode_table.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\inode_fixup.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\tagged_items.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\wimboot.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\update_image.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\xml_windows.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\registry.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\wimlib\split.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\wimlib\config.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\assert.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\blob_table.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\cpu_features.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\dentry.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\encoding.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\file_io.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\integrity.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\metadata.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\security.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\threads.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\wim.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\win32.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\xml.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\list.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\resource.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\sha1.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\types.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\util.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib_tchar.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\compiler.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\avl_tree.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\case.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\inode.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\error.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\guid.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\header.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\apply.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\progress.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\endianness.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\object_id.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\pathlist.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\paths.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\pattern.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\reparse.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\tagged_items.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\unix_data.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\xattr.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\timestamp.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\write.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\xmlproc.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\test_support.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\glob.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\win32_common.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\win32_vss.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\bitops.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\ntfs_3g.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\scan.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\unaligned.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\inode_table.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\textfile.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\wimboot.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\wof.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\alloca.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\decompress_common.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\decompressor_ops.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\xpress_constants.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\chunk_compressor.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\solid.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\lzms_common.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\lzms_constants.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\lzx_common.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\lzx_constants.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\compress_common.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\compressor_ops.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\hc_matchfinder.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\matchfinder_common.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\bt_matchfinder.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\lcpit_matchfinder.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\divsufsort.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\xml_windows.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\registry.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\wimlib\wimlib\security_descriptor.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

View file

@ -1,3 +1,17 @@
o Version 4.7 (2025.04.09)
Add a mechanism to detect and download updated DBXs from the official UEFI repository
Add ztsd compression support for disk images
Add a new exclusion feature in the settings, to ignore disks with a specific GPT GUID
Improve detection for compressed VHD images that are too large to fit the target drive
Fix commandline hogger not being deleted when running Rufus from a different directory
Fix FAT filenames from embedded images being potentially truncated on image extraction
Fix a side-loading vulnerability [CVE-2025-26624] with cfgmgr32.dll (with thanks to @EmperialX)
Fix UI memory leaks (courtesy of @ozone10)
Fall back to user/system default locale when getting error description (courtesy of @Wack0)
Don't run the commandline hogger on POSIX shells
Drop ARM 32-bit builds (Note that ARM 64-bit builds are *NOT* affected by this)
Update FreeDOS and Grub4DOS to latest
o Version 4.6 (2024.10.21)
Add a new setup.exe wrapper to bypass Windows 11 24H2 in-place upgrade restrictions
Add TimeZone to regional options replication

View file

@ -3,6 +3,9 @@ TARGET = rufus
TAGVER = $(shell git log --oneline | wc -l)
SEDCMD = s/^\([ \t]*\)Version="\([0-9]*\)\.\([0-9]*\)\.[0-9]*\.\([0-9]*\)"\(.*\)/\1Version="\2.\3.@@TAGVER@@.\4"\5/
upx: all
@upx --lzma --best src/$(TARGET)$(EXEEXT)
# This step produces the UPX compressed and signed releases that are made available for public download
# NB: UPX v3.09 or later is needed for LZMA compression (http://upx.sourceforge.net/)
release: all

View file

@ -502,6 +502,9 @@ uninstall-am:
pdf-am ps ps-am tags tags-am uninstall uninstall-am
upx: all
@upx --lzma --best src/$(TARGET)$(EXEEXT)
# This step produces the UPX compressed and signed releases that are made available for public download
# NB: UPX v3.09 or later is needed for LZMA compression (http://upx.sourceforge.net/)
release: all

View file

@ -1,7 +1,9 @@
# Reporting a Vulnerability
# Reporting a security vulnerability
To report a vulnerability for Rufus, please e-mail support@akeo.ie.
To report a **security** vulnerability for Rufus (i.e. an issue that you believe could lead to malicious actors being able to exploit the Rufus application), please e-mail support@akeo.ie.
If you find a vulnerability, we will ask you to respect [responsible disclosure](https://en.wikipedia.org/wiki/Responsible_disclosure) practices.
Please do **NOT** use the e-mail above if you have a regular issue, such as a problem creating or using a bootable drive. Instead go back to https://github.com/pbatard/rufus/issues and create an issue using the regular *Issue Report* template.
In return, we will endeavour to respond to vulnerability reports within 48 hours.
For any security vulnerability report, we kindly ask you to respect [responsible disclosure](https://en.wikipedia.org/wiki/Responsible_disclosure) practices.
In return, we will endeavour to respond to security vulnerability reports within 48 hours.

View file

@ -1,5 +1,4 @@
#!/bin/sh
rm -f rufus*.exe
./configure --disable-debug "$@"
make -j12 clean
make -j12 release

29
configure vendored
View file

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.71 for rufus 4.6.
# Generated by GNU Autoconf 2.71 for rufus 4.8.
#
# Report bugs to <https://github.com/pbatard/rufus/issues>.
#
@ -611,8 +611,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='rufus'
PACKAGE_TARNAME='rufus'
PACKAGE_VERSION='4.6'
PACKAGE_STRING='rufus 4.6'
PACKAGE_VERSION='4.8'
PACKAGE_STRING='rufus 4.8'
PACKAGE_BUGREPORT='https://github.com/pbatard/rufus/issues'
PACKAGE_URL='https://rufus.ie'
@ -1269,7 +1269,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures rufus 4.6 to adapt to many kinds of systems.
\`configure' configures rufus 4.8 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1336,7 +1336,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of rufus 4.6:";;
short | recursive ) echo "Configuration of rufus 4.8:";;
esac
cat <<\_ACEOF
@ -1428,7 +1428,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
rufus configure 4.6
rufus configure 4.8
generated by GNU Autoconf 2.71
Copyright (C) 2021 Free Software Foundation, Inc.
@ -1504,7 +1504,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by rufus $as_me 4.6, which was
It was created by rufus $as_me 4.8, which was
generated by GNU Autoconf 2.71. Invocation command line was
$ $0$ac_configure_args_raw
@ -2767,7 +2767,7 @@ fi
# Define the identity of the package.
PACKAGE='rufus'
VERSION='4.6'
VERSION='4.8'
printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
@ -4702,7 +4702,7 @@ fi
printf "%s\n" "enabling Large File Support (ISO support)" >&6; }
AM_CFLAGS="$AM_CFLAGS -D_FILE_OFFSET_BITS=64 -D_OFF_T_ -D_off_t=off64_t -Doff_t=off64_t -Doff32_t=long"
# check for -Wno-pointer-sign compiler support (GCC >= 4)
# Check for -Wno-pointer-sign compiler support (GCC >= 4)
saved_CFLAGS="${CFLAGS}"
CFLAGS="$CFLAGS -Wno-pointer-sign"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@ -4725,7 +4725,9 @@ fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
CFLAGS="${saved_CFLAGS}"
AM_CFLAGS="$AM_CFLAGS -DUNICODE -D_UNICODE -UNDEBUG -DCOBJMACROS -D__USE_MINGW_ANSI_STDIO=0 -std=gnu99 -Wshadow -Wall -Wformat-security -Wundef -Wunused -Wstrict-prototypes -Wno-restrict -Wno-array-bounds -Werror-implicit-function-declaration -Wbidi-chars=none $nopointersign_cflags"
# NB: The DECLSPEC_IMPORT redefinition below is a temporary(?) workaround for MinGW32 delay-loading
# See https://github.com/pbatard/rufus/pull/2513 as well as https://sourceware.org/bugzilla/show_bug.cgi?id=14339
AM_CFLAGS="$AM_CFLAGS -DUNICODE -D_UNICODE -UNDEBUG -DCOBJMACROS -D__USE_MINGW_ANSI_STDIO=0 -UDECLSPEC_IMPORT -DDECLSPEC_IMPORT=__attribute__\(\(visibility\(\\\"hidden\\\"\)\)\) -std=gnu11 -Wshadow -Wall -Wformat-security -Wundef -Wunused -Wstrict-prototypes -Wno-restrict -Wno-array-bounds -Werror-implicit-function-declaration -Wbidi-chars=none $nopointersign_cflags"
@ -4758,6 +4760,8 @@ ac_config_files="$ac_config_files src/syslinux/libinstaller/Makefile"
ac_config_files="$ac_config_files src/syslinux/win/Makefile"
ac_config_files="$ac_config_files src/wimlib/Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
@ -5309,7 +5313,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by rufus $as_me 4.6, which was
This file was extended by rufus $as_me 4.8, which was
generated by GNU Autoconf 2.71. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -5365,7 +5369,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
rufus config.status 4.6
rufus config.status 4.8
configured by $0, generated by GNU Autoconf 2.71,
with options \\"\$ac_cs_config\\"
@ -5491,6 +5495,7 @@ do
"src/syslinux/libfat/Makefile") CONFIG_FILES="$CONFIG_FILES src/syslinux/libfat/Makefile" ;;
"src/syslinux/libinstaller/Makefile") CONFIG_FILES="$CONFIG_FILES src/syslinux/libinstaller/Makefile" ;;
"src/syslinux/win/Makefile") CONFIG_FILES="$CONFIG_FILES src/syslinux/win/Makefile" ;;
"src/wimlib/Makefile") CONFIG_FILES="$CONFIG_FILES src/wimlib/Makefile" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac

View file

@ -1,4 +1,4 @@
AC_INIT([rufus], [4.6], [https://github.com/pbatard/rufus/issues], [rufus], [https://rufus.ie])
AC_INIT([rufus], [4.8], [https://github.com/pbatard/rufus/issues], [rufus], [https://rufus.ie])
AM_INIT_AUTOMAKE([-Wno-portability foreign no-dist no-dependencies])
AC_CONFIG_SRCDIR([src/rufus.c])
AC_CONFIG_MACRO_DIR([m4])
@ -57,14 +57,16 @@ fi
AC_MSG_RESULT([enabling Large File Support (ISO support)])
AM_CFLAGS="$AM_CFLAGS -D_FILE_OFFSET_BITS=64 -D_OFF_T_ -D_off_t=off64_t -Doff_t=off64_t -Doff32_t=long"
# check for -Wno-pointer-sign compiler support (GCC >= 4)
# Check for -Wno-pointer-sign compiler support (GCC >= 4)
saved_CFLAGS="${CFLAGS}"
CFLAGS="$CFLAGS -Wno-pointer-sign"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[nopointersign_cflags="-Wno-pointer-sign"], [nopointersign_cflags=""])
CFLAGS="${saved_CFLAGS}"
AM_CFLAGS="$AM_CFLAGS -DUNICODE -D_UNICODE -UNDEBUG -DCOBJMACROS -D__USE_MINGW_ANSI_STDIO=0 -std=gnu99 -Wshadow -Wall -Wformat-security -Wundef -Wunused -Wstrict-prototypes -Wno-restrict -Wno-array-bounds -Werror-implicit-function-declaration -Wbidi-chars=none $nopointersign_cflags"
# NB: The DECLSPEC_IMPORT redefinition below is a temporary(?) workaround for MinGW32 delay-loading
# See https://github.com/pbatard/rufus/pull/2513 as well as https://sourceware.org/bugzilla/show_bug.cgi?id=14339
AM_CFLAGS="$AM_CFLAGS -DUNICODE -D_UNICODE -UNDEBUG -DCOBJMACROS -D__USE_MINGW_ANSI_STDIO=0 -UDECLSPEC_IMPORT -DDECLSPEC_IMPORT=__attribute__\(\(visibility\(\\\"hidden\\\"\)\)\) -std=gnu11 -Wshadow -Wall -Wformat-security -Wundef -Wunused -Wstrict-prototypes -Wno-restrict -Wno-array-bounds -Werror-implicit-function-declaration -Wbidi-chars=none $nopointersign_cflags"
AC_SUBST([VISIBILITY_CFLAGS])
AC_SUBST([AM_CFLAGS])
@ -84,4 +86,5 @@ AC_CONFIG_FILES([src/ms-sys/Makefile])
AC_CONFIG_FILES([src/syslinux/libfat/Makefile])
AC_CONFIG_FILES([src/syslinux/libinstaller/Makefile])
AC_CONFIG_FILES([src/syslinux/win/Makefile])
AC_CONFIG_FILES([src/wimlib/Makefile])
AC_OUTPUT

63
loadcfg.py Normal file
View file

@ -0,0 +1,63 @@
#!/bin/env python3
# PE Load Configuration section enabler for MinGW/gcc executables.
# The PE executable should have a IMAGE_LOAD_CONFIG_DIRECTORY## section
# in .rdata with a 16-byte IMAGE_DIRECTORY_ENTRY_MARKER marker.
import os
import sys
import pefile
IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG = 10
IMAGE_DIRECTORY_ENTRY_MARKER = b"_RUFUS_LOAD_CFG"
if len(sys.argv) < 2:
raise RuntimeError("No executable path supplied")
# Create a temp file as our source
pe_dst = sys.argv[1]
pe_src = sys.argv[1] + ".tmp"
os.replace(pe_dst, pe_src)
# Open and parse PE
pe = pefile.PE(pe_src)
# Find .rdata section
rdata_section = next(
(s for s in pe.sections if s.Name.rstrip(b'\x00') == b'.rdata'),
None
)
if not rdata_section:
raise RuntimeError(".rdata section not found")
# Read the section's raw data to search for the target string
raw_data = rdata_section.get_data()
# Look for the target data in the raw section data
offset = raw_data.find(IMAGE_DIRECTORY_ENTRY_MARKER)
if offset == -1:
raise RuntimeError("Load Config marker not found")
# Move past our 16 bytes marker
offset += 0x10
# Calculate the RVA and size of the Load Config section
load_config_rva = rdata_section.VirtualAddress + offset
print(f"RVA of Load Config: 0x{load_config_rva:X}")
load_config_size = pe.get_dword_at_rva(load_config_rva)
if (load_config_size < 0x20):
raise RuntimeError("Size of Load Config section is too small")
print(f"Size of Load Config: 0x{load_config_size:X}")
# Update Load Config directory entry
pe.OPTIONAL_HEADER.DATA_DIRECTORY[IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG].VirtualAddress = load_config_rva
pe.OPTIONAL_HEADER.DATA_DIRECTORY[IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG].Size = load_config_size
# Update the checksum
pe.OPTIONAL_HEADER.CheckSum = pe.generate_checksum()
# Write the updated PE file and remove temp
pe.write(pe_dst)
os.remove(pe_src)
# Can be validated with `DUMPBIN /LOADCONFIG <.exe>` or `objdump -x <.exe> | grep "Load Configuration"`
print(f"Successfully enabled Load Config section in '{pe_dst}'")

View file

@ -0,0 +1,62 @@
// Compile with: gcc -lversion -o get_pe_info get_pe_info.c
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
VS_FIXEDFILEINFO *file_info;
DWORD handle, size;
WORD lang, codepage;
UINT len;
void *buffer = NULL, *translation, *version_info;
char sub_block[50];
int ret = 1;
if (argc != 3 || argv[1][0] != '-') {
printf("Usage: %s [-i|-v] <path_to_executable>\n", argv[0]);
goto out;
}
size = GetFileVersionInfoSizeA(argv[2], &handle);
if (size == 0) {
fprintf(stderr, "Failed to get version info size.\n");
goto out;
}
buffer = malloc(size);
if (buffer == NULL)
goto out;
if (!GetFileVersionInfoA(argv[2], handle, size, buffer)) {
fprintf(stderr, "Failed to get version info.\n");
goto out;
}
if (argv[1][1] == 'i') {
if (!VerQueryValueA(buffer, "\\VarFileInfo\\Translation", &translation, &len) || len < 4) {
fprintf(stderr, "Failed to retrieve language and codepage information.\n");
goto out;
}
lang = *(WORD*)translation;
codepage = *((WORD*)translation + 1);
snprintf(sub_block, sizeof(sub_block), "\\StringFileInfo\\%04x%04x\\InternalName", lang, codepage);
if (!VerQueryValueA(buffer, sub_block, &version_info, &len)) {
fprintf(stderr, "Failed to retrieve Internal Name.\n");
goto out;
}
printf("%s\n", (char*)version_info);
} else {
if (!VerQueryValueA(buffer, "\\", (LPVOID*)&file_info, &len) || len < sizeof(VS_FIXEDFILEINFO)) {
fprintf(stderr, "Failed to retrieve file info.\n");
goto out;
}
printf("%d.%d.%d.%d\n", HIWORD(file_info->dwFileVersionMS), LOWORD(file_info->dwFileVersionMS),
HIWORD(file_info->dwFileVersionLS), LOWORD(file_info->dwFileVersionLS));
}
ret = 0;
out:
free(buffer);
return ret;
}

View file

@ -1,4 +1,4 @@
"Field","ID","Type (Type)","default","en-us","ar-sa","bg-bg","zh-cn","zh-tw","hr-hr","cs-cz","da-dk","nl-nl","fi-fi","fr-fr","de-de","el-gr","he-il","hu-hu","id-id","it-it","ja-jp","ko-kr","lv-lv","lt-lt","ms-my","nb-no","fa-ir","pl-pl","pt-br","pt-pt","ro-ro","ru-ru","sr-latn-rs","sk-sk","sl-si","es-es","sv-se","th-th","tr-tr","uk-ua","vi-vn"
"Field","ID","Type (Type)","default","en-us","ar-sa","bg-bg","zh-cn","zh-tw","hr-hr","cs-cz","da-dk","nl-nl","fi-fi","fr-fr","de-de","el-gr","he-il","hu-hu","id-id","it-it","ja-jp","ko-kr","lv-lv","lt-lt","ms-my","nb-no","fa-ir","pl-pl","pt-br","pt-pt","ro-ro","ru-ru","sr-latn-rs","sk-sk","sl-si","es-es","sv-se","th-th","tr-tr","uk-ua","vi-vn"
"Description","2","Text","","Rufus is a utility that helps format and create bootable USB flash drives, such as USB keys/pendrives, memory sticks, etc.
• Official site: https://rufus.ie
• Source Code: https://github.com/pbatard/rufus
@ -114,21 +114,25 @@
• Trang web chính thức: https://rufus.ie
• Mã nguồn: https://github.com/pbatard/rufus
• Nhật ký thay đổi: https://github.com/pbatard/rufus/blob/master/ChangeLog.txt"
"ReleaseNotes","3","Text","• Add a new setup.exe wrapper to bypass Windows 11 24H2 in-place upgrade restrictions
• Add TimeZone to regional options replication
• Set local account passwords to not expire by default
• Fix an error when trying to write compressed VHD images
• Fix an error when invoking Rufus from the PowerShell commandline
• Improve revoked UEFI bootloaders check to support Linux SBAT, Windows SVN and cert DBX
• Improve support for ReactOS boot media
",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
"ReleaseNotes","3","Text","• Add a mechanism to detect and download updated DBXs from the official UEFI repository
• Add ztsd compression support for disk images
• Add a new exclusion feature in the settings, to ignore disks with a specific GPT GUID
• Improve detection for compressed VHD images that are too large to fit the target drive
• Fix commandline hogger not being deleted when running Rufus from a different directory
• Fix FAT filenames from embedded images being potentially truncated on image extraction
• Fix a side-loading vulnerability [CVE-2025-26624] with cfgmgr32.dll (with thanks to @EmperialX)
• Fix UI memory leaks (courtesy of @ozone10)
• Fall back to user/system default locale when getting error description (courtesy of @Wack0)
• Don't run the commandline hogger on POSIX shells
• Drop ARM 32-bit builds (Note that ARM 64-bit builds are *NOT* affected by this)
• Update FreeDOS and Grub4DOS to latest",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
"Title","4","Text","Rufus",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
"ShortTitle","5","Text","",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
"SortTitle","6","Text","",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
"VoiceTitle","7","Text","",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
"ShortDescription","8","Text","","Rufus - The Reliable USB Formatting Utility","Rufus - أداة فرمتة الـ USB جديرة بالثقة","Rufus - Надеждната USB форматираща програма","Rufus - 可靠的 USB 格式化工具","Rufus - 快速可靠的 USB 格式化工具","Rufus - Pouzdan alat za formatiranje USB-a","Rufus - Spolehlivý program pro formátování USB","Rufus - Det pålidelige USB-formateringsværktøj","Rufus - de betrouwbare USB-formatteertool","Rufus - Luotettava USB-alustusohjelma","Rufus - L'utilitaire de formatage USB fiable","Rufus - Das zuverlässige USB-Formatierungstool","Rufus - Μία αξιόπιστη εφαρμογή διαμόρφωσης USB","Rufus - הכלי לאתחול USB האמין ביותר","Rufus - A megbízható USB-formázó segédprogram","Rufus - Utilitas Pemformatan USB yang Handal","Rufus - Utility affidabile per la formattazione di unità USB","Rufus - 信頼性の高い USB フォーマット ユーティリティ","Rufus - 신뢰할 수 있는 USB 포맷 유틸리티","Rufus - uzticama un vienkārša USB formatēšanas utilīta","Rufus - patikima USB formatavimo priemonė","Rufus - Utiliti pemformatan USB yang dipercayai","Rufus - Det pålitelige USB-formateringsprogrammet","Rufus، ابزاری کاربردی و قابل‌اطمینان برای فرمت کردن درایوهای USB","Rufus - niezawodne narzędzie do formatowania USB","Rufus - O Utilitário de Formatação USB Confiável","Rufus - O utilitário de confiança para formatação USB","Rufus - Instrumentul de încredere pentru formatări USB","Rufus - Надёжная утилита для форматирования USB-дисков","Rufus - Pouzdan Alat Za Formatiranje USB diska","Rufus - Spoľahlivý program pre formátovanie USB","Rufus - zanesljivi pripomoček za USB formatiranje","Rufus, la herramienta de formateo de USBs en la que puedes confiar","Rufus - Det pålitliga verktyget för USB-formatering","Rufus - ยูทิลิตี้การฟอร์แมต USB ที่ไว้ใจได้","Rufus - Güvenilir USB Biçimlendirme Programı","Rufus - надійна утиліта для форматування USB-накопичувачів","Rufus - Tiện ích Định dạng USB Đáng tin cậy"
"DevStudio","9","Text","Pete Batard",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
"CopyrightTrademarkInformation","12","Text","© 2011-2024 Pete Batard",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
"CopyrightTrademarkInformation","12","Text","© 2011-2025 Pete Batard",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
"AdditionalLicenseTerms","13","Text","https://www.gnu.org/licenses/gpl-3.0.html","This application is licensed under the terms of the GNU Public License (GPL) version 3.
See https://www.gnu.org/licenses/gpl-3.0.en.html for details.","هذا التطبيق مُرخص بموجب شروط رخصة جنو (GNU) العمومية (GPL) الإصدار 3.
راجع https://www.gnu.org/licenses/gpl-3.0.ar.html لمزيد من التفاصيل.","Тази програма е лицензирана според условията на GNU Public License (GPL) версия 3.

1 Field ID Type (Type) default en-us ar-sa bg-bg zh-cn zh-tw hr-hr cs-cz da-dk nl-nl fi-fi fr-fr de-de el-gr he-il hu-hu id-id it-it ja-jp ko-kr lv-lv lt-lt ms-my nb-no fa-ir pl-pl pt-br pt-pt ro-ro ru-ru sr-latn-rs sk-sk sl-si es-es sv-se th-th tr-tr uk-ua vi-vn
2 Description 2 Text Rufus is a utility that helps format and create bootable USB flash drives, such as USB keys/pendrives, memory sticks, etc. • Official site: https://rufus.ie • Source Code: https://github.com/pbatard/rufus • ChangeLog: https://github.com/pbatard/rufus/blob/master/ChangeLog.txt برنامج Rufus هو أداة تساعد في تنسيق وإنشاء أقراص الإقلاع USB، مثل مفاتيح USB، بطاقات الذاكرة، وغيرها. • الموقع الرسمي: https://rufus.ie • كود المصدر: https://github.com/pbatard/rufus • سجل التغييرات: https://github.com/pbatard/rufus/blob/master/ChangeLog.txt Rufus е програма, с която можете лесно да форматирате и създавате стартиращи USB устройства, карти с памет и др. • Официален сайт: https://rufus.ie • Изходен код: https://github.com/pbatard/rufus • Лог на промените: https://github.com/pbatard/rufus/blob/master/ChangeLog.txt Rufus 是一个帮助您格式化并创建可启动 USB 驱动器(如 U 盘和存储卡)的工具。 • 官方网站: https://rufus.ie • 源代码: https://github.com/pbatard/rufus • 更新日志: https://github.com/pbatard/rufus/blob/master/ChangeLog.txt Rufus 是個能格式化並製作可開機 USB 快閃磁碟 (如 USB 隨身碟等) 的工具。 • 官方網站: https://rufus.ie • 原始碼: https://github.com/pbatard/rufus • 更新日誌: https://github.com/pbatard/rufus/blob/master/ChangeLog.txt Rufus je aplikacija koja olakšava formatiranje i stvaranje USB pokretačkih jedinica. • Službena stranica: https://rufus.ie • Šifra izvora: https://github.com/pbatard/rufus • ChangeLog: https://github.com/pbatard/rufus/blob/master/ChangeLog.txt Rufus je nástroj, který pomáhá formátovat a vytvářet bootovací USB flash disky, jako jsou USB klíče, paměťové karty atd. • Oficiální stránky: https://rufus.ie • Zdrojový kód: https://github.com/pbatard/rufus • Protokol změn: https://github.com/pbatard/rufus/blob/master/ChangeLog.txt Rufus er et værktøj, der hjælper med at formatere og skabe startbare USB-flashdrev, såsom USB-nøgler/USB-pinde, USB-stik, osv. • Officiel side: https://rufus.ie • Kildekode: https://github.com/pbatard/rufus • Ændrings log: https://github.com/pbatard/rufus/blob/master/ChangeLog.txt Rufus is een programma dat helpt bij het formatteren en aanmaken van opstartbare USB-flash-drives, zoals USB-sticks, geheugensticks, enz. • Officiële site: https://rufus.ie • Broncode: https://github.com/pbatard/rufus • Wijzigingslog: https://github.com/pbatard/rufus/blob/master/ChangeLog.txt Rufus on ohjelma, joka auttaa alustamaan ja luomaan boottaavia USB-laitteita, kuten esimerkiksi USB-avaimia, muistitikkuja jne. • Virallinen sivusto: https://rufus.ie • Lähdekoodi: https://github.com/pbatard/rufus • Muutosloki: https://github.com/pbatard/rufus/blob/master/ChangeLog.txt Rufus est un utilitaire permettant de formater et de créer des média USB amorçables, tels que clés USB, mémoire flash, etc. • Site officiel : https://rufus.ie • Code source: https://github.com/pbatard/rufus • ChangeLog: https://github.com/pbatard/rufus/blob/master/ChangeLog.txt Rufus ist ein Werkzeug, welches dabei hilft, bootfähige USB-Laufwerke zu erstellen, wie beispielweise USB-Keys, Speichersticks usw. • Offizielle Website: https://rufus.ie • Quellcode: https://github.com/pbatard/rufus • Änderungsprotokoll: https://github.com/pbatard/rufus/blob/master/ChangeLog.txt Το Rufus είναι ένα βοηθητικό πρόγραμμα που βοηθά στη διαμόρφωση και τη δημιουργία μονάδων flash USB με δυνατότητα εκκίνησης, όπως κλειδιά USB/pendrives,κάρτες μνήμης κ.λπ. • Επίσημος ιστότοπος: https://rufus.ie • Πηγαίος κώδικας: https://github.com/pbatard/rufus • Αρχείο καταγραφής αλλαγών: https://github.com/pbatard/rufus/blob/master/ChangeLog.txt Rufus הוא כלי המסייע באתחול ויצירת כונני הבזק מסוג USB הניתנים לאתחול, כמו דיסק און קי, כרטיסי זיכרון וכו׳. • האתר הרשמי: https://rufus.ie • קוד מקור: https://github.com/pbatard/rufus • הערות שחרור: https://github.com/pbatard/rufus/blob/master/ChangeLog.txt A Rufus egy segédprogram, amellyel bootolható USB flash meghajtókat formázhat és készíthet, például USB kulcsokat/pendrive-okat, memóriakártyákat, stb. • Hivatalos oldal: https://rufus.ie • Forráskód: https://github.com/pbatard/rufus • Változási napló: https://github.com/pbatard/rufus/blob/master/ChangeLog.txt Rufus adalah alat yang membantu untuk memformat dan membuat perangkat USB flash menjadi bootable, seperti USB flashdisk, kartu memori, dll. • Situs resmi: https://rufus.ie • Kode Sumber: https://github.com/pbatard/rufus • Catatan pergantian: https://github.com/pbatard/rufus/blob/master/ChangeLog.txt Rufus è un programma che ti aiuta a formattare e creare una unità flash USB avviabile, come una unità USB, memory stick, ecc. • Sito ufficiale: https://rufus.ie • Codice sorgente: https://github.com/pbatard/rufus • Novità: https://github.com/pbatard/rufus/blob/master/ChangeLog.txt Rufus (ルーファス) とは、起動可能なUSBフラッシュドライブ(USBメモリなど)を作成したり、フォーマットをするためのソフトウェアです。 • 公式サイト: https://rufus.ie • ソースコード: https://github.com/pbatard/rufus • 変更履歴: https://github.com/pbatard/rufus/blob/master/ChangeLog.txt Rufus는 USB 메모리 및 플래시 드라이브를 포맷하고 부팅할 수 있도록 만드는 도구입니다. • 공식 사이트: https://rufus.ie • 소스 코드: https://github.com/pbatard/rufus • 변경 사항: https://github.com/pbatard/rufus/blob/master/ChangeLog.txt Rufus ir instruments ar kura palīdzību var formatēt un izveidot USB ielādes ierīces uz tādiem nesējiem, kā USB pieslēguma zibatmiņas, atmiņas kartes u.c. • Oficiālā mājas lapa: https://rufus.ie • Sākotnējais kods: https://github.com/pbatard/rufus • Izmaiņas: https://github.com/pbatard/rufus/blob/master/ChangeLog.txt Rufus programa leidžia suženklinti ir sukurti sistemų paleidimo laikmenas, kaip pvz. USB atmintukus, atminties korteles ir pan. • Oficiali svetainė: https://rufus.ie • Šaltinio kodas: https://github.com/pbatard/rufus • Pakeitimų žurnalas: https://github.com/pbatard/rufus/blob/master/ChangeLog.txt Rufus adalah utiliti yang membantu memformat dan mencipta pemacu kilat USB boot, seperti pemacu pen/kekunci USB, kayu memori, dan lain-lain. • Laman rasmi: https://rufus.ie • Kod Sumber: https://github.com/pbatard/rufus • ChangeLog: https://github.com/pbatard/rufus/blob/master/ChangeLog.txt Rufus er et verktøy som hjelper til med å formatere og lage oppstartbare USB-stasjoner, for eksempel USB-minnepinner, USB-harddisker, og lignende. • Offisiell webside: https://rufus.ie • Kildekode: https://github.com/pbatard/rufus • Endringslogg: https://github.com/pbatard/rufus/blob/master/ChangeLog.txt Rufus ابزاری است که به فرمت و ایجاد درایوهای فلش USB قابل بوت، مانند کلیدهای USB/pendrives، مموری استیک ها و غیره به شما کمک می کند. • سایت رسمی: https://rufus.ie • منبع کد: https://github.com/pbatard/rufus • لیست تغییرات https://github.com/pbatard/rufus/blob/master/ChangeLog.txt Rufus to narzędzie, które pomaga formatować i tworzyć dyski rozruchowe flash USB, takie jak klucze USB, pendrive-y itp. • Oficjalna strona: https://rufus.ie • Kod źródłowy: https://github.com/pbatard/rufus • Zmiany: https://github.com/pbatard/rufus/blob/master/ChangeLog.txt Rufus é um utilitário que ajuda a formatar e a criar unidades flash USB inicializáveis, tais como pendrives USB, cartões de memória, etc. • Site oficial: https://rufus.ie • Código fonte: https://github.com/pbatard/rufus • Registro de alterações: https://github.com/pbatard/rufus/blob/master/ChangeLog.txt Rufus é um utilitário que ajuda a formatar e a criar unidades USB inicializáveis, tais como dispositivos USB/pendrives, cartões de memória, etc. • Site oficial: https://rufus.ie • Código fonte: https://github.com/pbatard/rufus • Alterações: https://github.com/pbatard/rufus/blob/master/ChangeLog.txt Rufus este un utilitar care ajută la formatarea și crearea de drive-uri USB bootabile, precum cheile sau pendriverele USB, unități de memorie, etc. • Site official: https://rufus.ie • Codul Sursei: https://github.com/pbatard/rufus • Listă de schimbări: https://github.com/pbatard/rufus/blob/master/ChangeLog.txt Rufus - это утилита для форматирования и создания загрузочных флеш-накопителей USB. • Официальный сайт: https://rufus.ie • Исходный код: https://github.com/pbatard/rufus • Изменения: https://github.com/pbatard/rufus/blob/master/ChangeLog.txt Rufus je uslužni program koji pomaže u formatiranju i kreiranju USB fleš diskova koji se mogu pokretati, kao što su USB ključevi, memorijski štapići itd. • Zvaničan sajt: https://rufus.ie • Izvorni kod: https://github.com/pbatard/rufus • Evidencija promena: https://github.com/pbatard/rufus/blob/master/ChangeLog.txt Rufus je utilita, ktorá vám pomôže naformátovať a vytvoriť bootovacie jednotky USB Flash, ako sú napr. USB kľúče, pamäťové karty, atď. • Oficiálna stránka: https://rufus.ie • Zdrojový kód: https://github.com/pbatard/rufus • Zoznam zmien: https://github.com/pbatard/rufus/blob/master/ChangeLog.txt Rufus je program za formatiranje in ustvarjanje zagonskih naprav USB. • Uradna stran: https://rufus.ie • Šifra vira: https://github.com/pbatard/rufus • Spremenitve: https://github.com/pbatard/rufus/blob/master/ChangeLog.txt Rufus es una utilidad que le ayuda a formatear y crear dispositivos flash booteables, como «pendrives», tarjetas de memoria, etcétera. • Sitio oficial https://rufus.ie • Código fuente https://github.com/pbatard/rufus • Registro de cambios https://github.com/pbatard/rufus/blob/master/ChangeLog.txt Rufus är ett program som hjälper dig formatera och skapa startbara USB-diskar, så som USB-minnen, minneskort, etc. • Officiell webbplats: https://rufus.ie • Källkod: https://github.com/pbatard/rufus • Ändringslogg: https://github.com/pbatard/rufus/blob/master/ChangeLog.txt Rufus คือ โปรแกรมที่ช่วยฟอร์แมต และสร้างไดรฟ์บูต USB จาก USB keys, pendrives, memory sticks เป็นต้น • เว็บไซต์ทางการ: https://rufus.ie • ซอร์สโค้ด: https://github.com/pbatard/rufus • บันทึกการเปลี่ยนแปลง: https://github.com/pbatard/rufus/blob/master/ChangeLog.txt Rufus, USB anahtar/bellekler, hafıza kartları vb. USB sürücüleri, biçimlendirmeye ve önyüklemeli hale getirmeye yardımcı olan bir araçtır. • Resmi site: https://rufus.ie • Kaynak Kodu: https://github.com/pbatard/rufus • Sürüm Notları https://github.com/pbatard/rufus/blob/master/ChangeLog.txt Rufus це утиліта, яка допомагає форматувати та створювати завантажувальні флешки, картки пам'яті, тощо. • Офіційний сайт: https://rufus.ie • Сирцевий код: https://github.com/pbatard/rufus • Список змін: https://github.com/pbatard/rufus/blob/master/ChangeLog.txt Rufus là một tiện ích giúp định dạng và tạo khả năng khởi động cho USB, chẳng hạn như thẻ USB/đĩa di động, thẻ nhớ, vv. • Trang web chính thức: https://rufus.ie • Mã nguồn: https://github.com/pbatard/rufus • Nhật ký thay đổi: https://github.com/pbatard/rufus/blob/master/ChangeLog.txt
3 ReleaseNotes 3 Text • Add a new setup.exe wrapper to bypass Windows 11 24H2 in-place upgrade restrictions • Add TimeZone to regional options replication • Set local account passwords to not expire by default • Fix an error when trying to write compressed VHD images • Fix an error when invoking Rufus from the PowerShell commandline • Improve revoked UEFI bootloaders check to support Linux SBAT, Windows SVN and cert DBX • Improve support for ReactOS boot media • Add a mechanism to detect and download updated DBXs from the official UEFI repository • Add ztsd compression support for disk images • Add a new exclusion feature in the settings, to ignore disks with a specific GPT GUID • Improve detection for compressed VHD images that are too large to fit the target drive • Fix commandline hogger not being deleted when running Rufus from a different directory • Fix FAT filenames from embedded images being potentially truncated on image extraction • Fix a side-loading vulnerability [CVE-2025-26624] with cfgmgr32.dll (with thanks to @EmperialX) • Fix UI memory leaks (courtesy of @ozone10) • Fall back to user/system default locale when getting error description (courtesy of @Wack0) • Don't run the commandline hogger on POSIX shells • Drop ARM 32-bit builds (Note that ARM 64-bit builds are *NOT* affected by this) • Update FreeDOS and Grub4DOS to latest
4 Title 4 Text Rufus
114 Feature9 708 Text Create VHD/DD images of the selected drive إنشاء صور VHD / DD لمحرك الأقراص المحدد Създаване на VHD/DD образи на избраното устройство 为选择的驱动器创建 VHD/DD 镜像 為選取的磁碟機建立 VHD/DD 映像檔 Stvaranje VHD/DD slika odabranog pogona Vytvoření obrazů VHD/DD z vybrané jednotky Lav VHD/DD billeder af det valgte drev VHD/DD-images van de geselecteerde schijf aanmaken Luo VHD/DD-kuvia valitusta asemasta Créez des images VHD/DD du périphérique sélectionné VHD/DD-Images des ausgewählten Laufwerks erstellen Δημιουργήστε εικόνες VHD/DD της επιλεγμένης μονάδας δίσκου יצירת קובצי תמונה מסוג VHD/DD של הכונן שנבחר VHD/DD képfájl készítése a kiválasztott meghajtóról Buat image VHD/DD dari penyimpanan yang dipilih Crea immagini VHD/DD dell'unità selezionata 選択されたドライブのVHD/DDイメージを作成します。 선택한 드라이브의 VHD/DD 이미지 만들기 Izveido izvēlētā diska VHD/DD virtuālos attēlus Sukurkite pasirinkto disko VHD / DD vaizdus Buat imej VHD/DD bagi pemacu yang dipilih Lag VHD/DD speilinger av valgt disk تصاویر VHD/DD از درایو انتخاب شده ایجاد کنید Stwórz obraz VHD/DD z wybranego dysku Criar imagens VHD/DD do dispositivo selecionado Criar imagens VHD/DD do dispositivo selecionado Crează imagini VHD/DD de pe drive-ul selectat Создание образов VHD/DD выбранного диска Kreiranje VHD/DD slika izabrane disk jedinice Vytvorte obrazy VHD/DD z vybratej jednotky Ustvarjanje VHD/DD slik izbranega pogona Cree imágenes VHD/DD de la unidad seleccionada Skapa VHD/DD-avbilder av den valda enheten สร้างอิมเมจไฟล์แบบ VHD/DD จากไดรฟ์ที่เลือก Seçilen sürücünün VHD/DD yansılarını oluşturun Створення образів VHD/DD з вибраних дисків Tạo tệp VHD/DD từ ổ đĩa đã chọn
115 Feature10 709 Text Compute MD5, SHA-1, SHA-256 and SHA-512 checksums of the selected image حساب المجاميع الإختبارية MD5 و SHA-1 و SHA-256 و SHA-512 للصورة المحددة Изчисляване на MD5, SHA-1, SHA-256 и SHA-512 чексуми на избраният образ 计算被选择镜像的 MD5、SHA-1、SHA-256 和 SHA-512 校验码 計算被選取映像的 MD5、SHA-1、SHA-256 和 SHA-512 檢查碼 Izračunajte kontrolne zbrojeve odabrane slike MD5, SHA-1, SHA-256 i SHA-512 Výpočet kontrolních součtů MD5, SHA-1, SHA-256 a SHA-512 vybraného obrazu Beregn MD5, SHA-1, SHA-256 og SHA-512 checksums af det valgte billede MD5, SHA-1, SHA-256 en SHA-512 controlesommen berekenen van de geselecteerde image Laske MD5, SHA-1, SHA-256 ja SHA-512 tarkistussummia valitusta levykuvasta Calculez les sommes de contrôle MD5, SHA-1, SHA-256 et SHA-512 de l'image sélectionnée Berechnung von MD5-, SHA-1-, SHA-256- und SHA-512-Prüfsummen für das ausgewählte Bild Υπολογίστε τα αθροίσματα ελέγχου MD5, SHA-1, SHA-256 και SHA-512 της επιλεγμένης εικόνας חישוב סיכומי ביקורת מסוג MD5,‏ SHA-1,‏ SHA-256 ו־SHA-512 של קובץ התמונה שנבחרה A kiválasztott képfájl MD5, SHA-1, SHA-256 és SHA-512 ellenőrző összegének kiszámítása Hitung checksum MD5, SHA-1, SHA-256 dan SHA-512 dari image yang dipilih Calcola i checksum MD5, SHA-1, SHA-256 e SHA-512 dell'immagine selezionata 選択されたイメージのMD5、SHA-1、SHA-256及びSHA-512チェックサムを計算します。 선택한 이미지의 MD5, SHA-1, SHA-256 및 SHA-512 체크섬 계산 Izskaitļo izvēlētā virtuālā attēla MD5, SHA-1, SHA-256 un SHA-512 kontrolsummas Apskaičiuokite pasirinkto vaizdo MD5, SHA-1, SHA-256 ir SHA-512 kontrolines sumas Kira MD5, SHA-1, SHA-256 dan SHA-512 checksum imej yang dipilih Kalkuler MD5, SHA-1, SHA-256 og SHA-512 sjekksummer fra valgt speiling MD5، SHA-1، SHA-256 و SHA-512 را برای تصویر انتخابی محاسبه کنید Oblicz sumy kontrolne MD5, SHA-1, SHA-256 i SHA-512 dla wybranego obrazu Calcular somas de verificação MD5, SHA-1, SHA-256 e SHA-512 da imagem selecionada Calcular checksums MD5, SHA-1, SHA-256 e SHA-512 da imagem selecionada Compută MD5, SHA-1, SHA-256 și SHA-512 suma de control ale imaginilor selectate Вычисление контрольных сумм MD5, SHA-1, SHA-256 и SHA-512 выбранного образа Izračunajte MD5, SHA-1, SHA-256 i SHA-512 kontrolne preglede izabrane slike Vypočítajte kontrolné súčty vybratého obrazu (MD5, SHA-1, SHA-256 a SHA-512) Račun MD5, SHA-1, SHA-256 in SHA-512 kontrolni vsoti izbrane slike Calcule las sumas de comprobación MD5, SHA-1, SHA-256 y SHA-512 de la imagen seleccionada Beräkna kontrollsummor MD5, SHA-1, SHA-256 och SHA-512 för den valda avbilden คำนวณรหัส MD5, SHA-1, SHA-256, SHA-512 ของไฟล์อิมเมจที่เลือก Seçilen yansının MD5, SHA-1, SHA-256 ve SHA-512 sağlama toplamlarını hesaplayın Обчислення контрольних сум MD5, SHA-1, SHA-256 та SHA-512 для вибраних образів Tính tổng kiểm MD5, SHA-1, SHA-256 và SHA-512 của tệp đã chọn
116 Feature11 710 Text Perform bad blocks checks, including detection of "fake" flash drives إجراء فحوصات كتل تالفة ، بما في ذلك الكشف عن محركات أقراص فلاش "زائفة\ Проверяване за лоши блокове, включително засичане на "фалшиви" устройства 执行坏块检查,包括对”假“U盘的检测 執行壞軌檢查,包括對”假“USB 快閃磁碟 的偵測 Izvršite provjere loših blokova, uključujući otkrivanje "lažnih" flash pogona Provést kontrolu vadných bloků, včetně detekce "falešných" bloků. flash disky Udøv dårlige blokke tjeks, inklusiv opdagelse af "falske" flashdrev Controles uitvoeren op slechte blokken, inclusief detectie van "valse" flashdrives Suorita viallisten lohkojen tarkistuksia, sisältäen "valheellisten" muistitikkujen tunnistamisen Executez un test de mauvais secteurs avec detection des "fake drives\ Durchführung von Prüfungen auf fehlerhafte Blöcke, einschließlich der Erkennung von "gefälschten" Flash-Laufwerken Εκτελέστε ελέγχους εσφαλμένων block, συμπεριλαμβανομένου του εντοπισμού "ψευδών" μονάδων flash ביצוע בדיקות אחר בלוקים (אזורים) פגומים, כולל זיהוי של כונני הבזק "מזוייפים\ Hibás blokkok ellenőrzése, beleértve a "hamis" flash meghajtók detektálását Lakukan cek Blok yang buruk, termasuk deteksi USB Flash Disk "PALSU\ Esegui controlli dei blocchi danneggiati, incluso il rilevamento di unità flash "false\ 不良ブロックチェック及び容量詐欺ドライブの検知を行います。 "위조" 플래시 드라이브 감지를 포함하여 불량 블록 검사 수행 Izpilda bojāto bloku pārbaudi ieskaitot "falsificēto" nesēju noteikšanu Atlikite blogų blokų patikrinimus, įskaitant "netikrų" flash diskų aptikimą Melakukan pemeriksaan blok buruk, termasuk pengesanan pemacu kilat "palsu\ Utfør sjekk for dårlige sektorer, inkludert sjekk for forfalskede flash disker بررسی بلوک های بد، از جمله تشخیص درایوهای فلش "جعلی" را انجام دهید Sprawdź dysk pod względem spójności danych lub wykryj "nieoryginalny" pendrive Executar verificações de blocos defeituosos, incluindo detecção de unidades flash "falsificadas\ Executar verificações de blocos inválidos, incluindo a deteção de unidades flash "falsas\ Verifică blocuri rele, incluzând detectarea de drive-uri flash "false\ Проверка на плохие блоки, обнаружение "поддельных" флешек Izvršite provere loših blokova, uključujući otkrivanje "lažnih" fleš diskova Vykonajte kontroly zlých blokov vrátane detekcie „falošných" prenosných diskov Izvajanje preverjanj slabih blokov, vključno z odkrivanjem »lažnih« bliskavic Realice comprobaciones de bloques defectuosos, incluida la detección de unidades flash "falsas\ Utför kontroll av trasiga block, inklusive upptäckt av "falska" USB-minnen ตรวจสอบจุดบกพร่อง รวมไปถึงการทดสอบแฟลชไดรฟ์ว่าเป็น "ของปลอม" หรือไม่ "Sahte" flash sürücülerin tespiti de dahil olmak üzere hatalı blok kontrolleri gerçekleştirin Перевірка дисків (включаючи фальшиві диски) Thực hiện kiểm tra điểm lỗi, bao gồm phát hiện ổ đĩa "giả\
117 Feature12 711 Text Download official Microsoft Windows retail ISOs قم بتنزيل ملفات ISO الرسمية الخاصة بـ Microsoft Windows Изтегляне на официални Microsoft Windows ISO образи 下载微软官方 Windows 镜像 下載微軟官方 Windows 映像檔 Preuzimanje službenih ISO-ova za maloprodaju sustava Microsoft Windows Stažení oficiálních souborů ISO systému Microsoft Windows Hent officielle Microsoft Windows detail ISOer Officiële Microsoft Windows retail ISO's downloaden Lataa virallisia Microsoft Windowsin jälleenmyyntiversion ISO-levykuvia Téléchargez des images ISOs commerciales officielles de Microsoft Windows Offizielle Microsoft Windows-ISOs herunterladen Κατεβάστε τα επίσημα retail ISO των Microsoft Windows הורדת קובצי ה־ISO הקמעונאיים הרשמיים של Microsoft Windows Hivatalos Microsoft Windows kiskereskedelmi ISO képfájlok letöltése Unduh ISO Microsoft Windows resmi Scarica le ISO ufficiali di Microsoft Windows マイクロソフト公式のWindows ISOをダウンロードします。 공식 Microsoft Windows 리테일 ISO 다운로드 Lejupielādē oficiālos Microsoft ISO failus Atsisiųskite oficialius Microsoft Windows mažmeninės prekybos ISO Muat turun rasmi ISO runcit Microsoft Windows Last ned offisielle Windows ISOer ISO های رسمی ماکروسافت را دریافت کنید Pobierz oficjalny obraz ISO systemu Microsoft Windows Baixar ISOs oficiais do Microsoft Windows Transferir ISOs oficiais do Microsoft Windows Retail Descarcă un Microsoft Windows ISO oficial de vânzare Загрузка официальных ISO-образов Windows Preuzmite zvanične Microsoft Windows maloprodajne ISO-ove Stiahnite si oficiálne ISO pre Microsoft Windows Prenos uradnih Microsoft Windows maloprodaja ISOs Descargue los ISO oficiales de Microsoft Windows Ladda ner officiella Microsoft Windows ISO-filer ดาวน์โหลดไฟล์ ISO ของ Microsoft Windows จากเว็บไซต์ทางการของ Microsoft Resmi Microsoft Windows Retail ISO'larını indirin Завантаження офіційних образів Microsoft Windows Tải xuống các tệp Microsoft Windows ISO bán lẻ chính thức
118 Feature13 712 Text Download UEFI Shell ISOs قم بتنزيل UEFI Shell ISOs Изтегляне на UEFI Shell образи 下载 UEFI Shell 镜像 下載 UEFI Shell 映像檔 Preuzmite ISO-ove UEFI ljuske Stažení souborů UEFI Shell ISO Hent UEFI Shell ISOer UEFI Shell ISO's downloaden Lataa UEFI Shell ISO-levykuvia Téléchargez des images ISOs du Shell UEFI UEFI-Shell-ISOs herunterladen Κατεβάστε τα ISO Shell UEFI הורדת קובצי ISO של מעטפת UEFI UEFI Shell ISO képfájlok letöltése Unduh Shell ISO UEFI Scarica le ISO della shell UEFI UEFIシェルのISOをダウンロードします。 UEFI Shell ISO 다운로드 Lejupielādē UEFI OS ISO failus Atsisiųskite UEFI Shell ISO Muat turun ISO Shell UEFI Last ned UEFI kommandolinje ISOer ISO های پوسته UEFI را دانلود کنید Ściągnij obrazy ISO UEFI Shell Baixar ISOs do Shell UEFI Transferir ISOs de UEFI Shell Descarcă UEFI Shell ISO-uri Загрузка ISO-образов оболочки UEFI Preuzmite UEFI Shell ISOs Stiahnite UEFI Shell ISO Prenos UEFI Shell ISOs Descargar ISO de UEFI Shell Ladda ner UEFI-skal ISO-filer ดาวน์โหลดไฟล์ ISO ของ UEFI Shell UEFI Shell ISO'larını indirin Завантаження командної оболонки UEFI ISO Tải xuống các tệp UEFI Shell ISO
119 Feature14 713 Text
120 Feature15 714 Text
121 Feature16 715 Text
122 Feature17 716 Text
123 Feature18 717 Text
124 Feature19 718 Text
125 Feature20 719 Text
126 MinimumHardwareReq1 800 Text
127 MinimumHardwareReq2 801 Text
128 MinimumHardwareReq3 802 Text
129 Feature20 MinimumHardwareReq4 719 803 Text
130 MinimumHardwareReq1 MinimumHardwareReq5 800 804 Text
131 MinimumHardwareReq2 MinimumHardwareReq6 801 805 Text
132 MinimumHardwareReq3 MinimumHardwareReq7 802 806 Text
133 MinimumHardwareReq4 MinimumHardwareReq8 803 807 Text
134 MinimumHardwareReq5 MinimumHardwareReq9 804 808 Text
135 MinimumHardwareReq6 MinimumHardwareReq10 805 809 Text
136 MinimumHardwareReq7 MinimumHardwareReq11 806 810 Text
137 MinimumHardwareReq8 RecommendedHardwareReq1 807 850 Text
138 MinimumHardwareReq9 RecommendedHardwareReq2 808 851 Text

View file

@ -29,7 +29,7 @@ set WDK_PATH=C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x64
set ZIP_PATH=C:\Program Files\7-Zip
set SIGNATURE_SHA1=fc4686753937a93fdcd48c2bb4375e239af92dcb
set MANIFEST=AppxManifest.xml
set ARCHS=x86 x64 arm arm64
set ARCHS=x86 x64 arm64
set DEFAULT_SCALE=200
set OTHER_SCALES=100 125 150 400
set SCALED_IMAGES=LargeTile SmallTile Square44x44Logo Square150x150Logo StoreLogo Wide310x150Logo
@ -69,25 +69,25 @@ for %%a in (%ARCHS%) do (
)
)
rem exiftool.exe can't be installed in the Windows system directories...
if not exist exiftool.exe (
echo exiftool.exe must exist in this directory
rem Use our own get_pe_info executable - source is in this directory
if not exist ..\get_pe_info.exe (
echo ..\get_pe_info.exe must exist in the parent directory. Compile it with MinGW.
goto out
)
rem Make sure we're not trying to create a package from an ALPHA or BETA version!
exiftool -s3 -*InternalName* rufus_x64.exe | findstr /C:"ALPHA" 1>nul && (
..\get_pe_info.exe -i rufus_x64.exe | findstr /C:"ALPHA" 1>nul && (
echo Alpha version detected - ABORTED
goto out
)
exiftool -s3 -*InternalName* rufus_x64.exe | findstr /C:"BETA" 1>nul && (
..\get_pe_info.exe -i rufus_x64.exe | findstr /C:"BETA" 1>nul && (
echo Beta version detected - ABORTED
goto out
)
rem Populate the version from the executable
if "%VERSION_OVERRIDE%"=="" (
exiftool -s3 -*FileVersionNumber* rufus_x64.exe > version.txt
..\get_pe_info.exe -v rufus_x64.exe > version.txt
set /p VERSION=<version.txt
del version.txt
) else (

BIN
res/dbx/amd64_DBXUpdate.bin Normal file

Binary file not shown.

BIN
res/dbx/arm64_DBXUpdate.bin Normal file

Binary file not shown.

BIN
res/dbx/arm_DBXUpdate.bin Normal file

Binary file not shown.

17
res/dbx/dbx_info.h Normal file
View file

@ -0,0 +1,17 @@
// Autogenerated - DO NOT EDIT
#include <stdint.h>
#pragma once
struct {
char* url;
uint64_t timestamp;
} dbx_info[] = {
{ "https://api.github.com/repos/microsoft/secureboot_objects/contents/PostSignedObjects/DBX/x86/DBXUpdate.bin", 1740428422 },
{ "https://api.github.com/repos/microsoft/secureboot_objects/contents/PostSignedObjects/DBX/amd64/DBXUpdate.bin", 1740428422 },
{ "https://api.github.com/repos/microsoft/secureboot_objects/contents/PostSignedObjects/DBX/arm/DBXUpdate.bin", 1740428422 },
{ "https://api.github.com/repos/microsoft/secureboot_objects/contents/PostSignedObjects/DBX/arm64/DBXUpdate.bin", 1740428422 },
{ "https://api.github.com/repos/microsoft/secureboot_objects/contents/PostSignedObjects/DBX/ia64/DBXUpdate.bin", 0 },
{ "https://api.github.com/repos/microsoft/secureboot_objects/contents/PostSignedObjects/DBX/riscv64/DBXUpdate.bin", 0 },
{ "https://api.github.com/repos/microsoft/secureboot_objects/contents/PostSignedObjects/DBX/loongarch64/DBXUpdate.bin", 0 },
};

50
res/dbx/dbx_update.sh Executable file
View file

@ -0,0 +1,50 @@
#!/bin/env bash
# This script downloads the latest UEFI DBXs and creates the dbx_info.h header
github_url="https://api.github.com/"
# Retrieve the commit epoch from a GitHub URL or 0 if not available
get_commit_date() {
url=$1
if [[ "${url}" =~ ^"${github_url}" ]]; then
parts=($(awk -F'contents/' '{ for(i=1;i<=NF;i++) print $i }' <<< ${url}))
date_url="${parts[0]}commits?path=${parts[1]//\//%2F}&page=1&per_page=1"
epoch="$(curl -s -L ${date_url} | grep -m1 \"date\": | sed -e 's/^.*\"date\":.*\"\(.*\)\".*/\1/' | date -f - +%s)"
fi
echo ${epoch:-0}
}
# Should be in the same order as the ArchType enum in Rufus with the first entry (ARCH_UNKNOWN = 0) skipped
# Note that are GUESSING the RISC-V 64 and LoongArch 64 URLS since there are no DBX revocations for those archs yet.
# Also use api.github.com (which is rate limited) so we don't get the stupid 404 GitHub page on error, which is 10
# times larger than our largest DBX update binary...
declare -a dbx_urls=(
'https://api.github.com/repos/microsoft/secureboot_objects/contents/PostSignedObjects/DBX/x86/DBXUpdate.bin'
'https://api.github.com/repos/microsoft/secureboot_objects/contents/PostSignedObjects/DBX/amd64/DBXUpdate.bin'
'https://api.github.com/repos/microsoft/secureboot_objects/contents/PostSignedObjects/DBX/arm/DBXUpdate.bin'
'https://api.github.com/repos/microsoft/secureboot_objects/contents/PostSignedObjects/DBX/arm64/DBXUpdate.bin'
'https://api.github.com/repos/microsoft/secureboot_objects/contents/PostSignedObjects/DBX/ia64/DBXUpdate.bin'
'https://api.github.com/repos/microsoft/secureboot_objects/contents/PostSignedObjects/DBX/riscv64/DBXUpdate.bin'
'https://api.github.com/repos/microsoft/secureboot_objects/contents/PostSignedObjects/DBX/loongarch64/DBXUpdate.bin'
)
cat << EOF > dbx_info.h
// Autogenerated - DO NOT EDIT
#include <stdint.h>
#pragma once
struct {
char* url;
uint64_t timestamp;
} dbx_info[] = {
EOF
for url in "${dbx_urls[@]}"; do
if [[ ! -z "${url}" ]]; then
dst=$(echo ${url} | cut -f10,11 -d'/' | tr '/' '_')
curl -L -H "Accept: application/vnd.github.v3.raw" "${url}" -o "${dst}"
fgrep -q "Not Found" "${dst}" && :> "${dst}"
fi
echo " { \"${url}\", $(get_commit_date ${url}) }," >> dbx_info.h
done
echo "};" >> dbx_info.h

View file

View file

4
res/dbx/readme.txt Normal file
View file

@ -0,0 +1,4 @@
This directory contains the official UEFI revocation databases, as provided by
https://github.com/microsoft/secureboot_objects/tree/main/PostSignedObjects.
These are used by Rufus to warn the user if a UEFI bootloader has been revoked.

View file

BIN
res/dbx/x86_DBXUpdate.bin Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,5 +1,5 @@
All of the executables found in this repository where extracted from:
https://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.3/official/FD13-FullUSB.zip
All of the executables found in this repository where extracted from FreeDOS v1.4:
https://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.4/FD14-FullUSB.zip
o COMMAND.COM was extracted from packages\base\freecom.zip
o DISPLAY.EXE was extracted from packages\base\display.zip

Binary file not shown.

View file

@ -1,6 +1,6 @@
This directory contains the Grub4DOS boot records that are used by Rufus
* grldr.mbr was taken from the official 2023-03-06 release from
* grldr.mbr was taken from the official 2024-02-26 release from
https://github.com/chenall/grub4dos/releases/tag/0.4.6a
* Note that, for convenience reasons, the first 512 bytes from this grldr.mbr are

View file

@ -8,8 +8,11 @@ Or simply download https://files.akeo.ie/pollock/pollock-1.5.exe and follow its
o v4.? (????.??.??) ** NOT FINAL!!! PLEASE DO NOT SEND UNSOLICITED TRANSLATIONS! **
- *NEW* MSG_350 "Use 'Windows UEFI CA 2023' signed bootloaders [EXPERIMENTAL]"
- *NEW* MSG_351 "Checking for UEFI bootloader revocation..."
- *NEW* MSG_352 "Checking for UEFI DBX updates..."
- *NEW* MSG_353 "DBX update available"
- *NEW* MSG_354 "Rufus has found an updated version of the DBX files used to perform UEFI Secure Boot revocation checks..."
o v4.5 (2024.05.??)
o v4.5 (2024.05.22)
- *UPDATED* IDC_RUFUS_MBR -> IDC_UEFI_MEDIA_VALIDATION "Enable runtime UEFI media validation"
- *UPDATED* MSG_167 "Install a UEFI bootloader, that will perform MD5Sum file validation of the media"
- *NEW* MSG_337 "An additional file ('diskcopy.dll') must be downloaded from Microsoft to install MS-DOS (...)"

View file

@ -1,5 +1,5 @@
@echo off
if not exist pollock.exe curl https://files.akeo.ie/pollock/pollock-1.5.exe --output pollock.exe
if not exist pollock.exe curl https://files.akeo.ie/pollock/pollock-1.6.exe --output pollock.exe
cls
:menu
echo 1 - Import .po into .loc

View file

@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: 4.5\n"
"Report-Msgid-Bugs-To: pete@akeo.ie\n"
"POT-Creation-Date: 2024-04-29 19:24+0300\n"
"PO-Revision-Date: 2024-04-29 20:25+0330\n"
"PO-Revision-Date: 2025-02-13 12:00+0000\n"
"Last-Translator: MasterVito <mv@mvaop.ir>\n"
"Language-Team: \n"
"Language: fa_IR\n"
@ -13,7 +13,7 @@ msgstr ""
"X-Poedit-SourceCharset: UTF-8\n"
"X-Rufus-LanguageName: Persian (پارسی)\n"
"X-Rufus-LCID: 0x0429\n"
"X-Generator: Poedit 3.4.2\n"
"X-Generator: Poedit 3.5\n"
#. • IDD_DIALOG → IDS_DRIVE_PROPERTIES_TXT
msgid "Drive Properties"
@ -1094,7 +1094,7 @@ msgstr "نسخه %d.%d (Build %d)"
#. • MSG_176
msgid "English translation: Pete Batard <mailto:pete@akeo.ie>"
msgstr "ترجمه فارسی:\\lineسید عرفان <mailto:aa3245540@gmail.com>\\line •ضیاءالدین عظیمی <mailto:s.zia.azimi@gmail.com>"
msgstr "ترجمه فارسی:\\lineمستر ویتو <mailto:mv@mvaop.ir>\\line •ضیاءالدین عظیمی <mailto:s.zia.azimi@gmail.com>"
#. • MSG_177
msgid "Report bugs or request enhancements at:"

View file

@ -1,9 +1,9 @@
msgid ""
msgstr ""
"Project-Id-Version: 3.22\n"
"Project-Id-Version: 4.5\n"
"Report-Msgid-Bugs-To: pete@akeo.ie\n"
"POT-Creation-Date: 2024-04-25 12:25+0100\n"
"PO-Revision-Date: 2024-04-25 12:46+0100\n"
"POT-Creation-Date: 2025-04-02 11:34+0100\n"
"PO-Revision-Date: 2025-04-02 11:51+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fr_FR\n"
@ -13,7 +13,7 @@ msgstr ""
"X-Poedit-SourceCharset: UTF-8\n"
"X-Rufus-LanguageName: French (Français)\n"
"X-Rufus-LCID: 0x040c, 0x080c, 0x0c0c, 0x100c, 0x140c, 0x180c, 0x1c0c, 0x200c, 0x240c, 0x280c, 0x2c0c, 0x300c, 0x340c, 0x380c, 0xe40c\n"
"X-Generator: Poedit 3.4.2\n"
"X-Generator: Poedit 3.6\n"
#. • IDD_DIALOG → IDS_DRIVE_PROPERTIES_TXT
msgid "Drive Properties"
@ -161,7 +161,7 @@ msgstr "Recherche mises à jour"
#. • IDD_UPDATE_POLICY → IDS_INCLUDE_BETAS_TXT
msgid "Include beta versions"
msgstr "Inclure les bétas"
msgstr "Inclure les versions bêta"
#. • IDD_UPDATE_POLICY → IDC_CHECK_NOW
msgid "Check Now"
@ -460,7 +460,7 @@ msgstr "Veuillez insérer un média dans le lecteur."
#. • MSG_062
msgid "An unsupported command was received."
msgstr "Commande non supportée."
msgstr "Une commande non prise en charge a été reçue."
#. • MSG_063
msgid "Memory allocation error."
@ -484,7 +484,7 @@ msgstr "Impossible d'accéder au média. Il peut être en cours d'utilisation pa
#. • MSG_068
msgid "Could not partition drive."
msgstr "Echec de partitionnement."
msgstr "Échec de partitionnement."
#. • MSG_069
msgid "Could not copy files to target drive."
@ -506,23 +506,23 @@ msgstr "La vérification de blocs défectueux a été interrompue."
#. • MSG_073
msgid "ISO image scan failure."
msgstr "Echec d'analyse de l'image ISO."
msgstr "Échec d'analyse de l'image ISO."
#. • MSG_074
msgid "ISO image extraction failure."
msgstr "Echec d'extraction de l'image ISO."
msgstr "Échec d'extraction de l'image ISO."
#. • MSG_075
msgid "Unable to remount volume."
msgstr "Echec lors du remontage du volume."
msgstr "Échec lors du remontage du volume."
#. • MSG_076
msgid "Unable to patch/setup files for boot."
msgstr "Echec de modification des fichiers de démarrage."
msgstr "Échec de modification des fichiers de démarrage."
#. • MSG_077
msgid "Unable to assign a drive letter."
msgstr "Echec d'assignation d'une lettre de volume."
msgstr "Échec d'assignation d'une lettre de volume."
#. • MSG_078
msgid "Can't mount GUID volume."
@ -548,7 +548,7 @@ msgstr ""
#. • MSG_081
msgid "Unsupported image"
msgstr "Image non supportée"
msgstr "Image non prise en charge"
#. • MSG_082
msgid "This image is either non-bootable, or it uses a boot or compression method that is not supported by Rufus..."
@ -609,7 +609,7 @@ msgstr "L'image est trop large pour être copiée sur le périphérique sélecti
#. • MSG_090
msgid "Unsupported ISO"
msgstr "Image ISO non supportée"
msgstr "Image ISO non prise en charge"
#. • MSG_091
msgid "When using UEFI Target Type, only EFI bootable ISO images are supported. Please select an EFI bootable ISO or set the Target Type to BIOS."
@ -617,7 +617,7 @@ msgstr "Quand UEFI est sélectionné, seules les images ISO basées sur EFI sont
#. • MSG_092
msgid "Unsupported filesystem"
msgstr "Système de fichiers non supporté"
msgstr "Système de fichiers non pris en charge"
#. • MSG_093
msgid ""
@ -669,7 +669,7 @@ msgstr "Cette image ISO contient un fichier de plus de 4 Go, soit plus que la ta
#. • MSG_101
msgid "Missing WIM support"
msgstr "Support pour archives WIM non disponible"
msgstr "Prise en charge des archives WIM non disponible"
#. • MSG_102
msgid ""
@ -906,7 +906,7 @@ msgid ""
msgstr ""
"Parce que MBR a été sélectionné pour le schéma de partition, Rufus peut seulement créer une partition sur ce média occupant jusquà 2 To, ce qui laissera %s despace disque non-disponible.\n"
"\n"
"Etes-vous sûr de vouloir continuer ?"
"Êtes-vous sûr de vouloir continuer ?"
#. • MSG_135
msgid "Version"
@ -1080,7 +1080,7 @@ msgid "Version %d.%d (Build %d)"
msgstr ""
#. • MSG_176
msgid "mailto:support@akeo.ie"
msgid "English translation: Pete Batard <mailto:pete@akeo.ie>"
msgstr "Traduction Française : Pete Batard <mailto:pete@akeo.ie>"
#. • MSG_177
@ -1203,7 +1203,7 @@ msgstr "Analyse de l'image..."
#. • MSG_203
msgid "Failed to scan image"
msgstr "Echec d'analyse de l'image"
msgstr "Échec de l'analyse de l'image"
#. • MSG_204
#.
@ -1252,7 +1252,7 @@ msgstr "Opération annulée"
#. • MSG_212
msgid "Failed"
msgstr "ECHEC"
msgstr "Échec"
#. • MSG_213
#.
@ -1262,7 +1262,7 @@ msgstr "Lancement de la nouvelle application..."
#. • MSG_214
msgid "Failed to launch new application"
msgstr "Echec de lancement de l'application"
msgstr "Échec de lancement de l'application"
#. • MSG_215
#.
@ -1284,11 +1284,11 @@ msgstr "Formatage : %s"
#. • MSG_218
msgid "Creating file system: Task %d/%d completed"
msgstr "Système de fichiers : Tâche %d/%d complétée"
msgstr "Système de fichiers : Tâche %d/%d terminée"
#. • MSG_219
msgid "NTFS Fixup: %d%% completed"
msgstr "Finalisation NTFS : %d%% complété"
msgstr "Finalisation NTFS : %d%% terminé"
#. • MSG_220
#.
@ -1300,7 +1300,7 @@ msgstr "Formatage (%s) - durée estimée %d :%02d..."
#. • MSG_221
msgid "Setting label (%s)..."
msgstr "Ecriture du label (%s)..."
msgstr "Écriture du label (%s)..."
#. • MSG_222
#.
@ -1330,11 +1330,11 @@ msgstr "Fermeture des volumes existants..."
#. • MSG_228
msgid "Writing Master Boot Record..."
msgstr "Ecriture du MBR..."
msgstr "Écriture du MBR..."
#. • MSG_229
msgid "Writing Partition Boot Record..."
msgstr "Ecriture du PBR..."
msgstr "Écriture du PBR..."
#. • MSG_230
msgid "Copying DOS files..."
@ -1346,7 +1346,7 @@ msgstr "Copie des fichiers ISO : %s"
#. • MSG_232
msgid "Win7 EFI boot setup (%s)..."
msgstr "Ecriture boot Win7 EFI (%s)..."
msgstr "Écriture boot Win7 EFI (%s)..."
#. • MSG_233
msgid "Finalizing, please wait..."
@ -1392,7 +1392,7 @@ msgid ""
"\n"
"The download will be deleted. Please check the log for more details."
msgstr ""
"La signature de la mise à jour qui vient dêtre téléchargée ne peut pas être validée. Cela peut indiquer que votre système nest pas configuré correctement pour la validation de signatures digitales, ou que le téléchargement contient un fichier malicieux.\n"
"La signature de la mise à jour qui vient dêtre téléchargée ne peut pas être validée. Cela peut indiquer que votre système nest pas configuré correctement pour la validation de signatures numériques, ou que le téléchargement contient un fichier malicieux.\n"
"\n"
"Le téléchargement va être supprimé. Veuillez consulter le log pour plus de détails."
@ -1402,7 +1402,7 @@ msgstr "Téléchargement : %s"
#. • MSG_242
msgid "Failed to download file."
msgstr "Echec de téléchargement du fichier."
msgstr "Échec de téléchargement du fichier."
#. • MSG_243
msgid "Checking for Rufus updates..."
@ -1430,7 +1430,7 @@ msgstr "Clés de registre supprimées"
#. • MSG_249
msgid "Failed to delete application registry keys"
msgstr "Echec de suppression des clés registres"
msgstr "Échec de suppression des clés registres"
#. • MSG_250
#.
@ -1480,7 +1480,7 @@ msgstr "Compression NTFS"
#. • MSG_261
msgid "Writing image: %s"
msgstr "Ecriture d'image : %s"
msgstr "Écriture d'image : %s"
#. • MSG_262
#.
@ -1524,7 +1524,7 @@ msgstr "Debug USB"
#. • MSG_271
msgid "Computing image checksums: %s"
msgstr "Calculation des checksums de l'image : %s"
msgstr "Calcul des checksums de l'image : %s"
#. • MSG_272
msgid "Compute the MD5, SHA1 and SHA256 checksums for the selected image"
@ -1558,13 +1558,13 @@ msgstr ""
#.
#. '%s' will be replaced with your translation for MSG_036 ("ISO Image")
msgid "Write in %s mode (Recommended)"
msgstr "Ecrire en mode %s (Recommandé)"
msgstr "Écrire en mode %s (Recommandé)"
#. • MSG_277
#.
#. '%s' will be replaced with your translation for MSG_095 ("DD Image")
msgid "Write in %s mode"
msgstr "Ecrire en mode %s"
msgstr "Écrire en mode %s"
#. • MSG_278
msgid "Checking for conflicting processes..."
@ -1592,7 +1592,7 @@ msgstr "Signature invalide"
#. • MSG_284
msgid "The downloaded executable is missing a digital signature."
msgstr "L'exécutable téléchargé ne possède pas de signature digitale."
msgstr "L'exécutable téléchargé ne possède pas de signature numérique."
#. • MSG_285
msgid ""
@ -1610,7 +1610,7 @@ msgstr "Effacement à zéro : %s"
#. • MSG_287
msgid "Detection of non-USB removable drives"
msgstr "Détection disques non-USB détachables"
msgstr "Détection des disques détachables non-USB"
#. • MSG_288
msgid "Missing elevated privileges"
@ -1618,15 +1618,15 @@ msgstr "Privilèges élevés manquants"
#. • MSG_289
msgid "This application can only run with elevated privileges"
msgstr "Cette application peut seulement être exécutée avec privilèges administratifs"
msgstr "Cette application peut seulement être exécutée avec les privilèges administrateur"
#. • MSG_290
msgid "File Indexing"
msgstr "Indexation de fichiers"
msgstr "Indexation des fichiers"
#. • MSG_291
msgid "Version selection"
msgstr "Sélection de version"
msgstr "Sélection de la version"
#. • MSG_292
msgid "Please select the version of Windows you want to install:"
@ -1634,7 +1634,7 @@ msgstr "Sélectionnez la version de Windows que vous souhaitez installer :"
#. • MSG_293
msgid "Unsupported Windows version"
msgstr "Version de Windows non supportée"
msgstr "Version de Windows non prise en charge"
#. • MSG_294
msgid ""
@ -1656,7 +1656,7 @@ msgid ""
msgstr ""
"Cette version de Rufus n'a pas produite par ses développeurs officiels.\n"
"\n"
"Etes-vous sur de vouloir la lancer ?"
"Êtes-vous sûr de vouloir la lancer ?"
#. • MSG_297
msgid "Truncated ISO detected"
@ -1688,7 +1688,7 @@ msgid ""
msgstr ""
"Rufus n'a pas pu valider que le timestamp du fichier de mise à jour téléchargé est plus récent que celui de l'exécutable en cours.\n"
"\n"
"Afin de mitiger des scenarios d'attaque potentiels, le processus de mise à jour a été interrompu et le téléchargement va être supprimé. Pour plus de détails, veuillez consulter le log."
"Afin d'éviter des scenarios d'attaque potentiels, le processus de mise à jour a été interrompu et le téléchargement va être supprimé. Pour plus de détails, veuillez consulter le log."
#. • MSG_301
msgid "Show application settings"
@ -1744,7 +1744,7 @@ msgstr "Utilisez %s (dans la fenêtre dapplication principale) pour active."
#. • MSG_312
msgid "Extra hashes (SHA512)"
msgstr "Checksum hash supplémentaire (SHA512)"
msgstr "Checksum supplémentaire (SHA512)"
#. • MSG_313
msgid "Save to VHD"
@ -1752,7 +1752,7 @@ msgstr "Sauver en image VHD"
#. • MSG_314
msgid "Compute image checksums"
msgstr "Calculer les checksums the limage sélectionnée"
msgstr "Calculer les checksums de limage sélectionnée"
#. • MSG_315
msgid "Multiple buttons"
@ -1768,7 +1768,7 @@ msgstr "ID disque"
#. • MSG_318
msgid "Default thread priority: %d"
msgstr "Priorité de thread part default : %d"
msgstr "Priorité de thread par défaut : %d"
#. • MSG_319
msgid "Ignore Boot Marker"
@ -1776,7 +1776,7 @@ msgstr "Ignorer le marqueur de démarrage"
#. • MSG_320
msgid "Refreshing partition layout (%s)..."
msgstr "Rafraichissement du schéma de partition (%s)..."
msgstr "Rafraîchissement du schéma de partition (%s)..."
#. • MSG_321
msgid ""
@ -1784,7 +1784,7 @@ msgid ""
"As a result, DD image writing mode will be enforced."
msgstr ""
"Limage que vous avez sélectionnée est de type ISOHybrid, mais ses créateurs ne lont pas rendue compatible avec le mode ISO (i.e. copie de fichier).\n"
"A cause de cela, seule lécriture en mode DD est applicable."
"À cause de cela, seule lécriture en mode DD est applicable."
#. • MSG_322
msgid "Unable to open or read '%s'"
@ -1832,7 +1832,7 @@ msgstr "Définir les options régionales avec les mêmes valeurs que celles de c
#. • MSG_335
msgid "Disable BitLocker automatic device encryption"
msgstr "Désactiver l'encryption automatique BitLocker"
msgstr "Désactiver le cryptage automatique BitLocker"
#. • MSG_336
msgid "Persistent log"
@ -1914,6 +1914,36 @@ msgstr "Extraction d'archive : %s"
msgid "Use Rufus MBR"
msgstr "Utilisation du MBR Rufus"
#. • MSG_350
msgid "Use 'Windows UEFI CA 2023' signed bootloaders [EXPERIMENTAL]"
msgstr "Utiliser les bootloaders signés par 'Windows UEFI CA 2023' [EXPÉRIMENTAL]"
#. • MSG_351
msgid "Checking for UEFI bootloader revocation..."
msgstr "Vérification de la revocation des bootloaders UEFI..."
#. • MSG_352
msgid "Checking for UEFI DBX updates..."
msgstr "Vérification des mises à jour de DBX UEFI..."
#. • MSG_353
msgid "DBX update available"
msgstr "Mise à jour DBX disponible"
#. • MSG_354
msgid ""
"Rufus has found an updated version of the DBX files used to perform UEFI Secure Boot revocation checks. Do you want to download this update?\n"
"- Select 'Yes' to connect to the Internet and download this content\n"
"- Select 'No' to cancel the operation\n"
"\n"
"Note: The files will be downloaded in the application's directory and will be reused automatically if present."
msgstr ""
"Rufus a trouvé une mise à jour des fichiers DBX utilisés pour effectuer la validation des revocations Secure Boot sous UEFI. Voulez-vous télécharger cette mise à jour ?\n"
"- Sélectionnez 'Oui' pour vous connecter à Internet et le télécharger ce contenu\n"
"- Sélectionnez 'Non' pour annuler lopération\n"
"\n"
"Note : Ces fichiers seront téléchargés dans le répertoire de l'application et réutilisés automatiquement si ils sont présent."
#. • MSG_900
#.
#. The following messages are for the Windows Store listing only and are not used by the application

View file

@ -1875,7 +1875,7 @@ msgid ""
msgstr ""
"Rufus ha rilevato che l'ISO selezionata contiene un bootloader UEFI che è stato revocato e che quando Secure Boot è abilitato su un sistema UEFI completamente aggiornato produrrà %s. \n"
"\n"
"- Se hai ottenuto questa immagine ISO da una so0egente non affidabile, dovresti considerare la possibilità che possa contenere malware UEFI ed evitare di eseguire l'avvio da esso.\n"
"- Se hai ottenuto questa immagine ISO da una sorgente non affidabile, dovresti considerare la possibilità che possa contenere malware UEFI ed evitare di eseguire l'avvio da esso.\n"
"- Se l'hai ottenuto da una sorgente attendibile, dovresti provare a cercare una versione più aggiornata, che non genererà questo avviso."
#. • MSG_340

View file

@ -611,6 +611,12 @@ t MSG_348 "Extracting archive files: %s"
t MSG_349 "Use Rufus MBR"
t MSG_350 "Use 'Windows UEFI CA 2023' signed bootloaders [EXPERIMENTAL]"
t MSG_351 "Checking for UEFI bootloader revocation..."
t MSG_352 "Checking for UEFI DBX updates..."
t MSG_353 "DBX update available"
t MSG_354 "Rufus has found an updated version of the DBX files used to perform UEFI Secure Boot revocation checks. Do you want to download this update?\n"
"- Select 'Yes' to connect to the Internet and download this content\n"
"- Select 'No' to cancel the operation\n\n"
"Note: The files will be downloaded in the application's directory and will be reused automatically if present."
# The following messages are for the Windows Store listing only and are not used by the application
t MSG_900 "Rufus is a utility that helps format and create bootable USB flash drives, such as USB keys/pendrives, memory sticks, etc."
t MSG_901 "Official site: %s"
@ -4470,7 +4476,7 @@ t IDCANCEL "Fermer"
t IDD_UPDATE_POLICY "Paramètres de mises à jour"
t IDS_UPDATE_SETTINGS_GRP "Options"
t IDS_UPDATE_FREQUENCY_TXT "Recherche mises à jour"
t IDS_INCLUDE_BETAS_TXT "Inclure les bétas"
t IDS_INCLUDE_BETAS_TXT "Inclure les versions bêta"
t IDC_CHECK_NOW "Chercher maintenant"
t MSG_001 "Autre instance détectée"
@ -4531,26 +4537,26 @@ t MSG_058 "Le handle de périphérique est invalide."
t MSG_059 "Cette taille de cluster n'est pas applicable ici."
t MSG_060 "La taille du volume est invalide."
t MSG_061 "Veuillez insérer un média dans le lecteur."
t MSG_062 "Commande non supportée."
t MSG_062 "Une commande non prise en charge a été reçue."
t MSG_063 "Erreur d'allocation mémoire."
t MSG_064 "Erreur de lecture."
t MSG_065 "Erreur d'écriture."
t MSG_066 "L'installation a échoué"
t MSG_067 "Impossible d'accéder au média. Il peut être en cours d'utilisation par une autre application. Essayer de déconnecter le média et essayez à nouveau."
t MSG_068 "Echec de partitionnement."
t MSG_068 "Échec de partitionnement."
t MSG_069 "Impossible de copier les fichiers sur le périphérique de destination."
t MSG_070 "Opération annulée par l'utilisateur."
t MSG_071 "Impossible de créer le thread."
t MSG_072 "La vérification de blocs défectueux a été interrompue."
t MSG_073 "Echec d'analyse de l'image ISO."
t MSG_074 "Echec d'extraction de l'image ISO."
t MSG_075 "Echec lors du remontage du volume."
t MSG_076 "Echec de modification des fichiers de démarrage."
t MSG_077 "Echec d'assignation d'une lettre de volume."
t MSG_073 "Échec d'analyse de l'image ISO."
t MSG_074 "Échec d'extraction de l'image ISO."
t MSG_075 "Échec lors du remontage du volume."
t MSG_076 "Échec de modification des fichiers de démarrage."
t MSG_077 "Échec d'assignation d'une lettre de volume."
t MSG_078 "Impossible de monter le volume GUID."
t MSG_079 "Le périphérique n'est pas prêt."
t MSG_080 "Rufus a détecté que Windows est en train de finir de vider la mémoire tampon.\n\nEn fonction de la vitesse de votre périphérique et de la taille du fichier, cette opération peut prendre beaucoup de temps.\n\nNous recommandons d'attendre que Windows complète cette opération pour éviter la corruption du périphérique. Mais si jamais vous en avez marre d'attendre, vous pouvez essayer de déconnecter le média..."
t MSG_081 "Image non supportée"
t MSG_081 "Image non prise en charge"
t MSG_082 "Cette image n'est pas démarrable, ou bien elle utilise une méthode de démarrage ou de compression qui n'est pas compatible avec Rufus..."
t MSG_083 "Remplacer %s ?"
t MSG_084 "Cette image ISO utilise une version obsolète du fichier '%s'.\nLes menus de démarrage peuvent de pas fonctionner à cause de cela.\n\nRufus peut télécharger une nouvelle version du fichier pour résoudre ce problème :\n- Choisissez 'Oui' pour télécharger le fichier depuis Internet\n- Choisissez 'Non' pour garder le fichier de l'image ISO\nSi vous ne savez pas quoi faire, sélectionnez 'Oui'.\n\nNote : Le nouveau fichier sera téléchargé dans le répertoire courant. Si un '%s' existe à cet endroit, il sera réutilisé automatiquement."
@ -4559,9 +4565,9 @@ t MSG_086 "Aucune image sélectionnée"
t MSG_087 "pour NAND %s"
t MSG_088 "Image trop large"
t MSG_089 "L'image est trop large pour être copiée sur le périphérique sélectionné."
t MSG_090 "Image ISO non supportée"
t MSG_090 "Image ISO non prise en charge"
t MSG_091 "Quand UEFI est sélectionné, seules les images ISO basées sur EFI sont supportées. Veuillez sélectionner une image ISO démarrable avec EFI ou sélectionner BIOS pour le système de destination."
t MSG_092 "Système de fichiers non supporté"
t MSG_092 "Système de fichiers non pris en charge"
t MSG_093 "IMPORTANT : CE PÉRIPHÉRIQUE CONTIENT PLUSIEURS PARTITIONS !!\n\nCeci peut inclure des partitions/volumes qui ne sont pas listées ou bien visibles depuis Windows. Si vous décidez de continuer, vous êtes responsable de toute perte de données intervenant sur ces partitions."
t MSG_094 "Partitions multiples détectées"
t MSG_095 "Image DD"
@ -4570,7 +4576,7 @@ t MSG_097 "'%s' peut seulement être appliqué pour un système de fichiers NTFS
t MSG_098 "IMPORTANT : Vous essayez d'installer 'Windows To Go', mais votre périphérique de destination ne possède pas l'attribut 'FIXE'. A cause de cela, Windows va très probablement geler lors du démarrage, car Microsoft ne l'a pas conçu pour fonctionner avec des périphériques qui possèdent l'attribut 'AMOVIBLE'.\n\nVoulez vous continuer malgré celà ?\n\nNote : L'attribut 'FIXE/AMOVIBLE' est une propriété matérielle qui peut uniquement être changée avec des outils propriétaires, que les fabriquants de périphériques ne fournissent PRESQUE JAMAIS au public..."
t MSG_099 "Limitation du système de fichiers"
t MSG_100 "Cette image ISO contient un fichier de plus de 4 Go, soit plus que la taille maximale autorisée pour un système de fichiers FAT ou FAT32."
t MSG_101 "Support pour archives WIM non disponible"
t MSG_101 "Prise en charge des archives WIM non disponible"
t MSG_102 "Votre plateforme ne peut pas extraire les fichiers depuis les archives WIM. L'extraction de données WIM est nécessaire pour créer des médias USB démarrable avec EFI pour Windows 7/8 ou Windows Vista. Vous pouvez adresser ce problème en téléchargeant une version récente de l'utilitaire 7-Zip.\nVoulez-vous visiter la page de téléchargements de 7-zip ?"
t MSG_103 "Télécharger %s ?"
t MSG_104 "%s ou plus récent requiert l'installation d'un fichier '%s'.\nPuisque ce fichier fait plus de 100 Ko et est toujours présent sur les images ISO à base de %s, il n'est pas inclus dans l'application.\n\nRufus peut télécharger ce fichier pour vous :\n- Choisissez 'Oui' pour télécharger le fichier depuis Internet\n- Choisissez 'Non' si vous compter copier ce fichier manuellement\nNote : Ce fichier est téléchargé dans le répertoire courant. Une fois qu'un fichier'%s' existe à cet endroit, il sera réutilisé automatiquement."
@ -4602,7 +4608,7 @@ t MSG_130 "Sélection d'image Windows"
t MSG_131 "Cette ISO contient plusieurs images Windows.\nVeuillez sélectionner l'image que vous souhaitez utiliser pour cette installation :"
t MSG_132 "Ce lecteur est utilisé par une autre application ou un autre processus. Voulez-vous quand même le formater ?"
t MSG_133 "Rufus a détecté que vous êtes en train de créer un média 'Windows To Go' à partir d'une ISO 1809.\n\nA cause d'un *BUG MICROSOFT*, ce média va planter durant le démarrage de Windows (Blue Screen Of Death), à moins que vous ne remplaciez le fichier 'WppRecorder.sys' par la version 1803.\n\nVeuillez aussi noter que la raison pour laquelle Rufus ne peut pas corriger ce problème pour vous est que le fichier 'WppRecorder.sys' est sujet au copyright de Microsoft, donc nous ne pouvons pas légalement en produire une copie avec cette application..."
t MSG_134 "Parce que MBR a été sélectionné pour le schéma de partition, Rufus peut seulement créer une partition sur ce média occupant jusquà 2 To, ce qui laissera %s despace disque non-disponible.\n\nEtes-vous sûr de vouloir continuer ?"
t MSG_134 "Parce que MBR a été sélectionné pour le schéma de partition, Rufus peut seulement créer une partition sur ce média occupant jusquà 2 To, ce qui laissera %s despace disque non-disponible.\n\nÊtes-vous sûr de vouloir continuer ?"
t MSG_137 "Édition"
t MSG_138 "Langue de produit"
t MSG_140 "Continuer"
@ -4664,7 +4670,7 @@ t MSG_198 "'Windows To Go' peut seulement être installé sur un disque partitio
t MSG_199 "Cette fonctionalité n'est pas disponible pour cette plateforme."
t MSG_201 "Annulation - Veuillez patienter..."
t MSG_202 "Analyse de l'image..."
t MSG_203 "Echec d'analyse de l'image"
t MSG_203 "Échec de l'analyse de l'image"
t MSG_204 "Fichier %s obsolète détecté"
t MSG_205 "Image utilisée : %s"
t MSG_206 "Fichier %s manquant"
@ -4673,27 +4679,27 @@ t MSG_208 "%d périphérique détecté"
t MSG_209 "%d périphériques détectés"
t MSG_210 "PRÊT"
t MSG_211 "Opération annulée"
t MSG_212 "ECHEC"
t MSG_212 "Échec"
t MSG_213 "Lancement de la nouvelle application..."
t MSG_214 "Echec de lancement de l'application"
t MSG_214 "Échec de lancement de l'application"
t MSG_215 "%s ouvert"
t MSG_216 "%s sauvegardé"
t MSG_217 "Formatage : %s"
t MSG_218 "Système de fichiers : Tâche %d/%d complétée"
t MSG_219 "Finalisation NTFS : %d%% complété"
t MSG_218 "Système de fichiers : Tâche %d/%d terminée"
t MSG_219 "Finalisation NTFS : %d%% terminé"
t MSG_220 "Formatage (%s) - durée estimée %d :%02d..."
t MSG_221 "Ecriture du label (%s)..."
t MSG_221 "Écriture du label (%s)..."
t MSG_222 "Formatage (%s)..."
t MSG_223 "Finalisation NTFS (Checkdisk)..."
t MSG_224 "Effacement des structures MBR/PBR/GPT..."
t MSG_225 "Requête d'accès disque..."
t MSG_226 "Analyse des structures de boot existantes..."
t MSG_227 "Fermeture des volumes existants..."
t MSG_228 "Ecriture du MBR..."
t MSG_229 "Ecriture du PBR..."
t MSG_228 "Écriture du MBR..."
t MSG_229 "Écriture du PBR..."
t MSG_230 "Copie des fichiers DOS..."
t MSG_231 "Copie des fichiers ISO : %s"
t MSG_232 "Ecriture boot Win7 EFI (%s)..."
t MSG_232 "Écriture boot Win7 EFI (%s)..."
t MSG_233 "Finalisation, veuillez patienter..."
t MSG_234 "Installation de Syslinux %s..."
t MSG_235 "Test de défauts : %s %d/%d - %0.2f%% (%d/%d/%d erreurs)"
@ -4701,16 +4707,16 @@ t MSG_236 "Test de défauts : Test avec motif aléatoire"
t MSG_237 "Test de défauts : Test avec motif 0x%02X"
t MSG_238 "Partitionnement (%s)..."
t MSG_239 "Suppression des partitions (%s)..."
t MSG_240 "La signature de la mise à jour qui vient dêtre téléchargée ne peut pas être validée. Cela peut indiquer que votre système nest pas configuré correctement pour la validation de signatures digitales, ou que le téléchargement contient un fichier malicieux.\n\nLe téléchargement va être supprimé. Veuillez consulter le log pour plus de détails."
t MSG_240 "La signature de la mise à jour qui vient dêtre téléchargée ne peut pas être validée. Cela peut indiquer que votre système nest pas configuré correctement pour la validation de signatures numériques, ou que le téléchargement contient un fichier malicieux.\n\nLe téléchargement va être supprimé. Veuillez consulter le log pour plus de détails."
t MSG_241 "Téléchargement : %s"
t MSG_242 "Echec de téléchargement du fichier."
t MSG_242 "Échec de téléchargement du fichier."
t MSG_243 "Recherche des mises à jour..."
t MSG_244 "Mises à jour : Impossible de se connecter"
t MSG_245 "Mises à jour : Impossible de lire les données"
t MSG_246 "Une nouvelle version de Rufus est disponible !"
t MSG_247 "Pas de nouvelle mise à jour"
t MSG_248 "Clés de registre supprimées"
t MSG_249 "Echec de suppression des clés registres"
t MSG_249 "Échec de suppression des clés registres"
t MSG_250 "%s activé"
t MSG_251 "%s désactivé"
t MSG_252 "Tests de dépassement de taille"
@ -4722,7 +4728,7 @@ t MSG_257 "Support Joliet"
t MSG_258 "Support Rock Ridge"
t MSG_259 "Forçage de mise à jour"
t MSG_260 "Compression NTFS"
t MSG_261 "Ecriture d'image : %s"
t MSG_261 "Écriture d'image : %s"
t MSG_262 "Support ISO"
t MSG_263 "Affichage de tailles avec de VRAIES unités"
t MSG_264 "Suppression du dossier '%s'"
@ -4732,36 +4738,36 @@ t MSG_267 "Application de l'image Windows : %s"
t MSG_268 "Application de l'image Windows..."
t MSG_269 "Préservation des dates de fichiers"
t MSG_270 "Debug USB"
t MSG_271 "Calculation des checksums de l'image : %s"
t MSG_271 "Calcul des checksums de l'image : %s"
t MSG_272 "Calcule les checksums MD5, SHA1 et SHA256 pour l'image sélectionée"
t MSG_273 "Change la langue de l'application"
t MSG_274 "Image %s détectée"
t MSG_275 "L'image que vous avez sélectionnée est une image 'ISOHybrid'. Cela veut dire quelle peut être écrite soit en mode %s (copie de fichiers) ou en mode %s (image disque).\nRufus recommande dutiliser le mode %s, de manière à ce que vous conserviez laccès à votre périphérique après écriture.\nCependant, si vous rencontrez des erreurs lors du démarrage, vous pouvez à nouveau essayer décrire cette image, en mode %s.\n\nVeuillez sélectionner le mode que vous souhaitez utiliser pour écrire cette image :"
t MSG_276 "Ecrire en mode %s (Recommandé)"
t MSG_277 "Ecrire en mode %s"
t MSG_276 "Écrire en mode %s (Recommandé)"
t MSG_277 "Écrire en mode %s"
t MSG_278 "Recherche de processus en conflit..."
t MSG_279 "Non démarrable"
t MSG_280 "Image disque ou ISO"
t MSG_281 "%s (Veuillez sélectionner)"
t MSG_282 "Verrouillage exclusif de périphérique USB"
t MSG_283 "Signature invalide"
t MSG_284 "L'exécutable téléchargé ne possède pas de signature digitale."
t MSG_284 "L'exécutable téléchargé ne possède pas de signature numérique."
t MSG_285 "L'exécutable téléchargé est signé par '%s'.\nIl ne s'agit pas d'une signature que nous connaissons et peut indiquer une activité malicieuse...\nÊtes-vous certain de vouloir lancer ce fichier ?"
t MSG_286 "Effacement à zéro : %s"
t MSG_287 "Détection disques non-USB détachables"
t MSG_287 "Détection des disques détachables non-USB"
t MSG_288 "Privilèges élevés manquants"
t MSG_289 "Cette application peut seulement être exécutée avec privilèges administratifs"
t MSG_290 "Indexation de fichiers"
t MSG_291 "Sélection de version"
t MSG_289 "Cette application peut seulement être exécutée avec les privilèges administrateur"
t MSG_290 "Indexation des fichiers"
t MSG_291 "Sélection de la version"
t MSG_292 "Sélectionnez la version de Windows que vous souhaitez installer :"
t MSG_293 "Version de Windows non supportée"
t MSG_293 "Version de Windows non prise en charge"
t MSG_294 "Cette version de Windows n'est plus prise en charge par Rufus.\nLa dernière version de Rufus compatible avec cette plateforme est v%d.%d."
t MSG_295 "Alerte: Version non-officielle"
t MSG_296 "Cette version de Rufus n'a pas produite par ses développeurs officiels.\n\nEtes-vous sur de vouloir la lancer ?"
t MSG_296 "Cette version de Rufus n'a pas produite par ses développeurs officiels.\n\nÊtes-vous sûr de vouloir la lancer ?"
t MSG_297 "ISO tronquée détectée"
t MSG_298 "Le fichier ISO que vous avez sélectionné ne fait pas la bonne taille : %s de données sont manquantes !\n\nSi vous avez obtenu ce fichier depuis Internet, vous devriez essayer de le télécharger à nouveau et verifier que le MD5 ou SHA correspond aux valeurs officielles.\n\nNotez que vous pouvez calculer le MD5 ou SHA depuis Rufus en cliquant le bouton (✓)."
t MSG_299 "Erreur de validation du timestamp"
t MSG_300 "Rufus n'a pas pu valider que le timestamp du fichier de mise à jour téléchargé est plus récent que celui de l'exécutable en cours.\n\nAfin de mitiger des scenarios d'attaque potentiels, le processus de mise à jour a été interrompu et le téléchargement va être supprimé. Pour plus de détails, veuillez consulter le log."
t MSG_300 "Rufus n'a pas pu valider que le timestamp du fichier de mise à jour téléchargé est plus récent que celui de l'exécutable en cours.\n\nAfin d'éviter des scenarios d'attaque potentiels, le processus de mise à jour a été interrompu et le téléchargement va être supprimé. Pour plus de détails, veuillez consulter le log."
t MSG_301 "Affiche les paramètres de l'application"
t MSG_302 "Affiche des informations à propos de cette application"
t MSG_303 "Affiche le log"
@ -4773,16 +4779,16 @@ t MSG_308 "Détection VHD"
t MSG_309 "Archive compressée"
t MSG_310 "Limage ISO que vous avez sélectionnée utilise EFI et est suffisamment petite pour être contenue entièrement dans une ESP (EFI System Partition). Lécriture en ESP, plutôt quen partition générique occupant la totalité de lespace disque, peut savérer préférable pour certaines méthodes dinstallation.\nVeuillez sélectionner le mode décriture que vous souhaitez utiliser pour écrire cette image :"
t MSG_311 "Utilisez %s (dans la fenêtre dapplication principale) pour active."
t MSG_312 "Checksum hash supplémentaire (SHA512)"
t MSG_312 "Checksum supplémentaire (SHA512)"
t MSG_313 "Sauver en image VHD"
t MSG_314 "Calculer les checksums the limage sélectionnée"
t MSG_314 "Calculer les checksums de limage sélectionnée"
t MSG_315 "Multiples boutons"
t MSG_316 "Nombre de passes"
t MSG_317 "ID disque"
t MSG_318 "Priorité de thread part default : %d"
t MSG_318 "Priorité de thread par défaut : %d"
t MSG_319 "Ignorer le marqueur de démarrage"
t MSG_320 "Rafraichissement du schéma de partition (%s)..."
t MSG_321 "Limage que vous avez sélectionnée est de type ISOHybrid, mais ses créateurs ne lont pas rendue compatible avec le mode ISO (i.e. copie de fichier).\nA cause de cela, seule lécriture en mode DD est applicable."
t MSG_320 "Rafraîchissement du schéma de partition (%s)..."
t MSG_321 "Limage que vous avez sélectionnée est de type ISOHybrid, mais ses créateurs ne lont pas rendue compatible avec le mode ISO (i.e. copie de fichier).\nÀ cause de cela, seule lécriture en mode DD est applicable."
t MSG_322 "Impossible d'ouvrir ou de lire '%s'"
t MSG_325 "Application des options de personnalisation de Windows: %s"
t MSG_326 "Application des options utilisateur..."
@ -4794,7 +4800,7 @@ t MSG_331 "Désactiver la collecte de données (Supprime les questions de confid
t MSG_332 "Empêcher Windows To Go d'accéder aux disques internes"
t MSG_333 "Créer un compte local sous le nom de :"
t MSG_334 "Définir les options régionales avec les mêmes valeurs que celles de cet utilisateur"
t MSG_335 "Désactiver l'encryption automatique BitLocker"
t MSG_335 "Désactiver le cryptage automatique BitLocker"
t MSG_336 "Log persistent"
t MSG_337 "Un fichier supplémentaire ('diskcopy.dll') doit être téléchargé depuis Microsoft pour installer MS-DOS :\n- Sélectionnez 'Oui' pour vous connecter à Internet et le télécharger\n- Sélectionnez 'Non' pour annuler lopération\n\nNote : Ce fichier sera téléchargé dans le répertoire de l'application et réutilisé automatiquement s'il est présent."
t MSG_338 "Bootloader UEFI révoqué détecté"
@ -4809,6 +4815,11 @@ t MSG_346 "Restreint Windows au mode \"S\" (INCOMPATIBLE avec l'option de désac
t MSG_347 "Mode expert"
t MSG_348 "Extraction d'archive : %s"
t MSG_349 "Utilisation du MBR Rufus"
t MSG_350 "Utiliser les bootloaders signés par 'Windows UEFI CA 2023' [EXPÉRIMENTAL]"
t MSG_351 "Vérification de la revocation des bootloaders UEFI..."
t MSG_352 "Vérification des mises à jour de DBX UEFI..."
t MSG_353 "Mise à jour DBX disponible"
t MSG_354 "Rufus a trouvé une mise à jour des fichiers DBX utilisés pour effectuer la validation des revocations Secure Boot sous UEFI. Voulez-vous télécharger cette mise à jour ?\n- Sélectionnez 'Oui' pour vous connecter à Internet et le télécharger ce contenu\n- Sélectionnez 'Non' pour annuler lopération\n\nNote : Ces fichiers seront téléchargés dans le répertoire de l'application et réutilisés automatiquement si ils sont présent."
t MSG_900 "Rufus est un utilitaire permettant de formater et de créer des média USB amorçables, tels que clés USB, mémoire flash, etc."
t MSG_901 "Site officiel : %s"
t MSG_902 "Code source: %s"
@ -7286,7 +7297,7 @@ t MSG_335 "Disabilita la crittografia automatica dei dispositivi BitLocker"
t MSG_336 "Log persistente"
t MSG_337 "Per installare MS-DOS è necessario scaricare da Microsoft un file aggiuntivo (\"diskcopy.dll\"):\n- Seleziona 'Sì' per connettersi ad internet e scaricarlo\n- Seleziona 'No' per annullare l'operazione\n\nNota: il file verrà scaricato nella cartella dell'applicazione e se presente verrà riutilizzato automaticamente."
t MSG_338 "Rilevato bootloader UEFI revocato"
t MSG_339 "Rufus ha rilevato che l'ISO selezionata contiene un bootloader UEFI che è stato revocato e che quando Secure Boot è abilitato su un sistema UEFI completamente aggiornato produrrà %s. \n\n- Se hai ottenuto questa immagine ISO da una so0egente non affidabile, dovresti considerare la possibilità che possa contenere malware UEFI ed evitare di eseguire l'avvio da esso.\n- Se l'hai ottenuto da una sorgente attendibile, dovresti provare a cercare una versione più aggiornata, che non genererà questo avviso."
t MSG_339 "Rufus ha rilevato che l'ISO selezionata contiene un bootloader UEFI che è stato revocato e che quando Secure Boot è abilitato su un sistema UEFI completamente aggiornato produrrà %s. \n\n- Se hai ottenuto questa immagine ISO da una sorgente non affidabile, dovresti considerare la possibilità che possa contenere malware UEFI ed evitare di eseguire l'avvio da esso.\n- Se l'hai ottenuto da una sorgente attendibile, dovresti provare a cercare una versione più aggiornata, che non genererà questo avviso."
t MSG_340 "una schermata \"Violazione sicurezza\""
t MSG_341 "una schermata di ripristino Windows (BSOD) con '%s'"
t MSG_342 "Immagine VHDX compressa"
@ -10049,7 +10060,7 @@ t MSG_172 "امضای فایل دانلود شده معتبر نیست"
t MSG_173 "برای انتخاب کلیک کنید..."
t MSG_174 "Rufus، ابزاری کاربردی و قابل‌اطمینان برای فرمت کردن درایوهای USB"
t MSG_175 "نسخه %d.%d (Build %d)"
t MSG_176 "ترجمه فارسی:\\lineسید عرفان <mailto:aa3245540@gmail.com>\\line •ضیاءالدین عظیمی <mailto:s.zia.azimi@gmail.com>"
t MSG_176 "ترجمه فارسی:\\lineمستر ویتو <mailto:mv@mvaop.ir>\\line •ضیاءالدین عظیمی <mailto:s.zia.azimi@gmail.com>"
t MSG_177 "گزارش اشکال (Bug) یا درخواست قابلیت جدید و بهبود نرم‌افزار در:"
t MSG_178 "حقوق نشر دیگران:"
t MSG_179 "سیاست به‌روزرسانی:"

BIN
res/md5/bootloongarch64.efi Normal file

Binary file not shown.

View file

@ -1,8 +1,11 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29215.179
# Visual Studio Version 17
VisualStudioVersion = 17.8.34330.188
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rufus", ".vs\rufus.vcxproj", "{731858A7-0303-4988-877B-9C0DD6471864}"
ProjectSection(ProjectDependencies) = postProject
{633CFC82-E01B-4777-BDE4-DC0739804332} = {633CFC82-E01B-4777-BDE4-DC0739804332}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ms-sys", ".vs\ms-sys.vcxproj", "{2B1D078D-8EB4-4398-9CA4-23457265A7F6}"
EndProject
@ -24,8 +27,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bled", ".vs\bled.vcxproj",
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ext2fs", ".vs\ext2fs.vcxproj", "{B01F5886-2B39-4B66-B65C-6427135B6A02}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wimlib", ".vs\wimlib.vcxproj", "{633CFC82-E01B-4777-BDE4-DC0739804332}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|arm = Debug|arm
@ -214,6 +217,22 @@ Global
{B01F5886-2B39-4B66-B65C-6427135B6A02}.Release|x64.Build.0 = Release|x64
{B01F5886-2B39-4B66-B65C-6427135B6A02}.Release|x86.ActiveCfg = Release|Win32
{B01F5886-2B39-4B66-B65C-6427135B6A02}.Release|x86.Build.0 = Release|Win32
{633CFC82-E01B-4777-BDE4-DC0739804332}.Debug|arm.ActiveCfg = Debug|ARM
{633CFC82-E01B-4777-BDE4-DC0739804332}.Debug|arm.Build.0 = Debug|ARM
{633CFC82-E01B-4777-BDE4-DC0739804332}.Debug|arm64.ActiveCfg = Debug|ARM64
{633CFC82-E01B-4777-BDE4-DC0739804332}.Debug|arm64.Build.0 = Debug|ARM64
{633CFC82-E01B-4777-BDE4-DC0739804332}.Debug|x64.ActiveCfg = Debug|x64
{633CFC82-E01B-4777-BDE4-DC0739804332}.Debug|x64.Build.0 = Debug|x64
{633CFC82-E01B-4777-BDE4-DC0739804332}.Debug|x86.ActiveCfg = Debug|Win32
{633CFC82-E01B-4777-BDE4-DC0739804332}.Debug|x86.Build.0 = Debug|Win32
{633CFC82-E01B-4777-BDE4-DC0739804332}.Release|arm.ActiveCfg = Release|ARM
{633CFC82-E01B-4777-BDE4-DC0739804332}.Release|arm.Build.0 = Release|ARM
{633CFC82-E01B-4777-BDE4-DC0739804332}.Release|arm64.ActiveCfg = Release|ARM64
{633CFC82-E01B-4777-BDE4-DC0739804332}.Release|arm64.Build.0 = Release|ARM64
{633CFC82-E01B-4777-BDE4-DC0739804332}.Release|x64.ActiveCfg = Release|x64
{633CFC82-E01B-4777-BDE4-DC0739804332}.Release|x64.Build.0 = Release|x64
{633CFC82-E01B-4777-BDE4-DC0739804332}.Release|x86.ActiveCfg = Release|Win32
{633CFC82-E01B-4777-BDE4-DC0739804332}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View file

@ -1,11 +1,9 @@
SUBDIRS = ../.mingw bled ext2fs ms-sys syslinux/libfat syslinux/libinstaller syslinux/win libcdio/iso9660 libcdio/udf libcdio/driver ../res/loc
SUBDIRS = ../.mingw bled ext2fs ms-sys syslinux/libfat syslinux/libinstaller syslinux/win libcdio/iso9660 libcdio/udf libcdio/driver wimlib ../res/loc
# As far as I can tell, the following libraries are *not* vulnerable to side-loading, so we link using their regular version:
NONVULNERABLE_LIBS = -lsetupapi -lole32 -lgdi32 -lshlwapi -lcrypt32 -lcomctl32 -luuid
NONVULNERABLE_LIBS = -lole32 -lgdi32 -lshlwapi -lcomctl32 -luuid -lntdll
# The following libraries are vulnerable (or have an unknown vulnerability status), so we link using our delay-loaded replacement:
# Ideally there would also be virtdisk and wininet as delaylib's below, but the MinGW folks haven't quite sorted out delay-loading
# for x86_32 so as soon as you try to call APIs from these, the application will crash!
# See https://github.com/pbatard/rufus/issues/2272
VULNERABLE_LIBS = -ldwmapi-delaylib -lversion-delaylib -lvirtdisk-delaylib -lwininet-delaylib -lwintrust-delaylib
VULNERABLE_LIBS = -lcrypt32-delaylib -ldwmapi-delaylib -lsetupapi-delaylib -lversion-delaylib -lvirtdisk-delaylib -lwininet-delaylib -lwintrust-delaylib
noinst_PROGRAMS = rufus
@ -17,10 +15,10 @@ AM_V_WINDRES = $(AM_V_WINDRES_$(V))
%_rc.o: %.rc ../res/loc/embedded.loc
$(AM_V_WINDRES) $(AM_RCFLAGS) -i $< -o $@
rufus_SOURCES = badblocks.c cpu.c dev.c dos.c dos_locale.c drive.c format.c format_ext.c format_fat32.c hash.c icon.c iso.c \
localization.c net.c parser.c pki.c process.c re.c rufus.c smart.c stdfn.c stdio.c stdlg.c syslinux.c ui.c vhd.c wue.c
rufus_CFLAGS = -I$(srcdir)/ms-sys/inc -I$(srcdir)/syslinux/libfat -I$(srcdir)/syslinux/libinstaller -I$(srcdir)/syslinux/win -I$(srcdir)/libcdio $(AM_CFLAGS) \
-DEXT2_FLAT_INCLUDES=0 -DSOLUTION=rufus
rufus_LDFLAGS = $(AM_LDFLAGS) -mwindows -L ../.mingw
rufus_SOURCES = badblocks.c dev.c dos.c dos_locale.c drive.c format.c format_ext.c format_fat32.c hash.c icon.c iso.c \
localization.c net.c parser.c pki.c process.c re.c rufus.c smart.c stdfn.c stdio.c stdlg.c syslinux.c ui.c vhd.c wue.c xml.c
rufus_CFLAGS = -I$(srcdir)/ms-sys/inc -I$(srcdir)/syslinux/libfat -I$(srcdir)/syslinux/libinstaller -I$(srcdir)/syslinux/win -I$(srcdir)/libcdio -I$(srcdir)/wimlib -I$(srcdir)/../res $(AM_CFLAGS) \
-DEXT2_FLAT_INCLUDES=0 -D_RUFUS -DSOLUTION=rufus
rufus_LDFLAGS = $(AM_LDFLAGS) -mwindows -L $(srcdir)/../.mingw
rufus_LDADD = rufus_rc.o bled/libbled.a ext2fs/libext2fs.a ms-sys/libmssys.a syslinux/libfat/libfat.a syslinux/libinstaller/libinstaller.a syslinux/win/libwin.a \
libcdio/iso9660/libiso9660.a libcdio/udf/libudf.a libcdio/driver/libdriver.a $(NONVULNERABLE_LIBS) $(VULNERABLE_LIBS)
libcdio/iso9660/libiso9660.a libcdio/udf/libudf.a libcdio/driver/libdriver.a wimlib/libwim.a $(NONVULNERABLE_LIBS) $(VULNERABLE_LIBS)

View file

@ -87,27 +87,27 @@ mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
PROGRAMS = $(noinst_PROGRAMS)
am_rufus_OBJECTS = rufus-badblocks.$(OBJEXT) rufus-cpu.$(OBJEXT) \
rufus-dev.$(OBJEXT) rufus-dos.$(OBJEXT) \
rufus-dos_locale.$(OBJEXT) rufus-drive.$(OBJEXT) \
rufus-format.$(OBJEXT) rufus-format_ext.$(OBJEXT) \
rufus-format_fat32.$(OBJEXT) rufus-hash.$(OBJEXT) \
rufus-icon.$(OBJEXT) rufus-iso.$(OBJEXT) \
am_rufus_OBJECTS = rufus-badblocks.$(OBJEXT) rufus-dev.$(OBJEXT) \
rufus-dos.$(OBJEXT) rufus-dos_locale.$(OBJEXT) \
rufus-drive.$(OBJEXT) rufus-format.$(OBJEXT) \
rufus-format_ext.$(OBJEXT) rufus-format_fat32.$(OBJEXT) \
rufus-hash.$(OBJEXT) rufus-icon.$(OBJEXT) rufus-iso.$(OBJEXT) \
rufus-localization.$(OBJEXT) rufus-net.$(OBJEXT) \
rufus-parser.$(OBJEXT) rufus-pki.$(OBJEXT) \
rufus-process.$(OBJEXT) rufus-re.$(OBJEXT) \
rufus-rufus.$(OBJEXT) rufus-smart.$(OBJEXT) \
rufus-stdfn.$(OBJEXT) rufus-stdio.$(OBJEXT) \
rufus-stdlg.$(OBJEXT) rufus-syslinux.$(OBJEXT) \
rufus-ui.$(OBJEXT) rufus-vhd.$(OBJEXT) rufus-wue.$(OBJEXT)
rufus-ui.$(OBJEXT) rufus-vhd.$(OBJEXT) rufus-wue.$(OBJEXT) \
rufus-xml.$(OBJEXT)
rufus_OBJECTS = $(am_rufus_OBJECTS)
am__DEPENDENCIES_1 =
rufus_DEPENDENCIES = rufus_rc.o bled/libbled.a ext2fs/libext2fs.a \
ms-sys/libmssys.a syslinux/libfat/libfat.a \
syslinux/libinstaller/libinstaller.a syslinux/win/libwin.a \
libcdio/iso9660/libiso9660.a libcdio/udf/libudf.a \
libcdio/driver/libdriver.a $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1)
libcdio/driver/libdriver.a wimlib/libwim.a \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
rufus_LINK = $(CCLD) $(rufus_CFLAGS) $(CFLAGS) $(rufus_LDFLAGS) \
$(LDFLAGS) -o $@
AM_V_P = $(am__v_P_@AM_V@)
@ -273,27 +273,25 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
SUBDIRS = ../.mingw bled ext2fs ms-sys syslinux/libfat syslinux/libinstaller syslinux/win libcdio/iso9660 libcdio/udf libcdio/driver ../res/loc
SUBDIRS = ../.mingw bled ext2fs ms-sys syslinux/libfat syslinux/libinstaller syslinux/win libcdio/iso9660 libcdio/udf libcdio/driver wimlib ../res/loc
# As far as I can tell, the following libraries are *not* vulnerable to side-loading, so we link using their regular version:
NONVULNERABLE_LIBS = -lsetupapi -lole32 -lgdi32 -lshlwapi -lcrypt32 -lcomctl32 -luuid
NONVULNERABLE_LIBS = -lole32 -lgdi32 -lshlwapi -lcomctl32 -luuid -lntdll
# The following libraries are vulnerable (or have an unknown vulnerability status), so we link using our delay-loaded replacement:
# Ideally there would also be virtdisk and wininet as delaylib's below, but the MinGW folks haven't quite sorted out delay-loading
# for x86_32 so as soon as you try to call APIs from these, the application will crash!
# See https://github.com/pbatard/rufus/issues/2272
VULNERABLE_LIBS = -ldwmapi-delaylib -lversion-delaylib -lvirtdisk-delaylib -lwininet-delaylib -lwintrust-delaylib
VULNERABLE_LIBS = -lcrypt32-delaylib -ldwmapi-delaylib -lsetupapi-delaylib -lversion-delaylib -lvirtdisk-delaylib -lwininet-delaylib -lwintrust-delaylib
AM_V_WINDRES_0 = @echo " RC $@";$(WINDRES)
AM_V_WINDRES_1 = $(WINDRES)
AM_V_WINDRES_ = $(AM_V_WINDRES_$(AM_DEFAULT_VERBOSITY))
AM_V_WINDRES = $(AM_V_WINDRES_$(V))
rufus_SOURCES = badblocks.c cpu.c dev.c dos.c dos_locale.c drive.c format.c format_ext.c format_fat32.c hash.c icon.c iso.c \
localization.c net.c parser.c pki.c process.c re.c rufus.c smart.c stdfn.c stdio.c stdlg.c syslinux.c ui.c vhd.c wue.c
rufus_SOURCES = badblocks.c dev.c dos.c dos_locale.c drive.c format.c format_ext.c format_fat32.c hash.c icon.c iso.c \
localization.c net.c parser.c pki.c process.c re.c rufus.c smart.c stdfn.c stdio.c stdlg.c syslinux.c ui.c vhd.c wue.c xml.c
rufus_CFLAGS = -I$(srcdir)/ms-sys/inc -I$(srcdir)/syslinux/libfat -I$(srcdir)/syslinux/libinstaller -I$(srcdir)/syslinux/win -I$(srcdir)/libcdio $(AM_CFLAGS) \
-DEXT2_FLAT_INCLUDES=0 -DSOLUTION=rufus
rufus_CFLAGS = -I$(srcdir)/ms-sys/inc -I$(srcdir)/syslinux/libfat -I$(srcdir)/syslinux/libinstaller -I$(srcdir)/syslinux/win -I$(srcdir)/libcdio -I$(srcdir)/wimlib -I$(srcdir)/../res $(AM_CFLAGS) \
-DEXT2_FLAT_INCLUDES=0 -D_RUFUS -DSOLUTION=rufus
rufus_LDFLAGS = $(AM_LDFLAGS) -mwindows -L ../.mingw
rufus_LDFLAGS = $(AM_LDFLAGS) -mwindows -L $(srcdir)/../.mingw
rufus_LDADD = rufus_rc.o bled/libbled.a ext2fs/libext2fs.a ms-sys/libmssys.a syslinux/libfat/libfat.a syslinux/libinstaller/libinstaller.a syslinux/win/libwin.a \
libcdio/iso9660/libiso9660.a libcdio/udf/libudf.a libcdio/driver/libdriver.a $(NONVULNERABLE_LIBS) $(VULNERABLE_LIBS)
libcdio/iso9660/libiso9660.a libcdio/udf/libudf.a libcdio/driver/libdriver.a wimlib/libwim.a $(NONVULNERABLE_LIBS) $(VULNERABLE_LIBS)
all: all-recursive
@ -355,12 +353,6 @@ rufus-badblocks.o: badblocks.c
rufus-badblocks.obj: badblocks.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rufus_CFLAGS) $(CFLAGS) -c -o rufus-badblocks.obj `if test -f 'badblocks.c'; then $(CYGPATH_W) 'badblocks.c'; else $(CYGPATH_W) '$(srcdir)/badblocks.c'; fi`
rufus-cpu.o: cpu.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rufus_CFLAGS) $(CFLAGS) -c -o rufus-cpu.o `test -f 'cpu.c' || echo '$(srcdir)/'`cpu.c
rufus-cpu.obj: cpu.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rufus_CFLAGS) $(CFLAGS) -c -o rufus-cpu.obj `if test -f 'cpu.c'; then $(CYGPATH_W) 'cpu.c'; else $(CYGPATH_W) '$(srcdir)/cpu.c'; fi`
rufus-dev.o: dev.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rufus_CFLAGS) $(CFLAGS) -c -o rufus-dev.o `test -f 'dev.c' || echo '$(srcdir)/'`dev.c
@ -511,6 +503,12 @@ rufus-wue.o: wue.c
rufus-wue.obj: wue.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rufus_CFLAGS) $(CFLAGS) -c -o rufus-wue.obj `if test -f 'wue.c'; then $(CYGPATH_W) 'wue.c'; else $(CYGPATH_W) '$(srcdir)/wue.c'; fi`
rufus-xml.o: xml.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rufus_CFLAGS) $(CFLAGS) -c -o rufus-xml.o `test -f 'xml.c' || echo '$(srcdir)/'`xml.c
rufus-xml.obj: xml.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rufus_CFLAGS) $(CFLAGS) -c -o rufus-xml.obj `if test -f 'xml.c'; then $(CYGPATH_W) 'xml.c'; else $(CYGPATH_W) '$(srcdir)/xml.c'; fi`
# This directory's subdirectories are mostly independent; you can cd
# into them and run 'make' without going through this Makefile.
# To change the values of 'make' variables: instead of editing Makefiles,

View file

@ -2,7 +2,9 @@ noinst_LIBRARIES = libbled.a
libbled_a_SOURCES = bled.c crc32.c data_align.c data_extract_all.c data_skip.c decompress_bunzip2.c \
decompress_gunzip.c decompress_uncompress.c decompress_unlzma.c decompress_unxz.c decompress_unzip.c \
decompress_vtsi.c filter_accept_all.c filter_accept_list.c filter_accept_reject_list.c find_list_entry.c \
header_list.c header_skip.c header_verbose_list.c init_handle.c open_transformer.c \
seek_by_jump.c seek_by_read.c xz_dec_bcj.c xz_dec_lzma2.c xz_dec_stream.c
decompress_unzstd.c decompress_vtsi.c filter_accept_all.c filter_accept_list.c filter_accept_reject_list.c \
find_list_entry.c fse_decompress.c header_list.c header_skip.c header_verbose_list.c huf_decompress.c \
init_handle.c open_transformer.c seek_by_jump.c seek_by_read.c xz_dec_bcj.c xz_dec_lzma2.c xz_dec_stream.c \
xxhash.c zstd_common.c zstd_decompress.c zstd_decompress_block.c zstd_ddict.c zstd_entropy_common.c \
zstd_error_private.c
libbled_a_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/.. -Wno-undef -Wno-strict-aliasing

View file

@ -103,21 +103,30 @@ am_libbled_a_OBJECTS = libbled_a-bled.$(OBJEXT) \
libbled_a-decompress_unlzma.$(OBJEXT) \
libbled_a-decompress_unxz.$(OBJEXT) \
libbled_a-decompress_unzip.$(OBJEXT) \
libbled_a-decompress_unzstd.$(OBJEXT) \
libbled_a-decompress_vtsi.$(OBJEXT) \
libbled_a-filter_accept_all.$(OBJEXT) \
libbled_a-filter_accept_list.$(OBJEXT) \
libbled_a-filter_accept_reject_list.$(OBJEXT) \
libbled_a-find_list_entry.$(OBJEXT) \
libbled_a-fse_decompress.$(OBJEXT) \
libbled_a-header_list.$(OBJEXT) \
libbled_a-header_skip.$(OBJEXT) \
libbled_a-header_verbose_list.$(OBJEXT) \
libbled_a-huf_decompress.$(OBJEXT) \
libbled_a-init_handle.$(OBJEXT) \
libbled_a-open_transformer.$(OBJEXT) \
libbled_a-seek_by_jump.$(OBJEXT) \
libbled_a-seek_by_read.$(OBJEXT) \
libbled_a-xz_dec_bcj.$(OBJEXT) \
libbled_a-xz_dec_lzma2.$(OBJEXT) \
libbled_a-xz_dec_stream.$(OBJEXT)
libbled_a-xz_dec_stream.$(OBJEXT) libbled_a-xxhash.$(OBJEXT) \
libbled_a-zstd_common.$(OBJEXT) \
libbled_a-zstd_decompress.$(OBJEXT) \
libbled_a-zstd_decompress_block.$(OBJEXT) \
libbled_a-zstd_ddict.$(OBJEXT) \
libbled_a-zstd_entropy_common.$(OBJEXT) \
libbled_a-zstd_error_private.$(OBJEXT)
libbled_a_OBJECTS = $(am_libbled_a_OBJECTS)
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
@ -269,9 +278,11 @@ top_srcdir = @top_srcdir@
noinst_LIBRARIES = libbled.a
libbled_a_SOURCES = bled.c crc32.c data_align.c data_extract_all.c data_skip.c decompress_bunzip2.c \
decompress_gunzip.c decompress_uncompress.c decompress_unlzma.c decompress_unxz.c decompress_unzip.c \
decompress_vtsi.c filter_accept_all.c filter_accept_list.c filter_accept_reject_list.c find_list_entry.c \
header_list.c header_skip.c header_verbose_list.c init_handle.c open_transformer.c \
seek_by_jump.c seek_by_read.c xz_dec_bcj.c xz_dec_lzma2.c xz_dec_stream.c
decompress_unzstd.c decompress_vtsi.c filter_accept_all.c filter_accept_list.c filter_accept_reject_list.c \
find_list_entry.c fse_decompress.c header_list.c header_skip.c header_verbose_list.c huf_decompress.c \
init_handle.c open_transformer.c seek_by_jump.c seek_by_read.c xz_dec_bcj.c xz_dec_lzma2.c xz_dec_stream.c \
xxhash.c zstd_common.c zstd_decompress.c zstd_decompress_block.c zstd_ddict.c zstd_entropy_common.c \
zstd_error_private.c
libbled_a_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/.. -Wno-undef -Wno-strict-aliasing
all: all-am
@ -395,6 +406,12 @@ libbled_a-decompress_unzip.o: decompress_unzip.c
libbled_a-decompress_unzip.obj: decompress_unzip.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbled_a_CFLAGS) $(CFLAGS) -c -o libbled_a-decompress_unzip.obj `if test -f 'decompress_unzip.c'; then $(CYGPATH_W) 'decompress_unzip.c'; else $(CYGPATH_W) '$(srcdir)/decompress_unzip.c'; fi`
libbled_a-decompress_unzstd.o: decompress_unzstd.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbled_a_CFLAGS) $(CFLAGS) -c -o libbled_a-decompress_unzstd.o `test -f 'decompress_unzstd.c' || echo '$(srcdir)/'`decompress_unzstd.c
libbled_a-decompress_unzstd.obj: decompress_unzstd.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbled_a_CFLAGS) $(CFLAGS) -c -o libbled_a-decompress_unzstd.obj `if test -f 'decompress_unzstd.c'; then $(CYGPATH_W) 'decompress_unzstd.c'; else $(CYGPATH_W) '$(srcdir)/decompress_unzstd.c'; fi`
libbled_a-decompress_vtsi.o: decompress_vtsi.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbled_a_CFLAGS) $(CFLAGS) -c -o libbled_a-decompress_vtsi.o `test -f 'decompress_vtsi.c' || echo '$(srcdir)/'`decompress_vtsi.c
@ -425,6 +442,12 @@ libbled_a-find_list_entry.o: find_list_entry.c
libbled_a-find_list_entry.obj: find_list_entry.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbled_a_CFLAGS) $(CFLAGS) -c -o libbled_a-find_list_entry.obj `if test -f 'find_list_entry.c'; then $(CYGPATH_W) 'find_list_entry.c'; else $(CYGPATH_W) '$(srcdir)/find_list_entry.c'; fi`
libbled_a-fse_decompress.o: fse_decompress.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbled_a_CFLAGS) $(CFLAGS) -c -o libbled_a-fse_decompress.o `test -f 'fse_decompress.c' || echo '$(srcdir)/'`fse_decompress.c
libbled_a-fse_decompress.obj: fse_decompress.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbled_a_CFLAGS) $(CFLAGS) -c -o libbled_a-fse_decompress.obj `if test -f 'fse_decompress.c'; then $(CYGPATH_W) 'fse_decompress.c'; else $(CYGPATH_W) '$(srcdir)/fse_decompress.c'; fi`
libbled_a-header_list.o: header_list.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbled_a_CFLAGS) $(CFLAGS) -c -o libbled_a-header_list.o `test -f 'header_list.c' || echo '$(srcdir)/'`header_list.c
@ -443,6 +466,12 @@ libbled_a-header_verbose_list.o: header_verbose_list.c
libbled_a-header_verbose_list.obj: header_verbose_list.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbled_a_CFLAGS) $(CFLAGS) -c -o libbled_a-header_verbose_list.obj `if test -f 'header_verbose_list.c'; then $(CYGPATH_W) 'header_verbose_list.c'; else $(CYGPATH_W) '$(srcdir)/header_verbose_list.c'; fi`
libbled_a-huf_decompress.o: huf_decompress.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbled_a_CFLAGS) $(CFLAGS) -c -o libbled_a-huf_decompress.o `test -f 'huf_decompress.c' || echo '$(srcdir)/'`huf_decompress.c
libbled_a-huf_decompress.obj: huf_decompress.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbled_a_CFLAGS) $(CFLAGS) -c -o libbled_a-huf_decompress.obj `if test -f 'huf_decompress.c'; then $(CYGPATH_W) 'huf_decompress.c'; else $(CYGPATH_W) '$(srcdir)/huf_decompress.c'; fi`
libbled_a-init_handle.o: init_handle.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbled_a_CFLAGS) $(CFLAGS) -c -o libbled_a-init_handle.o `test -f 'init_handle.c' || echo '$(srcdir)/'`init_handle.c
@ -485,6 +514,48 @@ libbled_a-xz_dec_stream.o: xz_dec_stream.c
libbled_a-xz_dec_stream.obj: xz_dec_stream.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbled_a_CFLAGS) $(CFLAGS) -c -o libbled_a-xz_dec_stream.obj `if test -f 'xz_dec_stream.c'; then $(CYGPATH_W) 'xz_dec_stream.c'; else $(CYGPATH_W) '$(srcdir)/xz_dec_stream.c'; fi`
libbled_a-xxhash.o: xxhash.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbled_a_CFLAGS) $(CFLAGS) -c -o libbled_a-xxhash.o `test -f 'xxhash.c' || echo '$(srcdir)/'`xxhash.c
libbled_a-xxhash.obj: xxhash.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbled_a_CFLAGS) $(CFLAGS) -c -o libbled_a-xxhash.obj `if test -f 'xxhash.c'; then $(CYGPATH_W) 'xxhash.c'; else $(CYGPATH_W) '$(srcdir)/xxhash.c'; fi`
libbled_a-zstd_common.o: zstd_common.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbled_a_CFLAGS) $(CFLAGS) -c -o libbled_a-zstd_common.o `test -f 'zstd_common.c' || echo '$(srcdir)/'`zstd_common.c
libbled_a-zstd_common.obj: zstd_common.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbled_a_CFLAGS) $(CFLAGS) -c -o libbled_a-zstd_common.obj `if test -f 'zstd_common.c'; then $(CYGPATH_W) 'zstd_common.c'; else $(CYGPATH_W) '$(srcdir)/zstd_common.c'; fi`
libbled_a-zstd_decompress.o: zstd_decompress.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbled_a_CFLAGS) $(CFLAGS) -c -o libbled_a-zstd_decompress.o `test -f 'zstd_decompress.c' || echo '$(srcdir)/'`zstd_decompress.c
libbled_a-zstd_decompress.obj: zstd_decompress.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbled_a_CFLAGS) $(CFLAGS) -c -o libbled_a-zstd_decompress.obj `if test -f 'zstd_decompress.c'; then $(CYGPATH_W) 'zstd_decompress.c'; else $(CYGPATH_W) '$(srcdir)/zstd_decompress.c'; fi`
libbled_a-zstd_decompress_block.o: zstd_decompress_block.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbled_a_CFLAGS) $(CFLAGS) -c -o libbled_a-zstd_decompress_block.o `test -f 'zstd_decompress_block.c' || echo '$(srcdir)/'`zstd_decompress_block.c
libbled_a-zstd_decompress_block.obj: zstd_decompress_block.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbled_a_CFLAGS) $(CFLAGS) -c -o libbled_a-zstd_decompress_block.obj `if test -f 'zstd_decompress_block.c'; then $(CYGPATH_W) 'zstd_decompress_block.c'; else $(CYGPATH_W) '$(srcdir)/zstd_decompress_block.c'; fi`
libbled_a-zstd_ddict.o: zstd_ddict.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbled_a_CFLAGS) $(CFLAGS) -c -o libbled_a-zstd_ddict.o `test -f 'zstd_ddict.c' || echo '$(srcdir)/'`zstd_ddict.c
libbled_a-zstd_ddict.obj: zstd_ddict.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbled_a_CFLAGS) $(CFLAGS) -c -o libbled_a-zstd_ddict.obj `if test -f 'zstd_ddict.c'; then $(CYGPATH_W) 'zstd_ddict.c'; else $(CYGPATH_W) '$(srcdir)/zstd_ddict.c'; fi`
libbled_a-zstd_entropy_common.o: zstd_entropy_common.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbled_a_CFLAGS) $(CFLAGS) -c -o libbled_a-zstd_entropy_common.o `test -f 'zstd_entropy_common.c' || echo '$(srcdir)/'`zstd_entropy_common.c
libbled_a-zstd_entropy_common.obj: zstd_entropy_common.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbled_a_CFLAGS) $(CFLAGS) -c -o libbled_a-zstd_entropy_common.obj `if test -f 'zstd_entropy_common.c'; then $(CYGPATH_W) 'zstd_entropy_common.c'; else $(CYGPATH_W) '$(srcdir)/zstd_entropy_common.c'; fi`
libbled_a-zstd_error_private.o: zstd_error_private.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbled_a_CFLAGS) $(CFLAGS) -c -o libbled_a-zstd_error_private.o `test -f 'zstd_error_private.c' || echo '$(srcdir)/'`zstd_error_private.c
libbled_a-zstd_error_private.obj: zstd_error_private.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbled_a_CFLAGS) $(CFLAGS) -c -o libbled_a-zstd_error_private.obj `if test -f 'zstd_error_private.c'; then $(CYGPATH_W) 'zstd_error_private.c'; else $(CYGPATH_W) '$(srcdir)/zstd_error_private.c'; fi`
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-am

View file

@ -17,6 +17,9 @@ enum {
/* (unsigned) cast suppresses "integer overflow in expression" warning */
XZ_MAGIC1a = 256 * (unsigned)(256 * (256 * 0xfd + '7') + 'z') + 'X',
XZ_MAGIC2a = 256 * 'Z' + 0,
ZSTD_MAGIC1 = 0x28B5,
ZSTD_MAGIC2 = 0x2FFD,
ZSTD_MAGIC = 0x28B52FFD,
#else
COMPRESS_MAGIC = 0x9d1f,
GZIP_MAGIC = 0x8b1f,
@ -25,6 +28,9 @@ enum {
XZ_MAGIC2 = 'z' + ('X' + ('Z' + 0 * 256) * 256) * 256,
XZ_MAGIC1a = 0xfd + ('7' + ('z' + 'X' * 256) * 256) * 256,
XZ_MAGIC2a = 'Z' + 0 * 256,
ZSTD_MAGIC1 = 0xB528,
ZSTD_MAGIC2 = 0xFD2F,
ZSTD_MAGIC = 0xFD2FB528,
#endif
};
@ -290,6 +296,7 @@ IF_DESKTOP(long long) int unpack_bz2_stream(transformer_state_t *xstate) FAST_FU
IF_DESKTOP(long long) int unpack_lzma_stream(transformer_state_t *xstate) FAST_FUNC;
IF_DESKTOP(long long) int unpack_xz_stream(transformer_state_t *xstate) FAST_FUNC;
IF_DESKTOP(long long) int unpack_vtsi_stream(transformer_state_t *xstate) FAST_FUNC;
IF_DESKTOP(long long) int unpack_zstd_stream(transformer_state_t *xstate) FAST_FUNC;
char* append_ext(char *filename, const char *expected_ext) FAST_FUNC;
int bbunpack(char **argv,

View file

@ -1,7 +1,7 @@
/*
* Bled (Base Library for Easy Decompression)
*
* Copyright © 2014-2023 Pete Batard <pete@akeo.ie>
* Copyright © 2014-2024 Pete Batard <pete@akeo.ie>
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
@ -31,7 +31,9 @@ jmp_buf bb_error_jmp;
char* bb_virtual_buf = NULL;
size_t bb_virtual_len = 0, bb_virtual_pos = 0;
int bb_virtual_fd = -1;
uint32_t BB_BUFSIZE = 0x10000;
// ZSTD has a minimal buffer size of (1 << ZSTD_BLOCKSIZELOG_MAX) + ZSTD_blockHeaderSize = 128 KB + 3
// So we set our bufsize to 256 KB
uint32_t BB_BUFSIZE = 0x40000;
static long long int unpack_none(transformer_state_t *xstate)
{
@ -49,6 +51,7 @@ unpacker_t unpacker[BLED_COMPRESSION_MAX] = {
unpack_xz_stream,
unpack_none,
unpack_vtsi_stream,
unpack_zstd_stream,
};
/* Uncompress file 'src', compressed using 'type', to file 'dst' */
@ -267,7 +270,7 @@ int64_t bled_uncompress_from_buffer_to_buffer(const char* src, const size_t src_
/* Initialize the library.
* When the parameters are not NULL or zero you can:
* - specify the buffer size to use (must be larger than 64KB and a power of two)
* - specify the buffer size to use (must be larger than 256KB and a power of two)
* - specify the printf-like function you want to use to output message
* void print_function(const char* format, ...);
* - specify the read/write functions you want to use;
@ -283,11 +286,11 @@ int bled_init(uint32_t buffer_size, printf_t print_function, read_t read_functio
if (bled_initialized)
return -1;
BB_BUFSIZE = buffer_size;
/* buffer_size must be larger than 64 KB and a power of two */
if (buffer_size < 0x10000 || (buffer_size & (buffer_size - 1)) != 0) {
/* buffer_size must be larger than 256 KB and a power of two */
if (buffer_size < 0x40000 || (buffer_size & (buffer_size - 1)) != 0) {
if (buffer_size != 0 && print_function != NULL)
print_function("bled_init: invalid buffer_size, defaulting to 64 KB");
BB_BUFSIZE = 0x10000;
BB_BUFSIZE = 0x40000;
}
bled_printf = print_function;
bled_read = read_function;

View file

@ -1,7 +1,7 @@
/*
* Bled (Base Library for Easy Decompression)
*
* Copyright © 2014-2015 Pete Batard <pete@akeo.ie>
* Copyright © 2014-2024 Pete Batard <pete@akeo.ie>
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
@ -31,6 +31,7 @@ typedef enum {
BLED_COMPRESSION_XZ, // .xz
BLED_COMPRESSION_7ZIP, // .7z
BLED_COMPRESSION_VTSI, // .vtsi
BLED_COMPRESSION_ZSTD, // .zst
BLED_COMPRESSION_MAX
} bled_compression_type;

View file

@ -2,7 +2,6 @@
/*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
#include "libbb.h"
#include "bb_archive.h"

View file

@ -2,7 +2,6 @@
/*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
#include "libbb.h"
#include "bb_archive.h"

View file

@ -163,7 +163,7 @@ static int get_next_block(bunzip_data *bd)
uint32_t *dbuf;
unsigned origPtr, t;
unsigned dbufCount, runPos;
unsigned runCnt = 0; // runCnt; /* for compiler */
unsigned runCnt = 0; /* for compiler */
dbuf = bd->dbuf;
selectors = bd->selectors;
@ -843,7 +843,7 @@ char* FAST_FUNC
unpack_bz2_data(const char *packed, int packed_len, int unpacked_len)
{
char *outbuf = NULL;
bunzip_data *bd;
bunzip_data *bd = NULL;
int i;
jmp_buf jmpbuf;

View file

@ -1269,7 +1269,6 @@ unpack_gz_stream(transformer_state_t *xstate)
return -1;
}
to_read = -1;
// bytebuffer_max = 0x8000;
bytebuffer = xmalloc(bytebuffer_max);
if (bytebuffer == NULL) {
bb_error_msg("alloc error");

View file

@ -17,8 +17,6 @@
# define dbg(...) ((void)0)
#endif
#define xread safe_read
enum {
#if BB_BIG_ENDIAN
ZIP_FILEHEADER_MAGIC = 0x504b0304,

View file

@ -0,0 +1,141 @@
/* vi: set sw=4 ts=4: */
/*
* Glue for zstd decompression
* Copyright (c) 2021 Norbert Lange <nolange79@gmail.com>
* Copyright (c) 2024 Pete Batard <pete@akeo.ie>
*
* Based on compress.c from the systemd project,
* provided by Norbert Lange <nolange79@gmail.com>.
* Which originally was copied from the streaming_decompression.c
* example from the zstd project, written by Yann Collet
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
#include "libbb.h"
#include "bb_archive.h"
#include "zstd_deps.h"
#include "zstd_internal.h"
ALWAYS_INLINE static size_t roundupsize(size_t size, size_t align)
{
return (size + align - 1U) & ~(align - 1);
}
ALWAYS_INLINE static IF_DESKTOP(long long) int
unpack_zstd_stream_inner(transformer_state_t *xstate,
ZSTD_DStream *dctx, void *out_buff)
{
const U32 zstd_magic = ZSTD_MAGIC;
const size_t in_allocsize = roundupsize(ZSTD_DStreamInSize(), 1024),
out_allocsize = roundupsize(ZSTD_DStreamOutSize(), 1024);
IF_DESKTOP(long long int total = 0;)
size_t last_result = ZSTD_error_maxCode + 1;
ssize_t nwrote = 0;
unsigned input_fixup;
void *in_buff = (char *)out_buff + out_allocsize;
memcpy(in_buff, &zstd_magic, 4);
input_fixup = xstate->signature_skipped ? 4 : 0;
/* This loop assumes that the input file is one or more concatenated
* zstd streams. This example won't work if there is trailing non-zstd
* data at the end, but streaming decompression in general handles this
* case. ZSTD_decompressStream() returns 0 exactly when the frame is
* completed, and doesn't consume input after the frame.
*/
for (;;) {
bool has_error = false;
ZSTD_inBuffer input;
ssize_t red;
red = safe_read(xstate->src_fd, (char *)in_buff + input_fixup, (unsigned int)(in_allocsize - input_fixup));
if (red < 0) {
bb_perror_msg(bb_msg_read_error);
return -1;
}
if (red == 0) {
break;
}
input.src = in_buff;
input.size = (size_t)red + input_fixup;
input.pos = 0;
input_fixup = 0;
/* Given a valid frame, zstd won't consume the last byte of the
* frame until it has flushed all of the decompressed data of
* the frame. So input.pos < input.size means frame is not done
* or there is still output available.
*/
while (input.pos < input.size) {
ZSTD_outBuffer output = { out_buff, out_allocsize, 0 };
/* The return code is zero if the frame is complete, but
* there may be multiple frames concatenated together.
* Zstd will automatically reset the context when a
* frame is complete. Still, calling ZSTD_DCtx_reset()
* can be useful to reset the context to a clean state,
* for instance if the last decompression call returned
* an error.
*/
last_result = ZSTD_decompressStream(dctx, &output, &input);
if (ZSTD_isError(last_result)) {
has_error = true;
break;
}
nwrote = transformer_write(xstate, output.dst, output.pos);
if (nwrote < 0 && nwrote != -ENOSPC) {
has_error = true;
break;
}
IF_DESKTOP(total = (nwrote == -ENOSPC) ? xstate->mem_output_size_max : total + output.pos);
}
if (has_error)
break;
}
if (last_result != 0) {
/* The last return value from ZSTD_decompressStream did not end
* on a frame, but we reached the end of the file! We assume
* this is an error, and the input was truncated.
*/
if (last_result == ZSTD_error_maxCode + 1) {
bb_simple_error_msg("could not read zstd data");
} else {
#if defined(ZSTD_STRIP_ERROR_STRINGS) && ZSTD_STRIP_ERROR_STRINGS == 1
bb_error_msg("zstd decoder error: %u", (unsigned)last_result);
#else
bb_error_msg("zstd decoder error: %s", ZSTD_getErrorName(last_result));
#endif
}
return -1;
}
return IF_DESKTOP(total) + 0;
}
IF_DESKTOP(long long) int FAST_FUNC
unpack_zstd_stream(transformer_state_t *xstate)
{
const size_t in_allocsize = roundupsize(ZSTD_DStreamInSize(), 1024),
out_allocsize = roundupsize(ZSTD_DStreamOutSize(), 1024);
IF_DESKTOP(long long) int result;
void *out_buff;
ZSTD_DStream *dctx;
dctx = ZSTD_createDStream();
if (!dctx) {
/* should be the only possibly reason of failure */
bb_error_msg_and_die("memory exhausted");
}
out_buff = xmalloc(in_allocsize + out_allocsize);
result = unpack_zstd_stream_inner(xstate, dctx, out_buff);
free(out_buff);
ZSTD_freeDStream(dctx);
return result;
}

View file

@ -4,7 +4,6 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
#include "libbb.h"
#include "bb_archive.h"

View file

@ -4,7 +4,6 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
#include "libbb.h"
#include "bb_archive.h"

View file

@ -5,7 +5,6 @@
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
//#include <fnmatch.h>
#include "libbb.h"
#include "bb_archive.h"

640
src/bled/fse.h Normal file
View file

@ -0,0 +1,640 @@
/* ******************************************************************
* FSE : Finite State Entropy codec
* Public Prototypes declaration
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* You can contact the author at :
* - Source repository : https://github.com/Cyan4973/FiniteStateEntropy
*
* This source code is licensed under both the BSD-style license (found in the
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
* in the COPYING file in the root directory of this source tree).
* You may select, at your option, one of the above-listed licenses.
****************************************************************** */
#if defined (__cplusplus)
extern "C" {
#endif
#ifndef FSE_H
#define FSE_H
/*-*****************************************
* Dependencies
******************************************/
#include "zstd_deps.h" /* size_t, ptrdiff_t */
/*-*****************************************
* FSE_PUBLIC_API : control library symbols visibility
******************************************/
#if defined(FSE_DLL_EXPORT) && (FSE_DLL_EXPORT==1) && defined(__GNUC__) && (__GNUC__ >= 4)
# define FSE_PUBLIC_API __attribute__ ((visibility ("default")))
#elif defined(FSE_DLL_EXPORT) && (FSE_DLL_EXPORT==1) /* Visual expected */
# define FSE_PUBLIC_API __declspec(dllexport)
#elif defined(FSE_DLL_IMPORT) && (FSE_DLL_IMPORT==1)
# define FSE_PUBLIC_API __declspec(dllimport) /* It isn't required but allows to generate better code, saving a function pointer load from the IAT and an indirect jump.*/
#else
# define FSE_PUBLIC_API
#endif
/*------ Version ------*/
#define FSE_VERSION_MAJOR 0
#define FSE_VERSION_MINOR 9
#define FSE_VERSION_RELEASE 0
#define FSE_LIB_VERSION FSE_VERSION_MAJOR.FSE_VERSION_MINOR.FSE_VERSION_RELEASE
#define FSE_QUOTE(str) #str
#define FSE_EXPAND_AND_QUOTE(str) FSE_QUOTE(str)
#define FSE_VERSION_STRING FSE_EXPAND_AND_QUOTE(FSE_LIB_VERSION)
#define FSE_VERSION_NUMBER (FSE_VERSION_MAJOR *100*100 + FSE_VERSION_MINOR *100 + FSE_VERSION_RELEASE)
FSE_PUBLIC_API unsigned FSE_versionNumber(void); /**< library version number; to be used when checking dll version */
/*-*****************************************
* Tool functions
******************************************/
FSE_PUBLIC_API size_t FSE_compressBound(size_t size); /* maximum compressed size */
/* Error Management */
FSE_PUBLIC_API unsigned FSE_isError(size_t code); /* tells if a return value is an error code */
FSE_PUBLIC_API const char* FSE_getErrorName(size_t code); /* provides error code string (useful for debugging) */
/*-*****************************************
* FSE detailed API
******************************************/
/*!
FSE_compress() does the following:
1. count symbol occurrence from source[] into table count[] (see hist.h)
2. normalize counters so that sum(count[]) == Power_of_2 (2^tableLog)
3. save normalized counters to memory buffer using writeNCount()
4. build encoding table 'CTable' from normalized counters
5. encode the data stream using encoding table 'CTable'
FSE_decompress() does the following:
1. read normalized counters with readNCount()
2. build decoding table 'DTable' from normalized counters
3. decode the data stream using decoding table 'DTable'
The following API allows targeting specific sub-functions for advanced tasks.
For example, it's possible to compress several blocks using the same 'CTable',
or to save and provide normalized distribution using external method.
*/
/* *** COMPRESSION *** */
/*! FSE_optimalTableLog():
dynamically downsize 'tableLog' when conditions are met.
It saves CPU time, by using smaller tables, while preserving or even improving compression ratio.
@return : recommended tableLog (necessarily <= 'maxTableLog') */
FSE_PUBLIC_API unsigned FSE_optimalTableLog(unsigned maxTableLog, size_t srcSize, unsigned maxSymbolValue);
/*! FSE_normalizeCount():
normalize counts so that sum(count[]) == Power_of_2 (2^tableLog)
'normalizedCounter' is a table of short, of minimum size (maxSymbolValue+1).
useLowProbCount is a boolean parameter which trades off compressed size for
faster header decoding. When it is set to 1, the compressed data will be slightly
smaller. And when it is set to 0, FSE_readNCount() and FSE_buildDTable() will be
faster. If you are compressing a small amount of data (< 2 KB) then useLowProbCount=0
is a good default, since header deserialization makes a big speed difference.
Otherwise, useLowProbCount=1 is a good default, since the speed difference is small.
@return : tableLog,
or an errorCode, which can be tested using FSE_isError() */
FSE_PUBLIC_API size_t FSE_normalizeCount(short* normalizedCounter, unsigned tableLog,
const unsigned* count, size_t srcSize, unsigned maxSymbolValue, unsigned useLowProbCount);
/*! FSE_NCountWriteBound():
Provides the maximum possible size of an FSE normalized table, given 'maxSymbolValue' and 'tableLog'.
Typically useful for allocation purpose. */
FSE_PUBLIC_API size_t FSE_NCountWriteBound(unsigned maxSymbolValue, unsigned tableLog);
/*! FSE_writeNCount():
Compactly save 'normalizedCounter' into 'buffer'.
@return : size of the compressed table,
or an errorCode, which can be tested using FSE_isError(). */
FSE_PUBLIC_API size_t FSE_writeNCount (void* buffer, size_t bufferSize,
const short* normalizedCounter,
unsigned maxSymbolValue, unsigned tableLog);
/*! Constructor and Destructor of FSE_CTable.
Note that FSE_CTable size depends on 'tableLog' and 'maxSymbolValue' */
typedef unsigned FSE_CTable; /* don't allocate that. It's only meant to be more restrictive than void* */
/*! FSE_buildCTable():
Builds `ct`, which must be already allocated, using FSE_createCTable().
@return : 0, or an errorCode, which can be tested using FSE_isError() */
FSE_PUBLIC_API size_t FSE_buildCTable(FSE_CTable* ct, const short* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog);
/*! FSE_compress_usingCTable():
Compress `src` using `ct` into `dst` which must be already allocated.
@return : size of compressed data (<= `dstCapacity`),
or 0 if compressed data could not fit into `dst`,
or an errorCode, which can be tested using FSE_isError() */
FSE_PUBLIC_API size_t FSE_compress_usingCTable (void* dst, size_t dstCapacity, const void* src, size_t srcSize, const FSE_CTable* ct);
/*!
Tutorial :
----------
The first step is to count all symbols. FSE_count() does this job very fast.
Result will be saved into 'count', a table of unsigned int, which must be already allocated, and have 'maxSymbolValuePtr[0]+1' cells.
'src' is a table of bytes of size 'srcSize'. All values within 'src' MUST be <= maxSymbolValuePtr[0]
maxSymbolValuePtr[0] will be updated, with its real value (necessarily <= original value)
FSE_count() will return the number of occurrence of the most frequent symbol.
This can be used to know if there is a single symbol within 'src', and to quickly evaluate its compressibility.
If there is an error, the function will return an ErrorCode (which can be tested using FSE_isError()).
The next step is to normalize the frequencies.
FSE_normalizeCount() will ensure that sum of frequencies is == 2 ^'tableLog'.
It also guarantees a minimum of 1 to any Symbol with frequency >= 1.
You can use 'tableLog'==0 to mean "use default tableLog value".
If you are unsure of which tableLog value to use, you can ask FSE_optimalTableLog(),
which will provide the optimal valid tableLog given sourceSize, maxSymbolValue, and a user-defined maximum (0 means "default").
The result of FSE_normalizeCount() will be saved into a table,
called 'normalizedCounter', which is a table of signed short.
'normalizedCounter' must be already allocated, and have at least 'maxSymbolValue+1' cells.
The return value is tableLog if everything proceeded as expected.
It is 0 if there is a single symbol within distribution.
If there is an error (ex: invalid tableLog value), the function will return an ErrorCode (which can be tested using FSE_isError()).
'normalizedCounter' can be saved in a compact manner to a memory area using FSE_writeNCount().
'buffer' must be already allocated.
For guaranteed success, buffer size must be at least FSE_headerBound().
The result of the function is the number of bytes written into 'buffer'.
If there is an error, the function will return an ErrorCode (which can be tested using FSE_isError(); ex : buffer size too small).
'normalizedCounter' can then be used to create the compression table 'CTable'.
The space required by 'CTable' must be already allocated, using FSE_createCTable().
You can then use FSE_buildCTable() to fill 'CTable'.
If there is an error, both functions will return an ErrorCode (which can be tested using FSE_isError()).
'CTable' can then be used to compress 'src', with FSE_compress_usingCTable().
Similar to FSE_count(), the convention is that 'src' is assumed to be a table of char of size 'srcSize'
The function returns the size of compressed data (without header), necessarily <= `dstCapacity`.
If it returns '0', compressed data could not fit into 'dst'.
If there is an error, the function will return an ErrorCode (which can be tested using FSE_isError()).
*/
/* *** DECOMPRESSION *** */
/*! FSE_readNCount():
Read compactly saved 'normalizedCounter' from 'rBuffer'.
@return : size read from 'rBuffer',
or an errorCode, which can be tested using FSE_isError().
maxSymbolValuePtr[0] and tableLogPtr[0] will also be updated with their respective values */
FSE_PUBLIC_API size_t FSE_readNCount (short* normalizedCounter,
unsigned* maxSymbolValuePtr, unsigned* tableLogPtr,
const void* rBuffer, size_t rBuffSize);
/*! FSE_readNCount_bmi2():
* Same as FSE_readNCount() but pass bmi2=1 when your CPU supports BMI2 and 0 otherwise.
*/
FSE_PUBLIC_API size_t FSE_readNCount_bmi2(short* normalizedCounter,
unsigned* maxSymbolValuePtr, unsigned* tableLogPtr,
const void* rBuffer, size_t rBuffSize, int bmi2);
typedef unsigned FSE_DTable; /* don't allocate that. It's just a way to be more restrictive than void* */
/*!
Tutorial :
----------
(Note : these functions only decompress FSE-compressed blocks.
If block is uncompressed, use memcpy() instead
If block is a single repeated byte, use memset() instead )
The first step is to obtain the normalized frequencies of symbols.
This can be performed by FSE_readNCount() if it was saved using FSE_writeNCount().
'normalizedCounter' must be already allocated, and have at least 'maxSymbolValuePtr[0]+1' cells of signed short.
In practice, that means it's necessary to know 'maxSymbolValue' beforehand,
or size the table to handle worst case situations (typically 256).
FSE_readNCount() will provide 'tableLog' and 'maxSymbolValue'.
The result of FSE_readNCount() is the number of bytes read from 'rBuffer'.
Note that 'rBufferSize' must be at least 4 bytes, even if useful information is less than that.
If there is an error, the function will return an error code, which can be tested using FSE_isError().
The next step is to build the decompression tables 'FSE_DTable' from 'normalizedCounter'.
This is performed by the function FSE_buildDTable().
The space required by 'FSE_DTable' must be already allocated using FSE_createDTable().
If there is an error, the function will return an error code, which can be tested using FSE_isError().
`FSE_DTable` can then be used to decompress `cSrc`, with FSE_decompress_usingDTable().
`cSrcSize` must be strictly correct, otherwise decompression will fail.
FSE_decompress_usingDTable() result will tell how many bytes were regenerated (<=`dstCapacity`).
If there is an error, the function will return an error code, which can be tested using FSE_isError(). (ex: dst buffer too small)
*/
#endif /* FSE_H */
#if defined(FSE_STATIC_LINKING_ONLY) && !defined(FSE_H_FSE_STATIC_LINKING_ONLY)
#define FSE_H_FSE_STATIC_LINKING_ONLY
/* *** Dependency *** */
#include "fse_bitstream.h"
/* *****************************************
* Static allocation
*******************************************/
/* FSE buffer bounds */
#define FSE_NCOUNTBOUND 512
#define FSE_BLOCKBOUND(size) ((size) + ((size)>>7) + 4 /* fse states */ + sizeof(size_t) /* bitContainer */)
#define FSE_COMPRESSBOUND(size) (FSE_NCOUNTBOUND + FSE_BLOCKBOUND(size)) /* Macro version, useful for static allocation */
/* It is possible to statically allocate FSE CTable/DTable as a table of FSE_CTable/FSE_DTable using below macros */
#define FSE_CTABLE_SIZE_U32(maxTableLog, maxSymbolValue) (1 + (1<<((maxTableLog)-1)) + (((maxSymbolValue)+1)*2))
#define FSE_DTABLE_SIZE_U32(maxTableLog) (1 + (1<<(maxTableLog)))
/* or use the size to malloc() space directly. Pay attention to alignment restrictions though */
#define FSE_CTABLE_SIZE(maxTableLog, maxSymbolValue) (FSE_CTABLE_SIZE_U32(maxTableLog, maxSymbolValue) * sizeof(FSE_CTable))
#define FSE_DTABLE_SIZE(maxTableLog) (FSE_DTABLE_SIZE_U32(maxTableLog) * sizeof(FSE_DTable))
/* *****************************************
* FSE advanced API
***************************************** */
unsigned FSE_optimalTableLog_internal(unsigned maxTableLog, size_t srcSize, unsigned maxSymbolValue, unsigned minus);
/**< same as FSE_optimalTableLog(), which used `minus==2` */
size_t FSE_buildCTable_rle (FSE_CTable* ct, unsigned char symbolValue);
/**< build a fake FSE_CTable, designed to compress always the same symbolValue */
/* FSE_buildCTable_wksp() :
* Same as FSE_buildCTable(), but using an externally allocated scratch buffer (`workSpace`).
* `wkspSize` must be >= `FSE_BUILD_CTABLE_WORKSPACE_SIZE_U32(maxSymbolValue, tableLog)` of `unsigned`.
* See FSE_buildCTable_wksp() for breakdown of workspace usage.
*/
#define FSE_BUILD_CTABLE_WORKSPACE_SIZE_U32(maxSymbolValue, tableLog) (((maxSymbolValue + 2) + (1ull << (tableLog)))/2 + sizeof(U64)/sizeof(U32) /* additional 8 bytes for potential table overwrite */)
#define FSE_BUILD_CTABLE_WORKSPACE_SIZE(maxSymbolValue, tableLog) (sizeof(unsigned) * FSE_BUILD_CTABLE_WORKSPACE_SIZE_U32(maxSymbolValue, tableLog))
size_t FSE_buildCTable_wksp(FSE_CTable* ct, const short* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog, void* workSpace, size_t wkspSize);
#define FSE_BUILD_DTABLE_WKSP_SIZE(maxTableLog, maxSymbolValue) (sizeof(short) * (maxSymbolValue + 1) + (1ULL << maxTableLog) + 8)
#define FSE_BUILD_DTABLE_WKSP_SIZE_U32(maxTableLog, maxSymbolValue) ((FSE_BUILD_DTABLE_WKSP_SIZE(maxTableLog, maxSymbolValue) + sizeof(unsigned) - 1) / sizeof(unsigned))
FSE_PUBLIC_API size_t FSE_buildDTable_wksp(FSE_DTable* dt, const short* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog, void* workSpace, size_t wkspSize);
/**< Same as FSE_buildDTable(), using an externally allocated `workspace` produced with `FSE_BUILD_DTABLE_WKSP_SIZE_U32(maxSymbolValue)` */
#define FSE_DECOMPRESS_WKSP_SIZE_U32(maxTableLog, maxSymbolValue) (FSE_DTABLE_SIZE_U32(maxTableLog) + 1 + FSE_BUILD_DTABLE_WKSP_SIZE_U32(maxTableLog, maxSymbolValue) + (FSE_MAX_SYMBOL_VALUE + 1) / 2 + 1)
#define FSE_DECOMPRESS_WKSP_SIZE(maxTableLog, maxSymbolValue) (FSE_DECOMPRESS_WKSP_SIZE_U32(maxTableLog, maxSymbolValue) * sizeof(unsigned))
size_t FSE_decompress_wksp_bmi2(void* dst, size_t dstCapacity, const void* cSrc, size_t cSrcSize, unsigned maxLog, void* workSpace, size_t wkspSize, int bmi2);
/**< same as FSE_decompress(), using an externally allocated `workSpace` produced with `FSE_DECOMPRESS_WKSP_SIZE_U32(maxLog, maxSymbolValue)`.
* Set bmi2 to 1 if your CPU supports BMI2 or 0 if it doesn't */
typedef enum {
FSE_repeat_none, /**< Cannot use the previous table */
FSE_repeat_check, /**< Can use the previous table but it must be checked */
FSE_repeat_valid /**< Can use the previous table and it is assumed to be valid */
} FSE_repeat;
/* *****************************************
* FSE symbol compression API
*******************************************/
/*!
This API consists of small unitary functions, which highly benefit from being inlined.
Hence their body are included in next section.
*/
typedef struct {
ptrdiff_t value;
const void* stateTable;
const void* symbolTT;
unsigned stateLog;
} FSE_CState_t;
static void FSE_initCState(FSE_CState_t* CStatePtr, const FSE_CTable* ct);
static void FSE_encodeSymbol(BIT_CStream_t* bitC, FSE_CState_t* CStatePtr, unsigned symbol);
static void FSE_flushCState(BIT_CStream_t* bitC, const FSE_CState_t* CStatePtr);
/**<
These functions are inner components of FSE_compress_usingCTable().
They allow the creation of custom streams, mixing multiple tables and bit sources.
A key property to keep in mind is that encoding and decoding are done **in reverse direction**.
So the first symbol you will encode is the last you will decode, like a LIFO stack.
You will need a few variables to track your CStream. They are :
FSE_CTable ct; // Provided by FSE_buildCTable()
BIT_CStream_t bitStream; // bitStream tracking structure
FSE_CState_t state; // State tracking structure (can have several)
The first thing to do is to init bitStream and state.
size_t errorCode = BIT_initCStream(&bitStream, dstBuffer, maxDstSize);
FSE_initCState(&state, ct);
Note that BIT_initCStream() can produce an error code, so its result should be tested, using FSE_isError();
You can then encode your input data, byte after byte.
FSE_encodeSymbol() outputs a maximum of 'tableLog' bits at a time.
Remember decoding will be done in reverse direction.
FSE_encodeByte(&bitStream, &state, symbol);
At any time, you can also add any bit sequence.
Note : maximum allowed nbBits is 25, for compatibility with 32-bits decoders
BIT_addBits(&bitStream, bitField, nbBits);
The above methods don't commit data to memory, they just store it into local register, for speed.
Local register size is 64-bits on 64-bits systems, 32-bits on 32-bits systems (size_t).
Writing data to memory is a manual operation, performed by the flushBits function.
BIT_flushBits(&bitStream);
Your last FSE encoding operation shall be to flush your last state value(s).
FSE_flushState(&bitStream, &state);
Finally, you must close the bitStream.
The function returns the size of CStream in bytes.
If data couldn't fit into dstBuffer, it will return a 0 ( == not compressible)
If there is an error, it returns an errorCode (which can be tested using FSE_isError()).
size_t size = BIT_closeCStream(&bitStream);
*/
/* *****************************************
* FSE symbol decompression API
*******************************************/
typedef struct {
size_t state;
const void* table; /* precise table may vary, depending on U16 */
} FSE_DState_t;
static void FSE_initDState(FSE_DState_t* DStatePtr, BIT_DStream_t* bitD, const FSE_DTable* dt);
static unsigned char FSE_decodeSymbol(FSE_DState_t* DStatePtr, BIT_DStream_t* bitD);
static unsigned FSE_endOfDState(const FSE_DState_t* DStatePtr);
/**<
Let's now decompose FSE_decompress_usingDTable() into its unitary components.
You will decode FSE-encoded symbols from the bitStream,
and also any other bitFields you put in, **in reverse order**.
You will need a few variables to track your bitStream. They are :
BIT_DStream_t DStream; // Stream context
FSE_DState_t DState; // State context. Multiple ones are possible
FSE_DTable* DTablePtr; // Decoding table, provided by FSE_buildDTable()
The first thing to do is to init the bitStream.
errorCode = BIT_initDStream(&DStream, srcBuffer, srcSize);
You should then retrieve your initial state(s)
(in reverse flushing order if you have several ones) :
errorCode = FSE_initDState(&DState, &DStream, DTablePtr);
You can then decode your data, symbol after symbol.
For information the maximum number of bits read by FSE_decodeSymbol() is 'tableLog'.
Keep in mind that symbols are decoded in reverse order, like a LIFO stack (last in, first out).
unsigned char symbol = FSE_decodeSymbol(&DState, &DStream);
You can retrieve any bitfield you eventually stored into the bitStream (in reverse order)
Note : maximum allowed nbBits is 25, for 32-bits compatibility
size_t bitField = BIT_readBits(&DStream, nbBits);
All above operations only read from local register (which size depends on size_t).
Refueling the register from memory is manually performed by the reload method.
endSignal = FSE_reloadDStream(&DStream);
BIT_reloadDStream() result tells if there is still some more data to read from DStream.
BIT_DStream_unfinished : there is still some data left into the DStream.
BIT_DStream_endOfBuffer : Dstream reached end of buffer. Its container may no longer be completely filled.
BIT_DStream_completed : Dstream reached its exact end, corresponding in general to decompression completed.
BIT_DStream_tooFar : Dstream went too far. Decompression result is corrupted.
When reaching end of buffer (BIT_DStream_endOfBuffer), progress slowly, notably if you decode multiple symbols per loop,
to properly detect the exact end of stream.
After each decoded symbol, check if DStream is fully consumed using this simple test :
BIT_reloadDStream(&DStream) >= BIT_DStream_completed
When it's done, verify decompression is fully completed, by checking both DStream and the relevant states.
Checking if DStream has reached its end is performed by :
BIT_endOfDStream(&DStream);
Check also the states. There might be some symbols left there, if some high probability ones (>50%) are possible.
FSE_endOfDState(&DState);
*/
/* *****************************************
* FSE unsafe API
*******************************************/
static unsigned char FSE_decodeSymbolFast(FSE_DState_t* DStatePtr, BIT_DStream_t* bitD);
/* faster, but works only if nbBits is always >= 1 (otherwise, result will be corrupted) */
/* *****************************************
* Implementation of inlined functions
*******************************************/
typedef struct {
int deltaFindState;
U32 deltaNbBits;
} FSE_symbolCompressionTransform; /* total 8 bytes */
MEM_STATIC void FSE_initCState(FSE_CState_t* statePtr, const FSE_CTable* ct)
{
const void* ptr = ct;
const U16* u16ptr = (const U16*) ptr;
const U32 tableLog = MEM_read16(ptr);
statePtr->value = (ptrdiff_t)1<<tableLog;
statePtr->stateTable = u16ptr+2;
statePtr->symbolTT = ct + 1 + (tableLog ? (1<<(tableLog-1)) : 1);
statePtr->stateLog = tableLog;
}
/*! FSE_initCState2() :
* Same as FSE_initCState(), but the first symbol to include (which will be the last to be read)
* uses the smallest state value possible, saving the cost of this symbol */
MEM_STATIC void FSE_initCState2(FSE_CState_t* statePtr, const FSE_CTable* ct, U32 symbol)
{
FSE_initCState(statePtr, ct);
{ const FSE_symbolCompressionTransform symbolTT = ((const FSE_symbolCompressionTransform*)(statePtr->symbolTT))[symbol];
const U16* stateTable = (const U16*)(statePtr->stateTable);
U32 nbBitsOut = (U32)((symbolTT.deltaNbBits + (1<<15)) >> 16);
statePtr->value = (nbBitsOut << 16) - symbolTT.deltaNbBits;
statePtr->value = stateTable[(statePtr->value >> nbBitsOut) + symbolTT.deltaFindState];
}
}
MEM_STATIC void FSE_encodeSymbol(BIT_CStream_t* bitC, FSE_CState_t* statePtr, unsigned symbol)
{
FSE_symbolCompressionTransform const symbolTT = ((const FSE_symbolCompressionTransform*)(statePtr->symbolTT))[symbol];
const U16* const stateTable = (const U16*)(statePtr->stateTable);
U32 const nbBitsOut = (U32)((statePtr->value + symbolTT.deltaNbBits) >> 16);
BIT_addBits(bitC, (size_t)statePtr->value, nbBitsOut);
statePtr->value = stateTable[ (statePtr->value >> nbBitsOut) + symbolTT.deltaFindState];
}
MEM_STATIC void FSE_flushCState(BIT_CStream_t* bitC, const FSE_CState_t* statePtr)
{
BIT_addBits(bitC, (size_t)statePtr->value, statePtr->stateLog);
BIT_flushBits(bitC);
}
/* FSE_getMaxNbBits() :
* Approximate maximum cost of a symbol, in bits.
* Fractional get rounded up (i.e. a symbol with a normalized frequency of 3 gives the same result as a frequency of 2)
* note 1 : assume symbolValue is valid (<= maxSymbolValue)
* note 2 : if freq[symbolValue]==0, @return a fake cost of tableLog+1 bits */
MEM_STATIC U32 FSE_getMaxNbBits(const void* symbolTTPtr, U32 symbolValue)
{
const FSE_symbolCompressionTransform* symbolTT = (const FSE_symbolCompressionTransform*) symbolTTPtr;
return (symbolTT[symbolValue].deltaNbBits + ((1<<16)-1)) >> 16;
}
/* FSE_bitCost() :
* Approximate symbol cost, as fractional value, using fixed-point format (accuracyLog fractional bits)
* note 1 : assume symbolValue is valid (<= maxSymbolValue)
* note 2 : if freq[symbolValue]==0, @return a fake cost of tableLog+1 bits */
MEM_STATIC U32 FSE_bitCost(const void* symbolTTPtr, U32 tableLog, U32 symbolValue, U32 accuracyLog)
{
const FSE_symbolCompressionTransform* symbolTT = (const FSE_symbolCompressionTransform*) symbolTTPtr;
U32 const minNbBits = symbolTT[symbolValue].deltaNbBits >> 16;
U32 const threshold = (minNbBits+1) << 16;
assert(tableLog < 16);
assert(accuracyLog < 31-tableLog); /* ensure enough room for renormalization double shift */
{ U32 const tableSize = 1 << tableLog;
U32 const deltaFromThreshold = threshold - (symbolTT[symbolValue].deltaNbBits + tableSize);
U32 const normalizedDeltaFromThreshold = (deltaFromThreshold << accuracyLog) >> tableLog; /* linear interpolation (very approximate) */
U32 const bitMultiplier = 1 << accuracyLog;
assert(symbolTT[symbolValue].deltaNbBits + tableSize <= threshold);
assert(normalizedDeltaFromThreshold <= bitMultiplier);
return (minNbBits+1)*bitMultiplier - normalizedDeltaFromThreshold;
}
}
/* ====== Decompression ====== */
typedef struct {
U16 tableLog;
U16 fastMode;
} FSE_DTableHeader; /* sizeof U32 */
typedef struct
{
unsigned short newState;
unsigned char symbol;
unsigned char nbBits;
} FSE_decode_t; /* size == U32 */
MEM_STATIC void FSE_initDState(FSE_DState_t* DStatePtr, BIT_DStream_t* bitD, const FSE_DTable* dt)
{
const void* ptr = dt;
const FSE_DTableHeader* const DTableH = (const FSE_DTableHeader*)ptr;
DStatePtr->state = BIT_readBits(bitD, DTableH->tableLog);
BIT_reloadDStream(bitD);
DStatePtr->table = dt + 1;
}
MEM_STATIC BYTE FSE_peekSymbol(const FSE_DState_t* DStatePtr)
{
FSE_decode_t const DInfo = ((const FSE_decode_t*)(DStatePtr->table))[DStatePtr->state];
return DInfo.symbol;
}
MEM_STATIC void FSE_updateState(FSE_DState_t* DStatePtr, BIT_DStream_t* bitD)
{
FSE_decode_t const DInfo = ((const FSE_decode_t*)(DStatePtr->table))[DStatePtr->state];
U32 const nbBits = DInfo.nbBits;
size_t const lowBits = BIT_readBits(bitD, nbBits);
DStatePtr->state = DInfo.newState + lowBits;
}
MEM_STATIC BYTE FSE_decodeSymbol(FSE_DState_t* DStatePtr, BIT_DStream_t* bitD)
{
FSE_decode_t const DInfo = ((const FSE_decode_t*)(DStatePtr->table))[DStatePtr->state];
U32 const nbBits = DInfo.nbBits;
BYTE const symbol = DInfo.symbol;
size_t const lowBits = BIT_readBits(bitD, nbBits);
DStatePtr->state = DInfo.newState + lowBits;
return symbol;
}
/*! FSE_decodeSymbolFast() :
unsafe, only works if no symbol has a probability > 50% */
MEM_STATIC BYTE FSE_decodeSymbolFast(FSE_DState_t* DStatePtr, BIT_DStream_t* bitD)
{
FSE_decode_t const DInfo = ((const FSE_decode_t*)(DStatePtr->table))[DStatePtr->state];
U32 const nbBits = DInfo.nbBits;
BYTE const symbol = DInfo.symbol;
size_t const lowBits = BIT_readBitsFast(bitD, nbBits);
DStatePtr->state = DInfo.newState + lowBits;
return symbol;
}
MEM_STATIC unsigned FSE_endOfDState(const FSE_DState_t* DStatePtr)
{
return DStatePtr->state == 0;
}
#ifndef FSE_COMMONDEFS_ONLY
/* **************************************************************
* Tuning parameters
****************************************************************/
/*!MEMORY_USAGE :
* Memory usage formula : N->2^N Bytes (examples : 10 -> 1KB; 12 -> 4KB ; 16 -> 64KB; 20 -> 1MB; etc.)
* Increasing memory usage improves compression ratio
* Reduced memory usage can improve speed, due to cache effect
* Recommended max value is 14, for 16KB, which nicely fits into Intel x86 L1 cache */
#ifndef FSE_MAX_MEMORY_USAGE
# define FSE_MAX_MEMORY_USAGE 14
#endif
#ifndef FSE_DEFAULT_MEMORY_USAGE
# define FSE_DEFAULT_MEMORY_USAGE 13
#endif
#if (FSE_DEFAULT_MEMORY_USAGE > FSE_MAX_MEMORY_USAGE)
# error "FSE_DEFAULT_MEMORY_USAGE must be <= FSE_MAX_MEMORY_USAGE"
#endif
/*!FSE_MAX_SYMBOL_VALUE :
* Maximum symbol value authorized.
* Required for proper stack allocation */
#ifndef FSE_MAX_SYMBOL_VALUE
# define FSE_MAX_SYMBOL_VALUE 255
#endif
/* **************************************************************
* template functions type & suffix
****************************************************************/
#define FSE_FUNCTION_TYPE BYTE
#define FSE_FUNCTION_EXTENSION
#define FSE_DECODE_TYPE FSE_decode_t
#endif /* !FSE_COMMONDEFS_ONLY */
/* ***************************************************************
* Constants
*****************************************************************/
#define FSE_MAX_TABLELOG (FSE_MAX_MEMORY_USAGE-2)
#define FSE_MAX_TABLESIZE (1U<<FSE_MAX_TABLELOG)
#define FSE_MAXTABLESIZE_MASK (FSE_MAX_TABLESIZE-1)
#define FSE_DEFAULT_TABLELOG (FSE_DEFAULT_MEMORY_USAGE-2)
#define FSE_MIN_TABLELOG 5
#define FSE_TABLELOG_ABSOLUTE_MAX 15
#if FSE_MAX_TABLELOG > FSE_TABLELOG_ABSOLUTE_MAX
# error "FSE_MAX_TABLELOG > FSE_TABLELOG_ABSOLUTE_MAX is not supported"
#endif
#define FSE_TABLESTEP(tableSize) (((tableSize)>>1) + ((tableSize)>>3) + 3)
#endif /* FSE_STATIC_LINKING_ONLY */
#if defined (__cplusplus)
}
#endif

456
src/bled/fse_bitstream.h Normal file
View file

@ -0,0 +1,456 @@
/* ******************************************************************
* bitstream
* Part of FSE library
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* You can contact the author at :
* - Source repository : https://github.com/Cyan4973/FiniteStateEntropy
*
* This source code is licensed under both the BSD-style license (found in the
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
* in the COPYING file in the root directory of this source tree).
* You may select, at your option, one of the above-listed licenses.
****************************************************************** */
#ifndef BITSTREAM_H_MODULE
#define BITSTREAM_H_MODULE
#if defined (__cplusplus)
extern "C" {
#endif
/*
* This API consists of small unitary functions, which must be inlined for best performance.
* Since link-time-optimization is not available for all compilers,
* these functions are defined into a .h to be included.
*/
/*-****************************************
* Dependencies
******************************************/
#include "zstd_mem.h" /* unaligned access routines */
#include "zstd_compiler.h" /* UNLIKELY() */
#include "zstd_error_private.h" /* error codes and messages */
#include "zstd_bits.h" /* ZSTD_highbit32 */
/*=========================================
* Target specific
=========================================*/
#ifndef ZSTD_NO_INTRINSICS
# if (defined(__BMI__) || defined(__BMI2__)) && defined(__GNUC__)
# include <immintrin.h> /* support for bextr (experimental)/bzhi */
# elif defined(__ICCARM__)
# include <intrinsics.h>
# endif
#endif
#define STREAM_ACCUMULATOR_MIN_32 25
#define STREAM_ACCUMULATOR_MIN_64 57
#define STREAM_ACCUMULATOR_MIN ((U32)(MEM_32bits() ? STREAM_ACCUMULATOR_MIN_32 : STREAM_ACCUMULATOR_MIN_64))
/*-******************************************
* bitStream encoding API (write forward)
********************************************/
/* bitStream can mix input from multiple sources.
* A critical property of these streams is that they encode and decode in **reverse** direction.
* So the first bit sequence you add will be the last to be read, like a LIFO stack.
*/
typedef struct {
size_t bitContainer;
unsigned bitPos;
char* startPtr;
char* ptr;
char* endPtr;
} BIT_CStream_t;
MEM_STATIC size_t BIT_initCStream(BIT_CStream_t* bitC, void* dstBuffer, size_t dstCapacity);
MEM_STATIC void BIT_addBits(BIT_CStream_t* bitC, size_t value, unsigned nbBits);
MEM_STATIC void BIT_flushBits(BIT_CStream_t* bitC);
MEM_STATIC size_t BIT_closeCStream(BIT_CStream_t* bitC);
/* Start with initCStream, providing the size of buffer to write into.
* bitStream will never write outside of this buffer.
* `dstCapacity` must be >= sizeof(bitD->bitContainer), otherwise @return will be an error code.
*
* bits are first added to a local register.
* Local register is size_t, hence 64-bits on 64-bits systems, or 32-bits on 32-bits systems.
* Writing data into memory is an explicit operation, performed by the flushBits function.
* Hence keep track how many bits are potentially stored into local register to avoid register overflow.
* After a flushBits, a maximum of 7 bits might still be stored into local register.
*
* Avoid storing elements of more than 24 bits if you want compatibility with 32-bits bitstream readers.
*
* Last operation is to close the bitStream.
* The function returns the final size of CStream in bytes.
* If data couldn't fit into `dstBuffer`, it will return a 0 ( == not storable)
*/
/*-********************************************
* bitStream decoding API (read backward)
**********************************************/
typedef size_t BitContainerType;
typedef struct {
BitContainerType bitContainer;
unsigned bitsConsumed;
const char* ptr;
const char* start;
const char* limitPtr;
} BIT_DStream_t;
typedef enum { BIT_DStream_unfinished = 0, /* fully refilled */
BIT_DStream_endOfBuffer = 1, /* still some bits left in bitstream */
BIT_DStream_completed = 2, /* bitstream entirely consumed, bit-exact */
BIT_DStream_overflow = 3 /* user requested more bits than present in bitstream */
} BIT_DStream_status; /* result of BIT_reloadDStream() */
MEM_STATIC size_t BIT_initDStream(BIT_DStream_t* bitD, const void* srcBuffer, size_t srcSize);
MEM_STATIC size_t BIT_readBits(BIT_DStream_t* bitD, unsigned nbBits);
MEM_STATIC BIT_DStream_status BIT_reloadDStream(BIT_DStream_t* bitD);
MEM_STATIC unsigned BIT_endOfDStream(const BIT_DStream_t* bitD);
/* Start by invoking BIT_initDStream().
* A chunk of the bitStream is then stored into a local register.
* Local register size is 64-bits on 64-bits systems, 32-bits on 32-bits systems (BitContainerType).
* You can then retrieve bitFields stored into the local register, **in reverse order**.
* Local register is explicitly reloaded from memory by the BIT_reloadDStream() method.
* A reload guarantee a minimum of ((8*sizeof(bitD->bitContainer))-7) bits when its result is BIT_DStream_unfinished.
* Otherwise, it can be less than that, so proceed accordingly.
* Checking if DStream has reached its end can be performed with BIT_endOfDStream().
*/
/*-****************************************
* unsafe API
******************************************/
MEM_STATIC void BIT_addBitsFast(BIT_CStream_t* bitC, size_t value, unsigned nbBits);
/* faster, but works only if value is "clean", meaning all high bits above nbBits are 0 */
MEM_STATIC void BIT_flushBitsFast(BIT_CStream_t* bitC);
/* unsafe version; does not check buffer overflow */
MEM_STATIC size_t BIT_readBitsFast(BIT_DStream_t* bitD, unsigned nbBits);
/* faster, but works only if nbBits >= 1 */
/*===== Local Constants =====*/
static const unsigned BIT_mask[] = {
0, 1, 3, 7, 0xF, 0x1F,
0x3F, 0x7F, 0xFF, 0x1FF, 0x3FF, 0x7FF,
0xFFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF, 0x1FFFF,
0x3FFFF, 0x7FFFF, 0xFFFFF, 0x1FFFFF, 0x3FFFFF, 0x7FFFFF,
0xFFFFFF, 0x1FFFFFF, 0x3FFFFFF, 0x7FFFFFF, 0xFFFFFFF, 0x1FFFFFFF,
0x3FFFFFFF, 0x7FFFFFFF}; /* up to 31 bits */
#define BIT_MASK_SIZE (sizeof(BIT_mask) / sizeof(BIT_mask[0]))
/*-**************************************************************
* bitStream encoding
****************************************************************/
/*! BIT_initCStream() :
* `dstCapacity` must be > sizeof(size_t)
* @return : 0 if success,
* otherwise an error code (can be tested using ERR_isError()) */
MEM_STATIC size_t BIT_initCStream(BIT_CStream_t* bitC,
void* startPtr, size_t dstCapacity)
{
bitC->bitContainer = 0;
bitC->bitPos = 0;
bitC->startPtr = (char*)startPtr;
bitC->ptr = bitC->startPtr;
bitC->endPtr = bitC->startPtr + dstCapacity - sizeof(bitC->bitContainer);
if (dstCapacity <= sizeof(bitC->bitContainer)) return ERROR(dstSize_tooSmall);
return 0;
}
FORCE_INLINE_TEMPLATE size_t BIT_getLowerBits(size_t bitContainer, U32 const nbBits)
{
#if defined(STATIC_BMI2) && STATIC_BMI2 == 1 && !defined(ZSTD_NO_INTRINSICS)
return _bzhi_u64(bitContainer, nbBits);
#else
assert(nbBits < BIT_MASK_SIZE);
return bitContainer & BIT_mask[nbBits];
#endif
}
/*! BIT_addBits() :
* can add up to 31 bits into `bitC`.
* Note : does not check for register overflow ! */
MEM_STATIC void BIT_addBits(BIT_CStream_t* bitC,
size_t value, unsigned nbBits)
{
DEBUG_STATIC_ASSERT(BIT_MASK_SIZE == 32);
assert(nbBits < BIT_MASK_SIZE);
assert(nbBits + bitC->bitPos < sizeof(bitC->bitContainer) * 8);
bitC->bitContainer |= BIT_getLowerBits(value, nbBits) << bitC->bitPos;
bitC->bitPos += nbBits;
}
/*! BIT_addBitsFast() :
* works only if `value` is _clean_,
* meaning all high bits above nbBits are 0 */
MEM_STATIC void BIT_addBitsFast(BIT_CStream_t* bitC,
size_t value, unsigned nbBits)
{
assert((value>>nbBits) == 0);
assert(nbBits + bitC->bitPos < sizeof(bitC->bitContainer) * 8);
bitC->bitContainer |= value << bitC->bitPos;
bitC->bitPos += nbBits;
}
/*! BIT_flushBitsFast() :
* assumption : bitContainer has not overflowed
* unsafe version; does not check buffer overflow */
MEM_STATIC void BIT_flushBitsFast(BIT_CStream_t* bitC)
{
size_t const nbBytes = bitC->bitPos >> 3;
assert(bitC->bitPos < sizeof(bitC->bitContainer) * 8);
assert(bitC->ptr <= bitC->endPtr);
MEM_writeLEST(bitC->ptr, bitC->bitContainer);
bitC->ptr += nbBytes;
bitC->bitPos &= 7;
bitC->bitContainer >>= nbBytes*8;
}
/*! BIT_flushBits() :
* assumption : bitContainer has not overflowed
* safe version; check for buffer overflow, and prevents it.
* note : does not signal buffer overflow.
* overflow will be revealed later on using BIT_closeCStream() */
MEM_STATIC void BIT_flushBits(BIT_CStream_t* bitC)
{
size_t const nbBytes = bitC->bitPos >> 3;
assert(bitC->bitPos < sizeof(bitC->bitContainer) * 8);
assert(bitC->ptr <= bitC->endPtr);
MEM_writeLEST(bitC->ptr, bitC->bitContainer);
bitC->ptr += nbBytes;
if (bitC->ptr > bitC->endPtr) bitC->ptr = bitC->endPtr;
bitC->bitPos &= 7;
bitC->bitContainer >>= nbBytes*8;
}
/*! BIT_closeCStream() :
* @return : size of CStream, in bytes,
* or 0 if it could not fit into dstBuffer */
MEM_STATIC size_t BIT_closeCStream(BIT_CStream_t* bitC)
{
BIT_addBitsFast(bitC, 1, 1); /* endMark */
BIT_flushBits(bitC);
if (bitC->ptr >= bitC->endPtr) return 0; /* overflow detected */
return (bitC->ptr - bitC->startPtr) + (bitC->bitPos > 0);
}
/*-********************************************************
* bitStream decoding
**********************************************************/
/*! BIT_initDStream() :
* Initialize a BIT_DStream_t.
* `bitD` : a pointer to an already allocated BIT_DStream_t structure.
* `srcSize` must be the *exact* size of the bitStream, in bytes.
* @return : size of stream (== srcSize), or an errorCode if a problem is detected
*/
MEM_STATIC size_t BIT_initDStream(BIT_DStream_t* bitD, const void* srcBuffer, size_t srcSize)
{
if (srcSize < 1) { ZSTD_memset(bitD, 0, sizeof(*bitD)); return ERROR(srcSize_wrong); }
bitD->start = (const char*)srcBuffer;
bitD->limitPtr = bitD->start + sizeof(bitD->bitContainer);
if (srcSize >= sizeof(bitD->bitContainer)) { /* normal case */
bitD->ptr = (const char*)srcBuffer + srcSize - sizeof(bitD->bitContainer);
bitD->bitContainer = MEM_readLEST(bitD->ptr);
{ BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0; /* ensures bitsConsumed is always set */
if (lastByte == 0) return ERROR(GENERIC); /* endMark not present */ }
} else {
bitD->ptr = bitD->start;
bitD->bitContainer = *(const BYTE*)(bitD->start);
switch(srcSize)
{
case 7: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[6]) << (sizeof(bitD->bitContainer)*8 - 16);
ZSTD_FALLTHROUGH;
case 6: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[5]) << (sizeof(bitD->bitContainer)*8 - 24);
ZSTD_FALLTHROUGH;
case 5: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[4]) << (sizeof(bitD->bitContainer)*8 - 32);
ZSTD_FALLTHROUGH;
case 4: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[3]) << 24;
ZSTD_FALLTHROUGH;
case 3: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[2]) << 16;
ZSTD_FALLTHROUGH;
case 2: bitD->bitContainer += (BitContainerType)(((const BYTE*)(srcBuffer))[1]) << 8;
ZSTD_FALLTHROUGH;
default: break;
}
{ BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1];
bitD->bitsConsumed = lastByte ? 8 - ZSTD_highbit32(lastByte) : 0;
if (lastByte == 0) return ERROR(corruption_detected); /* endMark not present */
}
bitD->bitsConsumed += (U32)(sizeof(bitD->bitContainer) - srcSize)*8;
}
return srcSize;
}
FORCE_INLINE_TEMPLATE size_t BIT_getUpperBits(BitContainerType bitContainer, U32 const start)
{
return bitContainer >> start;
}
FORCE_INLINE_TEMPLATE size_t BIT_getMiddleBits(BitContainerType bitContainer, U32 const start, U32 const nbBits)
{
U32 const regMask = sizeof(bitContainer)*8 - 1;
/* if start > regMask, bitstream is corrupted, and result is undefined */
assert(nbBits < BIT_MASK_SIZE);
/* x86 transform & ((1 << nbBits) - 1) to bzhi instruction, it is better
* than accessing memory. When bmi2 instruction is not present, we consider
* such cpus old (pre-Haswell, 2013) and their performance is not of that
* importance.
*/
#if defined(__x86_64__) || defined(_M_X64)
return (bitContainer >> (start & regMask)) & ((((U64)1) << nbBits) - 1);
#else
return (bitContainer >> (start & regMask)) & BIT_mask[nbBits];
#endif
}
/*! BIT_lookBits() :
* Provides next n bits from local register.
* local register is not modified.
* On 32-bits, maxNbBits==24.
* On 64-bits, maxNbBits==56.
* @return : value extracted */
FORCE_INLINE_TEMPLATE size_t BIT_lookBits(const BIT_DStream_t* bitD, U32 nbBits)
{
/* arbitrate between double-shift and shift+mask */
#if 1
/* if bitD->bitsConsumed + nbBits > sizeof(bitD->bitContainer)*8,
* bitstream is likely corrupted, and result is undefined */
return BIT_getMiddleBits(bitD->bitContainer, (sizeof(bitD->bitContainer)*8) - bitD->bitsConsumed - nbBits, nbBits);
#else
/* this code path is slower on my os-x laptop */
U32 const regMask = sizeof(bitD->bitContainer)*8 - 1;
return ((bitD->bitContainer << (bitD->bitsConsumed & regMask)) >> 1) >> ((regMask-nbBits) & regMask);
#endif
}
/*! BIT_lookBitsFast() :
* unsafe version; only works if nbBits >= 1 */
MEM_STATIC size_t BIT_lookBitsFast(const BIT_DStream_t* bitD, U32 nbBits)
{
U32 const regMask = sizeof(bitD->bitContainer)*8 - 1;
assert(nbBits >= 1);
return (bitD->bitContainer << (bitD->bitsConsumed & regMask)) >> (((regMask+1)-nbBits) & regMask);
}
FORCE_INLINE_TEMPLATE void BIT_skipBits(BIT_DStream_t* bitD, U32 nbBits)
{
bitD->bitsConsumed += nbBits;
}
/*! BIT_readBits() :
* Read (consume) next n bits from local register and update.
* Pay attention to not read more than nbBits contained into local register.
* @return : extracted value. */
FORCE_INLINE_TEMPLATE size_t BIT_readBits(BIT_DStream_t* bitD, unsigned nbBits)
{
size_t const value = BIT_lookBits(bitD, nbBits);
BIT_skipBits(bitD, nbBits);
return value;
}
/*! BIT_readBitsFast() :
* unsafe version; only works if nbBits >= 1 */
MEM_STATIC size_t BIT_readBitsFast(BIT_DStream_t* bitD, unsigned nbBits)
{
size_t const value = BIT_lookBitsFast(bitD, nbBits);
assert(nbBits >= 1);
BIT_skipBits(bitD, nbBits);
return value;
}
/*! BIT_reloadDStream_internal() :
* Simple variant of BIT_reloadDStream(), with two conditions:
* 1. bitstream is valid : bitsConsumed <= sizeof(bitD->bitContainer)*8
* 2. look window is valid after shifted down : bitD->ptr >= bitD->start
*/
MEM_STATIC BIT_DStream_status BIT_reloadDStream_internal(BIT_DStream_t* bitD)
{
assert(bitD->bitsConsumed <= sizeof(bitD->bitContainer)*8);
bitD->ptr -= bitD->bitsConsumed >> 3;
assert(bitD->ptr >= bitD->start);
bitD->bitsConsumed &= 7;
bitD->bitContainer = MEM_readLEST(bitD->ptr);
return BIT_DStream_unfinished;
}
/*! BIT_reloadDStreamFast() :
* Similar to BIT_reloadDStream(), but with two differences:
* 1. bitsConsumed <= sizeof(bitD->bitContainer)*8 must hold!
* 2. Returns BIT_DStream_overflow when bitD->ptr < bitD->limitPtr, at this
* point you must use BIT_reloadDStream() to reload.
*/
MEM_STATIC BIT_DStream_status BIT_reloadDStreamFast(BIT_DStream_t* bitD)
{
if (UNLIKELY(bitD->ptr < bitD->limitPtr))
return BIT_DStream_overflow;
return BIT_reloadDStream_internal(bitD);
}
/*! BIT_reloadDStream() :
* Refill `bitD` from buffer previously set in BIT_initDStream() .
* This function is safe, it guarantees it will not never beyond src buffer.
* @return : status of `BIT_DStream_t` internal register.
* when status == BIT_DStream_unfinished, internal register is filled with at least 25 or 57 bits */
FORCE_INLINE_TEMPLATE BIT_DStream_status BIT_reloadDStream(BIT_DStream_t* bitD)
{
/* note : once in overflow mode, a bitstream remains in this mode until it's reset */
if (UNLIKELY(bitD->bitsConsumed > (sizeof(bitD->bitContainer)*8))) {
static const BitContainerType zeroFilled = 0;
bitD->ptr = (const char*)&zeroFilled; /* aliasing is allowed for char */
/* overflow detected, erroneous scenario or end of stream: no update */
return BIT_DStream_overflow;
}
assert(bitD->ptr >= bitD->start);
if (bitD->ptr >= bitD->limitPtr) {
return BIT_reloadDStream_internal(bitD);
}
if (bitD->ptr == bitD->start) {
/* reached end of bitStream => no update */
if (bitD->bitsConsumed < sizeof(bitD->bitContainer)*8) return BIT_DStream_endOfBuffer;
return BIT_DStream_completed;
}
/* start < ptr < limitPtr => cautious update */
{ U32 nbBytes = bitD->bitsConsumed >> 3;
BIT_DStream_status result = BIT_DStream_unfinished;
if (bitD->ptr - nbBytes < bitD->start) {
nbBytes = (U32)(bitD->ptr - bitD->start); /* ptr > start */
result = BIT_DStream_endOfBuffer;
}
bitD->ptr -= nbBytes;
bitD->bitsConsumed -= nbBytes*8;
bitD->bitContainer = MEM_readLEST(bitD->ptr); /* reminder : srcSize > sizeof(bitD->bitContainer), otherwise bitD->ptr == bitD->start */
return result;
}
}
/*! BIT_endOfDStream() :
* @return : 1 if DStream has _exactly_ reached its end (all bits consumed).
*/
MEM_STATIC unsigned BIT_endOfDStream(const BIT_DStream_t* DStream)
{
return ((DStream->ptr == DStream->start) && (DStream->bitsConsumed == sizeof(DStream->bitContainer)*8));
}
#if defined (__cplusplus)
}
#endif
#endif /* BITSTREAM_H_MODULE */

314
src/bled/fse_decompress.c Normal file
View file

@ -0,0 +1,314 @@
/* ******************************************************************
* FSE : Finite State Entropy decoder
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* You can contact the author at :
* - FSE source repository : https://github.com/Cyan4973/FiniteStateEntropy
* - Public forum : https://groups.google.com/forum/#!forum/lz4c
*
* This source code is licensed under both the BSD-style license (found in the
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
* in the COPYING file in the root directory of this source tree).
* You may select, at your option, one of the above-listed licenses.
****************************************************************** */
/* **************************************************************
* Includes
****************************************************************/
#include "fse_bitstream.h"
#include "zstd_compiler.h"
#define FSE_STATIC_LINKING_ONLY
#include "fse.h"
#include "zstd_error_private.h"
#include "zstd_deps.h" /* ZSTD_memcpy */
#include "zstd_bits.h" /* ZSTD_highbit32 */
/* **************************************************************
* Error Management
****************************************************************/
#define FSE_isError ERR_isError
#define FSE_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c) /* use only *after* variable declarations */
/* **************************************************************
* Templates
****************************************************************/
/*
designed to be included
for type-specific functions (template emulation in C)
Objective is to write these functions only once, for improved maintenance
*/
/* safety checks */
#ifndef FSE_FUNCTION_EXTENSION
# error "FSE_FUNCTION_EXTENSION must be defined"
#endif
#ifndef FSE_FUNCTION_TYPE
# error "FSE_FUNCTION_TYPE must be defined"
#endif
/* Function names */
#define FSE_CAT(X,Y) X##Y
#define FSE_FUNCTION_NAME(X,Y) FSE_CAT(X,Y)
#define FSE_TYPE_NAME(X,Y) FSE_CAT(X,Y)
static size_t FSE_buildDTable_internal(FSE_DTable* dt, const short* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog, void* workSpace, size_t wkspSize)
{
void* const tdPtr = dt+1; /* because *dt is unsigned, 32-bits aligned on 32-bits */
FSE_DECODE_TYPE* const tableDecode = (FSE_DECODE_TYPE*) (tdPtr);
U16* symbolNext = (U16*)workSpace;
BYTE* spread = (BYTE*)(symbolNext + maxSymbolValue + 1);
U32 const maxSV1 = maxSymbolValue + 1;
U32 const tableSize = 1 << tableLog;
U32 highThreshold = tableSize-1;
/* Sanity Checks */
if (FSE_BUILD_DTABLE_WKSP_SIZE(tableLog, maxSymbolValue) > wkspSize) return ERROR(maxSymbolValue_tooLarge);
if (maxSymbolValue > FSE_MAX_SYMBOL_VALUE) return ERROR(maxSymbolValue_tooLarge);
if (tableLog > FSE_MAX_TABLELOG) return ERROR(tableLog_tooLarge);
/* Init, lay down lowprob symbols */
{ FSE_DTableHeader DTableH;
DTableH.tableLog = (U16)tableLog;
DTableH.fastMode = 1;
{ S16 const largeLimit= (S16)(1 << (tableLog-1));
U32 s;
for (s=0; s<maxSV1; s++) {
if (normalizedCounter[s]==-1) {
tableDecode[highThreshold--].symbol = (FSE_FUNCTION_TYPE)s;
symbolNext[s] = 1;
} else {
if (normalizedCounter[s] >= largeLimit) DTableH.fastMode=0;
symbolNext[s] = (U16)normalizedCounter[s];
} } }
ZSTD_memcpy(dt, &DTableH, sizeof(DTableH));
}
/* Spread symbols */
if (highThreshold == tableSize - 1) {
size_t const tableMask = tableSize-1;
size_t const step = FSE_TABLESTEP(tableSize);
/* First lay down the symbols in order.
* We use a uint64_t to lay down 8 bytes at a time. This reduces branch
* misses since small blocks generally have small table logs, so nearly
* all symbols have counts <= 8. We ensure we have 8 bytes at the end of
* our buffer to handle the over-write.
*/
{ U64 const add = 0x0101010101010101ull;
size_t pos = 0;
U64 sv = 0;
U32 s;
for (s=0; s<maxSV1; ++s, sv += add) {
int i;
int const n = normalizedCounter[s];
MEM_write64(spread + pos, sv);
for (i = 8; i < n; i += 8) {
MEM_write64(spread + pos + i, sv);
}
pos += (size_t)n;
} }
/* Now we spread those positions across the table.
* The benefit of doing it in two stages is that we avoid the
* variable size inner loop, which caused lots of branch misses.
* Now we can run through all the positions without any branch misses.
* We unroll the loop twice, since that is what empirically worked best.
*/
{
size_t position = 0;
size_t s;
size_t const unroll = 2;
assert(tableSize % unroll == 0); /* FSE_MIN_TABLELOG is 5 */
for (s = 0; s < (size_t)tableSize; s += unroll) {
size_t u;
for (u = 0; u < unroll; ++u) {
size_t const uPosition = (position + (u * step)) & tableMask;
tableDecode[uPosition].symbol = spread[s + u];
}
position = (position + (unroll * step)) & tableMask;
}
assert(position == 0);
}
} else {
U32 const tableMask = tableSize-1;
U32 const step = FSE_TABLESTEP(tableSize);
U32 s, position = 0;
for (s=0; s<maxSV1; s++) {
int i;
for (i=0; i<normalizedCounter[s]; i++) {
tableDecode[position].symbol = (FSE_FUNCTION_TYPE)s;
position = (position + step) & tableMask;
while (position > highThreshold) position = (position + step) & tableMask; /* lowprob area */
} }
if (position!=0) return ERROR(GENERIC); /* position must reach all cells once, otherwise normalizedCounter is incorrect */
}
/* Build Decoding table */
{ U32 u;
for (u=0; u<tableSize; u++) {
FSE_FUNCTION_TYPE const symbol = (FSE_FUNCTION_TYPE)(tableDecode[u].symbol);
U32 const nextState = symbolNext[symbol]++;
tableDecode[u].nbBits = (BYTE) (tableLog - ZSTD_highbit32(nextState) );
tableDecode[u].newState = (U16) ( (nextState << tableDecode[u].nbBits) - tableSize);
} }
return 0;
}
size_t FSE_buildDTable_wksp(FSE_DTable* dt, const short* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog, void* workSpace, size_t wkspSize)
{
return FSE_buildDTable_internal(dt, normalizedCounter, maxSymbolValue, tableLog, workSpace, wkspSize);
}
#ifndef FSE_COMMONDEFS_ONLY
/*-*******************************************************
* Decompression (Byte symbols)
*********************************************************/
FORCE_INLINE_TEMPLATE size_t FSE_decompress_usingDTable_generic(
void* dst, size_t maxDstSize,
const void* cSrc, size_t cSrcSize,
const FSE_DTable* dt, const unsigned fast)
{
BYTE* const ostart = (BYTE*) dst;
BYTE* op = ostart;
BYTE* const omax = op + maxDstSize;
BYTE* const olimit = omax-3;
BIT_DStream_t bitD;
FSE_DState_t state1;
FSE_DState_t state2;
/* Init */
CHECK_F(BIT_initDStream(&bitD, cSrc, cSrcSize));
FSE_initDState(&state1, &bitD, dt);
FSE_initDState(&state2, &bitD, dt);
RETURN_ERROR_IF(BIT_reloadDStream(&bitD)==BIT_DStream_overflow, corruption_detected, "");
#define FSE_GETSYMBOL(statePtr) fast ? FSE_decodeSymbolFast(statePtr, &bitD) : FSE_decodeSymbol(statePtr, &bitD)
/* 4 symbols per loop */
for ( ; (BIT_reloadDStream(&bitD)==BIT_DStream_unfinished) & (op<olimit) ; op+=4) {
op[0] = FSE_GETSYMBOL(&state1);
if (FSE_MAX_TABLELOG*2+7 > sizeof(bitD.bitContainer)*8) /* This test must be static */
BIT_reloadDStream(&bitD);
op[1] = FSE_GETSYMBOL(&state2);
if (FSE_MAX_TABLELOG*4+7 > sizeof(bitD.bitContainer)*8) /* This test must be static */
{ if (BIT_reloadDStream(&bitD) > BIT_DStream_unfinished) { op+=2; break; } }
op[2] = FSE_GETSYMBOL(&state1);
if (FSE_MAX_TABLELOG*2+7 > sizeof(bitD.bitContainer)*8) /* This test must be static */
BIT_reloadDStream(&bitD);
op[3] = FSE_GETSYMBOL(&state2);
}
/* tail */
/* note : BIT_reloadDStream(&bitD) >= FSE_DStream_partiallyFilled; Ends at exactly BIT_DStream_completed */
while (1) {
if (op>(omax-2)) return ERROR(dstSize_tooSmall);
*op++ = FSE_GETSYMBOL(&state1);
if (BIT_reloadDStream(&bitD)==BIT_DStream_overflow) {
*op++ = FSE_GETSYMBOL(&state2);
break;
}
if (op>(omax-2)) return ERROR(dstSize_tooSmall);
*op++ = FSE_GETSYMBOL(&state2);
if (BIT_reloadDStream(&bitD)==BIT_DStream_overflow) {
*op++ = FSE_GETSYMBOL(&state1);
break;
} }
assert(op >= ostart);
return (size_t)(op-ostart);
}
typedef struct {
short ncount[FSE_MAX_SYMBOL_VALUE + 1];
} FSE_DecompressWksp;
FORCE_INLINE_TEMPLATE size_t FSE_decompress_wksp_body(
void* dst, size_t dstCapacity,
const void* cSrc, size_t cSrcSize,
unsigned maxLog, void* workSpace, size_t wkspSize,
int bmi2)
{
const BYTE* const istart = (const BYTE*)cSrc;
const BYTE* ip = istart;
unsigned tableLog;
unsigned maxSymbolValue = FSE_MAX_SYMBOL_VALUE;
FSE_DecompressWksp* const wksp = (FSE_DecompressWksp*)workSpace;
size_t const dtablePos = sizeof(FSE_DecompressWksp) / sizeof(FSE_DTable);
FSE_DTable* const dtable = (FSE_DTable*)workSpace + dtablePos;
FSE_STATIC_ASSERT((FSE_MAX_SYMBOL_VALUE + 1) % 2 == 0);
if (wkspSize < sizeof(*wksp)) return ERROR(GENERIC);
/* correct offset to dtable depends on this property */
FSE_STATIC_ASSERT(sizeof(FSE_DecompressWksp) % sizeof(FSE_DTable) == 0);
/* normal FSE decoding mode */
{ size_t const NCountLength =
FSE_readNCount_bmi2(wksp->ncount, &maxSymbolValue, &tableLog, istart, cSrcSize, bmi2);
if (FSE_isError(NCountLength)) return NCountLength;
if (tableLog > maxLog) return ERROR(tableLog_tooLarge);
assert(NCountLength <= cSrcSize);
ip += NCountLength;
cSrcSize -= NCountLength;
}
if (FSE_DECOMPRESS_WKSP_SIZE(tableLog, maxSymbolValue) > wkspSize) return ERROR(tableLog_tooLarge);
assert(sizeof(*wksp) + FSE_DTABLE_SIZE(tableLog) <= wkspSize);
workSpace = (BYTE*)workSpace + sizeof(*wksp) + FSE_DTABLE_SIZE(tableLog);
wkspSize -= sizeof(*wksp) + FSE_DTABLE_SIZE(tableLog);
CHECK_F( FSE_buildDTable_internal(dtable, wksp->ncount, maxSymbolValue, tableLog, workSpace, wkspSize) );
{
const void* ptr = dtable;
const FSE_DTableHeader* DTableH = (const FSE_DTableHeader*)ptr;
const U32 fastMode = DTableH->fastMode;
/* select fast mode (static) */
if (fastMode) return FSE_decompress_usingDTable_generic(dst, dstCapacity, ip, cSrcSize, dtable, 1);
return FSE_decompress_usingDTable_generic(dst, dstCapacity, ip, cSrcSize, dtable, 0);
}
}
/* Avoids the FORCE_INLINE of the _body() function. */
static size_t FSE_decompress_wksp_body_default(void* dst, size_t dstCapacity, const void* cSrc, size_t cSrcSize, unsigned maxLog, void* workSpace, size_t wkspSize)
{
return FSE_decompress_wksp_body(dst, dstCapacity, cSrc, cSrcSize, maxLog, workSpace, wkspSize, 0);
}
#if DYNAMIC_BMI2
BMI2_TARGET_ATTRIBUTE static size_t FSE_decompress_wksp_body_bmi2(void* dst, size_t dstCapacity, const void* cSrc, size_t cSrcSize, unsigned maxLog, void* workSpace, size_t wkspSize)
{
return FSE_decompress_wksp_body(dst, dstCapacity, cSrc, cSrcSize, maxLog, workSpace, wkspSize, 1);
}
#endif
size_t FSE_decompress_wksp_bmi2(void* dst, size_t dstCapacity, const void* cSrc, size_t cSrcSize, unsigned maxLog, void* workSpace, size_t wkspSize, int bmi2)
{
#if DYNAMIC_BMI2
if (bmi2) {
return FSE_decompress_wksp_body_bmi2(dst, dstCapacity, cSrc, cSrcSize, maxLog, workSpace, wkspSize);
}
#endif
(void)bmi2;
return FSE_decompress_wksp_body_default(dst, dstCapacity, cSrc, cSrcSize, maxLog, workSpace, wkspSize);
}
#endif /* FSE_COMMONDEFS_ONLY */

View file

@ -11,7 +11,6 @@ void FAST_FUNC header_verbose_list(const file_header_t *file_header)
struct tm *ptm = &tm_time; //localtime(&file_header->mtime);
#if ENABLE_FEATURE_TAR_UNAME_GNAME
char modestr[12];
char uid[sizeof(int)*3 + 2];
/*char gid[sizeof(int)*3 + 2];*/
char *user;
@ -29,8 +28,8 @@ void FAST_FUNC header_verbose_list(const file_header_t *file_header)
/*sprintf(gid, "%u", (unsigned)file_header->gid);*/
group = utoa(file_header->gid);
}
printf("%s %s/%s %9"OFF_FMT"u %4u-%02u-%02u %02u:%02u:%02u %s",
bb_mode_string(modestr, file_header->mode),
printf("%u %s/%s %9"OFF_FMT"u %4u-%02u-%02u %02u:%02u:%02u %s",
file_header->mode,
user,
group,
file_header->size,
@ -46,8 +45,8 @@ void FAST_FUNC header_verbose_list(const file_header_t *file_header)
localtime_r(&file_header->mtime, ptm);
printf("%s %u/%u %9"OFF_FMT"u %4u-%02u-%02u %02u:%02u:%02u %s",
bb_mode_string(modestr, file_header->mode),
printf("%u %u/%u %9"OFF_FMT"u %4u-%02u-%02u %02u:%02u:%02u %s",
file_header->mode,
(unsigned)file_header->uid,
(unsigned)file_header->gid,
file_header->size,

286
src/bled/huf.h Normal file
View file

@ -0,0 +1,286 @@
/* ******************************************************************
* huff0 huffman codec,
* part of Finite State Entropy library
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* You can contact the author at :
* - Source repository : https://github.com/Cyan4973/FiniteStateEntropy
*
* This source code is licensed under both the BSD-style license (found in the
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
* in the COPYING file in the root directory of this source tree).
* You may select, at your option, one of the above-listed licenses.
****************************************************************** */
#if defined (__cplusplus)
extern "C" {
#endif
#ifndef HUF_H_298734234
#define HUF_H_298734234
/* *** Dependencies *** */
#include "zstd_deps.h" /* size_t */
#include "zstd_mem.h" /* U32 */
#define FSE_STATIC_LINKING_ONLY
#include "fse.h"
/* *** Tool functions *** */
#define HUF_BLOCKSIZE_MAX (128 * 1024) /**< maximum input size for a single block compressed with HUF_compress */
size_t HUF_compressBound(size_t size); /**< maximum compressed size (worst case) */
/* Error Management */
unsigned HUF_isError(size_t code); /**< tells if a return value is an error code */
const char* HUF_getErrorName(size_t code); /**< provides error code string (useful for debugging) */
#define HUF_WORKSPACE_SIZE ((8 << 10) + 512 /* sorting scratch space */)
#define HUF_WORKSPACE_SIZE_U64 (HUF_WORKSPACE_SIZE / sizeof(U64))
/* *** Constants *** */
#define HUF_TABLELOG_MAX 12 /* max runtime value of tableLog (due to static allocation); can be modified up to HUF_TABLELOG_ABSOLUTEMAX */
#define HUF_TABLELOG_DEFAULT 11 /* default tableLog value when none specified */
#define HUF_SYMBOLVALUE_MAX 255
#define HUF_TABLELOG_ABSOLUTEMAX 12 /* absolute limit of HUF_MAX_TABLELOG. Beyond that value, code does not work */
#if (HUF_TABLELOG_MAX > HUF_TABLELOG_ABSOLUTEMAX)
# error "HUF_TABLELOG_MAX is too large !"
#endif
/* ****************************************
* Static allocation
******************************************/
/* HUF buffer bounds */
#define HUF_CTABLEBOUND 129
#define HUF_BLOCKBOUND(size) (size + (size>>8) + 8) /* only true when incompressible is pre-filtered with fast heuristic */
#define HUF_COMPRESSBOUND(size) (HUF_CTABLEBOUND + HUF_BLOCKBOUND(size)) /* Macro version, useful for static allocation */
/* static allocation of HUF's Compression Table */
/* this is a private definition, just exposed for allocation and strict aliasing purpose. never EVER access its members directly */
typedef size_t HUF_CElt; /* consider it an incomplete type */
#define HUF_CTABLE_SIZE_ST(maxSymbolValue) ((maxSymbolValue)+2) /* Use tables of size_t, for proper alignment */
#define HUF_CTABLE_SIZE(maxSymbolValue) (HUF_CTABLE_SIZE_ST(maxSymbolValue) * sizeof(size_t))
#define HUF_CREATE_STATIC_CTABLE(name, maxSymbolValue) \
HUF_CElt name[HUF_CTABLE_SIZE_ST(maxSymbolValue)] /* no final ; */
/* static allocation of HUF's DTable */
typedef U32 HUF_DTable;
#define HUF_DTABLE_SIZE(maxTableLog) (1 + (1<<(maxTableLog)))
#define HUF_CREATE_STATIC_DTABLEX1(DTable, maxTableLog) \
HUF_DTable DTable[HUF_DTABLE_SIZE((maxTableLog)-1)] = { ((U32)((maxTableLog)-1) * 0x01000001) }
#define HUF_CREATE_STATIC_DTABLEX2(DTable, maxTableLog) \
HUF_DTable DTable[HUF_DTABLE_SIZE(maxTableLog)] = { ((U32)(maxTableLog) * 0x01000001) }
/* ****************************************
* Advanced decompression functions
******************************************/
/**
* Huffman flags bitset.
* For all flags, 0 is the default value.
*/
typedef enum {
/**
* If compiled with DYNAMIC_BMI2: Set flag only if the CPU supports BMI2 at runtime.
* Otherwise: Ignored.
*/
HUF_flags_bmi2 = (1 << 0),
/**
* If set: Test possible table depths to find the one that produces the smallest header + encoded size.
* If unset: Use heuristic to find the table depth.
*/
HUF_flags_optimalDepth = (1 << 1),
/**
* If set: If the previous table can encode the input, always reuse the previous table.
* If unset: If the previous table can encode the input, reuse the previous table if it results in a smaller output.
*/
HUF_flags_preferRepeat = (1 << 2),
/**
* If set: Sample the input and check if the sample is uncompressible, if it is then don't attempt to compress.
* If unset: Always histogram the entire input.
*/
HUF_flags_suspectUncompressible = (1 << 3),
/**
* If set: Don't use assembly implementations
* If unset: Allow using assembly implementations
*/
HUF_flags_disableAsm = (1 << 4),
/**
* If set: Don't use the fast decoding loop, always use the fallback decoding loop.
* If unset: Use the fast decoding loop when possible.
*/
HUF_flags_disableFast = (1 << 5)
} HUF_flags_e;
/* ****************************************
* HUF detailed API
* ****************************************/
#define HUF_OPTIMAL_DEPTH_THRESHOLD ZSTD_btultra
/*! HUF_compress() does the following:
* 1. count symbol occurrence from source[] into table count[] using FSE_count() (exposed within "fse.h")
* 2. (optional) refine tableLog using HUF_optimalTableLog()
* 3. build Huffman table from count using HUF_buildCTable()
* 4. save Huffman table to memory buffer using HUF_writeCTable()
* 5. encode the data stream using HUF_compress4X_usingCTable()
*
* The following API allows targeting specific sub-functions for advanced tasks.
* For example, it's possible to compress several blocks using the same 'CTable',
* or to save and regenerate 'CTable' using external methods.
*/
unsigned HUF_minTableLog(unsigned symbolCardinality);
unsigned HUF_cardinality(const unsigned* count, unsigned maxSymbolValue);
unsigned HUF_optimalTableLog(unsigned maxTableLog, size_t srcSize, unsigned maxSymbolValue, void* workSpace,
size_t wkspSize, HUF_CElt* table, const unsigned* count, int flags); /* table is used as scratch space for building and testing tables, not a return value */
size_t HUF_writeCTable_wksp(void* dst, size_t maxDstSize, const HUF_CElt* CTable, unsigned maxSymbolValue, unsigned huffLog, void* workspace, size_t workspaceSize);
size_t HUF_compress4X_usingCTable(void* dst, size_t dstSize, const void* src, size_t srcSize, const HUF_CElt* CTable, int flags);
size_t HUF_estimateCompressedSize(const HUF_CElt* CTable, const unsigned* count, unsigned maxSymbolValue);
int HUF_validateCTable(const HUF_CElt* CTable, const unsigned* count, unsigned maxSymbolValue);
typedef enum {
HUF_repeat_none, /**< Cannot use the previous table */
HUF_repeat_check, /**< Can use the previous table but it must be checked. Note : The previous table must have been constructed by HUF_compress{1, 4}X_repeat */
HUF_repeat_valid /**< Can use the previous table and it is assumed to be valid */
} HUF_repeat;
/** HUF_compress4X_repeat() :
* Same as HUF_compress4X_wksp(), but considers using hufTable if *repeat != HUF_repeat_none.
* If it uses hufTable it does not modify hufTable or repeat.
* If it doesn't, it sets *repeat = HUF_repeat_none, and it sets hufTable to the table used.
* If preferRepeat then the old table will always be used if valid.
* If suspectUncompressible then some sampling checks will be run to potentially skip huffman coding */
size_t HUF_compress4X_repeat(void* dst, size_t dstSize,
const void* src, size_t srcSize,
unsigned maxSymbolValue, unsigned tableLog,
void* workSpace, size_t wkspSize, /**< `workSpace` must be aligned on 4-bytes boundaries, `wkspSize` must be >= HUF_WORKSPACE_SIZE */
HUF_CElt* hufTable, HUF_repeat* repeat, int flags);
/** HUF_buildCTable_wksp() :
* Same as HUF_buildCTable(), but using externally allocated scratch buffer.
* `workSpace` must be aligned on 4-bytes boundaries, and its size must be >= HUF_CTABLE_WORKSPACE_SIZE.
*/
#define HUF_CTABLE_WORKSPACE_SIZE_U32 ((4 * (HUF_SYMBOLVALUE_MAX + 1)) + 192)
#define HUF_CTABLE_WORKSPACE_SIZE (HUF_CTABLE_WORKSPACE_SIZE_U32 * sizeof(unsigned))
size_t HUF_buildCTable_wksp (HUF_CElt* tree,
const unsigned* count, U32 maxSymbolValue, U32 maxNbBits,
void* workSpace, size_t wkspSize);
/*! HUF_readStats() :
* Read compact Huffman tree, saved by HUF_writeCTable().
* `huffWeight` is destination buffer.
* @return : size read from `src` , or an error Code .
* Note : Needed by HUF_readCTable() and HUF_readDTableXn() . */
size_t HUF_readStats(BYTE* huffWeight, size_t hwSize,
U32* rankStats, U32* nbSymbolsPtr, U32* tableLogPtr,
const void* src, size_t srcSize);
/*! HUF_readStats_wksp() :
* Same as HUF_readStats() but takes an external workspace which must be
* 4-byte aligned and its size must be >= HUF_READ_STATS_WORKSPACE_SIZE.
* If the CPU has BMI2 support, pass bmi2=1, otherwise pass bmi2=0.
*/
#define HUF_READ_STATS_WORKSPACE_SIZE_U32 FSE_DECOMPRESS_WKSP_SIZE_U32(6, HUF_TABLELOG_MAX-1)
#define HUF_READ_STATS_WORKSPACE_SIZE (HUF_READ_STATS_WORKSPACE_SIZE_U32 * sizeof(unsigned))
size_t HUF_readStats_wksp(BYTE* huffWeight, size_t hwSize,
U32* rankStats, U32* nbSymbolsPtr, U32* tableLogPtr,
const void* src, size_t srcSize,
void* workspace, size_t wkspSize,
int flags);
/** HUF_readCTable() :
* Loading a CTable saved with HUF_writeCTable() */
size_t HUF_readCTable (HUF_CElt* CTable, unsigned* maxSymbolValuePtr, const void* src, size_t srcSize, unsigned *hasZeroWeights);
/** HUF_getNbBitsFromCTable() :
* Read nbBits from CTable symbolTable, for symbol `symbolValue` presumed <= HUF_SYMBOLVALUE_MAX
* Note 1 : If symbolValue > HUF_readCTableHeader(symbolTable).maxSymbolValue, returns 0
* Note 2 : is not inlined, as HUF_CElt definition is private
*/
U32 HUF_getNbBitsFromCTable(const HUF_CElt* symbolTable, U32 symbolValue);
typedef struct {
BYTE tableLog;
BYTE maxSymbolValue;
BYTE unused[sizeof(size_t) - 2];
} HUF_CTableHeader;
/** HUF_readCTableHeader() :
* @returns The header from the CTable specifying the tableLog and the maxSymbolValue.
*/
HUF_CTableHeader HUF_readCTableHeader(HUF_CElt const* ctable);
/*
* HUF_decompress() does the following:
* 1. select the decompression algorithm (X1, X2) based on pre-computed heuristics
* 2. build Huffman table from save, using HUF_readDTableX?()
* 3. decode 1 or 4 segments in parallel using HUF_decompress?X?_usingDTable()
*/
/** HUF_selectDecoder() :
* Tells which decoder is likely to decode faster,
* based on a set of pre-computed metrics.
* @return : 0==HUF_decompress4X1, 1==HUF_decompress4X2 .
* Assumption : 0 < dstSize <= 128 KB */
U32 HUF_selectDecoder (size_t dstSize, size_t cSrcSize);
/**
* The minimum workspace size for the `workSpace` used in
* HUF_readDTableX1_wksp() and HUF_readDTableX2_wksp().
*
* The space used depends on HUF_TABLELOG_MAX, ranging from ~1500 bytes when
* HUF_TABLE_LOG_MAX=12 to ~1850 bytes when HUF_TABLE_LOG_MAX=15.
* Buffer overflow errors may potentially occur if code modifications result in
* a required workspace size greater than that specified in the following
* macro.
*/
#define HUF_DECOMPRESS_WORKSPACE_SIZE ((2 << 10) + (1 << 9))
#define HUF_DECOMPRESS_WORKSPACE_SIZE_U32 (HUF_DECOMPRESS_WORKSPACE_SIZE / sizeof(U32))
/* ====================== */
/* single stream variants */
/* ====================== */
size_t HUF_compress1X_usingCTable(void* dst, size_t dstSize, const void* src, size_t srcSize, const HUF_CElt* CTable, int flags);
/** HUF_compress1X_repeat() :
* Same as HUF_compress1X_wksp(), but considers using hufTable if *repeat != HUF_repeat_none.
* If it uses hufTable it does not modify hufTable or repeat.
* If it doesn't, it sets *repeat = HUF_repeat_none, and it sets hufTable to the table used.
* If preferRepeat then the old table will always be used if valid.
* If suspectUncompressible then some sampling checks will be run to potentially skip huffman coding */
size_t HUF_compress1X_repeat(void* dst, size_t dstSize,
const void* src, size_t srcSize,
unsigned maxSymbolValue, unsigned tableLog,
void* workSpace, size_t wkspSize, /**< `workSpace` must be aligned on 4-bytes boundaries, `wkspSize` must be >= HUF_WORKSPACE_SIZE */
HUF_CElt* hufTable, HUF_repeat* repeat, int flags);
size_t HUF_decompress1X_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize, int flags);
#ifndef HUF_FORCE_DECOMPRESS_X1
size_t HUF_decompress1X2_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize, int flags); /**< double-symbols decoder */
#endif
/* BMI2 variants.
* If the CPU has BMI2 support, pass bmi2=1, otherwise pass bmi2=0.
*/
size_t HUF_decompress1X_usingDTable(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable, int flags);
#ifndef HUF_FORCE_DECOMPRESS_X2
size_t HUF_decompress1X1_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize, int flags);
#endif
size_t HUF_decompress4X_usingDTable(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable, int flags);
size_t HUF_decompress4X_hufOnly_wksp(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize, int flags);
#ifndef HUF_FORCE_DECOMPRESS_X2
size_t HUF_readDTableX1_wksp(HUF_DTable* DTable, const void* src, size_t srcSize, void* workSpace, size_t wkspSize, int flags);
#endif
#ifndef HUF_FORCE_DECOMPRESS_X1
size_t HUF_readDTableX2_wksp(HUF_DTable* DTable, const void* src, size_t srcSize, void* workSpace, size_t wkspSize, int flags);
#endif
#endif /* HUF_H_298734234 */
#if defined (__cplusplus)
}
#endif

1945
src/bled/huf_decompress.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -2,7 +2,6 @@
/*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
#include "libbb.h"
#include "bb_archive.h"

View file

@ -23,7 +23,6 @@
#include "platform.h"
#include "msapi_utf8.h"
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
@ -40,24 +39,37 @@
#include <sys/types.h>
#include <io.h>
#define ONE_TB 1099511627776ULL
#define ONE_TB 1099511627776ULL
#define ENABLE_DESKTOP 1
#define ENABLE_DESKTOP 1
#if ENABLE_DESKTOP
#define IF_DESKTOP(x) x
#define IF_DESKTOP(x) x
#define IF_NOT_DESKTOP(x)
#else
#define IF_DESKTOP(x)
#define IF_NOT_DESKTOP(x) x
#define IF_NOT_DESKTOP(x) x
#endif
#define IF_NOT_FEATURE_LZMA_FAST(x) x
#define ENABLE_FEATURE_UNZIP_CDF 1
#define ENABLE_FEATURE_UNZIP_BZIP2 1
#define ENABLE_FEATURE_UNZIP_LZMA 1
#define ENABLE_FEATURE_UNZIP_XZ 1
#define IF_NOT_FEATURE_LZMA_FAST(x) x
#define ENABLE_FEATURE_UNZIP_CDF 1
#define ENABLE_FEATURE_UNZIP_BZIP2 1
#define ENABLE_FEATURE_UNZIP_LZMA 1
#define ENABLE_FEATURE_UNZIP_XZ 1
#define ENABLE_FEATURE_CLEAN_UP 1
#define uoff_t unsigned off_t
#define OFF_FMT "ll"
#define uoff_t unsigned off_t
#define OFF_FMT "ll"
#define SEAMLESS_COMPRESSION 0
#if (SEAMLESS_COMPRESSION)
#define ENABLE_FEATURE_SEAMLESS_BZ2 1
#define ENABLE_FEATURE_SEAMLESS_GZ 1
#define ENABLE_FEATURE_SEAMLESS_LZMA 1
#define ENABLE_FEATURE_SEAMLESS_XZ 1
#define ENABLE_FEATURE_SEAMLESS_Z 1
#define ENABLE_FEATURE_SEAMLESS_ZSTD 1
#define IF_FEATURE_SEAMLESS_BZ2(x) x
#define IF_FEATURE_SEAMLESS_XZ(x) x
#define IF_FEATURE_SEAMLESS_ZSTD(x) x
#endif
#ifndef _MODE_T_
#define _MODE_T_
@ -150,8 +162,8 @@ extern unsigned long* bled_cancel_request;
#define bb_printf(...) do { if (bled_printf != NULL) bled_printf(__VA_ARGS__); \
else { printf(__VA_ARGS__); putchar('\n'); } } while(0)
#define bb_error_msg(...) bb_printf("\nError: " __VA_ARGS__)
#define bb_error_msg_and_die(...) do {bb_error_msg(__VA_ARGS__); xfunc_die();} while(0)
#define bb_error_msg_and_err(...) do {bb_error_msg(__VA_ARGS__); goto err;} while(0)
#define bb_error_msg_and_die(...) do { bb_error_msg(__VA_ARGS__); xfunc_die(); } while(0)
#define bb_error_msg_and_err(...) do { bb_error_msg(__VA_ARGS__); goto err; } while(0)
#define bb_perror_msg bb_error_msg
#define bb_perror_msg_and_die bb_error_msg_and_die
#define bb_simple_error_msg bb_error_msg
@ -168,15 +180,14 @@ static inline void *xrealloc(void *ptr, size_t size) {
#define bb_msg_read_error "read error"
#define bb_msg_write_error "write error"
#define bb_mode_string(str, mode) "[not implemented]"
#define bb_make_directory(path, mode, flags) SHCreateDirectoryExU(NULL, path, NULL)
static inline int link(const char *oldpath, const char *newpath) {errno = ENOSYS; return -1;}
static inline int symlink(const char *oldpath, const char *newpath) {errno = ENOSYS; return -1;}
static inline int chown(const char *path, uid_t owner, gid_t group) {errno = ENOSYS; return -1;}
static inline int mknod(const char *pathname, mode_t mode, dev_t dev) {errno = ENOSYS; return -1;}
static inline int link(const char *oldpath, const char *newpath) { errno = ENOSYS; return -1; }
static inline int symlink(const char *oldpath, const char *newpath) { errno = ENOSYS; return -1; }
static inline int chown(const char *path, uid_t owner, gid_t group) { errno = ENOSYS; return -1; }
static inline int mknod(const char *pathname, mode_t mode, dev_t dev) { errno = ENOSYS; return -1; }
static inline int utimes64(const char* filename, const struct timeval64 times64[2]) { errno = ENOSYS; return -1; }
static inline int fnmatch(const char *pattern, const char *string, int flags) {return PathMatchSpecA(string, pattern)?0:1;}
static inline int fnmatch(const char *pattern, const char *string, int flags) { return PathMatchSpecA(string, pattern) ? 0 : 1; }
static inline pid_t wait(int* status) { *status = 4; return -1; }
#define wait_any_nohang wait
@ -284,6 +295,19 @@ static inline struct tm *localtime_r(const time_t *timep, struct tm *result) {
#define xzalloc(x) calloc(x, 1)
#define malloc_or_warn malloc
#define mkdir(x, y) _mkdirU(x)
struct fd_pair { int rd; int wr; };
void xpipe(int filedes[2]) FAST_FUNC;
#define xpiped_pair(pair) xpipe(&((pair).rd))
#define xpipe(filedes) _pipe(filedes, 0x1000, _O_BINARY)
#define xlseek lseek
#define xread safe_read
static inline void xmove_fd(int from, int to)
{
if (from != to) {
(void)_dup2(from, to);
_close(from);
}
}
#if defined(_MSC_VER)
#define _S_IFBLK 0x3000

View file

@ -2,7 +2,6 @@
/*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
#include "libbb.h"
#include "bb_archive.h"
@ -17,12 +16,9 @@ int FAST_FUNC check_signature16(transformer_state_t *xstate, unsigned magic16)
uint16_t magic2;
if (full_read(xstate->src_fd, &magic2, 2) != 2 || magic2 != magic16) {
bb_error_msg("invalid magic");
#if 0 /* possible future extension */
if (xstate->check_signature > 1)
xfunc_die();
#endif
return -1;
}
xstate->signature_skipped = 2;
}
return 0;
}
@ -101,7 +97,7 @@ void check_errors_in_children(int signo)
/* transformer(), more than meets the eye */
#if BB_MMU
void FAST_FUNC fork_transformer(int fd,
int check_signature,
int signature_skipped,
IF_DESKTOP(long long) int FAST_FUNC (*transformer)(transformer_state_t *xstate)
)
#else
@ -115,20 +111,20 @@ void FAST_FUNC fork_transformer(int fd, const char *transform_prog)
pid = BB_MMU ? xfork() : xvfork();
if (pid == 0) {
/* Child */
close(fd_pipe.rd); /* we don't want to read from the parent */
_close(fd_pipe.rd); /* we don't want to read from the parent */
// FIXME: error check?
#if BB_MMU
{
IF_DESKTOP(long long) int r;
transformer_state_t xstate;
init_transformer_state(&xstate);
xstate.check_signature = check_signature;
xstate.signature_skipped = signature_skipped;
xstate.src_fd = fd;
xstate.dst_fd = fd_pipe.wr;
r = transformer(&xstate);
if (ENABLE_FEATURE_CLEAN_UP) {
close(fd_pipe.wr); /* send EOF */
close(fd);
_close(fd_pipe.wr); /* send EOF */
_close(fd);
}
/* must be _exit! bug was actually seen here */
_exit(/*error if:*/ r < 0);
@ -150,7 +146,7 @@ void FAST_FUNC fork_transformer(int fd, const char *transform_prog)
}
/* parent process */
close(fd_pipe.wr); /* don't want to write to the child */
_close(fd_pipe.wr); /* don't want to write to the child */
xmove_fd(fd_pipe.rd, fd);
}
@ -159,59 +155,69 @@ void FAST_FUNC fork_transformer(int fd, const char *transform_prog)
*/
static transformer_state_t *setup_transformer_on_fd(int fd, int fail_if_not_compressed)
{
union {
uint8_t b[4];
uint16_t b16[2];
uint32_t b32[1];
} magic;
int offset;
transformer_state_t *xstate;
offset = -2;
xstate = xzalloc(sizeof(*xstate));
xstate->src_fd = fd;
/* .gz and .bz2 both have 2-byte signature, and their
* unpack_XXX_stream wants this header skipped. */
xread(fd, magic.b16, sizeof(magic.b16[0]));
xstate->signature_skipped = 2;
xread(fd, xstate->magic.b16, 2);
if (ENABLE_FEATURE_SEAMLESS_GZ
&& magic.b16[0] == GZIP_MAGIC
&& xstate->magic.b16[0] == GZIP_MAGIC
) {
xstate->xformer = unpack_gz_stream;
USE_FOR_NOMMU(xstate->xformer_prog = "gunzip";)
goto found_magic;
}
if (ENABLE_FEATURE_SEAMLESS_Z
&& magic.b16[0] == COMPRESS_MAGIC
&& xstate->magic.b16[0] == COMPRESS_MAGIC
) {
xstate->xformer = unpack_Z_stream;
USE_FOR_NOMMU(xstate->xformer_prog = "uncompress";)
goto found_magic;
}
if (ENABLE_FEATURE_SEAMLESS_BZ2
&& magic.b16[0] == BZIP2_MAGIC
&& xstate->magic.b16[0] == BZIP2_MAGIC
) {
xstate->xformer = unpack_bz2_stream;
USE_FOR_NOMMU(xstate->xformer_prog = "bunzip2";)
goto found_magic;
}
if (ENABLE_FEATURE_SEAMLESS_XZ
&& magic.b16[0] == XZ_MAGIC1
&& xstate->magic.b16[0] == XZ_MAGIC1
) {
offset = -6;
xread(fd, magic.b32, sizeof(magic.b32[0]));
if (magic.b32[0] == XZ_MAGIC2) {
uint32_t v32;
xstate->signature_skipped = 6;
xread(fd, &xstate->magic.b16[1], 4);
move_from_unaligned32(v32, &xstate->magic.b16[1]);
if (v32 == XZ_MAGIC2) {
xstate->xformer = unpack_xz_stream;
USE_FOR_NOMMU(xstate->xformer_prog = "unxz";)
goto found_magic;
}
}
if (ENABLE_FEATURE_SEAMLESS_ZSTD
&& xstate->magic.b16[0] == ZSTD_MAGIC1
) {
uint16_t v16;
xstate->signature_skipped = 4;
xread(fd, &xstate->magic.b16[1], 2);
move_from_unaligned16(v16, &xstate->magic.b16[1]);
if (v16 == ZSTD_MAGIC2) {
xstate->xformer = unpack_zstd_stream;
USE_FOR_NOMMU(xstate->xformer_prog = "unzstd";)
goto found_magic;
}
}
/* No known magic seen */
if (fail_if_not_compressed)
bb_error_msg_and_die("no gzip"
IF_FEATURE_SEAMLESS_BZ2("/bzip2")
IF_FEATURE_SEAMLESS_XZ("/xz")
IF_FEATURE_SEAMLESS_ZSTD("/zstd")
" magic");
/* Some callers expect this function to "consume" fd
@ -220,19 +226,25 @@ static transformer_state_t *setup_transformer_on_fd(int fd, int fail_if_not_comp
*/
// USE_FOR_MMU(xstate->xformer = copy_stream;)
// USE_FOR_NOMMU(xstate->xformer_prog = "cat";)
/* fall through to seeking bck over bytes we read earlier */
USE_FOR_NOMMU(found_magic:)
found_magic:
return xstate;
}
static void fork_transformer_and_free(transformer_state_t *xstate)
{
# if BB_MMU
fork_transformer_with_no_sig(xstate->src_fd, xstate->xformer);
# else
/* NOMMU version of fork_transformer execs
* an external unzipper that wants
* file position at the start of the file.
*/
xlseek(fd, offset, SEEK_CUR);
USE_FOR_MMU(found_magic:)
/* In MMU case, if magic was found, seeking back is not necessary */
return xstate;
xlseek(xstate->src_fd, - xstate->signature_skipped, SEEK_CUR);
xstate->signature_skipped = 0;
fork_transformer_with_sig(xstate->src_fd, xstate->xformer, xstate->xformer_prog);
# endif
free(xstate);
}
/* Used by e.g. rpm which gives us a fd without filename,
@ -247,21 +259,27 @@ int FAST_FUNC setup_unzip_on_fd(int fd, int fail_if_not_compressed)
return 1;
}
# if BB_MMU
fork_transformer_with_no_sig(xstate->src_fd, xstate->xformer);
# else
fork_transformer_with_sig(xstate->src_fd, xstate->xformer, xstate->xformer_prog);
# endif
free(xstate);
fork_transformer_and_free(xstate);
return 0;
}
#if ENABLE_FEATURE_SEAMLESS_LZMA
/* ...and custom version for LZMA */
void FAST_FUNC setup_lzma_on_fd(int fd)
{
transformer_state_t *xstate = xzalloc(sizeof(*xstate));
xstate->src_fd = fd;
xstate->xformer = unpack_lzma_stream;
USE_FOR_NOMMU(xstate->xformer_prog = "unlzma";)
fork_transformer_and_free(xstate);
}
#endif
static transformer_state_t *open_transformer(const char *fname, int fail_if_not_compressed)
{
transformer_state_t *xstate;
int fd;
fd = open(fname, O_RDONLY);
fd = _open(fname, O_RDONLY);
if (fd < 0)
return NULL;
@ -292,14 +310,22 @@ int FAST_FUNC open_zipped(const char *fname, int fail_if_not_compressed)
return -1;
fd = xstate->src_fd;
if (xstate->xformer) {
# if BB_MMU
fork_transformer_with_no_sig(xstate->src_fd, xstate->xformer);
# else
fork_transformer_with_sig(xstate->src_fd, xstate->xformer, xstate->xformer_prog);
# endif
if (xstate->xformer) {
fork_transformer_with_no_sig(fd, xstate->xformer);
} else {
/* the file is not compressed */
xlseek(fd, - xstate->signature_skipped, SEEK_CUR);
xstate->signature_skipped = 0;
}
/* else: the file is not compressed */
# else
/* NOMMU can't avoid the seek :( */
xlseek(fd, - xstate->signature_skipped, SEEK_CUR);
xstate->signature_skipped = 0;
if (xstate->xformer) {
fork_transformer_with_sig(fd, xstate->xformer, xstate->xformer_prog);
} /* else: the file is not compressed */
# endif
free(xstate);
return fd;
@ -326,13 +352,29 @@ void* FAST_FUNC xmalloc_open_zipped_read_close(const char *fname, size_t *maxsz_
*maxsz_p = xstate->mem_output_size;
}
} else {
/* File is not compressed */
image = xmalloc_read(xstate->src_fd, maxsz_p);
/* File is not compressed.
* We already read first few bytes, account for that.
* Example where it happens:
* "modinfo MODULE.ko" (not compressed)
* open("MODULE.ko", O_RDONLY|O_LARGEFILE) = 4
* read(4, "\177E", 2) = 2
* fstat64(4, ...)
* mmap(...)
* read(4, "LF\2\1\1\0\0\0\0"...
* ...and we avoided seeking on the fd! :)
*/
image = xmalloc_read_with_initial_buf(
xstate->src_fd,
maxsz_p,
xmemdup(&xstate->magic, xstate->signature_skipped),
xstate->signature_skipped
);
xstate->signature_skipped = 0;
}
if (!image)
bb_perror_msg("read error from '%s'", fname);
close(xstate->src_fd);
_close(xstate->src_fd);
free(xstate);
return image;
# else

View file

@ -261,7 +261,7 @@ typedef uint64_t bb__aliased_uint64_t FIX_ALIASING;
/* NB: unaligned parameter should be a pointer, aligned one -
* a lvalue. This makes it more likely to not swap them by mistake
*/
#if defined(i386) || defined(__x86_64__) || defined(__powerpc__)
#if defined(i386) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_X64) || defined(__powerpc__)
# define BB_UNALIGNED_MEMACCESS_OK 1
# define move_from_unaligned_int(v, intp) ((v) = *(bb__aliased_int*)(intp))
# define move_from_unaligned_long(v, longp) ((v) = *(bb__aliased_long*)(longp))

View file

@ -2,7 +2,6 @@
/*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
#include "libbb.h"
#include "bb_archive.h"

View file

@ -2,7 +2,6 @@
/*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
#include "libbb.h"
#include "bb_archive.h"

18
src/bled/xxhash.c Normal file
View file

@ -0,0 +1,18 @@
/*
* xxHash - Extremely Fast Hash algorithm
* Copyright (c) Yann Collet - Meta Platforms, Inc
*
* This source code is licensed under both the BSD-style license (found in the
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
* in the COPYING file in the root directory of this source tree).
* You may select, at your option, one of the above-listed licenses.
*/
/*
* xxhash.c instantiates functions defined in xxhash.h
*/
#define XXH_STATIC_LINKING_ONLY /* access advanced declarations */
#define XXH_IMPLEMENTATION /* access definitions */
#include "xxhash.h"

7021
src/bled/xxhash.h Normal file

File diff suppressed because it is too large Load diff

View file

@ -18,7 +18,6 @@
/* #define XZ_DEC_ARMTHUMB */
/* #define XZ_DEC_SPARC */
#include <assert.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>

View file

@ -622,7 +622,7 @@ static void XZ_FUNC lzma_len(struct xz_dec_lzma2 *s, struct lzma_len_dec *l,
uint32_t pos_state)
{
uint16_t *probs;
uint32_t limit, v;
uint32_t limit;
if (!rc_bit(&s->rc, &l->choice)) {
probs = l->low[pos_state];
@ -641,9 +641,8 @@ static void XZ_FUNC lzma_len(struct xz_dec_lzma2 *s, struct lzma_len_dec *l,
}
}
v = s->lzma.len + rc_bittree(&s->rc, probs, limit) - limit;
assert(v >= s->lzma.len);
s->lzma.len = (v < s->lzma.len) ? 0 : v;
// coverity[overflow_const]
s->lzma.len += rc_bittree(&s->rc, probs, limit) - limit;
}
/* Decode a match. The distance will be stored in s->lzma.rep0. */
@ -662,7 +661,6 @@ static void XZ_FUNC lzma_match(struct xz_dec_lzma2 *s, uint32_t pos_state)
lzma_len(s, &s->lzma.match_len_dec, pos_state);
probs = s->lzma.dist_slot[lzma_get_dist_state(s->lzma.len)];
// coverity[overflow_const]
dist_slot = rc_bittree(&s->rc, probs, DIST_SLOTS) - DIST_SLOTS;
if (dist_slot < DIST_MODEL_START) {

View file

@ -368,7 +368,7 @@ static enum xz_ret XZ_FUNC crc32_validate(struct xz_dec *s, struct xz_buf *b)
*/
static bool XZ_FUNC check_skip(struct xz_dec *s, struct xz_buf *b)
{
while (s->pos < check_sizes[s->check_type]) {
while (s->check_type < 16 && s->pos < check_sizes[s->check_type]) {
if (b->in_pos == b->in_size)
return false;

3171
src/bled/zstd.h Normal file

File diff suppressed because it is too large Load diff

208
src/bled/zstd_bits.h Normal file
View file

@ -0,0 +1,208 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under both the BSD-style license (found in the
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
* in the COPYING file in the root directory of this source tree).
* You may select, at your option, one of the above-listed licenses.
*/
#ifndef ZSTD_BITS_H
#define ZSTD_BITS_H
#include "zstd_mem.h"
MEM_STATIC unsigned ZSTD_countTrailingZeros32_fallback(U32 val)
{
assert(val != 0);
{
static const U32 DeBruijnBytePos[32] = {0, 1, 28, 2, 29, 14, 24, 3,
30, 22, 20, 15, 25, 17, 4, 8,
31, 27, 13, 23, 21, 19, 16, 7,
26, 12, 18, 6, 11, 5, 10, 9};
return DeBruijnBytePos[((U32) ((val & -(S32) val) * 0x077CB531U)) >> 27];
}
}
MEM_STATIC unsigned ZSTD_countTrailingZeros32(U32 val)
{
assert(val != 0);
# if defined(_MSC_VER)
# if STATIC_BMI2 == 1
return (unsigned)_tzcnt_u32(val);
# else
if (val != 0) {
unsigned long r;
_BitScanForward(&r, val);
return (unsigned)r;
} else {
/* Should not reach this code path */
__assume(0);
}
# endif
# elif defined(__GNUC__) && (__GNUC__ >= 4)
return (unsigned)__builtin_ctz(val);
# elif defined(__ICCARM__)
return (unsigned)__builtin_ctz(val);
# else
return ZSTD_countTrailingZeros32_fallback(val);
# endif
}
MEM_STATIC unsigned ZSTD_countLeadingZeros32_fallback(U32 val) {
assert(val != 0);
{
static const U32 DeBruijnClz[32] = {0, 9, 1, 10, 13, 21, 2, 29,
11, 14, 16, 18, 22, 25, 3, 30,
8, 12, 20, 28, 15, 17, 24, 7,
19, 27, 23, 6, 26, 5, 4, 31};
val |= val >> 1;
val |= val >> 2;
val |= val >> 4;
val |= val >> 8;
val |= val >> 16;
return 31 - DeBruijnClz[(val * 0x07C4ACDDU) >> 27];
}
}
MEM_STATIC unsigned ZSTD_countLeadingZeros32(U32 val)
{
assert(val != 0);
# if defined(_MSC_VER)
# if STATIC_BMI2 == 1
return (unsigned)_lzcnt_u32(val);
# else
if (val != 0) {
unsigned long r;
_BitScanReverse(&r, val);
return (unsigned)(31 - r);
} else {
/* Should not reach this code path */
__assume(0);
}
# endif
# elif defined(__GNUC__) && (__GNUC__ >= 4)
return (unsigned)__builtin_clz(val);
# elif defined(__ICCARM__)
return (unsigned)__builtin_clz(val);
# else
return ZSTD_countLeadingZeros32_fallback(val);
# endif
}
MEM_STATIC unsigned ZSTD_countTrailingZeros64(U64 val)
{
assert(val != 0);
# if defined(_MSC_VER) && defined(_WIN64)
# if STATIC_BMI2 == 1
return (unsigned)_tzcnt_u64(val);
# else
if (val != 0) {
unsigned long r;
_BitScanForward64(&r, val);
return (unsigned)r;
} else {
/* Should not reach this code path */
__assume(0);
}
# endif
# elif defined(__GNUC__) && (__GNUC__ >= 4) && defined(__LP64__)
return (unsigned)__builtin_ctzll(val);
# elif defined(__ICCARM__)
return (unsigned)__builtin_ctzll(val);
# else
{
U32 mostSignificantWord = (U32)(val >> 32);
U32 leastSignificantWord = (U32)val;
if (leastSignificantWord == 0) {
return 32 + ZSTD_countTrailingZeros32(mostSignificantWord);
} else {
return ZSTD_countTrailingZeros32(leastSignificantWord);
}
}
# endif
}
MEM_STATIC unsigned ZSTD_countLeadingZeros64(U64 val)
{
assert(val != 0);
# if defined(_MSC_VER) && defined(_WIN64)
# if STATIC_BMI2 == 1
return (unsigned)_lzcnt_u64(val);
# else
if (val != 0) {
unsigned long r;
_BitScanReverse64(&r, val);
return (unsigned)(63 - r);
} else {
/* Should not reach this code path */
__assume(0);
}
# endif
# elif defined(__GNUC__) && (__GNUC__ >= 4)
return (unsigned)(__builtin_clzll(val));
# elif defined(__ICCARM__)
return (unsigned)(__builtin_clzll(val));
# else
{
U32 mostSignificantWord = (U32)(val >> 32);
U32 leastSignificantWord = (U32)val;
if (mostSignificantWord == 0) {
return 32 + ZSTD_countLeadingZeros32(leastSignificantWord);
} else {
return ZSTD_countLeadingZeros32(mostSignificantWord);
}
}
# endif
}
MEM_STATIC unsigned ZSTD_NbCommonBytes(size_t val)
{
if (MEM_isLittleEndian()) {
if (MEM_64bits()) {
return ZSTD_countTrailingZeros64((U64)val) >> 3;
} else {
return ZSTD_countTrailingZeros32((U32)val) >> 3;
}
} else { /* Big Endian CPU */
if (MEM_64bits()) {
return ZSTD_countLeadingZeros64((U64)val) >> 3;
} else {
return ZSTD_countLeadingZeros32((U32)val) >> 3;
}
}
}
MEM_STATIC unsigned ZSTD_highbit32(U32 val) /* compress, dictBuilder, decodeCorpus */
{
assert(val != 0);
return 31 - ZSTD_countLeadingZeros32(val);
}
/* ZSTD_rotateRight_*():
* Rotates a bitfield to the right by "count" bits.
* https://en.wikipedia.org/w/index.php?title=Circular_shift&oldid=991635599#Implementing_circular_shifts
*/
MEM_STATIC
U64 ZSTD_rotateRight_U64(U64 const value, U32 count) {
assert(count < 64);
count &= 0x3F; /* for fickle pattern recognition */
return (value >> count) | (U64)(value << ((0U - count) & 0x3F));
}
MEM_STATIC
U32 ZSTD_rotateRight_U32(U32 const value, U32 count) {
assert(count < 32);
count &= 0x1F; /* for fickle pattern recognition */
return (value >> count) | (U32)(value << ((0U - count) & 0x1F));
}
MEM_STATIC
U16 ZSTD_rotateRight_U16(U16 const value, U32 count) {
assert(count < 16);
count &= 0x0F; /* for fickle pattern recognition */
return (value >> count) | (U16)(value << ((0U - count) & 0x0F));
}
#endif /* ZSTD_BITS_H */

48
src/bled/zstd_common.c Normal file
View file

@ -0,0 +1,48 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under both the BSD-style license (found in the
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
* in the COPYING file in the root directory of this source tree).
* You may select, at your option, one of the above-listed licenses.
*/
/*-*************************************
* Dependencies
***************************************/
#define ZSTD_DEPS_NEED_MALLOC
#include "zstd_error_private.h"
#include "zstd_internal.h"
/*-****************************************
* Version
******************************************/
unsigned ZSTD_versionNumber(void) { return ZSTD_VERSION_NUMBER; }
const char* ZSTD_versionString(void) { return ZSTD_VERSION_STRING; }
/*-****************************************
* ZSTD Error Management
******************************************/
#undef ZSTD_isError /* defined within zstd_internal.h */
/*! ZSTD_isError() :
* tells if a return value is an error code
* symbol is required for external callers */
unsigned ZSTD_isError(size_t code) { return ERR_isError(code); }
/*! ZSTD_getErrorName() :
* provides error code string from function result (useful for debugging) */
const char* ZSTD_getErrorName(size_t code) { return ERR_getErrorName(code); }
/*! ZSTD_getError() :
* convert a `size_t` function result into a proper ZSTD_errorCode enum */
ZSTD_ErrorCode ZSTD_getErrorCode(size_t code) { return ERR_getErrorCode(code); }
/*! ZSTD_getErrorString() :
* provides error code string from enum */
const char* ZSTD_getErrorString(ZSTD_ErrorCode code) { return ERR_getErrorString(code); }

457
src/bled/zstd_compiler.h Normal file
View file

@ -0,0 +1,457 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under both the BSD-style license (found in the
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
* in the COPYING file in the root directory of this source tree).
* You may select, at your option, one of the above-listed licenses.
*/
#ifndef ZSTD_COMPILER_H
#define ZSTD_COMPILER_H
#include <stddef.h>
#include "zstd_deps.h"
/*-*******************************************************
* Compiler specifics
*********************************************************/
/* force inlining */
#if !defined(ZSTD_NO_INLINE)
#if (defined(__GNUC__) && !defined(__STRICT_ANSI__)) || defined(__cplusplus) || defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */
# define INLINE_KEYWORD inline
#else
# define INLINE_KEYWORD
#endif
#if defined(__GNUC__) || defined(__IAR_SYSTEMS_ICC__)
# define FORCE_INLINE_ATTR __attribute__((always_inline))
#elif defined(_MSC_VER)
# define FORCE_INLINE_ATTR __forceinline
#else
# define FORCE_INLINE_ATTR
#endif
#else
#define INLINE_KEYWORD
#define FORCE_INLINE_ATTR
#endif
/**
On MSVC qsort requires that functions passed into it use the __cdecl calling conversion(CC).
This explicitly marks such functions as __cdecl so that the code will still compile
if a CC other than __cdecl has been made the default.
*/
#if defined(_MSC_VER)
# define WIN_CDECL __cdecl
#else
# define WIN_CDECL
#endif
/* UNUSED_ATTR tells the compiler it is okay if the function is unused. */
#if defined(__GNUC__) || defined(__IAR_SYSTEMS_ICC__)
# define UNUSED_ATTR __attribute__((unused))
#else
# define UNUSED_ATTR
#endif
/**
* FORCE_INLINE_TEMPLATE is used to define C "templates", which take constant
* parameters. They must be inlined for the compiler to eliminate the constant
* branches.
*/
#define FORCE_INLINE_TEMPLATE static INLINE_KEYWORD FORCE_INLINE_ATTR UNUSED_ATTR
/**
* HINT_INLINE is used to help the compiler generate better code. It is *not*
* used for "templates", so it can be tweaked based on the compilers
* performance.
*
* gcc-4.8 and gcc-4.9 have been shown to benefit from leaving off the
* always_inline attribute.
*
* clang up to 5.0.0 (trunk) benefit tremendously from the always_inline
* attribute.
*/
#if !defined(__clang__) && defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 8 && __GNUC__ < 5
# define HINT_INLINE static INLINE_KEYWORD
#else
# define HINT_INLINE FORCE_INLINE_TEMPLATE
#endif
/* "soft" inline :
* The compiler is free to select if it's a good idea to inline or not.
* The main objective is to silence compiler warnings
* when a defined function in included but not used.
*
* Note : this macro is prefixed `MEM_` because it used to be provided by `mem.h` unit.
* Updating the prefix is probably preferable, but requires a fairly large codemod,
* since this name is used everywhere.
*/
#ifndef MEM_STATIC /* already defined in Linux Kernel mem.h */
#if defined(__GNUC__)
# define MEM_STATIC static __inline UNUSED_ATTR
#elif defined(__IAR_SYSTEMS_ICC__)
# define MEM_STATIC static inline UNUSED_ATTR
#elif defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */)
# define MEM_STATIC static inline
#elif defined(_MSC_VER)
# define MEM_STATIC static __inline
#else
# define MEM_STATIC static /* this version may generate warnings for unused static functions; disable the relevant warning */
#endif
#endif
/* force no inlining */
#ifdef _MSC_VER
# define FORCE_NOINLINE static __declspec(noinline)
#else
# if defined(__GNUC__) || defined(__IAR_SYSTEMS_ICC__)
# define FORCE_NOINLINE static __attribute__((__noinline__))
# else
# define FORCE_NOINLINE static
# endif
#endif
/* target attribute */
#if defined(__GNUC__) || defined(__IAR_SYSTEMS_ICC__)
# define TARGET_ATTRIBUTE(target) __attribute__((__target__(target)))
#else
# define TARGET_ATTRIBUTE(target)
#endif
/* Target attribute for BMI2 dynamic dispatch.
* Enable lzcnt, bmi, and bmi2.
* We test for bmi1 & bmi2. lzcnt is included in bmi1.
*/
#define BMI2_TARGET_ATTRIBUTE TARGET_ATTRIBUTE("lzcnt,bmi,bmi2")
/* prefetch
* can be disabled, by declaring NO_PREFETCH build macro */
#if defined(NO_PREFETCH)
# define PREFETCH_L1(ptr) do { (void)(ptr); } while (0) /* disabled */
# define PREFETCH_L2(ptr) do { (void)(ptr); } while (0) /* disabled */
#else
# if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_I86)) && !defined(_M_ARM64EC) /* _mm_prefetch() is not defined outside of x86/x64 */
# include <mmintrin.h> /* https://msdn.microsoft.com/fr-fr/library/84szxsww(v=vs.90).aspx */
# define PREFETCH_L1(ptr) _mm_prefetch((const char*)(ptr), _MM_HINT_T0)
# define PREFETCH_L2(ptr) _mm_prefetch((const char*)(ptr), _MM_HINT_T1)
# elif defined(__GNUC__) && ( (__GNUC__ >= 4) || ( (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1) ) )
# define PREFETCH_L1(ptr) __builtin_prefetch((ptr), 0 /* rw==read */, 3 /* locality */)
# define PREFETCH_L2(ptr) __builtin_prefetch((ptr), 0 /* rw==read */, 2 /* locality */)
# elif defined(__aarch64__)
# define PREFETCH_L1(ptr) do { __asm__ __volatile__("prfm pldl1keep, %0" ::"Q"(*(ptr))); } while (0)
# define PREFETCH_L2(ptr) do { __asm__ __volatile__("prfm pldl2keep, %0" ::"Q"(*(ptr))); } while (0)
# else
# define PREFETCH_L1(ptr) do { (void)(ptr); } while (0) /* disabled */
# define PREFETCH_L2(ptr) do { (void)(ptr); } while (0) /* disabled */
# endif
#endif /* NO_PREFETCH */
#define CACHELINE_SIZE 64
#define PREFETCH_AREA(p, s) \
do { \
const char* const _ptr = (const char*)(p); \
size_t const _size = (size_t)(s); \
size_t _pos; \
for (_pos=0; _pos<_size; _pos+=CACHELINE_SIZE) { \
PREFETCH_L2(_ptr + _pos); \
} \
} while (0)
/* vectorization
* older GCC (pre gcc-4.3 picked as the cutoff) uses a different syntax,
* and some compilers, like Intel ICC and MCST LCC, do not support it at all. */
#if !defined(__INTEL_COMPILER) && !defined(__clang__) && defined(__GNUC__) && !defined(__LCC__)
# if (__GNUC__ == 4 && __GNUC_MINOR__ > 3) || (__GNUC__ >= 5)
# define DONT_VECTORIZE __attribute__((optimize("no-tree-vectorize")))
# else
# define DONT_VECTORIZE _Pragma("GCC optimize(\"no-tree-vectorize\")")
# endif
#else
# define DONT_VECTORIZE
#endif
/* Tell the compiler that a branch is likely or unlikely.
* Only use these macros if it causes the compiler to generate better code.
* If you can remove a LIKELY/UNLIKELY annotation without speed changes in gcc
* and clang, please do.
*/
#if defined(__GNUC__)
#define LIKELY(x) (__builtin_expect((x), 1))
#define UNLIKELY(x) (__builtin_expect((x), 0))
#else
#define LIKELY(x) (x)
#define UNLIKELY(x) (x)
#endif
#if 0 || (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)))
# define ZSTD_UNREACHABLE do { assert(0), __builtin_unreachable(); } while (0)
#else
# define ZSTD_UNREACHABLE do { assert(0); } while (0)
#endif
/* disable warnings */
#ifdef _MSC_VER /* Visual Studio */
# include <intrin.h> /* For Visual 2005 */
# pragma warning(disable : 4100) /* disable: C4100: unreferenced formal parameter */
# pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */
# pragma warning(disable : 4204) /* disable: C4204: non-constant aggregate initializer */
# pragma warning(disable : 4214) /* disable: C4214: non-int bitfields */
# pragma warning(disable : 4324) /* disable: C4324: padded structure */
#endif
/*Like DYNAMIC_BMI2 but for compile time determination of BMI2 support*/
#ifndef STATIC_BMI2
# if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_I86))
# ifdef __AVX2__ //MSVC does not have a BMI2 specific flag, but every CPU that supports AVX2 also supports BMI2
# define STATIC_BMI2 1
# endif
# elif defined(__BMI2__) && defined(__x86_64__) && defined(__GNUC__)
# define STATIC_BMI2 1
# endif
#endif
#ifndef STATIC_BMI2
#define STATIC_BMI2 0
#endif
/* compile time determination of SIMD support */
#if !defined(ZSTD_NO_INTRINSICS)
# if defined(__SSE2__) || defined(_M_AMD64) || (defined (_M_IX86) && defined(_M_IX86_FP) && (_M_IX86_FP >= 2))
# define ZSTD_ARCH_X86_SSE2
# endif
# if defined(__ARM_NEON) || defined(_M_ARM64)
# define ZSTD_ARCH_ARM_NEON
# endif
#
# if defined(ZSTD_ARCH_X86_SSE2)
# include <emmintrin.h>
# elif defined(ZSTD_ARCH_ARM_NEON)
# include <arm_neon.h>
# endif
#endif
/* C-language Attributes are added in C23. */
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ > 201710L) && defined(__has_c_attribute)
# define ZSTD_HAS_C_ATTRIBUTE(x) __has_c_attribute(x)
#else
# define ZSTD_HAS_C_ATTRIBUTE(x) 0
#endif
/* Only use C++ attributes in C++. Some compilers report support for C++
* attributes when compiling with C.
*/
#if defined(__cplusplus) && defined(__has_cpp_attribute)
# define ZSTD_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x)
#else
# define ZSTD_HAS_CPP_ATTRIBUTE(x) 0
#endif
/* Define ZSTD_FALLTHROUGH macro for annotating switch case with the 'fallthrough' attribute.
* - C23: https://en.cppreference.com/w/c/language/attributes/fallthrough
* - CPP17: https://en.cppreference.com/w/cpp/language/attributes/fallthrough
* - Else: __attribute__((__fallthrough__))
*/
#ifndef ZSTD_FALLTHROUGH
# if ZSTD_HAS_C_ATTRIBUTE(fallthrough)
# define ZSTD_FALLTHROUGH [[fallthrough]]
# elif ZSTD_HAS_CPP_ATTRIBUTE(fallthrough)
# define ZSTD_FALLTHROUGH [[fallthrough]]
# elif __has_attribute(__fallthrough__)
/* Leading semicolon is to satisfy gcc-11 with -pedantic. Without the semicolon
* gcc complains about: a label can only be part of a statement and a declaration is not a statement.
*/
# define ZSTD_FALLTHROUGH ; __attribute__((__fallthrough__))
# else
# define ZSTD_FALLTHROUGH
# endif
#endif
/*-**************************************************************
* Alignment check
*****************************************************************/
/* @return 1 if @u is a 2^n value, 0 otherwise
* useful to check a value is valid for alignment restrictions */
MEM_STATIC int ZSTD_isPower2(size_t u) {
return (u & (u-1)) == 0;
}
/* this test was initially positioned in mem.h,
* but this file is removed (or replaced) for linux kernel
* so it's now hosted in compiler.h,
* which remains valid for both user & kernel spaces.
*/
#ifndef ZSTD_ALIGNOF
# if defined(__GNUC__) || defined(_MSC_VER)
/* covers gcc, clang & MSVC */
/* note : this section must come first, before C11,
* due to a limitation in the kernel source generator */
# define ZSTD_ALIGNOF(T) __alignof(T)
# elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
/* C11 support */
# include <stdalign.h>
# define ZSTD_ALIGNOF(T) alignof(T)
# else
/* No known support for alignof() - imperfect backup */
# define ZSTD_ALIGNOF(T) (sizeof(void*) < sizeof(T) ? sizeof(void*) : sizeof(T))
# endif
#endif /* ZSTD_ALIGNOF */
/*-**************************************************************
* Sanitizer
*****************************************************************/
/**
* Zstd relies on pointer overflow in its decompressor.
* We add this attribute to functions that rely on pointer overflow.
*/
#ifndef ZSTD_ALLOW_POINTER_OVERFLOW_ATTR
# if __has_attribute(no_sanitize)
# if !defined(__clang__) && defined(__GNUC__) && __GNUC__ < 8
/* gcc < 8 only has signed-integer-overlow which triggers on pointer overflow */
# define ZSTD_ALLOW_POINTER_OVERFLOW_ATTR __attribute__((no_sanitize("signed-integer-overflow")))
# else
/* older versions of clang [3.7, 5.0) will warn that pointer-overflow is ignored. */
# define ZSTD_ALLOW_POINTER_OVERFLOW_ATTR __attribute__((no_sanitize("pointer-overflow")))
# endif
# else
# define ZSTD_ALLOW_POINTER_OVERFLOW_ATTR
# endif
#endif
/**
* Helper function to perform a wrapped pointer difference without triggering
* UBSAN.
*
* @returns lhs - rhs with wrapping
*/
MEM_STATIC
ZSTD_ALLOW_POINTER_OVERFLOW_ATTR
ptrdiff_t ZSTD_wrappedPtrDiff(unsigned char const* lhs, unsigned char const* rhs)
{
return lhs - rhs;
}
/**
* Helper function to perform a wrapped pointer add without triggering UBSAN.
*
* @return ptr + add with wrapping
*/
MEM_STATIC
ZSTD_ALLOW_POINTER_OVERFLOW_ATTR
unsigned char const* ZSTD_wrappedPtrAdd(unsigned char const* ptr, ptrdiff_t add)
{
return ptr + add;
}
/**
* Helper function to perform a wrapped pointer subtraction without triggering
* UBSAN.
*
* @return ptr - sub with wrapping
*/
MEM_STATIC
ZSTD_ALLOW_POINTER_OVERFLOW_ATTR
unsigned char const* ZSTD_wrappedPtrSub(unsigned char const* ptr, ptrdiff_t sub)
{
return ptr - sub;
}
/**
* Helper function to add to a pointer that works around C's undefined behavior
* of adding 0 to NULL.
*
* @returns `ptr + add` except it defines `NULL + 0 == NULL`.
*/
MEM_STATIC
unsigned char* ZSTD_maybeNullPtrAdd(unsigned char* ptr, ptrdiff_t add)
{
return add > 0 ? ptr + add : ptr;
}
/* Issue #3240 reports an ASAN failure on an llvm-mingw build. Out of an
* abundance of caution, disable our custom poisoning on mingw. */
#ifdef __MINGW32__
#ifndef ZSTD_ASAN_DONT_POISON_WORKSPACE
#define ZSTD_ASAN_DONT_POISON_WORKSPACE 1
#endif
#ifndef ZSTD_MSAN_DONT_POISON_WORKSPACE
#define ZSTD_MSAN_DONT_POISON_WORKSPACE 1
#endif
#endif
#if ZSTD_MEMORY_SANITIZER && !defined(ZSTD_MSAN_DONT_POISON_WORKSPACE)
/* Not all platforms that support msan provide sanitizers/msan_interface.h.
* We therefore declare the functions we need ourselves, rather than trying to
* include the header file... */
#include <stddef.h> /* size_t */
#define ZSTD_DEPS_NEED_STDINT
#include "zstd_deps.h" /* intptr_t */
/* Make memory region fully initialized (without changing its contents). */
void __msan_unpoison(const volatile void *a, size_t size);
/* Make memory region fully uninitialized (without changing its contents).
This is a legacy interface that does not update origin information. Use
__msan_allocated_memory() instead. */
void __msan_poison(const volatile void *a, size_t size);
/* Returns the offset of the first (at least partially) poisoned byte in the
memory range, or -1 if the whole range is good. */
intptr_t __msan_test_shadow(const volatile void *x, size_t size);
/* Print shadow and origin for the memory range to stderr in a human-readable
format. */
void __msan_print_shadow(const volatile void *x, size_t size);
#endif
#if ZSTD_ADDRESS_SANITIZER && !defined(ZSTD_ASAN_DONT_POISON_WORKSPACE)
/* Not all platforms that support asan provide sanitizers/asan_interface.h.
* We therefore declare the functions we need ourselves, rather than trying to
* include the header file... */
#include <stddef.h> /* size_t */
/**
* Marks a memory region (<c>[addr, addr+size)</c>) as unaddressable.
*
* This memory must be previously allocated by your program. Instrumented
* code is forbidden from accessing addresses in this region until it is
* unpoisoned. This function is not guaranteed to poison the entire region -
* it could poison only a subregion of <c>[addr, addr+size)</c> due to ASan
* alignment restrictions.
*
* \note This function is not thread-safe because no two threads can poison or
* unpoison memory in the same memory region simultaneously.
*
* \param addr Start of memory region.
* \param size Size of memory region. */
void __asan_poison_memory_region(void const volatile *addr, size_t size);
/**
* Marks a memory region (<c>[addr, addr+size)</c>) as addressable.
*
* This memory must be previously allocated by your program. Accessing
* addresses in this region is allowed until this region is poisoned again.
* This function could unpoison a super-region of <c>[addr, addr+size)</c> due
* to ASan alignment restrictions.
*
* \note This function is not thread-safe because no two threads can
* poison or unpoison memory in the same memory region simultaneously.
*
* \param addr Start of memory region.
* \param size Size of memory region. */
void __asan_unpoison_memory_region(void const volatile *addr, size_t size);
#endif
#endif /* ZSTD_COMPILER_H */

60
src/bled/zstd_config.h Normal file
View file

@ -0,0 +1,60 @@
#ifndef ZSTD_CONFIG
#define ZSTD_CONFIG
#define ZSTD_DEBUGLEVEL 0
#define ZSTD_LEGACY_SUPPORT 0
#define ZSTD_LIB_DEPRECATED 0
#define ZSTD_NO_UNUSED_FUNCTIONS 1
#define ZSTD_STRIP_ERROR_STRINGS 0
#define ZSTD_TRACE 0
#define ZSTD_DECOMPRESS_DICTIONARY 0
#define ZSTD_DECOMPRESS_MULTIFRAME 0
#define ZSTD_NO_TRACE 1
#if CONFIG_FEATURE_ZSTD_SMALL >= 9
#define ZSTD_NO_INLINE 1
#endif
#if CONFIG_FEATURE_ZSTD_SMALL >= 7
#define HUF_FORCE_DECOMPRESS_X1 1
#define ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT 1
#elif CONFIG_FEATURE_ZSTD_SMALL >= 5
#define HUF_FORCE_DECOMPRESS_X1 1
#endif
#if CONFIG_FEATURE_ZSTD_SMALL <= 7
/* doesnt blow up code too much, -O3 is horrible */
#ifdef __GNUC__
#pragma GCC optimize ("O2")
#endif
#endif
#if CONFIG_FEATURE_ZSTD_SMALL > 0
/* no dynamic detection of bmi2 instruction,
* prefer using CFLAGS setting to -march=haswell or similar */
# if !defined(__BMI2__)
# define DYNAMIC_BMI2 0
# endif
#endif
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
#endif
#ifndef __has_attribute
#define __has_attribute(x) 0
#endif
#ifndef __has_builtin
#define __has_builtin(x) 0
#endif
#ifndef __has_feature
#define __has_feature(x) 0
#endif
/* Include zstd_deps.h first with all the options we need enabled. */
#define ZSTD_DEPS_NEED_MALLOC
#define ZSTD_DEPS_NEED_MATH64
#define ZSTD_DEPS_NEED_STDINT
#endif

249
src/bled/zstd_cpu.h Normal file
View file

@ -0,0 +1,249 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under both the BSD-style license (found in the
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
* in the COPYING file in the root directory of this source tree).
* You may select, at your option, one of the above-listed licenses.
*/
#ifndef ZSTD_COMMON_CPU_H
#define ZSTD_COMMON_CPU_H
/**
* Implementation taken from folly/CpuId.h
* https://github.com/facebook/folly/blob/master/folly/CpuId.h
*/
#include "zstd_mem.h"
#ifdef _MSC_VER
#include <intrin.h>
#endif
typedef struct {
U32 f1c;
U32 f1d;
U32 f7b;
U32 f7c;
} ZSTD_cpuid_t;
MEM_STATIC ZSTD_cpuid_t ZSTD_cpuid(void) {
U32 f1c = 0;
U32 f1d = 0;
U32 f7b = 0;
U32 f7c = 0;
#if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_IX86))
#if !defined(__clang__) || __clang_major__ >= 16
int reg[4];
__cpuid((int*)reg, 0);
{
int const n = reg[0];
if (n >= 1) {
__cpuid((int*)reg, 1);
f1c = (U32)reg[2];
f1d = (U32)reg[3];
}
if (n >= 7) {
__cpuidex((int*)reg, 7, 0);
f7b = (U32)reg[1];
f7c = (U32)reg[2];
}
}
#else
/* Clang compiler has a bug (fixed in https://reviews.llvm.org/D101338) in
* which the `__cpuid` intrinsic does not save and restore `rbx` as it needs
* to due to being a reserved register. So in that case, do the `cpuid`
* ourselves. Clang supports inline assembly anyway.
*/
U32 n;
__asm__(
"pushq %%rbx\n\t"
"cpuid\n\t"
"popq %%rbx\n\t"
: "=a"(n)
: "a"(0)
: "rcx", "rdx");
if (n >= 1) {
U32 f1a;
__asm__(
"pushq %%rbx\n\t"
"cpuid\n\t"
"popq %%rbx\n\t"
: "=a"(f1a), "=c"(f1c), "=d"(f1d)
: "a"(1)
:);
}
if (n >= 7) {
__asm__(
"pushq %%rbx\n\t"
"cpuid\n\t"
"movq %%rbx, %%rax\n\t"
"popq %%rbx"
: "=a"(f7b), "=c"(f7c)
: "a"(7), "c"(0)
: "rdx");
}
#endif
#elif defined(__i386__) && defined(__PIC__) && !defined(__clang__) && defined(__GNUC__)
/* The following block like the normal cpuid branch below, but gcc
* reserves ebx for use of its pic register so we must specially
* handle the save and restore to avoid clobbering the register
*/
U32 n;
__asm__(
"pushl %%ebx\n\t"
"cpuid\n\t"
"popl %%ebx\n\t"
: "=a"(n)
: "a"(0)
: "ecx", "edx");
if (n >= 1) {
U32 f1a;
__asm__(
"pushl %%ebx\n\t"
"cpuid\n\t"
"popl %%ebx\n\t"
: "=a"(f1a), "=c"(f1c), "=d"(f1d)
: "a"(1));
}
if (n >= 7) {
__asm__(
"pushl %%ebx\n\t"
"cpuid\n\t"
"movl %%ebx, %%eax\n\t"
"popl %%ebx"
: "=a"(f7b), "=c"(f7c)
: "a"(7), "c"(0)
: "edx");
}
#elif defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || defined(_M_IX86)
U32 n;
__asm__("cpuid" : "=a"(n) : "a"(0) : "ebx", "ecx", "edx");
if (n >= 1) {
U32 f1a;
__asm__("cpuid" : "=a"(f1a), "=c"(f1c), "=d"(f1d) : "a"(1) : "ebx");
}
if (n >= 7) {
U32 f7a;
__asm__("cpuid"
: "=a"(f7a), "=b"(f7b), "=c"(f7c)
: "a"(7), "c"(0)
: "edx");
}
#endif
{
ZSTD_cpuid_t cpuid;
cpuid.f1c = f1c;
cpuid.f1d = f1d;
cpuid.f7b = f7b;
cpuid.f7c = f7c;
return cpuid;
}
}
#define X(name, r, bit) \
MEM_STATIC int ZSTD_cpuid_##name(ZSTD_cpuid_t const cpuid) { \
return ((cpuid.r) & (1U << bit)) != 0; \
}
/* cpuid(1): Processor Info and Feature Bits. */
#define C(name, bit) X(name, f1c, bit)
C(sse3, 0)
C(pclmuldq, 1)
C(dtes64, 2)
C(monitor, 3)
C(dscpl, 4)
C(vmx, 5)
C(smx, 6)
C(eist, 7)
C(tm2, 8)
C(ssse3, 9)
C(cnxtid, 10)
C(fma, 12)
C(cx16, 13)
C(xtpr, 14)
C(pdcm, 15)
C(pcid, 17)
C(dca, 18)
C(sse41, 19)
C(sse42, 20)
C(x2apic, 21)
C(movbe, 22)
C(popcnt, 23)
C(tscdeadline, 24)
C(aes, 25)
C(xsave, 26)
C(osxsave, 27)
C(avx, 28)
C(f16c, 29)
C(rdrand, 30)
#undef C
#define D(name, bit) X(name, f1d, bit)
D(fpu, 0)
D(vme, 1)
D(de, 2)
D(pse, 3)
D(tsc, 4)
D(msr, 5)
D(pae, 6)
D(mce, 7)
D(cx8, 8)
D(apic, 9)
D(sep, 11)
D(mtrr, 12)
D(pge, 13)
D(mca, 14)
D(cmov, 15)
D(pat, 16)
D(pse36, 17)
D(psn, 18)
D(clfsh, 19)
D(ds, 21)
D(acpi, 22)
D(mmx, 23)
D(fxsr, 24)
D(sse, 25)
D(sse2, 26)
D(ss, 27)
D(htt, 28)
D(tm, 29)
D(pbe, 31)
#undef D
/* cpuid(7): Extended Features. */
#define B(name, bit) X(name, f7b, bit)
B(bmi1, 3)
B(hle, 4)
B(avx2, 5)
B(smep, 7)
B(bmi2, 8)
B(erms, 9)
B(invpcid, 10)
B(rtm, 11)
B(mpx, 14)
B(avx512f, 16)
B(avx512dq, 17)
B(rdseed, 18)
B(adx, 19)
B(smap, 20)
B(avx512ifma, 21)
B(pcommit, 22)
B(clflushopt, 23)
B(clwb, 24)
B(avx512pf, 26)
B(avx512er, 27)
B(avx512cd, 28)
B(sha, 29)
B(avx512bw, 30)
B(avx512vl, 31)
#undef B
#define C(name, bit) X(name, f7c, bit)
C(prefetchwt1, 0)
C(avx512vbmi, 1)
#undef C
#undef X
#endif /* ZSTD_COMMON_CPU_H */

244
src/bled/zstd_ddict.c Normal file
View file

@ -0,0 +1,244 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under both the BSD-style license (found in the
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
* in the COPYING file in the root directory of this source tree).
* You may select, at your option, one of the above-listed licenses.
*/
/* zstd_ddict.c :
* concentrates all logic that needs to know the internals of ZSTD_DDict object */
/*-*******************************************************
* Dependencies
*********************************************************/
//#include "../common/allocations.h" /* ZSTD_customMalloc, ZSTD_customFree */
#include "zstd_deps.h" /* ZSTD_memcpy, ZSTD_memmove, ZSTD_memset */
#include "zstd_cpu.h" /* bmi2 */
#include "zstd_mem.h" /* low level memory routines */
#define FSE_STATIC_LINKING_ONLY
#include "fse.h"
#include "huf.h"
#include "zstd_decompress_internal.h"
#include "zstd_ddict.h"
#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT>=1)
# include "../legacy/zstd_legacy.h"
#endif
/*-*******************************************************
* Types
*********************************************************/
struct ZSTD_DDict_s {
void* dictBuffer;
const void* dictContent;
size_t dictSize;
ZSTD_entropyDTables_t entropy;
U32 dictID;
U32 entropyPresent;
ZSTD_customMem cMem;
}; /* typedef'd to ZSTD_DDict within "zstd.h" */
const void* ZSTD_DDict_dictContent(const ZSTD_DDict* ddict)
{
assert(ddict != NULL);
return ddict->dictContent;
}
size_t ZSTD_DDict_dictSize(const ZSTD_DDict* ddict)
{
assert(ddict != NULL);
return ddict->dictSize;
}
void ZSTD_copyDDictParameters(ZSTD_DCtx* dctx, const ZSTD_DDict* ddict)
{
DEBUGLOG(4, "ZSTD_copyDDictParameters");
assert(dctx != NULL);
assert(ddict != NULL);
dctx->dictID = ddict->dictID;
dctx->prefixStart = ddict->dictContent;
dctx->virtualStart = ddict->dictContent;
dctx->dictEnd = (const BYTE*)ddict->dictContent + ddict->dictSize;
dctx->previousDstEnd = dctx->dictEnd;
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
dctx->dictContentBeginForFuzzing = dctx->prefixStart;
dctx->dictContentEndForFuzzing = dctx->previousDstEnd;
#endif
if (ddict->entropyPresent) {
dctx->litEntropy = 1;
dctx->fseEntropy = 1;
dctx->LLTptr = ddict->entropy.LLTable;
dctx->MLTptr = ddict->entropy.MLTable;
dctx->OFTptr = ddict->entropy.OFTable;
dctx->HUFptr = ddict->entropy.hufTable;
dctx->entropy.rep[0] = ddict->entropy.rep[0];
dctx->entropy.rep[1] = ddict->entropy.rep[1];
dctx->entropy.rep[2] = ddict->entropy.rep[2];
} else {
dctx->litEntropy = 0;
dctx->fseEntropy = 0;
}
}
static size_t
ZSTD_loadEntropy_intoDDict(ZSTD_DDict* ddict,
ZSTD_dictContentType_e dictContentType)
{
ddict->dictID = 0;
ddict->entropyPresent = 0;
if (dictContentType == ZSTD_dct_rawContent) return 0;
if (ddict->dictSize < 8) {
if (dictContentType == ZSTD_dct_fullDict)
return ERROR(dictionary_corrupted); /* only accept specified dictionaries */
return 0; /* pure content mode */
}
{ U32 const magic = MEM_readLE32(ddict->dictContent);
if (magic != ZSTD_MAGIC_DICTIONARY) {
if (dictContentType == ZSTD_dct_fullDict)
return ERROR(dictionary_corrupted); /* only accept specified dictionaries */
return 0; /* pure content mode */
}
}
ddict->dictID = MEM_readLE32((const char*)ddict->dictContent + ZSTD_FRAMEIDSIZE);
/* load entropy tables */
RETURN_ERROR_IF(ZSTD_isError(ZSTD_loadDEntropy(
&ddict->entropy, ddict->dictContent, ddict->dictSize)),
dictionary_corrupted, "");
ddict->entropyPresent = 1;
return 0;
}
static size_t ZSTD_initDDict_internal(ZSTD_DDict* ddict,
const void* dict, size_t dictSize,
ZSTD_dictLoadMethod_e dictLoadMethod,
ZSTD_dictContentType_e dictContentType)
{
if ((dictLoadMethod == ZSTD_dlm_byRef) || (!dict) || (!dictSize)) {
ddict->dictBuffer = NULL;
ddict->dictContent = dict;
if (!dict) dictSize = 0;
} else {
void* const internalBuffer = ZSTD_customMalloc(dictSize, ddict->cMem);
ddict->dictBuffer = internalBuffer;
ddict->dictContent = internalBuffer;
if (!internalBuffer) return ERROR(memory_allocation);
ZSTD_memcpy(internalBuffer, dict, dictSize);
}
ddict->dictSize = dictSize;
ddict->entropy.hufTable[0] = (HUF_DTable)((ZSTD_HUFFDTABLE_CAPACITY_LOG)*0x1000001); /* cover both little and big endian */
/* parse dictionary content */
FORWARD_IF_ERROR( ZSTD_loadEntropy_intoDDict(ddict, dictContentType) , "");
return 0;
}
ZSTD_DDict* ZSTD_createDDict_advanced(const void* dict, size_t dictSize,
ZSTD_dictLoadMethod_e dictLoadMethod,
ZSTD_dictContentType_e dictContentType,
ZSTD_customMem customMem)
{
if ((!customMem.customAlloc) ^ (!customMem.customFree)) return NULL;
{ ZSTD_DDict* const ddict = (ZSTD_DDict*) ZSTD_customMalloc(sizeof(ZSTD_DDict), customMem);
if (ddict == NULL) return NULL;
ddict->cMem = customMem;
{ size_t const initResult = ZSTD_initDDict_internal(ddict,
dict, dictSize,
dictLoadMethod, dictContentType);
if (ZSTD_isError(initResult)) {
ZSTD_freeDDict(ddict);
return NULL;
} }
return ddict;
}
}
/*! ZSTD_createDDict() :
* Create a digested dictionary, to start decompression without startup delay.
* `dict` content is copied inside DDict.
* Consequently, `dict` can be released after `ZSTD_DDict` creation */
ZSTD_DDict* ZSTD_createDDict(const void* dict, size_t dictSize)
{
ZSTD_customMem const allocator = { NULL, NULL, NULL };
return ZSTD_createDDict_advanced(dict, dictSize, ZSTD_dlm_byCopy, ZSTD_dct_auto, allocator);
}
/*! ZSTD_createDDict_byReference() :
* Create a digested dictionary, to start decompression without startup delay.
* Dictionary content is simply referenced, it will be accessed during decompression.
* Warning : dictBuffer must outlive DDict (DDict must be freed before dictBuffer) */
ZSTD_DDict* ZSTD_createDDict_byReference(const void* dictBuffer, size_t dictSize)
{
ZSTD_customMem const allocator = { NULL, NULL, NULL };
return ZSTD_createDDict_advanced(dictBuffer, dictSize, ZSTD_dlm_byRef, ZSTD_dct_auto, allocator);
}
const ZSTD_DDict* ZSTD_initStaticDDict(
void* sBuffer, size_t sBufferSize,
const void* dict, size_t dictSize,
ZSTD_dictLoadMethod_e dictLoadMethod,
ZSTD_dictContentType_e dictContentType)
{
size_t const neededSpace = sizeof(ZSTD_DDict)
+ (dictLoadMethod == ZSTD_dlm_byRef ? 0 : dictSize);
ZSTD_DDict* const ddict = (ZSTD_DDict*)sBuffer;
assert(sBuffer != NULL);
assert(dict != NULL);
if ((size_t)sBuffer & 7) return NULL; /* 8-aligned */
if (sBufferSize < neededSpace) return NULL;
if (dictLoadMethod == ZSTD_dlm_byCopy) {
ZSTD_memcpy(ddict+1, dict, dictSize); /* local copy */
dict = ddict+1;
}
if (ZSTD_isError( ZSTD_initDDict_internal(ddict,
dict, dictSize,
ZSTD_dlm_byRef, dictContentType) ))
return NULL;
return ddict;
}
size_t ZSTD_freeDDict(ZSTD_DDict* ddict)
{
if (ddict==NULL) return 0; /* support free on NULL */
{ ZSTD_customMem const cMem = ddict->cMem;
ZSTD_customFree(ddict->dictBuffer, cMem);
ZSTD_customFree(ddict, cMem);
return 0;
}
}
/*! ZSTD_estimateDDictSize() :
* Estimate amount of memory that will be needed to create a dictionary for decompression.
* Note : dictionary created by reference using ZSTD_dlm_byRef are smaller */
size_t ZSTD_estimateDDictSize(size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod)
{
return sizeof(ZSTD_DDict) + (dictLoadMethod == ZSTD_dlm_byRef ? 0 : dictSize);
}
size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict)
{
if (ddict==NULL) return 0; /* support sizeof on NULL */
return sizeof(*ddict) + (ddict->dictBuffer ? ddict->dictSize : 0) ;
}
/*! ZSTD_getDictID_fromDDict() :
* Provides the dictID of the dictionary loaded into `ddict`.
* If @return == 0, the dictionary is not conformant to Zstandard specification, or empty.
* Non-conformant dictionaries can still be loaded, but as content-only dictionaries. */
unsigned ZSTD_getDictID_fromDDict(const ZSTD_DDict* ddict)
{
if (ddict==NULL) return 0;
return ddict->dictID;
}

44
src/bled/zstd_ddict.h Normal file
View file

@ -0,0 +1,44 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under both the BSD-style license (found in the
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
* in the COPYING file in the root directory of this source tree).
* You may select, at your option, one of the above-listed licenses.
*/
#ifndef ZSTD_DDICT_H
#define ZSTD_DDICT_H
/*-*******************************************************
* Dependencies
*********************************************************/
#include "zstd_deps.h" /* size_t */
#include "zstd.h" /* ZSTD_DDict, and several public functions */
/*-*******************************************************
* Interface
*********************************************************/
/* note: several prototypes are already published in `zstd.h` :
* ZSTD_createDDict()
* ZSTD_createDDict_byReference()
* ZSTD_createDDict_advanced()
* ZSTD_freeDDict()
* ZSTD_initStaticDDict()
* ZSTD_sizeof_DDict()
* ZSTD_estimateDDictSize()
* ZSTD_getDictID_fromDict()
*/
const void* ZSTD_DDict_dictContent(const ZSTD_DDict* ddict);
size_t ZSTD_DDict_dictSize(const ZSTD_DDict* ddict);
void ZSTD_copyDDictParameters(ZSTD_DCtx* dctx, const ZSTD_DDict* ddict);
#endif /* ZSTD_DDICT_H */

2405
src/bled/zstd_decompress.c Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,73 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under both the BSD-style license (found in the
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
* in the COPYING file in the root directory of this source tree).
* You may select, at your option, one of the above-listed licenses.
*/
#ifndef ZSTD_DEC_BLOCK_H
#define ZSTD_DEC_BLOCK_H
/*-*******************************************************
* Dependencies
*********************************************************/
#include "zstd_deps.h" /* size_t */
#include "zstd.h" /* DCtx, and some public functions */
#include "zstd_internal.h" /* blockProperties_t, and some public functions */
#include "zstd_decompress_internal.h" /* ZSTD_seqSymbol */
/* === Prototypes === */
/* note: prototypes already published within `zstd.h` :
* ZSTD_decompressBlock()
*/
/* note: prototypes already published within `zstd_internal.h` :
* ZSTD_getcBlockSize()
* ZSTD_decodeSeqHeaders()
*/
/* Streaming state is used to inform allocation of the literal buffer */
typedef enum {
not_streaming = 0,
is_streaming = 1
} streaming_operation;
/* ZSTD_decompressBlock_internal() :
* decompress block, starting at `src`,
* into destination buffer `dst`.
* @return : decompressed block size,
* or an error code (which can be tested using ZSTD_isError())
*/
size_t ZSTD_decompressBlock_internal(ZSTD_DCtx* dctx,
void* dst, size_t dstCapacity,
const void* src, size_t srcSize, const streaming_operation streaming);
/* ZSTD_buildFSETable() :
* generate FSE decoding table for one symbol (ll, ml or off)
* this function must be called with valid parameters only
* (dt is large enough, normalizedCounter distribution total is a power of 2, max is within range, etc.)
* in which case it cannot fail.
* The workspace must be 4-byte aligned and at least ZSTD_BUILD_FSE_TABLE_WKSP_SIZE bytes, which is
* defined in zstd_decompress_internal.h.
* Internal use only.
*/
void ZSTD_buildFSETable(ZSTD_seqSymbol* dt,
const short* normalizedCounter, unsigned maxSymbolValue,
const U32* baseValue, const U8* nbAdditionalBits,
unsigned tableLog, void* wksp, size_t wkspSize,
int bmi2);
/* Internal definition of ZSTD_decompressBlock() to avoid deprecation warnings. */
size_t ZSTD_decompressBlock_deprecated(ZSTD_DCtx* dctx,
void* dst, size_t dstCapacity,
const void* src, size_t srcSize);
#endif /* ZSTD_DEC_BLOCK_H */

View file

@ -0,0 +1,240 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under both the BSD-style license (found in the
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
* in the COPYING file in the root directory of this source tree).
* You may select, at your option, one of the above-listed licenses.
*/
/* zstd_decompress_internal:
* objects and definitions shared within lib/decompress modules */
#ifndef ZSTD_DECOMPRESS_INTERNAL_H
#define ZSTD_DECOMPRESS_INTERNAL_H
/*-*******************************************************
* Dependencies
*********************************************************/
#include "zstd_mem.h" /* BYTE, U16, U32 */
#include "zstd_internal.h" /* constants : MaxLL, MaxML, MaxOff, LLFSELog, etc. */
/*-*******************************************************
* Constants
*********************************************************/
static UNUSED_ATTR const U32 LL_base[MaxLL+1] = {
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15,
16, 18, 20, 22, 24, 28, 32, 40,
48, 64, 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000,
0x2000, 0x4000, 0x8000, 0x10000 };
static UNUSED_ATTR const U32 OF_base[MaxOff+1] = {
0, 1, 1, 5, 0xD, 0x1D, 0x3D, 0x7D,
0xFD, 0x1FD, 0x3FD, 0x7FD, 0xFFD, 0x1FFD, 0x3FFD, 0x7FFD,
0xFFFD, 0x1FFFD, 0x3FFFD, 0x7FFFD, 0xFFFFD, 0x1FFFFD, 0x3FFFFD, 0x7FFFFD,
0xFFFFFD, 0x1FFFFFD, 0x3FFFFFD, 0x7FFFFFD, 0xFFFFFFD, 0x1FFFFFFD, 0x3FFFFFFD, 0x7FFFFFFD };
static UNUSED_ATTR const U8 OF_bits[MaxOff+1] = {
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31 };
static UNUSED_ATTR const U32 ML_base[MaxML+1] = {
3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18,
19, 20, 21, 22, 23, 24, 25, 26,
27, 28, 29, 30, 31, 32, 33, 34,
35, 37, 39, 41, 43, 47, 51, 59,
67, 83, 99, 0x83, 0x103, 0x203, 0x403, 0x803,
0x1003, 0x2003, 0x4003, 0x8003, 0x10003 };
/*-*******************************************************
* Decompression types
*********************************************************/
typedef struct {
U32 fastMode;
U32 tableLog;
} ZSTD_seqSymbol_header;
typedef struct {
U16 nextState;
BYTE nbAdditionalBits;
BYTE nbBits;
U32 baseValue;
} ZSTD_seqSymbol;
#define SEQSYMBOL_TABLE_SIZE(log) (1 + (1 << (log)))
#define ZSTD_BUILD_FSE_TABLE_WKSP_SIZE (sizeof(S16) * (MaxSeq + 1) + (1u << MaxFSELog) + sizeof(U64))
#define ZSTD_BUILD_FSE_TABLE_WKSP_SIZE_U32 ((ZSTD_BUILD_FSE_TABLE_WKSP_SIZE + sizeof(U32) - 1) / sizeof(U32))
#define ZSTD_HUFFDTABLE_CAPACITY_LOG 12
typedef struct {
ZSTD_seqSymbol LLTable[SEQSYMBOL_TABLE_SIZE(LLFSELog)]; /* Note : Space reserved for FSE Tables */
ZSTD_seqSymbol OFTable[SEQSYMBOL_TABLE_SIZE(OffFSELog)]; /* is also used as temporary workspace while building hufTable during DDict creation */
ZSTD_seqSymbol MLTable[SEQSYMBOL_TABLE_SIZE(MLFSELog)]; /* and therefore must be at least HUF_DECOMPRESS_WORKSPACE_SIZE large */
HUF_DTable hufTable[HUF_DTABLE_SIZE(ZSTD_HUFFDTABLE_CAPACITY_LOG)]; /* can accommodate HUF_decompress4X */
U32 rep[ZSTD_REP_NUM];
U32 workspace[ZSTD_BUILD_FSE_TABLE_WKSP_SIZE_U32];
} ZSTD_entropyDTables_t;
typedef enum { ZSTDds_getFrameHeaderSize, ZSTDds_decodeFrameHeader,
ZSTDds_decodeBlockHeader, ZSTDds_decompressBlock,
ZSTDds_decompressLastBlock, ZSTDds_checkChecksum,
ZSTDds_decodeSkippableHeader, ZSTDds_skipFrame } ZSTD_dStage;
typedef enum { zdss_init=0, zdss_loadHeader,
zdss_read, zdss_load, zdss_flush } ZSTD_dStreamStage;
typedef enum {
ZSTD_use_indefinitely = -1, /* Use the dictionary indefinitely */
ZSTD_dont_use = 0, /* Do not use the dictionary (if one exists free it) */
ZSTD_use_once = 1 /* Use the dictionary once and set to ZSTD_dont_use */
} ZSTD_dictUses_e;
/* Hashset for storing references to multiple ZSTD_DDict within ZSTD_DCtx */
typedef struct {
const ZSTD_DDict** ddictPtrTable;
size_t ddictPtrTableSize;
size_t ddictPtrCount;
} ZSTD_DDictHashSet;
#ifndef ZSTD_DECODER_INTERNAL_BUFFER
# define ZSTD_DECODER_INTERNAL_BUFFER (1 << 16)
#endif
#define ZSTD_LBMIN 64
#define ZSTD_LBMAX (128 << 10)
/* extra buffer, compensates when dst is not large enough to store litBuffer */
#define ZSTD_LITBUFFEREXTRASIZE BOUNDED(ZSTD_LBMIN, ZSTD_DECODER_INTERNAL_BUFFER, ZSTD_LBMAX)
typedef enum {
ZSTD_not_in_dst = 0, /* Stored entirely within litExtraBuffer */
ZSTD_in_dst = 1, /* Stored entirely within dst (in memory after current output write) */
ZSTD_split = 2 /* Split between litExtraBuffer and dst */
} ZSTD_litLocation_e;
struct ZSTD_DCtx_s
{
const ZSTD_seqSymbol* LLTptr;
const ZSTD_seqSymbol* MLTptr;
const ZSTD_seqSymbol* OFTptr;
const HUF_DTable* HUFptr;
ZSTD_entropyDTables_t entropy;
U32 workspace[HUF_DECOMPRESS_WORKSPACE_SIZE_U32]; /* space needed when building huffman tables */
const void* previousDstEnd; /* detect continuity */
const void* prefixStart; /* start of current segment */
const void* virtualStart; /* virtual start of previous segment if it was just before current one */
const void* dictEnd; /* end of previous segment */
size_t expected;
ZSTD_frameHeader fParams;
U64 processedCSize;
U64 decodedSize;
blockType_e bType; /* used in ZSTD_decompressContinue(), store blockType between block header decoding and block decompression stages */
ZSTD_dStage stage;
U32 litEntropy;
U32 fseEntropy;
XXH64_state_t xxhState;
size_t headerSize;
ZSTD_format_e format;
ZSTD_forceIgnoreChecksum_e forceIgnoreChecksum; /* User specified: if == 1, will ignore checksums in compressed frame. Default == 0 */
U32 validateChecksum; /* if == 1, will validate checksum. Is == 1 if (fParams.checksumFlag == 1) and (forceIgnoreChecksum == 0). */
const BYTE* litPtr;
ZSTD_customMem customMem;
size_t litSize;
size_t rleSize;
size_t staticSize;
int isFrameDecompression;
#if DYNAMIC_BMI2 != 0
int bmi2; /* == 1 if the CPU supports BMI2 and 0 otherwise. CPU support is determined dynamically once per context lifetime. */
#endif
/* dictionary */
ZSTD_DDict* ddictLocal;
const ZSTD_DDict* ddict; /* set by ZSTD_initDStream_usingDDict(), or ZSTD_DCtx_refDDict() */
U32 dictID;
int ddictIsCold; /* if == 1 : dictionary is "new" for working context, and presumed "cold" (not in cpu cache) */
ZSTD_dictUses_e dictUses;
ZSTD_DDictHashSet* ddictSet; /* Hash set for multiple ddicts */
ZSTD_refMultipleDDicts_e refMultipleDDicts; /* User specified: if == 1, will allow references to multiple DDicts. Default == 0 (disabled) */
int disableHufAsm;
int maxBlockSizeParam;
/* streaming */
ZSTD_dStreamStage streamStage;
char* inBuff;
size_t inBuffSize;
size_t inPos;
size_t maxWindowSize;
char* outBuff;
size_t outBuffSize;
size_t outStart;
size_t outEnd;
size_t lhSize;
#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT>=1)
void* legacyContext;
U32 previousLegacyVersion;
U32 legacyVersion;
#endif
U32 hostageByte;
int noForwardProgress;
ZSTD_bufferMode_e outBufferMode;
ZSTD_outBuffer expectedOutBuffer;
/* workspace */
BYTE* litBuffer;
const BYTE* litBufferEnd;
ZSTD_litLocation_e litBufferLocation;
BYTE litExtraBuffer[ZSTD_LITBUFFEREXTRASIZE + WILDCOPY_OVERLENGTH]; /* literal buffer can be split between storage within dst and within this scratch buffer */
BYTE headerBuffer[ZSTD_FRAMEHEADERSIZE_MAX];
size_t oversizedDuration;
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
void const* dictContentBeginForFuzzing;
void const* dictContentEndForFuzzing;
#endif
/* Tracing */
#if ZSTD_TRACE
ZSTD_TraceCtx traceCtx;
#endif
}; /* typedef'd to ZSTD_DCtx within "zstd.h" */
MEM_STATIC int ZSTD_DCtx_get_bmi2(const struct ZSTD_DCtx_s *dctx) {
#if DYNAMIC_BMI2 != 0
return dctx->bmi2;
#else
(void)dctx;
return 0;
#endif
}
/*-*******************************************************
* Shared internal functions
*********************************************************/
/*! ZSTD_loadDEntropy() :
* dict : must point at beginning of a valid zstd dictionary.
* @return : size of dictionary header (size of magic number + dict ID + entropy tables) */
size_t ZSTD_loadDEntropy(ZSTD_entropyDTables_t* entropy,
const void* const dict, size_t const dictSize);
/*! ZSTD_checkContinuity() :
* check if next `dst` follows previous position, where decompression ended.
* If yes, do nothing (continue on current segment).
* If not, classify previous segment as "external dictionary", and start a new segment.
* This function cannot fail. */
void ZSTD_checkContinuity(ZSTD_DCtx* dctx, const void* dst, size_t dstSize);
#endif /* ZSTD_DECOMPRESS_INTERNAL_H */

144
src/bled/zstd_deps.h Normal file
View file

@ -0,0 +1,144 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under both the BSD-style license (found in the
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
* in the COPYING file in the root directory of this source tree).
* You may select, at your option, one of the above-listed licenses.
*/
/* This file provides common libc dependencies that zstd requires.
* The purpose is to allow replacing this file with a custom implementation
* to compile zstd without libc support.
*/
/* Need:
* NULL
* INT_MAX
* UINT_MAX
* ZSTD_memcpy()
* ZSTD_memset()
* ZSTD_memmove()
*/
#ifndef ZSTD_DEPS_COMMON
#define ZSTD_DEPS_COMMON
/* Even though we use qsort_r only for the dictionary builder, the macro
* _GNU_SOURCE has to be declared *before* the inclusion of any standard
* header and the script 'combine.sh' combines the whole zstd source code
* in a single file.
*/
#if defined(__linux) || defined(__linux__) || defined(linux) || defined(__gnu_linux__) || \
defined(__CYGWIN__) || defined(__MSYS__)
#if !defined(_GNU_SOURCE) && !defined(__ANDROID__) /* NDK doesn't ship qsort_r(). */
#define _GNU_SOURCE
#endif
#endif
#include <limits.h>
#include <stddef.h>
#include <string.h>
#include <crtdefs.h>
#include "zstd_config.h"
#if defined(__GNUC__) && __GNUC__ >= 4
# define ZSTD_memcpy(d,s,l) __builtin_memcpy((d),(s),(l))
# define ZSTD_memmove(d,s,l) __builtin_memmove((d),(s),(l))
# define ZSTD_memset(p,v,l) __builtin_memset((p),(v),(l))
#else
# define ZSTD_memcpy(d,s,l) memcpy((d),(s),(l))
# define ZSTD_memmove(d,s,l) memmove((d),(s),(l))
# define ZSTD_memset(p,v,l) memset((p),(v),(l))
#endif
#endif /* ZSTD_DEPS_COMMON */
/* Need:
* ZSTD_malloc()
* ZSTD_free()
* ZSTD_calloc()
*/
#ifdef ZSTD_DEPS_NEED_MALLOC
#ifndef ZSTD_DEPS_MALLOC
#define ZSTD_DEPS_MALLOC
#include <stdlib.h>
#define ZSTD_malloc(s) malloc(s)
#define ZSTD_calloc(n,s) calloc((n), (s))
#define ZSTD_free(p) free((p))
#endif /* ZSTD_DEPS_MALLOC */
#endif /* ZSTD_DEPS_NEED_MALLOC */
/*
* Provides 64-bit math support.
* Need:
* U64 ZSTD_div64(U64 dividend, U32 divisor)
*/
#ifdef ZSTD_DEPS_NEED_MATH64
#ifndef ZSTD_DEPS_MATH64
#define ZSTD_DEPS_MATH64
#define ZSTD_div64(dividend, divisor) ((dividend) / (divisor))
#endif /* ZSTD_DEPS_MATH64 */
#endif /* ZSTD_DEPS_NEED_MATH64 */
/* Need:
* assert()
*/
#ifdef ZSTD_DEPS_NEED_ASSERT
#ifndef ZSTD_DEPS_ASSERT
#define ZSTD_DEPS_ASSERT
#include <assert.h>
#endif /* ZSTD_DEPS_ASSERT */
#else
#ifndef assert
#define assert(condition) ((void)0)
#endif
#endif /* ZSTD_DEPS_NEED_ASSERT */
/* Need:
* ZSTD_DEBUG_PRINT()
*/
#ifdef ZSTD_DEPS_NEED_IO
#ifndef ZSTD_DEPS_IO
#define ZSTD_DEPS_IO
#include <stdio.h>
#define ZSTD_DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)
#endif /* ZSTD_DEPS_IO */
#endif /* ZSTD_DEPS_NEED_IO */
/* Only requested when <stdint.h> is known to be present.
* Need:
* intptr_t
*/
#ifdef ZSTD_DEPS_NEED_STDINT
#ifndef ZSTD_DEPS_STDINT
#define ZSTD_DEPS_STDINT
#include <stdint.h>
#endif /* ZSTD_DEPS_STDINT */
#endif /* ZSTD_DEPS_NEED_STDINT */
#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1])
#include "libbb.h"
#if (DEBUGLEVEL >= 1)
#define RAWLOG(l, ...) { if (l <= ZSTD_DEBUGLEVEL) bb_printf(__VA_ARGS__); }
#define DEBUGLOG(l, ...) { if (l <= ZSTD_DEBUGLEVEL) bb_printf(__VA_ARGS__); }
#else
#define RAWLOG(l, ...) do { } while (0)
#define DEBUGLOG(l, ...) do { } while (0)
#endif

View file

@ -0,0 +1,340 @@
/* ******************************************************************
* Common functions of New Generation Entropy library
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* You can contact the author at :
* - FSE+HUF source repository : https://github.com/Cyan4973/FiniteStateEntropy
* - Public forum : https://groups.google.com/forum/#!forum/lz4c
*
* This source code is licensed under both the BSD-style license (found in the
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
* in the COPYING file in the root directory of this source tree).
* You may select, at your option, one of the above-listed licenses.
****************************************************************** */
/* *************************************
* Dependencies
***************************************/
#include "zstd_mem.h"
#include "zstd_error_private.h" /* ERR_*, ERROR */
#define FSE_STATIC_LINKING_ONLY /* FSE_MIN_TABLELOG */
#include "fse.h"
#include "huf.h"
#include "zstd_bits.h" /* ZSDT_highbit32, ZSTD_countTrailingZeros32 */
/*=== Version ===*/
unsigned FSE_versionNumber(void) { return FSE_VERSION_NUMBER; }
/*=== Error Management ===*/
unsigned FSE_isError(size_t code) { return ERR_isError(code); }
const char* FSE_getErrorName(size_t code) { return ERR_getErrorName(code); }
unsigned HUF_isError(size_t code) { return ERR_isError(code); }
const char* HUF_getErrorName(size_t code) { return ERR_getErrorName(code); }
/*-**************************************************************
* FSE NCount encoding-decoding
****************************************************************/
FORCE_INLINE_TEMPLATE
size_t FSE_readNCount_body(short* normalizedCounter, unsigned* maxSVPtr, unsigned* tableLogPtr,
const void* headerBuffer, size_t hbSize)
{
const BYTE* const istart = (const BYTE*) headerBuffer;
const BYTE* const iend = istart + hbSize;
const BYTE* ip = istart;
int nbBits;
int remaining;
int threshold;
U32 bitStream;
int bitCount;
unsigned charnum = 0;
unsigned const maxSV1 = *maxSVPtr + 1;
int previous0 = 0;
if (hbSize < 8) {
/* This function only works when hbSize >= 8 */
char buffer[8] = {0};
ZSTD_memcpy(buffer, headerBuffer, hbSize);
{ size_t const countSize = FSE_readNCount(normalizedCounter, maxSVPtr, tableLogPtr,
buffer, sizeof(buffer));
if (FSE_isError(countSize)) return countSize;
if (countSize > hbSize) return ERROR(corruption_detected);
return countSize;
} }
assert(hbSize >= 8);
/* init */
ZSTD_memset(normalizedCounter, 0, (*maxSVPtr+1) * sizeof(normalizedCounter[0])); /* all symbols not present in NCount have a frequency of 0 */
bitStream = MEM_readLE32(ip);
nbBits = (bitStream & 0xF) + FSE_MIN_TABLELOG; /* extract tableLog */
if (nbBits > FSE_TABLELOG_ABSOLUTE_MAX) return ERROR(tableLog_tooLarge);
bitStream >>= 4;
bitCount = 4;
*tableLogPtr = nbBits;
remaining = (1<<nbBits)+1;
threshold = 1<<nbBits;
nbBits++;
for (;;) {
if (previous0) {
/* Count the number of repeats. Each time the
* 2-bit repeat code is 0b11 there is another
* repeat.
* Avoid UB by setting the high bit to 1.
*/
int repeats = ZSTD_countTrailingZeros32(~bitStream | 0x80000000) >> 1;
while (repeats >= 12) {
charnum += 3 * 12;
if (LIKELY(ip <= iend-7)) {
ip += 3;
} else {
bitCount -= (int)(8 * (iend - 7 - ip));
bitCount &= 31;
ip = iend - 4;
}
bitStream = MEM_readLE32(ip) >> bitCount;
repeats = ZSTD_countTrailingZeros32(~bitStream | 0x80000000) >> 1;
}
charnum += 3 * repeats;
bitStream >>= 2 * repeats;
bitCount += 2 * repeats;
/* Add the final repeat which isn't 0b11. */
assert((bitStream & 3) < 3);
charnum += bitStream & 3;
bitCount += 2;
/* This is an error, but break and return an error
* at the end, because returning out of a loop makes
* it harder for the compiler to optimize.
*/
if (charnum >= maxSV1) break;
/* We don't need to set the normalized count to 0
* because we already memset the whole buffer to 0.
*/
if (LIKELY(ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) {
assert((bitCount >> 3) <= 3); /* For first condition to work */
ip += bitCount>>3;
bitCount &= 7;
} else {
bitCount -= (int)(8 * (iend - 4 - ip));
bitCount &= 31;
ip = iend - 4;
}
bitStream = MEM_readLE32(ip) >> bitCount;
}
{
int const max = (2*threshold-1) - remaining;
int count;
if ((bitStream & (threshold-1)) < (U32)max) {
count = bitStream & (threshold-1);
bitCount += nbBits-1;
} else {
count = bitStream & (2*threshold-1);
if (count >= threshold) count -= max;
bitCount += nbBits;
}
count--; /* extra accuracy */
/* When it matters (small blocks), this is a
* predictable branch, because we don't use -1.
*/
if (count >= 0) {
remaining -= count;
} else {
assert(count == -1);
remaining += count;
}
normalizedCounter[charnum++] = (short)count;
previous0 = !count;
assert(threshold > 1);
if (remaining < threshold) {
/* This branch can be folded into the
* threshold update condition because we
* know that threshold > 1.
*/
if (remaining <= 1) break;
nbBits = ZSTD_highbit32(remaining) + 1;
threshold = 1 << (nbBits - 1);
}
if (charnum >= maxSV1) break;
if (LIKELY(ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) {
ip += bitCount>>3;
bitCount &= 7;
} else {
bitCount -= (int)(8 * (iend - 4 - ip));
bitCount &= 31;
ip = iend - 4;
}
bitStream = MEM_readLE32(ip) >> bitCount;
} }
if (remaining != 1) return ERROR(corruption_detected);
/* Only possible when there are too many zeros. */
if (charnum > maxSV1) return ERROR(maxSymbolValue_tooSmall);
if (bitCount > 32) return ERROR(corruption_detected);
*maxSVPtr = charnum-1;
ip += (bitCount+7)>>3;
return ip-istart;
}
/* Avoids the FORCE_INLINE of the _body() function. */
static size_t FSE_readNCount_body_default(
short* normalizedCounter, unsigned* maxSVPtr, unsigned* tableLogPtr,
const void* headerBuffer, size_t hbSize)
{
return FSE_readNCount_body(normalizedCounter, maxSVPtr, tableLogPtr, headerBuffer, hbSize);
}
#if DYNAMIC_BMI2
BMI2_TARGET_ATTRIBUTE static size_t FSE_readNCount_body_bmi2(
short* normalizedCounter, unsigned* maxSVPtr, unsigned* tableLogPtr,
const void* headerBuffer, size_t hbSize)
{
return FSE_readNCount_body(normalizedCounter, maxSVPtr, tableLogPtr, headerBuffer, hbSize);
}
#endif
size_t FSE_readNCount_bmi2(
short* normalizedCounter, unsigned* maxSVPtr, unsigned* tableLogPtr,
const void* headerBuffer, size_t hbSize, int bmi2)
{
#if DYNAMIC_BMI2
if (bmi2) {
return FSE_readNCount_body_bmi2(normalizedCounter, maxSVPtr, tableLogPtr, headerBuffer, hbSize);
}
#endif
(void)bmi2;
return FSE_readNCount_body_default(normalizedCounter, maxSVPtr, tableLogPtr, headerBuffer, hbSize);
}
size_t FSE_readNCount(
short* normalizedCounter, unsigned* maxSVPtr, unsigned* tableLogPtr,
const void* headerBuffer, size_t hbSize)
{
return FSE_readNCount_bmi2(normalizedCounter, maxSVPtr, tableLogPtr, headerBuffer, hbSize, /* bmi2 */ 0);
}
/*! HUF_readStats() :
Read compact Huffman tree, saved by HUF_writeCTable().
`huffWeight` is destination buffer.
`rankStats` is assumed to be a table of at least HUF_TABLELOG_MAX U32.
@return : size read from `src` , or an error Code .
Note : Needed by HUF_readCTable() and HUF_readDTableX?() .
*/
size_t HUF_readStats(BYTE* huffWeight, size_t hwSize, U32* rankStats,
U32* nbSymbolsPtr, U32* tableLogPtr,
const void* src, size_t srcSize)
{
U32 wksp[HUF_READ_STATS_WORKSPACE_SIZE_U32];
return HUF_readStats_wksp(huffWeight, hwSize, rankStats, nbSymbolsPtr, tableLogPtr, src, srcSize, wksp, sizeof(wksp), /* flags */ 0);
}
FORCE_INLINE_TEMPLATE size_t
HUF_readStats_body(BYTE* huffWeight, size_t hwSize, U32* rankStats,
U32* nbSymbolsPtr, U32* tableLogPtr,
const void* src, size_t srcSize,
void* workSpace, size_t wkspSize,
int bmi2)
{
U32 weightTotal;
const BYTE* ip = (const BYTE*) src;
size_t iSize;
size_t oSize;
if (!srcSize) return ERROR(srcSize_wrong);
iSize = ip[0];
/* ZSTD_memset(huffWeight, 0, hwSize); *//* is not necessary, even though some analyzer complain ... */
if (iSize >= 128) { /* special header */
oSize = iSize - 127;
iSize = ((oSize+1)/2);
if (iSize+1 > srcSize) return ERROR(srcSize_wrong);
if (oSize >= hwSize) return ERROR(corruption_detected);
ip += 1;
{ U32 n;
for (n=0; n<oSize; n+=2) {
huffWeight[n] = ip[n/2] >> 4;
huffWeight[n+1] = ip[n/2] & 15;
} } }
else { /* header compressed with FSE (normal case) */
if (iSize+1 > srcSize) return ERROR(srcSize_wrong);
/* max (hwSize-1) values decoded, as last one is implied */
oSize = FSE_decompress_wksp_bmi2(huffWeight, hwSize-1, ip+1, iSize, 6, workSpace, wkspSize, bmi2);
if (FSE_isError(oSize)) return oSize;
}
/* collect weight stats */
ZSTD_memset(rankStats, 0, (HUF_TABLELOG_MAX + 1) * sizeof(U32));
weightTotal = 0;
{ U32 n; for (n=0; n<oSize; n++) {
if (huffWeight[n] > HUF_TABLELOG_MAX) return ERROR(corruption_detected);
rankStats[huffWeight[n]]++;
weightTotal += (1 << huffWeight[n]) >> 1;
} }
if (weightTotal == 0) return ERROR(corruption_detected);
/* get last non-null symbol weight (implied, total must be 2^n) */
{ U32 const tableLog = ZSTD_highbit32(weightTotal) + 1;
if (tableLog > HUF_TABLELOG_MAX) return ERROR(corruption_detected);
*tableLogPtr = tableLog;
/* determine last weight */
{ U32 const total = 1 << tableLog;
U32 const rest = total - weightTotal;
U32 const verif = 1 << ZSTD_highbit32(rest);
U32 const lastWeight = ZSTD_highbit32(rest) + 1;
if (verif != rest) return ERROR(corruption_detected); /* last value must be a clean power of 2 */
huffWeight[oSize] = (BYTE)lastWeight;
rankStats[lastWeight]++;
} }
/* check tree construction validity */
if ((rankStats[1] < 2) || (rankStats[1] & 1)) return ERROR(corruption_detected); /* by construction : at least 2 elts of rank 1, must be even */
/* results */
*nbSymbolsPtr = (U32)(oSize+1);
return iSize+1;
}
/* Avoids the FORCE_INLINE of the _body() function. */
static size_t HUF_readStats_body_default(BYTE* huffWeight, size_t hwSize, U32* rankStats,
U32* nbSymbolsPtr, U32* tableLogPtr,
const void* src, size_t srcSize,
void* workSpace, size_t wkspSize)
{
return HUF_readStats_body(huffWeight, hwSize, rankStats, nbSymbolsPtr, tableLogPtr, src, srcSize, workSpace, wkspSize, 0);
}
#if DYNAMIC_BMI2
static BMI2_TARGET_ATTRIBUTE size_t HUF_readStats_body_bmi2(BYTE* huffWeight, size_t hwSize, U32* rankStats,
U32* nbSymbolsPtr, U32* tableLogPtr,
const void* src, size_t srcSize,
void* workSpace, size_t wkspSize)
{
return HUF_readStats_body(huffWeight, hwSize, rankStats, nbSymbolsPtr, tableLogPtr, src, srcSize, workSpace, wkspSize, 1);
}
#endif
size_t HUF_readStats_wksp(BYTE* huffWeight, size_t hwSize, U32* rankStats,
U32* nbSymbolsPtr, U32* tableLogPtr,
const void* src, size_t srcSize,
void* workSpace, size_t wkspSize,
int flags)
{
#if DYNAMIC_BMI2
if (flags & HUF_flags_bmi2) {
return HUF_readStats_body_bmi2(huffWeight, hwSize, rankStats, nbSymbolsPtr, tableLogPtr, src, srcSize, workSpace, wkspSize);
}
#endif
(void)flags;
return HUF_readStats_body_default(huffWeight, hwSize, rankStats, nbSymbolsPtr, tableLogPtr, src, srcSize, workSpace, wkspSize);
}

Some files were not shown because too many files have changed in this diff Show more