From a4b4d938cc978b66f93b8edfe5602735d4f9a711 Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Wed, 27 Sep 2023 13:57:40 +0200 Subject: [PATCH] contrib/mingw64: fix the DllMain signature declaration It should be using an unsigned long, not an unsigned. --- ...fix-bare-DllMain-_CRT_INIT-signature.patch | 33 +++++++++++++++++++ contrib/src/mingw64/rules.mak | 16 +++++++-- 2 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 contrib/src/mingw64/0001-include-process-fix-bare-DllMain-_CRT_INIT-signature.patch diff --git a/contrib/src/mingw64/0001-include-process-fix-bare-DllMain-_CRT_INIT-signature.patch b/contrib/src/mingw64/0001-include-process-fix-bare-DllMain-_CRT_INIT-signature.patch new file mode 100644 index 0000000000..f8b2306bc2 --- /dev/null +++ b/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 +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 + diff --git a/contrib/src/mingw64/rules.mak b/contrib/src/mingw64/rules.mak index 4df47c1f68..5659b56511 100644 --- a/contrib/src/mingw64/rules.mak +++ b/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 $