[vlc-devel] [3.0 PATCH v2 19/20] modules: set the forced _WIN32_WINNT right after including config.h

Steve Lhomme robux4 at ycbcr.xyz
Thu Apr 2 13:38:17 CEST 2020


config.h and vlc_fixups.h don't include files that use _WIN32_WINNT but any
other VLC or system these files require will likely use this value that is
found in config.h.

Partially cherry-picked from 4cb707be548fd2bbc202beca04826159e8663155
---
 modules/audio_output/mmdevice.c            | 10 +++++-----
 modules/audio_output/wasapi.c              | 10 +++++-----
 modules/codec/avcodec/directx_va.h         |  2 +-
 modules/video_chroma/d3d11_fmt.c           | 10 +++++-----
 modules/video_output/win32/d3d11_quad.c    |  8 ++++----
 modules/video_output/win32/d3d11_shaders.c | 10 +++++-----
 modules/video_output/win32/direct3d11.c    | 10 +++++-----
 modules/video_output/win32/win32touch.h    | 13 ++++++-------
 8 files changed, 36 insertions(+), 37 deletions(-)

diff --git a/modules/audio_output/mmdevice.c b/modules/audio_output/mmdevice.c
index 3642c8265e2..31d8cb9a97c 100644
--- a/modules/audio_output/mmdevice.c
+++ b/modules/audio_output/mmdevice.c
@@ -18,15 +18,15 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#if !defined(_WIN32_WINNT) || _WIN32_WINNT < _WIN32_WINNT_VISTA
-# undef _WIN32_WINNT
-# define _WIN32_WINNT _WIN32_WINNT_VISTA
-#endif
-
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
 
+#if _WIN32_WINNT < 0x0600 // _WIN32_WINNT_VISTA
+# undef _WIN32_WINNT
+# define _WIN32_WINNT _WIN32_WINNT_VISTA
+#endif
+
 #define INITGUID
 #define COBJMACROS
 #define CONST_VTABLE
diff --git a/modules/audio_output/wasapi.c b/modules/audio_output/wasapi.c
index e438e8e8689..60b041db6db 100644
--- a/modules/audio_output/wasapi.c
+++ b/modules/audio_output/wasapi.c
@@ -18,15 +18,15 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#if !defined(_WIN32_WINNT) || _WIN32_WINNT < _WIN32_WINNT_VISTA
-# undef _WIN32_WINNT
-# define _WIN32_WINNT _WIN32_WINNT_VISTA
-#endif
-
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
 
+#if _WIN32_WINNT < 0x0600 // _WIN32_WINNT_VISTA
+# undef _WIN32_WINNT
+# define _WIN32_WINNT _WIN32_WINNT_VISTA
+#endif
+
 #define INITGUID
 #define COBJMACROS
 #define CONST_VTABLE
diff --git a/modules/codec/avcodec/directx_va.h b/modules/codec/avcodec/directx_va.h
index 335cca7bd37..6b66979e019 100644
--- a/modules/codec/avcodec/directx_va.h
+++ b/modules/codec/avcodec/directx_va.h
@@ -28,7 +28,7 @@
 #ifndef AVCODEC_DIRECTX_VA_H
 #define AVCODEC_DIRECTX_VA_H
 
-# if _WIN32_WINNT < _WIN32_WINNT_VISTA
+# if _WIN32_WINNT < 0x0600 // _WIN32_WINNT_VISTA
 /* d3d11 needs Vista support */
 #  undef _WIN32_WINNT
 #  define _WIN32_WINNT _WIN32_WINNT_VISTA
diff --git a/modules/video_chroma/d3d11_fmt.c b/modules/video_chroma/d3d11_fmt.c
index 4a42e29d040..f348699e492 100644
--- a/modules/video_chroma/d3d11_fmt.c
+++ b/modules/video_chroma/d3d11_fmt.c
@@ -20,15 +20,15 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#if !defined(_WIN32_WINNT) || _WIN32_WINNT < _WIN32_WINNT_WIN7
-# undef _WIN32_WINNT
-# define _WIN32_WINNT _WIN32_WINNT_WIN7
-#endif
-
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
 
