[vlc-commits] [Git][videolan/vlc][3.0.x] 21 commits: vlc_fixup: don't redefine IN6_IS_ADDR_MULTICAST with newer mingw

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sat Jun 6 13:25:30 UTC 2026



Jean-Baptiste Kempf pushed to branch 3.0.x at VideoLAN / VLC


Commits:
971d9356 by Steve Lhomme at 2026-06-06T14:08:29+02:00
vlc_fixup: don't redefine IN6_IS_ADDR_MULTICAST with newer mingw

The proper fix has been in mingw-w64 since version 6, which is our minimum [^1].
It was entirely removed in VLC 4 with 73c858ddc134da61abd7aa0c76bfa6d6613ccc9c.

[^1]: https://github.com/mingw-w64/mingw-w64/commit/4c2df0d02ed71ae07e85f1b35ac857a148cd2b8f

- - - - -
29bb9cdf by Steve Lhomme at 2026-06-06T14:08:29+02:00
contrib: allow GetHandleInformation() in newer UWP versions

In VLC 4 the patches were removed in 313a3991ef7a9041cd6afec1f979332578815476.

- - - - -
0454cc7d by Steve Lhomme at 2026-06-06T14:08:29+02:00
vlc_network: map gai_strerror to the ANSI version on all Windows UNICODE builds

It doesn't depend on the WINAPI family. VLC expects it to return char*.

(cherry picked from commit 72843f162c8cda61f7610ac242f8979909916cf9)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
5e98d854 by Steve Lhomme at 2026-06-06T14:08:29+02:00
gai_strerror: add declaration as its not defined in vlc_fixups.h

(cherry picked from commit 0c45a05b8748acd2b97218d8633c6fdcda89343f)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
c9cf03bd by Steve Lhomme at 2026-06-06T14:08:29+02:00
gai_strerror: remap Windows SDK EAI_NODATA to WSANO_DATA

Otherwise it's mapped to WSAHOST_NOT_FOUND which we already handle with EAI_NONAME.
And we wouldn't have a string for WSANO_DATA.

(cherry picked from commit 8f9d92fd5c4bc3ec35c92f80d13e3f27b3c6e2ea)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
5d481a5c by Steve Lhomme at 2026-06-06T14:08:29+02:00
gai_strerror: map missing Windows getaddrinfo/getnameinfo errors

gai_strerror() is called to get the string version of an error code returned by
vlc_getaddrinfo(), vlc_getnameinfo() or vlc_getaddrinfo_i11e(). In all
cases the value comes from an OS call. On Windows they return both EAI_* and a
lot of WSA errors [^1].

The strings come from src/win32/error.c.

[^1]: https://learn.microsoft.com/en-us/windows/win32/api/ws2tcpip/nf-ws2tcpip-getaddrinfo#return-value

(cherry picked from commit fabc936116822567af28ed3a43012e2774779b03)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
bf7fa3af by Steve Lhomme at 2026-06-06T14:08:29+02:00
build: always use the compat version of gai_strerror() on Windows

We don't know what codepage the might be for gai_strerrorA() and the
documentation [^1] doesn't mention if it's using it or not. Internally
we deal with UTF-8 char* strings.

Also the Windows version is not thread safe. The returned pointer is always the
same and points to different content.

[^1]: https://learn.microsoft.com/en-us/windows/win32/api/ws2tcpip/nf-ws2tcpip-gai_strerrora

(cherry picked from commit 70ff5756b3996cbd10343cd2c905d3ae7781b1fe) (edited)
edited:
- 3.0 doesn't have meson
- the code around is slightly different
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
ac00ec54 by Steve Lhomme at 2026-06-06T14:08:29+02:00
contrib: libtasn1: fix UWP build

The gnulib rpl_stat() function uses CreateFileA which is forbidden.
We need to use CreateFile2 in UWP.

(cherry picked from commit 8da7610cd2738765b7b5306e0fb6d04ea4becea3) (rebased)
rebased:
- VLC 3 still uses the old system to update config.guess
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
361fc9ea by Steve Lhomme at 2026-06-06T14:08:29+02:00
contrib: shout: avoid getpid calls on Windows

It's not available in UWP.

(cherry picked from commit 5c6c69fab916cd98e19f22369c4bb485185c6c9f) (rebased)
rebased:
- VLC 3 still uses the old system to update config.guess
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
f61f1a8d by Steve Lhomme at 2026-06-06T14:08:29+02:00
contrib: shout: Add cast on setsockopt() call

So it can match POSIX and Win32 signatures. This is the same cast done a few lines above.

(cherry picked from commit a1a4b3f33d5ab3ce383c74f1e9ed6607812f7489)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
92c94be0 by Steve Lhomme at 2026-06-06T14:08:29+02:00
contrib: libdsm: Cast getsockopt pointer to match POSIX and Win32 signatures

