Skip to content

Commit 9092f75

Browse files
Alexpuxlazka
andcommitted
Build winreg by default when compiling for MINGW
Co-authored-by: Алексей <[email protected]> Co-authored-by: Christoph Reiter <[email protected]>
1 parent 30061bb commit 9092f75

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

Modules/Setup.bootstrap.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,6 @@ _symtable symtablemodule.c
3333

3434
# for systems without $HOME env, used by site._getuserbase()
3535
@MODULE_PWD_TRUE@pwd pwdmodule.c
36+
37+
# build-in modules for windows platform:
38+
@USE_WIN32_MODULE@winreg ../PC/winreg.c

PC/winreg.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,25 @@
1818
#include "structmember.h" // PyMemberDef
1919
#include <windows.h>
2020

21+
#ifndef SIZEOF_HKEY
22+
/* used only here */
23+
#if defined(MS_WIN64)
24+
# define SIZEOF_HKEY 8
25+
#elif defined(MS_WIN32)
26+
# define SIZEOF_HKEY 4
27+
#else
28+
# error "SIZEOF_HKEY is not defined"
29+
#endif
30+
#endif
31+
32+
#ifndef REG_LEGAL_CHANGE_FILTER
33+
#define REG_LEGAL_CHANGE_FILTER (\
34+
REG_NOTIFY_CHANGE_NAME |\
35+
REG_NOTIFY_CHANGE_ATTRIBUTES |\
36+
REG_NOTIFY_CHANGE_LAST_SET |\
37+
REG_NOTIFY_CHANGE_SECURITY )
38+
#endif
39+
2140
static BOOL PyHKEY_AsHKEY(PyObject *ob, HKEY *pRes, BOOL bNoneOK);
2241
static BOOL clinic_HKEY_converter(PyObject *ob, void *p);
2342
static PyObject *PyHKEY_FromHKEY(HKEY h);

configure.ac

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4161,6 +4161,13 @@ AS_VAR_IF([with_dbmliborder], [error], [
41614161
])
41624162
AC_MSG_RESULT($with_dbmliborder)
41634163

4164+
# Determine if windows modules should be used.
4165+
AC_SUBST(USE_WIN32_MODULE)
4166+
USE_WIN32_MODULE='#'
4167+
case $host in
4168+
*-*-mingw*) USE_WIN32_MODULE=;;
4169+
esac
4170+
41644171
# Templates for things AC_DEFINEd more than once.
41654172
# For a single AC_DEFINE, no template is needed.
41664173
AH_TEMPLATE(_REENTRANT,

0 commit comments

Comments
 (0)