[vlc-commits] [Git][videolan/vlc][3.0.x] 10 commits: contrib: mingw64: patch headers to allow more API's in UWP
Steve Lhomme (@robUx4)
gitlab at videolan.org
Wed Oct 9 11:36:22 UTC 2024
Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC
Commits:
2dcc3673 by Steve Lhomme at 2024-10-08T08:48:06+02:00
contrib: mingw64: patch headers to allow more API's in UWP
* fileapi.h to allow GetFileInformationByHandle in UWP
Unlike all the documentation says, it's allowed in the SDK.
* memoryapi.h for VirtualAlloc
(cherry picked from commit 826f28e5c90424367c2bde7e4140e6f734f38516) (edited)
edited:
- 3.0 uses pthreads/rules.mak
- 3.0 doesn't use winrt_headers
- - - - -
1b4ab35f by Steve Lhomme at 2024-10-08T08:48:06+02:00
contrib: mingw64: allow CreateHardLinkW/GetVolumePathNameW in UWP
(cherry picked from commit 4347aac5881d003f4edd10f7509f73b1f49d081a) (edited)
edited:
- 3.0 uses pthreads/rules.mak
- 3.0 doesn't use mingw-w64 v11
- - - - -
bd6d9772 by Steve Lhomme at 2024-10-08T09:51:34+02:00
contrib: libarchive: build with CMake
That's the target they use in their CI. Although they don't test
cross-compilation to Windows...
We don't need the Android patch anymore.
(cherry picked from commit 7179b5ee6e24641844c2a1ba075187ee12216534) (edited)
edited:
- 3.0 was not use MAKEBUILD
- LIBARCHIVE_CONF was different on 3.0
- - - - -
dc46659b by Khalid Masum at 2024-10-08T09:51:48+02:00
contrib: libarchive: update to 3.6.2
Co-authored-by: Steve Lhomme <robux4 at ycbcr.xyz>
(cherry picked from commit 37e03085a721c4a19210a5b8d8da7d110aef691e) (edited)
edited:
- 3.0 didn't have the UWP patch removed
- 3.0 didn't use $(GITHUB) for thr tarball URL
- - - - -
82b1831d by Steve Lhomme at 2024-10-08T09:51:48+02:00
contrib: libarchive: fix usage of GetVolumePathNameW in UWP before 20H1
(cherry picked from commit 037300632832df831721c0b6b09fbc13255b6fa2) (rebased)
rebased:
- the code around is slightly different
- - - - -
6fe63c98 by Steve Lhomme at 2024-10-08T09:51:48+02:00
contrib: update libarchive to 3.7.0
It contains all the patches we had.
Changelog: https://github.com/libarchive/libarchive/releases/tag/v3.7.0
New features:
* bsdunzip: new tool ported from FreeBSD)
* drop-in replacement for Info-ZIP unzip, not yet ported for Windows
* 7zip reader: support for Zstandard compression
* 7zip reader: support for ARM64 filter
* zstd filter: support for multi-frame zstd archives
Other notable bugfixes and improvements:
* pax: fix year 2038 problem on platforms with 64-bit time_t
* Windows: Universal Windows Platform (UWP) fixes and improvements
* Windows: bcrypt usage fixes and improvements
* Windows: time function usage fixes and improvements
(cherry picked from commit fa419f41709adb04bb4ef92b1dfc249dcc7bb897) (edited)
edited:
- 3.0 builds with autotools so the bsdunzip option is used there
- 3.0 had old patches we don't need anymore
- 3.0 used RECONF that is not needed anymore
- - - - -
f709dcdb by Steve Lhomme at 2024-10-08T09:51:48+02:00
contrib: libarchive: update to 3.7.6
Includes our UWP patch and some CVE fixes from 3.7.4 and 3.7.5.
(cherry picked from commit 78ae78c044e87086bc976b9c226eb6fa93e4af54) (rebased)
rebased:
- 3.0 doesn't use $(GITHUB) for the tarball
- - - - -
e0976845 by Steve Lhomme at 2024-10-08T09:51:48+02:00
contrib: libarchive: allow CreateHardLinkW in UWP
(cherry picked from commit d853db29e953c65aa370fb20643c4b89bb6dde64) (rebased)
rebased:
- 3.0 doesn't use DEPS_zlib before
- 3.0 doesn't have LIBARCHIVE_CONF next
- - - - -
eb54f4ce by Steve Lhomme at 2024-10-08T09:51:48+02:00
contrib: libarchive: fix detection of newer functions on macOS
- - - - -
76ef452e by Steve Lhomme at 2024-10-08T13:26:34+02:00
contrib: libarchive: fix bcrypt usage
The header may be detected but we don't want to use it when targetting XP.
Patch sent upstream: https://github.com/libarchive/libarchive/pull/2374
It's not necessary on 4.0 since we build for Windows 7.
- - - - -
11 changed files:
- + contrib/src/libarchive/0001-Don-t-use-Windows-bcrypt-when-building-for-Windows-X.patch
- + contrib/src/libarchive/0001-zstd-use-GetNativeSystemInfo-to-get-the-number-of-th.patch
- contrib/src/libarchive/SHA512SUMS
- − contrib/src/libarchive/android.patch
- contrib/src/libarchive/rules.mak
- − contrib/src/libarchive/winrt.patch
- + contrib/src/pthreads/0001-headers-enable-CreateHardLinkW-in-Win10-UWP-builds.patch
- + contrib/src/pthreads/0001-headers-enable-GetFileInformationByHandle-in-Win10-U.patch
- + contrib/src/pthreads/0001-headers-enable-GetVolumePathNameW-in-Win10-UWP-build.patch
- + contrib/src/pthreads/0001-headers-enable-VirtualAlloc-Ex-in-Win10-UWP-builds.patch
- contrib/src/pthreads/rules.mak
Changes:
=====================================
contrib/src/libarchive/0001-Don-t-use-Windows-bcrypt-when-building-for-Windows-X.patch
=====================================
@@ -0,0 +1,78 @@
+From fec1c63a2bb6dc7667baf57b2c36766676184e48 Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Tue, 8 Oct 2024 13:18:27 +0200
+Subject: [PATCH] Don't use Windows bcrypt when building for Windows XP or
+ older
+
+The header may be detected but we can't use the calls.
+---
+ libarchive/archive_cryptor.c | 4 ++--
+ libarchive/archive_cryptor_private.h | 2 +-
+ libarchive/archive_hmac.c | 2 +-
+ libarchive/archive_hmac_private.h | 2 +-
+ 4 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/libarchive/archive_cryptor.c b/libarchive/archive_cryptor.c
+index 437dba06..1825af4d 100644
+--- a/libarchive/archive_cryptor.c
++++ b/libarchive/archive_cryptor.c
+@@ -57,7 +57,7 @@ pbkdf2_sha1(const char *pw, size_t pw_len, const uint8_t *salt,
+ return 0;
+ }
+
+-#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H)
++#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
+ #ifdef _MSC_VER
+ #pragma comment(lib, "Bcrypt.lib")
+ #endif
+@@ -197,7 +197,7 @@ aes_ctr_release(archive_crypto_ctx *ctx)
+ return 0;
+ }
+
+-#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H)
++#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
+
+ static int
+ aes_ctr_init(archive_crypto_ctx *ctx, const uint8_t *key, size_t key_len)
+diff --git a/libarchive/archive_cryptor_private.h b/libarchive/archive_cryptor_private.h
+index 16b6d16f..c13f2926 100644
+--- a/libarchive/archive_cryptor_private.h
++++ b/libarchive/archive_cryptor_private.h
+@@ -62,7 +62,7 @@ typedef struct {
+ unsigned encr_pos;
+ } archive_crypto_ctx;
+
+-#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H)
++#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
+ #include <bcrypt.h>
+
+ /* Common in other bcrypt implementations, but missing from VS2008. */
+diff --git a/libarchive/archive_hmac.c b/libarchive/archive_hmac.c
+index edb3bf5a..210cca70 100644
+--- a/libarchive/archive_hmac.c
++++ b/libarchive/archive_hmac.c
+@@ -74,7 +74,7 @@ __hmac_sha1_cleanup(archive_hmac_sha1_ctx *ctx)
+ memset(ctx, 0, sizeof(*ctx));
+ }
+
+-#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H)
++#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
+
+ #ifndef BCRYPT_HASH_REUSABLE_FLAG
+ # define BCRYPT_HASH_REUSABLE_FLAG 0x00000020
+diff --git a/libarchive/archive_hmac_private.h b/libarchive/archive_hmac_private.h
+index d0fda7f9..1b24ddd1 100644
+--- a/libarchive/archive_hmac_private.h
++++ b/libarchive/archive_hmac_private.h
+@@ -52,7 +52,7 @@ int __libarchive_hmac_build_hack(void);
+
+ typedef CCHmacContext archive_hmac_sha1_ctx;
+
+-#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H)
++#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
+ #include <bcrypt.h>
+
+ typedef struct {
+--
+2.45.0.windows.1
+
=====================================
contrib/src/libarchive/0001-zstd-use-GetNativeSystemInfo-to-get-the-number-of-th.patch
=====================================
@@ -0,0 +1,36 @@
+From 51214b8cbd6008105fd94807dfc9c0699459e9e2 Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Mon, 23 Sep 2024 13:37:22 +0200
+Subject: [PATCH] zstd: use GetNativeSystemInfo() to get the number of threads
+
+GetActiveProcessorCount() is not available in UWP [1] and
+it's not available before Windows 7.
+
+SYSTEM_INFO::dwNumberOfProcessors gives the same information [2]
+
+[1] https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getactiveprocessorcount
+[2] https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/ns-sysinfoapi-system_info
+---
+ libarchive/archive_write_add_filter_zstd.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/libarchive/archive_write_add_filter_zstd.c b/libarchive/archive_write_add_filter_zstd.c
+index 7ea3d18c..89b90387 100644
+--- a/libarchive/archive_write_add_filter_zstd.c
++++ b/libarchive/archive_write_add_filter_zstd.c
+@@ -280,9 +280,9 @@ archive_compressor_zstd_options(struct archive_write_filter *f, const char *key,
+ #elif !defined(__CYGWIN__) && defined(_WIN32_WINNT) && \
+ _WIN32_WINNT >= 0x0601 /* _WIN32_WINNT_WIN7 */
+ if (threads == 0) {
+- DWORD winCores = GetActiveProcessorCount(
+- ALL_PROCESSOR_GROUPS);
+- threads = (intmax_t)winCores;
++ SYSTEM_INFO systemInfo;
++ GetNativeSystemInfo(&systemInfo);
++ threads = (intmax_t)systemInfo.dwNumberOfProcessors;
+ }
+ #endif
+ if (threads < 0 || threads > INT_MAX) {
+--
+2.45.0.windows.1
+
=====================================
contrib/src/libarchive/SHA512SUMS
=====================================
@@ -1 +1 @@
-58f7ac0c52116f73326a07dec10ff232be33b318862078785dc39f1fb2f8773b5194eabfa14764bb51ce6a5a1aa8820526e7f4c76087a6f4fcbe7789a22275b4 libarchive-3.6.1.tar.gz
+d55483de313e00b3855ea535dfeeb78dcfdaa48ae6d17589dbb419ead2eb5818e7a8617b73b93c810402a9ece65b416e2d73b09efbc39c02916d80b180f4200b libarchive-3.7.6.tar.gz
=====================================
contrib/src/libarchive/android.patch deleted
=====================================
@@ -1,19 +0,0 @@
---- libarchive/Makefile.am.orig 2022-02-09 13:24:12.000000000 +0100
-+++ libarchive/Makefile.am 2022-02-14 19:22:31.487152622 +0100
-@@ -89,7 +89,7 @@
- #
- #
-
--include_HEADERS= libarchive/archive.h libarchive/archive_entry.h
-+include_HEADERS= libarchive/archive.h libarchive/archive_entry.h contrib/android/include/android_lf.h
-
- libarchive_la_SOURCES= \
- libarchive/archive_acl.c \
-@@ -284,6 +284,7 @@
-
- # -no-undefined marks that libarchive doesn't rely on symbols
- # defined in the application. This is mandatory for cygwin.
-+libarchive_la_CPPFLAGS= -I$(top_srcdir)/contrib/android/include
- libarchive_la_LDFLAGS= -no-undefined -version-info $(ARCHIVE_LIBTOOL_VERSION) $(GC_SECTIONS)
- libarchive_la_LIBADD= $(LTLIBICONV)
-
=====================================
contrib/src/libarchive/rules.mak
=====================================
@@ -1,5 +1,5 @@
# LIBARCHIVE
-LIBARCHIVE_VERSION := 3.6.1
+LIBARCHIVE_VERSION := 3.7.6
LIBARCHIVE_URL := http://www.libarchive.org/downloads/libarchive-$(LIBARCHIVE_VERSION).tar.gz
PKGS += libarchive
@@ -7,12 +7,34 @@ ifeq ($(call need_pkg,"libarchive >= 3.2.0"),)
PKGS_FOUND += libarchive
endif
-DEPS_libarchive = zlib
+DEPS_libarchive = zlib $(DEPS_zlib)
+ifdef HAVE_WINSTORE
+# libarchive uses CreateHardLinkW
+DEPS_libarchive += alloweduwp $(DEPS_alloweduwp)
+endif
LIBARCHIVE_CONF := \
- --disable-bsdcpio --disable-bsdtar --disable-bsdcat \
- --without-nettle --without-cng \
- --without-xml2 --without-lzma --without-iconv --without-expat
+ -DENABLE_CPIO=OFF -DENABLE_TAR=OFF -DENABLE_CAT=OFF \
+ -DENABLE_NETTLE=OFF \
+ -DENABLE_LIBXML2=OFF -DENABLE_LZMA=OFF -DENABLE_ICONV=OFF -DENABLE_EXPAT=OFF \
+ -DENABLE_TEST=OFF
+
+# CNG enables bcrypt on Windows and useless otherwise, it's not used when building for XP
+LIBARCHIVE_CONF +=-DENABLE_CNG=ON
+
+# bsdunzip doesn't build on macos, android and emscripten and it's disabled on Windows
+LIBARCHIVE_CONF +=-DENABLE_UNZIP=OFF
+
+ifdef HAVE_WIN32
+LIBARCHIVE_CONF += -DENABLE_OPENSSL=OFF
+endif
+
+ifdef HAVE_MACOSX
+# these functions are detected as present but there are not until macOS 10.10
+# the minimum supported value is 10.7, in each case missing the functions falls
+# back to an alternative
+LIBARCHIVE_CONF += -DHAVE_FDOPENDIR:INTERNAL= -DHAVE_OPENAT:INTERNAL= -DHAVE_FSTATAT:INTERNAL= -DHAVE_LINKAT:INTERNAL=
+endif
$(TARBALLS)/libarchive-$(LIBARCHIVE_VERSION).tar.gz:
$(call download_pkg,$(LIBARCHIVE_URL),libarchive)
@@ -21,17 +43,14 @@ $(TARBALLS)/libarchive-$(LIBARCHIVE_VERSION).tar.gz:
libarchive: libarchive-$(LIBARCHIVE_VERSION).tar.gz .sum-libarchive
$(UNPACK)
-ifdef HAVE_ANDROID
- $(APPLY) $(SRC)/libarchive/android.patch
-endif
-ifdef HAVE_WINSTORE
- $(APPLY) $(SRC)/libarchive/winrt.patch
-endif
+ $(APPLY) $(SRC)/libarchive/0001-zstd-use-GetNativeSystemInfo-to-get-the-number-of-th.patch
+ $(APPLY) $(SRC)/libarchive/0001-Don-t-use-Windows-bcrypt-when-building-for-Windows-X.patch
$(call pkg_static,"build/pkgconfig/libarchive.pc.in")
$(MOVE)
-.libarchive: libarchive
- $(RECONF)
- cd $< && $(HOSTVARS) ./configure $(HOSTCONF) $(LIBARCHIVE_CONF)
- cd $< && $(MAKE) install
+.libarchive: libarchive toolchain.cmake
+ $(CMAKECLEAN)
+ $(HOSTVARS) $(CMAKE) $(LIBARCHIVE_CONF)
+ +$(CMAKEBUILD)
+ $(CMAKEINSTALL)
touch $@
=====================================
contrib/src/libarchive/winrt.patch deleted
=====================================
@@ -1,531 +0,0 @@
-From 54904e02380cd05191458f4b99bef92308ca12c7 Mon Sep 17 00:00:00 2001
-From: Steve Lhomme <robux4 at ycbcr.xyz>
-Date: Fri, 27 Mar 2020 16:25:36 +0100
-Subject: [PATCH] WIP fix compilation for Universal Windows
-
----
- libarchive/archive_check_magic.c | 3 +-
- libarchive/archive_entry.h | 2 +-
- libarchive/archive_entry_copy_bhfi.c | 2 +-
- libarchive/archive_read_disk_windows.c | 9 ++++++
- .../archive_read_support_filter_bzip2.c | 4 +++
- .../archive_read_support_filter_grzip.c | 4 +++
- .../archive_read_support_filter_lrzip.c | 4 +++
- libarchive/archive_read_support_filter_lz4.c | 4 +++
- libarchive/archive_read_support_filter_lzop.c | 4 +++
- .../archive_read_support_filter_program.c | 14 ++++++---
- libarchive/archive_read_support_filter_xz.c | 12 +++++++
- libarchive/archive_read_support_filter_zstd.c | 4 +++
- .../archive_read_support_format_mtree.c | 10 ++++++
- libarchive/archive_string.c | 2 +-
- libarchive/archive_util.c | 9 +++++-
- libarchive/archive_windows.c | 31 ++++++++++++++++++-
- libarchive/archive_windows.h | 6 ++++
- libarchive/filter_fork_windows.c | 8 +++++
- 18 files changed, 121 insertions(+), 11 deletions(-)
-
-diff --git a/libarchive/archive_check_magic.c b/libarchive/archive_check_magic.c
-index 288ce233..3b3b9bc7 100644
---- a/libarchive/archive_check_magic.c
-+++ b/libarchive/archive_check_magic.c
-@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_check_magic.c 201089 2009-12-28
- #if defined(_WIN32) && !defined(__CYGWIN__)
- #include <windows.h>
- #include <winbase.h>
-+#include <winapifamily.h>
- #endif
-
- #include "archive_private.h"
-@@ -65,7 +66,7 @@ errmsg(const char *m)
- static __LA_DEAD void
- diediedie(void)
- {
--#if defined(_WIN32) && !defined(__CYGWIN__) && defined(_DEBUG)
-+#if defined(_WIN32) && !defined(__CYGWIN__) && defined(_DEBUG) && WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
- /* Cause a breakpoint exception */
- DebugBreak();
- #endif
-diff --git a/libarchive/archive_entry.h b/libarchive/archive_entry.h
-index 42af2086..cff6e55a 100644
---- a/libarchive/archive_entry.h
-+++ b/libarchive/archive_entry.h
-@@ -303,7 +303,7 @@ __LA_DECL int archive_entry_is_encrypted(struct archive_entry *);
-
- __LA_DECL void archive_entry_set_atime(struct archive_entry *, time_t, long);
- __LA_DECL void archive_entry_unset_atime(struct archive_entry *);
--#if defined(_WIN32) && !defined(__CYGWIN__)
-+#if defined(_WIN32) && !defined(__CYGWIN__) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
- __LA_DECL void archive_entry_copy_bhfi(struct archive_entry *, BY_HANDLE_FILE_INFORMATION *);
- #endif
- __LA_DECL void archive_entry_set_birthtime(struct archive_entry *, time_t, long);
-diff --git a/libarchive/archive_entry_copy_bhfi.c b/libarchive/archive_entry_copy_bhfi.c
-index 77bf38e4..22f9702c 100644
---- a/libarchive/archive_entry_copy_bhfi.c
-+++ b/libarchive/archive_entry_copy_bhfi.c
-@@ -29,7 +29,7 @@ __FBSDID("$FreeBSD$");
- #include "archive_private.h"
- #include "archive_entry.h"
-
--#if defined(_WIN32) && !defined(__CYGWIN__)
-+#if defined(_WIN32) && !defined(__CYGWIN__) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
-
- #define EPOC_TIME ARCHIVE_LITERAL_ULL(116444736000000000)
-
-diff --git a/libarchive/archive_read_disk_windows.c b/libarchive/archive_read_disk_windows.c
-index fdd376f9..85215326 100644
---- a/libarchive/archive_read_disk_windows.c
-+++ b/libarchive/archive_read_disk_windows.c
-@@ -715,7 +715,11 @@ start_next_async_read(struct archive_read_disk *a, struct tree *t)
- if (olp->buff == NULL) {
- void *p;
- size_t s = (size_t)align_num_per_sector(t, READ_BUFFER_SIZE);
-+#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
- p = VirtualAlloc(NULL, s, MEM_COMMIT, PAGE_READWRITE);
-+#else /* !WINAPI_PARTITION_DESKTOP */
-+ p = VirtualAllocFromApp(NULL, s, MEM_COMMIT, PAGE_READWRITE);
-+#endif /* !WINAPI_PARTITION_DESKTOP */
- if (p == NULL) {
- archive_set_error(&a->archive, ENOMEM,
- "Couldn't allocate memory");
-@@ -1512,7 +1516,12 @@ setup_current_filesystem(struct archive_read_disk *a)
-
- t->current_filesystem->synthetic = -1;/* Not supported */
- path = safe_path_for_statfs(t);
-+#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
- if (!GetVolumePathNameW(path, vol, sizeof(vol)/sizeof(vol[0]))) {
-+#else /* !WINAPI_PARTITION_DESKTOP */
-+ DWORD MaximumComponentLength, FileSystemFlags;
-+ if (!GetVolumeInformationW(path, vol, sizeof(vol)/sizeof(vol[0]), NULL, &MaximumComponentLength, &FileSystemFlags, NULL, 0)) {
-+#endif
- free(path);
- t->current_filesystem->remote = -1;
- t->current_filesystem->bytesPerSector = 0;
-diff --git a/libarchive/archive_read_support_filter_bzip2.c b/libarchive/archive_read_support_filter_bzip2.c
-index 3885a7cf..d2e8b001 100644
---- a/libarchive/archive_read_support_filter_bzip2.c
-+++ b/libarchive/archive_read_support_filter_bzip2.c
-@@ -169,6 +169,7 @@ bzip2_reader_bid(struct archive_read_filter_bidder *self, struct archive_read_fi
- static int
- bzip2_reader_init(struct archive_read_filter *self)
- {
-+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
- int r;
-
- r = __archive_read_program(self, "bzip2 -d");
-@@ -178,6 +179,9 @@ bzip2_reader_init(struct archive_read_filter *self)
- self->code = ARCHIVE_FILTER_BZIP2;
- self->name = "bzip2";
- return (r);
-+#else
-+ return ARCHIVE_FATAL;
-+#endif
- }
-
-
-diff --git a/libarchive/archive_read_support_filter_grzip.c b/libarchive/archive_read_support_filter_grzip.c
-index 84c86aeb..66c32b4b 100644
---- a/libarchive/archive_read_support_filter_grzip.c
-+++ b/libarchive/archive_read_support_filter_grzip.c
-@@ -109,6 +109,7 @@ grzip_bidder_bid(struct archive_read_filter_bidder *self,
- static int
- grzip_bidder_init(struct archive_read_filter *self)
- {
-+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
- int r;
-
- r = __archive_read_program(self, "grzip -d");
-@@ -118,4 +119,7 @@ grzip_bidder_init(struct archive_read_filter *self)
- self->code = ARCHIVE_FILTER_GRZIP;
- self->name = "grzip";
- return (r);
-+#else
-+ return ARCHIVE_FATAL;
-+#endif
- }
-diff --git a/libarchive/archive_read_support_filter_lrzip.c b/libarchive/archive_read_support_filter_lrzip.c
-index c82a8e2f..b4100b9a 100644
---- a/libarchive/archive_read_support_filter_lrzip.c
-+++ b/libarchive/archive_read_support_filter_lrzip.c
-@@ -120,6 +120,7 @@ lrzip_bidder_bid(struct archive_read_filter_bidder *self,
- static int
- lrzip_bidder_init(struct archive_read_filter *self)
- {
-+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
- int r;
-
- r = __archive_read_program(self, "lrzip -d -q");
-@@ -129,4 +130,7 @@ lrzip_bidder_init(struct archive_read_filter *self)
- self->code = ARCHIVE_FILTER_LRZIP;
- self->name = "lrzip";
- return (r);
-+#else
-+ return ARCHIVE_FATAL;
-+#endif
- }
-diff --git a/libarchive/archive_read_support_filter_lz4.c b/libarchive/archive_read_support_filter_lz4.c
-index 43ee6c2b..5d3baf91 100644
---- a/libarchive/archive_read_support_filter_lz4.c
-+++ b/libarchive/archive_read_support_filter_lz4.c
-@@ -204,6 +204,7 @@ lz4_reader_bid(struct archive_read_filter_bidder *self,
- static int
- lz4_reader_init(struct archive_read_filter *self)
- {
-+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
- int r;
-
- r = __archive_read_program(self, "lz4 -d -q");
-@@ -213,6 +214,9 @@ lz4_reader_init(struct archive_read_filter *self)
- self->code = ARCHIVE_FILTER_LZ4;
- self->name = "lz4";
- return (r);
-+#else
-+ return ARCHIVE_FATAL;
-+#endif
- }
-
-
-diff --git a/libarchive/archive_read_support_filter_lzop.c b/libarchive/archive_read_support_filter_lzop.c
-index a1c392f4..191688f4 100644
---- a/libarchive/archive_read_support_filter_lzop.c
-+++ b/libarchive/archive_read_support_filter_lzop.c
-@@ -160,6 +160,7 @@ lzop_bidder_bid(struct archive_read_filter_bidder *self,
- static int
- lzop_bidder_init(struct archive_read_filter *self)
- {
-+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
- int r;
-
- r = __archive_read_program(self, "lzop -d");
-@@ -169,6 +170,9 @@ lzop_bidder_init(struct archive_read_filter *self)
- self->code = ARCHIVE_FILTER_LZOP;
- self->name = "lzop";
- return (r);
-+#else
-+ return ARCHIVE_FATAL;
-+#endif
- }
- #else
- /*
-diff --git a/libarchive/archive_read_support_filter_program.c b/libarchive/archive_read_support_filter_program.c
-index b8bf1288..2197ed41 100644
---- a/libarchive/archive_read_support_filter_program.c
-+++ b/libarchive/archive_read_support_filter_program.c
-@@ -82,6 +82,8 @@ archive_read_support_filter_program(struct archive *a, const char *cmd)
- return (archive_read_support_filter_program_signature(a, cmd, NULL, 0));
- }
-
-+ #if !defined(_WIN32) || WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
-+
- /*
- * The bidder object stores the command and the signature to watch for.
- * The 'inhibit' entry here is used to ensure that unchecked filters never
-@@ -105,7 +107,7 @@ static int program_bidder_free(struct archive_read_filter_bidder *);
- */
- struct program_filter {
- struct archive_string description;
--#if defined(_WIN32) && !defined(__CYGWIN__)
-+#if defined(_WIN32) && !defined(__CYGWIN__) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
- HANDLE child;
- #else
- pid_t child;
-@@ -254,7 +256,7 @@ child_stop(struct archive_read_filter *self, struct program_filter *state)
- state->waitpid_return
- = waitpid(state->child, &state->exit_status, 0);
- } while (state->waitpid_return == -1 && errno == EINTR);
--#if defined(_WIN32) && !defined(__CYGWIN__)
-+#if defined(_WIN32) && !defined(__CYGWIN__) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
- CloseHandle(state->child);
- #endif
- state->child = 0;
-@@ -309,7 +311,7 @@ child_read(struct archive_read_filter *self, char *buf, size_t buf_len)
- struct program_filter *state = self->data;
- ssize_t ret, requested, avail;
- const char *p;
--#if defined(_WIN32) && !defined(__CYGWIN__)
-+#if defined(_WIN32) && !defined(__CYGWIN__) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
- HANDLE handle = (HANDLE)_get_osfhandle(state->child_stdout);
- #endif
-
-@@ -317,7 +319,7 @@ child_read(struct archive_read_filter *self, char *buf, size_t buf_len)
-
- for (;;) {
- do {
--#if defined(_WIN32) && !defined(__CYGWIN__)
-+#if defined(_WIN32) && !defined(__CYGWIN__) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
- /* Avoid infinity wait.
- * Note: If there is no data in the pipe, ReadFile()
- * called in read() never returns and so we won't
-@@ -516,3 +518,5 @@ program_filter_close(struct archive_read_filter *self)
-
- return (e);
- }
-+
-+#endif // !_WIN32 || WINAPI_PARTITION_DESKTOP
-diff --git a/libarchive/archive_read_support_filter_xz.c b/libarchive/archive_read_support_filter_xz.c
-index 11807cf6..856e08a5 100644
---- a/libarchive/archive_read_support_filter_xz.c
-+++ b/libarchive/archive_read_support_filter_xz.c
-@@ -754,6 +754,7 @@ xz_filter_close(struct archive_read_filter *self)
- static int
- lzma_bidder_init(struct archive_read_filter *self)
- {
-+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
- int r;
-
- r = __archive_read_program(self, "lzma -d -qq");
-@@ -763,11 +764,15 @@ lzma_bidder_init(struct archive_read_filter *self)
- self->code = ARCHIVE_FILTER_LZMA;
- self->name = "lzma";
- return (r);
-+#else
-+ return ARCHIVE_FATAL;
-+#endif
- }
-
- static int
- xz_bidder_init(struct archive_read_filter *self)
- {
-+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
- int r;
-
- r = __archive_read_program(self, "xz -d -qq");
-@@ -777,11 +782,15 @@ xz_bidder_init(struct archive_read_filter *self)
- self->code = ARCHIVE_FILTER_XZ;
- self->name = "xz";
- return (r);
-+#else
-+ return ARCHIVE_FATAL;
-+#endif
- }
-
- static int
- lzip_bidder_init(struct archive_read_filter *self)
- {
-+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
- int r;
-
- r = __archive_read_program(self, "lzip -d -q");
-@@ -791,6 +800,9 @@ lzip_bidder_init(struct archive_read_filter *self)
- self->code = ARCHIVE_FILTER_LZIP;
- self->name = "lzip";
- return (r);
-+#else
-+ return ARCHIVE_FATAL;
-+#endif
- }
-
- #endif /* HAVE_LZMA_H */
-diff --git a/libarchive/archive_read_support_filter_zstd.c b/libarchive/archive_read_support_filter_zstd.c
-index c8bb36be..84859211 100644
---- a/libarchive/archive_read_support_filter_zstd.c
-+++ b/libarchive/archive_read_support_filter_zstd.c
-@@ -143,6 +143,7 @@ zstd_bidder_bid(struct archive_read_filter_bidder *self,
- static int
- zstd_bidder_init(struct archive_read_filter *self)
- {
-+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
- int r;
-
- r = __archive_read_program(self, "zstd -d -qq");
-@@ -152,6 +153,9 @@ zstd_bidder_init(struct archive_read_filter *self)
- self->code = ARCHIVE_FILTER_ZSTD;
- self->name = "zstd";
- return (r);
-+#else
-+ return ARCHIVE_FATAL;
-+#endif
- }
-
- #else
-diff --git a/libarchive/archive_read_support_format_mtree.c b/libarchive/archive_read_support_format_mtree.c
-index 332944ac..8c647131 100644
---- a/libarchive/archive_read_support_format_mtree.c
-+++ b/libarchive/archive_read_support_format_mtree.c
-@@ -57,6 +57,8 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_format_mtree.c 2011
- #include "archive_string.h"
- #include "archive_pack_dev.h"
-
-+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
-+
- #ifndef O_BINARY
- #define O_BINARY 0
- #endif
-@@ -2023,3 +2025,11 @@ readline(struct archive_read *a, struct mtree *mtree, char **start,
- find_off = u - mtree->line.s;
- }
- }
-+
-+#else
-+int
-+archive_read_support_format_mtree(struct archive *_a)
-+{
-+ return ARCHIVE_OK;
-+}
-+#endif
-diff --git a/libarchive/archive_string.c b/libarchive/archive_string.c
-index c77dcf52..7942ff8b 100644
---- a/libarchive/archive_string.c
-+++ b/libarchive/archive_string.c
-@@ -1323,7 +1323,7 @@ free_sconv_object(struct archive_string_conv *sc)
- free(sc);
- }
-
--#if defined(_WIN32) && !defined(__CYGWIN__)
-+#if defined(_WIN32) && !defined(__CYGWIN__) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
- static unsigned
- my_atoi(const char *p)
- {
-diff --git a/libarchive/archive_util.c b/libarchive/archive_util.c
-index 659665a8..d526497f 100644
---- a/libarchive/archive_util.c
-+++ b/libarchive/archive_util.c
-@@ -209,7 +209,7 @@ __archive_errx(int retvalue, const char *msg)
- * Create a temporary file
- */
- #if defined(_WIN32) && !defined(__CYGWIN__)
--
-+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
- /*
- * Do not use Windows tmpfile() function.
- * It will make a temporary file under the root directory
-@@ -378,6 +378,13 @@ exit_tmpfile:
- archive_wstring_free(&temp_name);
- return (fd);
- }
-+#else
-+int
-+__archive_mktempx(const char *tmpdir, wchar_t *template)
-+{
-+ return -1;
-+}
-+#endif
-
- int
- __archive_mktemp(const char *tmpdir)
-diff --git a/libarchive/archive_windows.c b/libarchive/archive_windows.c
-index 624e2700..828a8543 100644
---- a/libarchive/archive_windows.c
-+++ b/libarchive/archive_windows.c
-@@ -235,6 +235,7 @@ la_CreateFile(const char *path, DWORD dwDesiredAccess, DWORD dwShareMode,
- wchar_t *wpath;
- HANDLE handle;
-
-+#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
- handle = CreateFileA(path, dwDesiredAccess, dwShareMode,
- lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes,
- hTemplateFile);
-@@ -249,6 +250,20 @@ la_CreateFile(const char *path, DWORD dwDesiredAccess, DWORD dwShareMode,
- lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes,
- hTemplateFile);
- free(wpath);
-+#else /* !WINAPI_PARTITION_DESKTOP */
-+ wpath = __la_win_permissive_name(path);
-+ if (wpath == NULL)
-+ return (handle);
-+ CREATEFILE2_EXTENDED_PARAMETERS createExParams;
-+ createExParams.dwSize = sizeof(CREATEFILE2_EXTENDED_PARAMETERS);
-+ createExParams.dwFileAttributes = dwFlagsAndAttributes & 0xFFFF;
-+ createExParams.dwFileFlags = dwFlagsAndAttributes & 0xFFF00000;
-+ createExParams.dwSecurityQosFlags = dwFlagsAndAttributes & 0x000F00000;
-+ createExParams.lpSecurityAttributes = lpSecurityAttributes;
-+ createExParams.hTemplateFile = hTemplateFile;
-+ handle = CreateFile2(wpath, dwDesiredAccess, dwShareMode, dwCreationDisposition, &createExParams);
-+ free(wpath);
-+#endif /* !WINAPI_PARTITION_DESKTOP */
- return (handle);
- }
-
-@@ -320,7 +335,7 @@ __la_open(const char *path, int flags, ...)
- }
- if (attr & FILE_ATTRIBUTE_DIRECTORY) {
- HANDLE handle;
--
-+#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
- if (ws != NULL)
- handle = CreateFileW(ws, 0, 0, NULL,
- OPEN_EXISTING,
-@@ -333,6 +348,20 @@ __la_open(const char *path, int flags, ...)
- FILE_FLAG_BACKUP_SEMANTICS |
- FILE_ATTRIBUTE_READONLY,
- NULL);
-+#else /* !WINAPI_PARTITION_DESKTOP */
-+ if (ws != NULL) {
-+ CREATEFILE2_EXTENDED_PARAMETERS createExParams;
-+ createExParams.dwSize = sizeof(CREATEFILE2_EXTENDED_PARAMETERS);
-+ createExParams.dwFileAttributes = FILE_ATTRIBUTE_READONLY;
-+ createExParams.dwFileFlags = FILE_FLAG_BACKUP_SEMANTICS;
-+ createExParams.dwSecurityQosFlags = 0;
-+ createExParams.lpSecurityAttributes = NULL;
-+ createExParams.hTemplateFile = NULL;
-+ handle = CreateFile2(ws, 0, 0, OPEN_EXISTING, &createExParams);
-+ }
-+ else
-+ handle = INVALID_HANDLE_VALUE;
-+#endif /* !WINAPI_PARTITION_DESKTOP */
- free(ws);
- if (handle == INVALID_HANDLE_VALUE) {
- la_dosmaperr(GetLastError());
-diff --git a/libarchive/archive_windows.h b/libarchive/archive_windows.h
-index 47b7cb8e..9743f310 100644
---- a/libarchive/archive_windows.h
-+++ b/libarchive/archive_windows.h
-@@ -106,9 +106,11 @@
- #define lseek __la_lseek
- #define __LA_LSEEK_NEEDED
- #endif
-+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
- #define lstat __la_stat
- #define open __la_open
- #define read __la_read
-+#endif
- #if !defined(__BORLANDC__) && !defined(__WATCOMC__)
- #define setmode _setmode
- #endif
-@@ -122,8 +124,10 @@
- #define umask _umask
- #endif
- #endif
-+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
- #define waitpid __la_waitpid
- #define write __la_write
-+#endif
-
- #if !defined(__WATCOMC__)
-
-@@ -276,8 +280,10 @@ extern int __la_stat(const char *path, struct stat *st);
- extern pid_t __la_waitpid(HANDLE child, int *status, int option);
- extern ssize_t __la_write(int fd, const void *buf, size_t nbytes);
-
-+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
- #define _stat64i32(path, st) __la_stat(path, st)
- #define _stat64(path, st) __la_stat(path, st)
-+#endif
- /* for status returned by la_waitpid */
- #define WIFEXITED(sts) ((sts & 0x100) == 0)
- #define WEXITSTATUS(sts) (sts & 0x0FF)
-diff --git a/libarchive/filter_fork_windows.c b/libarchive/filter_fork_windows.c
-index ad271fe6..0414d6f4 100644
---- a/libarchive/filter_fork_windows.c.orig 2020-12-26 02:29:38.000000000 +0100
-+++ b/libarchive/filter_fork_windows.c 2021-04-21 17:17:42.651099766 +0200
-@@ -31,6 +31,13 @@
-
- #include "filter_fork.h"
-
-+#if !WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
-+int
-+__archive_create_child(const char *cmd, int *child_stdin, int *child_stdout, HANDLE *out_child)
-+{
-+ return ARCHIVE_FAILED;
-+}
-+#else /* WINAPI_PARTITION_DESKTOP */
- int
- __archive_create_child(const char *cmd, int *child_stdin, int *child_stdout,
- HANDLE *out_child)
-@@ -187,6 +194,7 @@
- __archive_cmdline_free(acmd);
- return ARCHIVE_FAILED;
- }
-+#endif /* WINAPI_PARTITION_DESKTOP */
-
- void
- __archive_check_child(int in, int out)
=====================================
contrib/src/pthreads/0001-headers-enable-CreateHardLinkW-in-Win10-UWP-builds.patch
=====================================
@@ -0,0 +1,36 @@
+From dd4f835601548529980550ddb0a66a7c8881ce9b Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Thu, 25 May 2023 09:44:35 +0200
+Subject: [PATCH] headers: enable CreateHardLinkW in Win10 UWP builds
+
+The documentation doesn't say it's allowed, but the WIndows SDK allow it and
+the Windows App Certification as well.
+
+The official page for allowed API's also doesn't say it's allowed [1]
+but the DLL that contains it is there.
+
+[1] https://learn.microsoft.com/en-us/uwp/win32-and-com/win32-apis#apis-from-api-ms-win-core-file-l2-1-0dll
+---
+ mingw-w64-headers/include/winbase.h | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/mingw-w64-headers/include/winbase.h b/mingw-w64-headers/include/winbase.h
+index 82c8b7cc3..94f5df309 100644
+--- a/mingw-w64-headers/include/winbase.h
++++ b/mingw-w64-headers/include/winbase.h
+@@ -2464,9 +2464,11 @@ typedef enum FILE_FLUSH_MODE {
+ WINBASEAPI WINBOOL WINAPI ReplaceFileA (LPCSTR lpReplacedFileName, LPCSTR lpReplacementFileName, LPCSTR lpBackupFileName, DWORD dwReplaceFlags, LPVOID lpExclude, LPVOID lpReserved);
+ WINBASEAPI WINBOOL WINAPI ReplaceFileW (LPCWSTR lpReplacedFileName, LPCWSTR lpReplacementFileName, LPCWSTR lpBackupFileName, DWORD dwReplaceFlags, LPVOID lpExclude, LPVOID lpReserved);
+ #endif
++#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP) || _WIN32_WINNT >= _WIN32_WINNT_WIN10
++ WINBASEAPI WINBOOL WINAPI CreateHardLinkW (LPCWSTR lpFileName, LPCWSTR lpExistingFileName, LPSECURITY_ATTRIBUTES lpSecurityAttributes);
++#endif
+ #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
+ WINBASEAPI WINBOOL WINAPI CreateHardLinkA (LPCSTR lpFileName, LPCSTR lpExistingFileName, LPSECURITY_ATTRIBUTES lpSecurityAttributes);
+- WINBASEAPI WINBOOL WINAPI CreateHardLinkW (LPCWSTR lpFileName, LPCWSTR lpExistingFileName, LPSECURITY_ATTRIBUTES lpSecurityAttributes);
+
+ #define ReplaceFile __MINGW_NAME_AW(ReplaceFile)
+ #define CreateHardLink __MINGW_NAME_AW(CreateHardLink)
+--
+2.37.3.windows.1
+
=====================================
contrib/src/pthreads/0001-headers-enable-GetFileInformationByHandle-in-Win10-U.patch
=====================================
@@ -0,0 +1,28 @@
+From ad395a3d5a9873e4388bf34687fd3e705e384a0d Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Wed, 24 May 2023 08:39:51 +0200
+Subject: [PATCH] headers: enable GetFileInformationByHandle in Win10 UWP
+ builds
+
+Contrary to what the documentation says, it's available in the Windows SDK,
+both in the headers and when linking with WindowsApp.lib.
+---
+ mingw-w64-headers/include/fileapi.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/mingw-w64-headers/include/fileapi.h b/mingw-w64-headers/include/fileapi.h
+index ffbe12560..d22c62704 100644
+--- a/mingw-w64-headers/include/fileapi.h
++++ b/mingw-w64-headers/include/fileapi.h
+@@ -32,7 +32,7 @@ WINBASEAPI DWORD WINAPI GetFileAttributesW (LPCWSTR lpFileName);
+ #define GetFileAttributes __MINGW_NAME_AW(GetFileAttributes)
+ WINBASEAPI DWORD WINAPI SetFilePointer (HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod);
+ #endif
+-#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP) || defined(WINSTORECOMPAT)
++#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP) || _WIN32_WINNT >= _WIN32_WINNT_WIN10
+ typedef struct _BY_HANDLE_FILE_INFORMATION {
+ DWORD dwFileAttributes;
+ FILETIME ftCreationTime;
+--
+2.37.3.windows.1
+
=====================================
contrib/src/pthreads/0001-headers-enable-GetVolumePathNameW-in-Win10-UWP-build.patch
=====================================
@@ -0,0 +1,39 @@
+From de5009b7952c6c74511facef02c3d21855b4ee0e Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Sat, 27 May 2023 11:52:25 +0200
+Subject: [PATCH] headers: enable GetVolumePathNameW in Win10 UWP builds
+
+The documentation doesn't say it's allowed, but the WIndows SDK allow it and
+the Windows App Certification as well.
+
+The official page for allowed API's also doesn't say it's allowed [1]
+but the DLL that contains it is there.
+
+[1] https://learn.microsoft.com/en-us/uwp/win32-and-com/win32-apis#apis-from-api-ms-win-core-file-l2-1-0dll
+---
+ mingw-w64-headers/include/fileapi.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/mingw-w64-headers/include/fileapi.h b/mingw-w64-headers/include/fileapi.h
+index 8ea09f6c9..e9e0c647f 100644
+--- a/mingw-w64-headers/include/fileapi.h
++++ b/mingw-w64-headers/include/fileapi.h
+@@ -81,6 +81,7 @@ WINBASEAPI DWORD WINAPI SetFilePointer (HANDLE hFile, LONG lDistanceToMove, PLON
+ WINBASEAPI DWORD WINAPI GetFullPathNameA (LPCSTR lpFileName, DWORD nBufferLength, LPSTR lpBuffer, LPSTR *lpFilePart);
+ WINBASEAPI DWORD WINAPI GetFullPathNameW (LPCWSTR lpFileName, DWORD nBufferLength, LPWSTR lpBuffer, LPWSTR *lpFilePart);
+ WINBASEAPI DWORD WINAPI GetLogicalDrives (VOID);
++ WINBASEAPI WINBOOL WINAPI GetVolumePathNameW (LPCWSTR lpszFileName, LPWSTR lpszVolumePathName, DWORD cchBufferLength);
+ #define FindFirstFile __MINGW_NAME_AW(FindFirstFile)
+ #define GetDiskFreeSpace __MINGW_NAME_AW(GetDiskFreeSpace)
+ #define GetDriveType __MINGW_NAME_AW(GetDriveType)
+@@ -89,7 +90,6 @@ WINBASEAPI DWORD WINAPI SetFilePointer (HANDLE hFile, LONG lDistanceToMove, PLON
+ #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
+ WINBASEAPI DWORD WINAPI GetLogicalDriveStringsW (DWORD nBufferLength, LPWSTR lpBuffer);
+ WINBASEAPI DWORD WINAPI GetShortPathNameW (LPCWSTR lpszLongPath, LPWSTR lpszShortPath, DWORD cchBuffer);
+- WINBASEAPI WINBOOL WINAPI GetVolumePathNameW (LPCWSTR lpszFileName, LPWSTR lpszVolumePathName, DWORD cchBufferLength);
+ WINBASEAPI DWORD WINAPI QueryDosDeviceW (LPCWSTR lpDeviceName, LPWSTR lpTargetPath, DWORD ucchMax);
+ WINBASEAPI WINBOOL WINAPI ReadFileScatter (HANDLE hFile, FILE_SEGMENT_ELEMENT aSegmentArray[], DWORD nNumberOfBytesToRead, LPDWORD lpReserved, LPOVERLAPPED lpOverlapped);
+ WINBASEAPI WINBOOL WINAPI SetFileValidData (HANDLE hFile, LONGLONG ValidDataLength);
+--
+2.37.3.windows.1
+
=====================================
contrib/src/pthreads/0001-headers-enable-VirtualAlloc-Ex-in-Win10-UWP-builds.patch
=====================================
@@ -0,0 +1,37 @@
+From 9559b683801027a3a944b60dd4c7b49debbcb66e Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Thu, 25 May 2023 08:19:26 +0200
+Subject: [PATCH] headers: enable VirtualAlloc(Ex) in Win10 UWP builds
+
+It is now officially allowed [1].
+
+[1] https://learn.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-virtualalloc
+---
+ mingw-w64-headers/include/memoryapi.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/mingw-w64-headers/include/memoryapi.h b/mingw-w64-headers/include/memoryapi.h
+index 0f2b4ae79..152671c18 100644
+--- a/mingw-w64-headers/include/memoryapi.h
++++ b/mingw-w64-headers/include/memoryapi.h
+@@ -29,6 +29,8 @@ extern "C" {
+ #endif
+
+ #if (WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP) && _WIN32_WINNT >= _WIN32_WINNT_WIN10) || WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
++ WINBASEAPI LPVOID WINAPI VirtualAlloc (LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect);
++ WINBASEAPI LPVOID WINAPI VirtualAllocEx (HANDLE hProcess, LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect);
+ WINBASEAPI WINBOOL WINAPI VirtualFree (LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType);
+ #endif
+
+@@ -78,8 +80,6 @@ extern "C" {
+ #define FILE_CACHE_MIN_HARD_ENABLE 0x00000004
+ #define FILE_CACHE_MIN_HARD_DISABLE 0x00000008
+
+- WINBASEAPI LPVOID WINAPI VirtualAlloc (LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect);
+- WINBASEAPI LPVOID WINAPI VirtualAllocEx (HANDLE hProcess, LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect);
+ WINBASEAPI WINBOOL WINAPI VirtualProtectEx (HANDLE hProcess, LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, PDWORD lpflOldProtect);
+ WINBASEAPI SIZE_T WINAPI VirtualQueryEx (HANDLE hProcess, LPCVOID lpAddress, PMEMORY_BASIC_INFORMATION lpBuffer, SIZE_T dwLength);
+ WINBASEAPI WINBOOL WINAPI ReadProcessMemory (HANDLE hProcess, LPCVOID lpBaseAddress, LPVOID lpBuffer, SIZE_T nSize, SIZE_T *lpNumberOfBytesRead);
+--
+2.37.3.windows.1
+
=====================================
contrib/src/pthreads/rules.mak
=====================================
@@ -9,8 +9,11 @@ ifdef HAVE_WIN32
PKGS += pthreads
ifndef HAVE_VISUALSTUDIO
+ifdef HAVE_WINSTORE
+PKGS += alloweduwp
+endif
PKGS += dxva dxvahd
-PKGS_ALL += dxva dxvahd
+PKGS_ALL += dxva dxvahd alloweduwp
ifeq ($(call mingw_at_least, 10), true)
PKGS_FOUND += dxva
endif # MINGW 10
@@ -37,6 +40,10 @@ pthreads: mingw-w64-$(MINGW64_HASH).tar.xz .sum-pthreads
$(UNPACK)
$(APPLY) $(SRC)/pthreads/0001-headers-Update-to-Wine-master-and-regenerate-H-from-.patch
$(APPLY) $(SRC)/pthreads/0002-headers-dxvahd-Regenerate-H-from-IDL.patch
+ $(APPLY) $(SRC)/pthreads/0001-headers-enable-GetFileInformationByHandle-in-Win10-U.patch
+ $(APPLY) $(SRC)/pthreads/0001-headers-enable-VirtualAlloc-Ex-in-Win10-UWP-builds.patch
+ $(APPLY) $(SRC)/pthreads/0001-headers-enable-CreateHardLinkW-in-Win10-UWP-builds.patch
+ $(APPLY) $(SRC)/pthreads/0001-headers-enable-GetVolumePathNameW-in-Win10-UWP-build.patch
$(MOVE)
.pthreads: pthreads
@@ -60,3 +67,13 @@ pthreads: mingw-w64-$(MINGW64_HASH).tar.xz .sum-pthreads
cd $< && cp mingw-w64-headers/include/dxva.h "$(PREFIX)/include"
touch $@
+
+.sum-alloweduwp: .sum-pthreads
+ touch $@
+
+.alloweduwp: pthreads
+ install -d "$(PREFIX)/include"
+ install $</mingw-w64-headers/include/fileapi.h "$(PREFIX)/include"
+ install $</mingw-w64-headers/include/memoryapi.h "$(PREFIX)/include"
+ install $</mingw-w64-headers/include/winbase.h "$(PREFIX)/include"
+ touch $@
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b8e6e00809f36cb9e74bac0b9d6a4b58d532575d...76ef452e901739f0431d8feacc47845f81b4a15c
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b8e6e00809f36cb9e74bac0b9d6a4b58d532575d...76ef452e901739f0431d8feacc47845f81b4a15c
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list