(cherry picked from commit d114c448d18d444dbe184acb869ea2e40f3506e2)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
ab3c7da1 by Steve Lhomme at 2026-06-06T14:08:29+02:00
contrib: orc: add missing crossfile.meson depedency

Missing from 0ca61cd3fdebfc06177bb5b7dd03597705cd6c10.

(cherry picked from commit e08395f8fab4293e8f2da992dc295728392379db)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
fe20a219 by Steve Lhomme at 2026-06-06T14:08:29+02:00
contrib: orc: remove unnecessary UPDATE_AUTOCONFIG

We build with meson since 724f05184099e7422133584ab8fb9ba57af6d447.

- - - - -
8527f70c by Steve Lhomme at 2026-06-06T14:08:29+02:00
contrib: orc: fix pointers in Windows calls

- - - - -
255241df by Rémi Denis-Courmont at 2026-06-06T14:08:29+02:00
winstore: fix invalid pointer aliasing

(cherry picked from commit 33015966e6eb6ef0e032cdbc18a706175748e381)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
533568c3 by Steve Lhomme at 2026-06-06T14:08:29+02:00
winstore: don't get the COM interface pointers directly

Partial backport of e99f23d50f5d89b3e1f2ac2cdadaae01cd479ae5.

- - - - -
a88f67f9 by Steve Lhomme at 2026-06-06T14:08:29+02:00
configure: always use ws2_32 and iphlpapi for Windows networking

There is no reason to test connect is in some system library.
And the detection fails for mingw-12 UWP.

(cherry picked from commit 25dfe4a2efd0db5995427e5a5b816dbe1d65e3da)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
9505c5b0 by Steve Lhomme at 2026-06-06T14:08:29+02:00
rand: use bcrypt instead of CryptographicBufferStatics for Winstore

It's available to winstore apps and on desktop since Vista.
The old API is deprecated.

(cherry picked from commit 12aab7fe8ec76a7eaf7d051762f8d83dfc262b3c)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
938c4ddc by Steve Lhomme at 2026-06-06T14:08:29+02:00
win32/dirs: use the properly prefixed class names

Adapted backport of c454659305ac0b79373405db5333b3a0e7c37f6b

- - - - -
09da163f by Steve Lhomme at 2026-06-06T14:08:29+02:00
Revert "CI: test the UWP with a x86 target"

This reverts commit 0e6f874df5f0887073c222cd4bf8c3d603a52d1a.

It seems UWP64 has more issues lately than 32-bit UWP.

- - - - -
9eeb4c57 by Steve Lhomme at 2026-06-06T14:08:29+02:00
CI: add UWP Windows arm64 target

- - - - -


19 changed files:

- compat/gai_strerror.c
- configure.ac
- contrib/src/gnutls/0001-fcntl-do-not-call-GetHandleInformation-in-Winstore-a.patch
- contrib/src/iconv/0001-do-not-call-GetHandleInformation-in-Winstore-apps.patch
- + contrib/src/libdsm/0001-Cast-getsockopt-pointer.patch
- contrib/src/libdsm/rules.mak
- + contrib/src/libtasn1/0001-Use-CreateFile2-in-UWP-builds.patch
- contrib/src/libtasn1/0001-fcntl-do-not-call-GetHandleInformation-in-Winstore-a.patch
- contrib/src/libtasn1/rules.mak
- contrib/src/orc/rules.mak
- + contrib/src/shout/0001-Add-cast-on-setsockopt-call.patch
- + contrib/src/shout/0001-Favor-GetCurrentProcessId-on-Windows.patch
- contrib/src/shout/rules.mak
- extras/ci/gitlab-ci.yml
- include/vlc_fixups.h
- include/vlc_network.h
- modules/audio_output/winstore.c
- src/win32/dirs.c
- src/win32/rand.c


Changes:

=====================================
compat/gai_strerror.c
=====================================
@@ -27,6 +27,26 @@
 # include "config.h"
 #endif
 
+const char *gai_strerror (int);
+
+#ifdef _WIN32
+# include <winsock2.h>
+# undef gai_strerror /* mapped to gai_strerrorA or gai_strerrorW */
+
+#ifdef _MSC_VER
+/* EAI_NODATA was removed in RFC 3493
+ * The Windows SDK defines EAI_NODATA as EAI_NONAME, aka WSAHOST_NOT_FOUND.
+ * It used to be WSANO_DATA. Remap it locally so we have strings for all the
+ * WSA errors that getaddrinfo() can return.
+ *
+ * In mingw-w64 EAI_NODATA is still mapped to WSANO_DATA.
+ */
+# undef EAI_NODATA
+# define EAI_NODATA  WSANO_DATA
+#endif
+
+#endif /* _WIN32 */
+
 /* GAI error codes. See include/vlc_network.h. */
 #ifndef EAI_BADFLAGS
 # define EAI_BADFLAGS -1
