diff -rupN Python-2.7.13/Python/random.c Python-2.7.13-new/Python/random.c
--- Python-2.7.13/Python/random.c 2016-12-17 21:05:07.000000000 +0100
+++ Python-2.7.13-new/Python/random.c 2017-01-21 01:46:05.094622630 +0100
@@ -1,6 +1,12 @@
#include "Python.h"
#ifdef MS_WINDOWS
#include <windows.h>
+#ifdef __MINGW32__
+/* NOTE: All sample MSDN wincrypt programs include header below as it
+ * is required to ensure that application could be build properly in
+ * all cases. */
+# include <wincrypt.h>
+#endif
#else
#include <fcntl.h>
#if defined(HAVE_GETRANDOM) || defined(HAVE_GETENTROPY)