Files
MINGW-packages/mingw-w64-python2/0200-MINGW-build-in-windows-modules-winreg.patch

83 lines
2.4 KiB
Diff

diff -Naur a/configure.ac b/configure.ac
--- a/configure.ac 2014-02-18 09:31:53.526200000 +0400
+++ b/configure.ac 2014-02-18 09:31:53.651000000 +0400
@@ -2442,6 +2442,14 @@
fi])
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
+
# Determine if signalmodule should be used.
AC_SUBST(USE_SIGNAL_MODULE)
AC_SUBST(SIGNAL_OBJS)
diff -Naur a/Modules/Setup.config.in b/Modules/Setup.config.in
--- a/Modules/Setup.config.in 2014-02-18 09:31:51.919400000 +0400
+++ b/Modules/Setup.config.in 2014-02-18 09:31:53.651000000 +0400
@@ -12,5 +12,8 @@
# The signal module
@USE_SIGNAL_MODULE@signal signalmodule.c
+# build-in modules for windows platform:
+@USE_WIN32_MODULE@_winreg ../PC/_winreg.c
+
# The rest of the modules previously listed in this file are built
# by the setup.py script in Python 2.1 and later.
diff -Naur a/PC/_winreg.c b/PC/_winreg.c
--- a/PC/_winreg.c 2013-11-10 11:36:41.000000000 +0400
+++ b/PC/_winreg.c 2014-02-18 09:31:53.666600000 +0400
@@ -17,6 +17,25 @@
#include "malloc.h" /* for alloca */
#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 PyObject *PyHKEY_FromHKEY(HKEY h);
static BOOL PyHKEY_Close(PyObject *obHandle);
@@ -1088,6 +1107,10 @@
static PyObject *
PyDeleteKeyEx(PyObject *self, PyObject *args)
{
+#ifdef KEY_WOW64_64KEY
+/* KEY_WOW64_64KEY is defined for _WIN32_WINNT >= 0x0502,
+ * i.e. Windows Server 2003 with SP1, Windows XP with SP2
+ * and not supported on w2k. */
HKEY hKey;
PyObject *obKey;
HMODULE hMod;
@@ -1123,6 +1146,11 @@
return PyErr_SetFromWindowsErrWithFunction(rc, "RegDeleteKeyEx");
Py_INCREF(Py_None);
return Py_None;
+#else /*def KEY_WOW64_64KEY*/
+ PyErr_SetString(PyExc_NotImplementedError,
+ "not implemented on this platform");
+ return NULL;
+#endif
}
static PyObject *