@@ -84,6 +104,12 @@ static const struct
     { EAI_MEMORY,     "Memory allocation failure" },
     { EAI_OVERFLOW,   "Buffer overflow" },
     { EAI_SYSTEM,     "System error" },
+
+#ifdef _WIN32
+    { WSAEFAULT,      "Invalid memory address" },
+    { WSANOTINITIALISED, "WSAStartup not called or failed" },
+#endif
+
     { 0,              "" },
 };
 


=====================================
configure.ac
=====================================
@@ -396,8 +396,8 @@ AS_IF([test "${SYS}" = "mingw32"],[
     AX_APPEND_FLAG([-DWINSTORECOMPAT],[CXXFLAGS])
     AX_APPEND_FLAG([-lwinstorecompat], [LDFLAGS])
     VLC_ADD_LIBS([libvlccore], [-lruntimeobject])
-    AC_LIBOBJ([gai_strerror])
   ],[])
+  AC_LIBOBJ([gai_strerror])
   AC_SUBST(LIBCOM)
   ])
 AC_DEFINE_UNQUOTED(VLC_WINSTORE_APP, ${vlc_winstore_app}, [Define to 1 if you want to build for Windows Store apps])
@@ -1028,13 +1028,13 @@ AX_APPEND_COMPILE_FLAGS([-pipe], [CFLAGS])
 dnl Checks for socket stuff
 VLC_SAVE_FLAGS
 SOCKET_LIBS=""
