[vlc-commits] [Git][videolan/vlc][master] 2 commits: contrib/mingw64: fix the DllMain signature declaration

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Sep 29 07:31:16 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
a4b4d938 by Steve Lhomme at 2023-09-29T06:49:28+00:00
contrib/mingw64: fix the DllMain signature declaration

It should be using an unsigned long, not an unsigned.

- - - - -
3b728b54 by Steve Lhomme at 2023-09-29T06:49:28+00:00
win32: really fix the DllMain signature

After 9ca790a6414b43c81ed0d539e9d200cc25ea4b0e the DWORD turned into
an unsigned, but it should be an unsigned long.

- - - - -


4 changed files:

- + contrib/src/mingw64/0001-include-process-fix-bare-DllMain-_CRT_INIT-signature.patch
- contrib/src/mingw64/rules.mak
- modules/access/wasapi.c
- src/win32/thread.c


Changes:

=====================================
contrib/src/mingw64/0001-include-process-fix-bare-DllMain-_CRT_INIT-signature.patch
=====================================
@@ -0,0 +1,33 @@
+From aa4e9797bac4b353ebfd6159e731e8347ea10f28 Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Wed, 27 Sep 2023 13:53:54 +0200
+Subject: [PATCH] include/process: fix bare DllMain/_CRT_INIT signature
+
+The DWORD reason corresponds to an "unsigned long", not an "unsigned".
+This is also how it's defined in the Windows SDK.
+---
+ mingw-w64-headers/crt/process.h | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/mingw-w64-headers/crt/process.h b/mingw-w64-headers/crt/process.h
+index 08b73cf58..1ac39a064 100644
+--- a/mingw-w64-headers/crt/process.h
++++ b/mingw-w64-headers/crt/process.h
+@@ -138,10 +138,10 @@ extern "C" {
+   WINBOOL WINAPI _wCRT_INIT(HANDLE _HDllHandle,DWORD _Reason,LPVOID _Reserved);
+   extern WINBOOL (WINAPI *const _pRawDllMain)(HANDLE,DWORD,LPVOID);
+ #else
+-  int __stdcall DllMain(void *_HDllHandle,unsigned _Reason,void *_Reserved);
+-  int __stdcall _CRT_INIT(void *_HDllHandle,unsigned _Reason,void *_Reserved);
+-  int __stdcall _wCRT_INIT(void *_HDllHandle,unsigned _Reason,void *_Reserved);
+-  extern int (__stdcall *const _pRawDllMain)(void *,unsigned,void *);
++  int __stdcall DllMain(void *_HDllHandle,unsigned long _Reason,void *_Reserved);
++  int __stdcall _CRT_INIT(void *_HDllHandle,unsigned long _Reason,void *_Reserved);
++  int __stdcall _wCRT_INIT(void *_HDllHandle,unsigned long _Reason,void *_Reserved);
++  extern int (__stdcall *const _pRawDllMain)(void *,unsigned long,void *);
+ #endif
+ #endif
+ 
+-- 
+2.37.3.windows.1
+


=====================================
contrib/src/mingw64/rules.mak
=====================================
@@ -14,7 +14,7 @@ PKGS += winrt_headers alloweduwp
 else  # !HAVE_WINSTORE
 PKGS += d3d9 dcomp
 endif # !HAVE_WINSTORE
-PKGS += dxva dxvahd
+PKGS += dxva dxvahd mingw11-fixes
 
 ifeq ($(call mingw_at_least, 8), true)
 PKGS_FOUND += d3d9
@@ -33,6 +33,9 @@ endif
 ifeq ($(call mingw_at_least, 11), true)
 PKGS_FOUND += dxvahd
 endif # MINGW 11
+ifeq ($(call mingw_at_least, 12), true)
+PKGS_FOUND += mingw11-fixes
+endif # MINGW 12
 endif # !HAVE_VISUALSTUDIO
 
 HAVE_WINPTHREAD := $(shell $(CC) $(CFLAGS) -E -dM -include pthread.h - < /dev/null >/dev/null 2>&1 || echo FAIL)
@@ -42,7 +45,7 @@ endif
 
 endif # HAVE_WIN32
 
-PKGS_ALL += winpthreads winrt_headers d3d9 dxva dxvahd dcomp alloweduwp
+PKGS_ALL += winpthreads winrt_headers d3d9 dxva dxvahd dcomp mingw11-fixes alloweduwp
 
 $(TARBALLS)/mingw-w64-$(MINGW64_HASH).tar.xz:
 	$(call download_git,$(MINGW64_GITURL),,$(MINGW64_HASH))
@@ -80,6 +83,7 @@ mingw64: mingw-w64-v$(MINGW64_VERSION).tar.bz2 .sum-mingw64
 	$(APPLY) $(SRC)/mingw64/0003-headers-allow-more-wincrypt-API-s-in-Win10-RS4-UWP-b.patch
 	$(APPLY) $(SRC)/mingw64/0004-headers-allow-more-wincrypt-API-s-in-Win10-19H1-UWP-.patch
 	$(APPLY) $(SRC)/mingw64/0005-crt-use-wincrypt-API-from-windowsapp-in-Windows-10.patch
+	$(APPLY) $(SRC)/mingw64/0001-include-process-fix-bare-DllMain-_CRT_INIT-signature.patch
 	$(MOVE)
 
 .mingw64: mingw64
@@ -121,6 +125,14 @@ MINGW_HEADERS_WINRT := \
 	install $</mingw-w64-headers/include/dxvahd.h "$(PREFIX)/include"
 	touch $@
 
+.sum-mingw11-fixes: .sum-mingw64
+	touch $@
+
+.mingw11-fixes: mingw64
+	install -d "$(PREFIX)/include"
+	install $</mingw-w64-headers/crt/process.h "$(PREFIX)/include"
+	touch $@
+
 .sum-dcomp: .sum-mingw64
 	touch $@
 


=====================================
modules/access/wasapi.c
=====================================
@@ -75,7 +75,7 @@ static msftime_t GetQPC_100ns(void)
 
 static msftime_t (*get_qpc)(void);
 
-int __stdcall DllMain(void *dll, unsigned reason, void *reserved)
+int __stdcall DllMain(void *dll, unsigned long reason, void *reserved)
 {
     (void) dll;
     (void) reserved;


=====================================
src/win32/thread.c
=====================================
@@ -707,7 +707,7 @@ void vlc_threads_setup(libvlc_int_t *vlc)
 
 #define LOOKUP(s) (((s##_) = (void *)GetProcAddress(h, #s)) != NULL)
 
-int __stdcall DllMain (void *hinstDll, unsigned fdwReason, void *lpvReserved)
+int __stdcall DllMain (void *hinstDll, unsigned long fdwReason, void *lpvReserved)
 {
     (void) hinstDll;
     (void) lpvReserved;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/ba02c9b5aceeefb6b5848a47784d2f84988e19e3...3b728b54f2ab4caccbe2d5a5e69473e19597f482

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/ba02c9b5aceeefb6b5848a47784d2f84988e19e3...3b728b54f2ab4caccbe2d5a5e69473e19597f482
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