QStandardPaths/Win: fix build with old MinGW SDK

...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 ae7e11e5c6.

Pick-to: 6.3
Change-Id: I74249c52dc02478ba93cfffd16d23c487229f95d
Reviewed-by: Yuhang Zhao <2546789017@qq.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
This commit is contained in:
Thiago Macieira 2022-02-09 13:44:55 -08:00
parent abf4175436
commit 5e378aaff6

View File

@ -92,8 +92,10 @@ static inline void appendTestMode(QString &path)
path += QLatin1String("/qttest"); path += QLatin1String("/qttest");
} }
static bool isProcessLowIntegrity() { static bool isProcessLowIntegrity()
const HANDLE process_token = GetCurrentProcessToken(); {
// same as GetCurrentProcessToken()
const auto process_token = HANDLE(quintptr(-4));
QVarLengthArray<char,256> token_info_buf(256); QVarLengthArray<char,256> token_info_buf(256);
auto* token_info = reinterpret_cast<TOKEN_MANDATORY_LABEL*>(token_info_buf.data()); auto* token_info = reinterpret_cast<TOKEN_MANDATORY_LABEL*>(token_info_buf.data());