From ae7e11e5c6c0e8e9ae03bb8feecf4bcb2d85d72d Mon Sep 17 00:00:00 2001 From: Yuhang Zhao <2546789017@qq.com> Date: Fri, 24 Dec 2021 15:06:01 +0800 Subject: [PATCH] QStandardPaths: Remove old MinGW workaround MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From the comments the workaround is for MinGW older than v7, now our CI has MinGW v9 trunk, it should be safe to drop this. The magic number is replaced by the official function, although it was introduced in Win8, Qt6's minimum supported platform is Win10, so it's also safe to do. As a drive-by, remove two unused includes. Change-Id: I891fe3883f17d4914932784868d7446299d32c65 Reviewed-by: MÃ¥rten Nordheim Reviewed-by: Thiago Macieira --- src/corelib/io/qstandardpaths_win.cpp | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/corelib/io/qstandardpaths_win.cpp b/src/corelib/io/qstandardpaths_win.cpp index 93034dd9b0..0d24ed3ce9 100644 --- a/src/corelib/io/qstandardpaths_win.cpp +++ b/src/corelib/io/qstandardpaths_win.cpp @@ -40,14 +40,12 @@ #include "qstandardpaths.h" #include -#include #include #ifndef QT_BOOTSTRAPPED #include #endif -#include #include #include #include @@ -95,14 +93,7 @@ static inline void appendTestMode(QString &path) } static bool isProcessLowIntegrity() { -#ifdef Q_CC_MINGW - // GetCurrentProcessToken was introduced in MinGW w64 in v7 - // Disable function until Qt CI is updated - return false; -#else - // non-leaking pseudo-handle. Expanded inline function GetCurrentProcessToken() - // (was made an inline function in Windows 8). - const auto process_token = HANDLE(quintptr(-4)); + const HANDLE process_token = GetCurrentProcessToken(); QVarLengthArray token_info_buf(256); auto* token_info = reinterpret_cast(token_info_buf.data()); @@ -119,7 +110,6 @@ static bool isProcessLowIntegrity() { // there's no point in checking before dereferencing DWORD integrity_level = *GetSidSubAuthority(token_info->Label.Sid, *GetSidSubAuthorityCount(token_info->Label.Sid) - 1); return (integrity_level < SECURITY_MANDATORY_MEDIUM_RID); -#endif } // Map QStandardPaths::StandardLocation to KNOWNFOLDERID of SHGetKnownFolderPath()