QStandardPaths: Remove old MinGW workaround

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 <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Yuhang Zhao 2021-12-24 15:06:01 +08:00
parent 6241dcb9a4
commit ae7e11e5c6

View File

@ -40,14 +40,12 @@
#include "qstandardpaths.h"
#include <qdir.h>
#include <private/qsystemlibrary_p.h>
#include <qstringlist.h>
#ifndef QT_BOOTSTRAPPED
#include <qcoreapplication.h>
#endif
#include <qoperatingsystemversion.h>
#include <qt_windows.h>
#include <shlobj.h>
#include <intshcut.h>
@ -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<char,256> token_info_buf(256);
auto* token_info = reinterpret_cast<TOKEN_MANDATORY_LABEL*>(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()