diff --git a/src/w32fns.c b/src/w32fns.c
index 3e4a8c475b7..7d288ce7bd5 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -47,6 +47,13 @@ along with GNU Emacs. If not, see . */
#include "w32inevt.h"
#ifdef WINDOWSNT
+/* mingw.org's MinGW headers mistakenly omit this enumeration: */
+# ifndef MINGW_W64
+typedef enum _WTS_VIRTUAL_CLASS {
+ WTSVirtualClientData,
+ WTSVirtualFileHandle
+} WTS_VIRTUAL_CLASS;
+# endif
#include
#include /* for _getmbcp */
#include /* for WTS(Un)RegisterSessionNotification */
diff --git a/src/w32xfns.c b/src/w32xfns.c
index 3d7a1514f72..853c8368118 100644
--- a/src/w32xfns.c
+++ b/src/w32xfns.c
@@ -22,6 +22,17 @@ along with GNU Emacs. If not, see . */
#include
#include
#include
+/* Override API version to get the required functionality. */
+#undef _WIN32_WINNT
+#define _WIN32_WINNT 0x0501
+/* mingw.org's MinGW headers mistakenly omit this enumeration: */
+# ifndef MINGW_W64
+typedef enum _WTS_VIRTUAL_CLASS {
+ WTSVirtualClientData,
+ WTSVirtualFileHandle
+} WTS_VIRTUAL_CLASS;
+# endif
+#include /* for WM_WTSSESSION_CHANGE, WTS_SESSION_LOCK */
#include "lisp.h"
#include "frame.h"