forked from qt-creator/qt-creator
Utils: Make Utils::is64BitWindowsBinary operate on FilePaths
Change-Id: I8ef840219bc93f77f5a55e38013facf892de759d Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -24,6 +24,8 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "winutils.h"
|
||||
|
||||
#include "filepath.h"
|
||||
#include "qtcassert.h"
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
@@ -152,16 +154,16 @@ QTCREATOR_UTILS_EXPORT bool is64BitWindowsSystem()
|
||||
#endif
|
||||
}
|
||||
|
||||
QTCREATOR_UTILS_EXPORT bool is64BitWindowsBinary(const QString &binaryIn)
|
||||
QTCREATOR_UTILS_EXPORT bool is64BitWindowsBinary(const FilePath &binaryIn)
|
||||
{
|
||||
QTC_ASSERT(!binaryIn.isEmpty(), return false);
|
||||
QTC_ASSERT(!binaryIn.isEmpty() && !binaryIn.needsDevice(), return false);
|
||||
#ifdef Q_OS_WIN32
|
||||
# ifdef __GNUC__ // MinGW lacking some definitions/winbase.h
|
||||
# define SCS_64BIT_BINARY 6
|
||||
# endif
|
||||
bool isAmd64 = false;
|
||||
DWORD binaryType = 0;
|
||||
const QString binary = QDir::toNativeSeparators(binaryIn);
|
||||
const QString binary = binaryIn.deviceLocalPath();
|
||||
bool success = GetBinaryTypeW(reinterpret_cast<const TCHAR*>(binary.utf16()), &binaryType) != 0;
|
||||
if (success && binaryType == SCS_64BIT_BINARY)
|
||||
isAmd64=true;
|
||||
|
||||
Reference in New Issue
Block a user