Skip to content

Commit

Permalink
Build winreg by default when compiling for MINGW
Browse files Browse the repository at this point in the history
Co-authored-by: Алексей <[email protected]>
Co-authored-by: Christoph Reiter <[email protected]>
  • Loading branch information
Alexpux and lazka committed Jul 19, 2023
1 parent 30061bb commit 9092f75
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Modules/Setup.bootstrap.in
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,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
19 changes: 19 additions & 0 deletions PC/winreg.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,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

static BOOL PyHKEY_AsHKEY(PyObject *ob, HKEY *pRes, BOOL bNoneOK);
static BOOL clinic_HKEY_converter(PyObject *ob, void *p);
static PyObject *PyHKEY_FromHKEY(HKEY h);
Expand Down
7 changes: 7 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -4161,6 +4161,13 @@ AS_VAR_IF([with_dbmliborder], [error], [
])
AC_MSG_RESULT($with_dbmliborder)

# 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,
Expand Down

0 comments on commit 9092f75

Please sign in to comment.