+#if _WIN32_WINNT < 0x0601 // _WIN32_WINNT_WIN7
+# undef _WIN32_WINNT
+# define _WIN32_WINNT _WIN32_WINNT_WIN7
+#endif
+
 #include <vlc_common.h>
 #include <vlc_picture.h>
 
diff --git a/modules/video_output/win32/d3d11_quad.c b/modules/video_output/win32/d3d11_quad.c
index ca9d31bb592..0e2ff332665 100644
--- a/modules/video_output/win32/d3d11_quad.c
+++ b/modules/video_output/win32/d3d11_quad.c
@@ -24,14 +24,14 @@
 # include "config.h"
 #endif
 
-#include <assert.h>
-#include <vlc_common.h>
-
-#if !defined(_WIN32_WINNT) || _WIN32_WINNT < _WIN32_WINNT_WIN7
+#if _WIN32_WINNT < 0x0601 // _WIN32_WINNT_WIN7
 # undef _WIN32_WINNT
 # define _WIN32_WINNT _WIN32_WINNT_WIN7
 #endif
 
+#include <assert.h>
+#include <vlc_common.h>
+
 #define COBJMACROS
 #include <d3d11.h>
 
diff --git a/modules/video_output/win32/d3d11_shaders.c b/modules/video_output/win32/d3d11_shaders.c
index e79d7117140..72ed6a83b57 100644
--- a/modules/video_output/win32/d3d11_shaders.c
+++ b/modules/video_output/win32/d3d11_shaders.c
@@ -20,15 +20,15 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#if !defined(_WIN32_WINNT) || _WIN32_WINNT < _WIN32_WINNT_WIN7
-# undef _WIN32_WINNT
-# define _WIN32_WINNT _WIN32_WINNT_WIN7
-#endif
-
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
 
+#if _WIN32_WINNT < 0x0601 // _WIN32_WINNT_WIN7
+# undef _WIN32_WINNT
+# define _WIN32_WINNT _WIN32_WINNT_WIN7
+#endif
+
 #include <vlc_common.h>
 
 #include <assert.h>
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 12e38ce2fa3..af11e939a93 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -21,15 +21,15 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#if !defined(_WIN32_WINNT) || _WIN32_WINNT < _WIN32_WINNT_WIN7
-# undef _WIN32_WINNT
-# define _WIN32_WINNT _WIN32_WINNT_WIN7
-#endif
-
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
 
+#if _WIN32_WINNT < 0x0601 // _WIN32_WINNT_WIN7
+# undef _WIN32_WINNT
+# define _WIN32_WINNT _WIN32_WINNT_WIN7
+#endif
+
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_vout_display.h>
diff --git a/modules/video_output/win32/win32touch.h b/modules/video_output/win32/win32touch.h
index ea854282bfe..b9bda93ff8e 100644
--- a/modules/video_output/win32/win32touch.h
+++ b/modules/video_output/win32/win32touch.h
@@ -24,17 +24,16 @@
 #ifndef VLC_GESTURE_H_
 #define VLC_GESTURE_H_
 
-# if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x601
-#  undef _WIN32_WINNT
-#  define _WIN32_WINNT 0x0601
-# endif
-# include <windows.h>
-# include <winuser.h>
-
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
 
+#if _WIN32_WINNT < 0x0601 // _WIN32_WINNT_WIN7
+# undef _WIN32_WINNT
+# define _WIN32_WINNT _WIN32_WINNT_WIN7
+#endif
+#define WINVER _WIN32_WINNT_WIN7
+
 #include <vlc_common.h>
 
 #ifndef WM_GESTURE
-- 
2.17.1



More information about the vlc-devel mailing list