78 lines
2.3 KiB
Diff
78 lines
2.3 KiB
Diff
From 8046053fef0ce72a6b771258de76bd5d651864cb Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B9?=
|
|
<alexey.pawlow@gmail.com>
|
|
Date: Thu, 17 Jun 2021 18:51:20 +0530
|
|
Subject: [PATCH 009/N] Build winreg by default when compiling for MINGW
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
Co-authored-by: Алексей <alexey.pawlow@gmail.com>
|
|
Co-authored-by: Christoph Reiter <reiter.christoph@gmail.com>
|
|
Co-authored-by: Naveen M K <naveen521kk@gmail.com>
|
|
---
|
|
Modules/Setup.bootstrap.in | 3 +++
|
|
PC/winreg.c | 19 +++++++++++++++++++
|
|
configure.ac | 7 +++++++
|
|
3 files changed, 29 insertions(+)
|
|
|
|
diff --git a/Modules/Setup.bootstrap.in b/Modules/Setup.bootstrap.in
|
|
index 1f21d35..3def7e8 100644
|
|
--- a/Modules/Setup.bootstrap.in
|
|
+++ b/Modules/Setup.bootstrap.in
|
|
@@ -34,3 +34,6 @@ _symtable symtablemodule.c
|
|
|
|
# for systems without $HOME env, used by site._getuserbase()
|
|
@MODULE_PWD_TRUE@pwd pwdmodule.c
|
|
+
|
|
+# build-in modules for windows platform:
|
|
+@USE_WIN32_MODULE@winreg ../PC/winreg.c
|
|
diff --git a/PC/winreg.c b/PC/winreg.c
|
|
index e2d5322..368291d 100644
|
|
--- a/PC/winreg.c
|
|
+++ b/PC/winreg.c
|
|
@@ -19,6 +19,25 @@
|
|
#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 1bc4974..c2b1e6c 100644
|
|
--- a/configure.ac
|
|
+++ b/configure.ac
|
|
@@ -4487,6 +4487,13 @@ done
|
|
IFS=$as_save_IFS
|
|
AC_MSG_RESULT([$DBM_CFLAGS $DBM_LIBS])
|
|
|
|
+# 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],
|