From 5e378aaff61c9708e0657f3ee29517c06cb075fa Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 9 Feb 2022 13:44:55 -0800 Subject: [PATCH] QStandardPaths/Win: fix build with old MinGW SDK MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ...that may lack GetCurrentProcessToken. The definition in the new SDKs is: FORCEINLINE HANDLE GetCurrentProcessToken (VOID) { return (HANDLE)(LONG_PTR) (-4); } This is a partial revert of ae7e11e5c6c0e8e9ae03bb8feecf4bcb2d85d72d. Pick-to: 6.3 Change-Id: I74249c52dc02478ba93cfffd16d23c487229f95d Reviewed-by: Yuhang Zhao <2546789017@qq.com> Reviewed-by: MÃ¥rten Nordheim Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qstandardpaths_win.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/corelib/io/qstandardpaths_win.cpp b/src/corelib/io/qstandardpaths_win.cpp index 2ddf4a5fe1..d191ed33b4 100644 --- a/src/corelib/io/qstandardpaths_win.cpp +++ b/src/corelib/io/qstandardpaths_win.cpp @@ -92,8 +92,10 @@ static inline void appendTestMode(QString &path) path += QLatin1String("/qttest"); } -static bool isProcessLowIntegrity() { - const HANDLE process_token = GetCurrentProcessToken(); +static bool isProcessLowIntegrity() +{ + // same as GetCurrentProcessToken() + const auto process_token = HANDLE(quintptr(-4)); QVarLengthArray token_info_buf(256); auto* token_info = reinterpret_cast(token_info_buf.data());