-AC_SEARCH_LIBS(connect, [socket], [
-  AS_IF([test "$ac_cv_search_connect" != "none required"], [
-    SOCKET_LIBS="$ac_cv_search_connect"
-  ])
-], [
-  AS_IF([test "${SYS}" = "mingw32"], [
-    SOCKET_LIBS="-lws2_32 -liphlpapi"
+AS_IF([test "${SYS}" = "mingw32"], [
+  SOCKET_LIBS="-lws2_32 -liphlpapi"
+],[
+  AC_SEARCH_LIBS(connect, [socket], [
+    AS_IF([test "$ac_cv_search_connect" != "none required"], [
+      SOCKET_LIBS="$ac_cv_search_connect"
+    ])
   ])
 ])
 
@@ -1255,7 +1255,10 @@ AH_BOTTOM([
   dnl Win32 requires linking to ssp for stack-protection
   AS_IF([test "${SYS}" = "mingw32"], [
       LDFLAGS="${LDFLAGS} -lssp"
-      AS_IF([test "${vlc_winstore_app}" != 1], [LDFLAGS="${LDFLAGS} -ladvapi32"])
+      dnl library for Crypt/BCrypt APIs
+      AS_IF([test "${vlc_winstore_app}" != 1],
+            [LDFLAGS="${LDFLAGS} -ladvapi32"],
+            [LDFLAGS="${LDFLAGS} -lbcrypt"])
   ])
 ])
 


=====================================
contrib/src/gnutls/0001-fcntl-do-not-call-GetHandleInformation-in-Winstore-a.patch
=====================================
@@ -20,7 +20,7 @@ index 6b9927ec4..e316ca306 100644
        {
  # if defined _WIN32 && ! defined __CYGWIN__
          HANDLE handle = (HANDLE) _get_osfhandle (fd);
-+#  if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
++#  if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP) || NTDDI_VERSION >= NTDDI_WIN10_19H1
          DWORD flags;
          if (handle == INVALID_HANDLE_VALUE
              || GetHandleInformation (handle, &flags) == 0)


=====================================
contrib/src/iconv/0001-do-not-call-GetHandleInformation-in-Winstore-apps.patch
=====================================
@@ -20,7 +20,7 @@ index e220800845..c95322b2d4 100644
  #  include <io.h>
  # endif
  
-+# if defined WINAPI_FAMILY && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
++# if defined WINAPI_FAMILY && !(WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) || NTDDI_VERSION >= NTDDI_WIN10_19H1)
 +/* GetHandleInformation is not available in UWP, the flags it would provide
 +   are also not available, so we just return 0.
 +   <https://docs.microsoft.com/en-us/windows/win32/api/handleapi/nf-handleapi-gethandleinformation>


=====================================
contrib/src/libdsm/0001-Cast-getsockopt-pointer.patch
=====================================
@@ -0,0 +1,26 @@
+From 782ab6c5a1bc0d5c2232eb61b4425713566cadf3 Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Wed, 1 Apr 2026 08:43:48 +0200
+Subject: [PATCH] Cast getsockopt pointer
+
+So it can match POSIX and Win32 signatures.
+---
+ src/netbios_session.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/netbios_session.c b/src/netbios_session.c
+index 9aabf12..124eb21 100644
+--- a/src/netbios_session.c
++++ b/src/netbios_session.c
+@@ -123,7 +123,7 @@ static int open_socket_and_connect(netbios_session *s)
+ 
+             if (FD_ISSET(s->socket, &write_fds))
+             {
+-                if (getsockopt(s->socket, SOL_SOCKET, SO_ERROR, &ret,
++                if (getsockopt(s->socket, SOL_SOCKET, SO_ERROR, (void*) &ret,
+                                &(socklen_t){ sizeof (ret) }) || ret)
+                 {
+                     errno = ret;
+-- 
+2.52.0.windows.1
+


=====================================
contrib/src/libdsm/rules.mak
=====================================
@@ -21,6 +21,7 @@ libdsm: libdsm-$(LIBDSM_VERSION).tar.xz .sum-libdsm
 	$(UNPACK)
 	$(APPLY) $(SRC)/libdsm/0001-Avoid-relying-on-implicit-function-declarations.patch
 	$(APPLY) $(SRC)/libdsm/0001-use-GetCurrentProcessId-for-the-process-ID-on-Window.patch
+	$(APPLY) $(SRC)/libdsm/0001-Cast-getsockopt-pointer.patch
 	$(MOVE)
 
 DEPS_libdsm = libtasn1 $(DEPS_libtasn1) iconv $(DEPS_iconv)


=====================================
contrib/src/libtasn1/0001-Use-CreateFile2-in-UWP-builds.patch
=====================================
@@ -0,0 +1,73 @@
+From 8425c77fe89d66cd8d5411d0ccd14c688de1416a Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Tue, 16 May 2023 09:40:34 +0200
+Subject: [PATCH] Use CreateFile2 in UWP builds
+
+CreateFileA and CreateFileW are forbidden calls in UWP.
+CreateFile2 is close enough, some parameters are passed in a structure
+and it requires a WCHAR filename. Given the original stat uses the
+"multibyte code page currently in use" [1], the char should be converted
+using CP_ACP [2].
+
+[1] https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/stat-functions
+[2] https://learn.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-multibytetowidechar#parameters
+---
+ lib/stat.c | 35 +++++++++++++++++++++++++++++++++++
+ 1 file changed, 35 insertions(+)
+
+diff --git a/src/gl/stat.c b/src/gl/stat.c
+index 7987e26583..f0e95a27dc 100644
+--- a/src/gl/stat.c
++++ b/src/gl/stat.c
+@@ -197,6 +197,7 @@ rpl_stat (char const *name, struct stat *buf)
+     {
+       /* Approach based on the file.  */
+ 
++# if !defined WINAPI_FAMILY || WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+       /* Open a handle to the file.
+          CreateFile
+          <https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-createfilea>
+@@ -212,6 +213,40 @@ rpl_stat (char const *name, struct stat *buf)
+                        filesystem operations.  */
+                     FILE_FLAG_BACKUP_SEMANTICS /* | FILE_FLAG_POSIX_SEMANTICS */,
+                     NULL);
++# else
++      /* Only CreateFile2 is available in UWP builds.
++         <https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfile2>
++         <https://learn.microsoft.com/en-us/uwp/win32-and-com/win32-apis#apis-from-api-ms-win-core-file-l1-2-1dll>  */
++      HANDLE h = INVALID_HANDLE_VALUE;
++      int wlen = MultiByteToWideChar (CP_ACP, 0, rname, -1, NULL, 0);
++      if (wlen > 0)
++        {
++          WCHAR *wrname = malloca (wlen * sizeof (WCHAR));
++          if (wrname != NULL)
++            {
++              MultiByteToWideChar (CP_ACP, 0, rname, -1, wrname, wlen);
++
++              CREATEFILE2_EXTENDED_PARAMETERS createExParams;
++              createExParams.dwSize = sizeof(CREATEFILE2_EXTENDED_PARAMETERS);
++              createExParams.dwFileAttributes = FILE_ATTRIBUTE_NORMAL;
++              /* FILE_FLAG_POSIX_SEMANTICS (treat file names that differ only
++                  in case as different) makes sense only when applied to *all*
++                  filesystem operations.  */
++              createExParams.dwFileFlags = FILE_FLAG_BACKUP_SEMANTICS;
++              createExParams.dwSecurityQosFlags = 0;
++              createExParams.lpSecurityAttributes = NULL;
++              createExParams.hTemplateFile = NULL;
++
++              h =
++                CreateFile2 (wrname,
++                             FILE_READ_ATTRIBUTES,
++                             FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
++                             OPEN_EXISTING,
++                             &createExParams);
++              freea(wrname);
++            }
++        }
++# endif
+       if (h != INVALID_HANDLE_VALUE)
+         {
+           ret = _gl_fstat_by_handle (h, rname, buf);
+-- 
+2.37.3.windows.1
+


=====================================
contrib/src/libtasn1/0001-fcntl-do-not-call-GetHandleInformation-in-Winstore-a.patch
=====================================
@@ -20,7 +20,7 @@ index 6b9927ec4..e316ca306 100644
        {
  # if defined _WIN32 && ! defined __CYGWIN__
          HANDLE handle = (HANDLE) _get_osfhandle (fd);
-+#  if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
++#  if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP) || NTDDI_VERSION >= NTDDI_WIN10_19H1
          DWORD flags;
          if (handle == INVALID_HANDLE_VALUE
              || GetHandleInformation (handle, &flags) == 0)


=====================================
contrib/src/libtasn1/rules.mak
=====================================
@@ -16,6 +16,9 @@ libtasn1: libtasn1-$(LIBTASN1_VERSION).tar.gz .sum-libtasn1
 	$(UNPACK)
 	$(UPDATE_AUTOCONFIG) && cd $(UNPACK_DIR) && mv config.guess config.sub build-aux
 	$(APPLY) $(SRC)/libtasn1/0001-fcntl-do-not-call-GetHandleInformation-in-Winstore-a.patch
+
+	# use CreateFile2 instead of CreateFile in UWP
+	$(APPLY) $(SRC)/libtasn1/0001-Use-CreateFile2-in-UWP-builds.patch
 	$(MOVE)
 
 LIBTASN1_CONF := --disable-doc


=====================================
contrib/src/orc/rules.mak
=====================================
@@ -14,17 +14,19 @@ $(TARBALLS)/orc-$(ORC_VERSION).tar.bz2:
 
 orc: orc-$(ORC_VERSION).tar.bz2 .sum-orc
 	$(UNPACK)
-	$(UPDATE_AUTOCONFIG)
 	$(APPLY) $(SRC)/orc/0001-Fix-usage-of-pthread_jit_write_protect_np-on-macOS-a.patch
 
 	# replace FORMAT_MESSAGE_ALLOCATE_BUFFER which may not be available in older mingw-w64 UWP
 	sed -i.orig -e s/FORMAT_MESSAGE_ALLOCATE_BUFFER/0x00000100/g $(UNPACK_DIR)/orc/orccompiler.c
+	sed -i.orig -e 's/LPTSTR/LPSTR/' $(UNPACK_DIR)/orc/orccompiler.c
+	# fix bogus pointer passed to VirtualProtectFromApp()
+	sed -i.orig -e 's/int old_protect/ULONG old_protect/' $(UNPACK_DIR)/orc/orccompiler.c
 
 	$(MOVE)
 
 ORC_CONF := -Dauto_features=disabled
 
-.orc: orc
+.orc: orc crossfile.meson
 	$(MESONCLEAN)
 	$(MESON) $(ORC_CONF)
 	+$(MESONBUILD)


=====================================
contrib/src/shout/0001-Add-cast-on-setsockopt-call.patch
=====================================
@@ -0,0 +1,26 @@
+From 19502f905828e21d90bb80e45d8a7546bdd0c2fb Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Wed, 1 Apr 2026 08:07:28 +0200
+Subject: [PATCH] Add cast on setsockopt() call
+
+So it can match POSIX and Win32 signatures. This is the same cast done a few lines above.
+---
+ src/common/net/sock.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/common/net/sock.c b/src/common/net/sock.c
+index b11bc0d..aa7aa47 100644
+--- a/src/common/net/sock.c
++++ b/src/common/net/sock.c
+@@ -743,7 +743,7 @@ sock_t sock_get_server_socket (int port, const char *sinterface)
+         setsockopt (sock, SOL_SOCKET, SO_REUSEADDR, (const void *)&on, sizeof(on));
+         on = 0;
+ #ifdef IPV6_V6ONLY
+-        setsockopt (sock, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof on);
++        setsockopt (sock, IPPROTO_IPV6, IPV6_V6ONLY, (const void *)&on, sizeof on);
+ #endif
+ 
+         if (bind (sock, ai->ai_addr, ai->ai_addrlen) < 0)
+-- 
+2.52.0.windows.1
+


=====================================
contrib/src/shout/0001-Favor-GetCurrentProcessId-on-Windows.patch
=====================================
@@ -0,0 +1,33 @@
+From 8a11efd9c218275816f75148e7096c27f390932c Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Tue, 23 May 2023 14:23:11 +0200
+Subject: [PATCH] Favor GetCurrentProcessId() on Windows
+
+getpid() is not available in UWP [1] builds but GetCurrentProcessId() is.
+It's available since Windows XP [2].
+
+[1] https://learn.microsoft.com/en-us/cpp/cppcx/crt-functions-not-supported-in-universal-windows-platform-apps
+[2] https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-getcurrentprocessid
+---
+ src/proto_roaraudio.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/proto_roaraudio.c b/src/proto_roaraudio.c
+index 041590d..a2b1fb5 100644
+--- a/src/proto_roaraudio.c
++++ b/src/proto_roaraudio.c
+@@ -111,7 +111,11 @@ static int shout_create_roaraudio_request_ident(shout_t *self, shout_connection_
+     size_t      datalen;
+     uint8_t    *data;
+     const char *agent;
++#ifdef _WIN32
++    uint32_t    pid = GetCurrentProcessId();
++#else
+     uint32_t    pid = getpid();
++#endif
+ 
+     /* We implement version 1 IDENTIFY header.
+      * It has the following structure:
+-- 
+2.37.3.windows.1
+


=====================================
contrib/src/shout/rules.mak
=====================================
@@ -29,6 +29,13 @@ libshout: libshout-$(SHOUT_VERSION).tar.gz .sum-shout
 	$(APPLY) $(SRC)/shout/should-win32-ws2tcpip.patch
 	$(APPLY) $(SRC)/shout/win32-gettimeofday.patch
 	$(APPLY) $(SRC)/shout/add-missing-stdlib-stdio.patch
+
+	# don't use getpid in UWP as it's not actually available
+	$(APPLY) $(SRC)/shout/0001-Favor-GetCurrentProcessId-on-Windows.patch
+
+	# cast setsockopt
+	$(APPLY) $(SRC)/shout/0001-Add-cast-on-setsockopt-call.patch
+
 	$(call pkg_static,"shout.pc.in")
 	$(MOVE)
 


=====================================
extras/ci/gitlab-ci.yml
=====================================
@@ -137,13 +137,23 @@ win64-arm-llvm:
     variables:
         <<: *variables-win64-arm
 
-uwp32-libvlc-llvm:
+uwp64-libvlc-llvm:
     extends: .win-common
     image:
         name: $VLC_UWP_LLVM_IMAGE
     variables:
-        <<: *variables-win32
-        VLCARCH: win32-uwp
+        <<: *variables-win64
+        VLCARCH: win64-uwp
+        LIBVLC_EXTRA_BUILD_FLAGS: -z
+        UWP_EXTRA_BUILD_FLAGS: -u -w
+
+uwparm64-libvlc-llvm:
+    extends: .win-common
+    image:
+        name: $VLC_WIN_LLVM_UCRT_IMAGE
+    variables:
+        <<: *variables-win64-arm
+        VLCARCH: winarm64-uwp
         LIBVLC_EXTRA_BUILD_FLAGS: -z
         UWP_EXTRA_BUILD_FLAGS: -u -w
 


=====================================
include/vlc_fixups.h
=====================================
@@ -661,7 +661,9 @@ char *realpath(const char * restrict pathname, char * restrict resolved_path);
 
 /* mingw-w64 has a broken IN6_IS_ADDR_MULTICAST macro */
 #if defined(_WIN32) && defined(__MINGW64_VERSION_MAJOR)
+# if __MINGW64_VERSION_MAJOR < 6 /* fixed in 4c2df0d02ed71ae07e85f1b35ac857a148cd2b8f */
 # define IN6_IS_ADDR_MULTICAST IN6_IS_ADDR_MULTICAST
+# endif
 #endif
 
 #ifdef __APPLE__


=====================================
include/vlc_network.h
=====================================
@@ -211,10 +211,9 @@ static inline int vlc_setsockopt(int s, int level, int name,
 #endif
 
 #ifdef _WIN32
-# if !defined(WINAPI_FAMILY) || WINAPI_FAMILY != WINAPI_FAMILY_APP
+/* undo ws2tcpip.h define and declare the signature from compat */
 #  undef gai_strerror
-#  define gai_strerror gai_strerrorA
-# endif
+const char *gai_strerror (int);
 #endif
 
 VLC_API int vlc_getnameinfo( const struct sockaddr *, int, char *, int, int *, int );


=====================================
modules/audio_output/winstore.c
=====================================
@@ -280,6 +280,7 @@ static int VolumeSet(audio_output_t *aout, float vol)
     if( unlikely( sys->client == NULL ) )
         return VLC_EGENERIC;
     HRESULT hr;
+    void *pv = NULL;
     ISimpleAudioVolume *pc_AudioVolume = NULL;
 
     float linear_vol = vol * vol * vol; /* ISimpleAudioVolume is tapered linearly. */
@@ -294,12 +295,13 @@ static int VolumeSet(audio_output_t *aout, float vol)
 
     aout_GainRequest(aout, sys->gain);
 
-    hr = IAudioClient_GetService(sys->client, &IID_ISimpleAudioVolume, &pc_AudioVolume);
+    hr = IAudioClient_GetService(sys->client, &IID_ISimpleAudioVolume, &pv);
     if (FAILED(hr))
     {
         msg_Err(aout, "cannot get volume service (error 0x%lX)", hr);
         goto done;
     }
+    pc_AudioVolume = pv;
 
     hr = ISimpleAudioVolume_SetMasterVolume(pc_AudioVolume, linear_vol, NULL);
     if (FAILED(hr))
@@ -323,14 +325,16 @@ static int MuteSet(audio_output_t *aout, bool mute)
     if( unlikely( sys->client == NULL ) )
         return VLC_EGENERIC;
     HRESULT hr;
+    void *pv = NULL;
     ISimpleAudioVolume *pc_AudioVolume = NULL;
 
-    hr = IAudioClient_GetService(sys->client, &IID_ISimpleAudioVolume, &pc_AudioVolume);
+    hr = IAudioClient_GetService(sys->client, &IID_ISimpleAudioVolume, &pv);
     if (FAILED(hr))
     {
         msg_Err(aout, "cannot get volume service (error 0x%lX)", hr);
         goto done;
     }
+    pc_AudioVolume = pv;
 
     hr = ISimpleAudioVolume_SetMute(pc_AudioVolume, mute, NULL);
     if (FAILED(hr))
@@ -505,14 +509,16 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
     // Report the initial volume and mute status to the core
     if (sys->client != NULL)
     {
-        ISimpleAudioVolume* pc_AudioVolume = NULL;
+        ISimpleAudioVolume *pc_AudioVolume = NULL;
+        void *pv;
 
-        hr = IAudioClient_GetService(sys->client, &IID_ISimpleAudioVolume, &pc_AudioVolume);
+        hr = IAudioClient_GetService(sys->client, &IID_ISimpleAudioVolume, &pv);
         if (FAILED(hr))
         {
             msg_Err(aout, "cannot get volume service (error 0x%lx)", hr);
             goto done;
         }
+        pc_AudioVolume = pv;
 
         float vol;
         hr = ISimpleAudioVolume_GetMasterVolume(pc_AudioVolume, &vol);


=====================================
src/win32/dirs.c
=====================================
@@ -49,9 +49,41 @@
 
 #if VLC_WINSTORE_APP
 #include <winstring.h>
+#define WIDL_using_Windows_Storage
 #include <windows.storage.h>
 #include <roapi.h>
 
+#ifndef IStorageItem_get_Path
+typedef __x_ABI_CWindows_CStorage_CIStorageFolder IStorageFolder;
+typedef __x_ABI_CWindows_CStorage_CIStorageItem   IStorageItem;
+typedef __x_ABI_CWindows_CStorage_CIKnownFoldersStatics IKnownFoldersStatics;
+typedef __x_ABI_CWindows_CStorage_CIApplicationDataStatics IApplicationDataStatics;
+typedef __x_ABI_CWindows_CStorage_CIApplicationData IApplicationData;
+typedef __x_ABI_CWindows_CStorage_CIApplicationData2 IApplicationData2;
+
+#define IID_IStorageItem IID___x_ABI_CWindows_CStorage_CIStorageItem
+#define IID_IKnownFoldersStatics IID___x_ABI_CWindows_CStorage_CIKnownFoldersStatics
+#define IID_IApplicationDataStatics IID___x_ABI_CWindows_CStorage_CIApplicationDataStatics
+#define IID_IApplicationData2 IID___x_ABI_CWindows_CStorage_CIApplicationData2
+
+#define IKnownFoldersStatics_get_DocumentsLibrary(a,f) __x_ABI_CWindows_CStorage_CIKnownFoldersStatics_get_DocumentsLibrary(a,f)
+#define IKnownFoldersStatics_get_MusicLibrary(a,f) __x_ABI_CWindows_CStorage_CIKnownFoldersStatics_get_MusicLibrary(a,f)
+#define IKnownFoldersStatics_get_PicturesLibrary(a,f) __x_ABI_CWindows_CStorage_CIKnownFoldersStatics_get_PicturesLibrary(a,f)
+#define IKnownFoldersStatics_get_VideosLibrary(a,f) __x_ABI_CWindows_CStorage_CIKnownFoldersStatics_get_VideosLibrary(a,f)
+#define IStorageItem_get_Path(a,f) __x_ABI_CWindows_CStorage_CIStorageItem_get_Path(a,f)
+#define IStorageItem_Release(a) __x_ABI_CWindows_CStorage_CIStorageItem_Release(a)
+#define IStorageFolder_Release(a) __x_ABI_CWindows_CStorage_CIStorageFolder_Release(a)
+#define IStorageFolder_QueryInterface(a,i,v) __x_ABI_CWindows_CStorage_CIStorageFolder_QueryInterface(a,i,v)
+#define IKnownFoldersStatics_Release(a) __x_ABI_CWindows_CStorage_CIKnownFoldersStatics_Release(a)
+#define IApplicationDataStatics_get_Current(a,f) __x_ABI_CWindows_CStorage_CIApplicationDataStatics_get_Current(a,f)
+#define IApplicationData_get_LocalFolder(a,f) __x_ABI_CWindows_CStorage_CIApplicationData_get_LocalFolder(a,f)
+#define IApplicationDataStatics_Release(a) __x_ABI_CWindows_CStorage_CIApplicationDataStatics_Release(a)
+#define IApplicationData_Release(a) __x_ABI_CWindows_CStorage_CIApplicationData_Release(a)
+#define IApplicationData_QueryInterface(a,i,v) __x_ABI_CWindows_CStorage_CIApplicationData_QueryInterface(a,i,v)
+#define IApplicationData2_get_LocalCacheFolder(a,f) __x_ABI_CWindows_CStorage_CIApplicationData2_get_LocalCacheFolder(a,f)
+#define IApplicationData2_Release(a) __x_ABI_CWindows_CStorage_CIApplicationData2_Release(a)
+#endif
+
 #ifndef CSIDL_LOCAL_APPDATA
 # define CSIDL_LOCAL_APPDATA 0x001C
 #endif


=====================================
src/win32/rand.c
=====================================
@@ -27,17 +27,23 @@
 #include <vlc_rand.h>
 
 #if VLC_WINSTORE_APP
-# define COBJMACROS
-# define INITGUID
-# include <winstring.h>
-# include <roapi.h>
-# include <windows.security.cryptography.h>
+# include <bcrypt.h>
 #else
 # include <wincrypt.h>
 #endif
 
 void vlc_rand_bytes (void *buf, size_t len)
 {
+#if VLC_WINSTORE_APP
+    BCRYPT_ALG_HANDLE algo_handle;
+    NTSTATUS ret = BCryptOpenAlgorithmProvider(&algo_handle, BCRYPT_RNG_ALGORITHM,
+                                               MS_PRIMITIVE_PROVIDER, 0);
+    if (BCRYPT_SUCCESS(ret))
+    {
+        BCryptGenRandom(algo_handle, buf, len, 0);
+        BCryptCloseAlgorithmProvider(algo_handle, 0);
+    }
+#else
     size_t count = len;
     uint8_t *p_buf = (uint8_t *)buf;
 
@@ -57,40 +63,6 @@ void vlc_rand_bytes (void *buf, size_t len)
         p_buf += sizeof (val);
     }
 
-#if VLC_WINSTORE_APP
-    static const WCHAR *className = L"Windows.Security.Cryptography.CryptographicBuffer";
-    const UINT32 clen = wcslen(className);
-
-    HSTRING hClassName = NULL;
-    HSTRING_HEADER header;
-    HRESULT hr = WindowsCreateStringReference(className, clen, &header, &hClassName);
-    if (hr) {
-        WindowsDeleteString(hClassName);
-        return;
-    }
-
-    ICryptographicBufferStatics *cryptoStatics = NULL;
-    hr = RoGetActivationFactory(hClassName, &IID_ICryptographicBufferStatics, (void**)&cryptoStatics);
-    WindowsDeleteString(hClassName);
-
-    if (hr)
-        return;
-
-    IBuffer *buffer = NULL;
-    hr = ICryptographicBufferStatics_GenerateRandom(cryptoStatics, len, &buffer);
-    if (hr) {
-        ICryptographicBufferStatics_Release(cryptoStatics);
-        return;
-    }
-
-    UINT32 olength;
-    unsigned char *rnd = NULL;
-    hr = ICryptographicBufferStatics_CopyToByteArray(cryptoStatics, buffer, &olength, (BYTE**)&rnd);
-    memcpy(buf, rnd, len);
-
-    IBuffer_Release(buffer);
-    ICryptographicBufferStatics_Release(cryptoStatics);
-#else
     HCRYPTPROV hProv;
     /* acquire default encryption context */
     if( CryptAcquireContext(



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/8f3a15f163d3213c65e7c9a243cf6bfbed38b346...9eeb4c57dfdc5789b0041fb106411f80d69e994d

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/8f3a15f163d3213c65e7c9a243cf6bfbed38b346...9eeb4c57dfdc5789b0041fb106411f80d69e994d
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list