Skip to content

Commit 203d18e

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 b971ecc commit 203d18e

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
@@ -4165,6 +4165,13 @@ AS_VAR_IF([with_dbmliborder], [error], [
41654165
])
41664166
AC_MSG_RESULT($with_dbmliborder)
41674167

4168+
# Determine if windows modules should be used.
4169+
AC_SUBST(USE_WIN32_MODULE)
4170+
USE_WIN32_MODULE='#'
4171+
case $host in
4172+
*-*-mingw*) USE_WIN32_MODULE=;;
4173+
esac
4174+
41684175
# Templates for things AC_DEFINEd more than once.
41694176
# For a single AC_DEFINE, no template is needed.
41704177
AH_TEMPLATE(_REENTRANT,

0 commit comments

Comments
 (0)