--- ./PC/_winreg.c.MINGW 2008-08-06 23:36:36.000000000 +0300 +++ ./PC/_winreg.c 2008-09-27 01:00:04.000000000 +0300 @@ -17,6 +17,18 @@ #include "malloc.h" /* for alloca */ #include "windows.h" +#if defined(__MINGW32__) +_CRTIMP size_t __cdecl __MINGW_NOTHROW _mbstrlen(const char *s); +#endif + +#if !defined(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); --- ./PC/msvcrtmodule.c.MINGW 2008-08-06 23:36:36.000000000 +0300 +++ ./PC/msvcrtmodule.c 2008-09-24 22:53:47.000000000 +0300 @@ -22,6 +22,31 @@ #include #include +#if defined(__MINGW32__) +#if __MSVCRT_VERSION__ >= 0x0700 +# define _WCONIO_DEFINED +/* NOTE: Up to version ?.?? mingw don't define functions + * listed below. Also it require module to be linked with + * ms-vcrt at least verion 7. + * To build with different runtimes see: + * http://www.mingw.org/wiki/HOWTO_Use_the_GCC_specs_file + * + * Also note that NT5.1(XP), shiped with msvcrt version 7.0, + * contain all those functions, but libary name is msvcrt.dll. + * So if you like module to run on w2k as is you must define + * appropriate __MSVCRT_VERSION__ . + * If you like those functions even on w2k you must link + * with appropriate runtime and to pack it in distributions. + * This is what native build do - it is build and packed + * with version 9.0 of Microsoft C-runtime. + */ +_CRTIMP wint_t __cdecl __MINGW_NOTHROW _getwch (void); +_CRTIMP wint_t __cdecl __MINGW_NOTHROW _getwche (void); +_CRTIMP wint_t __cdecl __MINGW_NOTHROW _putwch (wchar_t); +_CRTIMP wint_t __cdecl __MINGW_NOTHROW _ungetwch(wint_t); +#endif /* __MSVCRT_VERSION__ >= 0x0700 */ +#endif + // Force the malloc heap to clean itself up, and free unused blocks // back to the OS. (According to the docs, only works on NT.) static PyObject * @@ -252,6 +277,7 @@ if (!PyArg_ParseTuple(args, "u:ungetwch", &ch)) return NULL; + /* FIXME: why call _ungetch */ if (_ungetch(ch) == EOF) return PyErr_SetFromErrno(PyExc_IOError); Py_INCREF(Py_None); --- ./Lib/ctypes/util.py.MINGW 2008-08-06 23:37:08.000000000 +0300 +++ ./Lib/ctypes/util.py 2008-09-27 03:11:36.000000000 +0300 @@ -7,6 +7,11 @@ if os.name == "nt": def _get_build_version(): + #*********************************************************** + # NOTE: As example for GCC(mingw) build sys.version return: + # 2.6rc2+ (trunk:M, ,