summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuhang Zhao <2546789017@qq.com>2021-10-17 11:19:48 +0800
committerYuhang Zhao <2546789017@qq.com>2021-11-10 20:31:05 +0800
commit6652bf2353d807f724f398a15cb22c188830f57c (patch)
treef3728b8e582a49ab46b2417d1f28fb2f430c2dfa
parenta8be40bd64b9258334d6936b1775bc6631fd158d (diff)
Bump WINVER, _WIN32_WINNT and _WIN32_IE to _WIN32_WINNT_WIN10 (0x0A00)
And bump NTDDI_VERSION to 0x0A00000B (NTDDI_WIN10_CO) at the same time, to unblock the developers from accessing the latest Windows APIs. Pick-to: 6.2 Change-Id: Ifbc28c8f8b073866871685c020301f5f20dc9591 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r--cmake/QtBaseConfigureTests.cmake25
-rw-r--r--cmake/QtBuild.cmake2
-rw-r--r--mkspecs/features/qt_module.prf5
-rw-r--r--src/corelib/global/qt_windows.h29
-rw-r--r--src/corelib/io/qfilesystemengine_win.cpp9
-rw-r--r--src/plugins/platforms/windows/qwin10helpers.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowsdialoghelpers.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowspointerhandler.cpp7
-rw-r--r--src/plugins/platforms/windows/qwindowssystemtrayicon.cpp14
-rw-r--r--src/plugins/platforms/windows/qwindowstheme.cpp5
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp7
-rw-r--r--tests/auto/corelib/io/qdir/tst_qdir.cpp2
-rw-r--r--tests/benchmarks/corelib/thread/qmutex/tst_bench_qmutex.cpp4
13 files changed, 58 insertions, 55 deletions
diff --git a/cmake/QtBaseConfigureTests.cmake b/cmake/QtBaseConfigureTests.cmake
index 717ea1248e..ae16e8e53b 100644
--- a/cmake/QtBaseConfigureTests.cmake
+++ b/cmake/QtBaseConfigureTests.cmake
@@ -138,9 +138,34 @@ VERS_1;
set(TEST_ld_version_script "${HAVE_LD_VERSION_SCRIPT}" CACHE INTERNAL "linker version script support")
endfunction()
+function(qt_internal_ensure_latest_win_nt_api)
+ if(NOT WIN32)
+ return()
+ endif()
+ check_cxx_source_compiles([=[
+ #include <windows.h>
+ #if !defined(_WIN32_WINNT) && !defined(WINVER)
+ #error "_WIN32_WINNT and WINVER are not defined"
+ #endif
+ #if defined(_WIN32_WINNT) && (_WIN32_WINNT < 0x0A00)
+ #error "_WIN32_WINNT version too low"
+ #endif
+ #if defined(WINVER) && (WINVER < 0x0A00)
+ #error "WINVER version too low"
+ #endif
+ int main() { return 0; }
+ ]=] HAVE_WIN10_WIN32_WINNT)
+ if(NOT HAVE_WIN10_WIN32_WINNT)
+ list(APPEND QT_PLATFORM_DEFINITIONS _WIN32_WINNT=0x0A00 WINVER=0x0A00)
+ set(QT_PLATFORM_DEFINITIONS ${QT_PLATFORM_DEFINITIONS}
+ CACHE STRING "Qt platform specific pre-processor defines" FORCE)
+ endif()
+endfunction()
+
function(qt_run_qtbase_config_tests)
qt_run_config_test_architecture()
qt_run_linker_version_script_support()
+ qt_internal_ensure_latest_win_nt_api()
endfunction()
# The qmake build of android does not perform the right architecture tests and
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake
index b2cdd35667..a4d8c49ad1 100644
--- a/cmake/QtBuild.cmake
+++ b/cmake/QtBuild.cmake
@@ -310,7 +310,7 @@ if(WIN32)
endif()
if (MINGW)
- list(APPEND QT_DEFAULT_PLATFORM_DEFINITIONS _WIN32_WINNT=0x0601 MINGW_HAS_SECURE_API=1)
+ list(APPEND QT_DEFAULT_PLATFORM_DEFINITIONS MINGW_HAS_SECURE_API=1)
endif()
elseif(LINUX)
if(GCC)
diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf
index 62d225b14d..8bc1175ebb 100644
--- a/mkspecs/features/qt_module.prf
+++ b/mkspecs/features/qt_module.prf
@@ -345,4 +345,9 @@ msvc {
QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO += /GUARD:CF
}
+win32 {
+ DEFINES *= _WIN32_WINNT=0x0A00
+ DEFINES *= WINVER=0x0A00
+}
+
TARGET = $$qt5LibraryTarget($$TARGET$$QT_LIBINFIX) # Do this towards the end
diff --git a/src/corelib/global/qt_windows.h b/src/corelib/global/qt_windows.h
index 7ffe313f00..15255b9434 100644
--- a/src/corelib/global/qt_windows.h
+++ b/src/corelib/global/qt_windows.h
@@ -45,17 +45,17 @@
#pragma qt_sync_stop_processing
#endif
-#if defined(Q_CC_MINGW)
-// mingw's windows.h does not set _WIN32_WINNT, resulting breaking compilation
-# ifndef WINVER
-# define WINVER 0x601
-# endif
-# ifndef _WIN32_WINNT
-# define _WIN32_WINNT 0x601
-# endif
-# ifndef NTDDI_VERSION
-# define NTDDI_VERSION 0x06010000
-# endif
+#ifndef WINVER
+# define WINVER 0x0A00 // _WIN32_WINNT_WIN10
+#endif
+#ifndef _WIN32_WINNT
+# define _WIN32_WINNT 0x0A00
+#endif
+#ifndef _WIN32_IE
+# define _WIN32_IE 0x0A00
+#endif
+#ifndef NTDDI_VERSION
+# define NTDDI_VERSION 0x0A00000B // NTDDI_WIN10_CO
#endif
#ifndef NOMINMAX
@@ -63,13 +63,6 @@
#endif
#include <windows.h>
-#if defined(_WIN32_IE) && _WIN32_IE < 0x0501
-# undef _WIN32_IE
-#endif
-#if !defined(_WIN32_IE)
-# define _WIN32_IE 0x0501
-#endif
-
// already defined when compiled with WINVER >= 0x0500
#ifndef SPI_SETMENUANIMATION
#define SPI_SETMENUANIMATION 0x1003
diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp
index 9e009a05e7..d2da2082fa 100644
--- a/src/corelib/io/qfilesystemengine_win.cpp
+++ b/src/corelib/io/qfilesystemengine_win.cpp
@@ -627,15 +627,6 @@ QFileSystemEntry QFileSystemEngine::absoluteName(const QFileSystemEntry &entry)
return QFileSystemEntry(ret, QFileSystemEntry::FromInternalPath());
}
-#if defined(Q_CC_MINGW) && WINVER < 0x0602 && _WIN32_WINNT < _WIN32_WINNT_WIN8 // Windows 8 onwards
-
-typedef struct _FILE_ID_INFO {
- ULONGLONG VolumeSerialNumber;
- FILE_ID_128 FileId;
-} FILE_ID_INFO, *PFILE_ID_INFO;
-
-#endif // if defined(Q_CC_MINGW) && WINVER < 0x0602 && _WIN32_WINNT < _WIN32_WINNT_WIN8
-
// File ID for Windows up to version 7 and FAT32 drives
static inline QByteArray fileId(HANDLE handle)
{
diff --git a/src/plugins/platforms/windows/qwin10helpers.cpp b/src/plugins/platforms/windows/qwin10helpers.cpp
index 9a7fce9cd5..b8e834d54f 100644
--- a/src/plugins/platforms/windows/qwin10helpers.cpp
+++ b/src/plugins/platforms/windows/qwin10helpers.cpp
@@ -46,7 +46,7 @@
#if defined(Q_CC_MINGW) || defined(Q_CC_CLANG)
# define HAS_UI_VIEW_SETTINGS_INTEROP
// Present from MSVC2015 + SDK 10 onwards
-#elif (!defined(Q_CC_MSVC) || _MSC_VER >= 1900) && NTDDI_VERSION >= 0xa000000
+#elif (!defined(Q_CC_MSVC) || _MSC_VER >= 1900) && WINVER >= 0x0A00
# define HAS_UI_VIEW_SETTINGS_INTEROP
# define HAS_UI_VIEW_SETTINGS
#endif
diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
index 1ddde93f90..5524129418 100644
--- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
+++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
@@ -40,7 +40,7 @@
#define QT_NO_URL_CAST_FROM_STRING 1
#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x0601
+#define _WIN32_WINNT 0x0A00
#endif
#include "qwindowscombase.h"
diff --git a/src/plugins/platforms/windows/qwindowspointerhandler.cpp b/src/plugins/platforms/windows/qwindowspointerhandler.cpp
index 46fbfcc8d6..efe02139f1 100644
--- a/src/plugins/platforms/windows/qwindowspointerhandler.cpp
+++ b/src/plugins/platforms/windows/qwindowspointerhandler.cpp
@@ -37,11 +37,8 @@
**
****************************************************************************/
-#if defined(WINVER) && WINVER < 0x0603
-# undef WINVER
-#endif
-#if !defined(WINVER)
-# define WINVER 0x0603 // Enable pointer functions for MinGW
+#ifndef WINVER
+# define WINVER 0x0A00 // Enable pointer functions for MinGW
#endif
#include "qwindowspointerhandler.h"
diff --git a/src/plugins/platforms/windows/qwindowssystemtrayicon.cpp b/src/plugins/platforms/windows/qwindowssystemtrayicon.cpp
index 7c473e66b6..0a96d5a0f5 100644
--- a/src/plugins/platforms/windows/qwindowssystemtrayicon.cpp
+++ b/src/plugins/platforms/windows/qwindowssystemtrayicon.cpp
@@ -37,18 +37,12 @@
**
****************************************************************************/
-#if defined(WINVER) && WINVER < 0x0601
-# undef WINVER
-#endif
-#if !defined(WINVER)
-# define WINVER 0x0601 // required for NOTIFYICONDATA_V2_SIZE, ChangeWindowMessageFilterEx() (MinGW 5.3)
+#ifndef WINVER
+# define WINVER 0x0A00 // required for NOTIFYICONDATA_V2_SIZE, ChangeWindowMessageFilterEx() (MinGW 5.3)
#endif
-#if defined(NTDDI_VERSION) && NTDDI_VERSION < 0x06010000
-# undef NTDDI_VERSION
-#endif
-#if !defined(NTDDI_VERSION)
-# define NTDDI_VERSION 0x06010000 // required for Shell_NotifyIconGetRect (MinGW 5.3)
+#ifndef NTDDI_VERSION
+# define NTDDI_VERSION 0x0A00000B // required for Shell_NotifyIconGetRect (MinGW 5.3)
#endif
#include "qwindowssystemtrayicon.h"
diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp
index 6fbf4183da..85b6c30086 100644
--- a/src/plugins/platforms/windows/qwindowstheme.cpp
+++ b/src/plugins/platforms/windows/qwindowstheme.cpp
@@ -38,9 +38,8 @@
****************************************************************************/
// SHSTOCKICONINFO is only available since Vista
-#if _WIN32_WINNT < 0x0601
-# undef _WIN32_WINNT
-# define _WIN32_WINNT 0x0601
+#ifndef _WIN32_WINNT
+# define _WIN32_WINNT 0x0A00
#endif
#include "qwindowstheme.h"
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 92cf8c253e..5988d1498d 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -37,11 +37,8 @@
**
****************************************************************************/
-#if defined(WINVER) && WINVER < 0x0601
-# undef WINVER
-#endif
-#if !defined(WINVER)
-# define WINVER 0x0601 // Enable touch functions for MinGW
+#ifndef WINVER
+# define WINVER 0x0A00 // Enable touch functions for MinGW
#endif
#include "qwindowswindow.h"
diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp
index 8b6b390050..88ccd26611 100644
--- a/tests/auto/corelib/io/qdir/tst_qdir.cpp
+++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp
@@ -45,7 +45,7 @@
#endif
#if defined(Q_OS_WIN) && !defined(_WIN32_WINNT)
-#define _WIN32_WINNT 0x500
+#define _WIN32_WINNT 0x0A00
#endif
#include "../../../../shared/filesystem.h"
diff --git a/tests/benchmarks/corelib/thread/qmutex/tst_bench_qmutex.cpp b/tests/benchmarks/corelib/thread/qmutex/tst_bench_qmutex.cpp
index 987612b7b2..1091ef3251 100644
--- a/tests/benchmarks/corelib/thread/qmutex/tst_bench_qmutex.cpp
+++ b/tests/benchmarks/corelib/thread/qmutex/tst_bench_qmutex.cpp
@@ -76,7 +76,9 @@ void NativeMutexUnlock(NativeMutexType *mutex)
}
#endif
#elif defined(Q_OS_WIN)
-# define _WIN32_WINNT 0x0400
+# if !defined(_WIN32_WINNT)
+# define _WIN32_WINNT 0x0A00
+# endif
# include <windows.h>
typedef CRITICAL_SECTION NativeMutexType;
void NativeMutexInitialize(NativeMutexType *mutex)