From a8b373d678f44a9d7006a412cabc75e7586b2c43 Mon Sep 17 00:00:00 2001 From: Fredrik Orderud Date: Tue, 5 May 2020 13:59:27 +0200 Subject: qstandardpaths_win.cpp: Fix GetCurrentProcessToken() for Win7 The GetCurrentProcessToken() was made an inline function for Windows 8. Expand it to ensure builds work independent of WINVER and disable low integrity support for Windows 7. Fixes: QTBUG-83941 Task-number: QTBUG-83453 Change-Id: Ic989f16621cd80cbc70c6b62779afab8a12714df Reviewed-by: Fredrik Orderud Reviewed-by: Volker Hilsheimer Reviewed-by: Thiago Macieira --- src/corelib/io/qstandardpaths_win.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/corelib/io/qstandardpaths_win.cpp b/src/corelib/io/qstandardpaths_win.cpp index 5055f4020c..cbe4ccd0b2 100644 --- a/src/corelib/io/qstandardpaths_win.cpp +++ b/src/corelib/io/qstandardpaths_win.cpp @@ -47,6 +47,7 @@ #include #endif +#include #include #include #include @@ -99,7 +100,11 @@ static bool isProcessLowIntegrity() { // Disable function until Qt CI is updated return false; #else - HANDLE process_token = GetCurrentProcessToken(); // non-leaking pseudo-handle + if (QOperatingSystemVersion::current() < QOperatingSystemVersion::Windows8) + return false; + // non-leaking pseudo-handle. Expanded inline function GetCurrentProcessToken() + // (was made an inline function in Windows 8). + const auto process_token = HANDLE(quintptr(-4)); QVarLengthArray token_info_buf(256); auto* token_info = reinterpret_cast(token_info_buf.data()); -- cgit v1.2.3