MINGW-packages/mingw-w64-python/0122-winreg-patch-cleanup.patch
2025-10-10 14:31:04 +02:00

87 lines
2.7 KiB
Diff

From 5f118e451982c9502876e07fdf384d94dfff3975 Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Sun, 31 Aug 2025 16:40:48 +0200
Subject: [PATCH 122/N] winreg: patch cleanup
* REG_LEGAL_CHANGE_FILTER is part of mingw-w64 now
* SIZEOF_HKEY is defined already
* use the same build logic as with other win32 only modules
Needs to be merged into "Build winreg by default when compiling for MINGW"
Fixes #181
---
Modules/Setup.bootstrap.in | 2 +-
PC/winreg.c | 19 -------------------
configure.ac | 8 +-------
3 files changed, 2 insertions(+), 27 deletions(-)
diff --git a/Modules/Setup.bootstrap.in b/Modules/Setup.bootstrap.in
index cec80f5..271a5b6 100644
--- a/Modules/Setup.bootstrap.in
+++ b/Modules/Setup.bootstrap.in
@@ -36,6 +36,6 @@ _symtable symtablemodule.c
@MODULE_PWD_TRUE@pwd pwdmodule.c
# build-in modules for windows platform:
-@USE_WIN32_MODULE@winreg ../PC/winreg.c
+@MODULE_WINREG_TRUE@winreg ../PC/winreg.c
@MODULE_MSVCRT_TRUE@msvcrt -DPy_BUILD_CORE ../PC/msvcrtmodule.c
@MODULE__WINAPI_TRUE@_winapi _winapi.c
diff --git a/PC/winreg.c b/PC/winreg.c
index 33ec8ff..e8f36c1 100644
--- a/PC/winreg.c
+++ b/PC/winreg.c
@@ -19,25 +19,6 @@
#include "structmember.h" // PyMemberDef
#include <windows.h>
-#ifndef SIZEOF_HKEY
-/* used only here */
-#if defined(MS_WIN64)
-# define SIZEOF_HKEY 8
-#elif defined(MS_WIN32)
-# define SIZEOF_HKEY 4
-#else
-# error "SIZEOF_HKEY is not defined"
-#endif
-#endif
-
-#ifndef REG_LEGAL_CHANGE_FILTER
-#define REG_LEGAL_CHANGE_FILTER (\
- REG_NOTIFY_CHANGE_NAME |\
- REG_NOTIFY_CHANGE_ATTRIBUTES |\
- REG_NOTIFY_CHANGE_LAST_SET |\
- REG_NOTIFY_CHANGE_SECURITY )
-#endif
-
#if defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES)
typedef struct {
diff --git a/configure.ac b/configure.ac
index 10a6e84..5dcec81 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4633,13 +4633,6 @@ case $host in
CFLAGS_NODIST="$CFLAGS_NODIST -D_WIN32_WINNT=0x0602";;
esac
-# Determine if windows modules should be used.
-AC_SUBST(USE_WIN32_MODULE)
-USE_WIN32_MODULE='#'
-case $host in
- *-*-mingw*) USE_WIN32_MODULE=;;
-esac
-
# Templates for things AC_DEFINEd more than once.
# For a single AC_DEFINE, no template is needed.
AH_TEMPLATE([_REENTRANT],
@@ -8059,6 +8052,7 @@ PY_STDLIB_MOD([_hashlib], [], [test "$ac_cv_working_openssl_hashlib" = yes],
[$OPENSSL_INCLUDES], [$OPENSSL_LDFLAGS $OPENSSL_LDFLAGS_RPATH $LIBCRYPTO_LIBS])
dnl windows specific modules
+PY_STDLIB_MOD([winreg], [test "$MACHDEP" = "win32"])
PY_STDLIB_MOD([msvcrt], [test "$MACHDEP" = "win32"])
PY_STDLIB_MOD([_winapi], [test "$MACHDEP" = "win32"])
PY_STDLIB_MOD([_msi], [test "$MACHDEP" = "win32"], [], [],